@vllnt/ui 0.4.0-canary.sha09a55a6 → 0.4.0-canary.sha0abbc44

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 (54) hide show
  1. package/CHANGELOG.md +81 -1
  2. package/README.md +93 -9
  3. package/dist/components/atoms/accordion/accordion.js +1 -0
  4. package/dist/components/atoms/breadcrumb/breadcrumb.js +1 -1
  5. package/dist/components/atoms/checklist/checklist.js +4 -1
  6. package/dist/components/atoms/comparison/comparison.js +38 -24
  7. package/dist/components/atoms/curriculum/curriculum.js +1 -1
  8. package/dist/components/atoms/keyboard-shortcuts-help/keyboard-shortcuts-help.js +7 -2
  9. package/dist/components/atoms/learning-objectives/learning-objectives.js +24 -10
  10. package/dist/components/atoms/order-book/order-book.js +2 -2
  11. package/dist/components/atoms/pro-tip/pro-tip.js +3 -0
  12. package/dist/components/atoms/quiz/quiz.js +2 -0
  13. package/dist/components/atoms/rating/rating.js +2 -2
  14. package/dist/components/atoms/sparkline-grid/sparkline-grid.js +2 -2
  15. package/dist/components/atoms/step-by-step/step-by-step.js +2 -0
  16. package/dist/components/atoms/stepper/stepper.js +1 -0
  17. package/dist/components/atoms/table-of-contents-panel/table-of-contents-panel.js +4 -0
  18. package/dist/components/atoms/toolbar/toolbar.js +1 -0
  19. package/dist/components/molecules/ai-chat-input/ai-chat-input.js +1 -0
  20. package/dist/components/molecules/avatar-group/avatar-group.js +1 -1
  21. package/dist/components/molecules/color-picker/color-picker.js +2 -2
  22. package/dist/components/molecules/connector-edge/connector-edge.js +1 -0
  23. package/dist/components/molecules/content-intro/content-intro.js +2 -0
  24. package/dist/components/molecules/file-upload/file-upload.js +15 -7
  25. package/dist/components/molecules/filter-bar/filter-bar.js +3 -3
  26. package/dist/components/molecules/metric-gauge/metric-gauge.js +2 -2
  27. package/dist/components/molecules/object-card/object-card.js +5 -4
  28. package/dist/components/molecules/overview-board/overview-board.js +1 -0
  29. package/dist/components/molecules/progress-card/progress-card.js +10 -2
  30. package/dist/components/molecules/progress-tracker/progress-tracker.js +40 -32
  31. package/dist/components/molecules/scope-selector/scope-selector.js +2 -2
  32. package/dist/components/molecules/search-bar/search-bar.js +6 -4
  33. package/dist/components/molecules/sidebar/sidebar.js +3 -3
  34. package/dist/components/molecules/status-board/status-board.js +7 -1
  35. package/dist/components/molecules/ticker-tape/ticker-tape.js +2 -2
  36. package/dist/components/molecules/tutorial-filters/tutorial-filters.js +3 -3
  37. package/dist/components/molecules/zoom-hud/zoom-hud.js +1 -0
  38. package/dist/components/organisms/candlestick-chart/candlestick-chart.js +2 -2
  39. package/dist/components/organisms/chart/bar-chart.js +1 -1
  40. package/dist/components/organisms/data-table/data-table.js +31 -18
  41. package/dist/components/organisms/flow-diagram/flow-fullscreen.js +5 -1
  42. package/dist/components/organisms/map-2d/map-2d.js +1 -0
  43. package/dist/components/organisms/market-treemap/market-treemap.js +8 -1
  44. package/dist/components/organisms/slideshow/slideshow.js +13 -10
  45. package/dist/components/organisms/terminal/terminal.js +4 -4
  46. package/dist/index.d.ts +34 -3
  47. package/dist/index.js +4 -0
  48. package/dist/lib/use-event-callback.js +15 -0
  49. package/dist/lib/use-focus-containment.js +74 -0
  50. package/dist/tailwind-preset.js +16 -0
  51. package/package.json +10 -12
  52. package/styles.css +19 -0
  53. package/themes/default.css +19 -0
  54. package/themes/products.css +146 -0
package/CHANGELOG.md CHANGED
@@ -8,7 +8,34 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
8
8
 
9
9
  ### Added
10
10
 
