luan-ui 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ const alertStyles = getVariants({
42
42
  },
43
43
  },
44
44
  });
45
- const { root, title, description } = alertStyles;
45
+ const { root, title, description } = alertStyles();
46
46
  export const SIZES = {
47
47
  sm: {
48
48
  small: "sm:px-2 sm:py-1 sm:has-[>svg]:gap-x-2",
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sourceRoot":"/","sources":["components/alert/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAEN,aAAa,EACb,UAAU,EACV,UAAU,GACV,MAAM,OAAO,CAAC;AAOf,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE5E,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAQF,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI,EAAE,6JAA6J;QACnK,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,aAAa;KAC1B;IACD,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EAAE;gBACR,IAAI,EAAE,wBAAwB;aAC9B;YACD,SAAS,EAAE;gBACV,IAAI,EAAE,+BAA+B;aACrC;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,uBAAuB;aAC7B;SACD;QACD,IAAI,EAAE;YACL,KAAK,EAAE;gBACN,IAAI,EAAE,8BAA8B;gBACpC,K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AM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,KAAC,SAAS,IACT,GAAG,EAAE,GAAG,KACJ,KAAK,EACT,SAAS,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,GAC1C,CACF,CAAC;AACH,CAAC,CACD,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,OAAO,EACN,KAAK,EACL,gBAAgB,EAChB,UAAU,GAIV,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n} from \"react\";\n\ntype AlertContextType = {\n\tvariant: \"primary\" | \"secondary\" | \"error\";\n\tsize: ResponsiveValue<\"small\" | \"medium\">;\n};\n\nconst AlertContext = createContext<AlertContextType | undefined>(undefined);\n\nconst useAlertContext = () => {\n\tconst context = useContext(AlertContext);\n\tif (!context) {\n\t\tthrow new Error(\"useAlertContext must be used within an Alert component\");\n\t}\n\treturn context;\n};\n\ntype AlertProps = ComponentPropsWithoutRef<\"div\"> & {\n\tvariant?: \"primary\" | \"secondary\" | \"error\";\n\tasChild?: boolean;\n\tsize?: ResponsiveValue<\"small\" | \"medium\">;\n};\n\nconst alertStyles = getVariants({\n\tslots: {\n\t\troot: \"grid w-fit grid-cols-[0_1fr] items-start gap-1 rounded-md border border-transparent has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] [&>svg]:translate-y-1\",\n\t\ttitle: \"col-start-2 font-bold\",\n\t\tdescription: \"col-start-2\",\n\t},\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: {\n\t\t\t\troot: \"bg-gray-700 text-white\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\troot: \"border-gray-700 text-gray-700\",\n\t\t\t},\n\t\t\terror: {\n\t\t\t\troot: \"bg-red-500 text-white\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"px-2 py-1 has-[>svg]:gap-x-2\",\n\t\t\t\ttitle: \"text-sm\",\n\t\t\t\tdescription: \"text-xs\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"px-3 py-2 has-[>svg]:gap-x-3\",\n\t\t\t\ttitle: \"text-base\",\n\t\t\t\tdescription: \"text-sm\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, title, description } = alertStyles;\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:py-1 sm:has-[>svg]:gap-x-2\",\n\t\tmedium: \"sm:px-3 sm:py-2 sm:has-[>svg]:gap-x-3\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:py-1 md:has-[>svg]:gap-x-2\",\n\t\tmedium: \"md:px-3 md:py-2 md:has-[>svg]:gap-x-3\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:py-1 lg:has-[>svg]:gap-x-2\",\n\t\tmedium: \"lg:px-3 lg:py-2 lg:has-[>svg]:gap-x-3\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:py-1 xl:has-[>svg]:gap-x-2\",\n\t\tmedium: \"xl:px-3 xl:py-2 xl:has-[>svg]:gap-x-3\",\n\t},\n};\n\nconst Alert = forwardRef<HTMLDivElement, AlertProps>(\n\t(\n\t\t{ variant = \"primary\", size = \"medium\", className, asChild, ...props },\n\t\tref,\n\t) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\treturn (\n\t\t\t<AlertContext.Provider value={{ variant, size }}>\n\t\t\t\t<Component\n\t\t\t\t\tclassName={root({ variant, size, className })}\n\t\t\t\t\t{...props}\n\t\t\t\t\tref={ref}\n\t\t\t\t/>\n\t\t\t</AlertContext.Provider>\n\t\t);\n\t},\n);\n\nAlert.displayName = \"Alert\";\n\ntype AlertTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n\tasChild?: boolean;\n};\n\nexport const TITLE_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-sm\",\n\t\tmedium: \"sm:text-base\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-sm\",\n\t\tmedium: \"md:text-base\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-sm\",\n\t\tmedium: \"lg:text-base\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-sm\",\n\t\tmedium: \"xl:text-base\",\n\t},\n};\n\nconst AlertTitle = forwardRef<HTMLDivElement, AlertTitleProps>(\n\t({ className, asChild, ...props }, ref) => {\n\t\tconst { size } = useAlertContext();\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component ref={ref} {...props} className={title({ size, className })} />\n\t\t);\n\t},\n);\n\nAlertTitle.displayName = \"AlertTitle\";\n\ntype AlertDescriptionProps = ComponentPropsWithoutRef<\"div\"> & {\n\tasChild?: boolean;\n};\n\nexport const DESCRIPTION_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-xs\",\n\t\tmedium: \"sm:text-sm\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-xs\",\n\t\tmedium: \"md:text-sm\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-xs\",\n\t\tmedium: \"lg:text-sm\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-xs\",\n\t\tmedium: \"xl:text-sm\",\n\t},\n};\n\nconst AlertDescription = forwardRef<HTMLDivElement, AlertDescriptionProps>(\n\t({ className, asChild, ...props }, ref) => {\n\t\tconst { size } = useAlertContext();\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t\tclassName={description({ size, className })}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nAlertDescription.displayName = \"AlertDescription\";\n\nexport {\n\tAlert,\n\tAlertDescription,\n\tAlertTitle,\n\ttype AlertDescriptionProps,\n\ttype AlertProps,\n\ttype AlertTitleProps,\n};\n"]}
1
+ {"version":3,"file":"alert.js","sourceRoot":"/","sources":["components/alert/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAEN,aAAa,EACb,UAAU,EACV,UAAU,GACV,MAAM,OAAO,CAAC;AAOf,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE5E,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAQF,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI,EAAE,6JAA6J;QACnK,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,aAAa;KAC1B;IACD,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EAAE;gBACR,IAAI,EAAE,wBAAwB;aAC9B;YACD,SAAS,EAAE;gBACV,IAAI,EAAE,+BAA+B;aACrC;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,uBAAuB;aAC7B;SACD;QACD,IAAI,EAAE;YACL,KAAK,EAAE;gBACN,IAAI,EAAE,8BAA8B;gBACpC,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,SAAS;aACtB;YACD,MAAM,EAAE;gBACP,IAAI,EAAE,8BAA8B;gBACpC,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,SAAS;aACtB;SACD;KACD;CACD,CAAC,CAAC;AAEH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,E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AAC;AACH,CAAC,CACD,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,OAAO,EACN,KAAK,EACL,gBAAgB,EAChB,UAAU,GAIV,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n} from \"react\";\n\ntype AlertContextType = {\n\tvariant: \"primary\" | \"secondary\" | \"error\";\n\tsize: ResponsiveValue<\"small\" | \"medium\">;\n};\n\nconst AlertContext = createContext<AlertContextType | undefined>(undefined);\n\nconst useAlertContext = () => {\n\tconst context = useContext(AlertContext);\n\tif (!context) {\n\t\tthrow new Error(\"useAlertContext must be used within an Alert component\");\n\t}\n\treturn context;\n};\n\ntype AlertProps = ComponentPropsWithoutRef<\"div\"> & {\n\tvariant?: \"primary\" | \"secondary\" | \"error\";\n\tasChild?: boolean;\n\tsize?: ResponsiveValue<\"small\" | \"medium\">;\n};\n\nconst alertStyles = getVariants({\n\tslots: {\n\t\troot: \"grid w-fit grid-cols-[0_1fr] items-start gap-1 rounded-md border border-transparent has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] [&>svg]:translate-y-1\",\n\t\ttitle: \"col-start-2 font-bold\",\n\t\tdescription: \"col-start-2\",\n\t},\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: {\n\t\t\t\troot: \"bg-gray-700 text-white\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\troot: \"border-gray-700 text-gray-700\",\n\t\t\t},\n\t\t\terror: {\n\t\t\t\troot: \"bg-red-500 text-white\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"px-2 py-1 has-[>svg]:gap-x-2\",\n\t\t\t\ttitle: \"text-sm\",\n\t\t\t\tdescription: \"text-xs\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"px-3 py-2 has-[>svg]:gap-x-3\",\n\t\t\t\ttitle: \"text-base\",\n\t\t\t\tdescription: \"text-sm\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, title, description } = alertStyles();\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:py-1 sm:has-[>svg]:gap-x-2\",\n\t\tmedium: \"sm:px-3 sm:py-2 sm:has-[>svg]:gap-x-3\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:py-1 md:has-[>svg]:gap-x-2\",\n\t\tmedium: \"md:px-3 md:py-2 md:has-[>svg]:gap-x-3\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:py-1 lg:has-[>svg]:gap-x-2\",\n\t\tmedium: \"lg:px-3 lg:py-2 lg:has-[>svg]:gap-x-3\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:py-1 xl:has-[>svg]:gap-x-2\",\n\t\tmedium: \"xl:px-3 xl:py-2 xl:has-[>svg]:gap-x-3\",\n\t},\n};\n\nconst Alert = forwardRef<HTMLDivElement, AlertProps>(\n\t(\n\t\t{ variant = \"primary\", size = \"medium\", className, asChild, ...props },\n\t\tref,\n\t) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\treturn (\n\t\t\t<AlertContext.Provider value={{ variant, size }}>\n\t\t\t\t<Component\n\t\t\t\t\tclassName={root({ variant, size, className })}\n\t\t\t\t\t{...props}\n\t\t\t\t\tref={ref}\n\t\t\t\t/>\n\t\t\t</AlertContext.Provider>\n\t\t);\n\t},\n);\n\nAlert.displayName = \"Alert\";\n\ntype AlertTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n\tasChild?: boolean;\n};\n\nexport const TITLE_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-sm\",\n\t\tmedium: \"sm:text-base\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-sm\",\n\t\tmedium: \"md:text-base\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-sm\",\n\t\tmedium: \"lg:text-base\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-sm\",\n\t\tmedium: \"xl:text-base\",\n\t},\n};\n\nconst AlertTitle = forwardRef<HTMLDivElement, AlertTitleProps>(\n\t({ className, asChild, ...props }, ref) => {\n\t\tconst { size } = useAlertContext();\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component ref={ref} {...props} className={title({ size, className })} />\n\t\t);\n\t},\n);\n\nAlertTitle.displayName = \"AlertTitle\";\n\ntype AlertDescriptionProps = ComponentPropsWithoutRef<\"div\"> & {\n\tasChild?: boolean;\n};\n\nexport const DESCRIPTION_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-xs\",\n\t\tmedium: \"sm:text-sm\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-xs\",\n\t\tmedium: \"md:text-sm\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-xs\",\n\t\tmedium: \"lg:text-sm\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-xs\",\n\t\tmedium: \"xl:text-sm\",\n\t},\n};\n\nconst AlertDescription = forwardRef<HTMLDivElement, AlertDescriptionProps>(\n\t({ className, asChild, ...props }, ref) => {\n\t\tconst { size } = useAlertContext();\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t\tclassName={description({ size, className })}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nAlertDescription.displayName = \"AlertDescription\";\n\nexport {\n\tAlert,\n\tAlertDescription,\n\tAlertTitle,\n\ttype AlertDescriptionProps,\n\ttype AlertProps,\n\ttype AlertTitleProps,\n};\n"]}
@@ -62,7 +62,7 @@ const cardStyles = getVariants({
62
62
  },
63
63
  },
