@mbao01/common 0.5.2 → 0.6.0

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 (325) hide show
  1. package/dist/types/components/Alert/constants.d.ts +1 -1
  2. package/dist/types/components/AlertDialog/AlertDialog.d.ts +7 -5
  3. package/dist/types/components/Anchor/{constant.d.ts → constants.d.ts} +1 -1
  4. package/dist/types/components/Anchor/types.d.ts +1 -1
  5. package/dist/types/components/AspectRatio/AspectRatio.d.ts +6 -0
  6. package/dist/types/components/AspectRatio/constants.d.ts +3 -0
  7. package/dist/types/components/AspectRatio/index.d.ts +2 -0
  8. package/dist/types/components/AspectRatio/types.d.ts +5 -0
  9. package/dist/types/components/Avatar/constants.d.ts +6 -6
  10. package/dist/types/components/Badge/constants.d.ts +1 -1
  11. package/dist/types/components/Banner/Banner.d.ts +11 -0
  12. package/dist/types/components/Banner/constants.d.ts +4 -0
  13. package/dist/types/components/Banner/index.d.ts +2 -0
  14. package/dist/types/components/Banner/types.d.ts +9 -0
  15. package/dist/types/components/Blockquote/Blockquote.d.ts +6 -0
  16. package/dist/types/components/Blockquote/constants.d.ts +3 -0
  17. package/dist/types/components/Blockquote/index.d.ts +2 -0
  18. package/dist/types/components/Blockquote/types.d.ts +5 -0
  19. package/dist/types/components/Box/Box.d.ts +6 -0
  20. package/dist/types/components/Box/constants.d.ts +5 -0
  21. package/dist/types/components/Box/index.d.ts +2 -0
  22. package/dist/types/components/Box/types.d.ts +3 -0
  23. package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  24. package/dist/types/components/Breadcrumb/types.d.ts +1 -1
  25. package/dist/types/components/Button/Button.d.ts +3 -2
  26. package/dist/types/components/Button/constants.d.ts +2 -1
  27. package/dist/types/components/Carousel/Carousel.d.ts +6 -4
  28. package/dist/types/components/Center/Center.d.ts +5 -0
  29. package/dist/types/components/Center/constants.d.ts +4 -0
  30. package/dist/types/components/Center/index.d.ts +2 -0
  31. package/dist/types/components/Center/types.d.ts +3 -0
  32. package/dist/types/components/Chart/constants.d.ts +2 -2
  33. package/dist/types/components/Code/Code.d.ts +8 -0
  34. package/dist/types/components/Code/constants.d.ts +4 -0
  35. package/dist/types/components/Code/helper.d.ts +2 -0
  36. package/dist/types/components/Code/index.d.ts +2 -0
  37. package/dist/types/components/Code/types.d.ts +6 -0
  38. package/dist/types/components/Combobox/Combobox.d.ts +1 -1
  39. package/dist/types/components/Combobox/types.d.ts +1 -0
  40. package/dist/types/components/Container/Container.d.ts +6 -0
  41. package/dist/types/components/Container/constants.d.ts +5 -0
  42. package/dist/types/components/Container/index.d.ts +2 -0
  43. package/dist/types/components/Container/types.d.ts +3 -0
  44. package/dist/types/components/DatetimePicker/DatetimeGrid.d.ts +2 -2
  45. package/dist/types/components/DatetimePicker/DatetimePicker.d.ts +2 -2
  46. package/dist/types/components/DatetimePicker/constants.d.ts +1 -1
  47. package/dist/types/components/Dialog/Dialog.d.ts +1 -1
  48. package/dist/types/components/Dialog/constants.d.ts +1 -1
  49. package/dist/types/components/Dock/constants.d.ts +2 -2
  50. package/dist/types/components/Empty/Empty.d.ts +8 -0
  51. package/dist/types/components/Empty/constants.d.ts +6 -0
  52. package/dist/types/components/Empty/index.d.ts +2 -0
  53. package/dist/types/components/Empty/types.d.ts +3 -0
  54. package/dist/types/components/Flex/Flex.d.ts +8 -0
  55. package/dist/types/components/Flex/constants.d.ts +7 -0
  56. package/dist/types/components/Flex/index.d.ts +2 -0
  57. package/dist/types/components/Flex/types.d.ts +3 -0
  58. package/dist/types/components/Footer/Footer.d.ts +6 -0
  59. package/dist/types/components/Footer/constants.d.ts +4 -0
  60. package/dist/types/components/Footer/index.d.ts +2 -0
  61. package/dist/types/components/Footer/types.d.ts +4 -0
  62. package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +3 -3
  63. package/dist/types/components/Form/Input/Input.d.ts +4 -4
  64. package/dist/types/components/Form/Input/constants.d.ts +2 -2
  65. package/dist/types/components/Form/NativeSelect/NativeSelect.d.ts +8 -0
  66. package/dist/types/components/Form/NativeSelect/constants.d.ts +7 -0
  67. package/dist/types/components/Form/NativeSelect/index.d.ts +2 -0
  68. package/dist/types/components/Form/NativeSelect/types.d.ts +3 -0
  69. package/dist/types/components/Form/Radio/Radio.d.ts +1 -1
  70. package/dist/types/components/Form/Range/Range.d.ts +1 -1
  71. package/dist/types/components/Form/Select/Select.d.ts +4 -4
  72. package/dist/types/components/Form/Select/constants.d.ts +2 -2
  73. package/dist/types/components/Form/Switch/Switch.d.ts +1 -1
  74. package/dist/types/components/Form/TagsInput/TagsInput.d.ts +2 -2
  75. package/dist/types/components/Form/TextField/TextField.d.ts +4 -4
  76. package/dist/types/components/Form/Textarea/Textarea.d.ts +3 -3
  77. package/dist/types/components/Form/Textarea/constants.d.ts +1 -1
  78. package/dist/types/components/Form/components/Field/Field.d.ts +8 -0
  79. package/dist/types/components/Form/components/Field/FieldContext.d.ts +2 -0
  80. package/dist/types/components/Form/components/Field/constants.d.ts +6 -0
  81. package/dist/types/components/Form/components/Field/hooks/index.d.ts +1 -0
  82. package/dist/types/components/Form/components/Field/hooks/useField/index.d.ts +1 -0
  83. package/dist/types/components/Form/components/Field/hooks/useField/useField.d.ts +1 -0
  84. package/dist/types/components/Form/components/Field/index.d.ts +2 -0
  85. package/dist/types/components/Form/components/Field/types.d.ts +12 -0
  86. package/dist/types/components/Form/index.d.ts +2 -0
  87. package/dist/types/components/Grid/Grid.d.ts +11 -0
  88. package/dist/types/components/Grid/constants.d.ts +10 -0
  89. package/dist/types/components/Grid/index.d.ts +2 -0
  90. package/dist/types/components/Grid/types.d.ts +4 -0
  91. package/dist/types/components/Header/Header.d.ts +7 -0
  92. package/dist/types/components/Header/constants.d.ts +3 -0
  93. package/dist/types/components/Header/index.d.ts +2 -0
  94. package/dist/types/components/Header/types.d.ts +3 -0
  95. package/dist/types/components/Heading/Heading.d.ts +7 -0
  96. package/dist/types/components/Heading/constants.d.ts +4 -0
  97. package/dist/types/components/Heading/index.d.ts +2 -0
  98. package/dist/types/components/Heading/types.d.ts +7 -0
  99. package/dist/types/components/Image/Image.d.ts +7 -0
  100. package/dist/types/components/Image/constants.d.ts +4 -0
  101. package/dist/types/components/Image/index.d.ts +2 -0
  102. package/dist/types/components/Image/types.d.ts +5 -0
  103. package/dist/types/components/Kbd/constants.d.ts +1 -1
  104. package/dist/types/components/List/constants.d.ts +1 -1
  105. package/dist/types/components/Loading/Loading.d.ts +1 -1
  106. package/dist/types/components/Loading/constants.d.ts +2 -2
  107. package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +4 -4
  108. package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +4 -4
  109. package/dist/types/components/Menu/Menubar/Menubar.d.ts +5 -5
  110. package/dist/types/components/Menu/Menubar/constants.d.ts +5 -5
  111. package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +1 -1
  112. package/dist/types/components/Menu/NavigationMenu/constants.d.ts +1 -1
  113. package/dist/types/components/Panel/Panel.d.ts +11 -0
  114. package/dist/types/components/Panel/constants.d.ts +7 -0
  115. package/dist/types/components/Panel/index.d.ts +2 -0
  116. package/dist/types/components/Panel/types.d.ts +8 -0
  117. package/dist/types/components/Paragraph/Paragraph.d.ts +3 -0
  118. package/dist/types/components/Paragraph/constants.d.ts +3 -0
  119. package/dist/types/components/Paragraph/index.d.ts +2 -0
  120. package/dist/types/components/Paragraph/types.d.ts +5 -0
  121. package/dist/types/components/Progress/Progress.d.ts +1 -1
  122. package/dist/types/components/Progress/constants.d.ts +2 -2
  123. package/dist/types/components/Resizable/Resizable.d.ts +1 -1
  124. package/dist/types/components/ScrollArea/ScrollArea.d.ts +1 -1
  125. package/dist/types/components/ScrollArea/constants.d.ts +1 -1
  126. package/dist/types/components/Sheet/Sheet.d.ts +12 -0
  127. package/dist/types/components/Sheet/constants.d.ts +7 -0
  128. package/dist/types/components/Sheet/index.d.ts +2 -0
  129. package/dist/types/components/Sheet/types.d.ts +5 -0
  130. package/dist/types/components/Sidebar/Sidebar.d.ts +8 -7
  131. package/dist/types/components/Sidebar/SidebarMenu.d.ts +3 -2
  132. package/dist/types/components/Sidebar/constants.d.ts +5 -4
  133. package/dist/types/components/Sidebar/types.d.ts +1 -1
  134. package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
  135. package/dist/types/components/Skeleton/constants.d.ts +3 -3
  136. package/dist/types/components/Sonner/constants.d.ts +2 -2
  137. package/dist/types/components/Spacer/Spacer.d.ts +5 -0
  138. package/dist/types/components/Spacer/constants.d.ts +4 -0
  139. package/dist/types/components/Spacer/index.d.ts +2 -0
  140. package/dist/types/components/Spacer/types.d.ts +3 -0
  141. package/dist/types/components/Spinner/Spinner.d.ts +5 -0
  142. package/dist/types/components/Spinner/constants.d.ts +4 -0
  143. package/dist/types/components/Spinner/index.d.ts +2 -0
  144. package/dist/types/components/Spinner/types.d.ts +3 -0
  145. package/dist/types/components/Status/constants.d.ts +1 -1
  146. package/dist/types/components/Stepper/Stepper.d.ts +9 -0
  147. package/dist/types/components/Stepper/constants.d.ts +6 -0
  148. package/dist/types/components/Stepper/index.d.ts +2 -0
  149. package/dist/types/components/Stepper/types.d.ts +6 -0
  150. package/dist/types/components/Text/constants.d.ts +1 -1
  151. package/dist/types/components/Timeline/Timeline.d.ts +5 -5
  152. package/dist/types/components/Timeline/constants.d.ts +5 -5
  153. package/dist/types/components/Toggle/Toggle.d.ts +5 -3
  154. package/dist/types/components/Toggle/constants.d.ts +2 -1
  155. package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +5 -3
  156. package/dist/types/index.d.ts +24 -0
  157. package/dist/types/utilities/createVariants/createVariants.d.ts +2 -0
  158. package/dist/types/utilities/createVariants/index.d.ts +1 -0
  159. package/dist/types/utilities/createVariants/type.d.ts +10 -0
  160. package/dist/types/utilities/index.d.ts +1 -0
  161. package/package.json +41 -41
  162. package/src/components/Alert/constants.ts +3 -2
  163. package/src/components/Anchor/Anchor.tsx +1 -1
  164. package/src/components/Anchor/{constant.ts → constants.ts} +4 -4
  165. package/src/components/Anchor/types.ts +1 -1
  166. package/src/components/AspectRatio/AspectRatio.tsx +23 -0
  167. package/src/components/AspectRatio/constants.ts +17 -0
  168. package/src/components/AspectRatio/index.ts +2 -0
  169. package/src/components/AspectRatio/types.ts +7 -0
  170. package/src/components/Avatar/constants.ts +17 -22
  171. package/src/components/Badge/constants.ts +3 -2
  172. package/src/components/Banner/Banner.tsx +36 -0
  173. package/src/components/Banner/constants.ts +18 -0
  174. package/src/components/Banner/index.ts +2 -0
  175. package/src/components/Banner/types.ts +11 -0
  176. package/src/components/Blockquote/Blockquote.tsx +21 -0
  177. package/src/components/Blockquote/constants.ts +22 -0
  178. package/src/components/Blockquote/index.ts +2 -0
  179. package/src/components/Blockquote/types.ts +7 -0
  180. package/src/components/Box/Box.tsx +20 -0
  181. package/src/components/Box/constants.ts +34 -0
  182. package/src/components/Box/index.ts +2 -0
  183. package/src/components/Box/types.ts +4 -0
  184. package/src/components/Breadcrumb/types.ts +1 -1
  185. package/src/components/Button/Button.tsx +3 -4
  186. package/src/components/Button/constants.ts +6 -3
  187. package/src/components/Card/constants.ts +3 -2
  188. package/src/components/Carousel/constants.ts +9 -8
  189. package/src/components/Center/Center.tsx +16 -0
  190. package/src/components/Center/constants.ts +20 -0
  191. package/src/components/Center/index.ts +2 -0
  192. package/src/components/Center/types.ts +5 -0
  193. package/src/components/Chart/constants.ts +9 -8
  194. package/src/components/Code/Code.tsx +51 -0
  195. package/src/components/Code/constants.ts +28 -0
  196. package/src/components/Code/helper.ts +10 -0
  197. package/src/components/Code/index.ts +2 -0
  198. package/src/components/Code/types.ts +8 -0
  199. package/src/components/Combobox/Combobox.tsx +2 -3
  200. package/src/components/Combobox/types.ts +1 -0
  201. package/src/components/Container/Container.tsx +20 -0
  202. package/src/components/Container/constants.ts +31 -0
  203. package/src/components/Container/index.ts +2 -0
  204. package/src/components/Container/types.ts +5 -0
  205. package/src/components/DatetimePicker/constants.ts +5 -4
  206. package/src/components/Dialog/Dialog.tsx +3 -3
  207. package/src/components/Dialog/constants.ts +5 -4
  208. package/src/components/Dock/constants.ts +14 -13
  209. package/src/components/DragAndDrop/Draggable/constants.ts +5 -4
  210. package/src/components/DragAndDrop/Droppable/constants.ts +3 -2
  211. package/src/components/DragAndDrop/Sortable/constants.ts +3 -2
  212. package/src/components/Empty/Empty.tsx +66 -0
  213. package/src/components/Empty/constants.ts +30 -0
  214. package/src/components/Empty/index.ts +2 -0
  215. package/src/components/Empty/types.ts +5 -0
  216. package/src/components/Flex/Flex.tsx +20 -0
  217. package/src/components/Flex/constants.ts +51 -0
  218. package/src/components/Flex/index.ts +2 -0
  219. package/src/components/Flex/types.ts +4 -0
  220. package/src/components/Footer/Footer.tsx +26 -0
  221. package/src/components/Footer/constants.ts +12 -0
  222. package/src/components/Footer/index.ts +2 -0
  223. package/src/components/Footer/types.ts +6 -0
  224. package/src/components/Form/Checkbox/constants.ts +5 -4
  225. package/src/components/Form/DatetimeInput/constants.ts +9 -8
  226. package/src/components/Form/Input/constants.ts +7 -6
  227. package/src/components/Form/MultiSelect/constants.ts +10 -9
  228. package/src/components/Form/NativeSelect/NativeSelect.tsx +23 -0
  229. package/src/components/Form/NativeSelect/constants.ts +39 -0
  230. package/src/components/Form/NativeSelect/index.ts +2 -0
  231. package/src/components/Form/NativeSelect/types.ts +5 -0
  232. package/src/components/Form/Radio/constants.ts +3 -2
  233. package/src/components/Form/Range/constants.ts +3 -2
  234. package/src/components/Form/Select/constants.ts +14 -13
  235. package/src/components/Form/Slider/constants.ts +9 -8
  236. package/src/components/Form/Switch/constants.ts +3 -2
  237. package/src/components/Form/TagsInput/TagsInput.tsx +1 -1
  238. package/src/components/Form/TagsInput/constants.ts +7 -6
  239. package/src/components/Form/Textarea/constants.ts +3 -2
  240. package/src/components/Form/Validator/constants.ts +3 -2
  241. package/src/components/Form/components/Field/Field.tsx +81 -0
  242. package/src/components/Form/components/Field/FieldContext.tsx +4 -0
  243. package/src/components/Form/components/Field/constants.ts +20 -0
  244. package/src/components/Form/components/Field/hooks/index.ts +1 -0
  245. package/src/components/Form/components/Field/hooks/useField/index.ts +1 -0
  246. package/src/components/Form/components/Field/hooks/useField/useField.ts +10 -0
  247. package/src/components/Form/components/Field/index.ts +2 -0
  248. package/src/components/Form/components/Field/types.ts +19 -0
  249. package/src/components/Form/index.ts +2 -0
  250. package/src/components/Grid/Grid.tsx +32 -0
  251. package/src/components/Grid/constants.ts +84 -0
  252. package/src/components/Grid/index.ts +2 -0
  253. package/src/components/Grid/types.ts +7 -0
  254. package/src/components/Header/Header.tsx +49 -0
  255. package/src/components/Header/constants.ts +18 -0
  256. package/src/components/Header/index.ts +2 -0
  257. package/src/components/Header/types.ts +4 -0
  258. package/src/components/Heading/Heading.tsx +23 -0
  259. package/src/components/Heading/constants.ts +25 -0
  260. package/src/components/Heading/index.ts +2 -0
  261. package/src/components/Heading/types.ts +10 -0
  262. package/src/components/Image/Image.tsx +30 -0
  263. package/src/components/Image/constants.ts +25 -0
  264. package/src/components/Image/index.ts +2 -0
  265. package/src/components/Image/types.ts +7 -0
  266. package/src/components/Kbd/constants.ts +3 -2
  267. package/src/components/List/constants.ts +3 -2
  268. package/src/components/Loading/Loading.tsx +2 -4
  269. package/src/components/Loading/constants.ts +5 -4
  270. package/src/components/Menu/Menubar/constants.ts +16 -14
  271. package/src/components/Menu/NavigationMenu/constants.ts +5 -3
  272. package/src/components/Panel/Panel.tsx +58 -0
  273. package/src/components/Panel/constants.ts +31 -0
  274. package/src/components/Panel/index.ts +2 -0
  275. package/src/components/Panel/types.ts +11 -0
  276. package/src/components/Paragraph/Paragraph.tsx +17 -0
  277. package/src/components/Paragraph/constants.ts +18 -0
  278. package/src/components/Paragraph/index.ts +2 -0
  279. package/src/components/Paragraph/types.ts +8 -0
  280. package/src/components/Progress/constants.ts +9 -10
  281. package/src/components/Resizable/constants.ts +3 -2
  282. package/src/components/ScrollArea/constants.ts +6 -5
  283. package/src/components/Separator/constants.ts +3 -2
  284. package/src/components/Sheet/Sheet.tsx +126 -0
  285. package/src/components/Sheet/constants.ts +45 -0
  286. package/src/components/Sheet/index.ts +9 -0
  287. package/src/components/Sheet/types.ts +7 -0
  288. package/src/components/Sidebar/Sidebar.tsx +5 -5
  289. package/src/components/Sidebar/SidebarMenu.tsx +3 -3
  290. package/src/components/Sidebar/constants.ts +32 -25
  291. package/src/components/Sidebar/types.ts +1 -1
  292. package/src/components/Skeleton/Skeleton.tsx +2 -2
  293. package/src/components/Skeleton/constants.ts +4 -3
  294. package/src/components/Sonner/Toaster.tsx +1 -1
  295. package/src/components/Sonner/constants.ts +6 -5
  296. package/src/components/Sonner/helpers.ts +1 -1
  297. package/src/components/Spacer/Spacer.tsx +19 -0
  298. package/src/components/Spacer/constants.ts +55 -0
  299. package/src/components/Spacer/index.ts +2 -0
  300. package/src/components/Spacer/types.ts +5 -0
  301. package/src/components/Spinner/Spinner.tsx +24 -0
  302. package/src/components/Spinner/constants.ts +29 -0
  303. package/src/components/Spinner/index.ts +2 -0
  304. package/src/components/Spinner/types.ts +5 -0
  305. package/src/components/Stack/constants.ts +3 -2
  306. package/src/components/Stat/constants.ts +5 -4
  307. package/src/components/Status/constants.ts +3 -2
  308. package/src/components/Stepper/Stepper.tsx +30 -0
  309. package/src/components/Stepper/constants.ts +29 -0
  310. package/src/components/Stepper/index.ts +2 -0
  311. package/src/components/Stepper/types.ts +10 -0
  312. package/src/components/Table/constants.ts +3 -2
  313. package/src/components/Text/constants.ts +4 -7
  314. package/src/components/Timeline/Timeline.example.tsx +1 -1
  315. package/src/components/Timeline/constants.ts +19 -22
  316. package/src/components/Toggle/Toggle.tsx +3 -3
  317. package/src/components/Toggle/constants.ts +6 -3
  318. package/src/components/ToggleGroup/ToggleGroup.tsx +4 -2
  319. package/src/components/Tooltip/constants.ts +5 -4
  320. package/src/index.ts +27 -0
  321. package/src/utilities/createVariants/createVariants.ts +5 -0
  322. package/src/utilities/createVariants/index.ts +1 -0
  323. package/src/utilities/createVariants/type.ts +29 -0
  324. package/src/utilities/index.ts +1 -0
  325. package/vitest-setup.ts +4 -0
