@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.
Files changed (176) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accordion.d.ts +36 -0
  3. package/dist/accordion.js +57 -0
  4. package/dist/alert-dialog.d.ts +50 -0
  5. package/dist/alert-dialog.js +149 -0
  6. package/dist/alert.d.ts +23 -0
  7. package/dist/alert.js +87 -0
  8. package/dist/avatar.d.ts +35 -0
  9. package/dist/avatar.js +118 -0
  10. package/dist/badge.d.ts +27 -0
  11. package/dist/badge.js +148 -0
  12. package/dist/button-C2CCxHu1.d.ts +15 -0
  13. package/dist/button-DEsRlveL.js +86 -0
  14. package/dist/button.d.ts +2 -0
  15. package/dist/button.js +1 -0
  16. package/dist/calendar-DhsRPq2D.d.ts +23 -0
  17. package/dist/calendar-kbn4gZ1a.js +110 -0
  18. package/dist/calendar.d.ts +2 -0
  19. package/dist/calendar.js +1 -0
  20. package/dist/card-tkP52GwZ.js +77 -0
  21. package/dist/card.d.ts +18 -0
  22. package/dist/card.js +1 -0
  23. package/dist/chart.d.ts +52 -0
  24. package/dist/chart.js +163 -0
  25. package/dist/checkbox.d.ts +7 -0
  26. package/dist/checkbox.js +26 -0
  27. package/dist/cn-B-fHM4Ov.js +12 -0
  28. package/dist/collapsible.d.ts +10 -0
  29. package/dist/collapsible.js +23 -0
  30. package/dist/command.d.ts +38 -0
  31. package/dist/command.js +124 -0
  32. package/dist/date-picker.d.ts +46 -0
  33. package/dist/date-picker.js +159 -0
  34. package/dist/dialog-JjpMFEDR.js +117 -0
  35. package/dist/dialog.d.ts +2 -0
  36. package/dist/dialog.js +3 -0
  37. package/dist/dropdown-menu-B_VG1VXX.js +116 -0
  38. package/dist/dropdown-menu-CZ8xcq1d.d.ts +38 -0
  39. package/dist/dropdown-menu.d.ts +2 -0
  40. package/dist/dropdown-menu.js +1 -0
  41. package/dist/empty-state-B11Uq0U_.js +66 -0
  42. package/dist/empty-state.d.ts +15 -0
  43. package/dist/empty-state.js +1 -0
  44. package/dist/error-state.d.ts +48 -0
  45. package/dist/error-state.js +139 -0
  46. package/dist/field-Cwhz73-_.d.ts +15 -0
  47. package/dist/field-D-n7O1n6.js +63 -0
  48. package/dist/field.d.ts +2 -0
  49. package/dist/field.js +1 -0
  50. package/dist/focus-ring-BpxMbGAn.js +3 -0
  51. package/dist/form-actions.d.ts +21 -0
  52. package/dist/form-actions.js +41 -0
  53. package/dist/forms/formik.d.ts +20 -0
  54. package/dist/forms/formik.js +50 -0
  55. package/dist/forms/rhf.d.ts +32 -0
  56. package/dist/forms/rhf.js +114 -0
  57. package/dist/icon-button-XAjcFsZ2.js +14 -0
  58. package/dist/icon-button.d.ts +9 -0
  59. package/dist/icon-button.js +1 -0
  60. package/dist/icon.d.ts +15 -0
  61. package/dist/icon.js +21 -0
  62. package/dist/index-Ct4mPvuB.d.ts +29 -0
  63. package/dist/input-BxjcqQS1.js +49 -0
  64. package/dist/input-group.d.ts +12 -0
  65. package/dist/input-group.js +26 -0
  66. package/dist/input.d.ts +15 -0
  67. package/dist/input.js +1 -0
  68. package/dist/label-BrOAJU1p.js +31 -0
  69. package/dist/label-CUAiaBbm.d.ts +13 -0
  70. package/dist/label.d.ts +2 -0
  71. package/dist/label.js +1 -0
  72. package/dist/native-select.d.ts +8 -0
  73. package/dist/native-select.js +41 -0
  74. package/dist/page-header.d.ts +19 -0
  75. package/dist/page-header.js +51 -0
  76. package/dist/pagination.d.ts +47 -0
  77. package/dist/pagination.js +131 -0
  78. package/dist/password-input.d.ts +14 -0
  79. package/dist/password-input.js +41 -0
  80. package/dist/popover.d.ts +19 -0
  81. package/dist/popover.js +54 -0
  82. package/dist/popup-CLsuJ-AA.js +6 -0
  83. package/dist/progress.d.ts +8 -0
  84. package/dist/progress.js +36 -0
  85. package/dist/radio-group.d.ts +14 -0
  86. package/dist/radio-group.js +25 -0
  87. package/dist/scroll-area.d.ts +16 -0
  88. package/dist/scroll-area.js +52 -0
  89. package/dist/select-Cq_JDuYO.js +266 -0
  90. package/dist/select.d.ts +40 -0
  91. package/dist/select.js +1 -0
  92. package/dist/separator.d.ts +8 -0
  93. package/dist/separator.js +38 -0
  94. package/dist/sheet.d.ts +27 -0
  95. package/dist/sheet.js +95 -0
  96. package/dist/skeleton.d.ts +19 -0
  97. package/dist/skeleton.js +45 -0
  98. package/dist/spinner.d.ts +13 -0
  99. package/dist/spinner.js +44 -0
  100. package/dist/switch.d.ts +7 -0
  101. package/dist/switch.js +19 -0
  102. package/dist/table.d.ts +24 -0
  103. package/dist/table.js +75 -0
  104. package/dist/tabs.d.ts +24 -0
  105. package/dist/tabs.js +74 -0
  106. package/dist/textarea.d.ts +5 -0
  107. package/dist/textarea.js +15 -0
  108. package/dist/theme-toggle.d.ts +11 -0
  109. package/dist/theme-toggle.js +50 -0
  110. package/dist/toast.d.ts +12 -0
  111. package/dist/toast.js +105 -0
  112. package/dist/tooltip-BsVKZDXs.js +47 -0
  113. package/dist/tooltip.d.ts +18 -0
  114. package/dist/tooltip.js +1 -0
  115. package/dist/typography-Dy3PCTrL.js +34 -0
  116. package/dist/typography.d.ts +11 -0
  117. package/dist/typography.js +1 -0
  118. package/dist/visually-hidden-BrCs6ZEy.js +11 -0
  119. package/dist/visually-hidden.d.ts +3 -0
  120. package/dist/visually-hidden.js +1 -0
  121. package/docs/accessibility.md +95 -0
  122. package/docs/accordion.md +89 -0
  123. package/docs/alert-dialog.md +157 -0
  124. package/docs/alert.md +70 -0
  125. package/docs/avatar.md +57 -0
  126. package/docs/badge.md +51 -0
  127. package/docs/button.md +121 -0
  128. package/docs/calendar.md +116 -0
  129. package/docs/card.md +74 -0
  130. package/docs/chart.md +93 -0
  131. package/docs/checkbox.md +119 -0
  132. package/docs/collapsible.md +76 -0
  133. package/docs/command.md +114 -0
  134. package/docs/date-picker.md +177 -0
  135. package/docs/dialog.md +110 -0
  136. package/docs/dropdown-menu.md +126 -0
  137. package/docs/empty-state.md +65 -0
  138. package/docs/error-state.md +59 -0
  139. package/docs/field.md +54 -0
  140. package/docs/form-actions.md +55 -0
  141. package/docs/forms/formik.md +42 -0
  142. package/docs/forms/rhf.md +64 -0
  143. package/docs/icon-button.md +84 -0
  144. package/docs/icon.md +77 -0
  145. package/docs/input-group.md +47 -0
  146. package/docs/input.md +46 -0
  147. package/docs/label.md +33 -0
  148. package/docs/layout.md +102 -0
  149. package/docs/llms.txt +72 -0
  150. package/docs/native-select.md +87 -0
  151. package/docs/page-header.md +61 -0
  152. package/docs/pagination.md +107 -0
  153. package/docs/password-input.md +30 -0
  154. package/docs/popover.md +103 -0
  155. package/docs/progress.md +53 -0
  156. package/docs/radio-group.md +119 -0
  157. package/docs/scroll-area.md +85 -0
  158. package/docs/select.md +106 -0
  159. package/docs/separator.md +38 -0
  160. package/docs/sheet.md +118 -0
  161. package/docs/skeleton.md +50 -0
  162. package/docs/spinner.md +46 -0
  163. package/docs/switch.md +92 -0
  164. package/docs/table.md +87 -0
  165. package/docs/tabs.md +96 -0
  166. package/docs/textarea.md +38 -0
  167. package/docs/theme-toggle.md +76 -0
  168. package/docs/toast.md +95 -0
  169. package/docs/tooltip.md +101 -0
  170. package/docs/typography.md +96 -0
  171. package/docs/visually-hidden.md +44 -0
  172. package/layer.css +22 -0
  173. package/package.json +275 -3
  174. package/skills/eod-ui/SKILL.md +37 -0
  175. package/styles.css +2 -0
  176. package/README.md +0 -3
