@antadesign/anta 0.3.26 → 0.3.28
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 +26 -28
- package/dist/anta_helpers.d.ts +8 -0
- package/dist/anta_helpers.js +18 -0
- package/dist/box-types.d.ts +1 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +36 -42
- package/dist/capture-types.d.ts +156 -0
- package/dist/components/Banner.js +2 -2
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Box.js +3 -11
- package/dist/components/Button.js +2 -2
- package/dist/components/Capture.d.ts +39 -0
- package/dist/components/Capture.js +36 -0
- package/dist/components/Card.js +2 -2
- package/dist/components/Checkbox.d.ts +10 -11
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/Expander.js +2 -2
- package/dist/components/Input.js +2 -2
- package/dist/components/InputTime.js +2 -2
- package/dist/components/Loader.js +2 -1
- package/dist/components/MenuItem.d.ts +7 -8
- package/dist/components/MenuItem.js +4 -4
- package/dist/components/Progress.js +2 -2
- package/dist/components/RadioGroup.d.ts +12 -13
- package/dist/components/RadioGroup.js +7 -23
- package/dist/components/Select.d.ts +12 -7
- package/dist/components/Select.js +4 -3
- package/dist/components/SelectFaceted.d.ts +7 -5
- package/dist/components/SelectFaceted.js +4 -3
- package/dist/components/Slider.js +3 -3
- package/dist/components/Steps.css +1 -1
- package/dist/components/Switch.d.ts +7 -8
- package/dist/components/Switch.js +3 -11
- package/dist/components/Tabs.js +2 -2
- package/dist/components/Tag.d.ts +7 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.js +2 -2
- package/dist/components/Title.js +2 -2
- package/dist/components/capture-props.d.ts +30 -0
- package/dist/components/capture-props.js +44 -0
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-box.d.ts +1 -1
- package/dist/elements/a-box.js +11 -3
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +7 -9
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-capture.css +1 -0
- package/dist/elements/a-capture.d.ts +10 -0
- package/dist/elements/a-capture.js +24 -0
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.js +4 -4
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +5 -7
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +4 -6
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.js +6 -9
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-text.js +1 -0
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +3 -4
- package/dist/elements/a-tooltip.js +0 -1
- package/dist/elements/capture-input.d.ts +5 -0
- package/dist/elements/capture-input.js +609 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +56 -23
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +1 -0
- package/dist/theme-antune.css +1 -0
- package/dist/tokens.css +1 -1
- package/docs/accessibility.md +24 -0
- package/docs/changelog.md +79 -0
- package/docs/colors.md +141 -0
- package/docs/comparison.md +463 -28
- package/docs/components/avatar.md +13 -17
- package/docs/components/banner.md +13 -27
- package/docs/components/box.md +226 -154
- package/docs/components/breadcrumbs.md +49 -12
- package/docs/components/button.md +48 -37
- package/docs/components/capture.md +345 -0
- package/docs/components/card.md +17 -38
- package/docs/components/checkbox.md +27 -50
- package/docs/components/dialog.md +14 -36
- package/docs/components/expander.md +15 -40
- package/docs/components/icon.md +111 -9
- package/docs/components/input-autocomplete.md +9 -11
- package/docs/components/input-date.md +33 -23
- package/docs/components/input-time.md +15 -23
- package/docs/components/input.md +27 -76
- package/docs/components/loader.md +7 -5
- package/docs/components/menu.md +75 -80
- package/docs/components/progress.md +10 -14
- package/docs/components/radio.md +28 -46
- package/docs/components/select-faceted.md +8 -25
- package/docs/components/select.md +33 -105
- package/docs/components/slider.md +16 -21
- package/docs/components/steps.md +38 -8
- package/docs/components/switch.md +16 -19
- package/docs/components/tabs.md +52 -40
- package/docs/components/tag.md +15 -24
- package/docs/components/text.md +10 -23
- package/docs/components/title.md +7 -8
- package/docs/components/toaster.md +6 -3
- package/docs/components/tooltip.md +13 -23
- package/docs/index.md +3 -1
- package/docs/install-config.md +42 -8
- package/docs/normalization.md +48 -3
- package/docs/packages/stickers.md +56 -0
- package/docs/theming.md +362 -14
- package/package.json +7 -4
- package/dist/components/InputDate.module.css +0 -1
- package/dist/components/Select.module.css +0 -1
- package/dist/components/SelectFaceted.module.css +0 -1
- package/dist/theme-anta.css +0 -1
- /package/dist/{search-index.json → capture-types.js} +0 -0
package/README.md
CHANGED
|
@@ -7,34 +7,32 @@ components in React, Preact via compat, plain HTML, and custom JSX runtimes via
|
|
|
7
7
|
|
|
8
8
|
## Documentation for coding agents
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
│ ├── button.md
|
|
29
|
-
│ ├── dialog.md
|
|
30
|
-
│ └── ...
|
|
31
|
-
└── dist/
|
|
10
|
+
The package includes version-matched Markdown documentation. Start with the
|
|
11
|
+
[documentation index](./docs/index.md) and open the pages relevant to your task.
|
|
12
|
+
Agents with filesystem access can read these files offline.
|
|
13
|
+
|
|
14
|
+
### AI setup
|
|
15
|
+
|
|
16
|
+
Append this section to your application's agent instruction file, such as
|
|
17
|
+
`AGENTS.md`, `CLAUDE.md`, or your tool's equivalent. Keep existing project rules:
|
|
18
|
+
|
|
19
|
+
```md
|
|
20
|
+
## Anta
|
|
21
|
+
|
|
22
|
+
Before Anta UI work, read
|
|
23
|
+
`node_modules/@antadesign/anta/docs/index.md`
|
|
24
|
+
and the pages relevant to the task.
|
|
25
|
+
Verify component names, imports, props, and event signatures against the
|
|
26
|
+
installed documentation and TypeScript declarations. Do not infer Anta APIs
|
|
27
|
+
from similarly named components in other libraries.
|
|
32
28
|
```
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
The path is relative to the application directory where Anta is installed.
|
|
31
|
+
Adjust it for your workspace or package-manager layout. Installing Anta does
|
|
32
|
+
not modify your agent configuration.
|
|
33
|
+
|
|
34
|
+
If a documented type differs from the installed `.d.ts` declarations, use the
|
|
35
|
+
declarations for the installed API.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
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.
|
|
37
|
+
For tools without local file access, provide the [web documentation index](https://anta.design/llms.txt)
|
|
38
|
+
and your installed Anta version. Web documentation may describe a newer release.
|
package/dist/anta_helpers.d.ts
CHANGED
|
@@ -53,6 +53,10 @@ export declare function nativeStateChange<D>(e: StateChangeEvent<D>): {
|
|
|
53
53
|
detail?: D;
|
|
54
54
|
isOwn: boolean;
|
|
55
55
|
};
|
|
56
|
+
/** Adapt a callback to native or renderer-wrapped custom events with non-null detail. */
|
|
57
|
+
export declare function customEventHandler<D>(handler?: (event: CustomEvent<D>, detail: D) => void): ((input: StateChangeEvent<D>) => void) | undefined;
|
|
58
|
+
/** Parse a finite number, falling back for missing, empty, or invalid values. */
|
|
59
|
+
export declare function finiteNumber(value: string | number | null, fallback: number): number;
|
|
56
60
|
export declare const IS_MAC: boolean;
|
|
57
61
|
/** Default row hint teaching the Alt/⌥-click "select only this" accelerator on
|
|
58
62
|
* bulk-select rows (`Select` multiple, `SelectFaceted` multiple facets). Shared
|
|
@@ -76,6 +80,10 @@ export declare function installDismissTrigger(host: HTMLElement, attr: string, o
|
|
|
76
80
|
/** The six named tones every toned component shares. Anything else is a literal
|
|
77
81
|
* CSS color the element resolves through its `--{component}-tone-source` var. */
|
|
78
82
|
export declare const NAMED_TONES: Set<string>;
|
|
83
|
+
/** Omits the neutral default from JSX-generated DOM. Use only where an absent
|
|
84
|
+
* tone is equivalent to neutral; per-child tones keep an explicit `neutral`
|
|
85
|
+
* value when it resets an inherited group tone. */
|
|
86
|
+
export declare function neutralToneAttr<T extends string>(tone: T | undefined): T | undefined;
|
|
79
87
|
/**
|
|
80
88
|
* Inline-style helper for a custom (non-named) tone: hands the literal color to
|
|
81
89
|
* the element via `varName` (e.g. `--radio-tone-source`) so the element's CSS
|
package/dist/anta_helpers.js
CHANGED
|
@@ -24,6 +24,18 @@ function nativeStateChange(e) {
|
|
|
24
24
|
const event = "nativeEvent" in e ? e.nativeEvent : e;
|
|
25
25
|
return { event, detail: event?.detail, isOwn: !event || event.target === event.currentTarget };
|
|
26
26
|
}
|
|
27
|
+
function customEventHandler(handler) {
|
|
28
|
+
if (!handler) return void 0;
|
|
29
|
+
return (input) => {
|
|
30
|
+
const { event, detail } = nativeStateChange(input);
|
|
31
|
+
if (detail != null) handler(event, detail);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function finiteNumber(value, fallback) {
|
|
35
|
+
if (value == null || value === "") return fallback;
|
|
36
|
+
const number = Number(value);
|
|
37
|
+
return Number.isFinite(number) ? number : fallback;
|
|
38
|
+
}
|
|
27
39
|
const IS_MAC = typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.userAgent || "");
|
|
28
40
|
const ISOLATE_HINT = IS_MAC ? "\u2325+Click to select only this" : "Alt+Click to select only this";
|
|
29
41
|
function parseOpenState(v) {
|
|
@@ -45,6 +57,9 @@ const NAMED_TONES = /* @__PURE__ */ new Set([
|
|
|
45
57
|
"warning",
|
|
46
58
|
"critical"
|
|
47
59
|
]);
|
|
60
|
+
function neutralToneAttr(tone) {
|
|
61
|
+
return tone && tone !== "neutral" ? tone : void 0;
|
|
62
|
+
}
|
|
48
63
|
function toneStyle(tone, varName, base) {
|
|
49
64
|
return tone != null && !NAMED_TONES.has(tone) ? { ...base, [varName]: tone } : base;
|
|
50
65
|
}
|
|
@@ -160,12 +175,15 @@ export {
|
|
|
160
175
|
SelectableChildElement,
|
|
161
176
|
anchorRect,
|
|
162
177
|
cssLength,
|
|
178
|
+
customEventHandler,
|
|
179
|
+
finiteNumber,
|
|
163
180
|
hasChildren,
|
|
164
181
|
installDismissTrigger,
|
|
165
182
|
isInsideOpenMenu,
|
|
166
183
|
isMenuOpen,
|
|
167
184
|
lengthStyle,
|
|
168
185
|
nativeStateChange,
|
|
186
|
+
neutralToneAttr,
|
|
169
187
|
optionPresentationAttrs,
|
|
170
188
|
parseOpenState,
|
|
171
189
|
roundAttr,
|
package/dist/box-types.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ export interface BoxMeasurement {
|
|
|
152
152
|
hiddenStartY: boolean;
|
|
153
153
|
hiddenEndY: boolean;
|
|
154
154
|
}
|
|
155
|
-
/**
|
|
155
|
+
/** Box observation events include changed fields and a complete current snapshot. */
|
|
156
156
|
export interface BoxChange<T> {
|
|
157
157
|
changed: Partial<T>;
|
|
158
158
|
current: T;
|