@olympusoss/canvas 2.20.1 → 3.1.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 (214) hide show
  1. package/README.md +69 -35
  2. package/package.json +45 -177
  3. package/src/cn.ts +3 -0
  4. package/src/index.ts +12 -603
  5. package/src/theme.ts +62 -0
  6. package/src/tokens.ts +11 -0
  7. package/styles/base.css +17 -0
  8. package/styles/canvas.css +77 -52
  9. package/styles/components/alert.css +66 -0
  10. package/styles/components/app-shell.css +46 -0
  11. package/styles/components/avatar.css +22 -0
  12. package/styles/components/badge.css +83 -0
  13. package/styles/components/breadcrumb.css +35 -0
  14. package/styles/components/button-group.css +23 -0
  15. package/styles/components/button.css +107 -0
  16. package/styles/components/calendar.css +73 -0
  17. package/styles/components/card.css +58 -0
  18. package/styles/components/checkbox.css +55 -0
  19. package/styles/components/code-block.css +18 -0
  20. package/styles/components/combobox.css +75 -0
  21. package/styles/components/command.css +94 -0
  22. package/styles/components/data-table.css +142 -0
  23. package/styles/components/dialog.css +72 -0
  24. package/styles/components/dropdown.css +54 -0
  25. package/styles/components/empty-state.css +17 -0
  26. package/styles/components/field.css +27 -0
  27. package/styles/components/filter-panel.css +58 -0
  28. package/styles/components/form.css +27 -0
  29. package/styles/components/icon.css +8 -0
  30. package/styles/components/input-group.css +45 -0
  31. package/styles/components/input.css +56 -0
  32. package/styles/components/kbd.css +15 -0
  33. package/styles/components/page-header.css +52 -0
  34. package/styles/components/pagination.css +48 -0
  35. package/styles/components/popover.css +14 -0
  36. package/styles/components/radio.css +28 -0
  37. package/styles/components/row-menu.css +69 -0
  38. package/styles/components/section-card.css +49 -0
  39. package/styles/components/select.css +57 -0
  40. package/styles/components/separator.css +32 -0
  41. package/styles/components/sheet.css +70 -0
  42. package/styles/components/sidebar.css +146 -0
  43. package/styles/components/skeleton.css +32 -0
  44. package/styles/components/spinner.css +26 -0
  45. package/styles/components/stat-card.css +71 -0
  46. package/styles/components/stepper.css +63 -0
  47. package/styles/components/switch.css +45 -0
  48. package/styles/components/tabs.css +40 -0
  49. package/styles/components/textarea.css +31 -0
  50. package/styles/components/toast.css +95 -0
  51. package/styles/components/tooltip.css +53 -0
  52. package/styles/components/topbar.css +24 -0
  53. package/styles/components/typography.css +105 -0
  54. package/styles/patterns/backdrops.css +35 -0
  55. package/styles/patterns/density.css +66 -0
  56. package/styles/patterns/focus.css +22 -0
  57. package/styles/patterns/glass.css +85 -0
  58. package/styles/patterns/high-contrast.css +70 -0
  59. package/styles/patterns/reduced-motion.css +12 -0
  60. package/styles/patterns/scrollbar.css +10 -0
  61. package/styles/reset.css +89 -0
  62. package/styles/tokens/colors.css +106 -0
  63. package/styles/tokens/motion.css +33 -0
  64. package/styles/tokens/radius.css +10 -0
  65. package/styles/tokens/shadows.css +35 -0
  66. package/styles/tokens/spacing.css +19 -0
  67. package/styles/tokens/typography.css +6 -0
  68. package/styles/tokens/z-index.css +12 -0
  69. package/styles/utilities/display.css +66 -0
  70. package/styles/utilities/flexbox.css +240 -0
  71. package/styles/utilities/gap.css +288 -0
  72. package/styles/utilities/grid.css +138 -0
  73. package/styles/utilities/position.css +78 -0
  74. package/styles/utilities/sizing.css +138 -0
  75. package/tsconfig.json +20 -21
  76. package/src/components/atoms/README.md +0 -11
  77. package/src/components/atoms/aspect-ratio.tsx +0 -32
  78. package/src/components/atoms/avatar.tsx +0 -98
  79. package/src/components/atoms/badge.tsx +0 -44
  80. package/src/components/atoms/brand-mark.tsx +0 -74
  81. package/src/components/atoms/button.tsx +0 -105
  82. package/src/components/atoms/checkbox.tsx +0 -63
  83. package/src/components/atoms/flex-box.tsx +0 -105
  84. package/src/components/atoms/icon.tsx +0 -34
  85. package/src/components/atoms/input.tsx +0 -92
  86. package/src/components/atoms/label.tsx +0 -41
  87. package/src/components/atoms/logo.tsx +0 -89
  88. package/src/components/atoms/progress.tsx +0 -55
  89. package/src/components/atoms/radio-group.tsx +0 -122
  90. package/src/components/atoms/scroll-area.tsx +0 -106
  91. package/src/components/atoms/section.tsx +0 -48
  92. package/src/components/atoms/separator.tsx +0 -45
  93. package/src/components/atoms/skeleton.tsx +0 -17
  94. package/src/components/atoms/slider.tsx +0 -93
  95. package/src/components/atoms/spinner.tsx +0 -47
  96. package/src/components/atoms/switch.tsx +0 -60
  97. package/src/components/atoms/textarea.tsx +0 -78
  98. package/src/components/atoms/toggle.tsx +0 -80
  99. package/src/components/charts/activity-heatmap.tsx +0 -186
  100. package/src/components/charts/axes.tsx +0 -21
  101. package/src/components/charts/chart-container.tsx +0 -254
  102. package/src/components/charts/chart-legend.tsx +0 -67
  103. package/src/components/charts/chart-tooltip.tsx +0 -161
  104. package/src/components/charts/chart-types.tsx +0 -49
  105. package/src/components/charts/containers.tsx +0 -11
  106. package/src/components/charts/data.tsx +0 -16
  107. package/src/components/charts/details.tsx +0 -25
  108. package/src/components/charts/dot-pulse.tsx +0 -61
  109. package/src/components/charts/gauge.tsx +0 -106
  110. package/src/components/charts/grids.tsx +0 -8
  111. package/src/components/charts/index.ts +0 -62
  112. package/src/components/charts/labeled-bar-list.tsx +0 -85
  113. package/src/components/charts/metric-breakdown.tsx +0 -316
  114. package/src/components/charts/references.tsx +0 -8
  115. package/src/components/charts/service-health-list.tsx +0 -85
  116. package/src/components/charts/sparkline-area.tsx +0 -80
  117. package/src/components/charts/sparkline.tsx +0 -52
  118. package/src/components/charts/stacked-bar.tsx +0 -104
  119. package/src/components/charts/text.tsx +0 -10
  120. package/src/components/charts/world-heat-map-inner.tsx +0 -317
  121. package/src/components/charts/world-heat-map.tsx +0 -184
  122. package/src/components/molecules/README.md +0 -12
  123. package/src/components/molecules/action-bar.tsx +0 -73
  124. package/src/components/molecules/activity-item.tsx +0 -74
  125. package/src/components/molecules/alert.tsx +0 -86
  126. package/src/components/molecules/animated-background.tsx +0 -92
  127. package/src/components/molecules/auth-shell.tsx +0 -95
  128. package/src/components/molecules/brand-lockup.tsx +0 -48
  129. package/src/components/molecules/breadcrumb.tsx +0 -157
  130. package/src/components/molecules/button-group.tsx +0 -104
  131. package/src/components/molecules/calendar.tsx +0 -217
  132. package/src/components/molecules/card.tsx +0 -102
  133. package/src/components/molecules/client-brand.tsx +0 -95
  134. package/src/components/molecules/code-block.tsx +0 -86
  135. package/src/components/molecules/countdown-button.tsx +0 -92
  136. package/src/components/molecules/empty-state.tsx +0 -56
  137. package/src/components/molecules/error-state.tsx +0 -42
  138. package/src/components/molecules/field-display.tsx +0 -35
  139. package/src/components/molecules/input-otp.tsx +0 -74
  140. package/src/components/molecules/launcher-card.tsx +0 -152
  141. package/src/components/molecules/loading-state.tsx +0 -36
  142. package/src/components/molecules/notification-item.tsx +0 -67
  143. package/src/components/molecules/notification-list.tsx +0 -45
  144. package/src/components/molecules/number-badge.tsx +0 -53
  145. package/src/components/molecules/or-separator.tsx +0 -38
  146. package/src/components/molecules/page-header.tsx +0 -88
  147. package/src/components/molecules/page-tabs.tsx +0 -94
  148. package/src/components/molecules/pagination.tsx +0 -150
  149. package/src/components/molecules/password-input.tsx +0 -83
  150. package/src/components/molecules/password-strength-meter.tsx +0 -104
  151. package/src/components/molecules/phone-input.tsx +0 -200
  152. package/src/components/molecules/search-bar.tsx +0 -64
  153. package/src/components/molecules/secret-field.tsx +0 -158
  154. package/src/components/molecules/section-card.tsx +0 -91
  155. package/src/components/molecules/social-buttons.tsx +0 -165
  156. package/src/components/molecules/stat-card.tsx +0 -100
  157. package/src/components/molecules/status-badge.tsx +0 -42
  158. package/src/components/molecules/stepper.tsx +0 -96
  159. package/src/components/molecules/table.tsx +0 -157
  160. package/src/components/molecules/terminal.tsx +0 -74
  161. package/src/components/molecules/toggle-group.tsx +0 -145
  162. package/src/components/molecules/tooltip.tsx +0 -155
  163. package/src/components/molecules/user-avatar-chip.tsx +0 -71
  164. package/src/components/organisms/README.md +0 -14
  165. package/src/components/organisms/accordion.tsx +0 -154
  166. package/src/components/organisms/alert-dialog.tsx +0 -277
  167. package/src/components/organisms/carousel.tsx +0 -244
  168. package/src/components/organisms/collapsible.tsx +0 -69
  169. package/src/components/organisms/command.tsx +0 -144
  170. package/src/components/organisms/context-menu.tsx +0 -339
  171. package/src/components/organisms/dashboard-grid.tsx +0 -369
  172. package/src/components/organisms/data-table.tsx +0 -330
  173. package/src/components/organisms/dialog.tsx +0 -312
  174. package/src/components/organisms/drawer.tsx +0 -123
  175. package/src/components/organisms/dropdown-menu.tsx +0 -440
  176. package/src/components/organisms/editors/code-editor.tsx +0 -144
  177. package/src/components/organisms/editors/index.ts +0 -4
  178. package/src/components/organisms/editors/markdown-editor.tsx +0 -153
  179. package/src/components/organisms/editors/markdown-renderer.ts +0 -27
  180. package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
  181. package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
  182. package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
  183. package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
  184. package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
  185. package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
  186. package/src/components/organisms/error-boundary.tsx +0 -61
  187. package/src/components/organisms/form.tsx +0 -174
  188. package/src/components/organisms/hover-card.tsx +0 -115
  189. package/src/components/organisms/menubar.tsx +0 -498
  190. package/src/components/organisms/navbar.tsx +0 -104
  191. package/src/components/organisms/navigation-menu.tsx +0 -235
  192. package/src/components/organisms/popover.tsx +0 -149
  193. package/src/components/organisms/resizable.tsx +0 -58
  194. package/src/components/organisms/schema-form.tsx +0 -232
  195. package/src/components/organisms/select.tsx +0 -309
  196. package/src/components/organisms/sheet.tsx +0 -265
  197. package/src/components/organisms/sidebar.tsx +0 -1040
  198. package/src/components/organisms/sonner.tsx +0 -96
  199. package/src/components/organisms/tabs.tsx +0 -133
  200. package/src/components/organisms/theme-provider.tsx +0 -101
  201. package/src/hooks/use-mobile.tsx +0 -19
  202. package/src/lib/portal-container.tsx +0 -35
  203. package/src/lib/utils.ts +0 -6
  204. package/src/native.ts +0 -23
  205. package/src/tokens/colors.ts +0 -91
  206. package/src/tokens/index.ts +0 -3
  207. package/src/tokens/spacing.ts +0 -55
  208. package/src/tokens/typography.ts +0 -27
  209. package/styles/dashboard-grid.css +0 -47
  210. package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
  211. package/styles/glass.css +0 -171
  212. package/styles/leaflet.css +0 -13
  213. package/styles/tokens.css +0 -317
  214. package/tailwind.config.ts +0 -70
