@jobber/components 8.21.1 → 8.23.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 (93) hide show
  1. package/Dialog.d.ts +1 -0
  2. package/Dialog.js +17 -0
  3. package/dist/BottomSheet-cjs.js +34 -7
  4. package/dist/BottomSheet-es.js +34 -8
  5. package/dist/CSPContext-cjs.js +69 -0
  6. package/dist/CSPContext-es.js +46 -0
  7. package/dist/Card/index.cjs +3 -0
  8. package/dist/Card/index.mjs +3 -0
  9. package/dist/ComboboxChipRemove-cjs.js +54 -211
  10. package/dist/ComboboxChipRemove-es.js +8 -164
  11. package/dist/DataDump/index.cjs +3 -0
  12. package/dist/DataDump/index.mjs +3 -0
  13. package/dist/Dialog/Dialog.d.ts +3 -0
  14. package/dist/Dialog/Dialog.types.d.ts +205 -0
  15. package/dist/Dialog/DialogBottomSheet.d.ts +28 -0
  16. package/dist/Dialog/DialogModal.d.ts +20 -0
  17. package/dist/Dialog/constants.d.ts +1 -0
  18. package/dist/Dialog/dialogComposableShared.d.ts +53 -0
  19. package/dist/Dialog/dialogReturnFocus.d.ts +43 -0
  20. package/dist/Dialog/index.cjs +33 -0
  21. package/dist/Dialog/index.d.ts +4 -0
  22. package/dist/Dialog/index.mjs +25 -0
  23. package/dist/DrawerDescription-cjs.js +410 -0
  24. package/dist/DrawerDescription-es.js +383 -0
  25. package/dist/DrawerTitle-cjs.js +116 -0
  26. package/dist/DrawerTitle-es.js +92 -0
  27. package/dist/InputNumberExperimental-cjs.js +24 -23
  28. package/dist/InputNumberExperimental-es.js +3 -2
  29. package/dist/InternalBackdrop-es.js +3 -3
  30. package/dist/Menu/index.cjs +3 -0
  31. package/dist/Menu/index.mjs +3 -0
  32. package/dist/Menu-cjs.js +6 -4
  33. package/dist/Menu-es.js +6 -4
  34. package/dist/MenuSubmenuTrigger-cjs.js +53 -103
  35. package/dist/MenuSubmenuTrigger-es.js +55 -103
  36. package/dist/NumberFieldInput-cjs.js +9 -9
  37. package/dist/NumberFieldInput-es.js +3 -3
  38. package/dist/Page/index.cjs +3 -0
  39. package/dist/Page/index.mjs +3 -0
  40. package/dist/ScrollAreaViewport-cjs.js +921 -960
  41. package/dist/ScrollAreaViewport-es.js +917 -958
  42. package/dist/SelectGroupLabel-cjs.js +1924 -0
  43. package/dist/SelectGroupLabel-es.js +1888 -0
  44. package/dist/SelectPrimitive-cjs.js +112 -0
  45. package/dist/SelectPrimitive-es.js +110 -0
  46. package/dist/ToolbarRootContext-cjs.js +35 -0
  47. package/dist/ToolbarRootContext-es.js +14 -0
  48. package/dist/dialogReturnFocus-cjs.js +427 -0
  49. package/dist/dialogReturnFocus-es.js +423 -0
  50. package/dist/docs/SelectPrimitive/SelectPrimitive.md +326 -0
  51. package/dist/docs/index.md +1 -0
  52. package/dist/floating-ui.react-dom-cjs.js +1 -0
  53. package/dist/floating-ui.react-dom-es.js +2 -2
  54. package/dist/floating-ui.utils.dom-es.js +1 -1
  55. package/dist/index.cjs +15 -7
  56. package/dist/index.d.mts +1 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.mjs +12 -7
  59. package/dist/primitives/BottomSheet/BottomSheet.d.ts +19 -1
  60. package/dist/primitives/BottomSheet/BottomSheet.types.d.ts +8 -0
  61. package/dist/primitives/BottomSheet/index.cjs +2 -0
  62. package/dist/primitives/BottomSheet/index.d.ts +1 -1
  63. package/dist/primitives/BottomSheet/index.mjs +2 -1
  64. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -1
  65. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -1
  66. package/dist/primitives/InputNumberExperimental/index.cjs +2 -1
  67. package/dist/primitives/InputNumberExperimental/index.mjs +2 -1
  68. package/dist/primitives/SelectPrimitive/SelectPrimitive.d.ts +63 -0
  69. package/dist/primitives/SelectPrimitive/index.cjs +29 -0
  70. package/dist/primitives/SelectPrimitive/index.d.ts +2 -0
  71. package/dist/primitives/SelectPrimitive/index.mjs +23 -0
  72. package/dist/primitives/SelectPrimitive/types.d.ts +16 -0
  73. package/dist/primitives/index.cjs +9 -1
  74. package/dist/primitives/index.d.ts +1 -0
  75. package/dist/primitives/index.mjs +8 -2
  76. package/dist/primitives/mergeClassName.d.ts +12 -0
  77. package/dist/resolveAriaLabelledBy-cjs.js +195 -0
  78. package/dist/resolveAriaLabelledBy-es.js +162 -0
  79. package/dist/styles.css +685 -0
  80. package/dist/unstyledPrimitives/index.cjs +434 -259
  81. package/dist/unstyledPrimitives/index.d.ts +2 -0
  82. package/dist/unstyledPrimitives/index.mjs +425 -252
  83. package/dist/useButton-cjs.js +2 -0
  84. package/dist/useButton-es.js +3 -2
  85. package/dist/useCompositeListItem-es.js +4 -4
  86. package/dist/useLabel-cjs.js +3 -329
  87. package/dist/useLabel-es.js +4 -299
  88. package/dist/useLabelableId-cjs.js +332 -0
  89. package/dist/useLabelableId-es.js +300 -0
  90. package/dist/useRenderElement-cjs.js +3 -0
  91. package/dist/useRenderElement-es.js +4 -1
  92. package/dist/utils/meta/meta.json +11 -1
  93. package/package.json +2 -2
