@namroodinc/liquid-editorial 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -0
- package/README.md +1576 -180
- package/UPGRADING.md +215 -0
- package/dist/chunks/ColourField-CJicr3OT.cjs +2 -0
- package/dist/chunks/ColourField-CJicr3OT.cjs.map +1 -0
- package/dist/chunks/{ColourField-C2YDshDg.js → ColourField-DjHRiFDU.js} +167 -162
- package/dist/chunks/ColourField-DjHRiFDU.js.map +1 -0
- package/dist/chunks/DatePicker-D_6CQpUd.js +296 -0
- package/dist/chunks/DatePicker-D_6CQpUd.js.map +1 -0
- package/dist/chunks/DatePicker-aSlYLjtW.cjs +2 -0
- package/dist/chunks/DatePicker-aSlYLjtW.cjs.map +1 -0
- package/dist/chunks/FormEditor-M7tNidFo.js +584 -0
- package/dist/chunks/FormEditor-M7tNidFo.js.map +1 -0
- package/dist/chunks/FormEditor-UzbPdiJo.cjs +2 -0
- package/dist/chunks/FormEditor-UzbPdiJo.cjs.map +1 -0
- package/dist/chunks/Slider-k8weRl34.cjs +2 -0
- package/dist/chunks/Slider-k8weRl34.cjs.map +1 -0
- package/dist/chunks/Slider-vdMFLX-H.js +174 -0
- package/dist/chunks/Slider-vdMFLX-H.js.map +1 -0
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs +2 -0
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +1 -0
- package/dist/chunks/dialogFocus-BFoyeTpA.js +48 -0
- package/dist/chunks/dialogFocus-BFoyeTpA.js.map +1 -0
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.d.cts.map +1 -1
- package/dist/components/Choice/index.d.ts.map +1 -1
- package/dist/components/Choice/index.js +2 -0
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/ColourField/focus.d.cts +0 -1
- package/dist/components/ColourField/focus.d.cts.map +1 -1
- package/dist/components/ColourField/focus.d.ts +0 -1
- package/dist/components/ColourField/focus.d.ts.map +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/ColourField/value.d.cts +6 -0
- package/dist/components/ColourField/value.d.cts.map +1 -1
- package/dist/components/ColourField/value.d.ts +6 -0
- package/dist/components/ColourField/value.d.ts.map +1 -1
- package/dist/components/DatePicker/date.d.cts +9 -0
- package/dist/components/DatePicker/date.d.cts.map +1 -0
- package/dist/components/DatePicker/date.d.ts +9 -0
- package/dist/components/DatePicker/date.d.ts.map +1 -0
- package/dist/components/DatePicker/index.cjs +1 -2
- package/dist/components/DatePicker/index.d.cts +9 -6
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +9 -6
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +1 -259
- package/dist/components/DatePicker/style.css +5 -0
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +69 -73
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +68 -55
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/Field/style.css +20 -0
- package/dist/components/FormEditor/README.md +375 -0
- package/dist/components/FormEditor/additional-control.d.cts +6 -0
- package/dist/components/FormEditor/additional-control.d.cts.map +1 -0
- package/dist/components/FormEditor/additional-control.d.ts +6 -0
- package/dist/components/FormEditor/additional-control.d.ts.map +1 -0
- package/dist/components/FormEditor/choice-control.d.cts +6 -0
- package/dist/components/FormEditor/choice-control.d.cts.map +1 -0
- package/dist/components/FormEditor/choice-control.d.ts +6 -0
- package/dist/components/FormEditor/choice-control.d.ts.map +1 -0
- package/dist/components/FormEditor/control.d.cts +8 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +8 -0
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +68 -2
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +68 -2
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/style.css +12 -0
- package/dist/components/Grid/style.css +2 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/ImageCropper/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +40 -48
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.cjs.map +1 -1
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +4 -0
- package/dist/components/NumberField/index.js.map +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts +2 -0
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +45 -44
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.d.cts.map +1 -1
- package/dist/components/SelectionCard/index.d.ts.map +1 -1
- package/dist/components/SelectionCard/index.js +2 -1
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/Slider/index.cjs +1 -2
- package/dist/components/Slider/index.d.cts +14 -1
- package/dist/components/Slider/index.d.cts.map +1 -1
- package/dist/components/Slider/index.d.ts +14 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -127
- package/dist/components/Slider/scale.d.cts +13 -0
- package/dist/components/Slider/scale.d.cts.map +1 -0
- package/dist/components/Slider/scale.d.ts +13 -0
- package/dist/components/Slider/scale.d.ts.map +1 -0
- package/dist/elements.css +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -20
- package/dist/internal/dialogFocus.d.cts +17 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -0
- package/dist/internal/dialogFocus.d.ts +17 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -0
- package/dist/reset.css +2 -0
- package/dist/styles.css +1 -0
- package/package.json +2 -2
- package/dist/chunks/ColourField-C2YDshDg.js.map +0 -1
- package/dist/chunks/ColourField-Dc9533G6.cjs +0 -2
- package/dist/chunks/ColourField-Dc9533G6.cjs.map +0 -1
- package/dist/chunks/FormEditor-DRmPFe2E.js +0 -328
- package/dist/chunks/FormEditor-DRmPFe2E.js.map +0 -1
- package/dist/chunks/FormEditor-PVkvKep1.cjs +0 -2
- package/dist/chunks/FormEditor-PVkvKep1.cjs.map +0 -1
- package/dist/components/DatePicker/index.cjs.map +0 -1
- package/dist/components/DatePicker/index.js.map +0 -1
- package/dist/components/Slider/index.cjs.map +0 -1
- package/dist/components/Slider/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,86 +1,1078 @@
|
|
|
1
1
|
# Liquid Editorial
|
|
2
2
|
|
|
3
|
-
Accessible React components for editorial products.
|
|
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
|
-
|
|
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
|
-
|
|
17
|
+
```tsx
|
|
18
|
+
import "@namroodinc/liquid-editorial/styles.css";
|
|
19
|
+
import { Button } from "@namroodinc/liquid-editorial";
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
<Button variant="primary">Save draft</Button>;
|
|
22
|
+
```
|
|
16
23
|
|
|
17
|
-
|
|
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/
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
26
|
-
{(
|
|
27
|
-
|
|
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>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
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>
|
|
28
246
|
);
|
|
29
247
|
}
|
|
30
248
|
```
|
|
31
249
|
|
|
32
|
-
`
|
|
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. Pass `tabIndex={-1}` to a dialog panel so a click on its non-interactive content keeps focus inside it, where the caller's Escape handling still runs. 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
|
|
33
494
|
|
|
34
|
-
`
|
|
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.
|
|
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.
|
|
41
496
|
|
|
42
497
|
```tsx
|
|
43
|
-
|
|
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
|
|
520
|
+
|
|
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.
|
|
522
|
+
|
|
523
|
+
```tsx
|
|
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
|
-
<
|
|
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. `valueText` replaces the printed number (both numbers on RangeSlider) and is announced as `aria-valuetext`, for example `"Not set"` or `"Medium"`. `onValueCommit` reports the shown value after a click or step key on a thumb, even when it did not move, which lets a fallback position be accepted. RangeSlider's `hasFill={false}` leaves the span between the thumbs unpainted, so no range reads as chosen. Range thumbs stay exactly one step apart, including decimal steps such as `0.1`. 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
|
+
}
|
|
48
819
|
```
|
|
49
820
|
|
|
50
|
-
|
|
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.
|
|
821
|
+
A controlled search must reset its value in `onClear`. The application owns filtering, debouncing, requests, and results announcements.
|
|
58
822
|
|
|
59
|
-
|
|
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.
|
|
60
826
|
|
|
61
827
|
```tsx
|
|
62
|
-
import {
|
|
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
|
+
}
|
|
63
850
|
```
|
|
64
851
|
|
|
65
|
-
Use `
|
|
852
|
+
Use `defaultValue` for uncontrolled selection, `placeholder` for an empty display, and `isDisabled`/`isInvalid` for field states. Its trigger uses the shared `--field-radius`, matching text and colour fields; the floating menu uses the shared overlay radius. 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.
|
|
66
857
|
|
|
67
858
|
```tsx
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
}
|
|
71
876
|
```
|
|
72
877
|
|
|
73
|
-
|
|
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.
|
|
74
879
|
|
|
75
|
-
|
|
880
|
+
### DatePicker
|
|
76
881
|
|
|
77
|
-
|
|
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.
|
|
78
883
|
|
|
79
|
-
|
|
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";
|
|
80
894
|
|
|
81
|
-
|
|
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. Opt into `isClearable` on DateField or DateRangeField; DateField also accepts `clearLabel` (default `"Clear date"`). Opening focuses the selected day, or today when the value is empty or invalid, moved inside `min`/`max`; that day is also the arrow-key starting point. Escape closes the calendar and restores its trigger without closing an enclosing dialog, including after a click on the calendar's heading or padding. 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
|
+
}
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
Use `defaultValue` for local state, `max` to cap additions, and `isDisabled`/`isInvalid` for field states. Sizes are `sm`, `md` (default), and `lg`.
|
|
962
|
+
|
|
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.
|
|
966
|
+
|
|
967
|
+
```tsx
|
|
968
|
+
import { useState } from "react";
|
|
969
|
+
import { ColourField, ColourPanel, Field } from "@namroodinc/liquid-editorial";
|
|
82
970
|
|
|
83
|
-
|
|
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
|
+
}
|
|
999
|
+
```
|
|
1000
|
+
|
|
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. Escape closes the picker and restores its opener without closing an enclosing Modal or Drawer, including after a click on the picker's padding or labels. FormEditor exposes it through `type: "colour"`.
|
|
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.
|
|
1010
|
+
|
|
1011
|
+
```tsx
|
|
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
|
+
}
|
|
1039
|
+
```
|
|
1040
|
+
|
|
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`.
|
|
1042
|
+
|
|
1043
|
+
### RichTextEditor
|
|
1044
|
+
|
|
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.
|
|
1046
|
+
|
|
1047
|
+
```tsx
|
|
1048
|
+
import { useState } from "react";
|
|
1049
|
+
import { Field, RichTextEditor, type RichTextDocument } from "@namroodinc/liquid-editorial";
|
|
1050
|
+
|
|
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
|
+
```
|
|
1068
|
+
|
|
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
|
|
1074
|
+
|
|
1075
|
+
The [FormEditor reference for agents](src/components/FormEditor/README.md) contains every schema option, default, value shape, examples, and the extension checklist. Installed packages include the same guide at `dist/components/FormEditor/README.md` ([packaged reference](dist/components/FormEditor/README.md)). Read it before integrating or extending the editor.
|
|
84
1076
|
|
|
85
1077
|
`FormEditor` renders standard fields in schema order. Applications own state, choice loading, permissions, submission, and persistence:
|
|
86
1078
|
|
|
@@ -96,6 +1088,7 @@ import {
|
|
|
96
1088
|
const schema: FormSchema = {
|
|
97
1089
|
fields: [
|
|
98
1090
|
{ id: "title", type: "shortText", label: "Title", required: true },
|
|
1091
|
+
{ id: "status", type: "select", label: "Status", options: [{ value: "draft", label: "Draft" }, { value: "published", label: "Published" }] },
|
|
99
1092
|
{ id: "gallery", type: "asset", label: "Gallery", multiple: true },
|
|
100
1093
|
],
|
|
101
1094
|
};
|
|
@@ -115,25 +1108,78 @@ export function ContentEditor() {
|
|
|
115
1108
|
// Before saving: validateFormValues(schema, value) returns errors keyed by field ID.
|
|
116
1109
|
```
|
|
117
1110
|
|
|
118
|
-
Supported types are `shortText`, `longText`, `richText`, `number`, `boolean`, `dateTime`, `asset`, `reference`,
|
|
1111
|
+
Supported field types are `shortText`, `longText`, `richText`, `number`, `boolean`, `dateTime`, `asset`, `reference`, `select`, `slider`, `rangeSlider`, `colour`, `radioGroup`, `checkboxGroup`, `tags`, and `date`. Rich text stores a TipTap JSON document rooted at `doc`. Date-times use UTC ISO strings ending in `Z`; calendar dates use `YYYY-MM-DD`. Assets store `{ assetId }`; references store `{ entryId }`. Set `multiple: true` for an ordered array of these objects. `FormItem` includes value-bearing `FormField` and layout-only `FormDivider`: add `{ id: "section-rule", type: "divider" }` to span all columns without creating a value or validation error.
|
|
119
1112
|
|
|
120
|
-
|
|
1113
|
+
Radio and checkbox fields are groups, including when `options` contains one item. Set `appearance: "default" | "card"` and optional `columns: 1 | 2 | 3`. Options use `{ value, label, description?, isDisabled? }`. Radios store a string; checkboxes and tags store string arrays. Required groups need a selection; existing boolean switches still accept `false`. Range sliders store `{ min, max }` numbers. Colour fields support presets, alpha, and custom/native pickers, emitting canonical hex for valid edits and retaining invalid drafts for form validation.
|
|
121
1114
|
|
|
122
|
-
|
|
1115
|
+
**Select dropdowns** use `type: "select"` with `options: [{ value, label }]`. **Group option columns** use `columns: 1 | 2 | 3` on each `radioGroup` or `checkboxGroup` field, with either appearance. This controls options per row within that group; `<FormEditor columns={...}>` controls whole fields per row. Standalone ChoiceGroup and SelectionCardGroup also accept a `columns` prop. See the [agent guide examples](src/components/FormEditor/README.md#columns-within-each-group) and the FormEditor **GroupColumns** story for a live demonstration.
|
|
1116
|
+
|
|
1117
|
+
**Date picker types:** `date` renders the shared custom calendar popover and stores a day such as `"2026-11-02"`. `dateTime` renders the browser's native date-and-time input and stores a UTC timestamp such as `"2026-11-02T09:00:00.000Z"`; its label includes `(UTC)`. The native picker varies by browser/OS. Choose the type for the value your application needs.
|
|
1118
|
+
|
|
1119
|
+
Use `defaultValue` for an uncontrolled editor, `errors` for app-specific messages, `showAllErrors` after a submit attempt, and `isDisabled` to disable editing. Required and format errors appear after a field changes; loaded numeric, slider, range, calendar-date and colour fields validate immediately, except blank date and colour strings, which wait like other empty fields. `false` and `0` are populated values. Missing keys render controls without emitting changes; sliders show fallback positions without storing them. An unset slider or range slider prints `placeholder` or `"Not set"` (an unset range also has no fill) until a click or arrow key on a thumb stores the shown position or full range. Loaded slider values outside the scale, or reversed ranges, are drawn clamped and ordered while validation still reports them. Clearing a number, date, colour, select, radio group or single picker removes its key; empty text, rich-text documents and lists keep their shapes. Unrelated keys are preserved. Validation runs per field and is reused until that field or its value changes, so define schemas outside render or memoize them.
|
|
1120
|
+
|
|
1121
|
+
General forms can use select fields with `options: [{ value, label }]`, per-field `isDisabled`, and React-node hints. Optional selects lead with an empty choice, labelled with the field's `placeholder` or "None", that clears the value. Pass `options: []` while choices load; a stored value stays valid until they arrive. Text fields support `maxLength` and `readOnly`; short text also supports `inputType: "email"`, long text supports `rows`, and numeric fields support `min`, `max`, `step`, and `hasSteppers`. Steppers are named after their field, such as "Increase Width". `validateFormValues` enforces `maxLength`, numeric limits, and `picker.max`. `autoFocus` applies to text, number, select, boolean, UTC date-time, slider, and colour fields.
|
|
123
1122
|
|
|
124
1123
|
`columns` sets the most columns and defaults to one. The form drops a column whenever a field would be narrower than `minColumnWidth` (default `16rem`), measured against the form's own width, so it steps down inside drawers and modals. Use `columns="auto"` to fit as many columns as the width allows. FormEditor is not a size container, so it keeps its content width in flex rows and popovers.
|
|
125
1124
|
|
|
1125
|
+
Plain `hr` elements use a single theme-aware muted border through `--rule-width` and `--rule-color`. This style is included in `styles.css` and the optional reset. FormEditor separators use the form's grid gap instead of their global block margins.
|
|
1126
|
+
|
|
126
1127
|
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
1128
|
|
|
128
|
-
|
|
1129
|
+
## Layout
|
|
1130
|
+
|
|
1131
|
+
### Grid
|
|
1132
|
+
|
|
1133
|
+
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"`.
|
|
1134
|
+
|
|
1135
|
+
```tsx
|
|
1136
|
+
import { Button, Grid, GridItem, Stack } from "@namroodinc/liquid-editorial";
|
|
129
1137
|
|
|
130
|
-
|
|
1138
|
+
<Grid
|
|
1139
|
+
columns={2}
|
|
1140
|
+
gap="lg"
|
|
1141
|
+
>
|
|
1142
|
+
<GridItem>
|
|
1143
|
+
<p>Article content</p>
|
|
1144
|
+
</GridItem>
|
|
1145
|
+
<GridItem>
|
|
1146
|
+
<p>Metadata</p>
|
|
1147
|
+
</GridItem>
|
|
1148
|
+
<GridItem span="full">
|
|
1149
|
+
<Stack
|
|
1150
|
+
direction="horizontal"
|
|
1151
|
+
justify="end"
|
|
1152
|
+
gap="sm"
|
|
1153
|
+
wrap
|
|
1154
|
+
>
|
|
1155
|
+
<Button>Save draft</Button>
|
|
1156
|
+
<Button variant="primary">Publish</Button>
|
|
1157
|
+
</Stack>
|
|
1158
|
+
</GridItem>
|
|
1159
|
+
</Grid>;
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
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.
|
|
1163
|
+
|
|
1164
|
+
### Container
|
|
1165
|
+
|
|
1166
|
+
Constrains content to a reading/page width and provides a size container for responsive descendants. Defaults: `width="lg"`, `padded`, `center`, and `as="div"`.
|
|
1167
|
+
|
|
1168
|
+
```tsx
|
|
1169
|
+
import { Container } from "@namroodinc/liquid-editorial";
|
|
131
1170
|
|
|
132
|
-
|
|
1171
|
+
<Container
|
|
1172
|
+
as="article"
|
|
1173
|
+
width="md"
|
|
1174
|
+
>
|
|
1175
|
+
<h1>The corner bookshop</h1>
|
|
1176
|
+
<p>A measured width for editorial content.</p>
|
|
1177
|
+
</Container>;
|
|
1178
|
+
```
|
|
133
1179
|
|
|
134
|
-
|
|
1180
|
+
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
1181
|
|
|
136
|
-
|
|
1182
|
+
### AppShell
|
|
137
1183
|
|
|
138
1184
|
`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
1185
|
|
|
@@ -142,19 +1188,35 @@ import { AppShell, Avatar, SideNavItem, SideNavSection } from "@namroodinc/liqui
|
|
|
142
1188
|
|
|
143
1189
|
<AppShell
|
|
144
1190
|
brand={<a href="/">Liquid</a>}
|
|
145
|
-
navigation={
|
|
146
|
-
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
1191
|
+
navigation={
|
|
1192
|
+
<>
|
|
1193
|
+
<SideNavSection label="Workspace">
|
|
1194
|
+
<SideNavItem
|
|
1195
|
+
icon="home"
|
|
1196
|
+
label="Home"
|
|
1197
|
+
href="/"
|
|
1198
|
+
/>
|
|
1199
|
+
<SideNavItem
|
|
1200
|
+
icon="file-text"
|
|
1201
|
+
label="Stories"
|
|
1202
|
+
href="/stories"
|
|
1203
|
+
isActive
|
|
1204
|
+
/>
|
|
1205
|
+
</SideNavSection>
|
|
1206
|
+
</>
|
|
1207
|
+
}
|
|
1208
|
+
actions={(location) => (
|
|
1209
|
+
<>
|
|
1210
|
+
<Avatar
|
|
1211
|
+
name="Ada Lovelace"
|
|
1212
|
+
size={32}
|
|
1213
|
+
/>
|
|
1214
|
+
{location === "drawer" && <span>Ada Lovelace</span>}
|
|
1215
|
+
</>
|
|
1216
|
+
)}
|
|
155
1217
|
>
|
|
156
1218
|
<h1>Stories</h1>
|
|
157
|
-
</AppShell
|
|
1219
|
+
</AppShell>;
|
|
158
1220
|
```
|
|
159
1221
|
|
|
160
1222
|
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 +1227,41 @@ The drawer traps focus and locks body scroll. Escape, Close, the scrim, and navi
|
|
|
165
1227
|
|
|
166
1228
|
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
1229
|
|
|
168
|
-
|
|
1230
|
+
### EditLayout
|
|
169
1231
|
|
|
170
|
-
|
|
1232
|
+
A presentation layout for an edit page, composed inside the existing main landmark.
|
|
171
1233
|
|
|
172
|
-
|
|
1234
|
+
```tsx
|
|
1235
|
+
import { Button, EditLayout, Field, TextField } from "@namroodinc/liquid-editorial";
|
|
173
1236
|
|
|
174
|
-
|
|
1237
|
+
export function EditArticle({ onBack, onSave }: { onBack: () => void; onSave: () => void }) {
|
|
1238
|
+
return (
|
|
1239
|
+
<EditLayout
|
|
1240
|
+
backLabel="Articles"
|
|
1241
|
+
onBack={onBack}
|
|
1242
|
+
saveState="dirty"
|
|
1243
|
+
actions={
|
|
1244
|
+
<Button
|
|
1245
|
+
variant="primary"
|
|
1246
|
+
onClick={onSave}
|
|
1247
|
+
>
|
|
1248
|
+
Save draft
|
|
1249
|
+
</Button>
|
|
1250
|
+
}
|
|
1251
|
+
rail={<p>Publication metadata</p>}
|
|
1252
|
+
>
|
|
1253
|
+
<Field label="Headline">
|
|
1254
|
+
{(binding) => (
|
|
1255
|
+
<TextField
|
|
1256
|
+
{...binding}
|
|
1257
|
+
defaultValue="The corner bookshop"
|
|
1258
|
+
/>
|
|
1259
|
+
)}
|
|
1260
|
+
</Field>
|
|
1261
|
+
</EditLayout>
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
```
|
|
175
1265
|
|
|
176
1266
|
`EditLayout` composes a sticky action bar, a centred unframed body and a Details
|
|
177
1267
|
rail. Supply `backLabel`, `onBack`, `actions`, `rail` and body children. The layout
|
|
@@ -202,65 +1292,154 @@ client, after hydration. When a breakpoint, a collapse or a closing sheet
|
|
|
202
1292
|
removes the focused control, focus moves to the Details toggle that replaced
|
|
203
1293
|
it.
|
|
204
1294
|
|
|
205
|
-
##
|
|
1295
|
+
## Navigation
|
|
206
1296
|
|
|
207
|
-
|
|
1297
|
+
### SideNav
|
|
1298
|
+
|
|
1299
|
+
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
1300
|
|
|
209
1301
|
```tsx
|
|
210
|
-
import { useState } from "react";
|
|
211
1302
|
import {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
1303
|
+
SideNav,
|
|
1304
|
+
SideNavFooter,
|
|
1305
|
+
SideNavHeader,
|
|
1306
|
+
SideNavItem,
|
|
1307
|
+
SideNavSection,
|
|
1308
|
+
useSideNavCollapsed,
|
|
217
1309
|
} from "@namroodinc/liquid-editorial";
|
|
218
1310
|
|
|
219
|
-
function
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
src: string;
|
|
224
|
-
onSave: (blob: Blob) => void;
|
|
225
|
-
}) {
|
|
226
|
-
const [selection, setSelection] = useState<{
|
|
227
|
-
crop: CropRect;
|
|
228
|
-
state: CropState;
|
|
229
|
-
} | null>(null);
|
|
1311
|
+
function WorkspaceFooter() {
|
|
1312
|
+
const collapsed = useSideNavCollapsed();
|
|
1313
|
+
return <SideNavFooter>{collapsed ? "LE" : "Liquid Editorial"}</SideNavFooter>;
|
|
1314
|
+
}
|
|
230
1315
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
1316
|
+
<SideNav label="Workspace">
|
|
1317
|
+
<SideNavHeader
|
|
1318
|
+
title="Liquid Editorial"
|
|
1319
|
+
mark="LE"
|
|
1320
|
+
/>
|
|
1321
|
+
<SideNavSection label="Content">
|
|
1322
|
+
<SideNavItem
|
|
1323
|
+
icon="file-text"
|
|
1324
|
+
label="Articles"
|
|
1325
|
+
href="/articles"
|
|
1326
|
+
isActive
|
|
1327
|
+
/>
|
|
1328
|
+
<SideNavItem
|
|
1329
|
+
icon="image"
|
|
1330
|
+
label="Assets"
|
|
1331
|
+
href="/assets"
|
|
1332
|
+
/>
|
|
1333
|
+
</SideNavSection>
|
|
1334
|
+
<WorkspaceFooter />
|
|
1335
|
+
</SideNav>;
|
|
1336
|
+
```
|
|
1337
|
+
|
|
1338
|
+
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.
|
|
1339
|
+
|
|
1340
|
+
### TopNav
|
|
1341
|
+
|
|
1342
|
+
A top navigation bar with brand and actions slots. TopNavItem is a real anchor with an optional icon and `isActive`; the app owns routing.
|
|
240
1343
|
|
|
1344
|
+
```tsx
|
|
1345
|
+
import { Button, TopNav, TopNavItem } from "@namroodinc/liquid-editorial";
|
|
1346
|
+
|
|
1347
|
+
<TopNav
|
|
1348
|
+
label="Product"
|
|
1349
|
+
brand={<a href="/">Liquid</a>}
|
|
1350
|
+
actions={<Button>Account</Button>}
|
|
1351
|
+
>
|
|
1352
|
+
<TopNavItem
|
|
1353
|
+
label="Content"
|
|
1354
|
+
href="/content"
|
|
1355
|
+
isActive
|
|
1356
|
+
/>
|
|
1357
|
+
<TopNavItem
|
|
1358
|
+
label="Settings"
|
|
1359
|
+
href="/settings"
|
|
1360
|
+
/>
|
|
1361
|
+
</TopNav>;
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
Give multiple navigation landmarks distinct names. AppShell supplies its own TopNav; use this family for custom compositions.
|
|
1365
|
+
|
|
1366
|
+
### SubNav
|
|
1367
|
+
|
|
1368
|
+
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.
|
|
1369
|
+
|
|
1370
|
+
```tsx
|
|
1371
|
+
import { useState } from "react";
|
|
1372
|
+
import { SubNav, SubNavButton, SubNavItem } from "@namroodinc/liquid-editorial";
|
|
1373
|
+
|
|
1374
|
+
export function ArticleSections() {
|
|
1375
|
+
const [view, setView] = useState("content");
|
|
241
1376
|
return (
|
|
242
1377
|
<>
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
1378
|
+
<SubNav label="Article destinations">
|
|
1379
|
+
<SubNavItem
|
|
1380
|
+
label="Revisions"
|
|
1381
|
+
href="/articles/1/revisions"
|
|
1382
|
+
count={4}
|
|
1383
|
+
/>
|
|
1384
|
+
</SubNav>
|
|
1385
|
+
<SubNav label="Editor views">
|
|
1386
|
+
{["content", "metadata"].map((item) => (
|
|
1387
|
+
<SubNavButton
|
|
1388
|
+
key={item}
|
|
1389
|
+
label={item}
|
|
1390
|
+
isActive={view === item}
|
|
1391
|
+
onClick={() => setView(item)}
|
|
1392
|
+
/>
|
|
1393
|
+
))}
|
|
1394
|
+
</SubNav>
|
|
1395
|
+
<section aria-label={view}>
|
|
1396
|
+
{view === "content" ? "Article body" : "Publication metadata"}
|
|
1397
|
+
</section>
|
|
252
1398
|
</>
|
|
253
1399
|
);
|
|
254
1400
|
}
|
|
255
1401
|
```
|
|
256
1402
|
|
|
257
|
-
|
|
1403
|
+
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
1404
|
|
|
259
|
-
|
|
1405
|
+
### Stepper
|
|
1406
|
+
|
|
1407
|
+
Progress through ordered steps. `activeStep` is a zero-based index; earlier steps appear complete. Size defaults to `"md"`, with `"sm"` available for compact bands.
|
|
1408
|
+
|
|
1409
|
+
```tsx
|
|
1410
|
+
import { useState } from "react";
|
|
1411
|
+
import { Button, Stepper } from "@namroodinc/liquid-editorial";
|
|
1412
|
+
|
|
1413
|
+
const steps = [
|
|
1414
|
+
{ id: "content", label: "Content" },
|
|
1415
|
+
{ id: "review", label: "Review" },
|
|
1416
|
+
{ id: "publish", label: "Publish" },
|
|
1417
|
+
];
|
|
1418
|
+
|
|
1419
|
+
export function PublishingSteps() {
|
|
1420
|
+
const [active, setActive] = useState(0);
|
|
1421
|
+
return (
|
|
1422
|
+
<>
|
|
1423
|
+
<Stepper
|
|
1424
|
+
label="Publication progress"
|
|
1425
|
+
steps={steps}
|
|
1426
|
+
activeStep={active}
|
|
1427
|
+
onStepChange={setActive}
|
|
1428
|
+
/>
|
|
1429
|
+
<Button
|
|
1430
|
+
isDisabled={active === steps.length - 1}
|
|
1431
|
+
onClick={() => setActive(active + 1)}
|
|
1432
|
+
>
|
|
1433
|
+
Continue
|
|
1434
|
+
</Button>
|
|
1435
|
+
</>
|
|
1436
|
+
);
|
|
1437
|
+
}
|
|
1438
|
+
```
|
|
260
1439
|
|
|
261
|
-
|
|
1440
|
+
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
1441
|
|
|
263
|
-
|
|
1442
|
+
### Pagination
|
|
264
1443
|
|
|
265
1444
|
`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
1445
|
|
|
@@ -292,109 +1471,326 @@ Supply nonnegative integer totals, a positive integer page and page size, and a
|
|
|
292
1471
|
|
|
293
1472
|
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
1473
|
|
|
295
|
-
|
|
1474
|
+
## Collections and media
|
|
296
1475
|
|
|
297
|
-
###
|
|
1476
|
+
### Table
|
|
298
1477
|
|
|
299
|
-
|
|
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:
|
|
1478
|
+
Composable native table elements with a shared frame, toolbar, and empty state.
|
|
302
1479
|
|
|
303
1480
|
```tsx
|
|
304
|
-
|
|
305
|
-
|
|
1481
|
+
import {
|
|
1482
|
+
Button,
|
|
1483
|
+
Table,
|
|
1484
|
+
TableBody,
|
|
1485
|
+
TableCell,
|
|
1486
|
+
TableEmpty,
|
|
1487
|
+
TableFrame,
|
|
1488
|
+
TableHead,
|
|
1489
|
+
TableHeaderCell,
|
|
1490
|
+
TableRow,
|
|
1491
|
+
TableToolbar,
|
|
1492
|
+
} from "@namroodinc/liquid-editorial";
|
|
306
1493
|
|
|
307
|
-
<
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
<
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
1494
|
+
<TableFrame>
|
|
1495
|
+
<TableToolbar
|
|
1496
|
+
start={<strong>Articles</strong>}
|
|
1497
|
+
end={<Button>Add article</Button>}
|
|
1498
|
+
/>
|
|
1499
|
+
<Table>
|
|
1500
|
+
<caption>Latest articles</caption>
|
|
1501
|
+
<TableHead>
|
|
1502
|
+
<TableRow>
|
|
1503
|
+
<TableHeaderCell scope="col">Title</TableHeaderCell>
|
|
1504
|
+
<TableHeaderCell scope="col">Status</TableHeaderCell>
|
|
1505
|
+
</TableRow>
|
|
1506
|
+
</TableHead>
|
|
1507
|
+
<TableBody>
|
|
1508
|
+
<TableRow>
|
|
1509
|
+
<TableCell emphasis="primary">The corner bookshop</TableCell>
|
|
1510
|
+
<TableCell>Draft</TableCell>
|
|
1511
|
+
</TableRow>
|
|
1512
|
+
</TableBody>
|
|
1513
|
+
</Table>
|
|
1514
|
+
</TableFrame>;
|
|
1515
|
+
|
|
1516
|
+
// Standalone empty surface outside a table:
|
|
1517
|
+
<TableEmpty
|
|
1518
|
+
title="No matching articles"
|
|
1519
|
+
description="Try another search."
|
|
1520
|
+
/>;
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
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.
|
|
1524
|
+
|
|
1525
|
+
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.
|
|
1526
|
+
|
|
1527
|
+
### Board
|
|
1528
|
+
|
|
1529
|
+
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.
|
|
1530
|
+
|
|
1531
|
+
```tsx
|
|
1532
|
+
import { useState } from "react";
|
|
1533
|
+
import { Board, BoardCard, BoardColumn, type BoardMove } from "@namroodinc/liquid-editorial";
|
|
1534
|
+
|
|
1535
|
+
export function EditorialBoard() {
|
|
1536
|
+
const [lanes, setLanes] = useState([
|
|
1537
|
+
{ id: "draft", title: "Draft", cards: ["Article one"] },
|
|
1538
|
+
{ id: "review", title: "Review", cards: [] as string[] },
|
|
1539
|
+
]);
|
|
1540
|
+
function move({ cardId, fromColumnId, toColumnId, toIndex }: BoardMove) {
|
|
1541
|
+
setLanes((current) =>
|
|
1542
|
+
current.map((lane) => {
|
|
1543
|
+
const cards =
|
|
1544
|
+
lane.id === fromColumnId ? lane.cards.filter((id) => id !== cardId) : [...lane.cards];
|
|
1545
|
+
if (lane.id === toColumnId) {
|
|
1546
|
+
cards.splice(toIndex, 0, cardId);
|
|
1547
|
+
}
|
|
1548
|
+
return { ...lane, cards };
|
|
1549
|
+
}),
|
|
1550
|
+
);
|
|
1551
|
+
}
|
|
1552
|
+
return (
|
|
1553
|
+
<Board onMove={move}>
|
|
1554
|
+
{lanes.map((lane) => (
|
|
1555
|
+
<BoardColumn
|
|
1556
|
+
key={lane.id}
|
|
1557
|
+
id={lane.id}
|
|
1558
|
+
title={lane.title}
|
|
1559
|
+
itemIds={lane.cards}
|
|
1560
|
+
>
|
|
1561
|
+
{lane.cards.map((id) => (
|
|
1562
|
+
<BoardCard
|
|
1563
|
+
key={id}
|
|
1564
|
+
id={id}
|
|
1565
|
+
columnId={lane.id}
|
|
1566
|
+
label={id}
|
|
1567
|
+
>
|
|
1568
|
+
{id}
|
|
1569
|
+
</BoardCard>
|
|
1570
|
+
))}
|
|
1571
|
+
</BoardColumn>
|
|
1572
|
+
))}
|
|
1573
|
+
</Board>
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
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.
|
|
1579
|
+
|
|
1580
|
+
### SortableList
|
|
1581
|
+
|
|
1582
|
+
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.
|
|
1583
|
+
|
|
1584
|
+
```tsx
|
|
1585
|
+
import { useState } from "react";
|
|
1586
|
+
import { SortableList, SortableListItem } from "@namroodinc/liquid-editorial";
|
|
1587
|
+
|
|
1588
|
+
export function ReadingOrder() {
|
|
1589
|
+
const [items, setItems] = useState(["Introduction", "Main story", "Credits"]);
|
|
1590
|
+
return (
|
|
1591
|
+
<SortableList
|
|
1592
|
+
items={items}
|
|
1593
|
+
onReorder={setItems}
|
|
1594
|
+
>
|
|
1595
|
+
{items.map((id) => (
|
|
1596
|
+
<SortableListItem
|
|
1597
|
+
key={id}
|
|
1598
|
+
id={id}
|
|
1599
|
+
label={id}
|
|
1600
|
+
>
|
|
1601
|
+
{id}
|
|
1602
|
+
</SortableListItem>
|
|
1603
|
+
))}
|
|
1604
|
+
</SortableList>
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
```
|
|
1608
|
+
|
|
1609
|
+
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.
|
|
1610
|
+
|
|
1611
|
+
### AssetCard
|
|
1612
|
+
|
|
1613
|
+
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.
|
|
1614
|
+
|
|
1615
|
+
```tsx
|
|
1616
|
+
import { useState } from "react";
|
|
1617
|
+
import { AssetCard, AssetCardSkeleton, Button } from "@namroodinc/liquid-editorial";
|
|
1618
|
+
|
|
1619
|
+
export function CoverCard({ onEdit }: { onEdit: () => void }) {
|
|
1620
|
+
const [selected, setSelected] = useState(false);
|
|
1621
|
+
return (
|
|
1622
|
+
<AssetCard
|
|
1623
|
+
name="Cover.jpg"
|
|
1624
|
+
src="/cover.jpg"
|
|
1625
|
+
alt="Bookshop entrance"
|
|
1626
|
+
meta="1600 × 900"
|
|
1627
|
+
isSelected={selected}
|
|
1628
|
+
onSelect={() => setSelected(!selected)}
|
|
1629
|
+
footer={
|
|
1630
|
+
<Button
|
|
1631
|
+
size="sm"
|
|
1632
|
+
onClick={onEdit}
|
|
1633
|
+
>
|
|
1634
|
+
Edit crop
|
|
1635
|
+
</Button>
|
|
1636
|
+
}
|
|
319
1637
|
/>
|
|
320
|
-
)
|
|
321
|
-
|
|
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.
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
340
1640
|
|
|
341
|
-
|
|
1641
|
+
<AssetCardSkeleton
|
|
1642
|
+
description
|
|
1643
|
+
footer
|
|
1644
|
+
/>;
|
|
1645
|
+
```
|
|
342
1646
|
|
|
343
|
-
|
|
1647
|
+
`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
1648
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
1649
|
+
### AssetGrid
|
|
1650
|
+
|
|
1651
|
+
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.
|
|
1652
|
+
|
|
1653
|
+
```tsx
|
|
1654
|
+
import {
|
|
1655
|
+
AssetGrid,
|
|
1656
|
+
AssetGridEmpty,
|
|
1657
|
+
AssetTile,
|
|
1658
|
+
AssetTileSkeleton,
|
|
1659
|
+
} from "@namroodinc/liquid-editorial";
|
|
1660
|
+
|
|
1661
|
+
export function MediaLibrary({
|
|
1662
|
+
isLoading,
|
|
1663
|
+
files,
|
|
1664
|
+
}: {
|
|
1665
|
+
isLoading: boolean;
|
|
1666
|
+
files: { id: string; name: string; src: string }[];
|
|
1667
|
+
}) {
|
|
1668
|
+
return (
|
|
1669
|
+
<>
|
|
1670
|
+
<AssetGrid
|
|
1671
|
+
isLoading={isLoading}
|
|
1672
|
+
loadingCount={4}
|
|
1673
|
+
>
|
|
1674
|
+
{files.map((file) => (
|
|
1675
|
+
<AssetTile
|
|
1676
|
+
key={file.id}
|
|
1677
|
+
name={file.name}
|
|
1678
|
+
src={file.src}
|
|
1679
|
+
alt=""
|
|
1680
|
+
/>
|
|
1681
|
+
))}
|
|
1682
|
+
</AssetGrid>
|
|
1683
|
+
{!isLoading && files.length === 0 && (
|
|
1684
|
+
<AssetGridEmpty
|
|
1685
|
+
title="No assets yet"
|
|
1686
|
+
description="Upload a cover to begin."
|
|
1687
|
+
/>
|
|
1688
|
+
)}
|
|
1689
|
+
</>
|
|
1690
|
+
);
|
|
349
1691
|
}
|
|
1692
|
+
|
|
1693
|
+
<AssetTileSkeleton />;
|
|
350
1694
|
```
|
|
351
1695
|
|
|
352
|
-
|
|
1696
|
+
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
1697
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
1698
|
+
### ImageCropper
|
|
1699
|
+
|
|
1700
|
+
`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.
|
|
1701
|
+
|
|
1702
|
+
```tsx
|
|
1703
|
+
import { useState } from "react";
|
|
1704
|
+
import {
|
|
1705
|
+
Button,
|
|
1706
|
+
ImageCropper,
|
|
1707
|
+
cropToBlob,
|
|
1708
|
+
type CropRect,
|
|
1709
|
+
type CropState,
|
|
1710
|
+
} from "@namroodinc/liquid-editorial";
|
|
1711
|
+
|
|
1712
|
+
function CoverCropper({ src, onSave }: { src: string; onSave: (blob: Blob) => void }) {
|
|
1713
|
+
const [selection, setSelection] = useState<{
|
|
1714
|
+
crop: CropRect;
|
|
1715
|
+
state: CropState;
|
|
1716
|
+
} | null>(null);
|
|
1717
|
+
|
|
1718
|
+
async function save() {
|
|
1719
|
+
if (!selection) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
const blob = await cropToBlob(src, selection.crop, {
|
|
1723
|
+
outputWidth: 1600,
|
|
1724
|
+
rotation: selection.state.rotation,
|
|
1725
|
+
type: "image/jpeg",
|
|
1726
|
+
});
|
|
1727
|
+
onSave(blob);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
return (
|
|
1731
|
+
<>
|
|
1732
|
+
<ImageCropper
|
|
1733
|
+
src={src}
|
|
1734
|
+
alt="Article cover"
|
|
1735
|
+
aspect={16 / 9}
|
|
1736
|
+
onChange={(crop, state) => setSelection({ crop, state })}
|
|
1737
|
+
/>
|
|
1738
|
+
<Button
|
|
1739
|
+
isDisabled={!selection}
|
|
1740
|
+
onClick={save}
|
|
1741
|
+
>
|
|
1742
|
+
Save crop
|
|
1743
|
+
</Button>
|
|
1744
|
+
</>
|
|
1745
|
+
);
|
|
1746
|
+
}
|
|
363
1747
|
```
|
|
364
1748
|
|
|
365
|
-
|
|
1749
|
+
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.
|
|
1750
|
+
|
|
1751
|
+
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
1752
|
|
|
367
|
-
|
|
1753
|
+
## Themes and fonts
|
|
368
1754
|
|
|
369
|
-
|
|
1755
|
+
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
1756
|
|
|
371
|
-
|
|
1757
|
+
```css
|
|
1758
|
+
:root {
|
|
1759
|
+
--font-sans: "Your Sans", ui-sans-serif, system-ui, sans-serif;
|
|
1760
|
+
--font-mono: "Your Mono", ui-monospace, monospace;
|
|
1761
|
+
}
|
|
1762
|
+
```
|
|
1763
|
+
|
|
1764
|
+
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
1765
|
|
|
373
|
-
|
|
1766
|
+
## Upgrading
|
|
374
1767
|
|
|
375
|
-
|
|
1768
|
+
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
1769
|
|
|
377
|
-
|
|
378
|
-
- Repository: `liquid-editorial`
|
|
379
|
-
- Workflow filename: `release.yml`
|
|
380
|
-
- Environment: leave empty
|
|
381
|
-
- Allowed action: enable direct publishing with `npm publish`
|
|
1770
|
+
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
1771
|
|
|
383
|
-
|
|
1772
|
+
## Contributing
|
|
1773
|
+
|
|
1774
|
+
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
1775
|
|
|
385
1776
|
```sh
|
|
386
|
-
npm
|
|
1777
|
+
npm install
|
|
1778
|
+
npm run storybook
|
|
1779
|
+
npm run validate
|
|
1780
|
+
npm run fallow:report
|
|
387
1781
|
```
|
|
388
1782
|
|
|
389
|
-
|
|
1783
|
+
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.
|
|
1784
|
+
|
|
1785
|
+
`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
1786
|
|
|
391
|
-
###
|
|
1787
|
+
### Publishing
|
|
392
1788
|
|
|
393
|
-
|
|
1789
|
+
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
1790
|
|
|
395
|
-
|
|
1791
|
+
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
1792
|
|
|
397
|
-
|
|
1793
|
+
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
1794
|
|
|
399
1795
|
## License
|
|
400
1796
|
|