@antadesign/anta 0.3.18 → 0.3.20

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 (92) hide show
  1. package/README.md +38 -242
  2. package/dist/anta_helpers.d.ts +2 -2
  3. package/dist/components/Banner.d.ts +3 -3
  4. package/dist/components/Button.d.ts +1 -1
  5. package/dist/components/Calendar.d.ts +11 -12
  6. package/dist/components/Card.d.ts +1 -1
  7. package/dist/components/Card.js +1 -1
  8. package/dist/components/Checkbox.d.ts +8 -9
  9. package/dist/components/Dialog.d.ts +1 -1
  10. package/dist/components/Expander.d.ts +5 -6
  11. package/dist/components/Input.d.ts +6 -3
  12. package/dist/components/Input.js +3 -1
  13. package/dist/components/InputAutocomplete.d.ts +8 -8
  14. package/dist/components/InputDate.css +1 -0
  15. package/dist/components/InputDate.d.ts +1 -0
  16. package/dist/components/InputDate.js +5 -5
  17. package/dist/components/InputTime.d.ts +3 -3
  18. package/dist/components/InputTime.js +1 -1
  19. package/dist/components/Menu.d.ts +7 -3
  20. package/dist/components/Menu.js +3 -2
  21. package/dist/components/MenuItem.d.ts +1 -1
  22. package/dist/components/MenuItem.js +1 -1
  23. package/dist/components/Progress.d.ts +1 -1
  24. package/dist/components/RadioGroup.d.ts +12 -13
  25. package/dist/components/Select.d.ts +32 -38
  26. package/dist/components/Select.js +9 -13
  27. package/dist/components/SelectFaceted.d.ts +28 -33
  28. package/dist/components/SelectFaceted.js +29 -23
  29. package/dist/components/Slider.d.ts +5 -5
  30. package/dist/components/Switch.d.ts +4 -4
  31. package/dist/components/Tabs.d.ts +7 -7
  32. package/dist/components/Title.d.ts +1 -1
  33. package/dist/components/Toaster.d.ts +1 -1
  34. package/dist/components/Tooltip.d.ts +1 -1
  35. package/dist/components/select-parts.css +1 -0
  36. package/dist/elements/a-card.css +1 -1
  37. package/dist/elements/a-dialog.css +1 -1
  38. package/dist/elements/a-expander.css +1 -1
  39. package/dist/elements/a-expander.d.ts +1 -0
  40. package/dist/elements/a-expander.js +12 -2
  41. package/dist/elements/a-input.css +1 -1
  42. package/dist/elements/a-menu.js +12 -0
  43. package/dist/elements/a-progress.css +1 -1
  44. package/dist/elements/a-slider.css +1 -1
  45. package/dist/elements/a-tabs.css +1 -1
  46. package/dist/elements/a-tabs.d.ts +3 -0
  47. package/dist/elements/a-tabs.js +40 -1
  48. package/dist/elements/a-tooltip.css +1 -1
  49. package/dist/elements/a-tooltip.d.ts +1 -1
  50. package/dist/elements/a-tooltip.js +1 -1
  51. package/dist/elements/index.d.ts +1 -1
  52. package/dist/general_types.d.ts +24 -22
  53. package/dist/index.d.ts +3 -3
  54. package/dist/jsx-runtime.d.ts +9 -0
  55. package/docs/accessibility.md +34 -0
  56. package/docs/changelog.md +561 -0
  57. package/docs/colors.md +42 -0
  58. package/docs/comparison.md +28 -0
  59. package/docs/components/banner.md +267 -0
  60. package/docs/components/button.md +603 -0
  61. package/docs/components/card.md +321 -0
  62. package/docs/components/checkbox.md +296 -0
  63. package/docs/components/dialog.md +314 -0
  64. package/docs/components/expander.md +526 -0
  65. package/docs/components/icon.md +155 -0
  66. package/docs/components/input-autocomplete.md +100 -0
  67. package/docs/components/input-date.md +401 -0
  68. package/docs/components/input-time.md +174 -0
  69. package/docs/components/input.md +610 -0
  70. package/docs/components/loader.md +139 -0
  71. package/docs/components/menu.md +511 -0
  72. package/docs/components/progress.md +182 -0
  73. package/docs/components/radio.md +368 -0
  74. package/docs/components/select-faceted.md +451 -0
  75. package/docs/components/select.md +926 -0
  76. package/docs/components/slider.md +147 -0
  77. package/docs/components/switch.md +198 -0
  78. package/docs/components/tabs.md +471 -0
  79. package/docs/components/tag.md +185 -0
  80. package/docs/components/text.md +148 -0
  81. package/docs/components/title.md +146 -0
  82. package/docs/components/toaster.md +313 -0
  83. package/docs/components/tooltip.md +177 -0
  84. package/docs/credits.md +18 -0
  85. package/docs/index.md +52 -0
  86. package/docs/install-config.md +240 -0
  87. package/docs/normalization.md +102 -0
  88. package/docs/overview.md +10 -0
  89. package/docs/packages/stickers.md +187 -0
  90. package/docs/packages/table.md +153 -0
  91. package/docs/theming.md +13 -0
  92. package/package.json +10 -6
