@antadesign/anta 0.3.2 → 0.3.4

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 (96) hide show
  1. package/dist/anta_helpers.d.ts +97 -0
  2. package/dist/anta_helpers.js +70 -0
  3. package/dist/calendar-core.d.ts +126 -0
  4. package/dist/calendar-core.js +289 -0
  5. package/dist/components/Button.d.ts +9 -1
  6. package/dist/components/Button.js +5 -2
  7. package/dist/components/Calendar.d.ts +85 -0
  8. package/dist/components/Calendar.js +226 -0
  9. package/dist/components/Checkbox.d.ts +16 -11
  10. package/dist/components/Checkbox.js +13 -7
  11. package/dist/components/Expander.d.ts +7 -1
  12. package/dist/components/Expander.js +4 -2
  13. package/dist/components/Input.d.ts +13 -5
  14. package/dist/components/Input.js +14 -6
  15. package/dist/components/InputDate.d.ts +89 -0
  16. package/dist/components/InputDate.js +273 -0
  17. package/dist/components/InputDate.module.css +1 -0
  18. package/dist/components/Menu.d.ts +14 -1
  19. package/dist/components/Menu.js +6 -2
  20. package/dist/components/MenuItem.d.ts +48 -7
  21. package/dist/components/MenuItem.js +72 -14
  22. package/dist/components/MenuSeparator.d.ts +13 -2
  23. package/dist/components/MenuSeparator.js +12 -2
  24. package/dist/components/Progress.d.ts +4 -1
  25. package/dist/components/Progress.js +4 -3
  26. package/dist/components/RadioGroup.d.ts +12 -10
  27. package/dist/components/RadioGroup.js +5 -5
  28. package/dist/components/Select.d.ts +319 -0
  29. package/dist/components/Select.js +341 -0
  30. package/dist/components/Select.module.css +1 -0
  31. package/dist/components/Tab.d.ts +3 -0
  32. package/dist/components/Tab.js +2 -1
  33. package/dist/components/TabPanel.d.ts +21 -13
  34. package/dist/components/TabPanel.js +13 -1
  35. package/dist/components/Tabs.d.ts +75 -40
  36. package/dist/components/Tabs.js +20 -88
  37. package/dist/components/Tag.d.ts +10 -9
  38. package/dist/components/Tag.js +2 -2
  39. package/dist/components/Text.d.ts +6 -5
  40. package/dist/components/Title.d.ts +4 -2
  41. package/dist/components/Tooltip.d.ts +4 -1
  42. package/dist/components/Tooltip.js +5 -0
  43. package/dist/elements/a-button.css +1 -1
  44. package/dist/elements/a-calendar.css +1 -0
  45. package/dist/elements/a-calendar.d.ts +76 -0
  46. package/dist/elements/a-calendar.js +190 -0
  47. package/dist/elements/a-checkbox.css +1 -1
  48. package/dist/elements/a-checkbox.d.ts +1 -2
  49. package/dist/elements/a-checkbox.js +5 -5
  50. package/dist/elements/a-expander.css +1 -1
  51. package/dist/elements/a-expander.d.ts +16 -5
  52. package/dist/elements/a-expander.js +59 -8
  53. package/dist/elements/a-icon.shapes.css +1 -1
  54. package/dist/elements/a-icon.shapes.d.ts +6 -1
  55. package/dist/elements/a-icon.shapes.js +9 -0
  56. package/dist/elements/a-input.css +1 -1
  57. package/dist/elements/a-input.d.ts +6 -0
  58. package/dist/elements/a-input.js +28 -8
  59. package/dist/elements/a-menu-group.css +1 -1
  60. package/dist/elements/a-menu-item.css +1 -1
  61. package/dist/elements/a-menu-item.d.ts +22 -10
  62. package/dist/elements/a-menu-item.js +17 -0
  63. package/dist/elements/a-menu-separator.css +1 -1
  64. package/dist/elements/a-menu.css +1 -1
  65. package/dist/elements/a-menu.d.ts +61 -20
  66. package/dist/elements/a-menu.js +337 -58
  67. package/dist/elements/a-progress.css +1 -1
  68. package/dist/elements/a-radio-group.d.ts +1 -3
  69. package/dist/elements/a-radio-group.js +13 -13
  70. package/dist/elements/a-radio.css +1 -1
  71. package/dist/elements/a-radio.d.ts +3 -11
  72. package/dist/elements/a-radio.js +3 -34
  73. package/dist/elements/a-tab.css +1 -1
  74. package/dist/elements/a-tab.d.ts +3 -11
  75. package/dist/elements/a-tab.js +3 -34
  76. package/dist/elements/a-tabpanel.css +1 -1
  77. package/dist/elements/a-tabpanel.d.ts +17 -0
  78. package/dist/elements/a-tabpanel.js +66 -0
  79. package/dist/elements/a-tabs.css +1 -1
  80. package/dist/elements/a-tabs.d.ts +1 -4
  81. package/dist/elements/a-tabs.js +14 -14
  82. package/dist/elements/a-tag.css +1 -1
  83. package/dist/elements/a-text.d.ts +14 -13
  84. package/dist/elements/a-text.js +53 -23
  85. package/dist/elements/a-tooltip.css +1 -1
  86. package/dist/elements/a-tooltip.d.ts +1 -11
  87. package/dist/elements/a-tooltip.js +20 -19
  88. package/dist/elements/index.d.ts +2 -1
  89. package/dist/elements/index.js +6 -1
  90. package/dist/general_types.d.ts +158 -42
  91. package/dist/index.d.ts +10 -4
  92. package/dist/index.js +38 -3
  93. package/dist/jsx-runtime.d.ts +16 -7
  94. package/dist/jsx-runtime.js +6 -0
  95. package/dist/reset.css +1 -1
  96. package/package.json +4 -2
