@olympusoss/canvas 2.20.2 → 4.0.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 (208) hide show
  1. package/package.json +41 -177
  2. package/src/cn.ts +3 -0
  3. package/src/index.ts +12 -603
  4. package/src/theme.ts +41 -0
  5. package/src/tokens.ts +11 -0
  6. package/styles/base.css +17 -0
  7. package/styles/canvas.css +69 -52
  8. package/styles/components/alert.css +66 -0
  9. package/styles/components/app-shell.css +46 -0
  10. package/styles/components/avatar.css +15 -0
  11. package/styles/components/badge.css +83 -0
  12. package/styles/components/breadcrumb.css +35 -0
  13. package/styles/components/button-group.css +23 -0
  14. package/styles/components/button.css +107 -0
  15. package/styles/components/calendar.css +73 -0
  16. package/styles/components/card.css +58 -0
  17. package/styles/components/checkbox.css +55 -0
  18. package/styles/components/code-block.css +18 -0
  19. package/styles/components/combobox.css +75 -0
  20. package/styles/components/command.css +94 -0
  21. package/styles/components/data-table.css +142 -0
  22. package/styles/components/dialog.css +72 -0
  23. package/styles/components/dropdown.css +54 -0
  24. package/styles/components/empty-state.css +17 -0
  25. package/styles/components/field.css +27 -0
  26. package/styles/components/filter-panel.css +58 -0
  27. package/styles/components/form.css +27 -0
  28. package/styles/components/icon.css +8 -0
  29. package/styles/components/input-group.css +45 -0
  30. package/styles/components/input.css +56 -0
  31. package/styles/components/kbd.css +15 -0
  32. package/styles/components/page-header.css +52 -0
  33. package/styles/components/pagination.css +48 -0
  34. package/styles/components/popover.css +14 -0
  35. package/styles/components/radio.css +28 -0
  36. package/styles/components/row-menu.css +69 -0
  37. package/styles/components/section-card.css +49 -0
  38. package/styles/components/select.css +57 -0
  39. package/styles/components/separator.css +32 -0
  40. package/styles/components/sheet.css +70 -0
  41. package/styles/components/sidebar.css +146 -0
  42. package/styles/components/skeleton.css +32 -0
  43. package/styles/components/spinner.css +26 -0
  44. package/styles/components/stat-card.css +71 -0
  45. package/styles/components/stepper.css +63 -0
  46. package/styles/components/switch.css +45 -0
  47. package/styles/components/tabs.css +40 -0
  48. package/styles/components/textarea.css +31 -0
  49. package/styles/components/toast.css +95 -0
  50. package/styles/components/tooltip.css +53 -0
  51. package/styles/components/topbar.css +24 -0
  52. package/styles/components/typography.css +105 -0
  53. package/styles/patterns/backdrops.css +35 -0
  54. package/styles/patterns/density.css +66 -0
  55. package/styles/patterns/focus.css +38 -0
  56. package/styles/patterns/glass.css +85 -0
  57. package/styles/patterns/high-contrast.css +70 -0
  58. package/styles/patterns/reduced-motion.css +12 -0
  59. package/styles/patterns/scrollbar.css +10 -0
  60. package/styles/reset.css +89 -0
  61. package/styles/tokens/colors.css +106 -0
  62. package/styles/tokens/motion.css +33 -0
  63. package/styles/tokens/radius.css +10 -0
  64. package/styles/tokens/shadows.css +35 -0
  65. package/styles/tokens/spacing.css +19 -0
  66. package/styles/tokens/typography.css +6 -0
  67. package/styles/tokens/z-index.css +12 -0
  68. package/tsconfig.json +20 -21
  69. package/README.md +0 -60
  70. package/src/components/atoms/README.md +0 -11
  71. package/src/components/atoms/aspect-ratio.tsx +0 -32
  72. package/src/components/atoms/avatar.tsx +0 -98
  73. package/src/components/atoms/badge.tsx +0 -44
  74. package/src/components/atoms/brand-mark.tsx +0 -74
  75. package/src/components/atoms/button.tsx +0 -105
  76. package/src/components/atoms/checkbox.tsx +0 -63
  77. package/src/components/atoms/flex-box.tsx +0 -105
  78. package/src/components/atoms/icon.tsx +0 -34
  79. package/src/components/atoms/input.tsx +0 -92
  80. package/src/components/atoms/label.tsx +0 -41
  81. package/src/components/atoms/logo.tsx +0 -89
  82. package/src/components/atoms/progress.tsx +0 -55
  83. package/src/components/atoms/radio-group.tsx +0 -122
  84. package/src/components/atoms/scroll-area.tsx +0 -106
  85. package/src/components/atoms/section.tsx +0 -48
  86. package/src/components/atoms/separator.tsx +0 -45
  87. package/src/components/atoms/skeleton.tsx +0 -17
  88. package/src/components/atoms/slider.tsx +0 -93
  89. package/src/components/atoms/spinner.tsx +0 -47
  90. package/src/components/atoms/switch.tsx +0 -60
  91. package/src/components/atoms/textarea.tsx +0 -78
  92. package/src/components/atoms/toggle.tsx +0 -80
  93. package/src/components/charts/activity-heatmap.tsx +0 -186
  94. package/src/components/charts/axes.tsx +0 -21
  95. package/src/components/charts/chart-container.tsx +0 -254
  96. package/src/components/charts/chart-legend.tsx +0 -67
  97. package/src/components/charts/chart-tooltip.tsx +0 -161
  98. package/src/components/charts/chart-types.tsx +0 -49
  99. package/src/components/charts/containers.tsx +0 -11
  100. package/src/components/charts/data.tsx +0 -16
  101. package/src/components/charts/details.tsx +0 -25
  102. package/src/components/charts/dot-pulse.tsx +0 -61
  103. package/src/components/charts/gauge.tsx +0 -106
  104. package/src/components/charts/grids.tsx +0 -8
  105. package/src/components/charts/index.ts +0 -62
  106. package/src/components/charts/labeled-bar-list.tsx +0 -85
  107. package/src/components/charts/metric-breakdown.tsx +0 -316
  108. package/src/components/charts/references.tsx +0 -8
  109. package/src/components/charts/service-health-list.tsx +0 -85
  110. package/src/components/charts/sparkline-area.tsx +0 -80
  111. package/src/components/charts/sparkline.tsx +0 -52
  112. package/src/components/charts/stacked-bar.tsx +0 -104
  113. package/src/components/charts/text.tsx +0 -10
  114. package/src/components/charts/world-heat-map-inner.tsx +0 -317
  115. package/src/components/charts/world-heat-map.tsx +0 -184
  116. package/src/components/molecules/README.md +0 -12
  117. package/src/components/molecules/action-bar.tsx +0 -73
  118. package/src/components/molecules/activity-item.tsx +0 -74
  119. package/src/components/molecules/alert.tsx +0 -86
  120. package/src/components/molecules/animated-background.tsx +0 -92
  121. package/src/components/molecules/auth-shell.tsx +0 -95
  122. package/src/components/molecules/brand-lockup.tsx +0 -48
  123. package/src/components/molecules/breadcrumb.tsx +0 -157
  124. package/src/components/molecules/button-group.tsx +0 -104
  125. package/src/components/molecules/calendar.tsx +0 -217
  126. package/src/components/molecules/card.tsx +0 -102
  127. package/src/components/molecules/client-brand.tsx +0 -95
  128. package/src/components/molecules/code-block.tsx +0 -86
  129. package/src/components/molecules/countdown-button.tsx +0 -92
  130. package/src/components/molecules/empty-state.tsx +0 -56
  131. package/src/components/molecules/error-state.tsx +0 -42
  132. package/src/components/molecules/field-display.tsx +0 -35
  133. package/src/components/molecules/input-otp.tsx +0 -74
  134. package/src/components/molecules/launcher-card.tsx +0 -152
  135. package/src/components/molecules/loading-state.tsx +0 -36
  136. package/src/components/molecules/notification-item.tsx +0 -67
  137. package/src/components/molecules/notification-list.tsx +0 -45
  138. package/src/components/molecules/number-badge.tsx +0 -53
  139. package/src/components/molecules/or-separator.tsx +0 -38
  140. package/src/components/molecules/page-header.tsx +0 -88
  141. package/src/components/molecules/page-tabs.tsx +0 -94
  142. package/src/components/molecules/pagination.tsx +0 -150
  143. package/src/components/molecules/password-input.tsx +0 -83
  144. package/src/components/molecules/password-strength-meter.tsx +0 -104
  145. package/src/components/molecules/phone-input.tsx +0 -200
  146. package/src/components/molecules/search-bar.tsx +0 -64
  147. package/src/components/molecules/secret-field.tsx +0 -158
  148. package/src/components/molecules/section-card.tsx +0 -91
  149. package/src/components/molecules/social-buttons.tsx +0 -165
  150. package/src/components/molecules/stat-card.tsx +0 -100
  151. package/src/components/molecules/status-badge.tsx +0 -42
  152. package/src/components/molecules/stepper.tsx +0 -96
  153. package/src/components/molecules/table.tsx +0 -157
  154. package/src/components/molecules/terminal.tsx +0 -74
  155. package/src/components/molecules/toggle-group.tsx +0 -145
  156. package/src/components/molecules/tooltip.tsx +0 -155
  157. package/src/components/molecules/user-avatar-chip.tsx +0 -71
  158. package/src/components/organisms/README.md +0 -14
  159. package/src/components/organisms/accordion.tsx +0 -154
  160. package/src/components/organisms/alert-dialog.tsx +0 -277
  161. package/src/components/organisms/carousel.tsx +0 -244
  162. package/src/components/organisms/collapsible.tsx +0 -69
  163. package/src/components/organisms/command.tsx +0 -144
  164. package/src/components/organisms/context-menu.tsx +0 -339
  165. package/src/components/organisms/dashboard-grid.tsx +0 -369
  166. package/src/components/organisms/data-table.tsx +0 -330
  167. package/src/components/organisms/dialog.tsx +0 -312
  168. package/src/components/organisms/drawer.tsx +0 -123
  169. package/src/components/organisms/dropdown-menu.tsx +0 -440
  170. package/src/components/organisms/editors/code-editor.tsx +0 -144
  171. package/src/components/organisms/editors/index.ts +0 -4
  172. package/src/components/organisms/editors/markdown-editor.tsx +0 -153
  173. package/src/components/organisms/editors/markdown-renderer.ts +0 -27
  174. package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
  175. package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
  176. package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
  177. package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
  178. package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
  179. package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
  180. package/src/components/organisms/error-boundary.tsx +0 -61
  181. package/src/components/organisms/form.tsx +0 -174
  182. package/src/components/organisms/hover-card.tsx +0 -115
  183. package/src/components/organisms/menubar.tsx +0 -498
  184. package/src/components/organisms/navbar.tsx +0 -104
  185. package/src/components/organisms/navigation-menu.tsx +0 -235
  186. package/src/components/organisms/popover.tsx +0 -149
  187. package/src/components/organisms/resizable.tsx +0 -58
  188. package/src/components/organisms/schema-form.tsx +0 -232
  189. package/src/components/organisms/select.tsx +0 -309
  190. package/src/components/organisms/sheet.tsx +0 -265
  191. package/src/components/organisms/sidebar.tsx +0 -1040
  192. package/src/components/organisms/sonner.tsx +0 -96
  193. package/src/components/organisms/tabs.tsx +0 -133
  194. package/src/components/organisms/theme-provider.tsx +0 -101
  195. package/src/hooks/use-mobile.tsx +0 -19
  196. package/src/lib/portal-container.tsx +0 -35
  197. package/src/lib/utils.ts +0 -6
  198. package/src/native.ts +0 -23
  199. package/src/tokens/colors.ts +0 -91
  200. package/src/tokens/index.ts +0 -3
  201. package/src/tokens/spacing.ts +0 -55
  202. package/src/tokens/typography.ts +0 -27
  203. package/styles/dashboard-grid.css +0 -47
  204. package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
  205. package/styles/glass.css +0 -175
  206. package/styles/leaflet.css +0 -13
  207. package/styles/tokens.css +0 -317
  208. package/tailwind.config.ts +0 -70