@@ -0,0 +1,45 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getSheetClasses = cva(
5
+ "fixed z-50 bg-base-100 shadow-xl transition-transform duration-300 ease-in-out",
6
+ {
7
+ variants: createVariants({
8
+ side: {
9
+ top: "top-0 left-0 right-0 border-b border-base-200",
10
+ bottom: "bottom-0 left-0 right-0 border-t border-base-200",
11
+ left: "top-0 bottom-0 left-0 border-r border-base-200 h-full",
12
+ right: "top-0 bottom-0 right-0 border-l border-base-200 h-full",
13
+ },
14
+ open: {
15
+ true: "translate-x-0 translate-y-0",
16
+ false: "invisible", // Base invisible state, transforms handled by compound variants
17
+ },
18
+ }),
19
+ compoundVariants: [
20
+ { side: "top", open: false, class: "-translate-y-full" },
21
+ { side: "bottom", open: false, class: "translate-y-full" },
22
+ { side: "left", open: false, class: "-translate-x-full" },
23
+ { side: "right", open: false, class: "translate-x-full" },
24
+ ],
25
+ defaultVariants: {
26
+ side: "right",
27
+ open: false,
28
+ },
29
+ }
30
+ );
31
+
32
+ export const getSheetOverlayClasses = cva(
33
+ "fixed inset-0 z-40 bg-black/50 transition-opacity duration-300",
34
+ {
35
+ variants: createVariants({
36
+ open: {
37
+ true: "opacity-100",
38
+ false: "opacity-0 pointer-events-none",
39
+ },
40
+ }),
41
+ defaultVariants: {
42
+ open: false,
43
+ },
44
+ }
45
+ );
@@ -0,0 +1,9 @@
1
+ export {
2
+ Sheet,
3
+ SheetHeader,
4
+ SheetTitle,
5
+ SheetDescription,
6
+ SheetContent,
7
+ SheetFooter,
8
+ } from "./Sheet";
9
+ export type { SheetProps } from "./types";
@@ -0,0 +1,7 @@
1
+ import { type VariantProps } from "../../libs";
2
+ import { getSheetClasses } from "./constants";
3
+
4
+ export type SheetProps = React.HTMLAttributes<HTMLDivElement> &
5
+ VariantProps<typeof getSheetClasses> & {
6
+ onClose?: () => void;
7
+ };
@@ -41,7 +41,7 @@ import { SidebarContext } from "./SidebarContext";
41
41
 
