@olympusoss/canvas 2.20.2 → 3.2.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.
- package/README.md +73 -35
- package/package.json +46 -177
- package/src/cn.ts +3 -0
- package/src/index.ts +12 -603
- package/src/theme.ts +62 -0
- package/src/tokens.ts +11 -0
- package/styles/atoms/avatar.css +22 -0
- package/styles/atoms/badge.css +83 -0
- package/styles/atoms/breadcrumb.css +35 -0
- package/styles/atoms/button-group.css +23 -0
- package/styles/atoms/button.css +107 -0
- package/styles/atoms/checkbox.css +55 -0
- package/styles/atoms/combobox.css +75 -0
- package/styles/atoms/dropdown.css +54 -0
- package/styles/atoms/icon.css +8 -0
- package/styles/atoms/input-group.css +45 -0
- package/styles/atoms/input.css +56 -0
- package/styles/atoms/kbd.css +15 -0
- package/styles/atoms/pagination.css +48 -0
- package/styles/atoms/popover.css +14 -0
- package/styles/atoms/radio.css +28 -0
- package/styles/atoms/select.css +57 -0
- package/styles/atoms/separator.css +32 -0
- package/styles/atoms/skeleton.css +32 -0
- package/styles/atoms/spinner.css +26 -0
- package/styles/atoms/switch.css +45 -0
- package/styles/atoms/textarea.css +31 -0
- package/styles/atoms/tooltip.css +53 -0
- package/styles/atoms/typography.css +105 -0
- package/styles/base.css +17 -0
- package/styles/canvas.css +77 -52
- package/styles/molecules/alert.css +66 -0
- package/styles/molecules/card.css +58 -0
- package/styles/molecules/code-block.css +18 -0
- package/styles/molecules/empty-state.css +17 -0
- package/styles/molecules/field.css +27 -0
- package/styles/molecules/form.css +27 -0
- package/styles/molecules/page-header.css +52 -0
- package/styles/molecules/section-card.css +49 -0
- package/styles/molecules/stat-card.css +71 -0
- package/styles/molecules/toast.css +95 -0
- package/styles/organisms/app-shell.css +46 -0
- package/styles/organisms/calendar.css +73 -0
- package/styles/organisms/command.css +94 -0
- package/styles/organisms/data-table.css +142 -0
- package/styles/organisms/dialog.css +72 -0
- package/styles/organisms/filter-panel.css +58 -0
- package/styles/organisms/row-menu.css +69 -0
- package/styles/organisms/sheet.css +70 -0
- package/styles/organisms/sidebar.css +146 -0
- package/styles/organisms/stepper.css +63 -0
- package/styles/organisms/tabs.css +40 -0
- package/styles/organisms/topbar.css +24 -0
- package/styles/patterns/backdrops.css +35 -0
- package/styles/patterns/density.css +66 -0
- package/styles/patterns/focus.css +22 -0
- package/styles/patterns/glass.css +85 -0
- package/styles/patterns/high-contrast.css +70 -0
- package/styles/patterns/reduced-motion.css +12 -0
- package/styles/patterns/scrollbar.css +10 -0
- package/styles/reset.css +89 -0
- package/styles/tokens/colors.css +106 -0
- package/styles/tokens/motion.css +33 -0
- package/styles/tokens/radius.css +10 -0
- package/styles/tokens/shadows.css +35 -0
- package/styles/tokens/spacing.css +19 -0
- package/styles/tokens/typography.css +6 -0
- package/styles/tokens/z-index.css +12 -0
- package/styles/utilities/display.css +66 -0
- package/styles/utilities/flexbox.css +240 -0
- package/styles/utilities/gap.css +288 -0
- package/styles/utilities/grid.css +138 -0
- package/styles/utilities/position.css +78 -0
- package/styles/utilities/sizing.css +138 -0
- package/tsconfig.json +20 -21
- package/src/components/atoms/README.md +0 -11
- package/src/components/atoms/aspect-ratio.tsx +0 -32
- package/src/components/atoms/avatar.tsx +0 -98
- package/src/components/atoms/badge.tsx +0 -44
- package/src/components/atoms/brand-mark.tsx +0 -74
- package/src/components/atoms/button.tsx +0 -105
- package/src/components/atoms/checkbox.tsx +0 -63
- package/src/components/atoms/flex-box.tsx +0 -105
- package/src/components/atoms/icon.tsx +0 -34
- package/src/components/atoms/input.tsx +0 -92
- package/src/components/atoms/label.tsx +0 -41
- package/src/components/atoms/logo.tsx +0 -89
- package/src/components/atoms/progress.tsx +0 -55
- package/src/components/atoms/radio-group.tsx +0 -122
- package/src/components/atoms/scroll-area.tsx +0 -106
- package/src/components/atoms/section.tsx +0 -48
- package/src/components/atoms/separator.tsx +0 -45
- package/src/components/atoms/skeleton.tsx +0 -17
- package/src/components/atoms/slider.tsx +0 -93
- package/src/components/atoms/spinner.tsx +0 -47
- package/src/components/atoms/switch.tsx +0 -60
- package/src/components/atoms/textarea.tsx +0 -78
- package/src/components/atoms/toggle.tsx +0 -80
- package/src/components/charts/activity-heatmap.tsx +0 -186
- package/src/components/charts/axes.tsx +0 -21
- package/src/components/charts/chart-container.tsx +0 -254
- package/src/components/charts/chart-legend.tsx +0 -67
- package/src/components/charts/chart-tooltip.tsx +0 -161
- package/src/components/charts/chart-types.tsx +0 -49
- package/src/components/charts/containers.tsx +0 -11
- package/src/components/charts/data.tsx +0 -16
- package/src/components/charts/details.tsx +0 -25
- package/src/components/charts/dot-pulse.tsx +0 -61
- package/src/components/charts/gauge.tsx +0 -106
- package/src/components/charts/grids.tsx +0 -8
- package/src/components/charts/index.ts +0 -62
- package/src/components/charts/labeled-bar-list.tsx +0 -85
- package/src/components/charts/metric-breakdown.tsx +0 -316
- package/src/components/charts/references.tsx +0 -8
- package/src/components/charts/service-health-list.tsx +0 -85
- package/src/components/charts/sparkline-area.tsx +0 -80
- package/src/components/charts/sparkline.tsx +0 -52
- package/src/components/charts/stacked-bar.tsx +0 -104
- package/src/components/charts/text.tsx +0 -10
- package/src/components/charts/world-heat-map-inner.tsx +0 -317
- package/src/components/charts/world-heat-map.tsx +0 -184
- package/src/components/molecules/README.md +0 -12
- package/src/components/molecules/action-bar.tsx +0 -73
- package/src/components/molecules/activity-item.tsx +0 -74
- package/src/components/molecules/alert.tsx +0 -86
- package/src/components/molecules/animated-background.tsx +0 -92
- package/src/components/molecules/auth-shell.tsx +0 -95
- package/src/components/molecules/brand-lockup.tsx +0 -48
- package/src/components/molecules/breadcrumb.tsx +0 -157
- package/src/components/molecules/button-group.tsx +0 -104
- package/src/components/molecules/calendar.tsx +0 -217
- package/src/components/molecules/card.tsx +0 -102
- package/src/components/molecules/client-brand.tsx +0 -95
- package/src/components/molecules/code-block.tsx +0 -86
- package/src/components/molecules/countdown-button.tsx +0 -92
- package/src/components/molecules/empty-state.tsx +0 -56
- package/src/components/molecules/error-state.tsx +0 -42
- package/src/components/molecules/field-display.tsx +0 -35
- package/src/components/molecules/input-otp.tsx +0 -74
- package/src/components/molecules/launcher-card.tsx +0 -152
- package/src/components/molecules/loading-state.tsx +0 -36
- package/src/components/molecules/notification-item.tsx +0 -67
- package/src/components/molecules/notification-list.tsx +0 -45
- package/src/components/molecules/number-badge.tsx +0 -53
- package/src/components/molecules/or-separator.tsx +0 -38
- package/src/components/molecules/page-header.tsx +0 -88
- package/src/components/molecules/page-tabs.tsx +0 -94
- package/src/components/molecules/pagination.tsx +0 -150
- package/src/components/molecules/password-input.tsx +0 -83
- package/src/components/molecules/password-strength-meter.tsx +0 -104
- package/src/components/molecules/phone-input.tsx +0 -200
- package/src/components/molecules/search-bar.tsx +0 -64
- package/src/components/molecules/secret-field.tsx +0 -158
- package/src/components/molecules/section-card.tsx +0 -91
- package/src/components/molecules/social-buttons.tsx +0 -165
- package/src/components/molecules/stat-card.tsx +0 -100
- package/src/components/molecules/status-badge.tsx +0 -42
- package/src/components/molecules/stepper.tsx +0 -96
- package/src/components/molecules/table.tsx +0 -157
- package/src/components/molecules/terminal.tsx +0 -74
- package/src/components/molecules/toggle-group.tsx +0 -145
- package/src/components/molecules/tooltip.tsx +0 -155
- package/src/components/molecules/user-avatar-chip.tsx +0 -71
- package/src/components/organisms/README.md +0 -14
- package/src/components/organisms/accordion.tsx +0 -154
- package/src/components/organisms/alert-dialog.tsx +0 -277
- package/src/components/organisms/carousel.tsx +0 -244
- package/src/components/organisms/collapsible.tsx +0 -69
- package/src/components/organisms/command.tsx +0 -144
- package/src/components/organisms/context-menu.tsx +0 -339
- package/src/components/organisms/dashboard-grid.tsx +0 -369
- package/src/components/organisms/data-table.tsx +0 -330
- package/src/components/organisms/dialog.tsx +0 -312
- package/src/components/organisms/drawer.tsx +0 -123
- package/src/components/organisms/dropdown-menu.tsx +0 -440
- package/src/components/organisms/editors/code-editor.tsx +0 -144
- package/src/components/organisms/editors/index.ts +0 -4
- package/src/components/organisms/editors/markdown-editor.tsx +0 -153
- package/src/components/organisms/editors/markdown-renderer.ts +0 -27
- package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
- package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
- package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
- package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
- package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
- package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
- package/src/components/organisms/error-boundary.tsx +0 -61
- package/src/components/organisms/form.tsx +0 -174
- package/src/components/organisms/hover-card.tsx +0 -115
- package/src/components/organisms/menubar.tsx +0 -498
- package/src/components/organisms/navbar.tsx +0 -104
- package/src/components/organisms/navigation-menu.tsx +0 -235
- package/src/components/organisms/popover.tsx +0 -149
- package/src/components/organisms/resizable.tsx +0 -58
- package/src/components/organisms/schema-form.tsx +0 -232
- package/src/components/organisms/select.tsx +0 -309
- package/src/components/organisms/sheet.tsx +0 -265
- package/src/components/organisms/sidebar.tsx +0 -1040
- package/src/components/organisms/sonner.tsx +0 -96
- package/src/components/organisms/tabs.tsx +0 -133
- package/src/components/organisms/theme-provider.tsx +0 -101
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/lib/portal-container.tsx +0 -35
- package/src/lib/utils.ts +0 -6
- package/src/native.ts +0 -23
- package/src/tokens/colors.ts +0 -91
- package/src/tokens/index.ts +0 -3
- package/src/tokens/spacing.ts +0 -55
- package/src/tokens/typography.ts +0 -27
- package/styles/dashboard-grid.css +0 -47
- package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
- package/styles/glass.css +0 -175
- package/styles/leaflet.css +0 -13
- package/styles/tokens.css +0 -317
- 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
|
-
};
|