@jobber/components 9.4.0 → 9.5.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 (161) hide show
  1. package/dist/Autocomplete/index.cjs +0 -1
  2. package/dist/Autocomplete/index.mjs +0 -1
  3. package/dist/Card/index.cjs +7 -7
  4. package/dist/Card/index.mjs +7 -7
  5. package/dist/Chip/index.cjs +0 -1
  6. package/dist/Chip/index.mjs +0 -1
  7. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -1
  8. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -1
  9. package/dist/Chips/InternalChipDismissible/index.cjs +0 -1
  10. package/dist/Chips/InternalChipDismissible/index.mjs +0 -1
  11. package/dist/Chips/index.cjs +0 -1
  12. package/dist/Chips/index.mjs +0 -1
  13. package/dist/ComboboxChipRemove-cjs.js +181 -184
  14. package/dist/ComboboxChipRemove-es.js +4 -7
  15. package/dist/ConfirmationModal/index.cjs +0 -1
  16. package/dist/ConfirmationModal/index.mjs +0 -1
  17. package/dist/DataDump/index.cjs +7 -7
  18. package/dist/DataDump/index.mjs +7 -7
  19. package/dist/DataList/components/DataListActions/index.cjs +0 -1
  20. package/dist/DataList/components/DataListActions/index.mjs +0 -1
  21. package/dist/DataList/components/DataListBulkActions/index.cjs +0 -1
  22. package/dist/DataList/components/DataListBulkActions/index.mjs +0 -1
  23. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -1
  24. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -1
  25. package/dist/DataList/components/DataListFilters/index.cjs +0 -1
  26. package/dist/DataList/components/DataListFilters/index.mjs +0 -1
  27. package/dist/DataList/components/DataListHeader/index.cjs +0 -1
  28. package/dist/DataList/components/DataListHeader/index.mjs +0 -1
  29. package/dist/DataList/components/DataListItem/index.cjs +0 -1
  30. package/dist/DataList/components/DataListItem/index.mjs +0 -1
  31. package/dist/DataList/components/DataListItemActions/index.cjs +0 -1
  32. package/dist/DataList/components/DataListItemActions/index.mjs +0 -1
  33. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -1
  34. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -1
  35. package/dist/DataList/components/DataListItems/index.cjs +0 -1
  36. package/dist/DataList/components/DataListItems/index.mjs +0 -1
  37. package/dist/DataList/components/DataListLayout/index.cjs +0 -1
  38. package/dist/DataList/components/DataListLayout/index.mjs +0 -1
  39. package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -1
  40. package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -1
  41. package/dist/DataList/index.cjs +0 -1
  42. package/dist/DataList/index.mjs +0 -1
  43. package/dist/DatePicker/index.cjs +0 -2
  44. package/dist/DatePicker/index.mjs +0 -2
  45. package/dist/DatePicker-cjs.js +19 -18
  46. package/dist/DatePicker-es.js +2 -1
  47. package/dist/Dialog/index.cjs +11 -6
  48. package/dist/Dialog/index.mjs +11 -6
  49. package/dist/DrawerDescription-cjs.js +7 -8
  50. package/dist/DrawerDescription-es.js +1 -2
  51. package/dist/DrawerTitle-cjs.js +4 -4
  52. package/dist/DrawerTitle-es.js +1 -1
  53. package/dist/FieldDescription-cjs.js +49 -49
  54. package/dist/FieldDescription-es.js +2 -2
  55. package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +0 -1
  56. package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +0 -1
  57. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +0 -1
  58. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +0 -1
  59. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +0 -1
  60. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +0 -1
  61. package/dist/FilterPicker/index.cjs +0 -1
  62. package/dist/FilterPicker/index.mjs +0 -1
  63. package/dist/FormatFile/index.cjs +0 -1
  64. package/dist/FormatFile/index.mjs +0 -1
  65. package/dist/Gallery/index.cjs +0 -1
  66. package/dist/Gallery/index.mjs +0 -1
  67. package/dist/HelperText-cjs.js +3 -2
  68. package/dist/HelperText-es.js +3 -2
  69. package/dist/InputDate/index.cjs +0 -2
  70. package/dist/InputDate/index.mjs +0 -2
  71. package/dist/InputNumber/InputNumber.d.ts +75 -5
  72. package/dist/InputNumber/index.cjs +27 -3
  73. package/dist/InputNumber/index.d.ts +2 -2
  74. package/dist/InputNumber/index.mjs +27 -3
  75. package/dist/{primitives/InputNumberExperimental → InputNumber}/types.d.ts +48 -35
  76. package/dist/InputNumber-cjs.js +267 -4986
  77. package/dist/InputNumber-es.js +268 -4987
  78. package/dist/LightBox/index.cjs +0 -1
  79. package/dist/LightBox/index.mjs +0 -1
  80. package/dist/Menu/index.cjs +7 -7
  81. package/dist/Menu/index.mjs +7 -7
  82. package/dist/Menu-cjs.js +4 -1
  83. package/dist/Menu-es.js +4 -1
  84. package/dist/MenuSubmenuTrigger-cjs.js +142 -143
  85. package/dist/MenuSubmenuTrigger-es.js +5 -6
  86. package/dist/Modal/index.cjs +0 -1
  87. package/dist/Modal/index.mjs +0 -1
  88. package/dist/NumberFieldInput-cjs.js +63 -63
  89. package/dist/NumberFieldInput-es.js +5 -5
  90. package/dist/Page/index.cjs +7 -8
  91. package/dist/Page/index.mjs +7 -8
  92. package/dist/Popover/index.cjs +0 -1
  93. package/dist/Popover/index.mjs +0 -1
  94. package/dist/ScrollAreaViewport-cjs.js +119 -121
  95. package/dist/ScrollAreaViewport-es.js +3 -5
  96. package/dist/Select/index.cjs +3 -9
  97. package/dist/Select/index.mjs +3 -9
  98. package/dist/SelectGroupLabel-cjs.js +117 -107
  99. package/dist/SelectGroupLabel-es.js +20 -12
  100. package/dist/Tooltip/index.cjs +0 -1
  101. package/dist/Tooltip/index.mjs +0 -1
  102. package/dist/dialogReturnFocus-cjs.js +4 -1
  103. package/dist/dialogReturnFocus-es.js +4 -1
  104. package/dist/docs/InputNumber/InputNumber.md +564 -56
  105. package/dist/docs/index.md +0 -1
  106. package/dist/floating-ui.react-cjs.js +34 -35
  107. package/dist/floating-ui.react-dom-cjs.js +64 -65
  108. package/dist/floating-ui.react-dom-es.js +1 -2
  109. package/dist/floating-ui.react-es.js +1 -2
  110. package/dist/floating-ui.utils-cjs.js +183 -0
  111. package/dist/floating-ui.utils-es.js +165 -1
  112. package/dist/index.cjs +10 -15
  113. package/dist/index.mjs +10 -15
  114. package/dist/primitives/BottomSheet/index.cjs +2 -5
  115. package/dist/primitives/BottomSheet/index.mjs +2 -5
  116. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -7
  117. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -7
  118. package/dist/primitives/HelperText/HelperText.d.ts +4 -1
  119. package/dist/primitives/HelperText/index.cjs +1 -1
  120. package/dist/primitives/HelperText/index.mjs +1 -1
  121. package/dist/primitives/SelectPrimitive/index.cjs +3 -9
  122. package/dist/primitives/SelectPrimitive/index.mjs +3 -9
  123. package/dist/primitives/index.cjs +2 -16
  124. package/dist/primitives/index.d.ts +0 -2
  125. package/dist/primitives/index.mjs +2 -15
  126. package/dist/scrollEdges-cjs.js +6 -2
  127. package/dist/scrollEdges-es.js +5 -2
  128. package/dist/styles.css +573 -902
  129. package/dist/unstyledPrimitives/index.cjs +105 -111
  130. package/dist/unstyledPrimitives/index.mjs +5 -11
  131. package/dist/useCompositeListItem-cjs.js +516 -90
  132. package/dist/useCompositeListItem-es.js +407 -6
  133. package/dist/useLabel-cjs.js +10 -10
  134. package/dist/useLabel-es.js +3 -3
  135. package/dist/useRenderElement-es.js +1 -1
  136. package/dist/useScrollLock-cjs.js +1332 -203
  137. package/dist/useScrollLock-es.js +1068 -5
  138. package/dist/utils/meta/meta.json +12 -0
  139. package/package.json +2 -3
  140. package/dist/InputNumber/InputNumber.types.d.ts +0 -20
  141. package/dist/InputNumberExperimental-cjs.js +0 -277
  142. package/dist/InputNumberExperimental-es.js +0 -275
  143. package/dist/clamp-cjs.js +0 -7
  144. package/dist/clamp-es.js +0 -5
  145. package/dist/clsx-cjs.js +0 -5
  146. package/dist/clsx-es.js +0 -3
  147. package/dist/docs/InputNumberExperimental/InputNumberExperimental.md +0 -578
  148. package/dist/floating-ui.utils.dom-cjs.js +0 -185
  149. package/dist/floating-ui.utils.dom-es.js +0 -165
  150. package/dist/isElementDisabled-cjs.js +0 -40
  151. package/dist/isElementDisabled-es.js +0 -18
  152. package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +0 -77
  153. package/dist/primitives/InputNumberExperimental/index.cjs +0 -30
  154. package/dist/primitives/InputNumberExperimental/index.d.ts +0 -2
  155. package/dist/primitives/InputNumberExperimental/index.mjs +0 -24
  156. package/dist/resolveAriaLabelledBy-cjs.js +0 -200
  157. package/dist/resolveAriaLabelledBy-es.js +0 -166
  158. package/dist/useButton-cjs.js +0 -1164
  159. package/dist/useButton-es.js +0 -1071
  160. package/dist/useLabelableId-cjs.js +0 -278
  161. package/dist/useLabelableId-es.js +0 -247
