@wix/site-ui 1.347.0 → 1.349.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 (226) hide show
  1. package/dist/{6706.js → 1093.js} +3 -3
  2. package/dist/{8724.js → 1219.js} +2 -2
  3. package/dist/{7373.js → 1288.js} +8 -2
  4. package/dist/{5299.js → 1381.js} +98 -127
  5. package/dist/{3056.js → 1607.js} +32 -34
  6. package/dist/1629.js +2 -0
  7. package/dist/1669.js +75 -0
  8. package/dist/1718.js +26 -0
  9. package/dist/{1477.js → 201.js} +17 -26
  10. package/dist/2221.js +9 -0
  11. package/dist/{2445.js → 226.js} +12 -48
  12. package/dist/2387.js +7 -0
  13. package/dist/2580.js +6 -0
  14. package/dist/{1500.js → 2859.js} +10 -34
  15. package/dist/3014.js +178 -0
  16. package/dist/{6247.js → 3054.js} +3 -3
  17. package/dist/{7642.js → 3093.js} +1 -1
  18. package/dist/3189.js +5 -0
  19. package/dist/{7564.js → 331.js} +2 -2
  20. package/dist/3357.js +7 -0
  21. package/dist/{487.js → 3398.js} +38 -39
  22. package/dist/3502.js +224 -0
  23. package/dist/3695.js +50 -0
  24. package/dist/3829.js +1 -1
  25. package/dist/{6588.js → 3859.js} +115 -92
  26. package/dist/{3670.js → 3910.js} +28 -21
  27. package/dist/392.js +7 -0
  28. package/dist/{4549.js → 4155.js} +11 -3
  29. package/dist/4226.js +7 -0
  30. package/dist/{6329.js → 4229.js} +1 -1
  31. package/dist/4293.js +3 -0
  32. package/dist/4346.js +853 -2
  33. package/dist/{285.js → 4472.js} +3 -3
  34. package/dist/4605.js +207 -0
  35. package/dist/{7366.js → 488.js} +60 -7
  36. package/dist/{8750.js → 497.js} +190 -375
  37. package/dist/4989.js +35 -0
  38. package/dist/{6270.js → 510.js} +157 -196
  39. package/dist/5258.js +26 -0
  40. package/dist/{5036.js → 5275.js} +0 -3
  41. package/dist/{8171.js → 5298.js} +90 -102
  42. package/dist/5473.js +11 -0
  43. package/dist/{4745.js → 5490.js} +3 -1
  44. package/dist/{6089.js → 5561.js} +869 -786
  45. package/dist/{8996.js → 5595.js} +4 -3
  46. package/dist/5890.js +25 -0
  47. package/dist/{6046.js → 5969.js} +1 -1
  48. package/dist/5984.js +38 -0
  49. package/dist/{8527.js → 6006.js} +3 -3
  50. package/dist/6040.js +97 -0
  51. package/dist/{8758.js → 6137.js} +10 -8
  52. package/dist/{4281.js → 6140.js} +18 -10
  53. package/dist/{8960.js → 6191.js} +2 -2
  54. package/dist/6240.js +121 -0
  55. package/dist/{4490.js → 6373.js} +7 -5
  56. package/dist/{904.js → 6487.js} +19 -17
  57. package/dist/{9635.js → 6498.js} +1 -1
  58. package/dist/6499.js +4 -7
  59. package/dist/6508.js +7 -0
  60. package/dist/{8225.js → 6540.js} +1 -0
  61. package/dist/6551.js +46 -0
  62. package/dist/{9369.js → 6620.js} +35 -34
  63. package/dist/{4143.js → 6838.js} +19 -10
  64. package/dist/6902.js +48 -0
  65. package/dist/6904.js +51 -0
  66. package/dist/70.js +24 -0
  67. package/dist/7024.js +39 -0
  68. package/dist/{6882.js → 721.js} +737 -362
  69. package/dist/{951.js → 7270.js} +4 -4
  70. package/dist/{3485.js → 7323.js} +143 -111
  71. package/dist/{7541.js → 7488.js} +2 -2
  72. package/dist/{4863.js → 7542.js} +7 -6
  73. package/dist/7551.js +28 -0
  74. package/dist/{7021.js → 7640.js} +1 -1
  75. package/dist/{353.js → 7692.js} +3 -7
  76. package/dist/{4707.js → 7930.js} +2 -2
  77. package/dist/{8052.js → 8.js} +80 -64
  78. package/dist/{6914.js → 8129.js} +3 -15
  79. package/dist/{3319.js → 8358.js} +62 -63
  80. package/dist/{5864.js → 8407.js} +13 -13
  81. package/dist/8488.js +15 -0
  82. package/dist/{4768.js → 8495.js} +1 -1
  83. package/dist/8734.js +171 -0
  84. package/dist/{1763.js → 9018.js} +205 -331
  85. package/dist/9053.js +29 -0
  86. package/dist/9067.js +41 -0
  87. package/dist/{2861.js → 9120.js} +2 -2
  88. package/dist/{42.js → 9197.js} +2 -2
  89. package/dist/{9189.js → 9248.js} +36 -17
  90. package/dist/{2801.js → 9252.js} +4 -9
  91. package/dist/9295.js +7 -0
  92. package/dist/9303.js +8 -0
  93. package/dist/{167.js → 9374.js} +1 -1
  94. package/dist/{9352.js → 9540.js} +17 -47
  95. package/dist/9576.js +51 -0
  96. package/dist/{8272.js → 9591.js} +36 -46
  97. package/dist/{6107.js → 9770.js} +2 -2
  98. package/dist/{5085.js → 9880.js} +6 -3
  99. package/dist/Accordion/index.d.ts +207 -41
  100. package/dist/Accordion/index.js +75 -177
  101. package/dist/AlertDialog/index.d.ts +440 -140
  102. package/dist/AlertDialog/index.js +3 -13
  103. package/dist/Autocomplete/index.d.ts +722 -150
  104. package/dist/Autocomplete/index.js +16 -29
  105. package/dist/Avatar/index.d.ts +38 -3
  106. package/dist/Avatar/index.js +82 -28
  107. package/dist/Breadcrumbs/index.d.ts +63 -91
  108. package/dist/Breadcrumbs/index.js +1 -1
  109. package/dist/Button/index.d.ts +11 -0
  110. package/dist/Button/index.js +2 -2
  111. package/dist/Checkbox/index.d.ts +206 -36
  112. package/dist/Checkbox/index.js +293 -8
  113. package/dist/CheckboxField/index.css +1 -1
  114. package/dist/CheckboxField/index.d.ts +40 -36
  115. package/dist/CheckboxGroup/index.d.ts +50 -36
  116. package/dist/CheckboxGroup/index.js +87 -58
  117. package/dist/CheckboxGroupField/index.css +1 -1
  118. package/dist/Collapsible/index.d.ts +128 -36
  119. package/dist/Collapsible/index.js +21 -25
  120. package/dist/Combobox/index.d.ts +801 -158
  121. package/dist/Combobox/index.js +70 -114
  122. package/dist/ContextMenu/index.d.ts +1162 -195
  123. package/dist/ContextMenu/index.js +46 -36
  124. package/dist/Dialog/index.d.ts +425 -133
  125. package/dist/Dialog/index.js +8 -4
  126. package/dist/Drawer/index.d.ts +589 -144
  127. package/dist/Drawer/index.js +482 -562
  128. package/dist/Field/index.css +1 -1
  129. package/dist/Field/index.d.ts +341 -42
  130. package/dist/Field/index.js +123 -273
  131. package/dist/Fieldset/index.d.ts +11 -0
  132. package/dist/Fieldset/index.js +10 -17
  133. package/dist/Form/index.d.ts +43 -39
  134. package/dist/Form/index.js +58 -50
  135. package/dist/Input/index.css +1 -1
  136. package/dist/Input/index.d.ts +94 -42
  137. package/dist/Input/index.js +1 -1
  138. package/dist/Menu/index.d.ts +1140 -175
  139. package/dist/Menu/index.js +51 -67
  140. package/dist/Menubar/index.d.ts +651 -173
  141. package/dist/Menubar/index.js +12 -16
  142. package/dist/Meter/index.js +21 -18
  143. package/dist/NavigationMenu/index.d.ts +370 -86
  144. package/dist/NavigationMenu/index.js +144 -178
  145. package/dist/NumberField/index.css +1 -1
  146. package/dist/NumberField/index.d.ts +507 -47
  147. package/dist/NumberField/index.js +434 -718
  148. package/dist/Popover/index.d.ts +561 -142
  149. package/dist/Popover/index.js +181 -252
  150. package/dist/PreviewCard/index.d.ts +507 -143
  151. package/dist/PreviewCard/index.js +97 -151
  152. package/dist/Progress/index.d.ts +117 -3
  153. package/dist/Progress/index.js +37 -36
  154. package/dist/Radio/index.d.ts +177 -7
  155. package/dist/Radio/index.js +54 -70
  156. package/dist/RadioField/index.css +1 -1
  157. package/dist/RadioField/index.d.ts +23 -7
  158. package/dist/RadioGroup/index.d.ts +51 -37
  159. package/dist/RadioGroup/index.js +60 -51
  160. package/dist/RadioGroupField/index.css +1 -1
  161. package/dist/RadioGroupField/index.d.ts +40 -37
  162. package/dist/ScrollArea/index.d.ts +295 -1
  163. package/dist/ScrollArea/index.js +256 -324
  164. package/dist/Select/index.d.ts +516 -123
  165. package/dist/Select/index.js +513 -635
  166. package/dist/SelectField/index.css +1 -1
  167. package/dist/SelectField/index.d.ts +109 -134
  168. package/dist/SelectField/index.js +5 -1
  169. package/dist/Separator/index.d.ts +12 -0
  170. package/dist/Separator/index.js +1 -1
  171. package/dist/Slider/index.d.ts +383 -64
  172. package/dist/Slider/index.js +298 -374
  173. package/dist/Switch/index.d.ts +184 -37
  174. package/dist/Switch/index.js +44 -58
  175. package/dist/Tabs/index.d.ts +220 -35
  176. package/dist/Tabs/index.js +199 -193
  177. package/dist/Toast/index.d.ts +280 -64
  178. package/dist/Toast/index.js +299 -374
  179. package/dist/Toggle/index.d.ts +55 -35
  180. package/dist/Toggle/index.js +19 -13
  181. package/dist/ToggleGroup/index.d.ts +62 -35
  182. package/dist/ToggleGroup/index.js +13 -31
  183. package/dist/Toolbar/index.d.ts +117 -2
  184. package/dist/Toolbar/index.js +31 -43
  185. package/dist/Tooltip/index.d.ts +507 -150
  186. package/dist/Tooltip/index.js +163 -213
  187. package/dist/index.d.ts +12912 -5382
  188. package/package.json +3 -3
  189. package/dist/2205.js +0 -26
  190. package/dist/2274.js +0 -34
  191. package/dist/2287.js +0 -17
  192. package/dist/3020.js +0 -7
  193. package/dist/3021.js +0 -72
  194. package/dist/3140.js +0 -4
  195. package/dist/3248.js +0 -307
  196. package/dist/4026.js +0 -12
  197. package/dist/4922.js +0 -15
  198. package/dist/5659.js +0 -4
  199. package/dist/5992.js +0 -447
  200. package/dist/6330.js +0 -30
  201. package/dist/6535.js +0 -72
  202. package/dist/6917.js +0 -55
  203. package/dist/7725.js +0 -10
  204. package/dist/7871.js +0 -38
  205. package/dist/8106.js +0 -239
  206. package/dist/8685.js +0 -102
  207. package/dist/8935.js +0 -8
  208. package/dist/8971.js +0 -40
  209. package/dist/8979.js +0 -10
  210. package/dist/9048.js +0 -52
  211. package/dist/9087.js +0 -256
  212. package/dist/9255.js +0 -136
  213. /package/dist/{1457.js → 1068.js} +0 -0
  214. /package/dist/{6003.js → 1234.js} +0 -0
  215. /package/dist/{4723.js → 1282.js} +0 -0
  216. /package/dist/{6825.js → 1876.js} +0 -0
  217. /package/dist/{5778.js → 1885.js} +0 -0
  218. /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
  219. /package/dist/{1279.js → 3278.js} +0 -0
  220. /package/dist/{3296.js → 5568.js} +0 -0
  221. /package/dist/{8685.css → 6240.css} +0 -0
  222. /package/dist/{9829.js → 6488.js} +0 -0
  223. /package/dist/{9863.js → 6534.js} +0 -0
  224. /package/dist/{4495.js → 7718.js} +0 -0
  225. /package/dist/{3395.js → 8866.js} +0 -0
  226. /package/dist/{2418.js → 9837.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import * as __rspack_external_react from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useId } from "./2205.js";