@@ -3,11 +3,13 @@
3
3
  var React = require('react');
4
4
  var useButton = require('./useButton-cjs.js');
5
5
  var useRenderElement = require('./useRenderElement-cjs.js');
6
- var useLabel = require('./useLabel-cjs.js');
6
+ var useLabelableId = require('./useLabelableId-cjs.js');
7
7
  var useCompositeListItem = require('./useCompositeListItem-cjs.js');
8
+ var resolveAriaLabelledBy = require('./resolveAriaLabelledBy-cjs.js');
8
9
  var InternalBackdrop = require('./InternalBackdrop-cjs.js');
9
10
  var jsxRuntime = require('react/jsx-runtime');
10
11
  var ReactDOM = require('react-dom');
12
+ var useLabel = require('./useLabel-cjs.js');
11
13
 
12
14
  function _interopNamespaceDefault(e) {
13
15
  var n = Object.create(null);
@@ -64,157 +66,6 @@ function useComboboxInputValueContext() {
64
66
  return React__namespace.useContext(ComboboxInputValueContext);
65
67
  }
66
68
 
67
- const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
68
- function compareItemEquality(itemValue, selectedValue, comparer) {
69
- if (itemValue == null || selectedValue == null) {
70
- return Object.is(itemValue, selectedValue);
71
- }
72
- return comparer(itemValue, selectedValue);
73
- }
74
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
75
- if (!selectedValues || selectedValues.length === 0) {
76
- return false;
77
- }
78
- return selectedValues.some(selectedValue => {
79
- if (selectedValue === undefined) {
80
- return false;
81
- }
82
- return compareItemEquality(itemValue, selectedValue, comparer);
83
- });
84
- }
85
- function findItemIndex(itemValues, selectedValue, comparer) {
86
- if (!itemValues || itemValues.length === 0) {
87
- return -1;
88
- }
89
- return itemValues.findIndex(itemValue => {
90
- if (itemValue === undefined) {
91
- return false;
92
- }
93
- return compareItemEquality(itemValue, selectedValue, comparer);
94
- });
95
- }
96
- function removeItem(selectedValues, itemValue, comparer) {
97
- return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));
98
- }
99
-
100
- function serializeValue(value) {
101
- if (value == null) {
102
- return '';
103
- }
104
- if (typeof value === 'string') {
105
- return value;
106
- }
107
- try {
108
- return JSON.stringify(value);
109
- } catch {
110
- return String(value);
111
- }
112
- }
113
-
114
- function isGroupedItems(items) {
115
- return items != null && items.length > 0 && typeof items[0] === 'object' && items[0] != null && 'items' in items[0];
116
- }
117
-
118
- /**
119
- * Checks if the items array contains an item with a null value that has a non-null label.
120
- */
121
- function hasNullItemLabel(items) {
122
- if (!Array.isArray(items)) {
123
- return items != null && 'null' in items;
124
- }
125
- const arrayItems = items;
126
- if (isGroupedItems(arrayItems)) {
127
- for (const group of arrayItems) {
128
- for (const item of group.items) {
129
- if (item && item.value == null && item.label != null) {
130
- return true;
131
- }
132
- }
133
- }
134
- return false;
135
- }
136
- for (const item of arrayItems) {
137
- if (item && item.value == null && item.label != null) {
138
- return true;
139
- }
140
- }
141
- return false;
142
- }
143
- function stringifyAsLabel(item, itemToStringLabel) {
144
- if (itemToStringLabel && item != null) {
145
- return itemToStringLabel(item) ?? '';
146
- }
147
- if (item && typeof item === 'object') {
148
- if ('label' in item && item.label != null) {
149
- return String(item.label);
150
- }
151
- if ('value' in item) {
152
- return String(item.value);
153
- }
154
- }
155
- return serializeValue(item);
156
- }
157
- function stringifyAsValue(item, itemToStringValue) {
158
- if (itemToStringValue && item != null) {
159
- return itemToStringValue(item) ?? '';
160
- }
161
- if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
162
- return serializeValue(item.value);
163
- }
164
- return serializeValue(item);
165
- }
166
- function resolveSelectedLabel(value, items, itemToStringLabel) {
167
- function fallback() {
168
- return stringifyAsLabel(value, itemToStringLabel);
169
- }
170
- if (itemToStringLabel && value != null) {
171
- return itemToStringLabel(value);
172
- }
173
-
174
- // Custom object with explicit label takes precedence
175
- if (value && typeof value === 'object' && 'label' in value && value.label != null) {
176
- return value.label;
177
- }
178
-
179
- // Items provided as plain record map
180
- if (items && !Array.isArray(items)) {
181
- return items[value] ?? fallback();
182
- }
183
-
184
- // Items provided as array (flat or grouped)
185
- if (Array.isArray(items)) {
186
- const arrayItems = items;
187
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap(group => group.items) : arrayItems;
188
- if (value == null || typeof value !== 'object') {
189
- const match = flatItems.find(item => item.value === value);
190
- if (match && match.label != null) {
191
- return match.label;
192
- }
193
- return fallback();
194
- }
195
-
196
- // Object without explicit label: try matching by its `value` property
197
- if ('value' in value) {
198
- const match = flatItems.find(item => item && item.value === value.value);
199
- if (match && match.label != null) {
200
- return match.label;
201
- }
202
- }
203
- }
204
- return fallback();
205
- }
206
- function resolveMultipleLabels(values, items, itemToStringLabel) {
207
- return values.reduce((acc, value, index) => {
208
- if (index > 0) {
209
- acc.push(', ');
210
- }
211
- acc.push(/*#__PURE__*/jsxRuntime.jsx(React__namespace.Fragment, {
212
- children: resolveSelectedLabel(value, items, itemToStringLabel)
213
- }, index));
214
- return acc;
215
- }, []);
216
- }
217
-
218
69
  const selectors = {
219
70
  id: InternalBackdrop.createSelector(state => state.id),
220
71
  labelId: InternalBackdrop.createSelector(state => state.labelId),
@@ -239,7 +90,7 @@ const selectors = {
239
90
  return true;
240
91
  }),
