@eocrm/design-system 0.6.22 → 0.6.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AI-PRIMER.md +167 -288
  2. package/README.md +11 -1
  3. package/docs/accessible-names.md +22 -0
  4. package/docs/components/Chart.md +1 -0
  5. package/docs/components/CircularProgress.md +4 -0
  6. package/docs/components/CurrencySelect.md +1 -1
  7. package/docs/components/FunnelChart.md +96 -0
  8. package/docs/components/Kbd.md +1 -1
  9. package/docs/components/MoneyInput.md +1 -1
  10. package/docs/components/PhoneInput.md +1 -1
  11. package/docs/components/Progress.md +7 -0
  12. package/docs/components/Text.md +8 -0
  13. package/docs/components/Title.md +4 -0
  14. package/docs/components/index.json +657 -0
  15. package/docs/i18n.md +74 -0
  16. package/docs/typescript.md +9 -0
  17. package/package.json +2 -2
  18. package/src/_meta/manifest.ts +1 -0
  19. package/src/components/Chart/Chart.tsx +1 -22
  20. package/src/components/Chart/ChartTooltip.tsx +5 -3
  21. package/src/components/FunnelChart/FunnelChart.module.scss +265 -0
  22. package/src/components/FunnelChart/FunnelChart.tokens.scss +72 -0
  23. package/src/components/FunnelChart/FunnelChart.tsx +607 -0
  24. package/src/components/FunnelChart/funnelModel.ts +124 -0
  25. package/src/components/FunnelChart/index.ts +2 -0
  26. package/src/components/LiquidEditor/useLiquidAutocomplete.ts +1 -1
  27. package/src/components/RichText/RichTextAttachment.tsx +1 -1
  28. package/src/components/_internal/useSize.ts +23 -0
  29. package/src/components.manifest.json +18 -2
  30. package/src/i18n/I18nProvider.tsx +1 -1
  31. package/src/i18n/en.ts +10 -0
  32. package/src/i18n/messages.ts +18 -0
  33. package/src/i18n/ru.ts +11 -0
  34. package/src/index.ts +7 -0
package/AI-PRIMER.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Primer for AI coding agents building UI on top of this package.
4
4
 
5
- Read this first. Each component's contract is its `docs/components/<Name>.md`; the props table there is generated from the types. This file is a quick reference + token table + anti-patterns list. See [README.md](./README.md) for installation, bundler notes, and publishing/deploy ops.
5
+ Read this first. Each component's contract is `docs/components/<Name>.md`. Agents: install the MCP server so these docs match your installed version — see `@eocrm/design-system-mcp`.
6
6
 
7
7
  ---
8
8
 