4
- import { useIsoLayoutEffect } from "./6499.js";
5
- import { useRefWithInit } from "./8272.js";
3
+ import { useId } from "./4989.js";
4
+ import { useIsoLayoutEffect } from "./3357.js";
5
+ import { useRefWithInit } from "./9591.js";
6
6
  function createEventEmitter() {
7
7
  const map = new Map();
8
8
  return {
package/dist/4605.js ADDED
@@ -0,0 +1,207 @@
1
+ import { useLabelableContext, DEFAULT_VALIDITY_STATE } from "./201.js";
2
+ import { useFormContext } from "./9880.js";
3
+ import { useTimeout } from "./9197.js";
4
+ import { mergeProps, useRefWithInit, EMPTY_OBJECT } from "./9591.js";
5
+ import { useStableCallback } from "./7488.js";
6
+ import * as __rspack_external_react from "react";
7
+ function getCombinedFieldValidityData(validityData, invalid) {
8
+ return {
9
+ ...validityData,
10
+ state: {
11
+ ...validityData.state,
12
+ valid: !invalid && validityData.state.valid
13
+ }
14
+ };
15
+ }
16
+ const validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
17
+ function isEligibleInput(input, formElement) {
18
+ if (input.matches(':disabled')) return false;
19
+ if (!formElement || input.form === formElement) return true;
20
+ return null === input.form && !input.hasAttribute('form');
21
+ }
22
+ function findRepresentativeInput(inputs, formElement) {
23
+ let fallback = null;
24
+ for (const input of inputs.keys())if (isEligibleInput(input, formElement)) {
25
+ if (!input.validity.valid) return input;
26
+ fallback ??= input;
27
+ }
28
+ return fallback;
29
+ }
30
+ function makeState(customError) {
31
+ return {
32
+ ...DEFAULT_VALIDITY_STATE,
33
+ valid: !customError,
34
+ customError
35
+ };
36
+ }
37
+ function getNativeErrors(element) {
38
+ return element && element.validationMessage ? [
39
+ element.validationMessage
40
+ ] : [];
41
+ }
42
+ function useFieldValidation(params) {
43
+ const { elementRef, formRef } = useFormContext();
44
+ const { setValidityData, validate, validityData, validationDebounceTime, invalid, markedDirtyRef, state, shouldValidateOnChange, validationMode, registeredFieldIdRef } = params;
45
+ const { controlId, getDescriptionProps } = useLabelableContext();
46
+ const timeout = useTimeout();
47
+ const inputRef = __rspack_external_react.useRef(null);
48
+ const registeredInputs = useRefWithInit(()=>new Map()).current;
49
+ const validationCommitIdRef = __rspack_external_react.useRef(0);
50
+ const customValidityRef = __rspack_external_react.useRef(null);
51
+ const registerInput = __rspack_external_react.useCallback((element, registration)=>{
52
+ registeredInputs.set(element, registration);
53
+ return ()=>{
54
+ registeredInputs.delete(element);
55
+ };
56
+ }, [
57
+ registeredInputs
58
+ ]);
59
+ const getInputControl = useStableCallback(()=>{
60
+ const element = findRepresentativeInput(registeredInputs, elementRef.current);
61
+ return element && registeredInputs.get(element)?.controlRef.current || null;
62
+ });
63
+ const commit = useStableCallback(async (value, revalidate = false)=>{
64
+ validationCommitIdRef.current += 1;
65
+ const validationCommitId = validationCommitIdRef.current;
66
+ function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid) {
67
+ const fieldId = registeredFieldIdRef.current ?? controlId;
68
+ if (null == fieldId) return;
69
+ const currentFieldData = formRef.current.fields.get(fieldId);
70
+ if (!currentFieldData) return;
71
+ const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid);
72
+ formRef.current.fields.set(fieldId, {
73
+ ...currentFieldData,
74
+ validityData: validityDataWithFormErrors
75
+ });
76
+ }
77
+ function makeValidityData(validityState, errorMessages) {
78
+ const errors = false === validityState.valid ? errorMessages : [];
79
+ return {
80
+ value,
81
+ state: validityState,
82
+ error: errors[0] ?? '',
83
+ errors,
84
+ initialValue: validityData.initialValue
85
+ };
86
+ }
87
+ function setCustomValidity(element, message) {
88
+ const displaced = element.validity.customError ? element.validationMessage : '';
89
+ const ownedMessage = message.replace(/\r\n?/g, '\n');
90
+ element.setCustomValidity(ownedMessage);
91
+ customValidityRef.current = [
92
+ element,
93
+ ownedMessage,
94
+ displaced
95
+ ];
96
+ }
97
+ function clearCustomValidity() {
98
+ const record = customValidityRef.current;
99
+ customValidityRef.current = null;
100
+ if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) record[0].setCustomValidity(record[2]);
101
+ }
102
+ function publish(validityState, errorMessages, externalInvalid) {
103
+ const nextValidityData = makeValidityData(validityState, errorMessages);
104
+ updateRegisteredFieldValidity(nextValidityData, externalInvalid);
105
+ setValidityData(nextValidityData);
106
+ }
107
+ function getState(el) {
108
+ const computedState = validityKeys.reduce((acc, key)=>{
109
+ acc[key] = el.validity[key];
110
+ return acc;
111
+ }, {});
112
+ let hasOnlyValueMissingError = false;
113
+ for (const key of validityKeys)if ('valid' !== key) {
114
+ if ('valueMissing' === key && computedState[key]) hasOnlyValueMissingError = true;
115
+ else if (computedState[key]) return computedState;
116
+ }
117
+ if (hasOnlyValueMissingError && !markedDirtyRef.current) {
118
+ computedState.valid = true;
119
+ computedState.valueMissing = false;
120
+ }
121
+ return computedState;
122
+ }
123
+ function resolveRepresentativeInput() {
124
+ return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current;
125
+ }
126
+ let element = resolveRepresentativeInput();
127
+ function refreshState() {
128
+ element = resolveRepresentativeInput();
129
+ return element?.willValidate ? getState(element) : makeState(false);
130
+ }
131
+ if (revalidate) {
132
+ if (false !== state.valid || !element) return;
133
+ if (!element.validity.valueMissing) {
134
+ clearCustomValidity();
135
+ const currentElement = resolveRepresentativeInput();
136
+ const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : [];
137
+ publish(makeState(foreign.length > 0), foreign, false);
138
+ return;
139
+ }
140
+ for (const key of validityKeys)if ('valid' !== key && 'valueMissing' !== key && 'customError' !== key && element.validity[key]) return;
141
+ }
142
+ timeout.clear();
143
+ clearCustomValidity();
144
+ let nextState = refreshState();
145
+ let validationErrors = getNativeErrors(element);
146
+ const isValidatingOnChange = shouldValidateOnChange();
147
+ if (0 === validationErrors.length || isValidatingOnChange) {
148
+ const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field)=>{
149
+ if (field.name) acc[field.name] = field.getValue();
150
+ return acc;
151
+ }, {});
152
+ const resultOrPromise = validate(value, formValues);
153
+ let result;
154
+ if ('object' == typeof resultOrPromise && null !== resultOrPromise && 'then' in resultOrPromise) {
155
+ if (false === nextState.valid) publish(nextState, validationErrors);
156
+ else if ('onSubmit' === validationMode || !validityData.state.customError) {
157
+ nextState.valid = null;
158
+ publish(nextState, validationErrors);
159
+ }
160
+ result = await resultOrPromise;
161
+ if (validationCommitId !== validationCommitIdRef.current) return;
162
+ nextState = refreshState();
163
+ } else result = resultOrPromise;
164
+ validationErrors = result ? [].concat(result).filter(Boolean) : [];
165
+ if (validationErrors.length > 0) {
166
+ nextState.valid = false;
167
+ nextState.customError = true;
168
+ if (element?.willValidate) setCustomValidity(element, validationErrors.join('\n'));
169
+ } else validationErrors = getNativeErrors(element);
170
+ }
171
+ publish(nextState, validationErrors);
172
+ });
173
+ const change = useStableCallback((value, cancelPending = false)=>{
174
+ timeout.clear();
175
+ validationCommitIdRef.current += 1;
176
+ if (cancelPending) return;
177
+ const validateOnChange = shouldValidateOnChange();
178
+ if (validateOnChange && '' !== value && validationDebounceTime) timeout.start(validationDebounceTime, ()=>{
179
+ commit(value);
180
+ });
181
+ else commit(value, !validateOnChange);
182
+ });
183
+ const getValidationProps = __rspack_external_react.useCallback((disabled, externalProps = {})=>mergeProps(getDescriptionProps(externalProps), false !== state.valid || state.disabled || disabled ? EMPTY_OBJECT : {
184
+ 'aria-invalid': true
185
+ }), [
186
+ getDescriptionProps,
187
+ state.disabled,
188
+ state.valid
189
+ ]);
190
+ return __rspack_external_react.useMemo(()=>({
191
+ getValidationProps,
192
+ inputRef,
193
+ registeredInputs,
194
+ registerInput,
195
+ getInputControl,
196
+ commit,
197
+ change
198
+ }), [
199
+ getValidationProps,
200
+ registeredInputs,
201
+ registerInput,
202
+ getInputControl,
203
+ commit,
204
+ change
205
+ ]);
206
+ }
207
+ export { getCombinedFieldValidityData, isEligibleInput, useFieldValidation };
@@ -1,30 +1,63 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { serializeValue } from "./5778.js";
2
+ import { areArraysEqual } from "./2387.js";
3
+ import { serializeValue } from "./1885.js";
4
+ import { useRenderElement } from "./9591.js";
3
5
  import * as __rspack_external_react from "react";
