@namroodinc/liquid-editorial 0.3.2 → 0.3.3

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 (52) hide show
  1. package/README.md +1562 -177
  2. package/UPGRADING.md +70 -0
  3. package/dist/chunks/{ColourField-C2YDshDg.js → ColourField-Bd4twbaG.js} +128 -135
  4. package/dist/chunks/ColourField-Bd4twbaG.js.map +1 -0
  5. package/dist/chunks/ColourField-BdAbjgmY.cjs +2 -0
  6. package/dist/chunks/ColourField-BdAbjgmY.cjs.map +1 -0
  7. package/dist/chunks/dialogFocus-B9iqKl3I.cjs +2 -0
  8. package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +1 -0
  9. package/dist/chunks/dialogFocus-BFoyeTpA.js +48 -0
  10. package/dist/chunks/dialogFocus-BFoyeTpA.js.map +1 -0
  11. package/dist/components/ColourField/focus.d.cts +0 -1
  12. package/dist/components/ColourField/focus.d.cts.map +1 -1
  13. package/dist/components/ColourField/focus.d.ts +0 -1
  14. package/dist/components/ColourField/focus.d.ts.map +1 -1
  15. package/dist/components/ColourField/index.cjs +1 -1
  16. package/dist/components/ColourField/index.d.cts.map +1 -1
  17. package/dist/components/ColourField/index.d.ts.map +1 -1
  18. package/dist/components/ColourField/index.js +1 -1
  19. package/dist/components/Drawer/index.cjs +1 -1
  20. package/dist/components/Drawer/index.cjs.map +1 -1
  21. package/dist/components/Drawer/index.d.cts.map +1 -1
  22. package/dist/components/Drawer/index.d.ts.map +1 -1
  23. package/dist/components/Drawer/index.js +69 -73
  24. package/dist/components/Drawer/index.js.map +1 -1
  25. package/dist/components/EditLayout/index.cjs +1 -1
  26. package/dist/components/EditLayout/index.cjs.map +1 -1
  27. package/dist/components/EditLayout/index.d.cts.map +1 -1
  28. package/dist/components/EditLayout/index.d.ts.map +1 -1
  29. package/dist/components/EditLayout/index.js +68 -55
  30. package/dist/components/EditLayout/index.js.map +1 -1
  31. package/dist/components/Modal/index.cjs +1 -1
  32. package/dist/components/Modal/index.cjs.map +1 -1
  33. package/dist/components/Modal/index.d.cts.map +1 -1
  34. package/dist/components/Modal/index.d.ts.map +1 -1
  35. package/dist/components/Modal/index.js +40 -48
  36. package/dist/components/Modal/index.js.map +1 -1
  37. package/dist/components/Popover/index.cjs +1 -1
  38. package/dist/components/Popover/index.cjs.map +1 -1
  39. package/dist/components/Popover/index.d.cts.map +1 -1
  40. package/dist/components/Popover/index.d.ts.map +1 -1
  41. package/dist/components/Popover/index.js +45 -44
  42. package/dist/components/Popover/index.js.map +1 -1
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/internal/dialogFocus.d.cts +17 -0
  46. package/dist/internal/dialogFocus.d.cts.map +1 -0
  47. package/dist/internal/dialogFocus.d.ts +17 -0
  48. package/dist/internal/dialogFocus.d.ts.map +1 -0
  49. package/package.json +2 -2
  50. package/dist/chunks/ColourField-C2YDshDg.js.map +0 -1
  51. package/dist/chunks/ColourField-Dc9533G6.cjs +0 -2
  52. package/dist/chunks/ColourField-Dc9533G6.cjs.map +0 -1
package/README.md CHANGED
@@ -1,86 +1,1076 @@
1
1
  # Liquid Editorial
2
2
 
3
- Accessible React components for editorial products. The package ships ESM, CommonJS, TypeScript declarations, and explicit CSS entry points. Styles use those CSS entry points; the library does not inject styles through JavaScript.
3
+ Accessible React components for editorial products: forms, editors, navigation, collections, and media workflows. Published as **`@namroodinc/liquid-editorial`**, with ESM, CommonJS, TypeScript declarations, and explicit CSS entry points.
4
4
 