@@ -24,259 +24,160 @@ Accent: blue by default; `<html data-accent="…">` switches to `tealpine`, `ind
24
24
 
25
25
  ## Localization (i18n)
26
26
 
27
- Every user-facing string the library renders — visible text, aria-labels, placeholders, default empty/loading copy — flows through a single React Context. Wrap your app once; every component picks up the right copy. There are NO `labels` / `cancelLabel` / `searchPlaceholder` props on any component.
28
-
29
- ```tsx
30
- import { I18nProvider } from '@eocrm/design-system';
31
-
32
- <I18nProvider locale="ru">
33
- <App />
34
- </I18nProvider>;
35
- ```
36
-
37
- **Overrides** are a deep-partial of the messages tree:
38
-
39
- ```tsx
40
- <I18nProvider
41
- locale="ru"
42
- overrides={{
43
- pagination: { next: 'Дальше' },
44
- badge: { modified: 'Изменено!' },
45
- }}
46
- >
47
- <App />
48
- </I18nProvider>
49
- ```
50
-
51
- - Missing override keys fall back to the locale defaults.
52
- - Missing locale keys do NOT fall back to `en` — `I18nProvider` uses the one locale catalogue and `useTranslation` warns and returns the literal key string. The real guard is the type: `en` and `ru` are both annotated `: Messages` (total, not partial), so a missing key is a `tsc` error and cannot ship.
53
- - No provider at all = `en` defaults.
54
-
55
- **Available locales:** `'en'` (default), `'ru'`. v1.
56
-
57
- **`I18nProvider` vs `LocaleProvider` — pair them.** `I18nProvider` carries the message catalog (translated strings). `LocaleProvider` carries the BCP-47 tag used by `Intl.*` formatters inside Calendar / DatePicker / DateRangePicker (month names, weekday order, date-range formatting). They are independent — a Russian app should wrap with BOTH so visible strings AND Intl-rendered dates speak the right language:
58
-
59
- ```tsx
60
- <I18nProvider locale="ru">
61
- <LocaleProvider locale="ru-RU">
62
- <App />
63
- </LocaleProvider>
64
- </I18nProvider>
65
- ```
66
-
67
- **Adding a new string in a library component**:
68
-
69
- 1. Add the key to `src/i18n/messages.ts` (`Messages` interface).
70
- 2. Add the English value to `src/i18n/en.ts`.
71
- 3. Add the Russian value to `src/i18n/ru.ts` (use `ruPlural()` from `i18n/format.ts` for count-varying strings).
72
- 4. In the component, `const t = useTranslation();` then `aria-label={t('component.key')}`. For array messages (months / weekdays), use `useTranslationArray()`.
73
- 5. Never inline an English string — `aria-label="Close"` is a Hard rule 9 violation.
74
-
75
- **Drag-and-drop announcements** are localized too. Every drag surface (`Sortable`,
76
- `SortableGroup`, `Kanban`, `DataTable` column reorder, `RichTextEditor` block
77
- gutter) overrides dnd-kit's English defaults with the `drag.*` messages, and
78
- names what it drags by its **rendered text** rather than its id — "Amount due,
79
- position 3 of 7", not "col_amount was moved over droppable area col_name". Text
80
- is read from the DOM, so a closed `DropdownMenu` / `Tooltip` / `Popover` inside
81
- a card contributes nothing, and `aria-hidden` decoration is skipped.
82
-
83
- Two things are worth doing yourself:
84
-
85
- ```tsx
86
- {/* Name the CONTAINER — the library can't invent one. Either attribute works. */}
87
- <Kanban.Column id="qualified" aria-label="Qualified"> {/* → "…in Qualified" */}
88
- <Kanban.Column id="qualified" aria-labelledby="qualified-h"> {/* same, from the heading */}
89
- <SortableGroup.Container id="review" items={ids} aria-label="In review" />
90
-
91
- {/* Override a chatty ITEM. Without this the whole card is read out. */}
92
- <Kanban.Card id="d-1" aria-label="Acme renewal">…title, owner, due date, badges…</Kanban.Card>
93
- <Sortable.Item id="f-1" aria-label="Company name">…</Sortable.Item>
94
- ```
95
-
96
- An unnamed container falls back to its position ("column 2 of 3").
27
+ Every user-facing string the library renders flows through `I18nProvider` (`'en'` default, `'ru'`); pair it with `LocaleProvider` for `Intl` dates. There are NO `labels` / `cancelLabel` / `searchPlaceholder` props on any component. Overrides, adding a string, drag-and-drop announcements: see [docs/i18n.md](docs/i18n.md).
97
28
 
98
29
  ---
99
30
 
100
31
  ## An empty label prop means _unset_, never _blank_
101
32
 
102
- Label props in this library treat `''` exactly like omitting it — `aria-label` everywhere, `previousLabel`, `nextLabel`, `confirmLabel`, `dropzoneLabel`, `label` on `ColumnVisibilityTrigger`, `visibilityLabel`, `emptyState`, a `LiquidVariable`'s `label`, a `SortableGroup.Container`'s or `Kanban.Column`'s `aria-label`, a `FlowCanvas` node's `label`. You cannot use one to blank out a name or suppress default copy. That is deliberate:
103
-
104
- ```tsx
105
- // ✅ Fine. `row.title` missing → the component's own default copy.
106
- <CursorPagination previousLabel={row.title ?? ''} … />
107
-
108
- // ❌ Not a way to hide the label. It renders "Previous" all the same.
109
- <CursorPagination previousLabel="" … />
110
- ```
111
-
112
- **Two exceptions, both because the empty string already has a meaning of its own there.** An `<img>`'s `alt` — a RichText attachment block's `alt` field — is honoured when empty, because `alt=""` is HTML's marker for a decorative image. And a text input's `placeholder` (`DatePicker`, `DateRangePicker`) is honoured when empty, because wanting no placeholder is a real request and a placeholder is not an accessible name. Nothing else.
113
-
114
- If you are writing a component _in_ this library, the rule behind that is an operator choice, and it is not optional:
115
-
116
- - **Use `||`, never `??`, for any fallback that produces an accessible name** — whether the name comes from an attribute (`aria-label={x || t('key')}`) or from content (`<span>{label || t('key')}</span>`). `??` falls back only on `null`/`undefined`, so `''` reaches the DOM. Per the accname spec an empty `aria-label` contributes no name, so the computation does not stop there — it continues to name-from-content and then to `title`, and where the siblings are `aria-hidden` (a chevron, a spinner) the control ends up anonymous.
117
- - The same applies to a fallback that exists so there is _always_ something readable — `col.visibilityLabel || header || col.id`, `v.label || v.code`. An empty string defeats the safeguard and renders a blank, unidentifiable row.
118
-
119
- Two tests in `structure.test.ts` gate parts of this: one rejects `??` in `aria-label` / `aria-valuetext`, the other rejects `x ?? t(…)` anywhere in the source. **Neither implements the rule.** They cannot see whether an element is a control, whether its siblings are hidden, or that `v.label ?? v.code` and `node.label ?? id` are the same defect with a non-`t()` fallback — every one of those had to be found by reading. A green run is not coverage; the rule above is, and it is enforced by review.
33
+ `''` in a label prop (`aria-label`, `previousLabel`, `confirmLabel`, …) is treated exactly like omitting it, so it cannot blank out a name; only an `<img>` `alt` and a text input's `placeholder` honour `''`. Library authors: use `||`, never `??`, for an accessible-name fallback. See [docs/accessible-names.md](docs/accessible-names.md).
120
34
 
121
35
  ---
122
36
 
123
- ## Dark theme
37
+ ## More docs
124
38
 
125
- See [docs/theming.md](docs/theming.md#dark-theme).
39
+ - Dark theme: [docs/theming.md](docs/theming.md#dark-theme)
40
+ - Theming via component tokens: [docs/theming.md](docs/theming.md#theming-via-component-tokens)
41
+ - Transient state and screen readers: [docs/transient-state.md](docs/transient-state.md)
42
+ - TypeScript (no types in your editor?): [docs/typescript.md](docs/typescript.md)
126
43
 
127
44
  ---
128
45
 
129
46
  ## Components — TL;DR
130
47
 
131
- Each component's contract is its `docs/components/<Name>.md`; the props table there is generated from the types. The summaries below are for orientation only.
132
-
133
- - [`Title`](docs/components/Title.md) — semantic heading
134
- - [`Text`](docs/components/Text.md) — body / inline text
135
- - [`Code`](docs/components/Code.md) — inline `<code>` chip
136
- - [`CodeBlock`](docs/components/CodeBlock.md) — multi-line, highlighted, copyable code
137
- - [`HighlightedText`](docs/components/HighlightedText.md) — `Text` with matched runs in `<mark>` (search excerpts)
138
- - [`Kbd`](docs/components/Kbd.md) — keyboard-shortcut chips
139
-
140
- ### Typography hard rule
141
-
142
- - ❌ `style={{ fontSize: 'var(--font-size-sm)' }}` / `style={{ color: 'var(--color-fg-muted)' }}` — use `<Text size="sm" tone="muted">`.
143
- - ❌ Raw `<h1>` / `<h2>` / `<h3>` — use `<Title order={N}>`.
144
- - ❌ `<Text style={{ color: '#someHex' }}>` — pick a tone from the whitelist.
145
- - For semantic emphasis (the bold _is_ the meaning — e.g. a user's name in a notification, an error keyword), use `<strong>` or `<em>` inside `<Text>`. For visual-only weight changes (a medium-weight name in a list because hierarchy says so, not because the name is emphatic), use `<Text weight="medium">`. Pick the one that matches _why_ the text is heavy.
146
- - If the size / tone / weight you need isn't on `<Title>` or `<Text>`, **that's a token-vocabulary conversation, not a component-skipping conversation.**
147
-
148
- - [`RichText`](docs/components/RichText.md) — read-only rich-text renderer
149
- - [`Button`](docs/components/Button.md) — action triggers
150
- - [`SocialButton`](docs/components/SocialButton.md) — provider sign-in button
151
- - [`ButtonGroup`](docs/components/ButtonGroup.md) — joined Buttons + segmented control
152
- - [`Link`](docs/components/Link.md) — polymorphic styled anchor
153
- - [`LinkCard`](docs/components/LinkCard.md) — clickable, full-surface Card
154
- - [`Input`](docs/components/Input.md) — single-line text, optional free-text `suggestions`
155
- - [`Textarea`](docs/components/Textarea.md) — multi-line text
156
- - [`PasswordInput`](docs/components/PasswordInput.md) — password field with eye toggle + optional warnings
157
- - [`PasswordStrengthMeter`](docs/components/PasswordStrengthMeter.md) — 4-segment strength visualization
158
- - [`CurrencySelect`](docs/components/CurrencySelect.md) — ISO 4217 currency picker over Select
159
- - [`MoneyInput`](docs/components/MoneyInput.md) — currency picker + formatted decimal-string amount (`MoneyValue`)
160
- - [`PhoneInput`](docs/components/PhoneInput.md) — E.164 phone field with country picker
161
- - [`OtpInput`](docs/components/OtpInput.md) — one-time-code field
162
- - [`Checkbox`](docs/components/Checkbox.md) — checkbox with native input + custom paint
163
- - [`ColorPicker`](docs/components/ColorPicker.md) — controlled HEX color picker (popover + inline)
164
- - [`IconPicker`](docs/components/IconPicker.md) — choose one glyph (optionally + palette colour) from a consumer catalog
165
- - [`Switch`](docs/components/Switch.md) — binary toggle
166
- - [`Radio`](docs/components/Radio.md) — single radio button
167
- - [`RadioGroup`](docs/components/RadioGroup.md) — fieldset wrapper for related radios
168
- - [`Field`](docs/components/Field.md) — labeled-control unit
169
- - [`SettingRow`](docs/components/SettingRow.md) — one row of a settings screen
170
- - [`FormSection`](docs/components/FormSection.md) — titled group of fields
171
- - [`FormRow`](docs/components/FormRow.md) — fields side by side
172
- - [`FileUpload`](docs/components/FileUpload.md) — controlled file picker with dropzone
173
- - [`Slider`](docs/components/Slider.md) — controlled slider (single + range, horizontal + vertical)
174
- - [`Sortable`](docs/components/Sortable.md) — drag-to-reorder list (single column)
175
- - [`SortableGroup`](docs/components/SortableGroup.md) — multi-container sortable (drag between lists)
176
- - [`Kanban`](docs/components/Kanban.md) — multi-column board (drag-to-reorder + cross-column drag with live reflow)
177
- - [`FlowCanvas`](docs/components/FlowCanvas.md) — pan/zoom canvas for directed node-edge diagrams
178
- - [`DashboardCanvas`](docs/components/DashboardCanvas.md) — 2D snap-grid dashboard
179
- - [`DashboardWidget`](docs/components/DashboardWidget.md) — DashboardCanvas cell card: standard / list / kpi / chart / stats (StatGroup strip), with loading skeletons
180
- - [`StatGroup`](docs/components/StatGroup.md) — responsive grid of KPI tiles for a dashboard widget, with loading skeletons
181
- - [`StatTile`](docs/components/StatTile.md) — one KPI tile (label, value, trend, footnote, icon, sparkline, quota `progress`) inside a StatGroup (`filled` or `card` surface)
182
- - [`Sparkline`](docs/components/Sparkline.md) — compact static line / area / bar trend for KPI cards (StatTile slot, kpi DashboardWidget child); no axes, summary in the accessible name
183
- - [`Chart`](docs/components/Chart.md) — line / bar / stacked bar / area time-series chart for a chart DashboardWidget (smoothed lines, static markers, legend, tooltip, keyboard, data table, empty state)
184
- - [`TreeView`](docs/components/TreeView.md) — lazily loaded hierarchy (WAI-ARIA tree) as a file-explorer list or a top-down org chart, with loading / error-retry / load-more rows
185
- - [`LiquidEditor`](docs/components/LiquidEditor.md) — Liquid template editor
186
- - [`RichTextEditor`](docs/components/RichTextEditor.md) — controlled rich-text editor (contentEditable)
187
- - [`ImageCrop`](docs/components/ImageCrop.md) — controlled image cropper
188
- - [`Card`](docs/components/Card.md) — bordered container
189
- - [`DefinitionList`](docs/components/DefinitionList.md) — semantic key/value pairs (dl / dt / dd)
190
- - [`List`](docs/components/List.md) — bulleted / numbered prose lists (ul / ol), optional badge step numbers
191
- - [`Stack`](docs/components/Stack.md) — vertical layout
192
- - [`Page`](docs/components/Page.md) — page-root layout primitive
193
- - [`Cluster`](docs/components/Cluster.md) — horizontal layout that wraps
194
- - [`Constrain`](docs/components/Constrain.md) — size / flex constraint
195
- - [`Indent`](docs/components/Indent.md) — indent nested content by depth
196
- - [`Screen`](docs/components/Screen.md) — full-bleed / centered screen layout
197
- - [`AppLayout`](docs/components/AppLayout.md) — viewport-filling app shell
198
- - [`Grid`](docs/components/Grid.md) — 2D layout primitive
199
- - [`Split`](docs/components/Split.md) — master–detail two-pane layout
200
- - [`Sticky`](docs/components/Sticky.md) — sticky-positioning primitive
201
- - [`ScrollArea`](docs/components/ScrollArea.md) — height-capped vertical scroll region
202
- - [`Masonry`](docs/components/Masonry.md) — height-balanced masonry layout
203
- - [`Divider`](docs/components/Divider.md) — separator primitive
204
- - [`PageHeader`](docs/components/PageHeader.md) — top-of-page heading area
205
- - [`Avatar`](docs/components/Avatar.md) — profile circle
206
- - [`AgentAvatar`](docs/components/AgentAvatar.md) — AI agent tile with the acting member badge (`decorative` beside a byline that names both)
207
- - [`AvatarGroup`](docs/components/AvatarGroup.md) — Slack-style stacked row of avatars
208
- - [`PersonDisplay`](docs/components/PersonDisplay.md) — Avatar + name (+ optional description lines; `AgentAvatar` + `OnBehalfOf` for an agent acting for a member)
209
- - [`Badge`](docs/components/Badge.md) — status / category pill
210
- - [`EntityChip`](docs/components/EntityChip.md) — inline entity-link chip
211
- - [`PillMenu`](docs/components/PillMenu.md) — coloured value menu (status, type, priority…)
212
- - [`Dot`](docs/components/Dot.md) — bare palette/tone colored circle
213
- - [`Timeline`](docs/components/Timeline.md) — vertical activity-feed primitive
214
- - [`StagePath`](docs/components/StagePath.md) — chevron row of record stages (done / current / upcoming)
215
- - [`Thread`](docs/components/Thread.md) — nested-reply threading primitive
216
- - [`BrandIcon`](docs/components/BrandIcon.md) — third-party brand marks
217
- - [`Logo`](docs/components/Logo.md) — brand logo lockup
218
- - [`Palette`](docs/components/Palette.md) — categorical color set
219
- - [`FilterChip`](docs/components/FilterChip.md) — dismissible "active filter" pill
220
- - [`Tabs`](docs/components/Tabs.md) — tab strip (horizontal or vertical)
221
- - [`Accordion`](docs/components/Accordion.md) — vertically-stacked collapsible panels
222
- - [`Breadcrumb`](docs/components/Breadcrumb.md) — navigation trail
223
- - [`Rail`](docs/components/Rail.md) — collapsible left-side navigation
224
- - [`TableOfContents`](docs/components/TableOfContents.md) — "On this page" h2/h3 navigation with scroll-spy
225
- - [`TopBar`](docs/components/TopBar.md) — sticky application top bar; `TopBar.Search` with `results` is the global-search combobox
226
- - [`DropdownMenu`](docs/components/DropdownMenu.md) — action menus from a trigger
227
- - [`Tooltip`](docs/components/Tooltip.md) — small floating label on hover / keyboard focus
228
- - [`Popover`](docs/components/Popover.md) — non-modal floating panel for interactive content
229
- - [`ToastViewport`](docs/components/ToastViewport.md) — transient notifications
230
- - [`Alert`](docs/components/Alert.md) — persistent in-flow notification
231
- - [`Banner`](docs/components/Banner.md) — full-width system / app message bar
232
- - [`ChatBubble`](docs/components/ChatBubble.md) — chat message bubble by speaker (`ChatBubble.List` = `role="log"` announcing container; `pending` typing state)
233
- - [`ChatLauncher`](docs/components/ChatLauncher.md) — fixed bottom-end launcher toggling a non-modal chat panel (header/scrolling body/pinned `footer` composer; stays mounted, sticks to bottom)
234
- - [`Highlight`](docs/components/Highlight.md) — temporary attention ring on any block (+ optional scroll/focus)
235
- - [`ConfirmationPopover`](docs/components/ConfirmationPopover.md) — opinionated "Are you sure?" preset
236
- - [`Tour`](docs/components/Tour.md) — guided tour / onboarding walkthrough
237
- - [`Modal`](docs/components/Modal.md) — focus-locked dialog
238
- - [`Lightbox`](docs/components/Lightbox.md) — full-screen image & document gallery overlay
239
- - [`Drawer`](docs/components/Drawer.md) — edge-anchored slide-in panel
240
- - [`Select`](docs/components/Select.md) — value picker (single, multi, searchable, async, creatable)
241
- - [`OptionsPicker`](docs/components/OptionsPicker.md) — filter picker (multi/single, grouped, searchable; async server search via `loadOptions`)
242
- - [`EmojiPicker`](docs/components/EmojiPicker.md) — searchable emoji grid (reactions + input)
243
- - [`CatalogPicker`](docs/components/CatalogPicker.md) — searchable, category-filtered card picker for choosing one catalog item (Add widget)
244
- - [`EmptyState`](docs/components/EmptyState.md) — "nothing here" container
245
- - [`ErrorState`](docs/components/ErrorState.md) — page-level status / result screen
246
- - [`IconTile`](docs/components/IconTile.md) — palette-colored icon frame
247
- - [`Progress`](docs/components/Progress.md) — linear progress bar
248
- - [`CircularProgress`](docs/components/CircularProgress.md) — circular progress / spinner
249
-
250
- ### Progress hard rule
251
-
252
- - ❌ Hand-rolled `<div style={{ width: '${n}%', background: '#xxx' }}>` progress bars — use `<Progress value={n}>`.
253
- - ❌ Hand-rolled spinning `<svg>` per page (every Saving-state, every loader). Use `<CircularProgress />` indeterminate.
254
- - ❌ `<Progress tone="success" value={100}>` or `<Progress tone="success" />` to "celebrate" completion. Tones communicate STATE during progress (warning at 85%, danger at 95%), not success-on-done. A finished bar is just a finished bar — leave the default tone.
255
- - ❌ `<CircularProgress value={0}>` to render an empty circle for "not started yet." `value={0}` is determinate (0% done). The intent is usually indeterminate — omit `value` entirely.
256
-
257
- - [`Skeleton`](docs/components/Skeleton.md) — loading placeholder
258
- - [`Image`](docs/components/Image.md) — image with loading + error states
259
- - [`QrCode`](docs/components/QrCode.md) — scannable QR code
260
- - [`MediaTile`](docs/components/MediaTile.md) — media tile with caption, revealed actions and selection
261
- - [`WidgetPreview`](docs/components/WidgetPreview.md) — decorative data-free miniature of a widget kind (for CatalogPicker)
262
- - [`Table`](docs/components/Table.md) — tabular data primitive; also count grids (`layout="fixed"`, toned columns, whole-cell `Table.CellLink`)
263
- - [`DataTable`](docs/components/DataTable.md) — server-driven data table with column features
264
- - [`Pagination`](docs/components/Pagination.md) — numbered nav with windowing
265
- - [`CursorPagination`](docs/components/CursorPagination.md) — prev / next for streams without total
266
- - [`LocaleProvider`](docs/components/LocaleProvider.md) — locale Context
267
- - [`Calendar`](docs/components/Calendar.md) — month / week / day / agenda views
268
- - [`DatePicker`](docs/components/DatePicker.md) — single-date input + popover
269
- - [`DateRangePicker`](docs/components/DateRangePicker.md) — date-range input + two-month popover
270
- - [`RelativeDateInput`](docs/components/RelativeDateInput.md) — editor for a relative date / date-range expression string (`today+7d`, `last:30d`)
271
- - [`InlineDatePicker`](docs/components/InlineDatePicker.md) — single-date calendar in flow
272
- - [`InlineDateRangePicker`](docs/components/InlineDateRangePicker.md) — date-range calendar in flow
273
- - [`DateStrip`](docs/components/DateStrip.md) — week of selectable day tiles
274
- - [`SlotGrid`](docs/components/SlotGrid.md) — grouped time-slot tiles
275
- - [`TimeField`](docs/components/TimeField.md) — standalone time-of-day input
276
- - [`useMonth`](docs/components/useMonth.md) — `useMonth`, `useWeek`, `useDay`, `useAgenda`
277
- - [`useBelowBreakpoint`](docs/components/useBelowBreakpoint.md) — viewport breakpoint hook
278
- - [`VisuallyHidden`](docs/components/VisuallyHidden.md) — content for assistive tech only
279
- - [`LiveRegion`](docs/components/LiveRegion.md) — announcement region for consumer-level outcomes
48
+ Each `<Name>` below is documented in `docs/components/<Name>.md`.
49
+
50
+ - `Title` — semantic heading (typography hard rule: `Text` doc)
51
+ - `Text` — body / inline text; typography hard rule in its doc
52
+ - `Code` — inline `<code>` chip
53
+ - `CodeBlock` — multi-line, highlighted, copyable code
54
+ - `HighlightedText` — `Text` with matched runs in `<mark>` (search excerpts)
55
+ - `Kbd` — keyboard-shortcut chips
56
+ - `RichText` — read-only rich-text renderer
57
+ - `Button` — action triggers
58
+ - `SocialButton` — provider sign-in button
59
+ - `ButtonGroup` — joined Buttons + segmented control
60
+ - `Link` — polymorphic styled anchor
61
+ - `LinkCard` — clickable, full-surface Card
62
+ - `Input` — single-line text, optional free-text `suggestions`
63
+ - `Textarea` — multi-line text
64
+ - `PasswordInput` — password field with eye toggle + optional warnings
65
+ - `PasswordStrengthMeter` — 4-segment strength visualization
66
+ - `CurrencySelect` — ISO 4217 currency picker over Select
67
+ - `MoneyInput` — currency picker + formatted decimal-string amount (`MoneyValue`)
68
+ - `PhoneInput` — E.164 phone field with country picker
69
+ - `OtpInput` — one-time-code field
70
+ - `Checkbox` — checkbox with native input + custom paint
71
+ - `ColorPicker` — controlled HEX color picker (popover + inline)
72
+ - `IconPicker` — choose one glyph (optionally + palette colour) from a consumer catalog
73
+ - `Switch` — binary toggle
74
+ - `Radio` — single radio button
75
+ - `RadioGroup` — fieldset wrapper for related radios
76
+ - `Field` — labeled-control unit
77
+ - `SettingRow` — one row of a settings screen
78
+ - `FormSection` — titled group of fields
79
+ - `FormRow` — fields side by side
80
+ - `FileUpload` — controlled file picker with dropzone
81
+ - `Slider` — controlled slider (single + range, horizontal + vertical)
82
+ - `Sortable` — drag-to-reorder list (single column)
83
+ - `SortableGroup` — multi-container sortable (drag between lists)
84
+ - `Kanban` — multi-column board (drag-to-reorder + cross-column drag with live reflow)
85
+ - `FlowCanvas` — pan/zoom canvas for directed node-edge diagrams
86
+ - `DashboardCanvas` — 2D snap-grid dashboard
87
+ - `DashboardWidget` — DashboardCanvas cell card: standard / list / kpi / chart / stats (StatGroup strip), with loading skeletons
88
+ - `StatGroup` — responsive grid of KPI tiles for a dashboard widget, with loading skeletons
89
+ - `StatTile` — one KPI tile (label, value, trend, footnote, icon, sparkline, quota `progress`) inside a StatGroup (`filled` or `card` surface)
90
+ - `Sparkline` — compact static line / area / bar trend for KPI cards (StatTile slot, kpi DashboardWidget child); no axes, summary in the accessible name
91
+ - `Chart` — line / bar / stacked bar / area time-series chart for a chart DashboardWidget (smoothed lines, static markers, legend, tooltip, keyboard, data table, empty state)
92
+ - `FunnelChart` — stage funnel for pipeline / campaign conversion: height = drop-off, pill = step conversion, one-hue ramp with a hero first stage; optional stage click drill-through, vertical slices plus a table when narrow
93
+ - `TreeView` — lazily loaded hierarchy (WAI-ARIA tree) as a file-explorer list or a top-down org chart, with loading / error-retry / load-more rows
94
+ - `LiquidEditor` — Liquid template editor
95
+ - `RichTextEditor` — controlled rich-text editor (contentEditable)
96
+ - `ImageCrop` — controlled image cropper
97
+ - `Card` — bordered container
98
+ - `DefinitionList` — semantic key/value pairs (dl / dt / dd)
99
+ - `List` — bulleted / numbered prose lists (ul / ol), optional badge step numbers
100
+ - `Stack` — vertical layout
101
+ - `Page` — page-root layout primitive
102
+ - `Cluster` — horizontal layout that wraps
103
+ - `Constrain` — size / flex constraint
104
+ - `Indent` — indent nested content by depth
105
+ - `Screen` — full-bleed / centered screen layout
106
+ - `AppLayout` — viewport-filling app shell
107
+ - `Grid` — 2D layout primitive
108
+ - `Split` — master–detail two-pane layout
109
+ - `Sticky` — sticky-positioning primitive
110
+ - `ScrollArea` — height-capped vertical scroll region
111
+ - `Masonry` — height-balanced masonry layout
112
+ - `Divider` — separator primitive
113
+ - `PageHeader` — top-of-page heading area
114
+ - `Avatar` — profile circle
115
+ - `AgentAvatar` — AI agent tile with the acting member badge (`decorative` beside a byline that names both)
116
+ - `AvatarGroup` — Slack-style stacked row of avatars
117
+ - `PersonDisplay` — Avatar + name (+ optional description lines; `AgentAvatar` + `OnBehalfOf` for an agent acting for a member)
118
+ - `Badge` — status / category pill
119
+ - `EntityChip` — inline entity-link chip
120
+ - `PillMenu` — coloured value menu (status, type, priority…)
121
+ - `Dot` — bare palette/tone colored circle
122
+ - `Timeline` — vertical activity-feed primitive
123
+ - `StagePath` — chevron row of record stages (done / current / upcoming)
124
+ - `Thread` — nested-reply threading primitive
125
+ - `BrandIcon` — third-party brand marks
126
+ - `Logo` — brand logo lockup
127
+ - `Palette` — categorical color set
128
+ - `FilterChip` — dismissible "active filter" pill
129
+ - `Tabs` — tab strip (horizontal or vertical)
130
+ - `Accordion` — vertically-stacked collapsible panels
131
+ - `Breadcrumb` — navigation trail
132
+ - `Rail` — collapsible left-side navigation
133
+ - `TableOfContents` — "On this page" h2/h3 navigation with scroll-spy
134
+ - `TopBar` — sticky application top bar; `TopBar.Search` with `results` is the global-search combobox
135
+ - `DropdownMenu` — action menus from a trigger
136
+ - `Tooltip` — small floating label on hover / keyboard focus
137
+ - `Popover` — non-modal floating panel for interactive content
138
+ - `ToastViewport` — transient notifications
139
+ - `Alert` — persistent in-flow notification
140
+ - `Banner` — full-width system / app message bar
141
+ - `ChatBubble` — chat message bubble by speaker (`ChatBubble.List` = `role="log"` announcing container; `pending` typing state)
142
+ - `ChatLauncher` — fixed bottom-end launcher toggling a non-modal chat panel (header/scrolling body/pinned `footer` composer; stays mounted, sticks to bottom)
143
+ - `Highlight` — temporary attention ring on any block (+ optional scroll/focus)
144
+ - `ConfirmationPopover` — opinionated "Are you sure?" preset
145
+ - `Tour` — guided tour / onboarding walkthrough
146
+ - `Modal` — focus-locked dialog
147
+ - `Lightbox` — full-screen image & document gallery overlay
148
+ - `Drawer` — edge-anchored slide-in panel
149
+ - `Select` — value picker (single, multi, searchable, async, creatable)
150
+ - `OptionsPicker` — filter picker (multi/single, grouped, searchable; async server search via `loadOptions`)
151
+ - `EmojiPicker` — searchable emoji grid (reactions + input)
152
+ - `CatalogPicker` — searchable, category-filtered card picker for choosing one catalog item (Add widget)
153
+ - `EmptyState` — "nothing here" container
154
+ - `ErrorState` — page-level status / result screen
155
+ - `IconTile` — palette-colored icon frame
156
+ - `Progress` — linear progress bar; progress hard rule in its doc
157
+ - `CircularProgress` — circular progress / spinner (progress hard rule: `Progress` doc)
158
+ - `Skeleton` — loading placeholder
159
+ - `Image` — image with loading + error states
160
+ - `QrCode` — scannable QR code
161
+ - `MediaTile` — media tile with caption, revealed actions and selection
162
+ - `WidgetPreview` — decorative data-free miniature of a widget kind (for CatalogPicker)
163
+ - `Table` — tabular data primitive; also count grids (`layout="fixed"`, toned columns, whole-cell `Table.CellLink`)
164
+ - `DataTable` — server-driven data table with column features
165
+ - `Pagination` — numbered nav with windowing
166
+ - `CursorPagination` — prev / next for streams without total
167
+ - `LocaleProvider` — locale Context
168
+ - `Calendar` — month / week / day / agenda views
169
+ - `DatePicker` — single-date input + popover
170
+ - `DateRangePicker` — date-range input + two-month popover
171
+ - `RelativeDateInput` — editor for a relative date / date-range expression string (`today+7d`, `last:30d`)
172
+ - `InlineDatePicker` — single-date calendar in flow
173
+ - `InlineDateRangePicker` — date-range calendar in flow
174
+ - `DateStrip` — week of selectable day tiles
175
+ - `SlotGrid` — grouped time-slot tiles
176
+ - `TimeField` — standalone time-of-day input
177
+ - `useMonth` — `useMonth`, `useWeek`, `useDay`, `useAgenda`
178
+ - `useBelowBreakpoint` — viewport breakpoint hook
179
+ - `VisuallyHidden` — content for assistive tech only
180
+ - `LiveRegion` — announcement region for consumer-level outcomes
280
181
 
281
182
  ---
282
183
 
@@ -284,56 +185,34 @@ Each component's contract is its `docs/components/<Name>.md`; the props table th
284
185
 
285
186
  Every visual value comes from a token (`var(--color-*)`, `var(--space-*)`, `var(--radius-*)`, …); never raw hex, px, rem or em. The full token reference is in [`docs/tokens.md`](docs/tokens.md) — read it before writing SCSS.
286
187
 
287
- ## Theming via component tokens
288
-
289
- See [docs/theming.md](docs/theming.md#theming-via-component-tokens).
290
-
291
- ---
292
-
293
- ## Transient state and screen readers
294
-
295
- See [docs/transient-state.md](docs/transient-state.md).
296
-
297
188
  ## Anti-patterns to never generate
298
189
 
299
- | Don't write | Write instead |
300
- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
301
- | `color: #ffffff` in any SCSS | `color: var(--color-bg)` (or the right semantic token) |
302
- | `border: 1px solid var(--color-border)` | `border: var(--border-width) solid var(--color-border)` |
303
- | `opacity: 0.5` | `opacity: var(--opacity-disabled)` (or use the `disabled` attribute) |
304
- | `<button onClick={...}>Save</button>` | `<Button onClick={...}>Save</Button>` |
305
- | `<input value={...} onChange={...} />` | `<Input value={...} onChange={...} />` |
306
- | `<Card><Card>...</Card></Card>` | Use spacing or a divider inside one card |
307
- | `<Button style={{ marginLeft: 'auto' }}>` | `<Cluster justify="between">` or `<Cluster justify="end">` |
308
- | Two `<Button variant="primary">` in the same section | One primary, others `secondary` |
309
- | `<Button variant="success">Save</Button>` rendered on initial mount | `success` is transient — start as `primary`, flip to `success` for ~1.5s after the action resolves, flip back |
310
- | `<Avatar name="" />` | `name` is required and is the accessible label |
311
- | `import { Button } from '@eocrm/design-system/src/components/Button'` | `import { Button } from '@eocrm/design-system'` |
312
- | `<Badge onClick={...}>` | Badges are non-interactive — use a `Button` |
313
- | 3-digit hex (`#fff`) anywhere | Always 6-digit (`#ffffff`) |
314
- | `margin` on or around design-system components in your SCSS | Wrap in `<Stack>` / `<Cluster>` or set spacing on the parent's flex/grid |
315
- | `<DropdownMenu.Item disabled>--- Section ---</DropdownMenu.Item>` as a section header | Use `<DropdownMenu.Separator />` between groups |
316
- | `<DropdownMenu.RadioItem>` outside `<DropdownMenu.RadioGroup>` | Always wrap radio items in a RadioGroup; otherwise the value/onValueChange contract is broken |
317
- | `<DropdownMenu.ItemIndicator>` nested deeper than direct child | Detection is shallow; nest it directly under CheckboxItem/RadioItem |
318
- | Submenus 3+ levels deep | Discouraged — UX gets confusing fast; refactor to a different IA |
319
- | `<Tooltip><Button disabled>…</Button></Tooltip>` | `disabled` buttons don't fire pointer/focus events; render with `aria-disabled="true"` + intercept the click, or wrap in `<span>`. |
320
- | Putting essential info _only_ in a tooltip | Make it visible in copy or in the trigger's `aria-label`. Touch users will never see the tooltip. |
321
- | `<Tooltip content="">…</Tooltip>` expecting a no-op listener attach | Empty content **is** a no-op — listeners and aria are skipped entirely. That's by design. |
322
- | `<Popover.Trigger><Button disabled>…</Button></Popover.Trigger>` | `disabled` buttons don't fire click; render with `aria-disabled="true"` + intercept the click, or wrap in `<span>`. |
323
- | `<Popover.Content>` with no `<Popover.Close>` AND non-obvious outside-click dismissal | Keyboard / screen-reader users get no clear close affordance. Add a `<Popover.Close>` close button. |
324
- | `<ConfirmationPopover>` with `onConfirm` that never settles | v1 has no timeout — popover stays in pending state forever. Add a timeout/abort inside your `onConfirm` if relevant. |
325
-
326
- ---
327
-
328
- ## TypeScript
329
-
330
- Every prop and variant type is typed. If your editor shows no types:
331
-
332
- - Confirm `moduleResolution: "bundler"` (or `"node16"`) in your `tsconfig.json`.
333
- - Confirm your IDE's TS server is running.
334
- - The package's `types` field points at `./src/index.ts` — source distribution means the consumer's bundler compiles `.tsx`. Vite, Next.js, Webpack 5+ all support this; older configurations may need `transpilePackages: ['@eocrm/design-system']` (Next.js) or equivalent.
335
-
336
- ---
190
+ Each line: don't write → write instead.
191
+
192
+ - `color: #ffffff` in any SCSS → `color: var(--color-bg)` (or the right semantic token)
193
+ - `border: 1px solid var(--color-border)` → `border: var(--border-width) solid var(--color-border)`
194
+ - `opacity: 0.5` → `opacity: var(--opacity-disabled)` (or use the `disabled` attribute)
195
+ - `<button onClick={...}>Save</button>` → `<Button onClick={...}>Save</Button>`
196
+ - `<input value={...} onChange={...} />` → `<Input value={...} onChange={...} />`
197
+ - `<Card><Card>...</Card></Card>` → Use spacing or a divider inside one card
198
+ - `<Button style={{ marginLeft: 'auto' }}>` → `<Cluster justify="between">` or `<Cluster justify="end">`
199
+ - Two `<Button variant="primary">` in the same section → One primary, others `secondary`
200
+ - `<Button variant="success">Save</Button>` rendered on initial mount → `success` is transient — start as `primary`, flip to `success` for ~1.5s after the action resolves, flip back
201
+ - `<Avatar name="" />` → `name` is required and is the accessible label
202
+ - `import { Button } from '@eocrm/design-system/src/components/Button'` → `import { Button } from '@eocrm/design-system'`
203
+ - `<Badge onClick={...}>` → Badges are non-interactive — use a `Button`
204
+ - 3-digit hex (`#fff`) anywhere → Always 6-digit (`#ffffff`)
205
+ - `margin` on or around design-system components in your SCSS → Wrap in `<Stack>` / `<Cluster>` or set spacing on the parent's flex/grid
206
+ - `<DropdownMenu.Item disabled>--- Section ---</DropdownMenu.Item>` as a section header → Use `<DropdownMenu.Separator />` between groups
207
+ - `<DropdownMenu.RadioItem>` outside `<DropdownMenu.RadioGroup>` → Always wrap radio items in a RadioGroup; otherwise the value/onValueChange contract is broken
208
+ - `<DropdownMenu.ItemIndicator>` nested deeper than direct child → Detection is shallow; nest it directly under CheckboxItem/RadioItem
209
+ - Submenus 3+ levels deep → Discouraged — UX gets confusing fast; refactor to a different IA
210
+ - `<Tooltip><Button disabled>…</Button></Tooltip>` → `disabled` buttons don't fire pointer/focus events; render with `aria-disabled="true"` + intercept the click, or wrap in `<span>`.
211
+ - Putting essential info _only_ in a tooltip → Make it visible in copy or in the trigger's `aria-label`. Touch users will never see the tooltip.
212
+ - `<Tooltip content="">…</Tooltip>` expecting a no-op listener attach → Empty content **is** a no-op — listeners and aria are skipped entirely. That's by design.
213
+ - `<Popover.Trigger><Button disabled>…</Button></Popover.Trigger>` → `disabled` buttons don't fire click; render with `aria-disabled="true"` + intercept the click, or wrap in `<span>`.
214
+ - `<Popover.Content>` with no `<Popover.Close>` AND non-obvious outside-click dismissal → Keyboard / screen-reader users get no clear close affordance. Add a `<Popover.Close>` close button.
215
+ - `<ConfirmationPopover>` with `onConfirm` that never settles → v1 has no timeout — popover stays in pending state forever. Add a timeout/abort inside your `onConfirm` if relevant.
337
216
 
