@antscorp/ui 0.1.3 → 0.1.5

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 (198) hide show
  1. package/README.md +25 -1
  2. package/dist/atoms/AddButton.d.ts +3 -5
  3. package/dist/atoms/Chip.d.ts +3 -3
  4. package/dist/atoms/Chip.js +1 -1
  5. package/dist/atoms/RemoveButton.d.ts +3 -5
  6. package/dist/atoms/TextAction.d.ts +3 -3
  7. package/dist/docs.json +1 -1
  8. package/dist/lib/forwardable.d.ts +8 -0
  9. package/dist/lib/iso.d.ts +2 -2
  10. package/dist/lib/iso.js +16 -8
  11. package/dist/lib/tokenEditorExtensions.js +1 -1
  12. package/dist/molecules/AccentCard.js +2 -2
  13. package/dist/molecules/CheckGroup.d.ts +2 -1
  14. package/dist/molecules/CheckRow.d.ts +3 -5
  15. package/dist/molecules/ChoiceTiles.js +1 -1
  16. package/dist/molecules/CommitTextField.d.ts +2 -19
  17. package/dist/molecules/CommitTextField.js +21 -18
  18. package/dist/molecules/ConfirmDialog.d.ts +3 -7
  19. package/dist/molecules/DateTimeInput.d.ts +7 -3
  20. package/dist/molecules/DateTimeInput.js +82 -73
  21. package/dist/molecules/DurationInput.d.ts +2 -1
  22. package/dist/molecules/PercentRow.d.ts +2 -1
  23. package/dist/molecules/RemovableRow.js +32 -32
  24. package/dist/molecules/RevealRadioGroup.d.ts +3 -9
  25. package/dist/molecules/RevealSwitch.d.ts +3 -7
  26. package/dist/molecules/Select.d.ts +8 -23
  27. package/dist/molecules/Select.js +26 -20
  28. package/dist/molecules/StatusButton.d.ts +3 -7
  29. package/dist/molecules/ToggleGrid.d.ts +2 -1
  30. package/dist/molecules/TokenTextField.d.ts +2 -1
  31. package/dist/molecules/TreeOptions.d.ts +3 -2
  32. package/dist/molecules/TreeOptions.js +67 -44
  33. package/dist/organisms/HourOfDayRow.js +2 -2
  34. package/dist/organisms/HourOfWeekGrid.js +2 -2
  35. package/dist/organisms/TokenPickerDialog.d.ts +2 -1
  36. package/dist/organisms/TransferPicker.d.ts +2 -1
  37. package/dist/organisms/TreeSearchPanel.js +50 -47
  38. package/dist/theme/AntsomiTheme.d.ts +3 -2
  39. package/dist/theme/AntsomiTheme.js +8 -7
  40. package/dist/ui.css +1 -1
  41. package/package.json +23 -17
  42. package/src/atoms/AddButton.tsx +3 -6
  43. package/src/atoms/Chip.tsx +6 -5
  44. package/src/atoms/RemoveButton.tsx +4 -6
  45. package/src/atoms/TextAction.tsx +4 -4
  46. package/src/lib/forwardable.ts +8 -0
  47. package/src/lib/iso.ts +15 -3
  48. package/src/lib/tokenEditorExtensions.ts +1 -1
  49. package/src/molecules/AccentCard.tsx +4 -2
  50. package/src/molecules/CheckGroup.tsx +3 -3
  51. package/src/molecules/CheckRow.tsx +3 -6
  52. package/src/molecules/ChoiceTiles.tsx +3 -1
  53. package/src/molecules/CommitTextField.tsx +18 -20
  54. package/src/molecules/ConfirmDialog.tsx +6 -8
  55. package/src/molecules/DateTimeInput.tsx +87 -68
  56. package/src/molecules/DurationInput.tsx +4 -1
  57. package/src/molecules/PercentRow.tsx +3 -2
  58. package/src/molecules/RemovableRow.tsx +1 -1
  59. package/src/molecules/RevealRadioGroup.tsx +5 -10
  60. package/src/molecules/RevealSwitch.tsx +4 -8
  61. package/src/molecules/Select.tsx +25 -22
  62. package/src/molecules/StatusButton.tsx +4 -8
  63. package/src/molecules/ToggleGrid.tsx +3 -3
  64. package/src/molecules/TokenTextField.tsx +3 -3
  65. package/src/molecules/TreeOptions.tsx +86 -62
  66. package/src/organisms/HourOfDayRow.tsx +4 -2
  67. package/src/organisms/HourOfWeekGrid.tsx +4 -2
  68. package/src/organisms/TokenPickerDialog.tsx +2 -1
  69. package/src/organisms/TransferPicker.tsx +3 -3
  70. package/src/organisms/TreeSearchPanel.tsx +1 -1
  71. package/src/theme/AntsomiTheme.tsx +9 -3
  72. package/dist/atoms/AddButton.doc.d.ts +0 -21
  73. package/dist/atoms/AddGlyph.doc.d.ts +0 -16
  74. package/dist/atoms/Chip.doc.d.ts +0 -29
  75. package/dist/atoms/ChipSkeletons.doc.d.ts +0 -21
  76. package/dist/atoms/FieldHeading.doc.d.ts +0 -15
  77. package/dist/atoms/HoverSwap.doc.d.ts +0 -25
  78. package/dist/atoms/InfoTip.doc.d.ts +0 -25
  79. package/dist/atoms/JointLabel.doc.d.ts +0 -15
  80. package/dist/atoms/LabeledDivider.doc.d.ts +0 -21
  81. package/dist/atoms/LogoImage.doc.d.ts +0 -21
  82. package/dist/atoms/PanelSearchInput.doc.d.ts +0 -25
  83. package/dist/atoms/PathMark.doc.d.ts +0 -16
  84. package/dist/atoms/RemoveButton.doc.d.ts +0 -16
  85. package/dist/atoms/RowSkeletons.doc.d.ts +0 -25
  86. package/dist/atoms/TextAction.doc.d.ts +0 -25
  87. package/dist/atoms/TruncatedOption.doc.d.ts +0 -24
  88. package/dist/atoms/TruncatedText.doc.d.ts +0 -15
  89. package/dist/molecules/AccentCard.doc.d.ts +0 -25
  90. package/dist/molecules/CheckGroup.doc.d.ts +0 -25
  91. package/dist/molecules/CheckRow.doc.d.ts +0 -25
  92. package/dist/molecules/ChoiceDialog.doc.d.ts +0 -21
  93. package/dist/molecules/ChoiceTiles.doc.d.ts +0 -21
  94. package/dist/molecules/CommitTextField.doc.d.ts +0 -29
  95. package/dist/molecules/ConfirmDialog.doc.d.ts +0 -21
  96. package/dist/molecules/DateTimeInput.doc.d.ts +0 -25
  97. package/dist/molecules/DurationInput.doc.d.ts +0 -25
  98. package/dist/molecules/FieldGroup.doc.d.ts +0 -25
  99. package/dist/molecules/FieldRow.doc.d.ts +0 -24
  100. package/dist/molecules/FieldSkeleton.doc.d.ts +0 -25
  101. package/dist/molecules/FrequencyLimitRow.doc.d.ts +0 -25
  102. package/dist/molecules/InlineEditableText.doc.d.ts +0 -25
  103. package/dist/molecules/LoadMoreRow.doc.d.ts +0 -21
  104. package/dist/molecules/LoadState.doc.d.ts +0 -21
  105. package/dist/molecules/MetaTable.doc.d.ts +0 -25
  106. package/dist/molecules/PercentRow.doc.d.ts +0 -25
  107. package/dist/molecules/PhoneFrame.doc.d.ts +0 -21
  108. package/dist/molecules/ProblemsButton.doc.d.ts +0 -25
  109. package/dist/molecules/RemovableRow.doc.d.ts +0 -25
  110. package/dist/molecules/RevealRadioGroup.doc.d.ts +0 -25
  111. package/dist/molecules/RevealSwitch.doc.d.ts +0 -25
  112. package/dist/molecules/RuleRow.doc.d.ts +0 -25
  113. package/dist/molecules/Select.doc.d.ts +0 -30
  114. package/dist/molecules/SideLabelRow.doc.d.ts +0 -20
  115. package/dist/molecules/SplitButton.doc.d.ts +0 -25
  116. package/dist/molecules/StatusButton.doc.d.ts +0 -25
  117. package/dist/molecules/TagSelect.doc.d.ts +0 -25
  118. package/dist/molecules/ToggleGrid.doc.d.ts +0 -25
  119. package/dist/molecules/TokenTextField.doc.d.ts +0 -29
  120. package/dist/molecules/TransferLayout.doc.d.ts +0 -25
  121. package/dist/molecules/TreeOptions.doc.d.ts +0 -25
  122. package/dist/organisms/ChipListAddPopover.doc.d.ts +0 -25
  123. package/dist/organisms/HourOfDayRow.doc.d.ts +0 -25
  124. package/dist/organisms/HourOfWeekGrid.doc.d.ts +0 -25
  125. package/dist/organisms/RepeatableList.doc.d.ts +0 -21
  126. package/dist/organisms/ResizableDrawer.doc.d.ts +0 -25
  127. package/dist/organisms/RuleGroups.doc.d.ts +0 -21
  128. package/dist/organisms/RuleList.doc.d.ts +0 -25
  129. package/dist/organisms/SearchableGroupedList.doc.d.ts +0 -25
  130. package/dist/organisms/TokenPickerDialog.doc.d.ts +0 -21
  131. package/dist/organisms/TransferPicker.doc.d.ts +0 -29
  132. package/dist/organisms/TreeSearchPanel.doc.d.ts +0 -25
  133. package/dist/organisms/TreeSelect.doc.d.ts +0 -29
  134. package/dist/theme/AntsomiTheme.doc.d.ts +0 -15
  135. package/dist/theme/AntsomiTheme.doc.js +0 -22
  136. package/src/atoms/AddButton.doc.ts +0 -36
  137. package/src/atoms/AddGlyph.doc.ts +0 -26
  138. package/src/atoms/Chip.doc.ts +0 -45
  139. package/src/atoms/ChipSkeletons.doc.ts +0 -31
  140. package/src/atoms/FieldHeading.doc.ts +0 -22
  141. package/src/atoms/HoverSwap.doc.ts +0 -39
  142. package/src/atoms/InfoTip.doc.ts +0 -37
  143. package/src/atoms/JointLabel.doc.ts +0 -23
  144. package/src/atoms/LabeledDivider.doc.ts +0 -35
  145. package/src/atoms/LogoImage.doc.ts +0 -42
  146. package/src/atoms/PanelSearchInput.doc.ts +0 -41
  147. package/src/atoms/PathMark.doc.ts +0 -25
  148. package/src/atoms/RemoveButton.doc.ts +0 -26
  149. package/src/atoms/RowSkeletons.doc.ts +0 -43
  150. package/src/atoms/TextAction.doc.ts +0 -40
  151. package/src/atoms/TruncatedOption.doc.ts +0 -39
  152. package/src/atoms/TruncatedText.doc.ts +0 -22
  153. package/src/molecules/AccentCard.doc.ts +0 -43
  154. package/src/molecules/CheckGroup.doc.ts +0 -40
  155. package/src/molecules/CheckRow.doc.ts +0 -43
  156. package/src/molecules/ChoiceDialog.doc.ts +0 -48
  157. package/src/molecules/ChoiceTiles.doc.ts +0 -42
  158. package/src/molecules/CommitTextField.doc.ts +0 -41
  159. package/src/molecules/ConfirmDialog.doc.ts +0 -43
  160. package/src/molecules/DateTimeInput.doc.ts +0 -48
  161. package/src/molecules/DurationInput.doc.ts +0 -36
  162. package/src/molecules/FieldGroup.doc.ts +0 -41
  163. package/src/molecules/FieldRow.doc.ts +0 -36
  164. package/src/molecules/FieldSkeleton.doc.ts +0 -38
  165. package/src/molecules/FrequencyLimitRow.doc.ts +0 -48
  166. package/src/molecules/InlineEditableText.doc.ts +0 -41
  167. package/src/molecules/LoadMoreRow.doc.ts +0 -36
  168. package/src/molecules/LoadState.doc.ts +0 -42
  169. package/src/molecules/MetaTable.doc.ts +0 -46
  170. package/src/molecules/PercentRow.doc.ts +0 -48
  171. package/src/molecules/PhoneFrame.doc.ts +0 -46
  172. package/src/molecules/ProblemsButton.doc.ts +0 -41
  173. package/src/molecules/RemovableRow.doc.ts +0 -48
  174. package/src/molecules/RevealRadioGroup.doc.ts +0 -41
  175. package/src/molecules/RevealSwitch.doc.ts +0 -38
  176. package/src/molecules/RuleRow.doc.ts +0 -43
  177. package/src/molecules/Select.doc.ts +0 -62
  178. package/src/molecules/SideLabelRow.doc.ts +0 -35
  179. package/src/molecules/SplitButton.doc.ts +0 -41
  180. package/src/molecules/StatusButton.doc.ts +0 -39
  181. package/src/molecules/TagSelect.doc.ts +0 -41
  182. package/src/molecules/ToggleGrid.doc.ts +0 -43
  183. package/src/molecules/TokenTextField.doc.ts +0 -41
  184. package/src/molecules/TransferLayout.doc.ts +0 -42
  185. package/src/molecules/TreeOptions.doc.ts +0 -38
  186. package/src/organisms/ChipListAddPopover.doc.ts +0 -54
  187. package/src/organisms/HourOfDayRow.doc.ts +0 -43
  188. package/src/organisms/HourOfWeekGrid.doc.ts +0 -48
  189. package/src/organisms/RepeatableList.doc.ts +0 -49
  190. package/src/organisms/ResizableDrawer.doc.ts +0 -48
  191. package/src/organisms/RuleGroups.doc.ts +0 -49
  192. package/src/organisms/RuleList.doc.ts +0 -43
  193. package/src/organisms/SearchableGroupedList.doc.ts +0 -49
  194. package/src/organisms/TokenPickerDialog.doc.ts +0 -54
  195. package/src/organisms/TransferPicker.doc.ts +0 -69
  196. package/src/organisms/TreeSearchPanel.doc.ts +0 -43
  197. package/src/organisms/TreeSelect.doc.ts +0 -56
  198. package/src/theme/AntsomiTheme.doc.ts +0 -23