64
64
  });
65
- const { root, header, content, footer } = cardStyles;
65
+ const { root, header, content, footer } = cardStyles();
66
66
  /**
67
67
  * Card component that provides a container with consistent styling and spacing.
68
68
  * Supports different sizes and can be used with asChild prop for composition.
@@ -1 +1 @@
1
- {"version":3,"file":"card.js","sourceRoot":"/","sources":["components/card/card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQ9D,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE3E,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;CACD,CAAC;AAEF,MAAM,UAAU,GAAG,WAAW,CAAC;IAC9B,KAAK,EAAE;QACN,IAAI,EAAE,oEAAoE;QAC1E,MAAM,EAAE,4DAA4D;QACpE,OAAO,EAAE,eAAe;QACxB,MAAM,EAAE,4DAA4D;KACpE;IACD,QAAQ,E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,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,KAAC,SAAS,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,KAAM,KAAK,GAAI,CAC1E,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { createContext, forwardRef, useContext } from \"react\";\n\n/**\n * Card Context\n */\n\ntype CardContextValue = Required<Pick<CardProps, \"size\">>;\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined);\n\nconst useCardContext = () => {\n\tconst context = useContext(CardContext);\n\tif (!context) {\n\t\tthrow new Error(\"Card components must be used within a Card\");\n\t}\n\treturn context;\n};\n\n/**\n * Card\n */\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:gap-2 sm:py-2\",\n\t\tmedium: \"sm:gap-4 sm:py-4\",\n\t\tlarge: \"sm:gap-6 sm:py-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:gap-2 md:py-2\",\n\t\tmedium: \"md:gap-4 md:py-4\",\n\t\tlarge: \"md:gap-6 md:py-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:gap-2 lg:py-2\",\n\t\tmedium: \"lg:gap-4 lg:py-4\",\n\t\tlarge: \"lg:gap-6 lg:py-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:gap-2 xl:py-2\",\n\t\tmedium: \"xl:gap-4 xl:py-4\",\n\t\tlarge: \"xl:gap-6 xl:py-6\",\n\t},\n};\n\nconst cardStyles = getVariants({\n\tslots: {\n\t\troot: \"flex flex-col rounded-lg border border-gray-200 bg-white shadow-md\",\n\t\theader: \"flex items-center justify-between border-gray-200 border-b\",\n\t\tcontent: \"flex flex-col\",\n\t\tfooter: \"flex items-center justify-between border-gray-200 border-t\",\n\t},\n\tvariants: {\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"gap-2 py-2\",\n\t\t\t\theader: \"px-2 pb-2\",\n\t\t\t\tcontent: \"gap-2 px-2\",\n\t\t\t\tfooter: \"px-2 pt-2\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"gap-4 py-4\",\n\t\t\t\theader: \"px-4 pb-4\",\n\t\t\t\tcontent: \"gap-4 px-4\",\n\t\t\t\tfooter: \"px-4 pt-4\",\n\t\t\t},\n\t\t\tlarge: {\n\t\t\t\troot: \"gap-6 py-6\",\n\t\t\t\theader: \"px-6 pb-6\",\n\t\t\t\tcontent: \"gap-6 px-6\",\n\t\t\t\tfooter: \"px-6 pt-6\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, header, content, footer } = cardStyles;\n\n/**\n * Card component that provides a container with consistent styling and spacing.\n * Supports different sizes and can be used with asChild prop for composition.\n *\n * @example\n * ```tsx\n * <Card size=\"medium\">\n * <CardHeader>Header</CardHeader>\n * <CardContent>Content</CardContent>\n * <CardFooter>Footer</CardFooter>\n * </Card>\n * ```\n */\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n\t({ className, size = \"medium\", asChild, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<CardContext.Provider value={{ size }}>\n\t\t\t\t<Component ref={ref} className={root({ className, size })} {...props} />\n\t\t\t</CardContext.Provider>\n\t\t);\n\t},\n);\n\nCard.displayName = \"Card\";\n\n/**\n * Card Header\n */\n\nexport type CardHeaderProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_HEADER_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:pb-2\",\n\t\tmedium: \"sm:px-4 sm:pb-4\",\n\t\tlarge: \"sm:px-6 sm:pb-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:pb-2\",\n\t\tmedium: \"md:px-4 md:pb-4\",\n\t\tlarge: \"md:px-6 md:pb-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:pb-2\",\n\t\tmedium: \"lg:px-4 lg:pb-4\",\n\t\tlarge: \"lg:px-6 lg:pb-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:pb-2\",\n\t\tmedium: \"xl:px-4 xl:pb-4\",\n\t\tlarge: \"xl:px-6 xl:pb-6\",\n\t},\n};\n\n/**\n * Card Header component that provides a consistent header section for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardHeader>\n * <h2>Title</h2>\n * <button>Action</button>\n * </CardHeader>\n * ```\n */\nexport const CardHeader = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardHeaderProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={header({ className, size })} {...props} />\n\t);\n});\n\nCardHeader.displayName = \"CardHeader\";\n\n/**\n * Card Content\n */\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_CONTENT_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:gap-2 sm:px-2\",\n\t\tmedium: \"sm:gap-4 sm:px-4\",\n\t\tlarge: \"sm:gap-6 sm:px-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:gap-2 md:px-2\",\n\t\tmedium: \"md:gap-4 md:px-4\",\n\t\tlarge: \"md:gap-6 md:px-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:gap-2 lg:px-2\",\n\t\tmedium: \"lg:gap-4 lg:px-4\",\n\t\tlarge: \"lg:gap-6 lg:px-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:gap-2 xl:px-2\",\n\t\tmedium: \"xl:gap-4 xl:px-4\",\n\t\tlarge: \"xl:gap-6 xl:px-6\",\n\t},\n};\n\n/**\n * Card Content component that provides the main content area for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardContent>\n * <p>Main content goes here</p>\n * </CardContent>\n * ```\n */\nexport const CardContent = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardContentProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={content({ className, size })} {...props} />\n\t);\n});\n\nCardContent.displayName = \"CardContent\";\n\n/**\n * Card Footer\n */\n\nexport type CardFooterProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_FOOTER_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:pt-2\",\n\t\tmedium: \"sm:px-4 sm:pt-4\",\n\t\tlarge: \"sm:px-6 sm:pt-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:pt-2\",\n\t\tmedium: \"md:px-4 md:pt-4\",\n\t\tlarge: \"lg:px-6 lg:pt-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:pt-2\",\n\t\tmedium: \"lg:px-4 lg:pt-4\",\n\t\tlarge: \"lg:px-6 lg:pt-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:pt-2\",\n\t\tmedium: \"xl:px-4 xl:pt-4\",\n\t\tlarge: \"xl:px-6 xl:pt-6\",\n\t},\n};\n\n/**\n * Card Footer component that provides a consistent footer section for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardFooter>\n * <button>Cancel</button>\n * <button>Submit</button>\n * </CardFooter>\n * ```\n */\nexport const CardFooter = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardFooterProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={footer({ className, size })} {...props} />\n\t);\n});\n\nCardFooter.displayName = \"CardFooter\";\n"]}
1
+ {"version":3,"file":"card.js","sourceRoot":"/","sources":["components/card/card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQ9D,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE3E,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB;KACzB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,kBAAkB;QAC1B,KAAK,EAAE,kBAAkB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AU,CAGlC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,KAAC,SAAS,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,KAAM,KAAK,GAAI,CAC1E,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { createContext, forwardRef, useContext } from \"react\";\n\n/**\n * Card Context\n */\n\ntype CardContextValue = Required<Pick<CardProps, \"size\">>;\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined);\n\nconst useCardContext = () => {\n\tconst context = useContext(CardContext);\n\tif (!context) {\n\t\tthrow new Error(\"Card components must be used within a Card\");\n\t}\n\treturn context;\n};\n\n/**\n * Card\n */\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:gap-2 sm:py-2\",\n\t\tmedium: \"sm:gap-4 sm:py-4\",\n\t\tlarge: \"sm:gap-6 sm:py-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:gap-2 md:py-2\",\n\t\tmedium: \"md:gap-4 md:py-4\",\n\t\tlarge: \"md:gap-6 md:py-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:gap-2 lg:py-2\",\n\t\tmedium: \"lg:gap-4 lg:py-4\",\n\t\tlarge: \"lg:gap-6 lg:py-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:gap-2 xl:py-2\",\n\t\tmedium: \"xl:gap-4 xl:py-4\",\n\t\tlarge: \"xl:gap-6 xl:py-6\",\n\t},\n};\n\nconst cardStyles = getVariants({\n\tslots: {\n\t\troot: \"flex flex-col rounded-lg border border-gray-200 bg-white shadow-md\",\n\t\theader: \"flex items-center justify-between border-gray-200 border-b\",\n\t\tcontent: \"flex flex-col\",\n\t\tfooter: \"flex items-center justify-between border-gray-200 border-t\",\n\t},\n\tvariants: {\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"gap-2 py-2\",\n\t\t\t\theader: \"px-2 pb-2\",\n\t\t\t\tcontent: \"gap-2 px-2\",\n\t\t\t\tfooter: \"px-2 pt-2\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"gap-4 py-4\",\n\t\t\t\theader: \"px-4 pb-4\",\n\t\t\t\tcontent: \"gap-4 px-4\",\n\t\t\t\tfooter: \"px-4 pt-4\",\n\t\t\t},\n\t\t\tlarge: {\n\t\t\t\troot: \"gap-6 py-6\",\n\t\t\t\theader: \"px-6 pb-6\",\n\t\t\t\tcontent: \"gap-6 px-6\",\n\t\t\t\tfooter: \"px-6 pt-6\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, header, content, footer } = cardStyles();\n\n/**\n * Card component that provides a container with consistent styling and spacing.\n * Supports different sizes and can be used with asChild prop for composition.\n *\n * @example\n * ```tsx\n * <Card size=\"medium\">\n * <CardHeader>Header</CardHeader>\n * <CardContent>Content</CardContent>\n * <CardFooter>Footer</CardFooter>\n * </Card>\n * ```\n */\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n\t({ className, size = \"medium\", asChild, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<CardContext.Provider value={{ size }}>\n\t\t\t\t<Component ref={ref} className={root({ className, size })} {...props} />\n\t\t\t</CardContext.Provider>\n\t\t);\n\t},\n);\n\nCard.displayName = \"Card\";\n\n/**\n * Card Header\n */\n\nexport type CardHeaderProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_HEADER_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:pb-2\",\n\t\tmedium: \"sm:px-4 sm:pb-4\",\n\t\tlarge: \"sm:px-6 sm:pb-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:pb-2\",\n\t\tmedium: \"md:px-4 md:pb-4\",\n\t\tlarge: \"md:px-6 md:pb-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:pb-2\",\n\t\tmedium: \"lg:px-4 lg:pb-4\",\n\t\tlarge: \"lg:px-6 lg:pb-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:pb-2\",\n\t\tmedium: \"xl:px-4 xl:pb-4\",\n\t\tlarge: \"xl:px-6 xl:pb-6\",\n\t},\n};\n\n/**\n * Card Header component that provides a consistent header section for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardHeader>\n * <h2>Title</h2>\n * <button>Action</button>\n * </CardHeader>\n * ```\n */\nexport const CardHeader = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardHeaderProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={header({ className, size })} {...props} />\n\t);\n});\n\nCardHeader.displayName = \"CardHeader\";\n\n/**\n * Card Content\n */\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_CONTENT_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:gap-2 sm:px-2\",\n\t\tmedium: \"sm:gap-4 sm:px-4\",\n\t\tlarge: \"sm:gap-6 sm:px-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:gap-2 md:px-2\",\n\t\tmedium: \"md:gap-4 md:px-4\",\n\t\tlarge: \"md:gap-6 md:px-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:gap-2 lg:px-2\",\n\t\tmedium: \"lg:gap-4 lg:px-4\",\n\t\tlarge: \"lg:gap-6 lg:px-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:gap-2 xl:px-2\",\n\t\tmedium: \"xl:gap-4 xl:px-4\",\n\t\tlarge: \"xl:gap-6 xl:px-6\",\n\t},\n};\n\n/**\n * Card Content component that provides the main content area for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardContent>\n * <p>Main content goes here</p>\n * </CardContent>\n * ```\n */\nexport const CardContent = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardContentProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={content({ className, size })} {...props} />\n\t);\n});\n\nCardContent.displayName = \"CardContent\";\n\n/**\n * Card Footer\n */\n\nexport type CardFooterProps = React.HTMLAttributes<HTMLDivElement> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n};\n\nexport const CARD_FOOTER_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:pt-2\",\n\t\tmedium: \"sm:px-4 sm:pt-4\",\n\t\tlarge: \"sm:px-6 sm:pt-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:pt-2\",\n\t\tmedium: \"md:px-4 md:pt-4\",\n\t\tlarge: \"lg:px-6 lg:pt-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:pt-2\",\n\t\tmedium: \"lg:px-4 lg:pt-4\",\n\t\tlarge: \"lg:px-6 lg:pt-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:pt-2\",\n\t\tmedium: \"xl:px-4 xl:pt-4\",\n\t\tlarge: \"xl:px-6 xl:pt-6\",\n\t},\n};\n\n/**\n * Card Footer component that provides a consistent footer section for the Card.\n * Inherits size from parent Card component.\n *\n * @example\n * ```tsx\n * <CardFooter>\n * <button>Cancel</button>\n * <button>Submit</button>\n * </CardFooter>\n * ```\n */\nexport const CardFooter = forwardRef<\n\tHTMLDivElement,\n\tOmit<CardFooterProps, \"size\">\n>(({ className, asChild, ...props }, ref) => {\n\tconst { size } = useCardContext();\n\tconst Component = asChild ? Slot : \"div\";\n\treturn (\n\t\t<Component ref={ref} className={footer({ className, size })} {...props} />\n\t);\n});\n\nCardFooter.displayName = \"CardFooter\";\n"]}
@@ -41,7 +41,7 @@ const thumbStyles = getVariants({
41
41
  },
42
42
  },