@@ -1,244 +0,0 @@
1
- "use client";
2
-
3
- import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
4
- import { ArrowLeft, ArrowRight } from "lucide-react";
5
- import * as React from "react";
6
-
7
- import { cn } from "../../lib/utils";
8
- import { Button } from "../atoms/button";
9
-
10
- type CarouselApi = UseEmblaCarouselType[1];
11
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
12
- type CarouselOptions = UseCarouselParameters[0];
13
- type CarouselPlugin = UseCarouselParameters[1];
14
-
15
- type CarouselProps = {
16
- opts?: CarouselOptions;
17
- plugins?: CarouselPlugin;
18
- orientation?: "horizontal" | "vertical";
19
- setApi?: (api: CarouselApi) => void;
20
- };
21
-
22
- type CarouselContextProps = {
23
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
24
- api: ReturnType<typeof useEmblaCarousel>[1];
25
- scrollPrev: () => void;
26
- scrollNext: () => void;
27
- canScrollPrev: boolean;
28
- canScrollNext: boolean;
29
- } & CarouselProps;
30
-
31
- const CarouselContext = React.createContext<CarouselContextProps | null>(null);
32
-
33
- function useCarousel() {
34
- const context = React.useContext(CarouselContext);
35
-
36
- if (!context) {
37
- throw new Error("useCarousel must be used within a <Carousel />");
38
- }
39
-
40
- return context;
41
- }
42
-
43
- const Carousel = React.forwardRef<
44
- HTMLDivElement,
45
- React.HTMLAttributes<HTMLDivElement> & CarouselProps
46
- >(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
47
- const [carouselRef, api] = useEmblaCarousel(
48
- {
49
- ...opts,
50
- axis: orientation === "horizontal" ? "x" : "y",
51
- },
52
- plugins,
53
- );
54
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
55
- const [canScrollNext, setCanScrollNext] = React.useState(false);
56
-
57
- const onSelect = React.useCallback((api: CarouselApi) => {
58
- /* c8 ignore next 3 -- defensive guard: Embla always provides api in the onSelect handler */
59
- if (!api) {
60
- return;
61
- }
62
-
63
- setCanScrollPrev(api.canScrollPrev());
64
- setCanScrollNext(api.canScrollNext());
65
- }, []);
66
-
67
- const scrollPrev = React.useCallback(() => {
68
- api?.scrollPrev();
69
- }, [api]);
70
-
71
- const scrollNext = React.useCallback(() => {
72
- api?.scrollNext();
73
- }, [api]);
74
-
75
- const handleKeyDown = React.useCallback(
76
- (event: React.KeyboardEvent<HTMLDivElement>) => {
77
- if (event.key === "ArrowLeft") {
78
- event.preventDefault();
79
- scrollPrev();
80
- } else if (event.key === "ArrowRight") {
81
- event.preventDefault();
82
- scrollNext();
83
- }
84
- },
85
- [scrollPrev, scrollNext],
86
- );
87
-
88
- React.useEffect(() => {
89
- if (!api || !setApi) {
90
- return;
91
- }
92
-
93
- setApi(api);
94
- }, [api, setApi]);
95
-
96
- React.useEffect(() => {
97
- if (!api) {
98
- return;
99
- }
100
-
101
- onSelect(api);
102
- api.on("reInit", onSelect);
103
- api.on("select", onSelect);
104
-
105
- return () => {
106
- api?.off("select", onSelect);
107
- };
108
- }, [api, onSelect]);
109
-
110
- return (
111
- <CarouselContext.Provider
112
- value={{
113
- carouselRef,
114
- api: api,
115
- opts,
116
- // `orientation` is always defined (default: "horizontal"). No fallback needed.
117
- orientation,
118
- scrollPrev,
119
- scrollNext,
120
- canScrollPrev,
121
- canScrollNext,
122
- }}
123
- >
124
- <div
125
- ref={ref}
126
- onKeyDownCapture={handleKeyDown}
127
- className={cn("relative", className)}
128
- role="region"
129
- aria-roledescription="carousel"
130
- {...props}
131
- >
132
- {children}
133
- </div>
134
- </CarouselContext.Provider>
135
- );
136
- });
137
- Carousel.displayName = "Carousel";
138
-
139
- const CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
140
- ({ className, ...props }, ref) => {
141
- const { carouselRef, orientation } = useCarousel();
142
-
143
- return (
144
- <div ref={carouselRef} className="overflow-hidden">
145
- <div
146
- ref={ref}
147
- className={cn(
148
- "flex",
149
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
150
- className,
151
- )}
152
- {...props}
153
- />
154
- </div>
155
- );
156
- },
157
- );
158
- CarouselContent.displayName = "CarouselContent";
159
-
160
- const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
161
- ({ className, ...props }, ref) => {
162
- const { orientation } = useCarousel();
163
-
164
- return (
165
- <div
166
- ref={ref}
167
- role="group"
168
- aria-roledescription="slide"
169
- className={cn(
170
- "min-w-0 shrink-0 grow-0 basis-full",
171
- orientation === "horizontal" ? "pl-4" : "pt-4",
172
- className,
173
- )}
174
- {...props}
175
- />
176
- );
177
- },
178
- );
179
- CarouselItem.displayName = "CarouselItem";
180
-
181
- const CarouselPrevious = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
182
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
183
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
184
-
185
- return (
186
- <Button
187
- ref={ref}
188
- variant={variant}
189
- size={size}
190
- className={cn(
191
- "absolute h-8 w-8 rounded-full",
192
- orientation === "horizontal"
193
- ? "-left-12 top-1/2 -translate-y-1/2"
194
- : "-top-10 left-1/2 -translate-x-1/2 rotate-90",
195
- className,
196
- )}
197
- disabled={!canScrollPrev}
198
- onClick={scrollPrev}
199
- {...props}
200
- >
201
- <ArrowLeft className="h-4 w-4" />
202
- <span className="sr-only">Previous slide</span>
203
- </Button>
204
- );
205
- },
206
- );
207
- CarouselPrevious.displayName = "CarouselPrevious";
208
-
209
- const CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
210
- ({ className, variant = "outline", size = "icon", ...props }, ref) => {
211
- const { orientation, scrollNext, canScrollNext } = useCarousel();
212
-
213
- return (
214
- <Button
215
- ref={ref}
216
- variant={variant}
217
- size={size}
218
- className={cn(
219
- "absolute h-8 w-8 rounded-full",
220
- orientation === "horizontal"
221
- ? "-right-12 top-1/2 -translate-y-1/2"
222
- : "-bottom-10 left-1/2 -translate-x-1/2 rotate-90",
223
- className,
224
- )}
225
- disabled={!canScrollNext}
226
- onClick={scrollNext}
227
- {...props}
228
- >
229
- <ArrowRight className="h-4 w-4" />
230
- <span className="sr-only">Next slide</span>
231
- </Button>
232
- );
233
- },
234
- );
235
- CarouselNext.displayName = "CarouselNext";
236
-
237
- export {
238
- Carousel,
239
- type CarouselApi,
240
- CarouselContent,
241
- CarouselItem,
242
- CarouselNext,
243
- CarouselPrevious,
244
- };
@@ -1,69 +0,0 @@
1
- "use client";
2
-
3
- import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
4
- import type * as React from "react";
5
-
6
- export interface CollapsibleProps extends React.ComponentProps<typeof CollapsiblePrimitive.Root> {
7
- /** Controlled open state. Pair with `onOpenChange`. */
8
- open?: boolean;
9
- /**
10
- * Initial open state for uncontrolled usage.
11
- * @default false
12
- */
13
- defaultOpen?: boolean;
14
- /** Fires whenever the collapsible opens or closes. */
15
- onOpenChange?: (open: boolean) => void;
16
- /**
17
- * Disable the trigger.
18
- * @default false
19
- */
20
- disabled?: boolean;
21
- /** Trigger + Content. */
22
- children?: React.ReactNode;
23
- className?: string;
24
- }
25
-
26
- const Collapsible = CollapsiblePrimitive.Root as React.FC<CollapsibleProps>;
27
-
28
- export interface CollapsibleTriggerProps
29
- extends React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleTrigger> {
30
- /**
31
- * Render as a Radix Slot — wrap a custom button while keeping the
32
- * collapsible's toggle behaviour.
33
- * @default false
34
- */
35
- asChild?: boolean;
36
- /** The button (or slot) that opens/closes the content. */
37
- children?: React.ReactNode;
38
- className?: string;
39
- }
40
-
41
- const CollapsibleTrigger =
42
- CollapsiblePrimitive.CollapsibleTrigger as React.ForwardRefExoticComponent<
43
- CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>
44
- >;
45
-
46
- export interface CollapsibleContentProps
47
- extends React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent> {
48
- /**
49
- * Force the content to mount even when collapsed. Useful for measuring
50
- * height for animations.
51
- * @default false
52
- */
53
- forceMount?: true;
54
- /**
55
- * Render as a Radix Slot.
56
- * @default false
57
- */
58
- asChild?: boolean;
59
- /** Content shown when expanded. */
60
- children?: React.ReactNode;
61
- className?: string;
62
- }
63
-
64
- const CollapsibleContent =
65
- CollapsiblePrimitive.CollapsibleContent as React.ForwardRefExoticComponent<
66
- CollapsibleContentProps & React.RefAttributes<HTMLDivElement>
67
- >;
68
-
69
- export { Collapsible, CollapsibleContent, CollapsibleTrigger };
@@ -1,144 +0,0 @@
1
- "use client";
2
-
3
- import type { DialogProps } from "@radix-ui/react-dialog";
4
- import { Command as CommandPrimitive } from "cmdk";
5
- import { Search } from "lucide-react";
6
- import * as React from "react";
7
-
8
- import { cn } from "../../lib/utils";
9
- import { Dialog, DialogContent } from "./dialog";
10
-
11
- const Command = React.forwardRef<
12
- React.ElementRef<typeof CommandPrimitive>,
13
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
- >(({ className, ...props }, ref) => (
15
- <CommandPrimitive
16
- ref={ref}
17
- data-slot="command"
18
- className={cn(
19
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
20
- className,
21
- )}
22
- {...props}
23
- />
24
- ));
25
- Command.displayName = CommandPrimitive.displayName;
26
-
27
- const CommandDialog = ({ children, ...props }: DialogProps) => {
28
- return (
29
- <Dialog {...props}>
30
- <DialogContent className="overflow-hidden p-0">
31
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
32
- {children}
33
- </Command>
34
- </DialogContent>
35
- </Dialog>
36
- );
37
- };
38
-
39
- const CommandInput = React.forwardRef<
40
- React.ElementRef<typeof CommandPrimitive.Input>,
41
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
42
- >(({ className, ...props }, ref) => (
43
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
44
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
45
- <CommandPrimitive.Input
46
- ref={ref}
47
- className={cn(
48
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
49
- className,
50
- )}
51
- {...props}
52
- />
53
- </div>
54
- ));
55
-
56
- CommandInput.displayName = CommandPrimitive.Input.displayName;
57
-
58
- const CommandList = React.forwardRef<
59
- React.ElementRef<typeof CommandPrimitive.List>,
60
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
61
- >(({ className, ...props }, ref) => (
62
- <CommandPrimitive.List
63
- ref={ref}
64
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
65
- {...props}
66
- />
67
- ));
68
-
69
- CommandList.displayName = CommandPrimitive.List.displayName;
70
-
71
- const CommandEmpty = React.forwardRef<
72
- React.ElementRef<typeof CommandPrimitive.Empty>,
73
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
74
- >((props, ref) => (
75
- <CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
76
- ));
77
-
78
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
79
-
80
- const CommandGroup = React.forwardRef<
81
- React.ElementRef<typeof CommandPrimitive.Group>,
82
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
83
- >(({ className, ...props }, ref) => (
84
- <CommandPrimitive.Group
85
- ref={ref}
86
- className={cn(
87
- "overflow-hidden p-1 text-foreground [&_[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",
88
- className,
89
- )}
90
- {...props}
91
- />
92
- ));
93
-
94
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
95
-
96
- const CommandSeparator = React.forwardRef<
97
- React.ElementRef<typeof CommandPrimitive.Separator>,
98
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
99
- >(({ className, ...props }, ref) => (
100
- <CommandPrimitive.Separator
101
- ref={ref}
102
- className={cn("-mx-1 h-px bg-border", className)}
103
- {...props}
104
- />
105
- ));
106
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
107
-
108
- const CommandItem = React.forwardRef<
109
- React.ElementRef<typeof CommandPrimitive.Item>,
110
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
111
- >(({ className, ...props }, ref) => (
112
- <CommandPrimitive.Item
113
- ref={ref}
114
- className={cn(
115
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
116
- className,
117
- )}
118
- {...props}
119
- />
120
- ));
121
-
122
- CommandItem.displayName = CommandPrimitive.Item.displayName;
123
-
124
- const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
125
- return (
126
- <span
127
- className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
128
- {...props}
129
- />
130
- );
131
- };
132
- CommandShortcut.displayName = "CommandShortcut";
133
-
134
- export {
135
- Command,
136
- CommandDialog,
137
- CommandEmpty,
138
- CommandGroup,
139
- CommandInput,
140
- CommandItem,
141
- CommandList,
142
- CommandSeparator,
143
- CommandShortcut,
144
- };