@pismo/marola 2.1.63 → 2.1.65

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 (115) hide show
  1. package/dist/Button-CJaBSdv1.js +135 -0
  2. package/dist/ClassNameConfigurator-CVRWfyIa.js +847 -0
  3. package/dist/{ClickAwayListener-Z08peX_P.js → ClickAwayListener-BnYMO5Ki.js} +26 -33
  4. package/dist/Popup-D267EI4e.js +1338 -0
  5. package/dist/{Portal-DJapUCn6.js → Portal-BrGvxB96.js} +32 -36
  6. package/dist/RadioOption-DyRY8xlF.js +1094 -0
  7. package/dist/{Toggle-DcZTfLrC.js → Toggle-nnDfpqI1.js} +31 -31
  8. package/dist/assets/Checkbox.css +1 -1
  9. package/dist/assets/DropdownMenu.css +1 -1
  10. package/dist/assets/Input.css +1 -1
  11. package/dist/assets/ToastCard.css +1 -1
  12. package/dist/assets/Toggle2.css +1 -1
  13. package/dist/combineHooksSlotProps-j-8UVeYo.js +86 -0
  14. package/dist/components/Alert/Alert.stories.d.ts +6 -6
  15. package/dist/components/Autocomplete/Autocomplete.d.ts +1 -1
  16. package/dist/components/Autocomplete/Autocomplete.js +311 -320
  17. package/dist/components/Autocomplete/Autocomplete.stories.d.ts +1 -1
  18. package/dist/components/Avatar/Avatar.stories.d.ts +4 -4
  19. package/dist/components/BankingCard/BankingCard.d.ts +0 -1
  20. package/dist/components/Button/Button.js +1 -1
  21. package/dist/components/Checkbox/Checkbox.js +56 -56
  22. package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -8
  23. package/dist/components/Chip/Chip.js +3 -3
  24. package/dist/components/DatePicker/DatePicker.js +742 -639
  25. package/dist/components/DatePicker/DatePicker.stories.d.ts +8 -8
  26. package/dist/components/DatePicker/dateUtils.d.ts +2 -2
  27. package/dist/components/DatePicker/dateUtils.js +1 -1
  28. package/dist/components/DatePicker/keyboardNavigation.d.ts +1 -1
  29. package/dist/components/DatePicker/renderCalendarDays.js +1 -1
  30. package/dist/components/DatePicker/renderPeriodSelection.js +1 -1
  31. package/dist/components/Dialog/CloseIconButton.js +1 -1
  32. package/dist/components/Dialog/Dialog.js +372 -352
  33. package/dist/components/Dialog/Dialog.stories.d.ts +96 -135
  34. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.d.ts +1 -1
  35. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.js +2 -2
  36. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.stories.d.ts +1 -1
  37. package/dist/components/DoubleInput/DoubleInput.stories.d.ts +1 -1
  38. package/dist/components/Draggable/Draggable.d.ts +0 -1
  39. package/dist/components/Draggable/Draggable.js +1 -1
  40. package/dist/components/Draggable/Draggable.stories.d.ts +2 -3
  41. package/dist/components/Draggable/useDraggable.js +1 -1
  42. package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -1
  43. package/dist/components/DropdownMenu/DropdownMenu.js +39 -34
  44. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +6 -4
  45. package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +4 -4
  46. package/dist/components/IconButton/IconButton.js +1 -1
  47. package/dist/components/Input/Input.d.ts +2 -0
  48. package/dist/components/Input/Input.js +361 -340
  49. package/dist/components/Input/Input.stories.d.ts +2 -0
  50. package/dist/components/InputSearch/InputSearch.d.ts +31 -30
  51. package/dist/components/InputSearch/InputSearch.stories.d.ts +31 -30
  52. package/dist/components/Popover/Popover.d.ts +3 -3
  53. package/dist/components/Popover/Popover.js +2 -2
  54. package/dist/components/Popover/Popover.stories.d.ts +3 -3
  55. package/dist/components/Popover/PopoverBody.d.ts +0 -1
  56. package/dist/components/Popover/PopoverFooter.d.ts +0 -1
  57. package/dist/components/Popover/PopoverHeader.d.ts +0 -1
  58. package/dist/components/RadioButton/RadioButton.d.ts +0 -1
  59. package/dist/components/RadioButton/RadioButton.js +684 -769
  60. package/dist/components/RadioButton/RadioOption.d.ts +0 -1
  61. package/dist/components/RadioButton/RadioOption.js +3 -3
  62. package/dist/components/ResultContainer/ResultContainer.d.ts +0 -1
  63. package/dist/components/ResultContainer/ResultContainer.stories.d.ts +9 -9
  64. package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
  65. package/dist/components/ResultWithChips/ResultWithChips.stories.d.ts +9 -9
  66. package/dist/components/RowItem/RowItem.js +2 -2
  67. package/dist/components/Select/Select.js +625 -591
  68. package/dist/components/Skeleton/Skeleton.d.ts +0 -1
  69. package/dist/components/Snackbar/Snackbar.js +295 -239
  70. package/dist/components/Snackbar/Snackbar.stories.d.ts +113 -113
  71. package/dist/components/StepperNavigator/StepperNavigator.d.ts +0 -1
  72. package/dist/components/Table/Table.stories.d.ts +5 -5
  73. package/dist/components/Tabs/Tab.js +107 -98
  74. package/dist/components/Tabs/TabPanel.js +58 -55
  75. package/dist/components/Tabs/Tabs.js +246 -231
  76. package/dist/components/ToastCard/ToastCard.js +31 -31
  77. package/dist/components/Toggle/Toggle.js +147 -137
  78. package/dist/components/Toggle/Toggle.stories.d.ts +5 -5
  79. package/dist/components/ToggleGroup/Toggle.d.ts +0 -1
  80. package/dist/components/ToggleGroup/Toggle.js +2 -2
  81. package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
  82. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
  83. package/dist/components/Tooltip/Tooltip.js +266 -325
  84. package/dist/components/Tooltip/Tooltip.stories.d.ts +4 -4
  85. package/dist/components/TransactionRow/TransactionRow.stories.d.ts +21 -21
  86. package/dist/contexts/DraggableProvider/DraggableProvider.d.ts +0 -1
  87. package/dist/contexts/DraggableProvider/DraggableProvider.js +1 -1
  88. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +1 -1
  89. package/dist/{dayjs.min-ClQKmc--.js → dayjs.min-BtgZiFZY.js} +14 -14
  90. package/dist/getReactElementRef-iorwYm2A.js +19 -0
  91. package/dist/{index-1UpBa69h.js → index-ew-96uBP.js} +2129 -2128
  92. package/dist/isFocusVisible-CPZqtjv2.js +12 -0
  93. package/dist/main.js +2 -2
  94. package/dist/{ownerDocument-By592Iy6.js → ownerDocument-CU-LCrtd.js} +1 -1
  95. package/dist/react-BTbo_5A3.js +526 -0
  96. package/dist/setRef-Bo0HEdBB.js +6 -0
  97. package/dist/useButton-C2E_LFJp.js +90 -0
  98. package/dist/useControlled-BYdyS7Pn.js +31 -0
  99. package/dist/useId-CK6Kn3Tn.js +21 -0
  100. package/dist/useList-BLW78Lq7.js +446 -0
  101. package/dist/utils/draggable.d.ts +2 -2
  102. package/package.json +5 -4
  103. package/dist/Button-BrEDdtHO.js +0 -130
  104. package/dist/Popup-Dffqo7wT.js +0 -1246
  105. package/dist/RadioOption-DYovqiwF.js +0 -720
  106. package/dist/combineHooksSlotProps-BhQ14uyD.js +0 -79
  107. package/dist/exactProp-SYjL19cU.js +0 -13
  108. package/dist/react-BvI-Sw9b.js +0 -509
  109. package/dist/useButton-CezPDte8.js +0 -105
  110. package/dist/useControlled-CCMYYdCM.js +0 -31
  111. package/dist/useId-BW-oWmul.js +0 -19
  112. package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
  113. package/dist/useList-nqLfZem8.js +0 -435
  114. package/dist/useSlotProps-CYHDC4TN.js +0 -834
  115. package/dist/useTimeout-DxF9kiZL.js +0 -36
