@codefast/ui 0.3.16-canary.3 → 0.4.0-canary.4

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 (281) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +27 -16
  3. package/dist/components/accordion.d.mts +7 -22
  4. package/dist/components/accordion.mjs +26 -29
  5. package/dist/components/alert-dialog.d.mts +27 -26
  6. package/dist/components/alert-dialog.mjs +53 -45
  7. package/dist/components/alert.d.mts +12 -2
  8. package/dist/components/alert.mjs +15 -6
  9. package/dist/components/aspect-ratio.d.mts +2 -2
  10. package/dist/components/aspect-ratio.mjs +2 -3
  11. package/dist/components/avatar.d.mts +41 -5
  12. package/dist/components/avatar.mjs +40 -10
  13. package/dist/components/badge.mjs +4 -4
  14. package/dist/components/breadcrumb.d.mts +1 -0
  15. package/dist/components/breadcrumb.mjs +11 -10
  16. package/dist/components/button-group.d.mts +1 -1
  17. package/dist/components/button-group.mjs +6 -7
  18. package/dist/components/button.d.mts +0 -1
  19. package/dist/components/button.mjs +7 -7
  20. package/dist/components/calendar.d.mts +6 -2
  21. package/dist/components/calendar.mjs +39 -43
  22. package/dist/components/card.d.mts +4 -2
  23. package/dist/components/card.mjs +9 -9
  24. package/dist/components/carousel.d.mts +16 -4
  25. package/dist/components/carousel.mjs +24 -11
  26. package/dist/components/chart.d.mts +8 -3
  27. package/dist/components/chart.mjs +21 -15
  28. package/dist/components/checkbox-cards.mjs +4 -4
  29. package/dist/components/checkbox-group.mjs +3 -4
  30. package/dist/components/checkbox.d.mts +2 -2
  31. package/dist/components/checkbox.mjs +6 -7
  32. package/dist/components/collapsible.d.mts +4 -4
  33. package/dist/components/collapsible.mjs +4 -5
  34. package/dist/components/command.d.mts +11 -1
  35. package/dist/components/command.mjs +35 -32
  36. package/dist/components/context-menu.d.mts +22 -15
  37. package/dist/components/context-menu.mjs +44 -39
  38. package/dist/components/dialog.d.mts +19 -23
  39. package/dist/components/dialog.mjs +48 -47
  40. package/dist/components/direction.d.mts +24 -0
  41. package/dist/components/direction.mjs +18 -0
  42. package/dist/components/drawer.d.mts +2 -20
  43. package/dist/components/drawer.mjs +17 -25
  44. package/dist/components/dropdown-menu.d.mts +22 -15
  45. package/dist/components/dropdown-menu.mjs +41 -37
  46. package/dist/components/empty.mjs +5 -5
  47. package/dist/components/field.d.mts +1 -1
  48. package/dist/components/field.mjs +11 -12
  49. package/dist/components/form.d.mts +6 -7
  50. package/dist/components/form.mjs +6 -7
  51. package/dist/components/hover-card.d.mts +5 -5
  52. package/dist/components/hover-card.mjs +14 -12
  53. package/dist/components/input-group.d.mts +1 -1
  54. package/dist/components/input-group.mjs +12 -7
  55. package/dist/components/input-number.d.mts +3 -1
  56. package/dist/components/input-number.mjs +49 -27
  57. package/dist/components/input-otp.mjs +9 -7
  58. package/dist/components/input-password.mjs +1 -4
  59. package/dist/components/input-search.mjs +3 -5
  60. package/dist/components/input.mjs +1 -2
  61. package/dist/components/item.mjs +9 -9
  62. package/dist/components/kbd.mjs +1 -1
  63. package/dist/components/label.d.mts +2 -2
  64. package/dist/components/label.mjs +3 -4
  65. package/dist/components/menubar.d.mts +22 -16
  66. package/dist/components/menubar.mjs +54 -47
  67. package/dist/components/native-select.d.mts +5 -1
  68. package/dist/components/native-select.mjs +9 -6
  69. package/dist/components/navigation-menu.d.mts +30 -8
  70. package/dist/components/navigation-menu.mjs +33 -23
  71. package/dist/components/pagination.d.mts +6 -0
  72. package/dist/components/pagination.mjs +26 -11
  73. package/dist/components/popover.d.mts +40 -7
  74. package/dist/components/popover.mjs +46 -14
  75. package/dist/components/progress-circle.d.mts +1 -1
  76. package/dist/components/progress-circle.mjs +1 -2
  77. package/dist/components/progress.d.mts +2 -2
  78. package/dist/components/progress.mjs +5 -6
  79. package/dist/components/radio-cards.d.mts +3 -3
  80. package/dist/components/radio-cards.mjs +11 -11
  81. package/dist/components/radio-group.d.mts +3 -3
  82. package/dist/components/radio-group.mjs +9 -9
  83. package/dist/components/radio.mjs +2 -3
  84. package/dist/components/resizable.mjs +3 -8
  85. package/dist/components/scroll-area.d.mts +5 -5
  86. package/dist/components/scroll-area.mjs +13 -10
  87. package/dist/components/select.d.mts +14 -14
  88. package/dist/components/select.mjs +47 -47
  89. package/dist/components/separator.d.mts +2 -2
  90. package/dist/components/separator.mjs +3 -4
  91. package/dist/components/sheet.d.mts +13 -14
  92. package/dist/components/sheet.mjs +41 -39
  93. package/dist/components/sidebar.d.mts +2 -3
  94. package/dist/components/sidebar.mjs +46 -46
  95. package/dist/components/skeleton.mjs +1 -1
  96. package/dist/components/slider.d.mts +2 -2
  97. package/dist/components/slider.mjs +9 -11
  98. package/dist/components/sonner.mjs +11 -3
  99. package/dist/components/spinner.mjs +6 -7
  100. package/dist/components/switch.d.mts +5 -2
  101. package/dist/components/switch.mjs +7 -7
  102. package/dist/components/table.mjs +10 -10
  103. package/dist/components/tabs.d.mts +8 -5
  104. package/dist/components/tabs.mjs +18 -12
  105. package/dist/components/textarea.mjs +1 -1
  106. package/dist/components/toggle-group.d.mts +9 -6
  107. package/dist/components/toggle-group.mjs +19 -20
  108. package/dist/components/toggle.d.mts +2 -3
  109. package/dist/components/toggle.mjs +4 -6
  110. package/dist/components/tooltip.d.mts +7 -6
  111. package/dist/components/tooltip.mjs +19 -17
  112. package/dist/hooks/use-animated-value.mjs +0 -1
  113. package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
  114. package/dist/hooks/use-is-mobile.mjs +0 -1
  115. package/dist/hooks/use-media-query.mjs +0 -1
  116. package/dist/hooks/use-mutation-observer.mjs +0 -1
  117. package/dist/hooks/use-pagination.mjs +0 -1
  118. package/dist/index.d.mts +15 -13
  119. package/dist/index.mjs +18 -16
  120. package/dist/primitives/checkbox-group.d.mts +9 -10
  121. package/dist/primitives/checkbox-group.mjs +14 -19
  122. package/dist/primitives/input-number.d.mts +3 -3
  123. package/dist/primitives/input-number.mjs +3 -5
  124. package/dist/primitives/input.d.mts +4 -4
  125. package/dist/primitives/input.mjs +2 -3
  126. package/dist/primitives/progress-circle.d.mts +3 -3
  127. package/dist/primitives/progress-circle.mjs +2 -3
  128. package/dist/variants/alert.d.mts +1 -1
  129. package/dist/variants/alert.mjs +3 -13
  130. package/dist/variants/badge.d.mts +6 -4
  131. package/dist/variants/badge.mjs +7 -34
  132. package/dist/variants/button-group.d.mts +2 -2
  133. package/dist/variants/button-group.mjs +3 -14
  134. package/dist/variants/button.d.mts +12 -10
  135. package/dist/variants/button.mjs +15 -57
  136. package/dist/variants/empty.d.mts +1 -1
  137. package/dist/variants/empty.mjs +2 -7
  138. package/dist/variants/field.d.mts +3 -3
  139. package/dist/variants/field.mjs +4 -22
  140. package/dist/variants/input-group.d.mts +9 -9
  141. package/dist/variants/input-group.mjs +11 -70
  142. package/dist/variants/input-number.d.mts +45 -0
  143. package/dist/variants/input-number.mjs +40 -0
  144. package/dist/variants/item.d.mts +5 -4
  145. package/dist/variants/item.mjs +9 -31
  146. package/dist/variants/navigation-menu.d.mts +1 -1
  147. package/dist/variants/navigation-menu.mjs +1 -5
  148. package/dist/variants/progress-circle.d.mts +1 -1
  149. package/dist/variants/progress-circle.mjs +1 -5
  150. package/dist/variants/scroll-area.d.mts +2 -2
  151. package/dist/variants/scroll-area.mjs +3 -8
  152. package/dist/variants/separator.mjs +6 -6
  153. package/dist/variants/sheet.d.mts +4 -4
  154. package/dist/variants/sheet.mjs +5 -38
  155. package/dist/variants/sidebar.d.mts +4 -4
  156. package/dist/variants/sidebar.mjs +6 -23
  157. package/dist/variants/tabs.d.mts +18 -0
  158. package/dist/variants/tabs.mjs +15 -0
  159. package/dist/variants/toggle.d.mts +4 -4
  160. package/dist/variants/toggle.mjs +9 -27
  161. package/package.json +27 -44
  162. package/src/components/accordion.tsx +26 -68
  163. package/src/components/alert-dialog.tsx +70 -86
  164. package/src/components/alert.tsx +27 -19
  165. package/src/components/aspect-ratio.tsx +1 -4
  166. package/src/components/avatar.tsx +99 -12
  167. package/src/components/badge.tsx +5 -8
  168. package/src/components/breadcrumb.tsx +18 -24
  169. package/src/components/button-group.tsx +10 -20
  170. package/src/components/button.tsx +8 -19
  171. package/src/components/calendar.tsx +77 -132
  172. package/src/components/card.tsx +16 -22
  173. package/src/components/carousel.tsx +38 -56
  174. package/src/components/chart.tsx +41 -92
  175. package/src/components/checkbox-cards.tsx +10 -30
  176. package/src/components/checkbox-group.tsx +5 -28
  177. package/src/components/checkbox.tsx +5 -26
  178. package/src/components/collapsible.tsx +1 -4
  179. package/src/components/command.tsx +52 -65
  180. package/src/components/context-menu.tsx +46 -125
  181. package/src/components/dialog.tsx +49 -101
  182. package/src/components/direction.tsx +32 -0
  183. package/src/components/drawer.tsx +17 -79
  184. package/src/components/dropdown-menu.tsx +39 -118
  185. package/src/components/empty.tsx +6 -20
  186. package/src/components/field.tsx +19 -52
  187. package/src/components/form.tsx +19 -61
  188. package/src/components/hover-card.tsx +4 -27
  189. package/src/components/input-group.tsx +13 -52
  190. package/src/components/input-number.tsx +55 -75
  191. package/src/components/input-otp.tsx +19 -38
  192. package/src/components/input-password.tsx +5 -29
  193. package/src/components/input-search.tsx +6 -23
  194. package/src/components/input.tsx +1 -17
  195. package/src/components/item.tsx +17 -31
  196. package/src/components/kbd.tsx +2 -14
  197. package/src/components/label.tsx +2 -10
  198. package/src/components/menubar.tsx +34 -125
  199. package/src/components/native-select.tsx +21 -30
  200. package/src/components/navigation-menu.tsx +34 -94
  201. package/src/components/pagination.tsx +28 -34
  202. package/src/components/popover.tsx +66 -35
  203. package/src/components/progress-circle.tsx +7 -25
  204. package/src/components/progress.tsx +3 -16
  205. package/src/components/radio-cards.tsx +8 -27
  206. package/src/components/radio-group.tsx +7 -27
  207. package/src/components/radio.tsx +3 -24
  208. package/src/components/resizable.tsx +5 -26
  209. package/src/components/scroll-area.tsx +12 -32
  210. package/src/components/select.tsx +36 -59
  211. package/src/components/separator.tsx +4 -18
  212. package/src/components/sheet.tsx +37 -74
  213. package/src/components/sidebar.tsx +47 -177
  214. package/src/components/skeleton.tsx +1 -3
  215. package/src/components/slider.tsx +7 -36
  216. package/src/components/sonner.tsx +16 -6
  217. package/src/components/spinner.tsx +6 -15
  218. package/src/components/switch.tsx +8 -30
  219. package/src/components/table.tsx +18 -35
  220. package/src/components/tabs.tsx +16 -34
  221. package/src/components/textarea.tsx +1 -15
  222. package/src/components/toggle-group.tsx +34 -38
  223. package/src/components/toggle.tsx +4 -13
  224. package/src/components/tooltip.tsx +11 -37
  225. package/src/css/foundation/base.css +50 -0
  226. package/src/css/foundation/motion.css +36 -0
  227. package/src/css/foundation/source.css +3 -0
  228. package/src/css/foundation/tokens.css +71 -0
  229. package/src/css/foundation/variants.css +113 -0
  230. package/src/css/preset.css +5 -214
  231. package/src/css/style.css +1 -1
  232. package/src/hooks/use-animated-value.ts +1 -7
  233. package/src/hooks/use-copy-to-clipboard.ts +1 -6
  234. package/src/hooks/use-is-mobile.ts +0 -2
  235. package/src/hooks/use-media-query.ts +0 -2
  236. package/src/hooks/use-mutation-observer.ts +0 -3
  237. package/src/hooks/use-pagination.ts +0 -2
  238. package/src/index.ts +39 -80
  239. package/src/primitives/checkbox-group.tsx +25 -39
  240. package/src/primitives/input-number.tsx +17 -63
  241. package/src/primitives/input.tsx +8 -24
  242. package/src/primitives/progress-circle.tsx +13 -43
  243. package/src/variants/alert.ts +3 -14
  244. package/src/variants/badge.ts +8 -35
  245. package/src/variants/button-group.ts +5 -18
  246. package/src/variants/button.ts +21 -58
  247. package/src/variants/empty.ts +2 -11
  248. package/src/variants/field.ts +6 -19
  249. package/src/variants/input-group.ts +12 -64
  250. package/src/variants/input-number.ts +65 -0
  251. package/src/variants/item.ts +10 -32
  252. package/src/variants/navigation-menu.ts +1 -8
  253. package/src/variants/progress-circle.ts +1 -2
  254. package/src/variants/scroll-area.ts +3 -9
  255. package/src/variants/separator.ts +6 -7
  256. package/src/variants/sheet.ts +6 -39
  257. package/src/variants/sidebar.ts +7 -27
  258. package/src/variants/tabs.ts +34 -0
  259. package/src/variants/toggle.ts +9 -28
  260. /package/src/css/{amber.css → themes/amber.css} +0 -0
  261. /package/src/css/{blue.css → themes/blue.css} +0 -0
  262. /package/src/css/{cyan.css → themes/cyan.css} +0 -0
  263. /package/src/css/{emerald.css → themes/emerald.css} +0 -0
  264. /package/src/css/{fuchsia.css → themes/fuchsia.css} +0 -0
  265. /package/src/css/{gray.css → themes/gray.css} +0 -0
  266. /package/src/css/{green.css → themes/green.css} +0 -0
  267. /package/src/css/{indigo.css → themes/indigo.css} +0 -0
  268. /package/src/css/{lime.css → themes/lime.css} +0 -0
  269. /package/src/css/{neutral.css → themes/neutral.css} +0 -0
  270. /package/src/css/{orange.css → themes/orange.css} +0 -0
  271. /package/src/css/{pink.css → themes/pink.css} +0 -0
  272. /package/src/css/{purple.css → themes/purple.css} +0 -0
  273. /package/src/css/{red.css → themes/red.css} +0 -0
  274. /package/src/css/{rose.css → themes/rose.css} +0 -0
  275. /package/src/css/{sky.css → themes/sky.css} +0 -0
  276. /package/src/css/{slate.css → themes/slate.css} +0 -0
  277. /package/src/css/{stone.css → themes/stone.css} +0 -0
  278. /package/src/css/{teal.css → themes/teal.css} +0 -0
  279. /package/src/css/{violet.css → themes/violet.css} +0 -0
  280. /package/src/css/{yellow.css → themes/yellow.css} +0 -0
  281. /package/src/css/{zinc.css → themes/zinc.css} +0 -0
