@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,309 +0,0 @@
1
- "use client";
2
-
3
- import * as SelectPrimitive from "@radix-ui/react-select";
4
- import { Check, ChevronDown, ChevronUp } 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
- export interface SelectProps extends React.ComponentProps<typeof SelectPrimitive.Root> {
11
- /** Controlled value. Pair with `onValueChange`. */
12
- value?: string;
13
- /** Initial value for uncontrolled usage. */
14
- defaultValue?: string;
15
- /** Fires when the user picks an option. */
16
- onValueChange?: (value: string) => void;
17
- /** Controlled open state. */
18
- open?: boolean;
19
- /** Initial open state. */
20
- defaultOpen?: boolean;
21
- /** Fires when the dropdown opens/closes. */
22
- onOpenChange?: (open: boolean) => void;
23
- /** Form field name. Required for native form submission. */
24
- name?: string;
25
- /**
26
- * Disable the entire select.
27
- * @default false
28
- */
29
- disabled?: boolean;
30
- /**
31
- * Required for native form validation.
32
- * @default false
33
- */
34
- required?: boolean;
35
- /**
36
- * Reading direction.
37
- * @default "ltr"
38
- */
39
- dir?: "ltr" | "rtl";
40
- /** Trigger + Content. */
41
- children?: React.ReactNode;
42
- }
43
-
44
- const Select = SelectPrimitive.Root as React.FC<SelectProps>;
45
-
46
- export interface SelectGroupProps
47
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Group> {
48
- /** Items grouped together — pair with `<SelectLabel>`. */
49
- children?: React.ReactNode;
50
- }
51
-
52
- const SelectGroup = SelectPrimitive.Group as React.ForwardRefExoticComponent<
53
- SelectGroupProps & React.RefAttributes<HTMLDivElement>
54
- >;
55
-
56
- export interface SelectValueProps
57
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value> {
58
- /** Placeholder shown when no value is selected. */
59
- placeholder?: React.ReactNode;
60
- /**
61
- * Render as a Radix Slot — useful when you want to fully customise the
62
- * value display.
63
- * @default false
64
- */
65
- asChild?: boolean;
66
- /** Custom display node when a value is selected. */
67
- children?: React.ReactNode;
68
- }
69
-
70
- const SelectValue = SelectPrimitive.Value as React.ForwardRefExoticComponent<
71
- SelectValueProps & React.RefAttributes<HTMLSpanElement>
72
- >;
73
-
74
- export interface SelectTriggerProps
75
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
76
- /**
77
- * Render as a Radix Slot.
78
- * @default false
79
- */
80
- asChild?: boolean;
81
- /** Typically a `<SelectValue>`. */
82
- children?: React.ReactNode;
83
- className?: string;
84
- }
85
-
86
- const SelectTrigger = React.forwardRef<
87
- React.ElementRef<typeof SelectPrimitive.Trigger>,
88
- SelectTriggerProps
89
- >(({ className, children, ...props }, ref) => (
90
- <SelectPrimitive.Trigger
91
- ref={ref}
92
- className={cn(
93
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
94
- className,
95
- )}
96
- {...props}
97
- >
98
- {children}
99
- <SelectPrimitive.Icon asChild>
100
- <ChevronDown className="h-4 w-4 opacity-50" />
101
- </SelectPrimitive.Icon>
102
- </SelectPrimitive.Trigger>
103
- ));
104
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
105
-
106
- export interface SelectScrollUpButtonProps
107
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton> {
108
- asChild?: boolean;
109
- className?: string;
110
- }
111
-
112
- const SelectScrollUpButton = React.forwardRef<
113
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
114
- SelectScrollUpButtonProps
115
- >(({ className, ...props }, ref) => (
116
- <SelectPrimitive.ScrollUpButton
117
- ref={ref}
118
- className={cn("flex cursor-default items-center justify-center py-1", className)}
119
- {...props}
120
- >
121
- <ChevronUp className="h-4 w-4" />
122
- </SelectPrimitive.ScrollUpButton>
123
- ));
124
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
125
-
126
- export interface SelectScrollDownButtonProps
127
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton> {
128
- asChild?: boolean;
129
- className?: string;
130
- }
131
-
132
- const SelectScrollDownButton = React.forwardRef<
133
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
134
- SelectScrollDownButtonProps
135
- >(({ className, ...props }, ref) => (
136
- <SelectPrimitive.ScrollDownButton
137
- ref={ref}
138
- className={cn("flex cursor-default items-center justify-center py-1", className)}
139
- {...props}
140
- >
141
- <ChevronDown className="h-4 w-4" />
142
- </SelectPrimitive.ScrollDownButton>
143
- ));
144
- SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
145
-
146
- export interface SelectContentProps
147
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {
148
- /**
149
- * Whether to use trigger-anchored ("popper") or item-anchored
150
- * ("item-aligned") positioning.
151
- * @default "popper"
152
- */
153
- position?: "popper" | "item-aligned";
154
- /** Distance from the trigger (px). Only when `position="popper"`. */
155
- sideOffset?: number;
156
- /** Distance from the alignment edge (px). */
157
- alignOffset?: number;
158
- /**
159
- * Preferred side. Only when `position="popper"`.
160
- * @default "bottom"
161
- */
162
- side?: "top" | "right" | "bottom" | "left";
163
- /**
164
- * Alignment along the chosen side.
165
- * @default "start"
166
- */
167
- align?: "start" | "center" | "end";
168
- /** Avoid colliding with viewport edges. */
169
- avoidCollisions?: boolean;
170
- /** Padding kept from collision boundaries. */
171
- collisionPadding?: number | { top?: number; right?: number; bottom?: number; left?: number };
172
- /** Force the content to mount even when closed. */
173
- forceMount?: true;
174
- /** Render as a Radix Slot. */
175
- asChild?: boolean;
176
- /** Items + groups + separators. */
177
- children?: React.ReactNode;
178
- className?: string;
179
- }
180
-
181
- const SelectContent = React.forwardRef<
182
- React.ElementRef<typeof SelectPrimitive.Content>,
183
- SelectContentProps
184
- >(({ className, children, position = "popper", ...props }, ref) => {
185
- const container = usePortalContainer();
186
- return (
187
- <SelectPrimitive.Portal container={container ?? undefined}>
188
- <SelectPrimitive.Content
189
- ref={ref}
190
- data-slot="select-content"
191
- className={cn(
192
- "relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[var(--radix-select-content-transform-origin)]",
193
- position === "popper" &&
194
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
195
- className,
196
- )}
197
- position={position}
198
- {...props}
199
- >
200
- <SelectScrollUpButton />
201
- <SelectPrimitive.Viewport
202
- className={cn(
203
- "p-1",
204
- position === "popper" &&
205
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
206
- )}
207
- >
208
- {children}
209
- </SelectPrimitive.Viewport>
210
- <SelectScrollDownButton />
211
- </SelectPrimitive.Content>
212
- </SelectPrimitive.Portal>
213
- );
214
- });
215
- SelectContent.displayName = SelectPrimitive.Content.displayName;
216
-
217
- export interface SelectLabelProps
218
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> {
219
- asChild?: boolean;
220
- /** Section heading text. */
221
- children?: React.ReactNode;
222
- className?: string;
223
- }
224
-
225
- const SelectLabel = React.forwardRef<
226
- React.ElementRef<typeof SelectPrimitive.Label>,
227
- SelectLabelProps
228
- >(({ className, ...props }, ref) => (
229
- <SelectPrimitive.Label
230
- ref={ref}
231
- className={cn("px-2 py-1.5 text-sm font-semibold", className)}
232
- {...props}
233
- />
234
- ));
235
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
236
-
237
- export interface SelectItemProps
238
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {
239
- /** Required — value reported when this option is picked. */
240
- value: string;
241
- /**
242
- * Disable this option.
243
- * @default false
244
- */
245
- disabled?: boolean;
246
- /** Override what's used as text for typeahead/search. */
247
- textValue?: string;
248
- asChild?: boolean;
249
- /** Item label. */
250
- children?: React.ReactNode;
251
- className?: string;
252
- }
253
-
254
- const SelectItem = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Item>, SelectItemProps>(
255
- ({ className, children, ...props }, ref) => (
256
- <SelectPrimitive.Item
257
- ref={ref}
258
- className={cn(
259
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
260
- className,
261
- )}
262
- {...props}
263
- >
264
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
265
- <SelectPrimitive.ItemIndicator>
266
- <Check className="h-4 w-4" />
267
- </SelectPrimitive.ItemIndicator>
268
- </span>
269
- <SelectPrimitive.ItemText>
270
- {/* Wrap children in a flex row so an inline icon + label compose
271
- * horizontally instead of stacking — Tailwind's preflight makes
272
- * <svg> block-level, which would otherwise push the text below. */}
273
- <span className="flex items-center gap-2">{children}</span>
274
- </SelectPrimitive.ItemText>
275
- </SelectPrimitive.Item>
276
- ),
277
- );
278
- SelectItem.displayName = SelectPrimitive.Item.displayName;
279
-
280
- export interface SelectSeparatorProps
281
- extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> {
282
- asChild?: boolean;
283
- className?: string;
284
- }
285
-
286
- const SelectSeparator = React.forwardRef<
287
- React.ElementRef<typeof SelectPrimitive.Separator>,
288
- SelectSeparatorProps
289
- >(({ className, ...props }, ref) => (
290
- <SelectPrimitive.Separator
291
- ref={ref}
292
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
293
- {...props}
294
- />
295
- ));
296
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
297
-
298
- export {
299
- Select,
300
- SelectContent,
301
- SelectGroup,
302
- SelectItem,
303
- SelectLabel,
304
- SelectScrollDownButton,
305
- SelectScrollUpButton,
306
- SelectSeparator,
307
- SelectTrigger,
308
- SelectValue,
309
- };
@@ -1,265 +0,0 @@
1
- "use client";
2
-
3
- import * as SheetPrimitive from "@radix-ui/react-dialog";
4
- import { cva, type VariantProps } from "class-variance-authority";
5
- import { X } from "lucide-react";
6
- import * as React from "react";
7
-
8
- import { usePortalContainer } from "../../lib/portal-container";
9
- import { cn } from "../../lib/utils";
10
-
11
- export interface SheetProps extends React.ComponentProps<typeof SheetPrimitive.Root> {
12
- /** Controlled open state. Pair with `onOpenChange`. */
13
- open?: boolean;
14
- /**
15
- * Initial open state for uncontrolled usage.
16
- * @default false
17
- */
18
- defaultOpen?: boolean;
19
- /** Fires whenever the sheet opens or closes. */
20
- onOpenChange?: (open: boolean) => void;
21
- /**
22
- * When true, the sheet traps focus and renders the scrim overlay.
23
- * @default true
24
- */
25
- modal?: boolean;
26
- /** Trigger + Content. */
27
- children?: React.ReactNode;
28
- }
29
-
30
- const Sheet = SheetPrimitive.Root as React.FC<SheetProps>;
31
-
32
- export interface SheetTriggerProps
33
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger> {
34
- /**
35
- * Render as a Radix Slot.
36
- * @default false
37
- */
38
- asChild?: boolean;
39
- children?: React.ReactNode;
40
- className?: string;
41
- }
42
-
43
- const SheetTrigger = SheetPrimitive.Trigger as React.ForwardRefExoticComponent<
44
- SheetTriggerProps & React.RefAttributes<HTMLButtonElement>
45
- >;
46
-
47
- export interface SheetCloseProps
48
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Close> {
49
- /**
50
- * Render as a Radix Slot.
51
- * @default false
52
- */
53
- asChild?: boolean;
54
- children?: React.ReactNode;
55
- className?: string;
56
- }
57
-
58
- const SheetClose = SheetPrimitive.Close as React.ForwardRefExoticComponent<
59
- SheetCloseProps & React.RefAttributes<HTMLButtonElement>
60
- >;
61
-
62
- export interface SheetPortalProps
63
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Portal> {
64
- /** DOM element to portal into. Defaults to `document.body`. */
65
- container?: HTMLElement | null;
66
- /**
67
- * Force the portal to mount even when the sheet is closed.
68
- * @default false
69
- */
70
- forceMount?: true;
71
- children?: React.ReactNode;
72
- }
73
-
74
- const SheetPortal = SheetPrimitive.Portal as React.FC<SheetPortalProps>;
75
-
76
- export interface SheetOverlayProps
77
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay> {
78
- /**
79
- * Render as a Radix Slot.
80
- * @default false
81
- */
82
- asChild?: boolean;
83
- /**
84
- * Force the overlay to mount even when closed.
85
- * @default false
86
- */
87
- forceMount?: true;
88
- className?: string;
89
- }
90
-
91
- const SheetOverlay = React.forwardRef<
92
- React.ElementRef<typeof SheetPrimitive.Overlay>,
93
- SheetOverlayProps
94
- >(({ className, ...props }, ref) => (
95
- <SheetPrimitive.Overlay
96
- className={cn(
97
- "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",
98
- className,
99
- )}
100
- {...props}
101
- ref={ref}
102
- />
103
- ));
104
- SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
105
-
106
- const sheetVariants = cva(
107
- "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
108
- {
109
- variants: {
110
- side: {
111
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
112
- bottom:
113
- "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
114
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
115
- right:
116
- "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
117
- },
118
- },
119
- defaultVariants: {
120
- side: "right",
121
- },
122
- },
123
- );
124
-
125
- export interface SheetContentProps
126
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
127
- VariantProps<typeof sheetVariants> {
128
- /**
129
- * Which edge of the viewport the sheet slides in from.
130
- * @default "right"
131
- */
132
- side?: "top" | "right" | "bottom" | "left";
133
- /**
134
- * Render as a Radix Slot.
135
- * @default false
136
- */
137
- asChild?: boolean;
138
- /**
139
- * Force the content to mount even when closed.
140
- * @default false
141
- */
142
- forceMount?: true;
143
- /** Fires when focus enters the sheet after it opens. */
144
- onOpenAutoFocus?: (event: Event) => void;
145
- /** Fires when focus leaves the sheet after it closes. */
146
- onCloseAutoFocus?: (event: Event) => void;
147
- /** Fires when Escape is pressed. */
148
- onEscapeKeyDown?: (event: KeyboardEvent) => void;
149
- /** Fires on pointer event outside the sheet. */
150
- onPointerDownOutside?: (event: CustomEvent<{ originalEvent: PointerEvent }>) => void;
151
- /** Fires on any interaction outside (focus + pointer). */
152
- onInteractOutside?: (event: Event) => void;
153
- /** Sheet body — `<SheetHeader>`, content, `<SheetFooter>`. */
154
- children?: React.ReactNode;
155
- /** Tailwind / CSS classes merged via `cn()`. */
156
- className?: string;
157
- }
158
-
159
- const SheetContent = React.forwardRef<
160
- React.ElementRef<typeof SheetPrimitive.Content>,
161
- SheetContentProps
162
- >(({ side = "right", className, children, ...props }, ref) => {
163
- const container = usePortalContainer();
164
- return (
165
- <SheetPortal container={container ?? undefined}>
166
- <SheetOverlay />
167
- <SheetPrimitive.Content
168
- ref={ref}
169
- data-slot="sheet-content"
170
- className={cn(sheetVariants({ side }), className)}
171
- {...props}
172
- >
173
- <SheetPrimitive.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-secondary">
174
- <X className="h-4 w-4" />
175
- <span className="sr-only">Close</span>
176
- </SheetPrimitive.Close>
177
- {children}
178
- </SheetPrimitive.Content>
179
- </SheetPortal>
180
- );
181
- });
182
- SheetContent.displayName = SheetPrimitive.Content.displayName;
183
-
184
- export interface SheetHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
185
- /** Title + optional description. */
186
- children?: React.ReactNode;
187
- className?: string;
188
- }
189
-
190
- const SheetHeader = ({ className, ...props }: SheetHeaderProps) => (
191
- <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
192
- );
193
- SheetHeader.displayName = "SheetHeader";
194
-
195
- export interface SheetFooterProps extends React.HTMLAttributes<HTMLDivElement> {
196
- /** Action buttons. */
197
- children?: React.ReactNode;
198
- className?: string;
199
- }
200
-
201
- const SheetFooter = ({ className, ...props }: SheetFooterProps) => (
202
- <div
203
- className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
204
- {...props}
205
- />
206
- );
207
- SheetFooter.displayName = "SheetFooter";
208
-
209
- export interface SheetTitleProps
210
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title> {
211
- /**
212
- * Render as a Radix Slot.
213
- * @default false
214
- */
215
- asChild?: boolean;
216
- children?: React.ReactNode;
217
- className?: string;
218
- }
219
-
220
- const SheetTitle = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Title>, SheetTitleProps>(
221
- ({ className, ...props }, ref) => (
222
- <SheetPrimitive.Title
223
- ref={ref}
224
- className={cn("text-lg font-semibold text-foreground", className)}
225
- {...props}
226
- />
227
- ),
228
- );
229
- SheetTitle.displayName = SheetPrimitive.Title.displayName;
230
-
231
- export interface SheetDescriptionProps
232
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description> {
233
- /**
234
- * Render as a Radix Slot.
235
- * @default false
236
- */
237
- asChild?: boolean;
238
- children?: React.ReactNode;
239
- className?: string;
240
- }
241
-
242
- const SheetDescription = React.forwardRef<
243
- React.ElementRef<typeof SheetPrimitive.Description>,
244
- SheetDescriptionProps
245
- >(({ className, ...props }, ref) => (
246
- <SheetPrimitive.Description
247
- ref={ref}
248
- className={cn("text-sm text-muted-foreground", className)}
249
- {...props}
250
- />
251
- ));
252
- SheetDescription.displayName = SheetPrimitive.Description.displayName;
253
-
254
- export {
255
- Sheet,
256
- SheetClose,
257
- SheetContent,
258
- SheetDescription,
259
- SheetFooter,
260
- SheetHeader,
261
- SheetOverlay,
262
- SheetPortal,
263
- SheetTitle,
264
- SheetTrigger,
265
- };