@antadesign/anta 0.3.26 → 0.3.27

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 (69) hide show
  1. package/README.md +26 -28
  2. package/dist/anta_helpers.d.ts +4 -0
  3. package/dist/anta_helpers.js +14 -0
  4. package/dist/box-types.d.ts +1 -1
  5. package/dist/bundle.css +1 -1
  6. package/dist/bundle.js +25 -25
  7. package/dist/capture-types.d.ts +156 -0
  8. package/dist/capture-types.js +0 -0
  9. package/dist/components/Box.d.ts +15 -0
  10. package/dist/components/Box.js +3 -11
  11. package/dist/components/Capture.d.ts +39 -0
  12. package/dist/components/Capture.js +36 -0
  13. package/dist/components/capture-props.d.ts +30 -0
  14. package/dist/components/capture-props.js +44 -0
  15. package/dist/elements/a-box.d.ts +1 -1
  16. package/dist/elements/a-box.js +11 -3
  17. package/dist/elements/a-capture.css +1 -0
  18. package/dist/elements/a-capture.d.ts +10 -0
  19. package/dist/elements/a-capture.js +24 -0
  20. package/dist/elements/a-checkbox.js +4 -4
  21. package/dist/elements/a-slider.js +6 -6
  22. package/dist/elements/capture-input.d.ts +5 -0
  23. package/dist/elements/capture-input.js +609 -0
  24. package/dist/elements/index.d.ts +1 -0
  25. package/dist/elements/index.js +3 -0
  26. package/dist/general_types.d.ts +34 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +2 -0
  29. package/dist/jsx-runtime.d.ts +2 -1
  30. package/docs/accessibility.md +24 -0
  31. package/docs/changelog.md +22 -0
  32. package/docs/colors.md +141 -0
  33. package/docs/comparison.md +463 -28
  34. package/docs/components/avatar.md +13 -17
  35. package/docs/components/banner.md +13 -27
  36. package/docs/components/box.md +226 -154
  37. package/docs/components/breadcrumbs.md +7 -6
  38. package/docs/components/button.md +48 -37
  39. package/docs/components/capture.md +345 -0
  40. package/docs/components/card.md +17 -38
  41. package/docs/components/checkbox.md +16 -39
  42. package/docs/components/dialog.md +14 -36
  43. package/docs/components/expander.md +15 -40
  44. package/docs/components/icon.md +111 -9
  45. package/docs/components/input-autocomplete.md +9 -11
  46. package/docs/components/input-date.md +33 -23
  47. package/docs/components/input-time.md +15 -23
  48. package/docs/components/input.md +27 -76
  49. package/docs/components/loader.md +7 -5
  50. package/docs/components/menu.md +73 -77
  51. package/docs/components/progress.md +10 -14
  52. package/docs/components/radio.md +17 -36
  53. package/docs/components/select-faceted.md +7 -25
  54. package/docs/components/select.md +24 -97
  55. package/docs/components/slider.md +16 -21
  56. package/docs/components/steps.md +38 -8
  57. package/docs/components/switch.md +11 -14
  58. package/docs/components/tabs.md +52 -40
  59. package/docs/components/tag.md +11 -22
  60. package/docs/components/text.md +10 -23
  61. package/docs/components/title.md +7 -8
  62. package/docs/components/toaster.md +6 -3
  63. package/docs/components/tooltip.md +13 -23
  64. package/docs/index.md +3 -1
  65. package/docs/install-config.md +24 -0
  66. package/docs/normalization.md +45 -0
  67. package/docs/packages/stickers.md +56 -0
  68. package/docs/theming.md +270 -0
  69. package/package.json +3 -1
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
- 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/
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
- When working with Anta components:
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
- 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.
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.
@@ -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
@@ -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) {
@@ -160,6 +172,8 @@ export {
160
172
  SelectableChildElement,
161
173
  anchorRect,
162
174
  cssLength,
175
+ customEventHandler,
176
+ finiteNumber,
163
177
  hasChildren,
164
178
  installDismissTrigger,
165
179
  isInsideOpenMenu,
@@ -152,7 +152,7 @@ export interface BoxMeasurement {
152
152
  hiddenStartY: boolean;
153
153
  hiddenEndY: boolean;
154
154
  }
155
- /** Every Box event includes just the changed fields and a complete current snapshot. */
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;