11
- - Source-only React Native renderer and shared design contracts for the 0.4.0 canary track; stable Web installation remains unchanged.
11
+ - **Product themes stylesheet** - `@vllnt/ui/themes/products.css` ships the
12
+ Maia and PaaS themes as `html[data-theme="maia"]` and
13
+ `html[data-theme="paas"]`, each with a `.dark` block. It is generated from
14
+ `packages/design/tokens.json`. Load Figtree (Maia) and JetBrains Mono
15
+ (Maia, PaaS) in your app; the package does not ship the fonts.
16
+ - **Status and diff colors** - CSS variables `--success`, `--warning`,
17
+ `--info`, their `-foreground` pairs, `--diff-added` and `--diff-removed` in
18
+ `themes/default.css` and `styles.css`, and matching Tailwind colors
19
+ (`success`, `warning`, `info`, `diff.added`, `diff.removed`) in the preset.
20
+ - **Label type step** - `--font-size-label`, `--line-height-label` and
21
+ `--font-weight-label`.
22
+
23
+ ## [0.4.0] - 2026-10-31
24
+
25
+ ### Added
26
+
27
+ - **New hooks** - `useFocusContainment` (trap Tab inside a custom modal and
28
+ restore focus on close) and `useEventCallback` (stable callback that always
29
+ calls the latest closure). Registry items import them from `@vllnt/ui`.
30
+ - **Props types exported from the barrel** - `BreadcrumbProps`,
31
+ `CommandDialogProps`, `SheetContentProps`, `CarouselProps`, `CodeBlockProps`,
32
+ `MDXContentProps`, `SidebarProps`, `TableOfContentsProps`,
33
+ `CategoryFilterProps`, `SearchBarProps`, `ShareSectionProps`,
34
+ `SearchDialogProps`, `LangProviderProps`, `ThemeToggleProps`,
35
+ `ProfileSectionProps`, `TLDRSectionProps`, `AreaChartProps`, `BarChartProps`,
36
+ `LineChartProps` and `ThemePresetProviderProps`.
37
+
38
+ - 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.
12
39
  - Localized Native catalog discovery, dependency/capability comparison, and extensible React/React Native source tabs in a single component preview surface.
13
40
  - **Accessibility gate** - the Storybook test-runner runs axe-core (WCAG 2.0,
14
41
  2.1 and 2.2, levels A and AA) on every story in the light and dark theme and
@@ -34,6 +61,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
34
61
 
35
62
  ### Changed
36
63
 
