@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,90 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/instruments/_glyphs.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Shared instrument glyphs.
|
|
6
|
+
*
|
|
7
|
+
* Drawn inline for the same reason as `overlays/_glyphs.tsx`: a copy
|
|
8
|
+
* affordance should not put an icon dependency on the render path, and
|
|
9
|
+
* hand-set strokes stay hairline-thin at the 10–12px sizes console density
|
|
10
|
+
* asks for. `currentColor` everywhere — the tone comes from the button.
|
|
11
|
+
*
|
|
12
|
+
* @internal Not part of the public API.
|
|
13
|
+
*/
|
|
14
|
+
/** Two offset sheets: the universal "copy to clipboard" mark. */
|
|
15
|
+
function CopyGlyph(props) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: "1.5",
|
|
21
|
+
strokeLinejoin: "round",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
...props,
|
|
24
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
25
|
+
x: "5.5",
|
|
26
|
+
y: "5.5",
|
|
27
|
+
width: "8",
|
|
28
|
+
height: "8",
|
|
29
|
+
rx: "1.5"
|
|
30
|
+
}), /* @__PURE__ */ jsx("path", { d: "M10.5 3.5a1.5 1.5 0 0 0-1.5-1.5H4a1.5 1.5 0 0 0-1.5 1.5V9A1.5 1.5 0 0 0 4 10.5" })]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** The tick that confirms the copy landed. */
|
|
34
|
+
function CheckGlyph(props) {
|
|
35
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
36
|
+
viewBox: "0 0 16 16",
|
|
37
|
+
fill: "none",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
strokeWidth: "2",
|
|
40
|
+
strokeLinecap: "round",
|
|
41
|
+
strokeLinejoin: "round",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
...props,
|
|
44
|
+
children: /* @__PURE__ */ jsx("path", { d: "m3 8.5 3.5 3.5L13 4.5" })
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Shared stroke settings for the four pager chevrons. */
|
|
48
|
+
const CHEVRON = {
|
|
49
|
+
viewBox: "0 0 16 16",
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "2",
|
|
53
|
+
strokeLinecap: "round",
|
|
54
|
+
strokeLinejoin: "round",
|
|
55
|
+
"aria-hidden": "true"
|
|
56
|
+
};
|
|
57
|
+
/** Previous page. */
|
|
58
|
+
function ChevronLeftGlyph(props) {
|
|
59
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
60
|
+
...CHEVRON,
|
|
61
|
+
...props,
|
|
62
|
+
children: /* @__PURE__ */ jsx("path", { d: "m10 3-5 5 5 5" })
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Next page. */
|
|
66
|
+
function ChevronRightGlyph(props) {
|
|
67
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
68
|
+
...CHEVRON,
|
|
69
|
+
...props,
|
|
70
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 3 5 5-5 5" })
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** First page. */
|
|
74
|
+
function ChevronsLeftGlyph(props) {
|
|
75
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
76
|
+
...CHEVRON,
|
|
77
|
+
...props,
|
|
78
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m8 3-5 5 5 5" }), /* @__PURE__ */ jsx("path", { d: "m13 3-5 5 5 5" })]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Last page. */
|
|
82
|
+
function ChevronsRightGlyph(props) {
|
|
83
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
84
|
+
...CHEVRON,
|
|
85
|
+
...props,
|
|
86
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m3 3 5 5-5 5" }), /* @__PURE__ */ jsx("path", { d: "m8 3 5 5-5 5" })]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { CheckGlyph, ChevronLeftGlyph, ChevronRightGlyph, ChevronsLeftGlyph, ChevronsRightGlyph, CopyGlyph };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/instruments/_motion.ts
|
|
4
|
+
/**
|
|
5
|
+
* The JS half of the reduced-motion contract.
|
|
6
|
+
*
|
|
7
|
+
* Almost everything in this system stills itself in CSS with
|
|
8
|
+
* `motion-reduce:*`, which is both cheaper and impossible to forget on a
|
|
9
|
+
* re-render. This hook exists only for the cases CSS cannot reach: an animation
|
|
10
|
+
* driven by a timer, where honouring the preference means *not scheduling the
|
|
11
|
+
* work at all* rather than painting it without a transition.
|
|
12
|
+
*
|
|
13
|
+
* @internal Not part of the public API.
|
|
14
|
+
*/
|
|
15
|
+
const QUERY = "(prefers-reduced-motion: reduce)";
|
|
16
|
+
/**
|
|
17
|
+
* Whether the user has asked for reduced motion, tracked live.
|
|
18
|
+
*
|
|
19
|
+
* Starts `false` on the server and on the first client render so hydration
|
|
20
|
+
* matches, then corrects itself in a layout effect before paint.
|
|
21
|
+
*/
|
|
22
|
+
function usePrefersReducedMotion() {
|
|
23
|
+
const [reduced, setReduced] = React.useState(false);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
26
|
+
const query = window.matchMedia(QUERY);
|
|
27
|
+
setReduced(query.matches);
|
|
28
|
+
const onChange = (event) => setReduced(event.matches);
|
|
29
|
+
query.addEventListener("change", onChange);
|
|
30
|
+
return () => query.removeEventListener("change", onChange);
|
|
31
|
+
}, []);
|
|
32
|
+
return reduced;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* mulberry32 — 32 bits of state, uniform enough for jitter and fast enough to
|
|
36
|
+
* call per keystroke.
|
|
37
|
+
*
|
|
38
|
+
* Seeded rather than `Math.random()` so a simulated terminal plays the same way
|
|
39
|
+
* on every render, in every screenshot and in every test (the Phase 1 rule
|
|
40
|
+
* against unseeded randomness).
|
|
41
|
+
*
|
|
42
|
+
* @param seed - Any integer. The same seed always yields the same sequence.
|
|
43
|
+
* @returns A generator of numbers in `[0, 1)`.
|
|
44
|
+
*/
|
|
45
|
+
function mulberry32(seed) {
|
|
46
|
+
let state = seed >>> 0;
|
|
47
|
+
return () => {
|
|
48
|
+
state = state + 1831565813 >>> 0;
|
|
49
|
+
let t = state;
|
|
50
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
51
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
52
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { mulberry32, usePrefersReducedMotion };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/instruments/_rem.ts
|
|
2
|
+
/**
|
|
3
|
+
* Instruments are the one group that takes raw pixel numbers as props — a
|
|
4
|
+
* meter is 4px tall, a sparkline is 72×14, a progress track is 5px — because
|
|
5
|
+
* those are the numbers a data designer thinks in, and there is no density
|
|
6
|
+
* token for "the height of a bar".
|
|
7
|
+
*
|
|
8
|
+
* They are still emitted as `rem` so the instrument scales with browser zoom
|
|
9
|
+
* and the user's root font size like everything else in the system. This is the
|
|
10
|
+
* same conversion `StatusDot` does for its diameter.
|
|
11
|
+
*
|
|
12
|
+
* @internal Not part of the public API.
|
|
13
|
+
*/
|
|
14
|
+
/** The reference root font size the px props are quoted against. */
|
|
15
|
+
const ROOT_PX = 16;
|
|
16
|
+
/** Convert a px number quoted at the 16px root into a `rem` length. */
|
|
17
|
+
function toRem(px) {
|
|
18
|
+
return `${px / ROOT_PX}rem`;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { toRem };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/app-window-frame.d.ts
|
|
3
|
+
interface AppWindowFrameProps extends Omit<React.ComponentPropsWithoutRef<"div">, "title"> {
|
|
4
|
+
/** The document name, centred in the title bar. */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** Draw the three window lights. Defaults to `true`. */
|
|
7
|
+
traffic?: boolean;
|
|
8
|
+
/** Contents of the toolbar row under the title bar. Omit for no toolbar. */
|
|
9
|
+
toolbar?: React.ReactNode;
|
|
10
|
+
/** Contents of the status bar along the bottom. Omit for no status bar. */
|
|
11
|
+
statusBar?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Float the frame off the page with a drop shadow. Defaults to `true`.
|
|
14
|
+
*
|
|
15
|
+
* This is the one flat-design exception in the kit, and it is not really an
|
|
16
|
+
* exception: the component *depicts a floating window*, which is exactly the
|
|
17
|
+
* case the overlay shadow rule already carves out. Set it `false` when the
|
|
18
|
+
* frame is inlined into a page that is already a window.
|
|
19
|
+
*/
|
|
20
|
+
elevated?: boolean;
|
|
21
|
+
/** What is inside the window. */
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A screenshot of your own app, built out of your own components.
|
|
26
|
+
*
|
|
27
|
+
* The marketing device: title bar, optional toolbar, canvas, status bar — the
|
|
28
|
+
* shape of a desktop window, wrapped around real markup. Because the contents
|
|
29
|
+
* are components rather than a PNG, the hero image re-themes with the site, is
|
|
30
|
+
* legible at any zoom, and cannot go stale the week after a redesign.
|
|
31
|
+
*
|
|
32
|
+
* Built from the real `TitleBar` and `StatusBar`, so the depiction and the
|
|
33
|
+
* product share one set of geometry tokens and can never drift apart.
|
|
34
|
+
*
|
|
35
|
+
* Static markup — no `"use client"`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <AppWindowFrame
|
|
39
|
+
* title="main-stage.cue"
|
|
40
|
+
* toolbar={<><Chip>File</Chip><Chip tone="ok">Live</Chip></>}
|
|
41
|
+
* statusBar={<><StatusBar.Item tone="ok">LIVE</StatusBar.Item><StatusBar.Item>30 pps</StatusBar.Item></>}
|
|
42
|
+
* >
|
|
43
|
+
* <SeamGrid columns={3}>{cells}</SeamGrid>
|
|
44
|
+
* </AppWindowFrame>
|
|
45
|
+
*/
|
|
46
|
+
declare const AppWindowFrame: React.ForwardRefExoticComponent<AppWindowFrameProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { AppWindowFrame, AppWindowFrameProps };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { StatusBar } from "../chrome/status-bar.js";
|
|
3
|
+
import { TitleBar } from "../chrome/title-bar.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/instruments/app-window-frame.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The three lights, in the shared status vocabulary rather than in macOS hexes.
|
|
9
|
+
*
|
|
10
|
+
* `#ff5f57 / #febc2e / #28c840` are the colours of *one* operating system's
|
|
11
|
+
* chrome; on a themed page they read as three imported stickers. The status
|
|
12
|
+
* tokens are the same three hues, they re-tint per theme, and they are already
|
|
13
|
+
* the colours the rest of the console uses for stop / caution / go.
|
|
14
|
+
*/
|
|
15
|
+
const LIGHT_TONES = [
|
|
16
|
+
"bg-danger",
|
|
17
|
+
"bg-warn",
|
|
18
|
+
"bg-ok"
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* A screenshot of your own app, built out of your own components.
|
|
22
|
+
*
|
|
23
|
+
* The marketing device: title bar, optional toolbar, canvas, status bar — the
|
|
24
|
+
* shape of a desktop window, wrapped around real markup. Because the contents
|
|
25
|
+
* are components rather than a PNG, the hero image re-themes with the site, is
|
|
26
|
+
* legible at any zoom, and cannot go stale the week after a redesign.
|
|
27
|
+
*
|
|
28
|
+
* Built from the real `TitleBar` and `StatusBar`, so the depiction and the
|
|
29
|
+
* product share one set of geometry tokens and can never drift apart.
|
|
30
|
+
*
|
|
31
|
+
* Static markup — no `"use client"`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <AppWindowFrame
|
|
35
|
+
* title="main-stage.cue"
|
|
36
|
+
* toolbar={<><Chip>File</Chip><Chip tone="ok">Live</Chip></>}
|
|
37
|
+
* statusBar={<><StatusBar.Item tone="ok">LIVE</StatusBar.Item><StatusBar.Item>30 pps</StatusBar.Item></>}
|
|
38
|
+
* >
|
|
39
|
+
* <SeamGrid columns={3}>{cells}</SeamGrid>
|
|
40
|
+
* </AppWindowFrame>
|
|
41
|
+
*/
|
|
42
|
+
const AppWindowFrame = React.forwardRef(function AppWindowFrame({ className, title, traffic = true, toolbar, statusBar, elevated = true, children, ...elementProps }, ref) {
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
ref,
|
|
45
|
+
"data-slot": "app-window-frame",
|
|
46
|
+
className: cn("flex min-w-0 flex-col overflow-hidden rounded-(--radius-surface) border border-border bg-bg", elevated ? "shadow-[0_40px_120px_-40px_rgba(0,0,0,0.9)]" : null, className),
|
|
47
|
+
...elementProps,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx(TitleBar, {
|
|
50
|
+
center: title,
|
|
51
|
+
children: traffic ? /* @__PURE__ */ jsx("span", {
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
"data-slot": "app-window-lights",
|
|
54
|
+
className: "flex items-center gap-(--cue-space-3)",
|
|
55
|
+
children: LIGHT_TONES.map((tone) => /* @__PURE__ */ jsx("span", {
|
|
56
|
+
"data-slot": "app-window-light",
|
|
57
|
+
className: cn("size-[0.5rem] rounded-full opacity-80", tone)
|
|
58
|
+
}, tone))
|
|
59
|
+
}) : null
|
|
60
|
+
}),
|
|
61
|
+
toolbar === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
62
|
+
"data-slot": "app-window-toolbar",
|
|
63
|
+
className: "flex h-(--cue-chrome-toolbar) shrink-0 items-center gap-(--cue-space-2) border-b border-border bg-surface-1 px-(--cue-pad-row-x) font-mono text-(length:--cue-text-label) text-fg-muted",
|
|
64
|
+
children: toolbar
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("div", {
|
|
67
|
+
"data-slot": "app-window-canvas",
|
|
68
|
+
className: "min-h-0 min-w-0 flex-1 p-(--cue-space-6)",
|
|
69
|
+
children
|
|
70
|
+
}),
|
|
71
|
+
statusBar === void 0 ? null : /* @__PURE__ */ jsx(StatusBar, { children: statusBar })
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
//#endregion
|
|
76
|
+
export { AppWindowFrame };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ButtonProps } from "../primitives/button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/instruments/copy-button.d.ts
|
|
4
|
+
interface CopyButtonProps extends Omit<ButtonProps, "icon" | "children" | "onCopy"> {
|
|
5
|
+
/** The text to put on the clipboard. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** ms the confirmation stays up before reverting. Defaults to `1200`. */
|
|
8
|
+
timeout?: number;
|
|
9
|
+
/** The idle label. Defaults to `"Copy"`. */
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/** The confirmation label. Defaults to `"Copied"`. */
|
|
12
|
+
copiedLabel?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Called with `value` once it is actually on the clipboard. Replaces the
|
|
15
|
+
* native `onCopy` clipboard-event handler, which is meaningless on a button.
|
|
16
|
+
*/
|
|
17
|
+
onCopy?: (value: string) => void;
|
|
18
|
+
/** Called with whatever the clipboard threw. Nothing is claimed on failure. */
|
|
19
|
+
onCopyError?: (error: unknown) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Copy one string, and say so.
|
|
23
|
+
*
|
|
24
|
+
* The confirmation is a label swap rather than a colour change or a toast: at
|
|
25
|
+
* console density a toast for "copied an id" is heavier than the action, and
|
|
26
|
+
* colour alone would not be announced. The label lives in an `aria-live`
|
|
27
|
+
* region, so screen-reader users hear the state change too (WCAG 1.4.1).
|
|
28
|
+
*
|
|
29
|
+
* Failure is never dressed up as success — if both the async clipboard and the
|
|
30
|
+
* `execCommand` fallback fail, the label stays put and `onCopyError` fires.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <CopyButton value={fixture.id} />
|
|
34
|
+
* @example
|
|
35
|
+
* <CopyButton value={dsn} variant="ghost" size="sm" copiedLabel="On the clipboard">
|
|
36
|
+
* Copy DSN
|
|
37
|
+
* </CopyButton>
|
|
38
|
+
*/
|
|
39
|
+
declare const CopyButton: React.ForwardRefExoticComponent<CopyButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { CopyButton, CopyButtonProps };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../primitives/button.js";
|
|
3
|
+
import { CheckGlyph, CopyGlyph } from "./_glyphs.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/instruments/copy-button.tsx
|
|
7
|
+
/** How long the confirmation stays up, in ms. */
|
|
8
|
+
const DEFAULT_TIMEOUT_MS = 1200;
|
|
9
|
+
/**
|
|
10
|
+
* The synchronous fallback for browsers (and insecure origins) with no async
|
|
11
|
+
* clipboard: select a scratch textarea and let `execCommand` copy it.
|
|
12
|
+
*
|
|
13
|
+
* Returns `false` rather than throwing so the caller can re-raise whatever the
|
|
14
|
+
* real failure was — the fallback failing is never the interesting error.
|
|
15
|
+
*/
|
|
16
|
+
function copyWithExecCommand(value) {
|
|
17
|
+
if (typeof document === "undefined" || typeof document.execCommand !== "function") return false;
|
|
18
|
+
const scratch = document.createElement("textarea");
|
|
19
|
+
scratch.value = value;
|
|
20
|
+
scratch.setAttribute("readonly", "");
|
|
21
|
+
scratch.setAttribute("aria-hidden", "true");
|
|
22
|
+
scratch.style.position = "fixed";
|
|
23
|
+
scratch.style.top = "0";
|
|
24
|
+
scratch.style.left = "-9999px";
|
|
25
|
+
document.body.appendChild(scratch);
|
|
26
|
+
const selection = document.getSelection();
|
|
27
|
+
const previous = selection !== null && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
|
|
28
|
+
let copied = false;
|
|
29
|
+
try {
|
|
30
|
+
scratch.select();
|
|
31
|
+
copied = document.execCommand("copy");
|
|
32
|
+
} catch {
|
|
33
|
+
copied = false;
|
|
34
|
+
} finally {
|
|
35
|
+
scratch.remove();
|
|
36
|
+
if (previous !== null && selection !== null) {
|
|
37
|
+
selection.removeAllRanges();
|
|
38
|
+
selection.addRange(previous);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return copied;
|
|
42
|
+
}
|
|
43
|
+
/** Write to the clipboard, preferring the async API and never claiming success. */
|
|
44
|
+
async function writeToClipboard(value) {
|
|
45
|
+
const clipboard = typeof navigator === "undefined" ? void 0 : navigator.clipboard;
|
|
46
|
+
if (clipboard !== void 0 && typeof clipboard.writeText === "function") try {
|
|
47
|
+
await clipboard.writeText(value);
|
|
48
|
+
return;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (copyWithExecCommand(value)) return;
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
if (copyWithExecCommand(value)) return;
|
|
54
|
+
throw new Error("Clipboard unavailable");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Copy one string, and say so.
|
|
58
|
+
*
|
|
59
|
+
* The confirmation is a label swap rather than a colour change or a toast: at
|
|
60
|
+
* console density a toast for "copied an id" is heavier than the action, and
|
|
61
|
+
* colour alone would not be announced. The label lives in an `aria-live`
|
|
62
|
+
* region, so screen-reader users hear the state change too (WCAG 1.4.1).
|
|
63
|
+
*
|
|
64
|
+
* Failure is never dressed up as success — if both the async clipboard and the
|
|
65
|
+
* `execCommand` fallback fail, the label stays put and `onCopyError` fires.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* <CopyButton value={fixture.id} />
|
|
69
|
+
* @example
|
|
70
|
+
* <CopyButton value={dsn} variant="ghost" size="sm" copiedLabel="On the clipboard">
|
|
71
|
+
* Copy DSN
|
|
72
|
+
* </CopyButton>
|
|
73
|
+
*/
|
|
74
|
+
const CopyButton = React.forwardRef(function CopyButton({ value, timeout = DEFAULT_TIMEOUT_MS, children = "Copy", copiedLabel = "Copied", onCopy, onCopyError, onClick, ...buttonProps }, ref) {
|
|
75
|
+
const [copied, setCopied] = React.useState(false);
|
|
76
|
+
const timerRef = React.useRef(void 0);
|
|
77
|
+
React.useEffect(() => () => {
|
|
78
|
+
if (timerRef.current !== void 0) clearTimeout(timerRef.current);
|
|
79
|
+
}, []);
|
|
80
|
+
const handleClick = (event) => {
|
|
81
|
+
onClick?.(event);
|
|
82
|
+
if (event.defaultPrevented) return;
|
|
83
|
+
(async () => {
|
|
84
|
+
try {
|
|
85
|
+
await writeToClipboard(value);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
onCopyError?.(error);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
onCopy?.(value);
|
|
91
|
+
setCopied(true);
|
|
92
|
+
if (timerRef.current !== void 0) clearTimeout(timerRef.current);
|
|
93
|
+
timerRef.current = setTimeout(() => {
|
|
94
|
+
timerRef.current = void 0;
|
|
95
|
+
setCopied(false);
|
|
96
|
+
}, timeout);
|
|
97
|
+
})();
|
|
98
|
+
};
|
|
99
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
100
|
+
ref,
|
|
101
|
+
icon: copied ? CheckGlyph : CopyGlyph,
|
|
102
|
+
"data-copied": copied ? "true" : void 0,
|
|
103
|
+
onClick: handleClick,
|
|
104
|
+
...buttonProps,
|
|
105
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
106
|
+
"aria-live": "polite",
|
|
107
|
+
children: copied ? copiedLabel : children
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//#endregion
|
|
112
|
+
export { CopyButton };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ColumnHelper, ReactTable, RowData, TableOptions, flexRender } from "@tanstack/react-table";
|
|
3
|
+
//#region src/instruments/data-table.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The console table recipe. Not a component — deliberately.
|
|
6
|
+
*
|
|
7
|
+
* A `<DataTable columns={…} data={…} />` monolith has to own the markup of
|
|
8
|
+
* every cell, every header and every empty state, and the first column that
|
|
9
|
+
* needs a `Chip` or a `TwoStepButton` in it starts a prop-drilling arms race
|
|
10
|
+
* that ends with a component nobody can read. TanStack v9's whole point is that
|
|
11
|
+
* the markup stays yours and only the *logic* is shared, so what this module
|
|
12
|
+
* ships is the wiring:
|
|
13
|
+
*
|
|
14
|
+
* - {@link cueTableFeatures} — one opt-in feature set, so v9 can tree-shake
|
|
15
|
+
* everything the console does not use (grouping, faceting, pinning,
|
|
16
|
+
* virtualised column sizing).
|
|
17
|
+
* - {@link useCueTable} — that feature set, pre-bound, with sensible console
|
|
18
|
+
* defaults.
|
|
19
|
+
* - {@link createCueColumnHelper} — the column helper with the features
|
|
20
|
+
* already applied, so column defs infer.
|
|
21
|
+
* - {@link DataTableToolbar} / {@link DataTablePagination} — the two pieces of
|
|
22
|
+
* chrome every table needs and nobody enjoys writing twice.
|
|
23
|
+
*
|
|
24
|
+
* The rows render through the Phase 1 `Table`. There is a fully worked example
|
|
25
|
+
* in `test/instruments/data-table.test.tsx`.
|
|
26
|
+
*
|
|
27
|
+
* Ships from `@cueplusplus/ui/instruments/data-table`: `@tanstack/react-table`
|
|
28
|
+
* is an optional peer, and the core bundle must not require it.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Sorting, column filtering, global filtering and pagination — and nothing
|
|
32
|
+
* else.
|
|
33
|
+
*
|
|
34
|
+
* Named functions are registered individually rather than by spreading the
|
|
35
|
+
* built-in registries, because spreading puts every sort and filter
|
|
36
|
+
* implementation in the bundle whether or not a column names one.
|
|
37
|
+
*/
|
|
38
|
+
declare const cueTableFeatures: {
|
|
39
|
+
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
40
|
+
globalFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
41
|
+
rowPaginationFeature: import("@tanstack/react-table").TableFeature;
|
|
42
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
43
|
+
filteredRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
44
|
+
paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
45
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
46
|
+
filterFns: {
|
|
47
|
+
includesString: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
48
|
+
inNumberRange: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
49
|
+
};
|
|
50
|
+
sortFns: {
|
|
51
|
+
alphanumeric: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
52
|
+
basic: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
53
|
+
datetime: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
54
|
+
text: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/** The feature set every `useCueTable` instance carries. */
|
|
58
|
+
type CueTableFeatures = typeof cueTableFeatures;
|
|
59
|
+
/** A table instance produced by {@link useCueTable}. */
|
|
60
|
+
type CueTable<TData extends RowData> = ReactTable<CueTableFeatures, TData>;
|
|
61
|
+
/** Options for {@link useCueTable} — TanStack's, minus the features it supplies. */
|
|
62
|
+
interface UseCueTableOptions<TData extends RowData> extends Omit<TableOptions<CueTableFeatures, TData>, "features"> {}
|
|
63
|
+
/**
|
|
64
|
+
* A TanStack v9 table wired for the console.
|
|
65
|
+
*
|
|
66
|
+
* Adds one default on top of the feature set: `globalFilterFn: "includesString"`,
|
|
67
|
+
* which is what a single search box over a console table always means. Override
|
|
68
|
+
* it, or any other option, by passing it.
|
|
69
|
+
*
|
|
70
|
+
* @param options - Everything `useTable` takes except `features`.
|
|
71
|
+
* @returns The table instance, ready to render through `Table`.
|
|
72
|
+
* @example
|
|
73
|
+
* const table = useCueTable({ data, columns, state: { globalFilter }, onGlobalFilterChange });
|
|
74
|
+
*/
|
|
75
|
+
declare function useCueTable<TData extends RowData>(options: UseCueTableOptions<TData>): CueTable<TData>;
|
|
76
|
+
/**
|
|
77
|
+
* A column helper with {@link cueTableFeatures} already bound.
|
|
78
|
+
*
|
|
79
|
+
* @returns TanStack's `accessor` / `display` / `group` / `columns` builders.
|
|
80
|
+
* @example
|
|
81
|
+
* const helper = createCueColumnHelper<Fixture>();
|
|
82
|
+
* const columns = [helper.accessor("name", { header: "Fixture" })];
|
|
83
|
+
*/
|
|
84
|
+
declare function createCueColumnHelper<TData extends RowData>(): ColumnHelper<CueTableFeatures, TData>;
|
|
85
|
+
interface DataTableToolbarProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> {
|
|
86
|
+
/** The current query. Pair it with `onValueChange` and the table's global filter. */
|
|
87
|
+
value?: string;
|
|
88
|
+
/** Fired on every keystroke in the search box. */
|
|
89
|
+
onValueChange?: (value: string) => void;
|
|
90
|
+
/** Placeholder for the search box. Defaults to `"Filter…"`. */
|
|
91
|
+
placeholder?: string;
|
|
92
|
+
/** Accessible name for the search box. Defaults to `"Filter rows"`. */
|
|
93
|
+
searchLabel?: string;
|
|
94
|
+
/** Rows currently matching. Shown as `count/total` when both are given. */
|
|
95
|
+
count?: number;
|
|
96
|
+
/** Rows before filtering. */
|
|
97
|
+
total?: number;
|
|
98
|
+
/** Trailing controls — a column picker, an export button. */
|
|
99
|
+
children?: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The strip above a table: one search box, a match count, your controls.
|
|
103
|
+
*
|
|
104
|
+
* The count is the part worth having as a component. "12/340" next to a filter
|
|
105
|
+
* box is the difference between "the table is empty" and "the filter is too
|
|
106
|
+
* tight", and it is the first thing left out of a hand-rolled toolbar.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* <DataTableToolbar value={q} onValueChange={setQ} count={table.getRowCount()} total={data.length}>
|
|
110
|
+
* <Button variant="ghost" size="sm">Export</Button>
|
|
111
|
+
* </DataTableToolbar>
|
|
112
|
+
*/
|
|
113
|
+
declare const DataTableToolbar: React.ForwardRefExoticComponent<DataTableToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
114
|
+
/**
|
|
115
|
+
* The slice of a table instance the pager reads.
|
|
116
|
+
*
|
|
117
|
+
* Structural rather than generic so `DataTablePagination` never has to be
|
|
118
|
+
* parameterised by `TData` — and so a server-paginated table that is not a
|
|
119
|
+
* TanStack instance at all can still use the control by supplying these seven
|
|
120
|
+
* members.
|
|
121
|
+
*/
|
|
122
|
+
interface DataTablePager {
|
|
123
|
+
getPageCount: () => number;
|
|
124
|
+
getRowCount: () => number;
|
|
125
|
+
getCanPreviousPage: () => boolean;
|
|
126
|
+
getCanNextPage: () => boolean;
|
|
127
|
+
firstPage: () => void;
|
|
128
|
+
previousPage: () => void;
|
|
129
|
+
nextPage: () => void;
|
|
130
|
+
lastPage: () => void;
|
|
131
|
+
readonly state: {
|
|
132
|
+
readonly pagination?: {
|
|
133
|
+
readonly pageIndex: number;
|
|
134
|
+
readonly pageSize: number;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Names for the four pager buttons, for translation. */
|
|
139
|
+
interface DataTablePaginationLabels {
|
|
140
|
+
first: string;
|
|
141
|
+
previous: string;
|
|
142
|
+
next: string;
|
|
143
|
+
last: string;
|
|
144
|
+
}
|
|
145
|
+
interface DataTablePaginationProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
146
|
+
/** The table instance from {@link useCueTable}, or anything with the same seven members. */
|
|
147
|
+
table: DataTablePager;
|
|
148
|
+
/** Accessible names for the four buttons. */
|
|
149
|
+
labels?: Partial<DataTablePaginationLabels>;
|
|
150
|
+
/** Render the position readout. Defaults to `"2 / 7"`. */
|
|
151
|
+
formatPosition?: (page: number, pages: number) => string;
|
|
152
|
+
/** Render the row count. Defaults to `"340 rows"`. */
|
|
153
|
+
formatRowCount?: (rows: number) => string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The pager: four buttons, the position, and the row count.
|
|
157
|
+
*
|
|
158
|
+
* First and last are present because a console table is often sorted to put the
|
|
159
|
+
* interesting row at one end, and stepping there one page at a time is not a
|
|
160
|
+
* navigation strategy. Every button is an `IconButton` with a real accessible
|
|
161
|
+
* name — an arrow glyph alone announces as nothing.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* <DataTablePagination table={table} />
|
|
165
|
+
*/
|
|
166
|
+
declare const DataTablePagination: React.ForwardRefExoticComponent<DataTablePaginationProps & React.RefAttributes<HTMLDivElement>>;
|
|
167
|
+
//#endregion
|
|
168
|
+
export { CueTable, CueTableFeatures, DataTablePager, DataTablePagination, DataTablePaginationLabels, DataTablePaginationProps, DataTableToolbar, DataTableToolbarProps, UseCueTableOptions, createCueColumnHelper, cueTableFeatures, flexRender, useCueTable };
|