42
42
  const Sidebar = ({
43
43
  side = "left",
44
- variant = "sidebar",
44
+ type = "sidebar",
45
45
  collapsible = "offcanvas",
46
46
  className,
47
47
  children,
@@ -62,7 +62,7 @@ const Sidebar = ({
62
62
  <Dialog open={openMobile} onOpenChange={setOpenMobile} {...props}>
63
63
  <Dialog.Content
64
64
  side={side}
65
- variant="sheet"
65
+ type="sheet"
66
66
  data-mobile="true"
67
67
  data-sidebar="sidebar"
68
68
  className={cn(getSidebarMobileClasses({ isMobile }), className)}
@@ -83,12 +83,12 @@ const Sidebar = ({
83
83
  data-side={side}
84
84
  data-state={state}
85
85
  data-collapsible={state === "collapsed" ? collapsible : ""}
86
- data-variant={variant}
86
+ data-variant={type}
87
87
  className={getSidebarOuterClasses()}
88
88
  >
89
89
  {/* This is what handles the sidebar gap on desktop */}
90
- <div className={getSidebarGapClasses({ variant })} />
91
- <div className={getSidebarInnerClasses({ side, variant })} {...props}>
90
+ <div className={getSidebarGapClasses({ type })} />
91
+ <div className={getSidebarInnerClasses({ side, type })} {...props}>
92
92
  <div
93
93
  data-sidebar="sidebar"
94
94
  className={cn(getSidebarMobileClasses({ isMobile }), className)}
@@ -51,8 +51,8 @@ const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(
51
51
  {
52
52
  asChild = false,
53
53
  isActive = false,
54
- variant = "default",
55
- size = "default",
54
+ outline = false,
55
+ size = "md",
56
56
  tooltip,
57
57
  className,
58
58
  ...props
@@ -68,7 +68,7 @@ const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(
68
68
  data-sidebar="menu-button"
69
69
  data-size={size}
70
70
  data-active={isActive}
71
- className={cn(getSidebarMenuButtonClasses({ variant, size }), className)}
71
+ className={cn(getSidebarMenuButtonClasses({ outline, size }), className)}
72
72
  {...props}
73
73
  />
74
74
  );
@@ -1,4 +1,5 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const SIDEBAR_COOKIE_NAME = "sidebar:state";
4
5
 
@@ -13,21 +14,21 @@ export const SIDEBAR_WIDTH_ICON = "3rem";
13
14
  export const SIDEBAR_KEYBOARD_SHORTCUT = "b";
14
15
 
15
16
  export const getSidebarClasses = cva([], {
16
- variants: {
17
+ variants: createVariants({
17
18
  collapsible: {
18
19
  none: "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
19
20
  },
20
- },
21
+ }),
21
22
  });
22
23
 
23
24
  export const getSidebarMobileClasses = cva([], {
24
- variants: {
25
+ variants: createVariants({
25
26
  isMobile: {
26
27
  true: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
27
28
  false:
28
29
  "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",
29
30
  },
30
- },
31
+ }),
31
32
  });
32
33
 
33
34
  export const getSidebarOuterClasses = cva("group peer hidden md:block text-sidebar-foreground");
@@ -35,12 +36,12 @@ export const getSidebarOuterClasses = cva("group peer hidden md:block text-sideb
35
36
  export const getSidebarInnerClasses = cva(
36
37
  "duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
37
38
  {
38
- variants: {
39
+ variants: createVariants({
39
40
  side: {
40
41
  left: "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]",
41
42
  right: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
42
43
  },
43
- variant: {
44
+ type: {
44
45
  floating:
45
46
  "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]",
46
47
  inset:
@@ -48,7 +49,7 @@ export const getSidebarInnerClasses = cva(
48
49
  sidebar:
49
50
  "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
50
51
  },
51
- },
52
+ }),
52
53
  }
53
54
  );
54
55
 
@@ -59,18 +60,17 @@ export const getSidebarGapClasses = cva(
59
60
  "group-data-[side=right]:rotate-180",
60
61
  ],
61
62
  {
62
- variants: {
63
- variant: {
63
+ variants: createVariants({
64
+ type: {
64
65
  floating:
65
66
  "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
66
- inset:
67
- "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
67
+ inset: "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
68
68
  sidebar: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
69
69
  },
70
- },
70
+ }),
71
71
  compoundVariants: [
72
72
  {
73
- variant: null,
73
+ type: null,
74
74
  className: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
75
75
  },
76
76
  ],
@@ -135,22 +135,29 @@ export const getSidebarMenuItemClasses = cva("group/menu-item relative");
135
135
  export const getSidebarMenuButtonClasses = cva(
136
136
  "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
137
137
  {
138
- variants: {
138
+ variants: createVariants({
139
+ outline: {
140
+ true: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
141
+ },
139
142
  variant: {
140
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
141
- outline:
142
- "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
143
+ default: "",
143
144
  },
144
145
  size: {
145
- default: "h-8 text-sm",
146
146
  sm: "h-7 text-xs",
147
+ md: "h-8 text-sm",
147
148
  lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
148
149
  },
149
- },
150
+ }),
150
151
  defaultVariants: {
151
- variant: "default",
152
- size: "default",
152
+ outline: false,
153
+ size: "md",
153
154
  },
155
+ compoundVariants: [
156
+ {
157
+ outline: false,
158
+ className: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
159
+ },
160
+ ],
154
161
  }
155
162
  );
156
163
 
@@ -165,11 +172,11 @@ export const getSidebarMenuActionClasses = cva(
165
172
  "group-data-[collapsible=icon]:hidden",
166
173
  ],
167
174
  {
168
- variants: {
175
+ variants: createVariants({
169
176
  showOnHover: {
170
177
  true: "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
171
178
  },
172
- },
179
+ }),
173
180
  }
174
181
  );
175
182
 
@@ -196,11 +203,11 @@ export const getSidebarMenuSubItemClasses = cva(
196
203
  "group-data-[collapsible=icon]:hidden",
197
204
  ],
198
205
  {
199
- variants: {
206
+ variants: createVariants({
200
207
  size: {
201
208
  sm: "text-xs",
202
209
  md: "text-sm",
203
210
  },
204
- },
211
+ }),
205
212
  }
206
213
  );
@@ -17,7 +17,7 @@ export type SidebarContextProps = {
17
17
  export type SidebarProps = HTMLAttributes<HTMLDivElement> &
18
18
  Partial<{
19
19
  side: "left" | "right";
20
- variant: "sidebar" | "floating" | "inset";
20
+ type: "sidebar" | "floating" | "inset";
21
21
  collapsible: "offcanvas" | "icon" | "none";
22
22
  }>;
23
23
 
@@ -2,10 +2,10 @@ import { cn } from "../../utilities";
2
2
  import { getSkeletonClasses } from "./constants";
3
3
  import { type SkeletonProps } from "./types";
4
4
 
5
- export const Skeleton = ({ round, width, height, variant, className, ...props }: SkeletonProps) => {
5
+ export const Skeleton = ({ round, width, height, animate, className, ...props }: SkeletonProps) => {
6
6
  return (
7
7
  <div
8
- className={cn(getSkeletonClasses({ width, height, round, variant }), className)}
8
+ className={cn(getSkeletonClasses({ width, height, round, animate }), className)}
9
9
  {...props}
10
10
  />
11
11
  );
@@ -1,8 +1,9 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const getSkeletonClasses = cva("skeleton", {
4
- variants: {
5
- variant: { pulse: "animate-pulse" },
5
+ variants: createVariants({
6
+ animate: { pulse: "animate-pulse" },
6
7
  width: {
7
8
  2: "w-2",
8
9
  4: "w-4",
@@ -31,7 +32,7 @@ export const getSkeletonClasses = cva("skeleton", {
31
32
  true: "rounded-full",
32
33
  false: "rounded-md",
33
34
  },
34
- },
35
+ }),
35
36
  defaultVariants: {
36
37
  width: "full",
37
38
  height: 4,
@@ -26,7 +26,7 @@ export const Toaster = ({
26
26
  cancelButton: cn(
27
27
  getToastButtonClasses({
28
28
  outline: true,
29
- variant: "base",
29
+ variant: "default",
30
30
  ...cancelButton,
31
31
  })
32
32
  ),
@@ -1,7 +1,8 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const getToastClasses = cva("sonner group", {
4
- variants: {
5
+ variants: createVariants({
5
6
  variant: {
6
7
  accent: "bg-accent text-accent-content border-accent",
7
8
  default: "bg-default text-default-content border-default",
@@ -17,7 +18,7 @@ export const getToastClasses = cva("sonner group", {
17
18
  outline: {
18
19
  true: "border bg-default",
19
20
  },
20
- },
21
+ }),
21
22
  compoundVariants: [
22
23
  { outline: true, variant: "accent", className: "text-accent" },
23
24
  { outline: true, variant: "default", className: "text-default" },
@@ -36,9 +37,9 @@ export const getToastClasses = cva("sonner group", {
36
37
  });
37
38
 
38
39
  export const getToastButtonClasses = cva("", {
39
- variants: {
40
+ variants: createVariants({
40
41
  variant: {
41
- base: "group-[.sonner]:bg-base-300! group-[.sonner]:text-base-content!",
42
+ default: "group-[.sonner]:bg-base-300! group-[.sonner]:text-base-content!",
42
43
  accent: "group-[.sonner]:bg-accent! group-[.sonner]:text-accent-content!",
43
44
  error: "group-[.sonner]:bg-error! group-[.sonner]:text-error-content!",
44
45
  info: "group-[.sonner]:bg-info! group-[.sonner]:text-info-content!",
@@ -51,7 +52,7 @@ export const getToastButtonClasses = cva("", {
51
52
  outline: {
52
53
  true: "group-[.sonner]:border! group-[.sonner]:border-solid! group-[.sonner]:bg-transparent!",
53
54
  },
54
- },
55
+ }),
55
56
  compoundVariants: [
56
57
  {
57
58
  outline: true,
@@ -15,7 +15,7 @@ export const toastClassnames = ({
15
15
  cancelButton: cn(
16
16
  getToastButtonClasses({
17
17
  outline: true,
18
- variant: "base",
18
+ variant: "default",
19
19
  ...cancelButton,
20
20
  })
21
21
  ),
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { cn } from "../../utilities";
3
+ import { getSpacerClasses } from "./constants";
4
+ import { type SpacerProps } from "./types";
5
+
6
+ export const Spacer = React.forwardRef<HTMLDivElement, SpacerProps>(
7
+ ({ className, axis, gap, ...props }, ref) => {
8
+ return (
9
+ <div
10
+ ref={ref}
11
+ aria-hidden="true"
12
+ className={cn(getSpacerClasses({ axis, gap }), className)}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+ );
18
+
19
+ Spacer.displayName = "Spacer";
@@ -0,0 +1,55 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getSpacerClasses = cva("", {
5
+ variants: createVariants({
6
+ axis: {
7
+ horizontal: "flex-shrink-0",
8
+ vertical: "flex-shrink-0",
9
+ },
10
+ gap: {
11
+ 1: "",
12
+ 2: "",
13
+ 3: "",
14
+ 4: "",
15
+ 5: "",
16
+ 6: "",
17
+ 8: "",
18
+ 10: "",
19
+ 12: "",
20
+ 16: "",
21
+ 20: "",
22
+ 24: "",
23
+ },
24
+ }),
25
+ compoundVariants: [
26
+ { axis: "horizontal", gap: 1, className: "w-1" },
27
+ { axis: "horizontal", gap: 2, className: "w-2" },
28
+ { axis: "horizontal", gap: 3, className: "w-3" },
29
+ { axis: "horizontal", gap: 4, className: "w-4" },
30
+ { axis: "horizontal", gap: 5, className: "w-5" },
31
+ { axis: "horizontal", gap: 6, className: "w-6" },
32
+ { axis: "horizontal", gap: 8, className: "w-8" },
33
+ { axis: "horizontal", gap: 10, className: "w-10" },
34
+ { axis: "horizontal", gap: 12, className: "w-12" },
35
+ { axis: "horizontal", gap: 16, className: "w-16" },
36
+ { axis: "horizontal", gap: 20, className: "w-20" },
37
+ { axis: "horizontal", gap: 24, className: "w-24" },
38
+ { axis: "vertical", gap: 1, className: "h-1" },
39
+ { axis: "vertical", gap: 2, className: "h-2" },
40
+ { axis: "vertical", gap: 3, className: "h-3" },
41
+ { axis: "vertical", gap: 4, className: "h-4" },
42
+ { axis: "vertical", gap: 5, className: "h-5" },
43
+ { axis: "vertical", gap: 6, className: "h-6" },
44
+ { axis: "vertical", gap: 8, className: "h-8" },
45
+ { axis: "vertical", gap: 10, className: "h-10" },
46
+ { axis: "vertical", gap: 12, className: "h-12" },
47
+ { axis: "vertical", gap: 16, className: "h-16" },
48
+ { axis: "vertical", gap: 20, className: "h-20" },
49
+ { axis: "vertical", gap: 24, className: "h-24" },
50
+ ],
51
+ defaultVariants: {
52
+ axis: "vertical",
53
+ gap: 4,
54
+ },
55
+ });
@@ -0,0 +1,2 @@
1
+ export { Spacer } from "./Spacer";
2
+ export type { SpacerProps } from "./types";
@@ -0,0 +1,5 @@
1
+ import { type VariantProps } from "../../libs";
2
+ import { getSpacerClasses } from "./constants";
3
+
4
+ export type SpacerProps = Omit<React.HTMLAttributes<HTMLDivElement>, "children"> &
5
+ VariantProps<typeof getSpacerClasses>;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { Loader2Icon } from "lucide-react";
3
+ import { cn } from "../../utilities";
4
+ import { getSpinnerClasses } from "./constants";
5
+ import { type SpinnerProps } from "./types";
6
+
7
+ export const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
8
+ ({ className, size, variant, ...props }, ref) => {
9
+ return (
10
+ <div
11
+ ref={ref}
12
+ role="status"
13
+ aria-label="Loading"
14
+ className={cn(getSpinnerClasses({ size, variant }), className)}
15
+ {...props}
16
+ >
17
+ <Loader2Icon className="h-full w-full" />
18
+ <span className="sr-only">Loading...</span>
19
+ </div>
20
+ );
21
+ }
22
+ );
23
+
24
+ Spinner.displayName = "Spinner";
@@ -0,0 +1,29 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getSpinnerClasses = cva("animate-spin", {
5
+ variants: createVariants({
6
+ size: {
7
+ xs: "h-3 w-3",
8
+ sm: "h-4 w-4",
9
+ md: "h-6 w-6",
10
+ lg: "h-8 w-8",
11
+ xl: "h-12 w-12",
12
+ },
13
+ variant: {
14
+ default: "text-base-content",
15
+ primary: "text-primary",
16
+ secondary: "text-secondary",
17
+ accent: "text-accent",
18
+ info: "text-info",
19
+ success: "text-success",
20
+ warning: "text-warning",
21
+ error: "text-error",
22
+ ghost: "text-base-content/50",
23
+ },
24
+ }),
25
+ defaultVariants: {
26
+ size: "md",
27
+ variant: "default",
28
+ },
29
+ });
@@ -0,0 +1,2 @@
1
+ export { Spinner } from "./Spinner";
2
+ export type { SpinnerProps } from "./types";
@@ -0,0 +1,5 @@
1
+ import { type VariantProps } from "../../libs";
2
+ import { getSpinnerClasses } from "./constants";
3
+
4
+ export type SpinnerProps = React.HTMLAttributes<HTMLDivElement> &
5
+ VariantProps<typeof getSpinnerClasses>;
@@ -1,12 +1,13 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const getStackClasses = cva("stack", {
4
- variants: {
5
+ variants: createVariants({
5
6
  direction: {
6
7
  start: "stack-start",
7
8
  end: "stack-end",
8
9
  top: "stack-top",
9
10
  bottom: "stack-bottom",
10
11
  },
11
- },
12
+ }),
12
13
  });
@@ -1,25 +1,26 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const getStatsClasses = cva("stats", {
4
- variants: {
5
+ variants: createVariants({
5
6
  direction: {
6
7
  horizontal: "stats-horizontal",
7
8
  vertical: "stats-vertical",
8
9
  },
9
- },
10
+ }),
10
11
  defaultVariants: {
11
12
  direction: "horizontal",
12
13
  },
13
14
  });
14
15
 
15
16
  export const getStatClasses = cva("stat", {
16
- variants: {
17
+ variants: createVariants({
17
18
  position: {
18
19
  center: "place-items-center",
19
20
  start: "place-items-start",
20
21
  end: "place-items-end",
21
22
  },
22
- },
23
+ }),
23
24
  });
24
25
 
25
26
  export const getStatTitleClasses = cva("stat-title");
@@ -1,7 +1,8 @@
1
1
  import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
2
3
 
3
4
  export const getStatusClasses = cva("status", {
4
- variants: {
5
+ variants: createVariants({
5
6
  variant: {
6
7
  accent: "status-accent",
7
8
  default: "",
@@ -27,5 +28,5 @@ export const getStatusClasses = cva("status", {
27
28
  pulse: "animate-pulse",
28
29
  spin: "animate-spin",
29
30
  },
30
- },
31
+ }),
31
32
  });
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { cn } from "../../utilities";
3
+ import { getStepClasses, getStepperClasses } from "./constants";
4
+ import { type StepperProps, type StepProps } from "./types";
5
+
6
+ export const Stepper = React.forwardRef<HTMLUListElement, StepperProps>(
7
+ ({ className, orientation = "horizontal", children, ...props }, ref) => {
8
+ return (
9
+ <ul ref={ref} className={cn(getStepperClasses({ orientation }), className)} {...props}>
10
+ {children}
11
+ </ul>
12
+ );
13
+ }
14
+ );
15
+ Stepper.displayName = "Stepper";
16
+
17
+ export const Step = React.forwardRef<HTMLLIElement, StepProps>(
18
+ ({ className, variant, active, children, ...props }, ref) => {
19
+ return (
20
+ <li
21
+ ref={ref}
22
+ className={cn(getStepClasses({ variant: active ? "primary" : variant }), className)}
23
+ {...props}
24
+ >
25
+ {children}
26
+ </li>
27
+ );
28
+ }
29
+ );
30
+ Step.displayName = "Step";
@@ -0,0 +1,29 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getStepperClasses = cva("steps w-full", {
5
+ variants: createVariants({
6
+ orientation: {
7
+ horizontal: "steps-horizontal",
8
+ vertical: "steps-vertical",
9
+ },
10
+ }),
11
+ defaultVariants: {
12
+ orientation: "horizontal",
13
+ },
14
+ });
15
+
16
+ export const getStepClasses = cva("step", {
17
+ variants: createVariants({
18
+ variant: {
19
+ primary: "step-primary",
20
+ secondary: "step-secondary",
21
+ accent: "step-accent",
22
+ info: "step-info",
23
+ success: "step-success",
24
+ warning: "step-warning",
25
+ error: "step-error",
26
+ neutral: "step-neutral",
27
+ },
28
+ }),
29
+ });
@@ -0,0 +1,2 @@
1
+ export { Stepper, Step } from "./Stepper";
2
+ export type { StepperProps, StepProps } from "./types";
@@ -0,0 +1,10 @@
1
+ import { type VariantProps } from "../../libs";
2
+ import { getStepClasses, getStepperClasses } from "./constants";
3
+
4
+ export type StepperProps = React.HTMLAttributes<HTMLUListElement> &
5
+ VariantProps<typeof getStepperClasses>;
6
+
7
+ export type StepProps = React.LiHTMLAttributes<HTMLLIElement> &
8
+ VariantProps<typeof getStepClasses> & {
9
+ active?: boolean; // Convenience prop to apply primary color
10
+ };