@codefast/ui 0.3.16-canary.2 → 0.3.16-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion.mjs +2 -2
  4. package/dist/components/alert-dialog.d.mts +1 -1
  5. package/dist/components/alert-dialog.mjs +4 -4
  6. package/dist/components/alert.d.mts +3 -13
  7. package/dist/components/alert.mjs +3 -23
  8. package/dist/components/badge.d.mts +3 -15
  9. package/dist/components/badge.mjs +2 -44
  10. package/dist/components/breadcrumb.mjs +1 -1
  11. package/dist/components/button-group.d.mts +3 -13
  12. package/dist/components/button-group.mjs +3 -24
  13. package/dist/components/button.d.mts +3 -25
  14. package/dist/components/button.mjs +2 -72
  15. package/dist/components/calendar.mjs +2 -1
  16. package/dist/components/carousel.d.mts +1 -2
  17. package/dist/components/chart.d.mts +2 -4
  18. package/dist/components/checkbox.mjs +2 -2
  19. package/dist/components/context-menu.mjs +2 -2
  20. package/dist/components/dialog.d.mts +1 -1
  21. package/dist/components/dialog.mjs +4 -4
  22. package/dist/components/drawer.d.mts +1 -1
  23. package/dist/components/drawer.mjs +2 -2
  24. package/dist/components/dropdown-menu.mjs +2 -2
  25. package/dist/components/empty.d.mts +3 -13
  26. package/dist/components/empty.mjs +3 -18
  27. package/dist/components/field.d.mts +3 -14
  28. package/dist/components/field.mjs +3 -32
  29. package/dist/components/form.d.mts +2 -4
  30. package/dist/components/hover-card.mjs +1 -1
  31. package/dist/components/input-group.d.mts +4 -31
  32. package/dist/components/input-group.mjs +3 -90
  33. package/dist/components/input-number.mjs +4 -4
  34. package/dist/components/input-otp.mjs +2 -2
  35. package/dist/components/input.mjs +1 -1
  36. package/dist/components/item.d.mts +4 -29
  37. package/dist/components/item.mjs +3 -56
  38. package/dist/components/menubar.mjs +2 -2
  39. package/dist/components/native-select.mjs +1 -1
  40. package/dist/components/navigation-menu.d.mts +1 -6
  41. package/dist/components/navigation-menu.mjs +8 -15
  42. package/dist/components/pagination.d.mts +1 -1
  43. package/dist/components/pagination.mjs +1 -1
  44. package/dist/components/popover.mjs +1 -1
  45. package/dist/components/progress-circle.d.mts +3 -47
  46. package/dist/components/progress-circle.mjs +2 -47
  47. package/dist/components/progress.mjs +1 -1
  48. package/dist/components/radio-group.mjs +1 -1
  49. package/dist/components/radio.mjs +1 -1
  50. package/dist/components/scroll-area.d.mts +3 -19
  51. package/dist/components/scroll-area.mjs +4 -61
  52. package/dist/components/select.d.mts +1 -1
  53. package/dist/components/select.mjs +3 -3
  54. package/dist/components/separator.d.mts +3 -18
  55. package/dist/components/separator.mjs +3 -23
  56. package/dist/components/sheet.d.mts +6 -18
  57. package/dist/components/sheet.mjs +6 -49
  58. package/dist/components/sidebar.d.mts +4 -19
  59. package/dist/components/sidebar.mjs +10 -46
  60. package/dist/components/skeleton.mjs +1 -1
  61. package/dist/components/slider.mjs +1 -1
  62. package/dist/components/spinner.mjs +1 -1
  63. package/dist/components/switch.mjs +2 -2
  64. package/dist/components/table.mjs +1 -1
  65. package/dist/components/tabs.mjs +1 -1
  66. package/dist/components/textarea.mjs +1 -1
  67. package/dist/components/toggle-group.d.mts +3 -2
  68. package/dist/components/toggle-group.mjs +1 -1
  69. package/dist/components/toggle.d.mts +2 -21
  70. package/dist/components/toggle.mjs +2 -39
  71. package/dist/components/tooltip.mjs +1 -1
  72. package/dist/index.d.mts +31 -16
  73. package/dist/index.mjs +30 -15
  74. package/dist/lib/utils.d.mts +1 -12
  75. package/dist/lib/utils.mjs +1 -9
  76. package/dist/primitives/checkbox-group.d.mts +1 -2
  77. package/dist/primitives/input-number.d.mts +1 -2
  78. package/dist/primitives/input.d.mts +1 -2
  79. package/dist/primitives/progress-circle.d.mts +1 -2
  80. package/dist/variants/alert.d.mts +18 -0
  81. package/dist/variants/alert.mjs +25 -0
  82. package/dist/variants/badge.d.mts +20 -0
  83. package/dist/variants/badge.mjs +46 -0
  84. package/dist/variants/button-group.d.mts +18 -0
  85. package/dist/variants/button-group.mjs +26 -0
  86. package/dist/variants/button.d.mts +30 -0
  87. package/dist/variants/button.mjs +76 -0
  88. package/dist/variants/empty.d.mts +18 -0
  89. package/dist/variants/empty.mjs +20 -0
  90. package/dist/variants/field.d.mts +19 -0
  91. package/dist/variants/field.mjs +34 -0
  92. package/dist/variants/input-group.d.mts +43 -0
  93. package/dist/variants/input-group.mjs +93 -0
  94. package/dist/variants/item.d.mts +37 -0
  95. package/dist/variants/item.mjs +60 -0
  96. package/dist/variants/navigation-menu.d.mts +13 -0
  97. package/dist/variants/navigation-menu.mjs +12 -0
  98. package/dist/variants/progress-circle.d.mts +52 -0
  99. package/dist/variants/progress-circle.mjs +49 -0
  100. package/dist/variants/scroll-area.d.mts +24 -0
  101. package/dist/variants/scroll-area.mjs +63 -0
  102. package/dist/variants/separator.d.mts +23 -0
  103. package/dist/variants/separator.mjs +25 -0
  104. package/dist/variants/sheet.d.mts +20 -0
  105. package/dist/variants/sheet.mjs +50 -0
  106. package/dist/variants/sidebar.d.mts +23 -0
  107. package/dist/variants/sidebar.mjs +42 -0
  108. package/dist/variants/toggle.d.mts +23 -0
  109. package/dist/variants/toggle.mjs +43 -0
  110. package/package.json +168 -20
  111. package/src/components/accordion.tsx +156 -0
  112. package/src/components/alert-dialog.tsx +314 -0
  113. package/src/components/alert.tsx +86 -0
  114. package/src/components/aspect-ratio.tsx +28 -0
  115. package/src/components/avatar.tsx +84 -0
  116. package/src/components/badge.tsx +38 -0
  117. package/src/components/breadcrumb.tsx +197 -0
  118. package/src/components/button-group.tsx +107 -0
  119. package/src/components/button.tsx +66 -0
  120. package/src/components/calendar.tsx +277 -0
  121. package/src/components/card.tsx +175 -0
  122. package/src/components/carousel.tsx +367 -0
  123. package/src/components/chart.tsx +587 -0
  124. package/src/components/checkbox-cards.tsx +92 -0
  125. package/src/components/checkbox-group.tsx +83 -0
  126. package/src/components/checkbox.tsx +65 -0
  127. package/src/components/collapsible.tsx +60 -0
  128. package/src/components/command.tsx +311 -0
  129. package/src/components/context-menu.tsx +489 -0
  130. package/src/components/dialog.tsx +295 -0
  131. package/src/components/drawer.tsx +271 -0
  132. package/src/components/dropdown-menu.tsx +498 -0
  133. package/src/components/empty.tsx +169 -0
  134. package/src/components/field.tsx +362 -0
  135. package/src/components/form.tsx +300 -0
  136. package/src/components/hover-card.tsx +116 -0
  137. package/src/components/input-group.tsx +224 -0
  138. package/src/components/input-number.tsx +161 -0
  139. package/src/components/input-otp.tsx +151 -0
  140. package/src/components/input-password.tsx +74 -0
  141. package/src/components/input-search.tsx +98 -0
  142. package/src/components/input.tsx +52 -0
  143. package/src/components/item.tsx +280 -0
  144. package/src/components/kbd.tsx +59 -0
  145. package/src/components/label.tsx +44 -0
  146. package/src/components/menubar.tsx +531 -0
  147. package/src/components/native-select.tsx +96 -0
  148. package/src/components/navigation-menu.tsx +295 -0
  149. package/src/components/pagination.tsx +204 -0
  150. package/src/components/popover.tsx +139 -0
  151. package/src/components/progress-circle.tsx +203 -0
  152. package/src/components/progress.tsx +54 -0
  153. package/src/components/radio-cards.tsx +85 -0
  154. package/src/components/radio-group.tsx +79 -0
  155. package/src/components/radio.tsx +61 -0
  156. package/src/components/resizable.tsx +99 -0
  157. package/src/components/scroll-area.tsx +115 -0
  158. package/src/components/select.tsx +319 -0
  159. package/src/components/separator.tsx +74 -0
  160. package/src/components/sheet.tsx +278 -0
  161. package/src/components/sidebar.tsx +1056 -0
  162. package/src/components/skeleton.tsx +37 -0
  163. package/src/components/slider.tsx +95 -0
  164. package/src/components/sonner.tsx +47 -0
  165. package/src/components/spinner.tsx +75 -0
  166. package/src/components/switch.tsx +66 -0
  167. package/src/components/table.tsx +200 -0
  168. package/src/components/tabs.tsx +128 -0
  169. package/src/components/textarea.tsx +49 -0
  170. package/src/components/toggle-group.tsx +141 -0
  171. package/src/components/toggle.tsx +39 -0
  172. package/src/components/tooltip.tsx +141 -0
  173. package/src/css/amber.css +59 -22
  174. package/src/css/blue.css +59 -22
  175. package/src/css/cyan.css +59 -22
  176. package/src/css/emerald.css +59 -22
  177. package/src/css/fuchsia.css +59 -22
  178. package/src/css/gray.css +59 -22
  179. package/src/css/green.css +59 -22
  180. package/src/css/indigo.css +59 -22
  181. package/src/css/lime.css +59 -22
  182. package/src/css/neutral.css +59 -22
  183. package/src/css/orange.css +59 -22
  184. package/src/css/pink.css +59 -22
  185. package/src/css/preset.css +32 -13
  186. package/src/css/purple.css +59 -22
  187. package/src/css/red.css +59 -22
  188. package/src/css/rose.css +59 -22
  189. package/src/css/sky.css +59 -22
  190. package/src/css/slate.css +59 -22
  191. package/src/css/stone.css +59 -22
  192. package/src/css/teal.css +59 -22
  193. package/src/css/violet.css +59 -22
  194. package/src/css/yellow.css +59 -22
  195. package/src/css/zinc.css +59 -22
  196. package/src/hooks/use-animated-value.ts +97 -0
  197. package/src/hooks/use-copy-to-clipboard.ts +63 -0
  198. package/src/hooks/use-is-mobile.ts +27 -0
  199. package/src/hooks/use-media-query.ts +71 -0
  200. package/src/hooks/use-mutation-observer.ts +54 -0
  201. package/src/hooks/use-pagination.ts +166 -0
  202. package/src/index.ts +720 -0
  203. package/src/lib/utils.ts +5 -0
  204. package/src/primitives/checkbox-group.tsx +360 -0
  205. package/src/primitives/input-number.tsx +1013 -0
  206. package/src/primitives/input.tsx +243 -0
  207. package/src/primitives/progress-circle.tsx +537 -0
  208. package/src/variants/alert.ts +45 -0
  209. package/src/variants/badge.ts +66 -0
  210. package/src/variants/button-group.ts +49 -0
  211. package/src/variants/button.ts +93 -0
  212. package/src/variants/empty.ts +43 -0
  213. package/src/variants/field.ts +50 -0
  214. package/src/variants/input-group.ts +132 -0
  215. package/src/variants/item.ts +90 -0
  216. package/src/variants/navigation-menu.ts +32 -0
  217. package/src/variants/progress-circle.ts +47 -0
  218. package/src/variants/scroll-area.ts +79 -0
  219. package/src/variants/separator.ts +41 -0
  220. package/src/variants/sheet.ts +70 -0
  221. package/src/variants/sidebar.ts +61 -0
  222. package/src/variants/toggle.ts +59 -0
  223. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps, JSX } from "react";
