@viasat/beam-react 2.30.0 → 2.37.0

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 (200) hide show
  1. package/assets/ActionList.css +1 -1
  2. package/assets/Avatar.css +1 -1
  3. package/assets/Badge.css +1 -1
  4. package/assets/Button.css +1 -1
  5. package/assets/Checkbox.css +1 -1
  6. package/assets/Chip.css +1 -1
  7. package/assets/ChipGroup.css +1 -1
  8. package/assets/CloseButton.css +1 -1
  9. package/assets/DateField.css +1 -0
  10. package/assets/EmptyState.css +1 -1
  11. package/assets/FloatingUI.css +1 -0
  12. package/assets/InputChoiceGroup.css +1 -1
  13. package/assets/Link.css +1 -1
  14. package/assets/NativeSelect.css +1 -1
  15. package/assets/Pagination.css +1 -1
  16. package/assets/ProgressBar.css +1 -1
  17. package/assets/RadioButton.css +1 -1
  18. package/assets/Search.css +1 -1
  19. package/assets/SpinnerWrap.css +1 -1
  20. package/assets/Switch.css +1 -1
  21. package/assets/TextArea.css +1 -1
  22. package/assets/TextField.css +1 -1
  23. package/assets/card.css +1 -1
  24. package/assets/combobox.css +1 -1
  25. package/assets/dialog.css +1 -1
  26. package/assets/fileUpload.css +1 -1
  27. package/assets/header.css +1 -1
  28. package/assets/index.css +1 -1
  29. package/assets/panel.css +1 -1
  30. package/assets/segmentedControl.css +1 -1
  31. package/assets/slider.css +1 -1
  32. package/assets/stepper.css +1 -1
  33. package/chunks/DateField.Segment.7oCeBSNo.js +1 -0
  34. package/chunks/DateField.Segment.DbjGMAPP.js +99 -0
  35. package/chunks/FloatingUI.arrow.BK0jH2ge.js +1 -0
  36. package/chunks/FloatingUI.arrow.BXR2atOC.js +28 -0
  37. package/chunks/dialog.module.Djvqgz-x.js +1 -0
  38. package/chunks/{dialog.module.TRHzVysh.js → dialog.module.vokt9Lwb.js} +2 -1
  39. package/chunks/panel.module.BVmRxZHo.js +1 -0
  40. package/chunks/{panel.module.BblnuBjO.js → panel.module.CnHWv4EZ.js} +1 -3
  41. package/lib/ActionList/ActionList.Group.d.ts +1 -1
  42. package/lib/Autocomplete/Autocomplete.cjs.js +1 -1
  43. package/lib/Autocomplete/Autocomplete.d.ts +5 -5
  44. package/lib/Autocomplete/Autocomplete.es.js +296 -268
  45. package/lib/Autocomplete/AutocompleteDropdown.cjs.js +1 -1
  46. package/lib/Autocomplete/AutocompleteDropdown.es.js +15 -12
  47. package/lib/Breadcrumbs/BreadcrumbsItem.d.ts +1 -1
  48. package/lib/Dialog/Dialog.Body.cjs.js +1 -1
  49. package/lib/Dialog/Dialog.Body.es.js +1 -1
  50. package/lib/Dialog/Dialog.Content.cjs.js +1 -1
  51. package/lib/Dialog/Dialog.Content.es.js +1 -1
  52. package/lib/Dialog/Dialog.Footer.cjs.js +1 -1
  53. package/lib/Dialog/Dialog.Footer.es.js +1 -1
  54. package/lib/Dialog/Dialog.Header.cjs.js +1 -1
  55. package/lib/Dialog/Dialog.Header.es.js +1 -1
  56. package/lib/Dialog/Dialog.cjs.js +1 -1
  57. package/lib/Dialog/Dialog.es.js +1 -1
  58. package/lib/FloatingUI/FloatingUI.arrow.cjs.js +1 -1
  59. package/lib/FloatingUI/FloatingUI.arrow.es.js +6 -17
  60. package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
  61. package/lib/FloatingUI/FloatingUI.content.es.js +31 -32
  62. package/lib/Search/SearchDropdown.cjs.js +1 -1
  63. package/lib/Search/SearchDropdown.es.js +1 -1
  64. package/lib/Select/Select.cjs.js +1 -1
  65. package/lib/Select/Select.d.ts +3 -2
  66. package/lib/Select/Select.es.js +208 -195
  67. package/lib/Select/SelectDropdown.cjs.js +1 -1
  68. package/lib/Select/SelectDropdown.es.js +15 -12
  69. package/lib/SideNav/SideNavActionList.es.js +1 -0
  70. package/lib/SideNav/SideNavActionListItemLabel.d.ts +1 -1
  71. package/lib/Slider/DualSlider.cjs.js +1 -1
  72. package/lib/Slider/DualSlider.es.js +28 -27
  73. package/lib/Slider/SingleSlider.cjs.js +1 -1
  74. package/lib/Slider/SingleSlider.es.js +1 -1
  75. package/lib/Slider/Slider.es.js +17 -17
  76. package/lib/Slider/hooks/useDualSliderLogic.cjs.js +1 -1
  77. package/lib/Slider/hooks/useDualSliderLogic.es.js +14 -14
  78. package/lib/Slider/hooks/useSingleSliderLogic.cjs.js +1 -1
  79. package/lib/Slider/hooks/useSingleSliderLogic.es.js +17 -17
  80. package/lib/Tabs/Tabs.Group.d.ts +2 -2
  81. package/lib/Tabs/Tabs.Item.d.ts +2 -2
  82. package/lib/Tabs/Tabs.Panel.d.ts +2 -2
  83. package/lib/Text/Text.d.ts +2 -2
  84. package/lib/Text/Text.es.js +12 -12
  85. package/lib/_Options/Option.cjs.js +1 -1
  86. package/lib/_Options/Option.context.cjs.js +1 -1
  87. package/lib/_Options/Option.context.d.ts +31 -13
  88. package/lib/_Options/Option.context.es.js +133 -88
  89. package/lib/_Options/Option.es.js +23 -21
  90. package/lib/_Options/Option.types.d.ts +23 -0
  91. package/lib/_Options/OptionGroup.cjs.js +1 -0
  92. package/lib/_Options/OptionGroup.context.cjs.js +1 -0
  93. package/lib/_Options/OptionGroup.context.d.ts +6 -0
  94. package/lib/_Options/OptionGroup.context.es.js +6 -0
  95. package/lib/_Options/OptionGroup.d.ts +3 -0
  96. package/lib/_Options/OptionGroup.es.js +22 -0
  97. package/lib/_Options/getLastVisibleStructureIndex.cjs.js +1 -0
  98. package/lib/_Options/getLastVisibleStructureIndex.d.ts +15 -0
  99. package/lib/_Options/getLastVisibleStructureIndex.es.js +14 -0
  100. package/lib/_Options/index.cjs.js +1 -1
  101. package/lib/_Options/index.d.ts +4 -0
  102. package/lib/_Options/index.es.js +13 -4
  103. package/lib/_Options/useRenderOption.cjs.js +1 -0
  104. package/lib/_Options/useRenderOption.d.ts +30 -0
  105. package/lib/_Options/useRenderOption.es.js +43 -0
  106. package/lib/wip/DateField/DateField.Segment.cjs.js +1 -0
  107. package/lib/wip/DateField/DateField.Segment.d.ts +2 -0
  108. package/lib/wip/DateField/DateField.Segment.es.js +8 -0
  109. package/lib/wip/DateField/DateField.Segments.cjs.js +1 -0
  110. package/lib/wip/DateField/DateField.Segments.d.ts +17 -0
  111. package/lib/wip/DateField/DateField.Segments.es.js +61 -0
  112. package/lib/wip/DateField/DateField.cjs.js +1 -0
  113. package/lib/wip/DateField/DateField.d.ts +3 -0
  114. package/lib/wip/DateField/DateField.es.js +191 -0
  115. package/lib/wip/DateField/DateField.types.cjs.js +1 -0
  116. package/lib/wip/DateField/DateField.types.d.ts +118 -0
  117. package/lib/wip/DateField/DateField.types.es.js +1 -0
  118. package/lib/wip/DateField/DateField.utils.cjs.js +1 -0
  119. package/lib/wip/DateField/DateField.utils.d.ts +26 -0
  120. package/lib/wip/DateField/DateField.utils.es.js +45 -0
  121. package/lib/wip/DateField/DateField.validation.cjs.js +1 -0
  122. package/lib/wip/DateField/DateField.validation.d.ts +26 -0
  123. package/lib/wip/DateField/DateField.validation.es.js +24 -0
  124. package/lib/wip/DateField/index.cjs.js +1 -0
  125. package/lib/wip/DateField/index.d.ts +2 -0
  126. package/lib/wip/DateField/index.es.js +4 -0
  127. package/lib/wip/DateField/useDateFieldFocus.cjs.js +1 -0
  128. package/lib/wip/DateField/useDateFieldFocus.d.ts +23 -0
  129. package/lib/wip/DateField/useDateFieldFocus.es.js +65 -0
  130. package/lib/wip/DateField/useDateFieldForm.cjs.js +1 -0
  131. package/lib/wip/DateField/useDateFieldForm.d.ts +32 -0
  132. package/lib/wip/DateField/useDateFieldForm.es.js +51 -0
  133. package/lib/wip/DateField/useDateFieldSegments.cjs.js +1 -0
  134. package/lib/wip/DateField/useDateFieldSegments.d.ts +7 -0
  135. package/lib/wip/DateField/useDateFieldSegments.es.js +13 -0
  136. package/lib/wip/DateField/useDateFieldValidity.cjs.js +1 -0
  137. package/lib/wip/DateField/useDateFieldValidity.d.ts +23 -0
  138. package/lib/wip/DateField/useDateFieldValidity.es.js +19 -0
  139. package/lib/wip/DateField/useDateFieldValue.cjs.js +1 -0
  140. package/lib/wip/DateField/useDateFieldValue.d.ts +19 -0
  141. package/lib/wip/DateField/useDateFieldValue.es.js +62 -0
  142. package/lib/wip/DateField/useInvalidState.cjs.js +1 -0
  143. package/lib/wip/DateField/useInvalidState.d.ts +13 -0
  144. package/lib/wip/DateField/useInvalidState.es.js +8 -0
  145. package/lib/wip/Panel/Footer/Panel.Footer.Actions.cjs.js +1 -1
  146. package/lib/wip/Panel/Footer/Panel.Footer.Actions.es.js +1 -1
  147. package/lib/wip/Panel/Footer/Panel.Footer.cjs.js +1 -1
  148. package/lib/wip/Panel/Footer/Panel.Footer.es.js +1 -1
  149. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.cjs.js +1 -1
  150. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.es.js +1 -1
  151. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.cjs.js +1 -1
  152. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.es.js +1 -1
  153. package/lib/wip/Panel/Header/Panel.Header.Description.cjs.js +1 -1
  154. package/lib/wip/Panel/Header/Panel.Header.Description.es.js +1 -1
  155. package/lib/wip/Panel/Header/Panel.Header.Heading.cjs.js +1 -1
  156. package/lib/wip/Panel/Header/Panel.Header.Heading.es.js +1 -1
  157. package/lib/wip/Panel/Header/Panel.Header.Row.cjs.js +1 -1
  158. package/lib/wip/Panel/Header/Panel.Header.Row.es.js +1 -1
  159. package/lib/wip/Panel/Header/Panel.Header.Subheader.cjs.js +1 -1
  160. package/lib/wip/Panel/Header/Panel.Header.Subheader.es.js +1 -1
  161. package/lib/wip/Panel/Header/Panel.Header.cjs.js +1 -1
  162. package/lib/wip/Panel/Header/Panel.Header.es.js +1 -1
  163. package/lib/wip/Panel/Panel.Body.cjs.js +1 -1
  164. package/lib/wip/Panel/Panel.Body.es.js +1 -1
  165. package/lib/wip/Panel/Panel.Inline.cjs.js +1 -1
  166. package/lib/wip/Panel/Panel.Inline.d.ts +3 -1
  167. package/lib/wip/Panel/Panel.Inline.es.js +44 -40
  168. package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -1
  169. package/lib/wip/Panel/Panel.Overlay.d.ts +18 -2
  170. package/lib/wip/Panel/Panel.Overlay.es.js +110 -84
  171. package/lib/wip/Panel/Panel.ResizeHandle.cjs.js +1 -1
  172. package/lib/wip/Panel/Panel.ResizeHandle.es.js +1 -1
  173. package/lib/wip/Panel/Panel.cjs.js +1 -1
  174. package/lib/wip/Panel/Panel.d.ts +1 -1
  175. package/lib/wip/Panel/Panel.es.js +125 -94
  176. package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
  177. package/lib/wip/Panel/Panel.helpers.d.ts +2 -1
  178. package/lib/wip/Panel/Panel.helpers.es.js +37 -35
  179. package/lib/wip/Panel/Panel.types.d.ts +64 -10
  180. package/lib/wip/Panel/Panel.useResize.cjs.js +1 -1
  181. package/lib/wip/Panel/Panel.useResize.d.ts +3 -1
  182. package/lib/wip/Panel/Panel.useResize.es.js +34 -30
  183. package/lib/wip/index.cjs.js +1 -1
  184. package/lib/wip/index.d.ts +1 -0
  185. package/lib/wip/index.es.js +4 -2
  186. package/package.json +6 -6
  187. package/utils/hooks/index.cjs.js +1 -1
  188. package/utils/hooks/index.d.ts +1 -0
  189. package/utils/hooks/index.es.js +12 -10
  190. package/utils/hooks/useElementResize.cjs.js +1 -1
  191. package/utils/hooks/useElementResize.d.ts +1 -1
  192. package/utils/hooks/useElementResize.es.js +33 -33
  193. package/utils/hooks/usePrevious.cjs.js +1 -0
  194. package/utils/hooks/usePrevious.d.ts +5 -0
  195. package/utils/hooks/usePrevious.es.js +10 -0
  196. package/assets/floatingui.css +0 -1
  197. package/chunks/dialog.module.C_6Qrg4w.js +0 -1
  198. package/chunks/floatingui.module.BcBFebz0.js +0 -10
  199. package/chunks/floatingui.module.D3Aw_aYe.js +0 -1
  200. package/chunks/panel.module.CVyUzyCZ.js +0 -1