@@ -1,4 +1,6 @@
1
+ import { type RadioListProps } from "@astryxdesign/core/RadioList";
1
2
  import { type ReactNode } from "react";
3
+ import type { Forwardable } from "../lib/forwardable.js";
2
4
  /** One choice of a `RevealRadioGroup`. */
3
5
  export type RevealRadioOption<V extends string> = {
4
6
  /** What `onChange` gets when this option is picked. */
@@ -13,13 +15,7 @@ export type RevealRadioOption<V extends string> = {
13
15
  readonly content?: ReactNode;
14
16
  };
15
17
  /** What `RevealRadioGroup` takes. */
16
- export type RevealRadioGroupProps<V extends string> = {
17
- /** Names the group; also its accessible name when hidden. */
18
- readonly label: string;
19
- /** Keeps the label for screen readers only. */
20
- readonly isLabelHidden?: boolean | undefined;
21
- /** Lays the options out in a row instead of a column. */
22
- readonly orientation?: "vertical" | "horizontal" | undefined;
18
+ export type RevealRadioGroupProps<V extends string> = Forwardable<Pick<RadioListProps, "label" | "isLabelHidden" | "orientation" | "isDisabled">> & {
23
19
  /** The choices, in order. */
24
20
  readonly options: readonly RevealRadioOption<V>[];
25
21
  /** The chosen option's value. */
@@ -28,8 +24,6 @@ export type RevealRadioGroupProps<V extends string> = {
28
24
  readonly onChange: (value: V) => void;
29
25
  /** The radios' size, `md` by default (Astryx's default; the theme draws it at 18px). */
30
26
  readonly size?: "sm" | "md" | undefined;
31
- /** Dims the radios and blocks them. */
32
- readonly isDisabled?: boolean | undefined;
33
27
  /** Shows the value, not dimmed, and ignores changes. */
34
28
  readonly isReadOnly?: boolean | undefined;
35
29
  /** The space between the list and the revealed content, `2` by default. */
@@ -1,16 +1,12 @@
1
+ import { type SwitchProps } from "@astryxdesign/core/Switch";
1
2
  import type { ReactNode } from "react";
3
+ import type { Forwardable } from "../lib/forwardable.js";
2
4
  /** What `RevealSwitch` takes. */
3
- export type RevealSwitchProps = {
4
- /** What the switch turns on. */
5
- readonly label: string;
6
- /** Whether the switch is on. */
7
- readonly value: boolean;
5
+ export type RevealSwitchProps = Forwardable<Pick<SwitchProps, "label" | "isDisabled" | "value">> & {
8
6
  /** Called with the new state. */
9
7
  readonly onChange: (value: boolean) => void;
10
8
  /** The switch's size, `md` by default. */
11
9
  readonly size?: "sm" | "md" | undefined;
12
- /** Dims the switch and blocks it. */
13
- readonly isDisabled?: boolean | undefined;
14
10
  /** Shows the value, not dimmed, and ignores changes. */
15
11
  readonly isReadOnly?: boolean | undefined;
16
12
  /** What shows below the switch while it is on. */
@@ -1,15 +1,10 @@
1
- import { type SelectorOptionType } from "@astryxdesign/core/Selector";
1
+ import { type SelectorOptionType, type SelectorProps } from "@astryxdesign/core/Selector";
2
2
  import type { ReactNode } from "react";
3
+ import type { Forwardable } from "../lib/forwardable.js";
3
4
  /** One entry of `Select`'s list: an option, a titled section of options, or a divider (Astryx's). */
4
5
  export type SelectOption = SelectorOptionType;
5
6
  /** What `Select` takes. */
6
- export type SelectProps = {
7
- /** Names the control for assistive tech; shown above it unless `isLabelHidden`. */
8
- readonly label: string;
9
- /** Hides the label, as in a rule row. */
10
- readonly isLabelHidden?: boolean | undefined;
11
- /** A line under the label that explains the choice. */
12
- readonly description?: string | undefined;
7
+ export type SelectProps = Forwardable<Pick<SelectorProps, "label" | "isLabelHidden" | "description" | "placeholder" | "hasSearch" | "width" | "isDisabled" | "isReadOnly" | "isRequired" | "controlXstyle" | "containerXstyle">> & {
13
8
  /** The list, in order. */
14
9
  readonly options: readonly SelectOption[];
15
10
  /** The picked option's value; `null` or none shows the placeholder. */
@@ -18,22 +13,10 @@ export type SelectProps = {
18
13
  readonly onChange: (value: string) => void;
19
14
  /** Called by the clear button, which shows only when this is given and an option is picked. */
20
15
  readonly onClear?: (() => void) | undefined;
21
- /** Shown in the trigger while nothing is picked. */
22
- readonly placeholder?: string | undefined;
23
- /** A search box over the list, filtering it as it is typed. */
24
- readonly hasSearch?: boolean | undefined;
25
16
  /** The trigger's look: an underlined field (`input`, the default) or a bare text button (`ghost`). */
26
17
  readonly variant?: "input" | "ghost" | undefined;
27
- /** The trigger's size, `md` by default (the theme's 30px control height). */
28
- readonly size?: "sm" | "md" | undefined;
29
- /** The trigger's width, in pixels or any CSS length such as `"100%"`. */
30
- readonly width?: number | string | undefined;
31
- /** Dims the trigger and blocks it. */
32
- readonly isDisabled?: boolean | undefined;
33
- /** Shows the picked label without the chevron; the list does not open. */
34
- readonly isReadOnly?: boolean | undefined;
35
- /** Marks the field as required. */
36
- readonly isRequired?: boolean | undefined;
18
+ /** The trigger's size, md by default; the kit narrows the upstream sizes to sm and md. */
19
+ readonly size?: Extract<SelectorProps["size"], "sm" | "md"> | undefined;
37
20
  /**
38
21
  * The options are loading: a spinner in place of the chevron and the trigger busy from 300 ms
39
22
  * on, for at least 300 ms (`useLoadingShown`), and the list does not open meanwhile. The picked
@@ -43,7 +26,7 @@ export type SelectProps = {
43
26
  readonly isLoading?: boolean | undefined;
44
27
  /** A problem with the pick, already in the user's language, shown under the trigger. */
45
28
  readonly error?: string | undefined;
46
- /** The texts the view shows; the host translates them. Astryx's English stands in for a missing one. */
29
+ /** Host texts; missing strings use the facade's InternationalizationProvider locale (English by default). */
47
30
  readonly labels?: {
48
31
  /** The search box's placeholder, such as "Search". */
49
32
  readonly search?: string | undefined;
@@ -59,5 +42,7 @@ export type SelectProps = {
59
42
  * The kit's select on Astryx's `Selector`: the list is as wide as the
60
43
  * trigger (the theme) and a long option label ends in an ellipsis with the whole label in a
61
44
  * tooltip. Every select is one rather than Astryx's `Selector` (lint-enforced). It holds no state.
45
+ * Localize upstream search, clear and empty text with `InternationalizationProvider` from
46
+ * `@antscorp/ui/astryx/i18n`; `labels` overrides individual kit captions.
62
47
  */
63
48
  export declare function Select(props: SelectProps): ReactNode;
@@ -6,7 +6,7 @@ import { jsx as i } from "react/jsx-runtime";
6
6
  import { Selector as a } from "@astryxdesign/core/Selector";
7
7
  // src/molecules/Select.tsx
8
8
  function o(e) {
9
- let o = r(69), { labels: l, onClear: u, onChange: d } = e, f;
9
+ let o = r(75), { labels: l, onClear: u, onChange: d } = e, f;
10
10
  o[0] === l ? f = o[1] : (f = l === void 0 ? {} : l, o[0] = l, o[1] = f);
11
11
  let p = f, m = e.value ?? void 0, { isBusy: h, isShown: g } = n(e.isLoading === !0), _;
12
12
  o[2] !== h || o[3] !== p.value || o[4] !== e.options || o[5] !== m ? (_ = h && m !== void 0 && p.value !== void 0 && !c(e.options, m) ? [{
@@ -48,11 +48,15 @@ function o(e) {
48
48
  let A;
49
49
  o[34] === e.isRequired ? A = o[35] : (A = e.isRequired !== void 0 && { isRequired: e.isRequired }, o[34] = e.isRequired, o[35] = A);
50
50
  let j;
51
- o[36] === p.search ? j = o[37] : (j = p.search !== void 0 && { searchPlaceholder: p.search }, o[36] = p.search, o[37] = j);
51
+ o[36] === e.controlXstyle ? j = o[37] : (j = e.controlXstyle !== void 0 && { controlXstyle: e.controlXstyle }, o[36] = e.controlXstyle, o[37] = j);
52
52
  let M;
53
- o[38] === p.noMatch ? M = o[39] : (M = p.noMatch !== void 0 && { emptySearchText: p.noMatch }, o[38] = p.noMatch, o[39] = M);
53
+ o[38] === e.containerXstyle ? M = o[39] : (M = e.containerXstyle !== void 0 && { containerXstyle: e.containerXstyle }, o[38] = e.containerXstyle, o[39] = M);
54
54
  let N;
55
- o[40] !== e.label || o[41] !== E || o[42] !== D || o[43] !== O || o[44] !== k || o[45] !== A || o[46] !== j || o[47] !== M || o[48] !== y || o[49] !== b || o[50] !== x || o[51] !== S || o[52] !== C || o[53] !== w || o[54] !== T ? (N = {
55
+ o[40] === p.search ? N = o[41] : (N = p.search !== void 0 && { searchPlaceholder: p.search }, o[40] = p.search, o[41] = N);
56
+ let P;
57
+ o[42] === p.noMatch ? P = o[43] : (P = p.noMatch !== void 0 && { emptySearchText: p.noMatch }, o[42] = p.noMatch, o[43] = P);
58
+ let F;
59
+ o[44] !== e.label || o[45] !== E || o[46] !== D || o[47] !== O || o[48] !== k || o[49] !== A || o[50] !== j || o[51] !== M || o[52] !== N || o[53] !== P || o[54] !== y || o[55] !== b || o[56] !== x || o[57] !== S || o[58] !== C || o[59] !== w || o[60] !== T ? (F = {
56
60
  label: e.label,
57
61
  options: y,
58
62
  renderOption: s,
@@ -68,30 +72,32 @@ function o(e) {
68
72
  ...k,
69
73
  ...A,
70
74
  ...j,
71
- ...M
72
- }, o[40] = e.label, o[41] = E, o[42] = D, o[43] = O, o[44] = k, o[45] = A, o[46] = j, o[47] = M, o[48] = y, o[49] = b, o[50] = x, o[51] = S, o[52] = C, o[53] = w, o[54] = T, o[55] = N) : N = o[55];
73
- let P = N;
75
+ ...M,
76
+ ...N,
77
+ ...P
78
+ }, o[44] = e.label, o[45] = E, o[46] = D, o[47] = O, o[48] = k, o[49] = A, o[50] = j, o[51] = M, o[52] = N, o[53] = P, o[54] = y, o[55] = b, o[56] = x, o[57] = S, o[58] = C, o[59] = w, o[60] = T, o[61] = F) : F = o[61];
79
+ let I = F;
74
80
  if (u === void 0) {
75
81
  let e;
76
- o[56] === m ? e = o[57] : (e = m !== void 0 && { value: m }, o[56] = m, o[57] = e);
82
+ o[62] === m ? e = o[63] : (e = m !== void 0 && { value: m }, o[62] = m, o[63] = e);
77
83
  let t;
78
- return o[58] !== P || o[59] !== d || o[60] !== e ? (t = /* @__PURE__ */ i(a, {
79
- ...P,
84
+ return o[64] !== I || o[65] !== d || o[66] !== e ? (t = /* @__PURE__ */ i(a, {
85
+ ...I,
80
86
  ...e,
81
87
  onChange: d
82
- }), o[58] = P, o[59] = d, o[60] = e, o[61] = t) : t = o[61], t;
88
+ }), o[64] = I, o[65] = d, o[66] = e, o[67] = t) : t = o[67], t;
83
89
  }
84
- let F = m ?? null, I;
85
- o[62] !== d || o[63] !== u ? (I = (e) => {
90
+ let L = m ?? null, R;
91
+ o[68] !== d || o[69] !== u ? (R = (e) => {
86
92
  e === null ? u() : d(e);
87
- }, o[62] = d, o[63] = u, o[64] = I) : I = o[64];
88
- let L;
89
- return o[65] !== P || o[66] !== F || o[67] !== I ? (L = /* @__PURE__ */ i(a, {
90
- ...P,
93
+ }, o[68] = d, o[69] = u, o[70] = R) : R = o[70];
94
+ let z;
95
+ return o[71] !== I || o[72] !== L || o[73] !== R ? (z = /* @__PURE__ */ i(a, {
96
+ ...I,
91
97
  hasClear: !0,
92
- value: F,
93
- onChange: I
94
- }), o[65] = P, o[66] = F, o[67] = I, o[68] = L) : L = o[68], L;
98
+ value: L,
99
+ onChange: R
100
+ }), o[71] = I, o[72] = L, o[73] = R, o[74] = z) : z = o[74], z;
95
101
  }
96
102
  function s(t) {
97
103
  return /* @__PURE__ */ i(e, { option: t });
@@ -1,11 +1,11 @@
1
+ import { type ButtonProps } from "@astryxdesign/core/Button";
1
2
  import { StatusDot } from "@astryxdesign/core/StatusDot";
2
3
  import type { ComponentProps, ReactNode } from "react";
4
+ import type { Forwardable } from "../lib/forwardable.js";
3
5
  /** The tone of a `StatusButton`'s dot. */
4
6
  export type StatusTone = ComponentProps<typeof StatusDot>["variant"];
5
7
  /** What `StatusButton` takes. */
6
- export type StatusButtonProps = {
7
- /** The button's text. */
8
- readonly label: string;
8
+ export type StatusButtonProps = Forwardable<Pick<ButtonProps, "label" | "icon" | "isDisabled">> & {
9
9
  /** The dot's tone: neutral, accent, success, warning or error. */
10
10
  readonly status: StatusTone;
11
11
  /** The texts the view shows; the host translates them. */
@@ -13,14 +13,10 @@ export type StatusButtonProps = {
13
13
  /** What the dot means, read out for it, e.g. "Connected". */
14
14
  readonly status: string;
15
15
  };
16
- /** A glyph before the text. */
17
- readonly icon?: ReactNode;
18
16
  /** Called when the button is pressed. */
19
17
  readonly onClick: () => void;
20
18
  /** The button's height, `md` by default. */
21
19
  readonly size?: "sm" | "md" | undefined;
22
- /** Dimmed and not pressable. */
23
- readonly isDisabled?: boolean | undefined;
24
20
  };
25
21
  /** A button whose dot shows a state beside its text, such as a connection. */
26
22
  export declare function StatusButton(props: StatusButtonProps): ReactNode;
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { Forwardable } from "../lib/forwardable.js";
2
3
  import { type FieldGroupProps } from "./FieldGroup.js";
3
4
  /** One button of a `ToggleGrid`. */
4
5
  export type ToggleGridOption<V extends string> = {
@@ -10,7 +11,7 @@ export type ToggleGridOption<V extends string> = {
10
11
  readonly span?: number | undefined;
11
12
  };
12
13
  /** What `ToggleGrid` takes. */
13
- export type ToggleGridProps<V extends string> = Pick<FieldGroupProps, "label" | "isDisabled" | "error"> & {
14
+ export type ToggleGridProps<V extends string> = Forwardable<Pick<FieldGroupProps, "label" | "isDisabled" | "error">> & {
14
15
  /** The buttons, in order. */
15
16
  readonly options: readonly ToggleGridOption<V>[];
16
17
  /** How many 40px columns the grid has; one column of Astryx's default without it. */
@@ -1,10 +1,11 @@
1
1
  import { type FieldProps } from "@astryxdesign/core/Field";
2
2
  import { type IconProps } from "@astryxdesign/core/Icon";
3
3
  import { type ReactNode } from "react";
4
+ import type { Forwardable } from "../lib/forwardable.js";
4
5
  import type { TokenLook } from "../lib/tokenEditorConfig.js";
5
6
  export type { TokenLook } from "../lib/tokenEditorConfig.js";
6
7
  /** What `TokenTextField` takes. */
7
- export type TokenTextFieldProps = Pick<FieldProps, "label" | "description" | "isLabelHidden" | "isDisabled" | "isRequired"> & {
8
+ export type TokenTextFieldProps = Forwardable<Pick<FieldProps, "label" | "description" | "isLabelHidden" | "isDisabled" | "isRequired">> & {
8
9
  /** The committed string; outside changes replace the local draft. */
9
10
  readonly value: string;
10
11
  /** Commits the local draft on blur, or Enter in a single line. */
@@ -37,8 +37,9 @@ export type TreeOptionsProps = {
37
37
  * disabled row does neither. Rows are the Selector's option rows (its styles, its option-row and
38
38
  * check theme targets, its check on the picked leaf at the end, where a group shows its chevron),
39
39
  * so a theme styles both alike: the picked row's look and whether a check shows are the theme's.
40
- * Tab reaches the picked leaf (else the first enabled row), Up and Down move between rows, Enter
41
- * and Space act. Its state is which groups are open.
40
+ * Tab initially reaches the picked leaf (else the first enabled row); arrows, Home and End move
41
+ * through enabled rows, Right opens or enters a group, Left collapses or returns to its parent,
42
+ * and Enter and Space act. Its state is which groups are open and which row has focus.
42
43
  */
43
44
  export declare function TreeOptions(props: TreeOptionsProps): ReactNode;
44
45
  export declare function leafOf(items: readonly TreeItem[], value: string): TreeItem | undefined;
@@ -5,49 +5,62 @@ import "@stylexjs/stylex";
5
5
  import { Icon as r } from "@astryxdesign/core/Icon";
6
6
  import { Text as i } from "@astryxdesign/core/Text";
7
7
  import { themeProps as a } from "@astryxdesign/core/utils";
8
- import { useState as o } from "react";
9
- import { useIndicator as s } from "@astryxdesign/core/Indicator";
8
+ import { Fragment as o, useId as s, useState as c } from "react";
9
+ import { useTreeFocus as l } from "@astryxdesign/core/hooks";
10
+ import { useIndicator as u } from "@astryxdesign/core/Indicator";
10
11
  // src/molecules/TreeOptions.tsx
11
- function c(c) {
12
- let p = e(13), { items: m, value: h } = c, g = c.size ?? "md", _;
13
- p[0] !== m || p[1] !== c.isExpandedByDefault || p[2] !== h ? (_ = () => new Set(m.flatMap((e) => e.children !== void 0 && (c.isExpandedByDefault === !0 || e.children.some((e) => e.value === h)) ? [e.value] : [])), p[0] = m, p[1] = c.isExpandedByDefault, p[2] = h, p[3] = _) : _ = p[3];
14
- let [v, y] = o(_), b;
15
- p[4] === v ? b = p[5] : (b = (e) => {
12
+ function d(d) {
13
+ let g = e(21), { items: _, value: v } = d, y = d.size ?? "md", b = s(), [x, S] = c(), C;
14
+ g[0] !== _ || g[1] !== d.isExpandedByDefault || g[2] !== v ? (C = () => new Set(_.flatMap((e) => e.children !== void 0 && (d.isExpandedByDefault === !0 || e.children.some((e) => e.value === v)) ? [e.value] : [])), g[0] = _, g[1] = d.isExpandedByDefault, g[2] = v, g[3] = C) : C = g[3];
15
+ let [w, T] = c(C), E;
16
+ g[4] === w ? E = g[5] : (E = (e) => {
16
17
  if (e.children === void 0) return [{
17
18
  item: e,
18
19
  level: 1
19
20
  }];
20
- let t = v.has(e.value), n = t ? e.children.map(u) : [];
21
+ let t = w.has(e.value), n = t ? e.children.map(m) : [];
21
22
  return [{
22
23
  item: e,
23
24
  level: 1,
24
25
  isOpen: t
25
26
  }].concat(n);
26
- }, p[4] = v, p[5] = b);
27
- let x = m.flatMap(b), S = s("check"), C = x.filter(l), w = C.find((e) => e.isOpen === void 0 && e.item.value === h) ?? C[0], T;
28
- p[6] !== v || p[7] !== c ? (T = (e) => {
27
+ }, g[4] = w, g[5] = E);
28
+ let D = _.flatMap(E), O = u("check"), k = D.filter(p), A = k.find((e) => e.item.value === x) ?? k.find((e) => e.isOpen === void 0 && e.item.value === v) ?? k[0], j;
29
+ g[6] !== w || g[7] !== d ? (j = (e) => {
29
30
  if (e.item.isDisabled === !0) return;
30
31
  if (e.isOpen === void 0) {
31
- c.onChange(e.item.value);
32
+ d.onChange(e.item.value);
32
33
  return;
33
34
  }
34
- let t = new Set(v);
35
- t.delete(e.item.value) || t.add(e.item.value), y(t);
36
- }, p[6] = v, p[7] = c, p[8] = T) : T = p[8];
37
- let E = T, D = c.label, O = f, k = x.map((e) => /* @__PURE__ */ n("div", {
35
+ let t = new Set(w);
36
+ t.delete(e.item.value) || t.add(e.item.value), T(t);
37
+ }, g[6] = w, g[7] = d, g[8] = j) : j = g[8];
38
+ let M = j, N = (e) => {
39
+ let t = D.find((t) => t.item.value === e);
40
+ t !== void 0 && M(t);
41
+ }, { treeRef: P, handleKeyDown: F } = l({
42
+ itemSelector: "[role=\"treeitem\"]:not([aria-disabled=\"true\"])",
43
+ onToggleExpand: N,
44
+ onActivate: (e, t) => (N(t), !0)
45
+ }), I;
46
+ g[9] === b ? I = g[10] : (I = (e) => `${b}-${encodeURIComponent(e.item.value)}`, g[9] = b, g[10] = I);
47
+ let L = I, R = (e) => /* @__PURE__ */ n("div", {
38
48
  role: "treeitem",
49
+ "aria-label": e.item.label,
50
+ "data-tree-id": e.item.value,
39
51
  "aria-level": e.level,
40
52
  "aria-expanded": e.isOpen,
41
- "aria-selected": e.isOpen === void 0 ? e.item.value === h : void 0,
53
+ "aria-owns": e.isOpen === !0 ? L(e) : void 0,
54
+ "aria-selected": e.isOpen === void 0 ? e.item.value === v : void 0,
42
55
  "aria-disabled": e.item.isDisabled === !0 || void 0,
43
- tabIndex: e === w ? 0 : -1,
44
- onClick: () => {
45
- E(e);
56
+ tabIndex: e.item === A?.item ? 0 : -1,
57
+ onFocus: () => {
58
+ S(e.item.value);
46
59
  },
47
- onKeyDown: (t) => {
48
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), E(e));
60
+ onClick: () => {
61
+ M(e);
49
62
  },
50
- ...d(e, g, h),
63
+ ...h(e, y, v),
51
64
  children: [/* @__PURE__ */ t("span", {
52
65
  className: "aui78zum5 aui6s0dn4 aui1txdalj aui98rzlu auieuugli",
53
66
  children: /* @__PURE__ */ t(i, {
@@ -61,8 +74,8 @@ function c(c) {
61
74
  0: { className: "aui2lah0s auigomdpo aui14ju556" },
62
75
  1: { className: "aui2lah0s auigomdpo aui14ju556 aui3nfvp2 aui6s0dn4 auil56j7k" }
63
76
  }[e.isOpen !== void 0 | 0],
64
- children: e.isOpen === void 0 ? /* @__PURE__ */ t(S, {
65
- state: e.item.value === h ? "checked" : "unchecked",
77
+ children: e.isOpen === void 0 ? /* @__PURE__ */ t(O, {
78
+ state: e.item.value === v ? "checked" : "unchecked",
66
79
  size: "sm",
67
80
  isDisabled: e.item.isDisabled === !0,
68
81
  ...a("selector-check")
@@ -72,24 +85,41 @@ function c(c) {
72
85
  color: "secondary"
73
86
  })
74
87
  })]
75
- }, e.item.value)), A;
76
- return p[9] !== c.label || p[10] !== O || p[11] !== k ? (A = /* @__PURE__ */ t("div", {
88
+ }, e.item.value), z = d.label, B;
89
+ g[11] === P ? B = g[12] : (B = (e) => {
90
+ P.current = e;
91
+ }, g[11] = P, g[12] = B);
92
+ let V;
93
+ g[13] !== L || g[14] !== R ? (V = (e) => /* @__PURE__ */ n(o, { children: [R(e), e.isOpen === !0 && /* @__PURE__ */ t("div", {
94
+ role: "group",
95
+ id: L(e),
96
+ children: e.item.children?.map((e) => R({
97
+ item: e,
98
+ level: 2
99
+ }))
100
+ })] }, e.item.value), g[13] = L, g[14] = R, g[15] = V) : V = g[15];
101
+ let H = D.filter(f).map(V), U;
102
+ return g[16] !== F || g[17] !== d.label || g[18] !== B || g[19] !== H ? (U = /* @__PURE__ */ t("div", {
77
103
  role: "tree",
78
- "aria-label": D,
79
- onKeyDown: O,
80
- children: k
81
- }), p[9] = c.label, p[10] = O, p[11] = k, p[12] = A) : A = p[12], A;
104
+ "aria-label": z,
105
+ ref: B,
106
+ onKeyDown: F,
107
+ children: H
108
+ }), g[16] = F, g[17] = d.label, g[18] = B, g[19] = H, g[20] = U) : U = g[20], U;
82
109
  }
83
- function l(e) {
110
+ function f(e) {
111
+ return e.level === 1;
112
+ }
113
+ function p(e) {
84
114
  return e.item.isDisabled !== !0;
85
115
  }
86
- function u(e) {
116
+ function m(e) {
87
117
  return {
88
118
  item: e,
89
119
  level: 2
90
120
  };
91
121
  }
92
- function d(e, t, n) {
122
+ function h(e, t, n) {
93
123
  let r = e.isOpen === void 0 && e.item.value === n, i = e.item.isDisabled === !0, o = a("selector-option-row", {
94
124
  size: t,
95
125
  selected: r ? "selected" : null,
@@ -110,14 +140,7 @@ function d(e, t, n) {
110
140
  ...s.style && { style: s.style }
111
141
  };
112
142
  }
113
- function f(e) {
114
- let t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
115
- if (t === 0) return;
116
- e.preventDefault();
117
- let n = [...e.currentTarget.querySelectorAll("[role=\"treeitem\"]")], r = n.findIndex((t) => t === e.target);
118
- n[Math.min(Math.max(r + t, 0), n.length - 1)]?.focus();
119
- }
120
- function p(e, t) {
143
+ function g(e, t) {
121
144
  for (let n of e) if (n.children === void 0) {
122
145
  if (n.value === t) return n;
123
146
  } else {
@@ -125,7 +148,7 @@ function p(e, t) {
125
148
  if (e !== void 0) return e;
126
149
  }
127
150
  }
128
- function m(e, t) {
151
+ function _(e, t) {
129
152
  let n = t.trim().toLowerCase();
130
153
  if (n === "") return [...e];
131
154
  let r = (e) => e.label.toLowerCase().includes(n);
@@ -138,4 +161,4 @@ function m(e, t) {
138
161
  }] : [];
139
162
  });
140
163
  }
141
- export { c as TreeOptions, p as leafOf, m as matchTree };
164
+ export { d as TreeOptions, g as leafOf, _ as matchTree };
@@ -133,11 +133,11 @@ var h = {
133
133
  $$css: !0
134
134
  },
135
135
  liveOn: {
136
- kWkggS: "aui1ewilqj auia3af2z",
136
+ kWkggS: "aui1ewilqj aui1komwgl",
137
137
  $$css: !0
138
138
  },
139
139
  liveOff: {
140
- kWkggS: "aui17x4s8c auia3af2z",
140
+ kWkggS: "aui17x4s8c aui1komwgl",
141
141
  $$css: !0
142
142
  }
143
143
  };
@@ -210,11 +210,11 @@ var x = {
210
210
  $$css: !0
211
211
  },
212
212
  liveOn: {
213
- kWkggS: "aui1ewilqj auia3af2z",
213
+ kWkggS: "aui1ewilqj aui1komwgl",
214
214
  $$css: !0
215
215
  },
216
216
  liveOff: {
217
- kWkggS: "aui17x4s8c auia3af2z",
217
+ kWkggS: "aui17x4s8c aui1komwgl",
218
218
  $$css: !0
219
219
  }
220
220
  };
@@ -1,5 +1,6 @@
1
1
  import { type DialogProps } from "@astryxdesign/core/Dialog";
2
2
  import { type ReactNode } from "react";
3
+ import type { Forwardable } from "../lib/forwardable.js";
3
4
  import { type TreeItem } from "../molecules/TreeOptions.js";
4
5
  import { type TreeSelectProps } from "./TreeSelect.js";
5
6
  /** The host-controlled draft of a token definition. */
@@ -12,7 +13,7 @@ export type TokenPickerValue = {
12
13
  readonly defaultValue: string;
13
14
  };
14
15
  /** What `TokenPickerDialog` takes. */
15
- export type TokenPickerDialogProps = Pick<DialogProps, "isOpen"> & {
16
+ export type TokenPickerDialogProps = Forwardable<Pick<DialogProps, "isOpen">> & {
16
17
  /** Closes or cancels the dialog. */
17
18
  readonly onClose: () => void;
18
19
  /** Dialog heading. */
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { Forwardable } from "../lib/forwardable.js";
2
3
  import { type LoadMoreOptions } from "../lib/useLoadMore.js";
3
4
  /** One thing `TransferPicker` offers. */
4
5
  export type TransferPickerOption<V extends string> = {
@@ -16,7 +17,7 @@ export type TransferPickerOption<V extends string> = {
16
17
  readonly error?: string | undefined;
17
18
  };
18
19
  /** What `TransferPicker` takes. */
19
- export type TransferPickerProps<V extends string> = Pick<LoadMoreOptions, "onLoadMore" | "hasMore" | "isLoadingMore"> & {
20
+ export type TransferPickerProps<V extends string> = Forwardable<Pick<LoadMoreOptions, "onLoadMore" | "hasMore" | "isLoadingMore">> & {
20
21
  /** Names the list of options (the start column). */
21
22
  readonly label: string;
22
23
  /** The options to pick from. */