43
43
  });
44
- const { root, thumb } = thumbStyles;
44
+ const { root, thumb } = thumbStyles();
45
45
  /**
46
46
  * A switch component that toggles between on and off states.
47
47
  * Built on top of Radix UI's Switch primitive.
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sourceRoot":"/","sources":["components/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAqB,UAAU,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI,EAAE,wOAAwO;QAC9O,KAAK,EACJ,6HAA6H;KAC9H;IACD,QAAQ,EAAE;QACT,QAAQ,EAAE;YACT,IAAI,EAAE;gBACL,IAAI,EAAE,+BAA+B;gBACrC,KAAK,EAAE,aAAa;aACpB;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,4BAA4B;gBAClC,KAAK,EAAE,UAAU;aACjB;SACD;QACD,KAAK,EAAE;YACN,IAAI,EAAE;gBACL,IAAI,EAAE,4CAA4C;gBAClD,KAAK,EAAE,YAAY;aACnB;SACD;QACD,IAAI,EAAE;YACL,KAAK,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;YACD,MAAM,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;SACD;KACD;CACD,CAAC,CAAC;AAEH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAI/B,CACC,EACC,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,IAAI,GAAG,QAAQ,EACf,KAAK,EAAE,YAAY,EACnB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC;QAC1C,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,YAAY;KACnB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,WAAW,CAAC,IAAI,IAChB,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EACrD,QAAQ,EAAE,QAAQ,KACd,KAAK,EACT,GAAG,EAAE,GAAG,YAER,KAAC,WAAW,CAAC,KAAK,IAAC,SAAS,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAI,GACzC,CACnB,CAAC;AACH,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { Switch as RadixSwitch } from \"radix-ui\";\nimport { type ComponentRef, forwardRef } from \"react\";\n\nexport type SwitchProps = RadixSwitch.SwitchProps & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\terror?: boolean;\n};\n\nconst thumbStyles = getVariants({\n\tslots: {\n\t\troot: \"relative flex cursor-pointer appearance-none items-center rounded-full bg-gray-500 transition-colors duration-500 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-light-blue-300 data-[state=checked]:bg-green-500\",\n\t\tthumb:\n\t\t\t\"absolute left-1 h-5 w-5 rounded-full transition-transform duration-500 ease-out data-[state=checked]:translate-x-[1.125rem]\",\n\t},\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\troot: \"cursor-not-allowed opacity-50\",\n\t\t\t\tthumb: \"bg-gray-300\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\troot: \"cursor-pointer opacity-100\",\n\t\t\t\tthumb: \"bg-white\",\n\t\t\t},\n\t\t},\n\t\terror: {\n\t\t\ttrue: {\n\t\t\t\troot: \"bg-red-600 data-[state=checked]:bg-red-600\",\n\t\t\t\tthumb: \"bg-red-600\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"h-5 w-10\",\n\t\t\t\tthumb: \"h-3 w-3\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"h-7 w-12\",\n\t\t\t\tthumb: \"h-5 w-5\",\n\t\t\t},\n\t\t\tlarge: {\n\t\t\t\troot: \"h-9 w-14\",\n\t\t\t\tthumb: \"h-7 w-7\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, thumb } = thumbStyles;\n\n/**\n * A switch component that toggles between on and off states.\n * Built on top of Radix UI's Switch primitive.\n *\n * @param {SwitchProps} props - The props for the Switch component\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * // Basic usage\n * <Switch />\n *\n * @example\n * // With different sizes\n * <Switch size=\"small\" />\n * <Switch size=\"medium\" />\n * <Switch size=\"large\" />\n *\n * @example\n * // Disabled state\n * <Switch disabled />\n *\n * @example\n * // With onChange handler\n * <Switch onCheckedChange={(checked) => console.log(checked)} />\n *\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n */\nexport const Switch = forwardRef<\n\tComponentRef<typeof RadixSwitch.Root>,\n\tSwitchProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdisabled: initialDisabled,\n\t\t\tsize = \"medium\",\n\t\t\terror: initialError,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst { disabled, error } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t\terror: initialError,\n\t\t});\n\t\treturn (\n\t\t\t<RadixSwitch.Root\n\t\t\t\tclassName={root({ disabled, size, error, className })}\n\t\t\t\tdisabled={disabled}\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<RadixSwitch.Thumb className={thumb({ disabled, size })} />\n\t\t\t</RadixSwitch.Root>\n\t\t);\n\t},\n);\n\nSwitch.displayName = \"Switch\";\n"]}
1
+ {"version":3,"file":"switch.js","sourceRoot":"/","sources":["components/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAqB,UAAU,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,WA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d,KAAK,EACT,GAAG,EAAE,GAAG,YAER,KAAC,WAAW,CAAC,KAAK,IAAC,SAAS,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAI,GACzC,CACnB,CAAC;AACH,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { Switch as RadixSwitch } from \"radix-ui\";\nimport { type ComponentRef, forwardRef } from \"react\";\n\nexport type SwitchProps = RadixSwitch.SwitchProps & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\terror?: boolean;\n};\n\nconst thumbStyles = getVariants({\n\tslots: {\n\t\troot: \"relative flex cursor-pointer appearance-none items-center rounded-full bg-gray-500 transition-colors duration-500 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-light-blue-300 data-[state=checked]:bg-green-500\",\n\t\tthumb:\n\t\t\t\"absolute left-1 h-5 w-5 rounded-full transition-transform duration-500 ease-out data-[state=checked]:translate-x-[1.125rem]\",\n\t},\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\troot: \"cursor-not-allowed opacity-50\",\n\t\t\t\tthumb: \"bg-gray-300\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\troot: \"cursor-pointer opacity-100\",\n\t\t\t\tthumb: \"bg-white\",\n\t\t\t},\n\t\t},\n\t\terror: {\n\t\t\ttrue: {\n\t\t\t\troot: \"bg-red-600 data-[state=checked]:bg-red-600\",\n\t\t\t\tthumb: \"bg-red-600\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"h-5 w-10\",\n\t\t\t\tthumb: \"h-3 w-3\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"h-7 w-12\",\n\t\t\t\tthumb: \"h-5 w-5\",\n\t\t\t},\n\t\t\tlarge: {\n\t\t\t\troot: \"h-9 w-14\",\n\t\t\t\tthumb: \"h-7 w-7\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, thumb } = thumbStyles();\n\n/**\n * A switch component that toggles between on and off states.\n * Built on top of Radix UI's Switch primitive.\n *\n * @param {SwitchProps} props - The props for the Switch component\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * // Basic usage\n * <Switch />\n *\n * @example\n * // With different sizes\n * <Switch size=\"small\" />\n * <Switch size=\"medium\" />\n * <Switch size=\"large\" />\n *\n * @example\n * // Disabled state\n * <Switch disabled />\n *\n * @example\n * // With onChange handler\n * <Switch onCheckedChange={(checked) => console.log(checked)} />\n *\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n */\nexport const Switch = forwardRef<\n\tComponentRef<typeof RadixSwitch.Root>,\n\tSwitchProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdisabled: initialDisabled,\n\t\t\tsize = \"medium\",\n\t\t\terror: initialError,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst { disabled, error } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t\terror: initialError,\n\t\t});\n\t\treturn (\n\t\t\t<RadixSwitch.Root\n\t\t\t\tclassName={root({ disabled, size, error, className })}\n\t\t\t\tdisabled={disabled}\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<RadixSwitch.Thumb className={thumb({ disabled, size })} />\n\t\t\t</RadixSwitch.Root>\n\t\t);\n\t},\n);\n\nSwitch.displayName = \"Switch\";\n"]}
@@ -3,35 +3,39 @@ export declare const breakpoints: readonly ["sm", "md", "lg", "xl"];
3
3
  export declare const getVariants: {
4
4
  <T extends {
5
5
  [x: string]: {
6
- [x: string]: string | Record<string, string>;
6
+ [x: string]: (string | readonly string[]) | Record<string, string | readonly string[]>;
7
7
  };
8
- }, S extends Record<string, string>>(config: {
8
+ } = Record<never, {
9
+ [x: string]: (string | readonly string[]) | Record<string, string | readonly string[]>;
10
+ }>, S extends Record<string, string | readonly string[]> = Record<string, string | readonly string[]>>(config: {
9
11
  slots: S;
10
12
  variants?: T | undefined;
11
- compoundVariants?: (Partial<{ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", string | Record<string, string>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
13
+ compoundVariants?: (Partial<{ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", (string | readonly string[]) | Record<string, string | readonly string[]>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
12
14
  className?: string;
13
15
  }> & {
14
- class?: Partial<Record<keyof S & string, string>> | undefined;
16
+ class?: Partial<Record<keyof S & string, string | readonly string[]>> | undefined;
15
17
  className?: string;
16
18
  })[] | undefined;
17
19
  onComplete?: (classes: string) => string;
18
- }): { [K_1 in keyof S]: (props?: ({ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", string | Record<string, string>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
20
+ }): () => { [K_1 in keyof S]: (props?: ({ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", (string | readonly string[]) | Record<string, string | readonly string[]>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
19
21
  className?: string;
20
22
  }) | undefined) => string; };
21
23
  <T extends {
22
24
  [x: string]: {
23
- [x: string]: string | Record<string, string>;
25
+ [x: string]: (string | readonly string[]) | Record<string, string | readonly string[]>;
24
26
  };
25
- }>(config: {
27
+ } = Record<never, {
28
+ [x: string]: (string | readonly string[]) | Record<string, string | readonly string[]>;
29
+ }>>(config: {
26
30
  base: string;
27
31
  variants?: T | undefined;
28
- compoundVariants?: Partial<{ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", string | Record<string, string>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
32
+ compoundVariants?: Partial<{ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", (string | readonly string[]) | Record<string, string | readonly string[]>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
29
33
  className?: string;
30
34
  }>[] | undefined;
31
35
  onComplete?: (classes: string) => string;
32
- }): (props: { [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", string | Record<string, string>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
36
+ }): (props?: ({ [K in keyof T]?: (T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends Partial<Record<"true" | "false", (string | readonly string[]) | Record<string, string | readonly string[]>>> ? RcvResponsiveValue<boolean, "sm" | "md" | "lg" | "xl"> | undefined : T_1 extends Record<string, unknown> ? RcvResponsiveValue<keyof T_1, "sm" | "md" | "lg" | "xl"> : never : never : never) | undefined; } & {
33
37
  className?: string;
34
- }) => string;
38
+ }) | undefined) => string;
35
39
  };
36
40
  export type Breakpoints = (typeof breakpoints)[number];
37
41
  export type ResponsiveValue<T> = RcvResponsiveValue<T, Breakpoints>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luan-ui",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "A UI library for React",
5
5
  "author": "benebene84 <benedikt.sperl@gmail.com> (https://github.com/benebene84)",
6
6
  "main": "/dist/index.js",
@@ -33,30 +33,30 @@
33
33
  },
34
34
  "homepage": "https://github.com/benebene84/luan-ui#readme",
35
35
  "devDependencies": {
36
- "@biomejs/biome": "2.2.4",
37
- "@chromatic-com/storybook": "^4.1.1",
38
- "@storybook/addon-docs": "^9.1.6",
39
- "@storybook/addon-onboarding": "^9.1.6",
40
- "@storybook/react-vite": "^9.1.6",
41
- "@tailwindcss/postcss": "^4.1.13",
42
- "@tailwindcss/vite": "^4.1.13",
36
+ "@biomejs/biome": "2.3.5",
37
+ "@chromatic-com/storybook": "^4.1.2",
38
+ "@storybook/addon-docs": "^10.0.7",
39
+ "@storybook/addon-onboarding": "^10.0.7",
40
+ "@storybook/react-vite": "^10.0.7",
41
+ "@tailwindcss/postcss": "^4.1.17",
42
+ "@tailwindcss/vite": "^4.1.17",
43
43
  "@testing-library/dom": "^10.4.1",
44
- "@testing-library/jest-dom": "^6.8.0",
44
+ "@testing-library/jest-dom": "^6.9.1",
45
45
  "@testing-library/react": "^16.3.0",
46
46
  "@testing-library/user-event": "^14.6.1",
47
- "@types/node": "^24.5.0",
48
- "@types/react": "^19.1.13",
49
- "@types/react-dom": "^19.1.9",
50
- "@vitejs/plugin-react": "^5.0.2",
51
- "jsdom": "^27.0.0",
52
- "lefthook": "^1.13.0",
53
- "responsive-class-variants": "^1.1.1",
54
- "storybook": "^9.1.6",
55
- "tailwindcss": "^4.1.13",
47
+ "@types/node": "^24.10.1",
48
+ "@types/react": "^19.2.5",
49
+ "@types/react-dom": "^19.2.3",
50
+ "@vitejs/plugin-react": "^5.1.1",
51
+ "jsdom": "^27.2.0",
52
+ "lefthook": "^2.0.4",
53
+ "responsive-class-variants": "^1.2.3",
54
+ "storybook": "^10.0.7",
55
+ "tailwindcss": "^4.1.17",
56
56
  "tsc-alias": "^1.8.16",
57
- "typescript": "^5.9.2",
58
- "vite": "^7.1.5",
59
- "vitest": "^3.2.4"
57
+ "typescript": "^5.9.3",
58
+ "vite": "^7.2.2",
59
+ "vitest": "^4.0.9"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": "^18.0.0 || ^19.0.0",
@@ -68,7 +68,7 @@
68
68
  "clsx": "^2.1.1",
69
69
  "radix-ui": "^1.4.3",
70
70
  "sonner": "^2.0.7",
71
- "tailwind-merge": "^3.3.1"
71
+ "tailwind-merge": "^3.4.0"
72
72
  },
73
73
  "packageManager": "pnpm@9.14.2"
74
74
  }