@vllnt/ui 0.4.0-canary.sha8f4d258 → 0.4.0-canary.sha9d4e97e

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 (84) hide show
  1. package/CHANGELOG.md +104 -6
  2. package/README.md +33 -2
  3. package/dist/components/atoms/accordion/accordion.js +28 -7
  4. package/dist/components/atoms/agent-activity/agent-activity.js +1 -1
  5. package/dist/components/atoms/ai-source-citation/ai-source-citation.js +1 -1
  6. package/dist/components/atoms/avatar/avatar.js +129 -24
  7. package/dist/components/atoms/bottom-activity-strip/bottom-activity-strip.js +1 -1
  8. package/dist/components/atoms/breadcrumb/breadcrumb.js +89 -37
  9. package/dist/components/atoms/checklist/checklist.js +2 -2
  10. package/dist/components/atoms/curriculum/curriculum.js +4 -4
  11. package/dist/components/atoms/drawer/drawer.js +1 -1
  12. package/dist/components/atoms/dropdown-menu/dropdown-menu.js +1 -1
  13. package/dist/components/atoms/gauge-chart/gauge-chart.js +1 -1
  14. package/dist/components/atoms/glass-progress/glass-progress.js +1 -1
  15. package/dist/components/atoms/jarvis-dock/jarvis-dock.js +2 -2
  16. package/dist/components/atoms/kbd/kbd.js +41 -11
  17. package/dist/components/atoms/keyboard-shortcuts-help/keyboard-shortcuts-help.js +1 -1
  18. package/dist/components/atoms/menubar/menubar.js +1 -1
  19. package/dist/components/atoms/meter/meter.js +2 -2
  20. package/dist/components/atoms/policy-delivery-panel/policy-delivery-panel.js +1 -1
  21. package/dist/components/atoms/presence-stack/presence-stack.js +1 -1
  22. package/dist/components/atoms/progress-bar/progress-bar.js +164 -29
  23. package/dist/components/atoms/pull-quote/pull-quote.js +77 -0
  24. package/dist/components/atoms/quiz/quiz.js +2 -2
  25. package/dist/components/atoms/relationship-inspector/relationship-inspector.js +1 -1
  26. package/dist/components/atoms/routing-assignment-panel/routing-assignment-panel.js +2 -2
  27. package/dist/components/atoms/scrim/scrim.js +32 -0
  28. package/dist/components/atoms/segmented-control/segmented-control.js +1 -1
  29. package/dist/components/atoms/select/select.js +1 -1
  30. package/dist/components/atoms/sheet/sheet.js +3 -2
  31. package/dist/components/atoms/skeleton/skeleton.js +1 -1
  32. package/dist/components/atoms/stepper/stepper.js +1 -1
  33. package/dist/components/atoms/table/table.js +1 -1
  34. package/dist/components/atoms/table-of-contents/table-of-contents.js +1 -1
  35. package/dist/components/atoms/table-of-contents-panel/table-of-contents-panel.js +4 -4
  36. package/dist/components/atoms/tabs/tabs.js +34 -11
  37. package/dist/components/atoms/tag-group/tag-group.js +10 -5
  38. package/dist/components/atoms/tags-input/tags-input.js +1 -1
  39. package/dist/components/atoms/thread-bubble/thread-bubble.js +1 -1
  40. package/dist/components/atoms/threshold-ring/threshold-ring.js +1 -1
  41. package/dist/components/atoms/timeline/timeline.js +15 -3
  42. package/dist/components/atoms/timeline-scrubber/timeline-scrubber.js +1 -1
  43. package/dist/components/atoms/tldr-section/tldr-section.js +5 -5
  44. package/dist/components/atoms/toggle/toggle.js +1 -1
  45. package/dist/components/atoms/view-switcher/view-switcher.js +1 -1
  46. package/dist/components/atoms/viewport-bookmarks/viewport-bookmarks.js +1 -1
  47. package/dist/components/atoms/watchlist/watchlist.js +1 -1
  48. package/dist/components/atoms/workspace-switcher/workspace-switcher.js +1 -1
  49. package/dist/components/index.js +38 -2
  50. package/dist/components/molecules/approval-request/approval-request.js +168 -0
  51. package/dist/components/molecules/civilization-card/civilization-card.js +1 -1
  52. package/dist/components/molecules/content-intro/content-intro.js +2 -2
  53. package/dist/components/molecules/conversation-thread/conversation-thread.js +5 -5
  54. package/dist/components/molecules/cookie-consent/cookie-consent.js +188 -80
  55. package/dist/components/molecules/countdown-timer/countdown-timer.js +1 -1
  56. package/dist/components/molecules/filter-bar/filter-bar.js +2 -2
  57. package/dist/components/molecules/historical-figure-card/historical-figure-card.js +1 -1
  58. package/dist/components/molecules/pricing-table/pricing-table.js +1 -1
  59. package/dist/components/molecules/progress-tracker/progress-tracker.js +8 -17
  60. package/dist/components/molecules/sidebar/sidebar.js +24 -9
  61. package/dist/components/molecules/tour/tour.js +1 -1
  62. package/dist/components/molecules/tutorial-filters/tutorial-filters.js +2 -2
  63. package/dist/components/molecules/usage-breakdown/usage-breakdown.js +1 -1
  64. package/dist/components/organisms/access-matrix/access-matrix.js +271 -0
  65. package/dist/components/organisms/activity-heatmap/activity-heatmap.js +1 -1
  66. package/dist/components/organisms/code-block/code-block.js +145 -81
  67. package/dist/components/organisms/cta-band/cta-band.js +79 -0
  68. package/dist/components/organisms/flow-diagram/flow-controls.js +1 -1
  69. package/dist/components/organisms/flow-diagram/flow-fullscreen.js +1 -1
  70. package/dist/components/organisms/gantt-chart/gantt-chart.js +1 -1
  71. package/dist/components/organisms/historic-timeline/historic-timeline.js +1 -1
  72. package/dist/components/organisms/navbar-saas/navbar-saas.js +1 -1
  73. package/dist/components/organisms/order-summary/order-summary.js +172 -0
  74. package/dist/components/organisms/settings-list/settings-list.js +125 -0
  75. package/dist/components/organisms/share-dialog-people/share-dialog-people.js +412 -0
  76. package/dist/components/organisms/slideshow/slideshow.js +6 -6
  77. package/dist/components/organisms/tutorial-complete/tutorial-complete.js +2 -2
  78. package/dist/components/organisms/tutorial-mdx/tutorial-mdx.js +1 -1
  79. package/dist/index.d.ts +925 -62
  80. package/dist/tailwind-preset.js +16 -0
  81. package/package.json +8 -7
  82. package/styles.css +24 -5
  83. package/themes/default.css +24 -5
  84. package/themes/products.css +146 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,81 @@ 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.