64
+ - **Colour tokens meet WCAG AA** (#538). The default light theme uses a darker
65
+ `--muted-foreground`, `--destructive` and `--input`; in the dark theme
66
+ `--destructive` is lighter with a dark foreground and `--input` is lighter, so
67
+ input borders are easier to see in both. Presets adjust `--primary`,
68
+ `--destructive`, `--input` and `--ring` the same way. Visual snapshots change.
69
+ - **Font tokens on `:root`** - `styles.css` now defines `--font-sans`,
70
+ `--font-display` and `--font-mono` on `:root`. If your app sets variables
71
+ with these names, declare them later in the cascade or on `body` so yours win.
72
+ - **Lighter imports** (#541) - CodeBlock renders its code as plain text first
73
+ and highlights it once the Prism build loads on the client; TutorialMDX loads
74
+ the MDX compiler only for content with JSX, and FlowDiagram loads
75
+ `html-to-image` only when copied. Apps that use neither `toast` nor
76
+ `Toaster` no longer bundle sonner.
77
+ - **Smaller package** - the tarball has 361 files instead of 659: the
78
+ per-component re-export stubs and `dist/test-setup.js` are gone.
79
+ Only the `exports` entry points are public, so imports do not change.
80
+
81
+ - **Peer dependency ranges now match what the package needs.** `next` is
82
+ `>=15.0.0` (Next 14 peers React 18, which the React 19 build cannot use),
83
+ `tailwindcss` is `^3.4.0` (components use `size-*`, `text-balance` and
84
+ `has-[]`, and the preset and CSS are Tailwind v3 only), and `next-themes` is
85
+ now a required peer because the root entry imports it. `next` stays optional
86
+ in metadata, but the root entry still imports `next/link`, `next/image` and
87
+ `next/navigation`, so non-Next apps must alias them (see the README
88
+ workaround). `react` and `react-dom` stay `>=19.0.0`: SearchBar and Slideshow
89
+ no longer call React 19.2's `useEffectEvent`, so 19.0 and 19.1 work.
90
+
37
91
  - **Accessibility behaviour changes** (#543):
38
92
  - Drawer moves focus into its content on open (`autoFocus` now defaults to
39
93
  `true`; pass `autoFocus={false}` for vaul's previous behaviour).
@@ -65,6 +119,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
65
119
 
66
120
  ### Fixed
67
121
 
122
+ - **Setup docs** - the Tailwind config in both READMEs, the installation page
123
+ and the agent skill now lists `./node_modules/@vllnt/ui/dist/**/*.js` in
124
+ `content`. Tailwind 3 ignores a preset's `content` once the app sets its own,
125
+ so the documented config generated no component styles. The agent skill's
126
+ peer ranges and colour format (OKLCH) are corrected too.
127
+ - **Tailwind preset dependency** - `tailwindcss-animate`, which
128
+ `@vllnt/ui/tailwind-preset` imports, is now a runtime dependency. With 0.3.0
129
+ the preset failed to load unless the app installed it.
130
+ - **Duplicate React keys** - Terminal, FileUpload, AvatarGroup, Breadcrumb and
131
+ about 20 other list renderers no longer key rows by content or label alone,
132
+ so repeated or blank entries stop triggering duplicate-key errors. FileUpload
133
+ adds an identical file (same name, size and lastModified) once, so removal
134
+ removes one entry, and a selection that adds nothing new does not call
135
+ `onFilesChange`.
136
+ - **`"use client"` directives** - Toolbar, Stepper, AIChatInput, ObjectCard,
137
+ OverviewBoard and ZoomHUD use event handlers or browser globals and now carry
138
+ the directive. `check:use-client` also flags handler props and browser globals.
139
+ - **Focus in custom dialogs** - KeyboardShortcutsHelp, TableOfContentsPanel,
140
+ the FlowDiagram fullscreen view and the Slideshow contents panel keep Tab and
141
+ Shift+Tab inside the dialog and return focus to the opener on close.
142
+ - **DataTable** sortable headers expose `aria-sort`.
143
+ - **Contrast** - Rating stars and the green success icons in Checklist,
144
+ Curriculum and LearningObjectives reach 3:1 against the background in light
145
+ and dark themes.
146
+ - **Decorative inline `<svg>` icons** are hidden from assistive technology.
147
+
68
148
  - Preserve nested scrolling, reduced-motion behavior and sidebar keyboard focus in the affected Web components.
69
149
  - Forward explicit tab accessibility relationships and label/keyboard handlers without changing default tab navigation.
70
150
  - Emit JSON-LD graph documents and localized Native discovery metadata without advertising unpublished npm packages.
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 — 313 components built on Radix UI primitives, Tailwind CSS, and CVA.
4
4
 
5
5
  See [CHANGELOG.md](./CHANGELOG.md) for release history.
6
6
 
@@ -15,15 +15,69 @@ pnpm add @vllnt/ui
15
15
  Required:
16
16
 
17
17
  ```bash
18
- pnpm add react react-dom tailwindcss
18
+ pnpm add react react-dom tailwindcss next-themes
19
19
  ```
20
20
 
21
- Optional (only if using ThemeProvider, NavbarSaas, or other Next.js-specific components):
21
+ `react` and `react-dom` >= 19.0.0, `tailwindcss` ^3.4.0, `next-themes` >= 0.4.0 (a React-only library; it works outside Next.js).
22
+
23
+ Next.js (>= 15.0.0) is an optional peer, but the root entry imports `next/link`, `next/image` and `next/navigation` at module level. Install `next` unless you alias those modules (below).
22
24
 
23
25
  ```bash
24
- pnpm add next next-themes
26
+ pnpm add next
27
+ ```
28
+
29
+ #### Without Next.js (workaround)
30
+
31
+ Importing anything from `@vllnt/ui` loads every component, including the ones that use `next/*`. In a bundler without Next.js (for example Vite), alias the three modules to small stubs. Verified to build with Vite 7; runtime behaviour of the stubbed components (`Breadcrumb`, `Pagination`, `Sidebar`, `SearchBar`, `NavbarSaas`, ...) is not guaranteed.
32
+
33
+ ```ts
34
+ // vite.config.ts - workaround, not an officially supported setup
35
+ import { fileURLToPath } from "node:url";
36
+ import { defineConfig } from "vite";
37
+
38
+ const stub = (file: string) =>
39
+ fileURLToPath(new URL(`./next-stubs/${file}`, import.meta.url));
40
+
41
+ export default defineConfig({
42
+ resolve: {
43
+ alias: [
44
+ { find: /^next\/link$/, replacement: stub("link.js") },
45
+ { find: /^next\/image$/, replacement: stub("image.js") },
46
+ { find: /^next\/navigation$/, replacement: stub("navigation.js") },
47
+ ],
48
+ },
49
+ });
50
+ ```
51
+
52
+ Stub files (workaround for non-Next bundlers; place them in `next-stubs/`):
53
+
54
+ ```jsx
55
+ // next-stubs/link.js
56
+ import { createElement } from "react";
57
+ export default function Link({ href, prefetch, replace, scroll, ...props }) {
58
+ return createElement("a", { href: typeof href === "string" ? href : href?.pathname, ...props });
59
+ }
60
+ ```
61
+
62
+ ```jsx
63
+ // next-stubs/image.js
64
+ import { createElement } from "react";
65
+ export default function Image({ src, alt = "", fill, priority, quality, placeholder, blurDataURL, loader, unoptimized, ...props }) {
66
+ return createElement("img", { src: typeof src === "string" ? src : src?.src, alt, ...props });
67
+ }
68
+ ```
69
+
70
+ ```js
71
+ // next-stubs/navigation.js
72
+ export const usePathname = () => "/";
73
+ export const useRouter = () => ({
74
+ push() {}, replace() {}, back() {}, forward() {}, refresh() {}, prefetch() {},
75
+ });
76
+ export const useSearchParams = () => new URLSearchParams();
25
77
  ```
26
78
 
79
+ Plain Node ESM import is not supported.
80
+
27
81
  ## Setup
28
82
 
29
83
  ### 1. Tailwind Preset
@@ -38,7 +92,9 @@ export default {
38
92
  presets: [uiPreset],
39
93
  content: [
40
94
  "./src/**/*.{ts,tsx}",
41
- // 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",
42
98
  ],
43
99
  };
44
100
  ```
@@ -60,6 +116,8 @@ import "@vllnt/ui/styles.css";
60
116
 
61
117
  This imports Tailwind base/components/utilities + default theme variables + safe-area utilities.
62
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
+
63
121
  ### 3. Use Components
64
122
 
65
123
  ```tsx
@@ -84,6 +142,7 @@ export function Example() {
84
142
  | `@vllnt/ui/styles.css` | Full styles (Tailwind base + theme variables + utilities) |
85
143
  | `@vllnt/ui/themes/default.css` | Theme CSS variables only (no Tailwind base) |
86
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`) |
87
146
 
88
147
  ## Theming
89
148
 
@@ -133,6 +192,31 @@ at runtime with `<ThemeSwitcher />` (or `setThemePreset` / `useThemePreset`),
133
192
  which set `data-theme` on the document root. Render `<ThemePresetProvider />`
134
193
  once near the root to restore the saved preset before paint.
135
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. Load Figtree (Maia) and JetBrains Mono (Maia
212
+ and PaaS) in your app, for example with `next/font` or a font `<link>`; without
213
+ them the themes fall back to the system font stack (`system-ui` for Maia,
214
+ `ui-monospace` for PaaS).
215
+
216
+ Both define `success`, `warning`, `info`, `diff-added` and `diff-removed` roles
217
+ (the core theme defines them as well). Web `--radius` carries the theme's
218
+ `md` step only; the other radius steps ship in the `@vllnt/ui-core` outputs.
219
+
136
220
  To design and export your own theme, use the visual editor at
137
221
  [`/themes`](https://ui.vllnt.com/themes) — it exports a CSS block, a
138
222
  `npx shadcn add` command, or design tokens.
@@ -436,10 +520,10 @@ import type {
436
520
 
437
521
  ## Requirements
438
522
 
439
- - React >= 18.0.0
440
- - Tailwind CSS >= 3.0.0
441
- - Next.js >= 14.0.0 (optional — only for `ThemeProvider`, `NavbarSaas`, `LangProvider`)
442
- - `next-themes` >= 0.4.0 (optional — only for `ThemeProvider`, `ThemeToggle`)
523
+ - React >= 19.0.0
524
+ - Tailwind CSS ^3.4.0 (`size-*`, `text-balance` and `has-[...]` utilities need 3.4; Tailwind 4 is not supported)
525
+ - `next-themes` >= 0.4.0 (required peer)
526
+ - Next.js >= 15.0.0 (optional peer, but the root entry imports `next/*`; see Peer Dependencies for the no-Next workaround). Next 14 only supports React 18.
443
527
 
444
528
  ## License
445
529
 
@@ -106,6 +106,7 @@ function AccordionTrigger({
106
106
  ) : /* @__PURE__ */ jsx(
107
107
  "svg",
108
108
  {
109
+ "aria-hidden": "true",
109
110
  className: cn(
110
111
  "size-4 flex-shrink-0 transition-transform duration-200",
111
112
  isOpen && "rotate-180"
@@ -58,7 +58,7 @@ function Breadcrumb({
58
58
  ] })
59
59
  ]
60
60
  },
61
- typeof item.label === "string" ? item.label : `breadcrumb-${index}`
61
+ `${typeof item.label === "string" ? item.label : "breadcrumb"}-${index.toString()}`
62
62
  ))
63
63
  }
64
64
  );
@@ -46,7 +46,8 @@ function ChecklistItemRow({
46
46
  isChecked ? /* @__PURE__ */ jsx(
47
47
  "svg",
48
48
  {
49
- className: "size-5 text-green-500 flex-shrink-0 mt-0.5",
49
+ "aria-hidden": "true",
50
+ className: "size-5 text-green-600 dark:text-green-500 flex-shrink-0 mt-0.5",
50
51
  fill: "none",
51
52
  stroke: "currentColor",
52
53
  viewBox: "0 0 24 24",
@@ -63,6 +64,7 @@ function ChecklistItemRow({
63
64
  ) : /* @__PURE__ */ jsx(
64
65
  "svg",
65
66
  {
67
+ "aria-hidden": "true",
66
68
  className: "size-5 text-muted-foreground flex-shrink-0 mt-0.5",
67
69
  fill: "none",
68
70
  stroke: "currentColor",
@@ -103,6 +105,7 @@ function ChecklistHeader({
103
105
  /* @__PURE__ */ jsx(
104
106
  "svg",
105
107
  {
108
+ "aria-hidden": "true",
106
109
  className: "size-5 text-primary",
107
110
  fill: "none",
108
111
  stroke: "currentColor",
@@ -54,18 +54,25 @@ function Comparison({
54
54
  children: before.title
55
55
  }
56
56
  ),
57
- /* @__PURE__ */ jsx("ul", { className: "p-4 space-y-2", children: before.items.map((item) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 text-sm", children: [
58
- /* @__PURE__ */ jsx(
59
- BeforeIcon,
60
- {
61
- className: cn(
62
- "size-4 mt-0.5 flex-shrink-0",
63
- beforeConfig.iconClass
64
- )
65
- }
66
- ),
67
- /* @__PURE__ */ jsx("span", { children: item })
68
- ] }, item)) })
57
+ /* @__PURE__ */ jsx("ul", { className: "p-4 space-y-2", children: before.items.map((item, index) => /* @__PURE__ */ jsxs(
58
+ "li",
59
+ {
60
+ className: "flex items-start gap-2 text-sm",
61
+ children: [
62
+ /* @__PURE__ */ jsx(
63
+ BeforeIcon,
64
+ {
65
+ className: cn(
66
+ "size-4 mt-0.5 flex-shrink-0",
67
+ beforeConfig.iconClass
68
+ )
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx("span", { children: item })
72
+ ]
73
+ },
74
+ `${item}-${index.toString()}`
75
+ )) })
69
76
  ] }),
70
77
  /* @__PURE__ */ jsxs("div", { className: cn("rounded-lg border", afterConfig.className), children: [
71
78
  /* @__PURE__ */ jsx(
@@ -78,18 +85,25 @@ function Comparison({
78
85
  children: after.title
79
86
  }
80
87
  ),
81
- /* @__PURE__ */ jsx("ul", { className: "p-4 space-y-2", children: after.items.map((item) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 text-sm", children: [
82
- /* @__PURE__ */ jsx(
83
- AfterIcon,
84
- {
85
- className: cn(
86
- "size-4 mt-0.5 flex-shrink-0",
87
- afterConfig.iconClass
88
- )
89
- }
90
- ),
91
- /* @__PURE__ */ jsx("span", { children: item })
92
- ] }, item)) })
88
+ /* @__PURE__ */ jsx("ul", { className: "p-4 space-y-2", children: after.items.map((item, index) => /* @__PURE__ */ jsxs(
89
+ "li",
90
+ {
91
+ className: "flex items-start gap-2 text-sm",
92
+ children: [
93
+ /* @__PURE__ */ jsx(
94
+ AfterIcon,
95
+ {
96
+ className: cn(
97
+ "size-4 mt-0.5 flex-shrink-0",
98
+ afterConfig.iconClass
99
+ )
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsx("span", { children: item })
103
+ ]
104
+ },
105
+ `${item}-${index.toString()}`
106
+ )) })
93
107
  ] })
94
108
  ] })
95
109
  ] });
@@ -56,7 +56,7 @@ function statusLabel(status) {
56
56
  }
57
57
  function statusIcon(status) {
58
58
  if (status === "completed") {
59
- return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 flex-shrink-0 text-green-500" });
59
+ return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 flex-shrink-0 text-green-600 dark:text-green-500" });
60
60
  }
61
61
  if (status === "in-progress") {
62
62
  return /* @__PURE__ */ jsx(PlayCircle, { className: "size-4 flex-shrink-0 text-primary" });
@@ -3,11 +3,13 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { memo, useEffect, useRef } from "react";
4
4
  import { useBodyScrollLock } from "../../../lib/use-body-scroll-lock.js";
5
5
  import { useEscapeKey } from "../../../lib/use-escape-key.js";
6
+ import { useFocusContainment } from "../../../lib/use-focus-containment.js";
6
7
  import { cn } from "../../../lib/utils.js";
7
8
  function DefaultCloseIcon() {
8
9
  return /* @__PURE__ */ jsx(
9
10
  "svg",
10
11
  {
12
+ "aria-hidden": "true",
11
13
  className: "size-5",
12
14
  fill: "none",
13
15
  stroke: "currentColor",
@@ -27,7 +29,7 @@ function DefaultCloseIcon() {
27
29
  function ShortcutsList({
28
30
  shortcuts
29
31
  }) {
30
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: shortcuts.map((shortcut) => /* @__PURE__ */ jsxs(
32
+ return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: shortcuts.map((shortcut, index) => /* @__PURE__ */ jsxs(
31
33
  "div",
32
34
  {
33
35
  className: "flex items-center justify-between text-sm",
@@ -43,7 +45,7 @@ function ShortcutsList({
43
45
  )) })
44
46
  ]
45
47
  },
46
- shortcut.description
48
+ `${shortcut.description}-${index.toString()}`
47
49
  )) });
48
50
  }
49
51
  function KeyboardShortcutsHelpImpl({
@@ -57,6 +59,8 @@ function KeyboardShortcutsHelpImpl({
57
59
  title = "Keyboard Shortcuts"
58
60
  }) {
59
61
  const closeButtonRef = useRef(null);
62
+ const dialogRef = useRef(null);
63
+ useFocusContainment(dialogRef, isOpen);
60
64
  useEffect(() => {
61
65
  if (isOpen) {
62
66
  closeButtonRef.current?.focus();
@@ -71,6 +75,7 @@ function KeyboardShortcutsHelpImpl({
71
75
  "aria-labelledby": "shortcuts-title",
72
76
  "aria-modal": "true",
73
77
  className: "fixed inset-0 z-50 flex items-center justify-center",
78
+ ref: dialogRef,
74
79
  role: "dialog",
75
80
  children: [
76
81
  /* @__PURE__ */ jsx(
@@ -18,10 +18,17 @@ function LearningObjectives({
18
18
  /* @__PURE__ */ jsx("span", { children: estimatedTime })
19
19
  ] }) : null
20
20
  ] }),
21
- /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: objectives.map((objective) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
22
- /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-primary flex-shrink-0 mt-0.5" }),
23
- /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: objective })
24
- ] }, objective)) })
21
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: objectives.map((objective, index) => /* @__PURE__ */ jsxs(
22
+ "li",
23
+ {
24
+ className: "flex items-start gap-2",
25
+ children: [
26
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-primary flex-shrink-0 mt-0.5" }),
27
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: objective })
28
+ ]
29
+ },
30
+ `${objective}-${index.toString()}`
31
+ )) })
25
32
  ] });
