@eodparks/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.js +57 -0
- package/dist/alert-dialog.d.ts +50 -0
- package/dist/alert-dialog.js +149 -0
- package/dist/alert.d.ts +23 -0
- package/dist/alert.js +87 -0
- package/dist/avatar.d.ts +35 -0
- package/dist/avatar.js +118 -0
- package/dist/badge.d.ts +27 -0
- package/dist/badge.js +148 -0
- package/dist/button-C2CCxHu1.d.ts +15 -0
- package/dist/button-DEsRlveL.js +86 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +1 -0
- package/dist/calendar-DhsRPq2D.d.ts +23 -0
- package/dist/calendar-kbn4gZ1a.js +110 -0
- package/dist/calendar.d.ts +2 -0
- package/dist/calendar.js +1 -0
- package/dist/card-tkP52GwZ.js +77 -0
- package/dist/card.d.ts +18 -0
- package/dist/card.js +1 -0
- package/dist/chart.d.ts +52 -0
- package/dist/chart.js +163 -0
- package/dist/checkbox.d.ts +7 -0
- package/dist/checkbox.js +26 -0
- package/dist/cn-B-fHM4Ov.js +12 -0
- package/dist/collapsible.d.ts +10 -0
- package/dist/collapsible.js +23 -0
- package/dist/command.d.ts +38 -0
- package/dist/command.js +124 -0
- package/dist/date-picker.d.ts +46 -0
- package/dist/date-picker.js +159 -0
- package/dist/dialog-JjpMFEDR.js +117 -0
- package/dist/dialog.d.ts +2 -0
- package/dist/dialog.js +3 -0
- package/dist/dropdown-menu-B_VG1VXX.js +116 -0
- package/dist/dropdown-menu-CZ8xcq1d.d.ts +38 -0
- package/dist/dropdown-menu.d.ts +2 -0
- package/dist/dropdown-menu.js +1 -0
- package/dist/empty-state-B11Uq0U_.js +66 -0
- package/dist/empty-state.d.ts +15 -0
- package/dist/empty-state.js +1 -0
- package/dist/error-state.d.ts +48 -0
- package/dist/error-state.js +139 -0
- package/dist/field-Cwhz73-_.d.ts +15 -0
- package/dist/field-D-n7O1n6.js +63 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +1 -0
- package/dist/focus-ring-BpxMbGAn.js +3 -0
- package/dist/form-actions.d.ts +21 -0
- package/dist/form-actions.js +41 -0
- package/dist/forms/formik.d.ts +20 -0
- package/dist/forms/formik.js +50 -0
- package/dist/forms/rhf.d.ts +32 -0
- package/dist/forms/rhf.js +114 -0
- package/dist/icon-button-XAjcFsZ2.js +14 -0
- package/dist/icon-button.d.ts +9 -0
- package/dist/icon-button.js +1 -0
- package/dist/icon.d.ts +15 -0
- package/dist/icon.js +21 -0
- package/dist/index-Ct4mPvuB.d.ts +29 -0
- package/dist/input-BxjcqQS1.js +49 -0
- package/dist/input-group.d.ts +12 -0
- package/dist/input-group.js +26 -0
- package/dist/input.d.ts +15 -0
- package/dist/input.js +1 -0
- package/dist/label-BrOAJU1p.js +31 -0
- package/dist/label-CUAiaBbm.d.ts +13 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +1 -0
- package/dist/native-select.d.ts +8 -0
- package/dist/native-select.js +41 -0
- package/dist/page-header.d.ts +19 -0
- package/dist/page-header.js +51 -0
- package/dist/pagination.d.ts +47 -0
- package/dist/pagination.js +131 -0
- package/dist/password-input.d.ts +14 -0
- package/dist/password-input.js +41 -0
- package/dist/popover.d.ts +19 -0
- package/dist/popover.js +54 -0
- package/dist/popup-CLsuJ-AA.js +6 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +36 -0
- package/dist/radio-group.d.ts +14 -0
- package/dist/radio-group.js +25 -0
- package/dist/scroll-area.d.ts +16 -0
- package/dist/scroll-area.js +52 -0
- package/dist/select-Cq_JDuYO.js +266 -0
- package/dist/select.d.ts +40 -0
- package/dist/select.js +1 -0
- package/dist/separator.d.ts +8 -0
- package/dist/separator.js +38 -0
- package/dist/sheet.d.ts +27 -0
- package/dist/sheet.js +95 -0
- package/dist/skeleton.d.ts +19 -0
- package/dist/skeleton.js +45 -0
- package/dist/spinner.d.ts +13 -0
- package/dist/spinner.js +44 -0
- package/dist/switch.d.ts +7 -0
- package/dist/switch.js +19 -0
- package/dist/table.d.ts +24 -0
- package/dist/table.js +75 -0
- package/dist/tabs.d.ts +24 -0
- package/dist/tabs.js +74 -0
- package/dist/textarea.d.ts +5 -0
- package/dist/textarea.js +15 -0
- package/dist/theme-toggle.d.ts +11 -0
- package/dist/theme-toggle.js +50 -0
- package/dist/toast.d.ts +12 -0
- package/dist/toast.js +105 -0
- package/dist/tooltip-BsVKZDXs.js +47 -0
- package/dist/tooltip.d.ts +18 -0
- package/dist/tooltip.js +1 -0
- package/dist/typography-Dy3PCTrL.js +34 -0
- package/dist/typography.d.ts +11 -0
- package/dist/typography.js +1 -0
- package/dist/visually-hidden-BrCs6ZEy.js +11 -0
- package/dist/visually-hidden.d.ts +3 -0
- package/dist/visually-hidden.js +1 -0
- package/docs/accessibility.md +95 -0
- package/docs/accordion.md +89 -0
- package/docs/alert-dialog.md +157 -0
- package/docs/alert.md +70 -0
- package/docs/avatar.md +57 -0
- package/docs/badge.md +51 -0
- package/docs/button.md +121 -0
- package/docs/calendar.md +116 -0
- package/docs/card.md +74 -0
- package/docs/chart.md +93 -0
- package/docs/checkbox.md +119 -0
- package/docs/collapsible.md +76 -0
- package/docs/command.md +114 -0
- package/docs/date-picker.md +177 -0
- package/docs/dialog.md +110 -0
- package/docs/dropdown-menu.md +126 -0
- package/docs/empty-state.md +65 -0
- package/docs/error-state.md +59 -0
- package/docs/field.md +54 -0
- package/docs/form-actions.md +55 -0
- package/docs/forms/formik.md +42 -0
- package/docs/forms/rhf.md +64 -0
- package/docs/icon-button.md +84 -0
- package/docs/icon.md +77 -0
- package/docs/input-group.md +47 -0
- package/docs/input.md +46 -0
- package/docs/label.md +33 -0
- package/docs/layout.md +102 -0
- package/docs/llms.txt +72 -0
- package/docs/native-select.md +87 -0
- package/docs/page-header.md +61 -0
- package/docs/pagination.md +107 -0
- package/docs/password-input.md +30 -0
- package/docs/popover.md +103 -0
- package/docs/progress.md +53 -0
- package/docs/radio-group.md +119 -0
- package/docs/scroll-area.md +85 -0
- package/docs/select.md +106 -0
- package/docs/separator.md +38 -0
- package/docs/sheet.md +118 -0
- package/docs/skeleton.md +50 -0
- package/docs/spinner.md +46 -0
- package/docs/switch.md +92 -0
- package/docs/table.md +87 -0
- package/docs/tabs.md +96 -0
- package/docs/textarea.md +38 -0
- package/docs/theme-toggle.md +76 -0
- package/docs/toast.md +95 -0
- package/docs/tooltip.md +101 -0
- package/docs/typography.md +96 -0
- package/docs/visually-hidden.md +44 -0
- package/layer.css +22 -0
- package/package.json +275 -3
- package/skills/eod-ui/SKILL.md +37 -0
- package/styles.css +2 -0
- package/README.md +0 -3
package/docs/calendar.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
|
|
3
|
+
A month grid on the page for choosing one date, several dates or a range, with the shadcn name and a UI SDK Calendar underneath.
|
|
4
|
+
|
|
5
|
+
Wraps `@ui-sdk/react/calendar`. For a text field that opens a calendar, use `DatePicker`.
|
|
6
|
+
`e2e/calendar.spec.ts` is the executable form of this page.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Calendar, todayDate } from "@eodparks/ui/calendar";
|
|
12
|
+
|
|
13
|
+
<Calendar defaultValue="2026-10-16" onValueChange={(date) => save(date)} />
|
|
14
|
+
<Calendar mode="range" months={2} value={range} onValueChange={setRange} />
|
|
15
|
+
<Calendar captionLayout="dropdown" min="1920-01-01" max={todayDate()} />
|
|
16
|
+
<Calendar unavailable={[{ weekday: [0, 6] }, "2026-12-25"]} min="2026-10-01" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Values are ISO `YYYY-MM-DD` strings with no time or zone, so no date library is needed.
|
|
20
|
+
`todayDate`, `addDays`, `toISODate` (a `Date` to ISO) and `fromISODate` (ISO to a
|
|
21
|
+
local-midnight `Date`) come from this entry; apps never import `@ui-sdk/*`.
|
|
22
|
+
|
|
23
|
+
## Parts
|
|
24
|
+
|
|
25
|
+
An empty `Calendar` renders the header and one grid per month. Write the parts out only to add
|
|
26
|
+
classes or custom day content.
|
|
27
|
+
|
|
28
|
+
| Part | Is |
|
|
29
|
+
| ------------------------------------------- | -------------------------------------------------------------- |
|
|
30
|
+
| `Calendar` | the root and its default layout |
|
|
31
|
+
| `CalendarHeader` | the row that holds Previous, the heading and Next |
|
|
32
|
+
| `CalendarPrevious`, `CalendarNext` | month buttons named "Previous month" and "Next month" |
|
|
33
|
+
| `CalendarHeading` | the `h2` that names the months shown and announces each change |
|
|
34
|
+
| `CalendarMonthSelect`, `CalendarYearSelect` | native selects named "Month" and "Year" |
|
|
35
|
+
| `CalendarGrid` | one month's `grid`; `offset` picks which month, from 0 |
|
|
36
|
+
| `CalendarWeekdays`, `CalendarWeekday` | the header row and a weekday column header |
|
|
37
|
+
| `CalendarWeeks`, `CalendarDay` | the week rows and a day cell |
|
|
38
|
+
| `createCalendarController` | drives a calendar from outside: set the value, turn, focus |
|
|
39
|
+
|
|
40
|
+
Not provided: shadcn's `selected` and `onSelect` (use `value` and `onValueChange`), `Date`
|
|
41
|
+
objects, `asChild` (use `render`), and a `dir` prop (direction comes from the page).
|
|
42
|
+
|
|
43
|
+
## Props
|
|
44
|
+
|
|
45
|
+
`Calendar` takes every UI SDK Calendar option. The ones apps use most:
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Default | Note |
|
|
48
|
+
| -------------------------------------------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------- |
|
|
49
|
+
| `mode` | `"single" \| "multiple" \| "range"` | `"single"` | |
|
|
50
|
+
| `value`, `defaultValue` | ISO date, ISO date list, `[start, end]` | | `null` when empty |
|
|
51
|
+
| `onValueChange` | `(value, details) => void` | | a range reports once both ends are picked |
|
|
52
|
+
| `month`, `defaultMonth`, `onMonthChange` | `"YYYY-MM"` | value's | the first month shown |
|
|
53
|
+
| `captionLayout` | `"label" \| "dropdown"` | `"label"` | `dropdown` adds month and year selects; the heading stays for readers |
|
|
54
|
+
| `months`, `pageBy` | `number`, `"month" \| "page"` | `1` | grids side by side |
|
|
55
|
+
| `min`, `max`, `unavailable` | ISO dates, matchers | | unavailable days stay focusable and read as unavailable |
|
|
56
|
+
| `minDays`, `maxDays`, `allowUnavailable` | | | range limits, both ends counted |
|
|
57
|
+
| `disabled`, `readOnly`, `deselectable` | `boolean` | `false` | read-only lets people move and turn months without changing the value |
|
|
58
|
+
| `locale`, `weekStartsOn`, `weekdayFormat`, `monthFormat` | | page `lang` | names and week start follow the locale |
|
|
59
|
+
| `today`, `timeZone` | | browser's | which day is today; never converts the value |
|
|
60
|
+
| `fixedWeeks`, `showOutsideDays` | `boolean` | `false`, `true` | |
|
|
61
|
+
|
|
62
|
+
Every part takes `className` (a string or a function of its state) and `render`, and carries a
|
|
63
|
+
`data-slot` (`calendar`, `calendar-day`, ...).
|
|
64
|
+
|
|
65
|
+
## Variants
|
|
66
|
+
|
|
67
|
+
| Variant | How |
|
|
68
|
+
| --------------------- | ----------------------------------------------------------------------------- |
|
|
69
|
+
| single | default |
|
|
70
|
+
| multiple | `mode="multiple"`; each press toggles a date |
|
|
71
|
+
| range | `mode="range"`; a press starts, a second ends, hover previews, Escape cancels |
|
|
72
|
+
| month and year select | `captionLayout="dropdown"` |
|
|
73
|
+
| several months | `months={2}`; a date shown by another grid leaves its cell empty |
|
|
74
|
+
|
|
75
|
+
## States
|
|
76
|
+
|
|
77
|
+
| State | Source | Look |
|
|
78
|
+
| ------------- | ----------------------------------------- | ------------------------------------------------- |
|
|
79
|
+
| today | `data-today`, `aria-current="date"` | primary text, semibold, underlined |
|
|
80
|
+
| selected | `data-selected`, `aria-selected` | `bg-primary text-primary-foreground` |
|
|
81
|
+
| in range | `data-range-middle` | `bg-primary-subtle`, square ends join into a band |
|
|
82
|
+
| range preview | `data-preview` | `bg-accent` |
|
|
83
|
+
| outside month | `data-outside` | `text-muted-foreground` |
|
|
84
|
+
| disabled date | `data-disabled`, `aria-disabled` | muted at half opacity |
|
|
85
|
+
| unavailable | `data-unavailable` (with `data-disabled`) | also struck through, so it differs without colour |
|
|
86
|
+
| hover | `:hover` on an enabled, unselected day | `bg-accent` |
|
|
87
|
+
| focus-visible | `:focus-visible` | the library focus ring |
|
|
88
|
+
|
|
89
|
+
Day cells and month buttons are `--control-h-sm` square, so `data-density="compact"` shrinks them.
|
|
90
|
+
|
|
91
|
+
## Keyboard
|
|
92
|
+
|
|
93
|
+
| Key | Result |
|
|
94
|
+
| --------------------- | ----------------------------------------- |
|
|
95
|
+
| Tab | Previous, Next, then one stop in the grid |
|
|
96
|
+
| ArrowLeft, ArrowRight | one day, following the page direction |
|
|
97
|
+
| ArrowUp, ArrowDown | one week |
|
|
98
|
+
| Home, End | first and last day of the week |
|
|
99
|
+
| PageUp, PageDown | one month; with Shift, one year |
|
|
100
|
+
| Enter, Space | select the focused date |
|
|
101
|
+
| Escape | cancel an unfinished range |
|
|
102
|
+
|
|
103
|
+
The tab stop is the selected date, else today, else the first available date.
|
|
104
|
+
|
|
105
|
+
## Accessibility
|
|
106
|
+
|
|
107
|
+
Target: WCAG 2.2 AA. Each month is a `grid` named by its month, weekday headers are named in
|
|
108
|
+
full, and each day is a `gridcell` named by its full date with `aria-selected`,
|
|
109
|
+
`aria-disabled` and `aria-current="date"`. Multiple and range grids are `aria-multiselectable`.
|
|
110
|
+
UI SDK sets all of this; the library adds no roles. Text meets 4.5:1 and fills 3:1 in both
|
|
111
|
+
themes, checked with axe on the states page. Screen reader checks are manual.
|
|
112
|
+
|
|
113
|
+
## Copy
|
|
114
|
+
|
|
115
|
+
The library ships only UI SDK's English accessible names: "Previous month", "Next month",
|
|
116
|
+
"Month" and "Year". Pass `aria-label` to the parts to translate them.
|
package/docs/card.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
Groups related content on one raised surface, optionally as a single link.
|
|
4
|
+
|
|
5
|
+
`e2e/card.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@eodparks/ui/card";
|
|
11
|
+
|
|
12
|
+
<Card>
|
|
13
|
+
<CardHeader>
|
|
14
|
+
<CardTitle render={<h3 />}>Weekend booking</CardTitle>
|
|
15
|
+
<CardDescription>Saturday to Sunday</CardDescription>
|
|
16
|
+
<CardAction><Button size="icon-sm" variant="ghost" aria-label="More">...</Button></CardAction>
|
|
17
|
+
</CardHeader>
|
|
18
|
+
<CardContent>Two rooms, breakfast included.</CardContent>
|
|
19
|
+
<CardFooter><Button>Confirm</Button></CardFooter>
|
|
20
|
+
</Card>
|
|
21
|
+
|
|
22
|
+
<Card interactive render={<a href="/bookings/42" />}>...</Card>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Parts
|
|
26
|
+
|
|
27
|
+
| Export | Is |
|
|
28
|
+
| ------------------------------ | ---------------------------------------------------------------- |
|
|
29
|
+
| `Card` | the surface; a `div`, or the element you pass to `render` |
|
|
30
|
+
| `CardHeader` | a grid holding title and description, with the action at the end |
|
|
31
|
+
| `CardTitle`, `CardDescription` | the `section-title` and `small` text styles |
|
|
32
|
+
| `CardAction` | a control in the header's end corner |
|
|
33
|
+
| `CardContent`, `CardFooter` | the body, and a wrapping row for the buttons |
|
|
34
|
+
| `cardVariants` | the `cva` function, for a non-card element styled as a card |
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Notes |
|
|
39
|
+
| ------------- | ----------------------------- | ----------- | --------------------------------------------------------------- |
|
|
40
|
+
| `size` | `"default" \| "compact"` | `"default"` | padding 6 and gap 4, or padding 4 and gap 3 |
|
|
41
|
+
| `interactive` | `boolean` | `false` | hover fill and focus ring for a card that is one link or button |
|
|
42
|
+
| `render` | element or function | | `render={<a href />}` makes the whole card the link |
|
|
43
|
+
| `className` | `string \| (state) => string` | | merged last with `cn` |
|
|
44
|
+
|
|
45
|
+
## Style
|
|
46
|
+
|
|
47
|
+
Radius `rounded-surface`, 1px `border`, `bg-card text-card-foreground`, `shadow-xs`, no gradient.
|
|
48
|
+
Every card starts from `cardVariants`, so a card cannot drift from the base.
|
|
49
|
+
|
|
50
|
+
## Spacing
|
|
51
|
+
|
|
52
|
+
Padding is step 6 (`default`) or 4 (`compact`); the gap between header, content and footer is 4
|
|
53
|
+
or 3. A card has no outer margin: the parent places it with `gap`.
|
|
54
|
+
|
|
55
|
+
## Content hierarchy
|
|
56
|
+
|
|
57
|
+
One primary action per card, in the footer, as the filled `Button`. Other actions are `outline`
|
|
58
|
+
or `ghost`. The title is the heaviest text. A `CardAction` is a quiet icon button; never a second
|
|
59
|
+
filled button. An interactive card holds no other link or button, because a link cannot contain
|
|
60
|
+
one.
|
|
61
|
+
|
|
62
|
+
## States
|
|
63
|
+
|
|
64
|
+
| State | Source | Look |
|
|
65
|
+
| ------------- | --------------------- | -------------------------------------- |
|
|
66
|
+
| hover | `:hover`, interactive | `bg-accent text-accent-foreground` |
|
|
67
|
+
| focus-visible | `:focus-visible` | `focusRing` from `internal/focus-ring` |
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
|
|
71
|
+
Target: WCAG 2.2 AA. A card is a `div` with no role; the title is a heading only when you render
|
|
72
|
+
it as one (`render={<h3 />}`). An interactive card is a native `<a>` or `<button>`, so Enter
|
|
73
|
+
follows it and the link name is its text. The card stretches past 24 by 24 CSS pixels, and text
|
|
74
|
+
and the focus ring meet 4.5:1 and 3:1 in both themes.
|
package/docs/chart.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Chart
|
|
2
|
+
|
|
3
|
+
Recharts 3 charts on the chart tokens, with a labelled container, a tooltip, a legend, and loading and empty states.
|
|
4
|
+
|
|
5
|
+
You compose recharts parts (`AreaChart`, `Bar`, `Pie`) inside `ChartContainer`; this entry supplies the container, the tooltip and legend content, the palettes and the motion hook. `recharts` is a peer dependency, so the app and the library share one copy, and an app that installs it also installs `react-is` at its React version.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
|
|
11
|
+
import {
|
|
12
|
+
ChartContainer,
|
|
13
|
+
ChartTooltip,
|
|
14
|
+
ChartTooltipContent,
|
|
15
|
+
chartPalette,
|
|
16
|
+
useChartMotion,
|
|
17
|
+
} from "@eodparks/ui/chart";
|
|
18
|
+
|
|
19
|
+
const config = { sessions: { label: "Sessions", color: chartPalette.categorical[0] } };
|
|
20
|
+
|
|
21
|
+
function Sessions({ data }) {
|
|
22
|
+
const motion = useChartMotion();
|
|
23
|
+
return (
|
|
24
|
+
<ChartContainer
|
|
25
|
+
config={config}
|
|
26
|
+
aria-label="Sessions by month"
|
|
27
|
+
description="Sessions rose from January to June."
|
|
28
|
+
>
|
|
29
|
+
<BarChart data={data}>
|
|
30
|
+
<CartesianGrid vertical={false} />
|
|
31
|
+
<XAxis dataKey="month" />
|
|
32
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
33
|
+
<Bar dataKey="sessions" fill="var(--color-sessions)" {...motion} />
|
|
34
|
+
</BarChart>
|
|
35
|
+
</ChartContainer>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Parts
|
|
41
|
+
|
|
42
|
+
| Export | Role |
|
|
43
|
+
| --------------------- | ----------------------------------------------------------------------------------------- |
|
|
44
|
+
| `ChartContainer` | a labelled `group` that sizes the chart, themes recharts text and exposes `--color-<key>` |
|
|
45
|
+
| `ChartTooltip` | recharts `Tooltip` |
|
|
46
|
+
| `ChartTooltipContent` | tooltip body: label, then each series with a swatch, its name and its value |
|
|
47
|
+
| `ChartLegend` | recharts `Legend` |
|
|
48
|
+
| `ChartLegendContent` | legend body: a list of swatch and label |
|
|
49
|
+
| `chartPalette` | `categorical` (8 tokens) and `sequential` (5 tokens) colours |
|
|
50
|
+
| `useChartMotion` | `{ isAnimationActive }`, false under reduced motion; spread onto each series |
|
|
51
|
+
|
|
52
|
+
## Props
|
|
53
|
+
|
|
54
|
+
`ChartContainer`
|
|
55
|
+
|
|
56
|
+
| Prop | Type | Default | Note |
|
|
57
|
+
| ---------------------------- | ------------------------------------ | -------------------- | ------------------------------------------------------------------- |
|
|
58
|
+
| `config` | `Record<string, { label?, color? }>` | required | names and colours per series or slice; `color` sets `--color-<key>` |
|
|
59
|
+
| `aria-label` | `string` | required | names the chart |
|
|
60
|
+
| `description` | `string` | none | read after the name |
|
|
61
|
+
| `loading`, `empty` | `boolean` | `false` | replace the chart with a placeholder in the same box |
|
|
62
|
+
| `loadingLabel`, `emptyLabel` | `string` | "Loading", "No data" | pass the message for the period when you know it |
|
|
63
|
+
| `className` | | `aspect-video` | give a height and `aspect-auto` for a fixed box |
|
|
64
|
+
|
|
65
|
+
`ChartTooltipContent`: `hideLabel`, `indicator` (`dot`, `line` or `dashed`), `nameKey` (the data field that names a pie slice), `labelFormatter`, `valueFormatter`.
|
|
66
|
+
`ChartLegendContent`: `nameKey`.
|
|
67
|
+
|
|
68
|
+
## Variants
|
|
69
|
+
|
|
70
|
+
| Variant | How |
|
|
71
|
+
| ------------------- | ------------------------------------------------------------------------------------------------ |
|
|
72
|
+
| area, bar, line | `AreaChart`, `BarChart`, `LineChart` with `CartesianGrid`, two labelled axes, tooltip and legend |
|
|
73
|
+
| pie and donut | `PieChart` with `Pie`; `innerRadius` makes a donut; `stroke="var(--card)"` separates slices |
|
|
74
|
+
| sparkline | a small `LineChart` with no axes in a box such as `h-8 w-32 aspect-auto` |
|
|
75
|
+
| categorical palette | `chartPalette.categorical`, up to eight series, each with 3:1 against the card |
|
|
76
|
+
| sequential palette | `chartPalette.sequential`, one ramp for ordered values |
|
|
77
|
+
|
|
78
|
+
## States
|
|
79
|
+
|
|
80
|
+
| State | Source |
|
|
81
|
+
| ------- | ------------------------------------------------------------------------------- |
|
|
82
|
+
| loading | `loading`: `aria-busy`, a pulsing block with a status that reads `loadingLabel` |
|
|
83
|
+
| empty | `empty`: a dashed box reading `emptyLabel` |
|
|
84
|
+
|
|
85
|
+
Both keep the box's height, so the page does not jump.
|
|
86
|
+
|
|
87
|
+
## Sparkline
|
|
88
|
+
|
|
89
|
+
A sparkline is a trend with no axes, so give it `description` with the trend in words (up, down, flat) and never rely on it alone for a figure; show the number beside it. Pass `accessibilityLayer={false}` to its chart: it has no tooltip, so recharts' keyboard layer would only add a tab stop that does nothing.
|
|
90
|
+
|
|
91
|
+
## Accessibility
|
|
92
|
+
|
|
93
|
+
The container is a `group` with a name and an optional description. Recharts' own keyboard layer makes the svg a tab stop: arrow keys move between data points and open the tooltip, and the box shows the library focus ring. Escape hides the tooltip until the next key press, pointer move or focus change. A pie or donut takes two tab stops, the svg and then its slices, which is recharts' own layer. The svg is unnamed to assistive technology; the labelled `group` around it carries the name. Series differ by more than hue: lines use dash patterns, pie slices are separated by a card-coloured stroke, and the legend names each series. Categorical colours have 3:1 against the card in both themes. The sequential ramp mixes `--chart-cat-1` with the foreground, so it runs darker in light mode and lighter in dark mode; neighbouring steps are close, so label them or use the tooltip. CRM's `--chart-1` to `--chart-5` mix hues in dark mode, so they are not used as a ramp. For anything critical, show the figures in a Table as well. Pass `useChartMotion()` to each series so nothing animates under reduced motion.
|
package/docs/checkbox.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
A box that turns one option on or off, alone or in a group with a select-all parent.
|
|
4
|
+
|
|
5
|
+
`e2e/checkbox.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Checkbox, CheckboxGroup } from "@eodparks/ui/checkbox";
|
|
11
|
+
|
|
12
|
+
<label className="flex items-center gap-2">
|
|
13
|
+
<Checkbox name="terms" value="yes" required />
|
|
14
|
+
Accept terms
|
|
15
|
+
</label>
|
|
16
|
+
|
|
17
|
+
<Checkbox id="remember" checked={remember} onCheckedChange={setRemember} />
|
|
18
|
+
<Label htmlFor="remember">Remember me</Label>
|
|
19
|
+
|
|
20
|
+
<CheckboxGroup aria-label="Channels" name="channels" defaultValue={["email"]}>
|
|
21
|
+
<label><Checkbox parent /> Select all</label>
|
|
22
|
+
<label><Checkbox value="email" /> Email</label>
|
|
23
|
+
<label><Checkbox value="sms" /> SMS</label>
|
|
24
|
+
</CheckboxGroup>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Parts
|
|
28
|
+
|
|
29
|
+
| Export | Is |
|
|
30
|
+
| --------------- | ------------------------------------------------------------------------ |
|
|
31
|
+
| `Checkbox` | wraps `Checkbox` and `CheckboxIndicator` from `@ui-sdk/react/checkbox` |
|
|
32
|
+
| `CheckboxGroup` | wraps `CheckboxGroup`: one list of checked values, a column with `gap-3` |
|
|
33
|
+
| `*Props` | the prop types |
|
|
34
|
+
|
|
35
|
+
`Checkbox` renders a `<button role="checkbox">` and a hidden native checkbox for the form. The
|
|
36
|
+
indicator is built in: a check, or a minus while indeterminate.
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
### Checkbox
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Notes |
|
|
43
|
+
| ----------------- | ----------------------------- | ------- | ----------------------------------------------------------- |
|
|
44
|
+
| `checked` | `boolean \| "indeterminate"` | | controlled |
|
|
45
|
+
| `defaultChecked` | `boolean \| "indeterminate"` | `false` | uncontrolled; a form reset returns to it |
|
|
46
|
+
| `onCheckedChange` | `(checked, details) => void` | | the shadcn signature, plus UI SDK's `details.reason` |
|
|
47
|
+
| `name`, `value` | `string` | | a checked box submits `name=value`; `value` defaults `"on"` |
|
|
48
|
+
| `required` | `boolean` | `false` | blocks submit while unchecked |
|
|
49
|
+
| `disabled` | `boolean` | `false` | not focusable, not submitted |
|
|
50
|
+
| `readOnly` | `boolean` | `false` | focusable and submitted, presses do nothing |
|
|
51
|
+
| `parent` | `boolean` | `false` | inside a group: checks or clears every enabled child |
|
|
52
|
+
| `aria-invalid` | `boolean` | | destructive border; a surrounding `Field` sets it for you |
|
|
53
|
+
| `className` | `string \| (state) => string` | | merged with `withBase` |
|
|
54
|
+
|
|
55
|
+
### CheckboxGroup
|
|
56
|
+
|
|
57
|
+
| Prop | Type | Notes |
|
|
58
|
+
| ------------------------------- | -------------------------- | -------------------------------------------------------- |
|
|
59
|
+
| `value`, `defaultValue` | `string[]` | checked values, in the order the boxes appear |
|
|
60
|
+
| `onValueChange` | `(value, details) => void` | |
|
|
61
|
+
| `allValues` | `string[]` | every value the parent checks, so it renders right first |
|
|
62
|
+
| `name`, `required`, `disabled` | | apply to every box in the group |
|
|
63
|
+
| `aria-label`, `aria-labelledby` | `string` | the group needs a name |
|
|
64
|
+
|
|
65
|
+
## Default selection
|
|
66
|
+
|
|
67
|
+
A box starts unchecked. Start it checked only for an option most people keep, never for consent
|
|
68
|
+
or a paid extra. A required box (terms) always starts unchecked.
|
|
69
|
+
|
|
70
|
+
## Variants
|
|
71
|
+
|
|
72
|
+
| Variant | How |
|
|
73
|
+
| ---------------- | -------------------------------------------------------------------- |
|
|
74
|
+
| default | a `<label>` around the box and its text, or `<label htmlFor>` beside |
|
|
75
|
+
| with description | inside a UI SDK `Field`, with `FieldLabel` and `FieldDescription` |
|
|
76
|
+
| group | `CheckboxGroup`, optionally with a `parent` box |
|
|
77
|
+
|
|
78
|
+
## States
|
|
79
|
+
|
|
80
|
+
| State | Source | Look |
|
|
81
|
+
| ------------- | ----------------------------------- | ------------------------------------------- |
|
|
82
|
+
| unchecked | `data-unchecked` | 1px `border-primary`, `bg-background` |
|
|
83
|
+
| checked | `data-checked` | `bg-primary`, check in `primary-foreground` |
|
|
84
|
+
| indeterminate | `data-indeterminate` | `bg-primary`, minus in `primary-foreground` |
|
|
85
|
+
| hover | `:hover`, not disabled or read-only | `bg-accent`; checked `bg-primary/90` |
|
|
86
|
+
| active | `:active` | `bg-primary/20` |
|
|
87
|
+
| focus-visible | `:focus-visible` | `focusRing` |
|
|
88
|
+
| invalid | `aria-invalid` or `data-invalid` | `border-destructive` |
|
|
89
|
+
| disabled | `data-disabled` | `opacity-50`, `cursor-not-allowed` |
|
|
90
|
+
| read-only | `data-readonly` | no hover, `cursor-default` |
|
|
91
|
+
|
|
92
|
+
The box is 16px with `rounded-item` (decision 6 in the spec: CRM's radius, so it renders round
|
|
93
|
+
until `--radius-item` changes). A centred 24px `after:` square is the pointer target. The check fades
|
|
94
|
+
in over 150ms, and not at all under reduced motion.
|
|
95
|
+
|
|
96
|
+
## Keyboard
|
|
97
|
+
|
|
98
|
+
| Key | Does |
|
|
99
|
+
| ----- | ----------------------------------------- |
|
|
100
|
+
| Tab | moves to the next enabled checkbox |
|
|
101
|
+
| Space | checks or unchecks it; a mixed box checks |
|
|
102
|
+
| Enter | submits its form, never toggles |
|
|
103
|
+
|
|
104
|
+
## Accessibility
|
|
105
|
+
|
|
106
|
+
Target: WCAG 2.2 AA. UI SDK supplies the `checkbox` role and `aria-checked` (`mixed` while
|
|
107
|
+
indeterminate); the icons are `aria-hidden`. Every box needs a name from a label, a `Field`, or
|
|
108
|
+
`aria-label` in a table row. The unchecked border, the checked fill and the check meet 3:1 in
|
|
109
|
+
both themes.
|
|
110
|
+
|
|
111
|
+
## Copy
|
|
112
|
+
|
|
113
|
+
The label says what checking turns on ("Email me receipts"), not a question and not a negative
|
|
114
|
+
("Don't send"). Keep it the same in both states.
|
|
115
|
+
|
|
116
|
+
## Not in scope
|
|
117
|
+
|
|
118
|
+
Checkbox cards and chips (`ChoiceCards`), checkbox menu items (`DropdownMenu`), a tree of
|
|
119
|
+
checkboxes (`Tree`).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Collapsible
|
|
2
|
+
|
|
3
|
+
Shows and hides one panel from a trigger, keeping its content and animating its height.
|
|
4
|
+
|
|
5
|
+
`e2e/collapsible.spec.ts` is the executable form of this page. For a set of panels with one heading each, use Accordion.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@eodparks/ui/collapsible";
|
|
11
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
12
|
+
|
|
13
|
+
<Collapsible>
|
|
14
|
+
<CollapsibleTrigger>
|
|
15
|
+
Order details
|
|
16
|
+
<ChevronDownIcon aria-hidden />
|
|
17
|
+
</CollapsibleTrigger>
|
|
18
|
+
<CollapsibleContent>Three items, shipped on Monday.</CollapsibleContent>
|
|
19
|
+
</Collapsible>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Parts
|
|
23
|
+
|
|
24
|
+
| Export | Is |
|
|
25
|
+
| -------------------- | ------------------------------------------------------------------------- |
|
|
26
|
+
| `Collapsible` | the root; owns open state |
|
|
27
|
+
| `CollapsibleTrigger` | the button; a lucide icon child turns upside down while the panel is open |
|
|
28
|
+
| `CollapsibleContent` | the panel; animates its height; wraps UI SDK's `CollapsiblePanel` |
|
|
29
|
+
|
|
30
|
+
shadcn names, unchanged.
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Default | Notes |
|
|
35
|
+
| --------------------------------------- | ------------------------- | ------- | ----------------------------------------------------------------------- |
|
|
36
|
+
| `open`, `defaultOpen` | `boolean` | `false` | |
|
|
37
|
+
| `onOpenChange` | `(open, details) => void` | | `details.cancel()` stops the change |
|
|
38
|
+
| `disabled` | `boolean` | `false` | the trigger stays focusable and does nothing |
|
|
39
|
+
| `CollapsibleContent` `keepMounted` | `boolean` | `false` | closed content stays in the page, hidden, so a form field still submits |
|
|
40
|
+
| `CollapsibleContent` `hiddenUntilFound` | `boolean` | `false` | closed content stays findable with find in page |
|
|
41
|
+
|
|
42
|
+
Every part takes `className` and `render`, and carries a `data-slot`.
|
|
43
|
+
|
|
44
|
+
## Variants
|
|
45
|
+
|
|
46
|
+
One: default. Put the trigger and content in a `Card` or give them a border when they need a frame.
|
|
47
|
+
|
|
48
|
+
## Expanding logic
|
|
49
|
+
|
|
50
|
+
Each collapsible opens and closes on its own; opening one never changes another. When only one of several may be open, use Accordion with `type="single"`.
|
|
51
|
+
|
|
52
|
+
## States
|
|
53
|
+
|
|
54
|
+
| State | Source |
|
|
55
|
+
| -------- | --------------------------------------------------------------- |
|
|
56
|
+
| closed | `data-closed`, `aria-expanded="false"`, content out of the page |
|
|
57
|
+
| open | `data-open`, `aria-expanded="true"`, chevron turned up |
|
|
58
|
+
| hover | the label is underlined; not on a disabled trigger |
|
|
59
|
+
| focus | the library focus ring, on keyboard focus only |
|
|
60
|
+
| disabled | `data-disabled`, `aria-disabled`, half opacity, still focusable |
|
|
61
|
+
|
|
62
|
+
## Keyboard
|
|
63
|
+
|
|
64
|
+
Enter and Space toggle the panel and focus stays on the trigger. Tab moves from the trigger into an open panel. Closing the panel while focus is inside it moves focus back to the trigger.
|
|
65
|
+
|
|
66
|
+
## Accessibility
|
|
67
|
+
|
|
68
|
+
The trigger is a button with `aria-expanded` and `aria-controls`. An icon child must be `aria-hidden`. Target is WCAG 2.2 AA, checked by axe on the states page in both themes. Screen reader checks (VoiceOver with Safari, NVDA with Chrome) are manual.
|
|
69
|
+
|
|
70
|
+
## Motion
|
|
71
|
+
|
|
72
|
+
The panel animates its height in 200 ms and the icon turns with it. Under `prefers-reduced-motion` both are instant.
|
|
73
|
+
|
|
74
|
+
## Copy
|
|
75
|
+
|
|
76
|
+
The library ships no prose. The label and content are children.
|
package/docs/command.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Command
|
|
2
|
+
|
|
3
|
+
Searches a list of commands as you type and runs the one you choose, on its own or as a palette in a dialog, with the shadcn part names and a UI SDK Command underneath.
|
|
4
|
+
|
|
5
|
+
`e2e/command.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { buttonVariants } from "@eodparks/ui/button";
|
|
11
|
+
import {
|
|
12
|
+
CommandDialog,
|
|
13
|
+
CommandEmpty,
|
|
14
|
+
CommandGroup,
|
|
15
|
+
CommandInput,
|
|
16
|
+
CommandItem,
|
|
17
|
+
CommandList,
|
|
18
|
+
CommandShortcut,
|
|
19
|
+
} from "@eodparks/ui/command";
|
|
20
|
+
import { createDialogController, DialogTrigger } from "@eodparks/ui/dialog";
|
|
21
|
+
|
|
22
|
+
const [palette] = useState(() => createDialogController());
|
|
23
|
+
|
|
24
|
+
<DialogTrigger controller={palette} shortcut="mod+k" className={buttonVariants({ variant: "outline" })}>
|
|
25
|
+
Search
|
|
26
|
+
</DialogTrigger>
|
|
27
|
+
<CommandDialog controller={palette} commandProps={{ onAction: (value) => navigate(value) }}>
|
|
28
|
+
<CommandInput aria-label="Search pages" placeholder="Where do you want to go?" />
|
|
29
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
30
|
+
<CommandList>
|
|
31
|
+
<CommandGroup heading="Bookings">
|
|
32
|
+
<CommandItem value="/bookings" keywords={["orders"]}>
|
|
33
|
+
<CalendarIcon aria-hidden />
|
|
34
|
+
Bookings
|
|
35
|
+
</CommandItem>
|
|
36
|
+
<CommandItem value="/settings" shortcut="mod+,">
|
|
37
|
+
<SettingsIcon aria-hidden />
|
|
38
|
+
Settings
|
|
39
|
+
<CommandShortcut />
|
|
40
|
+
</CommandItem>
|
|
41
|
+
</CommandGroup>
|
|
42
|
+
</CommandList>
|
|
43
|
+
</CommandDialog>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Parts
|
|
47
|
+
|
|
48
|
+
| Part | Role | Notes |
|
|
49
|
+
| ------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
50
|
+
| `Command` | root | `onAction(value)` runs the chosen command; the popover surface, rounded |
|
|
51
|
+
| `CommandInput` | the search field, a `combobox` | needs `aria-label`; a 16px search icon sits before it; the row shows an inset ring while the field has focus |
|
|
52
|
+
| `CommandList` | the `listbox`, always shown | at most 288px tall, then scrolls |
|
|
53
|
+
| `CommandEmpty` | the no-match message, a live region | place it outside the list; plain children wait while `status="loading"` |
|
|
54
|
+
| `CommandStatus` | the loading or count message, a live region | place it outside the list; children can be a function of `{ loading, count }` |
|
|
55
|
+
| `CommandGroup` | a `group` | `heading` names it, as in shadcn and cmdk |
|
|
56
|
+
| `CommandItem` | an `option` | `value`, `keywords`, `label`, `disabled`, `shortcut`, `page`; icons are children |
|
|
57
|
+
| `CommandShortcut` | shows the item's `shortcut`, `⌘B` or `Ctrl+B` | hidden from screen readers; the item gets `aria-keyshortcuts` |
|
|
58
|
+
| `CommandSeparator` | a line between groups | hidden from assistive technology, since a listbox holds only options and groups |
|
|
59
|
+
| `CommandPage` | a page of commands | a `CommandItem` with `page` opens it |
|
|
60
|
+
| `CommandDialog` | a `Command` inside the library `Dialog` | titled "Command palette" for screen readers; closes when a command runs; a Close button on phones |
|
|
61
|
+
|
|
62
|
+
`createCommandController` is re-exported for `pop()`, `push()`, `setQuery()` and `run()`.
|
|
63
|
+
|
|
64
|
+
Not provided: cmdk's `CommandItem onSelect(value)` (UI SDK's `onSelect` receives the event; use `onAction(value)` on the root) and `CommandLoading` (use `status="loading"` with `CommandStatus`).
|
|
65
|
+
|
|
66
|
+
## Props
|
|
67
|
+
|
|
68
|
+
`Command`: `onAction(value, { event })`, `query`, `defaultQuery`, `onQueryChange`, `value` and `defaultValue` (the highlighted command), `onValueChange`, `pages`, `defaultPages`, `onPagesChange`, `filter` (`"fuzzy"`, `"contains"`, `"startsWith"`, a function, or `false` for server results), `autoHighlight` (`true`), `loop` (`true`), `status` (`"idle"`, `"loading"`, `"error"`), `onLoadMore`, `controller`, `className`, `render`. All from UI SDK. A Promise returned from `onAction` keeps the command pending.
|
|
69
|
+
|
|
70
|
+
`CommandDialog`: the `Dialog` props (`open`, `defaultOpen`, `onOpenChange`, `controller`), plus `title` (`"Command palette"`), `description`, `closeLabel` (`"Close"`), and `commandProps` for the inner `Command`.
|
|
71
|
+
|
|
72
|
+
Every part carries a `data-slot` (`command`, `command-input`, `command-list`, `command-item`, ...).
|
|
73
|
+
|
|
74
|
+
## Variants
|
|
75
|
+
|
|
76
|
+
| Variant | How |
|
|
77
|
+
| ------------ | ---------------------------------------------------------------------------------------- |
|
|
78
|
+
| groups | `CommandGroup heading` with a `CommandSeparator` between |
|
|
79
|
+
| shortcuts | `shortcut` on the item and `<CommandShortcut />` inside it |
|
|
80
|
+
| nested pages | `CommandPage value`, and `page` on the item that opens it |
|
|
81
|
+
| in dialog | `CommandDialog`, opened by a `DialogTrigger` with the same `controller` and a `shortcut` |
|
|
82
|
+
|
|
83
|
+
## States
|
|
84
|
+
|
|
85
|
+
| State | Source |
|
|
86
|
+
| ----------- | --------------------------------------------------------------------------------------------------------- |
|
|
87
|
+
| highlighted | `data-highlighted` on the item, fill plus an inset ring; the field's `aria-activedescendant` points at it |
|
|
88
|
+
| disabled | `data-disabled` and `aria-disabled`; keys and the pointer skip it |
|
|
89
|
+
| empty | `CommandEmpty` shows its text and announces it |
|
|
90
|
+
| loading | `data-loading` on the root, `aria-busy` on the list, `CommandStatus` shows |
|
|
91
|
+
| pending | `data-pending` on the item while an `onAction` Promise runs |
|
|
92
|
+
|
|
93
|
+
## Keyboard
|
|
94
|
+
|
|
95
|
+
| Key | Result |
|
|
96
|
+
| ------------------ | --------------------------------------------------------------- |
|
|
97
|
+
| typing | filters the commands and highlights the best match |
|
|
98
|
+
| ArrowDown, ArrowUp | moves the highlight, wrapping, skipping disabled commands |
|
|
99
|
+
| Enter | runs the highlighted command, or opens its page |
|
|
100
|
+
| Backspace | in an empty field, goes back a page |
|
|
101
|
+
| Escape | clears the search, then goes back a page, then closes a palette |
|
|
102
|
+
| an item's shortcut | runs it while the list is in the page |
|
|
103
|
+
|
|
104
|
+
Focus stays in the field the whole time.
|
|
105
|
+
|
|
106
|
+
## Accessibility
|
|
107
|
+
|
|
108
|
+
The field is a `combobox` that controls an always shown `listbox` named after the field, with `option` children in named `group`s. A palette is a `dialog` named by its hidden title. UI SDK sets all of this; the library adds no roles.
|
|
109
|
+
|
|
110
|
+
Target is WCAG 2.2 AA, checked by axe on the states page and on the open palette in both themes. Screen reader checks (VoiceOver with Safari, NVDA with Chrome) are manual.
|
|
111
|
+
|
|
112
|
+
## Copy
|
|
113
|
+
|
|
114
|
+
The placeholder says what the field searches ("Search pages", "Where do you want to go?"), and the field still needs `aria-label`. Empty and loading text are children. The library ships only the hidden palette title, "Command palette", as a prop default.
|