diff --git a/packages/react/src/utils/createStyleContext.tsx b/packages/react/src/utils/createStyleContext.tsx index 7f71ce7bc..8cccebcb9 100644 --- a/packages/react/src/utils/createStyleContext.tsx +++ b/packages/react/src/utils/createStyleContext.tsx @@ -2,12 +2,14 @@ import clsx from "clsx"; import { createContext, forwardRef, useContext } from "react"; type Recipe< - Props extends Record, + Props extends Record, Classnames extends Record, -> = (props?: Props) => Classnames; +> = ((props?: Props) => Classnames) & { + splitVariantProps: (props: T) => [Props, Omit]; +}; export function createStyleContext< - Props extends Record, + Props extends Record, Classnames extends Record, >(recipe: Recipe) { const ClassNamesContext = createContext(null); @@ -50,14 +52,15 @@ export function createStyleContext< const StyledComponent = forwardRef((innerProps, ref) => { const props = { ...(defaultProps ?? {}), ...useProps(), ...innerProps } as any; // TODO: use Props type instead of any after implementing splitRecipeProps() - const classNames = recipe(props); // TODO: classNames are generated on all props; we have to split recipeProps and others. should be resolved in qvism. + const [variantProps, otherProps] = recipe.splitVariantProps(props); + const classNames = recipe(variantProps); // TODO: classNames are generated on all props; we have to split recipeProps and others. should be resolved in qvism. const className = classNames[slot as keyof typeof classNames]; return ( {/* TODO: implement splitRecipeProps() method and spread splitted props */} {/* @ts-ignore */} - + ); }); diff --git a/packages/recipe/lib/actionButton.d.ts b/packages/recipe/lib/actionButton.d.ts index e72e1c53f..04d424d4d 100644 --- a/packages/recipe/lib/actionButton.d.ts +++ b/packages/recipe/lib/actionButton.d.ts @@ -1,4 +1,4 @@ -interface ActionButtonVariant { +declare interface ActionButtonVariant { /** * @default brandSolid */ @@ -13,16 +13,20 @@ interface ActionButtonVariant { layout: "withText" | "iconOnly"; } -type ActionButtonVariantMap = { +declare type ActionButtonVariantMap = { [key in keyof ActionButtonVariant]: Array; }; -export type ActionButtonVariantProps = Partial; +export declare type ActionButtonVariantProps = Partial; -export type ActionButtonSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "progressCircle"; +export declare type ActionButtonSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "progressCircle"; -export const actionButtonVariantMap: ActionButtonVariantMap; +export declare const actionButtonVariantMap: ActionButtonVariantMap; -export function actionButton( +export declare const actionButton: (( props?: ActionButtonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ActionButtonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/actionButton.mjs b/packages/recipe/lib/actionButton.mjs index 6ca53a03f..99ec9ae1d 100644 --- a/packages/recipe/lib/actionButton.mjs +++ b/packages/recipe/lib/actionButton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const actionButtonSlotNames = [ [ @@ -101,4 +102,6 @@ export function actionButton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(actionButton, { splitVariantProps: (props) => splitVariantProps(props, actionButtonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/actionChip.d.ts b/packages/recipe/lib/actionChip.d.ts index 4767b176a..622714819 100644 --- a/packages/recipe/lib/actionChip.d.ts +++ b/packages/recipe/lib/actionChip.d.ts @@ -1,4 +1,4 @@ -interface ActionChipVariant { +declare interface ActionChipVariant { /** * @default medium */ @@ -9,16 +9,20 @@ interface ActionChipVariant { layout: "withText" | "iconOnly"; } -type ActionChipVariantMap = { +declare type ActionChipVariantMap = { [key in keyof ActionChipVariant]: Array; }; -export type ActionChipVariantProps = Partial; +export declare type ActionChipVariantProps = Partial; -export type ActionChipSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "count"; +export declare type ActionChipSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "count"; -export const actionChipVariantMap: ActionChipVariantMap; +export declare const actionChipVariantMap: ActionChipVariantMap; -export function actionChip( +export declare const actionChip: (( props?: ActionChipVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ActionChipVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/actionChip.mjs b/packages/recipe/lib/actionChip.mjs index 3a38bc980..efc01f610 100644 --- a/packages/recipe/lib/actionChip.mjs +++ b/packages/recipe/lib/actionChip.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const actionChipSlotNames = [ [ @@ -74,4 +75,6 @@ export function actionChip(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(actionChip, { splitVariantProps: (props) => splitVariantProps(props, actionChipVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/actionSheet.d.ts b/packages/recipe/lib/actionSheet.d.ts index 4d4d80549..baa8ea527 100644 --- a/packages/recipe/lib/actionSheet.d.ts +++ b/packages/recipe/lib/actionSheet.d.ts @@ -1,17 +1,21 @@ -interface ActionSheetVariant { +declare interface ActionSheetVariant { } -type ActionSheetVariantMap = { +declare type ActionSheetVariantMap = { [key in keyof ActionSheetVariant]: Array; }; -export type ActionSheetVariantProps = Partial; +export declare type ActionSheetVariantProps = Partial; -export type ActionSheetSlotName = "backdrop" | "container" | "content" | "list" | "group" | "footer"; +export declare type ActionSheetSlotName = "backdrop" | "container" | "content" | "list" | "group" | "footer"; -export const actionSheetVariantMap: ActionSheetVariantMap; +export declare const actionSheetVariantMap: ActionSheetVariantMap; -export function actionSheet( +export declare const actionSheet: (( props?: ActionSheetVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ActionSheetVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/actionSheet.mjs b/packages/recipe/lib/actionSheet.mjs index 0f03e69e7..a2bea81be 100644 --- a/packages/recipe/lib/actionSheet.mjs +++ b/packages/recipe/lib/actionSheet.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const actionSheetSlotNames = [ [ @@ -45,4 +46,6 @@ export function actionSheet(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(actionSheet, { splitVariantProps: (props) => splitVariantProps(props, actionSheetVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/actionSheetCloseButton.d.ts b/packages/recipe/lib/actionSheetCloseButton.d.ts index 120e5a68d..271f8b330 100644 --- a/packages/recipe/lib/actionSheetCloseButton.d.ts +++ b/packages/recipe/lib/actionSheetCloseButton.d.ts @@ -1,17 +1,21 @@ -interface ActionSheetCloseButtonVariant { +declare interface ActionSheetCloseButtonVariant { } -type ActionSheetCloseButtonVariantMap = { +declare type ActionSheetCloseButtonVariantMap = { [key in keyof ActionSheetCloseButtonVariant]: Array; }; -export type ActionSheetCloseButtonVariantProps = Partial; +export declare type ActionSheetCloseButtonVariantProps = Partial; -export type ActionSheetCloseButtonSlotName = "root" | "label"; +export declare type ActionSheetCloseButtonSlotName = "root" | "label"; -export const actionSheetCloseButtonVariantMap: ActionSheetCloseButtonVariantMap; +export declare const actionSheetCloseButtonVariantMap: ActionSheetCloseButtonVariantMap; -export function actionSheetCloseButton( +export declare const actionSheetCloseButton: (( props?: ActionSheetCloseButtonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ActionSheetCloseButtonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/actionSheetCloseButton.mjs b/packages/recipe/lib/actionSheetCloseButton.mjs index 0c8d9fbe3..e6a2f7244 100644 --- a/packages/recipe/lib/actionSheetCloseButton.mjs +++ b/packages/recipe/lib/actionSheetCloseButton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const actionSheetCloseButtonSlotNames = [ [ @@ -29,4 +30,6 @@ export function actionSheetCloseButton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(actionSheetCloseButton, { splitVariantProps: (props) => splitVariantProps(props, actionSheetCloseButtonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/actionSheetItem.d.ts b/packages/recipe/lib/actionSheetItem.d.ts index 727284445..8b18e86c7 100644 --- a/packages/recipe/lib/actionSheetItem.d.ts +++ b/packages/recipe/lib/actionSheetItem.d.ts @@ -1,20 +1,24 @@ -interface ActionSheetItemVariant { +declare interface ActionSheetItemVariant { /** * @default neutral */ tone: "neutral" | "danger"; } -type ActionSheetItemVariantMap = { +declare type ActionSheetItemVariantMap = { [key in keyof ActionSheetItemVariant]: Array; }; -export type ActionSheetItemVariantProps = Partial; +export declare type ActionSheetItemVariantProps = Partial; -export type ActionSheetItemSlotName = "root" | "prefixIcon" | "label"; +export declare type ActionSheetItemSlotName = "root" | "prefixIcon" | "label"; -export const actionSheetItemVariantMap: ActionSheetItemVariantMap; +export declare const actionSheetItemVariantMap: ActionSheetItemVariantMap; -export function actionSheetItem( +export declare const actionSheetItem: (( props?: ActionSheetItemVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ActionSheetItemVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/actionSheetItem.mjs b/packages/recipe/lib/actionSheetItem.mjs index 90e1ea1f7..85fa35496 100644 --- a/packages/recipe/lib/actionSheetItem.mjs +++ b/packages/recipe/lib/actionSheetItem.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const actionSheetItemSlotNames = [ [ @@ -40,4 +41,6 @@ export function actionSheetItem(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(actionSheetItem, { splitVariantProps: (props) => splitVariantProps(props, actionSheetItemVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/avatar.d.ts b/packages/recipe/lib/avatar.d.ts index 985ccef0f..f6f00a8ad 100644 --- a/packages/recipe/lib/avatar.d.ts +++ b/packages/recipe/lib/avatar.d.ts @@ -1,20 +1,24 @@ -interface AvatarVariant { +declare interface AvatarVariant { /** * @default 48 */ size: "20" | "24" | "36" | "48" | "64" | "80" | "96"; } -type AvatarVariantMap = { +declare type AvatarVariantMap = { [key in keyof AvatarVariant]: Array; }; -export type AvatarVariantProps = Partial; +export declare type AvatarVariantProps = Partial; -export type AvatarSlotName = "root" | "image" | "fallback" | "badge"; +export declare type AvatarSlotName = "root" | "image" | "fallback" | "badge"; -export const avatarVariantMap: AvatarVariantMap; +export declare const avatarVariantMap: AvatarVariantMap; -export function avatar( +export declare const avatar: (( props?: AvatarVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [AvatarVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/avatar.mjs b/packages/recipe/lib/avatar.mjs index ba1de1c6b..be2c3b899 100644 --- a/packages/recipe/lib/avatar.mjs +++ b/packages/recipe/lib/avatar.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const avatarSlotNames = [ [ @@ -49,4 +50,6 @@ export function avatar(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(avatar, { splitVariantProps: (props) => splitVariantProps(props, avatarVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/avatarStack.d.ts b/packages/recipe/lib/avatarStack.d.ts index 6828442b4..199317708 100644 --- a/packages/recipe/lib/avatarStack.d.ts +++ b/packages/recipe/lib/avatarStack.d.ts @@ -1,20 +1,24 @@ -interface AvatarStackVariant { +declare interface AvatarStackVariant { /** * @default 48 */ size: "20" | "24" | "36" | "48" | "64"; } -type AvatarStackVariantMap = { +declare type AvatarStackVariantMap = { [key in keyof AvatarStackVariant]: Array; }; -export type AvatarStackVariantProps = Partial; +export declare type AvatarStackVariantProps = Partial; -export type AvatarStackSlotName = "root" | "item"; +export declare type AvatarStackSlotName = "root" | "item"; -export const avatarStackVariantMap: AvatarStackVariantMap; +export declare const avatarStackVariantMap: AvatarStackVariantMap; -export function avatarStack( +export declare const avatarStack: (( props?: AvatarStackVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [AvatarStackVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/avatarStack.mjs b/packages/recipe/lib/avatarStack.mjs index 81f052b22..142e8be41 100644 --- a/packages/recipe/lib/avatarStack.mjs +++ b/packages/recipe/lib/avatarStack.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const avatarStackSlotNames = [ [ @@ -39,4 +40,6 @@ export function avatarStack(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(avatarStack, { splitVariantProps: (props) => splitVariantProps(props, avatarStackVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/badge.d.ts b/packages/recipe/lib/badge.d.ts index 8524c0985..f0c909d7b 100644 --- a/packages/recipe/lib/badge.d.ts +++ b/packages/recipe/lib/badge.d.ts @@ -1,4 +1,4 @@ -interface BadgeVariant { +declare interface BadgeVariant { /** * @default medium */ @@ -17,16 +17,20 @@ interface BadgeVariant { tone: "neutral" | "brand" | "informative" | "positive" | "danger"; } -type BadgeVariantMap = { +declare type BadgeVariantMap = { [key in keyof BadgeVariant]: Array; }; -export type BadgeVariantProps = Partial; +export declare type BadgeVariantProps = Partial; -export type BadgeSlotName = "root" | "label"; +export declare type BadgeSlotName = "root" | "label"; -export const badgeVariantMap: BadgeVariantMap; +export declare const badgeVariantMap: BadgeVariantMap; -export function badge( +export declare const badge: (( props?: BadgeVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [BadgeVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/badge.mjs b/packages/recipe/lib/badge.mjs index 8b7ed3412..e8dd1ab9c 100644 --- a/packages/recipe/lib/badge.mjs +++ b/packages/recipe/lib/badge.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const badgeSlotNames = [ [ @@ -124,4 +125,6 @@ export function badge(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(badge, { splitVariantProps: (props) => splitVariantProps(props, badgeVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/bottomSheet.d.ts b/packages/recipe/lib/bottomSheet.d.ts index b13320545..1d16b7f2f 100644 --- a/packages/recipe/lib/bottomSheet.d.ts +++ b/packages/recipe/lib/bottomSheet.d.ts @@ -1,17 +1,21 @@ -interface BottomSheetVariant { +declare interface BottomSheetVariant { } -type BottomSheetVariantMap = { +declare type BottomSheetVariantMap = { [key in keyof BottomSheetVariant]: Array; }; -export type BottomSheetVariantProps = Partial; +export declare type BottomSheetVariantProps = Partial; -export type BottomSheetSlotName = "backdrop" | "container" | "content" | "header" | "footer" | "title" | "description" | "closeButton" | "closeIcon"; +export declare type BottomSheetSlotName = "backdrop" | "container" | "content" | "header" | "footer" | "title" | "description" | "closeButton" | "closeIcon"; -export const bottomSheetVariantMap: BottomSheetVariantMap; +export declare const bottomSheetVariantMap: BottomSheetVariantMap; -export function bottomSheet( +export declare const bottomSheet: (( props?: BottomSheetVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [BottomSheetVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/bottomSheet.mjs b/packages/recipe/lib/bottomSheet.mjs index c41061d17..d86b5dfd9 100644 --- a/packages/recipe/lib/bottomSheet.mjs +++ b/packages/recipe/lib/bottomSheet.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const bottomSheetSlotNames = [ [ @@ -57,4 +58,6 @@ export function bottomSheet(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(bottomSheet, { splitVariantProps: (props) => splitVariantProps(props, bottomSheetVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/callout.d.ts b/packages/recipe/lib/callout.d.ts index 64a35001a..a2b247afd 100644 --- a/packages/recipe/lib/callout.d.ts +++ b/packages/recipe/lib/callout.d.ts @@ -1,20 +1,24 @@ -interface CalloutVariant { +declare interface CalloutVariant { /** * @default neutral */ variant: "neutral" | "informative" | "warning" | "danger" | "magic"; } -type CalloutVariantMap = { +declare type CalloutVariantMap = { [key in keyof CalloutVariant]: Array; }; -export type CalloutVariantProps = Partial; +export declare type CalloutVariantProps = Partial; -export type CalloutSlotName = "root" | "icon" | "title" | "spacer" | "label" | "linkLabel" | "actionableIcon" | "dismissButton" | "dismissIcon"; +export declare type CalloutSlotName = "root" | "icon" | "title" | "spacer" | "label" | "linkLabel" | "actionableIcon" | "dismissButton" | "dismissIcon"; -export const calloutVariantMap: CalloutVariantMap; +export declare const calloutVariantMap: CalloutVariantMap; -export function callout( +export declare const callout: (( props?: CalloutVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [CalloutVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/callout.mjs b/packages/recipe/lib/callout.mjs index 2e780309d..7d4841351 100644 --- a/packages/recipe/lib/callout.mjs +++ b/packages/recipe/lib/callout.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const calloutSlotNames = [ [ @@ -67,4 +68,6 @@ export function callout(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(callout, { splitVariantProps: (props) => splitVariantProps(props, calloutVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/checkbox.d.ts b/packages/recipe/lib/checkbox.d.ts index b0c2ab9cc..2e221ebbf 100644 --- a/packages/recipe/lib/checkbox.d.ts +++ b/packages/recipe/lib/checkbox.d.ts @@ -1,4 +1,4 @@ -interface CheckboxVariant { +declare interface CheckboxVariant { /** * @default default */ @@ -17,16 +17,20 @@ interface CheckboxVariant { size: "large" | "medium" | "small"; } -type CheckboxVariantMap = { +declare type CheckboxVariantMap = { [key in keyof CheckboxVariant]: Array; }; -export type CheckboxVariantProps = Partial; +export declare type CheckboxVariantProps = Partial; -export type CheckboxSlotName = "root" | "control" | "icon" | "label"; +export declare type CheckboxSlotName = "root" | "control" | "icon" | "label"; -export const checkboxVariantMap: CheckboxVariantMap; +export declare const checkboxVariantMap: CheckboxVariantMap; -export function checkbox( +export declare const checkbox: (( props?: CheckboxVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [CheckboxVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/checkbox.mjs b/packages/recipe/lib/checkbox.mjs index 0c2f0fba5..0001754f3 100644 --- a/packages/recipe/lib/checkbox.mjs +++ b/packages/recipe/lib/checkbox.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const checkboxSlotNames = [ [ @@ -85,4 +86,6 @@ export function checkbox(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(checkbox, { splitVariantProps: (props) => splitVariantProps(props, checkboxVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/chipTab.d.ts b/packages/recipe/lib/chipTab.d.ts index ff16c00fa..e11b010ab 100644 --- a/packages/recipe/lib/chipTab.d.ts +++ b/packages/recipe/lib/chipTab.d.ts @@ -1,20 +1,24 @@ -interface ChipTabVariant { +declare interface ChipTabVariant { /** * @default neutralSolid */ variant: "neutralSolid" | "brandSolid"; } -type ChipTabVariantMap = { +declare type ChipTabVariantMap = { [key in keyof ChipTabVariant]: Array; }; -export type ChipTabVariantProps = Partial; +export declare type ChipTabVariantProps = Partial; -export type ChipTabSlotName = "root" | "label"; +export declare type ChipTabSlotName = "root" | "label"; -export const chipTabVariantMap: ChipTabVariantMap; +export declare const chipTabVariantMap: ChipTabVariantMap; -export function chipTab( +export declare const chipTab: (( props?: ChipTabVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ChipTabVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/chipTab.mjs b/packages/recipe/lib/chipTab.mjs index 3e51abcb3..35ca19edd 100644 --- a/packages/recipe/lib/chipTab.mjs +++ b/packages/recipe/lib/chipTab.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const chipTabSlotNames = [ [ @@ -36,4 +37,6 @@ export function chipTab(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(chipTab, { splitVariantProps: (props) => splitVariantProps(props, chipTabVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/chipTabs.d.ts b/packages/recipe/lib/chipTabs.d.ts index 3f4965f89..af57d62a2 100644 --- a/packages/recipe/lib/chipTabs.d.ts +++ b/packages/recipe/lib/chipTabs.d.ts @@ -1,20 +1,24 @@ -interface ChipTabsVariant { +declare interface ChipTabsVariant { /** * @default neutralSolid */ variant: "neutralSolid" | "brandSolid"; } -type ChipTabsVariantMap = { +declare type ChipTabsVariantMap = { [key in keyof ChipTabsVariant]: Array; }; -export type ChipTabsVariantProps = Partial; +export declare type ChipTabsVariantProps = Partial; -export type ChipTabsSlotName = "root" | "triggerList" | "contentList" | "contentCamera" | "content"; +export declare type ChipTabsSlotName = "root" | "triggerList" | "contentList" | "contentCamera" | "content"; -export const chipTabsVariantMap: ChipTabsVariantMap; +export declare const chipTabsVariantMap: ChipTabsVariantMap; -export function chipTabs( +export declare const chipTabs: (( props?: ChipTabsVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ChipTabsVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/chipTabs.mjs b/packages/recipe/lib/chipTabs.mjs index 775a58692..d018b14a6 100644 --- a/packages/recipe/lib/chipTabs.mjs +++ b/packages/recipe/lib/chipTabs.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const chipTabsSlotNames = [ [ @@ -48,4 +49,6 @@ export function chipTabs(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(chipTabs, { splitVariantProps: (props) => splitVariantProps(props, chipTabsVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/controlChip.d.ts b/packages/recipe/lib/controlChip.d.ts index e68eb45bf..0f44835d1 100644 --- a/packages/recipe/lib/controlChip.d.ts +++ b/packages/recipe/lib/controlChip.d.ts @@ -1,4 +1,4 @@ -interface ControlChipVariant { +declare interface ControlChipVariant { /** * @default medium */ @@ -9,16 +9,20 @@ interface ControlChipVariant { layout: "withText" | "iconOnly"; } -type ControlChipVariantMap = { +declare type ControlChipVariantMap = { [key in keyof ControlChipVariant]: Array; }; -export type ControlChipVariantProps = Partial; +export declare type ControlChipVariantProps = Partial; -export type ControlChipSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "count"; +export declare type ControlChipSlotName = "root" | "label" | "icon" | "prefixIcon" | "suffixIcon" | "count"; -export const controlChipVariantMap: ControlChipVariantMap; +export declare const controlChipVariantMap: ControlChipVariantMap; -export function controlChip( +export declare const controlChip: (( props?: ControlChipVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ControlChipVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/controlChip.mjs b/packages/recipe/lib/controlChip.mjs index e2b5d8d86..485408e45 100644 --- a/packages/recipe/lib/controlChip.mjs +++ b/packages/recipe/lib/controlChip.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const controlChipSlotNames = [ [ @@ -74,4 +75,6 @@ export function controlChip(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(controlChip, { splitVariantProps: (props) => splitVariantProps(props, controlChipVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/dialog.d.ts b/packages/recipe/lib/dialog.d.ts index 120e5ba46..b7f74fca0 100644 --- a/packages/recipe/lib/dialog.d.ts +++ b/packages/recipe/lib/dialog.d.ts @@ -1,20 +1,24 @@ -interface DialogVariant { +declare interface DialogVariant { /** * @default horizontal */ footerLayout: "horizontal" | "vertical"; } -type DialogVariantMap = { +declare type DialogVariantMap = { [key in keyof DialogVariant]: Array; }; -export type DialogVariantProps = Partial; +export declare type DialogVariantProps = Partial; -export type DialogSlotName = "backdrop" | "container" | "content" | "header" | "footer" | "action" | "title" | "description"; +export declare type DialogSlotName = "backdrop" | "container" | "content" | "header" | "footer" | "action" | "title" | "description"; -export const dialogVariantMap: DialogVariantMap; +export declare const dialogVariantMap: DialogVariantMap; -export function dialog( +export declare const dialog: (( props?: DialogVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [DialogVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/dialog.mjs b/packages/recipe/lib/dialog.mjs index 6894bacb9..bc720d01c 100644 --- a/packages/recipe/lib/dialog.mjs +++ b/packages/recipe/lib/dialog.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const dialogSlotNames = [ [ @@ -60,4 +61,6 @@ export function dialog(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(dialog, { splitVariantProps: (props) => splitVariantProps(props, dialogVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/extendedFab.d.ts b/packages/recipe/lib/extendedFab.d.ts index ee9b53a7d..e875c9c84 100644 --- a/packages/recipe/lib/extendedFab.d.ts +++ b/packages/recipe/lib/extendedFab.d.ts @@ -1,4 +1,4 @@ -interface ExtendedFabVariant { +declare interface ExtendedFabVariant { /** * @default neutralSolid */ @@ -9,16 +9,20 @@ interface ExtendedFabVariant { size: "small" | "medium"; } -type ExtendedFabVariantMap = { +declare type ExtendedFabVariantMap = { [key in keyof ExtendedFabVariant]: Array; }; -export type ExtendedFabVariantProps = Partial; +export declare type ExtendedFabVariantProps = Partial; -export type ExtendedFabSlotName = "root" | "label" | "prefixIcon"; +export declare type ExtendedFabSlotName = "root" | "label" | "prefixIcon"; -export const extendedFabVariantMap: ExtendedFabVariantMap; +export declare const extendedFabVariantMap: ExtendedFabVariantMap; -export function extendedFab( +export declare const extendedFab: (( props?: ExtendedFabVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ExtendedFabVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/extendedFab.mjs b/packages/recipe/lib/extendedFab.mjs index 8dc3ea5c4..52cf8c5d7 100644 --- a/packages/recipe/lib/extendedFab.mjs +++ b/packages/recipe/lib/extendedFab.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const extendedFabSlotNames = [ [ @@ -45,4 +46,6 @@ export function extendedFab(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(extendedFab, { splitVariantProps: (props) => splitVariantProps(props, extendedFabVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/fab.d.ts b/packages/recipe/lib/fab.d.ts index 86998f032..2d51df77c 100644 --- a/packages/recipe/lib/fab.d.ts +++ b/packages/recipe/lib/fab.d.ts @@ -1,20 +1,24 @@ -interface FabVariant { +declare interface FabVariant { /** * @default medium */ size: "small" | "medium"; } -type FabVariantMap = { +declare type FabVariantMap = { [key in keyof FabVariant]: Array; }; -export type FabVariantProps = Partial; +export declare type FabVariantProps = Partial; -export type FabSlotName = "root" | "icon"; +export declare type FabSlotName = "root" | "icon"; -export const fabVariantMap: FabVariantMap; +export declare const fabVariantMap: FabVariantMap; -export function fab( +export declare const fab: (( props?: FabVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [FabVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/fab.mjs b/packages/recipe/lib/fab.mjs index ca9f28267..1f2c9a83b 100644 --- a/packages/recipe/lib/fab.mjs +++ b/packages/recipe/lib/fab.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const fabSlotNames = [ [ @@ -36,4 +37,6 @@ export function fab(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(fab, { splitVariantProps: (props) => splitVariantProps(props, fabVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/helpBubble.d.ts b/packages/recipe/lib/helpBubble.d.ts index 5a43d0a1f..a9cb08d5a 100644 --- a/packages/recipe/lib/helpBubble.d.ts +++ b/packages/recipe/lib/helpBubble.d.ts @@ -1,17 +1,21 @@ -interface HelpBubbleVariant { +declare interface HelpBubbleVariant { } -type HelpBubbleVariantMap = { +declare type HelpBubbleVariantMap = { [key in keyof HelpBubbleVariant]: Array; }; -export type HelpBubbleVariantProps = Partial; +export declare type HelpBubbleVariantProps = Partial; -export type HelpBubbleSlotName = "positioner" | "backdrop" | "content" | "arrow" | "title" | "description" | "closeButton" | "closeIcon"; +export declare type HelpBubbleSlotName = "positioner" | "backdrop" | "content" | "arrow" | "title" | "description" | "closeButton" | "closeIcon"; -export const helpBubbleVariantMap: HelpBubbleVariantMap; +export declare const helpBubbleVariantMap: HelpBubbleVariantMap; -export function helpBubble( +export declare const helpBubble: (( props?: HelpBubbleVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [HelpBubbleVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/helpBubble.mjs b/packages/recipe/lib/helpBubble.mjs index 80d1c3f53..5f1ca075d 100644 --- a/packages/recipe/lib/helpBubble.mjs +++ b/packages/recipe/lib/helpBubble.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const helpBubbleSlotNames = [ [ @@ -53,4 +54,6 @@ export function helpBubble(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(helpBubble, { splitVariantProps: (props) => splitVariantProps(props, helpBubbleVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/identityPlaceholder.d.ts b/packages/recipe/lib/identityPlaceholder.d.ts index 2e26277bd..2209551fa 100644 --- a/packages/recipe/lib/identityPlaceholder.d.ts +++ b/packages/recipe/lib/identityPlaceholder.d.ts @@ -1,20 +1,24 @@ -interface IdentityPlaceholderVariant { +declare interface IdentityPlaceholderVariant { /** * @default person */ identity: "person"; } -type IdentityPlaceholderVariantMap = { +declare type IdentityPlaceholderVariantMap = { [key in keyof IdentityPlaceholderVariant]: Array; }; -export type IdentityPlaceholderVariantProps = Partial; +export declare type IdentityPlaceholderVariantProps = Partial; -export type IdentityPlaceholderSlotName = "root" | "image"; +export declare type IdentityPlaceholderSlotName = "root" | "image"; -export const identityPlaceholderVariantMap: IdentityPlaceholderVariantMap; +export declare const identityPlaceholderVariantMap: IdentityPlaceholderVariantMap; -export function identityPlaceholder( +export declare const identityPlaceholder: (( props?: IdentityPlaceholderVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [IdentityPlaceholderVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/identityPlaceholder.mjs b/packages/recipe/lib/identityPlaceholder.mjs index 7eae77fdf..d932d56e1 100644 --- a/packages/recipe/lib/identityPlaceholder.mjs +++ b/packages/recipe/lib/identityPlaceholder.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const identityPlaceholderSlotNames = [ [ @@ -35,4 +36,6 @@ export function identityPlaceholder(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(identityPlaceholder, { splitVariantProps: (props) => splitVariantProps(props, identityPlaceholderVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/inlineBanner.d.ts b/packages/recipe/lib/inlineBanner.d.ts index 3f3242eca..b9151d87e 100644 --- a/packages/recipe/lib/inlineBanner.d.ts +++ b/packages/recipe/lib/inlineBanner.d.ts @@ -1,20 +1,24 @@ -interface InlineBannerVariant { +declare interface InlineBannerVariant { /** * @default neutralWeak */ variant: "neutralWeak" | "positiveWeak" | "informativeWeak" | "warningWeak" | "warningSolid" | "dangerWeak" | "dangerSolid"; } -type InlineBannerVariantMap = { +declare type InlineBannerVariantMap = { [key in keyof InlineBannerVariant]: Array; }; -export type InlineBannerVariantProps = Partial; +export declare type InlineBannerVariantProps = Partial; -export type InlineBannerSlotName = "root" | "content" | "icon" | "title" | "spacer" | "label" | "linkLabel" | "actionableIcon" | "dismissButton" | "dismissIcon"; +export declare type InlineBannerSlotName = "root" | "content" | "icon" | "title" | "spacer" | "label" | "linkLabel" | "actionableIcon" | "dismissButton" | "dismissIcon"; -export const inlineBannerVariantMap: InlineBannerVariantMap; +export declare const inlineBannerVariantMap: InlineBannerVariantMap; -export function inlineBanner( +export declare const inlineBanner: (( props?: InlineBannerVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [InlineBannerVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/inlineBanner.mjs b/packages/recipe/lib/inlineBanner.mjs index d2be94e68..d3f8a2f4d 100644 --- a/packages/recipe/lib/inlineBanner.mjs +++ b/packages/recipe/lib/inlineBanner.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const inlineBannerSlotNames = [ [ @@ -73,4 +74,6 @@ export function inlineBanner(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(inlineBanner, { splitVariantProps: (props) => splitVariantProps(props, inlineBannerVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/progressCircle.d.ts b/packages/recipe/lib/progressCircle.d.ts index 4df441e1a..88e124463 100644 --- a/packages/recipe/lib/progressCircle.d.ts +++ b/packages/recipe/lib/progressCircle.d.ts @@ -1,4 +1,4 @@ -interface ProgressCircleVariant { +declare interface ProgressCircleVariant { /** * @default neutral */ @@ -13,16 +13,20 @@ interface ProgressCircleVariant { indeterminate: boolean; } -type ProgressCircleVariantMap = { +declare type ProgressCircleVariantMap = { [key in keyof ProgressCircleVariant]: Array; }; -export type ProgressCircleVariantProps = Partial; +export declare type ProgressCircleVariantProps = Partial; -export type ProgressCircleSlotName = "root" | "track" | "range"; +export declare type ProgressCircleSlotName = "root" | "track" | "range"; -export const progressCircleVariantMap: ProgressCircleVariantMap; +export declare const progressCircleVariantMap: ProgressCircleVariantMap; -export function progressCircle( +export declare const progressCircle: (( props?: ProgressCircleVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ProgressCircleVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/progressCircle.mjs b/packages/recipe/lib/progressCircle.mjs index ee743849d..6ea769a39 100644 --- a/packages/recipe/lib/progressCircle.mjs +++ b/packages/recipe/lib/progressCircle.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const progressCircleSlotNames = [ [ @@ -51,4 +52,6 @@ export function progressCircle(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(progressCircle, { splitVariantProps: (props) => splitVariantProps(props, progressCircleVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/radio.d.ts b/packages/recipe/lib/radio.d.ts index e56596806..95f13d02c 100644 --- a/packages/recipe/lib/radio.d.ts +++ b/packages/recipe/lib/radio.d.ts @@ -1,20 +1,24 @@ -interface RadioVariant { +declare interface RadioVariant { /** * @default medium */ size: "large" | "medium" | "small"; } -type RadioVariantMap = { +declare type RadioVariantMap = { [key in keyof RadioVariant]: Array; }; -export type RadioVariantProps = Partial; +export declare type RadioVariantProps = Partial; -export type RadioSlotName = "root" | "icon"; +export declare type RadioSlotName = "root" | "icon"; -export const radioVariantMap: RadioVariantMap; +export declare const radioVariantMap: RadioVariantMap; -export function radio( +export declare const radio: (( props?: RadioVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [RadioVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/radio.mjs b/packages/recipe/lib/radio.mjs index 32ec9d460..f3ee2a299 100644 --- a/packages/recipe/lib/radio.mjs +++ b/packages/recipe/lib/radio.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const radioSlotNames = [ [ @@ -37,4 +38,6 @@ export function radio(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(radio, { splitVariantProps: (props) => splitVariantProps(props, radioVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/reactionButton.d.ts b/packages/recipe/lib/reactionButton.d.ts index af0b36616..dcd35b6d8 100644 --- a/packages/recipe/lib/reactionButton.d.ts +++ b/packages/recipe/lib/reactionButton.d.ts @@ -1,20 +1,24 @@ -interface ReactionButtonVariant { +declare interface ReactionButtonVariant { /** * @default small */ size: "xsmall" | "small"; } -type ReactionButtonVariantMap = { +declare type ReactionButtonVariantMap = { [key in keyof ReactionButtonVariant]: Array; }; -export type ReactionButtonVariantProps = Partial; +export declare type ReactionButtonVariantProps = Partial; -export type ReactionButtonSlotName = "root" | "label" | "count" | "prefixIcon" | "progressCircle"; +export declare type ReactionButtonSlotName = "root" | "label" | "count" | "prefixIcon" | "progressCircle"; -export const reactionButtonVariantMap: ReactionButtonVariantMap; +export declare const reactionButtonVariantMap: ReactionButtonVariantMap; -export function reactionButton( +export declare const reactionButton: (( props?: ReactionButtonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ReactionButtonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/reactionButton.mjs b/packages/recipe/lib/reactionButton.mjs index afbf030a9..acbd49e8d 100644 --- a/packages/recipe/lib/reactionButton.mjs +++ b/packages/recipe/lib/reactionButton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const reactionButtonSlotNames = [ [ @@ -48,4 +49,6 @@ export function reactionButton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(reactionButton, { splitVariantProps: (props) => splitVariantProps(props, reactionButtonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/screen.d.ts b/packages/recipe/lib/screen.d.ts index ef696ef0c..abde57f76 100644 --- a/packages/recipe/lib/screen.d.ts +++ b/packages/recipe/lib/screen.d.ts @@ -1,4 +1,4 @@ -interface ScreenVariant { +declare interface ScreenVariant { /** * @default cupertino */ @@ -9,16 +9,20 @@ interface ScreenVariant { hasAppBar: boolean; } -type ScreenVariantMap = { +declare type ScreenVariantMap = { [key in keyof ScreenVariant]: Array; }; -export type ScreenVariantProps = Partial; +export declare type ScreenVariantProps = Partial; -export type ScreenSlotName = "root" | "layer" | "dim" | "edge"; +export declare type ScreenSlotName = "root" | "layer" | "dim" | "edge"; -export const screenVariantMap: ScreenVariantMap; +export declare const screenVariantMap: ScreenVariantMap; -export function screen( +export declare const screen: (( props?: ScreenVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ScreenVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/screen.mjs b/packages/recipe/lib/screen.mjs index 35ba541d4..d36c5443a 100644 --- a/packages/recipe/lib/screen.mjs +++ b/packages/recipe/lib/screen.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const screenSlotNames = [ [ @@ -48,4 +49,6 @@ export function screen(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(screen, { splitVariantProps: (props) => splitVariantProps(props, screenVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/segmentedControl.d.ts b/packages/recipe/lib/segmentedControl.d.ts index b747f6b0c..d91bda783 100644 --- a/packages/recipe/lib/segmentedControl.d.ts +++ b/packages/recipe/lib/segmentedControl.d.ts @@ -1,17 +1,21 @@ -interface SegmentedControlVariant { +declare interface SegmentedControlVariant { } -type SegmentedControlVariantMap = { +declare type SegmentedControlVariantMap = { [key in keyof SegmentedControlVariant]: Array; }; -export type SegmentedControlVariantProps = Partial; +export declare type SegmentedControlVariantProps = Partial; -export type SegmentedControlSlotName = "root" | "segment" | "segmentLabel" | "segmentLabelPlaceholder" | "indicator"; +export declare type SegmentedControlSlotName = "root" | "segment" | "segmentLabel" | "segmentLabelPlaceholder" | "indicator"; -export const segmentedControlVariantMap: SegmentedControlVariantMap; +export declare const segmentedControlVariantMap: SegmentedControlVariantMap; -export function segmentedControl( +export declare const segmentedControl: (( props?: SegmentedControlVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [SegmentedControlVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/segmentedControl.mjs b/packages/recipe/lib/segmentedControl.mjs index 8714cf7d8..b2bb533c3 100644 --- a/packages/recipe/lib/segmentedControl.mjs +++ b/packages/recipe/lib/segmentedControl.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const segmentedControlSlotNames = [ [ @@ -41,4 +42,6 @@ export function segmentedControl(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(segmentedControl, { splitVariantProps: (props) => splitVariantProps(props, segmentedControlVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/selectBox.d.ts b/packages/recipe/lib/selectBox.d.ts index d18fd99f9..e41300ff5 100644 --- a/packages/recipe/lib/selectBox.d.ts +++ b/packages/recipe/lib/selectBox.d.ts @@ -1,17 +1,21 @@ -interface SelectBoxVariant { +declare interface SelectBoxVariant { } -type SelectBoxVariantMap = { +declare type SelectBoxVariantMap = { [key in keyof SelectBoxVariant]: Array; }; -export type SelectBoxVariantProps = Partial; +export declare type SelectBoxVariantProps = Partial; -export type SelectBoxSlotName = "root" | "content" | "label" | "description" | "checkboxControl" | "checkboxIcon" | "radioControl" | "radioIcon"; +export declare type SelectBoxSlotName = "root" | "content" | "label" | "description" | "checkboxControl" | "checkboxIcon" | "radioControl" | "radioIcon"; -export const selectBoxVariantMap: SelectBoxVariantMap; +export declare const selectBoxVariantMap: SelectBoxVariantMap; -export function selectBox( +export declare const selectBox: (( props?: SelectBoxVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [SelectBoxVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/selectBox.mjs b/packages/recipe/lib/selectBox.mjs index 1d93fcd70..e27747229 100644 --- a/packages/recipe/lib/selectBox.mjs +++ b/packages/recipe/lib/selectBox.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const selectBoxSlotNames = [ [ @@ -53,4 +54,6 @@ export function selectBox(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(selectBox, { splitVariantProps: (props) => splitVariantProps(props, selectBoxVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/selectBoxGroup.d.ts b/packages/recipe/lib/selectBoxGroup.d.ts index d963e824b..2b6f79d5e 100644 --- a/packages/recipe/lib/selectBoxGroup.d.ts +++ b/packages/recipe/lib/selectBoxGroup.d.ts @@ -1,17 +1,21 @@ -interface SelectBoxGroupVariant { +declare interface SelectBoxGroupVariant { } -type SelectBoxGroupVariantMap = { +declare type SelectBoxGroupVariantMap = { [key in keyof SelectBoxGroupVariant]: Array; }; -export type SelectBoxGroupVariantProps = Partial; +export declare type SelectBoxGroupVariantProps = Partial; -export type SelectBoxGroupSlotName = "root"; +export declare type SelectBoxGroupSlotName = "root"; -export const selectBoxGroupVariantMap: SelectBoxGroupVariantMap; +export declare const selectBoxGroupVariantMap: SelectBoxGroupVariantMap; -export function selectBoxGroup( +export declare const selectBoxGroup: (( props?: SelectBoxGroupVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [SelectBoxGroupVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/selectBoxGroup.mjs b/packages/recipe/lib/selectBoxGroup.mjs index ef56fbe3f..6bd1a5d75 100644 --- a/packages/recipe/lib/selectBoxGroup.mjs +++ b/packages/recipe/lib/selectBoxGroup.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const selectBoxGroupSlotNames = [ [ @@ -25,4 +26,6 @@ export function selectBoxGroup(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(selectBoxGroup, { splitVariantProps: (props) => splitVariantProps(props, selectBoxGroupVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/skeleton.d.ts b/packages/recipe/lib/skeleton.d.ts index 0e4c9b0cb..45bca4fc5 100644 --- a/packages/recipe/lib/skeleton.d.ts +++ b/packages/recipe/lib/skeleton.d.ts @@ -1,20 +1,24 @@ -interface SkeletonVariant { +declare interface SkeletonVariant { /** * @default rounded */ shape: "rounded" | "circular" | "rectangular"; } -type SkeletonVariantMap = { +declare type SkeletonVariantMap = { [key in keyof SkeletonVariant]: Array; }; -export type SkeletonVariantProps = Partial; +export declare type SkeletonVariantProps = Partial; -export type SkeletonSlotName = "root"; +export declare type SkeletonSlotName = "root"; -export const skeletonVariantMap: SkeletonVariantMap; +export declare const skeletonVariantMap: SkeletonVariantMap; -export function skeleton( +export declare const skeleton: (( props?: SkeletonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [SkeletonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/skeleton.mjs b/packages/recipe/lib/skeleton.mjs index 5259877a2..e72724d75 100644 --- a/packages/recipe/lib/skeleton.mjs +++ b/packages/recipe/lib/skeleton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const skeletonSlotNames = [ [ @@ -33,4 +34,6 @@ export function skeleton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(skeleton, { splitVariantProps: (props) => splitVariantProps(props, skeletonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/switch.d.ts b/packages/recipe/lib/switch.d.ts index 702f3ebb6..972be0b55 100644 --- a/packages/recipe/lib/switch.d.ts +++ b/packages/recipe/lib/switch.d.ts @@ -1,20 +1,24 @@ -interface SwitchVariant { +declare interface SwitchVariant { /** * @default medium */ size: "medium" | "small"; } -type SwitchVariantMap = { +declare type SwitchVariantMap = { [key in keyof SwitchVariant]: Array; }; -export type SwitchVariantProps = Partial; +export declare type SwitchVariantProps = Partial; -export type SwitchSlotName = "root" | "control" | "thumb"; +export declare type SwitchSlotName = "root" | "control" | "thumb"; -export const switchVariantMap: SwitchVariantMap; +export declare const switchVariantMap: SwitchVariantMap; -export function switchStyle( +export declare const switchStyle: (( props?: SwitchVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [SwitchVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/switch.mjs b/packages/recipe/lib/switch.mjs index 198aa14b4..753e60c93 100644 --- a/packages/recipe/lib/switch.mjs +++ b/packages/recipe/lib/switch.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const switchSlotNames = [ [ @@ -40,4 +41,6 @@ export function switchStyle(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(switchStyle, { splitVariantProps: (props) => splitVariantProps(props, switchVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/tab.d.ts b/packages/recipe/lib/tab.d.ts index 58946c491..946c1a18c 100644 --- a/packages/recipe/lib/tab.d.ts +++ b/packages/recipe/lib/tab.d.ts @@ -1,4 +1,4 @@ -interface TabVariant { +declare interface TabVariant { /** * @default hug */ @@ -9,16 +9,20 @@ interface TabVariant { size: "medium" | "small"; } -type TabVariantMap = { +declare type TabVariantMap = { [key in keyof TabVariant]: Array; }; -export type TabVariantProps = Partial; +export declare type TabVariantProps = Partial; -export type TabSlotName = "root" | "label" | "notification"; +export declare type TabSlotName = "root" | "label" | "notification"; -export const tabVariantMap: TabVariantMap; +export declare const tabVariantMap: TabVariantMap; -export function tab( +export declare const tab: (( props?: TabVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TabVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/tab.mjs b/packages/recipe/lib/tab.mjs index 06e2fdb0d..b47b68084 100644 --- a/packages/recipe/lib/tab.mjs +++ b/packages/recipe/lib/tab.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const tabSlotNames = [ [ @@ -45,4 +46,6 @@ export function tab(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(tab, { splitVariantProps: (props) => splitVariantProps(props, tabVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/tabs.d.ts b/packages/recipe/lib/tabs.d.ts index 11e2e8f93..fbac32d7d 100644 --- a/packages/recipe/lib/tabs.d.ts +++ b/packages/recipe/lib/tabs.d.ts @@ -1,4 +1,4 @@ -interface TabsVariant { +declare interface TabsVariant { /** * @default hug */ @@ -13,16 +13,20 @@ interface TabsVariant { fixTriggerList: boolean; } -type TabsVariantMap = { +declare type TabsVariantMap = { [key in keyof TabsVariant]: Array; }; -export type TabsVariantProps = Partial; +export declare type TabsVariantProps = Partial; -export type TabsSlotName = "root" | "triggerList" | "contentList" | "contentCamera" | "content" | "indicator"; +export declare type TabsSlotName = "root" | "triggerList" | "contentList" | "contentCamera" | "content" | "indicator"; -export const tabsVariantMap: TabsVariantMap; +export declare const tabsVariantMap: TabsVariantMap; -export function tabs( +export declare const tabs: (( props?: TabsVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TabsVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/tabs.mjs b/packages/recipe/lib/tabs.mjs index b3083ffac..e6174c2ac 100644 --- a/packages/recipe/lib/tabs.mjs +++ b/packages/recipe/lib/tabs.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const tabsSlotNames = [ [ @@ -62,4 +63,6 @@ export function tabs(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(tabs, { splitVariantProps: (props) => splitVariantProps(props, tabsVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/text.d.ts b/packages/recipe/lib/text.d.ts index 582405791..8a2044737 100644 --- a/packages/recipe/lib/text.d.ts +++ b/packages/recipe/lib/text.d.ts @@ -1,4 +1,4 @@ -interface TextVariant { +declare interface TextVariant { /** * @default bodyMediumDefault */ @@ -9,16 +9,20 @@ interface TextVariant { maxLines: "none" | "single" | "multi"; } -type TextVariantMap = { +declare type TextVariantMap = { [key in keyof TextVariant]: Array; }; -export type TextVariantProps = Partial; +export declare type TextVariantProps = Partial; -export type TextSlotName = "root"; +export declare type TextSlotName = "root"; -export const textVariantMap: TextVariantMap; +export declare const textVariantMap: TextVariantMap; -export function text( +export declare const text: (( props?: TextVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TextVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/text.mjs b/packages/recipe/lib/text.mjs index 075faeeee..f8f6307eb 100644 --- a/packages/recipe/lib/text.mjs +++ b/packages/recipe/lib/text.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const textSlotNames = [ [ @@ -59,4 +60,6 @@ export function text(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(text, { splitVariantProps: (props) => splitVariantProps(props, textVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/textButton.d.ts b/packages/recipe/lib/textButton.d.ts index 0a7225a5d..356d4daf3 100644 --- a/packages/recipe/lib/textButton.d.ts +++ b/packages/recipe/lib/textButton.d.ts @@ -1,4 +1,4 @@ -interface TextButtonVariant { +declare interface TextButtonVariant { /** * @default brand */ @@ -9,16 +9,20 @@ interface TextButtonVariant { size: "large" | "medium" | "small"; } -type TextButtonVariantMap = { +declare type TextButtonVariantMap = { [key in keyof TextButtonVariant]: Array; }; -export type TextButtonVariantProps = Partial; +export declare type TextButtonVariantProps = Partial; -export type TextButtonSlotName = "root" | "prefixIcon" | "suffixIcon" | "label"; +export declare type TextButtonSlotName = "root" | "prefixIcon" | "suffixIcon" | "label"; -export const textButtonVariantMap: TextButtonVariantMap; +export declare const textButtonVariantMap: TextButtonVariantMap; -export function textButton( +export declare const textButton: (( props?: TextButtonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TextButtonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/textButton.mjs b/packages/recipe/lib/textButton.mjs index dfb4eaa05..a6d839cb9 100644 --- a/packages/recipe/lib/textButton.mjs +++ b/packages/recipe/lib/textButton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const textButtonSlotNames = [ [ @@ -52,4 +53,6 @@ export function textButton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(textButton, { splitVariantProps: (props) => splitVariantProps(props, textButtonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/textField.d.ts b/packages/recipe/lib/textField.d.ts index 8d2044351..a939d383e 100644 --- a/packages/recipe/lib/textField.d.ts +++ b/packages/recipe/lib/textField.d.ts @@ -1,20 +1,24 @@ -interface TextFieldVariant { +declare interface TextFieldVariant { /** * @default medium */ size: "xlarge" | "large" | "medium"; } -type TextFieldVariantMap = { +declare type TextFieldVariantMap = { [key in keyof TextFieldVariant]: Array; }; -export type TextFieldVariantProps = Partial; +export declare type TextFieldVariantProps = Partial; -export type TextFieldSlotName = "root" | "header" | "label" | "indicator" | "input" | "inputText" | "prefixText" | "prefixIcon" | "suffixText" | "suffixIcon" | "footer" | "description" | "errorMessage" | "errorIcon" | "characterCount" | "currentCharacterCount" | "maxCharacterCount"; +export declare type TextFieldSlotName = "root" | "header" | "label" | "indicator" | "input" | "inputText" | "prefixText" | "prefixIcon" | "suffixText" | "suffixIcon" | "footer" | "description" | "errorMessage" | "errorIcon" | "characterCount" | "currentCharacterCount" | "maxCharacterCount"; -export const textFieldVariantMap: TextFieldVariantMap; +export declare const textFieldVariantMap: TextFieldVariantMap; -export function textField( +export declare const textField: (( props?: TextFieldVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TextFieldVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/textField.mjs b/packages/recipe/lib/textField.mjs index cb5996da4..b60158fd1 100644 --- a/packages/recipe/lib/textField.mjs +++ b/packages/recipe/lib/textField.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const textFieldSlotNames = [ [ @@ -97,4 +98,6 @@ export function textField(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(textField, { splitVariantProps: (props) => splitVariantProps(props, textFieldVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/toggleButton.d.ts b/packages/recipe/lib/toggleButton.d.ts index becd5b678..6b5eee121 100644 --- a/packages/recipe/lib/toggleButton.d.ts +++ b/packages/recipe/lib/toggleButton.d.ts @@ -1,4 +1,4 @@ -interface ToggleButtonVariant { +declare interface ToggleButtonVariant { /** * @default brandSolid */ @@ -9,16 +9,20 @@ interface ToggleButtonVariant { size: "xsmall" | "small"; } -type ToggleButtonVariantMap = { +declare type ToggleButtonVariantMap = { [key in keyof ToggleButtonVariant]: Array; }; -export type ToggleButtonVariantProps = Partial; +export declare type ToggleButtonVariantProps = Partial; -export type ToggleButtonSlotName = "root" | "label" | "prefixIcon" | "suffixIcon" | "progressCircle"; +export declare type ToggleButtonSlotName = "root" | "label" | "prefixIcon" | "suffixIcon" | "progressCircle"; -export const toggleButtonVariantMap: ToggleButtonVariantMap; +export declare const toggleButtonVariantMap: ToggleButtonVariantMap; -export function toggleButton( +export declare const toggleButton: (( props?: ToggleButtonVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [ToggleButtonVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/toggleButton.mjs b/packages/recipe/lib/toggleButton.mjs index 67a71429a..cd5c5b8ef 100644 --- a/packages/recipe/lib/toggleButton.mjs +++ b/packages/recipe/lib/toggleButton.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const toggleButtonSlotNames = [ [ @@ -53,4 +54,6 @@ export function toggleButton(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(toggleButton, { splitVariantProps: (props) => splitVariantProps(props, toggleButtonVariantMap) }); \ No newline at end of file diff --git a/packages/recipe/lib/topNavigation.d.ts b/packages/recipe/lib/topNavigation.d.ts index f7a07b854..17589a70e 100644 --- a/packages/recipe/lib/topNavigation.d.ts +++ b/packages/recipe/lib/topNavigation.d.ts @@ -1,4 +1,4 @@ -interface TopNavigationVariant { +declare interface TopNavigationVariant { /** * @default cupertino */ @@ -13,16 +13,20 @@ interface TopNavigationVariant { border: boolean; } -type TopNavigationVariantMap = { +declare type TopNavigationVariantMap = { [key in keyof TopNavigationVariant]: Array; }; -export type TopNavigationVariantProps = Partial; +export declare type TopNavigationVariantProps = Partial; -export type TopNavigationSlotName = "root" | "safeArea" | "container" | "left" | "right" | "title" | "titleMain" | "titleEdge" | "titleText" | "iconButton" | "icon"; +export declare type TopNavigationSlotName = "root" | "safeArea" | "container" | "left" | "right" | "title" | "titleMain" | "titleEdge" | "titleText" | "iconButton" | "icon"; -export const topNavigationVariantMap: TopNavigationVariantMap; +export declare const topNavigationVariantMap: TopNavigationVariantMap; -export function topNavigation( +export declare const topNavigation: (( props?: TopNavigationVariantProps, -): Record; \ No newline at end of file +) => Record) & { + splitVariantProps: ( + props: T, + ) => [TopNavigationVariantProps, Omit]; +} \ No newline at end of file diff --git a/packages/recipe/lib/topNavigation.mjs b/packages/recipe/lib/topNavigation.mjs index 5b43c60b0..812598bff 100644 --- a/packages/recipe/lib/topNavigation.mjs +++ b/packages/recipe/lib/topNavigation.mjs @@ -1,5 +1,6 @@ import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; +import { splitVariantProps } from "./splitVariantProps.mjs"; const topNavigationSlotNames = [ [ @@ -81,4 +82,6 @@ export function topNavigation(props) { ]; }), ); -} \ No newline at end of file +} + +Object.assign(topNavigation, { splitVariantProps: (props) => splitVariantProps(props, topNavigationVariantMap) }); \ No newline at end of file diff --git a/tools/qvism/core/src/dts.ts b/tools/qvism/core/src/dts.ts index 6c227f488..4c4b072de 100644 --- a/tools/qvism/core/src/dts.ts +++ b/tools/qvism/core/src/dts.ts @@ -56,22 +56,26 @@ export function generateDts( const slotNameType = definition.slots.map((slot) => `"${slot}"`).join(" | "); return outdent` - interface ${capitalizedName}Variant { + declare interface ${capitalizedName}Variant { ${variantInterface} } - type ${capitalizedName}VariantMap = { + declare type ${capitalizedName}VariantMap = { [key in keyof ${capitalizedName}Variant]: Array<${capitalizedName}Variant[key]>; }; - export type ${capitalizedName}VariantProps = Partial<${capitalizedName}Variant>; + export declare type ${capitalizedName}VariantProps = Partial<${capitalizedName}Variant>; - export type ${capitalizedName}SlotName = ${slotNameType}; + export declare type ${capitalizedName}SlotName = ${slotNameType}; - export const ${definition.name}VariantMap: ${capitalizedName}VariantMap; + export declare const ${definition.name}VariantMap: ${capitalizedName}VariantMap; - export function ${escapeReservedWord(definition.name)}( + export declare const ${escapeReservedWord(definition.name)}: (( props?: ${capitalizedName}VariantProps, - ): Record<${capitalizedName}SlotName, string>; + ) => Record<${capitalizedName}SlotName, string>) & { + splitVariantProps: ( + props: T, + ) => [${capitalizedName}VariantProps, Omit]; + } `; } diff --git a/tools/qvism/core/src/js.ts b/tools/qvism/core/src/js.ts index 00e1fbc84..6559748d0 100644 --- a/tools/qvism/core/src/js.ts +++ b/tools/qvism/core/src/js.ts @@ -21,6 +21,7 @@ export function generateJs( return outdent` import { createClassName } from "./className.mjs"; import { mergeVariants } from "./mergeVariants.mjs"; + import { splitVariantProps } from "./splitVariantProps.mjs"; const ${definition.name}SlotNames = ${JSON.stringify(slotNames, null, 2)}; @@ -41,5 +42,8 @@ export function generateJs( ]; }), ); - }`; + } + + Object.assign(${escapeReservedWord(definition.name)}, { splitVariantProps: (props) => splitVariantProps(props, ${definition.name}VariantMap) }); + `; }