338
217
  ## Full reference
339
218
 
package/README.md CHANGED
@@ -6,7 +6,7 @@ Its web tokens are generated and versioned by `@eocrm/design-tokens`. Existing
6
6
  consumer imports remain unchanged: the design-system Sass entry points forward
7
7
  to the token package.
8
8
 
9
- Component contracts live in **[`docs/components/<Name>.md`](./docs/components)** (props table, anti-patterns). AI agents consuming this package should read **[AI-PRIMER.md](./AI-PRIMER.md)** first.
9
+ Component contracts live in **[`docs/components/<Name>.md`](./docs/components)** (props table, anti-patterns). AI agents consuming this package should read **[AI-PRIMER.md](./AI-PRIMER.md)** first, ideally through the MCP server (see [AI agents](#ai-agents)).
10
10
 
11
11
  **Live playground** (every component, demoed against `main`): <https://eocrm.github.io/design-system/components>
12
12
 
@@ -266,6 +266,16 @@ The playground (live component gallery) deploys to GitHub Pages automatically as
266
266
 
267
267
  ---
268
268
 
269
+ ## AI agents
270
+
271
+ [`@eocrm/design-system-mcp`](../design-system-mcp/README.md) is an MCP server that serves the docs of the `@eocrm/design-system` version your project has installed. One-time, user-scope install for Claude Code:
272
+
273
+ ```bash
274
+ claude mcp add --scope user eocrm-design-system -- npx -y @eocrm/design-system-mcp
275
+ ```
276
+
277
+ Codex, Cursor, VS Code and generic setups, plus `npx -y @eocrm/design-system-mcp install-skill`: see its [README](../design-system-mcp/README.md).
278
+
269
279
  ## Where docs live (so you don't have to grep)
270
280
 
271
281
  - **README.md** (this file) — install, setup, bundler notes, publishing/deploy ops.
@@ -0,0 +1,22 @@
1
+ # Accessible names
2
+
3
+ An empty label prop means _unset_, never _blank_.
4
+
5
+ Label props in this library treat `''` exactly like omitting it — `aria-label` everywhere, `previousLabel`, `nextLabel`, `confirmLabel`, `dropzoneLabel`, `label` on `ColumnVisibilityTrigger`, `visibilityLabel`, `emptyState`, a `LiquidVariable`'s `label`, a `SortableGroup.Container`'s or `Kanban.Column`'s `aria-label`, a `FlowCanvas` node's `label`. You cannot use one to blank out a name or suppress default copy. That is deliberate:
6
+
7
+ ```tsx
8
+ // ✅ Fine. `row.title` missing → the component's own default copy.
9
+ <CursorPagination previousLabel={row.title ?? ''} … />
10
+
11
+ // ❌ Not a way to hide the label. It renders "Previous" all the same.
12
+ <CursorPagination previousLabel="" … />
13
+ ```
14
+
15
+ **Two exceptions, both because the empty string already has a meaning of its own there.** An `<img>`'s `alt` — a RichText attachment block's `alt` field — is honoured when empty, because `alt=""` is HTML's marker for a decorative image. And a text input's `placeholder` (`DatePicker`, `DateRangePicker`) is honoured when empty, because wanting no placeholder is a real request and a placeholder is not an accessible name. Nothing else.
16
+
17
+ If you are writing a component _in_ this library, the rule behind that is an operator choice, and it is not optional:
18
+
19
+ - **Use `||`, never `??`, for any fallback that produces an accessible name** — whether the name comes from an attribute (`aria-label={x || t('key')}`) or from content (`<span>{label || t('key')}</span>`). `??` falls back only on `null`/`undefined`, so `''` reaches the DOM. Per the accname spec an empty `aria-label` contributes no name, so the computation does not stop there — it continues to name-from-content and then to `title`, and where the siblings are `aria-hidden` (a chevron, a spinner) the control ends up anonymous.
20
+ - The same applies to a fallback that exists so there is _always_ something readable — `col.visibilityLabel || header || col.id`, `v.label || v.code`. An empty string defeats the safeguard and renders a blank, unidentifiable row.
21
+
22
+ Two tests in `structure.test.ts` gate parts of this: one rejects `??` in `aria-label` / `aria-valuetext`, the other rejects `x ?? t(…)` anywhere in the source. **Neither implements the rule.** They cannot see whether an element is a control, whether its siblings are hidden, or that `v.label ?? v.code` and `node.label ?? id` are the same defect with a non-`t()` fallback — every one of those had to be found by reading. A green run is not coverage; the rule above is, and it is enforced by review.
@@ -102,6 +102,7 @@ import { Chart, DashboardWidget, ErrorState } from '@eocrm/design-system';
102
102
  - ❌ One headline number → `DashboardWidget variant="kpi"` or `StatGroup`.
103
103
  - ❌ More than 8 groups at once → fold the tail into an "Other" series in the app (the DS can't know whether your metric is additive).
104
104
  - ❌ Two measures with different units → two charts. There is no dual axis.
105
+ - ❌ Stage conversion (pipeline / campaign) → `FunnelChart`.
105
106
  - ❌ Non-time categorical comparisons that need sorting, pies, scatter or zoom — not supported.
106
107
 
107
108
  #### Anti-patterns