45
+
46
+ ### Added
47
+
48
+ - **Product themes stylesheet** - `@vllnt/ui/themes/products.css` ships the
49
+ Maia and PaaS themes as `html[data-theme="maia"]` and
50
+ `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.
53
+ - **Status and diff colors** - CSS variables `--success`, `--warning`,
54
+ `--info`, their `-foreground` pairs, `--diff-added` and `--diff-removed` in
55
+ `themes/default.css` and `styles.css`, and matching Tailwind colors
56
+ (`success`, `warning`, `info`, `diff.added`, `diff.removed`) in the preset.
57
+ - **Label type step** - `--font-size-label`, `--line-height-label` and
58
+ `--font-weight-label`.
59
+ - **Sidebar `pathname` prop** - names the page the sidebar marks as current.
60
+ It defaults to the router's pathname, so existing usage is unchanged. Pass
61
+ it when the URL the visitor sees differs from the route that renders, such as
62
+ a prerendered locale or variant route, instead of overriding the router's
63
+ pathname context.
64
+ - **Sidebar `prefetch` prop** - set it to `false` to stop the sidebar's links
65
+ from prefetching their pages. Left unset, the links keep the router's default
66
+ prefetching, so existing usage is unchanged. A sidebar with dozens of links
67
+ in view otherwise prefetches every one of them on page load.
68
+
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
+
9
84
  ### Added
10
85
 
11
86
  - **New hooks** - `useFocusContainment` (trap Tab inside a custom modal and
@@ -19,7 +94,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
19
94
  `ProfileSectionProps`, `TLDRSectionProps`, `AreaChartProps`, `BarChartProps`,
20
95
  `LineChartProps` and `ThemePresetProviderProps`.
21
96
 
22
- - Source-only React Native renderer and shared design contracts for the 0.4.0 canary track; stable Web installation remains unchanged.
97
+ - Source-only React Native renderer and shared design contracts (`@vllnt/ui-core`, `@vllnt/ui-native`). They are experimental and not published with this release; installing `@vllnt/ui` is unchanged.
23
98
  - Localized Native catalog discovery, dependency/capability comparison, and extensible React/React Native source tabs in a single component preview surface.
24
99
  - **Accessibility gate** - the Storybook test-runner runs axe-core (WCAG 2.0,
25
100
  2.1 and 2.2, levels A and AA) on every story in the light and dark theme and
@@ -45,6 +120,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
45
120
 
46
121
  ### Changed
47
122
 
123
+ - **Colour tokens meet WCAG AA** (#538). The default light theme uses a darker
124
+ `--muted-foreground`, `--destructive` and `--input`; in the dark theme
125
+ `--destructive` is lighter with a dark foreground and `--input` is lighter, so
126
+ input borders are easier to see in both. Presets adjust `--primary`,
127
+ `--destructive`, `--input` and `--ring` the same way. Visual snapshots change.
128
+ - **Font tokens on `:root`** - `styles.css` now defines `--font-sans`,
129
+ `--font-display` and `--font-mono` on `:root`. If your app sets variables
130
+ with these names, declare them later in the cascade or on `body` so yours win.
131
+ - **Lighter imports** (#541) - CodeBlock renders its code as plain text first
132
+ and highlights it once the Prism build loads on the client; TutorialMDX loads
133
+ the MDX compiler only for content with JSX, and FlowDiagram loads
134
+ `html-to-image` only when copied. Apps that use neither `toast` nor
135
+ `Toaster` no longer bundle sonner.
136
+ - **Smaller package** - the tarball has 361 files instead of 659: the
137
+ per-component re-export stubs and `dist/test-setup.js` are gone.
138
+ Only the `exports` entry points are public, so imports do not change.
139
+
48
140
  - **Peer dependency ranges now match what the package needs.** `next` is
49
141
  `>=15.0.0` (Next 14 peers React 18, which the React 19 build cannot use),
50
142
  `tailwindcss` is `^3.4.0` (components use `size-*`, `text-balance` and
@@ -86,10 +178,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
86
178
 
87
179
  ### Fixed
88
180
 
181
+ - **Setup docs** - the Tailwind config in both READMEs, the installation page
182
+ and the agent skill now lists `./node_modules/@vllnt/ui/dist/**/*.js` in
183
+ `content`. Tailwind 3 ignores a preset's `content` once the app sets its own,
184
+ so the documented config generated no component styles. The agent skill's
185
+ peer ranges and colour format (OKLCH) are corrected too.
186
+ - **Tailwind preset dependency** - `tailwindcss-animate`, which
187
+ `@vllnt/ui/tailwind-preset` imports, is now a runtime dependency. With 0.3.0
188
+ the preset failed to load unless the app installed it.
89
189
  - **Duplicate React keys** - Terminal, FileUpload, AvatarGroup, Breadcrumb and
90
190
  about 20 other list renderers no longer key rows by content or label alone,
91
191
  so repeated or blank entries stop triggering duplicate-key errors. FileUpload
92
- ignores a file that is already in the list, so removal removes one entry.
192
+ adds an identical file (same name, size and lastModified) once, so removal
193
+ removes one entry, and a selection that adds nothing new does not call
194
+ `onFilesChange`.
93
195
  - **`"use client"` directives** - Toolbar, Stepper, AIChatInput, ObjectCard,
94
196
  OverviewBoard and ZoomHUD use event handlers or browser globals and now carry
95
197
  the directive. `check:use-client` also flags handler props and browser globals.
@@ -109,10 +211,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
109
211
  listbox, tree, dialogs and focus return), reduced motion and hard-coded
110
212
  palette contrast across the Web components flagged by the #535 audit. (#543)
111
213
 
112
- - **FileUpload duplicates** - Selecting identical files (same name, size and
113
- lastModified) adds them once, and a selection that adds nothing new no longer
114
- calls `onFilesChange`.
115
-
116
214
  ## [0.3.0] - 2026-06-26
117
215
 
118
216
  ### Added
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vllnt/ui
2
2
 
3
- React component library — 309 components built on Radix UI primitives, Tailwind CSS, and CVA.
3
+ React component library — 321 components built on Radix UI primitives, Tailwind CSS, and CVA.
4
4
 
5
5
  See [CHANGELOG.md](./CHANGELOG.md) for release history.
6
6
 
@@ -92,7 +92,9 @@ export default {
92
92
  presets: [uiPreset],
93
93
  content: [
94
94
  "./src/**/*.{ts,tsx}",
95
- // The preset auto-includes @vllnt/ui content paths
95
+ // Required: Tailwind 3 ignores a preset's `content` once your config sets
96
+ // its own, so list the package's compiled components here.
97
+ "./node_modules/@vllnt/ui/dist/**/*.js",
96
98
  ],
97
99
  };
98
100
  ```
