luan-ui 0.5.3 → 0.6.1

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.
Files changed (103) hide show
  1. package/README.md +7 -3
  2. package/dist/components/accordion/accordion.d.ts +14 -15
  3. package/dist/components/accordion/accordion.js +11 -9
  4. package/dist/components/accordion/accordion.js.map +1 -1
  5. package/dist/components/alert/alert.d.ts +19 -18
  6. package/dist/components/alert/alert.js +34 -14
  7. package/dist/components/alert/alert.js.map +1 -1
  8. package/dist/components/alert-dialog/alert-dialog.d.ts +14 -9
  9. package/dist/components/alert-dialog/alert-dialog.js +21 -15
  10. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  11. package/dist/components/avatar/avatar-group.d.ts +3 -2
  12. package/dist/components/avatar/avatar-group.js +4 -4
  13. package/dist/components/avatar/avatar-group.js.map +1 -1
  14. package/dist/components/avatar/avatar.d.ts +8 -4
  15. package/dist/components/avatar/avatar.js +10 -8
  16. package/dist/components/avatar/avatar.js.map +1 -1
  17. package/dist/components/badge/badge.d.ts +12 -5
  18. package/dist/components/badge/badge.js +18 -7
  19. package/dist/components/badge/badge.js.map +1 -1
  20. package/dist/components/button/button.d.ts +24 -18
  21. package/dist/components/button/button.js +30 -15
  22. package/dist/components/button/button.js.map +1 -1
  23. package/dist/components/card/card.d.ts +32 -19
  24. package/dist/components/card/card.js +51 -19
  25. package/dist/components/card/card.js.map +1 -1
  26. package/dist/components/checkbox/checkbox.d.ts +6 -7
  27. package/dist/components/checkbox/checkbox.js +6 -8
  28. package/dist/components/checkbox/checkbox.js.map +1 -1
  29. package/dist/components/dialog/dialog.d.ts +16 -9
  30. package/dist/components/dialog/dialog.js +23 -18
  31. package/dist/components/dialog/dialog.js.map +1 -1
  32. package/dist/components/drawer/drawer.d.ts +19 -9
  33. package/dist/components/drawer/drawer.js +31 -25
  34. package/dist/components/drawer/drawer.js.map +1 -1
  35. package/dist/components/dropdown-menu/dropdown-menu.d.ts +30 -21
  36. package/dist/components/dropdown-menu/dropdown-menu.js +35 -30
  37. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  38. package/dist/components/form-field/form-field.d.ts +4 -8
  39. package/dist/components/form-field/form-field.js +3 -4
  40. package/dist/components/form-field/form-field.js.map +1 -1
  41. package/dist/components/form-helper/form-helper.d.ts +4 -6
  42. package/dist/components/form-helper/form-helper.js +2 -3
  43. package/dist/components/form-helper/form-helper.js.map +1 -1
  44. package/dist/components/icon/icon.d.ts +9 -15
  45. package/dist/components/icon/icon.js +20 -19
  46. package/dist/components/icon/icon.js.map +1 -1
  47. package/dist/components/input/input.d.ts +4 -4
  48. package/dist/components/input/input.js +2 -4
  49. package/dist/components/input/input.js.map +1 -1
  50. package/dist/components/label/label.d.ts +3 -4
  51. package/dist/components/label/label.js +5 -6
  52. package/dist/components/label/label.js.map +1 -1
  53. package/dist/components/pagination/pagination.d.ts +25 -21
  54. package/dist/components/pagination/pagination.js +30 -19
  55. package/dist/components/pagination/pagination.js.map +1 -1
  56. package/dist/components/popover/popover.d.ts +30 -14
  57. package/dist/components/popover/popover.js +30 -22
  58. package/dist/components/popover/popover.js.map +1 -1
  59. package/dist/components/progress/progress.d.ts +4 -6
  60. package/dist/components/progress/progress.js +4 -6
  61. package/dist/components/progress/progress.js.map +1 -1
  62. package/dist/components/radio-group/radio-group.d.ts +8 -7
  63. package/dist/components/radio-group/radio-group.js +8 -35
  64. package/dist/components/radio-group/radio-group.js.map +1 -1
  65. package/dist/components/select/select.d.ts +26 -15
  66. package/dist/components/select/select.js +28 -50
  67. package/dist/components/select/select.js.map +1 -1
  68. package/dist/components/skeleton/skeleton.d.ts +3 -1
  69. package/dist/components/skeleton/skeleton.js +3 -6
  70. package/dist/components/skeleton/skeleton.js.map +1 -1
  71. package/dist/components/slider/slider.d.ts +7 -14
  72. package/dist/components/slider/slider.js +23 -13
  73. package/dist/components/slider/slider.js.map +1 -1
  74. package/dist/components/switch/switch.d.ts +7 -7
  75. package/dist/components/switch/switch.js +8 -10
  76. package/dist/components/switch/switch.js.map +1 -1
  77. package/dist/components/table/table.d.ts +17 -8
  78. package/dist/components/table/table.js +24 -41
  79. package/dist/components/table/table.js.map +1 -1
  80. package/dist/components/tabs/tabs.d.ts +9 -5
  81. package/dist/components/tabs/tabs.js +10 -8
  82. package/dist/components/tabs/tabs.js.map +1 -1
  83. package/dist/components/text-area/text-area.d.ts +3 -5
  84. package/dist/components/text-area/text-area.js +2 -4
  85. package/dist/components/text-area/text-area.js.map +1 -1
  86. package/dist/components/toast/toast.d.ts +4 -10
  87. package/dist/components/toast/toast.js +4 -7
  88. package/dist/components/toast/toast.js.map +1 -1
  89. package/dist/components/tooltip/tooltip.d.ts +18 -9
  90. package/dist/components/tooltip/tooltip.js +21 -20
  91. package/dist/components/tooltip/tooltip.js.map +1 -1
  92. package/dist/index.d.ts +2 -2
  93. package/dist/index.js +2 -2
  94. package/dist/index.js.map +1 -1
  95. package/dist/styles/index.css +2 -2
  96. package/dist/utilities/merge-refs/merge-refs.d.ts +2 -2
  97. package/dist/utilities/merge-refs/merge-refs.js +1 -1
  98. package/dist/utilities/merge-refs/merge-refs.js.map +1 -1
  99. package/dist/utilities/responsive/responsive.d.ts +8 -4
  100. package/package.json +71 -72
  101. package/dist/components/slot/slot.d.ts +0 -13
  102. package/dist/components/slot/slot.js +0 -70
  103. package/dist/components/slot/slot.js.map +0 -1
@@ -1,7 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Slot } from "../slot/slot";
1
+ import { mergeProps } from "@base-ui/react/merge-props";
2
+ import { useRender } from "@base-ui/react/use-render";
3
3
  import { getVariants } from "../../utilities/responsive/responsive";
