@zentauri-ui/zentauri-components 0.0.8 → 0.0.9

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 (132) hide show
  1. package/README.md +27 -2
  2. package/dist/ui/accordion.cjs +311 -0
  3. package/dist/ui/accordion.cjs.map +1 -0
  4. package/dist/ui/accordion.d.cts +70 -0
  5. package/dist/ui/accordion.d.ts +70 -0
  6. package/dist/ui/accordion.js +286 -0
  7. package/dist/ui/accordion.js.map +1 -0
  8. package/dist/ui/alert.cjs +257 -0
  9. package/dist/ui/alert.cjs.map +1 -0
  10. package/dist/ui/alert.d.cts +66 -0
  11. package/dist/ui/alert.d.ts +66 -0
  12. package/dist/ui/alert.js +224 -0
  13. package/dist/ui/alert.js.map +1 -0
  14. package/dist/ui/badge.cjs +192 -0
  15. package/dist/ui/badge.cjs.map +1 -0
  16. package/dist/ui/badge.d.cts +37 -0
  17. package/dist/ui/badge.d.ts +37 -0
  18. package/dist/ui/badge.js +165 -0
  19. package/dist/ui/badge.js.map +1 -0
  20. package/dist/ui/buttons.cjs +202 -0
  21. package/dist/ui/buttons.cjs.map +1 -0
  22. package/dist/ui/buttons.d.cts +27 -0
  23. package/dist/ui/buttons.d.ts +27 -0
  24. package/dist/ui/buttons.js +176 -0
  25. package/dist/ui/buttons.js.map +1 -0
  26. package/dist/ui/card.cjs +293 -0
  27. package/dist/ui/card.cjs.map +1 -0
  28. package/dist/ui/card.d.cts +77 -0
  29. package/dist/ui/card.d.ts +77 -0
  30. package/dist/ui/card.js +258 -0
  31. package/dist/ui/card.js.map +1 -0
  32. package/dist/ui/divider.cjs +229 -0
  33. package/dist/ui/divider.cjs.map +1 -0
  34. package/dist/ui/divider.d.cts +39 -0
  35. package/dist/ui/divider.d.ts +39 -0
  36. package/dist/ui/divider.js +200 -0
  37. package/dist/ui/divider.js.map +1 -0
  38. package/dist/ui/drawer.cjs +408 -0
  39. package/dist/ui/drawer.cjs.map +1 -0
  40. package/dist/ui/drawer.d.cts +81 -0
  41. package/dist/ui/drawer.d.ts +81 -0
  42. package/dist/ui/drawer.js +383 -0
  43. package/dist/ui/drawer.js.map +1 -0
  44. package/dist/ui/dropdown.cjs +302 -0
  45. package/dist/ui/dropdown.cjs.map +1 -0
  46. package/dist/ui/dropdown.d.cts +50 -0
  47. package/dist/ui/dropdown.d.ts +50 -0
  48. package/dist/ui/dropdown.js +278 -0
  49. package/dist/ui/dropdown.js.map +1 -0
  50. package/dist/ui/empty-state.cjs +186 -0
  51. package/dist/ui/empty-state.cjs.map +1 -0
  52. package/dist/ui/empty-state.d.cts +55 -0
  53. package/dist/ui/empty-state.d.ts +55 -0
  54. package/dist/ui/empty-state.js +154 -0
  55. package/dist/ui/empty-state.js.map +1 -0
  56. package/dist/ui/index.d.cts +27 -1164
  57. package/dist/ui/index.d.ts +27 -1164
  58. package/dist/ui/inputs.cjs +458 -0
  59. package/dist/ui/inputs.cjs.map +1 -0
  60. package/dist/ui/inputs.d.cts +35 -0
  61. package/dist/ui/inputs.d.ts +35 -0
  62. package/dist/ui/inputs.js +432 -0
  63. package/dist/ui/inputs.js.map +1 -0
  64. package/dist/ui/modal.cjs +406 -0
  65. package/dist/ui/modal.cjs.map +1 -0
  66. package/dist/ui/modal.d.cts +84 -0
  67. package/dist/ui/modal.d.ts +84 -0
  68. package/dist/ui/modal.js +384 -0
  69. package/dist/ui/modal.js.map +1 -0
  70. package/dist/ui/pagination.cjs +523 -0
  71. package/dist/ui/pagination.cjs.map +1 -0
  72. package/dist/ui/pagination.d.cts +114 -0
  73. package/dist/ui/pagination.d.ts +114 -0
  74. package/dist/ui/pagination.js +494 -0
  75. package/dist/ui/pagination.js.map +1 -0
  76. package/dist/ui/progress.cjs +268 -0
  77. package/dist/ui/progress.cjs.map +1 -0
  78. package/dist/ui/progress.d.cts +61 -0
  79. package/dist/ui/progress.d.ts +61 -0
  80. package/dist/ui/progress.js +237 -0
  81. package/dist/ui/progress.js.map +1 -0
  82. package/dist/ui/select.cjs +360 -0
  83. package/dist/ui/select.cjs.map +1 -0
  84. package/dist/ui/select.d.cts +73 -0
  85. package/dist/ui/select.d.ts +73 -0
  86. package/dist/ui/select.js +327 -0
  87. package/dist/ui/select.js.map +1 -0
  88. package/dist/ui/skeleton.cjs +576 -0
  89. package/dist/ui/skeleton.cjs.map +1 -0
  90. package/dist/ui/skeleton.d.cts +90 -0
  91. package/dist/ui/skeleton.d.ts +90 -0
  92. package/dist/ui/skeleton.js +544 -0
  93. package/dist/ui/skeleton.js.map +1 -0
  94. package/dist/ui/spinner.cjs +219 -0
  95. package/dist/ui/spinner.cjs.map +1 -0
  96. package/dist/ui/spinner.d.cts +27 -0
  97. package/dist/ui/spinner.d.ts +27 -0
  98. package/dist/ui/spinner.js +193 -0
  99. package/dist/ui/spinner.js.map +1 -0
  100. package/dist/ui/table.cjs +328 -0
  101. package/dist/ui/table.cjs.map +1 -0
  102. package/dist/ui/table.d.cts +81 -0
  103. package/dist/ui/table.d.ts +81 -0
  104. package/dist/ui/table.js +293 -0
  105. package/dist/ui/table.js.map +1 -0
  106. package/dist/ui/tabs.cjs +300 -0
  107. package/dist/ui/tabs.cjs.map +1 -0
  108. package/dist/ui/tabs.d.cts +58 -0
  109. package/dist/ui/tabs.d.ts +58 -0
  110. package/dist/ui/tabs.js +274 -0
  111. package/dist/ui/tabs.js.map +1 -0
  112. package/dist/ui/toast.cjs +285 -0
  113. package/dist/ui/toast.cjs.map +1 -0
  114. package/dist/ui/toast.d.cts +86 -0
  115. package/dist/ui/toast.d.ts +86 -0
  116. package/dist/ui/toast.js +258 -0
  117. package/dist/ui/toast.js.map +1 -0
  118. package/dist/ui/toggle.cjs +185 -0
  119. package/dist/ui/toggle.cjs.map +1 -0
  120. package/dist/ui/toggle.d.cts +37 -0
  121. package/dist/ui/toggle.d.ts +37 -0
  122. package/dist/ui/toggle.js +158 -0
  123. package/dist/ui/toggle.js.map +1 -0
  124. package/dist/ui/tooltip.cjs +242 -0
  125. package/dist/ui/tooltip.cjs.map +1 -0
  126. package/dist/ui/tooltip.d.cts +46 -0
  127. package/dist/ui/tooltip.d.ts +46 -0
  128. package/dist/ui/tooltip.js +214 -0
  129. package/dist/ui/tooltip.js.map +1 -0
  130. package/dist/variants-1Bx3BEeS.d.cts +8 -0
  131. package/dist/variants-1Bx3BEeS.d.ts +8 -0
  132. package/package.json +7 -3