@@ -1,10 +1,8 @@
1
1
  import * as React from 'react';
2
- import { l as useId, a as useIsoLayoutEffect, m as useValueAsRef, b as useStableCallback, n as useAnimationFrame, p as activeElement, o as ownerDocument, q as contains, s as stopEvent, d as createChangeEventDetails, r as listNavigation, g as getTarget, v as focusOut, w as isVirtualClick, x as isVirtualPointerEvent, h as useTimeout, y as jsdom } from './useButton-es.js';
3
- import { b as isElement, i as isHTMLElement, o as getWindow } from './floating-ui.utils.dom-es.js';
4
- import { u as useFloatingParentNodeId, b as FloatingRootStore, P as PopupTriggerMap, d as useFloatingTree, g as getFloatingFocusElement, i as isTypeableCombobox, e as isIndexOutOfListBounds, f as getMinListIndex, h as getMaxListIndex, j as findNonDisabledListIndex, k as enqueueFocus, A as ARROW_UP, l as ARROW_DOWN, m as ARROW_LEFT, n as ARROW_RIGHT, o as isListIndexDisabled, q as isElementVisible, r as useDirection, D as DISABLED_TRANSITIONS_STYLE, p as popupStateMapping, s as useScrollLock } from './useScrollLock-es.js';
5
- import { a as useRefWithInit, b as EMPTY_ARRAY, E as EMPTY_OBJECT, u as useRenderElement } from './useRenderElement-es.js';
2
+ import { aa as useId, ab as useFloatingParentNodeId, ac as FloatingRootStore, ad as PopupTriggerMap, a as useIsoLayoutEffect, ae as useFloatingTree, Z as getFloatingFocusElement, af as isTypeableCombobox, q as useValueAsRef, b as useStableCallback, a5 as useAnimationFrame, ag as isIndexOutOfListBounds, ah as getMinListIndex, ai as getMaxListIndex, D as activeElement, o as ownerDocument, _ as contains, L as stopEvent, d as createChangeEventDetails, aj as listNavigation, ak as findNonDisabledListIndex, g as getTarget, W as focusOut, al as enqueueFocus, a8 as isVirtualClick, am as isVirtualPointerEvent, an as ARROW_UP, ao as ARROW_DOWN, ap as ARROW_LEFT, aq as ARROW_RIGHT, k as useTimeout, ar as isListIndexDisabled, as as isElementVisible, u as useBaseUiId, at as jsdom, a4 as useDirection, au as DISABLED_TRANSITIONS_STYLE, p as popupStateMapping, av as useScrollLock } from './useScrollLock-es.js';
3
+ import { b as isElement, i as isHTMLElement, K as getWindow, p as evaluate, q as getPaddingObject, m as getAlignmentAxis, o as getAlignment, z as getAxisLength, w as clamp, n as getSide, l as getSideAxis } from './floating-ui.utils-es.js';
4
+ import { a as useRefWithInit, c as EMPTY_ARRAY, N as NOOP, E as EMPTY_OBJECT, f as formatErrorMessage, u as useRenderElement } from './useRenderElement-es.js';
6
5
  import { jsx } from 'react/jsx-runtime';