package/docs/select.md ADDED
@@ -0,0 +1,106 @@
1
+ # Select
2
+
3
+ Choose one value or several from a popup list, with the shadcn part names and a UI SDK Select underneath.
4
+
5
+ Wraps `@ui-sdk/react/select`. Public names follow shadcn so CRM's 26 `select.tsx` importers move without edits. UI SDK names stay internal.
6
+
7
+ ## Parts
8
+
9
+ | Part | Role | Notes |
10
+ | ----------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
11
+ | `Select` | root, no DOM of its own | holds value, open state, form name |
12
+ | `SelectTrigger` | the combobox button | wraps UI SDK `SelectTrigger`; renders `SelectValue` and a 16px chevron when it has no children |
13
+ | `SelectValue` | the chosen label or the placeholder | |
14
+ | `SelectContent` | the popup list | uses `popup` from `internal/popup`; renders `items` itself when it has no children |
15
+ | `SelectGroup` | a labelled run of items | |
16
+ | `SelectLabel` | the heading of a group (shadcn meaning, not a field label) | UI SDK `SelectGroupLabel` |
17
+ | `SelectItem` | one option with a trailing check | |
18
+ | `SelectSeparator` | divider between groups | |
19
+ | `SelectClear` | button that empties the value | sits beside the trigger, never inside it |
20
+ | `SelectSelectAll` | toggles every item of its group, or of the list | `multiple` only |
21
+ | `SelectEmpty` | shown when there is nothing to choose | children required |
22
+ | `SelectStatus` | shown while `status="loading"` | children required |
23
+
24
+ Not provided: `asChild` (use `render`), `SelectPortal` (popups render in the top layer), `SelectScrollUpButton` and `SelectScrollDownButton` (the list scrolls natively), `position` (the popup always anchors to the trigger), and a `dir` prop (direction is inherited from the page).
25
+
26
+ ## Props
27
+
28
+ `Select`
29
+
30
+ | Prop | Type | Default | Note |
31
+ | ------------------------------------------------------------------ | -------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
32
+ | `value`, `defaultValue` | `string`, or `string[]` with `multiple` | | `""` means empty, never `null` |
33
+ | `onValueChange` | `(value, details) => void` | | `value` is `""` or `[]` after a clear; `details` is UI SDK's `{ reason, event, cancel() }` |
34
+ | `open`, `defaultOpen`, `onOpenChange` | | closed | |
35
+ | `multiple` | `boolean` | `false` | the list stays open while items toggle |
36
+ | `items` | `{ value, label, disabled? }[]`, groups and separators allowed | | data form of the list, needed for virtualized lists; without it the trigger shows the raw value for a moment after mount, then the label |
37
+ | `placeholder` | `string` | none | no default text |
38
+ | `name`, `form`, `required`, `disabled`, `readOnly`, `autoComplete` | | | native form behaviour; a disabled select is not submitted |
39
+ | `status` | `"idle" \| "loading" \| "error"` | `"idle"` | |
40
+ | `onLoadMore` | `() => void` | | |
41
+ | `modal`, `presentation`, `container` | | UI SDK defaults | passed through |
42
+
43
+ `SelectTrigger`: `size` (`"default"` or `"sm"`), `invalid` (sets `aria-invalid`), `render`, `className`, and any button prop including `aria-label`.
44
+ `SelectValue`: `placeholder`, `maxLabels` (default 2), `getMoreLabel` (English default, "and 2 more").
45
+ `SelectContent`: `side` (`"bottom"`), `align` (`"start"`), `sideOffset` (4), `alignItemWithTrigger` (`false`), `render`, `className`.
46
+ `SelectItem`: `value` (required), `disabled`, `label`, `index` (position in the full list), `render`, `className`.
47
+ `SelectClear`: `aria-label` defaults to "Clear"; icon is a 16px `X`, `aria-hidden`.
48
+
49
+ Every part takes `className` and `render`, and carries a `data-slot` (`select`, `select-trigger`, ...).
50
+
51
+ ## Variants
52
+
53
+ | Variant | How |
54
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
55
+ | single | default |
56
+ | multiple | `multiple`; add `SelectSelectAll` for select all; the trigger shows `maxLabels` labels then a count |
57
+ | groups | `SelectGroup`, `SelectLabel`, `SelectSeparator` |
58
+ | clearable | a `SelectClear` next to the trigger |
59
+ | size sm, default | `SelectTrigger size`; heights come from `--control-h-sm` and `--control-h`, so `data-density="compact"` shrinks both |
60
+ | virtualized | `items` with `SelectContent` and no children; the list renders only the visible rows (windowing starts above 100 items) and sets each row's `index` |
61
+
62
+ ## States
63
+
64
+ | State | Source |
65
+ | ------------- | ---------------------------------------------------------------------------- |
66
+ | open | `data-open` on the trigger and the list |
67
+ | highlighted | `data-highlighted` on the item |
68
+ | selected | `data-selected` on the item, check shown |
69
+ | placeholder | `data-placeholder` on the trigger and value |
70
+ | invalid | `aria-invalid` and `data-invalid` on the trigger |
71
+ | disabled | `data-disabled` on the trigger |
72
+ | disabled item | `data-disabled` and `aria-disabled` on the item; skipped by keys and pointer |
73
+ | empty | `SelectEmpty` visible |
74
+ | loading | `SelectStatus` visible, list `aria-busy` |
75
+
76
+ States come from data attributes in the class string, never from JavaScript.
77
+
78
+ ## Keyboard
79
+
80
+ | Where | Key | Result |
81
+ | -------------- | -------------------------------- | ----------------------------------------------------------- |
82
+ | closed trigger | Enter, Space, ArrowDown, ArrowUp | opens; focus on the selected item, or the first enabled one |
83
+ | closed trigger | a letter | selects the next item starting with it |
84
+ | open list | ArrowDown, ArrowUp, Home, End | move the highlight, skipping disabled items |
85
+ | open list | letters | highlight the next match |
86
+ | open list | Enter, Space | choose and close (single), toggle and stay open (multiple) |
87
+ | open list | Escape | close without choosing, focus to trigger |
88
+ | open list | Tab | close, focus moves on |
89
+
90
+ ## Accessibility
91
+
92
+ The trigger is a `combobox` with `aria-haspopup="listbox"`, `aria-expanded` and `aria-controls`. The popup is a `listbox` with `option` children. UI SDK sets all of this; the library adds no roles.
93
+
94
+ The control needs a name: `aria-label`, `aria-labelledby`, or a `<label htmlFor>` pointing at the trigger `id`, or a Field label. Target is WCAG 2.2 AA, checked by axe on every states page in both themes. Screen reader checks (VoiceOver with Safari, NVDA with Chrome) are manual.
95
+
96
+ ## Copy
97
+
98
+ The library ships no prose except the accessible names "Clear" and the English `getMoreLabel`. Placeholder, empty and loading text are props or children.
99
+
100
+ ## Motion
101
+
102
+ The list fades and scales in 150ms. Under `prefers-reduced-motion` the scale is removed and the transition is near zero.
103
+
104
+ ## Stacking
105
+
106
+ The list opens in the top layer, so no ancestor `overflow` clips it and `space-y-*` or `divide-y` parents must not match it (`internal/popup` and the gallery check this).
@@ -0,0 +1,38 @@
1
+ # Separator
2
+
3
+ Divides groups of content with a horizontal or vertical line, optionally labelled.
4
+
5
+ `e2e/separator.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Separator } from "@eodparks/ui/separator";
11
+
12
+ <Separator />
13
+ <Separator orientation="vertical" />
14
+ <Separator label="or continue with" />
15
+ <Separator decorative />
16
+ ```
17
+
18
+ ## Props
19
+
20
+ | Prop | Type | Default | Notes |
21
+ | ------------- | ---------------------------- | -------------- | ----------------------------------------------------------------- |
22
+ | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | a vertical line stretches to the height of its row |
23
+ | `label` | `string` | | horizontal only; text between two lines, also the accessible name |
24
+ | `decorative` | `boolean` | `false` | removes the `separator` role for a line that only decorates |
25
+
26
+ Wraps `Separator` from `@ui-sdk/react/separator`: role `separator`, `aria-orientation`,
27
+ `data-orientation`.
28
+
29
+ ## Spacing
30
+
31
+ The line is 1px in `bg-border` and has no margin. The parent spaces it with `gap` (step 3 or 4),
32
+ so the space above and below a separator is layout spacing, not the separator's own.
33
+
34
+ ## Accessibility
35
+
36
+ Target: WCAG 2.2 AA. The line meets 3:1 against its surface in both themes. A separator is not
37
+ interactive. Use `decorative` where a screen reader would only hear noise, such as a rule between
38
+ list items that are already a list.
package/docs/sheet.md ADDED
@@ -0,0 +1,118 @@
1
+ # Sheet
2
+
3
+ A panel that slides in from an edge of the screen for a task that needs more room than a dialog, built on UI SDK `drawer` with shadcn-compatible part names.
4
+
5
+ Import from `@eodparks/ui/sheet`.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ <Sheet side="right">
11
+ <SheetTrigger render={<Button variant="outline" />}>Edit guest</SheetTrigger>
12
+ <SheetContent size="md">
13
+ <SheetHeader>
14
+ <SheetTitle>Edit guest</SheetTitle>
15
+ <SheetDescription>Change the guest's details.</SheetDescription>
16
+ </SheetHeader>
17
+ <SheetBody>{/* long content scrolls here */}</SheetBody>
18
+ <SheetFooter>
19
+ <SheetClose render={<Button variant="outline" />}>Cancel</SheetClose>
20
+ <Button type="submit">Save</Button>
21
+ </SheetFooter>
22
+ </SheetContent>
23
+ </Sheet>
24
+ ```
25
+
26
+ ## Parts
27
+
28
+ | Part | Renders | Role |
29
+ | ------------------ | -------- | -------------------------------------------------------------------------------------------------- |
30
+ | `Sheet` | none | Root. Holds open state and the edge it opens from. |
31
+ | `SheetTrigger` | `button` | Opens the sheet. Also usable outside `Sheet` with a `controller`. |
32
+ | `SheetContent` | `div` | The overlay and the panel, in the top layer. Adds the close button, and a grip at the bottom edge. |
33
+ | `SheetHeader` | `div` | Stacks the title and description. |
34
+ | `SheetBody` | `div` | The scrolling region. Keyboard focusable. To name it, render a `section` with `aria-label`. |
35
+ | `SheetFooter` | `div` | The actions, pinned to the bottom of the panel. |
36
+ | `SheetTitle` | `h2` | Names the sheet. |
37
+ | `SheetDescription` | `p` | Describes the sheet. |
38
+ | `SheetClose` | `button` | Closes the sheet. Takes `value` and an async `action`. |
39
+
40
+ `SheetPortal` and `SheetOverlay` are not exported: the content owns the overlay and renders in the top layer. `createSheetController` and `SheetController` are re-exported from UI SDK's drawer.
41
+
42
+ ## Props
43
+
44
+ All parts take `className` and `render`. There is no `asChild`.
45
+
46
+ ### Sheet
47
+
48
+ | Prop | Type | Default | Notes |
49
+ | ---------------------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------ |
50
+ | `side` | `"right"`, `"left"`, `"top"`, `"bottom"`, `"start"`, `"end"` | `"right"` | On the root, not on `SheetContent` as in shadcn. `start` and `end` follow the writing direction. |
51
+ | `open` | `boolean` | | Controlled state. |
52
+ | `defaultOpen` | `boolean` | `false` | |
53
+ | `onOpenChange` | `(open, details) => void` | | `details.reason` includes `swipe`. |
54
+ | `onOpenChangeComplete` | `(open) => void` | | After the panel settles. |
55
+ | `dismissible` | `boolean` | `true` | `false` refuses Escape, outside press and swipe. |
56
+ | `onDismissAttempt` | `({ reason, event }) => void` | | A refused dismissal. |
57
+ | `modal` | `true`, `"trap-focus"` or `false` | `true` | |
58
+ | `controller` | `SheetController` | | Open and close from code. |
59
+
60
+ UI SDK drawer options such as `snapPoints` pass through.
61
+
62
+ ### SheetContent
63
+
64
+ | Prop | Type | Default | Notes |
65
+ | ----------------- | ------------------------------------------ | --------------- | ------------------------------------------------------------------------------------------------ |
66
+ | `size` | `"sm"`, `"md"` or `"lg"` | `"sm"` | Width on the left and right: up to 384, 512 or 672 px, and at most three quarters of the window. |
67
+ | `showCloseButton` | `boolean` | `true` | The corner close button. |
68
+ | `closeLabel` | `string` | `"Close"` | Accessible name of the corner close button. |
69
+ | `initialFocus` | selector, element, function or `"content"` | first focusable | Where focus starts. |
70
+ | `finalFocus` | selector, element or function | trigger | Where focus goes on close. |
71
+
72
+ ## Variants
73
+
74
+ | Variant | How |
75
+ | ---------------- | -------------------------------------------------------------------------- |
76
+ | side right, left | `Sheet side`. Full height. |
77
+ | side top, bottom | `Sheet side`. Full width, up to 85% of the window high. Bottom has a grip. |
78
+ | size sm, md, lg | `SheetContent size`. |
79
+ | with footer | `SheetFooter`; put long content in `SheetBody` so the footer stays put. |
80
+
81
+ ## States
82
+
83
+ | State | Signal |
84
+ | ----------------- | ------------------------------------------------------------------ |
85
+ | open | `data-open` on content and overlay. |
86
+ | closing | `data-ending-style` while the panel slides out. |
87
+ | dragging (bottom) | `data-dragging` while a pointer drags the panel. |
88
+ | pending action | `data-pending` and `aria-busy="true"` on the running `SheetClose`. |
89
+
90
+ Under `prefers-reduced-motion` the panel fades instead of sliding.
91
+
92
+ ## Behaviour
93
+
94
+ - Escape, a press on the overlay, the close button and a drag toward the edge close it; `details.reason` says which.
95
+ - Focus moves to the first focusable element inside and returns to the trigger on close.
96
+ - A form with `method="dialog"` closes the sheet on valid submit, with the submitter's `value` as `returnValue`.
97
+ - A sheet opened inside another joins its stack; Escape closes the top one only.
98
+
99
+ ## Styling hooks
100
+
101
+ `data-slot` values: `drawer-trigger`, `sheet-overlay`, `drawer-content`, `sheet-header`, `sheet-body`, `sheet-footer`, `drawer-title`, `drawer-description`, `drawer-close`, `sheet-grip`. `data-side` on the content is the resolved physical edge.
102
+
103
+ Look: `bg-background`, a 1px border on the inner edge, `shadow-lg`, 24 px padding. Overlay `bg-overlay/80`, as CRM renders it.
104
+
105
+ ## Accessibility
106
+
107
+ Target: WCAG 2.2 AA. UI SDK supplies the `dialog` role, `aria-modal`, the name and description, the
108
+ focus trap, focus return and Escape. The close button is named by `closeLabel`; the grip is hidden from
109
+ assistive technology. Text meets 4.5:1 and the focus ring 3:1 in both themes.
110
+
111
+ ## Copy
112
+
113
+ No prose ships. The only built-in string is `closeLabel`, defaulting to "Close".
114
+
115
+ ## Not included
116
+
117
+ - Snap points and a resize handle: pass `snapPoints` to `Sheet` and use UI SDK's drawer handle directly if a screen needs them.
118
+ - Toasts above an open sheet need no wiring; the library `Toaster` keeps itself on top.
@@ -0,0 +1,50 @@
1
+ # Skeleton
2
+
3
+ Holds the shape of content that is loading, with a quiet pulse.
4
+
5
+ `e2e/skeleton.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Skeleton, SkeletonCard, SkeletonTableRow } from "@eodparks/ui/skeleton";
11
+
12
+ <div aria-busy={isLoading}>{isLoading ? <SkeletonCard /> : <BookingCard booking={booking} />}</div>;
13
+ ```
14
+
15
+ ## Parts
16
+
17
+ | Export | Is |
18
+ | ------------------ | -------------------------------------------------------------------------- |
19
+ | `Skeleton` | one bar: `variant` is `text` (16px line), `circle` (40px) or `rect` (96px) |
20
+ | `SkeletonTableRow` | a row of `columns` text bars, padded with `--table-cell-py` |
21
+ | `SkeletonCard` | the shape of a `Card` with title, description and body; takes `size` |
22
+
23
+ Size a `Skeleton` with `className` (`h-7 w-1/2`) to match the content it replaces.
24
+
25
+ ## Match content structure
26
+
27
+ A skeleton has the box of the content: same width, same height, same radius family. The presets
28
+ are built from the real `Card` and the table cell token, so they follow density. Size a custom
29
+ skeleton to the real line height, not to a guess.
30
+
31
+ ## Animation
32
+
33
+ `animate-pulse` on every bar. Under reduced motion the pulse is off and the bar is a still,
34
+ muted block.
35
+
36
+ ## Style and colour
37
+
38
+ Flat shapes: no border, no shadow, no gradient, no shimmer. Fill is `bg-muted`, which sits close
39
+ to the surface so the page stays calm.
40
+
41
+ ## Transition to real content
42
+
43
+ Render the skeleton and the content in the same parent and let the content take the skeleton's
44
+ box. Because both have the same height, the page does not jump when the data arrives.
45
+
46
+ ## Accessibility
47
+
48
+ Target: WCAG 2.2 AA. Skeletons are `aria-hidden`. Set `aria-busy="true"` on the region that is
49
+ loading and announce the wait with a `Spinner` or a `Progress`; the bars say nothing themselves.
50
+ They are not interactive and have no target size or focus ring.
@@ -0,0 +1,46 @@
1
+ # Spinner
2
+
3
+ Shows that something is loading, in three sizes, inline or centred, with an accessible label.
4
+
5
+ `e2e/spinner.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Spinner } from "@eodparks/ui/spinner";
11
+
12
+ <Spinner size="sm" label="Saving" />
13
+ <Spinner layout="block" label="Loading bookings" />
14
+ <Spinner showLabel label="Saving changes" />
15
+ ```
16
+
17
+ ## Props
18
+
19
+ | Prop | Type | Default | Notes |
20
+ | ----------- | ---------------------- | ----------- | -------------------------------------------------------- |
21
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | 16px, 24px, 32px icon |
22
+ | `layout` | `"inline" \| "block"` | `"inline"` | `block` fills the parent's width and centres the spinner |
23
+ | `label` | `string` | `"Loading"` | what is loading; the accessible name |
24
+ | `showLabel` | `boolean` | `false` | shows the label beside the icon |
25
+
26
+ ## Visual indicator
27
+
28
+ A rotating `lucide` circle in `text-muted-foreground`. Under reduced motion it holds still, and
29
+ the label carries the meaning.
30
+
31
+ ## Text
32
+
33
+ `label` says what is loading ("Loading bookings", not "Loading"). It is hidden visually unless
34
+ `showLabel` is set, and always read by assistive technology.
35
+
36
+ ## Time
37
+
38
+ Show a spinner only after a wait the person would notice: about 300 ms. For work that takes
39
+ longer than about ten seconds, use `Progress`. The delay belongs to the caller; the component
40
+ renders at once.
41
+
42
+ ## Accessibility
43
+
44
+ Target: WCAG 2.2 AA. The spinner is `role="status"` (a polite live region) whose text is the
45
+ label, and the icon is `aria-hidden`. The icon meets 3:1 on its surface in both themes. It is
46
+ not interactive.
package/docs/switch.md ADDED
@@ -0,0 +1,92 @@
1
+ # Switch
2
+
3
+ Turns a setting on or off at once, with a thumb that slides along a track.
4
+
5
+ `e2e/switch.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Switch } from "@eodparks/ui/switch";
11
+
12
+ <label className="flex items-center gap-3">
13
+ <Switch name="alerts" defaultChecked />
14
+ Email alerts
15
+ </label>
16
+
17
+ <Switch id="dark" checked={dark} onCheckedChange={setDark} size="sm" />
18
+ <Label htmlFor="dark">Dark mode</Label>
19
+ ```
20
+
21
+ Use a switch for a setting that applies as soon as it changes. For a choice that applies on submit,
22
+ or one that needs a confirmation, use `Checkbox`.
23
+
24
+ ## Parts
25
+
26
+ | Export | Is |
27
+ | ------------- | ----------------------------------------------------------------------------------- |
28
+ | `Switch` | wraps `Switch` and `SwitchThumb` from `@ui-sdk/react/switch`; the thumb is built in |
29
+ | `SwitchProps` | the prop type |
30
+
31
+ `Switch` renders a `<button role="switch">` and a hidden native checkbox for the form.
32
+
33
+ ## Props
34
+
35
+ | Prop | Type | Default | Notes |
36
+ | ----------------- | ----------------------------- | ----------- | ---------------------------------------------------------- |
37
+ | `size` | `"default" \| "sm"` | `"default"` | 44 by 24px, or 36 by 20px with a 24px pointer target |
38
+ | `checked` | `boolean` | | controlled |
39
+ | `defaultChecked` | `boolean` | `false` | uncontrolled; a form reset returns to it |
40
+ | `onCheckedChange` | `(checked, details) => void` | | the shadcn signature, plus UI SDK's `details.reason` |
41
+ | `name`, `value` | `string` | | an on switch submits `name=value`; `value` defaults `"on"` |
42
+ | `required` | `boolean` | `false` | blocks submit while off |
43
+ | `disabled` | `boolean` | `false` | not focusable, not submitted |
44
+ | `readOnly` | `boolean` | `false` | focusable and submitted, presses do nothing |
45
+ | `className` | `string \| (state) => string` | | merged with `withBase` on the track |
46
+
47
+ ## Variants
48
+
49
+ | Variant | How |
50
+ | -------------------------- | ----------------------------------------------------------------- |
51
+ | size default | `h-6 w-11` track, 20px thumb (CRM's switch) |
52
+ | size sm | `h-5 w-9` track, 16px thumb |
53
+ | with label and description | inside a UI SDK `Field`, with `FieldLabel` and `FieldDescription` |
54
+
55
+ ## States
56
+
57
+ | State | Source | Look |
58
+ | ------------- | ----------------------------------- | --------------------------------------------- |
59
+ | off | `data-unchecked` | `bg-input` track, thumb at the start edge |
60
+ | on | `data-checked` | `bg-primary` track, thumb at the end edge |
61
+ | hover | `:hover`, not disabled or read-only | off `bg-muted-foreground`, on `bg-primary/90` |
62
+ | focus-visible | `:focus-visible` | `focusRing` |
63
+ | disabled | `data-disabled` | `opacity-50`, `cursor-not-allowed` |
64
+ | read-only | `data-readonly` | no hover, `cursor-default` |
65
+
66
+ The thumb is `bg-background` and slides with `translate` over 150ms; under reduced motion it
67
+ jumps. In right to left it starts on the right and slides left. Sizes do not change with
68
+ compact density.
69
+
70
+ ## Keyboard
71
+
72
+ | Key | Does |
73
+ | ----- | -------------------------------- |
74
+ | Tab | moves to the next enabled switch |
75
+ | Space | turns it on or off |
76
+ | Enter | submits its form, never toggles |
77
+
78
+ ## Accessibility
79
+
80
+ Target: WCAG 2.2 AA. UI SDK supplies the `switch` role and `aria-checked`, and passes its switch
81
+ pattern check. Name it with a label, a `Field`, or `aria-label`. The off track, the on track and
82
+ the thumb meet 3:1 in both themes.
83
+
84
+ ## Copy
85
+
86
+ The label names the setting ("Email alerts") and stays the same in both states; the switch shows
87
+ whether it is on. Do not write "Enable" or "On/Off" into the label.
88
+
89
+ ## Not in scope
90
+
91
+ A toggle button (`Toggle`), a setting that needs a save step (`Checkbox` in a form), switch cards
92
+ (`ChoiceCards`).
package/docs/table.md ADDED
@@ -0,0 +1,87 @@
1
+ # Table
2
+
3
+ Semantic table parts with row fills, numeric alignment, a sticky header, footer totals and density from a token.
4
+
5
+ Markup only, built on `renderElement`, so every part takes `render` and `className` and carries a `data-slot`. Sorting, filtering, selection and pagination belong to DataTable; Table is what it renders.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import {
11
+ Table,
12
+ TableBody,
13
+ TableCaption,
14
+ TableCell,
15
+ TableHead,
16
+ TableHeader,
17
+ TableRow,
18
+ } from "@eodparks/ui/table";
19
+
20
+ <Table>
21
+ <TableCaption>Bookings this week</TableCaption>
22
+ <TableHeader>
23
+ <TableRow>
24
+ <TableHead>Name</TableHead>
25
+ <TableHead numeric>Amount</TableHead>
26
+ </TableRow>
27
+ </TableHeader>
28
+ <TableBody>
29
+ <TableRow>
30
+ <TableCell>Harbour deck</TableCell>
31
+ <TableCell numeric>$1,200.00</TableCell>
32
+ </TableRow>
33
+ </TableBody>
34
+ </Table>;
35
+ ```
36
+
37
+ ## Parts
38
+
39
+ | Part | Element | Notes |
40
+ | -------------- | --------- | ------------------------------------------------------------- |
41
+ | `Table` | `table` | wrapped in a scroll container; `render` changes the `table` |
42
+ | `TableHeader` | `thead` | |
43
+ | `TableBody` | `tbody` | |
44
+ | `TableFooter` | `tfoot` | muted fill, medium weight, for totals |
45
+ | `TableRow` | `tr` | hover fill; `selected` adds the selected fill |
46
+ | `TableHead` | `th` | `scope="col"` by default; pass `scope="row"` for a row header |
47
+ | `TableCell` | `td` | |
48
+ | `TableCaption` | `caption` | under the table, caption text style |
49
+
50
+ ## Props
51
+
52
+ | Prop | On | Notes |
53
+ | -------------------- | ------------------------ | -------------------------------------------------------------------------------- |
54
+ | `stickyHeader` | `Table` | header cells stick to the top of the scroll container |
55
+ | `containerClassName` | `Table` | classes of the scroll container; give it a max height for a sticky header |
56
+ | `scrollLabel` | `Table` | makes the container a labelled region and a tab stop so arrow keys can scroll it |
57
+ | `numeric` | `TableHead`, `TableCell` | end aligned with tabular figures |
58
+ | `selected` | `TableRow` | fills the row and sets `data-selected` |
59
+
60
+ ## Variants
61
+
62
+ | Variant | How |
63
+ | ----------------- | ------------------------------------------------------- |
64
+ | default | 16px cell padding from `--table-cell-py` |
65
+ | compact density | `data-density="compact"` on any ancestor, 6px padding |
66
+ | sticky header | `stickyHeader` and a max height on `containerClassName` |
67
+ | footer totals | `TableFooter` after `TableBody` |
68
+ | numeric alignment | `numeric` on the head and the cells of a column |
69
+
70
+ ## States
71
+
72
+ | State | Source |
73
+ | ------------ | ---------------------------------------------------------------- |
74
+ | row hover | `hover:` fill on `TableRow`, so touch and keyboard see no change |
75
+ | selected row | `selected` on `TableRow` |
76
+
77
+ ## Accessibility
78
+
79
+ Every column has a `th` with `scope="col"`, and a first column that names the row is a `th` with `scope="row"`. A table has a `TableCaption` or an `aria-label`. A table wider or taller than its box scrolls inside its own container, which `scrollLabel` makes reachable by keyboard. A selected row is a fill only; a plain table has no selection role, so put a checkbox in the row that names it. Row actions are buttons with names that include the row.
80
+
81
+ ## Responsiveness
82
+
83
+ The page never scrolls sideways for a table: the container scrolls. Columns wrap their text, and an unbroken value widens its column inside the container. A table that must stay readable on a phone shows fewer columns, which DataTable does through column visibility.
84
+
85
+ ## Right to left
86
+
87
+ Alignment uses logical values, so `numeric` columns end at the left in right to left pages.
package/docs/tabs.md ADDED
@@ -0,0 +1,96 @@
1
+ # Tabs
2
+
3
+ Switches between related panels that share one place, with one tab selected at a time.
4
+
5
+ `e2e/tabs.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@eodparks/ui/tabs";
11
+
12
+ <Tabs defaultValue="account">
13
+ <TabsList aria-label="Settings">
14
+ <TabsTrigger value="account">Account</TabsTrigger>
15
+ <TabsTrigger value="password">Password</TabsTrigger>
16
+ </TabsList>
17
+ <TabsContent value="account">Manage your profile.</TabsContent>
18
+ <TabsContent value="password">Choose a new password.</TabsContent>
19
+ </Tabs>;
20
+ ```
21
+
22
+ ## Parts
23
+
24
+ | Export | Is |
25
+ | ------------- | ---------------------------------------------------------------- |
26
+ | `Tabs` | wraps `Tabs`; owns the value and the orientation |
27
+ | `TabsList` | the `tablist`; takes `variant` |
28
+ | `TabsTrigger` | one tab, a native `<button>`; icons and `TabsCount` are children |
29
+ | `TabsContent` | the panel of the tab with the same `value` |
30
+ | `TabsCount` | a small number beside a label; read as part of the tab name |
31
+
32
+ shadcn names, unchanged. UI SDK's `TabsTab` and `TabsPanel` stay internal.
33
+
34
+ ## Props
35
+
36
+ | Prop | Type | Default | Notes |
37
+ | ------------------------------------ | ---------------------------- | ------------- | ------------------------------------------------------------- |
38
+ | `value`, `defaultValue` | `string` | first enabled | `""` means no tab selected, never `null` |
39
+ | `onValueChange` | `(value, details) => void` | | `value` is `""` when nothing is selected; never runs on mount |
40
+ | `orientation` | `"horizontal" \| "vertical"` | `horizontal` | sets which arrow keys move |
41
+ | `activation` | `"automatic" \| "manual"` | `automatic` | `manual` selects on Enter or Space |
42
+ | `loop` | `boolean` | `false` | wrap at the ends |
43
+ | `TabsList` `variant` | `"pill" \| "line"` | `pill` | |
44
+ | `TabsTrigger` `value`, `disabled` | | | a disabled tab stays focusable and is never selected |
45
+ | `TabsContent` `value`, `keepMounted` | | | an unselected panel leaves the page unless `keepMounted` |
46
+
47
+ Every part takes `className` and `render`, and carries a `data-slot` (`tabs`, `tabs-list`, `tabs-tab`, `tabs-panel`).
48
+
49
+ ## Variants
50
+
51
+ | Variant | How |
52
+ | ---------- | -------------------------------------------------------------------------------------------------- |
53
+ | pill | `TabsList variant="pill"` (default): muted track, selected tab is a raised fill with a 3:1 border |
54
+ | line | `variant="line"`: a rule under the list and a 2px marker on the selected tab |
55
+ | horizontal | default |
56
+ | vertical | `orientation="vertical"`: the list is a column beside the panel; the marker sits on the start edge |
57
+ | with icon | a lucide icon before the label, `aria-hidden` |
58
+ | with count | `<TabsCount>12</TabsCount>` after the label |
59
+
60
+ Tabs wrap onto a new line when the list is too narrow; for dozens of tabs put the list in a horizontal `ScrollArea`.
61
+
62
+ ## States
63
+
64
+ | State | Source |
65
+ | -------- | --------------------------------------------------------------------- |
66
+ | default | muted label |
67
+ | hover | label turns to the foreground colour; not on a disabled tab |
68
+ | selected | `data-selected`, `aria-selected="true"`; fill (pill) or marker (line) |
69
+ | focus | the library focus ring, on keyboard focus only |
70
+ | disabled | `data-disabled`, `aria-disabled`, half opacity, still focusable |
71
+
72
+ States come from data attributes in the class string, never from JavaScript.
73
+
74
+ ## Keyboard
75
+
76
+ | Where | Key | Result |
77
+ | ------------ | ------------ | -------------------------------------------------------- |
78
+ | outside | Tab | enters the list on the selected tab; the next Tab leaves |
79
+ | list | Left, Right | move and select (vertical: Up, Down); follow `dir` |
80
+ | list | Home, End | first and last tab |
81
+ | list, manual | Enter, Space | select the focused tab |
82
+ | list | Tab | moves into the selected panel |
83
+
84
+ ## Accessibility
85
+
86
+ The list is a `tablist`, each tab controls its panel, each panel is labelled by its tab. UI SDK sets all of it; the library adds no roles. Give every `TabsList` an `aria-label`. An icon-only tab needs its own `aria-label`. 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.
87
+
88
+ ## Copy
89
+
90
+ The library ships no prose. Labels and counts are children.
91
+
92
+ ## Notes
93
+
94
+ An uncontrolled `defaultValue=""` selects the first tab; to start with none, control `value=""`.
95
+
96
+ A field in a panel that is not selected leaves the page and the form. Use `keepMounted` on its `TabsContent` when its value must still submit.