cleanplate 0.3.20 → 0.3.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"table-arg-types.d.ts","sourceRoot":"","sources":["../../../src/stories/table/table-arg-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAejD,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAWtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAE/B,CAAC"}
1
+ {"version":3,"file":"table-arg-types.d.ts","sourceRoot":"","sources":["../../../src/stories/table/table-arg-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgBjD,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAWtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAE/B,CAAC"}
package/docs/Avatar.md CHANGED
@@ -7,6 +7,7 @@ Purpose: Displays user initials, an image, or a Material icon in a consistent ci
7
7
  | Prop | Type | Required | Default | Description |
8
8
  | --- | --- | --- | --- | --- |
9
9
  | name | string | no | "" | Display name; used for initials and `title` when no image/icon. Also used for image `alt`. |
10
+ | codeText | string | no | "" | Optional code-like text override for non-image/non-icon mode. Keeps only alphanumeric chars, then renders the last 4 characters (uppercased). |
10
11
  | image | string | no | "" | Image URL; when set, shows image instead of initials or icon. |
11
12
  | icon | MaterialIconName | no | — | Material icon name; when set (and no image), shows icon instead of initials. |
12
13
  | size | "small" \| "medium" | no | "medium" | Size of the avatar. |
@@ -36,6 +37,7 @@ type AvatarMargin = string | SpacingOption[];
36
37
  ```typescript
37
38
  interface AvatarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "style"> {
38
39
  name?: string;
40
+ codeText?: string;
39
41
  image?: string;
40
42
  icon?: MaterialIconName; // from "../icon/material-icon-names"
41
43
  size?: AvatarSize;
@@ -60,6 +62,20 @@ export const Example = () => (
60
62
  );
61
63
  ```
62
64
 
65
+ ### Code text (up to 4 chars)
66
+
67
+ ```jsx
68
+ import { Avatar } from "cleanplate";
69
+
70
+ export const Example = () => (
71
+ <>
72
+ <Avatar codeText="B101" size="medium" />
73
+ <Avatar codeText="F2" size="small" />
74
+ <Avatar codeText="order-AB#12-99" size="medium" />
75
+ </>
76
+ );
77
+ ```
78
+
63
79
  ### Icon
64
80
 
65
81
  ```jsx
@@ -143,8 +159,10 @@ export const Example = () => (
143
159
 
144
160
  ## Behavior Notes
145
161
 
146
- - **Display priority:** If `image` is set, the image is shown. Else if `icon` is set, the Material icon is shown. Otherwise initials from `name` are shown.
162
+ - **Display priority:** If `image` is set, the image is shown. Else if `icon` is set, the Material icon is shown. Else if `codeText` resolves to a valid value, that text is shown. Otherwise initials from `name` are shown.
163
+ - **Code text sanitization:** `codeText` removes special characters, keeps only `[a-zA-Z0-9]`, then renders the **last 4** characters in uppercase. Examples: `"B101"` -> `"B101"`, `"F2"` -> `"F2"`, `"AB#12-99"` -> `"1299"`.
147
164
  - **Initials:** Derived from the first letter of each word in `name` (up to 2 characters), e.g. "John Doe" → "JD".
165
+ - **Text fitting:** Avatar text auto-scales for 3-4 characters so code labels remain readable in both sizes.
148
166
  - **Backgrounds (CSS only):** **Initials** use `var(--primary-brand)` on the root. **Icon** mode uses `var(--primary-brand)` for the circle. **Image** mode uses `var(--white)` behind the photo so transparent PNGs do not show a hole. To change colors, add a **`className`** and target the root in your stylesheet.
149
167
  - **Spacing:** `margin` accepts the **spacing suffix**; the component adds the `m-` prefix via `getSpacingClass`. Use suffix form (e.g. `"0"`, `"2"`, `"b-3"`) when passing values explicitly.
150
168
  - **Root element:** A `div`; supports `ref` and other attributes except **`style`** (omitted from the public type so layout stays class-based).
@@ -16,6 +16,26 @@ FormControls is a set of form primitives exported as a namespace: `FormControls.
16
16
  | Toggle | On/off switch | checked, defaultChecked, onChange(checked: boolean) |
17
17
  | Stepper | Numeric value with integrated − / + (integer text field + `min` / `max` / `step`) | placeholder, value, onChange(e), min, max, step, layout |
18
18
 
19
+ ## E2E / test selectors (overview)
20
+
21
+ Pass **`dataTestId="my-field"`** on any control below. Patterns are consistent across the library so package consumers can write the same Playwright habits everywhere.
22
+
23
+ | Control | Root id on | Primary interaction id | Common suffixes |
24
+ | --- | --- | --- | --- |
25
+ | **Input** | native `<input>` | same as root (`.fill()`) | `-clear`, `-prefix`, `-suffix`, `-error` |
26
+ | **TextArea** | native `<textarea>` | same as root | `-error` |
27
+ | **Select** | field wrapper | `-trigger` (open), `-option-{value}` (pick) | `-panel`, `-search`, `-search-clear`, `-listbox`, `-clear`, `-input`, `-error` |
28
+ | **Date** | field wrapper | `-trigger`, `-day-YYYY-MM-DD` | `-panel`, `-grid`, `-done`, `-cancel`, `-clear`, `-input`, … |
29
+ | **Checkbox** | `<fieldset>` | `-label-{value}` or `-input-{value}` | `-options`, `-option-{value}` |
30
+ | **Radio** | `<fieldset>` | `-label-{value}` or `-input-{value}` | same as Checkbox |
31
+ | **File** | hidden `<input type="file">` | same as root (`setInputFiles`) | `-trigger`, `-list`, `-item-{i}`, `-remove-{i}` |
32
+ | **Toggle** | native switch `<input>` | `-label` (click) or root (`.check()`) | `-error` |
33
+ | **Stepper** | numeric `<input>` | same as root | `-increment`, `-decrement`, `-error` |
34
+
35
+ `{value}` keys sanitize option values: non-alphanumeric characters become `-` (e.g. `premium_plus` → `premium-plus`).
36
+
37
+ Detail sections below expand each control. Component source files also document suffixes in **`dataTestId` JSDoc**.
38
+
19
39
  ## Types
20
40
 
21
41
  ### Option (and SelectOption)
@@ -112,6 +132,7 @@ interface InputProps {
112
132
  isFluid?: boolean;
113
133
  className?: string;
114
134
  error?: string;
135
+ /** On the native `<input>`; suffixed `-clear`, `-prefix`, `-suffix`, `-error` — see **Input — E2E / test selectors**. */
115
136
  dataTestId?: string;
116
137
  /** Native `autocomplete` attribute. */
117
138
  autoComplete?: string;
@@ -139,15 +160,16 @@ interface InputProps {
139
160
  ```
140
161
 
141
162
  ### Other control types
142
- - **TextAreaProps**: label, value/defaultValue, onChange, isDisabled, isRequired, isFluid, className, error, dataTestId.
143
- - **FileProps**: `name`, `label`, `variant` (`"button" | "card"`, default `"button"`), `multiple`, `accept`, `value: File[]` (controlled), `defaultValue: File[]` (uncontrolled initial visual list), `onChange(files: File[], e?)`, `buttonLabel` (default `"Browse file"`), `dropZoneText` (default `"Drag files to upload"`, card variant only), plus the common `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, `dataTestId`. The card variant supports drag-and-drop. **FileVariant** = `"button" | "card"`.
163
+ - **TextAreaProps**: label, value/defaultValue, onChange, isDisabled, isRequired, isFluid, className, error, **`dataTestId`** (on `<textarea>`; `-error` — see overview).
164
+ - **SelectProps**: **`dataTestId`** (wrapper root; `-trigger`, `-panel`, `-option-{value}`, see **Select E2E / test selectors**).
165
+ - **FileProps**: `name`, `label`, `variant` (`"button" | "card"`, default `"button"`), `multiple`, `accept`, `value: File[]` (controlled), `defaultValue: File[]` (uncontrolled initial visual list), `onChange(files: File[], e?)`, `buttonLabel` (default `"Browse file"`), `dropZoneText` (default `"Drag files to upload"`, card variant only), plus the common `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, **`dataTestId`** (on file input; `-trigger`, `-list`, `-item-{i}`, `-remove-{i}` — see **File — E2E / test selectors**). The card variant supports drag-and-drop. **FileVariant** = `"button" | "card"`.
144
166
  - **RadioProps**: `options` (non-empty `RadioOption[]`), `name`, `label` (group `<legend>`), optional `id`, `value`, `defaultValue`, `onChange(value, e)`, `orientation` (`"vertical" | "horizontal"`), `variant` (`"default" | "card"`), `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, **`dataTestId`** (root on `<fieldset>`; suffixed ids on options container, rows, inputs, and labels — see **Checkbox and Radio — E2E / test selectors**).
145
167
  - **RadioOption**: `{ label, value, isDisabled?, description?, icon?, dataTestId?, id? }`. `description` is rendered under the option label as muted secondary text and linked via `aria-describedby`. `icon` accepts any `ReactNode` (e.g. `<Icon />`, `<img />`, custom SVG) and renders to the left of the label/description. **`dataTestId`** on an option overrides the group-derived `-input-{value}` id for that option's native `<input>`.
146
- - **ToggleProps**: checked, defaultChecked, onChange(checked: boolean), label, isDisabled, isRequired, isFluid, className, error, dataTestId.
147
168
  - **CheckboxProps**: `options` (non-empty `CheckboxOption[]`), `name`, `label` (group `<legend>`), optional `id`, `value` (`CheckboxValue[]`), `defaultValue` (`CheckboxValue[]`), `onChange(values, e)`, `orientation` (`"vertical" | "horizontal"`), `variant` (`"default" | "card"`), `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, **`dataTestId`** (root on `<fieldset>`; suffixed ids on options container, rows, inputs, and labels — see **Checkbox and Radio — E2E / test selectors**).
148
169
  - **CheckboxOption**: `{ label, value, isDisabled?, description?, icon?, dataTestId?, id? }`. `description` is rendered under the option label as muted secondary text and linked via `aria-describedby`. `icon` accepts any `ReactNode` (e.g. `<Icon />`, `<img />`, custom SVG) and renders to the left of the label/description. **`dataTestId`** on an option overrides the group-derived `-input-{value}` id for that option's native `<input>`. `CheckboxValue = string | number`.
149
- - **DateProps**: `value` / `defaultValue` (`Date | null`), `onChange(date: Date | null)`, `placeholder`, **`dateFormat`** (display string via `date-fns` + `locale`, default `MMM dd, yyyy`), **`name`** (renders a hidden `<input>` that submits **`yyyy-MM-dd`** for the committed calendar date), **`minDate`** / **`maxDate`** (inclusive navigation + selection bounds), **`disabledDates`** / **`disabledDaysOfWeek`** (greyed cells), **`locale`** (`date-fns` `Locale` — grid, subview copy, and field text), **`weekStartsOn`** (`0`–`6`, default `0` = Sunday), **`clearable`** (default `true`; shows clear control when a value exists), **`readOnly`** (no picker; value fixed), **`popoverPlacement`** (Floating UI placement for desktop; default `bottom-start`), **`onOpen`** / **`onClose`**, plus shared `label`, `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, `dataTestId`.
150
- - **FormControlsStepperProps**: label, placeholder, value/defaultValue, onChange(e), min, max, step, layout (`"default" | "split-controls" | "trailing-stacked-chevrons"`), isDisabled, isRequired, isFluid, className, error, dataTestId.
170
+ - **DateProps**: `value` / `defaultValue` (`Date | null`), `onChange(date: Date | null)`, `placeholder`, **`dateFormat`** (display string via `date-fns` + `locale`, default `MMM dd, yyyy`), **`name`** (renders a hidden `<input>` that submits **`yyyy-MM-dd`** for the committed calendar date), **`minDate`** / **`maxDate`** (inclusive navigation + selection bounds), **`disabledDates`** / **`disabledDaysOfWeek`** (greyed cells), **`locale`** (`date-fns` `Locale` — grid, subview copy, and field text), **`weekStartsOn`** (`0`–`6`, default `0` = Sunday), **`clearable`** (default `true`; shows clear control when a value exists), **`readOnly`** (no picker; value fixed), **`popoverPlacement`** (Floating UI placement for desktop; default `bottom-start`), **`onOpen`** / **`onClose`**, plus shared `label`, `isDisabled`, `isRequired`, `isFluid`, `className`, `error`, **`dataTestId`** (see **Date — E2E / test selectors**).
171
+ - **ToggleProps**: checked, defaultChecked, onChange(checked: boolean), label, isDisabled, isRequired, isFluid, className, error, **`dataTestId`** (on switch input; `-label`, `-error`).
172
+ - **FormControlsStepperProps**: label, placeholder, value/defaultValue, onChange(e), min, max, step, layout (`"default" | "split-controls" | "trailing-stacked-chevrons"`), isDisabled, isRequired, isFluid, className, error, **`dataTestId`** (on input; `-increment`, `-decrement`, `-error`).
151
173
 
152
174
  ## Usage Examples
153
175
 
@@ -200,6 +222,82 @@ const [tags, setTags] = useState([{ label: "A", value: "a" }]);
200
222
 
201
223
  **Mobile:** At **viewport width ≤768px**, the panel opens as a **bottom sheet** (fixed to the lower viewport) with dialog semantics when a **label** is present, instead of a floating anchored list.
202
224
 
225
+ ### Input — E2E / test selectors
226
+
227
+ Unlike grouped controls (Checkbox, Radio), **`dataTestId` is placed on the native `<input>`** so Playwright can target it directly for `.fill()` / `.type()` without an extra `-input` suffix.
228
+
229
+ Pass **`dataTestId="email"`**:
230
+
231
+ | Target | `data-testid` |
232
+ | --- | --- |
233
+ | Native `<input>` | `email` |
234
+ | Search clear button | `email-clear` (only when `type="search"` and the field has a value) |
235
+ | Prefix affix | `email-prefix` (when `prefix` is set) |
236
+ | Suffix affix | `email-suffix` (when `suffix` is set) |
237
+ | Error message | `email-error` (when `error` is set) |
238
+
239
+ Affixes are ignored for `type="search"` (search uses icon + clear instead).
240
+
241
+ #### Playwright examples
242
+
243
+ ```ts
244
+ // Default / text / number / password
245
+ await page.getByTestId("email").fill("user@example.com");
246
+
247
+ // Search + clear
248
+ await page.getByTestId("search-input").fill("query");
249
+ await page.getByTestId("search-input-clear").click();
250
+
251
+ // Amount with affixes
252
+ await page.getByTestId("amount-input").fill("42");
253
+ await expect(page.getByTestId("amount-input-error")).toHaveText("Required");
254
+ ```
255
+
256
+ ### TextArea, Toggle, and Stepper — E2E / test selectors
257
+
258
+ **TextArea:** `dataTestId` on the `<textarea>`; `-error` when `error` is set.
259
+
260
+ ```ts
261
+ await page.getByTestId("message-textarea").fill("Hello");
262
+ ```
263
+
264
+ **Toggle:** `dataTestId` on the switch input; prefer `-label` for clicks.
265
+
266
+ ```ts
267
+ await page.getByTestId("notifications-toggle-label").click();
268
+ await expect(page.getByTestId("notifications-toggle")).toBeChecked();
269
+ ```
270
+
271
+ **Stepper:** `dataTestId` on the numeric input; `-increment` / `-decrement` on step buttons.
272
+
273
+ ```ts
274
+ await page.getByTestId("qty-stepper-increment").click();
275
+ await expect(page.getByTestId("qty-stepper")).toHaveValue("2");
276
+ ```
277
+
278
+ ### Select — E2E / test selectors
279
+
280
+ Pass **`dataTestId="fruit-select"`** on the field. The **root** id is on the field wrapper; open and pick via suffixed ids:
281
+
282
+ | Suffix | Element |
283
+ | --- | --- |
284
+ | *(root)* | Field wrapper |
285
+ | `-trigger` | Combobox (open panel) |
286
+ | `-clear` | Clear selection (when `clearable`) |
287
+ | `-panel` | Floating panel / mobile sheet |
288
+ | `-search` | Panel search input (`searchable`) |
289
+ | `-search-clear` | Clear panel search |
290
+ | `-listbox` | Options list |
291
+ | `-option-{value}` | Option row |
292
+ | `-input` | Hidden `name` field (form submit) |
293
+ | `-error` | Validation message |
294
+
295
+ ```ts
296
+ await page.getByTestId("fruit-select-trigger").click();
297
+ await page.getByTestId("fruit-select-option-mango").click();
298
+ await expect(page.getByTestId("fruit-select-input")).toHaveValue("mango");
299
+ ```
300
+
203
301
  ### Input with prefix / suffix
204
302
 
205
303
  ```jsx
@@ -249,6 +347,27 @@ import { de } from "date-fns/locale/de";
249
347
  />
250
348
  ```
251
349
 
350
+ ### Date — E2E / test selectors
351
+
352
+ Pass **`dataTestId="dob"`** on the field:
353
+
354
+ | Suffix | Element |
355
+ | --- | --- |
356
+ | *(root)* | Field wrapper |
357
+ | `-trigger` | Open picker |
358
+ | `-clear` | Clear committed value (`clearable`) |
359
+ | `-panel` | Calendar dialog |
360
+ | `-grid` | Day grid |
361
+ | `-day-YYYY-MM-DD` | Day button |
362
+ | `-cancel` / `-done` | Footer actions |
363
+ | `-input` | Hidden `name` field (`yyyy-MM-dd`) |
364
+
365
+ ```ts
366
+ await page.getByTestId("dob-trigger").click();
367
+ await page.getByTestId("dob-day-2026-05-18").click();
368
+ await page.getByTestId("dob-done").click();
369
+ ```
370
+
252
371
  ### Checkbox group
253
372
 
254
373
  Pass an `options` array. The component renders the entire group inside a `<fieldset>` + `<legend>` and emits `onChange(values, event)` with the next array of selected values. The required `*` is rendered on the group label, not on individual options.
@@ -397,6 +516,24 @@ await expect(page.getByTestId("shipping-input-std")).not.toBeChecked();
397
516
  await page.getByTestId("shipping-input-std").check();
398
517
  ```
399
518
 
519
+ ### File — E2E / test selectors
520
+
521
+ Pass **`dataTestId="upload"`**. The **root** id is on the hidden file input (use `setInputFiles`); related UI uses suffixes:
522
+
523
+ | Suffix | Element |
524
+ | --- | --- |
525
+ | *(root)* | Hidden `<input type="file">` |
526
+ | `-trigger` | Browse / drop-zone label |
527
+ | `-list` | Selected files list |
528
+ | `-item-{i}` | File row |
529
+ | `-remove-{i}` | Remove button |
530
+
531
+ ```ts
532
+ await page.getByTestId("upload").setInputFiles("fixtures/doc.pdf");
533
+ await expect(page.getByTestId("upload-item-0")).toContainText("doc.pdf");
534
+ await page.getByTestId("upload-remove-0").click();
535
+ ```
536
+
400
537
  ### File (button variant)
401
538
 
402
539
  Compact trigger that looks like a primary button. Selected files render below the trigger as small cards with a type-specific thumbnail icon, name, size, and a remove button.
@@ -440,6 +577,11 @@ Pagination uses `FormControls.Select` for rows-per-page. Pills uses `FormControl
440
577
  - **Input (`prefix` / `suffix`):** Inline leading/trailing text affix for currency (`$`), country code (`+91`), unit (`kg`, `%`), TLD (`.com`), etc. Soft-capped at 4 characters so the layout stays predictable; longer strings are truncated. When set, the field's outer wrapper takes over the visible border / padding / focus ring so the affixes read as part of the same input. Affixes are linked to the input via `aria-describedby`, so screen readers announce e.g. "Amount, dollars, $500" when the visible affix is `$`. For symbols/abbreviations that don't read well, pass `prefixA11yLabel` / `suffixA11yLabel` (e.g. `prefix="$"`, `prefixA11yLabel="dollars"`). Ignored when `type="search"` (search already uses both edges) — for any other `type`, including `number`, affixes work as expected.
441
578
  - **Input (validation / constraints):** `maxLength` is passed straight to the native attribute (works for any `type`). `min` / `max` are passed to the native attribute (HTML5 form-validation hints) and, for `type="number"` only, also clamped on `blur` — the user can finish typing freely and the value snaps to the bound when they leave the field.
442
579
  - **Input (`autoComplete` / `onBlur`):** `autoComplete` maps to the native attribute (`"email"`, `"current-password"`, `"off"`, …). `onBlur` runs after any internal numeric clamp so consumers see the final value.
580
+ - **Input (`dataTestId`):** Applied on the native `<input>` for direct E2E fill/type. Optional suffixed ids: `-clear` (search), `-prefix`, `-suffix` (affix layout), `-error` (validation message). See **Input — E2E / test selectors**.
581
+ - **TextArea / Toggle / Stepper (`dataTestId`):** On the native control; see **TextArea, Toggle, and Stepper — E2E / test selectors**.
582
+ - **Select (`dataTestId`):** Wrapper root plus `-trigger`, `-panel`, `-option-{value}`, etc. See **Select — E2E / test selectors**.
583
+ - **Date (`dataTestId`):** Wrapper root plus calendar suffixes. See **Date — E2E / test selectors**.
584
+ - **File (`dataTestId`):** On file input plus `-trigger`, `-list`, `-item-{i}`, `-remove-{i}`. See **File — E2E / test selectors**.
443
585
  - **Select:** Built on **Floating UI** — desktop uses a **portalled** panel with flip/shift to stay in the viewport; panel **width** matches the trigger, with optional **`panelMinWidth`** when options need more horizontal space; **`searchable={false}`** hides the panel search field (full static list, or async `onSearch("")` on open); **≤768px** uses a **bottom sheet** (`role="dialog"`, `aria-modal`, `aria-labelledby` to the field label when the label exists). **Option** shape supports `group`, `icon`, `avatar`, `meta`, `disabled`. **`mode`** (`'single' | 'multi'`) replaces **`isMulti`** (still supported, deprecated). Single mode: **`onChange(Option | null)`** — `null` when cleared. Multi mode: **`onChange(Option[])`** — use **`[]`** for clear. **`name` + hidden `<input>`:** native form submit posts the selected **`value`**(s); **multi** joins with **commas** — avoid comma characters inside `value` if you rely on `FormData`, or parse manually. **`options={null}` + `onSearch`:** async loading; show loading/empty/error states in the panel. **`groups`:** sticky headings for shared `Option.group`. **`maxSelect`:** multi only; **`triggerMaxItems`:** chip overflow **`+N`**. **`aria-controls`** on the combobox trigger and panel search point at the listbox **only while open**. **`aria-invalid`** reflects **`error`** on trigger, search field, and listbox. Validation message uses **`role="alert"`** (via shared field error pattern).
444
586
  - **Date:** **`Date | null`** with **`onChange`**. Opens a **`role="dialog"`** calendar: **staging** applies on day tap; **Cancel** reverts to the last committed value; **OK** commits (and clears staging). **Desktop:** portalled Floating UI panel with flip/shift, fixed **max width ~400px** (capped by viewport). **≤768px:** bottom sheet fixed to the lower viewport + dimmed backdrop, `aria-modal`, body scroll lock while open (same breakpoint idea as Select). **Header:** month cluster + year cluster (44px arrow hits); tapping month/year opens **scrollable subviews** with **back (`arrow_back`)** and headings **“Select a month of {yyyy}”** / **“Select a year for {MMMM}”** (locale-aware via `locale`). **Trigger:** **`calendar_month`** trailing icon (not Select chevrons); optional **clear** when `clearable`. **`readOnly`** and **`isDisabled`** block interaction. Constraints: **`minDate`/`maxDate`** (inclusive), **`disabledDates`**, **`disabledDaysOfWeek`**. **`dateFormat`** + **`locale`** control the field string; grid labels follow **`locale`** and **`weekStartsOn`**. **`name`:** hidden input posts **`yyyy-MM-dd`** for the **committed** value only. **`onOpen`/`onClose`** fire when the panel opens/closes. **`popoverPlacement`** adjusts desktop anchor (default `bottom-start`). **`error`** / **`isRequired`** use the shared field error pattern (`aria-invalid`, message under the field).
445
587
  - **Radio:** Group-first API — pass `options: RadioOption[]`. Renders `<fieldset>` + `<legend>` with a single `value` and `onChange(value, e)`. `isRequired` puts `*` on the legend and adds `required`/`aria-required` to the first enabled option (HTML5 only requires one input in the group to carry it). Custom ring/dot follows the native `:checked` state so uncontrolled groups stay visually correct. Pass `variant="card"` for tile-style options (ring in top-right, optional `icon` on the left, primary-brand border + tint when selected). **`dataTestId`** on the group maps to the fieldset and emits suffixed ids (`-options`, `-option-{value}`, `-input-{value}`, `-label-{value}`); per-option `dataTestId` overrides the input suffix only.
package/docs/Header.md CHANGED
@@ -136,7 +136,9 @@ Prefer **`Dropdown`** with **`Avatar`** as **`trigger`** and **`content`** that
136
136
  - **headerLeft / headerCenter / headerRight:** When provided, replace the default logo, MenuList, or right slot.
137
137
  - **AppShell:** If you pass **`header`** as **`HeaderProps`** to **`AppShell`**, configure **`headerRight`** the same way as a standalone **`Header`** (recommended account dropdown structure does not change).
138
138
  - **showCenterMenu:** When `false`, the center column is empty on desktop (unless `headerCenter` is set). `menuItems` is still used for the mobile overlay.
139
- - **Mobile:** Below 1024px, center nav hides; hamburger shows. Click opens slide-in menu (Animated fade-in-left).
139
+ - **Mobile:** Below 1024px, center nav hides; hamburger shows. Click opens a Floating UI drawer with backdrop fade and left slide animation.
140
+ - **Backdrop + close:** Clicking the backdrop closes the drawer; close button and menu item clicks also close it.
141
+ - **Scroll lock:** While the mobile drawer is open, background page scroll is locked.
140
142
  - **onMenuItemClick:** Called with the clicked item; mobile menu closes on click.
141
143
  - **Margin:** Uses the suffix API (e.g. `"0"` → m-0).
142
144
 
@@ -146,4 +148,4 @@ Prefer **`Dropdown`** with **`Avatar`** as **`trigger`** and **`content`** that
146
148
  - Dropdown, Avatar (account menu in **headerRight**; see `docs/Dropdown.md`)
147
149
  - AppShell (passes **`header`** as Header props; same **headerRight** recommendations apply)
148
150
  - Button, Icon (mobile menu trigger and close)
149
- - Animated (mobile menu slide-in)
151
+ - Floating UI overlay/dialog primitives (mobile menu drawer)
@@ -10,6 +10,7 @@ Purpose: Combines fixed media (`Avatar`: icon, image, or initials) with a dense
10
10
  | mediaIcon | `MaterialIconName` \| string | no | "" | Material Symbol name passed to `Avatar`. |
11
11
  | mediaImage | string | no | "" | Image URL for `Avatar`. |
12
12
  | mediaAvatar | string | no | "" | Display name used for initials when image/icon are not shown. |
13
+ | mediaAvatarCodeText | string | no | "" | Optional avatar code override. Passed to `Avatar.codeText` (alphanumeric only, last 4 chars). |
13
14
  | subtitle | `React.ReactNode` | no | — | Optional middle line (e.g. subject). Omit for two-line layouts. |
14
15
  | description | `React.ReactNode` | no | — | Optional preview/snippet line(s); muted, multi-line ellipsis via `--cp-media-object-desc-lines`. |
15
16
  | descriptionLineClamp | number | no | 2 | Max lines for `description` before truncation. |
@@ -40,6 +41,7 @@ interface MediaObjectProps extends React.HTMLAttributes<HTMLDivElement> {
40
41
  mediaIcon?: MaterialIconName | string;
41
42
  mediaImage?: string;
42
43
  mediaAvatar?: string;
44
+ mediaAvatarCodeText?: string;
43
45
  title: string;
44
46
  subtitle?: React.ReactNode;
45
47
  description?: React.ReactNode;
@@ -184,6 +186,7 @@ import { MediaObject, Typography } from "cleanplate";
184
186
  - **Trailing rail**: If `meta` and/or `action` is passed, the body adds a second grid column: `meta` always occupies **column 2, row 1** aligned with `title`; `action` occupies **column 2, last text row**, aligned toward the snippet row. When **only one** logical text row remains and **both** `meta` and `action` exist, both stack in one compact trailing cell (`gap` 2px).
185
187
  - **`descriptionLineClamp`** sets the CSS custom property `--cp-media-object-desc-lines` on the snippet wrapper so consumers can clamp 1–N lines preview text.
186
188
  - **Media slot**: Implemented with `Avatar` (`name={mediaAvatar}`, `image`, `icon`). Combination rules when multiple props are set match `Avatar` (see `docs/Avatar.md`); typical usage passes one dominant source (photo URL vs icon vs name for initials).
189
+ - **Code avatars**: Use `mediaAvatarCodeText` for code-like values (e.g. `B101`, `F2`). Avatar sanitizes to alphanumeric and renders the last 4 chars.
187
190
  - **`meta` primitives**: Strings and numbers render with component meta typography (muted `--text-muted`); pass React nodes when you control color/weight entirely.
188
191
  - **`title`** is always a string rendered as emphasized primary text (`--text-default`).
189
192
  - **`subtitle`** and **`description`** accept `React.ReactNode`; empty string / falsy hides the slot.
package/docs/Table.md CHANGED
@@ -74,13 +74,14 @@ interface TableMobileColumns
74
74
  extends Omit<
75
75
  MediaObjectProps,
76
76
  | "title" | "subtitle" | "description" | "meta" | "action"
77
- | "mediaAvatar" | "mediaIcon" | "mediaImage" | "onClick"
77
+ | "mediaAvatar" | "mediaAvatarCodeText" | "mediaIcon" | "mediaImage" | "onClick"
78
78
  > {
79
79
  title: TableMobileColumnKey; // required row key
80
80
  subtitle?: TableMobileColumnField;
81
81
  description?: TableMobileColumnField;
82
82
  meta?: TableMobileColumnField;
83
83
  mediaAvatar?: TableMobileColumnKey;
84
+ mediaAvatarCodeText?: TableMobileColumnField<string>; // static code, row key, or resolver
84
85
  mediaIcon?: TableMobileColumnField<string>; // static icon, row key, or resolver
85
86
  mediaImage?: TableMobileColumnField<string>; // static URL, row key, or resolver
86
87
  action?: (row: TableRow) => React.ReactNode;
@@ -180,6 +181,7 @@ const columns = [
180
181
  description: "email",
181
182
  meta: "status",
182
183
  mediaAvatar: "name",
184
+ mediaAvatarCodeText: "employeeCode",
183
185
  descriptionLineClamp: 2,
184
186
  action: (row) => <Badge label={String(row.status)} variant="success" />,
185
187
  }}
@@ -200,7 +202,7 @@ const columns = [
200
202
 
201
203
  - **Required:** `columns` and `data` are required. Each column must have `id` and `title`; row keys should match `id` for default cell display.
202
204
  - **Pagination:** Built-in Pagination is shown when `totalItems` > 0 and `hidePagination` is false. Pass `onPageChange` and optionally `onRowsPerPageChange`; keep `currentPage` and `rowsPerPage` in parent state.
203
- - **Mobile:** When viewport width < 768px and `mobileColumns` is set, each row renders as a `MediaObject`. Map row keys to `title`, `subtitle`, `description`, `meta`, and media fields, or use resolvers / `action` for custom per-row UI. Static MediaObject props (`descriptionLineClamp`, `margin`, `padding`, etc.) pass through unchanged.
205
+ - **Mobile:** When viewport width < 768px and `mobileColumns` is set, each row renders as a `MediaObject`. Map row keys to `title`, `subtitle`, `description`, `meta`, and media fields (`mediaAvatar`, `mediaAvatarCodeText`, `mediaIcon`, `mediaImage`), or use resolvers / `action` for custom per-row UI. Static MediaObject props (`descriptionLineClamp`, `margin`, `padding`, etc.) pass through unchanged.
204
206
  - **customRender:** Receives `(rowData, column)` and returns a React node; use for badges, buttons, or any custom cell content.
205
207
  - **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
206
208
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleanplate",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",