@eodparks/ui 0.0.0-stage → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-Bu72BGjv.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-C-tNDS8C.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
@@ -0,0 +1,55 @@
1
+ # FormActions
2
+
3
+ The Save and Cancel bar of a form: Save waits for a change, shows progress, and the outcome is announced.
4
+
5
+ `e2e/form-actions.spec.ts` is the executable form of this page. It replaces CRM's `FormFooter`.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { FormActions } from "@eodparks/ui/form-actions";
11
+
12
+ <FormActions
13
+ dirty={form.formState.isDirty}
14
+ saving={form.formState.isSubmitting}
15
+ status={saved ? "saved" : failed ? "error" : undefined}
16
+ message={saved ? "Changes saved" : "Could not save. Try again."}
17
+ cancel="Cancel"
18
+ onCancel={() => form.reset()}
19
+ >
20
+ Save changes
21
+ </FormActions>;
22
+ ```
23
+
24
+ Place it inside the `<form>`: Save is a submit button, so Enter in a field presses it.
25
+
26
+ ## Props
27
+
28
+ | Prop | Type | Default | Notes |
29
+ | ---------- | -------------------- | ---------------- | --------------------------------------------------------------------------------------- |
30
+ | `children` | `ReactNode` | `"Save changes"` | the Save label |
31
+ | `dirty` | `boolean` | `true` | `false` disables Save; leave it out for a form with nothing to compare |
32
+ | `saving` | `boolean` | `false` | Save shows its pending state; Cancel is disabled |
33
+ | `status` | `"saved" \| "error"` | | which outcome `message` reports |
34
+ | `message` | `ReactNode` | | the outcome text |
35
+ | `cancel` | `ReactNode` | | the Cancel label; without it there is no Cancel button |
36
+ | `onCancel` | `() => void` | | |
37
+ | `sticky` | `boolean` | `false` | keeps the bar at the bottom of its scroll container; give that container `scroll-pb-20` |
38
+
39
+ ## States
40
+
41
+ | State | Look |
42
+ | ------ | -------------------------------------------------------------------------------------- |
43
+ | clean | Save disabled with `aria-disabled`, still in the tab order so it can be explained |
44
+ | dirty | Save enabled |
45
+ | saving | Save keeps its label and shows the spinner; presses are ignored; focus stays |
46
+ | saved | the message in a polite live region |
47
+ | error | the message in an assertive live region; Save is enabled again so the person can retry |
48
+
49
+ ## Copy
50
+
51
+ Save says what is saved ("Save changes", "Create booking"). A saved message names the result, an error says what to do next. The library ships no toast: `status` and `message` are the inline confirmation, and an app may add a toast.
52
+
53
+ ## Accessibility
54
+
55
+ Target: WCAG 2.2 AA. Both live regions exist before their text does, so a screen reader announces it. Tab order is Cancel, then Save. A sticky bar can cover a control that takes focus, so the scroll container needs `scroll-pb-20` (more than the bar's height); the browser then scrolls the control clear of it. The bar aligns to the end edge and mirrors in right to left.
@@ -0,0 +1,42 @@
1
+ # FormikField
2
+
3
+ Maps a Formik field onto a `Field`: label, control, description and error in one component.
4
+
5
+ Import from `@eodparks/ui/forms/formik`. `formik` is an optional peer. `e2e/forms-formik.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { FormikField } from "@eodparks/ui/forms/formik";
11
+ import { Input } from "@eodparks/ui/input";
12
+
13
+ <Formik initialValues={{ name: "" }} validationSchema={schema} onSubmit={save}>
14
+ {(formik) => (
15
+ <form noValidate onSubmit={formik.handleSubmit}>
16
+ <FormikField name="name" label="Name" description="Shown on your profile.">
17
+ <Input />
18
+ </FormikField>
19
+ </form>
20
+ )}
21
+ </Formik>;
22
+ ```
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Notes |
27
+ | ------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------- |
28
+ | `name` | `string` | the Formik field |
29
+ | `label` | `ReactNode` | the `FieldLabel` |
30
+ | `description` | `ReactNode` | the `FieldDescription` |
31
+ | `required` | `boolean` | shows the label mark through `aria-required`; the schema stays the validator |
32
+ | `orientation` | `"vertical" \| "horizontal"` | as `Field` |
33
+ | `disabled` | `boolean` | as `Field` |
34
+ | `children` | one element, or `(control) => node` | the element gets `name`, `value`, `onValueChange` and `onBlur`; the function gets those and `invalid` |
35
+
36
+ ## Error timing
37
+
38
+ Formik validates as the value changes. The message shows once the field was left (`touched`) and then follows the value. Pass `noValidate` to the form so native `required` does not block the submit. A failed submit marks every field touched, so every error shows. After a failed submit, focus moves to the first invalid control, as the react-hook-form bridge does.
39
+
40
+ ## Accessibility
41
+
42
+ Target: WCAG 2.2 AA. The label names the control, the description and message are in `aria-describedby`, and an invalid control has `aria-invalid`, all through `Field`.
@@ -0,0 +1,64 @@
1
+ # Form (react-hook-form)
2
+
3
+ The shadcn form parts on react-hook-form, so CRM's form files keep their shape.
4
+
5
+ Import from `@eodparks/ui/forms/rhf`. `react-hook-form` is an optional peer. `e2e/forms-rhf.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import {
11
+ Form,
12
+ FormControl,
13
+ FormDescription,
14
+ FormField,
15
+ FormItem,
16
+ FormLabel,
17
+ FormMessage,
18
+ } from "@eodparks/ui/forms/rhf";
19
+ import { Input } from "@eodparks/ui/input";
20
+
21
+ const form = useForm({ resolver, mode: "onTouched", defaultValues: { name: "" } });
22
+
23
+ <Form {...form}>
24
+ <form noValidate onSubmit={form.handleSubmit(save)}>
25
+ <FormField
26
+ control={form.control}
27
+ name="name"
28
+ render={({ field }) => (
29
+ <FormItem>
30
+ <FormLabel>Name</FormLabel>
31
+ <FormControl>
32
+ <Input {...field} />
33
+ </FormControl>
34
+ <FormDescription>Shown on your profile.</FormDescription>
35
+ <FormMessage />
36
+ </FormItem>
37
+ )}
38
+ />
39
+ </form>
40
+ </Form>;
41
+ ```
42
+
43
+ ## Parts
44
+
45
+ | Export | Is |
46
+ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
47
+ | `Form` | `FormProvider` |
48
+ | `FormField` | a `Controller` that also passes its `ref` to `FormControl`, so focus-on-error reaches any control |
49
+ | `FormItem` | the wrapper, `orientation` `"vertical"` or `"horizontal"`, same layout as `Field`; `required` marks the label and sets `aria-required` on the control |
50
+ | `FormLabel` | a `Label` for the control; `optional` shows its mark, and `required` follows the `FormItem` |
51
+ | `FormControl` | exactly one child; injects `id`, `aria-describedby`, `aria-invalid`, `ref` and `disabled` |
52
+ | `FormDescription` | help text, in the control's description |
53
+ | `FormMessage` | the field's error (or its children), `role="alert"`, in the control's description |
54
+ | `useFormField` | the ids and the field state, for a custom part |
55
+
56
+ No `Slot` and no `asChild`. What `FormControl` injects wins over what the child set, except `aria-describedby`, which keeps the child's own ids. It does not use `Field`, so a child never gets two sets of label references.
57
+
58
+ ## Error timing
59
+
60
+ Use `mode: "onTouched"`: nothing is validated while the person types the first time, the message shows after the field was left, and it follows the value afterwards. A failed submit shows every error and focuses the first invalid control, including Select, Checkbox and Switch, because the Controller's ref reaches them. Keep `noValidate` on the form so the schema is the only validator.
61
+
62
+ ## Accessibility
63
+
64
+ Target: WCAG 2.2 AA. The label names the control and pressing it focuses it. The description and the message are in `aria-describedby`, the message is announced when it appears, and an invalid control has `aria-invalid`. Tab order is DOM order.
@@ -0,0 +1,84 @@
1
+ # IconButton
2
+
3
+ A Button that holds only an icon, names it with a required `aria-label` and shows that name as a tooltip.
4
+
5
+ `e2e/icon-button.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { IconButton } from "@eodparks/ui/icon-button";
11
+
12
+ <IconButton variant="ghost" aria-label="Delete booking" onClick={remove}>
13
+ <TrashIcon />
14
+ </IconButton>;
15
+ ```
16
+
17
+ As a popup trigger, pass it to `render`:
18
+
19
+ ```tsx
20
+ <DropdownMenuTrigger
21
+ render={
22
+ <IconButton variant="ghost" aria-label="Row actions">
23
+ <EllipsisIcon />
24
+ </IconButton>
25
+ }
26
+ />
27
+ ```
28
+
29
+ ## Parts
30
+
31
+ | Export | Is |
32
+ | ----------------- | ------------------------------------------------------------------------------------- |
33
+ | `IconButton` | a `Button` with an icon size, rendered as the trigger of a `Tooltip` showing its name |
34
+ | `IconButtonProps` | `ButtonProps` with `aria-label` required and `size` limited to the icon sizes |
35
+
36
+ ## Props
37
+
38
+ | Prop | Type | Default | Notes |
39
+ | ------------ | ---------------------------------- | ----------- | -------------------------------------------------------------------- |
40
+ | `aria-label` | `string` | required | the accessible name and the tooltip text |
41
+ | `size` | `"icon" \| "icon-sm" \| "icon-xs"` | `"icon"` | squares of `--control-h`, `--control-h-sm` and 1.5rem |
42
+ | `variant` | the `Button` variants but `link` | `"default"` | same looks as `Button` |
43
+ | `children` | a `lucide-react` icon | | drawn at 16px in `currentColor` and hidden from assistive technology |
44
+
45
+ Everything else is `Button`'s: `disabled`, `focusableWhenDisabled`, `pending`, `onClick`, `type`,
46
+ `render`, `ref`.
47
+
48
+ ## Variants
49
+
50
+ The `Button` variants `default`, `secondary`, `outline`, `ghost` and `destructive`, with the same
51
+ looks. `link` is left out: its hover is an underline, which an icon cannot show. A toolbar or a
52
+ table row usually wants `ghost` or `outline`.
53
+
54
+ ## States
55
+
56
+ | State | Look |
57
+ | ------------- | ------------------------------------------------------------------------------- |
58
+ | hover | the variant's hover fill, and the tooltip after the delay |
59
+ | active | same as hover |
60
+ | focus-visible | the focus ring, and the tooltip at once |
61
+ | disabled | dimmed; stays focusable and keeps its tooltip, so the action can still be named |
62
+ | pending | the spinner replaces the icon; focus and tooltip stay |
63
+
64
+ ## Naming
65
+
66
+ The icon shows a thing (`TrashIcon`, `PencilIcon`); the `aria-label` names the action ("Delete
67
+ booking", "Edit booking"). Pick the icon for what it draws, never for one screen's use of it.
68
+
69
+ ## Copy
70
+
71
+ The `aria-label` is a verb and an object, short enough for a one-line tooltip. The library ships no
72
+ prose.
73
+
74
+ ## Accessibility
75
+
76
+ Target: WCAG 2.2 AA. TypeScript rejects an `IconButton` with no `aria-label`. The tooltip is the
77
+ trigger's label rather than its description, so a screen reader hears the name once. Disabled and
78
+ pending buttons keep their tab stop and tooltip. Every size is at least 24 by 24 CSS pixels.
79
+ Screen reader checks (VoiceOver with Safari, NVDA with Chrome) are manual.
80
+
81
+ ## Not in scope
82
+
83
+ A visible label (use `Button`), a toggle state (`Toggle`) and a hint that differs from the name
84
+ (use `Tooltip` with `Button`).
package/docs/icon.md ADDED
@@ -0,0 +1,77 @@
1
+ # Icon
2
+
3
+ Draws one `lucide-react` icon at 16, 20 or 24 pixels, hidden from assistive technology unless it has a label.
4
+
5
+ `e2e/icon.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Icon } from "@eodparks/ui/icon";
11
+ import { CheckIcon, TrashIcon } from "lucide-react";
12
+
13
+ <Icon icon={CheckIcon} />
14
+ <Icon icon={TrashIcon} size={20} label="Delete booking" />
15
+ <Icon icon={CheckIcon} className="text-success" />
16
+ ```
17
+
18
+ ## Props
19
+
20
+ | Prop | Type | Default | Notes |
21
+ | ----------- | ----------------- | ------- | ------------------------------------------------------------------- |
22
+ | `icon` | `LucideIcon` | | the icon component; required |
23
+ | `size` | `16 \| 20 \| 24` | `16` | a `rem` size, so the icon follows the browser font size |
24
+ | `label` | `string` | | names the icon (`role="img"`); without it the icon is `aria-hidden` |
25
+ | `className` | `string` | | merged last with `cn`; set colour here with a text utility |
26
+ | `ref` | `Ref<SVGElement>` | | a plain React 19 prop |
27
+
28
+ Every other SVG attribute passes through, `strokeWidth` included. `role`, `aria-label` and
29
+ `aria-hidden` are not accepted: `label` decides all three.
30
+
31
+ The element carries `data-slot="icon"` and `data-size`.
32
+
33
+ ## Sizes
34
+
35
+ | Size | Class | Use |
36
+ | ---- | -------- | ---------------------------------------------------------------- |
37
+ | 16 | `size-4` | inside controls and beside `small` and `label` text; the default |
38
+ | 20 | `size-5` | beside `body` text, list rows, alerts |
39
+ | 24 | `size-6` | beside titles, empty states, standalone marks |
40
+
41
+ Every size draws the same 24 unit grid, so no icon loses detail between sizes. There is no size
42
+ under 16.
43
+
44
+ ## Style
45
+
46
+ One family only: lucide outline icons, stroke width 2 on the 24 grid, round caps and joins, no
47
+ fill. Do not change `strokeWidth` for one icon; a heavier or lighter icon beside the others
48
+ reads as a different set. Do not mix in filled icons, emoji or images.
49
+
50
+ ## Colour
51
+
52
+ An icon takes the text colour around it (`currentColor`). Set another colour with a text
53
+ utility on the icon or its parent: `text-muted-foreground`, `text-destructive`. One flat
54
+ colour, never a gradient. An icon that carries meaning without text needs 3:1 against its
55
+ surface; every theme text colour meets that.
56
+
57
+ ## Naming
58
+
59
+ Import an icon by its lucide name with the `Icon` suffix (`TrashIcon`, `CalendarIcon`). The
60
+ name says what the icon shows, not what one screen uses it for: `TrashIcon`, not `DeleteIcon`.
61
+ Do not re-export icons under new names.
62
+
63
+ ## Accessibility
64
+
65
+ Target: WCAG 2.2 AA. An icon next to text that says the same thing is decorative: give it no
66
+ `label`. An icon that is the only content of a control, or that carries meaning alone, needs a
67
+ `label`; it then has the role `img` and that name. In a button the label names the button.
68
+ Prefer `IconButton` for an icon-only button: its type requires the name.
69
+
70
+ ## Direction
71
+
72
+ Icons do not mirror by themselves. A directional icon (an arrow or chevron that means next or
73
+ back) takes `className="rtl:-scale-x-100"`. Icons that show an object keep their shape.
74
+
75
+ ## Not in scope
76
+
77
+ Icon-only buttons (`IconButton`), loading indicators (`Spinner`), brand logos and illustrations.
@@ -0,0 +1,47 @@
1
+ # InputGroup
2
+
3
+ Puts an icon, text or button beside an input inside one border.
4
+
5
+ Wraps the group of `@ui-sdk/react/input`. The group draws the border and the focus ring; the input inside draws none. `e2e/input-group.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Input, InputClear } from "@eodparks/ui/input";
11
+ import { InputGroup, InputGroupAddon } from "@eodparks/ui/input-group";
12
+ import { SearchIcon } from "lucide-react";
13
+
14
+ <InputGroup>
15
+ <InputGroupAddon>
16
+ <SearchIcon aria-hidden="true" />
17
+ </InputGroupAddon>
18
+ <Input aria-label="Search" />
19
+ </InputGroup>
20
+
21
+ <InputGroup>
22
+ <InputGroupAddon>https://</InputGroupAddon>
23
+ <Input aria-label="Website" />
24
+ <InputGroupAddon>.com</InputGroupAddon>
25
+ </InputGroup>
26
+ ```
27
+
28
+ ## Parts
29
+
30
+ | Export | Is |
31
+ | ----------------- | ------------------------------------------------------------------------------------ |
32
+ | `InputGroup` | the bordered box; `size` is `"sm" \| "default" \| "lg"` |
33
+ | `InputGroupAddon` | a `span` for an icon or text, before or after the input by its place in the children |
34
+
35
+ A button inside the group is a `Button` of `variant="ghost"` and `size="icon-xs"`, and `InputClear` from `@eodparks/ui/input` empties the input. Pressing addon text focuses the input.
36
+
37
+ ## Look
38
+
39
+ Same box as Input: `border-input`, `bg-background`, `rounded-control`. Focus on the input draws the two-layer ring on the group; a focused button draws its own. An `aria-invalid` input turns the group border `border-destructive`; a disabled input dims the group. The addon is `text-muted-foreground`, icons are 16px and `aria-hidden`.
40
+
41
+ ## Data format
42
+
43
+ The addon text is display only and is not part of the submitted value. Say the unit or prefix in the addon and keep the input's own name for the value.
44
+
45
+ ## Accessibility
46
+
47
+ Target: WCAG 2.2 AA. The input keeps its own name; an icon addon is decoration. A button addon needs an accessible name and is at least 24 by 24 pixels. Tab goes from the input to the button.
package/docs/input.md ADDED
@@ -0,0 +1,46 @@
1
+ # Input
2
+
3
+ A single-line text field in three sizes, with an optional clear button.
4
+
5
+ Wraps `@ui-sdk/react/input`. `e2e/input.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Input, InputClear } from "@eodparks/ui/input";
11
+
12
+ <Input aria-label="Search" placeholder="Search bookings" clearable clearLabel="Clear search" />
13
+ <Input type="email" autoComplete="email" size="lg" />
14
+ ```
15
+
16
+ Put an Input in a `Field` for a visible label, description and error. Without a Field, give it an `aria-label`.
17
+
18
+ ## Props
19
+
20
+ | Prop | Type | Default | Notes |
21
+ | ---------------------------------------- | --------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22
+ | `size` | `"sm" \| "default" \| "lg"` | `"default"` | height is `--control-h-sm`, `--control-h` or `--control-h-lg`, so it follows density |
23
+ | `clearable` | `boolean` | `false` | wraps the input in a box with a button that shows only while there is text; a string `className` then styles the box, a function `className` still styles the input |
24
+ | `clearLabel` | `string` | `"Clear"` | the accessible name of the clear button |
25
+ | `value`, `defaultValue`, `onValueChange` | | | UI SDK's value contract: `onValueChange(value, details)`; native `onChange` also works |
26
+
27
+ Everything else passes to the native `<input>`: `type`, `name`, `placeholder`, `autoComplete`, `inputMode`, `required`, `disabled`, `readOnly`, `aria-*`. No `asChild`.
28
+
29
+ ## States
30
+
31
+ | State | Source | Look |
32
+ | ------------- | ------------------------------------------ | ----------------------------------------- |
33
+ | hover | `:hover`, valid and enabled only | `border-muted-foreground` |
34
+ | placeholder | `placeholder` | `text-muted-foreground` |
35
+ | focus-visible | `:focus-visible` | `focusRing`, two layers |
36
+ | invalid | `aria-invalid` or a Field's `data-invalid` | `border-destructive` |
37
+ | disabled | `disabled` | `opacity-50`, `cursor-not-allowed` |
38
+ | read-only | `readOnly` | `bg-muted`, still focusable and submitted |
39
+
40
+ ## Data format
41
+
42
+ Choose the type that fits the value: `type="email"`, `type="tel"` with `inputMode="numeric"`, `autoComplete` for known fields. The field does not reformat what is typed.
43
+
44
+ ## Accessibility
45
+
46
+ Target: WCAG 2.2 AA. A native text input named by its Field label or an `aria-label`. Text and placeholder meet 4.5:1, the invalid border and focus ring 3:1, in both themes. The clear button is a native button of at least 24 by 24 pixels with its own name, and returns focus to the input.
package/docs/label.md ADDED
@@ -0,0 +1,33 @@
1
+ # Label
2
+
3
+ Names a control with visible text, and can mark it required or optional.
4
+
5
+ Wraps `@ui-sdk/react/label`, which renders a native `<label>`. Inside a Field use `FieldLabel`, which also ties the description and error to the control. `e2e/label.spec.ts` is the executable form of this page.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { Label } from "@eodparks/ui/label";
11
+
12
+ <Label htmlFor="email" required>Email</Label>
13
+ <Label htmlFor="nickname" optional>Nickname</Label>
14
+ ```
15
+
16
+ ## Props
17
+
18
+ | Prop | Type | Default | Notes |
19
+ | -------------- | ----------------------------- | ------------ | ------------------------------------------------------------------------------- |
20
+ | `htmlFor` | `string` | | the `id` of the control; UI SDK also names controls a native label cannot |
21
+ | `required` | `boolean` | `false` | shows a `*` hidden from assistive technology; put `required` on the control too |
22
+ | `optional` | `boolean` | `false` | shows the optional text after the label, and it is part of the name |
23
+ | `optionalText` | `string` | `"optional"` | the text in the parentheses |
24
+ | `disabled` | `boolean` | `false` | dims the label and shows `not-allowed`; set it with the control |
25
+ | `className` | `string \| (state) => string` | | merged last |
26
+
27
+ ## Look
28
+
29
+ Text style `label` (14px on 20px, weight 500). The mark is `text-destructive`; the optional text is `text-muted-foreground`. A label with no `htmlFor` and no control inside names nothing, and UI SDK warns in development.
30
+
31
+ ## Accessibility
32
+
33
+ Target: WCAG 2.2 AA. The label names its control and a press on it focuses the control. The required mark is decoration; the control's own `required` is what assistive technology reads. Label text and the mark meet 4.5:1 in both themes.
package/docs/layout.md ADDED
@@ -0,0 +1,102 @@
1
+ # Spacing and layout
2
+
3
+ One spacing scale on a 4px base, gap-based layout, a 4, 8 and 12 column grid on Tailwind's breakpoints, and a compact density.
4
+
5
+ `e2e/layout.spec.ts` is the executable form of this page. These are rules for library
6
+ components and for app screens; there is nothing to import.
7
+
8
+ ## Spacing scale
9
+
10
+ Tailwind's default scale, one unit is `0.25rem` (4px). The theme does not set `--spacing`.
11
+ Use these steps and no arbitrary values (`p-[13px]`):
12
+
13
+ | Step | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 6 | 8 | 12 | 16 | 24 |
14
+ | ----- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
15
+ | Pixel | 2 | 4 | 6 | 8 | 12 | 16 | 24 | 32 | 48 | 64 | 96 |
16
+
17
+ Steps 0.5 and 1.5 exist for optical fixes inside a component (an icon beside text, a label over
18
+ its field). Layout never uses them.
19
+
20
+ ## Spacing tokens
21
+
22
+ Spacing that has a purpose and must change in one place is a token. Everything else is a scale
23
+ step in the component.
24
+
25
+ | Token | Purpose |
26
+ | ------------------------------------------------- | --------------------------------------------- |
27
+ | `--control-h-sm`, `--control-h`, `--control-h-lg` | height of buttons, inputs and select triggers |
28
+ | `--table-cell-py` | vertical padding of table cells |
29
+ | `--focus-ring-width`, `--focus-ring-offset` | size of the focus ring and its gap |
30
+
31
+ Use them as `h-(--control-h)` and `py-(--table-cell-py)`. A new spacing token follows the rule
32
+ in the tokens README: more than one component needs it, or it changes with density.
33
+
34
+ ## Component and layout spacing
35
+
36
+ | Where | Steps | Example |
37
+ | ------------------------------------------------------------------- | ------------------- | -------------------------------------------- |
38
+ | inside a component (icon to text, label to field, items of a group) | 1 to 4 | `gap-2` in a button, `gap-1.5` under a label |
39
+ | padding of a surface (card, dialog, popover) | 4 or 6 | `p-6` on a card, `p-4` on a compact one |
40
+ | between components in a group (fields of a form, cards in a grid) | 4 or 6 | `gap-4` |
41
+ | between sections of a page | 8 or 12 | `gap-8` |
42
+ | page gutter | 4, then 6 from `sm` | `px-4 sm:px-6` |
43
+
44
+ A component sets the space inside itself and none outside: no outer margin. The parent places
45
+ it with `gap`.
46
+
47
+ ## Gap, not margins
48
+
49
+ Lay out with `flex` or `grid` and `gap`. Do not use `space-y-*`, `space-x-*`, `divide-y` or
50
+ `*:` selectors on a container that can hold a popup: an open popup renders in place, so those
51
+ selectors reach it and move it. Use logical utilities so layouts mirror in right to left:
52
+ `ps-*`, `pe-*`, `ms-*`, `me-*`, `start-*`, `end-*`, `text-start`, `text-end`.
53
+
54
+ ## Column grid
55
+
56
+ | From | Columns | Gutter | Page margin |
57
+ | ------------- | ------- | -------------- | ----------- |
58
+ | base | 4 | 16px (`gap-4`) | 16px |
59
+ | `md` (768px) | 8 | 16px | 24px |
60
+ | `lg` (1024px) | 12 | 24px (`gap-6`) | 24px |
61
+
62
+ ```tsx
63
+ <div className="grid grid-cols-4 gap-4 md:grid-cols-8 lg:grid-cols-12 lg:gap-6">
64
+ <main className="col-span-4 md:col-span-8">...</main>
65
+ <aside className="col-span-4">...</aside>
66
+ </div>
67
+ ```
68
+
69
+ Page content is at most `max-w-6xl` wide unless it is a data table.
70
+
71
+ ## Breakpoints
72
+
73
+ Tailwind's defaults, shared by the library and both apps. Styles are written mobile first: the
74
+ bare utility is the small screen, a prefix adds from that width up.
75
+
76
+ | Name | From |
77
+ | ----- | ------ |
78
+ | `sm` | 640px |
79
+ | `md` | 768px |
80
+ | `lg` | 1024px |
81
+ | `xl` | 1280px |
82
+ | `2xl` | 1536px |
83
+
84
+ ## Density
85
+
86
+ `data-density="compact"` on any ancestor shrinks control heights one step and table rows to
87
+ 6px of padding. The default is comfortable. There are no per-component compact variants.
88
+
89
+ | Token | Default | Compact |
90
+ | ----------------- | ------- | ------- |
91
+ | `--control-h-sm` | 36px | 32px |
92
+ | `--control-h` | 40px | 36px |
93
+ | `--control-h-lg` | 44px | 40px |
94
+ | `--table-cell-py` | 16px | 6px |
95
+
96
+ Use compact for dense data screens (reports, point of sale lists). A popup opened from a
97
+ compact region is compact too, because it renders in place.
98
+
99
+ ## Baseline
100
+
101
+ Control heights and every text line height are multiples of 4px in both densities, so rows of
102
+ text and controls stack on the scale. Compact table padding (6px) is the one half step.
package/docs/llms.txt ADDED
@@ -0,0 +1,72 @@
1
+ # @eodparks/ui
2
+
3
+ > Shared React 19 components for EOD apps, styled with Tailwind v4 and the @eodparks/tokens theme. This file is generated for this release.
4
+
5
+ Each component has its own entry. There is no root import:
6
+
7
+ ```tsx
8
+ import { Button } from "@eodparks/ui/button";
9
+ ```
10
+
11
+ The app stylesheet starts with these three lines, in this order:
12
+
13
+ ```css
14
+ @import "@eodparks/ui/layer.css";
15
+ @import "tailwindcss";
16
+ @import "@eodparks/ui/styles.css";
17
+ ```
18
+
19
+ Rules: change a part's element with `render` (there is no `asChild`); name every control; use theme utilities, never hex values or raw palette classes; lay out containers that can hold a popup with `gap`, not `space-y-*` or `divide-y`; do not import `@ui-sdk/*` in an app.
20
+
21
+ ## Components
22
+
23
+ - [Accessibility baseline](./accessibility.md): What every component meets before it merges: WCAG 2.2 AA, one focus ring, contrast floors, standard keys, names on every control, and the checks that prove each.
24
+ - [Accordion](./accordion.md): Shows and hides sections of content from their headings, one at a time or several at once. Import from `@eodparks/ui/accordion`.
25
+ - [Alert](./alert.md): Tells people what happened and what to do next, with an icon and a colour for the type. Import from `@eodparks/ui/alert`.
26
+ - [Alert dialog](./alert-dialog.md): Asks a question that must be answered before an action continues, such as confirming a delete, built on UI SDK `alert-dialog` with shadcn-compatible part names. Import from `@eodparks/ui/alert-dialog`.
27
+ - [Avatar](./avatar.md): Shows a person or a team as an image, with initials or an icon while it loads or when it fails. Import from `@eodparks/ui/avatar`.
28
+ - [Badge](./badge.md): Marks a status, a count or an unread dot, in the standard intent colours. Import from `@eodparks/ui/badge`.
29
+ - [Button](./button.md): Runs an action, shows that it is working, and stays reachable when disabled. Import from `@eodparks/ui/button`.
30
+ - [Calendar](./calendar.md): 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. Import from `@eodparks/ui/calendar`.
31
+ - [Card](./card.md): Groups related content on one raised surface, optionally as a single link. Import from `@eodparks/ui/card`.
32
+ - [Chart](./chart.md): Recharts 3 charts on the chart tokens, with a labelled container, a tooltip, a legend, and loading and empty states. Import from `@eodparks/ui/chart`.
33
+ - [Checkbox](./checkbox.md): A box that turns one option on or off, alone or in a group with a select-all parent. Import from `@eodparks/ui/checkbox`.
34
+ - [Collapsible](./collapsible.md): Shows and hides one panel from a trigger, keeping its content and animating its height. Import from `@eodparks/ui/collapsible`.
35
+ - [Command](./command.md): 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. Import from `@eodparks/ui/command`.
36
+ - [DatePicker](./date-picker.md): Type a date or pick one from a calendar popup, for one date or a range, with presets and ISO string values. Import from `@eodparks/ui/date-picker`.
37
+ - [Dialog](./dialog.md): A modal window that holds one focused task over the page, built on UI SDK `dialog` with shadcn-compatible part names. Import from `@eodparks/ui/dialog`.
38
+ - [DropdownMenu](./dropdown-menu.md): Lists actions and settings in a popup menu that opens from a button, with the shadcn part names and a UI SDK Menu underneath. Import from `@eodparks/ui/dropdown-menu`.
39
+ - [EmptyState](./empty-state.md): An icon, a title, a description and one action for a screen, card or table that has nothing to show, in three variants. Import from `@eodparks/ui/empty-state`.
40
+ - [ErrorState](./error-state.md): An announced error for a page, a section or a form, with an optional error id and retry, and an ErrorBoundary fallback. Import from `@eodparks/ui/error-state`.
41
+ - [Field](./field.md): Connects a control to its label, description and error, vertical or horizontal. Import from `@eodparks/ui/field`.
42
+ - [FormActions](./form-actions.md): The Save and Cancel bar of a form: Save waits for a change, shows progress, and the outcome is announced. Import from `@eodparks/ui/form-actions`.
43
+ - [FormikField](./forms/formik.md): Maps a Formik field onto a `Field`: label, control, description and error in one component. Import from `@eodparks/ui/forms/formik`.
44
+ - [Form (react-hook-form)](./forms/rhf.md): The shadcn form parts on react-hook-form, so CRM's form files keep their shape. Import from `@eodparks/ui/forms/rhf`.
45
+ - [Icon](./icon.md): Draws one `lucide-react` icon at 16, 20 or 24 pixels, hidden from assistive technology unless it has a label. Import from `@eodparks/ui/icon`.
46
+ - [IconButton](./icon-button.md): A Button that holds only an icon, names it with a required `aria-label` and shows that name as a tooltip. Import from `@eodparks/ui/icon-button`.
47
+ - [Input](./input.md): A single-line text field in three sizes, with an optional clear button. Import from `@eodparks/ui/input`.
48
+ - [InputGroup](./input-group.md): Puts an icon, text or button beside an input inside one border. Import from `@eodparks/ui/input-group`.
49
+ - [Label](./label.md): Names a control with visible text, and can mark it required or optional. Import from `@eodparks/ui/label`.
50
+ - [Spacing and layout](./layout.md): One spacing scale on a 4px base, gap-based layout, a 4, 8 and 12 column grid on Tailwind's breakpoints, and a compact density.
51
+ - [NativeSelect](./native-select.md): The browser's own `<select>`, styled like `SelectTrigger`, for short static lists and Formik fields. Import from `@eodparks/ui/native-select`.
52
+ - [PageHeader](./page-header.md): The page's single h1 with a description, a back link or breadcrumb, actions and a tabs slot. Import from `@eodparks/ui/page-header`.
53
+ - [Pagination](./pagination.md): Moves between pages of results with numbered links, steps, a page-size select and a total. Import from `@eodparks/ui/pagination`.
54
+ - [PasswordInput](./password-input.md): A password field with a toggle that shows or hides what is typed. Import from `@eodparks/ui/password-input`.
55
+ - [Popover](./popover.md): Shows a small panel of related content or controls beside its trigger, with the shadcn part names and a UI SDK Popover underneath. Import from `@eodparks/ui/popover`.
56
+ - [Progress](./progress.md): Shows how far a task has come, or that it is working when the end is unknown. Import from `@eodparks/ui/progress`.
57
+ - [RadioGroup](./radio-group.md): One choice from a short list, with one tab stop for the group and arrow keys between options. Import from `@eodparks/ui/radio-group`.
58
+ - [ScrollArea](./scroll-area.md): Native scrolling with styled scrollbars, edge marks and a follow-to-end mode. Import from `@eodparks/ui/scroll-area`.
59
+ - [Select](./select.md): Choose one value or several from a popup list, with the shadcn part names and a UI SDK Select underneath. Import from `@eodparks/ui/select`.
60
+ - [Separator](./separator.md): Divides groups of content with a horizontal or vertical line, optionally labelled. Import from `@eodparks/ui/separator`.
61
+ - [Sheet](./sheet.md): 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. Import from `@eodparks/ui/sheet`.
62
+ - [Skeleton](./skeleton.md): Holds the shape of content that is loading, with a quiet pulse. Import from `@eodparks/ui/skeleton`.
63
+ - [Spinner](./spinner.md): Shows that something is loading, in three sizes, inline or centred, with an accessible label. Import from `@eodparks/ui/spinner`.
64
+ - [Switch](./switch.md): Turns a setting on or off at once, with a thumb that slides along a track. Import from `@eodparks/ui/switch`.
65
+ - [Table](./table.md): Semantic table parts with row fills, numeric alignment, a sticky header, footer totals and density from a token. Import from `@eodparks/ui/table`.
66
+ - [Tabs](./tabs.md): Switches between related panels that share one place, with one tab selected at a time. Import from `@eodparks/ui/tabs`.
67
+ - [Textarea](./textarea.md): A multi-line text field that is fixed, grows with its text, or shows a character count. Import from `@eodparks/ui/textarea`.
68
+ - [ThemeToggle](./theme-toggle.md): An icon button that opens a menu to choose the light, dark or system theme, controlled by the app. Import from `@eodparks/ui/theme-toggle`.
69
+ - [Toast](./toast.md): A short message at a corner of the window that confirms an action or reports an event, with sonner's call shape and the library's look. Import from `@eodparks/ui/toast`.
70
+ - [Tooltip](./tooltip.md): Names a control or adds a short hint when the pointer rests on it or keyboard focus reaches it, with the shadcn part names and a UI SDK Tooltip underneath. Import from `@eodparks/ui/tooltip`.
71
+ - [Typography](./typography.md): Seven text styles named for their role, as a `Text` component and as class recipes for other components. Import from `@eodparks/ui/typography`.
72
+ - [VisuallyHidden](./visually-hidden.md): Keeps text out of sight and in the accessibility tree, for a name or a heading that only assistive technology needs. Import from `@eodparks/ui/visually-hidden`.