@cueplusplus/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/_token.js +39 -0
- package/dist/charts/container.d.ts +58 -0
- package/dist/charts/container.js +77 -0
- package/dist/charts/index.d.ts +5 -0
- package/dist/charts/index.js +5 -0
- package/dist/charts/ramps.d.ts +140 -0
- package/dist/charts/ramps.js +615 -0
- package/dist/charts/theme.d.ts +112 -0
- package/dist/charts/theme.js +165 -0
- package/dist/charts/tones.d.ts +111 -0
- package/dist/charts/tones.js +127 -0
- package/dist/chat/_glyphs.js +55 -0
- package/dist/chat/agent-color.d.ts +84 -0
- package/dist/chat/agent-color.js +101 -0
- package/dist/chat/agent-pile.d.ts +55 -0
- package/dist/chat/agent-pile.js +121 -0
- package/dist/chat/ask-box.d.ts +88 -0
- package/dist/chat/ask-box.js +341 -0
- package/dist/chat/composer.d.ts +66 -0
- package/dist/chat/composer.js +144 -0
- package/dist/chat/delegation-card.d.ts +60 -0
- package/dist/chat/delegation-card.js +129 -0
- package/dist/chat/index.d.ts +8 -0
- package/dist/chat/index.js +8 -0
- package/dist/chat/message-list.d.ts +39 -0
- package/dist/chat/message-list.js +105 -0
- package/dist/chat/message.d.ts +47 -0
- package/dist/chat/message.js +108 -0
- package/dist/chrome/_glyphs.js +101 -0
- package/dist/chrome/_tabs-scroll.d.ts +62 -0
- package/dist/chrome/_tabs-scroll.js +68 -0
- package/dist/chrome/_tree.d.ts +75 -0
- package/dist/chrome/_tree.js +49 -0
- package/dist/chrome/empty-state.d.ts +37 -0
- package/dist/chrome/empty-state.js +57 -0
- package/dist/chrome/eyebrow.d.ts +29 -0
- package/dist/chrome/eyebrow.js +36 -0
- package/dist/chrome/index.d.ts +17 -0
- package/dist/chrome/index.js +17 -0
- package/dist/chrome/navigation-menu.d.ts +80 -0
- package/dist/chrome/navigation-menu.js +121 -0
- package/dist/chrome/page-shell.d.ts +38 -0
- package/dist/chrome/page-shell.js +66 -0
- package/dist/chrome/panel.d.ts +55 -0
- package/dist/chrome/panel.js +67 -0
- package/dist/chrome/row.d.ts +82 -0
- package/dist/chrome/row.js +106 -0
- package/dist/chrome/scroll-area.d.ts +39 -0
- package/dist/chrome/scroll-area.js +70 -0
- package/dist/chrome/section-header.d.ts +42 -0
- package/dist/chrome/section-header.js +79 -0
- package/dist/chrome/segmented-control.d.ts +58 -0
- package/dist/chrome/segmented-control.js +76 -0
- package/dist/chrome/status-bar.d.ts +46 -0
- package/dist/chrome/status-bar.js +56 -0
- package/dist/chrome/tabs.d.ts +80 -0
- package/dist/chrome/tabs.js +176 -0
- package/dist/chrome/title-bar.d.ts +37 -0
- package/dist/chrome/title-bar.js +45 -0
- package/dist/chrome/toolbar.d.ts +46 -0
- package/dist/chrome/toolbar.js +62 -0
- package/dist/chrome/tree.d.ts +98 -0
- package/dist/chrome/tree.js +248 -0
- package/dist/color/_checker.js +14 -0
- package/dist/color/_convert.d.ts +52 -0
- package/dist/color/_convert.js +66 -0
- package/dist/color/_glyphs.js +28 -0
- package/dist/color/_thumb.js +15 -0
- package/dist/color/_value.js +28 -0
- package/dist/color/color-area.d.ts +27 -0
- package/dist/color/color-area.js +40 -0
- package/dist/color/color-field.d.ts +32 -0
- package/dist/color/color-field.js +43 -0
- package/dist/color/color-picker.d.ts +71 -0
- package/dist/color/color-picker.js +178 -0
- package/dist/color/color-slider.d.ts +31 -0
- package/dist/color/color-slider.js +51 -0
- package/dist/color/color-swatch.d.ts +32 -0
- package/dist/color/color-swatch.js +44 -0
- package/dist/color/index.d.ts +7 -0
- package/dist/color/index.js +7 -0
- package/dist/configurator/_export.d.ts +78 -0
- package/dist/configurator/_export.js +261 -0
- package/dist/configurator/_glyphs.js +92 -0
- package/dist/configurator/_overrides.d.ts +247 -0
- package/dist/configurator/_overrides.js +514 -0
- package/dist/configurator/configurator.d.ts +71 -0
- package/dist/configurator/configurator.js +279 -0
- package/dist/configurator/export-dialog.d.ts +30 -0
- package/dist/configurator/export-dialog.js +121 -0
- package/dist/configurator/index.d.ts +8 -0
- package/dist/configurator/index.js +8 -0
- package/dist/configurator/panel-sections.d.ts +86 -0
- package/dist/configurator/panel-sections.js +316 -0
- package/dist/configurator/token-editor.d.ts +74 -0
- package/dist/configurator/token-editor.js +149 -0
- package/dist/configurator/use-zoom.d.ts +87 -0
- package/dist/configurator/use-zoom.js +113 -0
- package/dist/date/_glyphs.js +34 -0
- package/dist/date/_segments.js +55 -0
- package/dist/date/_trigger.js +31 -0
- package/dist/date/calendar.d.ts +25 -0
- package/dist/date/calendar.js +125 -0
- package/dist/date/date-field.d.ts +34 -0
- package/dist/date/date-field.js +41 -0
- package/dist/date/date-picker.d.ts +69 -0
- package/dist/date/date-picker.js +89 -0
- package/dist/date/date-range-picker.d.ts +65 -0
- package/dist/date/date-range-picker.js +92 -0
- package/dist/date/index.d.ts +6 -0
- package/dist/date/index.js +6 -0
- package/dist/date/time-field.d.ts +29 -0
- package/dist/date/time-field.js +36 -0
- package/dist/dmx/_ramp.d.ts +77 -0
- package/dist/dmx/_ramp.js +169 -0
- package/dist/dmx/_readout.js +53 -0
- package/dist/dmx/_universe.d.ts +105 -0
- package/dist/dmx/_universe.js +112 -0
- package/dist/dmx/channel-matrix.d.ts +81 -0
- package/dist/dmx/channel-matrix.js +285 -0
- package/dist/dmx/dmx-bar.d.ts +50 -0
- package/dist/dmx/dmx-bar.js +107 -0
- package/dist/dmx/dmx-strip.d.ts +41 -0
- package/dist/dmx/dmx-strip.js +196 -0
- package/dist/dmx/index.d.ts +7 -0
- package/dist/dmx/index.js +7 -0
- package/dist/dmx/universe-grid.d.ts +61 -0
- package/dist/dmx/universe-grid.js +182 -0
- package/dist/flow/_frame.d.ts +52 -0
- package/dist/flow/_frame.js +38 -0
- package/dist/flow/controls.d.ts +41 -0
- package/dist/flow/controls.js +53 -0
- package/dist/flow/flow.css +121 -0
- package/dist/flow/handles.d.ts +40 -0
- package/dist/flow/handles.js +61 -0
- package/dist/flow/index.d.ts +7 -0
- package/dist/flow/index.js +7 -0
- package/dist/flow/node-card.d.ts +71 -0
- package/dist/flow/node-card.js +102 -0
- package/dist/flow/signal-edge.d.ts +60 -0
- package/dist/flow/signal-edge.js +108 -0
- package/dist/flow/use-flow-theme.d.ts +69 -0
- package/dist/flow/use-flow-theme.js +109 -0
- package/dist/forms/_chassis.d.ts +64 -0
- package/dist/forms/_chassis.js +59 -0
- package/dist/forms/_glyphs.js +143 -0
- package/dist/forms/_listbox.js +55 -0
- package/dist/forms/autocomplete.d.ts +61 -0
- package/dist/forms/autocomplete.js +88 -0
- package/dist/forms/button-group.d.ts +47 -0
- package/dist/forms/button-group.js +52 -0
- package/dist/forms/checkbox.d.ts +51 -0
- package/dist/forms/checkbox.js +98 -0
- package/dist/forms/combobox.d.ts +73 -0
- package/dist/forms/combobox.js +108 -0
- package/dist/forms/env-var-input.d.ts +74 -0
- package/dist/forms/env-var-input.js +116 -0
- package/dist/forms/field.d.ts +89 -0
- package/dist/forms/field.js +102 -0
- package/dist/forms/file-upload.d.ts +113 -0
- package/dist/forms/file-upload.js +232 -0
- package/dist/forms/index.d.ts +26 -0
- package/dist/forms/index.js +26 -0
- package/dist/forms/input-group.d.ts +31 -0
- package/dist/forms/input-group.js +54 -0
- package/dist/forms/input.d.ts +33 -0
- package/dist/forms/input.js +36 -0
- package/dist/forms/multi-select.d.ts +62 -0
- package/dist/forms/multi-select.js +107 -0
- package/dist/forms/number-field.d.ts +38 -0
- package/dist/forms/number-field.js +64 -0
- package/dist/forms/otp-field.d.ts +54 -0
- package/dist/forms/otp-field.js +59 -0
- package/dist/forms/password-input.d.ts +46 -0
- package/dist/forms/password-input.js +62 -0
- package/dist/forms/radio-group.d.ts +50 -0
- package/dist/forms/radio-group.js +64 -0
- package/dist/forms/rating.d.ts +69 -0
- package/dist/forms/rating.js +103 -0
- package/dist/forms/scrub-input.d.ts +81 -0
- package/dist/forms/scrub-input.js +249 -0
- package/dist/forms/search-input.d.ts +54 -0
- package/dist/forms/search-input.js +112 -0
- package/dist/forms/select.d.ts +75 -0
- package/dist/forms/select.js +91 -0
- package/dist/forms/slider.d.ts +44 -0
- package/dist/forms/slider.js +65 -0
- package/dist/forms/switch.d.ts +36 -0
- package/dist/forms/switch.js +71 -0
- package/dist/forms/tags-input.d.ts +69 -0
- package/dist/forms/tags-input.js +148 -0
- package/dist/forms/textarea.d.ts +27 -0
- package/dist/forms/textarea.js +37 -0
- package/dist/forms/toggle-group.d.ts +41 -0
- package/dist/forms/toggle-group.js +56 -0
- package/dist/forms/toggle.d.ts +41 -0
- package/dist/forms/toggle.js +100 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +104 -0
- package/dist/instruments/_ansi.js +116 -0
- package/dist/instruments/_glyphs.js +90 -0
- package/dist/instruments/_motion.js +56 -0
- package/dist/instruments/_rem.js +21 -0
- package/dist/instruments/app-window-frame.d.ts +48 -0
- package/dist/instruments/app-window-frame.js +76 -0
- package/dist/instruments/copy-button.d.ts +41 -0
- package/dist/instruments/copy-button.js +112 -0
- package/dist/instruments/data-table.d.ts +168 -0
- package/dist/instruments/data-table.js +212 -0
- package/dist/instruments/group-bar.d.ts +63 -0
- package/dist/instruments/group-bar.js +122 -0
- package/dist/instruments/index.d.ts +13 -0
- package/dist/instruments/index.js +13 -0
- package/dist/instruments/log-viewer.d.ts +74 -0
- package/dist/instruments/log-viewer.js +215 -0
- package/dist/instruments/meter.d.ts +77 -0
- package/dist/instruments/meter.js +96 -0
- package/dist/instruments/progress.d.ts +45 -0
- package/dist/instruments/progress.js +61 -0
- package/dist/instruments/seam-grid.d.ts +66 -0
- package/dist/instruments/seam-grid.js +78 -0
- package/dist/instruments/sparkline.d.ts +39 -0
- package/dist/instruments/sparkline.js +85 -0
- package/dist/instruments/stat.d.ts +35 -0
- package/dist/instruments/stat.js +59 -0
- package/dist/instruments/table.d.ts +51 -0
- package/dist/instruments/table.js +92 -0
- package/dist/instruments/terminal-frame.d.ts +89 -0
- package/dist/instruments/terminal-frame.js +256 -0
- package/dist/instruments/two-step-button.d.ts +47 -0
- package/dist/instruments/two-step-button.js +147 -0
- package/dist/instruments/usage-chart.d.ts +55 -0
- package/dist/instruments/usage-chart.js +235 -0
- package/dist/layout/_collapse.js +46 -0
- package/dist/layout/_glyphs.js +45 -0
- package/dist/layout/accordion.d.ts +52 -0
- package/dist/layout/accordion.js +81 -0
- package/dist/layout/breadcrumb.d.ts +35 -0
- package/dist/layout/breadcrumb.js +67 -0
- package/dist/layout/card.d.ts +51 -0
- package/dist/layout/card.js +76 -0
- package/dist/layout/carousel.d.ts +96 -0
- package/dist/layout/carousel.js +211 -0
- package/dist/layout/collapsible.d.ts +74 -0
- package/dist/layout/collapsible.js +126 -0
- package/dist/layout/container.d.ts +27 -0
- package/dist/layout/container.js +40 -0
- package/dist/layout/description-list.d.ts +24 -0
- package/dist/layout/description-list.js +37 -0
- package/dist/layout/grid.d.ts +40 -0
- package/dist/layout/grid.js +48 -0
- package/dist/layout/index.d.ts +15 -0
- package/dist/layout/index.js +15 -0
- package/dist/layout/item.d.ts +65 -0
- package/dist/layout/item.js +100 -0
- package/dist/layout/link.d.ts +48 -0
- package/dist/layout/link.js +63 -0
- package/dist/layout/pagination.d.ts +54 -0
- package/dist/layout/pagination.js +121 -0
- package/dist/layout/resizable.d.ts +38 -0
- package/dist/layout/resizable.js +68 -0
- package/dist/layout/sidebar.d.ts +67 -0
- package/dist/layout/sidebar.js +129 -0
- package/dist/layout/stack.d.ts +46 -0
- package/dist/layout/stack.js +62 -0
- package/dist/layout/stepper.d.ts +49 -0
- package/dist/layout/stepper.js +81 -0
- package/dist/layout/timeline.d.ts +43 -0
- package/dist/layout/timeline.js +63 -0
- package/dist/lib/aria-class.js +24 -0
- package/dist/lib/cn.js +18 -0
- package/dist/lib/compose.js +38 -0
- package/dist/lib/cva.d.ts +18 -0
- package/dist/lib/cva.js +65 -0
- package/dist/midi/_notes.d.ts +101 -0
- package/dist/midi/_notes.js +183 -0
- package/dist/midi/_ruler.d.ts +100 -0
- package/dist/midi/_ruler.js +105 -0
- package/dist/midi/_time.d.ts +107 -0
- package/dist/midi/_time.js +130 -0
- package/dist/midi/index.d.ts +9 -0
- package/dist/midi/index.js +9 -0
- package/dist/midi/musical-time-input.d.ts +48 -0
- package/dist/midi/musical-time-input.js +154 -0
- package/dist/midi/piano-keyboard.d.ts +50 -0
- package/dist/midi/piano-keyboard.js +193 -0
- package/dist/midi/spectrum-visualizer.d.ts +65 -0
- package/dist/midi/spectrum-visualizer.js +213 -0
- package/dist/midi/threshold-rail.d.ts +72 -0
- package/dist/midi/threshold-rail.js +214 -0
- package/dist/midi/timeline-ruler.d.ts +83 -0
- package/dist/midi/timeline-ruler.js +152 -0
- package/dist/overlays/_debounce.js +34 -0
- package/dist/overlays/_glyphs.js +59 -0
- package/dist/overlays/_surface.d.ts +70 -0
- package/dist/overlays/_surface.js +70 -0
- package/dist/overlays/_wheel.js +42 -0
- package/dist/overlays/alert-dialog.d.ts +67 -0
- package/dist/overlays/alert-dialog.js +117 -0
- package/dist/overlays/command-palette.d.ts +93 -0
- package/dist/overlays/command-palette.js +193 -0
- package/dist/overlays/context-menu.d.ts +64 -0
- package/dist/overlays/context-menu.js +78 -0
- package/dist/overlays/dialog.d.ts +72 -0
- package/dist/overlays/dialog.js +124 -0
- package/dist/overlays/drawer.d.ts +75 -0
- package/dist/overlays/drawer.js +151 -0
- package/dist/overlays/dropdown-menu.d.ts +79 -0
- package/dist/overlays/dropdown-menu.js +156 -0
- package/dist/overlays/hover-card.d.ts +58 -0
- package/dist/overlays/hover-card.js +91 -0
- package/dist/overlays/index.d.ts +15 -0
- package/dist/overlays/index.js +15 -0
- package/dist/overlays/info-tip.d.ts +41 -0
- package/dist/overlays/info-tip.js +45 -0
- package/dist/overlays/menubar.d.ts +72 -0
- package/dist/overlays/menubar.js +100 -0
- package/dist/overlays/popover.d.ts +66 -0
- package/dist/overlays/popover.js +114 -0
- package/dist/overlays/sheet.d.ts +78 -0
- package/dist/overlays/sheet.js +131 -0
- package/dist/overlays/toast.d.ts +106 -0
- package/dist/overlays/toast.js +146 -0
- package/dist/overlays/tooltip.d.ts +57 -0
- package/dist/overlays/tooltip.js +95 -0
- package/dist/primitives/avatar.d.ts +51 -0
- package/dist/primitives/avatar.js +93 -0
- package/dist/primitives/button.d.ts +46 -0
- package/dist/primitives/button.js +94 -0
- package/dist/primitives/chip.d.ts +47 -0
- package/dist/primitives/chip.js +152 -0
- package/dist/primitives/icon-button.d.ts +41 -0
- package/dist/primitives/icon-button.js +59 -0
- package/dist/primitives/index.d.ts +10 -0
- package/dist/primitives/index.js +10 -0
- package/dist/primitives/kbd.d.ts +17 -0
- package/dist/primitives/kbd.js +24 -0
- package/dist/primitives/separator.d.ts +25 -0
- package/dist/primitives/separator.js +30 -0
- package/dist/primitives/skeleton.d.ts +20 -0
- package/dist/primitives/skeleton.js +27 -0
- package/dist/primitives/spinner.d.ts +26 -0
- package/dist/primitives/spinner.js +31 -0
- package/dist/primitives/status-dot.d.ts +44 -0
- package/dist/primitives/status-dot.js +50 -0
- package/dist/styles.css +19 -0
- package/dist/system/density.d.ts +33 -0
- package/dist/system/density.js +49 -0
- package/dist/system/index.d.ts +8 -0
- package/dist/system/index.js +7 -0
- package/dist/system/portal.d.ts +51 -0
- package/dist/system/portal.js +122 -0
- package/dist/system/prepaint.d.ts +38 -0
- package/dist/system/prepaint.js +37 -0
- package/dist/system/theme-provider.d.ts +72 -0
- package/dist/system/theme-provider.js +252 -0
- package/dist/system/use-density.d.ts +33 -0
- package/dist/system/use-density.js +84 -0
- package/dist/system/use-isomorphic-layout-effect.js +15 -0
- package/dist/system/use-theme.d.ts +19 -0
- package/dist/system/use-theme.js +25 -0
- package/dist/theming/_presets.d.ts +11 -0
- package/dist/theming/_presets.js +487 -0
- package/dist/theming/contrast.d.ts +110 -0
- package/dist/theming/contrast.js +167 -0
- package/dist/theming/create-theme.d.ts +165 -0
- package/dist/theming/create-theme.js +442 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +5 -0
- package/dist/theming/serialize.d.ts +145 -0
- package/dist/theming/serialize.js +165 -0
- package/package.json +216 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* A padded container for one thing: a summary, a setting group, a preview.
|
|
6
|
+
*
|
|
7
|
+
* Every section paints its own `surface-1` ground, which is what lets the root
|
|
8
|
+
* switch to the seam idiom without any of the parts knowing.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Card.Root seam>
|
|
12
|
+
* <Card.Header><Card.Title>Failover</Card.Title></Card.Header>
|
|
13
|
+
* <Card.Content>…</Card.Content>
|
|
14
|
+
* </Card.Root>
|
|
15
|
+
*/
|
|
16
|
+
const Card = {
|
|
17
|
+
Root: React.forwardRef(function CardRoot({ className, seam = false, ...elementProps }, ref) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
ref,
|
|
20
|
+
"data-slot": "card",
|
|
21
|
+
"data-seam": seam ? "" : void 0,
|
|
22
|
+
className: cn("group/card flex flex-col overflow-hidden rounded-(--radius-surface) border border-border", seam ? "gap-px bg-border" : "bg-surface-1", className),
|
|
23
|
+
...elementProps
|
|
24
|
+
});
|
|
25
|
+
}),
|
|
26
|
+
Header: React.forwardRef(function CardHeader({ className, actions, children, ...elementProps }, ref) {
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
ref,
|
|
29
|
+
"data-slot": "card-header",
|
|
30
|
+
className: cn("flex items-start justify-between gap-(--cue-space-4) bg-surface-1 px-(--cue-space-5) pt-(--cue-space-5) pb-0 group-data-[seam]/card:pb-(--cue-space-5)", className),
|
|
31
|
+
...elementProps,
|
|
32
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: "flex min-w-0 flex-col gap-(--cue-space-1)",
|
|
34
|
+
children
|
|
35
|
+
}), actions === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
36
|
+
"data-slot": "card-header-actions",
|
|
37
|
+
className: "flex shrink-0 items-center gap-(--cue-space-2)",
|
|
38
|
+
children: actions
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}),
|
|
42
|
+
Title: React.forwardRef(function CardTitle({ className, ...elementProps }, ref) {
|
|
43
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
44
|
+
ref,
|
|
45
|
+
"data-slot": "card-title",
|
|
46
|
+
className: cn("font-mono text-(length:--cue-text-emphasis) font-medium text-fg", className),
|
|
47
|
+
...elementProps
|
|
48
|
+
});
|
|
49
|
+
}),
|
|
50
|
+
Description: React.forwardRef(function CardDescription({ className, ...elementProps }, ref) {
|
|
51
|
+
return /* @__PURE__ */ jsx("p", {
|
|
52
|
+
ref,
|
|
53
|
+
"data-slot": "card-description",
|
|
54
|
+
className: cn("font-mono text-(length:--cue-text-ui) leading-relaxed text-fg-muted", className),
|
|
55
|
+
...elementProps
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
Content: React.forwardRef(function CardContent({ className, ...elementProps }, ref) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
ref,
|
|
61
|
+
"data-slot": "card-content",
|
|
62
|
+
className: cn("bg-surface-1 p-(--cue-space-5)", className),
|
|
63
|
+
...elementProps
|
|
64
|
+
});
|
|
65
|
+
}),
|
|
66
|
+
Footer: React.forwardRef(function CardFooter({ className, ...elementProps }, ref) {
|
|
67
|
+
return /* @__PURE__ */ jsx("div", {
|
|
68
|
+
ref,
|
|
69
|
+
"data-slot": "card-footer",
|
|
70
|
+
className: cn("flex items-center justify-end gap-(--cue-space-3) bg-surface-1 px-(--cue-space-5) pt-0 pb-(--cue-space-5) group-data-[seam]/card:pt-(--cue-space-5)", className),
|
|
71
|
+
...elementProps
|
|
72
|
+
});
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { Card };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { IconButtonProps } from "../primitives/icon-button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
4
|
+
//#region src/layout/carousel.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The embla instance, once it has mounted.
|
|
7
|
+
*
|
|
8
|
+
* Derived from the hook's own signature rather than imported from
|
|
9
|
+
* `embla-carousel`, so this file has exactly one optional peer to satisfy
|
|
10
|
+
* instead of two.
|
|
11
|
+
*/
|
|
12
|
+
type CarouselApi = NonNullable<ReturnType<typeof useEmblaCarousel>[1]>;
|
|
13
|
+
/** embla's options object. */
|
|
14
|
+
type CarouselOptions = NonNullable<Parameters<typeof useEmblaCarousel>[0]>;
|
|
15
|
+
/** embla's plugin array. */
|
|
16
|
+
type CarouselPlugins = NonNullable<Parameters<typeof useEmblaCarousel>[1]>;
|
|
17
|
+
/** Which way the slides travel. */
|
|
18
|
+
type CarouselOrientation = "horizontal" | "vertical";
|
|
19
|
+
interface CarouselContextValue {
|
|
20
|
+
viewportRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
21
|
+
api: CarouselApi | undefined;
|
|
22
|
+
orientation: CarouselOrientation;
|
|
23
|
+
canScrollPrev: boolean;
|
|
24
|
+
canScrollNext: boolean;
|
|
25
|
+
selectedIndex: number;
|
|
26
|
+
scrollSnaps: readonly number[];
|
|
27
|
+
scrollPrev: () => void;
|
|
28
|
+
scrollNext: () => void;
|
|
29
|
+
scrollTo: (index: number) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Read the enclosing carousel's state and controls.
|
|
33
|
+
*
|
|
34
|
+
* Use it to build a control the kit does not ship — a slide counter, a
|
|
35
|
+
* thumbnail strip, an autoplay toggle.
|
|
36
|
+
*
|
|
37
|
+
* @throws If called outside a `Carousel.Root`.
|
|
38
|
+
* @example
|
|
39
|
+
* const { selectedIndex, scrollSnaps } = useCarousel();
|
|
40
|
+
*/
|
|
41
|
+
declare function useCarousel(): CarouselContextValue;
|
|
42
|
+
interface CarouselRootProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onSelect"> {
|
|
43
|
+
/** embla options, merged over the axis this component derives from `orientation`. */
|
|
44
|
+
options?: CarouselOptions;
|
|
45
|
+
/** embla plugins (autoplay, class names, wheel gestures…). */
|
|
46
|
+
plugins?: CarouselPlugins;
|
|
47
|
+
/** Which way the slides travel. Defaults to `"horizontal"`. */
|
|
48
|
+
orientation?: CarouselOrientation;
|
|
49
|
+
/** The region's accessible name. Defaults to `"Carousel"`. */
|
|
50
|
+
label?: string;
|
|
51
|
+
/** Receives the embla instance once mounted — the escape hatch to its full API. */
|
|
52
|
+
setApi?: (api: CarouselApi | undefined) => void;
|
|
53
|
+
}
|
|
54
|
+
interface CarouselContentProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
55
|
+
/** Extra classes for the flex track inside the viewport. */
|
|
56
|
+
trackClassName?: string;
|
|
57
|
+
}
|
|
58
|
+
interface CarouselSlideProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
59
|
+
/** Override the spoken name. Defaults to `"Slide <n> of <total>"`. */
|
|
60
|
+
label?: string;
|
|
61
|
+
}
|
|
62
|
+
interface CarouselControlProps extends Omit<IconButtonProps, "aria-label" | "icon"> {
|
|
63
|
+
/** Override the spoken name. */
|
|
64
|
+
"aria-label"?: string;
|
|
65
|
+
}
|
|
66
|
+
interface CarouselDotsProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
67
|
+
/** Builds each dot's spoken name. Defaults to `"Go to slide <n>"`. */
|
|
68
|
+
dotLabel?: (index: number) => string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A swipeable strip of slides, on embla.
|
|
72
|
+
*
|
|
73
|
+
* `embla-carousel-react` is an **optional peer**: import this from
|
|
74
|
+
* `@cueplusplus/ui/layout/carousel`, never from the core barrel, so an app that
|
|
75
|
+
* ships no carousel never installs one.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* <Carousel.Root label="Fixture gallery" options={{ loop: true }}>
|
|
79
|
+
* <Carousel.Content>
|
|
80
|
+
* {shots.map((s) => <Carousel.Slide key={s.id}><img src={s.src} /></Carousel.Slide>)}
|
|
81
|
+
* </Carousel.Content>
|
|
82
|
+
* <Carousel.Previous />
|
|
83
|
+
* <Carousel.Next />
|
|
84
|
+
* <Carousel.Dots />
|
|
85
|
+
* </Carousel.Root>
|
|
86
|
+
*/
|
|
87
|
+
declare const Carousel: {
|
|
88
|
+
Root: React.ForwardRefExoticComponent<CarouselRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
Content: React.ForwardRefExoticComponent<CarouselContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
|
+
Slide: React.ForwardRefExoticComponent<CarouselSlideProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
Previous: React.ForwardRefExoticComponent<CarouselControlProps & React.RefAttributes<HTMLButtonElement>>;
|
|
92
|
+
Next: React.ForwardRefExoticComponent<CarouselControlProps & React.RefAttributes<HTMLButtonElement>>;
|
|
93
|
+
Dots: React.ForwardRefExoticComponent<CarouselDotsProps & React.RefAttributes<HTMLDivElement>>;
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Carousel, CarouselApi, CarouselContentProps, CarouselControlProps, CarouselDotsProps, CarouselOptions, CarouselOrientation, CarouselPlugins, CarouselRootProps, CarouselSlideProps, useCarousel };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { ChevronLeftGlyph, ChevronRightGlyph } from "./_glyphs.js";
|
|
4
|
+
import { IconButton } from "../primitives/icon-button.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
8
|
+
//#region src/layout/carousel.tsx
|
|
9
|
+
const CarouselContext = React.createContext(null);
|
|
10
|
+
/**
|
|
11
|
+
* Read the enclosing carousel's state and controls.
|
|
12
|
+
*
|
|
13
|
+
* Use it to build a control the kit does not ship — a slide counter, a
|
|
14
|
+
* thumbnail strip, an autoplay toggle.
|
|
15
|
+
*
|
|
16
|
+
* @throws If called outside a `Carousel.Root`.
|
|
17
|
+
* @example
|
|
18
|
+
* const { selectedIndex, scrollSnaps } = useCarousel();
|
|
19
|
+
*/
|
|
20
|
+
function useCarousel() {
|
|
21
|
+
const context = React.useContext(CarouselContext);
|
|
22
|
+
if (context === null) throw new Error("useCarousel must be used inside a <Carousel.Root>.");
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
/** Position of a slide inside the track, for its spoken name. */
|
|
26
|
+
const SlidePositionContext = React.createContext(null);
|
|
27
|
+
/**
|
|
28
|
+
* A swipeable strip of slides, on embla.
|
|
29
|
+
*
|
|
30
|
+
* `embla-carousel-react` is an **optional peer**: import this from
|
|
31
|
+
* `@cueplusplus/ui/layout/carousel`, never from the core barrel, so an app that
|
|
32
|
+
* ships no carousel never installs one.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <Carousel.Root label="Fixture gallery" options={{ loop: true }}>
|
|
36
|
+
* <Carousel.Content>
|
|
37
|
+
* {shots.map((s) => <Carousel.Slide key={s.id}><img src={s.src} /></Carousel.Slide>)}
|
|
38
|
+
* </Carousel.Content>
|
|
39
|
+
* <Carousel.Previous />
|
|
40
|
+
* <Carousel.Next />
|
|
41
|
+
* <Carousel.Dots />
|
|
42
|
+
* </Carousel.Root>
|
|
43
|
+
*/
|
|
44
|
+
const Carousel = {
|
|
45
|
+
Root: React.forwardRef(function CarouselRoot({ className, options, plugins, orientation = "horizontal", label = "Carousel", setApi, onKeyDown, children, ...elementProps }, ref) {
|
|
46
|
+
const [viewportRef, api] = useEmblaCarousel({
|
|
47
|
+
axis: orientation === "vertical" ? "y" : "x",
|
|
48
|
+
...options
|
|
49
|
+
}, plugins);
|
|
50
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
51
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
52
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
53
|
+
const [scrollSnaps, setScrollSnaps] = React.useState([]);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (api === void 0) return;
|
|
56
|
+
const sync = () => {
|
|
57
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
58
|
+
setCanScrollNext(api.canScrollNext());
|
|
59
|
+
setSelectedIndex(api.selectedScrollSnap());
|
|
60
|
+
setScrollSnaps(api.scrollSnapList());
|
|
61
|
+
};
|
|
62
|
+
sync();
|
|
63
|
+
api.on("select", sync);
|
|
64
|
+
api.on("reInit", sync);
|
|
65
|
+
return () => {
|
|
66
|
+
api.off("select", sync);
|
|
67
|
+
api.off("reInit", sync);
|
|
68
|
+
};
|
|
69
|
+
}, [api]);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
setApi?.(api);
|
|
72
|
+
}, [api, setApi]);
|
|
73
|
+
const scrollPrev = React.useCallback(() => api?.scrollPrev(), [api]);
|
|
74
|
+
const scrollNext = React.useCallback(() => api?.scrollNext(), [api]);
|
|
75
|
+
const scrollTo = React.useCallback((index) => api?.scrollTo(index), [api]);
|
|
76
|
+
const context = React.useMemo(() => ({
|
|
77
|
+
viewportRef,
|
|
78
|
+
api,
|
|
79
|
+
orientation,
|
|
80
|
+
canScrollPrev,
|
|
81
|
+
canScrollNext,
|
|
82
|
+
selectedIndex,
|
|
83
|
+
scrollSnaps,
|
|
84
|
+
scrollPrev,
|
|
85
|
+
scrollNext,
|
|
86
|
+
scrollTo
|
|
87
|
+
}), [
|
|
88
|
+
viewportRef,
|
|
89
|
+
api,
|
|
90
|
+
orientation,
|
|
91
|
+
canScrollPrev,
|
|
92
|
+
canScrollNext,
|
|
93
|
+
selectedIndex,
|
|
94
|
+
scrollSnaps,
|
|
95
|
+
scrollPrev,
|
|
96
|
+
scrollNext,
|
|
97
|
+
scrollTo
|
|
98
|
+
]);
|
|
99
|
+
const back = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
|
|
100
|
+
const forward = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
|
|
101
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
102
|
+
value: context,
|
|
103
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
104
|
+
ref,
|
|
105
|
+
"data-slot": "carousel",
|
|
106
|
+
role: "region",
|
|
107
|
+
"aria-roledescription": "carousel",
|
|
108
|
+
"aria-label": label,
|
|
109
|
+
tabIndex: 0,
|
|
110
|
+
onKeyDown: (event) => {
|
|
111
|
+
onKeyDown?.(event);
|
|
112
|
+
if (event.defaultPrevented) return;
|
|
113
|
+
if (event.key === back) {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
scrollPrev();
|
|
116
|
+
} else if (event.key === forward) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
scrollNext();
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
className: cn("relative outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-accent", className),
|
|
122
|
+
...elementProps,
|
|
123
|
+
children
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
}),
|
|
127
|
+
Content: React.forwardRef(function CarouselContent({ className, trackClassName, children, ...elementProps }, ref) {
|
|
128
|
+
const { viewportRef, orientation } = useCarousel();
|
|
129
|
+
const count = React.Children.count(children);
|
|
130
|
+
return /* @__PURE__ */ jsx("div", {
|
|
131
|
+
ref: viewportRef,
|
|
132
|
+
"data-slot": "carousel-viewport",
|
|
133
|
+
className: cn("overflow-hidden", className),
|
|
134
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
135
|
+
ref,
|
|
136
|
+
"data-slot": "carousel-track",
|
|
137
|
+
className: cn("flex gap-(--cue-space-4)", orientation === "vertical" ? "flex-col" : "flex-row", trackClassName),
|
|
138
|
+
...elementProps,
|
|
139
|
+
children: React.Children.map(children, (child, index) => /* @__PURE__ */ jsx(SlidePositionContext.Provider, {
|
|
140
|
+
value: {
|
|
141
|
+
index,
|
|
142
|
+
count
|
|
143
|
+
},
|
|
144
|
+
children: child
|
|
145
|
+
}))
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}),
|
|
149
|
+
Slide: React.forwardRef(function CarouselSlide({ className, label, ...elementProps }, ref) {
|
|
150
|
+
const position = React.useContext(SlidePositionContext);
|
|
151
|
+
const name = label ?? (position === null ? "Slide" : `Slide ${position.index + 1} of ${position.count}`);
|
|
152
|
+
return /* @__PURE__ */ jsx("div", {
|
|
153
|
+
ref,
|
|
154
|
+
"data-slot": "carousel-slide",
|
|
155
|
+
role: "group",
|
|
156
|
+
"aria-roledescription": "slide",
|
|
157
|
+
"aria-label": name,
|
|
158
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", className),
|
|
159
|
+
...elementProps
|
|
160
|
+
});
|
|
161
|
+
}),
|
|
162
|
+
Previous: React.forwardRef(function CarouselPrevious({ "aria-label": ariaLabel = "Previous slide", disabled, onClick, ...elementProps }, ref) {
|
|
163
|
+
const { canScrollPrev, scrollPrev } = useCarousel();
|
|
164
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
165
|
+
ref,
|
|
166
|
+
"aria-label": ariaLabel,
|
|
167
|
+
icon: ChevronLeftGlyph,
|
|
168
|
+
"data-slot": "carousel-previous",
|
|
169
|
+
disabled: disabled ?? !canScrollPrev,
|
|
170
|
+
onClick: (event) => {
|
|
171
|
+
onClick?.(event);
|
|
172
|
+
if (!event.defaultPrevented) scrollPrev();
|
|
173
|
+
},
|
|
174
|
+
...elementProps
|
|
175
|
+
});
|
|
176
|
+
}),
|
|
177
|
+
Next: React.forwardRef(function CarouselNext({ "aria-label": ariaLabel = "Next slide", disabled, onClick, ...elementProps }, ref) {
|
|
178
|
+
const { canScrollNext, scrollNext } = useCarousel();
|
|
179
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
180
|
+
ref,
|
|
181
|
+
"aria-label": ariaLabel,
|
|
182
|
+
icon: ChevronRightGlyph,
|
|
183
|
+
"data-slot": "carousel-next",
|
|
184
|
+
disabled: disabled ?? !canScrollNext,
|
|
185
|
+
onClick: (event) => {
|
|
186
|
+
onClick?.(event);
|
|
187
|
+
if (!event.defaultPrevented) scrollNext();
|
|
188
|
+
},
|
|
189
|
+
...elementProps
|
|
190
|
+
});
|
|
191
|
+
}),
|
|
192
|
+
Dots: React.forwardRef(function CarouselDots({ className, dotLabel = (index) => `Go to slide ${index + 1}`, ...elementProps }, ref) {
|
|
193
|
+
const { scrollSnaps, selectedIndex, scrollTo } = useCarousel();
|
|
194
|
+
return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
ref,
|
|
196
|
+
"data-slot": "carousel-dots",
|
|
197
|
+
className: cn("flex items-center justify-center gap-(--cue-space-2)", className),
|
|
198
|
+
...elementProps,
|
|
199
|
+
children: scrollSnaps.map((_, index) => /* @__PURE__ */ jsx("button", {
|
|
200
|
+
type: "button",
|
|
201
|
+
"data-slot": "carousel-dot",
|
|
202
|
+
"aria-label": dotLabel(index),
|
|
203
|
+
"aria-current": index === selectedIndex ? "true" : void 0,
|
|
204
|
+
onClick: () => scrollTo(index),
|
|
205
|
+
className: cn("size-[0.25rem] cursor-pointer rounded-full border-0 p-0 transition-colors duration-150 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-accent motion-reduce:transition-none", index === selectedIndex ? "bg-accent" : "bg-border-strong")
|
|
206
|
+
}, index))
|
|
207
|
+
});
|
|
208
|
+
})
|
|
209
|
+
};
|
|
210
|
+
//#endregion
|
|
211
|
+
export { Carousel, useCarousel };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3
|
+
//#region src/layout/collapsible.d.ts
|
|
4
|
+
interface CollapsibleRootProps extends Omit<Collapsible.Root.Props, "className"> {
|
|
5
|
+
/** Extra classes for the frame. */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
interface CollapsibleTriggerProps extends Omit<Collapsible.Trigger.Props, "className"> {
|
|
9
|
+
/** Extra classes for the summary row. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
interface CollapsiblePanelProps extends Omit<Collapsible.Panel.Props, "className"> {
|
|
13
|
+
/** Extra classes for the animating box. Padding belongs on `bodyClassName`. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Extra classes for the padded body inside it. */
|
|
16
|
+
bodyClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One section that opens and closes — an accordion of exactly one.
|
|
20
|
+
*
|
|
21
|
+
* Wraps Base UI's `Collapsible` and wears the same summary-row skin as
|
|
22
|
+
* `Accordion`, so a lone section and a stack of them are visibly the same
|
|
23
|
+
* component.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <Collapsible.Root defaultOpen>
|
|
27
|
+
* <Collapsible.Trigger>failover</Collapsible.Trigger>
|
|
28
|
+
* <Collapsible.Panel>…</Collapsible.Panel>
|
|
29
|
+
* </Collapsible.Root>
|
|
30
|
+
*/
|
|
31
|
+
declare const Collapsible$1: {
|
|
32
|
+
Root: React.ForwardRefExoticComponent<Omit<CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
Trigger: React.ForwardRefExoticComponent<Omit<CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
Panel: React.ForwardRefExoticComponent<Omit<CollapsiblePanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
};
|
|
36
|
+
interface DisclosureProps extends Omit<React.ComponentPropsWithoutRef<"button">, "children" | "onChange"> {
|
|
37
|
+
/** What the toggle says. Defaults to `"advanced"`. */
|
|
38
|
+
label?: React.ReactNode;
|
|
39
|
+
/** Open state when controlled. Pass with `onOpenChange`. */
|
|
40
|
+
open?: boolean;
|
|
41
|
+
/** Initial open state when uncontrolled. */
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
/** Called with the new open state. */
|
|
44
|
+
onOpenChange?: Collapsible.Root.Props["onOpenChange"];
|
|
45
|
+
/** Extra classes for the frame around toggle and body. */
|
|
46
|
+
rootClassName?: string;
|
|
47
|
+
/** Extra classes for the revealed body. */
|
|
48
|
+
bodyClassName?: string;
|
|
49
|
+
/** The rarely-used fields to reveal. */
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The "advanced" idiom: a chromeless `▸ advanced` toggle over the fields most
|
|
54
|
+
* users never touch.
|
|
55
|
+
*
|
|
56
|
+
* Progressive disclosure, drawn as quietly as the system can draw anything — no
|
|
57
|
+
* rim, no fill, mono micro caption ink, one triangle. It is deliberately *not*
|
|
58
|
+
* a `Collapsible`: a collapsible section is a peer of the sections around it,
|
|
59
|
+
* while this is an annotation on the form it sits in, and giving it a summary
|
|
60
|
+
* row that looks like a section header is what makes forms read as twice as
|
|
61
|
+
* long as they are.
|
|
62
|
+
*
|
|
63
|
+
* Ported from dmxhub's `advBtn`, which is repeated at every route editor.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <Disclosure>
|
|
67
|
+
* <Field label="failover ttl"><NumberField /></Field>
|
|
68
|
+
* </Disclosure>
|
|
69
|
+
* @example
|
|
70
|
+
* <Disclosure label="output" open={open} onOpenChange={setOpen}>…</Disclosure>
|
|
71
|
+
*/
|
|
72
|
+
declare const Disclosure: React.ForwardRefExoticComponent<DisclosureProps & React.RefAttributes<HTMLButtonElement>>;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { Collapsible$1 as Collapsible, CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps, Disclosure, DisclosureProps };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { collapseCaretClasses, collapseLabelClasses, collapsePanelBodyClasses, collapseTriggerClasses, collapsiblePanelClasses } from "./_collapse.js";
|
|
4
|
+
import { ChevronRightGlyph } from "./_glyphs.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
8
|
+
/**
|
|
9
|
+
* One section that opens and closes — an accordion of exactly one.
|
|
10
|
+
*
|
|
11
|
+
* Wraps Base UI's `Collapsible` and wears the same summary-row skin as
|
|
12
|
+
* `Accordion`, so a lone section and a stack of them are visibly the same
|
|
13
|
+
* component.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Collapsible.Root defaultOpen>
|
|
17
|
+
* <Collapsible.Trigger>failover</Collapsible.Trigger>
|
|
18
|
+
* <Collapsible.Panel>…</Collapsible.Panel>
|
|
19
|
+
* </Collapsible.Root>
|
|
20
|
+
*/
|
|
21
|
+
const Collapsible$1 = {
|
|
22
|
+
Root: React.forwardRef(function CollapsibleRoot({ className, ...elementProps }, ref) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
24
|
+
ref,
|
|
25
|
+
"data-slot": "collapsible",
|
|
26
|
+
className: cn("flex min-w-0 flex-col", className),
|
|
27
|
+
...elementProps
|
|
28
|
+
});
|
|
29
|
+
}),
|
|
30
|
+
Trigger: React.forwardRef(function CollapsibleTrigger({ className, children, ...elementProps }, ref) {
|
|
31
|
+
return /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
32
|
+
ref,
|
|
33
|
+
"data-slot": "collapsible-trigger",
|
|
34
|
+
className: cn(collapseTriggerClasses, className),
|
|
35
|
+
...elementProps,
|
|
36
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
37
|
+
className: collapseLabelClasses,
|
|
38
|
+
children
|
|
39
|
+
}), /* @__PURE__ */ jsx(ChevronRightGlyph, {
|
|
40
|
+
"data-slot": "collapsible-caret",
|
|
41
|
+
className: collapseCaretClasses
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}),
|
|
45
|
+
Panel: React.forwardRef(function CollapsiblePanel({ className, bodyClassName, children, ...elementProps }, ref) {
|
|
46
|
+
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
47
|
+
ref,
|
|
48
|
+
"data-slot": "collapsible-panel",
|
|
49
|
+
className: cn(collapsiblePanelClasses, className),
|
|
50
|
+
...elementProps,
|
|
51
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
52
|
+
"data-slot": "collapsible-panel-body",
|
|
53
|
+
className: cn(collapsePanelBodyClasses, bodyClassName),
|
|
54
|
+
children
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The chromeless triangle used for the disclosure's own caret.
|
|
61
|
+
*
|
|
62
|
+
* Two glyphs, swapped by CSS off the trigger's `data-panel-open`, rather than
|
|
63
|
+
* one glyph rotated: `▸`/`▾` are the exact characters the upstream consoles use
|
|
64
|
+
* and a rotated `▸` sits visibly off-centre against a mono baseline.
|
|
65
|
+
*/
|
|
66
|
+
const DISCLOSURE_GLYPH_CLASSES = "shrink-0 text-(length:--cue-text-micro) leading-none select-none";
|
|
67
|
+
/**
|
|
68
|
+
* The "advanced" idiom: a chromeless `▸ advanced` toggle over the fields most
|
|
69
|
+
* users never touch.
|
|
70
|
+
*
|
|
71
|
+
* Progressive disclosure, drawn as quietly as the system can draw anything — no
|
|
72
|
+
* rim, no fill, mono micro caption ink, one triangle. It is deliberately *not*
|
|
73
|
+
* a `Collapsible`: a collapsible section is a peer of the sections around it,
|
|
74
|
+
* while this is an annotation on the form it sits in, and giving it a summary
|
|
75
|
+
* row that looks like a section header is what makes forms read as twice as
|
|
76
|
+
* long as they are.
|
|
77
|
+
*
|
|
78
|
+
* Ported from dmxhub's `advBtn`, which is repeated at every route editor.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* <Disclosure>
|
|
82
|
+
* <Field label="failover ttl"><NumberField /></Field>
|
|
83
|
+
* </Disclosure>
|
|
84
|
+
* @example
|
|
85
|
+
* <Disclosure label="output" open={open} onOpenChange={setOpen}>…</Disclosure>
|
|
86
|
+
*/
|
|
87
|
+
const Disclosure = React.forwardRef(function Disclosure({ className, label = "advanced", open, defaultOpen, onOpenChange, rootClassName, bodyClassName, children, ...elementProps }, ref) {
|
|
88
|
+
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
89
|
+
"data-slot": "disclosure",
|
|
90
|
+
className: cn("flex min-w-0 flex-col", rootClassName),
|
|
91
|
+
open,
|
|
92
|
+
defaultOpen,
|
|
93
|
+
onOpenChange,
|
|
94
|
+
children: [/* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
95
|
+
ref,
|
|
96
|
+
"data-slot": "disclosure-trigger",
|
|
97
|
+
className: cn("group/disclosure inline-flex cursor-pointer items-center gap-(--cue-space-2) self-start border-0 bg-transparent p-0 py-(--cue-space-2) font-mono text-(length:--cue-text-label) tracking-[0.15em] text-fg-subtle uppercase transition-colors duration-150 outline-none select-none hover:text-fg-muted focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-accent", className),
|
|
98
|
+
...elementProps,
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsx("span", {
|
|
101
|
+
"data-slot": "disclosure-glyph",
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
className: cn(DISCLOSURE_GLYPH_CLASSES, "group-data-[panel-open]/disclosure:hidden"),
|
|
104
|
+
children: "▸"
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ jsx("span", {
|
|
107
|
+
"data-slot": "disclosure-glyph",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: cn(DISCLOSURE_GLYPH_CLASSES, "hidden group-data-[panel-open]/disclosure:inline"),
|
|
110
|
+
children: "▾"
|
|
111
|
+
}),
|
|
112
|
+
label
|
|
113
|
+
]
|
|
114
|
+
}), /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
115
|
+
"data-slot": "disclosure-panel",
|
|
116
|
+
className: collapsiblePanelClasses,
|
|
117
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
118
|
+
"data-slot": "disclosure-panel-body",
|
|
119
|
+
className: cn("flex flex-col gap-(--cue-space-2) pb-(--cue-space-2)", bodyClassName),
|
|
120
|
+
children
|
|
121
|
+
})
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
//#endregion
|
|
126
|
+
export { Collapsible$1 as Collapsible, Disclosure };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/layout/container.d.ts
|
|
3
|
+
/** How wide the content column is allowed to get. */
|
|
4
|
+
type ContainerWidth = "narrow" | "wide" | "full";
|
|
5
|
+
interface ContainerProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
6
|
+
/** Which measure the column takes. Defaults to `"narrow"`. */
|
|
7
|
+
width?: ContainerWidth;
|
|
8
|
+
/** Draw the standard side gutters. Defaults to `true`. */
|
|
9
|
+
padded?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A centred column with the standard gutters and nothing else.
|
|
13
|
+
*
|
|
14
|
+
* `PageShell` is this plus a page header; reach for `Container` when the page
|
|
15
|
+
* already has its own heading (a route that opens with a `TitleBar`, a section
|
|
16
|
+
* inside a shell) and all you need is the measure.
|
|
17
|
+
*
|
|
18
|
+
* Static markup — no `"use client"`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Container width="wide"><Table /></Container>
|
|
22
|
+
* @example
|
|
23
|
+
* <Container width="full" padded={false}><Canvas /></Container>
|
|
24
|
+
*/
|
|
25
|
+
declare const Container: React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Container, ContainerProps, ContainerWidth };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/layout/container.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The same two measures `PageShell` uses, plus an uncapped one.
|
|
7
|
+
*
|
|
8
|
+
* `narrow` (42rem) is a reading column — settings, forms, prose. `wide` (54rem)
|
|
9
|
+
* is a working column — tables and panel grids. `full` caps nothing, for a
|
|
10
|
+
* console layout that owns the whole viewport and only wants the gutters.
|
|
11
|
+
*/
|
|
12
|
+
const WIDTHS = {
|
|
13
|
+
narrow: "max-w-[42rem]",
|
|
14
|
+
wide: "max-w-[54rem]",
|
|
15
|
+
full: ""
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A centred column with the standard gutters and nothing else.
|
|
19
|
+
*
|
|
20
|
+
* `PageShell` is this plus a page header; reach for `Container` when the page
|
|
21
|
+
* already has its own heading (a route that opens with a `TitleBar`, a section
|
|
22
|
+
* inside a shell) and all you need is the measure.
|
|
23
|
+
*
|
|
24
|
+
* Static markup — no `"use client"`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <Container width="wide"><Table /></Container>
|
|
28
|
+
* @example
|
|
29
|
+
* <Container width="full" padded={false}><Canvas /></Container>
|
|
30
|
+
*/
|
|
31
|
+
const Container = React.forwardRef(function Container({ className, width = "narrow", padded = true, ...elementProps }, ref) {
|
|
32
|
+
return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
ref,
|
|
34
|
+
"data-slot": "container",
|
|
35
|
+
className: cn("mx-auto w-full", WIDTHS[width], padded ? "px-(--cue-space-6)" : null, className),
|
|
36
|
+
...elementProps
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Container };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/layout/description-list.d.ts
|
|
3
|
+
/** How a term and its detail are arranged. */
|
|
4
|
+
type DescriptionListLayout = "inline" | "stacked";
|
|
5
|
+
interface DescriptionListRootProps extends React.ComponentPropsWithoutRef<"dl"> {
|
|
6
|
+
/**
|
|
7
|
+
* `"inline"` (default) puts the detail beside its term in a two-column grid;
|
|
8
|
+
* `"stacked"` puts it underneath. Stack when the details are long enough to
|
|
9
|
+
* wrap, which turns the aligned column into ragged text anyway.
|
|
10
|
+
*/
|
|
11
|
+
layout?: DescriptionListLayout;
|
|
12
|
+
}
|
|
13
|
+
/** Props for {@link DescriptionListTerm}: the native `<dt>` plus `className`. */
|
|
14
|
+
type DescriptionListTermProps = React.ComponentPropsWithoutRef<"dt">;
|
|
15
|
+
/** Props for {@link DescriptionListDetail}: the native `<dd>` plus `className`. */
|
|
16
|
+
type DescriptionListDetailProps = React.ComponentPropsWithoutRef<"dd">;
|
|
17
|
+
/** The `<dl>` family: {@link DescriptionListRoot}, `Term` and `Detail`. */
|
|
18
|
+
declare const DescriptionList: {
|
|
19
|
+
Root: React.ForwardRefExoticComponent<DescriptionListRootProps & React.RefAttributes<HTMLDListElement>>;
|
|
20
|
+
Term: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
21
|
+
Detail: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { DescriptionList, DescriptionListDetailProps, DescriptionListLayout, DescriptionListRootProps, DescriptionListTermProps };
|