4
6
  const defaultItemEquality = (itemValue, selectedValue)=>Object.is(itemValue, selectedValue);
5
7
  function compareItemEquality(itemValue, selectedValue, comparer) {
6
8
  if (null == itemValue || null == selectedValue) return Object.is(itemValue, selectedValue);
7
9
  return comparer(itemValue, selectedValue);
8
10
  }
11
+ function isSelectedValueDirty(currentValue, initialValue, comparer) {
12
+ if (Array.isArray(currentValue) && Array.isArray(initialValue)) return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue)=>compareItemEquality(itemValue, initialItemValue, comparer));
13
+ return currentValue !== initialValue;
14
+ }
9
15
  function selectedValueIncludes(selectedValues, itemValue, comparer) {
10
- if (!selectedValues || 0 === selectedValues.length) return false;
16
+ if (!selectedValues) return false;
11
17
  return selectedValues.some((selectedValue)=>{
12
18
  if (void 0 === selectedValue) return false;
13
19
  return compareItemEquality(itemValue, selectedValue, comparer);
14
20
  });
15
21
  }
16
22
  function findItemIndex(itemValues, selectedValue, comparer) {
17
- if (!itemValues || 0 === itemValues.length) return -1;
23
+ if (!itemValues) return -1;
18
24
  return itemValues.findIndex((itemValue)=>{
19
25
  if (void 0 === itemValue) return false;
20
26
  return compareItemEquality(itemValue, selectedValue, comparer);
21
27
  });
22
28
  }
