@xemahq/ui-kernel 0.11.0 → 0.11.2
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/dist/ui/chrome/page-shell.d.ts +1 -1
- package/dist/ui/chrome/page-shell.d.ts.map +1 -1
- package/dist/ui/chrome/page-shell.js +9 -4
- package/dist/ui/chrome/page-shell.js.map +1 -1
- package/package.json +6 -4
- package/src/index.ts +0 -17
- package/src/lib/biome-host/agent-validation.ts +0 -239
- package/src/lib/biome-host/biome-builders.ts +0 -112
- package/src/lib/biome-host/biome-mode.ts +0 -6
- package/src/lib/biome-host/biome-navigation.ts +0 -37
- package/src/lib/biome-host/biome-registry.ts +0 -299
- package/src/lib/biome-host/biome-scope-hooks.ts +0 -41
- package/src/lib/biome-host/biome-scope.tsx +0 -52
- package/src/lib/biome-host/biome-scoped-query.ts +0 -134
- package/src/lib/biome-host/create-biome-orval-config.ts +0 -82
- package/src/lib/biome-host/define-web-biome.spec.ts +0 -221
- package/src/lib/biome-host/define-web-biome.ts +0 -222
- package/src/lib/biome-host/errors.ts +0 -220
- package/src/lib/biome-host/frontend-biome.ts +0 -256
- package/src/lib/biome-host/host-bridge.ts +0 -281
- package/src/lib/biome-host/host-sources.ts +0 -54
- package/src/lib/biome-host/i18n-hooks.ts +0 -51
- package/src/lib/biome-host/i18n-port.test.ts +0 -50
- package/src/lib/biome-host/i18n-port.ts +0 -96
- package/src/lib/biome-host/index.ts +0 -35
- package/src/lib/biome-host/realtime-hooks.ts +0 -75
- package/src/lib/biome-host/realtime-port.ts +0 -115
- package/src/lib/biome-host/session-contributions.ts +0 -296
- package/src/lib/biome-host/use-mutation-with-error-toast.ts +0 -90
- package/src/lib/biome-host/use-page-state.ts +0 -248
- package/src/lib/capabilities/capability-context.ts +0 -25
- package/src/lib/capabilities/capability-provider.tsx +0 -73
- package/src/lib/capabilities/index.ts +0 -17
- package/src/lib/capabilities/types.ts +0 -69
- package/src/lib/capabilities/use-capability.ts +0 -79
- package/src/lib/contribution-registry/contribution-registry.spec.ts +0 -141
- package/src/lib/contribution-registry/contribution-registry.ts +0 -204
- package/src/lib/contribution-registry/index.ts +0 -9
- package/src/lib/contribution-registry/renderable-registry.ts +0 -142
- package/src/lib/system-bus/capability-invoke.ts +0 -92
- package/src/lib/system-bus/deeplink.ts +0 -210
- package/src/lib/system-bus/enums.ts +0 -86
- package/src/lib/system-bus/host-ports.ts +0 -93
- package/src/lib/system-bus/index.ts +0 -16
- package/src/lib/system-bus/intent-registry.ts +0 -109
- package/src/lib/system-bus/intents.ts +0 -113
- package/src/lib/system-bus/palette.ts +0 -78
- package/src/lib/system-bus/system-bus-builder.ts +0 -159
- package/src/lib/system-bus/system-bus.ts +0 -37
- package/src/lib/system-bus/windows.ts +0 -51
- package/src/offline/id.ts +0 -16
- package/src/offline/index.ts +0 -54
- package/src/offline/mutation.ts +0 -75
- package/src/offline/offline-status-badge.tsx +0 -51
- package/src/offline/online-controller.ts +0 -105
- package/src/offline/outbox.test.ts +0 -172
- package/src/offline/outbox.ts +0 -348
- package/src/offline/react-hooks.ts +0 -40
- package/src/offline/react.tsx +0 -32
- package/src/offline/storage.ts +0 -112
- package/src/offline/types.ts +0 -77
- package/src/org-db/components/DbResultTable.tsx +0 -176
- package/src/org-db/index.ts +0 -1
- package/src/pdf/index.ts +0 -11
- package/src/registry/index.ts +0 -9
- package/src/registry/lib/agent-validation-host.ts +0 -36
- package/src/registry/lib/biome-slot.tsx +0 -50
- package/src/registry/lib/biomes-enabled-context.ts +0 -20
- package/src/registry/lib/extension-points.ts +0 -134
- package/src/registry/lib/primitives/SessionEventCard.tsx +0 -164
- package/src/registry/lib/primitives/SessionEventTimeline.tsx +0 -95
- package/src/registry/lib/primitives/SessionMutationBar.tsx +0 -76
- package/src/registry/lib/primitives/SessionTabbedDrawer.tsx +0 -165
- package/src/registry/lib/primitives/index.ts +0 -18
- package/src/registry/lib/session-context-builder.ts +0 -84
- package/src/registry/lib/session-context-provider.tsx +0 -33
- package/src/registry/lib/session-context.ts +0 -21
- package/src/registry/lib/session-selectors.ts +0 -272
- package/src/session/comments/CommentRail.tsx +0 -164
- package/src/session/index.ts +0 -3
- package/src/session/lib/cn.ts +0 -11
- package/src/session/shell/SessionWorkspaceShell.tsx +0 -147
- package/src/session-kit/approvals/ApprovalButton.tsx +0 -89
- package/src/session-kit/approvals/ApprovalCard.tsx +0 -341
- package/src/session-kit/approvals/ApprovalsCenter.tsx +0 -336
- package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +0 -118
- package/src/session-kit/approvals/Obligation.tsx +0 -111
- package/src/session-kit/approvals/ScopedBody.tsx +0 -392
- package/src/session-kit/approvals/approval-icons.ts +0 -31
- package/src/session-kit/approvals/approval-model.ts +0 -204
- package/src/session-kit/approvals/index.ts +0 -22
- package/src/session-kit/approvals/obligation-display.ts +0 -100
- package/src/session-kit/approvals/risk-accent.ts +0 -47
- package/src/session-kit/approvals/scope-icons.ts +0 -19
- package/src/session-kit/combobox/Combobox.tsx +0 -358
- package/src/session-kit/combobox/use-click-outside.ts +0 -21
- package/src/session-kit/display/ContextHeader.tsx +0 -148
- package/src/session-kit/display/FileDiffCard.tsx +0 -140
- package/src/session-kit/display/MD.tsx +0 -162
- package/src/session-kit/display/MessageTurn.tsx +0 -157
- package/src/session-kit/display/ThinkingPanel.tsx +0 -81
- package/src/session-kit/display/TodoChecklist.tsx +0 -120
- package/src/session-kit/display/TokenMeter.tsx +0 -89
- package/src/session-kit/display/ToolStrip.tsx +0 -278
- package/src/session-kit/display/TypingDots.tsx +0 -24
- package/src/session-kit/index.ts +0 -44
- package/src/session-kit/lib/enums.ts +0 -66
- package/src/session-kit/lib/portal-accent.ts +0 -30
- package/src/session-kit/lib/status-dot.ts +0 -68
- package/src/session-kit/primitives/Avatar.tsx +0 -44
- package/src/session-kit/primitives/PortalGlyph.tsx +0 -51
- package/src/session-kit/primitives/RiskPill.tsx +0 -95
- package/src/session-kit/primitives/ScopeDot.tsx +0 -47
- package/src/session-kit/primitives/Segmented.tsx +0 -71
- package/src/ui/branding/app-branding-context.ts +0 -20
- package/src/ui/branding/app-branding-provider.tsx +0 -123
- package/src/ui/branding/sanitize.ts +0 -89
- package/src/ui/breakpoints.ts +0 -14
- package/src/ui/capture/document-preview.tsx +0 -166
- package/src/ui/capture/field-spec-to-zod.test.ts +0 -81
- package/src/ui/capture/field-spec-to-zod.ts +0 -174
- package/src/ui/capture/field-spec-validate.ts +0 -236
- package/src/ui/capture/field-spec.test.ts +0 -49
- package/src/ui/capture/field-spec.ts +0 -274
- package/src/ui/capture/index.ts +0 -51
- package/src/ui/capture/schema-field-input.tsx +0 -620
- package/src/ui/capture/schema-form.tsx +0 -149
- package/src/ui/capture/submit-values.test.ts +0 -70
- package/src/ui/capture/submit-values.ts +0 -63
- package/src/ui/capture/use-prefill.ts +0 -186
- package/src/ui/capture/use-schema-validation.ts +0 -145
- package/src/ui/capture/use-wizard.ts +0 -180
- package/src/ui/capture/value-format.ts +0 -32
- package/src/ui/capture/wizard.tsx +0 -105
- package/src/ui/charts/bar-chart.tsx +0 -139
- package/src/ui/charts/chart-frame.tsx +0 -125
- package/src/ui/charts/chart-types.ts +0 -52
- package/src/ui/charts/chart-utils.ts +0 -190
- package/src/ui/charts/charts.test.tsx +0 -204
- package/src/ui/charts/donut-chart.tsx +0 -129
- package/src/ui/charts/index.ts +0 -27
- package/src/ui/charts/line-chart.tsx +0 -202
- package/src/ui/charts/sparkline.tsx +0 -109
- package/src/ui/chrome/AsyncBoundary.tsx +0 -74
- package/src/ui/chrome/EmptyState.tsx +0 -257
- package/src/ui/chrome/ErrorCard.tsx +0 -63
- package/src/ui/chrome/LoadingState.tsx +0 -61
- package/src/ui/chrome/PageHeader.tsx +0 -137
- package/src/ui/chrome/RecordCardList.tsx +0 -98
- package/src/ui/chrome/StateCard.tsx +0 -150
- package/src/ui/chrome/confirm-delete-dialog.tsx +0 -59
- package/src/ui/chrome/page-shell.tsx +0 -189
- package/src/ui/chrome/scope-badge.tsx +0 -40
- package/src/ui/chrome/status-badge.tsx +0 -79
- package/src/ui/cn.ts +0 -32
- package/src/ui/design-tokens.ts +0 -372
- package/src/ui/hooks/use-debounced-value.ts +0 -16
- package/src/ui/hooks/use-is-mobile.ts +0 -28
- package/src/ui/index.ts +0 -110
- package/src/ui/pdf/pdf-preview.tsx +0 -122
- package/src/ui/primitives/alert-dialog.tsx +0 -104
- package/src/ui/primitives/async-combobox.tsx +0 -182
- package/src/ui/primitives/badge-variants.ts +0 -21
- package/src/ui/primitives/badge.tsx +0 -25
- package/src/ui/primitives/button-variants.ts +0 -31
- package/src/ui/primitives/button.tsx +0 -29
- package/src/ui/primitives/card.tsx +0 -43
- package/src/ui/primitives/checkbox.tsx +0 -26
- package/src/ui/primitives/collapsible.tsx +0 -9
- package/src/ui/primitives/dialog.tsx +0 -103
- package/src/ui/primitives/dropdown-menu.tsx +0 -179
- package/src/ui/primitives/form-stepper.tsx +0 -94
- package/src/ui/primitives/form-stepper.types.ts +0 -15
- package/src/ui/primitives/input.tsx +0 -22
- package/src/ui/primitives/label.tsx +0 -17
- package/src/ui/primitives/overflow-tabs.tsx +0 -331
- package/src/ui/primitives/popover.tsx +0 -33
- package/src/ui/primitives/preview-device-frame.tsx +0 -213
- package/src/ui/primitives/radio-group.tsx +0 -36
- package/src/ui/primitives/resizable.tsx +0 -67
- package/src/ui/primitives/scroll-area.tsx +0 -38
- package/src/ui/primitives/select.tsx +0 -143
- package/src/ui/primitives/separator.tsx +0 -20
- package/src/ui/primitives/sheet.tsx +0 -107
- package/src/ui/primitives/skeleton.tsx +0 -99
- package/src/ui/primitives/switch.tsx +0 -27
- package/src/ui/primitives/table.tsx +0 -72
- package/src/ui/primitives/tabs.tsx +0 -53
- package/src/ui/primitives/tag-multi-select.tsx +0 -261
- package/src/ui/primitives/textarea.tsx +0 -21
- package/src/ui/primitives/tooltip.tsx +0 -30
- package/src/ui/primitives/url-preview-chrome.tsx +0 -103
- package/src/vista/GenericCatalogueSurface.tsx +0 -179
- package/src/vista/SurfaceFallbackCard.tsx +0 -109
- package/src/vista/VistaPanel.tsx +0 -163
- package/src/vista/form-payload.spec.ts +0 -139
- package/src/vista/html/CustomUiFrame.spec.tsx +0 -127
- package/src/vista/html/CustomUiFrame.tsx +0 -206
- package/src/vista/html/custom-ui-frame-bridge.spec.ts +0 -191
- package/src/vista/html/custom-ui-frame-bridge.ts +0 -98
- package/src/vista/html/custom-ui-frame-contract.ts +0 -88
- package/src/vista/html/custom-ui-intents.spec.ts +0 -135
- package/src/vista/html/custom-ui-intents.ts +0 -155
- package/src/vista/html/custom-ui-srcdoc.spec.ts +0 -151
- package/src/vista/html/custom-ui-srcdoc.ts +0 -193
- package/src/vista/html/index.ts +0 -13
- package/src/vista/index.ts +0 -52
- package/src/vista/surface-catalogue.spec.ts +0 -140
- package/src/vista/surface-catalogue.ts +0 -90
- package/src/vista/surface-icons.ts +0 -57
- package/src/vista/surface-registry.ts +0 -56
- package/src/vista/surfaces/ChartSurface.tsx +0 -34
- package/src/vista/surfaces/FilesSurface.tsx +0 -202
- package/src/vista/surfaces/FormSurface.tsx +0 -380
- package/src/vista/surfaces/HtmlSurface.tsx +0 -43
- package/src/vista/surfaces/TableSurface.tsx +0 -100
- package/src/vista/surfaces/UrlSurface.tsx +0 -40
- package/src/vista/surfaces/blob-surfaces.tsx +0 -139
- package/src/vista/surfaces/elicitation-transport.spec.ts +0 -369
- package/src/vista/surfaces/elicitation-transport.ts +0 -367
- package/src/vista/surfaces/file-surface-utils.ts +0 -69
- package/src/vista/surfaces/index.ts +0 -24
- package/src/vista/surfaces/register-surfaces.tsx +0 -139
- package/src/vista/surfaces/text-surfaces.tsx +0 -132
- package/src/vista/use-vista-tabs.ts +0 -196
- package/src/vista/vista-code-renderer-context.ts +0 -16
- package/src/vista/vista-code-renderer.tsx +0 -35
- package/src/vista/vista-file-context.ts +0 -14
- package/src/vista/vista-file-source.tsx +0 -141
- package/src/vista/vista-form-context.ts +0 -20
- package/src/vista/vista-form-host.tsx +0 -48
- package/src/vista/vista-model.ts +0 -137
- package/src/vista/vista-open-context.tsx +0 -27
- package/src/vista/vista-open-state.ts +0 -11
- package/src/vista/vista-payloads.ts +0 -635
- package/src/vista/vista-tabs-manifest.ts +0 -138
- package/src/vista/vista-tools.ts +0 -232
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
-
// ── PreviewDeviceFrame — CSS-transform-scaled device bezel ──
|
|
3
|
-
//
|
|
4
|
-
// Wraps a child (typically an iframe, but any node works) in a scale-to-fit
|
|
5
|
-
// bezel for Tablet (768×1024) and Mobile (390×844). Desktop renders children
|
|
6
|
-
// at 100% width/height. Presentation renders a responsive 16:9 viewport;
|
|
7
|
-
// A4 renders a 794×1123 portrait sheet — both grow/shrink to fit the panel.
|
|
8
|
-
//
|
|
9
|
-
// IMPORTANT: We scale the *wrapper* via `transform: scale(...)` — the child is
|
|
10
|
-
// always rendered at the bezel's native resolution. This avoids ResizeObserver
|
|
11
|
-
// churn inside an embedded app (width/height stay constant; only the parent's
|
|
12
|
-
// visual size changes). Devices report the bezel's intended CSS pixel
|
|
13
|
-
// dimensions to the child regardless of the visual scale.
|
|
14
|
-
//
|
|
15
|
-
// Owned by the UI kernel so both the host session-preview surface AND biome
|
|
16
|
-
// canvases (e.g. App Forge's builder) reuse ONE bezel — there is no second
|
|
17
|
-
// device-frame implementation.
|
|
18
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
19
|
-
|
|
20
|
-
import { useLayoutEffect, useRef, useState, type ReactNode } from 'react';
|
|
21
|
-
|
|
22
|
-
import { cn } from '../cn';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Closed set of preview viewports. `desktop`/`tablet`/`mobile` are the
|
|
26
|
-
* device widths an app builder offers; `presentation`/`a4` are
|
|
27
|
-
* document-preview viewports used by the session preview surface only.
|
|
28
|
-
*/
|
|
29
|
-
export type PreviewDevice =
|
|
30
|
-
| 'desktop'
|
|
31
|
-
| 'tablet'
|
|
32
|
-
| 'mobile'
|
|
33
|
-
| 'presentation'
|
|
34
|
-
| 'a4';
|
|
35
|
-
|
|
36
|
-
interface PreviewDeviceFrameProps {
|
|
37
|
-
readonly device: PreviewDevice;
|
|
38
|
-
readonly children: ReactNode;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface Bezel {
|
|
42
|
-
width: number;
|
|
43
|
-
height: number;
|
|
44
|
-
radius: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const BEZELS: Record<
|
|
48
|
-
Exclude<PreviewDevice, 'desktop' | 'presentation' | 'a4'>,
|
|
49
|
-
Bezel
|
|
50
|
-
> = {
|
|
51
|
-
tablet: { width: 768, height: 1024, radius: 18 },
|
|
52
|
-
mobile: { width: 390, height: 844, radius: 36 },
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const PRESENTATION_VIEWPORT: Bezel = { width: 1280, height: 720, radius: 20 };
|
|
56
|
-
// A4 at 96 dpi: 210mm × 297mm → 794×1123 px
|
|
57
|
-
const A4_VIEWPORT: Bezel = { width: 794, height: 1123, radius: 4 };
|
|
58
|
-
|
|
59
|
-
export function PreviewDeviceFrame({
|
|
60
|
-
device,
|
|
61
|
-
children,
|
|
62
|
-
}: PreviewDeviceFrameProps) {
|
|
63
|
-
if (device === 'desktop') {
|
|
64
|
-
return <div className="h-full w-full">{children}</div>;
|
|
65
|
-
}
|
|
66
|
-
if (device === 'presentation') {
|
|
67
|
-
return (
|
|
68
|
-
<ResponsiveViewport bezel={PRESENTATION_VIEWPORT} aspectRatio={16 / 9}>
|
|
69
|
-
{children}
|
|
70
|
-
</ResponsiveViewport>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
if (device === 'a4') {
|
|
74
|
-
return (
|
|
75
|
-
<ResponsiveViewport bezel={A4_VIEWPORT} aspectRatio={794 / 1123}>
|
|
76
|
-
{children}
|
|
77
|
-
</ResponsiveViewport>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return <ScaledBezel bezel={BEZELS[device]}>{children}</ScaledBezel>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
interface ScaledBezelProps {
|
|
84
|
-
readonly bezel: Bezel;
|
|
85
|
-
readonly children: ReactNode;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Render a fixed-size bezel at (bezel.width × bezel.height) CSS px, then
|
|
90
|
-
* scale the whole wrapper down to fit its container. The child inside stays
|
|
91
|
-
* at the bezel's native resolution.
|
|
92
|
-
*/
|
|
93
|
-
function ScaledBezel({ bezel, children }: ScaledBezelProps) {
|
|
94
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
95
|
-
const [scale, setScale] = useState(1);
|
|
96
|
-
|
|
97
|
-
useLayoutEffect(() => {
|
|
98
|
-
const el = containerRef.current;
|
|
99
|
-
if (!el) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const compute = (): void => {
|
|
103
|
-
const { clientWidth, clientHeight } = el;
|
|
104
|
-
if (clientWidth === 0 || clientHeight === 0) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// Leave a tiny margin so the shadow is not clipped.
|
|
108
|
-
const margin = 24;
|
|
109
|
-
const availW = Math.max(0, clientWidth - margin);
|
|
110
|
-
const availH = Math.max(0, clientHeight - margin);
|
|
111
|
-
const next = Math.min(1, availW / bezel.width, availH / bezel.height);
|
|
112
|
-
setScale(next);
|
|
113
|
-
};
|
|
114
|
-
compute();
|
|
115
|
-
const observer = new ResizeObserver(compute);
|
|
116
|
-
observer.observe(el);
|
|
117
|
-
return () => observer.disconnect();
|
|
118
|
-
}, [bezel.width, bezel.height]);
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<div
|
|
122
|
-
ref={containerRef}
|
|
123
|
-
className="flex h-full w-full items-center justify-center overflow-hidden bg-paper-elev/60 p-2"
|
|
124
|
-
>
|
|
125
|
-
<div
|
|
126
|
-
className={cn(
|
|
127
|
-
'relative shrink-0 overflow-hidden bg-paper shadow-2xl ring-1 ring-border/75',
|
|
128
|
-
)}
|
|
129
|
-
style={{
|
|
130
|
-
width: bezel.width,
|
|
131
|
-
height: bezel.height,
|
|
132
|
-
borderRadius: bezel.radius,
|
|
133
|
-
// Scale the WRAPPER — NOT the child element. The child's own
|
|
134
|
-
// width/height in CSS pixels remain bezel.width × bezel.height, so
|
|
135
|
-
// an embedded app sees a stable viewport and no ResizeObserver churn
|
|
136
|
-
// when the outer panel resizes.
|
|
137
|
-
transform: `scale(${scale})`,
|
|
138
|
-
transformOrigin: 'center center',
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
{children}
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface ResponsiveViewportProps extends ScaledBezelProps {
|
|
148
|
-
/** Width-to-height ratio used to letterbox/pillarbox the frame. */
|
|
149
|
-
readonly aspectRatio: number;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Fit an arbitrary-aspect-ratio viewport inside the available space and let
|
|
154
|
-
* the child resize to that real size. Content sees the actual viewport
|
|
155
|
-
* dimensions instead of a transform-scaled shell, so it can adapt responsively.
|
|
156
|
-
*/
|
|
157
|
-
function ResponsiveViewport({
|
|
158
|
-
bezel,
|
|
159
|
-
aspectRatio,
|
|
160
|
-
children,
|
|
161
|
-
}: ResponsiveViewportProps) {
|
|
162
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
163
|
-
const [size, setSize] = useState(() => ({
|
|
164
|
-
width: bezel.width,
|
|
165
|
-
height: bezel.height,
|
|
166
|
-
}));
|
|
167
|
-
|
|
168
|
-
useLayoutEffect(() => {
|
|
169
|
-
const el = containerRef.current;
|
|
170
|
-
if (!el) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const compute = (): void => {
|
|
174
|
-
const { clientWidth, clientHeight } = el;
|
|
175
|
-
if (clientWidth === 0 || clientHeight === 0) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const margin = 24;
|
|
179
|
-
const availW = Math.max(0, clientWidth - margin);
|
|
180
|
-
const availH = Math.max(0, clientHeight - margin);
|
|
181
|
-
const nextWidth = Math.min(availW, availH * aspectRatio);
|
|
182
|
-
const nextHeight = nextWidth / aspectRatio;
|
|
183
|
-
setSize({
|
|
184
|
-
width: Math.max(1, Math.round(nextWidth)),
|
|
185
|
-
height: Math.max(1, Math.round(nextHeight)),
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
compute();
|
|
189
|
-
const observer = new ResizeObserver(compute);
|
|
190
|
-
observer.observe(el);
|
|
191
|
-
return () => observer.disconnect();
|
|
192
|
-
}, [aspectRatio, bezel.width, bezel.height]);
|
|
193
|
-
|
|
194
|
-
return (
|
|
195
|
-
<div
|
|
196
|
-
ref={containerRef}
|
|
197
|
-
className="flex h-full w-full items-center justify-center overflow-hidden bg-paper-elev/60 p-2"
|
|
198
|
-
>
|
|
199
|
-
<div
|
|
200
|
-
className={cn(
|
|
201
|
-
'relative shrink-0 overflow-hidden bg-paper shadow-2xl ring-1 ring-border/75',
|
|
202
|
-
)}
|
|
203
|
-
style={{
|
|
204
|
-
width: size.width,
|
|
205
|
-
height: size.height,
|
|
206
|
-
borderRadius: bezel.radius,
|
|
207
|
-
}}
|
|
208
|
-
>
|
|
209
|
-
{children}
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
2
|
-
import { Circle } from "lucide-react";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from '../cn';
|
|
6
|
-
|
|
7
|
-
const RadioGroup = React.forwardRef<
|
|
8
|
-
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
10
|
-
>(({ className, ...props }, ref) => {
|
|
11
|
-
return <RadioGroupPrimitive.Root className={cn("grid gap-2", className)} {...props} ref={ref} />;
|
|
12
|
-
});
|
|
13
|
-
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
14
|
-
|
|
15
|
-
const RadioGroupItem = React.forwardRef<
|
|
16
|
-
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
17
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
18
|
-
>(({ className, ...props }, ref) => {
|
|
19
|
-
return (
|
|
20
|
-
<RadioGroupPrimitive.Item
|
|
21
|
-
ref={ref}
|
|
22
|
-
className={cn(
|
|
23
|
-
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
24
|
-
className,
|
|
25
|
-
)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
29
|
-
<Circle className="h-4 w-4 fill-current text-current" />
|
|
30
|
-
</RadioGroupPrimitive.Indicator>
|
|
31
|
-
</RadioGroupPrimitive.Item>
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
35
|
-
|
|
36
|
-
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { GripVertical, GripHorizontal } from "lucide-react"
|
|
2
|
-
import { Group, Panel, Separator } from "react-resizable-panels"
|
|
3
|
-
|
|
4
|
-
import { cn } from '../cn'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Wrapper around react-resizable-panels v4.
|
|
8
|
-
*
|
|
9
|
-
* v4 API changes from v2/v3:
|
|
10
|
-
* - PanelGroup → Group
|
|
11
|
-
* - Panel (unchanged)
|
|
12
|
-
* - PanelResizeHandle → Separator
|
|
13
|
-
* - `direction` prop → `orientation` prop
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
type Direction = "horizontal" | "vertical"
|
|
17
|
-
|
|
18
|
-
const ResizablePanelGroup = ({
|
|
19
|
-
className,
|
|
20
|
-
direction,
|
|
21
|
-
...props
|
|
22
|
-
}: Omit<React.ComponentProps<typeof Group>, "orientation"> & {
|
|
23
|
-
direction?: Direction
|
|
24
|
-
}) => (
|
|
25
|
-
<Group
|
|
26
|
-
orientation={direction}
|
|
27
|
-
className={cn("flex h-full w-full", className)}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const ResizablePanel = Panel
|
|
33
|
-
|
|
34
|
-
const ResizableHandle = ({
|
|
35
|
-
withHandle,
|
|
36
|
-
className,
|
|
37
|
-
direction,
|
|
38
|
-
...props
|
|
39
|
-
}: React.ComponentProps<typeof Separator> & {
|
|
40
|
-
withHandle?: boolean
|
|
41
|
-
direction?: Direction
|
|
42
|
-
}) => (
|
|
43
|
-
<Separator
|
|
44
|
-
className={cn(
|
|
45
|
-
"relative flex items-center justify-center bg-border/60 hover:bg-border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 transition-colors",
|
|
46
|
-
direction === "vertical"
|
|
47
|
-
? "h-px w-full cursor-row-resize after:absolute after:left-0 after:h-2 after:w-full after:-translate-y-1/2"
|
|
48
|
-
: "w-[3px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2",
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
>
|
|
53
|
-
{withHandle && (
|
|
54
|
-
<div className={cn(
|
|
55
|
-
"z-10 flex items-center justify-center rounded-sm border bg-border",
|
|
56
|
-
direction === "vertical" ? "w-4 h-3" : "h-4 w-3"
|
|
57
|
-
)}>
|
|
58
|
-
{direction === "vertical"
|
|
59
|
-
? <GripHorizontal className="h-4 w-4" />
|
|
60
|
-
: <GripVertical className="h-4 w-4" />
|
|
61
|
-
}
|
|
62
|
-
</div>
|
|
63
|
-
)}
|
|
64
|
-
</Separator>
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from '../cn';
|
|
5
|
-
|
|
6
|
-
const ScrollArea = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
9
|
-
>(({ className, children, ...props }, ref) => (
|
|
10
|
-
<ScrollAreaPrimitive.Root ref={ref} className={cn("relative overflow-hidden", className)} {...props}>
|
|
11
|
-
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
|
|
12
|
-
<ScrollBar />
|
|
13
|
-
<ScrollAreaPrimitive.Corner />
|
|
14
|
-
</ScrollAreaPrimitive.Root>
|
|
15
|
-
));
|
|
16
|
-
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
17
|
-
|
|
18
|
-
const ScrollBar = React.forwardRef<
|
|
19
|
-
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
20
|
-
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
21
|
-
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
22
|
-
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
23
|
-
ref={ref}
|
|
24
|
-
orientation={orientation}
|
|
25
|
-
className={cn(
|
|
26
|
-
"flex touch-none select-none transition-colors",
|
|
27
|
-
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
28
|
-
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
29
|
-
className,
|
|
30
|
-
)}
|
|
31
|
-
{...props}
|
|
32
|
-
>
|
|
33
|
-
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
34
|
-
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
35
|
-
));
|
|
36
|
-
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
37
|
-
|
|
38
|
-
export { ScrollArea, ScrollBar };
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
-
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from '../cn';
|
|
6
|
-
|
|
7
|
-
const Select = SelectPrimitive.Root;
|
|
8
|
-
|
|
9
|
-
const SelectGroup = SelectPrimitive.Group;
|
|
10
|
-
|
|
11
|
-
const SelectValue = SelectPrimitive.Value;
|
|
12
|
-
|
|
13
|
-
const SelectTrigger = React.forwardRef<
|
|
14
|
-
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
-
>(({ className, children, ...props }, ref) => (
|
|
17
|
-
<SelectPrimitive.Trigger
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn(
|
|
20
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-body-1 ring-offset-background placeholder:text-ink-3 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
<SelectPrimitive.Icon asChild>
|
|
27
|
-
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
-
</SelectPrimitive.Icon>
|
|
29
|
-
</SelectPrimitive.Trigger>
|
|
30
|
-
));
|
|
31
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
-
|
|
33
|
-
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
-
>(({ className, ...props }, ref) => (
|
|
37
|
-
<SelectPrimitive.ScrollUpButton
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<ChevronUp className="h-4 w-4" />
|
|
43
|
-
</SelectPrimitive.ScrollUpButton>
|
|
44
|
-
));
|
|
45
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
46
|
-
|
|
47
|
-
const SelectScrollDownButton = React.forwardRef<
|
|
48
|
-
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
49
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
50
|
-
>(({ className, ...props }, ref) => (
|
|
51
|
-
<SelectPrimitive.ScrollDownButton
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<ChevronDown className="h-4 w-4" />
|
|
57
|
-
</SelectPrimitive.ScrollDownButton>
|
|
58
|
-
));
|
|
59
|
-
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
60
|
-
|
|
61
|
-
const SelectContent = React.forwardRef<
|
|
62
|
-
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
63
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
64
|
-
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
65
|
-
<SelectPrimitive.Portal>
|
|
66
|
-
<SelectPrimitive.Content
|
|
67
|
-
ref={ref}
|
|
68
|
-
className={cn(
|
|
69
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md 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",
|
|
70
|
-
position === "popper" &&
|
|
71
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
72
|
-
className,
|
|
73
|
-
)}
|
|
74
|
-
position={position}
|
|
75
|
-
{...props}
|
|
76
|
-
>
|
|
77
|
-
<SelectScrollUpButton />
|
|
78
|
-
<SelectPrimitive.Viewport
|
|
79
|
-
className={cn(
|
|
80
|
-
"p-1",
|
|
81
|
-
position === "popper" &&
|
|
82
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
83
|
-
)}
|
|
84
|
-
>
|
|
85
|
-
{children}
|
|
86
|
-
</SelectPrimitive.Viewport>
|
|
87
|
-
<SelectScrollDownButton />
|
|
88
|
-
</SelectPrimitive.Content>
|
|
89
|
-
</SelectPrimitive.Portal>
|
|
90
|
-
));
|
|
91
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
92
|
-
|
|
93
|
-
const SelectLabel = React.forwardRef<
|
|
94
|
-
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
95
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
96
|
-
>(({ className, ...props }, ref) => (
|
|
97
|
-
<SelectPrimitive.Label ref={ref} className={cn("py-1.5 pl-8 pr-2 text-body-1 font-semibold", className)} {...props} />
|
|
98
|
-
));
|
|
99
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
100
|
-
|
|
101
|
-
const SelectItem = React.forwardRef<
|
|
102
|
-
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
103
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
104
|
-
>(({ className, children, ...props }, ref) => (
|
|
105
|
-
<SelectPrimitive.Item
|
|
106
|
-
ref={ref}
|
|
107
|
-
className={cn(
|
|
108
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-body-1 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",
|
|
109
|
-
className,
|
|
110
|
-
)}
|
|
111
|
-
{...props}
|
|
112
|
-
>
|
|
113
|
-
<span className="absolute left-2 flex h-4 w-4 items-center justify-center">
|
|
114
|
-
<SelectPrimitive.ItemIndicator>
|
|
115
|
-
<Check className="h-4 w-4" />
|
|
116
|
-
</SelectPrimitive.ItemIndicator>
|
|
117
|
-
</span>
|
|
118
|
-
|
|
119
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
120
|
-
</SelectPrimitive.Item>
|
|
121
|
-
));
|
|
122
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
123
|
-
|
|
124
|
-
const SelectSeparator = React.forwardRef<
|
|
125
|
-
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
126
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
127
|
-
>(({ className, ...props }, ref) => (
|
|
128
|
-
<SelectPrimitive.Separator ref={ref} className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} />
|
|
129
|
-
));
|
|
130
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
131
|
-
|
|
132
|
-
export {
|
|
133
|
-
Select,
|
|
134
|
-
SelectGroup,
|
|
135
|
-
SelectValue,
|
|
136
|
-
SelectTrigger,
|
|
137
|
-
SelectContent,
|
|
138
|
-
SelectLabel,
|
|
139
|
-
SelectItem,
|
|
140
|
-
SelectSeparator,
|
|
141
|
-
SelectScrollUpButton,
|
|
142
|
-
SelectScrollDownButton,
|
|
143
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from '../cn';
|
|
5
|
-
|
|
6
|
-
const Separator = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
-
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
10
|
-
<SeparatorPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
decorative={decorative}
|
|
13
|
-
orientation={orientation}
|
|
14
|
-
className={cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className)}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
));
|
|
18
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
19
|
-
|
|
20
|
-
export { Separator };
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
-
import { X } from "lucide-react";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from '../cn';
|
|
7
|
-
|
|
8
|
-
const Sheet = SheetPrimitive.Root;
|
|
9
|
-
|
|
10
|
-
const SheetTrigger = SheetPrimitive.Trigger;
|
|
11
|
-
|
|
12
|
-
const SheetClose = SheetPrimitive.Close;
|
|
13
|
-
|
|
14
|
-
const SheetPortal = SheetPrimitive.Portal;
|
|
15
|
-
|
|
16
|
-
const SheetOverlay = React.forwardRef<
|
|
17
|
-
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
18
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
19
|
-
>(({ className, ...props }, ref) => (
|
|
20
|
-
<SheetPrimitive.Overlay
|
|
21
|
-
className={cn(
|
|
22
|
-
"modal-scrim fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
23
|
-
className,
|
|
24
|
-
)}
|
|
25
|
-
{...props}
|
|
26
|
-
ref={ref}
|
|
27
|
-
/>
|
|
28
|
-
));
|
|
29
|
-
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
30
|
-
|
|
31
|
-
const sheetVariants = cva(
|
|
32
|
-
"modal-surface fixed z-50 gap-4 p-6 transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
33
|
-
{
|
|
34
|
-
variants: {
|
|
35
|
-
side: {
|
|
36
|
-
top: "inset-x-0 top-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
37
|
-
bottom:
|
|
38
|
-
"inset-x-0 bottom-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
39
|
-
left: "inset-y-0 left-0 h-full w-3/4 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
40
|
-
right:
|
|
41
|
-
"inset-y-0 right-0 h-full w-3/4 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
defaultVariants: {
|
|
45
|
-
side: "right",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
interface SheetContentProps
|
|
51
|
-
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
52
|
-
VariantProps<typeof sheetVariants> {}
|
|
53
|
-
|
|
54
|
-
const SheetContent = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(
|
|
55
|
-
({ side = "right", className, children, ...props }, ref) => (
|
|
56
|
-
<SheetPortal>
|
|
57
|
-
<SheetOverlay />
|
|
58
|
-
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
59
|
-
{children}
|
|
60
|
-
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm text-ink-3 ring-offset-background transition-colors hover:text-ink focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
|
|
61
|
-
<X className="h-4 w-4" />
|
|
62
|
-
<span className="sr-only">Close</span>
|
|
63
|
-
</SheetPrimitive.Close>
|
|
64
|
-
</SheetPrimitive.Content>
|
|
65
|
-
</SheetPortal>
|
|
66
|
-
),
|
|
67
|
-
);
|
|
68
|
-
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
69
|
-
|
|
70
|
-
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
-
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
72
|
-
);
|
|
73
|
-
SheetHeader.displayName = "SheetHeader";
|
|
74
|
-
|
|
75
|
-
const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
76
|
-
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
77
|
-
);
|
|
78
|
-
SheetFooter.displayName = "SheetFooter";
|
|
79
|
-
|
|
80
|
-
const SheetTitle = React.forwardRef<
|
|
81
|
-
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
82
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
83
|
-
>(({ className, ...props }, ref) => (
|
|
84
|
-
<SheetPrimitive.Title ref={ref} className={cn("text-subtitle font-semibold text-foreground", className)} {...props} />
|
|
85
|
-
));
|
|
86
|
-
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
87
|
-
|
|
88
|
-
const SheetDescription = React.forwardRef<
|
|
89
|
-
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
90
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
91
|
-
>(({ className, ...props }, ref) => (
|
|
92
|
-
<SheetPrimitive.Description ref={ref} className={cn("text-body-1 text-ink-3", className)} {...props} />
|
|
93
|
-
));
|
|
94
|
-
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
95
|
-
|
|
96
|
-
export {
|
|
97
|
-
Sheet,
|
|
98
|
-
SheetClose,
|
|
99
|
-
SheetContent,
|
|
100
|
-
SheetDescription,
|
|
101
|
-
SheetFooter,
|
|
102
|
-
SheetHeader,
|
|
103
|
-
SheetOverlay,
|
|
104
|
-
SheetPortal,
|
|
105
|
-
SheetTitle,
|
|
106
|
-
SheetTrigger,
|
|
107
|
-
};
|