@@ -1,6 +1,16 @@
1
1
  import { jsx } from "@antadesign/anta/jsx-runtime";
2
- const MenuSeparator = ({ className, ...rest }) => {
3
- return /* @__PURE__ */ jsx("a-menu-separator", { role: "separator", class: className, ...rest });
2
+ const MenuSeparator = ({ className, children, ...rest }) => {
3
+ const hasContent = !!children && !(typeof children === "string" && children.trim() === "");
4
+ return /* @__PURE__ */ jsx(
5
+ "a-menu-separator",
6
+ {
7
+ role: hasContent ? "status" : "separator",
8
+ "aria-live": hasContent ? "polite" : void 0,
9
+ class: className,
10
+ ...rest,
11
+ children: hasContent ? children : null
12
+ }
13
+ );
4
14
  };
5
15
  export {
6
16
  MenuSeparator
@@ -10,6 +10,9 @@ export interface ProgressProps extends BaseProps {
10
10
  * light/dark automatically.
11
11
  * @defaultValue 'neutral' */
12
12
  tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
13
+ /** Fully-round track (`border-radius: 999px`); the fill is clipped to it. Pass a
14
+ * `number` (px) or a CSS length string for a custom radius. */
15
+ round?: boolean | number | string;
13
16
  /** Text label displayed after the percentage. When you provide custom
14
17
  * `children` (which replace the default label row), `label` is no longer
15
18
  * rendered — but it still supplies the progressbar's accessible name, so
@@ -46,4 +49,4 @@ export interface ProgressProps extends BaseProps {
46
49
  * <Progress value={75} tone="info" label="Processing" />
47
50
  * ```
48
51
  */
49
- export declare const Progress: ({ value, max, tone, label, hint, className, style, children, ...rest }: ProgressProps) => any;
52
+ export declare const Progress: ({ value, max, tone, round, label, hint, className, style, children, ...rest }: ProgressProps) => any;
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
2
- import { hasChildren, toneStyle } from "../anta_helpers";
3
- const Progress = ({ value, max = 100, tone, label, hint, className, style, children, ...rest }) => {
2
+ import { hasChildren, toneStyle, roundStyle } from "../anta_helpers";
3
+ const Progress = ({ value, max = 100, tone, round, label, hint, className, style, children, ...rest }) => {
4
4
  const percent = max > 0 ? Math.round(Math.min(100, Math.max(0, value / max * 100))) : 0;
5
5
  const clampedValue = max > 0 ? Math.min(max, Math.max(0, value)) : 0;
6
6
  const ariaLabel = [label, `${percent}%`, hint].filter(Boolean).join(" \xB7 ") || void 0;
@@ -10,13 +10,14 @@ const Progress = ({ value, max = 100, tone, label, hint, className, style, child
10
10
  value,
11
11
  max,
12
12
  tone: tone && tone !== "neutral" ? tone : void 0,
13
+ round: round ? "" : void 0,
13
14
  role: "progressbar",
14
15
  "aria-valuenow": clampedValue,
15
16
  "aria-valuemin": 0,
16
17
  "aria-valuemax": max,
17
18
  "aria-label": ariaLabel,
18
19
  class: className,
19
- style: toneStyle(tone, "--progress-tone-source", style),
20
+ style: roundStyle(round, "--progress-round", toneStyle(tone, "--progress-tone-source", style)),
20
21
  ...rest,
21
22
  children: hasChildren(children) ? children : /* @__PURE__ */ jsxs("a-progress-label", { children: [
22
23
  /* @__PURE__ */ jsxs("a-progress-number", { children: [
@@ -27,8 +27,8 @@ export interface RadioOption {
27
27
  disabled?: boolean;
28
28
  /** Override this one option's mark tone (defaults to the group's `tone`). */
29
29
  tone?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
30
- /** Override this one option's text tone (defaults to the group's `toneText`). */
31
- toneText?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
30
+ /** Override this one option's `toneSelected` (defaults to the group's). */
31
+ toneSelected?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
32
32
  /** Override this one option's size (defaults to the group's `size`). */
33
33
  size?: "small" | "medium" | "large";
34
34
  }
@@ -79,16 +79,18 @@ export interface RadioGroupProps extends Omit<BaseProps, "children" | "onChange"
79
79
  * @defaultValue 'neutral' */
80
80
  status?: "neutral" | "brand" | "info" | "success" | "warning" | "critical";
81
81
  /** Mark tone applied to every option (an option's own `tone` wins), or any literal
82
- * CSS color for a one-off custom tone. Colours the selected-ring fill + dot and
83
- * the unselected ring border. Named tones track light/dark mode. The option text
84
- * stays neutral use `toneText` for that.
82
+ * CSS color for a one-off custom tone. Colours the selected-ring fill + dot *and*
83
+ * the unselected ring border. Named tones track light/dark mode. Use `toneSelected`
84
+ * instead to tone only the selected option and leave the rest neutral. The option
85
+ * text stays neutral — recolour it in plain CSS via the `--text-N-{tone}` tokens.
85
86
  * @defaultValue 'neutral' */
86
87
  tone?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
87
- /** Text tone applied to every option's label + hint (an option's own `toneText`
88
- * wins), independent of `tone`. A named tone or any literal CSS color. Omit to
89
- * leave the text neutral.
88
+ /** Like `tone`, but coloured onto the **selected option only** every unselected
89
+ * ring stays neutral grey. Applied to every option (an option's own `toneSelected`
90
+ * wins). Prefer this over `tone` when a resting tinted border would read as a
91
+ * validation state.
90
92
  * @defaultValue 'neutral' */
91
- toneText?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
93
+ toneSelected?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
92
94
  /** Size applied to every option (an option's own `size` wins).
93
95
  * @defaultValue 'medium' */
94
96
  size?: "small" | "medium" | "large";
@@ -115,5 +117,5 @@ export interface RadioGroupProps extends Omit<BaseProps, "children" | "onChange"
115
117
  *
116
118
  * Requires `@antadesign/anta/elements` (client-side only).
117
119
  */
118
- export declare const RadioGroup: ({ options, value, defaultValue, onStateChange, onChange, onValueChange, onFocus, onBlur, name, label, hint, status, tone, toneText, size, disabled, orientation, className, style, ...rest }: RadioGroupProps) => any;
120
+ export declare const RadioGroup: ({ options, value, defaultValue, onStateChange, onChange, onValueChange, onFocus, onBlur, name, label, hint, status, tone, toneSelected, size, disabled, orientation, className, style, ...rest }: RadioGroupProps) => any;
119
121
  export {};
@@ -19,7 +19,7 @@ const RadioGroup = ({
19
19
  hint,
20
20
  status,
21
21
  tone,
22
- toneText,
22
+ toneSelected,
23
23
  size,
24
24
  disabled,
25
25
  orientation,
@@ -64,7 +64,7 @@ const RadioGroup = ({
64
64
  name,
65
65
  status: status && status !== "neutral" ? status : void 0,
66
66
  tone: tone && tone !== "neutral" ? tone : void 0,
67
- "tone-text": toneText && toneText !== "neutral" ? toneText : void 0,
67
+ "tone-selected": toneSelected && toneSelected !== "neutral" ? toneSelected : void 0,
68
68
  size: size && size !== "medium" ? size : void 0,
69
69
  disabled: disabled ? "" : void 0,
70
70
  orientation: orientation && orientation !== "vertical" ? orientation : void 0,
@@ -73,7 +73,7 @@ const RadioGroup = ({
73
73
  onfocusin: onFocus,
74
74
  onfocusout: onBlur,
75
75
  class: className,
76
- style: toneStyle(toneText, "--radio-tone-text-source", toneStyle(tone, "--radio-tone-source", style)),
76
+ style: toneStyle(toneSelected, "--radio-tone-source", toneStyle(tone, "--radio-tone-source", style)),
77
77
  children: [
78
78
  label && /* @__PURE__ */ jsx("a-radio-group-label", { id: labelId, children: label }),
79
79
  hint && /* @__PURE__ */ jsx("a-radio-group-hint", { id: hintId, children: hint }),
@@ -87,10 +87,10 @@ const RadioGroup = ({
87
87
  "aria-disabled": optDisabled ? "true" : void 0,
88
88
  tabIndex: o.value === tabStopValue ? 0 : -1,
89
89
  tone: o.tone && o.tone !== "neutral" ? o.tone : void 0,
90
- "tone-text": o.toneText && o.toneText !== "neutral" ? o.toneText : void 0,
90
+ "tone-selected": o.toneSelected && o.toneSelected !== "neutral" ? o.toneSelected : void 0,
91
91
  size: o.size && o.size !== "medium" ? o.size : void 0,
92
92
  disabled: o.disabled ? "" : void 0,
93
- style: toneStyle(o.toneText, "--radio-tone-text-source", toneStyle(o.tone, "--radio-tone-source")),
93
+ style: toneStyle(o.toneSelected, "--radio-tone-source", toneStyle(o.tone, "--radio-tone-source")),
94
94
  children: [
95
95
  /* @__PURE__ */ jsx("a-radio-label", { children: o.label }),
96
96
  o.hint != null && /* @__PURE__ */ jsx("a-radio-hint", { children: o.hint })
@@ -0,0 +1,319 @@
1
+ import type { BaseProps } from '../general_types';
2
+ import type { IconShape } from '../elements/a-icon.shapes';
3
+ /** One option in a `<Select>`. Pass a bare string as shorthand for
4
+ * `{ value: s, label: s }`. Carries an index signature so you can attach
5
+ * arbitrary fields (a `ranAt` date, a `status`, …) and read them back in
6
+ * `renderOption`; the built-in filter still matches on `value`/`label`/`hint`. */
7
+ export interface SelectOption {
8
+ /** The option's value — its identity, what `value` / `defaultValue` name, and what
9
+ * `onValueChange` reports. Unique across the whole `options` tree (selection is
10
+ * value-keyed and global across groups / submenus). */
11
+ value: string;
12
+ /** Visible label. Defaults to `value`. */
13
+ label?: string;
14
+ /** Secondary text under the label (the option row's `hint`). */
15
+ hint?: string;
16
+ /** Leading icon (renders after the selection indicator, if any). */
17
+ icon?: IconShape;
18
+ /** Disable just this option. */
19
+ disabled?: boolean;
20
+ /** Tone for this option's row (label, icon, hint, selected tint, and the
21
+ * checkbox/radio indicator). A named tone or a custom CSS color. */
22
+ tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
23
+ /** Tooltip for this option's row — a string or any node. In a `multiple`
24
+ * select with `selectAll`, a row with no `tooltip` falls back to a default
25
+ * hint for the Alt/Option-click "select only this" accelerator; set `tooltip`
26
+ * to override that, or `''` to suppress it. */
27
+ tooltip?: React.ReactNode;
28
+ /** Your own data — attach anything and read it in `renderOption`. */
29
+ [key: string]: unknown;
30
+ }
31
+ /** A titled group of options rendered **inline** under a heading (like `MenuGroup`).
32
+ * Selection stays global — a group only organizes; its heading isn't selectable.
33
+ * `disabled` cascades to every descendant. Nest groups / submenus freely. */
34
+ export interface SelectGroup {
35
+ /** The section heading (non-interactive). */
36
+ label: string;
37
+ /** The grouped items — options, or further groups / submenus. */
38
+ options: SelectItem[];
39
+ /** Disable the whole group (cascades to all descendants). */
40
+ disabled?: boolean;
41
+ }
42
+ /** A titled branch whose items live behind a **flyout** (like `MenuItem submenu`).
43
+ * Navigation only — the parent row opens the submenu and is never itself selectable.
44
+ * While a filter query is active the tree flattens and a submenu collapses into a
45
+ * group (its `label` becomes the heading). `disabled` cascades to descendants. */
46
+ export interface SelectSubmenu {
47
+ /** The parent row's label — and the group heading when filtering flattens it. */
48
+ label: string;
49
+ /** Leading icon on the parent row. */
50
+ icon?: IconShape;
51
+ /** The submenu's items — options, or further groups / submenus. */
52
+ submenu: SelectItem[];
53
+ /** Disable the whole branch (cascades to all descendants). */
54
+ disabled?: boolean;
55
+ }
56
+ /** One entry in `options`: a plain option (string shorthand or `SelectOption`), an
57
+ * inline `SelectGroup`, or a flyout `SelectSubmenu`. Discriminated by shape — an
58
+ * `options` array is a group, a `submenu` array is a submenu, else it's an option.
59
+ * (`options` / `submenu` are therefore reserved keys on an option object.) */
60
+ export type SelectItem = string | SelectOption | SelectGroup | SelectSubmenu;
61
+ /** Per-row snapshot passed to `renderOption` / `renderIndicator`. Everything here
62
+ * is known at render time; the combobox "active" cursor is deliberately absent
63
+ * (it's a live element state the DOM owns, not a render-time value). */
64
+ export interface OptionState {
65
+ /** The option's value. */
66
+ value: string;
67
+ /** Whether this row is currently selected. */
68
+ selected: boolean;
69
+ /** Whether this row is disabled. */
70
+ disabled: boolean;
71
+ }
72
+ /** Snapshot passed to `renderEmpty` when the option list (after any active
73
+ * filter) is empty. `query` discriminates the cause: non-empty means the filter
74
+ * hid everything; empty means there were no options to begin with (where the
75
+ * consumer's own external loading state, if any, decides "loading" vs "empty"). */
76
+ export interface EmptyState {
77
+ /** The current filter query, trimmed ('' when there's no filter, nothing typed,
78
+ * or simply no options). */
79
+ query: string;
80
+ }
81
+ /** Snapshot passed to `renderTrigger` so a custom trigger can reflect the current
82
+ * selection and open state. */
83
+ export interface TriggerState {
84
+ /** Whether the menu is open — use it for `aria-expanded` and a chevron. */
85
+ open: boolean;
86
+ /** The current selection: a string (single), a string array (`multiple`), or
87
+ * `undefined` when nothing is chosen. */
88
+ value: string | string[] | undefined;
89
+ /** The resolved option objects for the current selection (empty when none).
90
+ * `selected.length` is the multi-select count. */
91
+ selected: SelectOption[];
92
+ /** Whether the whole select is disabled. */
93
+ disabled: boolean;
94
+ /** The `icon` shape passed to `Select`, if any — hand it to your trigger
95
+ * (e.g. a `Button`'s `icon`) so a custom trigger keeps the same leading glyph. */
96
+ icon?: IconShape;
97
+ }
98
+ /** Snapshot passed as the 2nd argument to `onValueChange` — describes *what*
99
+ * changed, alongside the new full value in the 1st argument. A discriminated
100
+ * union: a row toggle carries `value` + `option`; the "Select all" row carries
101
+ * `all: true` instead. Narrow on `'all' in attrs` before reading `option`. */
102
+ export type SelectChangeAttrs = {
103
+ /** The option value that changed — the chosen value (single) or the toggled
104
+ * row (multiple). */
105
+ value: string;
106
+ /** The resolved option object for `value`. */
107
+ option: SelectOption;
108
+ /** Multiple only: whether the change turned selection **on** (true) or off. */
109
+ selected?: boolean;
110
+ } | {
111
+ /** Marks the change as coming from the "Select all" row (multiple only). */
112
+ all: true;
113
+ /** Whether Select-all turned everything **on** (true) or cleared it. */
114
+ selected: boolean;
115
+ };
116
+ /** Props shared by both selection modes, intersected into `SelectProps`. Exported
117
+ * (and kept as an interface intersected — not a union base via `extends`) so its
118
+ * members read as `Select`'s *own* props in the generated docs, not inherited. */
119
+ export interface SelectCommonProps extends Omit<BaseProps, 'children'> {
120
+ /** The options to choose from — bare strings, `SelectOption` objects, `SelectGroup`s
121
+ * (inline titled sections), or `SelectSubmenu`s (flyout branches). Groups and
122
+ * submenus nest and mix with plain options. Selection stays global (one `value`,
123
+ * leaf options only); a filter query flattens the tree into grouped results.
124
+ *
125
+ * Each leaf `value` is the option's identity and must be **unique across the whole
126
+ * tree** — selection is value-keyed, so a value repeated in two sections is one
127
+ * logical pick (both rows toggle together; the trigger resolves to the last). Dev
128
+ * builds `console.warn` on a duplicate. */
129
+ options: SelectItem[];
130
+ /** The per-row mark for **single**-select: `'none'` (a tint-only highlight),
131
+ * `'check'` (a trailing checkmark on the selected row, keeping the tint — the
132
+ * canonical Select look), or `'radio'` (a leading radio on every row).
133
+ * Multi-select always uses checkboxes.
134
+ * @defaultValue none */
135
+ indicator?: 'none' | 'check' | 'radio';
136
+ /** Text shown when nothing is selected. */
137
+ placeholder?: string;
138
+ /** Leading icon shown at the left of the field (the default trigger's `Input`
139
+ * `leading` slot). With a custom `renderTrigger`, it's passed through as
140
+ * `state.icon` instead — the consumer places it. */
141
+ icon?: IconShape;
142
+ /** Field label, above the trigger (Input's `label`). */
143
+ label?: string;
144
+ /** Helper text under the field (Input's `hint`). */
145
+ hint?: string;
146
+ /** Field size.
147
+ * @defaultValue medium */
148
+ size?: 'small' | 'medium' | 'large';
149
+ /** Validation/feedback tone for the field (Input's `status`).
150
+ * @defaultValue neutral */
151
+ status?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
152
+ /** Glyph shown before the `hint` when `status` is set (Input's `statusIcon`).
153
+ * Each status has a default; pass a shape to override, or `false` to drop it. */
154
+ statusIcon?: IconShape | (string & {}) | false;
155
+ /** Round the field corners — `true` for fully round, or a number / CSS length. */
156
+ round?: boolean | number | string;
157
+ /** Disable the whole select. */
158
+ disabled?: boolean;
159
+ /** Tone applied to the **selected** row(s) — the whole row takes this tone
160
+ * (label, icon, indicator, and the background tint), like passing `tone` to just
161
+ * the chosen option. A named tone or a custom CSS color. Most visible with the
162
+ * tint-based marks (`indicator` `'none'` / `'check'`); with `'radio'` /
163
+ * `'checkbox'` it tones the label + indicator (those modes have no row tint). */
164
+ toneSelected?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
165
+ /** Add a search field at the top of the menu that filters the options as you
166
+ * type. `true` uses the built-in matcher — a case-insensitive substring of the
167
+ * option's **value / label / hint**. Pass a **function** `(option, query) =>
168
+ * boolean` for custom matching (called per option; return `true` to keep it). */
169
+ filter?: boolean | ((option: SelectOption, query: string) => boolean);
170
+ /** `multiple` only: add a "Select all" row at the top that toggles every enabled
171
+ * option (the currently-visible ones when a `filter` query is active); its box
172
+ * shows the mixed state when only some are selected. */
173
+ selectAll?: boolean;
174
+ /** Label for the `selectAll` row.
175
+ * @defaultValue Select all */
176
+ selectAllLabel?: string;
177
+ /** Render the **content** of each option row yourself, replacing the built-in
178
+ * `label`/`hint`/`icon` layout. Select still supplies the row box, click, ARIA,
179
+ * and the selection indicator — you return only what goes *inside*. Read extra
180
+ * fields off the option (see `SelectOption`'s index signature) plus an
181
+ * `OptionState` (`value`/`selected`/`disabled`). Filtering still works (it
182
+ * matches the option's `value`/`label`/`hint`), but match-highlighting is
183
+ * skipped — your content owns its own display. */
184
+ renderOption?: (option: SelectOption, state: OptionState) => React.ReactNode;
185
+ /** Replace each row's selection **mark** with your own node, drawn at the
186
+ * leading edge. The row stays the control (`role` + `aria-checked` from
187
+ * `indicator` / `selection`); only the drawn mark changes, so pair it with an
188
+ * `indicator` (`'check'` / `'radio'`) or `selection="multiple"` for the
189
+ * semantics. Composes with `renderOption`. */
190
+ renderIndicator?: (state: OptionState) => React.ReactNode;
191
+ /** Render your own trigger in place of the default field. Receives a
192
+ * `TriggerState` (`open` / `value` / `selected` / `disabled` / `icon`) to drive
193
+ * its look. **Return exactly one focusable element** (an Anta `Button`, say) —
194
+ * the menu anchors to it (its own previous DOM sibling) and opens it on click,
195
+ * so a fragment, multiple siblings, or a non-focusable wrapper will misanchor
196
+ * (the menu warns in the console if the trigger has no focusable element). Give
197
+ * the element `aria-haspopup="menu"` plus `aria-expanded={state.open}`. The field
198
+ * props (`label`, `hint`, `size`, `status`, `placeholder`, `round`) don't apply. */
199
+ renderTrigger?: (state: TriggerState) => React.ReactNode;
200
+ /** Render content in the menu body when the (filtered) option list is empty —
201
+ * a "no results" message, a loading indicator (gated on your own external
202
+ * loading state), or a "create from the query" row. Receives an `EmptyState`
203
+ * (`query`, trimmed). There is no built-in empty message: when omitted, an empty
204
+ * list renders nothing. Whatever you return goes where the option rows would —
205
+ * a plain node is inert; return a `MenuItem` (e.g. a "Create" row) to make it
206
+ * focusable and selectable. */
207
+ renderEmpty?: (state: EmptyState) => React.ReactNode;
208
+ }
209
+ /**
210
+ * `<Select>` props. `selection` discriminates the value shape: single mode
211
+ * (`value: string`) or `multiple` (`value: string[]`).
212
+ */
213
+ export type SelectProps = SelectCommonProps & ({
214
+ /** Selection mode. `'single'` (the default) keeps `value` a string and
215
+ * closes the menu on pick. Switch to `'multiple'` for checkboxes + an
216
+ * array value.
217
+ * @defaultValue single */
218
+ selection?: 'single';
219
+ /** Controlled value — the `value` string of the selected option. When
220
+ * provided, the consumer owns selection: the field follows this prop and a
221
+ * pick only *requests* a change via `onValueChange` (reject by not updating).
222
+ * Leave undefined for uncontrolled. */
223
+ value?: string;
224
+ /** Initial value (an option's `value` string) for the uncontrolled case — the
225
+ * wrapper then owns it. */
226
+ defaultValue?: string;
227
+ /** Fires after the selection changes, with the new value and a
228
+ * `{ value, option }` snapshot. Select has no discrete element state, so
229
+ * there is no cancelable `onStateChange` (see the Input event-model note). */
230
+ onValueChange?: (value: string, attrs: SelectChangeAttrs) => void;
231
+ } | {
232
+ /** Multi-select: checkboxes on every row, the menu stays open while
233
+ * toggling, the field shows an "N selected" count, and `value` is an array. */
234
+ selection: 'multiple';
235
+ /** Controlled values — the `value` strings of the selected options (see the
236
+ * single-select `value` note). */
237
+ value?: string[];
238
+ /** Initial values (option `value` strings) for the uncontrolled case. */
239
+ defaultValue?: string[];
240
+ /** Fires after any toggle, with the new value array and a `{ value, option,
241
+ * selected }` snapshot of the row that changed (or `{ all: true }` for the
242
+ * Select-all row). */
243
+ onValueChange?: (value: string[], attrs: SelectChangeAttrs) => void;
244
+ });
245
+ /** Rolled-up selection of a group / submenu subtree: `'none'` / `'all'` of the
246
+ * descendant leaves selected, or `'some'` in between. On `SelectedGroup` /
247
+ * `SelectedSubmenu`, for a section indicator or custom styling. */
248
+ export type SelectionState = 'none' | 'some' | 'all';
249
+ /** A leaf option annotated with its current selection — a `SelectOption` plus
250
+ * `selected`. Returned by {@link optionsWithSelection}. */
251
+ export type SelectedOption = SelectOption & {
252
+ selected: boolean;
253
+ };
254
+ /** A group with its descendants annotated and a rolled-up `selectionState`.
255
+ * Returned by {@link optionsWithSelection}. */
256
+ export interface SelectedGroup extends Omit<SelectGroup, 'options'> {
257
+ options: SelectedItem[];
258
+ selectionState: SelectionState;
259
+ }
260
+ /** A submenu with its descendants annotated and a rolled-up `selectionState`.
261
+ * Returned by {@link optionsWithSelection}. */
262
+ export interface SelectedSubmenu extends Omit<SelectSubmenu, 'submenu'> {
263
+ submenu: SelectedItem[];
264
+ selectionState: SelectionState;
265
+ }
266
+ /** One node of the tree from {@link optionsWithSelection}: a leaf `SelectedOption`
267
+ * (with `selected`), or a `SelectedGroup` / `SelectedSubmenu` (annotated children
268
+ * + rolled-up `selectionState`). Mirrors `SelectItem` minus the bare-string
269
+ * shorthand — strings are normalized to `SelectedOption`. */
270
+ export type SelectedItem = SelectedOption | SelectedGroup | SelectedSubmenu;
271
+ /**
272
+ * Project a `Select` `options` tree onto a set of selected values: returns a mirror
273
+ * of the tree with every leaf marked `selected` and every group / submenu carrying a
274
+ * rolled-up `selectionState` (`'none'` / `'some'` / `'all'` of its descendant leaves).
275
+ * Bare-string options are normalized to `{ value, label }`; structure and order are
276
+ * preserved.
277
+ *
278
+ * A pure function of `(options, values)` — it needs no `Select` instance and reads
279
+ * nothing off the change event, so it behaves identically in controlled and
280
+ * uncontrolled code. Pass the current `value` (a string, an array, or `undefined`)
281
+ * and render a grouped summary, drive section indicators, or diff picks.
282
+ *
283
+ * A value that appears under more than one section marks the leaf in *every* place it
284
+ * occurs (selection is value-keyed), mirroring how the menu itself renders it.
285
+ *
286
+ * @example
287
+ * ```tsx
288
+ * const tree = optionsWithSelection(options, values)
289
+ * // tree[1] === { label: 'Engineering', selectionState: 'some', options: [
290
+ * // { value: 'eng-fe', label: 'Frontend', selected: false }, … ] }
291
+ * ```
292
+ */
293
+ export declare function optionsWithSelection(options: SelectItem[], values: string | string[] | undefined): SelectedItem[];
294
+ /**
295
+ * `<Select>` — a single- or multi-select dropdown, composed from `<Input>` (a
296
+ * read-only trigger) and `<Menu>` (the options). `selection` sets behaviour:
297
+ * `'single'` (default; `value` is a string, menu closes on pick) or `'multiple'`
298
+ * (checkboxes, `value` is a string array, menu stays open while toggling, the
299
+ * field shows an "N selected" count). For single-select, `indicator` picks the
300
+ * per-row mark: `'none'` (tint only, default), `'check'` (trailing checkmark), or
301
+ * `'radio'` (leading radio).
302
+ *
303
+ * Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`). There
304
+ * is no `a-select` element — this wrapper is the coordinator; for a non-React
305
+ * equivalent, hand-compose the same pieces (see the docs).
306
+ *
307
+ * Requires `@antadesign/anta/elements` (client-side only).
308
+ *
309
+ * @example
310
+ * ```tsx
311
+ * <Select
312
+ * label="Field"
313
+ * options={['output_text', 'stream', 'container']}
314
+ * defaultValue="stream"
315
+ * onValueChange={(v) => console.log(v)}
316
+ * />
317
+ * ```
318
+ */
319
+ export declare const Select: (props: SelectProps) => any;