29
+ function createSelectionMatcher(selectedValues, comparer) {
30
+ if (comparer !== defaultItemEquality) return (itemValue)=>selectedValueIncludes(selectedValues, itemValue, comparer);
31
+ const index = new Set(selectedValues);
32
+ index.delete(void 0);
33
+ return (itemValue)=>index.has(itemValue) && (0 !== itemValue || selectedValues.some((v)=>Object.is(itemValue, v)));
34
+ }
35
+ function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {
36
+ const index = multiple && Array.isArray(selectedValue) ? itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);
37
+ return -1 === index ? null : index;
38
+ }
39
+ function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {
40
+ if (selectedValueIncludes(selectedValues, itemValue, comparer)) return null != currentIndex && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;
41
+ return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;
42
+ }
23
43
  function removeItem(selectedValues, itemValue, comparer) {
24
44
  return selectedValues.filter((selectedValue)=>!compareItemEquality(itemValue, selectedValue, comparer));
25
45
  }
46
+ function useOnFirstRender(fn) {
47
+ const ref = __rspack_external_react.useRef(true);
48
+ if (ref.current) {
49
+ ref.current = false;
50
+ fn();
51
+ }
52
+ }
53
+ function isGroup(item) {
54
+ return 'object' == typeof item && null != item && Array.isArray(item.items);
55
+ }
26
56
  function isGroupedItems(items) {
27
- return null != items && items.length > 0 && 'object' == typeof items[0] && null != items[0] && 'items' in items[0];
57
+ return isGroup(items?.[0]);
58
+ }
59
+ function flattenLeafItems(items) {
60
+ return isGroupedItems(items) ? items.flatMap((group)=>group.items) : items;
28
61
  }