@@ -114,6 +116,8 @@ import "@vllnt/ui/styles.css";
114
116
 
115
117
  This imports Tailwind base/components/utilities + default theme variables + safe-area utilities.
116
118
 
119
+ If TypeScript reports TS2882 for this import (newer versions check side-effect imports), add `declare module "*.css";` to a `.d.ts` file in your app.
120
+
117
121
  ### 3. Use Components
118
122
 
119
123
  ```tsx
@@ -138,6 +142,7 @@ export function Example() {
138
142
  | `@vllnt/ui/styles.css` | Full styles (Tailwind base + theme variables + utilities) |
139
143
  | `@vllnt/ui/themes/default.css` | Theme CSS variables only (no Tailwind base) |
140
144
  | `@vllnt/ui/themes/presets.css` | Built-in color presets (applied via `data-theme`) |
145
+ | `@vllnt/ui/themes/products.css` | Product themes `maia` and `paas` (generated; applied via `data-theme`) |
141
146
 
142
147
  ## Theming
143
148
 
@@ -187,6 +192,32 @@ at runtime with `<ThemeSwitcher />` (or `setThemePreset` / `useThemePreset`),
187
192
  which set `data-theme` on the document root. Render `<ThemePresetProvider />`
188
193
  once near the root to restore the saved preset before paint.
189
194
 
195
+ ### Product themes
196
+
197
+ `@vllnt/ui/themes/products.css` adds two full product themes, generated from
198
+ `packages/design/tokens.json`. Import it after `styles.css`, set
199
+ `data-theme="maia"` or `data-theme="paas"` on `<html>`, and keep using the
200
+ `dark` class for dark mode:
201
+
202
+ ```html
203
+ <html data-theme="maia" class="dark">
204
+ ```
205
+
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.
208
+ - `paas`: core neutrals and status tones in JetBrains Mono. Dark is the design
209
+ default; light works too.
210
+
211
+ 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).
216
+
217
+ Both define `success`, `warning`, `info`, `diff-added` and `diff-removed` roles
218
+ (the core theme defines them as well). Web `--radius` carries the theme's
219
+ `md` step only; the other radius steps ship in the `@vllnt/ui-core` outputs.
220
+
190
221
  To design and export your own theme, use the visual editor at
191
222
  [`/themes`](https://ui.vllnt.com/themes) — it exports a CSS block, a
192
223
  `npx shadcn add` command, or design tokens.
@@ -1,8 +1,22 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, use, useCallback, useMemo, useState } from "react";
3
+ import {
4
+ createContext,
5
+ use,
6
+ useCallback,
7
+ useId,
8
+ useMemo,
9
+ useState
10
+ } from "react";
4
11
  import { cn } from "../../../lib/utils.js";
5
12
  const AccordionContext = createContext(null);
13
+ function getPartId(baseId, part, value) {
14
+ const key = value.replaceAll(
15
+ /[^\dA-Za-z-]/g,
16
+ (character) => `_${(character.codePointAt(0) ?? 0).toString(16)}_`
17
+ );
18
+ return `${baseId}-${part}-${key}`;
19
+ }
6
20
  function useAccordionContext() {
7
21
  const context = use(AccordionContext);
8
22
  if (!context) {
@@ -16,6 +30,7 @@ function Accordion({
16
30
  defaultValue,
17
31
  type = "single"
18
32
  }) {
33
+ const baseId = useId();
19
34
  const [openItems, setOpenItems] = useState(() => {
20
35
  if (!defaultValue) return /* @__PURE__ */ new Set();
21
36
  if (Array.isArray(defaultValue)) return new Set(defaultValue);
@@ -39,8 +54,8 @@ function Accordion({
39
54
  [type]
40
55
  );
41
56
  const contextValue = useMemo(
42
- () => ({ openItems, toggleItem, type }),
43
- [openItems, toggleItem, type]
57
+ () => ({ baseId, openItems, toggleItem, type }),
58
+ [baseId, openItems, toggleItem, type]
44
59
  );
45
60
  return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
46
61
  "div",
@@ -76,18 +91,20 @@ function AccordionTrigger({
76
91
  icon,
77
92
  value
78
93
  }) {
79
- const { openItems, toggleItem } = useAccordionContext();
94
+ const { baseId, openItems, toggleItem } = useAccordionContext();
80
95
  const isOpen = openItems.has(value);
81
96
  return /* @__PURE__ */ jsxs(
82
97
  "button",
83
98
  {
99
+ "aria-controls": getPartId(baseId, "content", value),
84
100
  "aria-expanded": isOpen,
85
101
  className: cn(
86
102
  "w-full flex items-center justify-between p-4 text-left font-medium transition-colors",
87
- "hover:bg-muted/50",
88
- isOpen && "bg-muted/30",
103
+ "hover:bg-secondary/50",
104
+ isOpen && "bg-secondary/30",
89
105
  className
90
106
  ),
107
+ id: getPartId(baseId, "trigger", value),
91
108
  onClick: () => {
92
109
  toggleItem(value);
93
110
  },
@@ -134,15 +151,19 @@ function AccordionContent({
134
151
  className,
135
152
  value
136
153
  }) {
137
- const { openItems } = useAccordionContext();
154
+ const { baseId, openItems } = useAccordionContext();
138
155
  const isOpen = openItems.has(value);
139
156
  return /* @__PURE__ */ jsx(
140
157
  "div",
141
158
  {
159
+ "aria-labelledby": getPartId(baseId, "trigger", value),
142
160
  className: cn(
143
161
  "overflow-hidden transition-all duration-200",
144
162
  isOpen ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0"
145
163
  ),
164
+ id: getPartId(baseId, "content", value),
165
+ inert: !isOpen,
166
+ role: "region",
146
167
  children: /* @__PURE__ */ jsx(
147
168
  "div",
148
169
  {
@@ -296,7 +296,7 @@ const AgentStepProgress = ({
296
296
  "aria-valuemax": 100,
297
297
  "aria-valuemin": 0,
298
298
  "aria-valuenow": clamped,
299
- className: cn("h-1.5 w-full rounded-full bg-muted", className),
299
+ className: cn("h-1.5 w-full rounded-full bg-secondary", className),
300
300
  ref,
301
301
  role: "progressbar",
302
302
  ...rest,
@@ -15,7 +15,7 @@ const AISourceCitation = ({
15
15
  "a",
16
16
  {
17
17
  className: cn(
18
- "group inline-flex max-w-full flex-col gap-2 rounded-xl border border-border/70 bg-background px-3 py-2 text-left shadow-sm transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
18
+ "group inline-flex max-w-full flex-col gap-2 rounded-xl border border-border/70 bg-background px-3 py-2 text-left shadow-sm transition-colors hover:bg-secondary/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
19
19
  className
20
20
  ),
21
21
  href,
@@ -1,51 +1,156 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { createContext, use } from "react";
3
4
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
5
+ import { cva } from "class-variance-authority";
4
6
  import { cn } from "../../../lib/utils.js";
7
+ const avatarSizeVariants = cva("relative flex shrink-0", {
8
+ defaultVariants: {
9
+ size: "md"
10
+ },
11
+ variants: {
12
+ size: {
13
+ lg: "size-12 text-lg",
14
+ md: "size-10",
15
+ sm: "size-8 text-sm",
16
+ xl: "size-16 text-2xl",
17
+ xs: "size-6 text-xs"
18
+ }
19
+ }
20
+ });
21
+ const avatarShapeVariants = cva("", {
22
+ defaultVariants: {
23
+ shape: "circle"
24
+ },
25
+ variants: {
26
+ shape: {
27
+ circle: "rounded-full",
28
+ square: "rounded-md"
29
+ }
30
+ }
31
+ });
32
+ const avatarPresenceVariants = cva(
33
+ "absolute bottom-0 right-0 flex items-center justify-center rounded-full ring-2 ring-background",
34
+ {
35
+ defaultVariants: {
36
+ size: "md"
37
+ },
38
+ variants: {
39
+ presence: {
40
+ away: "border-2 border-warning bg-background",
41
+ busy: "bg-destructive",
42
+ online: "bg-success"
43
+ },
44
+ size: {
45
+ lg: "size-3.5",
46
+ md: "size-3",
47
+ sm: "size-2.5",
48
+ xl: "size-4",
49
+ xs: "size-2"
50
+ }
51
+ }
52
+ }
53
+ );
54
+ const DEFAULT_PRESENCE_LABELS = {
55
+ away: "Away",
56
+ busy: "Busy",
57
+ online: "Online"
58
+ };
59
+ const AvatarShapeContext = createContext("circle");
60
+ const AvatarPresenceMarker = ({
61
+ label,
62
+ presence,
63
+ size
64
+ }) => /* @__PURE__ */ jsxs(
65
+ "span",
66
+ {
67
+ className: avatarPresenceVariants({ presence, size }),
68
+ "data-presence": presence,
69
+ children: [
70
+ presence === "busy" ? /* @__PURE__ */ jsx(
71
+ "span",
72
+ {
73
+ "aria-hidden": "true",
74
+ className: "h-0.5 w-1/2 rounded-full bg-background"
75
+ }
76
+ ) : null,
77
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: label })
78
+ ]
79
+ }
80
+ );
5
81
  const Avatar = ({
82
+ children,
6
83
  className,
84
+ presence,
85
+ presenceLabels,
7
86
  ref,
87
+ shape = "circle",
88
+ size = "md",
8
89
  ...props
9
- }) => /* @__PURE__ */ jsx(
90
+ }) => /* @__PURE__ */ jsx(AvatarShapeContext, { value: shape, children: /* @__PURE__ */ jsxs(
10
91
  AvatarPrimitive.Root,
11
92
  {
12
93
  className: cn(
13
- "relative flex size-10 shrink-0 overflow-hidden rounded-full",
94
+ avatarSizeVariants({ size }),
95
+ avatarShapeVariants({ shape }),
96
+ presence === void 0 && "overflow-hidden",
14
97
  className
15
98
  ),
16
99
  ref,
17
- ...props
100
+ ...props,
101
+ children: [
102
+ children,
103
+ presence === void 0 ? null : /* @__PURE__ */ jsx(
104
+ AvatarPresenceMarker,
105
+ {
106
+ label: presenceLabels?.[presence] ?? DEFAULT_PRESENCE_LABELS[presence],
107
+ presence,
108
+ size
109
+ }
110
+ )
111
+ ]
18
112
  }
19
- );
113
+ ) });
20
114
  Avatar.displayName = AvatarPrimitive.Root.displayName;
21
115
  const AvatarImage = ({
22
116
  className,
23
117
  ref,
24
118
  ...props
25
- }) => /* @__PURE__ */ jsx(
26
- AvatarPrimitive.Image,
27
- {
28
- className: cn("aspect-square h-full w-full", className),
29
- ref,
30
- ...props
31
- }
32
- );
119
+ }) => {
120
+ const shape = use(AvatarShapeContext);
121
+ return /* @__PURE__ */ jsx(
122
+ AvatarPrimitive.Image,
123
+ {
124
+ className: cn(
125
+ "aspect-square h-full w-full",
126
+ avatarShapeVariants({ shape }),
127
+ className
128
+ ),
129
+ ref,
130
+ ...props
131
+ }
132
+ );
133
+ };
33
134
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
34
135
  const AvatarFallback = ({
35
136
  className,
36
137
  ref,
37
138
  ...props
38
- }) => /* @__PURE__ */ jsx(
39
- AvatarPrimitive.Fallback,
40
- {
41
- className: cn(
42
- "flex h-full w-full items-center justify-center rounded-full bg-muted",
43
- className
44
- ),
45
- ref,
46
- ...props
47
- }
48
- );
139
+ }) => {
140
+ const shape = use(AvatarShapeContext);
141
+ return /* @__PURE__ */ jsx(
142
+ AvatarPrimitive.Fallback,
143
+ {
144
+ className: cn(
145
+ "flex h-full w-full items-center justify-center bg-muted",
146
+ avatarShapeVariants({ shape }),
147
+ className
148
+ ),
149
+ ref,
150
+ ...props
151
+ }
152
+ );
153
+ };
49
154
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
50
155
  export {
51
156
  Avatar,
@@ -37,7 +37,7 @@ const Chip = (props) => {
37
37
  return /* @__PURE__ */ jsx(
38
38
  "button",
39
39
  {
40
- className: "flex items-center rounded-full border border-border bg-background px-2 py-1 text-[11px] transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
40
+ className: "flex items-center rounded-full border border-border bg-background px-2 py-1 text-[11px] transition-colors hover:bg-secondary/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
41
41
  "data-strip-event": event.id,
42
42
  "data-strip-event-tone": tone,
43
43
  onClick: handleActivateEvent,
@@ -1,68 +1,120 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
2
3
  import Link from "next/link";
3
4
  import { cn } from "../../../lib/utils.js";
5
+ const DEFAULT_LABELS = {
6
+ more: "More",
7
+ region: "Breadcrumb"
8
+ };
9
+ const COLLAPSE_THRESHOLD = 3;
4
10
  const SEPARATOR_CHARS = {
5
11
  arrow: "\u2192",
6
12
  chevron: "\u203A",
7
13
  slash: "/"
8
14
  };
15
+ const crumbVariants = cva("flex min-h-6 items-center gap-1", {
16
+ defaultVariants: {
17
+ tone: "muted"
18
+ },
19
+ variants: {
20
+ tone: {
21
+ current: "font-medium text-foreground",
22
+ muted: "text-muted-foreground"
23
+ }
24
+ }
25
+ });
9
26
  function SeparatorIcon({ type }) {
10
27
  return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-muted-foreground", children: SEPARATOR_CHARS[type] ?? "\u203A" });
11
28
  }
12
- function Breadcrumb({
29
+ function CrumbBody({ item }) {
30
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ item.icon ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: item.icon }) : null,
32
+ /* @__PURE__ */ jsx("span", { className: cn(typeof item.label === "string" && "truncate"), children: item.label })
33
+ ] });
34
+ }
35
+ function Crumb({
36
+ isCurrent,
37
+ item,
38
+ linkComponent: LinkComponent,
39
+ variant
40
+ }) {
41
+ if (isCurrent) {
42
+ return /* @__PURE__ */ jsx(
43
+ "span",
44
+ {
45
+ "aria-current": "page",
46
+ className: crumbVariants({
47
+ tone: variant === "default" ? "current" : "muted"
48
+ }),
49
+ children: /* @__PURE__ */ jsx(CrumbBody, { item })
50
+ }
51
+ );
52
+ }
53
+ if (item.href) {
54
+ return /* @__PURE__ */ jsx(
55
+ LinkComponent,
56
+ {
57
+ className: cn(
58
+ crumbVariants({ tone: "muted" }),
59
+ "transition-colors hover:text-foreground motion-reduce:transition-none"
60
+ ),
61
+ href: item.href,
62
+ children: /* @__PURE__ */ jsx(CrumbBody, { item })
63
+ }
64
+ );
65
+ }
66
+ return /* @__PURE__ */ jsx("span", { className: crumbVariants({ tone: "muted" }), children: /* @__PURE__ */ jsx(CrumbBody, { item }) });
67
+ }
68
+ function getVisibleEntries(items, overflow) {
69
+ const entries = items.map((item, index) => ({ index, item }));
70
+ if (overflow === "collapsed" && entries.length > COLLAPSE_THRESHOLD) {
71
+ return [...entries.slice(0, 1), null, ...entries.slice(-2)];
72
+ }
73
+ return entries;
74
+ }
75
+ const Breadcrumb = ({
13
76
  className,
14
77
  items,
78
+ labels,
79
+ linkComponent = Link,
80
+ overflow = "none",
81
+ ref,
15
82
  separator = "chevron",
16
83
  variant = "default"
17
- }) {
84
+ }) => {
85
+ const lastIndex = items.length - 1;
18
86
  return /* @__PURE__ */ jsx(
19
87
  "nav",
20
88
  {
21
- "aria-label": "Breadcrumb",
89
+ "aria-label": labels?.region ?? DEFAULT_LABELS.region,
22
90
  className: cn("flex items-center space-x-1 text-sm", className),
23
- children: items.map((item, index) => /* @__PURE__ */ jsxs(
24
- "div",
91
+ ref,
92
+ children: /* @__PURE__ */ jsx("ol", { className: "flex items-center space-x-1", children: getVisibleEntries(items, overflow).map((entry, position) => /* @__PURE__ */ jsxs(
93
+ "li",
25
94
  {
26
95
  className: "flex items-center",
27
96
  children: [
28
- index > 0 && /* @__PURE__ */ jsx("span", { className: "mx-2", children: /* @__PURE__ */ jsx(SeparatorIcon, { type: separator }) }),
29
- item.href ? /* @__PURE__ */ jsxs(
30
- Link,
97
+ position > 0 && /* @__PURE__ */ jsx("span", { className: "mx-2", children: /* @__PURE__ */ jsx(SeparatorIcon, { type: separator }) }),
98
+ entry ? /* @__PURE__ */ jsx(
99
+ Crumb,
31
100
  {
32
- className: "flex items-center gap-1 hover:text-foreground transition-colors",
33
- href: item.href,
34
- children: [
35
- item.icon ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: item.icon }) : null,
36
- /* @__PURE__ */ jsx(
37
- "span",
38
- {
39
- className: cn(
40
- // Truncate plain string labels; custom React elements handle their own overflow
41
- typeof item.label === "string" && "truncate",
42
- variant === "minimal" ? "text-muted-foreground" : "text-foreground"
43
- ),
44
- children: item.label
45
- }
46
- )
47
- ]
101
+ isCurrent: entry.index === lastIndex,
102
+ item: entry.item,
103
+ linkComponent,
104
+ variant
48
105
  }
49
- ) : /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-muted-foreground", children: [
50
- item.icon ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: item.icon }) : null,
51
- /* @__PURE__ */ jsx(
52
- "span",
53
- {
54
- className: cn(typeof item.label === "string" && "truncate"),
55
- children: item.label
56
- }
57
- )
106
+ ) : /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
107
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2026" }),
108
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: labels?.more ?? DEFAULT_LABELS.more })
58
109
  ] })
59
110
  ]
60
111
  },
61
- `${typeof item.label === "string" ? item.label : "breadcrumb"}-${index.toString()}`
62
- ))
112
+ entry ? `${typeof entry.item.label === "string" ? entry.item.label : "breadcrumb"}-${entry.index.toString()}` : "breadcrumb-more"
113
+ )) })
63
114
  }
64
115
  );
65
- }
116
+ };
117
+ Breadcrumb.displayName = "Breadcrumb";
66
118
  export {
67
119
  Breadcrumb
68
120
  };