@antadesign/anta 0.3.30 → 0.3.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anta_helpers.d.ts +4 -0
- package/dist/anta_helpers.js +10 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +39 -30
- package/dist/components/InputDate.js +2 -0
- package/dist/components/MenuItem.d.ts +9 -7
- package/dist/components/MenuItem.js +21 -2
- package/dist/components/Text.js +2 -3
- package/dist/components/Title.d.ts +8 -2
- package/dist/components/Title.js +17 -6
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +5 -2
- package/dist/elements/a-calendar.js +3 -1
- package/dist/elements/a-copy.js +23 -3
- package/dist/elements/a-input-time.js +2 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.js +3 -0
- package/dist/elements/a-panel.css +1 -1
- package/dist/elements/a-panel.js +1 -1
- package/dist/elements/a-radio-group.js +2 -2
- package/dist/elements/a-slider.js +2 -2
- package/dist/elements/a-tabs.js +2 -2
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-tooltip.js +1 -1
- package/dist/general_types.d.ts +4 -0
- package/dist/theme-antune.css +1 -1
- package/docs/changelog.md +30 -0
- package/docs/comparison.md +1 -1
- package/docs/components/button.md +127 -381
- package/docs/components/menu.md +37 -15
- package/docs/components/panel.md +5 -6
- package/docs/components/title.md +19 -0
- package/docs/credits.md +3 -0
- package/package.json +2 -2
package/docs/components/menu.md
CHANGED
|
@@ -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
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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
|
package/docs/components/panel.md
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
146
|
-
|
|
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:
|
|
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
|
package/docs/components/title.md
CHANGED
|
@@ -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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"build:docs": "pnpm --filter anta-site run docs:api && pnpm --filter anta-site run docs:pages && node scripts/generate-package-docs.mjs",
|
|
62
62
|
"audit:contrast": "node scripts/audit-contrast.mjs",
|
|
63
63
|
"dev": "node scripts/dev.mjs",
|
|
64
|
-
"dev:run": "echo $$ > \"$ANTA_DEV_PID_FILE\"; trap 'rm -f \"$ANTA_DEV_PID_FILE\"' EXIT; pnpm run build:dev && pnpm --filter @antadesign/stickers run build:dev && pnpm --filter @antadesign/plot run build:dev &&
|
|
64
|
+
"dev:run": "echo $$ > \"$ANTA_DEV_PID_FILE\"; trap 'rm -f \"$ANTA_DEV_PID_FILE\"' EXIT; pnpm run build:dev && pnpm --filter @antadesign/stickers run build:dev && pnpm --filter @antadesign/plot run build:dev && (node scripts/dev-watch.mjs & pnpm --filter anta-site run dev:server & pnpm --filter anta-site run dev:search & wait)",
|
|
65
65
|
"stop": "node scripts/dev-stop.mjs",
|
|
66
66
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
67
67
|
"test": "node --test tests/*.test.mjs",
|