@vllnt/ui 0.4.0-canary.sha236ae3a → 0.4.0-canary.sha29bd7f0

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +116 -55
  2. package/README.md +35 -8
  3. package/dist/components/atoms/alert/alert.js +1 -1
  4. package/dist/components/atoms/alert-pulse/alert-pulse.js +7 -4
  5. package/dist/components/atoms/badge/badge.js +84 -5
  6. package/dist/components/atoms/bottom-activity-strip/bottom-activity-strip.js +2 -1
  7. package/dist/components/atoms/dialog/dialog.js +4 -2
  8. package/dist/components/atoms/floating-toolbar/floating-toolbar.js +23 -2
  9. package/dist/components/atoms/heat-overlay/heat-overlay.js +3 -2
  10. package/dist/components/atoms/metric-cluster/metric-cluster.js +2 -1
  11. package/dist/components/atoms/policy-delivery-panel/policy-delivery-panel.js +18 -9
  12. package/dist/components/atoms/progress-bar/progress-bar.js +29 -4
  13. package/dist/components/atoms/routing-assignment-panel/routing-assignment-panel.js +18 -9
  14. package/dist/components/atoms/runtime-overview-panel/runtime-overview-panel.js +2 -1
  15. package/dist/components/atoms/segmented-control/segmented-control.js +1 -1
  16. package/dist/components/atoms/select/select.js +2 -2
  17. package/dist/components/atoms/state-badge-overlay/state-badge-overlay.js +14 -16
  18. package/dist/components/atoms/sticky-metric/sticky-metric.js +2 -1
  19. package/dist/components/atoms/threshold-ring/threshold-ring.js +2 -1
  20. package/dist/components/atoms/timeline-scrubber/timeline-scrubber.js +2 -1
  21. package/dist/components/molecules/ai-artifact/ai-artifact.js +2 -12
  22. package/dist/components/molecules/completion-dialog/completion-dialog.js +1 -1
  23. package/dist/components/molecules/copy-button/use-copy-to-clipboard.js +10 -12
  24. package/dist/components/molecules/credit-badge/credit-badge.js +13 -16
  25. package/dist/components/molecules/plan-badge/plan-badge.js +12 -13
  26. package/dist/components/molecules/transaction-list/transaction-list.js +7 -9
  27. package/dist/components/organisms/subscription-card/subscription-card.js +10 -10
  28. package/dist/index.d.ts +222 -24
  29. package/dist/index.js +10 -0
  30. package/dist/lib/copy-text.js +64 -0
  31. package/dist/lib/status-dot.js +33 -0
  32. package/package.json +14 -3
  33. package/styles.css +24 -2
  34. package/themes/default.css +24 -2
  35. package/themes/presets.css +24 -24
  36. package/themes/products.css +8 -8