26
33
  }
27
34
  function Prerequisites({
@@ -37,7 +44,7 @@ function Prerequisites({
37
44
  ] }),
38
45
  level ? /* @__PURE__ */ jsx("span", { className: "text-xs font-medium px-2 py-1 rounded-full bg-primary/10 text-primary capitalize", children: level }) : null
39
46
  ] }),
40
- /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: items.map((item) => /* @__PURE__ */ jsxs(
47
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: items.map((item, index) => /* @__PURE__ */ jsxs(
41
48
  "li",
42
49
  {
43
50
  className: "flex items-start gap-2 text-sm text-muted-foreground",
@@ -46,7 +53,7 @@ function Prerequisites({
46
53
  item
47
54
  ]
48
55
  },
49
- item
56
+ `${item}-${index.toString()}`
50
57
  )) })
51
58
  ] });
52
59
  }
@@ -63,10 +70,17 @@ function Summary({
63
70
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground [&>p]:mb-2", children }),
64
71
  keyTakeaways && keyTakeaways.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "mt-4 pt-4 border-t border-border", children: [
65
72
  /* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2", children: "Key Takeaways" }),
66
- /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: keyTakeaways.map((takeaway) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 text-sm", children: [
67
- /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-green-500 flex-shrink-0 mt-0.5" }),
68
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: takeaway })
69
- ] }, takeaway)) })
73
+ /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: keyTakeaways.map((takeaway, index) => /* @__PURE__ */ jsxs(
74
+ "li",
75
+ {
76
+ className: "flex items-start gap-2 text-sm",
77
+ children: [
78
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-green-600 dark:text-green-500 flex-shrink-0 mt-0.5" }),
79
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: takeaway })
80
+ ]
81
+ },
82
+ `${takeaway}-${index.toString()}`
83
+ )) })
70
84
  ] }) : null