29
62
  function hasNullItemLabel(items) {
30
63
  if (!Array.isArray(items)) return null != items && 'null' in items;
@@ -55,10 +88,13 @@ function resolveSelectedLabel(value, items, itemToStringLabel) {
55
88
  }
56
89
  if (itemToStringLabel && null != value) return itemToStringLabel(value);
57
90
  if (value && 'object' == typeof value && 'label' in value && null != value.label) return value.label;
58
- if (items && !Array.isArray(items)) return items[value] ?? fallback();
91
+ if (items && !Array.isArray(items)) {
92
+ const label = Object.hasOwn(items, value) ? items[value] : void 0;
93
+ return label ?? fallback();
94
+ }
59
95
  if (Array.isArray(items)) {
60
96
  const arrayItems = items;
61
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap((group)=>group.items) : arrayItems;
97
+ const flatItems = flattenLeafItems(arrayItems);
62
98
  if (null == value || 'object' != typeof value) {
63
99
  const match = flatItems.find((item)=>item.value === value);
64
100
  if (match && null != match.label) return match.label;
@@ -80,4 +116,21 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
80
116
  return acc;
81
117
  }, []);
82
118
  }
83
- export { compareItemEquality, defaultItemEquality, findItemIndex, hasNullItemLabel, isGroupedItems, removeItem, resolveMultipleLabels, resolveSelectedLabel, selectedValueIncludes, stringifyAsLabel, stringifyAsValue };
119
+ const ListboxSeparator_ListboxSeparator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
120
+ const { className, render, orientation = 'horizontal', style, ...elementProps } = componentProps;
121
+ const state = {
122
+ orientation
123
+ };
124
+ return useRenderElement('div', componentProps, {
125
+ state,
126
+ ref: forwardedRef,
127
+ props: [
128
+ {
129
+ role: 'presentation'
130
+ },
131
+ elementProps
132
+ ]
133
+ });
134
+ });
135
+ if ("production" !== process.env.NODE_ENV) ListboxSeparator_ListboxSeparator.displayName = "ListboxSeparator";
136
+ export { ListboxSeparator_ListboxSeparator, compareItemEquality, defaultItemEquality, findItemIndex, findSelectionIndex, flattenLeafItems, hasNullItemLabel, isGroupedItems, isSelectedValueDirty, removeItem, resolveMultipleLabels, resolveSelectedIndex, resolveSelectedLabel, selectedValueIncludes, stringifyAsLabel, stringifyAsValue, useOnFirstRender };