@@ -0,0 +1,39 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { HTMLMotionProps } from 'framer-motion';
4
+ import { ReactNode } from 'react';
5
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
+
7
+ declare const dividerToneVariants: (props?: ({
8
+ appearance?: "default" | "ghost" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "gray" | "violet" | "destructive" | "amber" | "muted" | "primary" | null | undefined;
9
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
10
+ declare const dividerVariants: (props?: ({
11
+ appearance?: "default" | "ghost" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "gray" | "violet" | "destructive" | "amber" | "muted" | "primary" | null | undefined;
12
+ orientation?: "horizontal" | "vertical" | null | undefined;
13
+ size?: "sm" | "md" | "lg" | null | undefined;
14
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
15
+ declare const dividerLineVariants: (props?: ({
16
+ orientation?: "horizontal" | "vertical" | null | undefined;
17
+ size?: "sm" | "md" | "lg" | null | undefined;
18
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
19
+ declare const dividerLabelVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
20
+
21
+ type DividerAnimation = "none" | "expand" | "fade";
22
+ type DividerVariantProps = VariantProps<typeof dividerVariants>;
23
+ type DividerProps = DividerVariantProps & Omit<HTMLMotionProps<"div">, "children"> & {
24
+ animation?: DividerAnimation;
25
+ /** Optional label between divider lines. */
26
+ label?: ReactNode;
27
+ children?: ReactNode;
28
+ };
29
+
30
+ declare function Divider(props: DividerProps): react_jsx_runtime.JSX.Element;
31
+ declare namespace Divider {
32
+ var displayName: string;
33
+ }
34
+
35
+ type DividerPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "transition" | "whileHover">;
36
+ type DividerAnimationPresets = Record<DividerAnimation, DividerPresetMotionProps>;
37
+ declare const dividerAnimationPresets: DividerAnimationPresets;
38
+
39
+ export { Divider, type DividerAnimation, type DividerProps, dividerAnimationPresets, dividerLabelVariants, dividerLineVariants, dividerToneVariants, dividerVariants };
@@ -0,0 +1,200 @@
1
+ "use client";
2
+
3
+
4
+ // src/ui/divider/divider.tsx
5
+ import { motion } from "framer-motion";
6
+
7
+ // src/lib/utils.ts
8
+ import { clsx } from "clsx";
9
+ import { twMerge } from "tailwind-merge";
10
+ function cn(...inputs) {
11
+ return twMerge(clsx(inputs));
12
+ }
13
+
14
+ // src/ui/divider/animations.ts
15
+ var dividerAnimationPresets = {
16
+ none: {},
17
+ expand: {
18
+ initial: { scaleX: 0.6, opacity: 0.4 },
19
+ animate: { scaleX: 1, opacity: 1 },
20
+ transition: { duration: 0.35, ease: "easeOut" }
21
+ },
22
+ fade: {
23
+ initial: { opacity: 0 },
24
+ animate: { opacity: 1 },
25
+ transition: { duration: 0.25 }
26
+ }
27
+ };
28
+
29
+ // src/ui/divider/variants.ts
30
+ import { cva } from "class-variance-authority";
31
+ var APPEARANCES = {
32
+ default: "text-slate-200",
33
+ muted: "text-slate-500",
34
+ primary: "text-cyan-300",
35
+ destructive: "text-rose-400",
36
+ ghost: "text-slate-600",
37
+ sky: "text-sky-400",
38
+ rose: "text-rose-400",
39
+ purple: "text-purple-400",
40
+ pink: "text-pink-400",
41
+ orange: "text-orange-400",
42
+ yellow: "text-yellow-400",
43
+ teal: "text-teal-400",
44
+ indigo: "text-indigo-400",
45
+ emerald: "text-emerald-400",
46
+ gray: "text-gray-400",
47
+ amber: "text-amber-400",
48
+ violet: "text-violet-400",
49
+ "gradient-blue": "text-blue-400",
50
+ "gradient-green": "text-green-400",
51
+ "gradient-red": "text-red-400",
52
+ "gradient-yellow": "text-yellow-400",
53
+ "gradient-purple": "text-purple-400",
54
+ "gradient-teal": "text-teal-400",
55
+ "gradient-indigo": "text-indigo-400",
56
+ "gradient-pink": "text-pink-400",
57
+ "gradient-orange": "text-orange-400"
58
+ };
59
+ var dividerToneVariants = cva("", {
60
+ variants: {
61
+ appearance: APPEARANCES
62
+ },
63
+ defaultVariants: { appearance: "default" }
64
+ });
65
+ var dividerVariants = cva("flex w-full items-center gap-3", {
66
+ variants: {
67
+ appearance: APPEARANCES,
68
+ orientation: {
69
+ horizontal: "w-full flex-row",
70
+ vertical: "h-full min-h-[2rem] w-auto flex-col self-stretch"
71
+ },
72
+ size: {
73
+ sm: "",
74
+ md: "",
75
+ lg: ""
76
+ }
77
+ },
78
+ compoundVariants: [
79
+ { orientation: "horizontal", size: "sm", class: "min-h-px" },
80
+ { orientation: "horizontal", size: "md", class: "min-h-[2px]" },
81
+ { orientation: "horizontal", size: "lg", class: "min-h-[3px]" },
82
+ { orientation: "vertical", size: "sm", class: "min-w-px" },
83
+ { orientation: "vertical", size: "md", class: "min-w-[2px]" },
84
+ { orientation: "vertical", size: "lg", class: "min-w-[3px]" }
85
+ ],
86
+ defaultVariants: {
87
+ appearance: "default",
88
+ orientation: "horizontal",
89
+ size: "md"
90
+ }
91
+ });
92
+ var dividerLineVariants = cva(
93
+ "shrink grow rounded-full bg-current opacity-80",
94
+ {
95
+ variants: {
96
+ orientation: {
97
+ horizontal: "h-px",
98
+ vertical: "w-px flex-1"
99
+ },
100
+ size: {
101
+ sm: "",
102
+ md: "",
103
+ lg: ""
104
+ }
105
+ },
106
+ compoundVariants: [
107
+ { orientation: "horizontal", size: "sm", class: "h-px" },
108
+ { orientation: "horizontal", size: "md", class: "h-0.5" },
109
+ { orientation: "horizontal", size: "lg", class: "h-1" },
110
+ { orientation: "vertical", size: "sm", class: "w-px" },
111
+ { orientation: "vertical", size: "md", class: "w-0.5" },
112
+ { orientation: "vertical", size: "lg", class: "w-1" }
113
+ ],
114
+ defaultVariants: {
115
+ orientation: "horizontal",
116
+ size: "md"
117
+ }
118
+ }
119
+ );
120
+ var dividerLabelVariants = cva(
121
+ "shrink-0 text-xs font-medium uppercase tracking-wide text-current"
122
+ );
123
+
124
+ // src/ui/divider/divider.tsx
125
+ import { jsx, jsxs } from "react/jsx-runtime";
126
+ function Divider(props) {
127
+ const {
128
+ className,
129
+ appearance,
130
+ orientation,
131
+ size,
132
+ animation = "none",
133
+ label,
134
+ children,
135
+ ref,
136
+ ...rest
137
+ } = props;
138
+ const motionProps = dividerAnimationPresets[animation];
139
+ const slot = label ?? children;
140
+ if (!slot) {
141
+ return /* @__PURE__ */ jsx(
142
+ motion.div,
143
+ {
144
+ ref,
145
+ "data-slot": "divider",
146
+ role: "separator",
147
+ "aria-orientation": orientation === "vertical" ? "vertical" : "horizontal",
148
+ className: cn(
149
+ dividerToneVariants({ appearance }),
150
+ orientation === "horizontal" ? "flex w-full min-h-px flex-row items-stretch" : "flex h-full min-h-8 w-auto min-w-0 flex-col items-stretch self-stretch",
151
+ className
152
+ ),
153
+ initial: animation === "none" ? false : void 0,
154
+ ...motionProps,
155
+ ...rest,
156
+ children: /* @__PURE__ */ jsx("span", { className: cn(dividerLineVariants({ orientation, size })), "aria-hidden": true })
157
+ }
158
+ );
159
+ }
160
+ return /* @__PURE__ */ jsxs(
161
+ motion.div,
162
+ {
163
+ ref,
164
+ "data-slot": "divider",
165
+ role: "separator",
166
+ "aria-orientation": orientation === "vertical" ? "vertical" : "horizontal",
167
+ className: cn(dividerVariants({ appearance, orientation, size }), className),
168
+ initial: animation === "none" ? false : void 0,
169
+ ...motionProps,
170
+ ...rest,
171
+ children: [
172
+ /* @__PURE__ */ jsx(
173
+ "span",
174
+ {
175
+ className: cn(dividerLineVariants({ orientation, size })),
176
+ "aria-hidden": true
177
+ }
178
+ ),
179
+ /* @__PURE__ */ jsx("span", { "data-slot": "divider-label", className: dividerLabelVariants(), children: slot }),
180
+ /* @__PURE__ */ jsx(
181
+ "span",
182
+ {
183
+ className: cn(dividerLineVariants({ orientation, size })),
184
+ "aria-hidden": true
185
+ }
186
+ )
187
+ ]
188
+ }
189
+ );
190
+ }
191
+ Divider.displayName = "Divider";
192
+ export {
193
+ Divider,
194
+ dividerAnimationPresets,
195
+ dividerLabelVariants,
196
+ dividerLineVariants,
197
+ dividerToneVariants,
198
+ dividerVariants
199
+ };
200
+ //# sourceMappingURL=divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ui/divider/divider.tsx","../../src/lib/utils.ts","../../src/ui/divider/animations.ts","../../src/ui/divider/variants.ts"],"sourcesContent":["\"use client\";\n\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport { dividerAnimationPresets } from \"./animations\";\nimport type { DividerProps } from \"./types\";\nimport {\n dividerLabelVariants,\n dividerLineVariants,\n dividerToneVariants,\n dividerVariants,\n} from \"./variants\";\n\nexport function Divider(props: DividerProps) {\n const {\n className,\n appearance,\n orientation,\n size,\n animation = \"none\",\n label,\n children,\n ref,\n ...rest\n } = props;\n const motionProps = dividerAnimationPresets[animation];\n const slot = label ?? children;\n\n if (!slot) {\n return (\n <motion.div\n ref={ref}\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation={orientation === \"vertical\" ? \"vertical\" : \"horizontal\"}\n className={cn(\n dividerToneVariants({ appearance }),\n orientation === \"horizontal\"\n ? \"flex w-full min-h-px flex-row items-stretch\"\n : \"flex h-full min-h-8 w-auto min-w-0 flex-col items-stretch self-stretch\",\n className,\n )}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n <span className={cn(dividerLineVariants({ orientation, size }))} aria-hidden />\n </motion.div>\n );\n }\n\n return (\n <motion.div\n ref={ref}\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation={orientation === \"vertical\" ? \"vertical\" : \"horizontal\"}\n className={cn(dividerVariants({ appearance, orientation, size }), className)}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n <span\n className={cn(dividerLineVariants({ orientation, size }))}\n aria-hidden\n />\n <span data-slot=\"divider-label\" className={dividerLabelVariants()}>\n {slot}\n </span>\n <span\n className={cn(dividerLineVariants({ orientation, size }))}\n aria-hidden\n />\n </motion.div>\n );\n}\n\nDivider.displayName = \"Divider\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}","import type { HTMLMotionProps } from \"framer-motion\";\n\nimport type { DividerAnimation } from \"./types\";\n\ntype DividerPresetMotionProps = Pick<\n HTMLMotionProps<\"div\">,\n \"initial\" | \"animate\" | \"transition\" | \"whileHover\"\n>;\n\nexport type DividerAnimationPresets = Record<\n DividerAnimation,\n DividerPresetMotionProps\n>;\n\nexport const dividerAnimationPresets: DividerAnimationPresets = {\n none: {},\n expand: {\n initial: { scaleX: 0.6, opacity: 0.4 },\n animate: { scaleX: 1, opacity: 1 },\n transition: { duration: 0.35, ease: \"easeOut\" },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.25 },\n },\n};\n","import { cva } from \"class-variance-authority\";\n\nconst APPEARANCES = {\n default: \"text-slate-200\",\n muted: \"text-slate-500\",\n primary: \"text-cyan-300\",\n destructive: \"text-rose-400\",\n ghost: \"text-slate-600\",\n sky: \"text-sky-400\",\n rose: \"text-rose-400\",\n purple: \"text-purple-400\",\n pink: \"text-pink-400\",\n orange: \"text-orange-400\",\n yellow: \"text-yellow-400\",\n teal: \"text-teal-400\",\n indigo: \"text-indigo-400\",\n emerald: \"text-emerald-400\",\n gray: \"text-gray-400\",\n amber: \"text-amber-400\",\n violet: \"text-violet-400\",\n \"gradient-blue\": \"text-blue-400\",\n \"gradient-green\": \"text-green-400\",\n \"gradient-red\": \"text-red-400\",\n \"gradient-yellow\": \"text-yellow-400\",\n \"gradient-purple\": \"text-purple-400\",\n \"gradient-teal\": \"text-teal-400\",\n \"gradient-indigo\": \"text-indigo-400\",\n \"gradient-pink\": \"text-pink-400\",\n \"gradient-orange\": \"text-orange-400\",\n};\n\nexport const dividerToneVariants = cva(\"\", {\n variants: {\n appearance: APPEARANCES,\n },\n defaultVariants: { appearance: \"default\" },\n});\n\nexport const dividerVariants = cva(\"flex w-full items-center gap-3\", {\n variants: {\n appearance: APPEARANCES,\n orientation: {\n horizontal: \"w-full flex-row\",\n vertical: \"h-full min-h-[2rem] w-auto flex-col self-stretch\",\n },\n size: {\n sm: \"\",\n md: \"\",\n lg: \"\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", size: \"sm\", class: \"min-h-px\" },\n { orientation: \"horizontal\", size: \"md\", class: \"min-h-[2px]\" },\n { orientation: \"horizontal\", size: \"lg\", class: \"min-h-[3px]\" },\n { orientation: \"vertical\", size: \"sm\", class: \"min-w-px\" },\n { orientation: \"vertical\", size: \"md\", class: \"min-w-[2px]\" },\n { orientation: \"vertical\", size: \"lg\", class: \"min-w-[3px]\" },\n ],\n defaultVariants: {\n appearance: \"default\",\n orientation: \"horizontal\",\n size: \"md\",\n },\n});\n\nexport const dividerLineVariants = cva(\n \"shrink grow rounded-full bg-current opacity-80\",\n {\n variants: {\n orientation: {\n horizontal: \"h-px\",\n vertical: \"w-px flex-1\",\n },\n size: {\n sm: \"\",\n md: \"\",\n lg: \"\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", size: \"sm\", class: \"h-px\" },\n { orientation: \"horizontal\", size: \"md\", class: \"h-0.5\" },\n { orientation: \"horizontal\", size: \"lg\", class: \"h-1\" },\n { orientation: \"vertical\", size: \"sm\", class: \"w-px\" },\n { orientation: \"vertical\", size: \"md\", class: \"w-0.5\" },\n { orientation: \"vertical\", size: \"lg\", class: \"w-1\" },\n ],\n defaultVariants: {\n orientation: \"horizontal\",\n size: \"md\",\n },\n },\n);\n\nexport const dividerLabelVariants = cva(\n \"shrink-0 text-xs font-medium uppercase tracking-wide text-current\",\n);\n"],"mappings":"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","names":[]}
@@ -0,0 +1,408 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/ui/drawer/index.ts
21
+ var drawer_exports = {};
22
+ __export(drawer_exports, {
23
+ Drawer: () => Drawer,
24
+ DrawerBody: () => DrawerBody,
25
+ DrawerClose: () => DrawerClose,
26
+ DrawerContent: () => DrawerContent,
27
+ DrawerFooter: () => DrawerFooter,
28
+ DrawerHeader: () => DrawerHeader,
29
+ DrawerTitle: () => DrawerTitle,
30
+ DrawerTrigger: () => DrawerTrigger,
31
+ drawerContentVariants: () => drawerContentVariants,
32
+ drawerOverlayVariants: () => drawerOverlayVariants,
33
+ drawerPanelPresets: () => drawerPanelPresets
34
+ });
35
+ module.exports = __toCommonJS(drawer_exports);
36
+
37
+ // src/ui/drawer/drawer.tsx
38
+ var import_framer_motion = require("framer-motion");
39
+ var import_react = require("react");
40
+ var import_react_dom = require("react-dom");
41
+
42
+ // src/lib/utils.ts
43
+ var import_clsx = require("clsx");
44
+ var import_tailwind_merge = require("tailwind-merge");
45
+ function cn(...inputs) {
46
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
47
+ }
48
+
49
+ // src/ui/drawer/animations.ts
50
+ var drawerPanelPresets = (side) => ({
51
+ none: {},
52
+ fade: {
53
+ initial: { opacity: 0 },
54
+ animate: { opacity: 1 },
55
+ exit: { opacity: 0 },
56
+ transition: { duration: 0.2 }
57
+ },
58
+ scale: {
59
+ initial: { opacity: 0, scale: 0.98 },
60
+ animate: { opacity: 1, scale: 1 },
61
+ exit: { opacity: 0, scale: 0.98 },
62
+ transition: { type: "spring", stiffness: 420, damping: 32 }
63
+ },
64
+ slide: {
65
+ initial: side === "left" ? { x: -24, opacity: 0 } : side === "right" ? { x: 24, opacity: 0 } : side === "top" ? { y: -24, opacity: 0 } : { y: 24, opacity: 0 },
66
+ animate: { x: 0, y: 0, opacity: 1 },
67
+ exit: side === "left" ? { x: -16, opacity: 0 } : side === "right" ? { x: 16, opacity: 0 } : side === "top" ? { y: -16, opacity: 0 } : { y: 16, opacity: 0 },
68
+ transition: { type: "spring", stiffness: 380, damping: 30 }
69
+ }
70
+ });
71
+
72
+ // src/ui/drawer/variants.ts
73
+ var import_class_variance_authority = require("class-variance-authority");
74
+ var drawerOverlayVariants = (0, import_class_variance_authority.cva)("fixed inset-0 z-50 bg-slate-950/70 backdrop-blur-sm");
75
+ var drawerTriggerVariants = (0, import_class_variance_authority.cva)(
76
+ "relative inline-flex shrink-0 cursor-pointer rounded-md border",
77
+ {
78
+ variants: {
79
+ appearance: {
80
+ default: "bg-slate-950",
81
+ glass: "border-white/15 bg-slate-950/70 backdrop-blur-xl",
82
+ sky: "border-sky-600 bg-sky-950/70 backdrop-blur-xl",
83
+ rose: "border-rose-600 bg-rose-950/70 backdrop-blur-xl",
84
+ purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
85
+ pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
86
+ orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
87
+ yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
88
+ teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
89
+ indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
90
+ emerald: "border-emerald-600 bg-emerald-950/70 backdrop-blur-xl",
91
+ gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
92
+ amber: "border-amber-600 bg-amber-950/70 backdrop-blur-xl",
93
+ violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
94
+ "gradient-blue": "border-gradient-to-r from-blue-600 to-purple-600 bg-gradient-to-r from-blue-950/70 to-purple-950/70 backdrop-blur-xl",
95
+ "gradient-green": "border-gradient-to-r from-green-600 to-lime-600 bg-gradient-to-r from-green-950/70 to-lime-950/70 backdrop-blur-xl",
96
+ "gradient-red": "border-gradient-to-r from-red-600 to-pink-600 bg-gradient-to-r from-red-950/70 to-pink-950/70 backdrop-blur-xl",
97
+ "gradient-yellow": "border-gradient-to-r from-yellow-600 to-orange-600 bg-gradient-to-r from-yellow-950/70 to-orange-950/70 backdrop-blur-xl",
98
+ "gradient-purple": "border-gradient-to-r from-purple-600 to-pink-600 bg-gradient-to-r from-purple-950/70 to-pink-950/70 backdrop-blur-xl",
99
+ "gradient-teal": "border-gradient-to-r from-teal-600 to-cyan-600 bg-gradient-to-r from-teal-950/70 to-cyan-950/70 backdrop-blur-xl",
100
+ "gradient-indigo": "border-gradient-to-r from-indigo-600 to-purple-600 bg-gradient-to-r from-indigo-950/70 to-purple-950/70 backdrop-blur-xl",
101
+ "gradient-pink": "border-gradient-to-r from-pink-600 to-rose-600 bg-gradient-to-r from-pink-950/70 to-rose-950/70 backdrop-blur-xl",
102
+ "gradient-orange": "border-gradient-to-r from-orange-600 to-red-600 bg-gradient-to-r from-orange-950/70 to-red-950/70 backdrop-blur-xl"
103
+ }
104
+ },
105
+ defaultVariants: {
106
+ appearance: "default"
107
+ }
108
+ }
109
+ );
110
+ var drawerContentVariants = (0, import_class_variance_authority.cva)(
111
+ "fixed z-50 flex max-h-[min(92vh,900px)] flex-col border border-white/10 bg-slate-950 p-6 text-slate-50 shadow-[0_24px_80px_rgba(15,23,42,0.55)] focus:outline-none",
112
+ {
113
+ variants: {
114
+ side: {
115
+ left: "left-0 top-0 h-full w-[min(100%,420px)]",
116
+ right: "right-0 top-0 h-full w-[min(100%,420px)]",
117
+ top: "left-0 top-0 w-full max-h-[min(92vh,520px)]",
118
+ bottom: "bottom-0 left-0 w-full max-h-[min(92vh,520px)]"
119
+ },
120
+ size: {
121
+ sm: "",
122
+ md: "",
123
+ lg: "",
124
+ xl: "",
125
+ full: ""
126
+ },
127
+ appearance: {
128
+ default: "bg-slate-950",
129
+ glass: "border-white/15 bg-slate-950/70 backdrop-blur-xl",
130
+ sky: "border-sky-600 bg-sky-950/70 backdrop-blur-xl",
131
+ rose: "border-rose-600 bg-rose-950/70 backdrop-blur-xl",
132
+ purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
133
+ pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
134
+ orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
135
+ yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
136
+ teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
137
+ indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
138
+ emerald: "border-emerald-600 bg-emerald-950/70 backdrop-blur-xl",
139
+ gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
140
+ amber: "border-amber-600 bg-amber-950/70 backdrop-blur-xl",
141
+ violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
142
+ "gradient-blue": "border-gradient-to-r from-blue-600 to-purple-600 bg-gradient-to-r from-blue-950/70 to-purple-950/70 backdrop-blur-xl",
143
+ "gradient-green": "border-gradient-to-r from-green-600 to-lime-600 bg-gradient-to-r from-green-950/70 to-lime-950/70 backdrop-blur-xl",
144
+ "gradient-red": "border-gradient-to-r from-red-600 to-pink-600 bg-gradient-to-r from-red-950/70 to-pink-950/70 backdrop-blur-xl",
145
+ "gradient-yellow": "border-gradient-to-r from-yellow-600 to-orange-600 bg-gradient-to-r from-yellow-950/70 to-orange-950/70 backdrop-blur-xl",
146
+ "gradient-purple": "border-gradient-to-r from-purple-600 to-pink-600 bg-gradient-to-r from-purple-950/70 to-pink-950/70 backdrop-blur-xl",
147
+ "gradient-teal": "border-gradient-to-r from-teal-600 to-cyan-600 bg-gradient-to-r from-teal-950/70 to-cyan-950/70 backdrop-blur-xl",
148
+ "gradient-indigo": "border-gradient-to-r from-indigo-600 to-purple-600 bg-gradient-to-r from-indigo-950/70 to-purple-950/70 backdrop-blur-xl",
149
+ "gradient-pink": "border-gradient-to-r from-pink-600 to-rose-600 bg-gradient-to-r from-pink-950/70 to-rose-950/70 backdrop-blur-xl",
150
+ "gradient-orange": "border-gradient-to-r from-orange-600 to-red-600 bg-gradient-to-r from-orange-950/70 to-red-950/70 backdrop-blur-xl"
151
+ }
152
+ },
153
+ compoundVariants: [
154
+ { side: "left", size: "sm", class: "w-[min(100%,320px)]" },
155
+ { side: "left", size: "md", class: "w-[min(100%,420px)]" },
156
+ { side: "left", size: "lg", class: "w-[min(100%,520px)]" },
157
+ { side: "left", size: "xl", class: "w-[min(100%,640px)]" },
158
+ { side: "left", size: "full", class: "w-full max-w-none" },
159
+ { side: "right", size: "sm", class: "w-[min(100%,320px)]" },
160
+ { side: "right", size: "md", class: "w-[min(100%,420px)]" },
161
+ { side: "right", size: "lg", class: "w-[min(100%,520px)]" },
162
+ { side: "right", size: "xl", class: "w-[min(100%,640px)]" },
163
+ { side: "right", size: "full", class: "w-full max-w-none" }
164
+ ],
165
+ defaultVariants: {
166
+ side: "right",
167
+ size: "md",
168
+ appearance: "default"
169
+ }
170
+ }
171
+ );
172
+
173
+ // src/ui/drawer/drawer.tsx
174
+ var import_jsx_runtime = require("react/jsx-runtime");
175
+ var DrawerContext = (0, import_react.createContext)(null);
176
+ function useDrawerContext(component) {
177
+ const ctx = (0, import_react.useContext)(DrawerContext);
178
+ if (!ctx) {
179
+ throw new Error(`${component} must be used within <Drawer>`);
180
+ }
181
+ return ctx;
182
+ }
183
+ var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])';
184
+ function useBodyScrollLock(locked) {
185
+ (0, import_react.useEffect)(() => {
186
+ if (!locked) {
187
+ return;
188
+ }
189
+ const previousOverflow = document.body.style.overflow;
190
+ document.body.style.overflow = "hidden";
191
+ return () => {
192
+ document.body.style.overflow = previousOverflow;
193
+ };
194
+ }, [locked]);
195
+ }
196
+ function Drawer({ open, defaultOpen = false, onOpenChange, children }) {
197
+ const isControlled = open !== void 0;
198
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react.useState)(defaultOpen);
199
+ const resolvedOpen = isControlled ? Boolean(open) : uncontrolledOpen;
200
+ const setOpen = (0, import_react.useCallback)(
201
+ (next) => {
202
+ if (!isControlled) {
203
+ setUncontrolledOpen(next);
204
+ }
205
+ onOpenChange?.(next);
206
+ },
207
+ [isControlled, onOpenChange]
208
+ );
209
+ const baseId = (0, import_react.useId)();
210
+ const titleId = `${baseId}-title`;
211
+ const descriptionId = `${baseId}-description`;
212
+ const contentRef = (0, import_react.useRef)(null);
213
+ const ctx = (0, import_react.useMemo)(
214
+ () => ({
215
+ open: resolvedOpen,
216
+ setOpen,
217
+ titleId,
218
+ descriptionId,
219
+ contentRef
220
+ }),
221
+ [descriptionId, resolvedOpen, setOpen, titleId]
222
+ );
223
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerContext.Provider, { value: ctx, children });
224
+ }
225
+ Drawer.displayName = "Drawer";
226
+ function DrawerTrigger({ className, children, appearance, onClick, ref, ...rest }) {
227
+ const { setOpen } = useDrawerContext("DrawerTrigger");
228
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
229
+ "button",
230
+ {
231
+ ref,
232
+ type: "button",
233
+ "data-slot": "drawer-trigger",
234
+ className: cn(drawerTriggerVariants({ appearance }), className),
235
+ onClick: (event) => {
236
+ onClick?.(event);
237
+ if (!event.defaultPrevented) {
238
+ setOpen(true);
239
+ }
240
+ },
241
+ ...rest,
242
+ children
243
+ }
244
+ );
245
+ }
246
+ DrawerTrigger.displayName = "DrawerTrigger";
247
+ function DrawerContent({
248
+ className,
249
+ side = "right",
250
+ size,
251
+ appearance,
252
+ animation = "slide",
253
+ children,
254
+ ref,
255
+ id,
256
+ style
257
+ }) {
258
+ const { open, setOpen, titleId, descriptionId, contentRef } = useDrawerContext("DrawerContent");
259
+ const resolvedSide = side ?? "right";
260
+ const reduceMotion = (0, import_framer_motion.useReducedMotion)();
261
+ const overlayMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
262
+ const panelMotion = drawerPanelPresets(resolvedSide)[reduceMotion ? "fade" : animation];
263
+ useBodyScrollLock(open);
264
+ (0, import_react.useEffect)(() => {
265
+ if (!open) {
266
+ return;
267
+ }
268
+ const handleKeyDown = (event) => {
269
+ if (event.key === "Escape") {
270
+ setOpen(false);
271
+ }
272
+ };
273
+ window.addEventListener("keydown", handleKeyDown);
274
+ return () => window.removeEventListener("keydown", handleKeyDown);
275
+ }, [open, setOpen]);
276
+ (0, import_react.useEffect)(() => {
277
+ if (!open) {
278
+ return;
279
+ }
280
+ const node = contentRef.current;
281
+ if (!node) {
282
+ return;
283
+ }
284
+ const focusables = Array.from(
285
+ node.querySelectorAll(FOCUSABLE_SELECTOR)
286
+ ).filter((element) => element.offsetParent !== null || element === node);
287
+ const target = focusables[0] ?? node;
288
+ const previouslyFocused = document.activeElement;
289
+ target.focus();
290
+ const handleFocusIn = (event) => {
291
+ if (!node.contains(event.target)) {
292
+ event.stopPropagation();
293
+ target.focus();
294
+ }
295
+ };
296
+ document.addEventListener("focusin", handleFocusIn);
297
+ return () => {
298
+ document.removeEventListener("focusin", handleFocusIn);
299
+ previouslyFocused?.focus?.();
300
+ };
301
+ }, [contentRef, open]);
302
+ const portalTarget = typeof document !== "undefined" ? document.body : null;
303
+ if (!portalTarget) {
304
+ return null;
305
+ }
306
+ return (0, import_react_dom.createPortal)(
307
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: open ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "fixed inset-0 z-50", "data-slot": "drawer-portal", children: [
308
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
309
+ import_framer_motion.motion.button,
310
+ {
311
+ type: "button",
312
+ "aria-hidden": true,
313
+ tabIndex: -1,
314
+ "data-slot": "drawer-overlay",
315
+ className: drawerOverlayVariants(),
316
+ onClick: () => setOpen(false),
317
+ initial: animation === "none" ? false : overlayMotion.initial,
318
+ animate: animation === "none" ? void 0 : overlayMotion.animate,
319
+ exit: animation === "none" ? void 0 : overlayMotion.exit,
320
+ transition: overlayMotion.transition
321
+ }
322
+ ),
323
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
324
+ import_framer_motion.motion.div,
325
+ {
326
+ ref: (node) => {
327
+ contentRef.current = node;
328
+ if (typeof ref === "function") {
329
+ ref(node);
330
+ } else if (ref) {
331
+ ref.current = node;
332
+ }
333
+ },
334
+ role: "dialog",
335
+ "aria-modal": "true",
336
+ "aria-labelledby": titleId,
337
+ "aria-describedby": descriptionId,
338
+ "data-slot": "drawer-content",
339
+ tabIndex: -1,
340
+ className: cn(
341
+ drawerContentVariants({ side: resolvedSide, size, appearance }),
342
+ className
343
+ ),
344
+ initial: animation === "none" ? false : panelMotion.initial,
345
+ animate: animation === "none" ? void 0 : panelMotion.animate,
346
+ exit: animation === "none" ? void 0 : panelMotion.exit,
347
+ transition: panelMotion.transition,
348
+ id,
349
+ style,
350
+ children
351
+ }
352
+ )
353
+ ] }) : null }),
354
+ portalTarget
355
+ );
356
+ }
357
+ DrawerContent.displayName = "DrawerContent";
358
+ function DrawerHeader({ className, children }) {
359
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { "data-slot": "drawer-header", className: cn("mb-4 flex flex-col gap-2", className), children });
360
+ }
361
+ DrawerHeader.displayName = "DrawerHeader";
362
+ function DrawerBody({ className, children }) {
363
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-slot": "drawer-body", className: cn("flex-1 text-sm text-slate-300", className), children });
364
+ }
365
+ DrawerBody.displayName = "DrawerBody";
366
+ function DrawerFooter({ className, children }) {
367
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", { "data-slot": "drawer-footer", className: cn("mt-6 flex justify-end gap-2", className), children });
368
+ }
369
+ DrawerFooter.displayName = "DrawerFooter";
370
+ function DrawerTitle({ className, children }) {
371
+ const { titleId } = useDrawerContext("DrawerTitle");
372
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: titleId, "data-slot": "drawer-title", className: cn("text-lg font-semibold", className), children });
373
+ }
374
+ DrawerTitle.displayName = "DrawerTitle";
375
+ function DrawerClose({ className, children, ...rest }) {
376
+ const { setOpen } = useDrawerContext("DrawerClose");
377
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
378
+ "button",
379
+ {
380
+ type: "button",
381
+ "data-slot": "drawer-close",
382
+ className: cn(
383
+ "absolute right-4 top-4 inline-flex size-9 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30",
384
+ className
385
+ ),
386
+ "aria-label": "Close drawer",
387
+ onClick: () => setOpen(false),
388
+ ...rest,
389
+ children: children ?? "\xD7"
390
+ }
391
+ );
392
+ }
393
+ DrawerClose.displayName = "DrawerClose";
394
+ // Annotate the CommonJS export names for ESM import in node:
395
+ 0 && (module.exports = {
396
+ Drawer,
397
+ DrawerBody,
398
+ DrawerClose,
399
+ DrawerContent,
400
+ DrawerFooter,
401
+ DrawerHeader,
402
+ DrawerTitle,
403
+ DrawerTrigger,
404
+ drawerContentVariants,
405
+ drawerOverlayVariants,
406
+ drawerPanelPresets
407
+ });
408
+ //# sourceMappingURL=drawer.cjs.map