@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
package/README.md CHANGED
@@ -1,244 +1,40 @@
1
1
  # @antadesign/anta
2
2
 
3
- <a href="https://antithesis.com" target="_blank" rel="noopener noreferrer">Antithesis</a> design system, **Anta**, has three layers: global CSS tokens with swappable themes, framework-agnostic web components that work in plain HTML, and JSX wrappers for React and Preact.
4
-
5
- One constraint shapes the architecture. Antithesis runs most of its UI in a Worker thread, driven by a custom reactive engine, and a component that mutates its own attributes would desync the Worker from the UI thread. So Anta's web components are **fully declarative**: they never touch their own attributes, and internal state lives in Shadow DOM, invisible to the outer document. The components carry the styling without imposing a framework, and most are stateless; the JSX wrappers exist for dynamic state and conditional rendering.
6
-
7
- ## Installation
8
-
9
- ```sh
10
- npm install @antadesign/anta # or pnpm / bun
11
- ```
12
-
13
- Pin an exact version in `package.json` (`"@antadesign/anta": "0.3.16"`) instead
14
- of a floating tag such as `"latest"`.
15
-
16
- ### Usage
17
-
18
- ```tsx
19
- import '@antadesign/anta/tokens.css' // CSS custom properties
20
- import '@antadesign/anta/reset.css' // reset and typography defaults
21
- import '@antadesign/anta/elements' // registers <a-*> elements
22
- import { Progress } from '@antadesign/anta'
23
-
24
- <Progress value={42} label="Uploaded" hint="3 of 7" />
25
- ```
26
-
27
- ### What you import (and why)
28
-
29
- Tokens, elements, and the JSX layer render a styled component. The reset is
30
- recommended; the reference theme is optional.
31
-
32
- | Import | Provides | Skip if… |
33
- |---|---|---|
34
- | `@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. |
35
- | `@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. |
36
- | `@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. |
37
- | `@antadesign/anta` | Typed React/Preact wrappers such as `Progress`, `Text`, and `Icon`. | You write `<a-*>` elements directly. |
38
- | `@antadesign/anta/theme-anta.css` *(optional)* | The hand-tuned reference palette. Import last to replace the seed-derived default. | You want the seed-derived or your own palette. |
39
-
40
- Load `tokens.css` before element CSS. Elements read its variables; without it,
41
- they render unstyled.
42
-
43
- ### Cascade layers
44
-
45
- Anta's reset and element CSS live in `@layer anta`. `tokens.css` declares
46
- `@layer base, anta, components, utilities`, placing Anta above preflight resets
47
- and below your component and utility layers.
48
-
49
- To change that order, declare it in CSS loaded **before** `tokens.css`. The
50
- first declaration fixes a layer's position:
51
-
52
- ```css
53
- /* your global.css, loaded before anta */
54
- @layer reset, anta, my-components, utilities;
55
- ```
56
-
57
- Token custom properties stay unlayered so they apply everywhere.
58
-
59
- > **Gotcha: an unlayered hard reset defeats Anta's element rules.**
60
- >
61
- > ```css
62
- > *, *::before, *::after { box-sizing: border-box; }
63
- > * { margin: 0; }
64
- > ```
65
- >
66
- > Unlayered styles beat layered ones regardless of specificity. This reset
67
- > overrides Anta's element defaults. Delete the duplicate, or put your reset in
68
- > `@layer base { … }`; `reset.css` already applies the same universal reset in
69
- > `@layer anta`.
70
-
71
- ## Registering elements
72
-
73
- JSX wrappers render `<a-*>` tags. Register their classes before those tags reach
74
- the DOM. Registration needs `HTMLElement`, so the import is a no-op in Node.js
75
- and Worker threads.
76
-
77
- ```ts
78
- import '@antadesign/anta/elements' // auto-registers all elements
79
- ```
80
-
81
- `/elements` registers everything. Per-element entries register one element and
82
- load only its CSS:
83
-
84
- ```ts
85
- import '@antadesign/anta/elements/a-tooltip' // only <a-tooltip> + its CSS
86
- import '@antadesign/anta/elements/a-button' // only <a-button> + its CSS
87
- ```
88
-
89
- Both are idempotent, side-effect imports and safe during SSR.
90
-
91
- Use a static import in your app entry, outside components and hooks:
92
-
93
- ```ts
94
- // src/main.tsx (or wherever your root render lives)
95
- import '@antadesign/anta/elements'
96
- import { createRoot } from 'react-dom/client'
97
- import App from './App'
98
- createRoot(document.getElementById('root')!).render(<App />)
99
- ```
100
-
101
- Module initialisation registers the classes before the first render, avoiding a
102
- flash of un-upgraded elements.
103
-
104
- > **Why not `useEffect(() => import('@antadesign/anta/elements'), [])`?**
105
- > `useEffect` runs after paint and the import resolves later. The browser can
106
- > paint unregistered elements first. `useLayoutEffect` is still asynchronous and
107
- > warns during SSR hydration.
108
-
109
- Choose the entry point for your runtime:
110
-
111
- - **Plain HTML or static sites:** a `<script type="module">` in the document head.
112
- - **Astro or Next.js:** a client-only script. In Astro, use
113
- `<script>import '@antadesign/anta/elements'</script>`; in Next.js, import it
114
- from a `'use client'` file.
115
- - **Worker-rendered UI:** the UI-thread bootstrap that owns the DOM. A Worker
116
- has no `HTMLElement`.
117
-
118
- ## Framework setup
119
-
120
- ### React
121
-
122
- Works out of the box.
123
-
124
- ### Preact with compat
125
-
126
- If your bundler aliases `react` to `preact/compat`, Anta works without setup.
127
-
128
- ### Preact without compat
129
-
130
- Call `configure()` before rendering any anta components:
131
-
132
- ```ts
133
- import { configure } from '@antadesign/anta'
134
- import { h, Fragment } from 'preact'
135
- configure(h, Fragment)
136
- ```
137
-
138
- ### TypeScript: typing raw `<a-*>` tags in JSX
139
-
140
- JSX wrappers such as `<Button>` and `<Progress>` need no extra typing. Configure
141
- JSX only when you write raw `<a-*>` tags.
142
-
143
- **Option A (preferred)** — point JSX types at Anta in `tsconfig.json`:
144
-
145
- ```jsonc
146
- { "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "@antadesign/anta" } }
147
- ```
148
-
149
- Every `a-*` tag type-checks, standard HTML tags keep working, and importing
150
- `@antadesign/stickers` adds its tags automatically.
151
-
152
- **Option B** — if `jsxImportSource` cannot change, merge Anta's tag map into
153
- your JSX namespace with `AntaIntrinsicElements` (and `StickerIntrinsicElements`
154
- when needed):
155
-
156
- ```ts
157
- import type { AntaIntrinsicElements } from '@antadesign/anta'
158
- import type { StickerIntrinsicElements } from '@antadesign/stickers' // only if you use stickers
159
-
160
- declare global {
161
- namespace JSX {
162
- interface IntrinsicElements extends AntaIntrinsicElements, StickerIntrinsicElements {}
163
- }
164
- }
165
- ```
166
-
167
- With `@types/react` 18+ and `jsx: "react-jsx"`, JSX is module-scoped. Extend
168
- the `react` module instead:
169
-
170
- ```ts
171
- import type { AntaIntrinsicElements } from '@antadesign/anta'
172
-
173
- declare module 'react' {
174
- namespace JSX {
175
- interface IntrinsicElements extends AntaIntrinsicElements {}
176
- }
177
- }
178
- ```
179
-
180
- Both options reject unknown tags and invalid props. New tags arrive with Anta
181
- upgrades; there is no per-tag list to maintain.
182
-
183
- ### Raw web components (no JSX)
184
-
185
- Elements also work in plain HTML. Registration loads their CSS; resolve the bare
186
- specifier with a bundler or import map.
187
-
188
- ```html
189
- <script type="module">
190
- import '@antadesign/anta/elements'
191
- </script>
192
-
193
- <a-progress value="42" max="100" tone="info"></a-progress>
194
- ```
195
-
196
- ## Dark mode
197
-
198
- Add the `dark` class to any ancestor element:
199
-
200
- ```html
201
- <div class="dark">
202
- <Progress value={50} />
203
- </div>
204
- ```
205
-
206
- ## Fonts
207
-
208
- Anta is designed for a customized <a href="https://typetype.org/fonts/tt-interphases-pro" target="_blank" rel="noopener noreferrer">TT Interphases Pro</a>, but ships no font binaries. Components use `--sans-serif` and `--monospace` with system fallbacks. `tokens.css` sets a 15px root size (`1rem = 15px`).
209
-
210
- To use the Antithesis fonts, register your own `@font-face` declarations and override the variables:
211
-
212
- ```css
213
- @font-face {
214
- font-family: "Antithesis sans";
215
- src: url("/path/to/your/sans.woff2") format("woff2");
216
- /* ... */
217
- }
218
-
219
- :root {
220
- --sans-serif: "Antithesis sans", sans-serif;
221
- --monospace: "Antithesis mono", monospace;
222
- }
223
- ```
224
-
225
- ## Browser support
226
-
227
- 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):
228
-
229
- | Browser | Minimum version |
230
- | --- | --- |
231
- | Chrome / Edge | 125 (May 2024) |
232
- | Safari | 17.4 (Mar 2024) |
233
- | Firefox | 126 (May 2024) |
234
-
235
- This is [Baseline 2024](https://web.dev/baseline). Anta also relies on relative
236
- OKLCH, `:has()`, `dvh`, cascade layers, and constructable shadow DOM. Older
237
- browsers can fail hard, including `:state()` being unrecognized or
238
- `showPopover()` throwing. Gate Anta on your own support matrix when you support
239
- older browsers.
240
-
241
- Two features progressively enhance with fallbacks: `checkVisibility()` falls
242
- back to `getClientRects()`, and typed CSS `attr()` supports raw
243
- `<a-icon size>` in Chrome 133+ and Safari 18.2+. Elsewhere use `<Icon size>`
244
- or `--icon-size`.
3
+ **Anta** is an opinionated design system. It provides
4
+ design tokens, declarative web components, and typed JSX wrappers. Use the same
5
+ components in React, Preact via compat, plain HTML, and custom JSX runtimes via
6
+ `configure()`.
7
+
8
+ ## Documentation for coding agents
9
+
10
+ Start with [`./docs/index.md`](./docs/index.md). This path is relative to the
11
+ root of the installed Anta package, not to the consuming application.
12
+
13
+ This package includes version-specific documentation inside the installed npm
14
+ package.
15
+
16
+ Example:
17
+
18
+ ```text
19
+ node_modules/
20
+ └── @antadesign/
21
+ └── anta/
22
+ ├── README.md
23
+ ├── docs/
24
+ │ ├── index.md
25
+ │ ├── install-config.md
26
+ │ ├── theming.md
27
+ │ └── components/
28
+ │ ├── button.md
29
+ │ ├── dialog.md
30
+ │ └── ...
31
+ └── dist/
32
+ ```
33
+
34
+ When working with Anta components:
35
+
36
+ 1. Read `./docs/index.md` from the installed `@antadesign/anta` package.
37
+ 2. Open only the documentation relevant to the component or feature you are using.
38
+ 3. Do **not** guess component names, props, or behavior from similarly named component libraries (e.g. MUI, Chakra UI, Radix UI, Mantine, shadcn/ui, Ant Design, etc.).
39
+ 4. Use the installed package's TypeScript declarations (`*.d.ts`) as the source of truth for the installed package version.
40
+ 5. If the Markdown documentation and TypeScript declarations disagree, prefer the TypeScript declarations, as they always correspond to the installed version.
@@ -65,10 +65,10 @@ export declare function parseOpenState(v: string | null): 'open' | 'closed';
65
65
  * (e.g. skipping `[disabled]` triggers) lands for every element at once. */
66
66
  export declare function installDismissTrigger(host: HTMLElement, attr: string, onDismiss: () => void): void;
67
67
  /** The six named tones every toned component shares. Anything else is a literal
68
- * CSS colour the element resolves through its `--{component}-tone-source` var. */
68
+ * CSS color the element resolves through its `--{component}-tone-source` var. */
69
69
  export declare const NAMED_TONES: Set<string>;
70
70
  /**
71
- * Inline-style helper for a custom (non-named) tone: hands the literal colour to
71
+ * Inline-style helper for a custom (non-named) tone: hands the literal color to
72
72
  * the element via `varName` (e.g. `--radio-tone-source`) so the element's CSS
73
73
  * derives the fill/text/border curve in oklch. Named tones return `base` unchanged.
74
74
  */
@@ -12,7 +12,7 @@ export interface BannerProps extends BaseProps {
12
12
  children?: React.ReactNode;
13
13
  /** Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for
14
14
  * a one-off custom tone. Named tones re-point the surface, text, and border
15
- * colour (used if you opt into a border); a custom color keeps its hue while
15
+ * color (used if you opt into a border); a custom color keeps its hue while
16
16
  * lightness/chroma are pinned. `'neutral'` (the default) is the same as omitting it.
17
17
  * @defaultValue 'neutral' */
18
18
  tone?: "neutral" | "brand" | "info" | "success" | "warning" | "critical" | (string & {});
@@ -22,7 +22,7 @@ export interface BannerProps extends BaseProps {
22
22
  round?: boolean | number | string;
23
23
  /** Whether the trailing ✕ dismiss button is present. `false` removes it — drive
24
24
  * dismissal yourself (a controlled `dismissed`, or your own control) instead.
25
- * It doesn't make the banner un-dismissible, it just drops the built-in ✕.
25
+ * It removes the built-in ✕ without making the banner un-dismissible.
26
26
  * @defaultValue true */
27
27
  closable?: boolean;
28
28
  /** ARIA role for the strip host. `'status'` (a polite live region, so the notice
@@ -39,7 +39,7 @@ export interface BannerProps extends BaseProps {
39
39
  /** Initial dismissed state for the uncontrolled case (read once on mount). */
40
40
  defaultDismissed?: boolean;
41
41
  /** Fired when the user dismisses the banner (clicks ✕). Uncontrolled, the banner
42
- * hides itself and this just notifies. Controlled, it's how you accept the
42
+ * hides itself and this notifies. Controlled, use it to accept the
43
43
  * request — set `dismissed` to `true` (or ignore to reject); pair it with
44
44
  * `dismissed`, or the banner can't be closed. */
45
45
  onDismiss?: () => void;
@@ -58,7 +58,7 @@ export type ContentMode = {
58
58
  * don't carry anchor props. (Copy is no longer a Button concern — `ButtonCopy`
59
59
  * composes a `<a-copy>` child; see `copy-props.ts`.)
60
60
  *
61
- * `href` is **optional** so a conditional URL just works: `href={maybeUrl}`
61
+ * `href` is **optional**, so you can pass a conditional URL: `href={maybeUrl}`
62
62
  * (`string | undefined`) type-checks, and a falsy href degrades to a plain
63
63
  * button — a definite string renders `<a role="button">`, an absent / `undefined`
64
64
  * href renders `<a-button>`, mirroring the `href != null` runtime check. Keeping
@@ -14,8 +14,8 @@ export interface CalendarChangeAttrs {
14
14
  }
15
15
  /** Public props for `<Calendar>` — the single-date month grid. */
16
16
  export interface CalendarProps extends Omit<BaseProps, "children" | "onChange"> {
17
- /** Controlled selected date — ISO `YYYY-MM-DD`. When provided, the consumer owns
18
- * selection: the grid follows this prop and a pick only *requests* a change via
17
+ /** Controlled selected date — ISO `YYYY-MM-DD`. When provided, the application
18
+ * controls selection: the grid follows this prop and a pick only *requests* a change via
19
19
  * `onStateChange`. Leave undefined for uncontrolled. */
20
20
  value?: string;
21
21
  /** Initial selected date for the uncontrolled case (ISO `YYYY-MM-DD`). */
@@ -53,23 +53,22 @@ export interface CalendarProps extends Omit<BaseProps, "children" | "onChange">
53
53
  /** Fired *after* the selection changes (post-apply). Not cancelable; for a
54
54
  * controlled calendar it fires once you've updated `value`. */
55
55
  onChange?: (event: Event) => void;
56
- /** Like `onChange`, but with a `{ value, name }` snapshot — the ergonomic
57
- * "just give me the new date" callback (mirrors `Input`). */
56
+ /** Like `onChange`, but with a `{ value, name }` snapshot as the second argument,
57
+ * matching `Input`. */
58
58
  onValueChange?: (event: Event, attrs: CalendarChangeAttrs) => void;
59
59
  }
60
60
  /**
61
- * `<Calendar>` — a single-date month grid you pick a day from, **composed from
62
- * Anta components in light DOM** (nothing is hidden in a shadow root): days and
63
- * the prev/next chevrons are `<Button>`s, so they inherit the design system's
64
- * states for free — a selected day is literally a `tertiary` Button in its
65
- * `selected` state, toned `brand` so the active date reads in the brand color.
61
+ * `<Calendar>` is a single-date month grid. It uses Anta components in light DOM.
62
+ * Days and the previous/next chevrons are `<Button>`s, so they use the design
63
+ * system's button states. A selected day is a `tertiary` Button in its `selected`
64
+ * state, using the `brand` tone so the active date uses the brand color.
66
65
  * All date math runs on the Temporal engine
67
66
  * (`@antadesign/anta` exports `buildMonth` & friends), and the value is an ISO
68
67
  * `YYYY-MM-DD` string.
69
68
  *
70
- * The grid lives in a form-associated `<a-calendar>` element (which owns the
71
- * submitted value + reset/restore); the wrapper owns view-month, selection,
72
- * keyboard, and roving `tabindex` — the `RadioGroup` model. The month switcher
69
+ * The grid lives in a form-associated `<a-calendar>` element, which manages the
70
+ * submitted value, reset, and restore. The wrapper manages view month, selection,
71
+ * keyboard, and roving `tabindex`. The month switcher
73
72
  * is a sibling rendered *outside* the grid, so it can be extended (month/year
74
73
  * pickers) independently.
75
74
  *
@@ -93,7 +93,7 @@ export interface CardProps extends BaseProps {
93
93
  * @example Link card
94
94
  * ```tsx
95
95
  * <Card href="/docs/ci" header="CI integration guide">
96
- * Wire Antithesis into your pipeline in a few minutes.
96
+ * Connect your CI pipeline in a few minutes.
97
97
  * </Card>
98
98
  * ```
99
99
  */
@@ -75,7 +75,7 @@ const Card = ({
75
75
  /* @__PURE__ */ jsx(Text, { slot: "header", size: "small", priority: "tertiary", tone: toneAttr, children: subtitle }),
76
76
  typeof children === "string" || typeof children === "number" ? (
77
77
  // A string / number body becomes a <Text> at secondary priority (text-2,
78
- // the body colour) — stated explicitly rather than leaning on the default —
78
+ // the body color) — stated explicitly rather than leaning on the default —
79
79
  // following the card's tone and size. Anything else is a node the caller
80
80
  // owns, passed through untouched.
81
81
  /* @__PURE__ */ jsx(Text, { priority: "secondary", tone: toneAttr, size, children })
@@ -37,7 +37,7 @@ export interface CheckboxProps extends BaseProps {
37
37
  * visual precedence; clicking it requests `true`. */
38
38
  checked?: CheckboxValue;
39
39
  /** Initial checked state for an uncontrolled checkbox. Read once; later
40
- * changes ignored (the element then owns the state).
40
+ * changes are ignored and the element updates its state after interaction.
41
41
  * @defaultValue false */
42
42
  defaultChecked?: CheckboxValue;
43
43
  /** Disable the checkbox (no interaction, dropped from the tab order). */
@@ -51,16 +51,16 @@ export interface CheckboxProps extends BaseProps {
51
51
  /** Value submitted with the form when checked — like a native checkbox.
52
52
  * @defaultValue "on" */
53
53
  value?: string;
54
- /** Colour of the **mark** in every state — the checked-box fill *and* the
54
+ /** Color of the **mark** in every state — the checked-box fill *and* the
55
55
  * unselected box border. A named tone or any literal CSS color (`'#ff1493'`,
56
56
  * `'rebeccapurple'`) for a one-off custom tone. Named tones track light/dark mode
57
- * automatically; a custom colour keeps its hue + chroma and pins lightness to the
57
+ * automatically; a custom color keeps its hue + chroma and pins lightness to the
58
58
  * fill curve. Use `toneSelected` instead to tone only the checked mark and leave
59
- * the empty box neutral. The label + hint stay neutral — recolour them in plain
59
+ * the empty box neutral. The label + hint stay neutral — recolor them in plain
60
60
  * CSS via the theme-aware `--text-N-{tone}` tokens.
61
61
  * @defaultValue 'neutral' */
62
62
  tone?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
63
- /** Like `tone`, but coloured onto the **checked mark only** — the empty box stays
63
+ /** Like `tone`, but colored onto the **checked mark only** — the empty box stays
64
64
  * neutral grey until it's checked. Prefer this over `tone` when a resting tinted
65
65
  * border would read as a validation state. Same value set as `tone`; if both are
66
66
  * set, `tone` governs the off-state border and `toneSelected` the checked fill.
@@ -82,13 +82,12 @@ export interface CheckboxProps extends BaseProps {
82
82
  * checkbox this fires once you've updated `checked`. */
83
83
  onChange?: (event: Event) => void;
84
84
  /** Like `onChange`, but with a `{ checked, indeterminate, name, value }` snapshot
85
- * as the 2nd argument — the ergonomic "just give me the new value" callback
86
- * (mirrors `Input`'s `onValueChange`). */
85
+ * as the second argument, matching `Input`'s `onValueChange`. */
87
86
  onValueChange?: (event: Event, attrs: CheckboxChangeAttrs) => void;
88
87
  }
89
88
  /**
90
- * Checkbox. Renders an `<a-checkbox>` web component that owns the visual
91
- * state; controlled via `checked` + `onStateChange`, or uncontrolled via
89
+ * Checkbox. Renders an `<a-checkbox>` web component that provides visual
90
+ * state; use `checked` with `onStateChange` for controlled use, or
92
91
  * `defaultChecked`. Label is `label` (or `children`); `hint` adds secondary
93
92
  * text under the label. Requires `@antadesign/anta/elements`.
94
93
  *
@@ -18,7 +18,7 @@ export interface DialogProps extends Omit<BaseProps, "title"> {
18
18
  position?: "center" | "left" | "right" | "top" | "bottom" | "fullscreen";
19
19
  /** Whether the top-right ✕ button is present. It's one way to close the dialog,
20
20
  * alongside Esc, the backdrop, a `data-dialog-close` / footer action, and your
21
- * own code; `false` just removes the ✕, it doesn't make the dialog un-closable.
21
+ * own code; `false` removes the ✕ without making the dialog unclosable.
22
22
  * @defaultValue true */
23
23
  closable?: boolean;
24
24
  /** Turn off light-dismiss: a backdrop click and Esc no longer close the dialog.
@@ -44,10 +44,9 @@ export interface ExpanderProps extends Omit<BaseProps, "title"> {
44
44
  * `number` (px) or CSS length string for a *fixed* radius that overrides the
45
45
  * measurement (and skips it) in both states. */
46
46
  round?: boolean | number | string;
47
- /** Controlled open state. When provided, the consumer owns open/close:
48
- * the expander only follows this prop, and clicking the summary just
49
- * requests a change via `onStateChange` (so a toggle can be rejected by
50
- * not updating). Leave undefined for uncontrolled. */
47
+ /** Controlled open state. When provided, the consumer owns open/close. Selecting
48
+ * the summary requests a change through `onStateChange`; omit `open` for
49
+ * uncontrolled use. */
51
50
  open?: boolean;
52
51
  /** Initial open state for the uncontrolled case. */
53
52
  defaultOpen?: boolean;
@@ -64,12 +63,12 @@ export interface ExpanderProps extends Omit<BaseProps, "title"> {
64
63
  /**
65
64
  * `<Expander>` — a collapsible disclosure section.
66
65
  *
67
- * A pure, stateless pass-through to `<a-expander>`: the element owns all
66
+ * A pure, stateless pass-through to `<a-expander>`: the element handles all
68
67
  * interaction (toggle, keyboard, ARIA, animation), so the wrapper holds
69
68
  * no state and grabs no ref — it only maps props to attributes (safe
70
69
  * wherever the host DOM is reconciled, incl. off the UI thread).
71
70
  *
72
- * Uncontrolled (`defaultOpen`): the element owns its open state. The wrapper
71
+ * Uncontrolled (`defaultOpen`): the element updates its open state. The wrapper
73
72
  * emits `default-state="open"` — never `state` — so the DOM carries no stale
74
73
  * controlled attribute. Controlled (`open` + `onStateChange`): the wrapper
75
74
  * emits `state="open" | "closed"`; the element treats the attribute as the
@@ -19,7 +19,7 @@ export interface InputChangeAttrs {
19
19
  export interface InputProps extends BaseProps, DOMEventHandlers {
20
20
  /** Extra content rendered directly under the field, above the hint/error (it
21
21
  * pushes the message down). A no-box child like an Anta `<Tooltip>` takes no
22
- * space and just anchors to the field — consistent with how tooltips attach
22
+ * space and anchors to the field — consistent with how tooltips attach
23
23
  * to any other element. Use the named `leading` / `trailing` props for
24
24
  * in-field content. */
25
25
  children?: React.ReactNode;
@@ -41,7 +41,7 @@ export interface InputProps extends BaseProps, DOMEventHandlers {
41
41
  * success → `circle-check`, info → `info`, brand → `circle-small-solid`); pass a
42
42
  * shape to override, or `false` to drop it. `neutral` has no default glyph. */
43
43
  statusIcon?: IconShape | (string & {}) | false;
44
- /** Custom accent colour — any literal CSS colour tints the resting + hover
44
+ /** Custom accent color — any literal CSS color tints the resting + hover
45
45
  * border (focus ring stays the global `--focus-ring`). For consistency with the
46
46
  * other controls' custom-tone knob; a `status` still overrides for validation. */
47
47
  tone?: string;
@@ -92,6 +92,9 @@ export interface InputProps extends BaseProps, DOMEventHandlers {
92
92
  name?: string;
93
93
  /** Placeholder shown when empty. */
94
94
  placeholder?: string;
95
+ /** Ellipsize an overflowing single-line value. Read-only inputs already do
96
+ * this; use `truncate` when an editable field should keep the same treatment. */
97
+ truncate?: boolean;
95
98
  /** Disable the field. */
96
99
  disabled?: boolean;
97
100
  /** Make the field read-only. */
@@ -167,4 +170,4 @@ export interface InputProps extends BaseProps, DOMEventHandlers {
167
170
  * <Input label="Email" type="email" placeholder="you@example.com" clearable />
168
171
  * ```
169
172
  */
170
- export declare const Input: ({ label, hint, status, statusIcon, tone, size, round, value, defaultValue, multiline, rows, maxRows, clearable, leading, trailing, type, autoComplete, inputMode, name, placeholder, disabled, readOnly, required, dimActions, spellCheck, maxLength, minLength, pattern, min, max, step, onInput, onChange, onValueChange, onClearClick, onClearInput, children, className, style, ...rest }: InputProps) => any;
173
+ export declare const Input: ({ label, hint, status, statusIcon, tone, size, round, value, defaultValue, multiline, rows, maxRows, clearable, leading, trailing, type, autoComplete, inputMode, name, placeholder, truncate, disabled, readOnly, required, dimActions, spellCheck, maxLength, minLength, pattern, min, max, step, onInput, onChange, onValueChange, onClearClick, onClearInput, children, className, style, ...rest }: InputProps) => any;
@@ -51,6 +51,7 @@ const Input = ({
51
51
  inputMode,
52
52
  name,
53
53
  placeholder,
54
+ truncate,
54
55
  disabled,
55
56
  readOnly,
56
57
  required,
@@ -93,6 +94,7 @@ const Input = ({
93
94
  type: !multiline && rows == null ? nativeType : void 0,
94
95
  name,
95
96
  placeholder,
97
+ truncate: presence(truncate),
96
98
  disabled: presence(disabled),
97
99
  readonly: presence(readOnly),
98
100
  required: presence(required),
@@ -124,7 +126,7 @@ const Input = ({
124
126
  label != null && (isStringish(label) ? /* @__PURE__ */ jsx("span", { slot: "label", children: label }) : /* @__PURE__ */ jsx("span", { slot: "label", style: { display: "contents" }, children: label })),
125
127
  resolvedLeading != null && /* @__PURE__ */ jsx("span", { slot: "leading", style: { display: "contents" }, children: resolvedLeading }),
126
128
  resolvedClearable && // A real <a-button> (light DOM → fully styled, keyboard-focusable) in
127
- // the element's `clear` slot — the element owns its visibility (shown
129
+ // the element's `clear` slot — the element controls its visibility (shown
128
130
  // only when filled + editable). It fires the bubbling `clearrequest`
129
131
  // event via a-button's global listener, so clearing works even without
130
132
  // framework hydration; the element turns that into clearclick→clear().
@@ -8,7 +8,7 @@ export interface InputAutocompleteProps extends Omit<BaseProps, 'children'> {
8
8
  /** Controlled value: the field's text, a **free** string not constrained to a
9
9
  * suggestion. Leave undefined for uncontrolled. */
10
10
  value?: string;
11
- /** Initial value for the uncontrolled case (the wrapper then owns it). */
11
+ /** Initial value for uncontrolled use. */
12
12
  defaultValue?: string;
13
13
  /** Fires as the text changes (typing, picking a suggestion, or clearing) with
14
14
  * the new field text. */
@@ -17,8 +17,8 @@ export interface InputAutocompleteProps extends Omit<BaseProps, 'children'> {
17
17
  onSelect?: (option: SelectOption) => void;
18
18
  /** How suggestions match the text. `true` uses the built-in case-insensitive
19
19
  * substring match on `value` / `label` / `hint`; a function `(option, query) =>
20
- * boolean` does custom matching; `false` shows `suggestions` verbatim so you
21
- * can filter them yourself (async / remote).
20
+ * boolean` uses a custom matcher; `false` shows `suggestions` unchanged for
21
+ * application-provided async or remote filtering.
22
22
  * @defaultValue true */
23
23
  filter?: boolean | ((option: SelectOption, query: string) => boolean);
24
24
  /** Placeholder text. */
@@ -30,7 +30,7 @@ export interface InputAutocompleteProps extends Omit<BaseProps, 'children'> {
30
30
  status?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
31
31
  /** Status icon override, or `false` to drop it. */
32
32
  statusIcon?: IconShape | (string & {}) | false;
33
- /** Custom accent colour — a named tone or any CSS colour. */
33
+ /** Custom accent color — a named tone or any CSS color. */
34
34
  tone?: string;
35
35
  /** Show a clear button while the field has text. */
36
36
  clearable?: boolean;
@@ -48,10 +48,10 @@ export interface InputAutocompleteProps extends Omit<BaseProps, 'children'> {
48
48
  trailing?: React.ReactNode;
49
49
  }
50
50
  /**
51
- * `<InputAutocomplete>` — a text field whose value is a free string, with a
52
- * suggestion dropdown that assists without constraining. Typing something not in
53
- * the list is valid and stays the value; picking a suggestion just fills the
54
- * field. For a value that MUST be one of the options, use `Select` with `filter`.
51
+ * `<InputAutocomplete>` is a text field with a suggestion dropdown. Its value is
52
+ * a free-form string. Text not in the list remains valid, and choosing a
53
+ * suggestion fills the field. Use `Select` with `filter` when the value must be
54
+ * one of the options.
55
55
  *
56
56
  * Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
57
57
  * Requires `@antadesign/anta/elements` (client-side only).
@@ -0,0 +1 @@
1
+ @layer anta{a-input-date-time-container{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:6px;padding-top:8px;border-top:1px solid var(--border-3)}}
@@ -1,6 +1,7 @@
1
1
  import type { BaseProps } from '../general_types';
2
2
  import type { IconShape } from '../elements/a-icon.shapes';
3
3
  import { type MenuProps } from './Menu';
4
+ import './InputDate.css';
4
5
  /** Snapshot passed as the 2nd argument to `onValueChange` — the new ISO value
5
6
  * (`''` when cleared) plus the field name (mirrors `Input` / `Calendar`). */
6
7
  export interface InputDateChangeAttrs {