241
92
  hasNullItemLabel: InternalBackdrop.createSelector((state, enabled) => {
242
- return enabled ? hasNullItemLabel(state.items) : false;
93
+ return enabled ? resolveAriaLabelledBy.hasNullItemLabel(state.items) : false;
243
94
  }),
244
95
  open: InternalBackdrop.createSelector(state => state.open),
245
96
  mounted: InternalBackdrop.createSelector(state => state.mounted),
@@ -252,9 +103,9 @@ const selectors = {
252
103
  const comparer = state.isItemEqualToValue;
253
104
  const selectedValue = state.selectedValue;
254
105
  if (Array.isArray(selectedValue)) {
255
- return selectedValue.some(selectedItem => compareItemEquality(itemValue, selectedItem, comparer));
106
+ return selectedValue.some(selectedItem => resolveAriaLabelledBy.compareItemEquality(itemValue, selectedItem, comparer));
256
107
  }
257
- return compareItemEquality(itemValue, selectedValue, comparer);
108
+ return resolveAriaLabelledBy.compareItemEquality(itemValue, selectedValue, comparer);
258
109
  }),
259
110
  transitionStatus: InternalBackdrop.createSelector(state => state.transitionStatus),
260
111
  popupProps: InternalBackdrop.createSelector(state => state.popupProps),
