@raydenui/ui 0.9.7 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -49
- package/dist/Table-DCNSxua1.d.cts +31 -0
- package/dist/Table-DCNSxua1.d.ts +31 -0
- package/dist/blocks/ApplicationShellBlock.cjs +157 -0
- package/dist/blocks/ApplicationShellBlock.js +154 -0
- package/dist/blocks/CheckoutReviewBlock.cjs +16 -0
- package/dist/blocks/CheckoutReviewBlock.js +13 -0
- package/dist/blocks/CommandPaletteBlock.cjs +334 -0
- package/dist/blocks/CommandPaletteBlock.js +331 -0
- package/dist/blocks/CreateAccountBlock.cjs +147 -0
- package/dist/blocks/CreateAccountBlock.js +143 -0
- package/dist/blocks/EmptyStateBlock.cjs +19 -0
- package/dist/blocks/EmptyStateBlock.js +16 -0
- package/dist/blocks/FeatureOverviewBlock.cjs +54 -0
- package/dist/blocks/FeatureOverviewBlock.js +51 -0
- package/dist/blocks/HeaderBlock.cjs +230 -0
- package/dist/blocks/HeaderBlock.js +227 -0
- package/dist/blocks/KpiOverviewBlock.cjs +63 -0
- package/dist/blocks/KpiOverviewBlock.js +60 -0
- package/dist/blocks/LoginBlock.cjs +66 -0
- package/dist/blocks/LoginBlock.js +63 -0
- package/dist/blocks/NotificationsBlock.cjs +17 -0
- package/dist/blocks/NotificationsBlock.js +14 -0
- package/dist/blocks/PageHeaderBlock.cjs +121 -0
- package/dist/blocks/PageHeaderBlock.js +118 -0
- package/dist/blocks/PricingPlansBlock.cjs +146 -0
- package/dist/blocks/PricingPlansBlock.js +143 -0
- package/dist/blocks/ProductCollectionBlock.cjs +37 -0
- package/dist/blocks/ProductCollectionBlock.js +34 -0
- package/dist/blocks/ProductDetailBlock.cjs +30 -0
- package/dist/blocks/ProductDetailBlock.js +27 -0
- package/dist/blocks/ProductHeroBlock.cjs +83 -0
- package/dist/blocks/ProductHeroBlock.js +80 -0
- package/dist/blocks/ProfileSettingsBlock.cjs +130 -0
- package/dist/blocks/ProfileSettingsBlock.js +126 -0
- package/dist/blocks/QuickSendBlock.cjs +11 -0
- package/dist/blocks/QuickSendBlock.js +8 -0
- package/dist/blocks/RecentTransactionsBlock.cjs +13 -0
- package/dist/blocks/RecentTransactionsBlock.js +10 -0
- package/dist/blocks/SearchableTableBlock.cjs +91 -0
- package/dist/blocks/SearchableTableBlock.js +88 -0
- package/dist/blocks/ShoppingCartBlock.cjs +16 -0
- package/dist/blocks/ShoppingCartBlock.js +13 -0
- package/dist/blocks/SiteFooterBlock.cjs +69 -0
- package/dist/blocks/SiteFooterBlock.js +66 -0
- package/dist/blocks/TableBlock.cjs +20 -0
- package/dist/blocks/TableBlock.js +17 -0
- package/dist/blocks/TaskListBlock.cjs +198 -0
- package/dist/blocks/TaskListBlock.js +195 -0
- package/dist/blocks/WorkspaceSwitcherBlock.cjs +291 -0
- package/dist/blocks/WorkspaceSwitcherBlock.js +288 -0
- package/dist/blocks/commerce.cjs +44 -0
- package/dist/blocks/commerce.js +35 -0
- package/dist/blocks/index.cjs +53 -0
- package/dist/blocks/index.js +24 -0
- package/dist/blocks.d.cts +1820 -0
- package/dist/blocks.d.ts +1820 -0
- package/dist/chart.cjs +13 -0
- package/dist/chart.d.cts +59 -0
- package/dist/chart.d.ts +59 -0
- package/dist/chart.js +5 -0
- package/dist/components/Accordion/Accordion.cjs +94 -0
- package/dist/components/Accordion/Accordion.js +91 -0
- package/dist/components/Accordion/index.cjs +8 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/ActivityFeed/ActivityContent.cjs +40 -0
- package/dist/components/ActivityFeed/ActivityContent.js +37 -0
- package/dist/components/ActivityFeed/ActivityItem.cjs +19 -0
- package/dist/components/ActivityFeed/ActivityItem.js +16 -0
- package/dist/components/ActivityFeed/index.cjs +7 -0
- package/dist/components/ActivityFeed/index.js +2 -0
- package/dist/components/Alert/Alert.cjs +42 -0
- package/dist/components/Alert/Alert.js +39 -0
- package/dist/components/Alert/index.cjs +5 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Avatar/Avatar.cjs +101 -0
- package/dist/components/Avatar/Avatar.js +98 -0
- package/dist/components/Avatar/index.cjs +6 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Badge/Badge.cjs +53 -0
- package/dist/components/Badge/Badge.js +50 -0
- package/dist/components/Badge/index.cjs +5 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Banner/Banner.cjs +83 -0
- package/dist/components/Banner/Banner.js +80 -0
- package/dist/components/Banner/index.cjs +5 -0
- package/dist/components/Banner/index.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +31 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +28 -0
- package/dist/components/Breadcrumb/index.cjs +5 -0
- package/dist/components/Breadcrumb/index.js +1 -0
- package/dist/components/Button/Button.cjs +88 -0
- package/dist/components/Button/Button.js +85 -0
- package/dist/components/Button/index.cjs +5 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.cjs +8 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.cjs +15 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.js +12 -0
- package/dist/components/ButtonGroup/index.cjs +7 -0
- package/dist/components/ButtonGroup/index.js +2 -0
- package/dist/components/Card/Card.cjs +94 -0
- package/dist/components/Card/Card.js +91 -0
- package/dist/components/Card/index.cjs +9 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Chart/Chart.cjs +160 -0
- package/dist/components/Chart/Chart.js +153 -0
- package/dist/components/Chart/index.cjs +10 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Chart/theme.cjs +67 -0
- package/dist/components/Chart/theme.js +62 -0
- package/dist/components/Chip/Chip.cjs +18 -0
- package/dist/components/Chip/Chip.js +15 -0
- package/dist/components/Chip/index.cjs +5 -0
- package/dist/components/Chip/index.js +1 -0
- package/dist/components/Counter/Counter.cjs +74 -0
- package/dist/components/Counter/Counter.js +71 -0
- package/dist/components/Counter/index.cjs +6 -0
- package/dist/components/Counter/index.js +1 -0
- package/dist/components/DatePicker/DatePicker.cjs +343 -0
- package/dist/components/DatePicker/DatePicker.js +340 -0
- package/dist/components/DatePicker/index.cjs +5 -0
- package/dist/components/DatePicker/index.js +1 -0
- package/dist/components/Divider/Divider.cjs +31 -0
- package/dist/components/Divider/Divider.js +28 -0
- package/dist/components/Divider/index.cjs +5 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.cjs +108 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +105 -0
- package/dist/components/DropdownMenu/index.cjs +11 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.cjs +42 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.js +39 -0
- package/dist/components/EmptyStateIllustration/illustrations.cjs +3322 -0
- package/dist/components/EmptyStateIllustration/illustrations.js +3319 -0
- package/dist/components/EmptyStateIllustration/index.cjs +7 -0
- package/dist/components/EmptyStateIllustration/index.js +2 -0
- package/dist/components/FileUpload/FileUpload.cjs +116 -0
- package/dist/components/FileUpload/FileUpload.js +113 -0
- package/dist/components/FileUpload/FileUploadDropZone.cjs +58 -0
- package/dist/components/FileUpload/FileUploadDropZone.js +55 -0
- package/dist/components/FileUpload/FileUploadIcons.cjs +55 -0
- package/dist/components/FileUpload/FileUploadIcons.js +50 -0
- package/dist/components/FileUpload/FileUploadItem.cjs +34 -0
- package/dist/components/FileUpload/FileUploadItem.js +31 -0
- package/dist/components/FileUpload/index.cjs +9 -0
- package/dist/components/FileUpload/index.js +3 -0
- package/dist/components/FormControl/Checkbox.cjs +27 -0
- package/dist/components/FormControl/Checkbox.js +24 -0
- package/dist/components/FormControl/Radio.cjs +15 -0
- package/dist/components/FormControl/Radio.js +12 -0
- package/dist/components/FormControl/Toggle.cjs +15 -0
- package/dist/components/FormControl/Toggle.js +12 -0
- package/dist/components/FormControl/index.cjs +9 -0
- package/dist/components/FormControl/index.js +3 -0
- package/dist/components/Icon/Icon.cjs +70 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/catalog.cjs +1672 -0
- package/dist/components/Icon/catalog.js +1669 -0
- package/dist/components/Icon/icons.cjs +5621 -0
- package/dist/components/Icon/icons.js +5610 -0
- package/dist/components/Icon/index.cjs +8 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Input/Input.cjs +64 -0
- package/dist/components/Input/Input.js +61 -0
- package/dist/components/Input/index.cjs +5 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/MetricsCard/MetricsCard.cjs +107 -0
- package/dist/components/MetricsCard/MetricsCard.js +104 -0
- package/dist/components/MetricsCard/index.cjs +5 -0
- package/dist/components/MetricsCard/index.js +1 -0
- package/dist/components/Modal/Modal.cjs +126 -0
- package/dist/components/Modal/Modal.js +123 -0
- package/dist/components/Modal/index.cjs +5 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Pagination/Pagination.cjs +42 -0
- package/dist/components/Pagination/Pagination.js +39 -0
- package/dist/components/Pagination/index.cjs +5 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +34 -0
- package/dist/components/ProgressBar/ProgressBar.js +31 -0
- package/dist/components/ProgressBar/index.cjs +5 -0
- package/dist/components/ProgressBar/index.js +1 -0
- package/dist/components/ProgressCircle/ProgressCircle.cjs +34 -0
- package/dist/components/ProgressCircle/ProgressCircle.js +31 -0
- package/dist/components/ProgressCircle/index.cjs +5 -0
- package/dist/components/ProgressCircle/index.js +1 -0
- package/dist/components/Select/Select.cjs +84 -0
- package/dist/components/Select/Select.js +80 -0
- package/dist/components/Select/SelectOption.cjs +26 -0
- package/dist/components/Select/SelectOption.js +23 -0
- package/dist/components/Select/index.cjs +7 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SidebarMenu/SidebarMenu.cjs +85 -0
- package/dist/components/SidebarMenu/SidebarMenu.js +81 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.cjs +126 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.js +122 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.cjs +14 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.js +11 -0
- package/dist/components/SidebarMenu/index.cjs +12 -0
- package/dist/components/SidebarMenu/index.js +4 -0
- package/dist/components/Slider/Slider.cjs +161 -0
- package/dist/components/Slider/Slider.js +158 -0
- package/dist/components/Slider/index.cjs +6 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Spinner/Spinner.cjs +93 -0
- package/dist/components/Spinner/Spinner.js +90 -0
- package/dist/components/Spinner/index.cjs +5 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Stepper/Stepper.cjs +82 -0
- package/dist/components/Stepper/Stepper.js +79 -0
- package/dist/components/Stepper/index.cjs +7 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Table/Table.cjs +25 -0
- package/dist/components/Table/Table.js +22 -0
- package/dist/components/Table/index.cjs +10 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Table/useTableSelection.cjs +60 -0
- package/dist/components/Table/useTableSelection.js +57 -0
- package/dist/components/Tabs/Tab.cjs +70 -0
- package/dist/components/Tabs/Tab.js +67 -0
- package/dist/components/Tabs/Tabs.cjs +133 -0
- package/dist/components/Tabs/Tabs.js +129 -0
- package/dist/components/Tabs/index.cjs +7 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +101 -0
- package/dist/components/Tooltip/Tooltip.js +98 -0
- package/dist/components/Tooltip/index.cjs +5 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/context/ThemeContext.cjs +97 -0
- package/dist/context/ThemeContext.js +92 -0
- package/dist/fonts/README.md +13 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-normal.woff2 +0 -0
- package/dist/fonts/hankengrotesk-LICENSE.txt +94 -0
- package/dist/fonts/manrope-LICENSE.txt +93 -0
- package/dist/fonts/manrope-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-cyrillic-normal.woff2 +0 -0
- package/dist/fonts/manrope-greek-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-normal.woff2 +0 -0
- package/dist/fonts/manrope-vietnamese-normal.woff2 +0 -0
- package/dist/fonts.css +148 -0
- package/dist/hooks/form/index.cjs +11 -0
- package/dist/hooks/form/index.js +3 -0
- package/dist/hooks/form/useRaydenFormControl.cjs +81 -0
- package/dist/hooks/form/useRaydenFormControl.js +76 -0
- package/dist/hooks/form/useRaydenInput.cjs +38 -0
- package/dist/hooks/form/useRaydenInput.js +35 -0
- package/dist/hooks/form/useRaydenSelect.cjs +45 -0
- package/dist/hooks/form/useRaydenSelect.js +42 -0
- package/dist/hooks/index.cjs +17 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useBodyScrollLock.cjs +24 -0
- package/dist/hooks/useBodyScrollLock.js +21 -0
- package/dist/hooks/useCollisionAwareSide.cjs +72 -0
- package/dist/hooks/useCollisionAwareSide.js +69 -0
- package/dist/hooks/useControllableValue.cjs +16 -0
- package/dist/hooks/useControllableValue.js +13 -0
- package/dist/hooks/useDismissableLayer.cjs +100 -0
- package/dist/hooks/useDismissableLayer.js +97 -0
- package/dist/hooks/usePopupList.cjs +101 -0
- package/dist/hooks/usePopupList.js +98 -0
- package/dist/icons-8yD7I5jO.d.cts +430 -0
- package/dist/icons-8yD7I5jO.d.ts +430 -0
- package/dist/icons.cjs +2111 -418
- package/dist/icons.d.cts +1256 -429
- package/dist/icons.d.ts +1256 -429
- package/dist/icons.js +2089 -1
- package/dist/index.cjs +128 -15046
- package/dist/index.d.cts +697 -662
- package/dist/index.d.ts +697 -662
- package/dist/index.js +43 -14962
- package/dist/motion/Collapse.cjs +28 -0
- package/dist/motion/Collapse.js +25 -0
- package/dist/motion/MotionProvider.cjs +43 -0
- package/dist/motion/MotionProvider.js +38 -0
- package/dist/motion/Pressable.cjs +46 -0
- package/dist/motion/Pressable.js +43 -0
- package/dist/motion/Reveal.cjs +19 -0
- package/dist/motion/Reveal.js +16 -0
- package/dist/motion/SharedLayout.cjs +46 -0
- package/dist/motion/SharedLayout.js +43 -0
- package/dist/motion/index.cjs +19 -0
- package/dist/motion/index.js +6 -0
- package/dist/motion/presence.cjs +58 -0
- package/dist/motion/presence.js +55 -0
- package/dist/motion/presets.cjs +88 -0
- package/dist/motion/presets.js +84 -0
- package/dist/motion.d.cts +51 -0
- package/dist/motion.d.ts +51 -0
- package/dist/preset.cjs +356 -195
- package/dist/preset.d.cts +111 -32
- package/dist/preset.d.ts +111 -32
- package/dist/preset.js +353 -187
- package/dist/presets-Ba5QndHg.d.cts +144 -0
- package/dist/presets-Ba5QndHg.d.ts +144 -0
- package/dist/styles.css +1 -1
- package/dist/utils/cn.cjs +38 -0
- package/dist/utils/cn.js +35 -0
- package/dist/utils/resolveIcon.cjs +18 -0
- package/dist/utils/resolveIcon.js +15 -0
- package/package.json +79 -21
package/README.md
CHANGED
|
@@ -6,91 +6,166 @@
|
|
|
6
6
|
|
|
7
7
|
# Rayden UI
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
Pixel-perfect components from the [Rayna UI](https://www.raynaui.com/) design system.
|
|
9
|
+
React components, page blocks, icons, and design tokens for building product interfaces. Rayden's default **Citrionus** flavor is built with Tailwind CSS v4 and includes TypeScript definitions, light and dark themes, and opt-in motion.
|
|
11
10
|
|
|
12
11
|
[](https://www.npmjs.com/package/@raydenui/ui)
|
|
13
12
|
[](https://www.npmjs.com/package/@raydenui/ui)
|
|
14
13
|
[](https://opensource.org/licenses/MIT)
|
|
15
|
-
[](https://rayden-docs.vercel.app)
|
|
16
|
-
[](https://69b6d5e6cb6bbc778afec0ee-tcxvxzrkrt.chromatic.com/)
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
[Documentation](https://rayden-docs.vercel.app) · [Storybook](https://main--69b6d5d8527b4eddb882e0a7.chromatic.com) · [Source](https://github.com/playbookTV/Rayden)
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
In an existing React application:
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
|
-
|
|
22
|
+
npm install @raydenui/ui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
React and React DOM 18 or later are required. Import the component stylesheet once in your app entry point or root layout. The optional font stylesheet serves bundled Hanken Grotesk and Manrope webfonts from your app.
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import "@raydenui/ui/styles.css";
|
|
29
|
+
import "@raydenui/ui/fonts.css";
|
|
30
|
+
import { Badge, Button, Input, ThemeProvider } from "@raydenui/ui";
|
|
31
|
+
|
|
32
|
+
export default function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ThemeProvider defaultTheme="system">
|
|
35
|
+
<main style={{ display: "grid", gap: 16, maxWidth: 400, padding: 24 }}>
|
|
36
|
+
<Input label="Email" type="email" placeholder="you@example.com" />
|
|
37
|
+
<Button variant="primary" size="lg">Subscribe</Button>
|
|
38
|
+
<Badge color="success">Active</Badge>
|
|
39
|
+
</main>
|
|
40
|
+
</ThemeProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The package includes compiled component CSS. Configure Tailwind CSS v4 in your own app if you also want to generate utility classes for your layouts. In Next.js App Router, put interactive examples and providers in a client component with `"use client"`; import global styles from the root layout.
|
|
46
|
+
|
|
47
|
+
### Start a new project
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx create-rayden-app@latest my-app
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Choose Vite or Next.js, TypeScript or JavaScript, and one of six starter templates: `blank`, `minimal`, `landing`, `dashboard`, `ecommerce`, or `blog`. Follow the CLI's printed next steps; it can install dependencies during setup.
|
|
54
|
+
|
|
55
|
+
For an explicit setup with npm:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx create-rayden-app@latest my-app -f vite -t minimal --ts --pm npm --install
|
|
24
59
|
cd my-app
|
|
25
|
-
npm install
|
|
26
60
|
npm run dev
|
|
27
61
|
```
|
|
28
62
|
|
|
29
|
-
|
|
63
|
+
## Package imports
|
|
30
64
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
65
|
+
| Import | What it provides |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `@raydenui/ui` | Components, theme providers and hooks, icon discovery, and utilities |
|
|
68
|
+
| `@raydenui/ui/blocks` | Ready-made application, account, marketing, and commerce blocks |
|
|
69
|
+
| `@raydenui/ui/icons` | Named static icon data such as `heartIcon` |
|
|
70
|
+
| `@raydenui/ui/chart` | `RaydenChart` and chart helpers |
|
|
71
|
+
| `@raydenui/ui/motion` | Motion primitives, presets, and recipes |
|
|
72
|
+
| `@raydenui/ui/preset` | Programmatic design tokens and the Tailwind preset |
|
|
73
|
+
| `@raydenui/ui/styles.css` | Compiled component styles and theme variables |
|
|
74
|
+
| `@raydenui/ui/fonts.css` | Optional bundled webfonts |
|
|
39
75
|
|
|
40
|
-
|
|
76
|
+
Charts require the optional `chart.js` and `react-chartjs-2` peers. The `useRaydenInput`, `useRaydenSelect`, and other form integration hooks require `react-hook-form`. Install these only when using the corresponding features:
|
|
41
77
|
|
|
42
78
|
```bash
|
|
43
|
-
|
|
79
|
+
npm install chart.js react-chartjs-2
|
|
80
|
+
# For React Hook Form integration:
|
|
81
|
+
npm install react-hook-form
|
|
44
82
|
```
|
|
45
83
|
|
|
46
|
-
|
|
47
|
-
|------|---------|
|
|
48
|
-
| `-f, --framework` | `vite` (recommended), `nextjs` |
|
|
49
|
-
| `-t, --template` | `blank`, `minimal`, `landing`, `dashboard`, `ecommerce`, `blog` |
|
|
50
|
-
| `--ts` / `--js` | TypeScript (default) or JavaScript |
|
|
51
|
-
| `--pm` | `npm`, `pnpm`, `yarn` |
|
|
84
|
+
## Components and blocks
|
|
52
85
|
|
|
53
|
-
|
|
86
|
+
- **Forms:** Button, ButtonGroup, Input, Select, Checkbox, Radio, Toggle, Chip, FileUpload, Counter, Slider, and DatePicker.
|
|
87
|
+
- **Navigation:** Tabs, Breadcrumb, Pagination, SidebarMenu, DropdownMenu, and Stepper.
|
|
88
|
+
- **Display and feedback:** Card, Table, Avatar, ActivityItem, ActivityContent, MetricsCard, Icon, EmptyStateIllustration, Alert, Badge, Banner, ProgressBar, ProgressCircle, Spinner, and Tooltip.
|
|
89
|
+
- **Layout:** Accordion, Divider, and Modal. Charts are available as `RaydenChart` from the chart subpath.
|
|
54
90
|
|
|
55
|
-
|
|
56
|
-
|
|
91
|
+
Import page blocks separately:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { PageHeaderBlock } from "@raydenui/ui/blocks";
|
|
95
|
+
|
|
96
|
+
export function OverviewHeader() {
|
|
97
|
+
return (
|
|
98
|
+
<PageHeaderBlock
|
|
99
|
+
title="Overview"
|
|
100
|
+
description="A snapshot of your workspace activity."
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
57
104
|
```
|
|
58
105
|
|
|
59
|
-
|
|
106
|
+
The block library includes application shells, page headers, workspace switching, command palettes, login and account creation, profile settings, KPI overviews, task lists, tables, notifications, marketing sections, product browsing, carts, and checkout review. Blocks provide UI; connect their props and callbacks to your own data and services.
|
|
107
|
+
|
|
108
|
+
## Icons
|
|
109
|
+
|
|
110
|
+
Use a static data import for immediate rendering, including server rendering:
|
|
60
111
|
|
|
61
112
|
```tsx
|
|
62
|
-
import "@raydenui/ui
|
|
63
|
-
import {
|
|
113
|
+
import { Button, Icon } from "@raydenui/ui";
|
|
114
|
+
import { heartIcon } from "@raydenui/ui/icons";
|
|
115
|
+
|
|
116
|
+
export function FavoriteButton() {
|
|
117
|
+
return <Button icon={heartIcon} iconPosition="leading">Favorite</Button>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function FavoriteIcon() {
|
|
121
|
+
return <Icon icon={heartIcon} variant="solid" size={24} />;
|
|
122
|
+
}
|
|
123
|
+
```
|
|
64
124
|
|
|
65
|
-
|
|
125
|
+
`<Icon name="heart" />` supports dynamic name lookup and loads the icon registry after mounting. Pass either `name` or `icon`. Both `outline` and `solid` variants are available. The `iconCatalog` export lists exact registry names and static export names without SVG artwork.
|
|
126
|
+
|
|
127
|
+
Icons are decorative by default. Label icon-only controls on the control itself; a meaningful standalone icon needs `aria-hidden={false}`, `role="img"`, and an `aria-label`.
|
|
128
|
+
|
|
129
|
+
## Theme and motion
|
|
130
|
+
|
|
131
|
+
`ThemeProvider` supports `light`, `dark`, and `system`. Use `useTheme()` to read or change the selected theme.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import { MotionProvider, Pressable } from "@raydenui/ui/motion";
|
|
135
|
+
|
|
136
|
+
export function MotionExample() {
|
|
66
137
|
return (
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
<Badge color="success">Active</Badge>
|
|
71
|
-
</div>
|
|
138
|
+
<MotionProvider preset="snappy">
|
|
139
|
+
<Pressable>Continue</Pressable>
|
|
140
|
+
</MotionProvider>
|
|
72
141
|
);
|
|
73
142
|
}
|
|
74
143
|
```
|
|
75
144
|
|
|
76
|
-
|
|
145
|
+
Motion presets are `calm`, `snappy`, `playful`, and `reduced`. `Reveal`, `Collapse`, and `SharedLayout` provide additional primitives. Tabs and Modal require an explicit `motion` prop to animate. System reduced-motion preferences take precedence.
|
|
77
146
|
|
|
78
|
-
|
|
147
|
+
## AI and MCP
|
|
79
148
|
|
|
80
|
-
|
|
149
|
+
[`@raydenui/ai`](https://www.npmjs.com/package/@raydenui/ai) supplies component contracts, token references, icon discovery, usage validation, and the Rayden MCP server. The MCP server ships in that package; it does not require a separate MCP package.
|
|
81
150
|
|
|
82
|
-
|
|
151
|
+
For an MCP client that launches stdio servers, use command `npx` with arguments `-y` and `@raydenui/ai@latest`. To inspect the server from a terminal:
|
|
83
152
|
|
|
84
|
-
|
|
153
|
+
```bash
|
|
154
|
+
npx -y @raydenui/ai@latest --help
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
See the [AI package README](https://github.com/playbookTV/Rayden/tree/main/packages/rayden-ai#readme) for configuration and programmatic usage. The AI catalog identifies its reference UI version and supported components; it does not inspect your installed project automatically.
|
|
85
158
|
|
|
86
|
-
|
|
159
|
+
## Development
|
|
87
160
|
|
|
88
|
-
|
|
161
|
+
From a checkout with Node.js and pnpm installed:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pnpm install
|
|
165
|
+
pnpm storybook
|
|
166
|
+
```
|
|
89
167
|
|
|
90
|
-
|
|
91
|
-
- [Storybook](https://main--69b6d5d8527b4eddb882e0a7.chromatic.com) — Interactive component explorer
|
|
92
|
-
- [create-rayden-app](https://www.npmjs.com/package/create-rayden-app) — CLI scaffolding with 6 templates
|
|
93
|
-
- [@raydenui/ai](https://www.npmjs.com/package/@raydenui/ai) — MCP server for AI-assisted development
|
|
168
|
+
Use `pnpm typecheck`, `pnpm exec vitest run`, and `pnpm build` to check the UI. `pnpm check:pilots` validates the matching AI/MCP package and generated guidance after the UI build. Browser tests require a Playwright Chromium installation. See [CONTRIBUTING.md](https://github.com/playbookTV/Rayden/blob/main/CONTRIBUTING.md) for contributor setup.
|
|
94
169
|
|
|
95
170
|
## Contributors
|
|
96
171
|
|
|
@@ -105,4 +180,4 @@ function App() {
|
|
|
105
180
|
|
|
106
181
|
## License
|
|
107
182
|
|
|
108
|
-
MIT
|
|
183
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const illustrationNames: readonly ["calendar", "chat", "contacts", "dashboard", "favorites", "file-manager", "forms", "gallery", "inbox", "invoice", "notifications", "product-catalog", "project-list", "search", "shopping-cart", "subscriptions", "survey", "task-templates", "team"];
|
|
5
|
+
type IllustrationName = (typeof illustrationNames)[number];
|
|
6
|
+
|
|
7
|
+
type TableProps = HTMLAttributes<HTMLTableElement>;
|
|
8
|
+
declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
|
|
9
|
+
type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
10
|
+
declare const TableHeader: react.ForwardRefExoticComponent<TableHeaderProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
11
|
+
type TableBodyProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
12
|
+
declare const TableBody: react.ForwardRefExoticComponent<TableBodyProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
14
|
+
/** Whether this row is selected */
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
|
|
18
|
+
type SortDirection = "asc" | "desc" | null;
|
|
19
|
+
interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
20
|
+
/** Enable sort indicator and click-to-sort behavior */
|
|
21
|
+
sortable?: boolean;
|
|
22
|
+
/** Current sort direction for this column */
|
|
23
|
+
sortDirection?: SortDirection;
|
|
24
|
+
/** Called when the sort indicator is clicked */
|
|
25
|
+
onSort?: () => void;
|
|
26
|
+
}
|
|
27
|
+
declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
28
|
+
type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
|
|
29
|
+
declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
30
|
+
|
|
31
|
+
export { type IllustrationName as I, type SortDirection as S, Table as T, TableBody as a, type TableBodyProps as b, TableCell as c, type TableCellProps as d, TableHead as e, type TableHeadProps as f, TableHeader as g, type TableHeaderProps as h, type TableProps as i, TableRow as j, type TableRowProps as k, illustrationNames as l };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const illustrationNames: readonly ["calendar", "chat", "contacts", "dashboard", "favorites", "file-manager", "forms", "gallery", "inbox", "invoice", "notifications", "product-catalog", "project-list", "search", "shopping-cart", "subscriptions", "survey", "task-templates", "team"];
|
|
5
|
+
type IllustrationName = (typeof illustrationNames)[number];
|
|
6
|
+
|
|
7
|
+
type TableProps = HTMLAttributes<HTMLTableElement>;
|
|
8
|
+
declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
|
|
9
|
+
type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
10
|
+
declare const TableHeader: react.ForwardRefExoticComponent<TableHeaderProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
11
|
+
type TableBodyProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
12
|
+
declare const TableBody: react.ForwardRefExoticComponent<TableBodyProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
14
|
+
/** Whether this row is selected */
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
|
|
18
|
+
type SortDirection = "asc" | "desc" | null;
|
|
19
|
+
interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
20
|
+
/** Enable sort indicator and click-to-sort behavior */
|
|
21
|
+
sortable?: boolean;
|
|
22
|
+
/** Current sort direction for this column */
|
|
23
|
+
sortDirection?: SortDirection;
|
|
24
|
+
/** Called when the sort indicator is clicked */
|
|
25
|
+
onSort?: () => void;
|
|
26
|
+
}
|
|
27
|
+
declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
28
|
+
type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
|
|
29
|
+
declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
30
|
+
|
|
31
|
+
export { type IllustrationName as I, type SortDirection as S, Table as T, TableBody as a, type TableBodyProps as b, TableCell as c, type TableCellProps as d, TableHead as e, type TableHeadProps as f, TableHeader as g, type TableHeaderProps as h, type TableProps as i, TableRow as j, type TableRowProps as k, illustrationNames as l };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationShellBlock = ApplicationShellBlock;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../utils/cn.cjs");
|
|
7
|
+
const Icon_1 = require("../components/Icon/index.cjs");
|
|
8
|
+
const Spinner_1 = require("../components/Spinner/index.cjs");
|
|
9
|
+
const TIER = {
|
|
10
|
+
sm: {
|
|
11
|
+
expandedFlex: "hidden @min-[720px]:flex",
|
|
12
|
+
collapsed: "@min-[720px]:hidden",
|
|
13
|
+
row: "@min-[720px]:flex-row",
|
|
14
|
+
sidebarWidth: "@min-[720px]:w-[248px]",
|
|
15
|
+
pad: "@min-[720px]:px-6",
|
|
16
|
+
},
|
|
17
|
+
md: {
|
|
18
|
+
expandedFlex: "hidden @min-[900px]:flex",
|
|
19
|
+
collapsed: "@min-[900px]:hidden",
|
|
20
|
+
row: "@min-[900px]:flex-row",
|
|
21
|
+
sidebarWidth: "@min-[900px]:w-[264px]",
|
|
22
|
+
pad: "@min-[900px]:px-6",
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
expandedFlex: "hidden @min-[1080px]:flex",
|
|
26
|
+
collapsed: "@min-[1080px]:hidden",
|
|
27
|
+
row: "@min-[1080px]:flex-row",
|
|
28
|
+
sidebarWidth: "@min-[1080px]:w-[280px]",
|
|
29
|
+
pad: "@min-[1080px]:px-6",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
/* ─── Shared recipes ─────────────────────────────────────────────────── */
|
|
33
|
+
const FOCUS_RING = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary-text";
|
|
34
|
+
const NAV_ITEM_BASE = (0, cn_1.cn)("group flex min-h-11 w-full min-w-0 items-start gap-3 rounded-lg px-3 py-2 text-left text-body-sm font-medium transition-colors", FOCUS_RING);
|
|
35
|
+
/* ─── Navigation item ────────────────────────────────────────────────── */
|
|
36
|
+
function NavBadge({ badge, badgeDescription, }) {
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: "ml-auto inline-flex shrink-0 items-center rounded-full bg-grey-100 px-2 py-0.5 text-body-xs font-semibold text-grey-700", children: [(0, jsx_runtime_1.jsx)("span", { "aria-hidden": badgeDescription ? true : undefined, children: badge }), badgeDescription && (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: badgeDescription })] }));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One element for both arrangements. The collapsed panel used to rebuild
|
|
41
|
+
* destinations as buttons, which dropped the href and sent them nowhere
|
|
42
|
+
* (audit B01); rendering an anchor whenever there is an href makes that
|
|
43
|
+
* impossible to reintroduce.
|
|
44
|
+
*/
|
|
45
|
+
function ShellNavItem({ item, showDescription, onNavigate, reasonIdPrefix, }) {
|
|
46
|
+
const unavailable = "unavailableReason" in item ? item.unavailableReason : undefined;
|
|
47
|
+
const reasonId = `${reasonIdPrefix}-${item.id}-reason`;
|
|
48
|
+
const body = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [item.icon && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: item.icon, size: "md", className: (0, cn_1.cn)("mt-0.5 shrink-0", item.current ? "text-action-primary-text" : "text-grey-500") })), (0, jsx_runtime_1.jsxs)("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "break-words", children: item.label }), showDescription && item.description && ((0, jsx_runtime_1.jsx)("span", { className: "text-body-xs font-normal break-words text-grey-500", children: item.description }))] }), item.badge && (0, jsx_runtime_1.jsx)(NavBadge, { badge: item.badge, badgeDescription: item.badgeDescription })] }));
|
|
49
|
+
if (unavailable) {
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", disabled: true, "aria-describedby": reasonId, className: (0, cn_1.cn)(NAV_ITEM_BASE, "cursor-not-allowed text-grey-500"), children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "lock", size: "md", className: "mt-0.5 shrink-0 text-grey-500", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: (0, jsx_runtime_1.jsx)("span", { className: "break-words", children: item.label }) })] }), (0, jsx_runtime_1.jsx)("p", { id: reasonId, className: "px-3 pb-1 text-body-xs break-words text-grey-500", children: unavailable })] }));
|
|
51
|
+
}
|
|
52
|
+
const tone = item.current
|
|
53
|
+
? "bg-primary-50 text-grey-900"
|
|
54
|
+
: "text-grey-700 hover:bg-surface-muted hover:text-grey-900";
|
|
55
|
+
if (item.href) {
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", { href: item.href, "aria-current": item.current ? "page" : undefined, onClick: () => {
|
|
57
|
+
item.onClick?.();
|
|
58
|
+
onNavigate?.();
|
|
59
|
+
}, ...(item.external ? { target: "_blank", rel: "noreferrer" } : {}), className: (0, cn_1.cn)(NAV_ITEM_BASE, tone), children: body }) }));
|
|
60
|
+
}
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", "aria-current": item.current ? "page" : undefined, onClick: () => {
|
|
62
|
+
item.onClick?.();
|
|
63
|
+
onNavigate?.();
|
|
64
|
+
}, className: (0, cn_1.cn)(NAV_ITEM_BASE, "cursor-pointer", tone), children: body }) }));
|
|
65
|
+
}
|
|
66
|
+
/* ─── Component ──────────────────────────────────────────────────────── */
|
|
67
|
+
function ApplicationShellBlock({ brand, brandHref, onBrandClick, navSections = [], navLabel = "Main", sectionHeadingLevel = "h2", navStatus = "idle", navErrorMessage = "Navigation could not be loaded.", onRetryNav, navLoadingMessage = "Loading navigation", navEmptyMessage, search, switcher, actions = [], actionsLabel = "Account and tools", sidebarFooter, openMenuLabel = "Open navigation", closeMenuLabel = "Close navigation", skipLinkLabel = "Skip to main content", skipNavLabel = "Skip links", expandAt = "md", mainScroll = "page", stickyTopBar = true, mainLabel = "Workspace", children, className, }) {
|
|
68
|
+
const uid = (0, react_1.useId)();
|
|
69
|
+
const mainId = `${uid}-main`;
|
|
70
|
+
const panelId = `${uid}-nav-panel`;
|
|
71
|
+
const [menuOpen, setMenuOpen] = (0, react_1.useState)(false);
|
|
72
|
+
const toggleRef = (0, react_1.useRef)(null);
|
|
73
|
+
const tier = TIER[expandAt];
|
|
74
|
+
const SectionHeading = sectionHeadingLevel;
|
|
75
|
+
const itemCount = navSections.reduce((total, section) => total + section.items.length, 0);
|
|
76
|
+
/**
|
|
77
|
+
* A shell with nothing to navigate to renders no rail and no toggle, rather
|
|
78
|
+
* than an empty rail and a control that opens nothing. Supplying
|
|
79
|
+
* `navEmptyMessage` is how a consumer asks for the empty rail instead.
|
|
80
|
+
*/
|
|
81
|
+
const hasNav = navStatus !== "idle" || itemCount > 0 || Boolean(navEmptyMessage);
|
|
82
|
+
const regionScroll = mainScroll === "region";
|
|
83
|
+
function closeMenu() {
|
|
84
|
+
setMenuOpen(false);
|
|
85
|
+
}
|
|
86
|
+
function handleKeyDown(event) {
|
|
87
|
+
if (event.defaultPrevented || event.key !== "Escape" || !menuOpen)
|
|
88
|
+
return;
|
|
89
|
+
setMenuOpen(false);
|
|
90
|
+
toggleRef.current?.focus();
|
|
91
|
+
}
|
|
92
|
+
/* ── Navigation body, rendered in the sidebar and in the collapsed panel ── */
|
|
93
|
+
function renderNav(placement) {
|
|
94
|
+
if (navStatus === "loading") {
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)("div", { role: "status", className: "flex items-center gap-2 px-3 py-4 text-body-sm text-grey-500", children: [(0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { size: "sm" }), (0, jsx_runtime_1.jsx)("span", { children: navLoadingMessage })] }));
|
|
96
|
+
}
|
|
97
|
+
if (navStatus === "error") {
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)("div", { role: "alert", className: "mx-1 rounded-lg border border-error-200 bg-error-50 px-3 py-3 text-body-sm text-error-700", children: [(0, jsx_runtime_1.jsx)("p", { className: "break-words", children: navErrorMessage }), onRetryNav && ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: onRetryNav, className: (0, cn_1.cn)("mt-2 inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-lg border-[1.5px] border-current px-3 py-1.5 font-semibold", FOCUS_RING), children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "refresh", size: "sm", "aria-hidden": "true" }), "Try again"] }))] }));
|
|
99
|
+
}
|
|
100
|
+
if (itemCount === 0) {
|
|
101
|
+
return navEmptyMessage ? ((0, jsx_runtime_1.jsx)("p", { className: "px-3 py-4 text-body-sm break-words text-grey-500", children: navEmptyMessage })) : null;
|
|
102
|
+
}
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-5", children: navSections.map((section) => {
|
|
104
|
+
const headingId = `${uid}-${placement}-${section.id}`;
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [section.label && ((0, jsx_runtime_1.jsx)(SectionHeading, { id: headingId, className: "px-3 pb-1 text-caption-sm font-semibold break-words text-grey-500 uppercase", children: section.label })), (0, jsx_runtime_1.jsx)("ul", { className: "flex list-none flex-col gap-0.5", ...(section.label ? { "aria-labelledby": headingId } : {}), children: section.items.map((item) => ((0, jsx_runtime_1.jsx)(ShellNavItem, { item: item, showDescription: placement === "panel", onNavigate: placement === "panel" ? closeMenu : undefined, reasonIdPrefix: `${uid}-${placement}` }, item.id))) })] }, section.id));
|
|
106
|
+
}) }));
|
|
107
|
+
}
|
|
108
|
+
/* ── Brand ── */
|
|
109
|
+
function renderBrand(extraClassName) {
|
|
110
|
+
if (!brand)
|
|
111
|
+
return null;
|
|
112
|
+
const content = (0, jsx_runtime_1.jsx)("span", { className: "flex min-w-0 items-center gap-2 break-words", children: brand });
|
|
113
|
+
if (brandHref) {
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: brandHref, onClick: onBrandClick, className: (0, cn_1.cn)("rounded", FOCUS_RING, extraClassName), children: content }));
|
|
115
|
+
}
|
|
116
|
+
if (onBrandClick) {
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onBrandClick, className: (0, cn_1.cn)("cursor-pointer rounded text-left", FOCUS_RING, extraClassName), children: content }));
|
|
118
|
+
}
|
|
119
|
+
return (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("min-w-0", extraClassName), children: content });
|
|
120
|
+
}
|
|
121
|
+
/* ── Top-bar actions ── */
|
|
122
|
+
function renderAction(action) {
|
|
123
|
+
const iconOnly = Boolean(action.icon);
|
|
124
|
+
const inner = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [action.icon ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: action.icon, size: "md", "aria-hidden": "true" })) : ((0, jsx_runtime_1.jsx)("span", { className: "break-words", children: action.label })), iconOnly && (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: action.label }), action.badge && ((0, jsx_runtime_1.jsxs)("span", { className: "absolute top-0.5 right-0.5 inline-flex min-w-4 items-center justify-center rounded-full bg-action-primary px-1 text-[10px] leading-4 font-semibold text-white", children: [(0, jsx_runtime_1.jsx)("span", { "aria-hidden": action.badgeDescription ? true : undefined, children: action.badge }), action.badgeDescription && (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: action.badgeDescription })] }))] }));
|
|
125
|
+
const classes = (0, cn_1.cn)("relative inline-flex min-h-11 min-w-11 items-center justify-center gap-2 rounded-lg px-2 text-body-sm font-medium text-grey-700 transition-colors hover:bg-surface-muted hover:text-grey-900", FOCUS_RING);
|
|
126
|
+
if (action.href) {
|
|
127
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: action.href, onClick: action.onClick, ...(action.external ? { target: "_blank", rel: "noreferrer" } : {}), className: classes, children: inner }, action.id));
|
|
128
|
+
}
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: action.onClick, className: (0, cn_1.cn)(classes, "cursor-pointer"), children: inner }, action.id));
|
|
130
|
+
}
|
|
131
|
+
const sidebarInner = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [brand && (0, jsx_runtime_1.jsx)("div", { className: "px-3 pb-4", children: renderBrand("inline-flex min-h-10 items-center") }), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("flex-1", regionScroll && "min-h-0 overflow-y-auto"), children: renderNav("sidebar") }), sidebarFooter && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 border-t border-surface-border px-3 pt-4", children: sidebarFooter }))] }));
|
|
132
|
+
return ((0, jsx_runtime_1.jsxs)("div", { onKeyDown: handleKeyDown, className: (0, cn_1.cn)(
|
|
133
|
+
// `@container` sits on the outermost element, outside the padded
|
|
134
|
+
// surfaces, so `@min-[…]` padding inside resolves against the shell's
|
|
135
|
+
// real width. `relative` keeps the skip link's positioned box inside
|
|
136
|
+
// the shell instead of widening the document (audit B03).
|
|
137
|
+
"@container relative flex w-full flex-col bg-surface-muted", regionScroll && "h-full max-h-full overflow-hidden", className), children: [(0, jsx_runtime_1.jsx)("nav", { "aria-label": skipNavLabel, children: (0, jsx_runtime_1.jsx)("a", { href: `#${mainId}`, className: (0, cn_1.cn)("sr-only rounded-lg bg-surface px-4 py-2 text-body-sm font-semibold text-action-primary-text shadow-soft-sm", "focus:not-sr-only focus:absolute focus:top-3 focus:left-3 focus:z-40", FOCUS_RING), children: skipLinkLabel }) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex min-h-0 w-full flex-1 flex-col", tier.row), children: [hasNav && (
|
|
138
|
+
// The landmark wraps the brand, the destinations, and the sidebar
|
|
139
|
+
// footer. With the landmark on an inner element the brand and footer
|
|
140
|
+
// were page content outside every landmark, which axe's `region` rule
|
|
141
|
+
// reported and a screen-reader user would meet as stray text.
|
|
142
|
+
(0, jsx_runtime_1.jsx)("nav", { "aria-label": navLabel, className: (0, cn_1.cn)("w-full shrink-0 flex-col border-r border-surface-border bg-surface px-3 py-5", tier.sidebarWidth, regionScroll && "min-h-0", tier.expandedFlex), children: sidebarInner })), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex min-w-0 min-h-0 flex-1 flex-col"), children: [(0, jsx_runtime_1.jsxs)("header", { className: (0, cn_1.cn)("flex w-full flex-wrap items-center gap-2 border-b border-surface-border bg-surface px-4 py-2", tier.pad, stickyTopBar && !regionScroll && "sticky top-0 z-20"), children: [hasNav && ((0, jsx_runtime_1.jsxs)("button", { ref: toggleRef, type: "button", onClick: () => setMenuOpen((open) => !open), "aria-expanded": menuOpen, "aria-controls": panelId, className: (0, cn_1.cn)("inline-flex min-h-11 min-w-11 shrink-0 cursor-pointer items-center justify-center rounded-lg text-grey-700 hover:bg-surface-muted hover:text-grey-900", FOCUS_RING, tier.collapsed), children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: menuOpen ? "multiply" : "list", size: "md", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: menuOpen ? closeMenuLabel : openMenuLabel })] })), brand && !(hasNav && switcher) && ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("min-w-0", hasNav ? tier.collapsed : undefined), children: renderBrand("inline-flex min-h-10 items-center") })), switcher && (
|
|
143
|
+
// A floor, not a fixed width: the switcher is a feature, and a
|
|
144
|
+
// feature squeezed to nothing has been dropped. It wraps onto the
|
|
145
|
+
// next row before it shrinks below this.
|
|
146
|
+
(0, jsx_runtime_1.jsx)("div", { className: "flex min-w-0 flex-1 @min-[640px]:min-w-[168px] @min-[640px]:flex-none", children: switcher })), search && ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(
|
|
147
|
+
// Wraps onto its own row while the shell is narrow rather
|
|
148
|
+
// than being removed. One instance, so its state is stable.
|
|
149
|
+
"order-last w-full min-w-0 basis-full", "@min-[640px]:order-none @min-[640px]:w-auto @min-[640px]:max-w-[420px] @min-[640px]:flex-1 @min-[640px]:basis-auto"), children: search })), actions.length > 0 && ((0, jsx_runtime_1.jsx)("div", { role: "group", "aria-label": actionsLabel, className: "ml-auto flex shrink-0 items-center gap-1", children: actions.map((action) => renderAction(action)) }))] }), hasNav && ((0, jsx_runtime_1.jsxs)("nav", { id: panelId, "aria-label": navLabel, className: (0, cn_1.cn)("border-b border-surface-border bg-surface px-3 py-4", tier.collapsed, !menuOpen && "hidden"), children: [brand && switcher && ((0, jsx_runtime_1.jsx)("div", { className: "px-3 pb-4", children: renderBrand("inline-flex min-h-11 items-center") })), renderNav("panel"), sidebarFooter && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 border-t border-surface-border px-3 pt-4", children: sidebarFooter }))] })), (0, jsx_runtime_1.jsx)("main", { id: mainId,
|
|
150
|
+
/**
|
|
151
|
+
* In `region` mode the workspace is its own scroll container, so it
|
|
152
|
+
* has to be reachable from the keyboard even when the content it
|
|
153
|
+
* holds is not focusable (WCAG 2.1.1). In `page` mode it is only a
|
|
154
|
+
* skip-link target and should not be a tab stop.
|
|
155
|
+
*/
|
|
156
|
+
tabIndex: regionScroll ? 0 : -1, "aria-label": mainLabel, className: (0, cn_1.cn)("min-w-0 flex-1 px-4 py-6", tier.pad, regionScroll && "min-h-0 overflow-y-auto"), children: children })] })] })] }));
|
|
157
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useRef, useState, } from "react";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { Icon } from "../components/Icon/index.js";
|
|
5
|
+
import { Spinner } from "../components/Spinner/index.js";
|
|
6
|
+
const TIER = {
|
|
7
|
+
sm: {
|
|
8
|
+
expandedFlex: "hidden @min-[720px]:flex",
|
|
9
|
+
collapsed: "@min-[720px]:hidden",
|
|
10
|
+
row: "@min-[720px]:flex-row",
|
|
11
|
+
sidebarWidth: "@min-[720px]:w-[248px]",
|
|
12
|
+
pad: "@min-[720px]:px-6",
|
|
13
|
+
},
|
|
14
|
+
md: {
|
|
15
|
+
expandedFlex: "hidden @min-[900px]:flex",
|
|
16
|
+
collapsed: "@min-[900px]:hidden",
|
|
17
|
+
row: "@min-[900px]:flex-row",
|
|
18
|
+
sidebarWidth: "@min-[900px]:w-[264px]",
|
|
19
|
+
pad: "@min-[900px]:px-6",
|
|
20
|
+
},
|
|
21
|
+
lg: {
|
|
22
|
+
expandedFlex: "hidden @min-[1080px]:flex",
|
|
23
|
+
collapsed: "@min-[1080px]:hidden",
|
|
24
|
+
row: "@min-[1080px]:flex-row",
|
|
25
|
+
sidebarWidth: "@min-[1080px]:w-[280px]",
|
|
26
|
+
pad: "@min-[1080px]:px-6",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/* ─── Shared recipes ─────────────────────────────────────────────────── */
|
|
30
|
+
const FOCUS_RING = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary-text";
|
|
31
|
+
const NAV_ITEM_BASE = cn("group flex min-h-11 w-full min-w-0 items-start gap-3 rounded-lg px-3 py-2 text-left text-body-sm font-medium transition-colors", FOCUS_RING);
|
|
32
|
+
/* ─── Navigation item ────────────────────────────────────────────────── */
|
|
33
|
+
function NavBadge({ badge, badgeDescription, }) {
|
|
34
|
+
return (_jsxs("span", { className: "ml-auto inline-flex shrink-0 items-center rounded-full bg-grey-100 px-2 py-0.5 text-body-xs font-semibold text-grey-700", children: [_jsx("span", { "aria-hidden": badgeDescription ? true : undefined, children: badge }), badgeDescription && _jsx("span", { className: "sr-only", children: badgeDescription })] }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One element for both arrangements. The collapsed panel used to rebuild
|
|
38
|
+
* destinations as buttons, which dropped the href and sent them nowhere
|
|
39
|
+
* (audit B01); rendering an anchor whenever there is an href makes that
|
|
40
|
+
* impossible to reintroduce.
|
|
41
|
+
*/
|
|
42
|
+
function ShellNavItem({ item, showDescription, onNavigate, reasonIdPrefix, }) {
|
|
43
|
+
const unavailable = "unavailableReason" in item ? item.unavailableReason : undefined;
|
|
44
|
+
const reasonId = `${reasonIdPrefix}-${item.id}-reason`;
|
|
45
|
+
const body = (_jsxs(_Fragment, { children: [item.icon && (_jsx(Icon, { name: item.icon, size: "md", className: cn("mt-0.5 shrink-0", item.current ? "text-action-primary-text" : "text-grey-500") })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { className: "break-words", children: item.label }), showDescription && item.description && (_jsx("span", { className: "text-body-xs font-normal break-words text-grey-500", children: item.description }))] }), item.badge && _jsx(NavBadge, { badge: item.badge, badgeDescription: item.badgeDescription })] }));
|
|
46
|
+
if (unavailable) {
|
|
47
|
+
return (_jsxs("li", { children: [_jsxs("button", { type: "button", disabled: true, "aria-describedby": reasonId, className: cn(NAV_ITEM_BASE, "cursor-not-allowed text-grey-500"), children: [_jsx(Icon, { name: "lock", size: "md", className: "mt-0.5 shrink-0 text-grey-500", "aria-hidden": "true" }), _jsx("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: _jsx("span", { className: "break-words", children: item.label }) })] }), _jsx("p", { id: reasonId, className: "px-3 pb-1 text-body-xs break-words text-grey-500", children: unavailable })] }));
|
|
48
|
+
}
|
|
49
|
+
const tone = item.current
|
|
50
|
+
? "bg-primary-50 text-grey-900"
|
|
51
|
+
: "text-grey-700 hover:bg-surface-muted hover:text-grey-900";
|
|
52
|
+
if (item.href) {
|
|
53
|
+
return (_jsx("li", { children: _jsx("a", { href: item.href, "aria-current": item.current ? "page" : undefined, onClick: () => {
|
|
54
|
+
item.onClick?.();
|
|
55
|
+
onNavigate?.();
|
|
56
|
+
}, ...(item.external ? { target: "_blank", rel: "noreferrer" } : {}), className: cn(NAV_ITEM_BASE, tone), children: body }) }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx("li", { children: _jsx("button", { type: "button", "aria-current": item.current ? "page" : undefined, onClick: () => {
|
|
59
|
+
item.onClick?.();
|
|
60
|
+
onNavigate?.();
|
|
61
|
+
}, className: cn(NAV_ITEM_BASE, "cursor-pointer", tone), children: body }) }));
|
|
62
|
+
}
|
|
63
|
+
/* ─── Component ──────────────────────────────────────────────────────── */
|
|
64
|
+
export function ApplicationShellBlock({ brand, brandHref, onBrandClick, navSections = [], navLabel = "Main", sectionHeadingLevel = "h2", navStatus = "idle", navErrorMessage = "Navigation could not be loaded.", onRetryNav, navLoadingMessage = "Loading navigation", navEmptyMessage, search, switcher, actions = [], actionsLabel = "Account and tools", sidebarFooter, openMenuLabel = "Open navigation", closeMenuLabel = "Close navigation", skipLinkLabel = "Skip to main content", skipNavLabel = "Skip links", expandAt = "md", mainScroll = "page", stickyTopBar = true, mainLabel = "Workspace", children, className, }) {
|
|
65
|
+
const uid = useId();
|
|
66
|
+
const mainId = `${uid}-main`;
|
|
67
|
+
const panelId = `${uid}-nav-panel`;
|
|
68
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
69
|
+
const toggleRef = useRef(null);
|
|
70
|
+
const tier = TIER[expandAt];
|
|
71
|
+
const SectionHeading = sectionHeadingLevel;
|
|
72
|
+
const itemCount = navSections.reduce((total, section) => total + section.items.length, 0);
|
|
73
|
+
/**
|
|
74
|
+
* A shell with nothing to navigate to renders no rail and no toggle, rather
|
|
75
|
+
* than an empty rail and a control that opens nothing. Supplying
|
|
76
|
+
* `navEmptyMessage` is how a consumer asks for the empty rail instead.
|
|
77
|
+
*/
|
|
78
|
+
const hasNav = navStatus !== "idle" || itemCount > 0 || Boolean(navEmptyMessage);
|
|
79
|
+
const regionScroll = mainScroll === "region";
|
|
80
|
+
function closeMenu() {
|
|
81
|
+
setMenuOpen(false);
|
|
82
|
+
}
|
|
83
|
+
function handleKeyDown(event) {
|
|
84
|
+
if (event.defaultPrevented || event.key !== "Escape" || !menuOpen)
|
|
85
|
+
return;
|
|
86
|
+
setMenuOpen(false);
|
|
87
|
+
toggleRef.current?.focus();
|
|
88
|
+
}
|
|
89
|
+
/* ── Navigation body, rendered in the sidebar and in the collapsed panel ── */
|
|
90
|
+
function renderNav(placement) {
|
|
91
|
+
if (navStatus === "loading") {
|
|
92
|
+
return (_jsxs("div", { role: "status", className: "flex items-center gap-2 px-3 py-4 text-body-sm text-grey-500", children: [_jsx(Spinner, { size: "sm" }), _jsx("span", { children: navLoadingMessage })] }));
|
|
93
|
+
}
|
|
94
|
+
if (navStatus === "error") {
|
|
95
|
+
return (_jsxs("div", { role: "alert", className: "mx-1 rounded-lg border border-error-200 bg-error-50 px-3 py-3 text-body-sm text-error-700", children: [_jsx("p", { className: "break-words", children: navErrorMessage }), onRetryNav && (_jsxs("button", { type: "button", onClick: onRetryNav, className: cn("mt-2 inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-lg border-[1.5px] border-current px-3 py-1.5 font-semibold", FOCUS_RING), children: [_jsx(Icon, { name: "refresh", size: "sm", "aria-hidden": "true" }), "Try again"] }))] }));
|
|
96
|
+
}
|
|
97
|
+
if (itemCount === 0) {
|
|
98
|
+
return navEmptyMessage ? (_jsx("p", { className: "px-3 py-4 text-body-sm break-words text-grey-500", children: navEmptyMessage })) : null;
|
|
99
|
+
}
|
|
100
|
+
return (_jsx("div", { className: "flex flex-col gap-5", children: navSections.map((section) => {
|
|
101
|
+
const headingId = `${uid}-${placement}-${section.id}`;
|
|
102
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [section.label && (_jsx(SectionHeading, { id: headingId, className: "px-3 pb-1 text-caption-sm font-semibold break-words text-grey-500 uppercase", children: section.label })), _jsx("ul", { className: "flex list-none flex-col gap-0.5", ...(section.label ? { "aria-labelledby": headingId } : {}), children: section.items.map((item) => (_jsx(ShellNavItem, { item: item, showDescription: placement === "panel", onNavigate: placement === "panel" ? closeMenu : undefined, reasonIdPrefix: `${uid}-${placement}` }, item.id))) })] }, section.id));
|
|
103
|
+
}) }));
|
|
104
|
+
}
|
|
105
|
+
/* ── Brand ── */
|
|
106
|
+
function renderBrand(extraClassName) {
|
|
107
|
+
if (!brand)
|
|
108
|
+
return null;
|
|
109
|
+
const content = _jsx("span", { className: "flex min-w-0 items-center gap-2 break-words", children: brand });
|
|
110
|
+
if (brandHref) {
|
|
111
|
+
return (_jsx("a", { href: brandHref, onClick: onBrandClick, className: cn("rounded", FOCUS_RING, extraClassName), children: content }));
|
|
112
|
+
}
|
|
113
|
+
if (onBrandClick) {
|
|
114
|
+
return (_jsx("button", { type: "button", onClick: onBrandClick, className: cn("cursor-pointer rounded text-left", FOCUS_RING, extraClassName), children: content }));
|
|
115
|
+
}
|
|
116
|
+
return _jsx("div", { className: cn("min-w-0", extraClassName), children: content });
|
|
117
|
+
}
|
|
118
|
+
/* ── Top-bar actions ── */
|
|
119
|
+
function renderAction(action) {
|
|
120
|
+
const iconOnly = Boolean(action.icon);
|
|
121
|
+
const inner = (_jsxs(_Fragment, { children: [action.icon ? (_jsx(Icon, { name: action.icon, size: "md", "aria-hidden": "true" })) : (_jsx("span", { className: "break-words", children: action.label })), iconOnly && _jsx("span", { className: "sr-only", children: action.label }), action.badge && (_jsxs("span", { className: "absolute top-0.5 right-0.5 inline-flex min-w-4 items-center justify-center rounded-full bg-action-primary px-1 text-[10px] leading-4 font-semibold text-white", children: [_jsx("span", { "aria-hidden": action.badgeDescription ? true : undefined, children: action.badge }), action.badgeDescription && _jsx("span", { className: "sr-only", children: action.badgeDescription })] }))] }));
|
|
122
|
+
const classes = cn("relative inline-flex min-h-11 min-w-11 items-center justify-center gap-2 rounded-lg px-2 text-body-sm font-medium text-grey-700 transition-colors hover:bg-surface-muted hover:text-grey-900", FOCUS_RING);
|
|
123
|
+
if (action.href) {
|
|
124
|
+
return (_jsx("a", { href: action.href, onClick: action.onClick, ...(action.external ? { target: "_blank", rel: "noreferrer" } : {}), className: classes, children: inner }, action.id));
|
|
125
|
+
}
|
|
126
|
+
return (_jsx("button", { type: "button", onClick: action.onClick, className: cn(classes, "cursor-pointer"), children: inner }, action.id));
|
|
127
|
+
}
|
|
128
|
+
const sidebarInner = (_jsxs(_Fragment, { children: [brand && _jsx("div", { className: "px-3 pb-4", children: renderBrand("inline-flex min-h-10 items-center") }), _jsx("div", { className: cn("flex-1", regionScroll && "min-h-0 overflow-y-auto"), children: renderNav("sidebar") }), sidebarFooter && (_jsx("div", { className: "mt-4 border-t border-surface-border px-3 pt-4", children: sidebarFooter }))] }));
|
|
129
|
+
return (_jsxs("div", { onKeyDown: handleKeyDown, className: cn(
|
|
130
|
+
// `@container` sits on the outermost element, outside the padded
|
|
131
|
+
// surfaces, so `@min-[…]` padding inside resolves against the shell's
|
|
132
|
+
// real width. `relative` keeps the skip link's positioned box inside
|
|
133
|
+
// the shell instead of widening the document (audit B03).
|
|
134
|
+
"@container relative flex w-full flex-col bg-surface-muted", regionScroll && "h-full max-h-full overflow-hidden", className), children: [_jsx("nav", { "aria-label": skipNavLabel, children: _jsx("a", { href: `#${mainId}`, className: cn("sr-only rounded-lg bg-surface px-4 py-2 text-body-sm font-semibold text-action-primary-text shadow-soft-sm", "focus:not-sr-only focus:absolute focus:top-3 focus:left-3 focus:z-40", FOCUS_RING), children: skipLinkLabel }) }), _jsxs("div", { className: cn("flex min-h-0 w-full flex-1 flex-col", tier.row), children: [hasNav && (
|
|
135
|
+
// The landmark wraps the brand, the destinations, and the sidebar
|
|
136
|
+
// footer. With the landmark on an inner element the brand and footer
|
|
137
|
+
// were page content outside every landmark, which axe's `region` rule
|
|
138
|
+
// reported and a screen-reader user would meet as stray text.
|
|
139
|
+
_jsx("nav", { "aria-label": navLabel, className: cn("w-full shrink-0 flex-col border-r border-surface-border bg-surface px-3 py-5", tier.sidebarWidth, regionScroll && "min-h-0", tier.expandedFlex), children: sidebarInner })), _jsxs("div", { className: cn("flex min-w-0 min-h-0 flex-1 flex-col"), children: [_jsxs("header", { className: cn("flex w-full flex-wrap items-center gap-2 border-b border-surface-border bg-surface px-4 py-2", tier.pad, stickyTopBar && !regionScroll && "sticky top-0 z-20"), children: [hasNav && (_jsxs("button", { ref: toggleRef, type: "button", onClick: () => setMenuOpen((open) => !open), "aria-expanded": menuOpen, "aria-controls": panelId, className: cn("inline-flex min-h-11 min-w-11 shrink-0 cursor-pointer items-center justify-center rounded-lg text-grey-700 hover:bg-surface-muted hover:text-grey-900", FOCUS_RING, tier.collapsed), children: [_jsx(Icon, { name: menuOpen ? "multiply" : "list", size: "md", "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: menuOpen ? closeMenuLabel : openMenuLabel })] })), brand && !(hasNav && switcher) && (_jsx("div", { className: cn("min-w-0", hasNav ? tier.collapsed : undefined), children: renderBrand("inline-flex min-h-10 items-center") })), switcher && (
|
|
140
|
+
// A floor, not a fixed width: the switcher is a feature, and a
|
|
141
|
+
// feature squeezed to nothing has been dropped. It wraps onto the
|
|
142
|
+
// next row before it shrinks below this.
|
|
143
|
+
_jsx("div", { className: "flex min-w-0 flex-1 @min-[640px]:min-w-[168px] @min-[640px]:flex-none", children: switcher })), search && (_jsx("div", { className: cn(
|
|
144
|
+
// Wraps onto its own row while the shell is narrow rather
|
|
145
|
+
// than being removed. One instance, so its state is stable.
|
|
146
|
+
"order-last w-full min-w-0 basis-full", "@min-[640px]:order-none @min-[640px]:w-auto @min-[640px]:max-w-[420px] @min-[640px]:flex-1 @min-[640px]:basis-auto"), children: search })), actions.length > 0 && (_jsx("div", { role: "group", "aria-label": actionsLabel, className: "ml-auto flex shrink-0 items-center gap-1", children: actions.map((action) => renderAction(action)) }))] }), hasNav && (_jsxs("nav", { id: panelId, "aria-label": navLabel, className: cn("border-b border-surface-border bg-surface px-3 py-4", tier.collapsed, !menuOpen && "hidden"), children: [brand && switcher && (_jsx("div", { className: "px-3 pb-4", children: renderBrand("inline-flex min-h-11 items-center") })), renderNav("panel"), sidebarFooter && (_jsx("div", { className: "mt-4 border-t border-surface-border px-3 pt-4", children: sidebarFooter }))] })), _jsx("main", { id: mainId,
|
|
147
|
+
/**
|
|
148
|
+
* In `region` mode the workspace is its own scroll container, so it
|
|
149
|
+
* has to be reachable from the keyboard even when the content it
|
|
150
|
+
* holds is not focusable (WCAG 2.1.1). In `page` mode it is only a
|
|
151
|
+
* skip-link target and should not be a tab stop.
|
|
152
|
+
*/
|
|
153
|
+
tabIndex: regionScroll ? 0 : -1, "aria-label": mainLabel, className: cn("min-w-0 flex-1 px-4 py-6", tier.pad, regionScroll && "min-h-0 overflow-y-auto"), children: children })] })] })] }));
|
|
154
|
+
}
|