@antadesign/anta 0.3.30 → 0.3.32

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 (50) hide show
  1. package/dist/anta_helpers.d.ts +4 -0
  2. package/dist/anta_helpers.js +10 -0
  3. package/dist/box-types.d.ts +12 -1
  4. package/dist/bundle.css +1 -1
  5. package/dist/bundle.js +140 -66
  6. package/dist/components/Box.d.ts +18 -6
  7. package/dist/components/Box.js +4 -0
  8. package/dist/components/Expander.d.ts +17 -9
  9. package/dist/components/Expander.js +14 -1
  10. package/dist/components/InputDate.js +2 -0
  11. package/dist/components/MenuItem.d.ts +9 -7
  12. package/dist/components/MenuItem.js +21 -2
  13. package/dist/components/Text.js +2 -3
  14. package/dist/components/Title.d.ts +8 -2
  15. package/dist/components/Title.js +17 -6
  16. package/dist/elements/a-box.css +1 -1
  17. package/dist/elements/a-box.d.ts +2 -0
  18. package/dist/elements/a-box.js +74 -32
  19. package/dist/elements/a-button.css +1 -1
  20. package/dist/elements/a-button.d.ts +5 -2
  21. package/dist/elements/a-calendar.js +3 -1
  22. package/dist/elements/a-copy.js +23 -3
  23. package/dist/elements/a-dialog.js +2 -0
  24. package/dist/elements/a-expander.css +1 -1
  25. package/dist/elements/a-expander.js +118 -39
  26. package/dist/elements/a-input-time.js +2 -1
  27. package/dist/elements/a-menu-item.css +1 -1
  28. package/dist/elements/a-menu.js +43 -3
  29. package/dist/elements/a-panel.css +1 -1
  30. package/dist/elements/a-panel.js +1 -1
  31. package/dist/elements/a-radio-group.js +2 -2
  32. package/dist/elements/a-slider.js +2 -2
  33. package/dist/elements/a-tabs.js +2 -2
  34. package/dist/elements/a-title.css +1 -1
  35. package/dist/elements/a-tooltip.js +1 -1
  36. package/dist/general_types.d.ts +22 -6
  37. package/dist/index.d.ts +1 -1
  38. package/dist/theme-antune.css +1 -1
  39. package/docs/changelog.md +64 -0
  40. package/docs/comparison.md +1 -1
  41. package/docs/components/box.md +81 -24
  42. package/docs/components/button.md +127 -381
  43. package/docs/components/expander.md +88 -47
  44. package/docs/components/menu.md +37 -15
  45. package/docs/components/panel.md +5 -6
  46. package/docs/components/select-faceted.md +25 -11
  47. package/docs/components/title.md +19 -0
  48. package/docs/credits.md +3 -0
  49. package/docs/packages/plot.md +234 -19
  50. package/package.json +2 -2
@@ -94,6 +94,43 @@ it's a no-op there. Use it where the expander sits in a content column
94
94
  with room to its left (a prose measure); in a full-width / edge-to-edge
95
95
  container the chevron would overhang the edge.
96
96
 
97
+ ## Indicator
98
+
99
+ `indicatorPlacement="end"` puts the disclosure mark after the header actions.
100
+ The mark stays inside the summary button, so selecting it toggles the section.
101
+ Actions remain separate controls. The default `start` placement keeps the
102
+ right-pointing chevron that turns down when open. At the end, it points down
103
+ when closed and up when open.
104
+
105
+ Choose `indicator="triangle"` for a filled arrow or `indicator="plus"` for a
106
+ plus that becomes a minus. The default is `chevron`. The built-in motion follows
107
+ the reduced-motion preference. An unrecognized string or number leaves the
108
+ indicator empty; omit `indicator` to keep the default chevron.
109
+
110
+ ```tsx
111
+ <Expander title="Download report" indicatorPlacement="end"
112
+ actions={<Button size="small" label="Download" />}>
113
+ …
114
+ </Expander>
115
+ <Expander title="Plus and minus" indicator="plus" indicatorPlacement="end">…</Expander>
116
+ ```
117
+
118
+ Pass a decorative node as `indicator` to replace the built-in mark. One node
119
+ rotates with the section. To switch between two visuals, pass `closed` and
120
+ `open` nodes. Neither form adds a focus stop or an accessible name: the title
121
+ names the summary button, and its `aria-expanded` reports the state. Put
122
+ interactive controls in `actions`.
123
+
124
+ ```tsx
125
+ <Expander title="Custom mark" indicatorPlacement="end"
126
+ indicator={<Icon shape="chevron-down" />}>…</Expander>
127
+ <Expander title="Two marks" indicatorPlacement="end"
128
+ indicator={{ closed: <Icon shape="plus" />, open: <Icon shape="minus" /> }}>…</Expander>
129
+ ```
130
+
131
+ On a tertiary end-placement expander, `outdent` still aligns the title and body
132
+ with surrounding content. The indicator stays inside the end edge.
133
+
97
134
  ## Title and level