7
- import { e as evaluate, d as getPaddingObject, a as getAlignmentAxis, c as getAlignment, o as getAxisLength, l as clamp, b as getSide, g as getSideAxis } from './floating-ui.utils-es.js';
8
6
  import { u as useFloating$1, h as hide$1, f as flip, d as size, b as autoUpdate, o as offset, s as shift, l as limitShift } from './floating-ui.react-dom-es.js';
9
7
 
10
8
  function useFloatingRootContext(options) {
@@ -894,6 +892,402 @@ function useTypeahead(context, props) {
894
892
  } : {}, [enabled, sharedProps]);
895
893
  }
896
894
 
895
+ const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
896
+ function compareItemEquality(itemValue, selectedValue, comparer) {
897
+ if (itemValue == null || selectedValue == null) {
898
+ return Object.is(itemValue, selectedValue);
899
+ }
900
+ return comparer(itemValue, selectedValue);
901
+ }
902
+ function selectedValueIncludes(selectedValues, itemValue, comparer) {
903
+ if (!selectedValues || selectedValues.length === 0) {
904
+ return false;
905
+ }
906
+ return selectedValues.some(selectedValue => {
907
+ if (selectedValue === undefined) {
908
+ return false;
909
+ }
910
+ return compareItemEquality(itemValue, selectedValue, comparer);
911
+ });
912
+ }
913
+ function findItemIndex(itemValues, selectedValue, comparer) {
914
+ if (!itemValues || itemValues.length === 0) {
915
+ return -1;
916
+ }
917
+ return itemValues.findIndex(itemValue => {
918
+ if (itemValue === undefined) {
919
+ return false;
920
+ }
921
+ return compareItemEquality(itemValue, selectedValue, comparer);
922
+ });
923
+ }
924
+ function removeItem(selectedValues, itemValue, comparer) {
925
+ return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));
926
+ }
927
+
928
+ function serializeValue(value) {
929
+ if (value == null) {
930
+ return '';
931
+ }
932
+ if (typeof value === 'string') {
933
+ return value;
934
+ }
935
+ try {
936
+ return JSON.stringify(value);
937
+ } catch {
938
+ return String(value);
939
+ }
940
+ }
941
+
942
+ function isGroupedItems(items) {
943
+ return items != null && items.length > 0 && typeof items[0] === 'object' && items[0] != null && 'items' in items[0];
944
+ }
945
+
946
+ /**
947
+ * Checks if the items array contains an item with a null value that has a non-null label.
948
+ */
949
+ function hasNullItemLabel(items) {
950
+ if (!Array.isArray(items)) {
951
+ return items != null && 'null' in items;
952
+ }
953
+ const arrayItems = items;
954
+ if (isGroupedItems(arrayItems)) {
955
+ for (const group of arrayItems) {
956
+ for (const item of group.items) {
957
+ if (item && item.value == null && item.label != null) {
958
+ return true;
959
+ }
960
+ }
961
+ }
962
+ return false;
963
+ }
964
+ for (const item of arrayItems) {
965
+ if (item && item.value == null && item.label != null) {
966
+ return true;
967
+ }
968
+ }
969
+ return false;
970
+ }
971
+ function stringifyAsLabel(item, itemToStringLabel) {
972
+ if (itemToStringLabel && item != null) {
973
+ return itemToStringLabel(item) ?? '';
974
+ }
975
+ if (item && typeof item === 'object') {
976
+ if ('label' in item && item.label != null) {
977
+ return String(item.label);
978
+ }
979
+ if ('value' in item) {
980
+ return String(item.value);
981
+ }
982
+ }
983
+ return serializeValue(item);
984
+ }
985
+ function stringifyAsValue(item, itemToStringValue) {
986
+ if (itemToStringValue && item != null) {
987
+ return itemToStringValue(item) ?? '';
988
+ }
989
+ if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
990
+ return serializeValue(item.value);
991
+ }
992
+ return serializeValue(item);
993
+ }
994
+ function resolveSelectedLabel(value, items, itemToStringLabel) {
995
+ function fallback() {
996
+ return stringifyAsLabel(value, itemToStringLabel);
997
+ }
998
+ if (itemToStringLabel && value != null) {
999
+ return itemToStringLabel(value);
1000
+ }
1001
+
1002
+ // Custom object with explicit label takes precedence
1003
+ if (value && typeof value === 'object' && 'label' in value && value.label != null) {
1004
+ return value.label;
1005
+ }
1006
+
1007
+ // Items provided as plain record map
1008
+ if (items && !Array.isArray(items)) {
1009
+ return items[value] ?? fallback();
1010
+ }
1011
+
1012
+ // Items provided as array (flat or grouped)
1013
+ if (Array.isArray(items)) {
1014
+ const arrayItems = items;
1015
+ const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap(group => group.items) : arrayItems;
1016
+ if (value == null || typeof value !== 'object') {
1017
+ const match = flatItems.find(item => item.value === value);
1018
+ if (match && match.label != null) {
1019
+ return match.label;
1020
+ }
1021
+ return fallback();
1022
+ }
1023
+
1024
+ // Object without explicit label: try matching by its `value` property
1025
+ if ('value' in value) {
1026
+ const match = flatItems.find(item => item && item.value === value.value);
1027
+ if (match && match.label != null) {
1028
+ return match.label;
1029
+ }
1030
+ }
1031
+ }
1032
+ return fallback();
1033
+ }
1034
+ function resolveMultipleLabels(values, items, itemToStringLabel) {
1035
+ return values.reduce((acc, value, index) => {
1036
+ if (index > 0) {
1037
+ acc.push(', ');
1038
+ }
1039
+ acc.push(/*#__PURE__*/jsx(React.Fragment, {
1040
+ children: resolveSelectedLabel(value, items, itemToStringLabel)
1041
+ }, index));
1042
+ return acc;
1043
+ }, []);
1044
+ }
1045
+
1046
+ let FieldControlDataAttributes = /*#__PURE__*/function (FieldControlDataAttributes) {
1047
+ /**
1048
+ * Present when the field is disabled.
1049
+ */
1050
+ FieldControlDataAttributes["disabled"] = "data-disabled";
1051
+ /**
1052
+ * Present when the field is in a valid state.
1053
+ */
1054
+ FieldControlDataAttributes["valid"] = "data-valid";
1055
+ /**
1056
+ * Present when the field is in an invalid state.
1057
+ */
1058
+ FieldControlDataAttributes["invalid"] = "data-invalid";
1059
+ /**
1060
+ * Present when the field has been touched.
1061
+ */
1062
+ FieldControlDataAttributes["touched"] = "data-touched";
1063
+ /**
1064
+ * Present when the field's value has changed.
1065
+ */
1066
+ FieldControlDataAttributes["dirty"] = "data-dirty";
1067
+ /**
1068
+ * Present when the field is filled.
1069
+ */
1070
+ FieldControlDataAttributes["filled"] = "data-filled";
1071
+ /**
1072
+ * Present when the field control is focused.
1073
+ */
1074
+ FieldControlDataAttributes["focused"] = "data-focused";
1075
+ return FieldControlDataAttributes;
1076
+ }({});
1077
+
1078
+ const DEFAULT_VALIDITY_STATE = {
1079
+ badInput: false,
1080
+ customError: false,
1081
+ patternMismatch: false,
1082
+ rangeOverflow: false,
1083
+ rangeUnderflow: false,
1084
+ stepMismatch: false,
1085
+ tooLong: false,
1086
+ tooShort: false,
1087
+ typeMismatch: false,
1088
+ valid: null,
1089
+ valueMissing: false
1090
+ };
1091
+ const DEFAULT_FIELD_STATE_ATTRIBUTES = {
1092
+ valid: null,
1093
+ touched: false,
1094
+ dirty: false,
1095
+ filled: false,
1096
+ focused: false
1097
+ };
1098
+ const DEFAULT_FIELD_ROOT_STATE = {
1099
+ disabled: false,
1100
+ ...DEFAULT_FIELD_STATE_ATTRIBUTES
1101
+ };
1102
+ const fieldValidityMapping = {
1103
+ valid(value) {
1104
+ if (value === null) {
1105
+ return null;
1106
+ }
1107
+ if (value) {
1108
+ return {
1109
+ [FieldControlDataAttributes.valid]: ''
1110
+ };
1111
+ }
1112
+ return {
1113
+ [FieldControlDataAttributes.invalid]: ''
1114
+ };
1115
+ }
1116
+ };
1117
+
1118
+ const DEFAULT_FIELD_ROOT_CONTEXT = {
1119
+ invalid: undefined,
1120
+ name: undefined,
1121
+ validityData: {
1122
+ state: DEFAULT_VALIDITY_STATE,
1123
+ errors: [],
1124
+ error: '',
1125
+ value: '',
1126
+ initialValue: null
1127
+ },
1128
+ setValidityData: NOOP,
1129
+ disabled: undefined,
1130
+ touched: DEFAULT_FIELD_STATE_ATTRIBUTES.touched,
1131
+ setTouched: NOOP,
1132
+ dirty: DEFAULT_FIELD_STATE_ATTRIBUTES.dirty,
1133
+ setDirty: NOOP,
1134
+ filled: DEFAULT_FIELD_STATE_ATTRIBUTES.filled,
1135
+ setFilled: NOOP,
1136
+ focused: DEFAULT_FIELD_STATE_ATTRIBUTES.focused,
1137
+ setFocused: NOOP,
1138
+ validate: () => null,
1139
+ validationMode: 'onSubmit',
1140
+ validationDebounceTime: 0,
1141
+ shouldValidateOnChange: () => false,
1142
+ state: DEFAULT_FIELD_ROOT_STATE,
1143
+ markedDirtyRef: {
1144
+ current: false
1145
+ },
1146
+ registerFieldControl: NOOP,
1147
+ validation: {
1148
+ getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
1149
+ inputRef: {
1150
+ current: null
1151
+ },
1152
+ registerInput: NOOP,
1153
+ commit: async () => {},
1154
+ change: NOOP
1155
+ }
1156
+ };
1157
+ const FieldRootContext = /*#__PURE__*/React.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
1158
+ if (process.env.NODE_ENV !== "production") FieldRootContext.displayName = "FieldRootContext";
1159
+ function useFieldRootContext(optional = true) {
1160
+ const context = React.useContext(FieldRootContext);
1161
+ if (context.setValidityData === NOOP && !optional) {
1162
+ throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.' : formatErrorMessage(28));
1163
+ }
1164
+ return context;
1165
+ }
1166
+
1167
+ function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
1168
+ const {
1169
+ registerFieldControl
1170
+ } = useFieldRootContext();
1171
+ const sourceRef = React.useRef(null);
1172
+ if (!sourceRef.current) {
1173
+ sourceRef.current = Symbol();
1174
+ }
1175
+ useIsoLayoutEffect(() => {
1176
+ const source = sourceRef.current;
1177
+ if (!source || !enabled) {
1178
+ return undefined;
1179
+ }
1180
+ const registration = {
1181
+ controlRef,
1182
+ getValue: getFormValueOverride,
1183
+ id,
1184
+ name,
1185
+ value
1186
+ };
1187
+ registerFieldControl(source, registration);
1188
+ return () => {
1189
+ registerFieldControl(source, undefined);
1190
+ };
1191
+ }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, value]);
1192
+ }
1193
+
1194
+ const FormContext = /*#__PURE__*/React.createContext({
1195
+ formRef: {
1196
+ current: {
1197
+ fields: new Map()
1198
+ }
1199
+ },
1200
+ errors: {},
1201
+ clearErrors: NOOP,
1202
+ validationMode: 'onSubmit',
1203
+ submitAttemptedRef: {
1204
+ current: false
1205
+ }
1206
+ });
1207
+ if (process.env.NODE_ENV !== "production") FormContext.displayName = "FormContext";
1208
+ function useFormContext() {
1209
+ return React.useContext(FormContext);
1210
+ }
1211
+
1212
+ /**
1213
+ * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
1214
+ * with an accessible name (label) and description.
1215
+ */
1216
+ const LabelableContext = /*#__PURE__*/React.createContext({
1217
+ controlId: undefined,
1218
+ registerControlId: NOOP,
1219
+ labelId: undefined,
1220
+ setLabelId: NOOP,
1221
+ messageIds: [],
1222
+ setMessageIds: NOOP,
1223
+ getDescriptionProps: externalProps => externalProps
1224
+ });
1225
+ if (process.env.NODE_ENV !== "production") LabelableContext.displayName = "LabelableContext";
1226
+ function useLabelableContext() {
1227
+ return React.useContext(LabelableContext);
1228
+ }
1229
+
1230
+ function useLabelableId(params = {}) {
1231
+ const {
1232
+ id,
1233
+ implicit = false,
1234
+ controlRef
1235
+ } = params;
1236
+ const {
1237
+ controlId,
1238
+ registerControlId
1239
+ } = useLabelableContext();
1240
+ const defaultId = useBaseUiId(id);
1241
+ const controlIdForEffect = implicit ? controlId : undefined;
1242
+ const controlSourceRef = useRefWithInit(() => Symbol('labelable-control'));
1243
+ const hasRegisteredRef = React.useRef(false);
1244
+ const hadExplicitIdRef = React.useRef(id != null);
1245
+ const unregisterControlId = useStableCallback(() => {
1246
+ if (!hasRegisteredRef.current || registerControlId === NOOP) {
1247
+ return;
1248
+ }
1249
+ hasRegisteredRef.current = false;
1250
+ registerControlId(controlSourceRef.current, undefined);
1251
+ });
1252
+ useIsoLayoutEffect(() => {
1253
+ if (registerControlId === NOOP) {
1254
+ return undefined;
1255
+ }
1256
+ let nextId;
1257
+ if (implicit) {
1258
+ const elem = controlRef?.current;
1259
+ if (isElement(elem) && elem.closest('label') != null) {
1260
+ nextId = id ?? null;
1261
+ } else {
1262
+ nextId = controlIdForEffect ?? defaultId;
1263
+ }
1264
+ } else if (id != null) {
1265
+ hadExplicitIdRef.current = true;
1266
+ nextId = id;
1267
+ } else if (hadExplicitIdRef.current) {
1268
+ nextId = defaultId;
1269
+ } else {
1270
+ unregisterControlId();
1271
+ return undefined;
1272
+ }
1273
+ if (nextId === undefined) {
1274
+ unregisterControlId();
1275
+ return undefined;
1276
+ }
1277
+ hasRegisteredRef.current = true;
1278
+ registerControlId(controlSourceRef.current, nextId);
1279
+ return undefined;
1280
+ }, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);
1281
+ React.useEffect(() => {
1282
+ return unregisterControlId;
1283
+ }, [unregisterControlId]);
1284
+ return controlId ?? defaultId;
1285
+ }
1286
+
1287
+ function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
1288
+ return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
1289
+ }
1290
+
897
1291
  function getPseudoElementBounds(element) {
898
1292
  const elementRect = element.getBoundingClientRect();
899
1293
  const win = getWindow(element);
@@ -930,6 +1324,13 @@ function getPseudoElementBounds(element) {
930
1324
  };
931
1325
  }