package/CHANGELOG.md CHANGED
@@ -6,50 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ### Changed
10
-
11
- - **Dark surfaces are pure black** - the default dark theme now renders
12
- `--background`, `--muted`, `--card` and `--popover` as `0 0 0` (#000000).
13
- Hairline borders separate the surfaces: `--border`, `--secondary` and
14
- `--accent` stay `0.2686` (#262626), and `--input` is unchanged. Before,
15
- `--muted` was `0.2686` (#262626) and `--card` / `--popover` were `0.1445`
16
- (#0a0a0a). A `bg-card` or `bg-popover` surface needs a `border` to show its
17
- edge; every shipped one has it, and a test now fails on one that does not.
18
- The separators in `DropdownMenu`, `Menubar` and `Select` draw with
19
- `bg-border` instead of `bg-muted`, which is the page color now, and a test
20
- fails on any one-pixel divider that uses `bg-muted`. Light mode is unchanged.
21
- Themes that override these roles (presets, Maia) keep their values; PaaS and
22
- any app that reads the dark `--muted`, `--card` or `--popover` directly get
23
- black.
24
- - **Hover, selected and data-state fills use `secondary`** - 32 component files
25
- (`Table`, `Tabs` pill, `Toggle`, `Slideshow`, `FilterBar` and others) used
26
- `bg-muted` for that feedback, which is now the page color in dark.
27
- They use `bg-secondary` with the same opacity. In the default and PaaS themes
28
- the fill is the same color as before in light and dark, because `--secondary`
29
- equals the old `--muted` there. Theme presets keep a quiet neutral
30
- `--secondary` (their `--accent` is a brand color), so text on these fills
31
- stays at 6.65 to 12.53:1 in dark. The Maia theme has its own dark `--muted`
32
- (`0.2002`) and a core dark `--secondary` (`0.2686`), so its dark hover fills
33
- are one step lighter than before.
34
- `SegmentedControl`, `ViewSwitcher`, `WorkspaceSwitcher` and the `PricingTable`
35
- period toggle draw their track with `bg-secondary` for the same reason: the
36
- selected segment is `bg-background` on that track.
37
- - **Skeletons, tracks and handles use `secondary`** - 29 `bg-muted` fills in 23
38
- component files were the whole visual of their element: `Skeleton`, the
39
- `ProgressBar`, `Meter`, `Tour`, `Checklist`, `UsageBreakdown` and other
40
- progress, meter and usage tracks, the `Drawer` handle, the empty cells of
41
- `ActivityHeatmap` and the neutral `GanttChart` bar. They use `bg-secondary`
42
- (#262626) with the same opacity, because `bg-muted` is the page color in dark
43
- and they would disappear. Chips, code spans and panels keep `bg-muted`: their
44
- text and border carry them. A test fails on a `bg-muted` skeleton or bar.
9
+ These entries ship in 0.4.0, which is not published yet (the latest release is
10
+ 0.3.0). The release cut adds the version heading and its date.
45
11
 
46
12
  ### Added
47
13
 
14
+ - **Dialog overlay** - `DialogContent` takes `overlay="scrim"` (default, the
15
+ dimmed veil as before) or `overlay="none"` (no veil; the dialog stays modal).
16
+ (#601)
17
+ - **Design tokens** - `color.badge-label.*`, `brand.status.*`, `radius.control`
18
+ (6 px), `radius.surface` (8 px), `size.target.min` (44 px), `size.control-xs`
19
+ (32 px, and 44 px under a coarse pointer), `opacity.grain` and
20
+ `opacity.contact`. Only the radius, size and opacity tokens have CSS
21
+ variables. (#602)
22
+ - **Lock 2 tokens** - `shadow.raised`, `shadow.overlay` and `shadow.floating`
23
+ (`--shadow-raised`, `--shadow-overlay`, `--shadow-floating`, one list per
24
+ mode), `spacing.page-gutter`, `spacing.page-gutter-tablet` and
25
+ `spacing.page-gutter-desktop` (20, 48 and 96 px, as `--spacing-page-gutter*`),
26
+ `size.page-max` (1440 px) and `size.measure-narrow` (480 px) as
27
+ `--size-page-max` and `--size-measure-narrow`, and a `spacing.24` step
28
+ (96 px, no CSS variable). (#614)
29
+ - **Badge v1.3 props** - `tone`, `size`, `border`, `dot` and `variant="soft"`.
30
+ A status tone colours a dot, not the words. Existing props and defaults
31
+ render as before. (#610)
32
+ - **ProgressBar `blocks`** - draws ten blocks and fills one per whole 10% of
33
+ `value / max`; `aria-valuenow` stays exact. (#611)
34
+ - **Lint rule A12** (`vllnt/a12-no-status-text-colour`) - flags a status colour
35
+ used as text colour in component code. 56 existing files are allowlisted and
36
+ burn down in #604. (#607)
37
+ - **`warning` tone** - `AlertPulse` (`severity`), `BottomActivityStrip`,
38
+ `HeatOverlay`, `MetricCluster`, `RuntimeOverviewPanel`, `StickyMetric`,
39
+ `ThresholdRing` and `TimelineScrubber` (`tone`) accept `warning`, the name the
40
+ design library uses. (#616)
48
41
  - **Product themes stylesheet** - `@vllnt/ui/themes/products.css` ships the
49
42
  Maia and PaaS themes as `html[data-theme="maia"]` and
50
43
  `html[data-theme="paas"]`, each with a `.dark` block. It is generated from
51
- `packages/design/tokens.json`. Load Figtree (Maia) and JetBrains Mono
52
- (Maia, PaaS) in your app; the package does not ship the fonts.
44
+ `packages/design/tokens.json`. Load JetBrains Mono (Maia, PaaS) in your
45
+ app; the package does not ship the font.
53
46
  - **Status and diff colors** - CSS variables `--success`, `--warning`,
54
47
  `--info`, their `-foreground` pairs, `--diff-added` and `--diff-removed` in
55
48
  `themes/default.css` and `styles.css`, and matching Tailwind colors
@@ -66,23 +59,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
59
  prefetching, so existing usage is unchanged. A sidebar with dozens of links
67
60
  in view otherwise prefetches every one of them on page load.
68
61
 
69
- ### Fixed
70
-
71
- - **Tap targets** - the NavbarSaas links, the Breadcrumb crumbs, the
72
- TableOfContents buttons and the Sidebar family heading link are at least
73
- 24 px tall (WCAG 2.5.8); they were 20 px.
74
-
75
- ### Fixed
76
-
77
- - **Accordion accessibility** - each trigger now has `aria-controls` pointing
78
- at its panel, and each panel is a `region` labelled by its trigger. Closed
79
- panels are `inert`, so screen readers no longer read closed answers and Tab
80
- skips links inside them. The open and close animation is unchanged.
81
-
82
- ## [0.4.0] - 2026-10-31
83
-
84
- ### Added
85
-
86
62
  - **New hooks** - `useFocusContainment` (trap Tab inside a custom modal and
87
63
  restore focus on close) and `useEventCallback` (stable callback that always
88
64
  calls the latest closure). Registry items import them from `@vllnt/ui`.
@@ -117,9 +93,68 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
117
93
  that contains them (the registry pins `^0.3.0`, which does not).
118
94
  `registry:integrity` now fails when a registry item imports a name that
119
95
  `@vllnt/ui` does not export. (#543)
96
+ - **`copyText` helper** - `copyText(value): Promise<boolean>` is exported from
97
+ `@vllnt/ui`. It writes through the Clipboard API, falls back to a temporary
98
+ textarea and `document.execCommand("copy")` when that API is missing or
99
+ rejects, and resolves to `false` when neither path works. (#576)
120
100
 
121
101
  ### Changed
122
102
 
103
+ - **Dark surfaces are pure black** - the default dark theme now renders
104
+ `--background`, `--muted`, `--card` and `--popover` as `0 0 0` (#000000).
105
+ Hairline borders separate the surfaces: `--border`, `--secondary` and
106
+ `--accent` stay `0.2686` (#262626), and `--input` is unchanged. Before,
107
+ `--muted` was `0.2686` (#262626) and `--card` / `--popover` were `0.1445`
108
+ (#0a0a0a). A `bg-card` or `bg-popover` surface needs a `border` to show its
109
+ edge; every shipped one has it, and a test now fails on one that does not.
110
+ The separators in `DropdownMenu`, `Menubar` and `Select` draw with
111
+ `bg-border` instead of `bg-muted`, which is the page color now, and a test
112
+ fails on any one-pixel divider that uses `bg-muted`. Light mode is unchanged.
113
+ Themes that override these roles (presets, Maia) keep their values; PaaS and
114
+ any app that reads the dark `--muted`, `--card` or `--popover` directly get
115
+ black.
116
+ - **Hover, selected and data-state fills use `secondary`** - 32 component files
117
+ (`Table`, `Tabs` pill, `Toggle`, `Slideshow`, `FilterBar` and others) used
118
+ `bg-muted` for that feedback, which is now the page color in dark.
119
+ They use `bg-secondary` with the same opacity. In the default and PaaS themes
120
+ the fill is the same color as before in light and dark, because `--secondary`
121
+ equals the old `--muted` there. Theme presets keep a quiet neutral
122
+ `--secondary` (their `--accent` is a brand color), so text on these fills
123
+ stays at 6.65 to 12.53:1 in dark. The Maia theme has its own dark `--muted`
124
+ (`0.2002`) and a core dark `--secondary` (`0.2686`), so its dark hover fills
125
+ are one step lighter than before.
126
+ `SegmentedControl`, `ViewSwitcher`, `WorkspaceSwitcher` and the `PricingTable`
127
+ period toggle draw their track with `bg-secondary` for the same reason: the
128
+ selected segment is `bg-background` on that track.
129
+ - **Skeletons, tracks and handles use `secondary`** - 29 `bg-muted` fills in 23
130
+ component files were the whole visual of their element: `Skeleton`, the
131
+ `ProgressBar`, `Meter`, `Tour`, `Checklist`, `UsageBreakdown` and other
132
+ progress, meter and usage tracks, the `Drawer` handle, the empty cells of
133
+ `ActivityHeatmap` and the neutral `GanttChart` bar. They use `bg-secondary`
134
+ (#262626) with the same opacity, because `bg-muted` is the page color in dark
135
+ and they would disappear. Chips, code spans and panels keep `bg-muted`: their
136
+ text and border carry them. A test fails on a `bg-muted` skeleton or bar.
137
+ - **Alert destructive** - the title and body use the foreground colour. The
138
+ status colour stays on the border and the glyph. (#607)
139
+ - **Badge status chips** use a status dot. (#610)
140
+ - **Maia is Ink, and `--input` follows the design library** - Maia `--primary`
141
+ is black in light and white in dark (it was pink), Maia uses the core sans
142
+ font instead of Figtree, and its display and label weights are 600, not 700.
143
+ The default theme's `--input` is `0.6167` in light (was `0.66`) and `0.5208`
144
+ in dark (was `0.49`). (#614)
145
+ - **Theme presets meet the input 3:1 rule on muted** - the 12 runtime presets
146
+ (aura, chatgpt, claude, cyberlime, cyberpunk, dracula, dusk, gemini, matrix,
147
+ nord, synthwave and tron) get a new `--input` lightness in light and dark, by
148
+ 0.048 at most, with hue and chroma unchanged. The control border now reaches
149
+ 3:1 on background, card, popover and muted. (#620)
150
+ - **`warn` is deprecated** in the eight components above; pass `warning`. `warn`
151
+ still works and renders the same colour. Removing it would break consumers,
152
+ so that waits for a breaking release. `HeatOverlay` and `AlertPulse` now
153
+ default to `warning`. A `data-*` tone attribute echoes the value you pass.
154
+ - **Site header name** - `NavbarSaas` is the one code name for the design
155
+ library's `organism / Site header`. A `floating` style will join it as an
156
+ added prop, and `FloatingNavbar` stays a separate component until then.
157
+ `Display` is the design library's `atom / Heading` with `Level=display`.
123
158
  - **Colour tokens meet WCAG AA** (#538). The default light theme uses a darker
124
159
  `--muted-foreground`, `--destructive` and `--input`; in the dark theme
125
160
  `--destructive` is lighter with a dark foreground and `--input` is lighter, so
@@ -178,6 +213,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
178
213
 
179
214
  ### Fixed
180
215
 
216
+ - **Tap targets** - the NavbarSaas links, the Breadcrumb crumbs, the
217
+ TableOfContents buttons and the Sidebar family heading link are at least
218
+ 24 px tall (WCAG 2.5.8); they were 20 px.
219
+ - **Close button target size** - the close buttons of `DialogContent`,
220
+ `SheetContent` and `CompletionDialog` were 16 px. They are at least 24 x 24 px
221
+ around the same 16 px icon (WCAG 2.5.8). (#576)
222
+ - **Copy without the Clipboard API** - `useCopyToClipboard` (so `CopyButton`,
223
+ `CodeBlock`, `Terminal` and the other copy controls) and
224
+ `AIArtifactCopyButton` fall back to a temporary textarea and
225
+ `document.execCommand("copy")` when `navigator.clipboard` is missing (plain
226
+ http, such as a Tailnet IP) or `writeText` rejects. The fallback works inside
227
+ modal dialogs, alert dialogs, native `dialog` elements and modal menus, keeps
228
+ the text the user had selected on the page, and returns focus only when it
229
+ came from the keyboard. `copied` stays `false` when both paths fail.
230
+ `FlowDiagram` copies a PNG, so it has no text fallback and keeps reporting
231
+ "Copy failed". (#576)
232
+ - **Accordion accessibility** - each trigger now has `aria-controls` pointing
233
+ at its panel, and each panel is a `region` labelled by its trigger. Closed
234
+ panels are `inert`, so screen readers no longer read closed answers and Tab
235
+ skips links inside them. The open and close animation is unchanged.
236
+ - **Select, SegmentedControl, FloatingToolbar and ProgressBar** - `Select`
237
+ shows `aria-invalid` with a destructive border. The `Select` menu animation,
238
+ the `SegmentedControl` selection transition, the `FloatingToolbar` colour
239
+ transition and the `ProgressBar` transitions stop under
240
+ `prefers-reduced-motion`. `FloatingToolbar` is one tab stop, and the arrow,
241
+ Home and End keys move between its actions and skip disabled ones. (#611)
181
242
  - **Setup docs** - the Tailwind config in both READMEs, the installation page
182
243
  and the agent skill now lists `./node_modules/@vllnt/ui/dist/**/*.js` in
183
244
  `content`. Tailwind 3 ignores a preset's `content` once the app sets its own,
package/README.md CHANGED
@@ -1,9 +1,33 @@
1
1
  # @vllnt/ui
2
2
 
3
- React component library — 321 components built on Radix UI primitives, Tailwind CSS, and CVA.
3
+ React components built on Radix UI primitives, Tailwind CSS, and CVA. For humans and AI agents.
4
4
 
5
5
  See [CHANGELOG.md](./CHANGELOG.md) for release history.
6
6
 
7
+ ## For AI agents
8
+
9
+ An agent can read this library as text and JSON, without scraping pages. The site is <https://ui.vllnt.com>.
10
+
11
+ | URL | Returns |
12
+ | --- | --- |
13
+ | `https://ui.vllnt.com/llms.txt` | A short plain-text overview: install steps, docs links, and components grouped by category. |
14
+ | `https://ui.vllnt.com/llms-full.txt` | One long text file: guides, the design guide, latest release notes, templates, and a summary of every component. |
15
+ | `https://ui.vllnt.com/r/registry.json` | JSON index of every component in the shadcn registry. |
16
+ | `https://ui.vllnt.com/r/<name>` | One component as a shadcn registry item, with its source files inline. |
17
+ | `https://ui.vllnt.com/r/themes?t=<token>` | A shadcn theme item decoded from a theme token made in the theme editor. |
18
+ | `https://ui.vllnt.com/r/design.json` | The design tokens as JSON. |
19
+ | `https://ui.vllnt.com/design.txt` | The design guide as plain text. `https://ui.vllnt.com/DESIGN.md` is the same guide as Markdown. |
20
+ | `https://ui.vllnt.com/mcp` | An MCP server. It speaks JSON-RPC 2.0 over HTTP POST and has four read-only tools: `search_components`, `get_component`, `list_categories`, `list_platforms`. A GET returns server info. |
21
+ | `https://ui.vllnt.com/.well-known/api-catalog` | A catalog of these APIs (RFC 9727 linkset). |
22
+
23
+ The home page, the design and philosophy pages, and most docs and component pages also answer in Markdown. Send `Accept: text/markdown` to the same URL. A wildcard `Accept` does not select Markdown; the header must name `text/markdown`.
24
+
25
+ ```bash
26
+ curl -H "Accept: text/markdown" https://ui.vllnt.com/components/button
27
+ ```
28
+
29
+ More: <https://ui.vllnt.com/docs/agents>.
30
+
7
31
  ## Install
8
32
 
9
33
  ```bash
@@ -165,7 +189,7 @@ All colors are **OKLCH channel** CSS variables (`L C H`), consumed as
165
189
  --destructive: 0.55 0.2078 25.326;
166
190
  --destructive-foreground: 0.9848 0 0;
167
191
  --border: 0.9219 0 0;
168
- --input: 0.66 0 0;
192
+ --input: 0.6167 0 0;
169
193
  --ring: 0.1445 0 0;
170
194
  --radius: 0.5rem;
171
195
  --card: 1 0 0;
@@ -203,16 +227,19 @@ once near the root to restore the saved preset before paint.
203
227
  <html data-theme="maia" class="dark">
204
228
  ```
205
229
 
206
- - `maia`: pink primary, Figtree and JetBrains Mono, tighter type scale and radius.
207
- Its Label step is capitals in the design: add `uppercase` where you use it.
230
+ - `maia` (Ink): no accent; `--primary` is the ink colour (pure black `#000000`
231
+ in light on purpose, while core keeps `#171717`; white in dark). Core Inter
232
+ plus JetBrains Mono, weights 400 to 600, tighter type
233
+ scale and radius. Its Label step is capitals in the design: add `uppercase`
234
+ where you use it.
208
235
  - `paas`: core neutrals and status tones in JetBrains Mono. Dark is the design
209
236
  default; light works too.
210
237
 
211
238
  The package does not ship fonts. Core puts Inter (sans) and JetBrains Mono
212
- (mono) first, then the system stacks. Load Inter, JetBrains Mono (core, Maia and
213
- PaaS) and Figtree (Maia) in your app, for example with `next/font` or a font
214
- `<link>`; without them each stack falls back to the system font stack
215
- (`system-ui` for core sans and Maia, `ui-monospace` for core mono and PaaS).
239
+ (mono) first, then the system stacks. Load Inter and JetBrains Mono (core, Maia
240
+ and PaaS) in your app, for example with `next/font` or a font `<link>`; without
241
+ them each stack falls back to the system font stack (`system-ui` for core sans
242
+ and Maia, `ui-monospace` for core mono and PaaS).
216
243
 
217
244
  Both define `success`, `warning`, `info`, `diff-added` and `diff-removed` roles
218
245
  (the core theme defines them as well). Web `--radius` carries the theme's
@@ -10,7 +10,7 @@ const alertVariants = cva(
10
10
  variants: {
11
11
  variant: {
12
12
  default: "bg-background text-foreground",
13
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
13
+ destructive: "border-destructive/50 text-foreground dark:border-destructive [&>svg]:text-destructive"
14
14
  }
15
15
  }
16
16
  }
@@ -4,17 +4,20 @@ import { cn } from "../../../lib/utils.js";
4
4
  const SEVERITY_STROKE = {
5
5
  error: "stroke-red-500",
6
6
  info: "stroke-blue-500",
7
- warn: "stroke-amber-500"
7
+ warn: "stroke-amber-500",
8
+ warning: "stroke-amber-500"
8
9
  };
9
10
  const SEVERITY_FILL = {
10
11
  error: "fill-red-500/20",
11
12
  info: "fill-blue-500/20",
12
- warn: "fill-amber-500/20"
13
+ warn: "fill-amber-500/20",
14
+ warning: "fill-amber-500/20"
13
15
  };
14
16
  const SEVERITY_LABEL = {
15
17
  error: "Error",
16
18
  info: "Info",
17
- warn: "Warning"
19
+ warn: "Warning",
20
+ warning: "Warning"
18
21
  };
19
22
  const safeRadius = (value) => value < 6 ? 6 : value;
20
23
  const AlertPulse = ({
@@ -28,7 +31,7 @@ const AlertPulse = ({
28
31
  labels,
29
32
  radius = 36,
30
33
  reducedMotion = false,
31
- severity = "warn",
34
+ severity = "warning",
32
35
  ...rest
33
36
  } = props;
34
37
  const r = safeRadius(radius);
@@ -1,24 +1,103 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cva } from "class-variance-authority";
3
+ import { isStatusTone, statusDotVariants } from "../../../lib/status-dot.js";
3
4
  import { cn } from "../../../lib/utils.js";
4
5
  const badgeVariants = cva(
5
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
6
+ "inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
6
7
  {
8
+ compoundVariants: [
9
+ {
10
+ class: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
11
+ tone: "danger-solid"
12
+ },
13
+ {
14
+ class: "border-destructive/30 bg-destructive/10 text-foreground hover:bg-destructive/15",
15
+ tone: "danger-tint"
16
+ },
17
+ {
18
+ class: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
19
+ tone: "solid"
20
+ },
21
+ { border: "none", class: "border-transparent" },
22
+ { border: "strong", class: "border-foreground" }
23
+ ],
7
24
  defaultVariants: {
25
+ dot: false,
26
+ size: "default",
8
27
  variant: "default"
9
28
  },
10
29
  variants: {
30
+ border: {
31
+ none: "",
32
+ strong: ""
33
+ },
34
+ dot: {
35
+ false: "",
36
+ true: "gap-1.5"
37
+ },
38
+ size: {
39
+ default: "px-2.5 py-0.5 text-xs",
40
+ header: "px-3 py-1 text-sm",
41
+ inline: "px-1.5 py-0 text-[10px] leading-4",
42
+ sm: "px-2 py-0 text-[11px] leading-[1.125rem]"
43
+ },
44
+ tone: {
45
+ danger: "",
46
+ "danger-solid": "",
47
+ "danger-tint": "",
48
+ info: "",
49
+ neutral: "",
50
+ primary: "",
51
+ solid: "",
52
+ success: "",
53
+ warning: ""
54
+ },
11
55
  variant: {
12
56
  default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13
57
  destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
14
58
  outline: "text-foreground",
15
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80"
59
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
60
+ soft: "border-transparent bg-muted text-foreground hover:bg-secondary/80"
16
61
  }
17
62
  }
18
63
  }
19
64
  );
20
- function Badge({ className, variant, ...props }) {
21
- return /* @__PURE__ */ jsx("span", { className: cn(badgeVariants({ variant }), className), ...props });
65
+ function Badge({
66
+ border,
67
+ children,
68
+ className,
69
+ dot = false,
70
+ ref,
71
+ size,
72
+ tone,
73
+ variant,
74
+ ...props
75
+ }) {
76
+ const statusTone = isStatusTone(tone) ? tone : void 0;
77
+ const surface = variant ?? (statusTone ? "secondary" : "default");
78
+ const dotTone = tone === "danger-tint" ? "danger" : statusTone;
79
+ return /* @__PURE__ */ jsxs(
80
+ "span",
81
+ {
82
+ className: cn(
83
+ badgeVariants({ border, dot, size, tone, variant: surface }),
84
+ className
85
+ ),
86
+ ref,
87
+ ...props,
88
+ children: [
89
+ dot ? /* @__PURE__ */ jsx(
90
+ "span",
91
+ {
92
+ "aria-hidden": "true",
93
+ className: statusDotVariants({ tone: dotTone }),
94
+ "data-badge-dot": ""
95
+ }
96
+ ) : null,
97
+ children
98
+ ]
99
+ }
100
+ );
22
101
  }
23
102
  export {
24
103
  Badge,
@@ -6,7 +6,8 @@ const TONE_DOT = {
6
6
  info: "bg-blue-500",
7
7
  neutral: "bg-muted-foreground",
8
8
  success: "bg-emerald-500",
9
- warn: "bg-amber-500"
9
+ warn: "bg-amber-500",
10
+ warning: "bg-amber-500"
10
11
  };
11
12
  const DEFAULT_LABELS = {
12
13
  empty: "No recent activity",
@@ -23,13 +23,15 @@ const DialogOverlay = ({
23
23
  }
24
24
  );
25
25
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
26
+ const DialogScrollLock = () => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "hidden" });
26
27
  const DialogContent = ({
27
28
  children,
28
29
  className,
30
+ overlay = "scrim",
29
31
  ref: reference,
30
32
  ...props
31
33
  }) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
32
- /* @__PURE__ */ jsx(DialogOverlay, {}),
34
+ overlay === "scrim" ? /* @__PURE__ */ jsx(DialogOverlay, {}) : /* @__PURE__ */ jsx(DialogScrollLock, {}),
33
35
  /* @__PURE__ */ jsxs(
34
36
  DialogPrimitive.Content,
35
37
  {
@@ -41,7 +43,7 @@ const DialogContent = ({
41
43
  ...props,
42
44
  children: [
43
45
  children,
44
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
46
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-3 top-3 inline-flex min-h-6 min-w-6 items-center justify-center rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
45
47
  /* @__PURE__ */ jsx(X, { className: "size-4" }),
46
48
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
47
49
  ] })
@@ -1,5 +1,9 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ useState
5
+ } from "react";
6
+ import { moveRovingFocus } from "../../../lib/roving-focus.js";
3
7
  import { cn } from "../../../lib/utils.js";
4
8
  const VARIANT_CLASSES = {
5
9
  destructive: "border-red-300 bg-red-500/10 text-red-700 hover:bg-red-500/20 dark:text-red-300",
@@ -9,12 +13,23 @@ const VARIANT_CLASSES = {
9
13
  const DEFAULT_LABELS = {
10
14
  region: "Selection actions"
11
15
  };
16
+ const ACTION_SELECTOR = "button[data-action-id]";
17
+ function resolveTabStopId(actions, focusedId) {
18
+ const enabledIds = actions.filter((action) => !action.disabled).map((action) => action.id);
19
+ return focusedId !== void 0 && enabledIds.includes(focusedId) ? focusedId : enabledIds[0];
20
+ }
12
21
  const FloatingToolbar = ({
13
22
  ref,
14
23
  ...props
15
24
  }) => {
16
- const { actions, className, labels, x, y, ...rest } = props;
25
+ const { actions, className, labels, onKeyDown, x, y, ...rest } = props;
26
+ const [focusedId, setFocusedId] = useState();
17
27
  const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
28
+ const tabStopId = resolveTabStopId(actions, focusedId);
29
+ const handleKeyDownToolbar = (event) => {
30
+ onKeyDown?.(event);
31
+ moveRovingFocus(event, ACTION_SELECTOR);
32
+ };
18
33
  return /* @__PURE__ */ jsx(
19
34
  "div",
20
35
  {
@@ -28,17 +43,21 @@ const FloatingToolbar = ({
28
43
  role: "toolbar",
29
44
  style: { left: `${x.toString()}px`, top: `${y.toString()}px` },
30
45
  ...rest,
46
+ onKeyDown: handleKeyDownToolbar,
31
47
  children: actions.map((action) => {
32
48
  const variant = action.variant ?? "ghost";
33
49
  const handleActivateToolbarAction = () => {
34
50
  action.onActivate();
35
51
  };
52
+ const handleFocusToolbarAction = () => {
53
+ setFocusedId(action.id);
54
+ };
36
55
  return /* @__PURE__ */ jsxs(
37
56
  "button",
38
57
  {
39
58
  "aria-label": action.ariaLabel ?? void 0,
40
59
  className: cn(
41
- "inline-flex h-7 items-center gap-1 rounded-md border px-2 text-xs font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
60
+ "inline-flex h-7 items-center gap-1 rounded-md border px-2 text-xs font-medium transition-colors motion-reduce:transition-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
42
61
  VARIANT_CLASSES[variant],
43
62
  action.disabled ? "cursor-not-allowed opacity-50" : ""
44
63
  ),
@@ -46,6 +65,8 @@ const FloatingToolbar = ({
46
65
  "data-variant": variant,
47
66
  disabled: action.disabled,
48
67
  onClick: handleActivateToolbarAction,
68
+ onFocus: handleFocusToolbarAction,
69
+ tabIndex: action.id === tabStopId ? 0 : -1,
49
70
  type: "button",
50
71
  children: [
51
72
  action.glyph ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-flex size-3", children: action.glyph }) : null,
@@ -6,7 +6,8 @@ const TONE_FILL = {
6
6
  cool: "fill-blue-500",
7
7
  danger: "fill-red-500",
8
8
  neutral: "fill-foreground",
9
- warn: "fill-amber-500"
9
+ warn: "fill-amber-500",
10
+ warning: "fill-amber-500"
10
11
  };
11
12
  const DEFAULT_LABELS = {
12
13
  region: "Heat overlay"
@@ -44,7 +45,7 @@ const HeatOverlay = ({
44
45
  }) => {
45
46
  const {
46
47
  className,
47
- defaultTone = "warn",
48
+ defaultTone = "warning",
48
49
  intensity = 48,
49
50
  labels,
50
51
  points,
@@ -5,7 +5,8 @@ const TONE_DOT = {
5
5
  danger: "bg-red-500",
6
6
  neutral: "bg-muted-foreground",
7
7
  success: "bg-emerald-500",
8
- warn: "bg-amber-500"
8
+ warn: "bg-amber-500",
9
+ warning: "bg-amber-500"
9
10
  };
10
11
  const ANCHOR_TRANSFORM = {
11
12
  "bottom-left": "translate(-100%, 100%)",
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { statusDotVariants } from "../../../lib/status-dot.js";
3
4
  import { cn } from "../../../lib/utils.js";
4
5
  const STATUS_LABEL = {
5
6
  advisory: "Advisory",
@@ -7,9 +8,9 @@ const STATUS_LABEL = {
7
8
  enforced: "Enforced"
8
9
  };
9
10
  const STATUS_TONE = {
10
- advisory: "border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300",
11
- disabled: "border-border bg-muted/40 text-muted-foreground",
12
- enforced: "border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
11
+ advisory: "warning",
12
+ disabled: "neutral",
13
+ enforced: "success"
13
14
  };
14
15
  const DEFAULT_LABELS = {
15
16
  empty: "No policies",
@@ -20,14 +21,22 @@ const RowBody = (props) => {
20
21
  return /* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col gap-0.5 text-left", children: [
21
22
  /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-2", children: [
22
23
  /* @__PURE__ */ jsx("span", { className: "truncate text-xs font-medium text-foreground", children: policy.name }),
23
- /* @__PURE__ */ jsx(
24
+ /* @__PURE__ */ jsxs(
24
25
  "span",
25
26
  {
26
- className: cn(
27
- "rounded-full border px-1.5 py-0.5 text-[10px] uppercase tracking-wide",
28
- STATUS_TONE[policy.status]
29
- ),
30
- children: STATUS_LABEL[policy.status]
27
+ className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-secondary px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-foreground",
28
+ "data-policy-status-chip": true,
29
+ children: [
30
+ /* @__PURE__ */ jsx(
31
+ "span",
32
+ {
33
+ "aria-hidden": "true",
34
+ className: statusDotVariants({ tone: STATUS_TONE[policy.status] }),
35
+ "data-policy-status-dot": true
36
+ }
37
+ ),
38
+ STATUS_LABEL[policy.status]
39
+ ]
31
40
  }
32
41
  )
33
42
  ] }),