5
- ## Install
5
+ [Quick start](#quick-start) · [Component catalogue](#component-catalogue) · [Themes and fonts](#themes-and-fonts) · [Upgrading](#upgrading) · [Contributing](#contributing)
6
+
7
+ ## Install and styles
6
8
 
7
9
  ```sh
8
10
  npm install @namroodinc/liquid-editorial
9
11
  ```
10
12
 
11
- React and React DOM 18.2 through 19 are supported peer dependencies.
13
+ React and React DOM **18.2 through 19** are supported peer dependencies. The package declares Node.js **22 or newer** for tooling/runtime environments.
14
+
15
+ Import the complete stylesheet once near your application entry point. JavaScript does not inject styles:
12
16
 
13
- When updating the package, see [the versioned upgrade guide](UPGRADING.md) for adoption and compatibility notes. Agents can start with `AGENTS.md` in the installed package.
17
+ ```tsx
18
+ import "@namroodinc/liquid-editorial/styles.css";
19
+ import { Button } from "@namroodinc/liquid-editorial";
14
20
 
15
- ## Use
21
+ <Button variant="primary">Save draft</Button>;
22
+ ```
16
23
 
17
- Import the complete component stylesheet once near your application entry point:
24
+ Every family has a direct entry point; use the exact family name/case from the catalogue:
18
25
 
19
26
  ```tsx
20
- import "@namroodinc/liquid-editorial/styles.css";
21
- import { Field, TextField } from "@namroodinc/liquid-editorial";
27
+ import { Button, type ButtonProps } from "@namroodinc/liquid-editorial/components/Button";
28
+
29
+ const props: ButtonProps = { variant: "primary", children: "Save draft" };
30
+ <Button {...props} />;
31
+ ```
22
32
 
23
- export function ArticleForm() {
33
+ Root and family imports expose the same components. Keep the stylesheet import with either approach. `tokens.css` provides design tokens alone; `reset.css` is an optional global normalization and is never included automatically. Import reset before `styles.css` when using both.
34
+
35
+ ## Quick start
36
+
37
+ ```tsx
38
+ import { useState } from "react";
39
+ import { Button, Field, Stack, TextField } from "@namroodinc/liquid-editorial";
40
+
41
+ export function ArticleForm({ onSave }: { onSave: (headline: string) => void }) {
42
+ const [headline, setHeadline] = useState("");
24
43
  return (
25
- <Field label="Headline" hint="Keep it concise." isRequired>
26
- {(fieldProps) => <TextField {...fieldProps} />}
27
- </Field>
44
+ <form
45
+ onSubmit={(event) => {
46
+ event.preventDefault();
47
+ onSave(headline);
48
+ }}
49
+ >
50
+ <Stack gap="md">
51
+ <Field
52
+ label="Headline"
53
+ hint="Keep it concise."
54
+ isRequired
55
+ >
56
+ {(binding) => (
57
+ <TextField
58
+ {...binding}
59
+ value={headline}
60
+ onChange={(event) => setHeadline(event.target.value)}
61
+ />
62
+ )}
63
+ </Field>
64
+ <Button
65
+ type="submit"
66
+ variant="primary"
67
+ >
68
+ Save draft
69
+ </Button>
70
+ </Stack>
71
+ </form>
28
72
  );
29
73
  }
30
74
  ```
31
75
 
32
- `Field.hint` accepts a string or React node, such as `hint={<>Use a <strong>short headline</strong>.</>}`. Hints are associated with the control through `aria-describedby`; an error replaces the hint while present.
76
+ Field supplies labels and validation relationships. Button supplies action styling, focus, pending, and disabled states. Applications own data access, routing, submission, and persistence. Controlled components keep values in application state; `defaultValue` (where offered) initializes local state. Native controls such as TextField and Checkbox use native events, while compound controls expose value callbacks described below.
77
+
78
+ ## Component catalogue
79
+
80
+ All **43 families** and **93 runtime exports** are listed below, including compound components, hooks, helpers, and compatibility aliases. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
81
+
82
+ ### Actions and feedback catalogue
83
+
84
+ | Family / usage | Public exports | Source examples |
85
+ | --- | --- | --- |
86
+ | [Button](#button) | `Button` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Button/Button.stories.tsx) |
87
+ | [ButtonGroup](#buttongroup) | `ButtonGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/ButtonGroup/ButtonGroup.stories.tsx) |
88
+ | [Menu](#menu) | `Menu`, `MenuItem`, `MenuSeparator`, `MenuLabel` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Menu/Menu.stories.tsx) |
89
+ | [Modal](#modal) | `Modal` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Modal/Modal.stories.tsx) |
90
+ | [Drawer](#drawer) | `Drawer` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Drawer/Drawer.stories.tsx) |
91
+ | [Popover](#popover) | `Popover` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Popover/Popover.stories.tsx) |
92
+ | [Toast](#toast) | `Toast`, `ToastProvider`, `useToast` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Toast/Toast.stories.tsx) |
93
+ | [Badge](#badge) | `Badge` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Badge/Badge.stories.tsx) |
94
+ | [Icon](#icon) | `Icon`, `icons`, `iconNames` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Icon/Icon.stories.tsx) |
95
+ | [Avatar](#avatar) | `Avatar`, `AvatarGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Avatar/Avatar.stories.tsx) |
96
+ | [Skeleton](#skeleton) | `Skeleton`, `SkeletonText` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Skeleton/Skeleton.stories.tsx) |
97
+ | [Time](#time) | `Time`, `formatRelativeTime`, `formatAbsoluteDate`, `formatAbsoluteTime` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Time/Time.stories.tsx) |
98
+
99
+ ### Fields and editors catalogue
100
+
101
+ | Family / usage | Public exports | Source examples |
102
+ | --- | --- | --- |
103
+ | [Field](#field) | `Field` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Field/Field.stories.tsx) |
104
+ | [TextField](#textfield) | `TextField`, `TextArea` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/TextField/TextField.stories.tsx) |
105
+ | [Choice](#choice) | `Checkbox`, `Radio`, `ChoiceGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Choice/Choice.stories.tsx) |
106
+ | [SelectionCard](#selectioncard) | `CheckboxCard`, `RadioCard`, `SelectionCardGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/SelectionCard/SelectionCard.stories.tsx) |
107
+ | [FieldAffix](#fieldaffix) | `FieldAffix` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/FieldAffix/FieldAffix.stories.tsx) |
108
+ | [NumberField](#numberfield) | `NumberField`, `NumberRangeField` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/NumberField/NumberField.stories.tsx) |
109
+ | [Slider](#slider) | `Slider`, `RangeSlider` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Slider/Slider.stories.tsx) |
110
+ | [SearchField](#searchfield) | `SearchField` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/SearchField/SearchField.stories.tsx) |
111
+ | [Select](#select) | `Select` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Select/Select.stories.tsx) |
112
+ | [Switch](#switch) | `Switch` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Switch/Switch.stories.tsx) |
113
+ | [DatePicker](#datepicker) | `Calendar`, `DateField`, `DateRangeField`, `formatIsoDate` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/DatePicker/DatePicker.stories.tsx) |
114
+ | [TagsInput](#tagsinput) | `TagsInput` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/TagsInput/TagsInput.stories.tsx) |
115
+ | [ColourField](#colourfield) | `ColourField`, `ColourPanel` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/ColourField/ColourField.stories.tsx) |
116
+ | [EntryPicker](#entrypicker) | `EntryPicker` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/EntryPicker/EntryPicker.stories.tsx) |
117
+ | [RichTextEditor](#richtexteditor) | `RichTextEditor` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/RichTextEditor/RichTextEditor.stories.tsx) |
118
+ | [FormEditor](#formeditor) | `FormEditor`, `validateFormValues` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/FormEditor/FormEditor.stories.tsx) |
119
+
120
+ ### Layout catalogue
121
+
122
+ | Family / usage | Public exports | Source examples |
123
+ | --- | --- | --- |
124
+ | [Grid](#grid) | `Grid`, `GridItem`, `Stack` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Grid/Grid.stories.tsx) |
125
+ | [Container](#container) | `Container` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Container/Container.stories.tsx) |
126
+ | [AppShell](#appshell) | `AppShell` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/AppShell/AppShell.stories.tsx) |
127
+ | [EditLayout](#editlayout) | `EditLayout` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/EditLayout/EditLayout.stories.tsx) |
128
+
129
+ ### Navigation catalogue
130
+
131
+ | Family / usage | Public exports | Source examples |
132
+ | --- | --- | --- |
133
+ | [SideNav](#sidenav) | `SideNav`, `SideNavHeader`, `SideNavSection`, `SideNavItem`, `SideNavFooter`, `useSideNavCollapsed` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/SideNav/SideNav.stories.tsx) |
134
+ | [TopNav](#topnav) | `TopNav`, `TopNavItem` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/TopNav/TopNav.stories.tsx) |
135
+ | [SubNav](#subnav) | `SubNav`, `SubNavItem`, `SubNavButton` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/SubNav/SubNav.stories.tsx) |
136
+ | [Stepper](#stepper) | `Stepper` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Stepper/Stepper.stories.tsx) |
137
+ | [Pagination](#pagination) | `Pagination` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Pagination/Pagination.stories.tsx) |
138
+
139
+ ### Collections and media catalogue
140
+
141
+ | Family / usage | Public exports | Source examples |
142
+ | --- | --- | --- |
143
+ | [Table](#table) | `TableFrame`, `TableToolbar`, `Table`, `TableHead`, `TableBody`, `TableRow`, `TableHeaderCell`, `TableCell`, `TableEmpty` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Table/Table.stories.tsx) |
144
+ | [Board](#board) | `Board`, `BoardColumn`, `BoardCard` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Board/Board.stories.tsx) |
145
+ | [SortableList](#sortablelist) | `SortableList`, `SortableListItem` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/SortableList/SortableList.stories.tsx) |
146
+ | [AssetCard](#assetcard) | `AssetCard`, `AssetCardSkeleton` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/AssetCard/AssetCard.stories.tsx) |
147
+ | [AssetGrid](#assetgrid) | `AssetGrid`, `AssetTile`, `AssetTileSkeleton`, `AssetGridEmpty` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/AssetGrid/AssetGrid.stories.tsx) |
148
+ | [ImageCropper](#imagecropper) | `ImageCropper`, `cropToBlob` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/ImageCropper/ImageCropper.stories.tsx) |
149
+
150
+ ## Actions and feedback
151
+
152
+ ### Button
153
+
154
+ Use Button for actions, including controls inside custom components. Defaults are `variant="neutral"`, `size="md"`, and `type="button"`. Variants are `primary`, `neutral`, `danger`, `active`, and `simple`; sizes are `xs`, `sm`, `md`, and `lg`.
155
+
156
+ ```tsx
157
+ import { Avatar, Button } from "@namroodinc/liquid-editorial";
158
+
159
+ <>
160
+ <Button
161
+ variant="primary"
162
+ type="submit"
163
+ iconStart="check"
164
+ >
165
+ Save article
166
+ </Button>
167
+ <Button
168
+ variant="simple"
169
+ isIconOnly
170
+ aria-label="Account: Ada Lovelace"
171
+ >
172
+ <Avatar
173
+ name="Ada Lovelace"
174
+ size={32}
175
+ aria-hidden="true"
176
+ />
177
+ </Button>
178
+ </>;
179
+ ```
180
+
181
+ `isDisabled` and `isPending` block presses. Pending buttons show the shared spinner. Name icon-only controls with `aria-label` or `aria-labelledby`. Use `xs` for compact clear/remove actions; a custom glyph goes in children with `iconStart` omitted.
182
+
183
+ ### ButtonGroup
184
+
185
+ Groups related Buttons without owning their selection state. Attached horizontal segments are the default; use `isAttached={false}` for spacing or `orientation="vertical"` for a column.
186
+
187
+ ```tsx
188
+ import { useState } from "react";
189
+ import { Button, ButtonGroup } from "@namroodinc/liquid-editorial";
190
+
191
+ export function ViewPicker() {
192
+ const [view, setView] = useState("list");
193
+ return (
194
+ <ButtonGroup aria-label="Collection view">
195
+ {["list", "grid"].map((item) => (
196
+ <Button
197
+ key={item}
198
+ variant={view === item ? "active" : "neutral"}
199
+ aria-pressed={view === item}
200
+ onClick={() => setView(item)}
201
+ >
202
+ {item}
203
+ </Button>
204
+ ))}
205
+ </ButtonGroup>
206
+ );
207
+ }
208
+ ```
209
+
210
+ Give a meaningful group an accessible name, and mark selected toggle buttons with `aria-pressed`.
211
+
212
+ ### Menu
213
+
214
+ A keyboard-operable action menu. Spread the trigger binding onto Button; Menu owns opening, focus, arrow-key navigation, Escape, and dismissal after selection. `align` defaults to `"start"`.
215
+
216
+ ```tsx
217
+ import { Button, Menu, MenuItem, MenuLabel, MenuSeparator } from "@namroodinc/liquid-editorial";
218
+
219
+ export function ArticleMenu({ onEdit, onDelete }: { onEdit: () => void; onDelete: () => void }) {
220
+ return (
221
+ <Menu
222
+ trigger={(props) => (
223
+ <Button
224
+ {...props}
225
+ iconEnd="chevron-down"
226
+ >
227
+ Actions
228
+ </Button>
229
+ )}
230
+ >
231
+ <MenuLabel>Article</MenuLabel>
232
+ <MenuItem
233
+ icon="pencil"
234
+ onClick={onEdit}
235
+ >
236
+ Edit
237
+ </MenuItem>
238
+ <MenuSeparator />
239
+ <MenuItem
240
+ tone="danger"
241
+ onClick={onDelete}
242
+ >
243
+ Delete
244
+ </MenuItem>
245
+ </Menu>
246
+ );
247
+ }
248
+ ```
249
+
250
+ `MenuItem` supports `isDisabled`, `icon`, and a visual `shortcut`; the app implements actions and any shortcut handlers.
251
+
252
+ ### Modal
253
+
254
+ A controlled dialog for a focused task. Supply `isOpen`, `onClose`, and a string `title`. Size defaults to `"md"`; `"dialog"` and `"wide"` are also available.
255
+
256
+ ```tsx
257
+ import { useState } from "react";
258
+ import { Button, Modal } from "@namroodinc/liquid-editorial";
259
+
260
+ export function ConfirmPublish({ onPublish }: { onPublish: () => void }) {
261
+ const [open, setOpen] = useState(false);
262
+ return (
263
+ <>
264
+ <Button onClick={() => setOpen(true)}>Publish</Button>
265
+ <Modal
266
+ isOpen={open}
267
+ onClose={() => setOpen(false)}
268
+ title="Publish article?"
269
+ description="The article will be visible to readers."
270
+ footer={
271
+ <Button
272
+ variant="primary"
273
+ onClick={() => {
274
+ onPublish();
275
+ setOpen(false);
276
+ }}
277
+ >
278
+ Publish
279
+ </Button>
280
+ }
281
+ >
282
+ Check the headline and cover before publishing.
283
+ </Modal>
284
+ </>
285
+ );
286
+ }
287
+ ```
288
+
289
+ Modal portals to the body, traps Tab, locks scrolling, and restores the opener on close. Tab wraps between the first and last rendered controls, counting a radio group as one stop, and focus that leaves the panel returns on the next Tab. Escape, the scrim, and Close request dismissal; the app updates `isOpen`. Nested dialogs share the dialog stack and scroll lock.
290
+
291
+ ### Drawer
292
+
293
+ A controlled side panel with the same dialog responsibilities as Modal. Defaults are `side="end"`, `size="md"`, and `variant="default"`.
294
+
295
+ ```tsx
296
+ import { useState } from "react";
297
+ import { Button, Drawer, Field, TextField } from "@namroodinc/liquid-editorial";
298
+
299
+ export function MetadataDrawer() {
300
+ const [open, setOpen] = useState(false);
301
+ return (
302
+ <>
303
+ <Button onClick={() => setOpen(true)}>Edit metadata</Button>
304
+ <Drawer
305
+ isOpen={open}
306
+ onClose={() => setOpen(false)}
307
+ title="Metadata"
308
+ >
309
+ <Field label="Slug">
310
+ {(binding) => (
311
+ <TextField
312
+ {...binding}
313
+ defaultValue="bookshop"
314
+ />
315
+ )}
316
+ </Field>
317
+ </Drawer>
318
+ </>
319
+ );
320
+ }
321
+ ```
322
+
323
+ `side="start"` and `"end"` mirror in RTL; `"bottom"` creates a bottom sheet. All sides have square corners and slide through their anchored edge. Motion follows `--duration-panel` and `--ease-panel`, with reduced-motion support. Side panels have a single outer border facing the page.
324
+
325
+ Use `variant="navigation"` for compact navigation, `closeLabel` for contextual dismissal copy, and a React-node `title` for a brand. Supply `aria-label` for an independent dialog name. `portalContainer` can keep a navigation drawer inside a positioned element; the default covers the viewport from `document.body`.
326
+
327
+ Keep Drawer mounted while changing `isOpen`: closing immediately makes the exiting panel inert and accessibility-hidden, restores focus without scrolling, and releases its scroll lock; DOM removal follows the transition. Tests should await removal. Tab follows Modal's rules. Only the topmost dialog handles Tab/Escape, and an open popup inside Drawer can handle Escape first. Nested dialogs keep body scrolling locked until the last one closes; scrollbar compensation preserves layout widths.
328
+
329
+ ### Popover
330
+
331
+ Low-level anchored positioning shared by menus, selects, calendars, colour pickers, and tooltips. It measures the anchor, flips when needed, clamps to the viewport, and follows scrolling and anchor/content resizing. Defaults: `align="start"`, `placement="bottom"`, `offset={4}`.
332
+
333
+ ```tsx
334
+ import { useId, useRef, useState } from "react";
335
+ import { Button, Popover } from "@namroodinc/liquid-editorial";
336
+
337
+ export function HelpPopover() {
338
+ const anchor = useRef<HTMLButtonElement>(null);
339
+ const id = useId();
340
+ const [open, setOpen] = useState(false);
341
+ return (
342
+ <>
343
+ <Button
344
+ ref={anchor}
345
+ aria-expanded={open}
346
+ aria-controls={open ? id : undefined}
347
+ onClick={() => setOpen(!open)}
348
+ >
349
+ Formatting help
350
+ </Button>
351
+ <Popover
352
+ anchorRef={anchor}
353
+ id={id}
354
+ isOpen={open}
355
+ role="region"
356
+ aria-label="Formatting help"
357
+ >
358
+ <p>Use a short, descriptive headline.</p>
359
+ <Button onClick={() => setOpen(false)}>Close help</Button>
360
+ </Popover>
361
+ </>
362
+ );
363
+ }
364
+ ```
365
+
366
+ The caller owns opening, closing, keyboard/focus semantics, and outside-click handling. A Modal or Drawer containing the anchor treats the open panel as its own, leaving Tab inside it to the panel. Use Menu, Select, Modal, or Drawer when their interactions fit. `matchAnchorWidth` suits listboxes; tall panels scroll without losing their scroll position during repositioning.
367
+
368
+ ### Toast
369
+
370
+ Mount ToastProvider once, then call `useToast()` inside its descendants. The returned `toast` function accepts a title, optional description, tone, and duration in milliseconds. Tones are `neutral`, `info`, `success`, `warning`, and `danger`.
371
+
372
+ ```tsx
373
+ import { Button, Toast, ToastProvider, useToast } from "@namroodinc/liquid-editorial";
374
+
375
+ function SavedNotice() {
376
+ const { toast } = useToast();
377
+ return (
378
+ <Button onClick={() => toast({ title: "Draft saved", tone: "success", duration: 4000 })}>
379
+ Show saved notice
380
+ </Button>
381
+ );
382
+ }
383
+
384
+ export function Notifications() {
385
+ return (
386
+ <ToastProvider>
387
+ <SavedNotice />
388
+ </ToastProvider>
389
+ );
390
+ }
391
+
392
+ // Standalone display, with dismissal/timing managed by its parent:
393
+ <Toast
394
+ title="Upload complete"
395
+ description="The cover is ready."
396
+ tone="success"
397
+ />;
398
+ ```
399
+
400
+ Provider notifications dismiss automatically after five seconds unless `duration` overrides it. Standalone Toast renders a status message; pass `onDismiss` to show its dismiss control.
401
+
402
+ ### Badge
403
+
404
+ A non-interactive editorial label. Use `shape="status"` for publication state, `"tag"` (the default) for metadata, and `"count"` for totals. Appearance defaults to `"outline"`; `"soft"` suits dense lists and `"solid"` emphasizes one state.
405
+
406
+ ```tsx
407
+ import { Badge } from "@namroodinc/liquid-editorial";
408
+
409
+ <>
410
+ <Badge
411
+ shape="status"
412
+ tone="published"
413
+ appearance="soft"
414
+ >
415
+ Published
416
+ </Badge>
417
+ <Badge>Opinion</Badge>
418
+ <Badge shape="count">128</Badge>
419
+ <Badge
420
+ shape="count"
421
+ isCountExact
422
+ >
423
+ {0}
424
+ </Badge>
425
+ </>;
426
+ ```
427
+
428
+ Status tones are `draft`, `scheduled`, `published`, `changed`, `unpublished`, and `archived`; use `tone` only with status badges. Tags/status text displays uppercase with 4px corners, and status labels have square markers. Counts use tabular numerals: zero is hidden and values above 99 become `99+`, unless `isCountExact` shows the full value including zero. Field counts use that exact behavior. Badge does not supply action or filter interactions.
429
+
430
+ ### Icon
431
+
432
+ A curated glyph set with sizes 16, 20, and 24 (default 16). `IconName` supplies the typed names; `iconNames` lists them and `icons` exposes the glyph registry.
433
+
434
+ ```tsx
435
+ import { Icon, icons, iconNames, type IconName } from "@namroodinc/liquid-editorial";
436
+
437
+ const name: IconName = "file-text";
438
+ <Icon
439
+ name={name}
440
+ size={20}
441
+ />;
442
+ const availableNames = iconNames.filter((item) => item in icons);
443
+ ```
444
+
445
+ Icons are decorative by default. Put the accessible name on their containing control, or override `aria-hidden` and supply a meaningful SVG label when the icon itself conveys information.
446
+
447
+ ### Avatar
448
+
449
+ Avatar displays an image or name-derived initials. The required `name` supplies its accessible name. Sizes are 24 (default), 32, and 40. AvatarGroup shows up to three people and a count for the remainder.
450
+
451
+ ```tsx
452
+ import { Avatar, AvatarGroup } from "@namroodinc/liquid-editorial";
453
+
454
+ <>
455
+ <Avatar
456
+ name="Ada Lovelace"
457
+ size={32}
458
+ />
459
+ <AvatarGroup
460
+ people={[{ name: "Ada Lovelace" }, { name: "Grace Hopper" }]}
461
+ size={24}
462
+ />
463
+ </>;
464
+ ```
465
+
466
+ Use `aria-hidden="true"` when an adjacent label already identifies the person. Wrap interactive avatars in a named Button or link.
467
+
468
+ ### Skeleton
469
+
470
+ Loading placeholders for text, headings, blocks, and circles. Skeleton defaults to a full-width text line; SkeletonText defaults to three lines with a shorter final line.
471
+
472
+ ```tsx
473
+ import { Skeleton, SkeletonText } from "@namroodinc/liquid-editorial";
474
+
475
+ <section
476
+ aria-busy="true"
477
+ aria-label="Loading article"
478
+ >
479
+ <Skeleton
480
+ shape="heading"
481
+ width="60%"
482
+ />
483
+ <Skeleton
484
+ shape="circle"
485
+ size="40px"
486
+ />
487
+ <SkeletonText lines={4} />
488
+ </section>;
489
+ ```
490
+
491
+ Individual Skeleton placeholders are hidden from assistive technology. SkeletonText provides a busy status named “Loading”; its label can be overridden. The containing UI owns loading state and the switch to real content.
492
+
493
+ ### Time
494
+
495
+ A semantic time element with relative text and an absolute tooltip on hover/focus. `format` defaults to `"auto"`; `"absolute"` always displays the date. Relative formatting ages to an absolute date after a week, and future dates display as absolute dates.
496
+
497
+ ```tsx
498
+ import {
499
+ Time,
500
+ formatRelativeTime,
501
+ formatAbsoluteDate,
502
+ formatAbsoluteTime,
503
+ } from "@namroodinc/liquid-editorial";
504
+
505
+ const date = new Date("2026-06-12T11:05:00Z");
506
+ <Time
507
+ value={date}
508
+ format="absolute"
509
+ />;
510
+ const relative = formatRelativeTime(date, new Date("2026-06-12T12:05:00Z"));
511
+ const day = formatAbsoluteDate(date, { hasYear: true });
512
+ const stamp = formatAbsoluteTime(date, { hasTimeZone: true });
513
+ ```
514
+
515
+ Values accept Date, epoch milliseconds, or a date string; invalid values render nothing. Formatting uses the reader's local timezone. `hasTooltip={false}` removes the tooltip; `hasTimeZone` controls its zone suffix. The default refresh interval is 30 seconds. Set `now` for deterministic rendering/tests; it also disables the interval.
516
+
517
+ ## Fields and editors
518
+
519
+ ### Field
33
520
 
34
- `Field` owns the visible label, required marker, hint and error for every control.
35
- Spread its render-prop binding onto the interactive component; custom adapters can
36
- import `FieldBinding` or `FieldRenderProps`. Use `isGroup` for related controls,
37
- which gives the group a `<fieldset>/<legend>` while retaining each option caption
38
- and range-member name, following [W3C grouping guidance](https://www.w3.org/WAI/tutorials/forms/grouping/).
39
- Native inputs receive `required`; custom inputs use supported ARIA semantics.
40
- Group validation remains with the consumer rather than making every member required.
521
+ Field owns a control's visible label, required marker, hint, and error. Spread its render-prop binding onto the control so IDs and accessible descriptions stay connected. Hints accept React nodes; an error replaces the hint and marks the control invalid.
41
522
 
42
523
  ```tsx
43
- <Field label="Related Articles" isGroup>
524
+ import { ChoiceGroup, Checkbox, Field, TextField } from "@namroodinc/liquid-editorial";
525
+
526
+ <>
527
+ <Field
528
+ label="Headline"
529
+ hint={
530
+ <>
531
+ Use a <strong>short headline</strong>.
532
+ </>
533
+ }
534
+ isRequired
535
+ >
536
+ {(binding) => <TextField {...binding} />}
537
+ </Field>
538
+ <Field
539
+ label="Channels"
540
+ isGroup
541
+ count={0}
542
+ >
543
+ {(binding) => (
544
+ <ChoiceGroup
545
+ {...binding}
546
+ label="Channels"
547
+ >
548
+ <Checkbox
549
+ name="channels"
550
+ value="web"
551
+ >
552
+ Web
553
+ </Checkbox>
554
+ <Checkbox
555
+ name="channels"
556
+ value="print"
557
+ >
558
+ Print
559
+ </Checkbox>
560
+ </ChoiceGroup>
561
+ )}
562
+ </Field>
563
+ </>;
564
+ ```
565
+
566
+ Use `isGroup` for a fieldset/legend around related controls and range widgets. Keep each option/member's own name. Native controls receive `required`; custom controls use supported ARIA semantics. Group validation stays with the consumer instead of requiring every option.
567
+
568
+ `count` displays a Badge beside the label, including zero and totals above 99, without changing the accessible name. Bound EntryPicker, ChoiceGroup, and SelectionCardGroup share this frame and report their count unless Field supplies one. Their standalone label props remain usable; external `aria-labelledby` alone does not remove their frame. Import `FieldBinding`/`FieldRenderProps` when writing adapters. FormEditor uses the same binding path.
569
+
570
+ ### TextField
571
+
572
+ TextField and TextArea wrap native text controls. Use native `value`/`defaultValue`, `onChange`, `disabled`, `readOnly`, and validation attributes. TextField sizes are `sm`, `md` (default), and `lg`; TextArea uses native rows.
573
+
574
+ ```tsx
575
+ import { Field, TextArea, TextField } from "@namroodinc/liquid-editorial";
576
+
577
+ <>
578
+ <Field
579
+ label="Email"
580
+ isRequired
581
+ >
582
+ {(binding) => (
583
+ <TextField
584
+ {...binding}
585
+ type="email"
586
+ autoComplete="email"
587
+ />
588
+ )}
589
+ </Field>
590
+ <Field label="Summary">
591
+ {(binding) => (
592
+ <TextArea
593
+ {...binding}
594
+ rows={4}
595
+ maxLength={240}
596
+ />
597
+ )}
598
+ </Field>
599
+ </>;
600
+ ```
601
+
602
+ Refs target the native input/textarea. For controlled values, read `event.target.value` in `onChange`.
603
+
604
+ ### Choice
605
+
606
+ Checkbox and Radio keep native checked/change behavior and option captions. ChoiceGroup provides the shared legend, hint, and error frame, with one column by default and optional two/three-column layouts.
607
+
608
+ ```tsx
609
+ import { Checkbox, ChoiceGroup, Radio } from "@namroodinc/liquid-editorial";
610
+
611
+ <>
612
+ <ChoiceGroup
613
+ label="Channels"
614
+ columns={2}
615
+ >
616
+ <Checkbox
617
+ name="channels"
618
+ value="web"
619
+ defaultChecked
620
+ >
621
+ Web
622
+ </Checkbox>
623
+ <Checkbox
624
+ name="channels"
625
+ value="print"
626
+ >
627
+ Print
628
+ </Checkbox>
629
+ </ChoiceGroup>
630
+ <ChoiceGroup label="Visibility">
631
+ <Radio
632
+ name="visibility"
633
+ value="public"
634
+ defaultChecked
635
+ >
636
+ Public
637
+ </Radio>
638
+ <Radio
639
+ name="visibility"
640
+ value="private"
641
+ >
642
+ Private
643
+ </Radio>
644
+ </ChoiceGroup>
645
+ </>;
646
+ ```
647
+
648
+ Radios share a `name` for native exclusivity. Use `checked`/`onChange` for controlled options and native `disabled` for unavailable choices. Checkbox supports `isIndeterminate` for a select-all display. Bind the group to a Field with `isGroup` when it belongs to a larger form.
649
+
650
+ ### SelectionCard
651
+
652
+ CheckboxCard and RadioCard add explanatory space to native selection controls. SelectionCardGroup supplies a legend and a responsive grid; defaults are two columns and `gap="md"`.
653
+
654
+ ```tsx
655
+ import { CheckboxCard, RadioCard, SelectionCardGroup } from "@namroodinc/liquid-editorial";
656
+
657
+ <>
658
+ <SelectionCardGroup
659
+ label="Extras"
660
+ columns={2}
661
+ >
662
+ <CheckboxCard
663
+ title="Newsletter"
664
+ description="Send a weekly digest."
665
+ name="extras"
666
+ value="newsletter"
667
+ />
668
+ <CheckboxCard
669
+ title="Print"
670
+ name="extras"
671
+ value="print"
672
+ />
673
+ </SelectionCardGroup>
674
+ <SelectionCardGroup label="Plan">
675
+ <RadioCard
676
+ title="Standard"
677
+ name="plan"
678
+ value="standard"
679
+ defaultChecked
680
+ />
681
+ <RadioCard
682
+ title="Team"
683
+ name="plan"
684
+ value="team"
685
+ />
686
+ </SelectionCardGroup>
687
+ </>;
688
+ ```
689
+
690
+ Supply `title`, optional `description`/children, and native `checked`, `onChange`, or `disabled`. Radios share a `name`. Bind the group to a group Field to share labels and validation.
691
+
692
+ ### FieldAffix
693
+
694
+ Adds a leading/trailing glyph, unit, or control to a field while measuring the space each needs. Wrap one control using the shared field skin, such as TextField.
695
+
696
+ ```tsx
697
+ import { Field, FieldAffix, Icon, TextField } from "@namroodinc/liquid-editorial";
698
+
699
+ <Field label="Website">
44
700
  {(binding) => (
45
- <EntryPicker {...binding} items={articles} value={selected} onValueChange={setSelected} />
701
+ <FieldAffix
702
+ lead={<Icon name="link" />}
703
+ trail=".com"
704
+ >
705
+ <TextField
706
+ {...binding}
707
+ placeholder="example"
708
+ />
709
+ </FieldAffix>
46
710
  )}
47
- </Field>
711
+ </Field>;
712
+ ```
713
+
714
+ Affixes are non-interactive by default. Set `isLeadInteractive` or `isTrailInteractive` when that slot contains a Button; give the control its own accessible name. NumberField, SearchField, and other fields already compose affixes where needed.
715
+
716
+ ### NumberField
717
+
718
+ NumberField emits a number or `""` when cleared. It includes steppers by default, supports prefix/suffix content, and marks typed out-of-range values invalid. NumberRangeField emits `{ min, max }` with each member a number or `""`.
719
+
720
+ ```tsx
721
+ import { Field, NumberField, NumberRangeField } from "@namroodinc/liquid-editorial";
722
+
723
+ <>
724
+ <Field label="Width">
725
+ {(binding) => (
726
+ <NumberField
727
+ {...binding}
728
+ defaultValue={800}
729
+ min={100}
730
+ max={2000}
731
+ step={10}
732
+ suffix="px"
733
+ decreaseLabel="Decrease Width"
734
+ increaseLabel="Increase Width"
735
+ />
736
+ )}
737
+ </Field>
738
+ <Field
739
+ label="Price range"
740
+ isGroup
741
+ >
742
+ {(binding) => (
743
+ <NumberRangeField
744
+ {...binding}
745
+ defaultValue={{ min: 10, max: 100 }}
746
+ min={0}
747
+ prefix="£"
748
+ minLabel="Minimum price"
749
+ maxLabel="Maximum price"
750
+ />
751
+ )}
752
+ </Field>
753
+ </>;
754
+ ```
755
+
756
+ Use `value`/`onValueChange` for controlled numbers and ranges; sizes are `sm`, `md` (default), and `lg`. Steppers honor `min`, `max`, and `step`; typing stays editable. Set `hasSteppers={false}` for typing only. Name steppers after their field when several are present; `isDisabled` disables the whole widget.
757
+
758
+ ### Slider
759
+
760
+ A native range control with optional value text, prefix, and suffix. RangeSlider exposes two bounds through `{ min, max }`, with named lower/upper controls. Defaults are 0–100, step 1, and visible value labels.
761
+
762
+ ```tsx
763
+ import { Field, RangeSlider, Slider } from "@namroodinc/liquid-editorial";
764
+
765
+ <>
766
+ <Field label="Opacity">
767
+ {(binding) => (
768
+ <Slider
769
+ {...binding}
770
+ defaultValue={80}
771
+ min={0}
772
+ max={100}
773
+ suffix="%"
774
+ />
775
+ )}
776
+ </Field>
777
+ <Field
778
+ label="Budget"
779
+ isGroup
780
+ >
781
+ {(binding) => (
782
+ <RangeSlider
783
+ {...binding}
784
+ defaultValue={{ min: 20, max: 80 }}
785
+ prefix="£"
786
+ minLabel="Minimum budget"
787
+ maxLabel="Maximum budget"
788
+ />
789
+ )}
790
+ </Field>
791
+ </>;
792
+ ```
793
+
794
+ Use `value`/`onValueChange` for controlled values, `isDisabled` to disable, and `hasValueLabel={false}` to hide printed values. Bind range sliders to a group Field and keep both member names.
795
+
796
+ ### SearchField
797
+
798
+ A native search input with a search glyph and clear control. Size defaults to `"md"`; `"sm"` and `"lg"` are also supported. Clearing or Escape calls `onClear`.
799
+
800
+ ```tsx
801
+ import { useState } from "react";
802
+ import { Field, SearchField } from "@namroodinc/liquid-editorial";
803
+
804
+ export function ArticleSearch() {
805
+ const [query, setQuery] = useState("");
806
+ return (
807
+ <Field label="Search articles">
808
+ {(binding) => (
809
+ <SearchField
810
+ {...binding}
811
+ value={query}
812
+ onChange={(event) => setQuery(event.target.value)}
813
+ onClear={() => setQuery("")}
814
+ />
815
+ )}
816
+ </Field>
817
+ );
818
+ }
819
+ ```
820
+
821
+ A controlled search must reset its value in `onClear`. The application owns filtering, debouncing, requests, and results announcements.
822
+
823
+ ### Select
824
+
825
+ A button-backed single-choice listbox with string values, disabled choices, descriptions, and keyboard navigation. Size defaults to `"md"`, with `"sm"`/`"lg"` available.
826
+
827
+ ```tsx
828
+ import { useState } from "react";
829
+ import { Field, Select } from "@namroodinc/liquid-editorial";
830
+
831
+ export function PublicationSelect() {
832
+ const [status, setStatus] = useState("draft");
833
+ return (
834
+ <Field label="Publication">
835
+ {(binding) => (
836
+ <Select
837
+ {...binding}
838
+ value={status}
839
+ onValueChange={setStatus}
840
+ options={[
841
+ { value: "draft", label: "Draft" },
842
+ { value: "published", label: "Published" },
843
+ ]}
844
+ menuPlacement="bottom"
845
+ />
846
+ )}
847
+ </Field>
848
+ );
849
+ }
850
+ ```
851
+
852
+ Use `defaultValue` for uncontrolled selection, `placeholder` for an empty display, and `isDisabled`/`isInvalid` for field states. The default menu placement is bottom; top preference and automatic flipping are supported. An `aria-labelledby` binding also names its listbox. Select emits through `onValueChange`; adapt it explicitly when constructing submitted form data.
853
+
854
+ ### Switch
855
+
856
+ A boolean switch composed from Button. `defaultSelected` initializes local state; use `isSelected`/`onSelectedChange` for controlled state. It is off by default.
857
+
858
+ ```tsx
859
+ import { useState } from "react";
860
+ import { Field, Switch } from "@namroodinc/liquid-editorial";
861
+
862
+ export function CommentsSwitch() {
863
+ const [enabled, setEnabled] = useState(true);
864
+ return (
865
+ <Field label="Allow comments">
866
+ {(binding) => (
867
+ <Switch
868
+ {...binding}
869
+ isSelected={enabled}
870
+ onSelectedChange={setEnabled}
871
+ />
872
+ )}
873
+ </Field>
874
+ );
875
+ }
876
+ ```
877
+
878
+ Standalone switches can use children for their visible caption or `aria-label` for a name. `isDisabled` blocks changes. Applications serialize the boolean and own persistence.
879
+
880
+ ### DatePicker
881
+
882
+ DateField and DateRangeField edit calendar dates as `YYYY-MM-DD` strings. Calendar is the inline Monday-first picker; `formatIsoDate` formats a valid date into a long display label, returning `""` for invalid input.
883
+
884
+ ```tsx
885
+ import { useState } from "react";
886
+ import {
887
+ Calendar,
888
+ DateField,
889
+ DateRangeField,
890
+ Field,
891
+ formatIsoDate,
892
+ type DateRangeValue,
893
+ } from "@namroodinc/liquid-editorial";
894
+
895
+ export function Dates() {
896
+ const [day, setDay] = useState("2026-06-12");
897
+ const [range, setRange] = useState<DateRangeValue>({ start: "2026-06-12", end: "2026-06-19" });
898
+ return (
899
+ <>
900
+ <Field label="Publication date">
901
+ {(binding) => (
902
+ <DateField
903
+ {...binding}
904
+ value={day}
905
+ onValueChange={setDay}
906
+ />
907
+ )}
908
+ </Field>
909
+ <Field
910
+ label="Campaign dates"
911
+ isGroup
912
+ >
913
+ {(binding) => (
914
+ <DateRangeField
915
+ {...binding}
916
+ value={range}
917
+ onValueChange={setRange}
918
+ startLabel="Campaign start"
919
+ endLabel="Campaign end"
920
+ />
921
+ )}
922
+ </Field>
923
+ <Calendar
924
+ aria-label="Inline publication date"
925
+ value={day}
926
+ onSelect={setDay}
927
+ />
928
+ <p>{formatIsoDate(day)}</p>
929
+ </>
930
+ );
931
+ }
932
+ ```
933
+
934
+ Fields support `defaultValue`, sizes `sm`/`md`/`lg` (default `md`), `min`/`max`, and `isDisabled`. Placement defaults to bottom and can prefer top. Calendar uses `value`/`onSelect`; supply `endValue` to highlight a range. The app owns range-selection logic for a standalone Calendar. These date-only values differ from FormEditor's UTC `dateTime` values.
935
+
936
+ ### TagsInput
937
+
938
+ Editable free-text tags stored as a string array. Enter, comma, or blur commits trimmed text; duplicates and empty tags are ignored. Backspace in an empty input removes the final tag.
939
+
940
+ ```tsx
941
+ import { useState } from "react";
942
+ import { Field, TagsInput } from "@namroodinc/liquid-editorial";
943
+
944
+ export function Keywords() {
945
+ const [tags, setTags] = useState<string[]>(["editorial"]);
946
+ return (
947
+ <Field label="Keywords">
948
+ {(binding) => (
949
+ <TagsInput
950
+ {...binding}
951
+ value={tags}
952
+ onValueChange={setTags}
953
+ max={5}
954
+ />
955
+ )}
956
+ </Field>
957
+ );
958
+ }
48
959
  ```
49
960
 
50
- `count` renders the shared count Badge beside the label, including zero and full
51
- totals above 99, without changing its accessible name. EntryPicker, ChoiceGroup and
52
- SelectionCardGroup keep their standalone label props and compose the same frame.
53
- Bound to their own Field, they render only their controls and the Field shows their
54
- count unless it has its own `count`. Labelled by anything else through
55
- `aria-labelledby`, they keep their own frame. A group Field's fieldset carries the
56
- hint or error, so bound groups and range members don't repeat it. FormEditor uses
57
- this path for all field types, including picker-label overrides and selection counts.
961
+ Use `defaultValue` for local state, `max` to cap additions, and `isDisabled`/`isInvalid` for field states. Sizes are `sm`, `md` (default), and `lg`.
58
962
 
59
- Every family also has a direct entry point:
963
+ ### ColourField
964
+
965
+ ColourField combines typed input with an adaptive picker; ColourPanel provides the same selection surface inline. Both support controlled/uncontrolled string values.
60
966
 
61
967
  ```tsx
62
- import { Button } from "@namroodinc/liquid-editorial/components/Button";
968
+ import { useState } from "react";
969
+ import { ColourField, ColourPanel, Field } from "@namroodinc/liquid-editorial";
970
+
971
+ export function AccentColour() {
972
+ const [colour, setColour] = useState("#0052CC");
973
+ const [valid, setValid] = useState(true);
974
+ return (
975
+ <>
976
+ <Field
977
+ label="Accent colour"
978
+ hint="Hex, rgb(), hsl() or a colour name."
979
+ error={valid ? undefined : "Enter a valid colour."}
980
+ >
981
+ {(binding) => (
982
+ <ColourField
983
+ {...binding}
984
+ value={colour}
985
+ onValueChange={setColour}
986
+ onValidityChange={setValid}
987
+ presets={["#0052CC", "rebeccapurple", "#136C3F80", "transparent"]}
988
+ />
989
+ )}
990
+ </Field>
991
+ <ColourPanel
992
+ aria-label="Inline accent colour"
993
+ value={colour}
994
+ onValueChange={setColour}
995
+ />
996
+ </>
997
+ );
998
+ }
63
999
  ```
64
1000
 
65
- Use `Button` for action controls, including controls rendered inside other components. Its variants, sizes, icons, focus rings, and disabled states supply the shared appearance. Use `size="xs"` for compact actions inside a field or chip, such as clear and remove. For a custom square glyph, omit `iconStart` and provide visual children plus an accessible name:
1001
+ Values emit as uppercase `#RRGGBB` or `#RRGGBBAA` with transparency. Clearing text emits `""`. Valid drafts stay typed until blur/Enter; invalid drafts remain visible and invalid without committing them. `onValidityChange` reports parsing validity; empty values are parse-valid and native `required` is separate. Supported inputs include 3/4/6/8-digit hex with or without `#`, RGB/RGBA, HSL/HSLA, named colours, and `transparent`. CSS variables, `currentColor`, and additional colour spaces are outside this API.
1002
+
1003
+ Use `defaultValue` for local state, `picker="native"` for OS selection, and `showPresets={false}` to hide supplied presets. Custom is the default picker. Both modes retain an opacity slider. Native selection and the optional supported screen eyedropper preserve opacity; presets replace the whole colour. The custom panel supports pointer/keyboard adjustments and remembers hue through grey/black.
1004
+
1005
+ ColourField supports normal textbox props, refs, `size`, `readOnly`, `isDisabled`, `isInvalid`, and `placement="top"`/`"bottom"` (default bottom). The swatch is a pointer shortcut and the chevron is the picker tab stop. FormEditor has no colour schema type.
1006
+
1007
+ ### EntryPicker
1008
+
1009
+ Select entries or assets from app-provided items. The value is an ordered array of IDs in both single and multiple mode. The picker owns search, its selection modal, and optional ordering; the app owns loading and persistence.
66
1010
 
67
1011
  ```tsx
68
- <Button variant="simple" isIconOnly aria-label="Account: Ada Lovelace">
69
- <Avatar name="Ada Lovelace" size={32} aria-hidden="true" />
70
- </Button>
1012
+ import { useState } from "react";
1013
+ import { EntryPicker, Field } from "@namroodinc/liquid-editorial";
1014
+
1015
+ const articles = [{ id: "article-1", title: "The corner bookshop", subtitle: "Article" }];
1016
+
1017
+ export function RelatedArticles() {
1018
+ const [selected, setSelected] = useState<string[]>([]);
1019
+ return (
1020
+ <Field
1021
+ label="Related articles"
1022
+ isGroup
1023
+ >
1024
+ {(binding) => (
1025
+ <EntryPicker
1026
+ {...binding}
1027
+ items={articles}
1028
+ value={selected}
1029
+ onValueChange={setSelected}
1030
+ mode="multiple"
1031
+ max={3}
1032
+ itemLabel="article"
1033
+ itemsLabel="articles"
1034
+ />
1035
+ )}
1036
+ </Field>
1037
+ );
1038
+ }
71
1039
  ```
72
1040
 
73
- Pending Buttons replace custom glyphs with the shared spinner. Button-backed selects and date fields retain the shared Field skin; Switch retains its track and knob while composing Button.
1041
+ Mode defaults to `"multiple"`; multiple selections are reorderable by default. `max` disables unpicked items at the limit. Items can have a subtitle, image URL, keywords, and `isDisabled`. `defaultValue` supplies local state; `isDisabled` disables editing. Standalone pickers can supply their own `label`, `hint`, and `error`; a bound group Field owns that frame and displays the selected count. Copy options include `emptyLabel`, `addLabel`, `itemLabel`, and `itemsLabel`.
74
1042
 
75
- If an application only needs the design tokens, import `@namroodinc/liquid-editorial/tokens.css`. A small global normalization is available separately at `@namroodinc/liquid-editorial/reset.css`; it is never included automatically.
1043
+ ### RichTextEditor
76
1044
 
77
- ## Badges
1045
+ A TipTap editor with the library toolbar. HTML is the default format; `format="json"` uses a document rooted at `doc` with the editor's StarterKit/Link schema.
78
1046
 
79
- `Badge` is a non-interactive editorial label. Use `shape="status"` with one of the six publication tones, `shape="tag"` (the default) for metadata, and `shape="count"` for totals. Status labels and tags display uppercase with 4px corners; status labels add 6px square markers. Counts keep 12px untracked, tabular numerals; zero renders nothing and values above 99 display `99+`. The original child text remains unchanged in the markup.
1047
+ ```tsx
1048
+ import { useState } from "react";
1049
+ import { Field, RichTextEditor, type RichTextDocument } from "@namroodinc/liquid-editorial";
80
1050
 
81
- Use `appearance="outline"` (the default) on board and selection cards, `appearance="soft"` in dense tables and toolbar counts, and `appearance="solid"` for the one state a row or tile emphasizes, such as a Cover asset badge. Soft badges have no visible stroke. Tags inside sentences also display uppercase, including path labels such as `/news`.
1051
+ export function ArticleBody() {
1052
+ const [document, setDocument] = useState<RichTextDocument>({ type: "doc", content: [] });
1053
+ return (
1054
+ <Field label="Body">
1055
+ {(binding) => (
1056
+ <RichTextEditor
1057
+ {...binding}
1058
+ format="json"
1059
+ value={document}
1060
+ onChange={setDocument}
1061
+ placeholder="Tell the story…"
1062
+ />
1063
+ )}
1064
+ </Field>
1065
+ );
1066
+ }
1067
+ ```
82
1068
 
83
- ## Forms and content models
1069
+ Use `value`/`onChange` for controlled content or `defaultValue` for local content. Sizes are `sm`, `md` (default), and `lg`; `isDisabled` prevents editing. `toolbarExtra` appends app controls. Unsupported JSON produces an error and remains uneditable until corrected.
1070
+
1071
+ Links open a URL modal from the toolbar or an existing body link. Saving preserves selected text/formatting; with no selection, the URL becomes linked text. Existing links offer Remove link. The application owns storage and any server-side processing of editor output.
1072
+
1073
+ ### FormEditor
84
1074
 
85
1075
  `FormEditor` renders standard fields in schema order. Applications own state, choice loading, permissions, submission, and persistence:
86
1076
 
@@ -125,15 +1115,60 @@ General forms can use select fields with `options: [{ value, label }]`, per-fiel
125
1115
 
126
1116
  Changes emit `onValueChange(nextValues, { fieldId })`. Use the changed field ID when adapting to APIs that accept patches, generated IDs, or dependent values. Runtime form schemas can hold JSX and live choices, so keep them separate from persisted content definitions. Picker field options such as `picker: { itemLabel: "image", itemsLabel: "images" }` provide contextual search and selection copy without putting data access in the library. `picker.label` overrides the field's name: its legend, accessible name, default "Choose …" action and required message. Omitted or `undefined` item and action options keep the asset or entry wording.
127
1117
 
128
- `RichTextEditor` also supports `format="json"` with `value`/`defaultValue` and an `onChange` callback receiving the document. HTML remains its default format. Unsupported JSON content produces an error and cannot be edited until corrected.
1118
+ ## Layout
1119
+
1120
+ ### Grid
1121
+
1122
+ Responsive layout primitives sharing the spacing scale. Grid defaults to `columns="auto"`, `gap="md"`, and stretch alignment. GridItem handles spans; Stack defaults to a vertical layout with `gap="md"`.
129
1123
 
130
- Links open a URL modal from the toolbar or by clicking an existing body link. Save preserves selected text and formatting; with no selection, it inserts the URL as linked text. Existing links offer Remove link in the modal.
1124
+ ```tsx
1125
+ import { Button, Grid, GridItem, Stack } from "@namroodinc/liquid-editorial";
1126
+
1127
+ <Grid
1128
+ columns={2}
1129
+ gap="lg"
1130
+ >
1131
+ <GridItem>
1132
+ <p>Article content</p>
1133
+ </GridItem>
1134
+ <GridItem>
1135
+ <p>Metadata</p>
1136
+ </GridItem>
1137
+ <GridItem span="full">
1138
+ <Stack
1139
+ direction="horizontal"
1140
+ justify="end"
1141
+ gap="sm"
1142
+ wrap
1143
+ >
1144
+ <Button>Save draft</Button>
1145
+ <Button variant="primary">Publish</Button>
1146
+ </Stack>
1147
+ </GridItem>
1148
+ </Grid>;
1149
+ ```
131
1150
 
132
- ## Table states
1151
+ Fixed column counts step down in narrow containers; `columns="auto"` uses `minColumnWidth`. Gap values are `none`, `xs`, `sm`, `md`, `lg`, `xl`, and `2xl`. `rowGap` can differ from the column gap. Use `as` for semantic elements and `align`/`justify` for placement.
1152
+
1153
+ ### Container
1154
+
1155
+ Constrains content to a reading/page width and provides a size container for responsive descendants. Defaults: `width="lg"`, `padded`, `center`, and `as="div"`.
1156
+
1157
+ ```tsx
1158
+ import { Container } from "@namroodinc/liquid-editorial";
1159
+
1160
+ <Container
1161
+ as="article"
1162
+ width="md"
1163
+ >
1164
+ <h1>The corner bookshop</h1>
1165
+ <p>A measured width for editorial content.</p>
1166
+ </Container>;
1167
+ ```
133
1168
 
134
- Empty `TableBody` children automatically show “No data found.” across the table; override the text with `Table.emptyMessage`. Use `isEmpty` when custom row components determine whether there are results, or set it to `false` to suppress the message while the UI loads data. Loading indicators and skeleton rows are composed by the consuming UI. Standalone `TableEmpty` uses the same default message and supports a custom `title`. See the [upgrade guide example](UPGRADING.md#013).
1169
+ Widths are `xs`, `sm`, `md`, `lg`, `xl`, and `full`. Use `padded={false}` inside an already padded surface or `center={false}` for start alignment. Use `as="main"` only when the surrounding layout does not already supply the main landmark.
135
1170
 
136
- ## App shell
1171
+ ### AppShell
137
1172
 
138
1173
  `AppShell` places a full-width `TopNav` above the desktop `SideNav` and a scrolling `main` landmark. Below 768px of **shell width**, a hamburger opens navigation in a right-side drawer. Its default height is `100dvh`; native `style`, `className`, div attributes, and a forwarded ref allow it to fit an embedded frame.
139
1174
 
@@ -142,19 +1177,35 @@ import { AppShell, Avatar, SideNavItem, SideNavSection } from "@namroodinc/liqui
142
1177
 
143
1178
  <AppShell
144
1179
  brand={<a href="/">Liquid</a>}
145
- navigation={<>
146
- <SideNavSection label="Workspace">
147
- <SideNavItem icon="home" label="Home" href="/" />
148
- <SideNavItem icon="file-text" label="Stories" href="/stories" isActive />
149
- </SideNavSection>
150
- </>}
151
- actions={(location) => <>
152
- <Avatar name="Ada Lovelace" size={32} />
153
- {location === "drawer" && <span>Ada Lovelace</span>}
154
- </>}
1180
+ navigation={
1181
+ <>
1182
+ <SideNavSection label="Workspace">
1183
+ <SideNavItem
1184
+ icon="home"
1185
+ label="Home"
1186
+ href="/"
1187
+ />
1188
+ <SideNavItem
1189
+ icon="file-text"
1190
+ label="Stories"
1191
+ href="/stories"
1192
+ isActive
1193
+ />
1194
+ </SideNavSection>
1195
+ </>
1196
+ }
1197
+ actions={(location) => (
1198
+ <>
1199
+ <Avatar
1200
+ name="Ada Lovelace"
1201
+ size={32}
1202
+ />
1203
+ {location === "drawer" && <span>Ada Lovelace</span>}
1204
+ </>
1205
+ )}
155
1206
  >
156
1207
  <h1>Stories</h1>
157
- </AppShell>
1208
+ </AppShell>;
158
1209
  ```
159
1210
 
160
1211
  Pass sections/items as `navigation`, without an enclosing SideNav, header, footer, or collapse control. Applications own destinations and `isActive`; AppShell closes the drawer when a navigation link is activated. `navigationLabel` defaults to `"Main"`. Keep shared application state outside the responsive slots and use React `useId` inside custom slot components that need IDs, since the desktop and drawer presentations can coexist during transitions.
@@ -165,13 +1216,41 @@ The drawer traps focus and locks body scroll. Escape, Close, the scrim, and navi
165
1216
 
166
1217
  With `scrollMode="document"` the window scrolls instead of `main`, the desktop navigation stays pinned below the top bar, and the drawer portals to `document.body` like Modal. It keeps the shell's `dir`; set themes on the document root as usual. `contentPadding="none"` lets a full-width page such as `EditLayout` own its spacing.
167
1218
 
168
- All `Drawer` variants have square corners and slide fully in and out through their anchored edge, with a fading scrim. Use `side="end"` (the default) for the right edge in LTR, `side="start"` for the left, and `side="bottom"` for a bottom sheet. Start and end mirror in RTL, including when passing `dir="rtl"` directly to Drawer. Motion uses `--duration-panel` and `--ease-panel`; reduced motion skips the transition. Closing immediately makes the exiting panel inert and accessibility-hidden, restores focus, releases its body-scroll lock, and removes the panel when the transition finishes. Nested drawers and modals keep scrolling locked until the last dialog closes, and only the most recently opened one handles Escape and Tab. While scrolling is locked, the body is padded by the width of the scrollbar it hid, so layouts that measure their own width keep their breakpoints. Tests checking actual DOM removal should await it rather than expect immediate unmounting. Keep Drawer mounted while changing `isOpen` so it can animate its exit.
1219
+ ### EditLayout
169
1220
 
170
- Side drawers have one outer border facing the page: the left border for a panel entering from the right, or the right border for one entering from the left. They have no outer top or bottom border. This applies to both variants and mirrors in RTL. Internal header/footer separators remain.
1221
+ A presentation layout for an edit page, composed inside the existing main landmark.
171
1222
 
172
- AppShell uses the shared `Drawer` with `variant="navigation"` and `side="end"`. For other navigation compositions, use the same variant for a compact width, header and footer. Drawer supports a React-node `title` and `closeLabel`; supply `aria-label` for a dialog name independent of its visual brand. By default the drawer portals to `document.body` and covers the viewport; for a navigation drawer, pass a positioned element as `portalContainer` to keep it inside that element. Default drawers retain their standard widths, shadow, and header/footer spacing. Both variants use the same slide, exit handling, and focus protection.
1223
+ ```tsx
1224
+ import { Button, EditLayout, Field, TextField } from "@namroodinc/liquid-editorial";
173
1225
 
174
- ## Edit pages
1226
+ export function EditArticle({ onBack, onSave }: { onBack: () => void; onSave: () => void }) {
1227
+ return (
1228
+ <EditLayout
1229
+ backLabel="Articles"
1230
+ onBack={onBack}
1231
+ saveState="dirty"
1232
+ actions={
1233
+ <Button
1234
+ variant="primary"
1235
+ onClick={onSave}
1236
+ >
1237
+ Save draft
1238
+ </Button>
1239
+ }
1240
+ rail={<p>Publication metadata</p>}
1241
+ >
1242
+ <Field label="Headline">
1243
+ {(binding) => (
1244
+ <TextField
1245
+ {...binding}
1246
+ defaultValue="The corner bookshop"
1247
+ />
1248
+ )}
1249
+ </Field>
1250
+ </EditLayout>
1251
+ );
1252
+ }
1253
+ ```
175
1254
 
176
1255
  `EditLayout` composes a sticky action bar, a centred unframed body and a Details
177
1256
  rail. Supply `backLabel`, `onBack`, `actions`, `rail` and body children. The layout
@@ -202,65 +1281,154 @@ client, after hydration. When a breakpoint, a collapse or a closing sheet
202
1281
  removes the focused control, focus moves to the Details toggle that replaced
203
1282
  it.
204
1283
 
205
- ## Image cropping
1284
+ ## Navigation
206
1285
 
207
- `ImageCropper` uses the library's custom engine with a fixed crop frame, diagonal background, shared `Slider` with a `Field` label/hint, and optional quarter-turn controls. Shared `Stack` components put the rotate/Reset buttons to the right of the zoom slider and wrap them below on narrow layouts. Supply one positive, finite `aspect` (width / height): `1` for an avatar, `16 / 9` for a cover, or `4 / 5` for a portrait.
1286
+ ### SideNav
1287
+
1288
+ Standalone collapsible navigation with header, sections, links, and footer. Collapse defaults to false; `isCollapsed`/`onCollapsedChange` support app-controlled state. `useSideNavCollapsed()` lets descendants adapt optional content.
208
1289
 
209
1290
  ```tsx
210
- import { useState } from "react";
211
1291
  import {
212
- Button,
213
- ImageCropper,
214
- cropToBlob,
215
- type CropRect,
216
- type CropState,
1292
+ SideNav,
1293
+ SideNavFooter,
1294
+ SideNavHeader,
1295
+ SideNavItem,
1296
+ SideNavSection,
1297
+ useSideNavCollapsed,
217
1298
  } from "@namroodinc/liquid-editorial";
218
1299
 
219
- function CoverCropper({
220
- src,
221
- onSave,
222
- }: {
223
- src: string;
224
- onSave: (blob: Blob) => void;
225
- }) {
226
- const [selection, setSelection] = useState<{
227
- crop: CropRect;
228
- state: CropState;
229
- } | null>(null);
1300
+ function WorkspaceFooter() {
1301
+ const collapsed = useSideNavCollapsed();
1302
+ return <SideNavFooter>{collapsed ? "LE" : "Liquid Editorial"}</SideNavFooter>;
1303
+ }
230
1304
 
231
- async function save() {
232
- if (!selection) return;
233
- const blob = await cropToBlob(src, selection.crop, {
234
- outputWidth: 1600,
235
- rotation: selection.state.rotation,
236
- type: "image/jpeg",
237
- });
238
- onSave(blob);
239
- }
1305
+ <SideNav label="Workspace">
1306
+ <SideNavHeader
1307
+ title="Liquid Editorial"
1308
+ mark="LE"
1309
+ />
1310
+ <SideNavSection label="Content">
1311
+ <SideNavItem
1312
+ icon="file-text"
1313
+ label="Articles"
1314
+ href="/articles"
1315
+ isActive
1316
+ />
1317
+ <SideNavItem
1318
+ icon="image"
1319
+ label="Assets"
1320
+ href="/assets"
1321
+ />
1322
+ </SideNavSection>
1323
+ <WorkspaceFooter />
1324
+ </SideNav>;
1325
+ ```
1326
+
1327
+ Links retain accessible names while collapsed; badges and section labels adapt visually. Set `isCollapsible={false}` on SideNavHeader for a permanently open rail. The app owns destinations and `isActive`. AppShell already creates the navigation frame: supply sections/items there.
1328
+
1329
+ ### TopNav
1330
+
1331
+ A top navigation bar with brand and actions slots. TopNavItem is a real anchor with an optional icon and `isActive`; the app owns routing.
1332
+
1333
+ ```tsx
1334
+ import { Button, TopNav, TopNavItem } from "@namroodinc/liquid-editorial";
1335
+
1336
+ <TopNav
1337
+ label="Product"
1338
+ brand={<a href="/">Liquid</a>}
1339
+ actions={<Button>Account</Button>}
1340
+ >
1341
+ <TopNavItem
1342
+ label="Content"
1343
+ href="/content"
1344
+ isActive
1345
+ />
1346
+ <TopNavItem
1347
+ label="Settings"
1348
+ href="/settings"
1349
+ />
1350
+ </TopNav>;
1351
+ ```
1352
+
1353
+ Give multiple navigation landmarks distinct names. AppShell supplies its own TopNav; use this family for custom compositions.
1354
+
1355
+ ### SubNav
1356
+
1357
+ Secondary navigation within a page. SubNavItem represents a destination; SubNavButton switches an in-place view using app-owned state. `label` names the navigation and `actions` adds trailing controls.
1358
+
1359
+ ```tsx
1360
+ import { useState } from "react";
1361
+ import { SubNav, SubNavButton, SubNavItem } from "@namroodinc/liquid-editorial";
240
1362
 
1363
+ export function ArticleSections() {
1364
+ const [view, setView] = useState("content");
241
1365
  return (
242
1366
  <>
243
- <ImageCropper
244
- src={src}
245
- alt="Article cover"
246
- aspect={16 / 9}
247
- onChange={(crop, state) => setSelection({ crop, state })}
248
- />
249
- <Button isDisabled={!selection} onClick={save}>
250
- Save crop
251
- </Button>
1367
+ <SubNav label="Article destinations">
1368
+ <SubNavItem
1369
+ label="Revisions"
1370
+ href="/articles/1/revisions"
1371
+ count={4}
1372
+ />
1373
+ </SubNav>
1374
+ <SubNav label="Editor views">
1375
+ {["content", "metadata"].map((item) => (
1376
+ <SubNavButton
1377
+ key={item}
1378
+ label={item}
1379
+ isActive={view === item}
1380
+ onClick={() => setView(item)}
1381
+ />
1382
+ ))}
1383
+ </SubNav>
1384
+ <section aria-label={view}>
1385
+ {view === "content" ? "Article body" : "Publication metadata"}
1386
+ </section>
252
1387
  </>
253
1388
  );
254
1389
  }
255
1390
  ```
256
1391
 
257
- Drag the image or focus the stage and use arrow keys (Shift for a larger step). The image always covers the fixed crop window; panning, zooming out, resizing, and rotation keep the crop inside the image. Zoom defaults to a maximum of `3`; set `maxZoom` to change it. Rotation is enabled by default; set `rotatable={false}` to hide its buttons. Reset clears pan, zoom, and rotation while retaining the supplied aspect.
1392
+ Active links use `aria-current`; buttons use `aria-pressed`. Items support an icon and count. The caller renders the matching content and handles any routing.
258
1393
 
259
- Changing `aspect` resets pan and zoom while preserving rotation. There is no ratio picker or implicit square default. `onChange(crop, state)` reports image-pixel coordinates plus pan, zoom, and quarter-turn rotation. `state.cx` and `state.cy` give the crop centre as fractions of the unrotated source. Save the whole `state` and pass it back as `defaultState` to reopen the same crop; the offsets are stage pixels and change with the stage size. `defaultState` is uncontrolled and is applied again whenever `src` changes. `cropToBlob` supports same-origin or CORS-enabled sources and remains usable after unmounting with the saved crop/state. The forwarded ref and native HTML attributes apply to the outer container.
1394
+ ### Stepper
1395
+
1396
+ Progress through ordered steps. `activeStep` is a zero-based index; earlier steps appear complete. Size defaults to `"md"`, with `"sm"` available for compact bands.
1397
+
1398
+ ```tsx
1399
+ import { useState } from "react";
1400
+ import { Button, Stepper } from "@namroodinc/liquid-editorial";
1401
+
1402
+ const steps = [
1403
+ { id: "content", label: "Content" },
1404
+ { id: "review", label: "Review" },
1405
+ { id: "publish", label: "Publish" },
1406
+ ];
1407
+
1408
+ export function PublishingSteps() {
1409
+ const [active, setActive] = useState(0);
1410
+ return (
1411
+ <>
1412
+ <Stepper
1413
+ label="Publication progress"
1414
+ steps={steps}
1415
+ activeStep={active}
1416
+ onStepChange={setActive}
1417
+ />
1418
+ <Button
1419
+ isDisabled={active === steps.length - 1}
1420
+ onClick={() => setActive(active + 1)}
1421
+ >
1422
+ Continue
1423
+ </Button>
1424
+ </>
1425
+ );
1426
+ }
1427
+ ```
260
1428
 
261
- Cropper.js has been removed; no third-party cropper initialization or styles are needed. Keep importing the library's `styles.css`. See [UPGRADING.md](UPGRADING.md#unreleased) for migration from the temporary native Cropper.js API or the earlier shape-picker API.
1429
+ Omit `onStepChange` for a read-only indicator. When provided, completed/current steps can be revisited; callbacks receive `(index, id)`. Steps can include descriptions. The app validates each stage and advances progress.
262
1430
 
263
- ## Pagination
1431
+ ### Pagination
264
1432
 
265
1433
  `Pagination` is controlled: keep the page and page size together in application state, and apply the single change callback. Import it from the package root or `@namroodinc/liquid-editorial/components/Pagination`.
266
1434
 
@@ -292,109 +1460,326 @@ Supply nonnegative integer totals, a positive integer page and page size, and a
292
1460
 
293
1461
  Zero results display “No results” and disable every control. `isDisabled` also disables everything. Boundary navigation buttons are disabled, and the size selector is disabled when the total is at most the smallest size option. Override the navigation's `aria-label` when rendering multiple pagination bars.
294
1462
 
295
- `Select.menuPlacement`, `Popover.placement`, and `DateField`/`DateRangeField.placement` accept `"top"` or `"bottom"`; they default to `"bottom"` and flip when space requires it. Shared Popover positioning also follows anchor/content resizing, clamps to viewport edges and scrolls tall panels. A Select with `aria-labelledby` shares that label with its listbox.
1463
+ ## Collections and media
296
1464
 
297
- ### Colour picker
1465
+ ### Table
298
1466
 
299
- `ColourField` combines a typed input with an adaptive picker; `ColourPanel` provides
300
- the same selection surface inline. Both are exported from the package root and
301
- `components/ColourField`. Compose the field with the shared Field frame:
1467
+ Composable native table elements with a shared frame, toolbar, and empty state.
302
1468
 
303
1469
  ```tsx
304
- const [colour, setColour] = useState("#0052CC");
305
- const [valid, setValid] = useState(true);
1470
+ import {
1471
+ Button,
1472
+ Table,
1473
+ TableBody,
1474
+ TableCell,
1475
+ TableEmpty,
1476
+ TableFrame,
1477
+ TableHead,
1478
+ TableHeaderCell,
1479
+ TableRow,
1480
+ TableToolbar,
1481
+ } from "@namroodinc/liquid-editorial";
306
1482
 
307
- <Field
308
- label="Accent colour"
309
- hint="Hex, rgb(), hsl() or a colour name."
310
- error={valid ? undefined : "Enter a valid colour."}
311
- >
312
- {(binding) => (
313
- <ColourField
314
- {...binding}
315
- value={colour}
316
- onValueChange={setColour}
317
- onValidityChange={setValid}
318
- presets={["#0052CC", "rebeccapurple", "#136C3F80", "transparent"]}
1483
+ <TableFrame>
1484
+ <TableToolbar
1485
+ start={<strong>Articles</strong>}
1486
+ end={<Button>Add article</Button>}
1487
+ />
1488
+ <Table>
1489
+ <caption>Latest articles</caption>
1490
+ <TableHead>
1491
+ <TableRow>
1492
+ <TableHeaderCell scope="col">Title</TableHeaderCell>
1493
+ <TableHeaderCell scope="col">Status</TableHeaderCell>
1494
+ </TableRow>
1495
+ </TableHead>
1496
+ <TableBody>
1497
+ <TableRow>
1498
+ <TableCell emphasis="primary">The corner bookshop</TableCell>
1499
+ <TableCell>Draft</TableCell>
1500
+ </TableRow>
1501
+ </TableBody>
1502
+ </Table>
1503
+ </TableFrame>;
1504
+
1505
+ // Standalone empty surface outside a table:
1506
+ <TableEmpty
1507
+ title="No matching articles"
1508
+ description="Try another search."
1509
+ />;
1510
+ ```
1511
+
1512
+ Empty TableBody children automatically show “No data found.” across the table. Override with `emptyMessage`; use `isEmpty` when custom row components determine results, or `isEmpty={false}` while loading. The consuming UI composes skeleton rows/loading indicators. Standalone TableEmpty supports an optional icon, description, and action.
1513
+
1514
+ TableRow supports `isSelected` and `isInteractive`; an interactive appearance still needs real link/Button controls and handlers. Cells support `align="start"`/`"end"`, `width="control"`, and emphasis `default`/`primary`/`muted`. Preserve captions/header scopes. Set native `colSpan` explicitly when composing custom spanning cells.
1515
+
1516
+ ### Board
1517
+
1518
+ Drag-and-drop columns/cards with keyboard support. Supply stable IDs and `itemIds` in render order. Board reports moves and the application applies them to its data.
1519
+
1520
+ ```tsx
1521
+ import { useState } from "react";
1522
+ import { Board, BoardCard, BoardColumn, type BoardMove } from "@namroodinc/liquid-editorial";
1523
+
1524
+ export function EditorialBoard() {
1525
+ const [lanes, setLanes] = useState([
1526
+ { id: "draft", title: "Draft", cards: ["Article one"] },
1527
+ { id: "review", title: "Review", cards: [] as string[] },
1528
+ ]);
1529
+ function move({ cardId, fromColumnId, toColumnId, toIndex }: BoardMove) {
1530
+ setLanes((current) =>
1531
+ current.map((lane) => {
1532
+ const cards =
1533
+ lane.id === fromColumnId ? lane.cards.filter((id) => id !== cardId) : [...lane.cards];
1534
+ if (lane.id === toColumnId) {
1535
+ cards.splice(toIndex, 0, cardId);
1536
+ }
1537
+ return { ...lane, cards };
1538
+ }),
1539
+ );
1540
+ }
1541
+ return (
1542
+ <Board onMove={move}>
1543
+ {lanes.map((lane) => (
1544
+ <BoardColumn
1545
+ key={lane.id}
1546
+ id={lane.id}
1547
+ title={lane.title}
1548
+ itemIds={lane.cards}
1549
+ >
1550
+ {lane.cards.map((id) => (
1551
+ <BoardCard
1552
+ key={id}
1553
+ id={id}
1554
+ columnId={lane.id}
1555
+ label={id}
1556
+ >
1557
+ {id}
1558
+ </BoardCard>
1559
+ ))}
1560
+ </BoardColumn>
1561
+ ))}
1562
+ </Board>
1563
+ );
1564
+ }
1565
+ ```
1566
+
1567
+ Card IDs are unique across the board. Set `columnIds` and handle `onColumnMove({ columnId, toIndex })` to reorder columns; `isDraggable={false}` pins a column. Optional drag-overlay renderers customize previews. Give cards meaningful labels for drag announcements; the application owns persistence and any optimistic updates.
1568
+
1569
+ ### SortableList
1570
+
1571
+ An ordered drag-and-drop list with keyboard support. It maintains the shown order during interactions and emits the complete next ID array through `onReorder`; synchronize application state to persist it.
1572
+
1573
+ ```tsx
1574
+ import { useState } from "react";
1575
+ import { SortableList, SortableListItem } from "@namroodinc/liquid-editorial";
1576
+
1577
+ export function ReadingOrder() {
1578
+ const [items, setItems] = useState(["Introduction", "Main story", "Credits"]);
1579
+ return (
1580
+ <SortableList
1581
+ items={items}
1582
+ onReorder={setItems}
1583
+ >
1584
+ {items.map((id) => (
1585
+ <SortableListItem
1586
+ key={id}
1587
+ id={id}
1588
+ label={id}
1589
+ >
1590
+ {id}
1591
+ </SortableListItem>
1592
+ ))}
1593
+ </SortableList>
1594
+ );
1595
+ }
1596
+ ```
1597
+
1598
+ Use stable unique IDs in render order. SortableListItem accepts an `action` slot for a Button/Menu; `renderDragOverlay` overrides the default row-content preview. Name each item for keyboard drag announcements.
1599
+
1600
+ ### AssetCard
1601
+
1602
+ A reusable asset preview with filename, metadata, selection, and action slots. `fit="cover"` is the default; `"contain"` shows the complete image. Omit `src` to display the fallback icon.
1603
+
1604
+ ```tsx
1605
+ import { useState } from "react";
1606
+ import { AssetCard, AssetCardSkeleton, Button } from "@namroodinc/liquid-editorial";
1607
+
1608
+ export function CoverCard({ onEdit }: { onEdit: () => void }) {
1609
+ const [selected, setSelected] = useState(false);
1610
+ return (
1611
+ <AssetCard
1612
+ name="Cover.jpg"
1613
+ src="/cover.jpg"
1614
+ alt="Bookshop entrance"
1615
+ meta="1600 × 900"
1616
+ isSelected={selected}
1617
+ onSelect={() => setSelected(!selected)}
1618
+ footer={
1619
+ <Button
1620
+ size="sm"
1621
+ onClick={onEdit}
1622
+ >
1623
+ Edit crop
1624
+ </Button>
1625
+ }
319
1626
  />
320
- )}
321
- </Field>
322
- ```
323
-
324
- Values emit as uppercase `#RRGGBB` or `#RRGGBBAA` with transparency. Deleting all
325
- text emits `""`. Valid drafts stay typed until blur or Enter; invalid drafts remain
326
- visible and mark the input invalid without committing them. `onValidityChange`
327
- reports parsing validity; empty values are parse-valid and native `required` is
328
- separate. Hex with or without `#` (3/4/6/8 digits), RGB/RGBA, HSL/HSLA, named colours
329
- and `transparent` are accepted. CSS variables, `currentColor` and additional colour
330
- spaces are outside this API.
331
-
332
- Use `defaultValue` for uncontrolled inputs/panels, `picker="native"` for OS colour
333
- selection, and `showPresets={false}` to hide supplied presets. Both modes retain an
334
- opacity slider; native selection and the optional supported screen eyedropper
335
- preserve opacity. Presets replace the entire colour. The custom panel supports
336
- pointer/keyboard adjustments and remembers hue through grey and black. Use
337
- `placement="top"` to prefer opening above the field. Normal textbox props, refs,
338
- `size`, `readOnly`, `isDisabled` and `isInvalid` are supported. FormEditor schemas
339
- are unchanged.
1627
+ );
1628
+ }
340
1629
 
341
- ## Themes and fonts
1630
+ <AssetCardSkeleton
1631
+ description
1632
+ footer
1633
+ />;
1634
+ ```
342
1635
 
343
- Set `data-theme` on the document root to `light`, `dark`, `cherry-glaze`, or `black-hawaii`. The default font tokens use system stacks and can be overridden by the consumer without downloading bundled font files:
1636
+ `onSelect` makes the thumbnail a toggle independent of `actions` overlays and the `footer`. `isPending` shows an uploading overlay and disables thumbnail selection. Use `description` for supporting text. Match skeleton `description`/`footer` slots to the card that will replace it.
344
1637
 
345
- ```css
346
- :root {
347
- --font-sans: "Your Sans", ui-sans-serif, system-ui, sans-serif;
348
- --font-mono: "Your Mono", ui-monospace, monospace;
1638
+ ### AssetGrid
1639
+
1640
+ An auto-filling media grid. `isLoading` substitutes eight skeletons by default; `loadingCount` and `loadingCard` control their number and reserved slots. Empty states are composed explicitly.
1641
+
1642
+ ```tsx
1643
+ import {
1644
+ AssetGrid,
1645
+ AssetGridEmpty,
1646
+ AssetTile,
1647
+ AssetTileSkeleton,
1648
+ } from "@namroodinc/liquid-editorial";
1649
+
1650
+ export function MediaLibrary({
1651
+ isLoading,
1652
+ files,
1653
+ }: {
1654
+ isLoading: boolean;
1655
+ files: { id: string; name: string; src: string }[];
1656
+ }) {
1657
+ return (
1658
+ <>
1659
+ <AssetGrid
1660
+ isLoading={isLoading}
1661
+ loadingCount={4}
1662
+ >
1663
+ {files.map((file) => (
1664
+ <AssetTile
1665
+ key={file.id}
1666
+ name={file.name}
1667
+ src={file.src}
1668
+ alt=""
1669
+ />
1670
+ ))}
1671
+ </AssetGrid>
1672
+ {!isLoading && files.length === 0 && (
1673
+ <AssetGridEmpty
1674
+ title="No assets yet"
1675
+ description="Upload a cover to begin."
1676
+ />
1677
+ )}
1678
+ </>
1679
+ );
349
1680
  }
1681
+
1682
+ <AssetTileSkeleton />;
350
1683
  ```
351
1684
 
352
- ## Development
1685
+ AssetTile and AssetTileSkeleton are compatibility aliases of AssetCard and AssetCardSkeleton. Place the grid in TableFrame for a collection page or directly inside a drawer. The application loads files and supplies upload/select actions.
353
1686
 
354
- ```sh
355
- npm install
356
- npm run storybook
357
- npm test
358
- npm run test:coverage
359
- npm run build
360
- npm run lint
361
- npm run format
362
- npm run validate
1687
+ ### ImageCropper
1688
+
1689
+ `ImageCropper` uses the library's custom engine with a fixed crop frame, diagonal background, shared `Slider` with a `Field` label/hint, and optional quarter-turn controls. Shared `Stack` components put the rotate/Reset buttons to the right of the zoom slider and wrap them below on narrow layouts. Supply one positive, finite `aspect` (width / height): `1` for an avatar, `16 / 9` for a cover, or `4 / 5` for a portrait.
1690
+
1691
+ ```tsx
1692
+ import { useState } from "react";
1693
+ import {
1694
+ Button,
1695
+ ImageCropper,
1696
+ cropToBlob,
1697
+ type CropRect,
1698
+ type CropState,
1699
+ } from "@namroodinc/liquid-editorial";
1700
+
1701
+ function CoverCropper({ src, onSave }: { src: string; onSave: (blob: Blob) => void }) {
1702
+ const [selection, setSelection] = useState<{
1703
+ crop: CropRect;
1704
+ state: CropState;
1705
+ } | null>(null);
1706
+
1707
+ async function save() {
1708
+ if (!selection) {
1709
+ return;
1710
+ }
1711
+ const blob = await cropToBlob(src, selection.crop, {
1712
+ outputWidth: 1600,
1713
+ rotation: selection.state.rotation,
1714
+ type: "image/jpeg",
1715
+ });
1716
+ onSave(blob);
1717
+ }
1718
+
1719
+ return (
1720
+ <>
1721
+ <ImageCropper
1722
+ src={src}
1723
+ alt="Article cover"
1724
+ aspect={16 / 9}
1725
+ onChange={(crop, state) => setSelection({ crop, state })}
1726
+ />
1727
+ <Button
1728
+ isDisabled={!selection}
1729
+ onClick={save}
1730
+ >
1731
+ Save crop
1732
+ </Button>
1733
+ </>
1734
+ );
1735
+ }
363
1736
  ```
364
1737
 
365
- `npm run lint` runs ESLint, Stylelint (`stylelint-config-standard` with the library's BEM class pattern) and a Prettier check. `npm run format` rewrites TypeScript, scripts and CSS to match. Prettier wraps at 100 characters and puts each JSX attribute on its own line once an element has more than one. Stylesheets use one declaration per line and nest an element's state variants under its block. The aggregate `src/styles.css` lists each component after the components it imports or overrides; a test enforces that order.
1738
+ Drag the image or focus the stage and use arrow keys (Shift for a larger step). The image always covers the fixed crop window; panning, zooming out, resizing, and rotation keep the crop inside the image. Zoom defaults to a maximum of `3`; set `maxZoom` to change it. Rotation is enabled by default; set `rotatable={false}` to hide its buttons. Reset clears pan, zoom, and rotation while retaining the supplied aspect.
1739
+
1740
+ Changing `aspect` resets pan and zoom while preserving rotation. There is no ratio picker or implicit square default. `onChange(crop, state)` reports image-pixel coordinates plus pan, zoom, and quarter-turn rotation. `state.cx` and `state.cy` give the crop centre as fractions of the unrotated source. Save the whole `state` and pass it back as `defaultState` to reopen the same crop; the offsets are stage pixels and change with the stage size. `defaultState` is uncontrolled and is applied again whenever `src` changes. `cropToBlob` supports same-origin or CORS-enabled sources and remains usable after unmounting with the saved crop/state. The forwarded ref and native HTML attributes apply to the outer container.
366
1741
 
367
- Storybook is the component catalogue and documentation surface. Stories and tests live beside each component in `src/components/<Family>/`.
1742
+ ## Themes and fonts
368
1743
 
369
- ## Publishing
1744
+ Set `data-theme` on the document root to `light` (the default), `dark`, `cherry-glaze`, or `black-hawaii`. The system font stacks can be overridden with tokens; the package does not download bundled fonts.
370
1745
 
371
- Merge a PR into `main` to publish a release. Every push to `main` runs [the release workflow](.github/workflows/release.yml), which installs dependencies, bumps the version, moves the `Unreleased` upgrade notes under that version, and runs `npm run validate`. It then commits the version files and guide back to `main` and publishes `@namroodinc/liquid-editorial` to npm under `latest`. All commands run in GitHub Actions; contributors do not run local release commands or create GitHub Releases or tags. Other branches and pull requests do not publish.
1746
+ ```css
1747
+ :root {
1748
+ --font-sans: "Your Sans", ui-sans-serif, system-ui, sans-serif;
1749
+ --font-mono: "Your Mono", ui-monospace, monospace;
1750
+ }
1751
+ ```
1752
+
1753
+ Theme tokens are included in `styles.css`. Import `@namroodinc/liquid-editorial/tokens.css` when you only need the token system. Keep themes on the document root so body-portaled dialogs and popovers inherit them. Layouts support RTL and reduced-motion preferences where described in their guides.
372
1754
 
373
- ### One-time npm setup
1755
+ ## Upgrading
374
1756
 
375
- After pushing the workflow to GitHub, open [the package settings](https://www.npmjs.com/package/@namroodinc/liquid-editorial/access) and add a GitHub Actions trusted publisher with:
1757
+ Read [UPGRADING.md](https://github.com/namroodinc/liquid-editorial/blob/main/UPGRADING.md) for adoption, compatibility, and verification steps between your previous and installed versions. The guide and AGENTS.md ship alongside the package manifest in `node_modules/@namroodinc/liquid-editorial/`.
376
1758
 
377
- - Organization or user: `namroodinc`
378
- - Repository: `liquid-editorial`
379
- - Workflow filename: `release.yml`
380
- - Environment: leave empty
381
- - Allowed action: enable direct publishing with `npm publish`
1759
+ Agents working in consuming projects should read every intervening upgrade entry and run that project's checks. Historical migrations, including the temporary Cropper.js API and EntryEditor rename, live in their versioned entries. Current examples above use the supported APIs.
382
1760
 
383
- Alternatively, with npm 11.15 or newer and an authenticated maintainer account, run:
1761
+ ## Contributing
1762
+
1763
+ Read [AGENTS.md](https://github.com/namroodinc/liquid-editorial/blob/main/AGENTS.md). Every change needs a decision document and Unreleased adoption/compatibility/verification notes. Use the shared Button for controls and follow the existing tokens and Field composition.
384
1764
 
385
1765
  ```sh
386
- npm trust github @namroodinc/liquid-editorial --repo namroodinc/liquid-editorial --file release.yml --allow-publish
1766
+ npm install
1767
+ npm run storybook
1768
+ npm run validate
1769
+ npm run fallow:report
387
1770
  ```
388
1771
 
389
- npm requires two-factor verification for this setup. The workflow subsequently authenticates through OIDC without an `NPM_TOKEN` secret. Complete the first workflow publish within two days of adding the trusted publisher to avoid configuration expiry. See [npm's trusted publishing guide](https://docs.npmjs.com/trusted-publishers/) for the current setup requirements.
1772
+ Storybook runs on port 6006. Stories/tests live beside each family. `npm run validate` runs ESLint, Stylelint, formatting checks, TypeScript, tests with coverage, the Storybook build, package lint/type checks, packed ESM/CommonJS smoke checks on React 18/19, and Fallow. `npm run format` rewrites formatting; `npm run lint` checks it. The aggregate stylesheet order is checked by tests.
1773
+
1774
+ `npm run fallow` checks dead code, duplication, and cyclomatic/cognitive complexity without writing reports. `npm run test:coverage && npm run fallow:report` refreshes [the report](https://github.com/namroodinc/liquid-editorial/blob/main/reports/fallow-report.md) and its raw JSON with current coverage. Estimated change-risk advisories stay visible and non-blocking; confirmed findings fail both commands. Keep the original baseline and thresholds.
390
1775
 
391
- ### Release a change
1776
+ ### Publishing
392
1777
 
393
- Add the change's adoption, compatibility, and verification notes under `Unreleased` in `UPGRADING.md`, then merge the PR to `main`. The workflow handles the version bump; for example, `0.1.4` becomes `0.1.5`. When a change removes or renames public API, add a `### Breaking changes` section under `Unreleased` that lists it. The workflow then bumps the minor version below 1.0 (`0.1.11` becomes `0.2.0`) and the major version from 1.0, so caret ranges do not pick it up. Pull the generated version commit before continuing local work.
1778
+ Every push to `main` triggers [the release workflow](https://github.com/namroodinc/liquid-editorial/blob/main/.github/workflows/release.yml). It bumps the package/lockfile version, versions Unreleased upgrade notes, validates, commits the release files, and publishes to npm under `latest`. Related changes share one Unreleased section. Contributors leave version increments to this workflow.
394
1779
 
395
- Follow **Publish to npm** in GitHub Actions to check the result. Runs are serialized, and the bot's version commit uses `GITHUB_TOKEN`, which does not trigger another workflow run.
1780
+ A `### Breaking changes` heading under Unreleased triggers a minor bump below 1.0 or a major bump from 1.0; other changes get a patch bump. Pull the generated version commit before continuing work. Pull requests and other branches do not publish. The workflow uses npm trusted publishing and does not create release tags or GitHub Releases; maintainer setup belongs in the repository's package/publisher settings.
396
1781
 
397
- Failures stop the workflow. If validation or the version push fails, npm publishing does not run. If publishing fails after the version commit is pushed, that commit stays on `main`; rerunning the workflow bumps to the next patch version. The workflow does not roll back versions or create GitHub Releases or tags.
1782
+ Validation or version-push failures stop publishing. If publication fails after the release commit is pushed, that commit remains on main and rerunning the workflow bumps the next version. Check the Publish to npm workflow run for its outcome.
398
1783
 
399
1784
  ## License
400
1785