@@ -0,0 +1,187 @@
1
+ # Stickers
2
+
3
+ Square illustrated stickers in two flavors per name — a lightweight
4
+ static SVG and a Lottie-driven animated version. Stickers ship in their
5
+ own package, `@antadesign/stickers` (a companion to `@antadesign/anta`,
6
+ kept separate so apps that don't use stickers never install
7
+ `lottie-web`). Each one is its own named export, so the consumer's
8
+ bundler ships only the stickers actually used. The static variant is
9
+ the default; reach for the animated one explicitly when you want
10
+ motion.
11
+
12
+ ```sh
13
+ npm install @antadesign/stickers # pulls @antadesign/anta + lottie-web
14
+ ```
15
+
16
+ > Both flavors are JSX wrappers over two custom elements,
17
+ > `<a-sticker>` and `<a-sticker-animated>`, registered by
18
+ > `@antadesign/stickers/elements`. Plain HTML/JS consumers can drive the
19
+ > elements directly via `setAttribute` instead of using the JSX
20
+ > wrappers — see *Non-React consumers* below.
21
+
22
+ The full set is also published as a [Telegram sticker pack](https://t.me/addstickers/SnoutyAntithesis).
23
+
24
+ ## Props
25
+
26
+ Both flavors share the same base props; the animated flavor adds playback props.
27
+
28
+ ### `Sticker{Name}` (static)
29
+
30
+ | Prop | Type | Description |
31
+ |---|---|---|
32
+ | `size?` | `number` | Edge length in pixels. Stickers are always square. Defaults to `256`. |
33
+ | `label?` | `string` | Accessible name. When set, the sticker is exposed as `role="img"` + `aria-label`. Omitted ⇒ `aria-hidden="true"` (decorative). |
34
+
35
+ Inherited props (`className`, `style`).
36
+
37
+ ### `Sticker{Name}Animated` (Lottie)
38
+
39
+ Same as the static base, plus:
40
+
41
+ | Prop | Type | Description |
42
+ |---|---|---|
43
+ | `paused?` | `boolean \| number` | `true` freezes at the current frame; a number freezes at that time in seconds. Omit (or pass `false`) to play. |
44
+ | `delay?` | `number` | Seconds to wait at the first frame before playing. |
45
+ | `playOnce?` | `boolean` | Plays once and holds the final frame instead of looping. |
46
+ | `replayOnClick?` | `boolean` | With `playOnce`, lets people click or press Enter/Space to replay the animation. The sticker becomes a labeled button. |
47
+
48
+ Use the web component directly when you are not using React or Preact and a native control does not fit.
49
+
50
+ Pass the generated SVG payload to `<a-sticker>` and set a size through
51
+ `--sticker-size`. The animated element takes its generated Lottie JSON through
52
+ `animation` instead.
53
+
54
+ ```html
55
+ <a-sticker
56
+ role="img"
57
+ aria-label="Purple circle"
58
+ svg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="7" fill="currentColor"/></svg>'
59
+ style="--sticker-size: 96px; color: var(--text-1-brand)"
60
+ ></a-sticker>
61
+ ```
62
+
63
+ ## Sizing
64
+
65
+ Pass `size` (a number, in pixels) to control width and height together.
66
+ Default is `256`. Stickers are always square.
67
+
68
+ ```tsx
69
+ <StickerVacation /> // 256×256
70
+ <StickerVacation size={128} /> // 128×128
71
+ <StickerVacationAnimated size={64} /> // 64×64
72
+ ```
73
+
74
+ Internally, `size` is applied as the `--sticker-size` CSS custom
75
+ property on the rendered `<a-sticker>` / `<a-sticker-animated>`. The
76
+ base CSS rule reads it as
77
+ `width: var(--sticker-size, 256px); height: var(--sticker-size, 256px)`.
78
+ That means consumer CSS (or a parent's variable cascade) can drive
79
+ sticker size too:
80
+
81
+ ```css
82
+ .sticker-grid { --sticker-size: 96px; }
83
+ ```
84
+
85
+ ## Animation control
86
+
87
+ `paused`, `delay`, `playOnce`, and `replayOnClick` only apply to
88
+ `Sticker{Name}Animated`.
89
+ They map to observed element attributes:
90
+
91
+ ```tsx
92
+ <StickerCodingAnimated /> // autoplay, looping
93
+ <StickerCodingAnimated paused /> // freeze at the current frame
94
+ <StickerCodingAnimated paused={1.5} /> // freeze at 1.5 seconds
95
+ <StickerCodingAnimated paused={false} /> // explicitly play (same as omitted)
96
+ <StickerCodingAnimated delay={0.5} /> // wait half a second, then play
97
+ <StickerCodingAnimated playOnce /> // play once, then hold the final frame
98
+ <StickerCodingAnimated playOnce replayOnClick label="Replay coding sticker" />
99
+ ```
100
+
101
+ ## Adding your own stickers
102
+
103
+ `@antadesign/stickers` ships a generator script at
104
+ `@antadesign/stickers/generate-stickers.mjs`. Drop your sources in a
105
+ folder structured the same way as the built-in set — one subfolder per
106
+ sticker, with a `<name>.json` (Lottie) and/or `<name>.svg` (static
107
+ pose):
108
+
109
+ ```
110
+ my-stickers/
111
+ happy/
112
+ happy.json
113
+ happy.svg
114
+ sad/
115
+ sad.json
116
+ ```
117
+
118
+ Then point the generator at it:
119
+
120
+ ```sh
121
+ node ./node_modules/@antadesign/stickers/dist/generate-stickers.mjs \
122
+ --input ./my-stickers \
123
+ --output ./src/my-generated-stickers
124
+ ```
125
+
126
+ The emitted modules import their `Sticker` / `StickerAnimated` runtime
127
+ wrappers from `@antadesign/stickers` by default; pass `--package <name>`
128
+ to point them at a different specifier (e.g. your own re-export).
129
+
130
+ Out comes one `<name>.ts` per static sticker and one `<name>-animated.ts`
131
+ per animated sticker, plus an `index.ts` barrel. Import and use:
132
+
133
+ ```ts
134
+ import { StickerHappy, StickerSadAnimated } from './my-generated-stickers'
135
+
136
+ <StickerHappy size={96} />
137
+ <StickerSadAnimated paused={1.5} />
138
+ ```
139
+
140
+ ### Source conventions
141
+
142
+ - Animated stickers are `<name>.json` Lottie payloads.
143
+ - Either file is optional — supply just the SVG for a static-only
144
+ sticker, just the JSON for an animated-only one, or both.
145
+
146
+ ### Conflicting names
147
+
148
+ If a generated sticker has the same name as one of the pack's built-ins
149
+ (e.g. `vacation`), the generator prints a warning. The built-in sticker
150
+ imported from `@antadesign/stickers` is unaffected — your generated
151
+ barrel exposes yours under your own import path.
152
+
153
+ ## Non-React consumers
154
+
155
+ The custom elements `<a-sticker>` and `<a-sticker-animated>` are
156
+ framework-agnostic. Each generated module exports the raw payload
157
+ (`svg` string for static, `animationJson` string for animated)
158
+ alongside the JSX component, so non-React consumers can pull just the
159
+ data and drive the elements directly:
160
+
161
+ ```js
162
+ import { svg } from '@antadesign/stickers/vacation'
163
+ import { animationJson } from '@antadesign/stickers/vacation-animated'
164
+
165
+ const still = document.createElement('a-sticker')
166
+ still.setAttribute('svg', svg)
167
+ still.style.setProperty('--sticker-size', '128px')
168
+ document.body.appendChild(still)
169
+
170
+ const movie = document.createElement('a-sticker-animated')
171
+ movie.setAttribute('animation', animationJson)
172
+ document.body.appendChild(movie)
173
+ ```
174
+
175
+ The static element renders the SVG into its own shadow DOM; the
176
+ animated element drives a shadow-DOM `<svg>` via `lottie-web`. Both
177
+ consume their payload through the `svg` / `animation` HTML attribute —
178
+ the JSX wrapper passes the same data, just through React/Preact's
179
+ prop layer.
180
+
181
+ ## SSR
182
+
183
+ `@antadesign/stickers/elements` references browser APIs (`HTMLElement`,
184
+ `customElements`, `lottie-web`). In SSR contexts (Astro, Next.js) gate
185
+ the import behind a client boundary — same rule as anta's own elements.
186
+ The sticker components themselves render fine on the server (just JSX);
187
+ only the underlying custom-element classes need the browser.
@@ -0,0 +1,153 @@
1
+ # Table
2
+
3
+ A tabular layout for structured data — rows, columns, headers, sorting,
4
+ selection. **Not yet shipped in `@antadesign/anta`.** For now, use the
5
+ component published in the Anta Figma library; the React/web-component
6
+ implementation will follow.
7
+
8
+ ## Status
9
+
10
+ Available in Figma; not yet implemented in code. There is no
11
+ `<Table>` component or `<a-table>` element to import. This page will
12
+ grow Props / Examples / Tokens sections once the component lands.
13
+
14
+ ## Figma source
15
+
16
+ The Table component lives in the **Anta 0.2** Figma library:
17
+
18
+ [Open Table in Figma →](https://www.figma.com/design/cIvfEHHCYgJb5RYuMqBMbN/Anta-0.2?node-id=882-18882&t=98Cj3I7mvzMVVchU-11)
19
+
20
+ ## Preview
21
+
22
+ ## Plain HTML tables
23
+
24
+ While the `<Table>` component is in design, Anta's `reset.css` ships a
25
+ polite baseline for the native `<table>` element so plain HTML tables
26
+ look intentional out of the box. The defaults are deliberately minimal:
27
+ top-left aligned cells with 5 × 10 px padding, hairline row separators
28
+ in `--border-4`, semibold `<thead>` cells, and no outer frame or
29
+ column dividers. Set `font-variant-numeric: tabular-nums` so numeric
30
+ columns line up.
31
+
32
+ All rules live inside `@layer anta`, so any consumer rule outside a
33
+ layer (or in `components` / `utilities`) overrides without specificity
34
+ fights or `!important`.
35
+
36
+ ### Default
37
+
38
+
39
+
40
+ Token
41
+ Value
42
+ Usage
43
+
44
+
45
+
46
+
47
+ --text-1
48
+ #1c1f23
49
+ Primary body copy
50
+
51
+
52
+ --text-3
53
+ #52575e
54
+ Secondary labels, sidebar links
55
+
56
+
57
+ --border-5
58
+ #e8eaed
59
+ Hairline dividers, table row separators
60
+
61
+
62
+
63
+ ```html
64
+ <table>
65
+ <thead>
66
+ <tr><th>Token</th><th>Value</th><th>Usage</th></tr>
67
+ </thead>
68
+ <tbody>
69
+ <tr><td>--text-1</td><td>#1c1f23</td><td>Primary body copy</td></tr>
70
+ …
71
+ </tbody>
72
+ </table>
73
+ ```
74
+
75
+ ### Bordered
76
+
77
+ Add `data-bordered` to draw the outer frame, vertical column dividers,
78
+ and 3 px rounded corners. Under the hood the variant switches to
79
+ `border-collapse: separate` because `border-radius` doesn't render
80
+ reliably with collapsed borders.
81
+
82
+
83
+
84
+ Token
85
+ Value
86
+ Usage
87
+
88
+
89
+
90
+
91
+ --text-1
92
+ #1c1f23
93
+ Primary body copy
94
+
95
+
96
+ --text-3
97
+ #52575e
98
+ Secondary labels, sidebar links
99
+
100
+
101
+ --border-5
102
+ #e8eaed
103
+ Hairline dividers, table row separators
104
+
105
+
106
+
107
+ ```html
108
+ <table data-bordered>
109
+ …
110
+ </table>
111
+ ```
112
+
113
+ ### With a caption
114
+
115
+ `<caption>` is the semantic title for a data table — the first child of
116
+ `<table>`, announced by screen readers as the table's accessible name.
117
+ Browsers render it as a block above the rows; Anta's only opinion is
118
+ left alignment (browser default is centered).
119
+
120
+ Color tokens used by the docs sidebar
121
+
122
+
123
+ Token
124
+ Role
125
+
126
+
127
+
128
+
129
+ --text-1-brand
130
+ Logo wordmark
131
+
132
+
133
+ --text-3
134
+ Nav link, idle state
135
+
136
+
137
+ --text-1
138
+ Nav link, current page
139
+
140
+
141
+
142
+ ```html
143
+ <table data-bordered>
144
+ <caption>Color tokens used by the docs sidebar</caption>
145
+ <thead>
146
+ <tr><th>Token</th><th>Role</th></tr>
147
+ </thead>
148
+ <tbody>
149
+ <tr><td>--text-1-brand</td><td>Logo wordmark</td></tr>
150
+ …
151
+ </tbody>
152
+ </table>
153
+ ```
@@ -0,0 +1,13 @@
1
+ # Theming
2
+
3
+ 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
+
5
+ ```css
6
+ :root {
7
+ --anta-seed-brand: #0f766e; /* a teal brand; every brand token follows */
8
+ }
9
+ ```
10
+
11
+ Past the seeds, any look and feel is reachable. Anta's styles live in `@layer anta`, so an un-layered rule you write wins without `!important`, and shadow-DOM components expose `::part(...)` hooks. Per component, the `tone` prop takes a named tone or any CSS color and derives that component's full rest/hover/active curve from it. Each component page lists its own hooks under Styling.
12
+
13
+ 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,11 +1,12 @@
1
1
  {
2
2
  "name": "@antadesign/anta",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist",
9
+ "docs",
9
10
  "NOTICES.md"
10
11
  ],
11
12
  "packageManager": "pnpm@8.13.1",
@@ -44,20 +45,23 @@
44
45
  }
45
46
  },
46
47
  "scripts": {
47
- "build": "pnpm run build:js && pnpm run build:css && pnpm run build:types",
48
+ "build": "pnpm run build:js && pnpm run build:css && pnpm run build:types && pnpm run build:docs",
48
49
  "build:dev": "pnpm run build:js && pnpm run build:css:dev && pnpm run build:types",
49
- "build:css": "esbuild $(find src -name '*.css') --minify --loader:.module.css=css --outdir=dist --outbase=src && cp scripts/generate-icons.mjs dist/",
50
+ "build:css": "esbuild $(find src -name '*.css') --minify --outdir=dist --outbase=src && cp scripts/generate-icons.mjs dist/",
50
51
  "build:css:dev": "find src -name '*.css' | while IFS= read -r f; do d=\"dist/${f#src/}\"; mkdir -p \"$(dirname \"$d\")\"; cp \"$f\" \"$d\"; done && cp scripts/generate-icons.mjs dist/",
51
- "build:js": "esbuild $(find src \\( -name '*.ts' -o -name '*.tsx' \\) ! -name '*.d.ts') --outdir=dist --outbase=src --jsx=automatic --jsx-import-source=@antadesign/anta --format=esm --target=ES2022 --loader:.module.css=local-css --loader:.css=global-css",
52
+ "build:js": "esbuild $(find src \\( -name '*.ts' -o -name '*.tsx' \\) ! -name '*.d.ts') --outdir=dist --outbase=src --jsx=automatic --jsx-import-source=@antadesign/anta --format=esm --target=ES2022 --loader:.css=global-css",
52
53
  "build:types": "tsc -p src/tsconfig.json",
53
- "dev": "echo $$ > .dev.pid; trap 'rm -f .dev.pid' 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)",
54
+ "build:docs": "pnpm --filter anta-site run docs:api && pnpm --filter anta-site run docs:pages && node scripts/generate-package-docs.mjs",
55
+ "dev": "node scripts/dev.mjs",
56
+ "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)",
54
57
  "stop": "node scripts/dev-stop.mjs",
55
58
  "typecheck": "tsc --noEmit -p src/tsconfig.json",
56
59
  "lint": "node scripts/lint-getters.mjs",
57
60
  "icons": "node scripts/generate-icons.mjs --input src/elements/icons --output src/elements --name a-icon.shapes --internal",
58
61
  "clean": "rm -rf dist",
59
62
  "prepare": "pnpm run build",
60
- "prepublishOnly": "pnpm run build"
63
+ "prepublishOnly": "pnpm run build",
64
+ "prepack": "pnpm run build:docs"
61
65
  },
62
66
  "devDependencies": {
63
67
  "@types/react": "^19.0.0",