@@ -1,123 +1,168 @@
1
- import { createContext as S, useRef as C, useState as b, useMemo as p, useCallback as i, useContext as k } from "react";
2
- const P = S(null), E = P.Provider, L = () => {
3
- const r = k(P);
4
- if (!r)
1
+ import { createContext as H, useRef as C, useState as d, useMemo as O, useCallback as s, useContext as J } from "react";
2
+ const S = H(null), N = S.Provider, Q = () => {
3
+ const o = J(S);
4
+ if (!o)
5
5
  throw new Error("useOptionsContext must be used within an OptionsProvider");
6
- return r;
7
- }, B = (r) => Array.isArray(r) ? r : r !== void 0 ? [r] : [], T = (r, s, u) => {
8
- const O = C(void 0), [c, x] = b(
6
+ return o;
7
+ }, E = (o) => Array.isArray(o) ? o : o !== void 0 ? [o] : [], U = (o, c, p) => {
8
+ const w = C(void 0), [i, h] = d(
9
9
  () => /* @__PURE__ */ new Map()
10
- ), [a, g] = b(() => []), w = C(c);
11
- w.current = c;
12
- const d = p(() => B(r), [r]), f = C(d);
13
- f.current = d, p(() => {
14
- if (!d.length)
15
- O.current = void 0;
10
+ ), [u, y] = d(() => []), [D, I] = d(
11
+ () => /* @__PURE__ */ new Map()
12
+ ), [M, v] = d(
13
+ () => /* @__PURE__ */ new Map()
14
+ ), [m, g] = d(() => []), x = C(i);
15
+ x.current = i;
16
+ const a = O(() => E(o), [o]), f = C(a);
17
+ f.current = a, O(() => {
18
+ if (!a.length)
19
+ w.current = void 0;
16
20
  else {
17
- const e = d[d.length - 1], n = a.map((t) => c.get(t)).findIndex((t) => (t == null ? void 0 : t.value) === e);
18
- O.current = n;
21
+ const e = a[a.length - 1], n = u.map((t) => i.get(t)).findIndex((t) => (t == null ? void 0 : t.value) === e);
22
+ w.current = n;
19
23
  }
20
- }, [d, a, c]);
21
- const m = i(
24
+ }, [a, u, i]);
25
+ const G = s(
22
26
  (e) => {
23
- const n = w.current.get(e), t = n == null ? void 0 : n.value, o = f.current;
24
- n && t && s(u ? [...o.filter((l) => l !== t), t] : t);
27
+ const n = x.current.get(e), t = n == null ? void 0 : n.value, r = f.current;
28
+ n && t && c(p ? [...r.filter((l) => l !== t), t] : t);
25
29
  },
26
- [u, s]
27
- ), v = i(
30
+ [p, c]
31
+ ), k = s(
28
32
  (e) => {
29
- const n = w.current.get(e), t = n == null ? void 0 : n.value, o = f.current;
33
+ const n = x.current.get(e), t = n == null ? void 0 : n.value, r = f.current;
30
34
  if (n && t)
31
- if (u) {
32
- if (!o.includes(t)) return;
33
- s(o.filter((l) => l !== t));
35
+ if (p) {
36
+ if (!r.includes(t)) return;
37
+ c(r.filter((l) => l !== t));
34
38
  } else
35
39
  return;
36
40
  },
37
- [u, s]
38
- ), y = i(
41
+ [p, c]
42
+ ), L = s(
39
43
  (e) => {
40
- if (!u || e === void 0) return;
41
- const t = B(e)[0];
44
+ if (!p || e === void 0) return;
45
+ const t = E(e)[0];
42
46
  if (!t) return;
43
- const o = f.current;
44
- o.includes(t) && s(o.filter((l) => l !== t));
47
+ const r = f.current;
48
+ r.includes(t) && c(r.filter((l) => l !== t));
49
+ },
50
+ [p, c]
51
+ ), z = s(
52
+ (e, n) => {
53
+ y((t) => [...t, e]), v((t) => {
54
+ const r = new Map(t);
55
+ return r.set(e, n), r;
56
+ }), n === null && g((t) => [...t, { kind: "option", id: e }]);
57
+ },
58
+ []
59
+ ), P = s(
60
+ (e) => {
61
+ y((n) => n.filter((t) => t !== e)), h((n) => {
62
+ const t = new Map(n);
63
+ return t.delete(e), t;
64
+ }), v((n) => {
65
+ const t = new Map(n);
66
+ return t.delete(e), t;
67
+ }), g(
68
+ (n) => n.filter((t) => !(t.kind === "option" && t.id === e))
69
+ );
70
+ },
71
+ []
72
+ ), V = s(
73
+ (e, n) => h((t) => {
74
+ const r = new Map(t);
75
+ return r.set(e, n), r;
76
+ }),
77
+ []
78
+ ), A = s(
79
+ (e) => {
80
+ g((n) => [...n, { kind: "group", id: e }]);
45
81
  },
46
- [u, s]
47
- ), z = i(
48
- (e) => g((n) => [...n, e]),
49
- [g]
50
- ), I = i(
82
+ []
83
+ ), B = s(
51
84
  (e) => {
52
- g((n) => n.filter((t) => t !== e)), x((n) => {
85
+ I((n) => {
53
86
  const t = new Map(n);
54
87
  return t.delete(e), t;
55
- });
88
+ }), g(
89
+ (n) => n.filter((t) => !(t.kind === "group" && t.id === e))
90
+ );
56
91
  },
57
- [x, g]
58
- ), h = i(
59
- (e, n) => x((t) => {
60
- const o = new Map(t);
61
- return o.set(e, n), o;
92
+ []
93
+ ), R = s(
94
+ (e, n) => I((t) => {
95
+ const r = new Map(t);
96
+ return r.set(e, n), r;
62
97
  }),
63
- [x]
64
- ), M = p(
98
+ []
99
+ ), T = O(
65
100
  () => ({
66
- setValue: s,
101
+ setValue: c,
67
102
  registerOption: z,
68
- unregisterOption: I,
69
- setOptionProps: h,
70
- selectOption: m,
71
- deselectOption: v
103
+ unregisterOption: P,
104
+ setOptionProps: V,
105
+ selectOption: G,
106
+ deselectOption: k,
107
+ registerGroup: A,
108
+ unregisterGroup: B,
109
+ setGroupProps: R
72
110
  }),
73
111
  [
74
- s,
112
+ c,
75
113
  z,
76
- I,
77
- h,
78
- m,
79
- v
114
+ P,
115
+ V,
116
+ G,
117
+ k,
118
+ A,
119
+ B,
120
+ R
80
121
  ]
81
- ), V = p(() => {
82
- if (!r || !c.size) return [];
83
- const e = Array.from(c.values()), n = new Map(
122
+ ), j = O(() => {
123
+ if (!o || !i.size) return [];
124
+ const e = Array.from(i.values()), n = new Map(
84
125
  e.map((t) => [t.value, t])
85
126
  );
86
127
  return f.current.length === 0 ? [] : f.current.map((t) => n.get(t)).filter(Boolean);
87
- }, [r, c]), A = i(
88
- (e) => w.current.get(e),
128
+ }, [o, i]), b = s(
129
+ (e) => x.current.get(e),
89
130
  []
90
- ), R = i(
131
+ ), q = s(
91
132
  (e) => {
92
- const n = a[e];
133
+ const n = u[e];
93
134
  if (n)
94
- return A(n);
135
+ return b(n);
95
136
  },
96
- [A, a]
97
- );
98
- return p(
99
- () => ({
100
- optionsContext: M,
101
- selectedOptionsProps: V,
102
- optionIds: a,
103
- optionsProps: c,
104
- deselectOptionValue: y,
105
- indexOfLastSelectedOptionRef: O,
106
- getOptionByIndex: R
107
- }),
108
- [
109
- M,
110
- y,
111
- a,
112
- c,
113
- V,
114
- O,
115
- R
116
- ]
117
- );
137
+ [b, u]
138
+ ), F = O(() => {
139
+ const e = /* @__PURE__ */ new Map();
140
+ return m.forEach((n) => {
141
+ n.kind === "group" && e.set(n.id, []);
142
+ }), u.forEach((n) => {
143
+ const t = M.get(n);
144
+ if (t != null) {
145
+ const r = e.get(t);
146
+ r && r.push(n);
147
+ }
148
+ }), e;
149
+ }, [m, u, M]);
150
+ return {
151
+ optionsContext: T,
152
+ selectedOptionsProps: j,
153
+ optionIds: u,
154
+ optionsProps: i,
155
+ deselectOptionValue: L,
156
+ indexOfLastSelectedOptionRef: w,
157
+ getOptionByIndex: q,
158
+ structureIds: m,
159
+ groupsProps: D,
160
+ optionGroupOf: M,
161
+ optionIdsByGroup: F
162
+ };
118
163
  };
119
164
  export {
120
- E as OptionsProvider,
121
- T as useCreateOptionsContext,
122
- L as useOptionsContext
165
+ N as OptionsProvider,
166
+ U as useCreateOptionsContext,
167
+ Q as useOptionsContext
123
168
  };
@@ -1,31 +1,33 @@
1
1
  import { jsx as x } from "react/jsx-runtime";
2
- import { useMemo as l, useCallback as b, useLayoutEffect as d, useEffect as g } from "react";
3
- import { useOptionsContext as C } from "./Option.context.es.js";
4
- import { extractTextFromReactNode as N } from "../../utils/functions.es.js";
5
- const k = ({
6
- className: v,
7
- label: n,
8
- value: f,
9
- children: e,
10
- ...r
2
+ import { useMemo as d, useCallback as g, useLayoutEffect as C, useEffect as N } from "react";
3
+ import { useOptionsContext as b } from "./Option.context.es.js";
4
+ import { useOptionGroupContext as v } from "./OptionGroup.context.es.js";
5
+ import { extractTextFromReactNode as E } from "../../utils/functions.es.js";
6
+ import { useId as I } from "../../utils/hooks/useId.es.js";
7
+ const P = ({
8
+ className: j,
9
+ label: r,
10
+ value: l,
11
+ children: o,
12
+ ...n
11
13
  }) => {
12
- const o = l(() => n ?? N(e), [n, e]), s = f ?? o, {
14
+ const e = d(() => r ?? E(o), [r, o]), s = l ?? e, {
13
15
  selectOption: i,
14
- deselectOption: a,
15
- registerOption: c,
16
+ deselectOption: p,
17
+ registerOption: u,
16
18
  unregisterOption: m,
17
- setOptionProps: p
18
- } = C(), t = l(() => Symbol("OptionId"), []), u = b(
19
+ setOptionProps: a
20
+ } = b(), { groupId: c } = v(), t = I() ?? "", f = g(
19
21
  (O) => {
20
- O ? i(t) : a(t);
22
+ O ? i(t) : p(t);
21
23
  },
22
- [a, t, i]
24
+ [p, t, i]
23
25
  );
24
- return d(() => (c(t), () => m(t)), [t, c, m]), g(() => {
25
- p(t, { ...r, label: o, value: s, children: e, onSelectionChange: u });
26
- }, [e, t, o, u, r, p, s]), /* @__PURE__ */ x("option", { value: s, children: o });
26
+ return C(() => (u(t, c), () => m(t)), [t, c, u, m]), N(() => {
27
+ a(t, { ...n, label: e, value: s, children: o, onSelectionChange: f });
28
+ }, [o, t, e, f, n, a, s]), /* @__PURE__ */ x("option", { value: s, children: e });
27
29
  };
28
30
  export {
29
- k as Option,
30
- k as default
31
+ P as Option,
32
+ P as default
31
33
  };
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ActionListItemProps } from '../ActionList/ActionList.Item';
2
3
  export interface OptionProps extends Omit<ActionListItemProps, 'defaultSelected' | 'kind' | 'indent' | 'role'> {
3
4
  /**
@@ -9,3 +10,25 @@ export interface OptionProps extends Omit<ActionListItemProps, 'defaultSelected'
9
10
  */
10
11
  label?: string;
11
12
  }
13
+ export interface OptionGroupProps {
14
+ /**
15
+ * Visible group label rendered above the group's options. Used as the source for `aria-label` on the group container.
16
+ */
17
+ heading?: string | ReactNode;
18
+ /**
19
+ * Render a visual separator below the group.
20
+ *
21
+ * @default false
22
+ */
23
+ divider?: boolean;
24
+ /**
25
+ * Disables every Option inside the group. Heading remains visible; options are non-interactive.
26
+ *
27
+ * @default false
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * `Option` components. Nested `OptionGroup`s are not supported.
32
+ */
33
+ children?: ReactNode;
34
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),O=require("./Option.context.cjs.js"),G=require("./OptionGroup.context.cjs.js"),a=require("../../utils/hooks/useId.cjs.js"),p=({heading:o,divider:u,disabled:r,children:c})=>{const{registerGroup:s,unregisterGroup:n,setGroupProps:i}=O.useOptionsContext(),e=a.useId()??"";t.useLayoutEffect(()=>(s(e),()=>n(e)),[e,s,n]),t.useEffect(()=>{i(e,{heading:o,divider:u,disabled:r})},[e,o,u,r,i]);const _=t.useMemo(()=>({groupId:e}),[e]);return l.jsx(G.OptionGroupProvider,{value:_,children:c})};exports.OptionGroup=p;exports.default=p;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),t=o.createContext({groupId:null}),e=t.Provider,r=()=>o.useContext(t);exports.OptionGroupProvider=e;exports.useOptionGroupContext=r;
@@ -0,0 +1,6 @@
1
+ interface OptionGroupContextValue {
2
+ groupId: string | null;
3
+ }
4
+ export declare const OptionGroupProvider: import('react').Provider<OptionGroupContextValue>;
5
+ export declare const useOptionGroupContext: () => OptionGroupContextValue;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { createContext as t, useContext as r } from "react";
2
+ const o = t({ groupId: null }), n = o.Provider, p = () => r(o);
3
+ export {
4
+ n as OptionGroupProvider,
5
+ p as useOptionGroupContext
6
+ };
@@ -0,0 +1,3 @@
1
+ import { OptionGroupProps } from './Option.types';
2
+ export declare const OptionGroup: ({ heading, divider, disabled, children, }: OptionGroupProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default OptionGroup;
@@ -0,0 +1,22 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useLayoutEffect as i, useEffect as c, useMemo as G } from "react";
3
+ import { useOptionsContext as x } from "./Option.context.es.js";
4
+ import { OptionGroupProvider as a } from "./OptionGroup.context.es.js";
5
+ import { useId as O } from "../../utils/hooks/useId.es.js";
6
+ const j = ({
7
+ heading: r,
8
+ divider: t,
9
+ disabled: e,
10
+ children: m
11
+ }) => {
12
+ const { registerGroup: u, unregisterGroup: p, setGroupProps: s } = x(), o = O() ?? "";
13
+ i(() => (u(o), () => p(o)), [o, u, p]), c(() => {
14
+ s(o, { heading: r, divider: t, disabled: e });
15
+ }, [o, r, t, e, s]);
16
+ const n = G(() => ({ groupId: o }), [o]);
17
+ return /* @__PURE__ */ f(a, { value: n, children: m });
18
+ };
19
+ export {
20
+ j as OptionGroup,
21
+ j as default
22
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(i,o,n={}){for(let t=i.length-1;t>=0;t--){const e=i[t];if(e.kind==="option"){if(!n[e.id])return t}else if((o.get(e.id)??[]).some(r=>!n[r]))return t}return-1}exports.getLastVisibleStructureIndex=s;
@@ -0,0 +1,15 @@
1
+ import { StructureNode } from './Option.context';
2
+ /**
3
+ * Find the index of the last visible node in an options dropdown structure.
4
+ *
5
+ * Used to determine which group should suppress its trailing divider (the one
6
+ * that ends up as the last visible thing in the dropdown).
7
+ *
8
+ * - For an option node: visible when not filtered out.
9
+ * - For a group node: visible when at least one of its options is not filtered.
10
+ *
11
+ * Pass `filteredOptionsById` when the consumer supports filtering (Autocomplete).
12
+ * Omit it for non-filtering consumers (Select); options are then treated as
13
+ * always visible and groups are treated as visible when non-empty.
14
+ */
15
+ export declare function getLastVisibleStructureIndex(structureIds: StructureNode[], optionIdsByGroup: Map<string, string[]>, filteredOptionsById?: Record<string, boolean>): number;
@@ -0,0 +1,14 @@
1
+ function u(t, e, o = {}) {
2
+ for (let i = t.length - 1; i >= 0; i--) {
3
+ const n = t[i];
4
+ if (n.kind === "option") {
5
+ if (!o[n.id]) return i;
6
+ } else if ((e.get(n.id) ?? []).some(
7
+ (s) => !o[s]
8
+ )) return i;
9
+ }
10
+ return -1;
11
+ }
12
+ export {
13
+ u as getLastVisibleStructureIndex
14
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Option.context.cjs.js"),t=require("./Option.cjs.js"),o=require("./useSelectValue.cjs.js");exports.OptionsProvider=e.OptionsProvider;exports.useCreateOptionsContext=e.useCreateOptionsContext;exports.useOptionsContext=e.useOptionsContext;exports.Option=t.Option;exports.useSelectValue=o.useSelectValue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Option.context.cjs.js"),o=require("./Option.cjs.js"),i=require("./OptionGroup.cjs.js"),t=require("./OptionGroup.context.cjs.js"),n=require("./getLastVisibleStructureIndex.cjs.js"),r=require("./useRenderOption.cjs.js"),s=require("./useSelectValue.cjs.js");exports.OptionsProvider=e.OptionsProvider;exports.useCreateOptionsContext=e.useCreateOptionsContext;exports.useOptionsContext=e.useOptionsContext;exports.Option=o.Option;exports.OptionGroup=i.OptionGroup;exports.OptionGroupProvider=t.OptionGroupProvider;exports.useOptionGroupContext=t.useOptionGroupContext;exports.getLastVisibleStructureIndex=n.getLastVisibleStructureIndex;exports.useRenderOption=r.useRenderOption;exports.useSelectValue=s.useSelectValue;
@@ -1,4 +1,8 @@
1
1
  export * from './Option.types';
2
2
  export * from './Option.context';
3
3
  export * from './Option';
4
+ export * from './OptionGroup';
5
+ export * from './OptionGroup.context';
6
+ export * from './getLastVisibleStructureIndex';
7
+ export * from './useRenderOption';
4
8
  export * from './useSelectValue';
@@ -1,10 +1,19 @@
1
1
  import { OptionsProvider as t, useCreateOptionsContext as r, useOptionsContext as p } from "./Option.context.es.js";
2
- import { Option as s } from "./Option.es.js";
3
- import { useSelectValue as x } from "./useSelectValue.es.js";
2
+ import { Option as i } from "./Option.es.js";
3
+ import { OptionGroup as x } from "./OptionGroup.es.js";
4
+ import { OptionGroupProvider as O, useOptionGroupContext as f } from "./OptionGroup.context.es.js";
5
+ import { getLastVisibleStructureIndex as d } from "./getLastVisibleStructureIndex.es.js";
6
+ import { useRenderOption as a } from "./useRenderOption.es.js";
7
+ import { useSelectValue as G } from "./useSelectValue.es.js";
4
8
  export {
5
- s as Option,
9
+ i as Option,
10
+ x as OptionGroup,
11
+ O as OptionGroupProvider,
6
12
  t as OptionsProvider,
13
+ d as getLastVisibleStructureIndex,
7
14
  r as useCreateOptionsContext,
15
+ f as useOptionGroupContext,
8
16
  p as useOptionsContext,
9
- x as useSelectValue
17
+ a as useRenderOption,
18
+ G as useSelectValue
10
19
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),d=require("clsx"),S=require("../ActionList/ActionList.cjs.js");function g({optionsProps:t,selectionStrategy:n,value:r,multiple:i,optionClassName:l,filteredOptionsById:c}){return a.useCallback((s,o)=>{const e=t.get(s);if(!e)return null;const b=n.isSelected(e.value,r),u=(c==null?void 0:c[s])??!1,k=u||e.disabled||!!o;return a.createElement(S.ActionList.Item,{...e,className:d(l,e.className),disabled:k,hidden:u,defaultSelected:b,key:s,kind:i?"checkbox":"singleCheckMark",role:"option"})},[t,n,r,i,l,c])}exports.useRenderOption=g;
@@ -0,0 +1,30 @@
1
+ import { OptionProps } from './Option.types';
2
+ import { SelectionStrategy, SelectValue } from './strategies/SelectionStrategy';
3
+ export interface UseRenderOptionParams {
4
+ /** Live options registry from `useCreateOptionsContext`. */
5
+ optionsProps: Map<string, OptionProps>;
6
+ /** Selection strategy (single vs multi) from `createSelectionStrategy`. */
7
+ selectionStrategy: SelectionStrategy;
8
+ /** Current selected value (single string or array for multi). */
9
+ value: SelectValue;
10
+ /** Whether the parent is in multiselect mode (affects item kind). */
11
+ multiple: boolean;
12
+ /** CSS class applied to each rendered `ActionList.Item` for parent-specific styling. */
13
+ optionClassName?: string;
14
+ /**
15
+ * Per-option "filtered out" map (Autocomplete only). When set, filtered
16
+ * options render with `hidden` and `disabled` so keyboard navigation skips
17
+ * them while their `useListItem` index stays stable. Omit on consumers that
18
+ * don't filter (Select).
19
+ */
20
+ filteredOptionsById?: Record<string, boolean>;
21
+ }
22
+ /**
23
+ * Shared per-option renderer for `Autocomplete` and `Select` dropdowns.
24
+ *
25
+ * Returns a stable `(optionId, groupDisabled?)` callback the parent invokes
26
+ * while walking its rendered structure. Centralises the `ActionList.Item`
27
+ * wiring (className, disabled cascade, selection mirror, role, key) so both
28
+ * components stay in lockstep.
29
+ */
30
+ export declare function useRenderOption({ optionsProps, selectionStrategy, value, multiple, optionClassName, filteredOptionsById, }: UseRenderOptionParams): (optionId: string, groupDisabled?: boolean) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,43 @@
1
+ import { useCallback as b, createElement as i } from "react";
2
+ import h from "clsx";
3
+ import { ActionList as x } from "../ActionList/ActionList.es.js";
4
+ function g({
5
+ optionsProps: s,
6
+ selectionStrategy: a,
7
+ value: l,
8
+ multiple: n,
9
+ optionClassName: m,
10
+ filteredOptionsById: c
11
+ }) {
12
+ return b(
13
+ (r, u) => {
14
+ const e = s.get(r);
15
+ if (!e) return null;
16
+ const k = a.isSelected(e.value, l), t = (c == null ? void 0 : c[r]) ?? !1, o = t || e.disabled || !!u;
17
+ return /* @__PURE__ */ i(
18
+ x.Item,
19
+ {
20
+ ...e,
21
+ className: h(m, e.className),
22
+ disabled: o,
23
+ hidden: t,
24
+ defaultSelected: k,
25
+ key: r,
26
+ kind: n ? "checkbox" : "singleCheckMark",
27
+ role: "option"
28
+ }
29
+ );
30
+ },
31
+ [
32
+ s,
33
+ a,
34
+ l,
35
+ n,
36
+ m,
37
+ c
38
+ ]
39
+ );
40
+ }
41
+ export {
42
+ g as useRenderOption
43
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("clsx");require("react");const e=require("../../../chunks/DateField.Segment.7oCeBSNo.js");require("./DateField.utils.cjs.js");exports.DateFieldSegment=e.DateFieldSegment;
@@ -0,0 +1,2 @@
1
+ import { DateFieldSegmentProps } from './DateField.types';
2
+ export declare const DateFieldSegment: ({ type, value, displayValue, isPlaceholder, isActive, disabled, readOnly, onFocus, onBlur, onInput, segmentRef, }: DateFieldSegmentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import "react/jsx-runtime";
2
+ import "clsx";
3
+ import "react";
4
+ import { D as p } from "../../../chunks/DateField.Segment.DbjGMAPP.js";
5
+ import "./DateField.utils.es.js";
6
+ export {
7
+ p as DateFieldSegment
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("../../../chunks/DateField.Segment.7oCeBSNo.js"),l=require("./DateField.utils.cjs.js"),i=[{type:"month",value:""},{type:"literal",value:"/"},{type:"day",value:""},{type:"literal",value:"/"},{type:"year",value:""}],F={month:"MM",day:"DD",year:"YYYY"},R=l.getSegmentOrder(i),v=({segmentText:n,segmentValues:r,focusedSegment:o,disabled:u,readOnly:c,onSegmentFocus:d,onSegmentBlur:y,onSegmentInput:m,registerSegmentRef:p})=>a.jsx("span",{className:t.styles[t.staticDateFieldClassNames.segments],children:i.map((s,D)=>{if(s.type==="literal")return a.jsx("span",{"aria-hidden":"true",className:t.styles[t.staticDateFieldClassNames.separator],children:s.value},`literal-${D}`);const e=s.type,g=F[e],{displayValue:S,isPlaceholder:_}=l.getSegmentDisplay(e,n[e],g);return a.jsx(t.DateFieldSegment,{type:e,value:r[e],displayValue:S,isPlaceholder:_,isActive:o===e,disabled:u,readOnly:c,onFocus:()=>d(e),onBlur:y,onInput:m,segmentRef:p(e)},e)})});exports.DateFieldSegments=v;exports.PARTS_ORDER=R;
@@ -0,0 +1,17 @@
1
+ import { FocusEvent } from 'react';
2
+ import { FocusTarget, SegmentText, SegmentType, SegmentValues } from './DateField.types';
3
+ export declare const PARTS_ORDER: ReadonlyArray<SegmentType>;
4
+ export interface DateFieldSegmentsProps {
5
+ /** Per-segment raw strings — the single source of truth for display. */
6
+ segmentText: SegmentText;
7
+ /** Derived per-segment numbers for `aria-valuenow`. */
8
+ segmentValues: SegmentValues;
9
+ focusedSegment: FocusTarget;
10
+ disabled: boolean;
11
+ readOnly: boolean;
12
+ onSegmentFocus: (segment: SegmentType) => void;
13
+ onSegmentBlur: (event: FocusEvent<HTMLSpanElement>) => void;
14
+ onSegmentInput: (segment: SegmentType, char: string) => void;
15
+ registerSegmentRef: (segment: SegmentType) => (element: HTMLSpanElement | null) => void;
16
+ }
17
+ export declare const DateFieldSegments: ({ segmentText, segmentValues, focusedSegment, disabled, readOnly, onSegmentFocus, onSegmentBlur, onSegmentInput, registerSegmentRef, }: DateFieldSegmentsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { s, a as l, D as h } from "../../../chunks/DateField.Segment.DbjGMAPP.js";
3
+ import { getSegmentOrder as R, getSegmentDisplay as f } from "./DateField.utils.es.js";
4
+ const n = [
5
+ { type: "month", value: "" },
6
+ { type: "literal", value: "/" },
7
+ { type: "day", value: "" },
8
+ { type: "literal", value: "/" },
9
+ { type: "year", value: "" }
10
+ ], A = {
11
+ month: "MM",
12
+ day: "DD",
13
+ year: "YYYY"
14
+ }, P = R(n), Y = ({
15
+ segmentText: r,
16
+ segmentValues: o,
17
+ focusedSegment: i,
18
+ disabled: m,
19
+ readOnly: p,
20
+ onSegmentFocus: c,
21
+ onSegmentBlur: y,
22
+ onSegmentInput: u,
23
+ registerSegmentRef: d
24
+ }) => /* @__PURE__ */ a("span", { className: s[l.segments], children: n.map((t, g) => {
25
+ if (t.type === "literal")
26
+ return /* @__PURE__ */ a(
27
+ "span",
28
+ {
29
+ "aria-hidden": "true",
30
+ className: s[l.separator],
31
+ children: t.value
32
+ },
33
+ `literal-${g}`
34
+ );
35
+ const e = t.type, D = A[e], { displayValue: v, isPlaceholder: S } = f(
36
+ e,
37
+ r[e],
38
+ D
39
+ );
40
+ return /* @__PURE__ */ a(
41
+ h,
42
+ {
43
+ type: e,
44
+ value: o[e],
45
+ displayValue: v,
46
+ isPlaceholder: S,
47
+ isActive: i === e,
48
+ disabled: m,
49
+ readOnly: p,
50
+ onFocus: () => c(e),
51
+ onBlur: y,
52
+ onInput: u,
53
+ segmentRef: d(e)
54
+ },
55
+ e
56
+ );
57
+ }) });
58
+ export {
59
+ Y as DateFieldSegments,
60
+ P as PARTS_ORDER
61
+ };