4
+
5
+ import { cn } from "#/lib/utils";
6
+ import { CheckIcon } from "lucide-react";
7
+
8
+ import * as CheckboxGroupPrimitive from "#/primitives/checkbox-group";
9
+
10
+ /* -----------------------------------------------------------------------------
11
+ * Component: CheckboxGroup
12
+ * -------------------------------------------------------------------------- */
13
+
14
+ /**
15
+ * @since 0.3.16-canary.0
16
+ */
17
+ type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
18
+
19
+ /**
20
+ * @since 0.3.16-canary.0
21
+ */
22
+ function CheckboxGroup({ className, ...props }: CheckboxGroupProps): JSX.Element {
23
+ return (
24
+ <CheckboxGroupPrimitive.Root
25
+ className={cn("grid gap-2", className)}
26
+ data-slot="checkbox-group"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ /* -----------------------------------------------------------------------------
33
+ * Component: CheckboxGroupItem
34
+ * -------------------------------------------------------------------------- */
35
+
36
+ /**
37
+ * @since 0.3.16-canary.0
38
+ */
39
+ type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupPrimitive.Item>;
40
+
41
+ /**
42
+ * @since 0.3.16-canary.0
43
+ */
44
+ function CheckboxGroupItem({ className, ...props }: CheckboxGroupItemProps): JSX.Element {
45
+ return (
46
+ <CheckboxGroupPrimitive.Item
47
+ className={cn(
48
+ "peer flex size-4 shrink-0 items-center justify-center",
49
+ "rounded-sm border border-input shadow-xs outline-hidden",
50
+ "text-primary-foreground",
51
+ "transition",
52
+ "hover:not-disabled:not-aria-checked:border-ring/60",
53
+ "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
54
+ "disabled:opacity-50",
55
+ "aria-checked:border-primary aria-checked:bg-primary",
56
+ "focus-visible:aria-checked:ring-primary/20",
57
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
58
+ "hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60",
59
+ "aria-checked:aria-invalid:bg-destructive",
60
+ "dark:bg-input/30",
61
+ "dark:focus-visible:aria-checked:ring-primary/40",
62
+ "dark:aria-invalid:ring-destructive/40",
63
+ className,
64
+ )}
65
+ data-slot="checkbox-group-item"
66
+ {...props}
67
+ >
68
+ <CheckboxGroupPrimitive.CheckboxGroupIndicator
69
+ className={cn("flex items-center justify-center text-current", "transition-none")}
70
+ data-slot="checkbox-group-indicator"
71
+ >
72
+ <CheckIcon className="size-3.5" />
73
+ </CheckboxGroupPrimitive.CheckboxGroupIndicator>
74
+ </CheckboxGroupPrimitive.Item>
75
+ );
76
+ }
77
+
78
+ /* -----------------------------------------------------------------------------
79
+ * Exports
80
+ * -------------------------------------------------------------------------- */
81
+
82
+ export { CheckboxGroup, CheckboxGroupItem };
83
+ export type { CheckboxGroupItemProps, CheckboxGroupProps };
@@ -0,0 +1,65 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps, JSX } from "react";
4
+
5
+ import { cn } from "#/lib/utils";
6
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
7
+ import { CheckIcon } from "lucide-react";
8
+
9
+ /* -----------------------------------------------------------------------------
10
+ * Component: Checkbox
11
+ * -------------------------------------------------------------------------- */
12
+
13
+ /**
14
+ * @since 0.3.16-canary.0
15
+ */
16
+ type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
17
+
18
+ /**
19
+ * @since 0.3.16-canary.0
20
+ */
21
+ function Checkbox({ className, ...props }: CheckboxProps): JSX.Element {
22
+ return (
23
+ <CheckboxPrimitive.Root
24
+ className={cn(
25
+ "peer flex size-4 shrink-0 items-center justify-center",
26
+ "rounded-sm border border-input shadow-xs outline-hidden",
27
+ "text-primary-foreground",
28
+ "transition-[border-color,background-color,box-shadow] duration-150 ease-spring",
29
+ "motion-reduce:transition-none motion-reduce:duration-0",
30
+ "hover:not-disabled:not-aria-checked:border-ring/60",
31
+ "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
32
+ "disabled:opacity-50",
33
+ "aria-checked:border-primary aria-checked:bg-primary",
34
+ "aria-checked:focus-visible:ring-primary/20",
35
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
36
+ "hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60",
37
+ "aria-checked:aria-invalid:bg-destructive",
38
+ "dark:bg-input/30",
39
+ "dark:aria-checked:focus-visible:ring-primary/40",
40
+ "dark:aria-invalid:ring-destructive/40",
41
+ className,
42
+ )}
43
+ data-slot="checkbox"
44
+ {...props}
45
+ >
46
+ <CheckboxPrimitive.Indicator
47
+ className={cn(
48
+ "flex items-center justify-center text-current",
49
+ "animate-in duration-150 ease-spring zoom-in-50",
50
+ "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
51
+ )}
52
+ data-slot="checkbox-indicator"
53
+ >
54
+ <CheckIcon className="size-3.5" />
55
+ </CheckboxPrimitive.Indicator>
56
+ </CheckboxPrimitive.Root>
57
+ );
58
+ }
59
+
60
+ /* -----------------------------------------------------------------------------
61
+ * Exports
62
+ * -------------------------------------------------------------------------- */
63
+
64
+ export { Checkbox };
65
+ export type { CheckboxProps };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps, JSX } from "react";
4
+
5
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
6
+
7
+ /* -----------------------------------------------------------------------------
8
+ * Component: Collapsible
9
+ * -------------------------------------------------------------------------- */
10
+
11
+ /**
12
+ * @since 0.3.16-canary.0
13
+ */
14
+ type CollapsibleProps = ComponentProps<typeof CollapsiblePrimitive.Root>;
15
+
16
+ /**
17
+ * @since 0.3.16-canary.0
18
+ */
19
+ function Collapsible({ ...props }: CollapsibleProps): JSX.Element {
20
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
21
+ }
22
+
23
+ /* -----------------------------------------------------------------------------
24
+ * Component: CollapsibleTrigger
25
+ * -------------------------------------------------------------------------- */
26
+
27
+ /**
28
+ * @since 0.3.16-canary.0
29
+ */
30
+ type CollapsibleTriggerProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>;
31
+
32
+ /**
33
+ * @since 0.3.16-canary.0
34
+ */
35
+ function CollapsibleTrigger({ ...props }: CollapsibleTriggerProps): JSX.Element {
36
+ return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />;
37
+ }
38
+
39
+ /* -----------------------------------------------------------------------------
40
+ * Component: CollapsibleContent
41
+ * -------------------------------------------------------------------------- */
42
+
43
+ /**
44
+ * @since 0.3.16-canary.0
45
+ */
46
+ type CollapsibleContentProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>;
47
+
48
+ /**
49
+ * @since 0.3.16-canary.0
50
+ */
51
+ function CollapsibleContent({ ...props }: CollapsibleContentProps): JSX.Element {
52
+ return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />;
53
+ }
54
+
55
+ /* -----------------------------------------------------------------------------
56
+ * Exports
57
+ * -------------------------------------------------------------------------- */
58
+
59
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
60
+ export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps };
@@ -0,0 +1,311 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps, JSX } from "react";
4
+
5
+ import { cn } from "#/lib/utils";
6
+ import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
7
+ import { Command as CommandPrimitive } from "cmdk";
8
+ import { SearchIcon } from "lucide-react";
9
+
10
+ import { Dialog, DialogContent, DialogDescription, DialogTitle } from "#/components/dialog";
11
+
12
+ /* -----------------------------------------------------------------------------
13
+ * Component: Command
14
+ * -------------------------------------------------------------------------- */
15
+
16
+ /**
17
+ * @since 0.3.16-canary.0
18
+ */
19
+ type CommandProps = ComponentProps<typeof CommandPrimitive>;
20
+
21
+ /**
22
+ * @since 0.3.16-canary.0
23
+ */
24
+ function Command({ className, ...props }: CommandProps): JSX.Element {
25
+ return (
26
+ <CommandPrimitive
27
+ className={cn(
28
+ "flex flex-col overflow-hidden",
29
+ "rounded-[inherit]",
30
+ "bg-popover text-popover-foreground outline-hidden",
31
+ className,
32
+ )}
33
+ data-slot="command"
34
+ {...props}
35
+ />
36
+ );
37
+ }
38
+
39
+ /* -----------------------------------------------------------------------------
40
+ * Component: CommandDialog
41
+ * -------------------------------------------------------------------------- */
42
+
43
+ /**
44
+ * @since 0.3.16-canary.0
45
+ */
46
+ type CommandDialogProps = ComponentProps<typeof Dialog>;
47
+
48
+ /**
49
+ * @since 0.3.16-canary.0
50
+ */
51
+ function CommandDialog({ children, ...props }: CommandDialogProps): JSX.Element {
52
+ return (
53
+ <Dialog data-slot="command-dialog" {...props}>
54
+ <DialogContent
55
+ className={cn("rounded-t-lg", "sm:rounded-lg")}
56
+ data-slot="command-dialog-content"
57
+ >
58
+ <VisuallyHidden>
59
+ <DialogTitle>Search command</DialogTitle>
60
+ <DialogDescription>
61
+ Use the search bar to find and select the desired command.
62
+ </DialogDescription>
63
+ </VisuallyHidden>
64
+ <Command
65
+ className={cn(
66
+ "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
67
+ "[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0",
68
+ "[&_[cmdk-input]]:h-12",
69
+ )}
70
+ >
71
+ {children}
72
+ </Command>
73
+ </DialogContent>
74
+ </Dialog>
75
+ );
76
+ }
77
+
78
+ /* -----------------------------------------------------------------------------
79
+ * Component: CommandInput
80
+ * -------------------------------------------------------------------------- */
81
+
82
+ /**
83
+ * @since 0.3.16-canary.0
84
+ */
85
+ type CommandInputProps = ComponentProps<typeof CommandPrimitive.Input>;
86
+
87
+ /**
88
+ * @since 0.3.16-canary.0
89
+ */
90
+ function CommandInput({ className, ...props }: CommandInputProps): JSX.Element {
91
+ return (
92
+ <div
93
+ cmdk-input-wrapper
94
+ className={cn("flex items-center gap-2", "px-3", "border-b")}
95
+ data-slot="command-input-wrapper"
96
+ >
97
+ <SearchIcon className={cn("size-4 shrink-0", "opacity-50")} />
98
+ <CommandPrimitive.Input
99
+ className={cn(
100
+ "flex h-10 w-full",
101
+ "text-base",
102
+ "outline-hidden",
103
+ "placeholder:text-muted-foreground",
104
+ "disabled:opacity-50",
105
+ "md:text-sm",
106
+ className,
107
+ )}
108
+ data-slot="command-input"
109
+ {...props}
110
+ />
111
+ </div>
112
+ );
113
+ }
114
+
115
+ /* -----------------------------------------------------------------------------
116
+ * Component: CommandList
117
+ * -------------------------------------------------------------------------- */
118
+
119
+ /**
120
+ * @since 0.3.16-canary.0
121
+ */
122
+ type CommandListProps = ComponentProps<typeof CommandPrimitive.List>;
123
+
124
+ /**
125
+ * @since 0.3.16-canary.0
126
+ */
127
+ function CommandList({ className, ...props }: CommandListProps): JSX.Element {
128
+ return (
129
+ <CommandPrimitive.List
130
+ className={cn("max-h-75 overflow-x-hidden overflow-y-auto", className)}
131
+ data-slot="command-list"
132
+ {...props}
133
+ />
134
+ );
135
+ }
136
+
137
+ /* -----------------------------------------------------------------------------
138
+ * Component: CommandEmpty
139
+ * -------------------------------------------------------------------------- */
140
+
141
+ /**
142
+ * @since 0.3.16-canary.0
143
+ */
144
+ type CommandEmptyProps = ComponentProps<typeof CommandPrimitive.Empty>;
145
+
146
+ /**
147
+ * @since 0.3.16-canary.0
148
+ */
149
+ function CommandEmpty({ className, ...props }: CommandEmptyProps): JSX.Element {
150
+ return (
151
+ <CommandPrimitive.Empty
152
+ className={cn("py-6", "text-center text-sm", className)}
153
+ data-slot="command-empty"
154
+ {...props}
155
+ />
156
+ );
157
+ }
158
+
159
+ /* -----------------------------------------------------------------------------
160
+ * Component: CommandGroup
161
+ * -------------------------------------------------------------------------- */
162
+
163
+ /**
164
+ * @since 0.3.16-canary.0
165
+ */
166
+ type CommandGroupProps = ComponentProps<typeof CommandPrimitive.Group>;
167
+
168
+ /**
169
+ * @since 0.3.16-canary.0
170
+ */
171
+ function CommandGroup({ className, ...props }: CommandGroupProps): JSX.Element {
172
+ return (
173
+ <CommandPrimitive.Group
174
+ className={cn(
175
+ "overflow-hidden p-1 text-foreground",
176
+ "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
177
+ className,
178
+ )}
179
+ data-slot="command-group"
180
+ {...props}
181
+ />
182
+ );
183
+ }
184
+
185
+ /* -----------------------------------------------------------------------------
186
+ * Component: CommandSeparator
187
+ * -------------------------------------------------------------------------- */
188
+
189
+ /**
190
+ * @since 0.3.16-canary.0
191
+ */
192
+ type CommandSeparatorProps = ComponentProps<typeof CommandPrimitive.Separator>;
193
+
194
+ /**
195
+ * @since 0.3.16-canary.0
196
+ */
197
+ function CommandSeparator({ className, ...props }: CommandSeparatorProps): JSX.Element {
198
+ return (
199
+ <CommandPrimitive.Separator
200
+ className={cn("-mx-1 h-px", "bg-border", className)}
201
+ data-slot="command-separator"
202
+ {...props}
203
+ />
204
+ );
205
+ }
206
+
207
+ /* -----------------------------------------------------------------------------
208
+ * Component: CommandItem
209
+ * -------------------------------------------------------------------------- */
210
+
211
+ /**
212
+ * @since 0.3.16-canary.0
213
+ */
214
+ type CommandItemProps = ComponentProps<typeof CommandPrimitive.Item>;
215
+
216
+ /**
217
+ * @since 0.3.16-canary.0
218
+ */
219
+ function CommandItem({ className, ...props }: CommandItemProps): JSX.Element {
220
+ return (
221
+ <CommandPrimitive.Item
222
+ className={cn(
223
+ "group/command-item relative flex items-center gap-x-2",
224
+ "px-2 py-1.5",
225
+ "rounded-sm outline-hidden",
226
+ "text-sm",
227
+ "cursor-default select-none",
228
+ "aria-disabled:opacity-50",
229
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
230
+ "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
231
+ "[&_svg:not([class*='text-'])]:text-muted-foreground",
232
+ className,
233
+ )}
234
+ data-slot="command-item"
235
+ {...props}
236
+ />
237
+ );
238
+ }
239
+
240
+ /* -----------------------------------------------------------------------------
241
+ * Component: CommandLoading
242
+ * -------------------------------------------------------------------------- */
243
+
244
+ /**
245
+ * @since 0.3.16-canary.0
246
+ */
247
+ type CommandLoadingProps = ComponentProps<typeof CommandPrimitive.Loading>;
248
+
249
+ /**
250
+ * @since 0.3.16-canary.0
251
+ */
252
+ function CommandLoading({ className, ...props }: CommandLoadingProps): JSX.Element {
253
+ return (
254
+ <CommandPrimitive.Loading
255
+ className={cn("flex justify-center", "p-2", className)}
256
+ data-slot="command-loading"
257
+ {...props}
258
+ />
259
+ );
260
+ }
261
+
262
+ /* -----------------------------------------------------------------------------
263
+ * Component: CommandShortcut
264
+ * -------------------------------------------------------------------------- */
265
+
266
+ /**
267
+ * @since 0.3.16-canary.0
268
+ */
269
+ type CommandShortcutProps = ComponentProps<"span">;
270
+
271
+ /**
272
+ * @since 0.3.16-canary.0
273
+ */
274
+ function CommandShortcut({ className, ...props }: CommandShortcutProps): JSX.Element {
275
+ return (
276
+ <span
277
+ className={cn("ml-auto", "text-xs tracking-widest text-muted-foreground", className)}
278
+ data-slot="command-shortcut"
279
+ {...props}
280
+ />
281
+ );
282
+ }
283
+
284
+ /* -----------------------------------------------------------------------------
285
+ * Exports
286
+ * -------------------------------------------------------------------------- */
287
+
288
+ export {
289
+ Command,
290
+ CommandDialog,
291
+ CommandEmpty,
292
+ CommandGroup,
293
+ CommandInput,
294
+ CommandItem,
295
+ CommandList,
296
+ CommandLoading,
297
+ CommandSeparator,
298
+ CommandShortcut,
299
+ };
300
+ export type {
301
+ CommandDialogProps,
302
+ CommandEmptyProps,
303
+ CommandGroupProps,
304
+ CommandInputProps,
305
+ CommandItemProps,
306
+ CommandListProps,
307
+ CommandLoadingProps,
308
+ CommandProps,
309
+ CommandSeparatorProps,
310
+ CommandShortcutProps,
311
+ };