@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,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
3
|
+
//#region src/overlays/tooltip.d.ts
|
|
4
|
+
interface TooltipProviderProps extends Tooltip.Provider.Props {}
|
|
5
|
+
/**
|
|
6
|
+
* Shares one hover delay across a group of tooltips: once the first one has
|
|
7
|
+
* opened, its neighbours open instantly, so scanning a toolbar does not mean
|
|
8
|
+
* waiting out the delay at every button.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Tooltip.Provider delay={400}><Toolbar>…</Toolbar></Tooltip.Provider>
|
|
12
|
+
*/
|
|
13
|
+
declare function TooltipProvider(props: TooltipProviderProps): React.JSX.Element;
|
|
14
|
+
interface TooltipRootProps extends Tooltip.Root.Props {}
|
|
15
|
+
/** Groups the parts of one tooltip. Renders no element. */
|
|
16
|
+
declare function TooltipRoot({ children, ...rootProps }: TooltipRootProps): React.JSX.Element;
|
|
17
|
+
interface TooltipTriggerProps extends Tooltip.Trigger.Props {}
|
|
18
|
+
interface TooltipContentProps extends Omit<Tooltip.Popup.Props, "className"> {
|
|
19
|
+
/** Extra classes for the popup surface. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Extra classes for the positioner that places the popup. */
|
|
22
|
+
positionerClassName?: string;
|
|
23
|
+
/** Preferred side of the trigger. Defaults to `"top"`. */
|
|
24
|
+
side?: Tooltip.Positioner.Props["side"];
|
|
25
|
+
/** Alignment along that side. Defaults to `"center"`. */
|
|
26
|
+
align?: Tooltip.Positioner.Props["align"];
|
|
27
|
+
/** Gap in px between trigger and popup. Defaults to `4`. */
|
|
28
|
+
sideOffset?: Tooltip.Positioner.Props["sideOffset"];
|
|
29
|
+
/** Nudge along the alignment axis, in px. */
|
|
30
|
+
alignOffset?: Tooltip.Positioner.Props["alignOffset"];
|
|
31
|
+
/** Keep the popup mounted while closed. */
|
|
32
|
+
keepMounted?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A short label revealed on hover or keyboard focus — what an icon-only control
|
|
36
|
+
* does, what an abbreviated column header means.
|
|
37
|
+
*
|
|
38
|
+
* Wraps Base UI's `Tooltip` and adds the two things a design system must not
|
|
39
|
+
* leave to the caller: the `role="tooltip"` / `aria-describedby` pairing, and
|
|
40
|
+
* the portal theme stamp. For anything longer than a label, reach for
|
|
41
|
+
* {@link InfoTip} (a focusable badge) or a `Popover` instead — hover-only
|
|
42
|
+
* content is unreachable on touch.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <Tooltip.Root>
|
|
46
|
+
* <Tooltip.Trigger render={<IconButton aria-label="Blackout" icon={Power} />} />
|
|
47
|
+
* <Tooltip.Content>Fades every channel to zero</Tooltip.Content>
|
|
48
|
+
* </Tooltip.Root>
|
|
49
|
+
*/
|
|
50
|
+
declare const Tooltip$1: {
|
|
51
|
+
Provider: typeof TooltipProvider;
|
|
52
|
+
Root: typeof TooltipRoot;
|
|
53
|
+
Trigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
Content: React.ForwardRefExoticComponent<Omit<TooltipContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Tooltip$1 as Tooltip, TooltipContentProps, TooltipProviderProps, TooltipRootProps, TooltipTriggerProps };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { useCuePortalProps } from "../system/portal.js";
|
|
4
|
+
import { overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses } from "./_surface.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
8
|
+
//#region src/overlays/tooltip.tsx
|
|
9
|
+
/**
|
|
10
|
+
* The id the trigger points `aria-describedby` at and the popup answers to.
|
|
11
|
+
*
|
|
12
|
+
* Base UI does not wire the two together — its tooltip is a purely visual
|
|
13
|
+
* affordance — so this layer does it. Without the pairing a screen reader user
|
|
14
|
+
* gets no hint at all, and this system uses tooltips for real information
|
|
15
|
+
* (see {@link InfoTip}).
|
|
16
|
+
*/
|
|
17
|
+
const TooltipIdContext = React.createContext(void 0);
|
|
18
|
+
/**
|
|
19
|
+
* Shares one hover delay across a group of tooltips: once the first one has
|
|
20
|
+
* opened, its neighbours open instantly, so scanning a toolbar does not mean
|
|
21
|
+
* waiting out the delay at every button.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Tooltip.Provider delay={400}><Toolbar>…</Toolbar></Tooltip.Provider>
|
|
25
|
+
*/
|
|
26
|
+
function TooltipProvider(props) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Tooltip.Provider, { ...props });
|
|
28
|
+
}
|
|
29
|
+
/** Groups the parts of one tooltip. Renders no element. */
|
|
30
|
+
function TooltipRoot({ children, ...rootProps }) {
|
|
31
|
+
const id = React.useId();
|
|
32
|
+
return /* @__PURE__ */ jsx(TooltipIdContext.Provider, {
|
|
33
|
+
value: id,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Tooltip.Root, {
|
|
35
|
+
...rootProps,
|
|
36
|
+
children
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A short label revealed on hover or keyboard focus — what an icon-only control
|
|
42
|
+
* does, what an abbreviated column header means.
|
|
43
|
+
*
|
|
44
|
+
* Wraps Base UI's `Tooltip` and adds the two things a design system must not
|
|
45
|
+
* leave to the caller: the `role="tooltip"` / `aria-describedby` pairing, and
|
|
46
|
+
* the portal theme stamp. For anything longer than a label, reach for
|
|
47
|
+
* {@link InfoTip} (a focusable badge) or a `Popover` instead — hover-only
|
|
48
|
+
* content is unreachable on touch.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* <Tooltip.Root>
|
|
52
|
+
* <Tooltip.Trigger render={<IconButton aria-label="Blackout" icon={Power} />} />
|
|
53
|
+
* <Tooltip.Content>Fades every channel to zero</Tooltip.Content>
|
|
54
|
+
* </Tooltip.Root>
|
|
55
|
+
*/
|
|
56
|
+
const Tooltip$1 = {
|
|
57
|
+
Provider: TooltipProvider,
|
|
58
|
+
Root: TooltipRoot,
|
|
59
|
+
Trigger: React.forwardRef(function TooltipTrigger({ className, ...elementProps }, ref) {
|
|
60
|
+
const id = React.useContext(TooltipIdContext);
|
|
61
|
+
return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
62
|
+
ref,
|
|
63
|
+
"data-slot": "tooltip-trigger",
|
|
64
|
+
"aria-describedby": id,
|
|
65
|
+
className: cn(className),
|
|
66
|
+
...elementProps
|
|
67
|
+
});
|
|
68
|
+
}),
|
|
69
|
+
Content: React.forwardRef(function TooltipContent({ className, positionerClassName, side = "top", align, sideOffset = 4, alignOffset, keepMounted, children, ...popupProps }, ref) {
|
|
70
|
+
const portalProps = useCuePortalProps();
|
|
71
|
+
const id = React.useContext(TooltipIdContext);
|
|
72
|
+
return /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
73
|
+
keepMounted,
|
|
74
|
+
...portalProps,
|
|
75
|
+
children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
76
|
+
className: cn(overlayPositionerClasses, positionerClassName),
|
|
77
|
+
side,
|
|
78
|
+
align,
|
|
79
|
+
sideOffset,
|
|
80
|
+
alignOffset,
|
|
81
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, {
|
|
82
|
+
ref,
|
|
83
|
+
id,
|
|
84
|
+
role: "tooltip",
|
|
85
|
+
"data-slot": "tooltip-popup",
|
|
86
|
+
className: cn(overlaySurfaceClasses, overlayPopupTransitionClasses, "max-w-[16rem] px-(--cue-space-3) py-(--cue-space-2) font-mono text-(length:--cue-text-label) leading-relaxed text-fg", className),
|
|
87
|
+
...popupProps,
|
|
88
|
+
children
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { Tooltip$1 as Tooltip };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ClassProp, VariantProps } from "../lib/cva.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/primitives/avatar.d.ts
|
|
4
|
+
/** Rung of the control ladder an avatar (and its group) sits on. */
|
|
5
|
+
type AvatarSize = "sm" | "md" | "lg";
|
|
6
|
+
declare const avatarVariants: (props?: ({
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & ClassProp) | undefined) => string;
|
|
9
|
+
interface AvatarProps extends Omit<React.ComponentPropsWithoutRef<"span">, "children">, VariantProps<typeof avatarVariants> {
|
|
10
|
+
/** Image URL. Omit to go straight to the fallback. */
|
|
11
|
+
src?: string;
|
|
12
|
+
/** Alt text for the image, and the name the default initials are derived from. */
|
|
13
|
+
alt?: string;
|
|
14
|
+
/** What to show while the image loads or after it fails. Defaults to initials from `alt`. */
|
|
15
|
+
fallback?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A round user/entity avatar sized off the density control ladder, so it lines
|
|
19
|
+
* up with the buttons and inputs on the same row.
|
|
20
|
+
*
|
|
21
|
+
* Wraps Base UI's `Avatar`, which owns the image-loading state machine: the
|
|
22
|
+
* fallback shows immediately, is replaced when the image decodes, and comes
|
|
23
|
+
* back if the image errors.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <Avatar alt="Ada Lovelace" src="/ada.png" />
|
|
27
|
+
* @example
|
|
28
|
+
* <Avatar alt="Ada Lovelace" size="sm" />
|
|
29
|
+
*/
|
|
30
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
31
|
+
interface AvatarGroupProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
32
|
+
/** Show at most this many avatars; the rest collapse into a `+N` chip. Omit for no limit. */
|
|
33
|
+
max?: number;
|
|
34
|
+
/** Size of the `+N` overflow chip. Match it to the avatars you pass in. Defaults to `"md"`. */
|
|
35
|
+
size?: AvatarSize;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An overlapping stack of {@link Avatar}s with a `+N` overflow chip.
|
|
39
|
+
*
|
|
40
|
+
* Each item after the first is pulled left by a negative inline-start margin
|
|
41
|
+
* and ringed in the page background colour, which is what reads as "stacked"
|
|
42
|
+
* rather than "crowded". Logical margins, so the stack flips correctly in RTL.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <AvatarGroup max={3}>
|
|
46
|
+
* {users.map((u) => <Avatar key={u.id} alt={u.name} src={u.avatar} />)}
|
|
47
|
+
* </AvatarGroup>
|
|
48
|
+
*/
|
|
49
|
+
declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps, AvatarSize };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { cva } from "../lib/cva.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
7
|
+
//#region src/primitives/avatar.tsx
|
|
8
|
+
const avatarVariants = cva("relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full border border-border bg-surface-2 font-mono leading-none tracking-normal text-fg-muted uppercase", {
|
|
9
|
+
variants: { size: {
|
|
10
|
+
sm: "size-control-sm text-(length:--cue-text-micro)",
|
|
11
|
+
md: "size-control-md text-(length:--cue-text-label)",
|
|
12
|
+
lg: "size-control-lg text-(length:--cue-text-ui)"
|
|
13
|
+
} },
|
|
14
|
+
defaultVariants: { size: "md" }
|
|
15
|
+
});
|
|
16
|
+
/** Overlap for stacked avatars: half a step of negative inline-start margin. */
|
|
17
|
+
const OVERLAP_CLASS = "[margin-inline-start:calc(var(--cue-space-2)*-1)]";
|
|
18
|
+
/**
|
|
19
|
+
* "Ada Lovelace" → "AL"; "cue" → "CU"; nothing usable → "?".
|
|
20
|
+
*
|
|
21
|
+
* Deliberately naive and synchronous: initials are decoration behind a real
|
|
22
|
+
* `alt`, not an identity claim.
|
|
23
|
+
*/
|
|
24
|
+
function initialsFrom(name) {
|
|
25
|
+
const words = (name ?? "").trim().split(/\s+/).filter(Boolean);
|
|
26
|
+
if (words.length === 0) return "?";
|
|
27
|
+
if (words.length === 1) return (words[0] ?? "").slice(0, 2).toUpperCase();
|
|
28
|
+
return `${words[0]?.[0] ?? ""}${words[words.length - 1]?.[0] ?? ""}`.toUpperCase();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A round user/entity avatar sized off the density control ladder, so it lines
|
|
32
|
+
* up with the buttons and inputs on the same row.
|
|
33
|
+
*
|
|
34
|
+
* Wraps Base UI's `Avatar`, which owns the image-loading state machine: the
|
|
35
|
+
* fallback shows immediately, is replaced when the image decodes, and comes
|
|
36
|
+
* back if the image errors.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Avatar alt="Ada Lovelace" src="/ada.png" />
|
|
40
|
+
* @example
|
|
41
|
+
* <Avatar alt="Ada Lovelace" size="sm" />
|
|
42
|
+
*/
|
|
43
|
+
const Avatar$1 = React.forwardRef(function Avatar$2({ className, size, src, alt, fallback, ...elementProps }, ref) {
|
|
44
|
+
return /* @__PURE__ */ jsxs(Avatar.Root, {
|
|
45
|
+
ref,
|
|
46
|
+
className: cn(avatarVariants({ size }), className),
|
|
47
|
+
...elementProps,
|
|
48
|
+
children: [src === void 0 ? null : /* @__PURE__ */ jsx(Avatar.Image, {
|
|
49
|
+
src,
|
|
50
|
+
alt: alt ?? "",
|
|
51
|
+
className: "size-full object-cover"
|
|
52
|
+
}), /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
53
|
+
className: "leading-none",
|
|
54
|
+
children: fallback ?? initialsFrom(alt)
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const OVERFLOW_SIZES = {
|
|
59
|
+
sm: "size-control-sm text-(length:--cue-text-micro)",
|
|
60
|
+
md: "size-control-md text-(length:--cue-text-micro)",
|
|
61
|
+
lg: "size-control-lg text-(length:--cue-text-label)"
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* An overlapping stack of {@link Avatar}s with a `+N` overflow chip.
|
|
65
|
+
*
|
|
66
|
+
* Each item after the first is pulled left by a negative inline-start margin
|
|
67
|
+
* and ringed in the page background colour, which is what reads as "stacked"
|
|
68
|
+
* rather than "crowded". Logical margins, so the stack flips correctly in RTL.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* <AvatarGroup max={3}>
|
|
72
|
+
* {users.map((u) => <Avatar key={u.id} alt={u.name} src={u.avatar} />)}
|
|
73
|
+
* </AvatarGroup>
|
|
74
|
+
*/
|
|
75
|
+
const AvatarGroup = React.forwardRef(function AvatarGroup({ className, max, size = "md", children, ...elementProps }, ref) {
|
|
76
|
+
const items = React.Children.toArray(children);
|
|
77
|
+
const visible = max === void 0 ? items : items.slice(0, Math.max(0, max));
|
|
78
|
+
const overflow = items.length - visible.length;
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
ref,
|
|
81
|
+
className: cn("flex items-center", className),
|
|
82
|
+
...elementProps,
|
|
83
|
+
children: [visible.map((child, index) => /* @__PURE__ */ jsx("span", {
|
|
84
|
+
className: cn("relative inline-flex rounded-full ring-1 ring-bg", index === 0 ? null : OVERLAP_CLASS),
|
|
85
|
+
children: child
|
|
86
|
+
}, index)), overflow > 0 ? /* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: cn("relative inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-surface-3 font-mono leading-none text-fg-muted ring-1 ring-bg", OVERFLOW_SIZES[size], OVERLAP_CLASS),
|
|
88
|
+
children: `+${overflow}`
|
|
89
|
+
}) : null]
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { Avatar$1 as Avatar, AvatarGroup };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ClassProp, VariantProps } from "../lib/cva.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/primitives/button.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The `Button` class recipe, exported so other surfaces (a link that must look
|
|
7
|
+
* like a button, a third-party trigger) can borrow the exact same classes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <a className={buttonVariants({ variant: "primary", size: "sm" })} href="/go">Go</a>
|
|
11
|
+
*/
|
|
12
|
+
declare const buttonVariants: (props?: ({
|
|
13
|
+
variant?: "ghost" | "primary" | "secondary" | "outline" | "danger" | "danger-outline" | null | undefined;
|
|
14
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & ClassProp) | undefined) => string;
|
|
16
|
+
interface ButtonProps extends React.ComponentPropsWithoutRef<"button">, VariantProps<typeof buttonVariants> {
|
|
17
|
+
/**
|
|
18
|
+
* Replace the rendered element (Base UI render prop). Accepts an element —
|
|
19
|
+
* `render={<a href="/x" />}` — or a function returning one. When set, the
|
|
20
|
+
* default `type="button"` is dropped so non-button elements stay valid.
|
|
21
|
+
*/
|
|
22
|
+
render?: useRender.RenderProp;
|
|
23
|
+
/**
|
|
24
|
+
* Optional leading icon component (e.g. a lucide icon). Rendered
|
|
25
|
+
* `aria-hidden` and sized to the density icon token, so it tracks the density
|
|
26
|
+
* level without the caller passing a pixel size.
|
|
27
|
+
*/
|
|
28
|
+
icon?: React.ElementType;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The system's primary action control.
|
|
32
|
+
*
|
|
33
|
+
* A real `<button>` by default, restyled entirely from tokens: height comes
|
|
34
|
+
* from the density control ladder, colour from the theme's accent/surface ramp.
|
|
35
|
+
* The focus ring is an `outline`, never a `box-shadow`, so it survives inside
|
|
36
|
+
* `overflow: hidden` panels.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Button variant="primary" size="sm" icon={Play}>Run cue</Button>
|
|
40
|
+
* @example
|
|
41
|
+
* // Compose with a router link instead of a <button>:
|
|
42
|
+
* <Button render={<Link href="/patch" />}>Patch</Button>
|
|
43
|
+
*/
|
|
44
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Button, ButtonProps, buttonVariants };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { cva } from "../lib/cva.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
//#region src/primitives/button.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The chassis every control-shaped primitive shares: layout, mono type, the
|
|
10
|
+
* density radius, the transition and the focus ring. Deliberately carries no
|
|
11
|
+
* size and no colour so `Button` (height + horizontal padding) and `IconButton`
|
|
12
|
+
* (one square token) can each add their own without fighting `tailwind-merge`.
|
|
13
|
+
*
|
|
14
|
+
* `focus-visible:outline-solid` is load-bearing, not decoration. In Tailwind v4
|
|
15
|
+
* `outline-2` compiles to `outline-style: var(--tw-outline-style)` and
|
|
16
|
+
* `outline-none` sets that property to `none` on the element — so a control
|
|
17
|
+
* carrying both resolves its ring to `outline-style: none` and paints nothing.
|
|
18
|
+
* Restoring the style at ring time is what makes the focus indicator exist
|
|
19
|
+
* (WCAG 2.4.7). `test/focus-ring.test.ts` guards every occurrence.
|
|
20
|
+
*
|
|
21
|
+
* @internal Not part of the public API; imported by `icon-button.tsx`.
|
|
22
|
+
*/
|
|
23
|
+
const buttonChassis = "inline-flex select-none items-center justify-center gap-[0.4em] whitespace-nowrap rounded-(--radius-control) font-mono font-medium transition-colors duration-150 outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-accent disabled:pointer-events-none disabled:opacity-40";
|
|
24
|
+
/**
|
|
25
|
+
* The shared colour vocabulary. `accent` is theme-controlled, so `primary`
|
|
26
|
+
* reads as white-on-black in `cue` and cyan-on-near-black in `terminal` with no
|
|
27
|
+
* per-theme branching here.
|
|
28
|
+
*
|
|
29
|
+
* @internal Not part of the public API; imported by `icon-button.tsx`.
|
|
30
|
+
*/
|
|
31
|
+
const buttonTones = {
|
|
32
|
+
primary: "bg-accent text-accent-fg hover:bg-accent-hover border border-transparent",
|
|
33
|
+
secondary: "border border-border text-fg-muted hover:border-border-strong hover:text-fg bg-surface-2",
|
|
34
|
+
ghost: "text-fg-muted hover:text-fg hover:bg-surface-2 border border-transparent",
|
|
35
|
+
outline: "border border-border text-fg hover:border-accent hover:text-accent bg-transparent",
|
|
36
|
+
danger: "bg-danger text-white hover:opacity-90 border border-transparent",
|
|
37
|
+
"danger-outline": "border text-danger bg-transparent hover:bg-danger/10 border-danger/40"
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The `Button` class recipe, exported so other surfaces (a link that must look
|
|
41
|
+
* like a button, a third-party trigger) can borrow the exact same classes.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* <a className={buttonVariants({ variant: "primary", size: "sm" })} href="/go">Go</a>
|
|
45
|
+
*/
|
|
46
|
+
const buttonVariants = cva(buttonChassis, {
|
|
47
|
+
variants: {
|
|
48
|
+
variant: buttonTones,
|
|
49
|
+
size: {
|
|
50
|
+
sm: "h-control-sm px-(--cue-space-4) text-(length:--cue-text-ui)",
|
|
51
|
+
md: "h-control-md px-(--cue-space-5) text-(length:--cue-text-ui)",
|
|
52
|
+
lg: "h-control-lg px-(--cue-space-6) text-(length:--cue-text-emphasis)"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
size: "md"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* The system's primary action control.
|
|
62
|
+
*
|
|
63
|
+
* A real `<button>` by default, restyled entirely from tokens: height comes
|
|
64
|
+
* from the density control ladder, colour from the theme's accent/surface ramp.
|
|
65
|
+
* The focus ring is an `outline`, never a `box-shadow`, so it survives inside
|
|
66
|
+
* `overflow: hidden` panels.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* <Button variant="primary" size="sm" icon={Play}>Run cue</Button>
|
|
70
|
+
* @example
|
|
71
|
+
* // Compose with a router link instead of a <button>:
|
|
72
|
+
* <Button render={<Link href="/patch" />}>Patch</Button>
|
|
73
|
+
*/
|
|
74
|
+
const Button = React.forwardRef(function Button({ className, variant, size, render, icon: Icon, children, type, ...elementProps }, ref) {
|
|
75
|
+
return useRender({
|
|
76
|
+
render,
|
|
77
|
+
ref,
|
|
78
|
+
defaultTagName: "button",
|
|
79
|
+
props: {
|
|
80
|
+
...render === void 0 ? { type: type ?? "button" } : type === void 0 ? {} : { type },
|
|
81
|
+
...elementProps,
|
|
82
|
+
className: cn(buttonVariants({
|
|
83
|
+
variant,
|
|
84
|
+
size
|
|
85
|
+
}), className),
|
|
86
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [Icon === void 0 ? null : /* @__PURE__ */ jsx(Icon, {
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
className: cn("shrink-0", size === "sm" ? "size-icon-sm" : "size-icon-md")
|
|
89
|
+
}), children] })
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
//#endregion
|
|
94
|
+
export { Button, buttonChassis, buttonTones, buttonVariants };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ClassProp, VariantProps } from "../lib/cva.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/primitives/chip.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The tinted-chip recipe: `bg-<tone>/10 border-<tone>/35 text-<tone>`.
|
|
6
|
+
*
|
|
7
|
+
* Tone and fill are split across `variants` and `compoundVariants` on purpose.
|
|
8
|
+
* Emitting `bg-<tone>/10` from the tone map and then cancelling it with
|
|
9
|
+
* `bg-transparent` for the outline variant would leave two competing background
|
|
10
|
+
* utilities in the class string and lean on `tailwind-merge` to pick a winner —
|
|
11
|
+
* which it cannot do reliably for token-named colours. Compound variants emit
|
|
12
|
+
* exactly one fill, always.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <span className={chipVariants({ tone: "danger", variant: "outline" })}>fault</span>
|
|
16
|
+
*/
|
|
17
|
+
declare const chipVariants: (props?: ({
|
|
18
|
+
tone?: "danger" | "info" | "warn" | "accent" | "ok" | "busy" | "neutral" | null | undefined;
|
|
19
|
+
variant?: "outline" | "tinted" | null | undefined;
|
|
20
|
+
interactive?: boolean | null | undefined;
|
|
21
|
+
} & ClassProp) | undefined) => string;
|
|
22
|
+
interface ChipProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof chipVariants> {
|
|
23
|
+
/**
|
|
24
|
+
* Render as a `<button>` with hover feedback instead of a static `<span>`.
|
|
25
|
+
* Use for filter pills and other clickable tags; leave off for pure labels.
|
|
26
|
+
*/
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
/** Disable the interactive form. Ignored when `interactive` is not set. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Chip content — normally one or two words, or a short count. */
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A compact status/label pill: mono, uppercase, wide-tracked, one line tall.
|
|
35
|
+
*
|
|
36
|
+
* `tone` uses the shared status vocabulary (`ok | busy | warn | danger | info`)
|
|
37
|
+
* plus `neutral` and `accent`, so a chip, a `StatusDot` and a `Meter` always
|
|
38
|
+
* agree on what "warn" looks like.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <Chip tone="ok">online</Chip>
|
|
42
|
+
* @example
|
|
43
|
+
* <Chip tone="accent" variant="outline" interactive onClick={toggle}>dimmer</Chip>
|
|
44
|
+
*/
|
|
45
|
+
declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLElement>>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Chip, ChipProps, chipVariants };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { cva } from "../lib/cva.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/primitives/chip.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The tinted-chip recipe: `bg-<tone>/10 border-<tone>/35 text-<tone>`.
|
|
9
|
+
*
|
|
10
|
+
* Tone and fill are split across `variants` and `compoundVariants` on purpose.
|
|
11
|
+
* Emitting `bg-<tone>/10` from the tone map and then cancelling it with
|
|
12
|
+
* `bg-transparent` for the outline variant would leave two competing background
|
|
13
|
+
* utilities in the class string and lean on `tailwind-merge` to pick a winner —
|
|
14
|
+
* which it cannot do reliably for token-named colours. Compound variants emit
|
|
15
|
+
* exactly one fill, always.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <span className={chipVariants({ tone: "danger", variant: "outline" })}>fault</span>
|
|
19
|
+
*/
|
|
20
|
+
const chipVariants = cva("inline-flex h-chip select-none items-center justify-center gap-(--cue-space-2) whitespace-nowrap rounded-(--radius-control) border px-(--cue-space-3) font-mono text-(length:--cue-text-label) leading-none uppercase tracking-[0.15em] outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-accent", {
|
|
21
|
+
variants: {
|
|
22
|
+
tone: {
|
|
23
|
+
neutral: "border-border text-fg-muted",
|
|
24
|
+
accent: "border-accent/35 text-accent",
|
|
25
|
+
ok: "border-ok/35 text-ok",
|
|
26
|
+
busy: "border-busy/35 text-busy",
|
|
27
|
+
warn: "border-warn/35 text-warn",
|
|
28
|
+
danger: "border-danger/35 text-danger",
|
|
29
|
+
info: "border-info/35 text-info"
|
|
30
|
+
},
|
|
31
|
+
variant: {
|
|
32
|
+
tinted: "",
|
|
33
|
+
outline: "bg-transparent"
|
|
34
|
+
},
|
|
35
|
+
interactive: {
|
|
36
|
+
true: "cursor-pointer disabled:pointer-events-none disabled:opacity-40",
|
|
37
|
+
false: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
compoundVariants: [
|
|
41
|
+
{
|
|
42
|
+
tone: "neutral",
|
|
43
|
+
variant: "tinted",
|
|
44
|
+
class: "bg-surface-2"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
tone: "accent",
|
|
48
|
+
variant: "tinted",
|
|
49
|
+
class: "bg-accent/10"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
tone: "ok",
|
|
53
|
+
variant: "tinted",
|
|
54
|
+
class: "bg-ok/10"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
tone: "busy",
|
|
58
|
+
variant: "tinted",
|
|
59
|
+
class: "bg-busy/10"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
tone: "warn",
|
|
63
|
+
variant: "tinted",
|
|
64
|
+
class: "bg-warn/10"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
tone: "danger",
|
|
68
|
+
variant: "tinted",
|
|
69
|
+
class: "bg-danger/10"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
tone: "info",
|
|
73
|
+
variant: "tinted",
|
|
74
|
+
class: "bg-info/10"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
tone: "neutral",
|
|
78
|
+
interactive: true,
|
|
79
|
+
class: "hover:border-border-strong hover:text-fg"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
tone: "accent",
|
|
83
|
+
interactive: true,
|
|
84
|
+
class: "hover:border-accent/60 hover:bg-accent/20"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
tone: "ok",
|
|
88
|
+
interactive: true,
|
|
89
|
+
class: "hover:border-ok/60 hover:bg-ok/20"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
tone: "busy",
|
|
93
|
+
interactive: true,
|
|
94
|
+
class: "hover:border-busy/60 hover:bg-busy/20"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
tone: "warn",
|
|
98
|
+
interactive: true,
|
|
99
|
+
class: "hover:border-warn/60 hover:bg-warn/20"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
tone: "danger",
|
|
103
|
+
interactive: true,
|
|
104
|
+
class: "hover:border-danger/60 hover:bg-danger/20"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
tone: "info",
|
|
108
|
+
interactive: true,
|
|
109
|
+
class: "hover:border-info/60 hover:bg-info/20"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
defaultVariants: {
|
|
113
|
+
tone: "neutral",
|
|
114
|
+
variant: "tinted",
|
|
115
|
+
interactive: false
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* A compact status/label pill: mono, uppercase, wide-tracked, one line tall.
|
|
120
|
+
*
|
|
121
|
+
* `tone` uses the shared status vocabulary (`ok | busy | warn | danger | info`)
|
|
122
|
+
* plus `neutral` and `accent`, so a chip, a `StatusDot` and a `Meter` always
|
|
123
|
+
* agree on what "warn" looks like.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* <Chip tone="ok">online</Chip>
|
|
127
|
+
* @example
|
|
128
|
+
* <Chip tone="accent" variant="outline" interactive onClick={toggle}>dimmer</Chip>
|
|
129
|
+
*/
|
|
130
|
+
const Chip = React.forwardRef(function Chip({ className, tone, variant, interactive = false, disabled, children, ...elementProps }, ref) {
|
|
131
|
+
const classes = cn(chipVariants({
|
|
132
|
+
tone,
|
|
133
|
+
variant,
|
|
134
|
+
interactive
|
|
135
|
+
}), className);
|
|
136
|
+
if (interactive) return /* @__PURE__ */ jsx("button", {
|
|
137
|
+
ref,
|
|
138
|
+
type: "button",
|
|
139
|
+
disabled,
|
|
140
|
+
className: classes,
|
|
141
|
+
...elementProps,
|
|
142
|
+
children
|
|
143
|
+
});
|
|
144
|
+
return /* @__PURE__ */ jsx("span", {
|
|
145
|
+
ref,
|
|
146
|
+
className: classes,
|
|
147
|
+
...elementProps,
|
|
148
|
+
children
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
//#endregion
|
|
152
|
+
export { Chip, chipVariants };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ClassProp, VariantProps } from "../lib/cva.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/primitives/icon-button.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Square sibling of `buttonVariants`: one `size-control-*` token instead of a
|
|
7
|
+
* height plus horizontal padding, so the hit target stays a perfect square at
|
|
8
|
+
* every density.
|
|
9
|
+
*/
|
|
10
|
+
declare const iconButtonVariants: (props?: ({
|
|
11
|
+
variant?: "ghost" | "primary" | "secondary" | "outline" | "danger" | "danger-outline" | null | undefined;
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
} & ClassProp) | undefined) => string;
|
|
14
|
+
interface IconButtonProps extends Omit<React.ComponentPropsWithoutRef<"button">, "children">, VariantProps<typeof iconButtonVariants> {
|
|
15
|
+
/**
|
|
16
|
+
* Required. An icon-only control has no text to name it, so the label is not
|
|
17
|
+
* optional — the type makes forgetting it a compile error.
|
|
18
|
+
*/
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
/**
|
|
21
|
+
* The icon component to render (e.g. a lucide icon). Rendered `aria-hidden`
|
|
22
|
+
* and sized to the density icon token.
|
|
23
|
+
*/
|
|
24
|
+
icon: React.ElementType;
|
|
25
|
+
/** Replace the rendered element (Base UI render prop). */
|
|
26
|
+
render?: useRender.RenderProp;
|
|
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
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { IconButton, IconButtonProps };
|