@@ -1,14 +1,10 @@
1
- "use client";
2
-
3
- import type { ButtonGroupVariants } from "#/variants/button-group";
1
+ import { Slot } from "radix-ui";
4
2
  import type { ComponentProps, JSX } from "react";
5
3
 
4
+ import { Separator } from "#/components/separator";
6
5
  import { cn } from "#/lib/utils";
7
-
6
+ import type { ButtonGroupVariants } from "#/variants/button-group";
8
7
  import { buttonGroupVariants } from "#/variants/button-group";
9
- import { Slot } from "@radix-ui/react-slot";
10
-
11
- import { Separator } from "#/components/separator";
12
8
 
13
9
  /* -----------------------------------------------------------------------------
14
10
  * Component: ButtonGroup
@@ -48,22 +44,13 @@ interface ButtonGroupTextProps extends ComponentProps<"div"> {
48
44
  /**
49
45
  * @since 0.3.16-canary.0
50
46
  */
51
- function ButtonGroupText({
52
- asChild = false,
53
- className,
54
- ...props
55
- }: ButtonGroupTextProps): JSX.Element {
56
- const Component = asChild ? Slot : "div";
47
+ function ButtonGroupText({ asChild = false, className, ...props }: ButtonGroupTextProps): JSX.Element {
48
+ const Component = asChild ? Slot.Root : "div";
57
49
 
58
50
  return (
59
51
  <Component
60
52
  className={cn(
61
- "flex items-center gap-2",
62
- "px-4",
63
- "rounded-lg border",
64
- "bg-muted shadow-xs",
65
- "text-sm font-medium",
66
- "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
53
+ "flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
67
54
  className,
68
55
  )}
69
56
  {...props}
@@ -90,7 +77,10 @@ function ButtonGroupSeparator({
90
77
  }: ButtonGroupSeparatorProps): JSX.Element {
91
78
  return (
92
79
  <Separator
93
- className={cn("relative self-stretch", "bg-input", "data-vertical:h-auto", "!m-0", className)}
80
+ className={cn(
81
+ "relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
82
+ className,
83
+ )}
94
84
  data-slot="button-group-separator"
95
85
  orientation={orientation}
96
86
  {...props}
@@ -1,8 +1,7 @@
1
- import type { ButtonVariants } from "#/variants/button";
1
+ import { Slot } from "radix-ui";
2
2
  import type { ComponentProps, JSX } from "react";
3
3
 
4
- import { Slot } from "@radix-ui/react-slot";
5
-
4
+ import type { ButtonVariants } from "#/variants/button";
6
5
  import { buttonVariants } from "#/variants/button";
7
6
 
8
7
  /* -----------------------------------------------------------------------------
@@ -21,40 +20,30 @@ type ButtonProps = ComponentProps<"button"> &
21
20
  /**
22
21
  * @since 0.3.16-canary.0
23
22
  */
24
- function Button({
25
- asChild = false,
26
- children,
27
- className,
28
- size,
29
- type = "button",
30
- variant,
31
- ...props
32
- }: ButtonProps): JSX.Element {
33
- const Comp = asChild ? Slot : "button";
23
+ function Button({ asChild = false, className, size, type = "button", variant, ...props }: ButtonProps): JSX.Element {
24
+ const Comp = asChild ? Slot.Root : "button";
34
25
 
35
26
  if (asChild) {
36
27
  return (
37
28
  <Comp
38
29
  className={buttonVariants({ className, size, variant })}
30
+ data-size={size}
39
31
  data-slot="button"
40
32
  data-variant={variant}
41
33
  {...props}
42
- >
43
- {children}
44
- </Comp>
34
+ />
45
35
  );
46
36
  }
47
37
 
48
38
  return (
49
39
  <button
50
40
  className={buttonVariants({ className, size, variant })}
41
+ data-size={size}
51
42
  data-slot="button"
52
43
  data-variant={variant}
53
44
  type={type}
54
45
  {...props}
55
- >
56
- {children}
57
- </button>
46
+ />
58
47
  );
59
48
  }
60
49
 
@@ -1,14 +1,11 @@
1
- "use client";
2
-
3
- import type { ComponentProps, JSX } from "react";
4
- import type { Chevron, DayButton, Root, WeekNumber } from "react-day-picker";
5
-
6
- import { cn } from "#/lib/utils";
1
+ import type { Chevron, DayButton, Locale, Root, WeekNumber } from "@daypicker/react";
2
+ import { DayPicker, getDefaultClassNames } from "@daypicker/react";
7
3
  import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4
+ import type { ComponentProps, JSX } from "react";
8
5
  import { useEffect, useRef } from "react";
9
- import { DayPicker, getDefaultClassNames } from "react-day-picker";
10
6
 
11
7
  import { Button } from "#/components/button";
8
+ import { cn } from "#/lib/utils";
12
9
  import { buttonVariants } from "#/variants/button";
13
10
 
14
11
  /* -----------------------------------------------------------------------------
@@ -32,6 +29,7 @@ function Calendar({
32
29
  classNames,
33
30
  components,
34
31
  formatters,
32
+ locale,
35
33
  showOutsideDays = true,
36
34
  ...props
37
35
  }: CalendarProps): JSX.Element {
@@ -41,123 +39,92 @@ function Calendar({
41
39
  <DayPicker
42
40
  captionLayout={captionLayout}
43
41
  className={cn(
44
- "group/calendar",
45
- "p-3",
46
- "bg-background",
47
- "in-data-[slot=card-content]:bg-transparent",
48
- "in-data-[slot=popover-content]:bg-transparent",
49
- "rtl:**:[.rdp-button_next>svg]:rotate-180",
50
- "rtl:**:[.rdp-button_previous>svg]:rotate-180",
51
- "[--cell-size:--spacing(8)]",
42
+ "group/calendar bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
43
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
44
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
52
45
  className,
53
46
  )}
54
47
  classNames={{
55
- button_next: buttonVariants({
56
- variant: buttonVariant,
57
- className: [
58
- "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
59
- defaultClassNames.button_next,
60
- ],
61
- }),
62
- button_previous: buttonVariants({
63
- variant: buttonVariant,
64
- className: [
65
- "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
66
- defaultClassNames.button_previous,
67
- ],
68
- }),
48
+ root: cn("w-fit", defaultClassNames.root),
49
+ months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
50
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
51
+ nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
52
+ button_previous: cn(
53
+ buttonVariants({ variant: buttonVariant }),
54
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
55
+ defaultClassNames.button_previous,
56
+ ),
57
+ button_next: cn(
58
+ buttonVariants({ variant: buttonVariant }),
59
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
60
+ defaultClassNames.button_next,
61
+ ),
62
+ month_caption: cn(
63
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
64
+ defaultClassNames.month_caption,
65
+ ),
66
+ dropdowns: cn(
67
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
68
+ defaultClassNames.dropdowns,
69
+ ),
70
+ dropdown_root: cn(
71
+ "relative rounded-(--cell-radius) border border-input shadow-xs has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50",
72
+ defaultClassNames.dropdown_root,
73
+ ),
74
+ dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
69
75
  caption_label: cn(
70
- "font-medium",
71
- "select-none",
76
+ "font-medium select-none",
72
77
  captionLayout === "label"
73
78
  ? "text-sm"
74
- : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
79
+ : "flex h-8 items-center gap-1 rounded-(--cell-radius) pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
75
80
  defaultClassNames.caption_label,
76
81
  ),
82
+ month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
83
+ weekdays: cn("flex", defaultClassNames.weekdays),
84
+ weekday: cn(
85
+ "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
86
+ defaultClassNames.weekday,
87
+ ),
88
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
89
+ week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
90
+ week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
77
91
  day: cn(
78
- "group/day relative",
79
- "aspect-square h-full w-full p-0 text-center",
80
- "select-none",
81
- "[&:last-child[data-selected=true]_button]:rounded-r-md",
92
+ "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
82
93
  props.showWeekNumber
83
- ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
84
- : "[&:first-child[data-selected=true]_button]:rounded-l-md",
94
+ ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
95
+ : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
85
96
  defaultClassNames.day,
86
97
  ),
87
- disabled: cn("opacity-50", "text-muted-foreground", defaultClassNames.disabled),
88
- dropdown: cn("absolute inset-0", "bg-popover", "opacity-0", defaultClassNames.dropdown),
89
- dropdown_root: cn(
90
- "relative",
91
- "rounded-md border border-input shadow-xs",
92
- "has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50",
93
- defaultClassNames.dropdown_root,
94
- ),
95
- dropdowns: cn(
96
- "flex h-(--cell-size) w-full items-center justify-center gap-1.5",
97
- "text-sm font-medium",
98
- defaultClassNames.dropdowns,
98
+ range_start: cn(
99
+ "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
100
+ defaultClassNames.range_start,
99
101
  ),
100
- hidden: cn("invisible", defaultClassNames.hidden),
101
- month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
102
- month_caption: cn(
103
- "flex h-(--cell-size) w-full items-center justify-center",
104
- "px-(--cell-size)",
105
- defaultClassNames.month_caption,
106
- ),
107
- months: cn("relative flex flex-col gap-4", "md:flex-row", defaultClassNames.months),
108
- nav: cn(
109
- "absolute flex w-full items-center justify-between gap-1",
110
- "inset-x-0 top-0",
111
- defaultClassNames.nav,
112
- ),
113
- outside: cn(
114
- "text-muted-foreground",
115
- "aria-selected:text-muted-foreground",
116
- defaultClassNames.outside,
117
- ),
118
- range_end: cn("rounded-r-md", "bg-accent", defaultClassNames.range_end),
119
102
  range_middle: cn("rounded-none", defaultClassNames.range_middle),
120
- range_start: cn("rounded-l-md", "bg-accent", defaultClassNames.range_start),
121
- root: cn("w-fit", defaultClassNames.root),
122
- month_grid: "w-full border-collapse",
103
+ range_end: cn(
104
+ "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
105
+ defaultClassNames.range_end,
106
+ ),
123
107
  today: cn(
124
- "rounded-md",
125
- "bg-accent text-accent-foreground",
126
- "data-selected:rounded-none",
108
+ "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
127
109
  defaultClassNames.today,
128
110
  ),
129
- week: cn("flex w-full", "mt-2", defaultClassNames.week),
130
- week_number: cn(
131
- "text-[0.8rem] text-muted-foreground",
132
- "select-none",
133
- defaultClassNames.week_number,
134
- ),
135
- week_number_header: cn(
136
- "w-(--cell-size)",
137
- "select-none",
138
- defaultClassNames.week_number_header,
139
- ),
140
- weekday: cn(
141
- "flex-1",
142
- "rounded-md",
143
- "text-[0.8rem] font-normal text-muted-foreground",
144
- "select-none",
145
- defaultClassNames.weekday,
146
- ),
147
- weekdays: cn("flex", defaultClassNames.weekdays),
111
+ outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
112
+ disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
113
+ hidden: cn("invisible", defaultClassNames.hidden),
148
114
  ...classNames,
149
115
  }}
150
116
  components={{
151
117
  Chevron: CalendarChevron,
152
- DayButton: CalendarDayButton,
118
+ DayButton: (dayButtonProps) => <CalendarDayButton locale={locale} {...dayButtonProps} />,
153
119
  Root: CalendarRoot,
154
120
  WeekNumber: CalendarWeekNumber,
155
121
  ...components,
156
122
  }}
157
123
  formatters={{
158
- formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
124
+ formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
159
125
  ...formatters,
160
126
  }}
127
+ locale={locale}
161
128
  showOutsideDays={showOutsideDays}
162
129
  {...props}
163
130
  />
@@ -168,17 +135,13 @@ function Calendar({
168
135
  * Component: CalendarChevron (internal)
169
136
  * -------------------------------------------------------------------------- */
170
137
 
171
- function CalendarChevron({
172
- className,
173
- orientation,
174
- ...props
175
- }: ComponentProps<typeof Chevron>): JSX.Element {
138
+ function CalendarChevron({ className, orientation, ...props }: ComponentProps<typeof Chevron>): JSX.Element {
176
139
  if (orientation === "left") {
177
- return <ChevronLeftIcon className={cn("size-4", className)} {...props} />;
140
+ return <ChevronLeftIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
178
141
  }
179
142
 
180
143
  if (orientation === "right") {
181
- return <ChevronRightIcon className={cn("size-4", className)} {...props} />;
144
+ return <ChevronRightIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
182
145
  }
183
146
 
184
147
  return <ChevronDownIcon className={cn("size-4", className)} {...props} />;
@@ -188,23 +151,18 @@ function CalendarChevron({
188
151
  * Component: CalendarRoot (internal)
189
152
  * -------------------------------------------------------------------------- */
190
153
 
191
- function CalendarRoot({ className, rootRef, ...props }: ComponentProps<typeof Root>): JSX.Element {
192
- return <div ref={rootRef} className={cn(className)} data-slot="calendar" {...props} />;
154
+ function CalendarRoot({ rootRef, ...props }: ComponentProps<typeof Root>): JSX.Element {
155
+ return <div ref={rootRef} data-slot="calendar" {...props} />;
193
156
  }
194
157
 
195
158
  /* -----------------------------------------------------------------------------
196
159
  * Component: CalendarWeekNumber (internal)
197
160
  * -------------------------------------------------------------------------- */
198
161
 
199
- function CalendarWeekNumber({
200
- children,
201
- ...props
202
- }: ComponentProps<typeof WeekNumber>): JSX.Element {
162
+ function CalendarWeekNumber({ children, ...props }: ComponentProps<typeof WeekNumber>): JSX.Element {
203
163
  return (
204
164
  <td {...props}>
205
- <div className={cn("flex size-(--cell-size) items-center justify-center", "text-center")}>
206
- {children}
207
- </div>
165
+ <div className="flex size-(--cell-size) items-center justify-center text-center">{children}</div>
208
166
  </td>
209
167
  );
210
168
  }
@@ -216,17 +174,14 @@ function CalendarWeekNumber({
216
174
  /**
217
175
  * @since 0.3.16-canary.0
218
176
  */
219
- type CalendarDayButtonProps = ComponentProps<typeof DayButton>;
177
+ type CalendarDayButtonProps = ComponentProps<typeof DayButton> & {
178
+ locale?: Partial<Locale>;
179
+ };
220
180
 
221
181
  /**
222
182
  * @since 0.3.16-canary.0
223
183
  */
224
- function CalendarDayButton({
225
- className,
226
- day,
227
- modifiers,
228
- ...props
229
- }: CalendarDayButtonProps): JSX.Element {
184
+ function CalendarDayButton({ className, day, locale, modifiers, ...props }: CalendarDayButtonProps): JSX.Element {
230
185
  const defaultClassNames = getDefaultClassNames();
231
186
 
232
187
  const ref = useRef<HTMLButtonElement>(null);
@@ -241,26 +196,16 @@ function CalendarDayButton({
241
196
  <Button
242
197
  ref={ref}
243
198
  className={cn(
244
- "flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal",
245
- "group-data-focused/day:relative group-data-focused/day:z-10 group-data-focused/day:border-ring group-data-focused/day:ring-3 group-data-focused/day:ring-ring/50",
246
- "data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground",
247
- "data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground",
248
- "data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground",
249
- "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground",
250
- "dark:hover:text-accent-foreground",
251
- "[&>span]:text-xs [&>span]:opacity-70",
199
+ "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-focused/day:relative group-data-focused/day:z-10 group-data-focused/day:border-ring group-data-focused/day:ring-3 group-data-focused/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
252
200
  defaultClassNames.day,
253
201
  className,
254
202
  )}
255
- data-day={day.date.toLocaleDateString()}
203
+ data-day={day.date.toLocaleDateString(locale?.code)}
256
204
  data-range-end={modifiers.range_end}
257
205
  data-range-middle={modifiers.range_middle}
258
206
  data-range-start={modifiers.range_start}
259
207
  data-selected-single={
260
- modifiers.selected &&
261
- !modifiers.range_start &&
262
- !modifiers.range_end &&
263
- !modifiers.range_middle
208
+ modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
264
209
  }
265
210
  size="icon"
266
211
  variant="ghost"
@@ -9,20 +9,21 @@ import { cn } from "#/lib/utils";
9
9
  /**
10
10
  * @since 0.3.16-canary.0
11
11
  */
12
- type CardProps = ComponentProps<"div">;
12
+ type CardProps = ComponentProps<"div"> & {
13
+ size?: "default" | "sm";
14
+ };
13
15
 
14
16
  /**
15
17
  * @since 0.3.16-canary.0
16
18
  */
17
- function Card({ className, ...props }: CardProps): JSX.Element {
19
+ function Card({ className, size = "default", ...props }: CardProps): JSX.Element {
18
20
  return (
19
21
  <div
20
22
  className={cn(
21
- "flex flex-col gap-6 overflow-auto py-6",
22
- "rounded-xl border",
23
- "bg-card text-card-foreground shadow-sm",
23
+ "group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
24
24
  className,
25
25
  )}
26
+ data-size={size}
26
27
  data-slot="card"
27
28
  {...props}
28
29
  />
@@ -45,10 +46,7 @@ function CardHeader({ className, ...props }: CardHeaderProps): JSX.Element {
45
46
  return (
46
47
  <div
47
48
  className={cn(
48
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5",
49
- "px-6",
50
- "has-[data-slot=card-action]:grid-cols-[1fr_auto]",
51
- "[.border-b]:pb-6",
49
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
52
50
  className,
53
51
  )}
54
52
  data-slot="card-header"
@@ -69,11 +67,13 @@ type CardTitleProps = ComponentProps<"div">;
69
67
  /**
70
68
  * @since 0.3.16-canary.0
71
69
  */
72
- function CardTitle({ children, className, ...props }: CardTitleProps): JSX.Element {
70
+ function CardTitle({ className, ...props }: CardTitleProps): JSX.Element {
73
71
  return (
74
- <div className={cn("leading-none font-semibold", className)} data-slot="card-title" {...props}>
75
- {children}
76
- </div>
72
+ <div
73
+ className={cn("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className)}
74
+ data-slot="card-title"
75
+ {...props}
76
+ />
77
77
  );
78
78
  }
79
79
 
@@ -90,13 +90,7 @@ type CardDescriptionProps = ComponentProps<"div">;
90
90
  * @since 0.3.16-canary.0
91
91
  */
92
92
  function CardDescription({ className, ...props }: CardDescriptionProps): JSX.Element {
93
- return (
94
- <div
95
- className={cn("text-sm text-muted-foreground", className)}
96
- data-slot="card-description"
97
- {...props}
98
- />
99
- );
93
+ return <div className={cn("text-sm text-muted-foreground", className)} data-slot="card-description" {...props} />;
100
94
  }
101
95
 
102
96
  /* -----------------------------------------------------------------------------
@@ -112,7 +106,7 @@ type CardContentProps = ComponentProps<"div">;
112
106
  * @since 0.3.16-canary.0
113
107
  */
114
108
  function CardContent({ className, ...props }: CardContentProps): JSX.Element {
115
- return <div className={cn("px-6", className)} data-slot="card-content" {...props} />;
109
+ return <div className={cn("px-(--card-spacing)", className)} data-slot="card-content" {...props} />;
116
110
  }
117
111
 
118
112
  /* -----------------------------------------------------------------------------
@@ -130,7 +124,7 @@ type CardFooterProps = ComponentProps<"div">;
130
124
  function CardFooter({ className, ...props }: CardFooterProps): JSX.Element {
131
125
  return (
132
126
  <div
133
- className={cn("flex items-center", "px-6", "[.border-t]:pt-6", className)}
127
+ className={cn("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)", className)}
134
128
  data-slot="card-footer"
135
129
  {...props}
136
130
  />