@antadesign/anta 0.3.19 → 0.3.21
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/README.md +1 -1
- package/dist/anta_helpers.d.ts +11 -2
- package/dist/anta_helpers.js +9 -0
- package/dist/components/Banner.d.ts +3 -3
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Calendar.d.ts +11 -12
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.d.ts +8 -9
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Expander.d.ts +5 -6
- package/dist/components/Input.d.ts +2 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/InputAutocomplete.d.ts +8 -8
- package/dist/components/InputAutocomplete.js +24 -18
- package/dist/components/InputTime.d.ts +3 -3
- package/dist/components/InputTime.js +1 -1
- package/dist/components/Menu.d.ts +2 -2
- package/dist/components/MenuItem.d.ts +1 -1
- package/dist/components/MenuItem.js +1 -1
- package/dist/components/Progress.d.ts +1 -1
- package/dist/components/RadioGroup.d.ts +14 -15
- package/dist/components/RadioGroup.js +5 -2
- package/dist/components/Select.d.ts +33 -40
- package/dist/components/Select.js +6 -2
- package/dist/components/SelectFaceted.d.ts +27 -33
- package/dist/components/SelectFaceted.js +5 -1
- package/dist/components/Slider.d.ts +5 -5
- package/dist/components/Switch.d.ts +4 -4
- package/dist/components/TabPanel.d.ts +1 -2
- package/dist/components/TabPanel.js +0 -1
- package/dist/components/Tabs.d.ts +9 -9
- package/dist/components/Tabs.js +5 -2
- package/dist/components/Text.d.ts +5 -3
- package/dist/components/Text.js +7 -3
- package/dist/components/Title.d.ts +1 -1
- package/dist/components/Toaster.d.ts +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +1 -0
- package/dist/elements/a-expander.js +12 -2
- package/dist/elements/a-menu.d.ts +1 -8
- package/dist/elements/a-menu.js +1 -40
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-text.d.ts +4 -0
- package/dist/elements/a-text.js +10 -3
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +8 -1
- package/dist/elements/a-tooltip.js +88 -15
- package/dist/elements/index.d.ts +1 -1
- package/dist/general_types.d.ts +33 -22
- package/dist/index.d.ts +3 -3
- package/dist/theme-anta.css +1 -1
- package/docs/accessibility.md +4 -4
- package/docs/changelog.md +40 -13
- package/docs/comparison.md +1 -1
- package/docs/components/banner.md +17 -17
- package/docs/components/button.md +6 -6
- package/docs/components/card.md +5 -6
- package/docs/components/checkbox.md +17 -18
- package/docs/components/dialog.md +2 -2
- package/docs/components/expander.md +27 -30
- package/docs/components/icon.md +1 -1
- package/docs/components/input-autocomplete.md +15 -16
- package/docs/components/input-date.md +54 -59
- package/docs/components/input-time.md +7 -7
- package/docs/components/input.md +14 -14
- package/docs/components/menu.md +72 -8
- package/docs/components/progress.md +2 -2
- package/docs/components/radio.md +28 -25
- package/docs/components/select-faceted.md +95 -100
- package/docs/components/select.md +113 -115
- package/docs/components/slider.md +15 -10
- package/docs/components/switch.md +13 -13
- package/docs/components/tabs.md +23 -23
- package/docs/components/tag.md +5 -5
- package/docs/components/text.md +31 -7
- package/docs/components/title.md +1 -1
- package/docs/components/toaster.md +4 -4
- package/docs/components/tooltip.md +2 -2
- package/docs/credits.md +0 -4
- package/docs/index.md +1 -1
- package/docs/install-config.md +12 -7
- package/docs/normalization.md +6 -9
- package/docs/overview.md +1 -1
- package/docs/packages/stickers.md +1 -1
- package/docs/theming.md +15 -0
- package/package.json +3 -8
package/docs/components/tabs.md
CHANGED
|
@@ -23,9 +23,9 @@ selectable strip that emits the chosen value; add matching `<TabPanel>` children
|
|
|
23
23
|
## Tones
|
|
24
24
|
|
|
25
25
|
Six named tones: `neutral` (default), `brand`, `info`, `success`, `warning`,
|
|
26
|
-
`critical`. Any CSS
|
|
26
|
+
`critical`. Any CSS color works for a one-off custom tone. The tone runs through the
|
|
27
27
|
strip's labels, indicator, and track at every priority. Rows are tones (the last is a
|
|
28
|
-
custom
|
|
28
|
+
custom color); columns are priorities.
|
|
29
29
|
|
|
30
30
|
**Primary**
|
|
31
31
|
|
|
@@ -35,14 +35,14 @@ custom colour); columns are priorities.
|
|
|
35
35
|
|
|
36
36
|
```tsx
|
|
37
37
|
<Tabs tone="brand" priority="secondary" defaultValue="a">…</Tabs>
|
|
38
|
-
<Tabs tone="#e0457b" priority="tertiary" defaultValue="a">…</Tabs> {/* any CSS
|
|
38
|
+
<Tabs tone="#e0457b" priority="tertiary" defaultValue="a">…</Tabs> {/* any CSS color */}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
**Per-tab tone.** A `tone` on an individual option overrides the strip's tone for that one
|
|
42
|
-
tab: it
|
|
43
|
-
A named tone
|
|
42
|
+
tab: it colors the label and icons in every mode, and the indicator when it's the active tab.
|
|
43
|
+
A named tone colors the sliding indicator too; a custom literal color tones the label
|
|
44
44
|
everywhere but the indicator only under `noslide` (the single shared sliding element can't
|
|
45
|
-
read a descendant's
|
|
45
|
+
read a descendant's color).
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
48
|
<Tabs
|
|
@@ -93,7 +93,7 @@ and panels are siblings; see [Panels](#panels)). Vertical works at every priorit
|
|
|
93
93
|
/>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
## Icons
|
|
96
|
+
## Icons and content
|
|
97
97
|
|
|
98
98
|
A tab option takes a leading **`icon`** and a trailing **`iconTrailing`**; here the
|
|
99
99
|
trailing dot flags an unsaved file. For more than text, give the option **`children`**
|
|
@@ -137,7 +137,7 @@ tabs above to see it.
|
|
|
137
137
|
|
|
138
138
|
```tsx
|
|
139
139
|
{/* The strip and panels are flat siblings — you arrange them. A flex column gaps
|
|
140
|
-
them; the strip
|
|
140
|
+
them; the strip centers itself (a <Tabs> `style` lands on <a-tabs>). */}
|
|
141
141
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
142
142
|
<Tabs
|
|
143
143
|
defaultValue="account"
|
|
@@ -160,7 +160,7 @@ Add a `<TabPanel value="…">` child for each option; each panel shows itself wh
|
|
|
160
160
|
its value is active. The panel names its tab as its accessible label
|
|
161
161
|
(`aria-labelledby`, off-DOM). Panel content is arbitrary React, so it renders normally.
|
|
162
162
|
|
|
163
|
-
Panels are **optional**.
|
|
163
|
+
Panels are **optional**. Without panels, `Tabs` renders the strip. Listen to
|
|
164
164
|
`onStateChange` / `onValueChange` and render the content yourself.
|
|
165
165
|
|
|
166
166
|
The strip renders from the `options` array; each `<TabPanel>` renders a
|
|
@@ -228,12 +228,12 @@ content wherever you like, switching on the value yourself.
|
|
|
228
228
|
|
|
229
229
|
## Controlled vs. uncontrolled
|
|
230
230
|
|
|
231
|
-
The active tab is
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
The active tab is identified by one option's **value string**. Tabs marks the
|
|
232
|
+
matching tab selected and shows the corresponding `<TabPanel value="…">`, when
|
|
233
|
+
one exists. Choose either uncontrolled or controlled state:
|
|
234
234
|
|
|
235
|
-
**Uncontrolled.** Pass `defaultValue` (an option's `value`)
|
|
236
|
-
active tab
|
|
235
|
+
**Uncontrolled.** Pass `defaultValue` (an option's `value`). Tabs then updates
|
|
236
|
+
the active tab after interaction:
|
|
237
237
|
|
|
238
238
|
```tsx
|
|
239
239
|
<Tabs
|
|
@@ -245,9 +245,9 @@ active tab from there:
|
|
|
245
245
|
/>
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
**Controlled.** Pass `value` (an option's `value`)
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
**Controlled.** Pass `value` (an option's `value`) and `onStateChange`.
|
|
249
|
+
`onStateChange` fires before the change applies. Set `value` to the new tab to
|
|
250
|
+
accept it, or leave it unchanged to reject it.
|
|
251
251
|
|
|
252
252
|
```tsx
|
|
253
253
|
const [tab, setTab] = useState('overview')
|
|
@@ -347,7 +347,7 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
347
347
|
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Visual priority. `primary` is the raised pill on a recessed track (the
|
|
348
348
|
segmented-control look); `secondary` keeps that sizing but drops the track, marking
|
|
349
349
|
the selected tab with a subtle active background fill; `tertiary` is a bottom-underline
|
|
350
|
-
indicator under the selected tab (no track, no rest line). `tone`
|
|
350
|
+
indicator under the selected tab (no track, no rest line). `tone` colors `secondary` +
|
|
351
351
|
`tertiary`; `primary` stays neutral. |
|
|
352
352
|
| `round?` | boolean \| number \| string | — | Fully-round the tabs and the sliding indicator (and the primary track
|
|
353
353
|
well). Applies strip-wide; a single tab's `round` rounds just that tab. A
|
|
@@ -363,7 +363,7 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
363
363
|
*requests* a change via `onStateChange` — apply it by updating this prop.
|
|
364
364
|
Leave undefined (and use `defaultValue`) for uncontrolled. |
|
|
365
365
|
|
|
366
|
-
Use
|
|
366
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
367
367
|
|
|
368
368
|
Keep the tab strip and panels as siblings under one parent. Panels read the active
|
|
369
369
|
value from `<a-tabs>`.
|
|
@@ -387,7 +387,7 @@ tab (its text wrapped in `<a-tab-label>`), `<a-tabpanel>` a panel, and the movin
|
|
|
387
387
|
indicator is `<a-tabs>`'s `::before`. Target them with ordinary CSS (an un-layered rule
|
|
388
388
|
beats `@layer anta` without `!important`) and reach for real properties
|
|
389
389
|
(`border-radius`, `padding`, `background`, …), **not** the internal `--*` output tokens.
|
|
390
|
-
The demo classes
|
|
390
|
+
The demo classes (`.square-tabs`, `.glow-tabs`, …) are hooks. Replace them with selectors you own.
|
|
391
391
|
|
|
392
392
|
**Roomier track.** The strip hugs its tabs by default (0 padding), so it's exactly a
|
|
393
393
|
same-size button tall. For a gap around the selected pill (the classic "well" look), add
|
|
@@ -409,7 +409,7 @@ a-tabs.square-tabs { border-radius: 0; padding: 4px; box-shadow: none; }
|
|
|
409
409
|
a-tabs.square-tabs::before { border-radius: 0; box-shadow: 0 0 0 1px light-dark(#cfcfd6, #46464e); } /* 1px square pill ring */
|
|
410
410
|
```
|
|
411
411
|
|
|
412
|
-
**Tertiary glowing underline.**
|
|
412
|
+
**Tertiary glowing underline.** Recolor the sliding underline and add a radial highlight
|
|
413
413
|
rising from it. The slider is a full-cover box whose `border-bottom` is the line, so a
|
|
414
414
|
`background` gradient on it fills the tab behind the label. Because it's one element, the
|
|
415
415
|
glow **slides with the line** between tabs, with no `noslide` and no separate per-tab
|
|
@@ -417,11 +417,11 @@ background.
|
|
|
417
417
|
|
|
418
418
|
```css
|
|
419
419
|
/* The class is on the <a-tabs> element itself, so target a-tabs.glow-tabs (not a descendant).
|
|
420
|
-
The tertiary slider is a full-cover box with a border-bottom line —
|
|
420
|
+
The tertiary slider is a full-cover box with a border-bottom line — recolor the border and
|
|
421
421
|
fill it with a gradient; both slide together. Where CSS anchor positioning isn't supported
|
|
422
422
|
there's no slider — tertiary falls back to the per-tab ::after underline (a plain line). */
|
|
423
423
|
a-tabs.glow-tabs::before {
|
|
424
|
-
border-bottom-color: light-dark(#8067ff, #907aff); /*
|
|
424
|
+
border-bottom-color: light-dark(#8067ff, #907aff); /* recolor the sliding line */
|
|
425
425
|
background: /* highlight rising from the line, slides with it */
|
|
426
426
|
radial-gradient(80% 100% at 50% 100%,
|
|
427
427
|
color-mix(in oklch, light-dark(#8067ff, #907aff) 30%, transparent), transparent 70%);
|
package/docs/components/tag.md
CHANGED
|
@@ -62,7 +62,7 @@ clipped.
|
|
|
62
62
|
<Tag allcaps tone="info" size="large" label="Large" />
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
## Icon, label
|
|
65
|
+
## Icon, label, and value
|
|
66
66
|
|
|
67
67
|
Set `icon` / `iconTrailing` for a leading or trailing glyph (scaled to
|
|
68
68
|
the pill), and pair `label` with `value` for a two-part tag. `value` is
|
|
@@ -145,7 +145,7 @@ down 1px, since caps read larger than mixed case at the same size.
|
|
|
145
145
|
Rendered in the default color and weight, with no divider from the
|
|
146
146
|
label; the color + weight contrast does the separating. |
|
|
147
147
|
|
|
148
|
-
Use
|
|
148
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
149
149
|
|
|
150
150
|
Use `a-tag-label` for the key and `a-tag-value` for its value.
|
|
151
151
|
|
|
@@ -157,7 +157,7 @@ Use `a-tag-label` for the key and `a-tag-value` for its value.
|
|
|
157
157
|
</a-tag>
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
Reach for the props first: **`tone`** sets the
|
|
160
|
+
Reach for the props first: **`tone`** sets the color (any CSS color for a custom
|
|
161
161
|
tone — it derives the fill / border / text in oklch), **`priority`** the fill style,
|
|
162
162
|
**`size`** the dimensions.
|
|
163
163
|
|
|
@@ -167,7 +167,7 @@ tone — it derives the fill / border / text in oklch), **`priority`** the fill
|
|
|
167
167
|
|
|
168
168
|
`<a-tag>` is light-DOM, so for anything a tone can't give you it's plain CSS (an
|
|
169
169
|
un-layered rule beats `@layer anta` without `!important`). The `.badge` class below
|
|
170
|
-
takes a **gradient** background (impossible from `tone`, which is a solid
|
|
170
|
+
takes a **gradient** background (impossible from `tone`, which is a solid color),
|
|
171
171
|
**1px** corners, and taller vertical padding so it reads completely differently:
|
|
172
172
|
|
|
173
173
|
```css
|
|
@@ -181,5 +181,5 @@ a-tag.badge {
|
|
|
181
181
|
a-tag.badge a-tag-label { font-weight: 600; letter-spacing: 0.15ch; }
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
For a *solid*
|
|
184
|
+
For a *solid* recolor, prefer `tone` / `priority` — don't reach for the resolved
|
|
185
185
|
`--tag-bg` / `--tag-border` / `--tag-text` (they're recomputed per priority and tone).
|
package/docs/components/text.md
CHANGED
|
@@ -36,7 +36,7 @@ underline to full alpha.
|
|
|
36
36
|
|
|
37
37
|
## Demo
|
|
38
38
|
|
|
39
|
-
## Truncation
|
|
39
|
+
## Truncation and expansion
|
|
40
40
|
|
|
41
41
|
`truncate` takes `true` (or `1`) for a single-line ellipsis, any integer
|
|
42
42
|
≥ 2 for multi-line clamping, and `0` or a negative value for no
|
|
@@ -45,6 +45,11 @@ truncation. Both modes use `-webkit-line-clamp` inside
|
|
|
45
45
|
prefix (Firefox 68+, Chrome, Safari, Edge). The host gets `min-width: 0`
|
|
46
46
|
so truncation works inside flex and grid containers.
|
|
47
47
|
|
|
48
|
+
JSX `Text` adds a `truncatedOnly` tooltip containing its text content. It
|
|
49
|
+
opens only when the text clips. Nest a `<Tooltip>` to replace that tooltip;
|
|
50
|
+
an empty nested tooltip suppresses it. `expandable` text has no automatic
|
|
51
|
+
tooltip because its own control reveals the content.
|
|
52
|
+
|
|
48
53
|
```tsx
|
|
49
54
|
{/* Single line */}
|
|
50
55
|
<Text truncate>{longSentence}</Text>
|
|
@@ -54,6 +59,23 @@ so truncation works inside flex and grid containers.
|
|
|
54
59
|
<Text truncate={3}>{longSentence}</Text>
|
|
55
60
|
```
|
|
56
61
|
|
|
62
|
+
### Use a tooltip with the web component
|
|
63
|
+
|
|
64
|
+
`<a-text>` does not add a tooltip. Nest `<a-tooltip truncated-only>` and pass
|
|
65
|
+
the full text as its content:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<a-text truncate="1" style="max-width: 260px; cursor: help">
|
|
69
|
+
A long status message that is clipped until you hover it.
|
|
70
|
+
<a-tooltip truncated-only>
|
|
71
|
+
A long status message that is clipped until you hover it.
|
|
72
|
+
</a-tooltip>
|
|
73
|
+
</a-text>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`a-text.isTruncated` is a read-only layout measurement. Read it on the UI
|
|
77
|
+
thread when you compose custom truncation behavior.
|
|
78
|
+
|
|
57
79
|
Pair `expandable` with `truncate` to let the reader reveal the full text.
|
|
58
80
|
The fade and chevron appear only when the clamped content overflows; text
|
|
59
81
|
that fits gets neither. Single-line truncation fades on the right edge,
|
|
@@ -98,11 +120,13 @@ more" and "Show less". `collapsible` takes effect only with `expandable`.
|
|
|
98
120
|
kept while lightness/chroma are pinned per priority in oklch. |
|
|
99
121
|
| `truncate?` | boolean \| number | — | Truncate with a trailing ellipsis. `true` (or `1`) clamps to a
|
|
100
122
|
single line; any integer ≥ 2 clamps to that many lines; `0` or a
|
|
101
|
-
negative value means no truncation.
|
|
102
|
-
|
|
103
|
-
|
|
123
|
+
negative value means no truncation. A clipped, non-expandable JSX
|
|
124
|
+
`Text` shows its text content in a tooltip by default. Nest a
|
|
125
|
+
`<Tooltip>` to provide your own tooltip instead. Uses the
|
|
126
|
+
`-webkit-line-clamp` technique, supported in all major browsers
|
|
127
|
+
(Firefox 68+, Chrome, Safari, Edge). |
|
|
104
128
|
|
|
105
|
-
Use
|
|
129
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
106
130
|
|
|
107
131
|
Use `<a-text>` directly for a block that carries the text priority and tone.
|
|
108
132
|
|
|
@@ -112,10 +136,10 @@ Use `<a-text>` directly for a block that carries the text priority and tone.
|
|
|
112
136
|
</a-text>
|
|
113
137
|
```
|
|
114
138
|
|
|
115
|
-
|
|
139
|
+
Color comes from **`priority`** (the neutral text level) and **`tone`** (the tint);
|
|
116
140
|
`size` and the type props set the rest. For a named tone, `Text` consumes the
|
|
117
141
|
global **text role tokens** (`--text-1` … `--text-5`, the `-{tone}` tints,
|
|
118
|
-
`--link-color`), so retuning those once on `:root` / `.dark` shifts text
|
|
142
|
+
`--link-color`), so retuning those once on `:root` / `.dark` shifts text color
|
|
119
143
|
everywhere (see [Colors](../colors.md)). A custom `tone` (any CSS color) is derived in
|
|
120
144
|
oklch from **`--text-tone-source`** — the same one-off knob as `Button` / `Tag`.
|
|
121
145
|
|
package/docs/components/title.md
CHANGED
|
@@ -106,7 +106,7 @@ scale.
|
|
|
106
106
|
color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is
|
|
107
107
|
kept while lightness/chroma are pinned per priority in oklch. |
|
|
108
108
|
|
|
109
|
-
Use
|
|
109
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
110
110
|
|
|
111
111
|
Set the heading role and level when writing `<a-title>` directly.
|
|
112
112
|
|
|
@@ -100,7 +100,7 @@ depending on what you toast:
|
|
|
100
100
|
- **A string** auto-wraps in a `Banner`, so its ✕ is there for free.
|
|
101
101
|
- **Any control carrying `data-toast-dismiss`** dismisses the toast on click. This is
|
|
102
102
|
the simplest path — no handler, no `id`, no `onDismiss`; the render function doesn't
|
|
103
|
-
even take an argument.
|
|
103
|
+
even take an argument. Add the attribute to a button, link, or menu item inside
|
|
104
104
|
the content (the same convention as `<a-banner>`'s `data-banner-dismiss` and
|
|
105
105
|
`<a-dialog>`'s `data-dialog-close`):
|
|
106
106
|
|
|
@@ -178,8 +178,8 @@ whole toast — the Banner, its ✕, everything — many times a second, which c
|
|
|
178
178
|
focus, text selection, or an in-progress animation inside the content. `--toast-remaining`
|
|
179
179
|
updates a single inherited value the browser interpolates on the compositor: the
|
|
180
180
|
content renders **once**, nothing reconciles, and it's smooth at display refresh rate
|
|
181
|
-
instead of
|
|
182
|
-
exposing the value keeps one source of truth.
|
|
181
|
+
instead of the application's tick interval. The toast already tracks its timer
|
|
182
|
+
and pause state, so exposing the value keeps one source of truth.
|
|
183
183
|
|
|
184
184
|
`--toast-remaining` is display only — the real dismissal is the toast's own timer — so
|
|
185
185
|
where a browser can't animate a custom property it simply stays full. A **sticky**
|
|
@@ -230,7 +230,7 @@ Toaster.manager.add(() => <Banner tone="critical" message="Connection lost" />,
|
|
|
230
230
|
| `toaster?` | Toaster | — | The store this region renders. Omit to bind the default store driven by
|
|
231
231
|
`Toaster.manager`; pass a `createToaster()` for an isolated region. |
|
|
232
232
|
|
|
233
|
-
Use
|
|
233
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
234
234
|
|
|
235
235
|
Place each `<a-toast>` in a positional slot. This button clones the toast template
|
|
236
236
|
into the toaster. `data-toast-dismiss` requests removal; listen for `dismiss` and
|
|
@@ -127,7 +127,7 @@ shows.
|
|
|
127
127
|
~`50` for a near-instant tooltip (0 has caused issues in practice). |
|
|
128
128
|
| `follow?` | boolean | — | Follow the cursor instead of pinning under the anchor. The bubble is
|
|
129
129
|
pinned (anchored beneath the target) by default; pass `follow` for the
|
|
130
|
-
cursor-tracking
|
|
130
|
+
cursor-tracking behavior, which fades by distance as the cursor leaves. |
|
|
131
131
|
| `interactive?` | boolean | — | Make the bubble hoverable and clickable — enables pointer events and
|
|
132
132
|
keeps it open while the cursor is over it, so its content (links,
|
|
133
133
|
buttons) can be interacted with. Always pinned (an interactive bubble
|
|
@@ -144,7 +144,7 @@ shows.
|
|
|
144
144
|
| `truncatedSelector?` | string | — | CSS selector (resolved within the anchor) for the element whose overflow
|
|
145
145
|
decides whether a `truncatedOnly` tooltip shows. |
|
|
146
146
|
|
|
147
|
-
Use
|
|
147
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
148
148
|
|
|
149
149
|
Place `<a-tooltip>` inside the element it describes.
|
|
150
150
|
|
package/docs/credits.md
CHANGED
package/docs/index.md
CHANGED
|
@@ -6,7 +6,7 @@ Anta is designed for a clean DOM. Prefer the props and attributes exposed by eac
|
|
|
6
6
|
|
|
7
7
|
- [Overview](./overview.md)
|
|
8
8
|
- [Comparison](./comparison.md)
|
|
9
|
-
- [Install
|
|
9
|
+
- [Install and configure](./install-config.md)
|
|
10
10
|
- [Normalization](./normalization.md)
|
|
11
11
|
- [Colors](./colors.md)
|
|
12
12
|
- [Theming](./theming.md)
|
package/docs/install-config.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Install
|
|
1
|
+
# Install and configure
|
|
2
2
|
|
|
3
3
|
## Installation
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ of a floating tag such as `"latest"`.
|
|
|
15
15
|
import '@antadesign/anta/tokens.css' // CSS custom properties
|
|
16
16
|
import '@antadesign/anta/reset.css' // reset and typography defaults
|
|
17
17
|
import '@antadesign/anta/elements' // registers <a-*> elements
|
|
18
|
+
import '@antadesign/anta/theme-anta.css' // optional hand-tuned reference palette
|
|
18
19
|
import { Progress } from '@antadesign/anta'
|
|
19
20
|
|
|
20
21
|
<Progress value={42} label="Uploaded" hint="3 of 7" />
|
|
@@ -36,6 +37,10 @@ recommended; the reference theme is optional.
|
|
|
36
37
|
Load `tokens.css` before element CSS. Elements read its variables; without it,
|
|
37
38
|
they render unstyled.
|
|
38
39
|
|
|
40
|
+
To use the optional reference palette, import `theme-anta.css` after the element
|
|
41
|
+
registration import. It ships in `@antadesign/anta`; omit it to keep the
|
|
42
|
+
seed-derived default palette or provide your own theme.
|
|
43
|
+
|
|
39
44
|
### Cascade layers
|
|
40
45
|
|
|
41
46
|
Anta's reset and element CSS live in `@layer anta`. `tokens.css` declares
|
|
@@ -108,8 +113,8 @@ Choose the entry point for your runtime:
|
|
|
108
113
|
- **Astro or Next.js:** a client-only script. In Astro, use
|
|
109
114
|
`<script>import '@antadesign/anta/elements'</script>`; in Next.js, import it
|
|
110
115
|
from a `'use client'` file.
|
|
111
|
-
- **Worker-rendered UI:** the UI
|
|
112
|
-
has no `HTMLElement`.
|
|
116
|
+
- **Worker-rendered UI:** code that runs on the UI thread and initializes the
|
|
117
|
+
DOM. A Worker has no `HTMLElement`.
|
|
113
118
|
|
|
114
119
|
## Framework setup
|
|
115
120
|
|
|
@@ -203,18 +208,18 @@ Add the `dark` class to any ancestor element:
|
|
|
203
208
|
|
|
204
209
|
Anta is designed for a customized TT Interphases Pro, but ships no font binaries. Components use `--sans-serif` and `--monospace` with system fallbacks. `tokens.css` sets a 15px root size (`1rem = 15px`).
|
|
205
210
|
|
|
206
|
-
To use
|
|
211
|
+
To use your own fonts, register `@font-face` declarations and override the variables:
|
|
207
212
|
|
|
208
213
|
```css
|
|
209
214
|
@font-face {
|
|
210
|
-
font-family: "
|
|
215
|
+
font-family: "App Sans";
|
|
211
216
|
src: url("/path/to/your/sans.woff2") format("woff2");
|
|
212
217
|
/* ... */
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
:root {
|
|
216
|
-
--sans-serif: "
|
|
217
|
-
--monospace:
|
|
221
|
+
--sans-serif: "App Sans", sans-serif;
|
|
222
|
+
--monospace: ui-monospace, monospace;
|
|
218
223
|
}
|
|
219
224
|
```
|
|
220
225
|
|
package/docs/normalization.md
CHANGED
|
@@ -5,8 +5,8 @@ HTML (`<h2>`, `<ul>`, `<a>`, `<table>`…) renders in the same visual language a
|
|
|
5
5
|
components — no per-page restyling to make prose match a `<Title>` or a `<Table>`.
|
|
6
6
|
|
|
7
7
|
It's a **separate import**, and every rule lives in a single cascade layer
|
|
8
|
-
(`@layer anta`), so it
|
|
9
|
-
|
|
8
|
+
(`@layer anta`), so it is easy to override individual rules or use a different
|
|
9
|
+
reset. Omit this import when another reset provides the baseline.
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
import '@antadesign/anta/tokens.css' // design tokens
|
|
@@ -37,7 +37,7 @@ This is **not** a neutral normalize — these defaults make raw markup match the
|
|
|
37
37
|
- **Lists** (`ul` / `ol`): `3ch` left padding so markers hug the text; a small bottom margin between items; markers toned to `--text-5`.
|
|
38
38
|
- `menu` is stripped to a clean semantic container (no disc markers / default padding).
|
|
39
39
|
- **Links** get `--link-color` with a hairline underline (75% alpha, `0.5px`); hover only thickens it to `1px` (no color repaint). Anchor-buttons (`<a role="button">`) are excluded so they keep button styling.
|
|
40
|
-
- `::selection` → the focus-ring
|
|
40
|
+
- `::selection` → the focus-ring color, tuned per theme (20% alpha in light, 30% in dark).
|
|
41
41
|
- **Tables**: `border-collapse`, `tabular-nums`, and a polite cell baseline; opt into a framed look with `<table data-bordered>` (outer frame + column dividers + rounded corners).
|
|
42
42
|
|
|
43
43
|
Everything above is defined in `src/reset.css`, inside `@layer anta` — read that file
|
|
@@ -77,10 +77,9 @@ Write the rule unlayered (or in a layer after `anta`) — targeting a **specific
|
|
|
77
77
|
h2 { letter-spacing: -0.01em; }
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
###
|
|
80
|
+
### Use a different reset
|
|
81
81
|
|
|
82
|
-
Because `reset.css` is a separate import,
|
|
83
|
-
own reset govern typography — keep the tokens and elements:
|
|
82
|
+
Because `reset.css` is a separate import, omit it when your own reset governs typography. Keep the tokens and elements:
|
|
84
83
|
|
|
85
84
|
```js
|
|
86
85
|
import '@antadesign/anta/tokens.css' // keep — tokens
|
|
@@ -90,9 +89,7 @@ import '@antadesign/anta/elements' // keep — components
|
|
|
90
89
|
|
|
91
90
|
**One dependency to keep:** Anta's elements don't set their own `box-sizing` — they
|
|
92
91
|
assume the global `* { box-sizing: border-box }` that this reset provides. Every common
|
|
93
|
-
reset (normalize.css, Tailwind's preflight,
|
|
94
|
-
normally seamless; but if yours doesn't, keep that one rule or component padding,
|
|
95
|
-
`max-width`, and icon-button sizing will be slightly off.
|
|
92
|
+
reset (normalize.css, Tailwind's preflight, and others) sets it too. If yours does not, keep that rule or component padding, `max-width`, and icon-button sizing will be slightly off.
|
|
96
93
|
|
|
97
94
|
Or import both and override only the pieces you want (unlayered, or in a later layer).
|
|
98
95
|
|
package/docs/overview.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
|
-
Anta is
|
|
3
|
+
Anta is an opinionated design system. It combines global CSS tokens,
|
|
4
4
|
framework-agnostic declarative web components, and JSX wrappers for dynamic
|
|
5
5
|
state and conditional composition.
|
|
6
6
|
|
|
@@ -45,7 +45,7 @@ Same as the static base, plus:
|
|
|
45
45
|
| `playOnce?` | `boolean` | Plays once and holds the final frame instead of looping. |
|
|
46
46
|
| `replayOnClick?` | `boolean` | With `playOnce`, lets people click or press Enter/Space to replay the animation. The sticker becomes a labeled button. |
|
|
47
47
|
|
|
48
|
-
Use
|
|
48
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
49
49
|
|
|
50
50
|
Pass the generated SVG payload to `<a-sticker>` and set a size through
|
|
51
51
|
`--sticker-size`. The animated element takes its generated Lottie JSON through
|
package/docs/theming.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Theming
|
|
2
2
|
|
|
3
|
+
## Reference palette
|
|
4
|
+
|
|
5
|
+
`@antadesign/anta` ships an optional hand-tuned reference palette at
|
|
6
|
+
`@antadesign/anta/theme-anta.css`. Import it after the tokens, reset, and element
|
|
7
|
+
registration imports to replace the seed-derived default:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import '@antadesign/anta/tokens.css'
|
|
11
|
+
import '@antadesign/anta/reset.css'
|
|
12
|
+
import '@antadesign/anta/elements'
|
|
13
|
+
import '@antadesign/anta/theme-anta.css'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Omit the final import to use the default palette, or define your own theme.
|
|
17
|
+
|
|
3
18
|
Anta's palette is generative. Every color in the system derives from six tone seeds (`--anta-seed-neutral`, `--anta-seed-brand`, `--anta-seed-info`, …), and a seed contributes only its hue: the lightness and chroma of every background, text, border, and component state come from Anta's formulas, tuned per role and per theme. Reskinning a tone is one custom property, and the whole scale re-derives in both light and dark:
|
|
4
19
|
|
|
5
20
|
```css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"docs",
|
|
10
10
|
"NOTICES.md"
|
|
11
11
|
],
|
|
12
|
-
"packageManager": "pnpm@
|
|
12
|
+
"packageManager": "pnpm@10.11.1",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"stop": "node scripts/dev-stop.mjs",
|
|
58
58
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
59
59
|
"lint": "node scripts/lint-getters.mjs",
|
|
60
|
+
"verify": "pnpm run lint && pnpm run typecheck && pnpm --filter anta-site run docs:api",
|
|
60
61
|
"icons": "node scripts/generate-icons.mjs --input src/elements/icons --output src/elements --name a-icon.shapes --internal",
|
|
61
62
|
"clean": "rm -rf dist",
|
|
62
63
|
"prepare": "pnpm run build",
|
|
@@ -76,11 +77,5 @@
|
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"react": "^18.0.0 || ^19.0.0"
|
|
79
|
-
},
|
|
80
|
-
"pnpm": {
|
|
81
|
-
"onlyBuiltDependencies": [
|
|
82
|
-
"esbuild",
|
|
83
|
-
"sharp"
|
|
84
|
-
]
|
|
85
80
|
}
|
|
86
81
|
}
|