4
- import { forwardRef } from "react";
5
4
  const badgeStyles = getVariants({
6
5
  base: "flex w-fit items-center justify-center rounded-full font-medium",
7
6
  variants: {
@@ -25,10 +24,22 @@ const badgeStyles = getVariants({
25
24
  * ```tsx
26
25
  * <Badge variant="primary" size="medium">New</Badge>
27
26
  * ```
27
+ *
28
+ * @example
29
+ * // With render prop to change the element
30
+ * ```tsx
31
+ * <Badge render={<a href="/link" />}>Link Badge</Badge>
32
+ * ```
28
33
  */
29
- const Badge = forwardRef(({ className, asChild, variant = "primary", size = "medium", ...props }, ref) => {
30
- const Component = asChild ? Slot : "div";
31
- return (_jsx(Component, { className: badgeStyles({ className, variant, size }), ref: ref, ...props }));
32
- });
34
+ function Badge({ className, variant = "primary", size = "medium", render, ...props }) {
35
+ const defaultProps = {
36
+ className: badgeStyles({ className, variant, size }),
37
+ };
38
+ return useRender({
39
+ defaultTagName: "div",
40
+ render,
41
+ props: mergeProps(defaultProps, props),
42
+ });
43
+ }
33
44
  export { Badge };
34
45
  //# sourceMappingURL=badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sourceRoot":"/","sources":["components/badge/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAgBnC,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,iEAAiE;IACvE,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS,EAAE,2BAA2B;YACtC,WAAW,EAAE,uBAAuB;YACpC,OAAO,EAAE,+CAA+C;SACxD;QACD,IAAI,EAAE;YACL,KAAK,EAAE,yBAAyB;YAChC,MAAM,EAAE,yBAAyB;YACjC,KAAK,EAAE,yBAAyB;SAChC;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,UAAU,CACvB,CACC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,EACtE,GAAG,EACF,EAAE;IACH,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,KAAC,SAAS,IACT,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EACpD,GAAG,EAAE,GAAG,KACJ,KAAK,GACR,CACF,CAAC;AACH,CAAC,CACD,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { Slot } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport type { ComponentProps } from \"react\";\nimport { forwardRef } from \"react\";\n\n/**\n * Props for the Badge component\n * @interface BadgeProps\n * @extends {ComponentProps<\"div\">}\n */\nexport type BadgeProps = ComponentProps<\"div\"> & {\n\t/** Whether to render the badge as a child component */\n\tasChild?: boolean;\n\t/** The visual style variant of the badge */\n\tvariant?: \"primary\" | \"secondary\" | \"destructive\" | \"outline\";\n\t/** The size of the badge, can be responsive */\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n};\n\nconst badgeStyles = getVariants({\n\tbase: \"flex w-fit items-center justify-center rounded-full font-medium\",\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: \"bg-gray-700 text-white\",\n\t\t\tsecondary: \"bg-gray-200 text-gray-700\",\n\t\t\tdestructive: \"bg-red-500 text-white\",\n\t\t\toutline: \"border border-gray-700 bg-white text-gray-700\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"gap-1 px-2 py-1 text-xs\",\n\t\t\tmedium: \"gap-1 px-3 py-1 text-sm\",\n\t\t\tlarge: \"gap-2 px-4 py-2 text-lg\",\n\t\t},\n\t},\n});\n\n/**\n * Badge component for displaying status, labels, or counts\n * @component\n * @example\n * ```tsx\n * <Badge variant=\"primary\" size=\"medium\">New</Badge>\n * ```\n */\nconst Badge = forwardRef<HTMLDivElement, BadgeProps>(\n\t(\n\t\t{ className, asChild, variant = \"primary\", size = \"medium\", ...props },\n\t\tref,\n\t) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tclassName={badgeStyles({ className, variant, size })}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport { Badge };\n"]}
1
+ {"version":3,"file":"badge.js","sourceRoot":"/","sources":["components/badge/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAkB/D,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,iEAAiE;IACvE,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS,EAAE,2BAA2B;YACtC,WAAW,EAAE,uBAAuB;YACpC,OAAO,EAAE,+CAA+C;SACxD;QACD,IAAI,EAAE;YACL,KAAK,EAAE,yBAAyB;YAChC,MAAM,EAAE,yBAAyB;YACjC,KAAK,EAAE,yBAAyB;SAChC;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,SAAS,KAAK,CAAC,EACd,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,MAAM,EACN,GAAG,KAAK,EACI;IACZ,MAAM,YAAY,GAAkC;QACnD,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KACpD,CAAC;IAEF,OAAO,SAAS,CAAC;QAChB,cAAc,EAAE,KAAK;QACrB,MAAM;QACN,KAAK,EAAE,UAAU,CAAQ,YAAY,EAAE,KAAK,CAAC;KAC7C,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Props for the Badge component\n * @interface BadgeProps\n * @extends {useRender.ComponentProps<\"div\">}\n */\nexport type BadgeProps = Omit<ComponentProps<\"div\">, \"className\"> &\n\tuseRender.ComponentProps<\"div\"> & {\n\t\t/** The visual style variant of the badge */\n\t\tvariant?: \"primary\" | \"secondary\" | \"destructive\" | \"outline\";\n\t\t/** The size of the badge, can be responsive */\n\t\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\t\t/** Additional CSS classes to apply */\n\t\tclassName?: string;\n\t};\n\nconst badgeStyles = getVariants({\n\tbase: \"flex w-fit items-center justify-center rounded-full font-medium\",\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: \"bg-gray-700 text-white\",\n\t\t\tsecondary: \"bg-gray-200 text-gray-700\",\n\t\t\tdestructive: \"bg-red-500 text-white\",\n\t\t\toutline: \"border border-gray-700 bg-white text-gray-700\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"gap-1 px-2 py-1 text-xs\",\n\t\t\tmedium: \"gap-1 px-3 py-1 text-sm\",\n\t\t\tlarge: \"gap-2 px-4 py-2 text-lg\",\n\t\t},\n\t},\n});\n\n/**\n * Badge component for displaying status, labels, or counts\n * @component\n * @example\n * ```tsx\n * <Badge variant=\"primary\" size=\"medium\">New</Badge>\n * ```\n *\n * @example\n * // With render prop to change the element\n * ```tsx\n * <Badge render={<a href=\"/link\" />}>Link Badge</Badge>\n * ```\n */\nfunction Badge({\n\tclassName,\n\tvariant = \"primary\",\n\tsize = \"medium\",\n\trender,\n\t...props\n}: BadgeProps) {\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: badgeStyles({ className, variant, size }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nexport { Badge };\n"]}
@@ -1,10 +1,9 @@
1
+ import { useRender } from "@base-ui/react/use-render";
1
2
  import type { ResponsiveValue } from "../../utilities/responsive/responsive";
2
- export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
3
+ export type ButtonProps = useRender.ComponentProps<"button"> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className"> & {
3
4
  variant?: "primary" | "secondary" | "destructive";
4
5
  size?: ResponsiveValue<"small" | "medium" | "large">;
5
- asChild?: boolean;
6
- iconStart?: React.ReactNode;
7
- iconEnd?: React.ReactNode;
6
+ className?: string;
8
7
  };
9
8
  export declare const SIZES: {
10
9
  sm: {
@@ -24,37 +23,44 @@ export declare const SIZES: {
24
23
  };
25
24
  };
26
25
  /**
27
- * A flexible button component that supports variants, sizes, and icons
26
+ * A flexible button component that supports variants and sizes.
27
+ * Icons should be rendered by the consumer as part of children.
28
+ *
28
29
  * @param {Object} props - The props for the Button component
29
- * @param {'primary' | 'secondary'} [props.variant='primary'] - The visual style variant of the button
30
+ * @param {'primary' | 'secondary' | 'destructive'} [props.variant='primary'] - The visual style variant of the button
30
31
  * @param {'small' | 'medium' | 'large'} [props.size='medium'] - The size of the button
31
- * @param {boolean} [props.asChild] - Whether to render the button as a child component using Radix Slot
32
- * @param {React.ReactNode} [props.iconStart] - Icon element to display before the button content
33
- * @param {React.ReactNode} [props.iconEnd] - Icon element to display after the button content
32
+ * @param {React.ReactElement | ((props, state) => React.ReactElement)} [props.render] - Custom element to render instead of button
34
33
  * @param {string} [props.className] - Additional CSS classes to apply
35
34
  * @param {boolean} [props.disabled] - Whether the button is disabled
36
35
  * @returns {React.ReactElement} The Button component
36
+ *
37
37
  * @example
38
38
  * // Basic usage
39
39
  * <Button>Click me</Button>
40
40
  *
41
+ * @example
41
42
  * // With variants and size
42
43
  * <Button variant="secondary" size="large">
43
44
  * Large Secondary Button
44
45
  * </Button>
45
46
  *
46
- * // With icons
47
- * <Button iconStart={<SearchIcon />} iconEnd={<ArrowRightIcon />}>
47
+ * @example
48
+ * // With icons (rendered by consumer)
49
+ * <Button>
50
+ * <Icon render={<SearchIcon />} size="small" />
48
51
  * Search
52
+ * <Icon render={<ArrowRightIcon />} size="small" />
49
53
  * </Button>
50
54
  *
55
+ * @example
56
+ * // As a link using render prop
57
+ * <Button render={<a href="/contact" />}>Contact Us</Button>
58
+ *
59
+ * @example
51
60
  * // Disabled state
52
61
  * <Button disabled>Disabled Button</Button>
53
62
  */
54
- export declare const Button: import("react").ForwardRefExoticComponent<import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
55
- variant?: "primary" | "secondary" | "destructive";
56
- size?: ResponsiveValue<"small" | "medium" | "large">;
57
- asChild?: boolean;
58
- iconStart?: React.ReactNode;
59
- iconEnd?: React.ReactNode;
60
- } & import("react").RefAttributes<HTMLButtonElement>>;
63
+ export declare function Button({ children, variant, size, className, disabled, render, ...props }: ButtonProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
64
+ export declare namespace Button {
65
+ var displayName: string;
66
+ }
@@ -1,8 +1,6 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Icon } from "../icon/icon";
3
- import { Slot, Slottable } from "../slot/slot";
1
+ import { mergeProps } from "@base-ui/react/merge-props";
2
+ import { useRender } from "@base-ui/react/use-render";
4
3
  import { getVariants } from "../../utilities/responsive/responsive";
5
- import { forwardRef } from "react";
6
4
  export const SIZES = {
7
5
  sm: {
8
6
  small: "sm:text-sm sm:px-2 sm:py-1 sm:gap-2",
@@ -46,36 +44,53 @@ const buttonStyles = getVariants({
46
44
  ],
47
45
  });
48
46
  /**
49
- * A flexible button component that supports variants, sizes, and icons
47
+ * A flexible button component that supports variants and sizes.
48
+ * Icons should be rendered by the consumer as part of children.
49
+ *
50
50
  * @param {Object} props - The props for the Button component
51
- * @param {'primary' | 'secondary'} [props.variant='primary'] - The visual style variant of the button
51
+ * @param {'primary' | 'secondary' | 'destructive'} [props.variant='primary'] - The visual style variant of the button
52
52
  * @param {'small' | 'medium' | 'large'} [props.size='medium'] - The size of the button
53
- * @param {boolean} [props.asChild] - Whether to render the button as a child component using Radix Slot
54
- * @param {React.ReactNode} [props.iconStart] - Icon element to display before the button content
55
- * @param {React.ReactNode} [props.iconEnd] - Icon element to display after the button content
53
+ * @param {React.ReactElement | ((props, state) => React.ReactElement)} [props.render] - Custom element to render instead of button
56
54
  * @param {string} [props.className] - Additional CSS classes to apply
57
55
  * @param {boolean} [props.disabled] - Whether the button is disabled
58
56
  * @returns {React.ReactElement} The Button component
57
+ *
59
58
  * @example
60
59
  * // Basic usage
61
60
  * <Button>Click me</Button>
62
61
  *
62
+ * @example
63
63
  * // With variants and size
64
64
  * <Button variant="secondary" size="large">
65
65
  * Large Secondary Button
66
66
  * </Button>
67
67
  *
68
- * // With icons
69
- * <Button iconStart={<SearchIcon />} iconEnd={<ArrowRightIcon />}>
68
+ * @example
69
+ * // With icons (rendered by consumer)
70
+ * <Button>
71
+ * <Icon render={<SearchIcon />} size="small" />
70
72
  * Search
73
+ * <Icon render={<ArrowRightIcon />} size="small" />
71
74
  * </Button>
72
75
  *
76
+ * @example
77
+ * // As a link using render prop
78
+ * <Button render={<a href="/contact" />}>Contact Us</Button>
79
+ *
80
+ * @example
73
81
  * // Disabled state
74
82
  * <Button disabled>Disabled Button</Button>
75
83
  */
76
- export const Button = forwardRef(({ asChild, children, variant = "primary", size = "medium", className, disabled, iconStart, iconEnd, ...props }, ref) => {
77
- const Component = asChild ? Slot : "button";
78
- return (_jsx(Component, { ref: ref, className: buttonStyles({ variant, size, disabled, className }), ...props, children: _jsx(Slottable, { child: children, children: (child) => (_jsxs(_Fragment, { children: [iconStart && (_jsx(Icon, { size: size, asChild: true, children: iconStart })), child, iconEnd && (_jsx(Icon, { size: size, asChild: true, children: iconEnd }))] })) }) }));
79
- });
84
+ export function Button({ children, variant = "primary", size = "medium", className, disabled, render, ...props }) {
85
+ const defaultProps = {
86
+ className: buttonStyles({ variant, size, disabled, className }),
87
+ children,
88
+ };
89
+ return useRender({
90
+ defaultTagName: "button",
91
+ render,
92
+ props: mergeProps(defaultProps, props),
93
+ });
94
+ }
80
95
  Button.displayName = "Button";
81
96
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"/","sources":["components/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAUnC,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;IACD,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;IACD,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;CACD,CAAC;AAEF,MAAM,YAAY,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,0FAA0F;IAChG,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EACN,gFAAgF;YACjF,SAAS,EACR,4EAA4E;YAC7E,WAAW,EACV,6EAA6E;SAC9E;QACD,IAAI,EAAE;YACL,KAAK,EAAE,yBAAyB;YAChC,MAAM,EAAE,2BAA2B;YACnC,KAAK,EAAE,yBAAyB;SAChC;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,+BAA+B;SACrC;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,uBAAuB;SAClC;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC/B,CACC,EACC,OAAO,EACP,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,OAAO,CACN,KAAC,SAAS,IACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,KAC3D,KAAK,YAET,KAAC,SAAS,IAAC,KAAK,EAAE,QAAQ,YACxB,CAAC,KAAK,EAAE,EAAE,CAAC,CACX,8BACE,SAAS,IAAI,CACb,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,kBACvB,SAAS,GACJ,CACP,EACA,KAAK,EACL,OAAO,IAAI,CACX,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,kBACvB,OAAO,GACF,CACP,IACC,CACH,GACU,GACD,CACZ,CAAC;AACH,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import { Icon } from \"@components/icon/icon\";\nimport { Slot, Slottable } from \"@components/slot/slot\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { forwardRef } from \"react\";\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n\tvariant?: \"primary\" | \"secondary\" | \"destructive\";\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tasChild?: boolean;\n\ticonStart?: React.ReactNode;\n\ticonEnd?: React.ReactNode;\n};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-sm sm:px-2 sm:py-1 sm:gap-2\",\n\t\tmedium: \"sm:text-base sm:px-4 sm:py-2 sm:gap-4\",\n\t\tlarge: \"sm:text-lg sm:px-6 sm:py-3 sm:gap-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-sm md:px-2 md:py-1 md:gap-2\",\n\t\tmedium: \"md:text-base md:px-4 md:py-2 md:gap-4\",\n\t\tlarge: \"md:text-lg md:px-6 md:py-3 md:gap-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-sm lg:px-2 lg:py-1 lg:gap-2\",\n\t\tmedium: \"lg:text-base lg:px-4 lg:py-2 lg:gap-4\",\n\t\tlarge: \"lg:text-lg lg:px-6 lg:py-3 lg:gap-6\",\n\t},\n};\n\nconst buttonStyles = getVariants({\n\tbase: \"flex w-fit cursor-pointer items-center justify-center gap-2 rounded border font-semibold\",\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary:\n\t\t\t\t\"border-transparent bg-gray-700 text-white hover:bg-gray-800 active:bg-gray-900\",\n\t\t\tsecondary:\n\t\t\t\t\"border-gray-700 bg-white text-gray-700 hover:bg-gray-50 active:bg-gray-100\",\n\t\t\tdestructive:\n\t\t\t\t\"border-transparent bg-red-500 text-white hover:bg-red-600 active:bg-red-700\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"gap-2 px-2 py-1 text-sm\",\n\t\t\tmedium: \"gap-3 px-4 py-2 text-base\",\n\t\t\tlarge: \"gap-4 px-6 py-3 text-lg\",\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: \"cursor-not-allowed opacity-50\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\tvariant: \"secondary\",\n\t\t\tsize: \"medium\",\n\t\t\tclassName: \"test-compound-variant\",\n\t\t},\n\t],\n});\n\n/**\n * A flexible button component that supports variants, sizes, and icons\n * @param {Object} props - The props for the Button component\n * @param {'primary' | 'secondary'} [props.variant='primary'] - The visual style variant of the button\n * @param {'small' | 'medium' | 'large'} [props.size='medium'] - The size of the button\n * @param {boolean} [props.asChild] - Whether to render the button as a child component using Radix Slot\n * @param {React.ReactNode} [props.iconStart] - Icon element to display before the button content\n * @param {React.ReactNode} [props.iconEnd] - Icon element to display after the button content\n * @param {string} [props.className] - Additional CSS classes to apply\n * @param {boolean} [props.disabled] - Whether the button is disabled\n * @returns {React.ReactElement} The Button component\n * @example\n * // Basic usage\n * <Button>Click me</Button>\n *\n * // With variants and size\n * <Button variant=\"secondary\" size=\"large\">\n * Large Secondary Button\n * </Button>\n *\n * // With icons\n * <Button iconStart={<SearchIcon />} iconEnd={<ArrowRightIcon />}>\n * Search\n * </Button>\n *\n * // Disabled state\n * <Button disabled>Disabled Button</Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(\n\t\t{\n\t\t\tasChild,\n\t\t\tchildren,\n\t\t\tvariant = \"primary\",\n\t\t\tsize = \"medium\",\n\t\t\tclassName,\n\t\t\tdisabled,\n\t\t\ticonStart,\n\t\t\ticonEnd,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst Component = asChild ? Slot : \"button\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tref={ref}\n\t\t\t\tclassName={buttonStyles({ variant, size, disabled, className })}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<Slottable child={children}>\n\t\t\t\t\t{(child) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{iconStart && (\n\t\t\t\t\t\t\t\t<Icon size={size} asChild>\n\t\t\t\t\t\t\t\t\t{iconStart}\n\t\t\t\t\t\t\t\t</Icon>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{child}\n\t\t\t\t\t\t\t{iconEnd && (\n\t\t\t\t\t\t\t\t<Icon size={size} asChild>\n\t\t\t\t\t\t\t\t\t{iconEnd}\n\t\t\t\t\t\t\t\t</Icon>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</Slottable>\n\t\t\t</Component>\n\t\t);\n\t},\n);\n\nButton.displayName = \"Button\";\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot":"/","sources":["components/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAS/D,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;IACD,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;IACD,EAAE,EAAE;QACH,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EAAE,uCAAuC;QAC/C,KAAK,EAAE,qCAAqC;KAC5C;CACD,CAAC;AAEF,MAAM,YAAY,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,0FAA0F;IAChG,QAAQ,EAAE;QACT,OAAO,EAAE;YACR,OAAO,EACN,gFAAgF;YACjF,SAAS,EACR,4EAA4E;YAC7E,WAAW,EACV,6EAA6E;SAC9E;QACD,IAAI,EAAE;YACL,KAAK,EAAE,yBAAyB;YAChC,MAAM,EAAE,2BAA2B;YACnC,KAAK,EAAE,yBAAyB;SAChC;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,+BAA+B;SACrC;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,uBAAuB;SAClC;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,MAAM,CAAC,EACtB,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,SAAS,EACT,QAAQ,EACR,MAAM,EACN,GAAG,KAAK,EACK;IACb,MAAM,YAAY,GAAqC;QACtD,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;QAC/D,QAAQ;KACR,CAAC;IAEF,OAAO,SAAS,CAAC;QAChB,cAAc,EAAE,QAAQ;QACxB,MAAM;QACN,KAAK,EAAE,UAAU,CAAW,YAAY,EAAE,KAAK,CAAC;KAChD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\n\nexport type ButtonProps = useRender.ComponentProps<\"button\"> &\n\tOmit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"className\"> & {\n\t\tvariant?: \"primary\" | \"secondary\" | \"destructive\";\n\t\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\t\tclassName?: string;\n\t};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-sm sm:px-2 sm:py-1 sm:gap-2\",\n\t\tmedium: \"sm:text-base sm:px-4 sm:py-2 sm:gap-4\",\n\t\tlarge: \"sm:text-lg sm:px-6 sm:py-3 sm:gap-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-sm md:px-2 md:py-1 md:gap-2\",\n\t\tmedium: \"md:text-base md:px-4 md:py-2 md:gap-4\",\n\t\tlarge: \"md:text-lg md:px-6 md:py-3 md:gap-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-sm lg:px-2 lg:py-1 lg:gap-2\",\n\t\tmedium: \"lg:text-base lg:px-4 lg:py-2 lg:gap-4\",\n\t\tlarge: \"lg:text-lg lg:px-6 lg:py-3 lg:gap-6\",\n\t},\n};\n\nconst buttonStyles = getVariants({\n\tbase: \"flex w-fit cursor-pointer items-center justify-center gap-2 rounded border font-semibold\",\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary:\n\t\t\t\t\"border-transparent bg-gray-700 text-white hover:bg-gray-800 active:bg-gray-900\",\n\t\t\tsecondary:\n\t\t\t\t\"border-gray-700 bg-white text-gray-700 hover:bg-gray-50 active:bg-gray-100\",\n\t\t\tdestructive:\n\t\t\t\t\"border-transparent bg-red-500 text-white hover:bg-red-600 active:bg-red-700\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"gap-2 px-2 py-1 text-sm\",\n\t\t\tmedium: \"gap-3 px-4 py-2 text-base\",\n\t\t\tlarge: \"gap-4 px-6 py-3 text-lg\",\n\t\t},\n\t\tdisabled: {\n\t\t\ttrue: \"cursor-not-allowed opacity-50\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\tvariant: \"secondary\",\n\t\t\tsize: \"medium\",\n\t\t\tclassName: \"test-compound-variant\",\n\t\t},\n\t],\n});\n\n/**\n * A flexible button component that supports variants and sizes.\n * Icons should be rendered by the consumer as part of children.\n *\n * @param {Object} props - The props for the Button component\n * @param {'primary' | 'secondary' | 'destructive'} [props.variant='primary'] - The visual style variant of the button\n * @param {'small' | 'medium' | 'large'} [props.size='medium'] - The size of the button\n * @param {React.ReactElement | ((props, state) => React.ReactElement)} [props.render] - Custom element to render instead of button\n * @param {string} [props.className] - Additional CSS classes to apply\n * @param {boolean} [props.disabled] - Whether the button is disabled\n * @returns {React.ReactElement} The Button component\n *\n * @example\n * // Basic usage\n * <Button>Click me</Button>\n *\n * @example\n * // With variants and size\n * <Button variant=\"secondary\" size=\"large\">\n * Large Secondary Button\n * </Button>\n *\n * @example\n * // With icons (rendered by consumer)\n * <Button>\n * <Icon render={<SearchIcon />} size=\"small\" />\n * Search\n * <Icon render={<ArrowRightIcon />} size=\"small\" />\n * </Button>\n *\n * @example\n * // As a link using render prop\n * <Button render={<a href=\"/contact\" />}>Contact Us</Button>\n *\n * @example\n * // Disabled state\n * <Button disabled>Disabled Button</Button>\n */\nexport function Button({\n\tchildren,\n\tvariant = \"primary\",\n\tsize = \"medium\",\n\tclassName,\n\tdisabled,\n\trender,\n\t...props\n}: ButtonProps) {\n\tconst defaultProps: useRender.ElementProps<\"button\"> = {\n\t\tclassName: buttonStyles({ variant, size, disabled, className }),\n\t\tchildren,\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"button\",\n\t\trender,\n\t\tprops: mergeProps<\"button\">(defaultProps, props),\n\t});\n}\n\nButton.displayName = \"Button\";\n"]}
@@ -1,10 +1,11 @@
1
+ import { useRender } from "@base-ui/react/use-render";
1
2
  import type { ResponsiveValue } from "../../utilities/responsive/responsive";
2
3
  /**
3
4
  * Card
4
5
  */
5
- export type CardProps = React.HTMLAttributes<HTMLDivElement> & {
6
+ export type CardProps = useRender.ComponentProps<"div"> & {
6
7
  size?: ResponsiveValue<"small" | "medium" | "large">;
7
- asChild?: boolean;
8
+ className?: string;
8
9
  };
9
10
  export declare const CARD_SIZES: {
10
11
  sm: {
@@ -30,7 +31,7 @@ export declare const CARD_SIZES: {
30
31
  };
31
32
  /**
32
33
  * Card component that provides a container with consistent styling and spacing.
33
- * Supports different sizes and can be used with asChild prop for composition.
34
+ * Supports different sizes and can be used with render prop for composition.
34
35
  *
35
36
  * @example
36
37
  * ```tsx
@@ -40,17 +41,22 @@ export declare const CARD_SIZES: {
40
41
  * <CardFooter>Footer</CardFooter>
41
42
  * </Card>
42
43
  * ```
44
+ *
45
+ * @example
46
+ * // With render prop to change the element
47
+ * ```tsx
48
+ * <Card render={<article />}>Content</Card>
49
+ * ```
43
50
  */
44
- export declare const Card: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
45
- size?: ResponsiveValue<"small" | "medium" | "large">;
46
- asChild?: boolean;
47
- } & import("react").RefAttributes<HTMLDivElement>>;
51
+ export declare function Card({ className, size, render, children, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
52
+ export declare namespace Card {
53
+ var displayName: string;
54
+ }
48
55
  /**
49
56
  * Card Header
50
57
  */
51
- export type CardHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
52
- size?: ResponsiveValue<"small" | "medium" | "large">;
53
- asChild?: boolean;
58
+ export type CardHeaderProps = useRender.ComponentProps<"div"> & {
59
+ className?: string;
54
60
  };
55
61
  export declare const CARD_HEADER_SIZES: {
56
62
  sm: {
@@ -86,13 +92,15 @@ export declare const CARD_HEADER_SIZES: {
86
92
  * </CardHeader>
87
93
  * ```
88
94
  */
89
- export declare const CardHeader: import("react").ForwardRefExoticComponent<Omit<CardHeaderProps, "size"> & import("react").RefAttributes<HTMLDivElement>>;
95
+ export declare function CardHeader({ className, render, ...props }: CardHeaderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
96
+ export declare namespace CardHeader {
97
+ var displayName: string;
98
+ }
90
99
  /**
91
100
  * Card Content
92
101
  */
93
- export type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {
94
- size?: ResponsiveValue<"small" | "medium" | "large">;
95
- asChild?: boolean;
102
+ export type CardContentProps = useRender.ComponentProps<"div"> & {
103
+ className?: string;
96
104
  };
97
105
  export declare const CARD_CONTENT_SIZES: {
98
106
  sm: {
@@ -127,13 +135,15 @@ export declare const CARD_CONTENT_SIZES: {
127
135
  * </CardContent>
128
136
  * ```
129
137
  */
130
- export declare const CardContent: import("react").ForwardRefExoticComponent<Omit<CardContentProps, "size"> & import("react").RefAttributes<HTMLDivElement>>;
138
+ export declare function CardContent({ className, render, ...props }: CardContentProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
139
+ export declare namespace CardContent {
140
+ var displayName: string;
141
+ }
131
142
  /**
132
143
  * Card Footer
133
144
  */
134
- export type CardFooterProps = React.HTMLAttributes<HTMLDivElement> & {
135
- size?: ResponsiveValue<"small" | "medium" | "large">;
136
- asChild?: boolean;
145
+ export type CardFooterProps = useRender.ComponentProps<"div"> & {
146
+ className?: string;
137
147
  };
138
148
  export declare const CARD_FOOTER_SIZES: {
139
149
  sm: {
@@ -169,4 +179,7 @@ export declare const CARD_FOOTER_SIZES: {
169
179
  * </CardFooter>
170
180
  * ```
171
181
  */
172
- export declare const CardFooter: import("react").ForwardRefExoticComponent<Omit<CardFooterProps, "size"> & import("react").RefAttributes<HTMLDivElement>>;
182
+ export declare function CardFooter({ className, render, ...props }: CardFooterProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
183
+ export declare namespace CardFooter {
184
+ var displayName: string;
185
+ }
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Slot } from "../slot/slot";
2
+ import { mergeProps } from "@base-ui/react/merge-props";
3
+ import { useRender } from "@base-ui/react/use-render";
3
4
  import { getVariants } from "../../utilities/responsive/responsive";
4
- import { createContext, forwardRef, useContext } from "react";
5
+ import { createContext, useContext } from "react";
5
6
  const CardContext = createContext(undefined);
6
7
  const useCardContext = () => {
7
8
  const context = useContext(CardContext);
@@ -65,7 +66,7 @@ const cardStyles = getVariants({
65
66
  const { root, header, content, footer } = cardStyles();
66
67
  /**
67
68
  * Card component that provides a container with consistent styling and spacing.
68
- * Supports different sizes and can be used with asChild prop for composition.
69
+ * Supports different sizes and can be used with render prop for composition.
69
70
  *
70
71
  * @example
71
72
  * ```tsx
@@ -75,11 +76,24 @@ const { root, header, content, footer } = cardStyles();
75
76
  * <CardFooter>Footer</CardFooter>
76
77
  * </Card>
77
78
  * ```
79
+ *
80
+ * @example
81
+ * // With render prop to change the element
82
+ * ```tsx
83
+ * <Card render={<article />}>Content</Card>
84
+ * ```
78
85
  */
79
- export const Card = forwardRef(({ className, size = "medium", asChild, ...props }, ref) => {
80
- const Component = asChild ? Slot : "div";
81
- return (_jsx(CardContext.Provider, { value: { size }, children: _jsx(Component, { ref: ref, className: root({ className, size }), ...props }) }));
82
- });
86
+ export function Card({ className, size = "medium", render, children, ...props }) {
87
+ const defaultProps = {
88
+ className: root({ className, size }),
89
+ children: (_jsx(CardContext.Provider, { value: { size }, children: children })),
90
+ };
91
+ return useRender({
92
+ defaultTagName: "div",
93
+ render,
94
+ props: mergeProps(defaultProps, props),
95
+ });
96
+ }
83
97
  Card.displayName = "Card";
84
98
  export const CARD_HEADER_SIZES = {
85
99
  sm: {
@@ -115,11 +129,17 @@ export const CARD_HEADER_SIZES = {
115
129
  * </CardHeader>
116
130
  * ```
117
131
  */
118
- export const CardHeader = forwardRef(({ className, asChild, ...props }, ref) => {
132
+ export function CardHeader({ className, render, ...props }) {
119
133
  const { size } = useCardContext();
120
- const Component = asChild ? Slot : "div";
121
- return (_jsx(Component, { ref: ref, className: header({ className, size }), ...props }));
122
- });
134
+ const defaultProps = {
135
+ className: header({ className, size }),
136
+ };
137
+ return useRender({
138
+ defaultTagName: "div",
139
+ render,
140
+ props: mergeProps(defaultProps, props),
141
+ });
142
+ }
123
143
  CardHeader.displayName = "CardHeader";
124
144
  export const CARD_CONTENT_SIZES = {
125
145
  sm: {
@@ -154,11 +174,17 @@ export const CARD_CONTENT_SIZES = {
154
174
  * </CardContent>
155
175
  * ```
156
176
  */
157
- export const CardContent = forwardRef(({ className, asChild, ...props }, ref) => {
177
+ export function CardContent({ className, render, ...props }) {
158
178
  const { size } = useCardContext();
159
- const Component = asChild ? Slot : "div";
160
- return (_jsx(Component, { ref: ref, className: content({ className, size }), ...props }));
161
- });
179
+ const defaultProps = {
180
+ className: content({ className, size }),
181
+ };
182
+ return useRender({
183
+ defaultTagName: "div",
184
+ render,
185
+ props: mergeProps(defaultProps, props),
186
+ });
187
+ }
162
188
  CardContent.displayName = "CardContent";
163
189
  export const CARD_FOOTER_SIZES = {
164
190
  sm: {
@@ -194,10 +220,16 @@ export const CARD_FOOTER_SIZES = {
194
220
  * </CardFooter>
195
221
  * ```
196
222
  */
197
- export const CardFooter = forwardRef(({ className, asChild, ...props }, ref) => {
223
+ export function CardFooter({ className, render, ...props }) {
198
224
  const { size } = useCardContext();
199
- const Component = asChild ? Slot : "div";
200
- return (_jsx(Component, { ref: ref, className: footer({ className, size }), ...props }));
201
- });
225
+ const defaultProps = {
226
+ className: footer({ className, size }),
227
+ };
228
+ return useRender({
229
+ defaultTagName: "div",
230
+ render,
231
+ props: mergeProps(defaultProps, props),
232
+ });
233
+ }
202
234
  CardFooter.displayName = "CardFooter";
203
235
  //# sourceMappingURL=card.js.map
@@ -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,EA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AiB;KACxB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,iBAAiB;KACxB;CACD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,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"]}
1
+ {"version":3,"file":"card.js","sourceRoot":"/","sources":["components/card/card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQlD,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,CA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B,KAAK,EAAE,iBAAiB;KACxB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,iBAAiB;KACxB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,iBAAiB;KACxB;CACD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAmB;IAC1E,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,MAAM,YAAY,GAAkC;QACnD,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACtC,CAAC;IAEF,OAAO,SAAS,CAAC;QAChB,cAAc,EAAE,KAAK;QACrB,MAAM;QACN,KAAK,EAAE,UAAU,CAAQ,YAAY,EAAE,KAAK,CAAC;KAC7C,CAAC,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { createContext, 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 = useRender.ComponentProps<\"div\"> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tclassName?: string;\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 render 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 *\n * @example\n * // With render prop to change the element\n * ```tsx\n * <Card render={<article />}>Content</Card>\n * ```\n */\nexport function Card({\n\tclassName,\n\tsize = \"medium\",\n\trender,\n\tchildren,\n\t...props\n}: CardProps) {\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: root({ className, size }),\n\t\tchildren: (\n\t\t\t<CardContext.Provider value={{ size }}>{children}</CardContext.Provider>\n\t\t),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nCard.displayName = \"Card\";\n\n/**\n * Card Header\n */\n\nexport type CardHeaderProps = useRender.ComponentProps<\"div\"> & {\n\tclassName?: string;\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 function CardHeader({ className, render, ...props }: CardHeaderProps) {\n\tconst { size } = useCardContext();\n\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: header({ className, size }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nCardHeader.displayName = \"CardHeader\";\n\n/**\n * Card Content\n */\n\nexport type CardContentProps = useRender.ComponentProps<\"div\"> & {\n\tclassName?: string;\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 function CardContent({ className, render, ...props }: CardContentProps) {\n\tconst { size } = useCardContext();\n\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: content({ className, size }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nCardContent.displayName = \"CardContent\";\n\n/**\n * Card Footer\n */\n\nexport type CardFooterProps = useRender.ComponentProps<\"div\"> & {\n\tclassName?: string;\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 function CardFooter({ className, render, ...props }: CardFooterProps) {\n\tconst { size } = useCardContext();\n\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: footer({ className, size }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nCardFooter.displayName = \"CardFooter\";\n"]}
@@ -1,8 +1,9 @@
1
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
1
2
  import { type ResponsiveValue } from "../../utilities/responsive/responsive";
2
- import { Checkbox as CheckboxPrimitive } from "radix-ui";
3
- import { type ComponentPropsWithoutRef } from "react";
4
- export type CheckboxProps = ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> & {
3
+ import type { ComponentProps } from "react";
4
+ export type CheckboxProps = Omit<ComponentProps<typeof CheckboxPrimitive.Root>, "className"> & {
5
5
  size?: ResponsiveValue<"small" | "medium" | "large">;
6
+ className?: string;
6
7
  };
7
8
  export declare const SIZES: {
8
9
  sm: {
@@ -27,13 +28,11 @@ export declare const SIZES: {
27
28
  };
28
29
  };
29
30
  /**
30
- * A checkbox component built on top of Radix UI's checkbox primitive.
31
+ * A checkbox component built on top of Base UI's checkbox primitive.
31
32
  *
32
33
  * @example
33
34
  * ```tsx
34
35
  * <Checkbox id="checkbox" onCheckedChange={(checked) => console.log(checked)} />
35
36
  * ```
36
37
  */
37
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
38
- size?: ResponsiveValue<"small" | "medium" | "large">;
39
- } & import("react").RefAttributes<HTMLButtonElement>>;
38
+ export declare function Checkbox({ className, disabled: initialDisabled, required: initialRequired, size, ref, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
2
3
  import { useFormContext } from "../form-field/form-field-context";
3
4
  import { Icon } from "../icon/icon";
4
5
  import { CheckIcon } from "@radix-ui/react-icons";
5
6
  import { getVariants, mapResponsiveValue, } from "../../utilities/responsive/responsive";
6
- import { Checkbox as CheckboxPrimitive } from "radix-ui";
7
- import { forwardRef, } from "react";
8
7
  export const SIZES = {
9
8
  sm: {
10
9
  small: "sm:h-4 sm:w-4",
@@ -28,7 +27,7 @@ export const SIZES = {
28
27
  },
29
28
  };
30
29
  const checkboxStyles = getVariants({
31
- base: "peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[state=checked]:bg-gray-700 data-[state=checked]:text-gray-100",
30
+ base: "peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[checked]:bg-gray-700 data-[checked]:text-gray-100",
32
31
  variants: {
33
32
  disabled: {
34
33
  true: "cursor-not-allowed bg-gray-400 opacity-50",
@@ -46,20 +45,19 @@ const iconSizeMap = {
46
45
  large: "medium",
47
46
  };
48
47
  /**
49
- * A checkbox component built on top of Radix UI's checkbox primitive.
48
+ * A checkbox component built on top of Base UI's checkbox primitive.
50
49
  *
51
50
  * @example
52
51
  * ```tsx
53
52
  * <Checkbox id="checkbox" onCheckedChange={(checked) => console.log(checked)} />
54
53
  * ```
55
54
  */
56
- export const Checkbox = forwardRef(({ className, disabled: initialDisabled, required: initialRequired, size = "medium", ...props }, ref) => {
55
+ export function Checkbox({ className, disabled: initialDisabled, required: initialRequired, size = "medium", ref, ...props }) {
57
56
  const iconSize = mapResponsiveValue(size, (size) => iconSizeMap[size]);
58
57
  const { disabled, required } = useFormContext({
59
58
  disabled: initialDisabled,
60
59
  required: initialRequired,
61
60
  });
62
- return (_jsx(CheckboxPrimitive.Root, { className: checkboxStyles({ disabled, size, className }), ref: ref, disabled: disabled, required: required, ...props, children: _jsx(CheckboxPrimitive.Indicator, { children: _jsx(Icon, { asChild: true, size: iconSize, children: _jsx(CheckIcon, {}) }) }) }));
63
- });
64
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
61
+ return (_jsx(CheckboxPrimitive.Root, { className: checkboxStyles({ disabled, size, className }), ref: ref, disabled: disabled, required: required, ...props, children: _jsx(CheckboxPrimitive.Indicator, { children: _jsx(Icon, { render: _jsx(CheckIcon, {}), size: iconSize }) }) }));
62
+ }
65
63
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"/","sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,kBAAkB,GAElB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACzD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,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,iBAAiB,CAAC,IAAI,IACtB,SAAS,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACxD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,cAC3B,KAAC,IAAI,IAAC,OAAO,QAAC,IAAI,EAAE,QAAQ,YAC3B,KAAC,SAAS,KAAG,GACP,GACsB,GACN,CACzB,CAAC;AACH,CAAC,CACD,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport { CheckIcon } from \"@radix-ui/react-icons\";\nimport {\n\tgetVariants,\n\tmapResponsiveValue,\n\ttype ResponsiveValue,\n} from \"@utilities/responsive/responsive\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\n\nexport type CheckboxProps = ComponentPropsWithoutRef<\n\ttypeof CheckboxPrimitive.Root\n> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:h-4 sm:w-4\",\n\t\tmedium: \"sm:h-5 sm:w-5\",\n\t\tlarge: \"sm:h-6 sm:w-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:h-4 md:w-4\",\n\t\tmedium: \"md:h-5 md:w-5\",\n\t\tlarge: \"md:h-6 md:w-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:h-4 lg:w-4\",\n\t\tmedium: \"lg:h-5 lg:w-5\",\n\t\tlarge: \"lg:h-6 lg:w-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:h-4 xl:w-4\",\n\t\tmedium: \"xl:h-5 xl:w-5\",\n\t\tlarge: \"xl:h-6 xl:w-6\",\n\t},\n};\nconst checkboxStyles = getVariants({\n\tbase: \"peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[state=checked]:bg-gray-700 data-[state=checked]:text-gray-100\",\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: \"cursor-not-allowed bg-gray-400 opacity-50\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"h-4 w-4\",\n\t\t\tmedium: \"h-5 w-5\",\n\t\t\tlarge: \"h-6 w-6\",\n\t\t},\n\t},\n});\n\nconst iconSizeMap = {\n\tsmall: \"small\",\n\tmedium: \"medium\",\n\tlarge: \"medium\",\n} as const;\n\n/**\n * A checkbox component built on top of Radix UI's checkbox primitive.\n *\n * @example\n * ```tsx\n * <Checkbox id=\"checkbox\" onCheckedChange={(checked) => console.log(checked)} />\n * ```\n */\nexport const Checkbox = forwardRef<\n\tComponentRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t\tsize = \"medium\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst iconSize = mapResponsiveValue(size, (size) => iconSizeMap[size]);\n\t\tconst { disabled, required } = useFormContext({\n\t\t\tdisabled: initialDisabled,\n\t\t\trequired: initialRequired,\n\t\t});\n\t\treturn (\n\t\t\t<CheckboxPrimitive.Root\n\t\t\t\tclassName={checkboxStyles({ disabled, size, className })}\n\t\t\t\tref={ref}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<CheckboxPrimitive.Indicator>\n\t\t\t\t\t<Icon asChild size={iconSize}>\n\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t</Icon>\n\t\t\t\t</CheckboxPrimitive.Indicator>\n\t\t\t</CheckboxPrimitive.Root>\n\t\t);\n\t},\n);\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n"]}
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"/","sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EACN,WAAW,EACX,kBAAkB,GAElB,MAAM,kCAAkC,CAAC;AAW1C,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;CACD,CAAC;AAEF,MAAM,cAAc,GAAG,WAAW,CAAC;IAClC,IAAI,EAAE,uMAAuM;IAC7M,QAAQ,EAAE;QACT,QAAQ,EAAE;YACT,IAAI,EAAE,2CAA2C;SACjD;QACD,IAAI,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,SAAS;SAChB;KACD;CACD,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG;IACnB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;CACN,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,EACxB,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,IAAI,GAAG,QAAQ,EACf,GAAG,EACH,GAAG,KAAK,EACO;IACf,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC7C,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,iBAAiB,CAAC,IAAI,IACtB,SAAS,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACxD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,cAC3B,KAAC,IAAI,IAAC,MAAM,EAAE,KAAC,SAAS,KAAG,EAAE,IAAI,EAAE,QAAQ,GAAI,GAClB,GACN,CACzB,CAAC;AACH,CAAC","sourcesContent":["import { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport { CheckIcon } from \"@radix-ui/react-icons\";\nimport {\n\tgetVariants,\n\tmapResponsiveValue,\n\ttype ResponsiveValue,\n} from \"@utilities/responsive/responsive\";\nimport type { ComponentProps } from \"react\";\n\nexport type CheckboxProps = Omit<\n\tComponentProps<typeof CheckboxPrimitive.Root>,\n\t\"className\"\n> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\tclassName?: string;\n};\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:h-4 sm:w-4\",\n\t\tmedium: \"sm:h-5 sm:w-5\",\n\t\tlarge: \"sm:h-6 sm:w-6\",\n\t},\n\tmd: {\n\t\tsmall: \"md:h-4 md:w-4\",\n\t\tmedium: \"md:h-5 md:w-5\",\n\t\tlarge: \"md:h-6 md:w-6\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:h-4 lg:w-4\",\n\t\tmedium: \"lg:h-5 lg:w-5\",\n\t\tlarge: \"lg:h-6 lg:w-6\",\n\t},\n\txl: {\n\t\tsmall: \"xl:h-4 xl:w-4\",\n\t\tmedium: \"xl:h-5 xl:w-5\",\n\t\tlarge: \"xl:h-6 xl:w-6\",\n\t},\n};\n\nconst checkboxStyles = getVariants({\n\tbase: \"peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[checked]:bg-gray-700 data-[checked]:text-gray-100\",\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: \"cursor-not-allowed bg-gray-400 opacity-50\",\n\t\t},\n\t\tsize: {\n\t\t\tsmall: \"h-4 w-4\",\n\t\t\tmedium: \"h-5 w-5\",\n\t\t\tlarge: \"h-6 w-6\",\n\t\t},\n\t},\n});\n\nconst iconSizeMap = {\n\tsmall: \"small\",\n\tmedium: \"medium\",\n\tlarge: \"medium\",\n} as const;\n\n/**\n * A checkbox component built on top of Base UI's checkbox primitive.\n *\n * @example\n * ```tsx\n * <Checkbox id=\"checkbox\" onCheckedChange={(checked) => console.log(checked)} />\n * ```\n */\nexport function Checkbox({\n\tclassName,\n\tdisabled: initialDisabled,\n\trequired: initialRequired,\n\tsize = \"medium\",\n\tref,\n\t...props\n}: CheckboxProps) {\n\tconst iconSize = mapResponsiveValue(size, (size) => iconSizeMap[size]);\n\tconst { disabled, required } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t<CheckboxPrimitive.Root\n\t\t\tclassName={checkboxStyles({ disabled, size, className })}\n\t\t\tref={ref}\n\t\t\tdisabled={disabled}\n\t\t\trequired={required}\n\t\t\t{...props}\n\t\t>\n\t\t\t<CheckboxPrimitive.Indicator>\n\t\t\t\t<Icon render={<CheckIcon />} size={iconSize} />\n\t\t\t</CheckboxPrimitive.Indicator>\n\t\t</CheckboxPrimitive.Root>\n\t);\n}\n"]}