@@ -307,7 +158,7 @@ function createCollatorItemFilter(collatorFilter, itemToStringLabel) {
307
158
  if (item == null) {
308
159
  return false;
309
160
  }
310
- const itemString = stringifyAsLabel(item, itemToStringLabel);
161
+ const itemString = resolveAriaLabelledBy.stringifyAsLabel(item, itemToStringLabel);
311
162
  return collatorFilter.contains(itemString, query);
312
163
  };
313
164
  }
@@ -324,8 +175,8 @@ function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel,
324
175
  if (!query) {
325
176
  return true;
326
177
  }
327
- const itemString = stringifyAsLabel(item, itemToStringLabel);
328
- const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, itemToStringLabel) : '';
178
+ const itemString = resolveAriaLabelledBy.stringifyAsLabel(item, itemToStringLabel);
179
+ const selectedString = selectedValue != null ? resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel) : '';
329
180
 
330
181
  // Handle case-insensitive matching consistently
331
182
  if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) {
@@ -363,7 +214,7 @@ function getFilter(options = {}) {
363
214
  if (!query) {
364
215
  return true;
365
216
  }
366
- const itemString = stringifyAsLabel(item, itemToString);
217
+ const itemString = resolveAriaLabelledBy.stringifyAsLabel(item, itemToString);
367
218
  for (let i = 0; i <= itemString.length - query.length; i += 1) {
368
219
  if (collator.compare(itemString.slice(i, i + query.length), query) === 0) {
369
220
  return true;
@@ -375,14 +226,14 @@ function getFilter(options = {}) {
375
226
  if (!query) {
376
227
  return true;
377
228
  }
378
- const itemString = stringifyAsLabel(item, itemToString);
229
+ const itemString = resolveAriaLabelledBy.stringifyAsLabel(item, itemToString);
379
230
  return collator.compare(itemString.slice(0, query.length), query) === 0;
380
231
  },
381
232
  endsWith(item, query, itemToString) {
382
233
  if (!query) {
383
234
  return true;
384
235
  }
385
- const itemString = stringifyAsLabel(item, itemToString);
236
+ const itemString = resolveAriaLabelledBy.stringifyAsLabel(item, itemToString);
386
237
  const queryLength = query.length;
387
238
  return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;
388
239
  }
@@ -451,7 +302,7 @@ function AriaCombobox(props) {
451
302
  loopFocus = true,
452
303
  itemToStringLabel,
453
304
  itemToStringValue,
454
- isItemEqualToValue = defaultItemEquality,
305
+ isItemEqualToValue = resolveAriaLabelledBy.defaultItemEquality,
455
306
  virtualized = false,
456
307
  inline: inlineProp = false,
457
308
  fillInputOnItemPress = true,
@@ -464,7 +315,7 @@ function AriaCombobox(props) {
464
315
  } = props;
465
316
  const {
466
317
  clearErrors
467
- } = useLabel.useFormContext();
318
+ } = useLabelableId.useFormContext();
468
319
  const {
469
320
  setDirty,
470
321
  validityData,
@@ -476,8 +327,8 @@ function AriaCombobox(props) {
476
327
  setFocused,
477
328
  validationMode,
478
329
  validation
479
- } = useLabel.useFieldRootContext();
480
- const id = useLabel.useLabelableId({
330
+ } = useLabelableId.useFieldRootContext();
331
+ const id = useLabelableId.useLabelableId({
481
332
  id: idProp
482
333
  });
483
334
  const collatorFilter = useCoreFilter({
@@ -550,7 +401,7 @@ function AriaCombobox(props) {
550
401
  return defaultInputValueProp ?? '';
551
402
  }
552
403
  if (single) {
553
- return stringifyAsLabel(selectedValue, itemToStringLabel);
404
+ return resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel);
554
405
  }
555
406
  return '';
556
407
  }).current;
@@ -566,9 +417,9 @@ function AriaCombobox(props) {
566
417
  name: 'Combobox',
567
418
  state: 'open'
568
419
  });
569
- const isGrouped = isGroupedItems(items);
420
+ const isGrouped = resolveAriaLabelledBy.isGroupedItems(items);
570
421
  const query = closeQuery ?? (inputValue === '' ? '' : String(inputValue).trim());
571
- const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : '';
422
+ const selectedLabelString = single ? resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel) : '';
572
423
  const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== '' && selectedLabelString !== '' && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
573
424
  const filterQuery = shouldBypassFiltering ? '' : query;
574
425
  const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
@@ -712,9 +563,9 @@ function AriaCombobox(props) {
712
563
  return fieldRawValue;
713
564
  }
714
565
  if (Array.isArray(selectedValue)) {
715
- return selectedValue.map(value => stringifyAsValue(value, itemToStringValue));
566
+ return selectedValue.map(value => resolveAriaLabelledBy.stringifyAsValue(value, itemToStringValue));
716
567
  }
717
- return stringifyAsValue(selectedValue, itemToStringValue);
568
+ return resolveAriaLabelledBy.stringifyAsValue(selectedValue, itemToStringValue);
718
569
  }, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]);
