@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,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { cva } from "../lib/cva.js";
|
|
4
|
+
import { buttonChassis, buttonTones } from "./button.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
//#region src/primitives/icon-button.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Square sibling of `buttonVariants`: one `size-control-*` token instead of a
|
|
11
|
+
* height plus horizontal padding, so the hit target stays a perfect square at
|
|
12
|
+
* every density.
|
|
13
|
+
*/
|
|
14
|
+
const iconButtonVariants = cva(buttonChassis, {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: buttonTones,
|
|
17
|
+
size: {
|
|
18
|
+
sm: "size-control-sm",
|
|
19
|
+
md: "size-control-md",
|
|
20
|
+
lg: "size-control-lg"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "ghost",
|
|
25
|
+
size: "md"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* A square, icon-only button for toolbars, row affordances and panel headers.
|
|
30
|
+
*
|
|
31
|
+
* Defaults to the `ghost` variant: in a dense console most icon buttons should
|
|
32
|
+
* be invisible until hovered, speaking through text colour rather than a rim.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <IconButton aria-label="Close panel" icon={X} />
|
|
36
|
+
* @example
|
|
37
|
+
* <IconButton aria-label="Delete cue" icon={Trash} variant="danger-outline" size="sm" />
|
|
38
|
+
*/
|
|
39
|
+
const IconButton = React.forwardRef(function IconButton({ className, variant, size, render, icon: Icon, type, ...elementProps }, ref) {
|
|
40
|
+
return useRender({
|
|
41
|
+
render,
|
|
42
|
+
ref,
|
|
43
|
+
defaultTagName: "button",
|
|
44
|
+
props: {
|
|
45
|
+
...render === void 0 ? { type: type ?? "button" } : type === void 0 ? {} : { type },
|
|
46
|
+
...elementProps,
|
|
47
|
+
className: cn(iconButtonVariants({
|
|
48
|
+
variant,
|
|
49
|
+
size
|
|
50
|
+
}), className),
|
|
51
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
className: cn("shrink-0", size === "sm" ? "size-icon-sm" : "size-icon-md")
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { IconButton };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button, ButtonProps, buttonVariants } from "./button.js";
|
|
2
|
+
import { StatusDot, StatusDotProps, StatusTone } from "./status-dot.js";
|
|
3
|
+
import { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps, AvatarSize } from "./avatar.js";
|
|
4
|
+
import { Chip, ChipProps, chipVariants } from "./chip.js";
|
|
5
|
+
import { IconButton, IconButtonProps } from "./icon-button.js";
|
|
6
|
+
import { Kbd, KbdProps } from "./kbd.js";
|
|
7
|
+
import { Separator, SeparatorProps } from "./separator.js";
|
|
8
|
+
import { Skeleton, SkeletonProps } from "./skeleton.js";
|
|
9
|
+
import { Spinner, SpinnerProps } from "./spinner.js";
|
|
10
|
+
export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Button, type ButtonProps, Chip, type ChipProps, IconButton, type IconButtonProps, Kbd, type KbdProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Spinner, type SpinnerProps, StatusDot, type StatusDotProps, type StatusTone, buttonVariants, chipVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button, buttonVariants } from "./button.js";
|
|
2
|
+
import { Chip, chipVariants } from "./chip.js";
|
|
3
|
+
import { Spinner } from "./spinner.js";
|
|
4
|
+
import { IconButton } from "./icon-button.js";
|
|
5
|
+
import { StatusDot } from "./status-dot.js";
|
|
6
|
+
import { Avatar, AvatarGroup } from "./avatar.js";
|
|
7
|
+
import { Kbd } from "./kbd.js";
|
|
8
|
+
import { Separator } from "./separator.js";
|
|
9
|
+
import { Skeleton } from "./skeleton.js";
|
|
10
|
+
export { Avatar, AvatarGroup, Button, Chip, IconButton, Kbd, Separator, Skeleton, Spinner, StatusDot, buttonVariants, chipVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/kbd.d.ts
|
|
3
|
+
/** Props for {@link Kbd}: the native `<kbd>` surface plus `className`. */
|
|
4
|
+
type KbdProps = React.ComponentPropsWithoutRef<"kbd">;
|
|
5
|
+
/**
|
|
6
|
+
* A key cap for documenting shortcuts inline: `⌘K`, `Esc`, `Shift`.
|
|
7
|
+
*
|
|
8
|
+
* Static markup — no `"use client"`, so it renders on the server. Sized off the
|
|
9
|
+
* chip height so a `Kbd` and a `Chip` line up on the same row, and set in the
|
|
10
|
+
* micro type step because shortcut hints are reference material, not content.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <span>Press <Kbd>⌘</Kbd><Kbd>K</Kbd> to search</span>
|
|
14
|
+
*/
|
|
15
|
+
declare const Kbd: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Kbd, KbdProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/kbd.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A key cap for documenting shortcuts inline: `⌘K`, `Esc`, `Shift`.
|
|
7
|
+
*
|
|
8
|
+
* Static markup — no `"use client"`, so it renders on the server. Sized off the
|
|
9
|
+
* chip height so a `Kbd` and a `Chip` line up on the same row, and set in the
|
|
10
|
+
* micro type step because shortcut hints are reference material, not content.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <span>Press <Kbd>⌘</Kbd><Kbd>K</Kbd> to search</span>
|
|
14
|
+
*/
|
|
15
|
+
const Kbd = React.forwardRef(function Kbd({ className, children, ...elementProps }, ref) {
|
|
16
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
17
|
+
ref,
|
|
18
|
+
className: cn("inline-flex h-chip min-w-chip select-none items-center justify-center rounded-(--radius-control) border border-border bg-surface-2 px-(--cue-space-2) font-mono text-(length:--cue-text-micro) leading-none text-fg-muted", className),
|
|
19
|
+
...elementProps,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Kbd };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Separator } from "@base-ui/react/separator";
|
|
3
|
+
//#region src/primitives/separator.d.ts
|
|
4
|
+
interface SeparatorProps extends Omit<Separator.Props, "className"> {
|
|
5
|
+
/** Extra classes, merged over the hairline defaults. */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A hairline rule that screen readers can see.
|
|
10
|
+
*
|
|
11
|
+
* Wraps Base UI's `Separator`, which contributes `role="separator"` and
|
|
12
|
+
* `aria-orientation`. The line itself is a 1px block painted with the `border`
|
|
13
|
+
* token rather than an actual CSS border: a bordered zero-height box collapses
|
|
14
|
+
* unpredictably inside flex rows, while a `h-px` block never does.
|
|
15
|
+
*
|
|
16
|
+
* Static markup — no `"use client"`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Separator />
|
|
20
|
+
* @example
|
|
21
|
+
* <div className="flex items-center gap-2">a <Separator orientation="vertical" /> b</div>
|
|
22
|
+
*/
|
|
23
|
+
declare const Separator$1: React.ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Separator$1 as Separator, SeparatorProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Separator } from "@base-ui/react/separator";
|
|
5
|
+
//#region src/primitives/separator.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A hairline rule that screen readers can see.
|
|
8
|
+
*
|
|
9
|
+
* Wraps Base UI's `Separator`, which contributes `role="separator"` and
|
|
10
|
+
* `aria-orientation`. The line itself is a 1px block painted with the `border`
|
|
11
|
+
* token rather than an actual CSS border: a bordered zero-height box collapses
|
|
12
|
+
* unpredictably inside flex rows, while a `h-px` block never does.
|
|
13
|
+
*
|
|
14
|
+
* Static markup — no `"use client"`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Separator />
|
|
18
|
+
* @example
|
|
19
|
+
* <div className="flex items-center gap-2">a <Separator orientation="vertical" /> b</div>
|
|
20
|
+
*/
|
|
21
|
+
const Separator$1 = React.forwardRef(function Separator$2({ className, orientation = "horizontal", ...elementProps }, ref) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
23
|
+
ref,
|
|
24
|
+
orientation,
|
|
25
|
+
className: cn("shrink-0 bg-border", orientation === "vertical" ? "h-full w-px" : "h-px w-full", className),
|
|
26
|
+
...elementProps
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Separator$1 as Separator };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/skeleton.d.ts
|
|
3
|
+
/** Props for {@link Skeleton}: the native `<div>` surface plus `className`. */
|
|
4
|
+
type SkeletonProps = React.ComponentPropsWithoutRef<"div">;
|
|
5
|
+
/**
|
|
6
|
+
* A loading placeholder block.
|
|
7
|
+
*
|
|
8
|
+
* Carries no intrinsic size — give it one with `className` (`h-4 w-24`) so the
|
|
9
|
+
* skeleton matches the shape of whatever is arriving. `aria-hidden` by default:
|
|
10
|
+
* a screen reader should hear the surrounding live region say "loading", not a
|
|
11
|
+
* fleet of empty boxes. The pulse stills under `prefers-reduced-motion`.
|
|
12
|
+
*
|
|
13
|
+
* Static markup — no `"use client"`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Skeleton className="h-4 w-32" />
|
|
17
|
+
*/
|
|
18
|
+
declare const Skeleton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Skeleton, SkeletonProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/skeleton.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A loading placeholder block.
|
|
7
|
+
*
|
|
8
|
+
* Carries no intrinsic size — give it one with `className` (`h-4 w-24`) so the
|
|
9
|
+
* skeleton matches the shape of whatever is arriving. `aria-hidden` by default:
|
|
10
|
+
* a screen reader should hear the surrounding live region say "loading", not a
|
|
11
|
+
* fleet of empty boxes. The pulse stills under `prefers-reduced-motion`.
|
|
12
|
+
*
|
|
13
|
+
* Static markup — no `"use client"`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Skeleton className="h-4 w-32" />
|
|
17
|
+
*/
|
|
18
|
+
const Skeleton = React.forwardRef(function Skeleton({ className, ...elementProps }, ref) {
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
ref,
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: cn("animate-pulse rounded-(--radius-control) bg-surface-2 motion-reduce:animate-none", className),
|
|
23
|
+
...elementProps
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Skeleton };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/spinner.d.ts
|
|
3
|
+
interface SpinnerProps extends Omit<React.ComponentPropsWithoutRef<"span">, "children"> {
|
|
4
|
+
/** Rung of the density icon ladder to draw at. Defaults to `"md"`. */
|
|
5
|
+
size?: "sm" | "md";
|
|
6
|
+
/** Accessible label announced while the spinner is on screen. Defaults to `"Loading"`. */
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An indeterminate progress ring, drawn in CSS only — no SVG, no animation
|
|
11
|
+
* library, one element.
|
|
12
|
+
*
|
|
13
|
+
* The ring is a conic gradient masked to a hairline annulus, inked with
|
|
14
|
+
* `currentColor`, so it inherits whatever text colour surrounds it (a spinner
|
|
15
|
+
* inside a `danger` button is red without being told). Under
|
|
16
|
+
* `prefers-reduced-motion` the rotation stops and the ring stays as a static
|
|
17
|
+
* arc rather than disappearing.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Spinner size="sm" />
|
|
21
|
+
* @example
|
|
22
|
+
* <Button disabled><Spinner /> Rendering…</Button>
|
|
23
|
+
*/
|
|
24
|
+
declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Spinner, SpinnerProps };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/spinner.tsx
|
|
6
|
+
/**
|
|
7
|
+
* An indeterminate progress ring, drawn in CSS only — no SVG, no animation
|
|
8
|
+
* library, one element.
|
|
9
|
+
*
|
|
10
|
+
* The ring is a conic gradient masked to a hairline annulus, inked with
|
|
11
|
+
* `currentColor`, so it inherits whatever text colour surrounds it (a spinner
|
|
12
|
+
* inside a `danger` button is red without being told). Under
|
|
13
|
+
* `prefers-reduced-motion` the rotation stops and the ring stays as a static
|
|
14
|
+
* arc rather than disappearing.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Spinner size="sm" />
|
|
18
|
+
* @example
|
|
19
|
+
* <Button disabled><Spinner /> Rendering…</Button>
|
|
20
|
+
*/
|
|
21
|
+
const Spinner = React.forwardRef(function Spinner({ className, size = "md", label = "Loading", ...elementProps }, ref) {
|
|
22
|
+
return /* @__PURE__ */ jsx("span", {
|
|
23
|
+
ref,
|
|
24
|
+
role: "status",
|
|
25
|
+
"aria-label": label,
|
|
26
|
+
className: cn("inline-block shrink-0 animate-spin rounded-full motion-reduce:animate-none", "[background:conic-gradient(from_0deg,transparent_0deg,currentColor_320deg)]", "[mask:radial-gradient(farthest-side,#0000_calc(100%_-_1.5px),#000_calc(100%_-_1.5px))]", size === "sm" ? "size-icon-sm" : "size-icon-md", className),
|
|
27
|
+
...elementProps
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Spinner };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/status-dot.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The five console states. `ok | busy | warn | danger` are the shared status
|
|
5
|
+
* vocabulary (same tokens as `Chip`, `Meter`, `Toast`); `idle` is the fifth,
|
|
6
|
+
* "nothing is happening here" state and is drawn hollow rather than filled.
|
|
7
|
+
*/
|
|
8
|
+
type StatusTone = "ok" | "busy" | "warn" | "danger" | "idle";
|
|
9
|
+
interface StatusDotProps extends Omit<React.ComponentPropsWithoutRef<"span">, "children"> {
|
|
10
|
+
/** Which state to paint. `idle` renders a hollow ring. */
|
|
11
|
+
tone: StatusTone;
|
|
12
|
+
/**
|
|
13
|
+
* Pulse the dot to signal live activity. Automatically stilled under
|
|
14
|
+
* `prefers-reduced-motion`.
|
|
15
|
+
*/
|
|
16
|
+
pulse?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Diameter in px at the default 16px root font size. Emitted as `rem`, so it
|
|
19
|
+
* scales with browser zoom and the user's font size. Defaults to `6`.
|
|
20
|
+
*/
|
|
21
|
+
size?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Screen-reader text. Defaults to the tone name, which is usually the honest
|
|
24
|
+
* answer; pass something specific when the surrounding row does not say it.
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A 6px state dot — the densest possible status indicator.
|
|
30
|
+
*
|
|
31
|
+
* Colour alone never carries meaning here: the dot is `aria-hidden` and the
|
|
32
|
+
* component always emits an `sr-only` label inside a `role="status"` wrapper,
|
|
33
|
+
* so the state is announced as well as shown (WCAG 1.4.1).
|
|
34
|
+
*
|
|
35
|
+
* Static markup — no `"use client"`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <StatusDot tone="ok" />
|
|
39
|
+
* @example
|
|
40
|
+
* <StatusDot tone="busy" pulse label="Rendering preview" size={8} />
|
|
41
|
+
*/
|
|
42
|
+
declare const StatusDot: React.ForwardRefExoticComponent<StatusDotProps & React.RefAttributes<HTMLSpanElement>>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { StatusDot, StatusDotProps, StatusTone };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/status-dot.tsx
|
|
5
|
+
const DOT_TONES = {
|
|
6
|
+
ok: "bg-ok",
|
|
7
|
+
busy: "bg-busy",
|
|
8
|
+
warn: "bg-warn",
|
|
9
|
+
danger: "bg-danger",
|
|
10
|
+
idle: "border border-fg-subtle bg-transparent"
|
|
11
|
+
};
|
|
12
|
+
/** Default diameter in px — the smallest dot that still reads as a shape. */
|
|
13
|
+
const DEFAULT_SIZE_PX = 6;
|
|
14
|
+
/** px at the reference 16px root, converted so the dot tracks browser zoom. */
|
|
15
|
+
const toRem = (px) => `${px / 16}rem`;
|
|
16
|
+
/**
|
|
17
|
+
* A 6px state dot — the densest possible status indicator.
|
|
18
|
+
*
|
|
19
|
+
* Colour alone never carries meaning here: the dot is `aria-hidden` and the
|
|
20
|
+
* component always emits an `sr-only` label inside a `role="status"` wrapper,
|
|
21
|
+
* so the state is announced as well as shown (WCAG 1.4.1).
|
|
22
|
+
*
|
|
23
|
+
* Static markup — no `"use client"`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <StatusDot tone="ok" />
|
|
27
|
+
* @example
|
|
28
|
+
* <StatusDot tone="busy" pulse label="Rendering preview" size={8} />
|
|
29
|
+
*/
|
|
30
|
+
const StatusDot = React.forwardRef(function StatusDot({ className, tone, pulse = false, size = DEFAULT_SIZE_PX, label, ...elementProps }, ref) {
|
|
31
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
32
|
+
ref,
|
|
33
|
+
role: "status",
|
|
34
|
+
className: cn("inline-flex shrink-0 items-center justify-center", className),
|
|
35
|
+
...elementProps,
|
|
36
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
className: cn("block shrink-0 rounded-full", DOT_TONES[tone], pulse ? "animate-pulse motion-reduce:animate-none" : null),
|
|
39
|
+
style: {
|
|
40
|
+
width: toRem(size),
|
|
41
|
+
height: toRem(size)
|
|
42
|
+
}
|
|
43
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "sr-only",
|
|
45
|
+
children: label ?? tone
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { StatusDot };
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*! @cueplusplus/ui — lane A stylesheet (Tailwind v4 consumers).
|
|
2
|
+
*
|
|
3
|
+
* Consumer app CSS:
|
|
4
|
+
* @import "tailwindcss";
|
|
5
|
+
* @import "@cueplusplus/ui/styles.css";
|
|
6
|
+
*
|
|
7
|
+
* Tailwind v4 does not scan node_modules, so the library registers its own
|
|
8
|
+
* sources: `@source "./"` resolves relative to THIS file, i.e. the shipped
|
|
9
|
+
* dist/, which is where the class strings live after the build.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@import "@cueplusplus/tokens/theme.css";
|
|
13
|
+
@import "@cueplusplus/tokens/tailwind.css";
|
|
14
|
+
|
|
15
|
+
@source "./";
|
|
16
|
+
|
|
17
|
+
@custom-variant density-ultra (&:where([data-density="ultra-compact"], [data-density="ultra-compact"] *));
|
|
18
|
+
@custom-variant density-large (&:where([data-density="large"], [data-density="large"] *));
|
|
19
|
+
@custom-variant mode-light (&:where([data-mode="light"], [data-mode="light"] *));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Density } from "@cueplusplus/tokens";
|
|
3
|
+
//#region src/system/density.d.ts
|
|
4
|
+
interface DensityProps {
|
|
5
|
+
/** Level to apply to this subtree: `ultra-compact`, `normal` or `large`. */
|
|
6
|
+
density: Density;
|
|
7
|
+
/** Subtree that should render at `density`. */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Extra classes for the island element. It is an ordinary `<div>` — style it like one. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Inline styles for the island element. */
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Re-scope any subtree to a different density level.
|
|
16
|
+
*
|
|
17
|
+
* Renders a plain `<div data-density="…">`: the geometry custom properties are
|
|
18
|
+
* re-declared by the attribute selector and inherit down, so nesting is free and
|
|
19
|
+
* needs no JS. The matching React context is published alongside for the rare
|
|
20
|
+
* JS reads (`useDensity()`, `useControlHeight()`, portal stamping) — the DOM
|
|
21
|
+
* attribute, not the context, is what actually restyles the tree.
|
|
22
|
+
*
|
|
23
|
+
* Theme and mode are deliberately *not* re-scoped here: density is the only axis
|
|
24
|
+
* an island may override (spec §6).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <Density density="ultra-compact">
|
|
28
|
+
* <Toolbar />
|
|
29
|
+
* </Density>
|
|
30
|
+
*/
|
|
31
|
+
declare function Density$1({ density, children, className, style }: DensityProps): React.JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Density$1 as Density, DensityProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/system/density.tsx
|
|
5
|
+
/** Density level every unstamped subtree falls back to. */
|
|
6
|
+
const DEFAULT_DENSITY = "normal";
|
|
7
|
+
/** The three levels, as a runtime array for validating persisted input. */
|
|
8
|
+
const DENSITY_LEVELS = [
|
|
9
|
+
"ultra-compact",
|
|
10
|
+
"normal",
|
|
11
|
+
"large"
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Nearest ambient density. `null` means "nothing has stamped a level yet", which
|
|
15
|
+
* `useDensity()` reports as {@link DEFAULT_DENSITY}.
|
|
16
|
+
*
|
|
17
|
+
* Internal: consumers read it through `useDensity()`, never directly.
|
|
18
|
+
*/
|
|
19
|
+
const DensityContext = React.createContext(null);
|
|
20
|
+
/**
|
|
21
|
+
* Re-scope any subtree to a different density level.
|
|
22
|
+
*
|
|
23
|
+
* Renders a plain `<div data-density="…">`: the geometry custom properties are
|
|
24
|
+
* re-declared by the attribute selector and inherit down, so nesting is free and
|
|
25
|
+
* needs no JS. The matching React context is published alongside for the rare
|
|
26
|
+
* JS reads (`useDensity()`, `useControlHeight()`, portal stamping) — the DOM
|
|
27
|
+
* attribute, not the context, is what actually restyles the tree.
|
|
28
|
+
*
|
|
29
|
+
* Theme and mode are deliberately *not* re-scoped here: density is the only axis
|
|
30
|
+
* an island may override (spec §6).
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Density density="ultra-compact">
|
|
34
|
+
* <Toolbar />
|
|
35
|
+
* </Density>
|
|
36
|
+
*/
|
|
37
|
+
function Density({ density, children, className, style }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(DensityContext.Provider, {
|
|
39
|
+
value: density,
|
|
40
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
41
|
+
"data-density": density,
|
|
42
|
+
className,
|
|
43
|
+
style,
|
|
44
|
+
children
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DEFAULT_DENSITY, DENSITY_LEVELS, Density, DensityContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResolvedMode, ThemeContextValue, ThemeProvider, ThemeProviderProps } from "./theme-provider.js";
|
|
2
|
+
import { Density, DensityProps } from "./density.js";
|
|
3
|
+
import { CuePortalFrame, CuePortalFrameProps, useCuePortalProps } from "./portal.js";
|
|
4
|
+
import { DEFAULT_STORAGE_KEY, PersistedPreferences, prepaintScript } from "./prepaint.js";
|
|
5
|
+
import { ControlSize, useControlHeight, useDensity } from "./use-density.js";
|
|
6
|
+
import { useTheme } from "./use-theme.js";
|
|
7
|
+
import { Density as DensityLevel, Mode, ThemeName } from "@cueplusplus/tokens";
|
|
8
|
+
export { type ControlSize, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, Density, type DensityLevel, type DensityProps, type Mode, type PersistedPreferences, type ResolvedMode, type ThemeContextValue, type ThemeName, ThemeProvider, type ThemeProviderProps, prepaintScript, useControlHeight, useCuePortalProps, useDensity, useTheme };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Density } from "./density.js";
|
|
2
|
+
import { DEFAULT_STORAGE_KEY, prepaintScript } from "./prepaint.js";
|
|
3
|
+
import { ThemeProvider } from "./theme-provider.js";
|
|
4
|
+
import { CuePortalFrame, useCuePortalProps } from "./portal.js";
|
|
5
|
+
import { useControlHeight, useDensity } from "./use-density.js";
|
|
6
|
+
import { useTheme } from "./use-theme.js";
|
|
7
|
+
export { CuePortalFrame, DEFAULT_STORAGE_KEY, Density, ThemeProvider, prepaintScript, useControlHeight, useCuePortalProps, useDensity, useTheme };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/system/portal.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Props to spread onto a Base UI `Portal` part so the portal root inherits the
|
|
5
|
+
* caller's theme, density and mode.
|
|
6
|
+
*
|
|
7
|
+
* Returns a `container` element appended to `document.body` and stamped with
|
|
8
|
+
* `data-theme` / `data-density` / `data-mode` (plus `--cue-font-scale`) copied
|
|
9
|
+
* from the nearest provider and density island. The container is
|
|
10
|
+
* `display: contents`, so it changes no layout and creates no containing block —
|
|
11
|
+
* fixed-position overlay content behaves exactly as if it were a direct child of
|
|
12
|
+
* `<body>`.
|
|
13
|
+
*
|
|
14
|
+
* Before the container exists (server render, first client render) the object is
|
|
15
|
+
* empty, which leaves the Base UI default (`document.body`) in place.
|
|
16
|
+
*
|
|
17
|
+
* Every overlay in this system spreads this. It is the single fix for the
|
|
18
|
+
* nested-density portal bug (spec §6).
|
|
19
|
+
*
|
|
20
|
+
* @returns `{ container }` once mounted, `{}` otherwise.
|
|
21
|
+
* @example
|
|
22
|
+
* const portalProps = useCuePortalProps();
|
|
23
|
+
* <Popover.Portal {...portalProps}><Popover.Positioner>…</Popover.Positioner></Popover.Portal>
|
|
24
|
+
*/
|
|
25
|
+
declare function useCuePortalProps(): {
|
|
26
|
+
container?: HTMLElement;
|
|
27
|
+
};
|
|
28
|
+
interface CuePortalFrameProps {
|
|
29
|
+
/** Portal content to stamp. */
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
/** Extra classes for the frame element. */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Inline styles, merged after `display: contents`. */
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Inline version of the portal contract, for portals whose container cannot be
|
|
38
|
+
* chosen (a third-party overlay, or content already portaled by something else).
|
|
39
|
+
*
|
|
40
|
+
* Wraps `children` in a `display: contents` element carrying the same
|
|
41
|
+
* `data-theme` / `data-density` / `data-mode` triple and `--cue-font-scale` as
|
|
42
|
+
* {@link useCuePortalProps}. Prefer the hook — a stamped container costs one
|
|
43
|
+
* element per overlay instead of one per render tree — and reach for this only
|
|
44
|
+
* when the container prop is not available.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* <SomeThirdPartyPortal><CuePortalFrame>{content}</CuePortalFrame></SomeThirdPartyPortal>
|
|
48
|
+
*/
|
|
49
|
+
declare function CuePortalFrame({ children, className, style }: CuePortalFrameProps): React.JSX.Element;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { CuePortalFrame, CuePortalFrameProps, useCuePortalProps };
|