@antadesign/anta 0.3.24 → 0.3.26
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.js +3 -3
- package/dist/box-types.d.ts +161 -0
- package/dist/box-types.js +0 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +26 -25
- package/dist/components/Banner.d.ts +10 -10
- package/dist/components/Banner.js +3 -1
- package/dist/components/Box.d.ts +37 -0
- package/dist/components/Box.js +63 -0
- package/dist/components/Breadcrumbs.css +1 -1
- package/dist/components/ButtonCopy.d.ts +2 -2
- package/dist/components/InputDate.css +1 -1
- package/dist/components/MenuItem.d.ts +5 -1
- package/dist/components/MenuItem.js +72 -2
- package/dist/components/MenuItemCopy.d.ts +2 -2
- package/dist/components/Steps.css +1 -1
- package/dist/components/copy-props.d.ts +3 -4
- package/dist/components/select-parts.css +1 -1
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-banner.js +16 -4
- package/dist/elements/a-box.css +1 -0
- package/dist/elements/a-box.d.ts +41 -0
- package/dist/elements/a-box.js +576 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-calendar.js +2 -2
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-copy.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +2 -2
- package/dist/elements/a-icon.css +1 -1
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +3 -3
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +14 -6
- package/dist/elements/a-loader.css +1 -1
- package/dist/elements/a-menu-group.css +1 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.js +3 -3
- package/dist/elements/a-menu-separator.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +4 -4
- package/dist/elements/a-menu.js +8 -6
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio-group.css +1 -1
- package/dist/elements/a-radio-group.js +3 -3
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-switch.js +2 -2
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabpanel.css +1 -1
- package/dist/elements/a-tabpanel.js +2 -2
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.js +6 -6
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-toast.css +1 -1
- package/dist/elements/a-toast.js +2 -2
- package/dist/elements/a-toaster.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +4 -3
- package/dist/elements/a-tooltip.js +9 -5
- package/dist/elements/copy-behavior.d.ts +13 -15
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +42 -4
- package/dist/generate-icons.mjs +3 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/reset.css +1 -1
- package/dist/theme-anta.css +1 -1
- package/dist/tokens.css +1 -1
- package/docs/changelog.md +42 -1
- package/docs/components/avatar.md +368 -0
- package/docs/components/banner.md +26 -15
- package/docs/components/box.md +282 -0
- package/docs/components/breadcrumbs.md +2 -2
- package/docs/components/button.md +26 -15
- package/docs/components/input.md +5 -0
- package/docs/components/menu.md +14 -11
- package/docs/components/tag.md +47 -0
- package/docs/index.md +4 -3
- package/docs/install-config.md +58 -13
- package/docs/normalization.md +37 -28
- package/docs/theming.md +4 -1
- package/package.json +2 -2
package/docs/install-config.md
CHANGED
|
@@ -44,7 +44,7 @@ recommended; the reference theme is optional.
|
|
|
44
44
|
| Import | Provides | Skip if… |
|
|
45
45
|
|---|---|---|
|
|
46
46
|
| `@antadesign/anta/tokens.css` | Six seed tokens, derived role scales (`--bg-1…5`, `--text-1…5`, `--border-1…5`), `.dark`, the 15px root size, and layer order. Override a seed to reskin its tone. | You provide those variables. |
|
|
47
|
-
| `@antadesign/anta/reset.css` | A small reset plus Anta's focus, heading, list, and link typography in `@layer anta`. | You use another reset and typography. |
|
|
47
|
+
| `@antadesign/anta/reset.css` | A small reset plus Anta's focus, heading, list, and link typography in `@layer anta.reset`. | You use another reset and typography. |
|
|
48
48
|
| `@antadesign/anta/elements` | Registers every `<a-*>` element and its CSS. Per-element entries register one; see [Registering elements](#registering-elements). | You render only on the server or register elements individually. |
|
|
49
49
|
| `@antadesign/anta` | Typed React/Preact wrappers such as `Progress`, `Text`, and `Icon`. | You write `<a-*>` elements directly. |
|
|
50
50
|
| `@antadesign/anta/bundle.css` | One minified stylesheet containing tokens, reset, element, and JSX-wrapper styles. | You want granular CSS imports. |
|
|
@@ -60,9 +60,16 @@ seed-derived default palette or provide your own theme.
|
|
|
60
60
|
|
|
61
61
|
### Cascade layers
|
|
62
62
|
|
|
63
|
-
Anta's reset and element CSS
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
Anta's reset and element CSS use child layers inside `@layer anta`. `tokens.css`
|
|
64
|
+
orders them above preflight resets and below your component and utility layers:
|
|
65
|
+
|
|
66
|
+
```css
|
|
67
|
+
@layer base, anta, components, utilities;
|
|
68
|
+
@layer anta.reset, anta.components, anta.theme;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`anta.theme` lets the optional reference palette replace component formulas. The
|
|
72
|
+
outer `anta` layer keeps its public cascade position.
|
|
66
73
|
|
|
67
74
|
To change that order, declare it in CSS loaded **before** `tokens.css`. The
|
|
68
75
|
first declaration fixes a layer's position:
|
|
@@ -84,7 +91,7 @@ Token custom properties stay unlayered so they apply everywhere.
|
|
|
84
91
|
> Unlayered styles beat layered ones regardless of specificity. This reset
|
|
85
92
|
> overrides Anta's element defaults. Delete the duplicate, or put your reset in
|
|
86
93
|
> `@layer base { … }`; `reset.css` already applies the same universal reset in
|
|
87
|
-
> `@layer anta`.
|
|
94
|
+
> `@layer anta.reset`.
|
|
88
95
|
|
|
89
96
|
## Registering elements
|
|
90
97
|
|
|
@@ -213,25 +220,39 @@ specifier with a bundler or import map.
|
|
|
213
220
|
|
|
214
221
|
## Dark mode
|
|
215
222
|
|
|
216
|
-
|
|
223
|
+
For a page-wide dark mode, add `dark` to `html`. The `body` `--bg-2` background
|
|
224
|
+
then paints the browser canvas, and the root controls scrollbar colors:
|
|
217
225
|
|
|
218
226
|
```html
|
|
219
|
-
<
|
|
220
|
-
<
|
|
221
|
-
|
|
227
|
+
<html class="dark">
|
|
228
|
+
<body>
|
|
229
|
+
<Progress value={50} />
|
|
230
|
+
</body>
|
|
231
|
+
</html>
|
|
222
232
|
```
|
|
223
233
|
|
|
234
|
+
Use `dark` or `light` on another ancestor to scope its color scheme and palette.
|
|
235
|
+
|
|
224
236
|
## Fonts
|
|
225
237
|
|
|
226
|
-
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
|
|
238
|
+
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 `1rem` to 15px.
|
|
227
239
|
|
|
228
|
-
|
|
240
|
+
Register application-owned fonts, then override the font variables. This example
|
|
241
|
+
uses separate Roman and Italic variable files:
|
|
229
242
|
|
|
230
243
|
```css
|
|
231
244
|
@font-face {
|
|
232
245
|
font-family: "App Sans";
|
|
233
|
-
src: url("/
|
|
234
|
-
|
|
246
|
+
src: url("/fonts/app-sans-roman.woff2") format("woff2");
|
|
247
|
+
font-style: normal;
|
|
248
|
+
font-weight: 100 900;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@font-face {
|
|
252
|
+
font-family: "App Sans";
|
|
253
|
+
src: url("/fonts/app-sans-italic.woff2") format("woff2");
|
|
254
|
+
font-style: italic;
|
|
255
|
+
font-weight: 100 900;
|
|
235
256
|
}
|
|
236
257
|
|
|
237
258
|
:root {
|
|
@@ -240,6 +261,30 @@ To use your own fonts, register `@font-face` declarations and override the varia
|
|
|
240
261
|
}
|
|
241
262
|
```
|
|
242
263
|
|
|
264
|
+
Anta's semantic italics (`em`, `i`, `var`, and `dt`) select the Italic face.
|
|
265
|
+
|
|
266
|
+
### Variable slant
|
|
267
|
+
|
|
268
|
+
A variable font with a standard `slnt` axis can provide both instances. Expose it
|
|
269
|
+
through `font-style: oblique` instead of setting `slnt` on italic elements:
|
|
270
|
+
|
|
271
|
+
```css
|
|
272
|
+
@font-face {
|
|
273
|
+
font-family: "App Variable";
|
|
274
|
+
src: url("/fonts/app-variable.woff2") format("woff2");
|
|
275
|
+
font-style: oblique 0deg 12deg;
|
|
276
|
+
font-weight: 100 900;
|
|
277
|
+
font-stretch: 75% 100%;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:root {
|
|
281
|
+
--sans-serif: "App Variable", sans-serif;
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The browser selects `0deg` for normal text and `11deg` for semantic italics. Use
|
|
286
|
+
the range your font declares to avoid combining `slnt` with a synthetic oblique.
|
|
287
|
+
|
|
243
288
|
## Browser support
|
|
244
289
|
|
|
245
290
|
Anta targets evergreen browsers and ships **no baseline polyfills**. Its floor is [custom-element states](https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet), used throughout the components for their internal CSS state, alongside the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API):
|
package/docs/normalization.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# Normalization
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
components — no per-page restyling to make prose match a `<Title>` or a `<Table>`.
|
|
3
|
+
`reset.css` gives plain HTML (`<h2>`, `<ul>`, `<a>`, `<table>`) the same baseline as
|
|
4
|
+
Anta components.
|
|
6
5
|
|
|
7
|
-
It
|
|
8
|
-
|
|
9
|
-
reset. Omit this import when another reset provides the baseline.
|
|
6
|
+
It is a separate import in `@layer anta.reset`. Override individual rules, or omit
|
|
7
|
+
it when another reset provides the baseline.
|
|
10
8
|
|
|
11
9
|
```js
|
|
12
10
|
import '@antadesign/anta/tokens.css' // design tokens
|
|
@@ -18,6 +16,9 @@ import '@antadesign/anta/elements' // web components (client-side only)
|
|
|
18
16
|
|
|
19
17
|
### Structural reset
|
|
20
18
|
|
|
19
|
+
- `html` uses `--sans-serif`, `--text-2`, 22px leading, and `color-scheme`.
|
|
20
|
+
`.dark` selects dark mode; `.light` restores it in a dark subtree. `body` paints
|
|
21
|
+
`--bg-2`, including the browser canvas.
|
|
21
22
|
- `box-sizing: border-box` on every element (and `::before` / `::after`).
|
|
22
23
|
- `margin: 0` on everything — apps build spacing from explicit values.
|
|
23
24
|
- Replaced elements (`img`, `picture`, `video`, `canvas`, `svg`) → `display: block` + `max-width: 100%`, so a stray large asset can't blow out the layout.
|
|
@@ -28,21 +29,31 @@ import '@antadesign/anta/elements' // web components (client-side only)
|
|
|
28
29
|
|
|
29
30
|
### Typography (Anta's opinion)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
These defaults make raw markup match Anta components.
|
|
32
33
|
|
|
33
|
-
- **Headings**
|
|
34
|
+
- **Headings** match `<Title level={n}>` and have document margins. `<Title>` remains margin-free.
|
|
35
|
+
- **Block rhythm:** `p`, `ul`, `ol`, `blockquote`, `dl`, `pre`, and `figure` have a
|
|
36
|
+
`1rem` bottom margin, removed on a last child. `table` and `hr` have no reset margin.
|
|
34
37
|
- `strong` → `font-weight: 600`.
|
|
35
38
|
- `dfn` (defined term) → non-italic, with a dotted underline at half the surrounding text's strength (`3px` offset) in place of the UA italic. No `cursor: help` — that's for where the term is actually hoverable.
|
|
36
|
-
- Inline `code` → `line-height: 1em`
|
|
39
|
+
- Inline `code` → a tone-aware `--monospace` pill. `line-height: 1em` preserves the
|
|
40
|
+
surrounding line box; `pre code` has no pill.
|
|
37
41
|
- **Lists** (`ul` / `ol`): `3ch` left padding so markers hug the text; a small bottom margin between items; markers toned to `--text-5`.
|
|
42
|
+
- **Blockquotes** → a 3px `--text-5` rule on the left with `2ch` total left inset.
|
|
43
|
+
- `mark` → a theme-specific yellow with near-black text.
|
|
44
|
+
- `del` → `--text-2-critical` with a strike; `ins` → `--text-2-success` without an underline.
|
|
45
|
+
- `var` and `dt` → italic at `font-weight: 600`.
|
|
46
|
+
- `small` and `figcaption` → `calc(13em / 15)`; `figcaption` also uses `--text-3`.
|
|
47
|
+
- `sub` / `sup` → 75% with relative offsets that preserve line height.
|
|
48
|
+
- `hr` → a 1px `--border-4` line.
|
|
49
|
+
- `pre` → a bordered `--bg-3` code surface with horizontal scrolling.
|
|
38
50
|
- `menu` is stripped to a clean semantic container (no disc markers / default padding).
|
|
39
51
|
- **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
52
|
- `::selection` → the focus-ring color, tuned per theme (20% alpha in light, 30% in dark).
|
|
41
53
|
- **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
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
in `src/elements/a-title.css`; the two are kept in sync.
|
|
55
|
+
See `src/reset.css` for the full set. Heading values are duplicated in
|
|
56
|
+
`src/elements/a-title.css` and kept in sync.
|
|
46
57
|
|
|
47
58
|
## Cascade layers — how to override
|
|
48
59
|
|
|
@@ -50,30 +61,26 @@ Anta declares this layer order once (in `tokens.css`):
|
|
|
50
61
|
|
|
51
62
|
```css
|
|
52
63
|
@layer base, anta, components, utilities;
|
|
64
|
+
@layer anta.reset, anta.components, anta.theme;
|
|
53
65
|
```
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
Anta uses child layers inside `@layer anta`: `anta.reset`, `anta.components`, and
|
|
68
|
+
the optional `anta.theme`.
|
|
56
69
|
|
|
57
70
|
- **Above `base`** — a framework preflight you drop into `@layer base` (e.g. Tailwind) won't wipe Anta's typography.
|
|
58
71
|
- **Below `components` and `utilities`** — your own component or utility CSS overrides Anta with no specificity battles.
|
|
59
72
|
- **Unlayered CSS beats every layer** — so any plain rule you write already wins over Anta's reset, no `!important` needed.
|
|
60
73
|
|
|
61
|
-
> **
|
|
62
|
-
>
|
|
63
|
-
>
|
|
64
|
-
> **unlayered** also outranks Anta's *per-element* defaults — its `p`, `caption`,
|
|
65
|
-
> and `ul / ol` margins — because unlayered wins over `@layer anta` regardless of
|
|
66
|
-
> specificity. Anta already runs that universal `*` reset itself, inside
|
|
67
|
-
> `@layer anta`, so the copy-pasted duplicate is redundant *and* harmful: delete it,
|
|
68
|
-
> or if you keep your own reset wrap it in `@layer base { … }` (below `anta`) so
|
|
69
|
-
> Anta's element defaults still apply.
|
|
74
|
+
> **Don't add an unlayered universal reset.** It overrides Anta's element defaults.
|
|
75
|
+
> Anta already applies `box-sizing` and `margin: 0`; delete duplicates, or put your
|
|
76
|
+
> reset in `@layer base`.
|
|
70
77
|
|
|
71
78
|
### Override one thing
|
|
72
79
|
|
|
73
80
|
Write the rule unlayered (or in a layer after `anta`) — targeting a **specific** element, not `*`:
|
|
74
81
|
|
|
75
82
|
```css
|
|
76
|
-
/* wins over Anta's @layer anta
|
|
83
|
+
/* wins over Anta's @layer anta.reset — no !important */
|
|
77
84
|
h2 { letter-spacing: -0.01em; }
|
|
78
85
|
```
|
|
79
86
|
|
|
@@ -95,8 +102,10 @@ Or import both and override only the pieces you want (unlayered, or in a later l
|
|
|
95
102
|
|
|
96
103
|
## Why it's opinionated
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
The reset gives headings, lists, links, and tables the same baseline as Anta
|
|
106
|
+
components. Omit it when your own reset should control them.
|
|
107
|
+
|
|
108
|
+
Tags styled by the reset, rendered live.
|
|
109
|
+
|
|
110
|
+
`abbr`, `q`, and `cite` keep browser typographic styles. `dd` has no browser indent
|
|
111
|
+
because the reset clears margins. The reset adds no `kbd` typography.
|
package/docs/theming.md
CHANGED
|
@@ -23,6 +23,9 @@ Anta's palette is generative. Every color in the system derives from six tone se
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Anta's styles use ordered child layers inside `@layer anta`. Your unlayered CSS
|
|
27
|
+
overrides them without `!important`, and shadow-DOM components expose
|
|
28
|
+
`::part(...)`. A component's `tone` accepts a named tone or CSS color and derives
|
|
29
|
+
its rest, hover, and active values. Each component page lists its styling hooks.
|
|
27
30
|
|
|
28
31
|
The lab below shows the derivation live. For each toned component, the shipped Default sits next to a Custom preview driven by the seed picker, with the formula constants editable and the resolved CSS shown.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"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 anta-site run docs && (node scripts/dev-watch.mjs & pnpm --filter anta-site run dev:server & wait)",
|
|
63
63
|
"stop": "node scripts/dev-stop.mjs",
|
|
64
64
|
"typecheck": "tsc --noEmit -p src/tsconfig.json",
|
|
65
|
-
"lint": "node scripts/lint-getters.mjs",
|
|
65
|
+
"lint": "node scripts/lint-getters.mjs && node scripts/lint-css-layers.mjs",
|
|
66
66
|
"verify": "pnpm run lint && pnpm run typecheck && pnpm --filter anta-site run docs:api",
|
|
67
67
|
"icons": "node scripts/generate-icons.mjs --input src/elements/icons --output src/elements --name a-icon.shapes --internal",
|
|
68
68
|
"clean": "rm -rf dist",
|