932
1326
 
1327
+ function getDefaultLabelId(id) {
1328
+ return id == null ? undefined : `${id}-label`;
1329
+ }
1330
+ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
1331
+ return fieldLabelId ?? localLabelId;
1332
+ }
1333
+
933
1334
  const CompositeListContext = /*#__PURE__*/React.createContext({
934
1335
  register: () => {},
935
1336
  unregister: () => {},
@@ -1806,4 +2207,4 @@ function useCompositeListItem(params = {}) {
1806
2207
  };
1807
2208
  }
1808
2209
 
1809
- export { CompositeList as C, IndexGuessBehavior as I, useListNavigation as a, useTypeahead as b, useAnchoredPopupScrollLock as c, useAnchorPositioning as d, usePositioner as e, getDisabledMountTransitionStyles as f, getPseudoElementBounds as g, useCompositeListItem as h, adaptiveOrigin as i, useFloatingRootContext as u };
2210
+ export { removeItem as A, adaptiveOrigin as B, CompositeList as C, DEFAULT_VALIDITY_STATE as D, isGroupedItems as E, FieldRootContext as F, DEFAULT_FIELD_ROOT_CONTEXT as G, DEFAULT_FIELD_STATE_ATTRIBUTES as H, IndexGuessBehavior as I, getDefaultLabelId as J, LabelableContext as L, useFormContext as a, useFieldRootContext as b, useLabelableId as c, useRegisterFieldControl as d, compareItemEquality as e, fieldValidityMapping as f, findItemIndex as g, hasNullItemLabel as h, useFloatingRootContext as i, useListNavigation as j, useTypeahead as k, defaultItemEquality as l, stringifyAsLabel as m, areArraysEqual as n, getPseudoElementBounds as o, resolveMultipleLabels as p, resolveSelectedLabel as q, resolveAriaLabelledBy as r, stringifyAsValue as s, useAnchoredPopupScrollLock as t, useLabelableContext as u, useAnchorPositioning as v, usePositioner as w, selectedValueIncludes as x, getDisabledMountTransitionStyles as y, useCompositeListItem as z };
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
4
- var useButton = require('./useButton-cjs.js');
5
- var useLabelableId = require('./useLabelableId-cjs.js');
3
+ var floatingUi_utils = require('./floating-ui.utils-cjs.js');
4
+ var useScrollLock = require('./useScrollLock-cjs.js');
5
+ var useCompositeListItem = require('./useCompositeListItem-cjs.js');
6
6
 
7
7
  function useRegisteredLabelId(idProp, setLabelId) {
8
- const id = useButton.useBaseUiId(idProp);
9
- useButton.useIsoLayoutEffect(() => {
8
+ const id = useScrollLock.useBaseUiId(idProp);
9
+ useScrollLock.useIsoLayoutEffect(() => {
10
10
  setLabelId(id);
11
11
  return () => {
12
12
  setLabelId(undefined);
@@ -26,8 +26,8 @@ function useLabel(params = {}) {
26
26
  const {
27
27
  controlId: contextControlId,
28
28
  setLabelId: setContextLabelId
29
- } = useLabelableId.useLabelableContext();
30
- const syncLabelId = useButton.useStableCallback(nextLabelId => {
29
+ } = useCompositeListItem.useLabelableContext();
30
+ const syncLabelId = useScrollLock.useStableCallback(nextLabelId => {
31
31
  setContextLabelId(nextLabelId);
32
32
  setLabelIdProp?.(nextLabelId);
33
33
  });
@@ -41,13 +41,13 @@ function useLabel(params = {}) {
41
41
  if (!resolvedControlId) {
42
42
  return;
43
43
  }
44
- const controlElement = useButton.ownerDocument(event.currentTarget).getElementById(resolvedControlId);
45
- if (floatingUi_utils_dom.isHTMLElement(controlElement)) {
44
+ const controlElement = useScrollLock.ownerDocument(event.currentTarget).getElementById(resolvedControlId);
45
+ if (floatingUi_utils.isHTMLElement(controlElement)) {
46
46
  focusElementWithVisible(controlElement);
47
47
  }
48
48
  }
49
49
  function handleInteraction(event) {
50
- const target = useButton.getTarget(event.nativeEvent);
50
+ const target = useScrollLock.getTarget(event.nativeEvent);
51
51
  if (target?.closest('button,input,select,textarea')) {
52
52
  return;
53
53
  }
@@ -1,6 +1,6 @@
1
- import { i as isHTMLElement } from './floating-ui.utils.dom-es.js';
2
- import { u as useBaseUiId, a as useIsoLayoutEffect, b as useStableCallback, g as getTarget, o as ownerDocument } from './useButton-es.js';
3
- import { u as useLabelableContext } from './useLabelableId-es.js';
1
+ import { i as isHTMLElement } from './floating-ui.utils-es.js';
2
+ import { u as useBaseUiId, a as useIsoLayoutEffect, b as useStableCallback, g as getTarget, o as ownerDocument } from './useScrollLock-es.js';
3
+ import { u as useLabelableContext } from './useCompositeListItem-es.js';
4
4
 
5
5
  function useRegisteredLabelId(idProp, setLabelId) {
6
6
  const id = useBaseUiId(idProp);
@@ -623,4 +623,4 @@ function renderTag(Tag, props) {
623
623
  return /*#__PURE__*/React.createElement(Tag, props);
624
624
  }
625
625
 
626
- export { EMPTY_OBJECT as E, NOOP as N, useRefWithInit as a, EMPTY_ARRAY as b, useMergedRefs as c, makeEventPreventable as d, formatErrorMessage as f, isReactVersionAtLeast as i, mergeProps as m, useRenderElement as u, warn as w };
626
+ export { EMPTY_OBJECT as E, NOOP as N, useRefWithInit as a, useMergedRefs as b, EMPTY_ARRAY as c, makeEventPreventable as d, formatErrorMessage as f, isReactVersionAtLeast as i, mergeProps as m, useRenderElement as u, warn as w };