71
85
  ] });
72
86
  }
@@ -42,7 +42,7 @@ function BookSide({
42
42
  /* @__PURE__ */ jsx("span", { className: "text-right", children: "Size" }),
43
43
  /* @__PURE__ */ jsx("span", { className: "text-right", children: "Total" })
44
44
  ] }),
45
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: levels.map((level) => {
45
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: levels.map((level, index) => {
46
46
  const width = `${(level.total ?? 0) / maxTotal * 100}%`;
47
47
  return /* @__PURE__ */ jsxs(
48
48
  "div",
@@ -66,7 +66,7 @@ function BookSide({
66
66
  ] })
67
67
  ]
68
68
  },
69
- `${accent}-${level.price}-${level.size}`
69
+ `${accent}-${level.price}-${index.toString()}`
70
70
  );
71
71
  }) })
72
72
  ] })
@@ -42,6 +42,7 @@ function ProTip({
42
42
  /* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-full bg-current/10 flex-shrink-0", children: icon ? /* @__PURE__ */ jsx("span", { className: "size-4", children: icon }) : /* @__PURE__ */ jsx(
43
43
  "svg",
44
44
  {
45
+ "aria-hidden": "true",
45
46
  className: "size-4",
46
47
  fill: "none",
47
48
  stroke: "currentColor",
@@ -73,6 +74,7 @@ function CommonMistakeFix({
73
74
  fixIcon ? /* @__PURE__ */ jsx("span", { className: "size-5 text-green-500 flex-shrink-0 mt-0.5", children: fixIcon }) : /* @__PURE__ */ jsx(
74
75
  "svg",
75
76
  {
77
+ "aria-hidden": "true",
76
78
  className: "size-5 text-green-500 flex-shrink-0 mt-0.5",
77
79
  fill: "none",
78
80
  stroke: "currentColor",
@@ -114,6 +116,7 @@ function CommonMistake({
114
116
  icon ? /* @__PURE__ */ jsx("span", { className: "size-5 text-red-500 flex-shrink-0 mt-0.5", children: icon }) : /* @__PURE__ */ jsx(
115
117
  "svg",
116
118
  {
119
+ "aria-hidden": "true",
117
120
  className: "size-5 text-red-500 flex-shrink-0 mt-0.5",
118
121
  fill: "none",
119
122
  stroke: "currentColor",
@@ -9,6 +9,7 @@ function QuizResultIcon({
9
9
  return /* @__PURE__ */ jsx(
10
10
  "svg",
11
11
  {
12
+ "aria-hidden": "true",
12
13
  className,
13
14
  fill: "none",
14
15
  stroke: "currentColor",
@@ -112,6 +113,7 @@ function QuizHeader({ Heading, question }) {
112
113
  /* @__PURE__ */ jsx(
113
114
  "svg",
114
115
  {
116
+ "aria-hidden": "true",
115
117
  className: "size-5 text-primary flex-shrink-0 mt-0.5",
116
118
  fill: "none",
117
119
  stroke: "currentColor",
@@ -48,8 +48,8 @@ function RatingStars({
48
48
  "aria-label": `${starValue} ${starValue === 1 ? "star" : "stars"}`,
49
49
  className: cn(
50
50
  "rounded-sm text-muted-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
51
- !readOnly && "hover:text-amber-500",
52
- isFilled && "text-amber-500"
51
+ !readOnly && "hover:text-amber-600 dark:hover:text-amber-500",
52
+ isFilled && "text-amber-600 dark:text-amber-500"
53
53
  ),
54
54
  disabled: readOnly,
55
55
  onBlur: () => {
@@ -28,7 +28,7 @@ const SparklineGrid = (props) => {
28
28
  className: cn("grid grid-cols-1 gap-4", gridColumns[columns], className),
29
29
  ref: reference,
30
30
  ...rest,
31
- children: items.map((item) => {
31
+ children: items.map((item, index) => {
32
32
  const isPositive = item.change >= 0;
33
33
  const TrendIcon = isPositive ? ArrowUpRight : ArrowDownRight;
34
34
  const strokeClass = isPositive ? "text-emerald-700 dark:text-emerald-400" : "text-rose-700 dark:text-rose-400";
@@ -80,7 +80,7 @@ const SparklineGrid = (props) => {
80
80
  ) })
81
81
  ]
82
82
  },
83
- item.label
83
+ `${item.label}-${index.toString()}`
84
84
  );
85
85
  })
86
86
  }
@@ -41,6 +41,7 @@ function InteractiveStep({
41
41
  children: isCompleted ? /* @__PURE__ */ jsx(
42
42
  "svg",
43
43
  {
44
+ "aria-hidden": "true",
44
45
  className: "size-4",
45
46
  fill: "none",
46
47
  stroke: "currentColor",
@@ -96,6 +97,7 @@ function StepByStepTitleIcon() {
96
97
  return /* @__PURE__ */ jsx(
97
98
  "svg",
98
99
  {
100
+ "aria-hidden": "true",
99
101
  className: "size-5 text-primary",
100
102
  fill: "none",
101
103
  stroke: "currentColor",
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Check, Circle } from "lucide-react";
3
4
  import { cn } from "../../../lib/utils.js";
@@ -3,10 +3,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { memo, useEffect, useRef } from "react";
4
4
  import { useBodyScrollLock } from "../../../lib/use-body-scroll-lock.js";
5
5
  import { useEscapeKey } from "../../../lib/use-escape-key.js";
6
+ import { useFocusContainment } from "../../../lib/use-focus-containment.js";
6
7
  import { cn } from "../../../lib/utils.js";
7
8
  function useTocPanelBehavior(isOpen, onClose) {
8
9
  const panelRef = useRef(null);
9
10
  const closeButtonRef = useRef(null);
11
+ useFocusContainment(panelRef, isOpen);
10
12
  useEffect(() => {
11
13
  if (isOpen) {
12
14
  closeButtonRef.current?.focus();
@@ -47,6 +49,7 @@ function TocHeader({
47
49
  children: closeIcon ?? /* @__PURE__ */ jsx(
48
50
  "svg",
49
51
  {
52
+ "aria-hidden": "true",
50
53
  className: "size-5",
51
54
  fill: "none",
52
55
  stroke: "currentColor",
@@ -137,6 +140,7 @@ function TocSectionList({
137
140
  children: isCompleted ? /* @__PURE__ */ jsx(
138
141
  "svg",
139
142
  {
143
+ "aria-hidden": "true",
140
144
  className: "size-3",
141
145
  fill: "none",
142
146
  stroke: "currentColor",
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { cn } from "../../../lib/utils.js";
3
4
  const FOCUSABLE_SELECTOR = [
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { cva } from "class-variance-authority";
3
4
  import { LoaderCircle, SendHorizontal } from "lucide-react";