@@ -1,312 +0,0 @@
1
- "use client";
2
-
3
- import * as DialogPrimitive from "@radix-ui/react-dialog";
4
- import { X } from "lucide-react";
5
- import * as React from "react";
6
-
7
- import { usePortalContainer } from "../../lib/portal-container";
8
- import { cn } from "../../lib/utils";
9
-
10
- /* ────────────────────────────────────────────────────────────────
11
- * Public prop interfaces — every prop documented for the docs site
12
- * and TS hover-info. Mirrors the full Radix Dialog API surface.
13
- * ──────────────────────────────────────────────────────────────── */
14
-
15
- export interface DialogProps extends React.ComponentProps<typeof DialogPrimitive.Root> {
16
- /**
17
- * Controlled open state. Pair with `onOpenChange`. Omit for uncontrolled
18
- * usage and pass `defaultOpen` instead.
19
- */
20
- open?: boolean;
21
- /**
22
- * Initial open state for uncontrolled usage. Ignored if `open` is also
23
- * passed.
24
- * @default false
25
- */
26
- defaultOpen?: boolean;
27
- /**
28
- * Fires whenever the user opens or closes the dialog (escape key, scrim
29
- * click, X button, programmatic close).
30
- */
31
- onOpenChange?: (open: boolean) => void;
32
- /**
33
- * When true, blocks focus from leaving the dialog (focus trap) and
34
- * renders the scrim overlay over the rest of the page.
35
- * @default true
36
- */
37
- modal?: boolean;
38
- /** Trigger + Content + any other Radix sub-pieces. */
39
- children?: React.ReactNode;
40
- }
41
-
42
- const Dialog = DialogPrimitive.Root as React.FC<DialogProps>;
43
-
44
- export interface DialogTriggerProps
45
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger> {
46
- /**
47
- * Render as a Radix Slot — forwards props onto the immediate child
48
- * element instead of rendering a wrapper `<button>`.
49
- * @default false
50
- */
51
- asChild?: boolean;
52
- /** The button (or slot) that opens the dialog. */
53
- children?: React.ReactNode;
54
- /** Tailwind / CSS classes merged onto the trigger via `cn()`. */
55
- className?: string;
56
- }
57
-
58
- const DialogTrigger = DialogPrimitive.Trigger as React.ForwardRefExoticComponent<
59
- DialogTriggerProps & React.RefAttributes<HTMLButtonElement>
60
- >;
61
-
62
- export interface DialogPortalProps
63
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal> {
64
- /**
65
- * The DOM element to portal the dialog content into. Defaults to
66
- * `document.body`. Useful when canvas is embedded inside an iframe and
67
- * the dialog should mount in the iframe's document instead of the parent.
68
- */
69
- container?: HTMLElement | null;
70
- /**
71
- * Force the portal to mount its children even when the dialog is
72
- * closed. Useful when animation libraries need the DOM nodes to persist
73
- * between open/close.
74
- * @default false
75
- */
76
- forceMount?: true;
77
- /** Overlay + Content + Close. */
78
- children?: React.ReactNode;
79
- }
80
-
81
- const DialogPortal = DialogPrimitive.Portal as React.FC<DialogPortalProps>;
82
-
83
- export interface DialogCloseProps
84
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close> {
85
- /**
86
- * Render as a Radix Slot — forwards props onto the immediate child
87
- * element instead of rendering a wrapper `<button>`.
88
- * @default false
89
- */
90
- asChild?: boolean;
91
- /** The button (or slot) that closes the dialog. */
92
- children?: React.ReactNode;
93
- /** Tailwind / CSS classes merged onto the close button via `cn()`. */
94
- className?: string;
95
- }
96
-
97
- const DialogClose = DialogPrimitive.Close as React.ForwardRefExoticComponent<
98
- DialogCloseProps & React.RefAttributes<HTMLButtonElement>
99
- >;
100
-
101
- export interface DialogOverlayProps
102
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {
103
- /**
104
- * Render as a Radix Slot — forwards props onto the immediate child
105
- * element instead of rendering a wrapper `<div>`.
106
- * @default false
107
- */
108
- asChild?: boolean;
109
- /**
110
- * Force the overlay to mount even when the dialog is closed. Pair with
111
- * a CSS animation that fades in/out based on `data-state`.
112
- * @default false
113
- */
114
- forceMount?: true;
115
- /** Tailwind / CSS classes merged onto the overlay via `cn()`. Defaults to a black/80% scrim. */
116
- className?: string;
117
- }
118
-
119
- const DialogOverlay = React.forwardRef<
120
- React.ElementRef<typeof DialogPrimitive.Overlay>,
121
- DialogOverlayProps
122
- >(({ className, ...props }, ref) => (
123
- <DialogPrimitive.Overlay
124
- ref={ref}
125
- className={cn(
126
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
127
- className,
128
- )}
129
- {...props}
130
- />
131
- ));
132
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
133
-
134
- export interface DialogContentProps
135
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
136
- /**
137
- * Render as a Radix Slot — forwards props onto the immediate child
138
- * element instead of rendering a wrapper `<div>`.
139
- * @default false
140
- */
141
- asChild?: boolean;
142
- /**
143
- * Force the content to mount even when the dialog is closed. Pair with
144
- * a CSS animation that fades in/out based on `data-state`.
145
- * @default false
146
- */
147
- forceMount?: true;
148
- /**
149
- * Fires when focus enters the dialog after it opens. Call
150
- * `event.preventDefault()` to prevent the default focus-first-element
151
- * behaviour.
152
- */
153
- onOpenAutoFocus?: (event: Event) => void;
154
- /**
155
- * Fires when focus leaves the dialog after it closes. Call
156
- * `event.preventDefault()` to prevent focus from returning to the trigger.
157
- */
158
- onCloseAutoFocus?: (event: Event) => void;
159
- /**
160
- * Fires when the Escape key is pressed inside the dialog. Call
161
- * `event.preventDefault()` to keep the dialog open.
162
- */
163
- onEscapeKeyDown?: (event: KeyboardEvent) => void;
164
- /**
165
- * Fires when a pointer event happens outside the dialog. Call
166
- * `event.preventDefault()` to keep the dialog open.
167
- */
168
- onPointerDownOutside?: (event: CustomEvent<{ originalEvent: PointerEvent }>) => void;
169
- /**
170
- * Fires on any interaction (focus, pointer) outside the dialog. Call
171
- * `event.preventDefault()` to keep the dialog open. Superset of the
172
- * `onPointerDownOutside` and focus-out events.
173
- */
174
- onInteractOutside?: (event: Event) => void;
175
- /** Title + Description + body content + Footer. */
176
- children?: React.ReactNode;
177
- /**
178
- * Tailwind / CSS classes merged onto the content panel via `cn()`.
179
- * Default styling: centered, max-w-lg, white card with shadow.
180
- */
181
- className?: string;
182
- }
183
-
184
- const DialogContent = React.forwardRef<
185
- React.ElementRef<typeof DialogPrimitive.Content>,
186
- DialogContentProps
187
- >(({ className, children, ...props }, ref) => {
188
- const container = usePortalContainer();
189
- return (
190
- <DialogPortal container={container ?? undefined}>
191
- <DialogOverlay />
192
- <DialogPrimitive.Content
193
- ref={ref}
194
- data-slot="dialog-content"
195
- className={cn(
196
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
197
- className,
198
- )}
199
- {...props}
200
- >
201
- {children}
202
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
203
- <X className="h-4 w-4" />
204
- <span className="sr-only">Close</span>
205
- </DialogPrimitive.Close>
206
- </DialogPrimitive.Content>
207
- </DialogPortal>
208
- );
209
- });
210
- DialogContent.displayName = DialogPrimitive.Content.displayName;
211
-
212
- export interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
213
- /**
214
- * Title + optional description for the dialog. Stacked column on mobile,
215
- * left-aligned by default on desktop.
216
- */
217
- children?: React.ReactNode;
218
- /** Tailwind / CSS classes merged onto the header via `cn()`. */
219
- className?: string;
220
- }
221
-
222
- const DialogHeader = ({ className, ...props }: DialogHeaderProps) => (
223
- <div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
224
- );
225
- DialogHeader.displayName = "DialogHeader";
226
-
227
- export interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
228
- /**
229
- * Action buttons for the dialog. Reverses to a column on mobile so the
230
- * primary action sits on top.
231
- */
232
- children?: React.ReactNode;
233
- /** Tailwind / CSS classes merged onto the footer via `cn()`. */
234
- className?: string;
235
- }
236
-
237
- const DialogFooter = ({ className, ...props }: DialogFooterProps) => (
238
- <div
239
- className={cn(
240
- "flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-end",
241
- className,
242
- )}
243
- {...props}
244
- />
245
- );
246
- DialogFooter.displayName = "DialogFooter";
247
-
248
- export interface DialogTitleProps
249
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> {
250
- /**
251
- * Render as a Radix Slot — forwards props onto the immediate child
252
- * element. Use to swap the heading level (e.g. `<h3>` instead of the
253
- * default `<h2>`).
254
- * @default false
255
- */
256
- asChild?: boolean;
257
- /** Title text. Required for screen-reader users. */
258
- children?: React.ReactNode;
259
- /** Tailwind / CSS classes merged onto the title via `cn()`. */
260
- className?: string;
261
- }
262
-
263
- const DialogTitle = React.forwardRef<
264
- React.ElementRef<typeof DialogPrimitive.Title>,
265
- DialogTitleProps
266
- >(({ className, ...props }, ref) => (
267
- <DialogPrimitive.Title
268
- ref={ref}
269
- className={cn("text-lg font-semibold leading-none tracking-tight", className)}
270
- {...props}
271
- />
272
- ));
273
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
274
-
275
- export interface DialogDescriptionProps
276
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> {
277
- /**
278
- * Render as a Radix Slot — forwards props onto the immediate child
279
- * element instead of the default `<p>`.
280
- * @default false
281
- */
282
- asChild?: boolean;
283
- /** Description text shown below the title. */
284
- children?: React.ReactNode;
285
- /** Tailwind / CSS classes merged onto the description via `cn()`. */
286
- className?: string;
287
- }
288
-
289
- const DialogDescription = React.forwardRef<
290
- React.ElementRef<typeof DialogPrimitive.Description>,
291
- DialogDescriptionProps
292
- >(({ className, ...props }, ref) => (
293
- <DialogPrimitive.Description
294
- ref={ref}
295
- className={cn("text-sm text-muted-foreground", className)}
296
- {...props}
297
- />
298
- ));
299
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
300
-
301
- export {
302
- Dialog,
303
- DialogClose,
304
- DialogContent,
305
- DialogDescription,
306
- DialogFooter,
307
- DialogHeader,
308
- DialogOverlay,
309
- DialogPortal,
310
- DialogTitle,
311
- DialogTrigger,
312
- };
@@ -1,123 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Drawer as DrawerPrimitive } from "vaul";
5
-
6
- import { usePortalContainer } from "../../lib/portal-container";
7
- import { cn } from "../../lib/utils";
8
-
9
- const Drawer = ({
10
- shouldScaleBackground = true,
11
- container,
12
- ...props
13
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) => {
14
- const fallbackContainer = usePortalContainer();
15
- return (
16
- <DrawerPrimitive.Root
17
- shouldScaleBackground={shouldScaleBackground}
18
- container={container ?? fallbackContainer ?? undefined}
19
- {...props}
20
- />
21
- );
22
- };
23
- Drawer.displayName = "Drawer";
24
-
25
- const DrawerTrigger = DrawerPrimitive.Trigger;
26
-
27
- const DrawerPortal = DrawerPrimitive.Portal;
28
-
29
- const DrawerClose = DrawerPrimitive.Close;
30
-
31
- const DrawerOverlay = React.forwardRef<
32
- React.ElementRef<typeof DrawerPrimitive.Overlay>,
33
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
34
- >(({ className, ...props }, ref) => (
35
- <DrawerPrimitive.Overlay
36
- ref={ref}
37
- className={cn("fixed inset-0 z-50 bg-black/80", className)}
38
- {...props}
39
- />
40
- ));
41
- DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
42
-
43
- const DrawerHandle = React.forwardRef<
44
- React.ElementRef<typeof DrawerPrimitive.Handle>,
45
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Handle>
46
- >(({ className, ...props }, ref) => (
47
- <DrawerPrimitive.Handle
48
- ref={ref}
49
- className={cn("mx-auto mt-4 !h-2 !w-[100px] rounded-full bg-muted", className)}
50
- {...props}
51
- />
52
- ));
53
- DrawerHandle.displayName = "DrawerHandle";
54
-
55
- const DrawerContent = React.forwardRef<
56
- React.ElementRef<typeof DrawerPrimitive.Content>,
57
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
58
- >(({ className, children, ...props }, ref) => (
59
- <DrawerPortal>
60
- <DrawerOverlay />
61
- <DrawerPrimitive.Content
62
- ref={ref}
63
- data-slot="drawer-content"
64
- className={cn(
65
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border border-border bg-background",
66
- className,
67
- )}
68
- {...props}
69
- >
70
- <DrawerHandle />
71
- {children}
72
- </DrawerPrimitive.Content>
73
- </DrawerPortal>
74
- ));
75
- DrawerContent.displayName = "DrawerContent";
76
-
77
- const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
78
- <div className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)} {...props} />
79
- );
80
- DrawerHeader.displayName = "DrawerHeader";
81
-
82
- const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
83
- <div className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props} />
84
- );
85
- DrawerFooter.displayName = "DrawerFooter";
86
-
87
- const DrawerTitle = React.forwardRef<
88
- React.ElementRef<typeof DrawerPrimitive.Title>,
89
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
90
- >(({ className, ...props }, ref) => (
91
- <DrawerPrimitive.Title
92
- ref={ref}
93
- className={cn("text-lg font-semibold leading-none tracking-tight", className)}
94
- {...props}
95
- />
96
- ));
97
- DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
98
-
99
- const DrawerDescription = React.forwardRef<
100
- React.ElementRef<typeof DrawerPrimitive.Description>,
101
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
102
- >(({ className, ...props }, ref) => (
103
- <DrawerPrimitive.Description
104
- ref={ref}
105
- className={cn("text-sm text-muted-foreground", className)}
106
- {...props}
107
- />
108
- ));
109
- DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
110
-
111
- export {
112
- Drawer,
113
- DrawerClose,
114
- DrawerContent,
115
- DrawerDescription,
116
- DrawerFooter,
117
- DrawerHandle,
118
- DrawerHeader,
119
- DrawerOverlay,
120
- DrawerPortal,
121
- DrawerTitle,
122
- DrawerTrigger,
123
- };