98
135
 
99
136
  `title` takes a string or any node. For a string, `level` (1–6) applies
@@ -168,10 +205,10 @@ toggle:
168
205
 
169
206
  ## Actions
170
207
 
171
- Pass `actions` to render extra controls — buttons, tags — at the end of
172
- the header row. They sit **outside** the toggle trigger, as its flex
173
- siblings: clicking them never toggles the expander, they're separately
174
- focusable, and screen readers announce them as their own controls.
208
+ Pass `actions` to render extra controls — buttons, tags — after the title.
209
+ They sit **outside** the toggle trigger as its header siblings. Clicking them
210
+ never toggles the expander; they're separately focusable and announced as
211
+ their own controls.
175
212
  (Don't put interactive elements *inside* a custom `title` instead —
176
213
  nesting controls in a button is an accessibility anti-pattern.)
177
214
 
@@ -309,13 +346,15 @@ function Accordion() {
309
346
  | Prop | Type | Default | Description |
310
347
  |------|------|---------|-------------|
311
348
  | `title` | ReactNode | — | Summary (header) content. A string is rendered with the `level` type scale; pass a node (e.g. a `<Title>`) for full control or real heading semantics in the document outline. |
312
- | `actions?` | ReactNode | — | Header actions (e.g. buttons, tags) rendered at the end of the header row, OUTSIDE the toggle trigger — clicking them never toggles, they're separately focusable, and screen readers see them as separate controls. |
349
+ | `actions?` | ReactNode | — | Header actions rendered outside the toggle trigger. With an end indicator, actions sit between the title and indicator. |
313
350
  | `defaultOpen?` | boolean | — | Initial open state for the uncontrolled case. |
314
351
  | `disabled?` | boolean | — | Disables the header: not clickable or focusable, hover affordance off, text dimmed. The open state freezes as-is — disabling an open expander keeps it open. `actions` stay live; disable them separately if needed. |
352
+ | `indicator?` | ReactNode | 'chevron' | Built-in disclosure mark, a decorative node, or separate closed/open visuals. Other primitive values leave the indicator empty. Custom nodes are passive; use `actions` for controls. |
353
+ | `indicatorPlacement?` | 'start' \| 'end' | 'start' | Place the disclosure mark before the title or after the actions. |
315
354
  | `level?` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 5 | Heading type scale applied to a string `title` (mirrors `<Title>`'s levels). Visual only — for outline semantics, pass a `<Title>` as the title. |
316
355
  | `onStateChange?` | (event, detail) => void | — | Fired before the open state changes. `event` is the cancelable `statechange` — call `event.preventDefault()` to veto an *uncontrolled* toggle (e.g. confirm before closing). `detail.next` is the requested open state, `detail.prev` the current one (booleans). In controlled mode, apply `detail.next` to `open` to accept, or do nothing to reject. |
317
356
  | `open?` | boolean | — | Controlled open state. When provided, the consumer owns open/close. Selecting the summary requests a change through `onStateChange`; omit `open` for uncontrolled use. |
318
- | `outdent?` | boolean | — | Outdent the chevron into the left gutter so the title and body sit flush with surrounding content (the docs-header layout). Only takes effect with `priority="tertiary"` — on the filled priorities the container edge has to bound the chevron, so it's a no-op there. |
357
+ | `outdent?` | boolean | — | Align the title and body with surrounding content on a tertiary expander. With the default start indicator, the mark hangs in the gutter; an end indicator stays inside its edge. |
319
358
  | `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'secondary' | Surface emphasis. `secondary` (the default) is a subtle fill; `primary` is a more pronounced card; `tertiary` is transparent (the bare disclosure). |
320
359
  | `round?` | boolean \| number \| string | — | Round corners sized to half the folded (header) height: a pill when folded, and — when expanded — the same corner radius rather than a bigger stadium. The element measures the header, so it tracks custom header content. Pass a `number` (px) or CSS length string for a *fixed* radius that overrides the measurement (and skips it) in both states. |
321
360
  | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Named tones re-point the text and (on filled priorities) the surface to the matching palette; a custom color keeps its hue while lightness/chroma are pinned. `'neutral'` (the default) is the same as omitting it. |
@@ -324,7 +363,8 @@ function Accordion() {
324
363
 
325
364
  Use the web component directly when you are not using React or Preact and a native control does not fit.
326
365
 
327
- Slots hold the title and actions. The details element contains the collapsible body.
366
+ Slots hold the title, actions, and an optional custom indicator. The details
367
+ element contains the collapsible body.
328
368
 
329
369
  ```html
330
370
  <a-expander default-state="open">
@@ -336,6 +376,29 @@ Slots hold the title and actions. The details element contains the collapsible b
336
376
  </a-expander>
337
377
  ```
338
378
 
379
+ Use the `indicator` and `indicator-placement` attributes for built-in marks.
380
+ For custom artwork, assign one element to `slot="indicator"`. Assign two
381
+ elements with `data-when="closed"` and `data-when="open"` when the artwork
382
+ changes between states. Indicator content is decorative and cannot receive focus
383
+ or pointer events.
384
+
385
+ ```html
386
+ <a-expander indicator="triangle" indicator-placement="end">…</a-expander>
387
+
388
+ <a-expander indicator-placement="end">
389
+ <a-expander-summary slot="title">Custom mark</a-expander-summary>
390
+ <a-icon slot="indicator" shape="chevron-down" aria-hidden="true" inert></a-icon>
391
+ <a-expander-details>Content</a-expander-details>
392
+ </a-expander>
393
+
394
+ <a-expander indicator-placement="end">
395
+ <a-expander-summary slot="title">Two marks</a-expander-summary>
396
+ <a-icon slot="indicator" data-when="closed" shape="plus" aria-hidden="true" inert></a-icon>
397
+ <a-icon slot="indicator" data-when="open" shape="minus" aria-hidden="true" inert></a-icon>
398
+ <a-expander-details>Content</a-expander-details>
399
+ </a-expander>
400
+ ```
401
+
339
402
  ### Native HTML details
340
403
 
341
404
  For a simple disclosure, add `data-anta` to native `<details>`. It keeps the
@@ -358,18 +421,18 @@ Reach for the props first: **`tone`** sets the color (any CSS color for a custom
358
421
  tone — it derives the surface in oklch), **`priority`** the fill, **`level`** the
359
422
  heading. Two knobs are worth keeping: **`--expander-tone-source`** (the color a
360
423
  custom `tone` derives from — set it to drive the palette from your own variable) and
361
- **`--expander-gutter`** (the shared left inset that re-insets header + body + chevron
362
- in lockstep; `outdent` sets it to `0`).
424
+ **`--expander-gutter`** (the shared title and body inset; it also positions the
425
+ start indicator). It is 24px at the start, 12px at the end, and `0` with tertiary
426
+ `outdent`.
363
427
 
364
428
  ```tsx
365
429
  <Expander tone="#e0457b" title="Custom" />
366
430
  ```
367
431
 
368
432
  For everything else, `<a-expander>` exposes shadow **parts** — `::part(summary)` (the
369
- header button), `::part(content)` (the body), `::part(actions)` (the actions row) — and
370
- the light-DOM `<a-expander-summary>` / `<a-expander-details>` children, which you style
371
- directly. The header hover / active / focus states and the chevron all live on
372
- `::part(summary)`.
433
+ header button), `::part(indicator)` (the decorative mark), `::part(content)` (the
434
+ body), and `::part(actions)` (the actions row) — and the light-DOM
435
+ `<a-expander-summary>` / `<a-expander-details>` children, which you style directly.
373
436
 
374
437
  Each example keeps its CSS in a `<style>` **inside** its own preview, targeting a demo
375
438
  class on that preview's expander (e.g. `.hide-chevron`) — so the rule you read is
@@ -377,25 +440,19 @@ literally in the preview's DOM, next to the element it styles, never a page-wide
377
440
  stylesheet. The folded recipe under each preview is that same CSS; in your app, swap the
378
441
  demo class for your own selector.
379
442
 
380
- **Hide the chevron.** There's deliberately no prop for it: a region that folds needs a
381
- visible affordance. For a genuine one-off, the chevron is the summary's `::before`, so
382
- remove it — then pull `--expander-gutter` in (it drives the title *and* body inset
383
- together) to tighten the now-empty gutter, and drop your own marker into the title:
443
+ **Hide the indicator.** A disclosure needs a visible affordance. If the title
444
+ provides one, hide the indicator part and tighten the unused gutter:
384
445
 
385
446
  ```css
386
- a-expander.hide-chevron::part(summary)::before { display: none; } /* remove the built-in chevron */
447
+ a-expander.hide-chevron::part(indicator) { display: none; }
387
448
  a-expander.hide-chevron { --expander-gutter: 12px; } /* tighten the inset (default 24px) */
388
449
  ```
389
450
 
390
- **Swap the chevron glyph.** It's a CSS mask, so point `mask-image` at your own SVG; it
391
- keeps its gutter position and the open-state rotation:
451
+ **Change the indicator.** Use the built-in `triangle` or `plus` preset, or
452
+ provide a custom node through `indicator` / `slot="indicator"`:
392
453
 
393
- ```css
394
- /* the chevron is the summary's ::before with a mask-image; swap the glyph for a
395
- solid triangle — it keeps its position and the open-state rotate */
396
- a-expander.swap-chevron::part(summary)::before {
397
- mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5l11 7-11 7z'/%3E%3C/svg%3E");
398
- }
454
+ ```tsx
455
+ <Expander title="Triangle indicator" indicator="triangle" priority="tertiary">…</Expander>
399
456
  ```
400
457
 
401
458
  **Tint the whole header** on hover / press by styling the summary part (the header
@@ -473,29 +530,13 @@ export function SaveButton() {
473
530
  `}</style>
474
531
  ```
475
532
 
476
- *A chevron as a status indicator* — drop the built-in toggle chevron and put a
477
- **non-interactive** chevron in `actions` instead. The whole header still toggles; the
478
- indicator only reflects state, rotating via `:state(open)`. With the `<Expander>` JSX
479
- wrapper, pass `actions={<Icon shape="chevron-down" />}` (the preview below uses the
480
- equivalent element composition because these docs render statically):
533
+ *Style the indicator by state* with `:state(open)` and `::part(indicator)`. The
534
+ example changes its color without changing the built-in glyph or motion:
481
535
 
482
536
  ```tsx
483
- {/* renders an <a-expander> whose only header control is a non-interactive
484
- chevron in the actions slot; the whole header toggles, the chevron flips */}
485
- <Expander actions={<Icon shape="chevron-down" />} className="indicator" defaultOpen>
486
- Build log
487
- </Expander>
488
-
489
- {/* the JSX wrapper boxes the icon in a layout-neutral span, so target the
490
- [slot="actions"] element */}
537
+ <Expander title="Build log" indicatorPlacement="end" className="indicator" defaultOpen>…</Expander>
491
538
  <style>{`
492
- a-expander.indicator { --expander-gutter: 12px; } /* one var: title + body inset */
493
- a-expander.indicator::part(summary)::before { display: none; } /* drop the built-in chevron */
494
- a-expander.indicator [slot="actions"] {
495
- pointer-events: none;
496
- margin-inline-end: 6px; /* a little more right inset */
497
- transition: transform 150ms ease;
498
- }
499
- a-expander.indicator:state(open) [slot="actions"] { transform: rotate(180deg); } /* points down → up */
539
+ a-expander.indicator::part(indicator) { color: var(--text-4); }
540
+ a-expander.indicator:state(open)::part(indicator) { color: var(--text-1); }
500
541
  `}</style>
501
542
  ```
@@ -328,13 +328,13 @@ menus: mark one row for single-select, several for multi-select (pair with
328
328
  `data-menu-open` to keep the menu open as choices toggle). The tint tracks
329
329
  `tone`, so a toned row stays in its own color.
330
330
 
331
- For a real checkable row, add **`selectionIndicator`** (`'checkbox'` or `'radio'`).
332
- It renders a passive checkbox/radio at the leading edge (reusing the
333
- [Checkbox](./checkbox.md) / [Radio](./radio.md) element visuals),
334
- flips the row to `role="menuitemcheckbox"` / `"menuitemradio"`, and pairs
335
- `aria-checked` — the row stays the control, the indicator is decorative. This is
336
- what [Select](./select.md)'s `selection` modes render; use it directly for
337
- a checkable menu.
331
+ For a checkable row, add `selectionIndicator`. The `checkbox` and `radio`
332
+ variants render a passive leading mark. The `switch` variant renders a passive
333
+ trailing switch for settings that take effect immediately. The
334
+ row remains the control and carries `aria-checked`; the indicator adds no focus
335
+ stop or nested role. A switch row keeps the menu open when selected.
336
+
337
+ [Select](./select.md)'s selection modes use the checkbox and radio variants.
338
338
 
339
339
  ```tsx
340
340
  {/* Plain tint (no indicator) */}
@@ -345,6 +345,28 @@ a checkable menu.
345
345
  <MenuItem selectionIndicator="checkbox" label="Show archived" selected data-menu-open />
346
346
  ```
347
347
 
348
+ ```tsx
349
+ const [notifications, setNotifications] = useState(true)
350
+ const [automaticUpdates, setAutomaticUpdates] = useState(false)
351
+
352
+ <Button>Settings</Button>
353
+ <Menu>
354
+ <MenuItem
355
+ selectionIndicator="switch"
356
+ label="Notifications"
357
+ selected={notifications}
358
+ onSelect={() => setNotifications((value) => !value)}
359
+ />
360
+ <MenuItem
361
+ selectionIndicator="switch"
362
+ label="Automatic updates"
363
+ hint="Install new versions automatically"
364
+ selected={automaticUpdates}
365
+ onSelect={() => setAutomaticUpdates((value) => !value)}
366
+ />
367
+ </Menu>
368
+ ```
369
+
348
370
  ## Badges, counters, and hints
349
371
 
350
372
  Drop a `<Tag>` (or any element) as a **child** of a `MenuItem` for a trailing
@@ -411,11 +433,11 @@ navigating links.
411
433
  | `onMouseDown?` | (event) => void | — | Raw `mousedown` on the row. Mainly to `preventDefault()` so the row doesn't take focus on a mouse press — e.g. a combobox option keeping focus in its input field while the click still selects. |
412
434
  | `onSelect?` | (event, detail) => void | — | Activation handler — fires when *this* item is chosen (click / Enter / Space), unless it's `disabled`. It does **not** fire for a submenu parent (clicking that opens the flyout, which isn't a selection) nor for a selection bubbling up from a nested submenu. On a link item it fires alongside the navigation. Receives the event plus a `{ value, label }` detail. |
413
435
  | `role?` | string | — | ARIA role override. Defaults to the role implied by `selectionIndicator` (`menuitem` / `menuitemcheckbox` / `menuitemradio`); set it to reparent the row under a different container role — e.g. `option` inside a `listbox`. |
414
- | `selected?` | boolean | — | Mark the item as selected. On a plain row (no `selectionIndicator`) this is a persistent background tint, the same resting fill a pressed row shows — also the way to flag the current page on a link item. On a checkable row (`selectionIndicator` set) it instead drives the leading `checkbox` / `radio` indicator and the row's `aria-checked`. |
415
- | `selectionIndicator?` | 'checkbox' \| 'radio' \| 'check' | — | Turn the row into a checkable item, driven by `selected` (the row stays the control and carries `aria-checked`): - `'checkbox'` → `role="menuitemcheckbox"`, a leading passive `<a-checkbox>` (before `icon`); the tint is dropped (the box carries state). - `'radio'` → `role="menuitemradio"`, a leading passive `<a-radio>`; tint dropped. - `'check'` → `role="menuitemradio"`, a trailing check glyph on the selected row *and* the background tint (the canonical single-select look). Omit for a plain row (the default). |
436
+ | `selected?` | boolean | — | Mark the item as selected. On a plain row (no `selectionIndicator`) this is a persistent background tint, the same resting fill a pressed row shows — also the way to flag the current page on a link item. On a checkable row (`selectionIndicator` set) it instead drives the indicator and the row's `aria-checked`. |
437
+ | `selectionIndicator?` | 'checkbox' \| 'radio' \| 'check' \| 'switch' | — | Turn the row into a checkable item, driven by `selected` (the row stays the control and carries `aria-checked`): - `'checkbox'` → `role="menuitemcheckbox"`, a leading passive `<a-checkbox>` (before `icon`); the tint is dropped (the box carries state). - `'radio'` → `role="menuitemradio"`, a leading passive `<a-radio>`; tint dropped. - `'check'` → `role="menuitemradio"`, a trailing check glyph on the selected row *and* the background tint (the canonical single-select look). - `'switch'` → `role="menuitemcheckbox"`, a trailing passive `<a-switch>`; selecting the row keeps its menu open. Omit for a plain row (the default). |
416
438
  | `submenu?` | boolean | — | Marks this item as a submenu parent: adds the trailing chevron and `aria-haspopup="menu"`. Nest the flyout as a `<Menu>` child. |
417
- | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone — colors the label, icon, and hover/selected tint (and the `checkbox`/`radio` indicator, which adopts it). A named tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone whose hue + chroma are kept while the lightness is pinned to match the brand text. `critical` is the destructive action; `neutral` (the default) is the standard gray. |
418
- | `toneScope?` | 'all' \| 'selected' | 'all' | Apply `tone` to every row state, or only while the row is selected. In `selected` scope, an unselected row and its checkbox/radio indicator stay neutral. |
439
+ | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone — colors the label, icon, hover/selected tint, and selection indicator. A named tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone whose hue + chroma are kept while the lightness is pinned to match the brand text. `critical` is the destructive action; `neutral` (the default) is the standard gray. |
440
+ | `toneScope?` | 'all' \| 'selected' | 'all' | Apply `tone` to every row state, or only while the row is selected. In `selected` scope, an unselected row and its indicator stay neutral. |
419
441
  | `value?` | string \| number | — | An opaque value identifying this item, handed back in `onSelect`'s detail so a shared handler can tell which row was chosen without a per-item closure. |
420
442
 
421
443
  ## Keyboard
@@ -489,12 +511,12 @@ or do nothing to reject. (Submenus are always uncontrolled, regardless of `open`
489
511
  | `ping?` | string | — | Space-separated URLs the browser pings on navigation. |
490
512
  | `rel?` | string | — | Anchor rel. |
491
513
  | `role?` | string | — | ARIA role override. Defaults to the role implied by `selectionIndicator` (`menuitem` / `menuitemcheckbox` / `menuitemradio`); set it to reparent the row under a different container role — e.g. `option` inside a `listbox`. |
492
- | `selected?` | boolean | — | Mark the item as selected. On a plain row (no `selectionIndicator`) this is a persistent background tint, the same resting fill a pressed row shows — also the way to flag the current page on a link item. On a checkable row (`selectionIndicator` set) it instead drives the leading `checkbox` / `radio` indicator and the row's `aria-checked`. |
493
- | `selectionIndicator?` | 'checkbox' \| 'radio' \| 'check' | — | Turn the row into a checkable item, driven by `selected` (the row stays the control and carries `aria-checked`): - `'checkbox'` → `role="menuitemcheckbox"`, a leading passive `<a-checkbox>` (before `icon`); the tint is dropped (the box carries state). - `'radio'` → `role="menuitemradio"`, a leading passive `<a-radio>`; tint dropped. - `'check'` → `role="menuitemradio"`, a trailing check glyph on the selected row *and* the background tint (the canonical single-select look). Omit for a plain row (the default). |
514
+ | `selected?` | boolean | — | Mark the item as selected. On a plain row (no `selectionIndicator`) this is a persistent background tint, the same resting fill a pressed row shows — also the way to flag the current page on a link item. On a checkable row (`selectionIndicator` set) it instead drives the indicator and the row's `aria-checked`. |
515
+ | `selectionIndicator?` | 'checkbox' \| 'radio' \| 'check' \| 'switch' | — | Turn the row into a checkable item, driven by `selected` (the row stays the control and carries `aria-checked`): - `'checkbox'` → `role="menuitemcheckbox"`, a leading passive `<a-checkbox>` (before `icon`); the tint is dropped (the box carries state). - `'radio'` → `role="menuitemradio"`, a leading passive `<a-radio>`; tint dropped. - `'check'` → `role="menuitemradio"`, a trailing check glyph on the selected row *and* the background tint (the canonical single-select look). - `'switch'` → `role="menuitemcheckbox"`, a trailing passive `<a-switch>`; selecting the row keeps its menu open. Omit for a plain row (the default). |
494
516
  | `submenu?` | boolean | — | Marks this item as a submenu parent: adds the trailing chevron and `aria-haspopup="menu"`. Nest the flyout as a `<Menu>` child. |
495
517
  | `target?` | string | — | Anchor target, e.g. `'_blank'`. |
496
- | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone — colors the label, icon, and hover/selected tint (and the `checkbox`/`radio` indicator, which adopts it). A named tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone whose hue + chroma are kept while the lightness is pinned to match the brand text. `critical` is the destructive action; `neutral` (the default) is the standard gray. |
497
- | `toneScope?` | 'all' \| 'selected' | 'all' | Apply `tone` to every row state, or only while the row is selected. In `selected` scope, an unselected row and its checkbox/radio indicator stay neutral. |
518
+ | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone — colors the label, icon, hover/selected tint, and selection indicator. A named tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone whose hue + chroma are kept while the lightness is pinned to match the brand text. `critical` is the destructive action; `neutral` (the default) is the standard gray. |
519
+ | `toneScope?` | 'all' \| 'selected' | 'all' | Apply `tone` to every row state, or only while the row is selected. In `selected` scope, an unselected row and its indicator stay neutral. |
498
520
  | `value?` | string \| number | — | An opaque value identifying this item, handed back in `onSelect`'s detail so a shared handler can tell which row was chosen without a per-item closure. |
499
521
 
500
522
  ## Web Component
@@ -2,7 +2,7 @@
2
2
 
3
3
  `Panel` is a container that can maximize to the browser viewport without moving
4
4
  or remounting its children. It fills its parent's width and height and uses
5
- `overflow: scroll` by default.
5
+ `overflow: auto` to show scrollbars only when content overflows.
6
6
 
7
7
  Give the parent a defined height for Panel to fill vertically. With an
8
8
  auto-height parent, percentage height follows normal CSS sizing and the Panel
@@ -138,20 +138,19 @@ Anta buttons can send `panelmaximizerequest`, `panelrestorerequest`, or
138
138
  ## Styling
139
139
 
140
140
  Panel defaults to `display: block`, `width: 100%`, `height: 100%`,
141
- `box-sizing: border-box`, and `overflow: scroll`. Padding and borders stay inside
141
+ `box-sizing: border-box`, and `overflow: auto`. Padding and borders stay inside
142
142
  its assigned size. It does not set `flex-grow`.
143
143
 
144
144
  Override these through ordinary CSS. Use `height: auto` for content-driven
145
- height or `overflow: auto` for scrollbars only when content overflows.
146
- With `overflow: scroll`, scrollbar visibility and reserved space follow the
147
- browser and operating system's scrollbar settings.
145
+ height or `overflow: scroll` to request scrollbars even when content fits.
146
+ Scrollbar appearance follows the browser and operating system's settings.
148
147
 
149
148
  Set the background on Panel. Its maximized surface inherits that background,
150
149
  so inner content can keep its natural height. Style light-DOM children, such as
151
150
  [Box](./box.md) or [Capture](./capture.md), for content layout shared between both states.
152
151
  Use `:state(maximized)` for viewport styling and `::part(content)` for the
153
152
  maximized scrolling surface. In normal mode, the content slot uses `display: contents`.
154
- The maximized surface also uses `overflow: scroll`; override
153
+ The maximized surface also uses `overflow: auto`; override
155
154
  `::part(content)` to change its overflow separately from the normal Panel.
156
155
 
157
156
  Enter a note, then select **Maximize panel** and **Restore panel**. The input
@@ -28,12 +28,21 @@ is limited. `offset` sets the gap in pixels between the trigger and the menu:
28
28
  <SelectFaceted placement="top-end" offset={8} facets={FACETS} />
29
29
  ```
30
30
 
31
- Open **Metadata** in the first demo to choose key–value tags such as
31
+ Open **Recency** in the first demo, select **Custom range**, then pick **From**
32
+ and **To** from the fields side by side. Each field closes its own calendar after
33
+ a pick while the Recency editor stays open for the second date.
34
+
35
+ Open **Metadata** to choose key–value tags such as
32
36
  **env production** or **region us-east**. Its `renderOption` callback reads
33
37
  custom option fields and renders a `Tag` with `label` and `value`. Search
34
38
  for **production** to see the same tag in global results.
35
39
 
36
40
  ```tsx
41
+ const recencySummary = (v) =>
42
+ 'preset' in v
43
+ ? { today: 'Today', yesterday: 'Yesterday', last14: 'Last 14 days', last30: 'Last 30 days' }[v.preset]
44
+ : v.from && v.to ? `${v.from} → ${v.to}` : 'Custom range'
45
+
37
46
  const FACETS = [
38
47
  { key: 'assignee', label: 'Assignee', kind: 'multiple', filter: true, options: people },
39
48
  { key: 'owner', label: 'Owner', kind: 'single', filter: true, options: people },
@@ -56,6 +65,7 @@ const FACETS = [
56
65
  },
57
66
  { key: 'title', label: 'Title contains', kind: 'text' },
58
67
  { key: 'duration', label: 'Min duration', kind: 'custom', summary: (v) => `≥ ${v.min}s`, render: /* … */ },
68
+ { key: 'recency', label: 'Recency', kind: 'custom', summary: recencySummary, render: /* radio presets and two InputDate fields */ },
59
69
  ]
60
70
 
61
71
  const isSet = (v) => !(v == null || v === '' || (Array.isArray(v) && v.length === 0))
@@ -83,8 +93,7 @@ function Demo() {
83
93
 
84
94
  {active.length > 0 && (
85
95
  <div style={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap', gap: 8, alignItems: 'center' }}>
86
- {/* Show one editable control for each active facet. Its label becomes
87
- the control's `leading` prefix. */}
96
+ {/* Show an editable control or summary for each active facet. */}
88
97
  {active.map((facet) => {
89
98
  // Options facets → an editable Select (single shows the trailing check;
90
99
  // both are filterable + have a clearable footer).
@@ -106,7 +115,12 @@ function Demo() {
106
115
  />
107
116
  )
108
117
 
109
- // Free-form text / custom → an editable Input.
118
+ if (facet.key === 'recency') {
119
+ const recency = value.recency
120
+ return <Tag key={facet.key} label="Recency" value={recencySummary(recency)} />
121
+ }
122
+
123
+ // Free-form text / duration → an editable Input.
110
124
  const val = facet.kind === 'text' ? value[facet.key] : value[facet.key]?.min
111
125
  const write = (raw) =>
112
126
  setFacet(facet.key, facet.kind === 'text' ? raw || undefined : raw ? { min: raw } : undefined)
@@ -144,9 +158,9 @@ function Demo() {
144
158
  }
145
159
  ```
146
160
 
147
- The trigger opens the facet menu. The example renders one editable
148
- [Select](./select.md) below it for each active facet. Each Select receives the
149
- facet label through `leading`, which displays it as a prefix.
161
+ The trigger opens the facet menu. The example shows active values beside it.
162
+ Option facets use an editable [Select](./select.md) with the facet label in its
163
+ `leading` prefix. Recency uses a summary tag and is edited in the facet menu.
150
164
 
151
165
  ### Custom option content
152
166
 
@@ -300,7 +314,7 @@ A custom facet stores a `Date` directly. Unlike the value of a `single` or
300
314
  #### A recency filter: presets plus a range
301
315
 
302
316
  This editor combines a `RadioGroup` of presets with a **Custom range** option
303
- that reveals two `InputDate` fields. Its value is either `{ preset }` or
317
+ that reveals two `InputDate` fields side by side. Its value is either `{ preset }` or
304
318
  `{ from, to }`. The `resolveRange` helper converts either shape into the date
305
319
  range used to filter the result set. Each InputDate calendar opens above the
306
320
  facet menu without closing it.
@@ -332,7 +346,7 @@ const recency: SelectFacetCustom<Recency> = {
332
346
  const mode = value == null ? '' : 'preset' in value ? value.preset : 'custom'
333
347
  const range = value && 'from' in value ? value : { from: '', to: '' }
334
348
  return (
335
- <div style={{ display: 'grid', gap: 8 }}>
349
+ <div style={{ display: 'grid', gap: 8, minWidth: 360 }}>
336
350
  <RadioGroup
337
351
  size="small"
338
352
  options={PRESETS} // Today / Yesterday / Last 14 / Last 30 / Custom range
@@ -342,12 +356,12 @@ const recency: SelectFacetCustom<Recency> = {
342
356
  onStateChange={(_e, { next }) => onChange(next === 'custom' ? range : { preset: next })}
343
357
  />
344
358
  {mode === 'custom' && (
345
- <>
359
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, minmax(0, 1fr))', gap: 8 }}>
346
360
  <InputDate size="small" label="From" value={range.from}
347
361
  onValueChange={(from) => onChange({ from, to: range.to })} />
348
362
  <InputDate size="small" label="To" value={range.to} min={range.from || undefined}
349
363
  onValueChange={(to) => onChange({ from: range.from, to })} />
350
- </>
364
+ </div>
351
365
  )}
352
366
  </div>
353
367
  )
@@ -38,6 +38,24 @@ the title text.
38
38
  Use a span for a small inline accent. Don't nest `<Text>` or `<a-text>` inside a
39
39
  title: they are block containers, while heading content should remain inline.
40
40
 
41
+ ## Truncation
42
+
43
+ Pass `truncate` for a single-line ellipsis or a positive number to clamp to that
44
+ many lines. When the title is clipped, JSX `Title` shows its full text in a
45
+ tooltip. A nested `<Tooltip>` overrides that automatic tooltip.
46
+
47
+ ```tsx
48
+ <Title truncate style={{ maxWidth: '320px' }}>
49
+ A long workspace heading that stays on one line in a compact layout
50
+ </Title>
51
+ ```
52
+
53
+ Use a number for multi-line titles.
54
+
55
+ ```tsx
56
+ <Title truncate={2}>A long heading clamped after its second line</Title>
57
+ ```
58
+
41
59
  ## Level reference
42
60
 
43
61
  | level | font-size | line-height |
@@ -100,6 +118,7 @@ scale.
100
118
  | `level?` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 2 | Heading level, 1-6. Drives font-size, line-height, and vertical rhythm. Also surfaced to assistive tech via `aria-level` (h1 is typically reserved for the page title). |
101
119
  | `priority?` | 'primary' \| 'secondary' \| 'tertiary' \| 'quaternary' | primary | Visual priority. Maps to text-1..text-4 (`primary` = text-1). |
102
120
  | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a named tone applies the matching `--text-{N}-{tone}` palette. Any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is kept while lightness/chroma are pinned per priority in oklch. |
121
+ | `truncate?` | boolean \| number | — | Truncate with a trailing ellipsis. `true` (or `1`) clamps to a single line; any integer ≥ 2 clamps to that many lines; `0` or a negative value means no truncation. A clipped JSX `Title` shows its text content in a tooltip by default. Nest a `<Tooltip>` to provide your own tooltip instead. |
103
122
 
104
123
  ## Web Component
105
124
 
package/docs/credits.md CHANGED
@@ -6,6 +6,7 @@
6
6
  - Ksenia Toloknova — lead designer
7
7
  - Leonid Kniazev — contributing designer
8
8
  - Vehbi Karaagac — engineer
9
+ - Fernando Oliveros — engineer, leading the [Plot package](./packages/plot.md)
9
10
 
10
11
  ## Icons
11
12
 
@@ -16,3 +17,5 @@ Anta's icon set is built on the shoulders of several excellent open-source icon
16
17
  - Blueprint by Palantir — additional product-UI glyphs covering domains the previous two don't (Apache License 2.0).
17
18
 
18
19
  Full license texts and per-icon attribution are reproduced verbatim in the package's NOTICES.md.
20
+
21
+ The Antithesis theme uses Hugeicons. These icons are licensed only for use by Antithesis.