719
570
  const onItemHighlighted = useButton.useStableCallback(onItemHighlightedProp);
720
571
  const onOpenChangeComplete = useButton.useStableCallback(onOpenChangeCompleteProp);
@@ -737,7 +588,7 @@ function AriaCombobox(props) {
737
588
  openMethod,
738
589
  triggerProps
739
590
  } = InternalBackdrop.useOpenInteractionType(open);
740
- useLabel.useField({
591
+ useLabelableId.useField({
741
592
  id,
742
593
  name,
743
594
  commit: validation.commit,
@@ -748,7 +599,7 @@ function AriaCombobox(props) {
748
599
  const forceMount = useButton.useStableCallback(() => {
749
600
  if (items) {
750
601
  // Ensure typeahead works on a closed list.
751
- labelsRef.current = flatFilteredItems.map(item => stringifyAsLabel(item, itemToStringLabel));
602
+ labelsRef.current = flatFilteredItems.map(item => resolveAriaLabelledBy.stringifyAsLabel(item, itemToStringLabel));
752
603
  } else {
753
604
  store.set('forceMounted', true);
754
605
  }
@@ -874,7 +725,7 @@ function AriaCombobox(props) {
874
725
  setSelectedValueUnwrapped(nextValue);
875
726
  const shouldFillInput = selectionMode === 'none' && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup;
876
727
  if (shouldFillInput) {
877
- setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), useButton.createChangeEventDetails(eventDetails.reason, eventDetails.event));
728
+ setInputValue(resolveAriaLabelledBy.stringifyAsLabel(nextValue, itemToStringLabel), useButton.createChangeEventDetails(eventDetails.reason, eventDetails.event));
878
729
  }
879
730
  if (single && nextValue != null && eventDetails.reason !== useButton.inputChange && queryChangedAfterOpen && !inline) {
880
731
  setCloseQuery(query);
@@ -903,8 +754,8 @@ function AriaCombobox(props) {
903
754
  }
904
755
  if (multiple) {
905
756
  const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
906
- const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue);
907
- const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue];
757
+ const isCurrentlySelected = resolveAriaLabelledBy.selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue);
758
+ const nextValue = isCurrentlySelected ? resolveAriaLabelledBy.removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue];
908
759
  setSelectedValue(nextValue, eventDetails);
909
760
  const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== '' : false;
910
761
  if (!wasFiltering) {
@@ -961,7 +812,7 @@ function AriaCombobox(props) {
961
812
  setInputValue('', useButton.createChangeEventDetails(useButton.inputClear));
962
813
  }
963
814
  } else {
964
- const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
815
+ const stringVal = resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel);
965
816
  if (inputRef.current && inputRef.current.value !== stringVal) {
966
817
  // If no selection was made, treat this as clearing the typed filter.
967
818
  const reason = stringVal === '' ? useButton.inputClear : useButton.none;
@@ -1004,12 +855,12 @@ function AriaCombobox(props) {
1004
855
  if (multiple) {
1005
856
  const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
1006
857
  const lastValue = currentValue[currentValue.length - 1];
1007
- const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
858
+ const lastIndex = resolveAriaLabelledBy.findItemIndex(registry, lastValue, isItemEqualToValue);
1008
859
  setIndices({
1009
860
  selectedIndex: lastIndex === -1 ? null : lastIndex
1010
861
  });
1011
862
  } else {
1012
- const index = findItemIndex(registry, selectedValue, isItemEqualToValue);
863
+ const index = resolveAriaLabelledBy.findItemIndex(registry, selectedValue, isItemEqualToValue);
1013
864
  setIndices({
1014
865
  selectedIndex: index === -1 ? null : index
1015
866
  });
@@ -1064,7 +915,7 @@ function AriaCombobox(props) {
1064
915
  }
1065
916
  const itemValue = candidateItems[storeActiveIndex];
1066
917
  const previouslyHighlightedItemValue = lastHighlightRef.current.value;
1067
- const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
918
+ const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && resolveAriaLabelledBy.compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
1068
919
  if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
1069
920
  lastHighlightRef.current = {
1070
921
  value: itemValue,
@@ -1110,7 +961,7 @@ function AriaCombobox(props) {
1110
961
  validation.commit(selectedValue, true);
1111
962
  }
1112
963
  if (single && !hasInputValue && !inputInsidePopup) {
1113
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
964
+ const nextInputValue = resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel);
1114
965
  if (inputValue !== nextInputValue) {
1115
966
  setInputValue(nextInputValue, useButton.createChangeEventDetails(useButton.none));
1116
967
  }
@@ -1132,7 +983,7 @@ function AriaCombobox(props) {
1132
983
  if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) {
1133
984
  return;
1134
985
  }
1135
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
986
+ const nextInputValue = resolveAriaLabelledBy.stringifyAsLabel(selectedValue, itemToStringLabel);
1136
987
  if (inputValue !== nextInputValue) {
1137
988
  setInputValue(nextInputValue, useButton.createChangeEventDetails(useButton.none));
1138
989
  }
@@ -1304,7 +1155,7 @@ function AriaCombobox(props) {
1304
1155
  if (Array.isArray(fieldRawValue)) {
1305
1156
  return '';
1306
1157
  }
1307
- return stringifyAsValue(fieldRawValue, itemToStringValue);
1158
+ return resolveAriaLabelledBy.stringifyAsValue(fieldRawValue, itemToStringValue);
1308
1159
  }, [fieldRawValue, itemToStringValue]);
1309
1160
  const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;
1310
1161
  const hiddenInputName = multiple || selectionMode === 'none' ? undefined : name;
@@ -1313,7 +1164,7 @@ function AriaCombobox(props) {
1313
1164
  return null;
1314
1165
  }
1315
1166
  return selectedValue.map(value => {
1316
- const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
1167
+ const currentSerializedValue = resolveAriaLabelledBy.stringifyAsValue(value, itemToStringValue);
1317
1168
  return /*#__PURE__*/jsxRuntime.jsx("input", {
1318
1169
  type: "hidden",
1319
1170
  name: name,
@@ -1354,7 +1205,7 @@ function AriaCombobox(props) {
1354
1205
  return;
1355
1206
  }
1356
1207
  const matchingValue = valuesRef.current.find(v => {
1357
- const candidate = stringifyAsValue(v, itemToStringValue);
1208
+ const candidate = resolveAriaLabelledBy.stringifyAsValue(v, itemToStringValue);
1358
1209
  if (candidate.toLowerCase() === nextValue.toLowerCase()) {
1359
1210
  return true;
1360
1211
  }
@@ -1406,7 +1257,7 @@ function AriaCombobox(props) {
1406
1257
 
1407
1258
  const triggerStateAttributesMapping = {
1408
1259
  ...InternalBackdrop.pressableTriggerOpenStateMapping,
1409
- ...useLabel.fieldValidityMapping,
1260
+ ...useLabelableId.fieldValidityMapping,
1410
1261
  popupSide: side => side ? {
1411
1262
  'data-popup-side': side
1412
1263
  } : null,
@@ -1415,13 +1266,6 @@ const triggerStateAttributesMapping = {
1415
1266
  } : null
1416
1267
  };
1417
1268
 
1418
- function getDefaultLabelId(id) {
1419
- return id == null ? undefined : `${id}-label`;
1420
- }
1421
- function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
1422
- return fieldLabelId ?? localLabelId;
1423
- }
1424
-
1425
1269
  const BOUNDARY_OFFSET = 2;
1426
1270
 
1427
1271
  /**
@@ -1444,10 +1288,10 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
1444
1288
  setFocused,
1445
1289
  validationMode,
1446
1290
  validation
1447
- } = useLabel.useFieldRootContext();
1291
+ } = useLabelableId.useFieldRootContext();
1448
1292
  const {
1449
1293
  labelId: fieldLabelId
1450
- } = useLabel.useLabelableContext();
1294
+ } = useLabelableId.useLabelableContext();
1451
1295
  const store = useComboboxRootContext();
1452
1296
  const {
1453
1297
  filteredItems
@@ -1476,11 +1320,11 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
1476
1320
  const disabled = fieldDisabled || comboboxDisabled || disabledProp;
1477
1321
  const listEmpty = filteredItems.length === 0;
1478
1322
  const popupSide = mounted && positionerElement ? popupSideValue : null;
1479
- useLabel.useLabelableId({
1323
+ useLabelableId.useLabelableId({
1480
1324
  id: inputInsidePopup ? idProp : undefined
1481
1325
  });
1482
1326
  const id = inputInsidePopup ? idProp ?? rootId : idProp;
1483
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
1327
+ const ariaLabelledBy = resolveAriaLabelledBy.resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
1484
1328
  const currentPointerTypeRef = React__namespace.useRef('');
1485
1329
  function trackPointerType(event) {
1486
1330
  currentPointerTypeRef.current = event.pointerType;
@@ -1688,10 +1532,10 @@ const ComboboxInput = /*#__PURE__*/React__namespace.forwardRef(function Combobox
1688
1532
  setFocused,
1689
1533
  validationMode,
1690
1534
  validation
1691
- } = useLabel.useFieldRootContext();
1535
+ } = useLabelableId.useFieldRootContext();
1692
1536
  const {
1693
1537
  labelId: fieldLabelId
1694
- } = useLabel.useLabelableContext();
1538
+ } = useLabelableId.useLabelableContext();
1695
1539
  const comboboxChipsContext = useComboboxChipsContext();
1696
1540
  const positioning = useComboboxPositionerContext(true);
1697
1541
  const hasPositionerParent = Boolean(positioning);
@@ -1726,8 +1570,8 @@ const ComboboxInput = /*#__PURE__*/React__namespace.forwardRef(function Combobox
1726
1570
  const isInsidePopup = hasPositionerParent || inline;
1727
1571
  const focusManagerModal = !isInsidePopup || modal;
1728
1572
  const id = useButton.useBaseUiId(idProp ?? (!isInsidePopup ? rootId : undefined));
1729
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, undefined);
1730
- const fieldStateForInput = hasPositionerParent ? useLabel.DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
1573
+ const ariaLabelledBy = resolveAriaLabelledBy.resolveAriaLabelledBy(fieldLabelId, undefined);
1574
+ const fieldStateForInput = hasPositionerParent ? useLabelableId.DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
1731
1575
  const [composingValue, setComposingValue] = React__namespace.useState(null);
1732
1576
  const isComposingRef = React__namespace.useRef(false);
1733
1577
  const lastActiveIndexRef = React__namespace.useRef(null);
@@ -2057,7 +1901,7 @@ const ComboboxInputGroup = /*#__PURE__*/React__namespace.forwardRef(function Com
2057
1901
  const {
2058
1902
  state: fieldState,
2059
1903
  disabled: fieldDisabled
2060
- } = useLabel.useFieldRootContext();
1904
+ } = useLabelableId.useFieldRootContext();
2061
1905
  const store = useComboboxRootContext();
2062
1906
  const {
2063
1907
  filteredItems
@@ -2138,7 +1982,7 @@ const ComboboxClear = /*#__PURE__*/React__namespace.forwardRef(function Combobox
2138
1982
  } = componentProps;
2139
1983
  const {
2140
1984
  disabled: fieldDisabled
2141
- } = useLabel.useFieldRootContext();
1985
+ } = useLabelableId.useFieldRootContext();
2142
1986
  const store = useComboboxRootContext();
2143
1987
  const selectionMode = InternalBackdrop.useStore(store, selectors.selectionMode);
2144
1988
  const comboboxDisabled = InternalBackdrop.useStore(store, selectors.disabled);
@@ -2805,7 +2649,7 @@ const ComboboxItem = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__name
2805
2649
  const virtualized = InternalBackdrop.useStore(store, selectors.virtualized);
2806
2650
  const isItemEqualToValue = InternalBackdrop.useStore(store, selectors.isItemEqualToValue);
2807
2651
  const selectable = selectionMode !== 'none';
2808
- const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
2652
+ const index = indexProp ?? (virtualized ? resolveAriaLabelledBy.findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
2809
2653
  const hasRegistered = listItem.index !== -1;
2810
2654
  const rootId = InternalBackdrop.useStore(store, selectors.id);
2811
2655
  const highlighted = InternalBackdrop.useStore(store, selectors.isActive, index);
@@ -2852,7 +2696,7 @@ const ComboboxItem = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__name
2852
2696
  }
2853
2697
  const selectedValue = store.state.selectedValue;
2854
2698
  const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
2855
- if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) {
2699
+ if (resolveAriaLabelledBy.compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) {
2856
2700
  store.set('selectedIndex', index);
2857
2701
  }
2858
2702
  }, [hasRegistered, hasItems, open, store, index, itemValue, isItemEqualToValue]);
@@ -3021,13 +2865,13 @@ const ComboboxLabel = /*#__PURE__*/React__namespace.forwardRef(function Combobox
3021
2865
  // Keep label id derived from the root and ignore runtime `id` overrides from untyped consumers.
3022
2866
  const elementPropsWithoutId = elementProps;
3023
2867
  delete elementPropsWithoutId.id;
3024
- const fieldRootContext = useLabel.useFieldRootContext();
2868
+ const fieldRootContext = useLabelableId.useFieldRootContext();
3025
2869
  const store = useComboboxRootContext();
3026
2870
  const inputInsidePopup = InternalBackdrop.useStore(store, selectors.inputInsidePopup);
3027
2871
  const triggerElement = InternalBackdrop.useStore(store, selectors.triggerElement);
3028
2872
  const inputElement = InternalBackdrop.useStore(store, selectors.inputElement);
3029
2873
  const rootId = InternalBackdrop.useStore(store, selectors.id);
3030
- const defaultLabelId = getDefaultLabelId(rootId);
2874
+ const defaultLabelId = resolveAriaLabelledBy.getDefaultLabelId(rootId);
3031
2875
  const localControlId = triggerElement?.id ?? (inputInsidePopup ? rootId : undefined);
3032
2876
  if (process.env.NODE_ENV !== 'production') {
3033
2877
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -3051,7 +2895,7 @@ const ComboboxLabel = /*#__PURE__*/React__namespace.forwardRef(function Combobox
3051
2895
  ref: forwardedRef,
3052
2896
  state: fieldRootContext.state,
3053
2897
  props: [labelProps, elementProps],
3054
- stateAttributesMapping: useLabel.fieldValidityMapping
2898
+ stateAttributesMapping: useLabelableId.fieldValidityMapping
3055
2899
  });
3056
2900
  });
3057
2901
  if (process.env.NODE_ENV !== "production") ComboboxLabel.displayName = "ComboboxLabel";
@@ -3077,9 +2921,9 @@ function ComboboxValue(props) {
3077
2921
  } else if (!hasSelectedValue && placeholder != null && !hasNullLabel) {
3078
2922
  children = placeholder;
3079
2923
  } else if (multiple && Array.isArray(selectedValue)) {
3080
- children = resolveMultipleLabels(selectedValue, items, itemToStringLabel);
2924
+ children = resolveAriaLabelledBy.resolveMultipleLabels(selectedValue, items, itemToStringLabel);
3081
2925
  } else {
3082
- children = resolveSelectedLabel(selectedValue, items, itemToStringLabel);
2926
+ children = resolveAriaLabelledBy.resolveSelectedLabel(selectedValue, items, itemToStringLabel);
3083
2927
  }
3084
2928
  return /*#__PURE__*/jsxRuntime.jsx(React__namespace.Fragment, {
3085
2929
  children: children
@@ -3338,7 +3182,7 @@ const ComboboxChipRemove = /*#__PURE__*/React__namespace.forwardRef(function Com
3338
3182
 
3339
3183
  // Try current visible list first; if not found, it's filtered out.
3340
3184
  // No need to clear highlight in that case since it can't equal activeIndex.
3341
- const removedIndex = findItemIndex(store.state.valuesRef.current, removedItem, isItemEqualToValue);
3185
+ const removedIndex = resolveAriaLabelledBy.findItemIndex(store.state.valuesRef.current, removedItem, isItemEqualToValue);
3342
3186
  if (removedIndex !== -1 && activeIndex === removedIndex) {
3343
3187
  store.state.setIndices({
3344
3188
  activeIndex: null,
@@ -3411,7 +3255,6 @@ exports.ComboboxRow = ComboboxRow;
3411
3255
  exports.ComboboxStatus = ComboboxStatus;
3412
3256
  exports.ComboboxTrigger = ComboboxTrigger;
3413
3257
  exports.ComboboxValue = ComboboxValue;
3414
- exports.stringifyAsLabel = stringifyAsLabel;
3415
3258
  exports.useComboboxFilter = useComboboxFilter;
3416
3259
  exports.useComboboxInputValueContext = useComboboxInputValueContext;
3417
3260
  exports.useCoreFilter = useCoreFilter;