@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# NativeSelect
|
|
2
|
+
|
|
3
|
+
The browser's own `<select>`, styled like `SelectTrigger`, for short static lists and Formik fields.
|
|
4
|
+
|
|
5
|
+
`e2e/native-select.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { NativeSelect, NativeSelectOption } from "@eodparks/ui/native-select";
|
|
11
|
+
|
|
12
|
+
<label>
|
|
13
|
+
City
|
|
14
|
+
<NativeSelect name="city" defaultValue="">
|
|
15
|
+
<NativeSelectOption value="">Choose a city</NativeSelectOption>
|
|
16
|
+
<NativeSelectOption value="delhi">Delhi</NativeSelectOption>
|
|
17
|
+
<NativeSelectOption value="mumbai">Mumbai</NativeSelectOption>
|
|
18
|
+
</NativeSelect>
|
|
19
|
+
</label>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `Select` when the list needs search, groups with custom rendering, multiple values, a
|
|
23
|
+
clear control or a loading state. Use `NativeSelect` when a plain list is enough, on touch
|
|
24
|
+
screens where the OS picker helps, and in Formik forms that bind `onChange` and `value` directly.
|
|
25
|
+
|
|
26
|
+
## Parts
|
|
27
|
+
|
|
28
|
+
| Export | Is |
|
|
29
|
+
| ---------------------- | --------------------------------------------------------------------- |
|
|
30
|
+
| `NativeSelect` | a native `<select>` that joins a UI SDK `Field`, with a chevron after |
|
|
31
|
+
| `NativeSelectOption` | a native `<option>` |
|
|
32
|
+
| `NativeSelectOptGroup` | a native `<optgroup>`; `label` names the group |
|
|
33
|
+
| `NativeSelectProps` | the prop type: native select props and `size` |
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Default | Notes |
|
|
38
|
+
| -------------- | -------------------- | ----------- | ----------------------------------------------------------------------- |
|
|
39
|
+
| `size` | `"default" \| "sm"` | `"default"` | heights `--control-h` and `--control-h-sm`, the same as `SelectTrigger` |
|
|
40
|
+
| `value` | `string` | | controlled, with `onChange` |
|
|
41
|
+
| `defaultValue` | `string` | | uncontrolled; a form reset returns to it |
|
|
42
|
+
| `onChange` | `ChangeEventHandler` | | the native event; read `event.target.value` |
|
|
43
|
+
| `aria-invalid` | `boolean` | | destructive border; a surrounding `Field` sets it for you |
|
|
44
|
+
| `className` | `string` | | merged last with `cn` on the `<select>` |
|
|
45
|
+
|
|
46
|
+
Everything else is a native select prop: `name`, `required`, `disabled`, `form`, `autoComplete`.
|
|
47
|
+
The native `size` attribute is replaced by the size variant; `multiple` is not supported.
|
|
48
|
+
|
|
49
|
+
## Variants
|
|
50
|
+
|
|
51
|
+
| Size | Height | Padding |
|
|
52
|
+
| --------- | ---------------- | ------------------------------ |
|
|
53
|
+
| `default` | `--control-h` | `ps-3`, `pe-9` (chevron space) |
|
|
54
|
+
| `sm` | `--control-h-sm` | `ps-2.5`, `pe-8` |
|
|
55
|
+
|
|
56
|
+
The select fills its container, like `SelectTrigger`. A long option truncates before the
|
|
57
|
+
chevron. Heights follow `data-density="compact"`.
|
|
58
|
+
|
|
59
|
+
## States
|
|
60
|
+
|
|
61
|
+
| State | Source | Look |
|
|
62
|
+
| ------------- | ------------------------------- | -------------------------------------------- |
|
|
63
|
+
| placeholder | the `value=""` option is chosen | `text-muted-foreground` |
|
|
64
|
+
| hover | `:hover`, not disabled | `bg-accent` |
|
|
65
|
+
| focus-visible | `:focus-visible` | `focusRing` from `internal/focus-ring` |
|
|
66
|
+
| invalid | `aria-invalid` | `border-destructive` |
|
|
67
|
+
| disabled | `:disabled` | `opacity-50`, `cursor-not-allowed`, no hover |
|
|
68
|
+
|
|
69
|
+
## Field
|
|
70
|
+
|
|
71
|
+
Inside a UI SDK `Field` the select joins it with `useFieldControl`, the same way `FieldControl` would, and keeps its own `data-slot`: the field's label names it,
|
|
72
|
+
its description and error describe it, and an invalid field sets `aria-invalid`.
|
|
73
|
+
|
|
74
|
+
## Keyboard
|
|
75
|
+
|
|
76
|
+
The browser's: Tab focuses, typing jumps to a matching option, arrows move through enabled
|
|
77
|
+
options, and Space or Alt+ArrowDown opens the list. The wrapper adds no key handling.
|
|
78
|
+
|
|
79
|
+
## Accessibility
|
|
80
|
+
|
|
81
|
+
Target: WCAG 2.2 AA. A native `<select>` is a combobox with a list of options to assistive
|
|
82
|
+
technology; the chevron is `aria-hidden` and ignores the pointer. Name it with a `<label>` or a
|
|
83
|
+
`Field`. Text meets 4.5:1 and the border 3:1 in both themes.
|
|
84
|
+
|
|
85
|
+
## Not in scope
|
|
86
|
+
|
|
87
|
+
`multiple` and listbox-style `size` (use `Select`), search, a clear button, async options.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# PageHeader
|
|
2
|
+
|
|
3
|
+
The page's single h1 with a description, a back link or breadcrumb, actions and a tabs slot.
|
|
4
|
+
|
|
5
|
+
Place it inside `main`; a header at the top level of the page becomes a banner landmark. Use one per page. Breadcrumb and tabs are slots, so the header never owns their behaviour.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { PageHeader, PageHeaderBack } from "@eodparks/ui/page-header";
|
|
11
|
+
|
|
12
|
+
<PageHeader
|
|
13
|
+
back={<PageHeaderBack render={<NavLink to="/bookings" />}>Bookings</PageHeaderBack>}
|
|
14
|
+
title="Booking A-101"
|
|
15
|
+
description="Harbour deck, 12 guests"
|
|
16
|
+
actions={
|
|
17
|
+
<>
|
|
18
|
+
<Button variant="outline">Edit</Button>
|
|
19
|
+
<Button variant="destructive">Delete</Button>
|
|
20
|
+
</>
|
|
21
|
+
}
|
|
22
|
+
tabs={<Tabs />}
|
|
23
|
+
/>;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Parts
|
|
27
|
+
|
|
28
|
+
| Part | Element | Notes |
|
|
29
|
+
| ---------------- | -------- | ------------------------------------------------------------ |
|
|
30
|
+
| `PageHeader` | `header` | the layout; `title` renders the `h1` |
|
|
31
|
+
| `PageHeaderBack` | `a` | arrow and the parent's name; `render` swaps in a router link |
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Note |
|
|
36
|
+
| ------------- | ----------- | ------------------------------------------------------------------ |
|
|
37
|
+
| `title` | `ReactNode` | required; the `h1`; long values wrap, never overflow |
|
|
38
|
+
| `description` | `ReactNode` | one muted sentence under the title |
|
|
39
|
+
| `breadcrumb` | `ReactNode` | above the title; a labelled `nav` |
|
|
40
|
+
| `back` | `ReactNode` | above the title; a `PageHeaderBack` |
|
|
41
|
+
| `actions` | `ReactNode` | at the inline end of the title row; wraps below on a narrow screen |
|
|
42
|
+
| `tabs` | `ReactNode` | below the title row |
|
|
43
|
+
|
|
44
|
+
## Variants
|
|
45
|
+
|
|
46
|
+
| Variant | How |
|
|
47
|
+
| ----------- | ------------- |
|
|
48
|
+
| title | `title` alone |
|
|
49
|
+
| description | `description` |
|
|
50
|
+
| back link | `back` |
|
|
51
|
+
| breadcrumb | `breadcrumb` |
|
|
52
|
+
| actions | `actions` |
|
|
53
|
+
| tabs slot | `tabs` |
|
|
54
|
+
|
|
55
|
+
## Accessibility
|
|
56
|
+
|
|
57
|
+
The title is the page's only `h1`. Back link or breadcrumb come first in the DOM and on screen, then the title and description, then the actions, then the tabs, so tab order follows reading order. The back link's arrow is hidden from assistive technology and flips in right to left pages; the link's name is the parent page. Text has 4.5:1 in both themes, and the back link has the library focus ring and a 24px target.
|
|
58
|
+
|
|
59
|
+
## Responsiveness
|
|
60
|
+
|
|
61
|
+
On a wide screen actions sit at the inline end of the title row. On a narrow one they wrap under the title. A long title wraps, including an identifier with no spaces.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
Moves between pages of results with numbered links, steps, a page-size select and a total.
|
|
4
|
+
|
|
5
|
+
`e2e/pagination.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Pagination, PaginationContent } from "@eodparks/ui/pagination";
|
|
11
|
+
|
|
12
|
+
<Pagination aria-label="Bookings" page={page} onPageChange={setPage} pageCount={20}>
|
|
13
|
+
<PaginationContent />
|
|
14
|
+
</Pagination>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
With a page size and a total:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Pagination aria-label="Bookings" page={page} onPageChange={setPage} total={95} pageSize={size}>
|
|
21
|
+
<PaginationSummary />
|
|
22
|
+
<PaginationContent />
|
|
23
|
+
<PaginationPageSize value={size} onValueChange={changeSize} />
|
|
24
|
+
</Pagination>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Previous and next only:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<Pagination aria-label="Bookings" pageCount={10}>
|
|
31
|
+
<PaginationContent>
|
|
32
|
+
<PaginationItem>
|
|
33
|
+
<PaginationPrevious />
|
|
34
|
+
</PaginationItem>
|
|
35
|
+
<PaginationItem>
|
|
36
|
+
<PaginationNext />
|
|
37
|
+
</PaginationItem>
|
|
38
|
+
</PaginationContent>
|
|
39
|
+
</Pagination>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Parts
|
|
43
|
+
|
|
44
|
+
| Export | Is |
|
|
45
|
+
| -------------------------------------- | -------------------------------------------------------------------------------- |
|
|
46
|
+
| `Pagination` | the `navigation` landmark; `aria-label` defaults to "Pagination"; owns the page |
|
|
47
|
+
| `PaginationContent` | the list; with no children it renders Previous, the numbered range and Next |
|
|
48
|
+
| `PaginationItem` | one `li` |
|
|
49
|
+
| `PaginationLink` | one page, a button (a link with `getHref`); the current one is an outline button |
|
|
50
|
+
| `PaginationPrevious`, `PaginationNext` | the steps, with an arrow and a label |
|
|
51
|
+
| `PaginationEllipsis` | a gap in the range, hidden from screen readers |
|
|
52
|
+
| `PaginationSummary` | the range on this page and the total, such as `11-20 of 95` |
|
|
53
|
+
| `PaginationPageSize` | a Select for rows per page |
|
|
54
|
+
|
|
55
|
+
shadcn names, unchanged. `PaginationContent` wraps UI SDK's `PaginationList`.
|
|
56
|
+
|
|
57
|
+
## Props
|
|
58
|
+
|
|
59
|
+
| Prop | Type | Default | Notes |
|
|
60
|
+
| --------------------------------------------------------------- | ------------------------------------------------ | ------------------------------------ | ----------------------------------------------------------------------- |
|
|
61
|
+
| `page`, `defaultPage` | `number` | `1` | pages count from 1 |
|
|
62
|
+
| `onPageChange` | `(page, details) => void` | | `details.cancel()` keeps the page and stops a link from navigating |
|
|
63
|
+
| `pageCount` | `number` | | or pass `total` and `pageSize` |
|
|
64
|
+
| `total`, `pageSize` | `number` | | the summary reads them; the owner resets `page` when `pageSize` changes |
|
|
65
|
+
| `siblings`, `boundaries` | `number` | UI SDK | pages beside the current one, and pages kept at each end |
|
|
66
|
+
| `getHref` | `(page) => string` | | pages and steps become links |
|
|
67
|
+
| `disabled` | `boolean` | `false` | every page and step does nothing |
|
|
68
|
+
| `PaginationContent` `previousLabel`, `nextLabel` | `string` | English | |
|
|
69
|
+
| `PaginationLink` `page`, `label` | `number`, `string` | `Page <n>` | `label` is the accessible name |
|
|
70
|
+
| `PaginationSummary` `format` | `({ from, to, total }) => ReactNode` | `11-20 of 95` | |
|
|
71
|
+
| `PaginationPageSize` `value`, `onValueChange`, `sizes`, `label` | `number`, `(size) => void`, `number[]`, `string` | `[10, 20, 50, 100]`, "Rows per page" | |
|
|
72
|
+
|
|
73
|
+
Every part takes `className` and `render`, and carries a `data-slot`.
|
|
74
|
+
|
|
75
|
+
## Variants
|
|
76
|
+
|
|
77
|
+
| Variant | How |
|
|
78
|
+
| ---------------------- | ---------------------------------------------------- |
|
|
79
|
+
| numbered with ellipsis | `<PaginationContent />` |
|
|
80
|
+
| previous and next only | `PaginationContent` with two items |
|
|
81
|
+
| with page-size select | add `PaginationPageSize` |
|
|
82
|
+
| with total | add `PaginationSummary`, with `total` and `pageSize` |
|
|
83
|
+
|
|
84
|
+
## States
|
|
85
|
+
|
|
86
|
+
| State | Source |
|
|
87
|
+
| -------- | ------------------------------------------------------------------------- |
|
|
88
|
+
| current | `aria-current="page"` and `data-current`; an outline button |
|
|
89
|
+
| hover | the ghost fill; not on a disabled step |
|
|
90
|
+
| focus | the library focus ring, on keyboard focus only |
|
|
91
|
+
| disabled | `aria-disabled` and `data-disabled` on a step at its end, still focusable |
|
|
92
|
+
|
|
93
|
+
## Keyboard
|
|
94
|
+
|
|
95
|
+
Every page and step is in the tab order. Enter and Space press it. Focus stays on the control that was pressed while the range changes around it. A step at its end keeps its focus and does nothing.
|
|
96
|
+
|
|
97
|
+
## Accessibility
|
|
98
|
+
|
|
99
|
+
A `navigation` landmark named by `aria-label`, a list of pages, `aria-current="page"` on the current one. Give each pagination on a page its own `aria-label`. A page link is named `Page <n>`. Arrows and the ellipsis are hidden from screen readers. 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.
|
|
100
|
+
|
|
101
|
+
## Copy
|
|
102
|
+
|
|
103
|
+
The library ships the English defaults "Pagination", "Previous", "Next", "Page <n>" and "Rows per page", each a prop.
|
|
104
|
+
|
|
105
|
+
## Not included
|
|
106
|
+
|
|
107
|
+
First and Last steps, and a jump-to-page field. Both come from UI SDK's `PaginationFirst` and `PaginationLast` when a screen needs them.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# PasswordInput
|
|
2
|
+
|
|
3
|
+
A password field with a toggle that shows or hides what is typed.
|
|
4
|
+
|
|
5
|
+
Wraps `@ui-sdk/react/password-input`. The field is a password input until the toggle shows it, and it hides again when the form submits. `e2e/password-input.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { PasswordInput } from "@eodparks/ui/password-input";
|
|
11
|
+
|
|
12
|
+
<PasswordInput aria-label="Password" name="password" autoComplete="current-password" />
|
|
13
|
+
<PasswordInput name="new" autoComplete="new-password" toggleLabel="Show new password" />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Notes |
|
|
19
|
+
| ---------------------------------------------- | ------------------------------------------------ | -------------------- | ---------------------------------------------------------------- |
|
|
20
|
+
| `size` | `"sm" \| "default" \| "lg"` | `"default"` | the control heights |
|
|
21
|
+
| `toggleLabel` | `string` | `"Show password"` | the toggle's name; it does not change when the password is shown |
|
|
22
|
+
| `autoComplete` | `"current-password" \| "new-password" \| string` | `"current-password"` | tells a password manager sign-in from a new password |
|
|
23
|
+
| `visible`, `defaultVisible`, `onVisibleChange` | | | UI SDK's visibility contract |
|
|
24
|
+
| `value`, `defaultValue`, `onValueChange` | | | UI SDK's value contract |
|
|
25
|
+
|
|
26
|
+
Form options (`name`, `form`, `required`, `disabled`, `readOnly`) go to the root; `id`, `placeholder`, `maxLength`, `ref`, `onBlur` and the `aria-*` attributes go to the input, so a form bridge can inject them.
|
|
27
|
+
|
|
28
|
+
## Accessibility
|
|
29
|
+
|
|
30
|
+
Target: WCAG 2.2 AA. The input is named by its Field label or an `aria-label`. The toggle is a button with a fixed name and `aria-pressed`, at least 24 by 24 pixels, with an `aria-hidden` icon. Tab goes from the input to the toggle; Enter in the input submits the form and never presses the toggle. A pointer press on the toggle keeps the caret in the input. Caps Lock sets `data-capslock` on the parts for an app that wants to warn.
|
package/docs/popover.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
Shows a small panel of related content or controls beside its trigger, with the shadcn part names and a UI SDK Popover underneath.
|
|
4
|
+
|
|
5
|
+
`e2e/popover.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
|
+
Popover,
|
|
13
|
+
PopoverClose,
|
|
14
|
+
PopoverContent,
|
|
15
|
+
PopoverDescription,
|
|
16
|
+
PopoverHeader,
|
|
17
|
+
PopoverTitle,
|
|
18
|
+
PopoverTrigger,
|
|
19
|
+
} from "@eodparks/ui/popover";
|
|
20
|
+
|
|
21
|
+
<Popover>
|
|
22
|
+
<PopoverTrigger className={buttonVariants({ variant: "outline" })}>Dimensions</PopoverTrigger>
|
|
23
|
+
<PopoverContent align="start">
|
|
24
|
+
<PopoverHeader>
|
|
25
|
+
<PopoverTitle>Dimensions</PopoverTitle>
|
|
26
|
+
<PopoverDescription>Set the size of the layer.</PopoverDescription>
|
|
27
|
+
</PopoverHeader>
|
|
28
|
+
{/* fields */}
|
|
29
|
+
<PopoverClose className={buttonVariants({ size: "sm" })}>Save</PopoverClose>
|
|
30
|
+
</PopoverContent>
|
|
31
|
+
</Popover>;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Parts
|
|
35
|
+
|
|
36
|
+
| Part | Role | Notes |
|
|
37
|
+
| -------------------- | -------------------------------------- | ------------------------------------------------------------------------ |
|
|
38
|
+
| `Popover` | root, no DOM of its own | holds the open state |
|
|
39
|
+
| `PopoverTrigger` | the button that opens and closes it | unstyled; give it `buttonVariants` or `render={<Button />}` |
|
|
40
|
+
| `PopoverContent` | the panel, a `dialog` | 288px wide (`w-72`), 16px padding, surface classes from `internal/popup` |
|
|
41
|
+
| `PopoverArrow` | optional arrow pointing at the trigger | first child of the content; follows the side the panel landed on |
|
|
42
|
+
| `PopoverHeader` | stacks the title and description | markup only |
|
|
43
|
+
| `PopoverTitle` | names the panel; an `h2` | the `label` text style, since the panel is a small surface |
|
|
44
|
+
| `PopoverDescription` | describes the panel; a `p` | the `small` text style in the muted colour |
|
|
45
|
+
| `PopoverClose` | a button that closes it | unstyled; any number of them |
|
|
46
|
+
|
|
47
|
+
Not provided: `asChild` (use `render`), `PopoverPortal` (the panel renders in the top layer), and `PopoverAnchor` (pass `anchor` to `PopoverContent`).
|
|
48
|
+
|
|
49
|
+
## Props
|
|
50
|
+
|
|
51
|
+
`Popover`: `open`, `defaultOpen`, `onOpenChange(open, { reason, event, cancel })`, `onOpenChangeComplete`, `modal` (`false`, `"trap-focus"` or `true`; default `false`), `openOnHover` with `delay` and `closeDelay`, `dismissible` with `onDismissAttempt`, `controller`, `presentation`, `container`. All from UI SDK.
|
|
52
|
+
|
|
53
|
+
`PopoverContent`
|
|
54
|
+
|
|
55
|
+
| Prop | Default | Note |
|
|
56
|
+
| ----------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------- |
|
|
57
|
+
| `side` | `"bottom"` | `top`, `right`, `bottom`, `left`, `start`, `end`; flips when there is no room |
|
|
58
|
+
| `align` | `"center"` | `start`, `center`, `end`; start and end follow the reading direction |
|
|
59
|
+
| `sideOffset` | `4` | pixels between the trigger and the panel; use `8` with an arrow |
|
|
60
|
+
| `alignOffset`, `collisionPadding`, `arrowPadding`, `anchor` | | passed through |
|
|
61
|
+
| `initialFocus`, `finalFocus` | `"auto"` | where focus goes on open and on close |
|
|
62
|
+
| `keepMounted` | `false` | keep the closed panel in the page, hidden |
|
|
63
|
+
| `className`, `render` | | `className` merges with the panel classes and can be a function of state |
|
|
64
|
+
|
|
65
|
+
Every part carries a `data-slot` (`popover-trigger`, `popover-content`, `popover-arrow`, `popover-header`, ...).
|
|
66
|
+
|
|
67
|
+
## Variants
|
|
68
|
+
|
|
69
|
+
| Variant | How |
|
|
70
|
+
| --------------- | -------------------------------------------------------------------------- |
|
|
71
|
+
| with title | `PopoverHeader` with `PopoverTitle` and `PopoverDescription` |
|
|
72
|
+
| with arrow | `<PopoverArrow />` as the first child of the content, and `sideOffset={8}` |
|
|
73
|
+
| sides and align | `side` and `align` on `PopoverContent` |
|
|
74
|
+
|
|
75
|
+
## States
|
|
76
|
+
|
|
77
|
+
| State | Source |
|
|
78
|
+
| ------- | -------------------------------------------------------------------------------------- |
|
|
79
|
+
| open | `data-open` on the trigger and the panel; `aria-expanded` on the trigger |
|
|
80
|
+
| closing | `data-ending-style` on the panel while it animates out; it stays mounted until the end |
|
|
81
|
+
| side | `data-side` and `data-align` on the panel and the arrow, after any flip |
|
|
82
|
+
|
|
83
|
+
## Keyboard
|
|
84
|
+
|
|
85
|
+
| Where | Key | Result |
|
|
86
|
+
| ------- | ------------ | ------------------------------------------------------------------------- |
|
|
87
|
+
| trigger | Enter, Space | opens; focus moves to the first control, or to the panel when it has none |
|
|
88
|
+
| panel | Tab | next control; from the last, on to the page after the trigger, and closes |
|
|
89
|
+
| panel | Escape | closes, focus to the trigger; a Select or menu inside closes first |
|
|
90
|
+
|
|
91
|
+
## Accessibility
|
|
92
|
+
|
|
93
|
+
The trigger is a button with `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`. The panel is a `dialog` named by `PopoverTitle` and described by `PopoverDescription`; one with no title needs `aria-label`. The arrow is `aria-hidden`. UI SDK sets all of this; the library adds no roles.
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
## Motion
|
|
98
|
+
|
|
99
|
+
The panel fades and scales in 150ms from the trigger. Under `prefers-reduced-motion` the scale is removed and the transition is near zero.
|
|
100
|
+
|
|
101
|
+
## Stacking
|
|
102
|
+
|
|
103
|
+
The panel opens in the top layer, so no ancestor `overflow` clips it and `space-y-*` or `divide-y` parents must not match it.
|
package/docs/progress.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
Shows how far a task has come, or that it is working when the end is unknown.
|
|
4
|
+
|
|
5
|
+
`e2e/progress.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue } from "@eodparks/ui/progress";
|
|
11
|
+
|
|
12
|
+
<Progress value={60}>
|
|
13
|
+
<ProgressLabel>Exporting bookings</ProgressLabel>
|
|
14
|
+
<ProgressValue />
|
|
15
|
+
<ProgressTrack><ProgressIndicator /></ProgressTrack>
|
|
16
|
+
</Progress>
|
|
17
|
+
|
|
18
|
+
<Progress value={null} aria-label="Connecting"><ProgressTrack><ProgressIndicator /></ProgressTrack></Progress>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Parts
|
|
22
|
+
|
|
23
|
+
Wraps `@ui-sdk/react/progress`. Props are UI SDK's: `value` (`null` for indeterminate), `min`,
|
|
24
|
+
`max`, `format`, `locale`.
|
|
25
|
+
|
|
26
|
+
| Export | Is |
|
|
27
|
+
| ------------------- | -------------------------------------------------------------- |
|
|
28
|
+
| `Progress` | the `progressbar`; a grid with label and value above the track |
|
|
29
|
+
| `ProgressLabel` | the visible name; or pass `aria-label` to the root |
|
|
30
|
+
| `ProgressValue` | the formatted value, hidden from assistive technology |
|
|
31
|
+
| `ProgressTrack` | the 8px bar |
|
|
32
|
+
| `ProgressIndicator` | the fill: `primary`, `success` when complete |
|
|
33
|
+
|
|
34
|
+
## Visual indicator
|
|
35
|
+
|
|
36
|
+
Determinate fills the track to the value. Indeterminate fills it and pulses; under reduced
|
|
37
|
+
motion it is a still, full bar. At the end of the range the fill turns to `success`.
|
|
38
|
+
|
|
39
|
+
## Text
|
|
40
|
+
|
|
41
|
+
Label and value sit on one row above the bar. The label says what is running; the value is the
|
|
42
|
+
percentage, or any text from `format`. A label wider than its row wraps; it never clips.
|
|
43
|
+
|
|
44
|
+
## Time
|
|
45
|
+
|
|
46
|
+
Use `Progress` when the wait is longer than about ten seconds, and a `Spinner` before that. Show
|
|
47
|
+
a determinate bar only when the value is real; use indeterminate otherwise.
|
|
48
|
+
|
|
49
|
+
## Accessibility
|
|
50
|
+
|
|
51
|
+
Target: WCAG 2.2 AA. The root is a native `progressbar` with `aria-valuenow`, `aria-valuemin` and
|
|
52
|
+
`aria-valuemax`, and no `aria-valuenow` while indeterminate. The fill meets 3:1 against the
|
|
53
|
+
track and the surface in both themes. Not interactive.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# RadioGroup
|
|
2
|
+
|
|
3
|
+
One choice from a short list, with one tab stop for the group and arrow keys between options.
|
|
4
|
+
|
|
5
|
+
`e2e/radio-group.spec.ts` is the executable form of this page.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { RadioGroup, RadioGroupItem } from "@eodparks/ui/radio-group";
|
|
11
|
+
|
|
12
|
+
<RadioGroup aria-label="Plan" name="plan" defaultValue="monthly">
|
|
13
|
+
<label className="flex items-center gap-2">
|
|
14
|
+
<RadioGroupItem value="monthly" />
|
|
15
|
+
Monthly
|
|
16
|
+
</label>
|
|
17
|
+
<label className="flex items-center gap-2">
|
|
18
|
+
<RadioGroupItem value="yearly" />
|
|
19
|
+
Yearly
|
|
20
|
+
</label>
|
|
21
|
+
</RadioGroup>
|
|
22
|
+
|
|
23
|
+
<RadioGroup value={plan} onValueChange={setPlan} orientation="horizontal">
|
|
24
|
+
<RadioGroupItem id="monthly" value="monthly" />
|
|
25
|
+
<Label htmlFor="monthly">Monthly</Label>
|
|
26
|
+
</RadioGroup>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Parts
|
|
30
|
+
|
|
31
|
+
| Export | Is |
|
|
32
|
+
| ---------------- | ---------------------------------------------------------------------- |
|
|
33
|
+
| `RadioGroup` | wraps `RadioGroup` from `@ui-sdk/react/radio`; reports `""` when empty |
|
|
34
|
+
| `RadioGroupItem` | wraps `Radio` and `RadioIndicator`; a 16px ring with a dot |
|
|
35
|
+
| `*Props` | the prop types |
|
|
36
|
+
|
|
37
|
+
The shadcn names are kept. Each `RadioGroupItem` renders a `<button role="radio">`; the group
|
|
38
|
+
renders one hidden native input for the form.
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
### RadioGroup
|
|
43
|
+
|
|
44
|
+
| Prop | Type | Default | Notes |
|
|
45
|
+
| --------------- | ----------------------------- | ------------ | ------------------------------------------------------------ |
|
|
46
|
+
| `value` | `string` | | controlled; `""` checks nothing |
|
|
47
|
+
| `defaultValue` | `string` | | uncontrolled; a form reset returns to it |
|
|
48
|
+
| `onValueChange` | `(value, details) => void` | | `""` when cleared, never `null` (shadcn contract) |
|
|
49
|
+
| `orientation` | `"vertical" \| "horizontal"` | `"vertical"` | layout only: a `grid` column, or a wrapping row |
|
|
50
|
+
| `name` | `string` | | the value submits under it |
|
|
51
|
+
| `required` | `boolean` | `false` | blocks submit until one is checked |
|
|
52
|
+
| `disabled` | `boolean` | `false` | every radio; not focusable, not submitted |
|
|
53
|
+
| `readOnly` | `boolean` | `false` | focusable and submitted, nothing changes |
|
|
54
|
+
| `loop` | `boolean` | `true` | arrow keys wrap from the last radio to the first |
|
|
55
|
+
| `aria-invalid` | `boolean` | | destructive rings; a surrounding `Field` sets it for you |
|
|
56
|
+
| `aria-label` | `string` | | the group needs a name: this, `aria-labelledby` or a `Field` |
|
|
57
|
+
| `className` | `string \| (state) => string` | | merged with `withBase` |
|
|
58
|
+
|
|
59
|
+
### RadioGroupItem
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Notes |
|
|
62
|
+
| ---------- | --------- | ---------------------------------------------------- |
|
|
63
|
+
| `value` | `string` | required; the group's value when this one is checked |
|
|
64
|
+
| `disabled` | `boolean` | arrow keys skip it |
|
|
65
|
+
| `id` | `string` | for a sibling `<label htmlFor>` |
|
|
66
|
+
|
|
67
|
+
## Default selection
|
|
68
|
+
|
|
69
|
+
Nothing starts checked unless you pass `defaultValue`. Preselect the option most people pick when
|
|
70
|
+
there is a safe default (standard shipping); leave it empty when the choice must be deliberate,
|
|
71
|
+
and add `required`.
|
|
72
|
+
|
|
73
|
+
## Variants
|
|
74
|
+
|
|
75
|
+
| Variant | How |
|
|
76
|
+
| ---------------- | ------------------------------------------------------------------------------- |
|
|
77
|
+
| vertical | the default; options stack with `gap-3` |
|
|
78
|
+
| horizontal | `orientation="horizontal"`: a wrapping row, `gap-x-6 gap-y-3` |
|
|
79
|
+
| with description | each option in a UI SDK `Field` with `FieldLabel` and `FieldDescription` |
|
|
80
|
+
| card | a `<label>` card around the radio and its text; anywhere on the card selects it |
|
|
81
|
+
|
|
82
|
+
## States
|
|
83
|
+
|
|
84
|
+
| State | Source | Look |
|
|
85
|
+
| ------------- | ----------------------------------- | ---------------------------------- |
|
|
86
|
+
| unchecked | `data-unchecked` | 1px `border-primary` ring |
|
|
87
|
+
| checked | `data-checked` | ring with an 8px `bg-primary` dot |
|
|
88
|
+
| hover | `:hover`, not disabled or read-only | `bg-accent` inside the ring |
|
|
89
|
+
| focus-visible | `:focus-visible` | `focusRing` |
|
|
90
|
+
| invalid | `aria-invalid` on the group | `border-destructive` rings |
|
|
91
|
+
| disabled | `data-disabled` | `opacity-50`, `cursor-not-allowed` |
|
|
92
|
+
| read-only | `data-readonly` | no hover, `cursor-default` |
|
|
93
|
+
|
|
94
|
+
A centred 24px `after:` square is the pointer target around each ring. The dot fades in over
|
|
95
|
+
150ms, and not at all under reduced motion.
|
|
96
|
+
|
|
97
|
+
## Keyboard
|
|
98
|
+
|
|
99
|
+
| Key | Does |
|
|
100
|
+
| ---------- | ------------------------------------------------------------------ |
|
|
101
|
+
| Tab | enters the group on the checked radio, or the first enabled one |
|
|
102
|
+
| Arrow keys | move to the next or previous radio and check it, skipping disabled |
|
|
103
|
+
| Space | checks the focused radio |
|
|
104
|
+
| Enter | submits its form |
|
|
105
|
+
|
|
106
|
+
## Accessibility
|
|
107
|
+
|
|
108
|
+
Target: WCAG 2.2 AA. UI SDK supplies `radiogroup`, `radio` and `aria-checked`, and passes its
|
|
109
|
+
radio-group pattern check. Name the group and give each option its own label. The ring and the dot
|
|
110
|
+
meet 3:1 in both themes.
|
|
111
|
+
|
|
112
|
+
## Copy
|
|
113
|
+
|
|
114
|
+
Options are short, parallel and mutually exclusive. Two to about six options; past that, use
|
|
115
|
+
`Select`.
|
|
116
|
+
|
|
117
|
+
## Not in scope
|
|
118
|
+
|
|
119
|
+
Radio cards and chips as a component (`ChoiceCards`), radio menu items (`DropdownMenu`).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ScrollArea
|
|
2
|
+
|
|
3
|
+
Native scrolling with styled scrollbars, edge marks and a follow-to-end mode.
|
|
4
|
+
|
|
5
|
+
`e2e/scroll-area.spec.ts` is the executable form of this page. The browser does the scrolling, so the wheel, touch, keys and find in page work as in any region.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { ScrollArea } from "@eodparks/ui/scroll-area";
|
|
11
|
+
|
|
12
|
+
<ScrollArea aria-label="Bookings" className="h-64 w-80 rounded-item border">
|
|
13
|
+
<ul className="p-3">...</ul>
|
|
14
|
+
</ScrollArea>
|
|
15
|
+
|
|
16
|
+
<ScrollArea aria-label="Cards" orientation="horizontal" className="h-24 w-80">
|
|
17
|
+
<div className="flex w-max gap-3 p-3">...</div>
|
|
18
|
+
</ScrollArea>
|
|
19
|
+
|
|
20
|
+
<ScrollArea aria-label="Log" stickToEnd className="h-64 w-80">
|
|
21
|
+
{lines}
|
|
22
|
+
</ScrollArea>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Give the root a size. Children go inside the scroller; a wide row needs `w-max` to overflow sideways.
|
|
26
|
+
|
|
27
|
+
## Parts
|
|
28
|
+
|
|
29
|
+
| Export | Is |
|
|
30
|
+
| ------------ | --------------------------------------------------------------------------------------------- |
|
|
31
|
+
| `ScrollArea` | the root, the scroller, the scrollbars, the edge marks and, with `stickToEnd`, the end button |
|
|
32
|
+
|
|
33
|
+
One part, as in CRM today. There is no `ScrollBar`: `orientation` chooses the bars.
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Default | Notes |
|
|
38
|
+
| ------------------------------- | ------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `orientation` | `"vertical" \| "horizontal" \| "both"` | `"vertical"` | which scrollbars show; `both` adds the corner |
|
|
40
|
+
| `type` | `"hover" \| "auto" \| "always" \| "scroll"` | `"hover"` | when the bars show: on hover or scroll, whenever it overflows, always, or only while scrolling |
|
|
41
|
+
| `scrollHideDelay` | `number` (ms) | UI SDK | how long a bar stays after it is no longer needed |
|
|
42
|
+
| `stickToEnd` | `boolean` | `false` | starts at the end and keeps it in view while content grows; scrolling up lets go |
|
|
43
|
+
| `scrollToEndLabel` | `string` | "Scroll to latest" | the name of the button that returns to the end |
|
|
44
|
+
| `aria-label`, `aria-labelledby` | `string` | | name the scroller; it becomes a `region` landmark |
|
|
45
|
+
| `controller` | UI SDK controller | | `scrollToEnd`, `scrollToStart` from anywhere |
|
|
46
|
+
|
|
47
|
+
The root takes `className` and `render`; parts carry `data-slot` (`scroll-area`, `scroll-area-viewport`, `scroll-area-scrollbar`, `scroll-area-thumb`).
|
|
48
|
+
|
|
49
|
+
## Variants
|
|
50
|
+
|
|
51
|
+
| Variant | How |
|
|
52
|
+
| ------------- | ------------------------------------------------------------------------ |
|
|
53
|
+
| vertical | default |
|
|
54
|
+
| horizontal | `orientation="horizontal"` |
|
|
55
|
+
| follow to end | `stickToEnd`; an icon button appears while the view is away from the end |
|
|
56
|
+
|
|
57
|
+
## States
|
|
58
|
+
|
|
59
|
+
| State | Source |
|
|
60
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
61
|
+
| scrolling | `data-scrolling` on the root and the bar; the thumb darkens while dragged |
|
|
62
|
+
| at edge | `data-at-y-start`, `data-at-y-end`, `data-at-x-start`, `data-at-x-end` on the root; the edge mark on that side goes away |
|
|
63
|
+
| overflow | `data-overflow-x`, `data-overflow-y`; a region that fits shows no thumb and no edge mark |
|
|
64
|
+
| following | `data-sticking` on the root |
|
|
65
|
+
| focus | the library focus ring on the scroller, on keyboard focus only |
|
|
66
|
+
|
|
67
|
+
## Keyboard
|
|
68
|
+
|
|
69
|
+
A scroller with nothing focusable inside is a tab stop, so a keyboard user can reach it. Arrow keys, Page Up and Down, Home, End and Space then scroll it. A scroller with links or fields inside is not a tab stop: Tab reaches them and they scroll it.
|
|
70
|
+
|
|
71
|
+
## Accessibility
|
|
72
|
+
|
|
73
|
+
No ARIA pattern covers a scroll area: the scroller is native. Name a region that is worth finding with `aria-label`; it becomes a `region`. A log can take `role="log"` through `render` on its own markup. The scrollbars, edge marks and the arrow are hidden from screen readers, which scroll the region themselves. The thumb and the edge marks have 3:1 against their surface; a mark sits inside the frame border, clear of it. 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.
|
|
74
|
+
|
|
75
|
+
## Motion
|
|
76
|
+
|
|
77
|
+
The scrollbar fades in 150 ms. Under `prefers-reduced-motion` the fade is near zero and scrolling to the end is instant.
|
|
78
|
+
|
|
79
|
+
## Copy
|
|
80
|
+
|
|
81
|
+
The library ships one accessible name, "Scroll to latest", a prop.
|
|
82
|
+
|
|
83
|
+
## Migration
|
|
84
|
+
|
|
85
|
+
CRM's `ScrollArea` always showed a vertical bar; the default here is the same. A horizontal area, which CRM got by adding a `ScrollBar` child, takes `orientation="horizontal"` and no child.
|