@@ -1,31 +0,0 @@
1
- import * as n from "react";
2
- function d({
3
- controlled: o,
4
- default: r,
5
- name: t,
6
- state: s = "value"
7
- }) {
8
- const {
9
- current: e
10
- } = n.useRef(o !== void 0), [l, c] = n.useState(r), u = e ? o : l;
11
- if (process.env.NODE_ENV !== "production") {
12
- n.useEffect(() => {
13
- e !== (o !== void 0) && console.error([`MUI: A component is changing the ${e ? "" : "un"}controlled ${s} state of ${t} to be ${e ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
14
- `));
15
- }, [s, t, o]);
16
- const {
17
- current: i
18
- } = n.useRef(r);
19
- n.useEffect(() => {
20
- !e && i !== r && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
21
- `));
22
- }, [JSON.stringify(r)]);
23
- }
24
- const f = n.useCallback((i) => {
25
- e || c(i);
26
- }, []);
27
- return [u, f];
28
- }
29
- export {
30
- d as u
31
- };
@@ -1,19 +0,0 @@
1
- import * as e from "react";
2
- let n = 0;
3
- function l(t) {
4
- const [u, o] = e.useState(t), a = t || u;
5
- return e.useEffect(() => {
6
- u == null && (n += 1, o(`mui-${n}`));
7
- }, [u]), a;
8
- }
9
- const s = e.useId;
10
- function c(t) {
11
- if (s !== void 0) {
12
- const u = s();
13
- return t ?? u;
14
- }
15
- return l(t);
16
- }
17
- export {
18
- c as u
19
- };
@@ -1,69 +0,0 @@
1
- import * as a from "react";
2
- import { T as o } from "./useTimeout-DxF9kiZL.js";
3
- let n = !0, s = !1;
4
- const c = new o(), f = {
5
- text: !0,
6
- search: !0,
7
- url: !0,
8
- tel: !0,
9
- email: !0,
10
- password: !0,
11
- number: !0,
12
- date: !0,
13
- month: !0,
14
- week: !0,
15
- time: !0,
16
- datetime: !0,
17
- "datetime-local": !0
18
- };
19
- function d(e) {
20
- const {
21
- type: t,
22
- tagName: r
23
- } = e;
24
- return !!(r === "INPUT" && f[t] && !e.readOnly || r === "TEXTAREA" && !e.readOnly || e.isContentEditable);
25
- }
26
- function h(e) {
27
- e.metaKey || e.altKey || e.ctrlKey || (n = !0);
28
- }
29
- function i() {
30
- n = !1;
31
- }
32
- function y() {
33
- this.visibilityState === "hidden" && s && (n = !0);
34
- }
35
- function m(e) {
36
- e.addEventListener("keydown", h, !0), e.addEventListener("mousedown", i, !0), e.addEventListener("pointerdown", i, !0), e.addEventListener("touchstart", i, !0), e.addEventListener("visibilitychange", y, !0);
37
- }
38
- function b(e) {
39
- const {
40
- target: t
41
- } = e;
42
- try {
43
- return t.matches(":focus-visible");
44
- } catch {
45
- }
46
- return n || d(t);
47
- }
48
- function w() {
49
- const e = a.useCallback((u) => {
50
- u != null && m(u.ownerDocument);
51
- }, []), t = a.useRef(!1);
52
- function r() {
53
- return t.current ? (s = !0, c.start(100, () => {
54
- s = !1;
55
- }), t.current = !1, !0) : !1;
56
- }
57
- function l(u) {
58
- return b(u) ? (t.current = !0, !0) : !1;
59
- }
60
- return {
61
- isFocusVisibleRef: t,
62
- onFocus: l,
63
- onBlur: r,
64
- ref: e
65
- };
66
- }
67
- export {
68
- w as u
69
- };
@@ -1,435 +0,0 @@
1
- import { _ as p, u as re, f as ie } from "./useSlotProps-CYHDC4TN.js";
2
- import * as f from "react";
3
- import { L as x } from "./combineHooksSlotProps-BhQ14uyD.js";
4
- function W(t, e, r = (n, l) => n === l) {
5
- return t.length === e.length && t.every((n, l) => r(n, e[l]));
6
- }
7
- function ue(t, e) {
8
- return t === e;
9
- }
10
- const N = {}, q = () => {
11
- };
12
- function L(t, e) {
13
- const r = p({}, t);
14
- return Object.keys(e).forEach((n) => {
15
- e[n] !== void 0 && (r[n] = e[n]);
16
- }), r;
17
- }
18
- function se(t) {
19
- const {
20
- nextState: e,
21
- initialState: r,
22
- stateComparers: n,
23
- onStateChange: l,
24
- controlledProps: a,
25
- lastActionRef: i
26
- } = t, h = f.useRef(r);
27
- f.useEffect(() => {
28
- if (i.current === null)
29
- return;
30
- const s = L(h.current, a);
31
- Object.keys(e).forEach((C) => {
32
- var V;
33
- const g = (V = n[C]) != null ? V : ue, c = e[C], m = s[C];
34
- if (m == null && c != null || m != null && c == null || m != null && c != null && !g(c, m)) {
35
- var o, S;
36
- l == null || l((o = i.current.event) != null ? o : null, C, c, (S = i.current.type) != null ? S : "", e);
37
- }
38
- }), h.current = e, i.current = null;
39
- }, [h, e, i, l, n, a]);
40
- }
41
- function ae(t) {
42
- const e = f.useRef(null), {
43
- reducer: r,
44
- initialState: n,
45
- controlledProps: l = N,
46
- stateComparers: a = N,
47
- onStateChange: i = q,
48
- actionContext: h,
49
- componentName: s = ""
50
- } = t, C = f.useRef(l);
51
- process.env.NODE_ENV !== "production" && f.useEffect(() => {
52
- Object.keys(l).forEach((o) => {
53
- C.current[o] !== void 0 && l[o] === void 0 && console.error(`useControllableReducer: ${s ? `The ${s} component` : "A component"} is changing a controlled prop to be uncontrolled: ${o}`), C.current[o] === void 0 && l[o] !== void 0 && console.error(`useControllableReducer: ${s ? `The ${s} component` : "A component"} is changing an uncontrolled prop to be controlled: ${o}`);
54
- });
55
- }, [l, s]);
56
- const V = f.useCallback((o, S) => {
57
- e.current = S;
58
- const R = L(o, l);
59
- return r(R, S);
60
- }, [l, r]), [g, c] = f.useReducer(V, n), m = f.useCallback((o) => {
61
- c(p({}, o, {
62
- context: h
63
- }));
64
- }, [h]);
65
- return se({
66
- nextState: g,
67
- initialState: n,
68
- stateComparers: a ?? N,
69
- onStateChange: i ?? q,
70
- controlledProps: l,
71
- lastActionRef: e
72
- }), [L(g, l), m];
73
- }
74
- function oe(t, e, r, n, l, a) {
75
- if (r.length === 0 || !n && r.every((h, s) => l(h, s)))
76
- return -1;
77
- let i = t;
78
- for (; ; ) {
79
- if (!a && e === "next" && i === r.length || !a && e === "previous" && i === -1)
80
- return -1;
81
- if (n ? !1 : l(r[i], i))
82
- i += e === "next" ? 1 : -1, a && (i = (i + r.length) % r.length);
83
- else
84
- return i;
85
- }
86
- }
87
- function w(t, e, r) {
88
- var n;
89
- const {
90
- items: l,
91
- isItemDisabled: a,
92
- disableListWrap: i,
93
- disabledItemsFocusable: h,
94
- itemComparer: s,
95
- focusManagement: C
96
- } = r, V = C === "DOM" ? 0 : -1, g = l.length - 1, c = t == null ? -1 : l.findIndex((D) => s(D, t));
97
- let m, o, S = !i;
98
- switch (e) {
99
- case "reset":
100
- if (V === -1)
101
- return null;
102
- m = 0, o = "next", S = !1;
103
- break;
104
- case "start":
105
- m = 0, o = "next", S = !1;
106
- break;
107
- case "end":
108
- m = g, o = "previous", S = !1;
109
- break;
110
- default: {
111
- const D = c + e;
112
- D < 0 ? !S && c !== -1 || Math.abs(e) > 1 ? (m = 0, o = "next") : (m = g, o = "previous") : D > g ? !S || Math.abs(e) > 1 ? (m = g, o = "previous") : (m = 0, o = "next") : (m = D, o = e >= 0 ? "next" : "previous");
113
- }
114
- }
115
- const R = oe(m, o, l, h, a, S);
116
- return R === -1 && t !== null && !a(t, c) ? t : (n = l[R]) != null ? n : null;
117
- }
118
- function ce(t, e, r, n) {
119
- return r === "none" ? [] : r === "single" ? n(e[0], t) ? e : [t] : e.some((l) => n(l, t)) ? e.filter((l) => !n(l, t)) : [...e, t];
120
- }
121
- function j(t, e, r) {
122
- const {
123
- itemComparer: n,
124
- isItemDisabled: l,
125
- selectionMode: a,
126
- items: i
127
- } = r, {
128
- selectedValues: h
129
- } = e, s = i.findIndex((V) => n(t, V));
130
- if (l(t, s))
131
- return e;
132
- const C = ce(t, h, a, n);
133
- return p({}, e, {
134
- selectedValues: C,
135
- highlightedValue: t
136
- });
137
- }
138
- function he(t, e, r) {
139
- const n = e.highlightedValue, {
140
- orientation: l,
141
- pageSize: a
142
- } = r;
143
- switch (t) {
144
- case "Home":
145
- return p({}, e, {
146
- highlightedValue: w(n, "start", r)
147
- });
148
- case "End":
149
- return p({}, e, {
150
- highlightedValue: w(n, "end", r)
151
- });
152
- case "PageUp":
153
- return p({}, e, {
154
- highlightedValue: w(n, -a, r)
155
- });
156
- case "PageDown":
157
- return p({}, e, {
158
- highlightedValue: w(n, a, r)
159
- });
160
- case "ArrowUp":
161
- if (l !== "vertical")
162
- break;
163
- return p({}, e, {
164
- highlightedValue: w(n, -1, r)
165
- });
166
- case "ArrowDown":
167
- if (l !== "vertical")
168
- break;
169
- return p({}, e, {
170
- highlightedValue: w(n, 1, r)
171
- });
172
- case "ArrowLeft": {
173
- if (l === "vertical")
174
- break;
175
- return p({}, e, {
176
- highlightedValue: w(n, l === "horizontal-ltr" ? -1 : 1, r)
177
- });
178
- }
179
- case "ArrowRight": {
180
- if (l === "vertical")
181
- break;
182
- return p({}, e, {
183
- highlightedValue: w(n, l === "horizontal-ltr" ? 1 : -1, r)
184
- });
185
- }
186
- case "Enter":
187
- case " ":
188
- return e.highlightedValue === null ? e : j(e.highlightedValue, e, r);
189
- }
190
- return e;
191
- }
192
- function ge(t, e) {
193
- return e.focusManagement === "DOM" ? t : p({}, t, {
194
- highlightedValue: null
195
- });
196
- }
197
- function de(t, e, r) {
198
- var n;
199
- const l = (n = r(t)) == null ? void 0 : n.trim().toLowerCase();
200
- return !l || l.length === 0 ? !1 : l.indexOf(e) === 0;
201
- }
202
- function fe(t, e, r) {
203
- const {
204
- items: n,
205
- isItemDisabled: l,
206
- disabledItemsFocusable: a,
207
- getItemAsString: i
208
- } = r, h = e.length > 1;
209
- let s = h ? t.highlightedValue : w(t.highlightedValue, 1, r);
210
- for (let C = 0; C < n.length; C += 1) {
211
- if (!s || !h && t.highlightedValue === s)
212
- return t;
213
- if (de(s, e, i) && (!l(s, n.indexOf(s)) || a))
214
- return p({}, t, {
215
- highlightedValue: s
216
- });
217
- s = w(s, 1, r);
218
- }
219
- return t;
220
- }
221
- function me(t, e, r, n) {
222
- var l;
223
- const {
224
- itemComparer: a,
225
- focusManagement: i
226
- } = n;
227
- let h = null;
228
- if (r.highlightedValue != null) {
229
- var s;
230
- h = (s = t.find((g) => a(g, r.highlightedValue))) != null ? s : null;
231
- } else i === "DOM" && e.length === 0 && (h = w(null, "reset", n));
232
- const V = ((l = r.selectedValues) != null ? l : []).filter((g) => t.some((c) => a(c, g)));
233
- return p({}, r, {
234
- highlightedValue: h,
235
- selectedValues: V
236
- });
237
- }
238
- function pe(t, e) {
239
- return p({}, t, {
240
- highlightedValue: w(null, "reset", e)
241
- });
242
- }
243
- function Ce(t, e) {
244
- return p({}, t, {
245
- highlightedValue: w(null, "end", e)
246
- });
247
- }
248
- function Se(t, e) {
249
- return p({}, t, {
250
- selectedValues: [],
251
- highlightedValue: w(null, "reset", e)
252
- });
253
- }
254
- function Ie(t, e) {
255
- const {
256
- type: r,
257
- context: n
258
- } = e;
259
- switch (r) {
260
- case x.keyDown:
261
- return he(e.key, t, n);
262
- case x.itemClick:
263
- return j(e.item, t, n);
264
- case x.blur:
265
- return ge(t, n);
266
- case x.textNavigation:
267
- return fe(t, e.searchString, n);
268
- case x.itemsChange:
269
- return me(e.items, e.previousItems, t, n);
270
- case x.resetHighlight:
271
- return pe(t, n);
272
- case x.highlightLast:
273
- return Ce(t, n);
274
- case x.clearSelection:
275
- return Se(t, n);
276
- default:
277
- return t;
278
- }
279
- }
280
- const be = 500;
281
- function xe(t) {
282
- const e = f.useRef({
283
- searchString: "",
284
- lastTime: null
285
- });
286
- return f.useCallback((r) => {
287
- if (r.key.length === 1 && r.key !== " ") {
288
- const n = e.current, l = r.key.toLowerCase(), a = performance.now();
289
- n.searchString.length > 0 && n.lastTime && a - n.lastTime > be ? n.searchString = l : (n.searchString.length !== 1 || l !== n.searchString) && (n.searchString += l), n.lastTime = a, t(n.searchString, r);
290
- }
291
- }, [t]);
292
- }
293
- const z = {}, Ve = () => {
294
- }, we = (t, e) => t === e, De = () => !1, Re = (t) => typeof t == "string" ? t : String(t), ve = () => ({
295
- highlightedValue: null,
296
- selectedValues: []
297
- });
298
- function Me(t) {
299
- const {
300
- controlledProps: e = z,
301
- disabledItemsFocusable: r = !1,
302
- disableListWrap: n = !1,
303
- focusManagement: l = "activeDescendant",
304
- getInitialState: a = ve,
305
- getItemDomElement: i,
306
- getItemId: h,
307
- isItemDisabled: s = De,
308
- rootRef: C,
309
- onStateChange: V = Ve,
310
- items: g,
311
- itemComparer: c = we,
312
- getItemAsString: m = Re,
313
- onChange: o,
314
- onHighlightChange: S,
315
- onItemsChange: R,
316
- orientation: D = "vertical",
317
- pageSize: P = 5,
318
- reducerActionContext: H = z,
319
- selectionMode: $ = "single",
320
- stateReducer: _,
321
- componentName: G = "useList"
322
- } = t;
323
- if (process.env.NODE_ENV !== "production") {
324
- if (l === "DOM" && i == null)
325
- throw new Error("useList: The `getItemDomElement` prop is required when using the `DOM` focus management.");
326
- if (l === "activeDescendant" && h == null)
327
- throw new Error("useList: The `getItemId` prop is required when using the `activeDescendant` focus management.");
328
- }
329
- const B = f.useRef(null), F = re(C, B), T = f.useCallback((d, u, I) => {
330
- if (S == null || S(d, u, I), l === "DOM" && u != null && (I === x.itemClick || I === x.keyDown || I === x.textNavigation)) {
331
- var b;
332
- i == null || (b = i(u)) == null || b.focus();
333
- }
334
- }, [i, S, l]), O = f.useMemo(() => ({
335
- highlightedValue: c,
336
- selectedValues: (d, u) => W(d, u, c)
337
- }), [c]), J = f.useCallback((d, u, I, b, M) => {
338
- switch (V == null || V(d, u, I, b, M), u) {
339
- case "highlightedValue":
340
- T(d, I, b);
341
- break;
342
- case "selectedValues":
343
- o == null || o(d, I, b);
344
- break;
345
- }
346
- }, [T, o, V]), K = f.useMemo(() => ({
347
- disabledItemsFocusable: r,
348
- disableListWrap: n,
349
- focusManagement: l,
350
- isItemDisabled: s,
351
- itemComparer: c,
352
- items: g,
353
- getItemAsString: m,
354
- onHighlightChange: T,
355
- orientation: D,
356
- pageSize: P,
357
- selectionMode: $,
358
- stateComparers: O
359
- }), [r, n, l, s, c, g, m, T, D, P, $, O]), Y = a(), X = _ ?? Ie, Q = f.useMemo(() => p({}, H, K), [H, K]), [k, v] = ae({
360
- reducer: X,
361
- actionContext: Q,
362
- initialState: Y,
363
- controlledProps: e,
364
- stateComparers: O,
365
- onStateChange: J,
366
- componentName: G
367
- }), {
368
- highlightedValue: E,
369
- selectedValues: A
370
- } = k, Z = xe((d, u) => v({
371
- type: x.textNavigation,
372
- event: u,
373
- searchString: d
374
- })), y = f.useRef([]);
375
- f.useEffect(() => {
376
- W(y.current, g, c) || (v({
377
- type: x.itemsChange,
378
- event: null,
379
- items: g,
380
- previousItems: y.current
381
- }), y.current = g, R == null || R(g));
382
- }, [g, c, v, R]);
383
- const ee = (d) => (u) => {
384
- var I;
385
- if ((I = d.onKeyDown) == null || I.call(d, u), u.defaultMuiPrevented)
386
- return;
387
- const b = ["Home", "End", "PageUp", "PageDown"];
388
- D === "vertical" ? b.push("ArrowUp", "ArrowDown") : b.push("ArrowLeft", "ArrowRight"), l === "activeDescendant" && b.push(" ", "Enter"), b.includes(u.key) && u.preventDefault(), v({
389
- type: x.keyDown,
390
- key: u.key,
391
- event: u
392
- }), Z(u);
393
- }, te = (d) => (u) => {
394
- var I, b;
395
- (I = d.onBlur) == null || I.call(d, u), !u.defaultMuiPrevented && ((b = B.current) != null && b.contains(u.relatedTarget) || v({
396
- type: x.blur,
397
- event: u
398
- }));
399
- }, ne = (d = {}) => {
400
- const u = ie(d);
401
- return p({}, d, {
402
- "aria-activedescendant": l === "activeDescendant" && E != null ? h(E) : void 0,
403
- tabIndex: l === "DOM" ? -1 : 0,
404
- ref: F
405
- }, u, {
406
- onBlur: te(u),
407
- onKeyDown: ee(u)
408
- });
409
- }, U = f.useCallback((d) => {
410
- const u = (A ?? []).some((M) => M != null && c(d, M)), I = E != null && c(d, E);
411
- return {
412
- focusable: l === "DOM",
413
- highlighted: I,
414
- selected: u
415
- };
416
- }, [c, A, E, l]), le = f.useMemo(() => ({
417
- dispatch: v,
418
- getItemState: U
419
- }), [v, U]);
420
- return f.useDebugValue({
421
- state: k
422
- }), {
423
- contextValue: le,
424
- dispatch: v,
425
- getRootProps: ne,
426
- rootRef: F,
427
- state: k
428
- };
429
- }
430
- export {
431
- j as h,
432
- Ie as l,
433
- w as m,
434
- Me as u
435
- };