@jobber/components 8.22.0 → 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 (72) hide show
  1. package/dist/CSPContext-cjs.js +69 -0
  2. package/dist/CSPContext-es.js +46 -0
  3. package/dist/Card/index.cjs +2 -0
  4. package/dist/Card/index.mjs +2 -0
  5. package/dist/ComboboxChipRemove-cjs.js +54 -211
  6. package/dist/ComboboxChipRemove-es.js +8 -164
  7. package/dist/DataDump/index.cjs +2 -0
  8. package/dist/DataDump/index.mjs +2 -0
  9. package/dist/Dialog/index.cjs +1 -0
  10. package/dist/Dialog/index.mjs +1 -0
  11. package/dist/DrawerDescription-cjs.js +2 -1
  12. package/dist/DrawerDescription-es.js +3 -2
  13. package/dist/DrawerTitle-es.js +1 -1
  14. package/dist/InputNumberExperimental-cjs.js +24 -23
  15. package/dist/InputNumberExperimental-es.js +3 -2
  16. package/dist/InternalBackdrop-es.js +3 -3
  17. package/dist/Menu/index.cjs +2 -0
  18. package/dist/Menu/index.mjs +2 -0
  19. package/dist/Menu-cjs.js +1 -1
  20. package/dist/Menu-es.js +1 -1
  21. package/dist/MenuSubmenuTrigger-cjs.js +5 -13
  22. package/dist/MenuSubmenuTrigger-es.js +8 -16
  23. package/dist/NumberFieldInput-cjs.js +9 -9
  24. package/dist/NumberFieldInput-es.js +3 -3
  25. package/dist/Page/index.cjs +2 -0
  26. package/dist/Page/index.mjs +2 -0
  27. package/dist/ScrollAreaViewport-cjs.js +5 -47
  28. package/dist/ScrollAreaViewport-es.js +5 -46
  29. package/dist/SelectGroupLabel-cjs.js +1924 -0
  30. package/dist/SelectGroupLabel-es.js +1888 -0
  31. package/dist/SelectPrimitive-cjs.js +112 -0
  32. package/dist/SelectPrimitive-es.js +110 -0
  33. package/dist/ToolbarRootContext-cjs.js +35 -0
  34. package/dist/ToolbarRootContext-es.js +14 -0
  35. package/dist/docs/SelectPrimitive/SelectPrimitive.md +326 -0
  36. package/dist/docs/index.md +1 -0
  37. package/dist/floating-ui.react-dom-cjs.js +1 -0
  38. package/dist/floating-ui.react-dom-es.js +2 -2
  39. package/dist/floating-ui.utils.dom-es.js +1 -1
  40. package/dist/index.cjs +2 -0
  41. package/dist/index.mjs +2 -0
  42. package/dist/primitives/BottomSheet/index.cjs +1 -0
  43. package/dist/primitives/BottomSheet/index.mjs +1 -0
  44. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -1
  45. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -1
  46. package/dist/primitives/InputNumberExperimental/index.cjs +2 -1
  47. package/dist/primitives/InputNumberExperimental/index.mjs +2 -1
  48. package/dist/primitives/SelectPrimitive/SelectPrimitive.d.ts +63 -0
  49. package/dist/primitives/SelectPrimitive/index.cjs +29 -0
  50. package/dist/primitives/SelectPrimitive/index.d.ts +2 -0
  51. package/dist/primitives/SelectPrimitive/index.mjs +23 -0
  52. package/dist/primitives/SelectPrimitive/types.d.ts +16 -0
  53. package/dist/primitives/index.cjs +8 -1
  54. package/dist/primitives/index.d.ts +1 -0
  55. package/dist/primitives/index.mjs +7 -1
  56. package/dist/primitives/mergeClassName.d.ts +12 -0
  57. package/dist/resolveAriaLabelledBy-cjs.js +195 -0
  58. package/dist/resolveAriaLabelledBy-es.js +162 -0
  59. package/dist/styles.css +325 -0
  60. package/dist/unstyledPrimitives/index.cjs +416 -24
  61. package/dist/unstyledPrimitives/index.d.ts +1 -0
  62. package/dist/unstyledPrimitives/index.mjs +417 -26
  63. package/dist/useButton-cjs.js +2 -0
  64. package/dist/useButton-es.js +3 -2
  65. package/dist/useCompositeListItem-es.js +3 -3
  66. package/dist/useLabel-cjs.js +3 -329
  67. package/dist/useLabel-es.js +4 -299
  68. package/dist/useLabelableId-cjs.js +332 -0
  69. package/dist/useLabelableId-es.js +300 -0
  70. package/dist/useRenderElement-cjs.js +3 -0
  71. package/dist/useRenderElement-es.js +4 -1
  72. package/package.json +2 -2
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
- import { E as useControlled, e as useStableCallback, n as useValueAsRef, h as useTransitionStatus, j as useIsoLayoutEffect, N as createGenericEventDetails, K as inputClear, J as inputChange, c as createChangeEventDetails, y as focusOut, a4 as outsidePress, k as getTarget, a3 as itemPress, d as useOpenChangeComplete, Q as useValueChanged, G as none, ar as inputPress, H as visuallyHiddenInput, I as visuallyHidden, r as contains, f as useTimeout, u as useButton, o as ownerDocument, s as stopEvent, v as listNavigation, a as closePress, b as useBaseUiId, ag as isAndroid, ad as isFirefox, a0 as escapeKey, as as clearPress, t as transitionStatusMapping, S as SafeReact, g as error, at as chipRemovePress } from './useButton-es.js';
3
- import { f as formatErrorMessage, d as EMPTY_ARRAY, a as useRefWithInit, N as NOOP, E as EMPTY_OBJECT, b as useMergedRefs, u as useRenderElement } from './useRenderElement-es.js';
4
- import { a as useFormContext, b as useFieldRootContext, d as useLabelableId, e as useField, f as fieldValidityMapping, u as useLabelableContext, h as DEFAULT_FIELD_STATE_ATTRIBUTES, c as useLabel } from './useLabel-es.js';
5
- import { f as useFloatingRootContext, c as useListNavigation, d as useTypeahead, e as getPseudoElementBounds, C as CompositeList, a as useAnchorPositioning, g as getDisabledMountTransitionStyles, u as useCompositeListItem, I as IndexGuessBehavior } from './useCompositeListItem-es.js';
6
- import { x as createSelector, _ as Store, $ as useStore, E as useOpenInteractionType, M as useClick, H as useDismiss, J as useInteractions, A as useOnFirstRender, U as pressableTriggerOpenStateMapping, n as useDirection, X as triggerOpenStateMapping, r as FloatingPortal, p as popupStateMapping, G as useScrollLock, I as InternalBackdrop, t as inertValue, w as DROPDOWN_COLLISION_AVOIDANCE, F as FloatingFocusManager } from './InternalBackdrop-es.js';
2
+ import { E as useControlled, b as useStableCallback, n as useValueAsRef, k as useTransitionStatus, a as useIsoLayoutEffect, N as createGenericEventDetails, K as inputClear, J as inputChange, d as createChangeEventDetails, y as focusOut, U as outsidePress, g as getTarget, Z as itemPress, f as useOpenChangeComplete, Q as useValueChanged, G as none, ae as inputPress, r as contains, H as visuallyHiddenInput, I as visuallyHidden, h as useTimeout, c as useButton, o as ownerDocument, s as stopEvent, v as listNavigation, e as closePress, u as useBaseUiId, _ as isAndroid, af as isFirefox, a8 as escapeKey, ag as clearPress, t as transitionStatusMapping, S as SafeReact, j as error, ah as chipRemovePress } from './useButton-es.js';
3
+ import { f as formatErrorMessage, c as EMPTY_ARRAY, a as useRefWithInit, N as NOOP, E as EMPTY_OBJECT, b as useMergedRefs, u as useRenderElement } from './useRenderElement-es.js';
4
+ import { a as useFormContext, b as useFieldRootContext, c as useLabelableId, d as useField, f as fieldValidityMapping, u as useLabelableContext, e as DEFAULT_FIELD_STATE_ATTRIBUTES } from './useLabelableId-es.js';
5
+ import { u as useFloatingRootContext, a as useListNavigation, b as useTypeahead, g as getPseudoElementBounds, C as CompositeList, c as useAnchorPositioning, d as getDisabledMountTransitionStyles, e as useCompositeListItem, I as IndexGuessBehavior } from './useCompositeListItem-es.js';
6
+ import { h as hasNullItemLabel, c as compareItemEquality, i as stringifyAsLabel, j as isGroupedItems, s as stringifyAsValue, e as selectedValueIncludes, g as removeItem, f as findItemIndex, d as defaultItemEquality, r as resolveAriaLabelledBy, k as getDefaultLabelId, a as resolveMultipleLabels, b as resolveSelectedLabel } from './resolveAriaLabelledBy-es.js';
7
+ import { o as createSelector, S as Store, r as useStore, q as useOpenInteractionType, s as useClick, t as useDismiss, v as useInteractions, w as useOnFirstRender, x as pressableTriggerOpenStateMapping, n as useDirection, G as triggerOpenStateMapping, y as FloatingPortal, p as popupStateMapping, z as useScrollLock, I as InternalBackdrop, A as inertValue, B as DROPDOWN_COLLISION_AVOIDANCE, F as FloatingFocusManager } from './InternalBackdrop-es.js';
7
8
  import { jsx, jsxs } from 'react/jsx-runtime';
8
9
  import * as ReactDOM from 'react-dom';
10
+ import { u as useLabel } from './useLabel-es.js';
9
11
 
10
12
  const ComboboxRootContext = /*#__PURE__*/React.createContext(undefined);
11
13
  if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
@@ -42,157 +44,6 @@ function useComboboxInputValueContext() {
42
44
  return React.useContext(ComboboxInputValueContext);
43
45
  }
44
46
 
45
- const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
46
- function compareItemEquality(itemValue, selectedValue, comparer) {
47
- if (itemValue == null || selectedValue == null) {
48
- return Object.is(itemValue, selectedValue);
49
- }
50
- return comparer(itemValue, selectedValue);
51
- }
52
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
53
- if (!selectedValues || selectedValues.length === 0) {
54
- return false;
55
- }
56
- return selectedValues.some(selectedValue => {
57
- if (selectedValue === undefined) {
58
- return false;
59
- }
60
- return compareItemEquality(itemValue, selectedValue, comparer);
61
- });
62
- }
63
- function findItemIndex(itemValues, selectedValue, comparer) {
64
- if (!itemValues || itemValues.length === 0) {
65
- return -1;
66
- }
67
- return itemValues.findIndex(itemValue => {
68
- if (itemValue === undefined) {
69
- return false;
70
- }
71
- return compareItemEquality(itemValue, selectedValue, comparer);
72
- });
73
- }
74
- function removeItem(selectedValues, itemValue, comparer) {
75
- return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));
76
- }
77
-
78
- function serializeValue(value) {
79
- if (value == null) {
80
- return '';
81
- }
82
- if (typeof value === 'string') {
83
- return value;
84
- }
85
- try {
86
- return JSON.stringify(value);
87
- } catch {
88
- return String(value);
89
- }
90
- }
91
-
92
- function isGroupedItems(items) {
93
- return items != null && items.length > 0 && typeof items[0] === 'object' && items[0] != null && 'items' in items[0];
94
- }
95
-
96
- /**
97
- * Checks if the items array contains an item with a null value that has a non-null label.
98
- */
99
- function hasNullItemLabel(items) {
100
- if (!Array.isArray(items)) {
101
- return items != null && 'null' in items;
102
- }
103
- const arrayItems = items;
104
- if (isGroupedItems(arrayItems)) {
105
- for (const group of arrayItems) {
106
- for (const item of group.items) {
107
- if (item && item.value == null && item.label != null) {
108
- return true;
109
- }
110
- }
111
- }
112
- return false;
113
- }
114
- for (const item of arrayItems) {
115
- if (item && item.value == null && item.label != null) {
116
- return true;
117
- }
118
- }
119
- return false;
120
- }
121
- function stringifyAsLabel(item, itemToStringLabel) {
122
- if (itemToStringLabel && item != null) {
123
- return itemToStringLabel(item) ?? '';
124
- }
125
- if (item && typeof item === 'object') {
126
- if ('label' in item && item.label != null) {
127
- return String(item.label);
128
- }
129
- if ('value' in item) {
130
- return String(item.value);
131
- }
132
- }
133
- return serializeValue(item);
134
- }
135
- function stringifyAsValue(item, itemToStringValue) {
136
- if (itemToStringValue && item != null) {
137
- return itemToStringValue(item) ?? '';
138
- }
139
- if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
140
- return serializeValue(item.value);
141
- }
142
- return serializeValue(item);
143
- }
144
- function resolveSelectedLabel(value, items, itemToStringLabel) {
145
- function fallback() {
146
- return stringifyAsLabel(value, itemToStringLabel);
147
- }
148
- if (itemToStringLabel && value != null) {
149
- return itemToStringLabel(value);
150
- }
151
-
152
- // Custom object with explicit label takes precedence
153
- if (value && typeof value === 'object' && 'label' in value && value.label != null) {
154
- return value.label;
155
- }
156
-
157
- // Items provided as plain record map
158
- if (items && !Array.isArray(items)) {
159
- return items[value] ?? fallback();
160
- }
161
-
162
- // Items provided as array (flat or grouped)
163
- if (Array.isArray(items)) {
164
- const arrayItems = items;
165
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap(group => group.items) : arrayItems;
166
- if (value == null || typeof value !== 'object') {
167
- const match = flatItems.find(item => item.value === value);
168
- if (match && match.label != null) {
169
- return match.label;
170
- }
171
- return fallback();
172
- }
173
-
174
- // Object without explicit label: try matching by its `value` property
175
- if ('value' in value) {
176
- const match = flatItems.find(item => item && item.value === value.value);
177
- if (match && match.label != null) {
178
- return match.label;
179
- }
180
- }
181
- }
182
- return fallback();
183
- }
184
- function resolveMultipleLabels(values, items, itemToStringLabel) {
185
- return values.reduce((acc, value, index) => {
186
- if (index > 0) {
187
- acc.push(', ');
188
- }
189
- acc.push(/*#__PURE__*/jsx(React.Fragment, {
190
- children: resolveSelectedLabel(value, items, itemToStringLabel)
191
- }, index));
192
- return acc;
193
- }, []);
194
- }
195
-
196
47
  const selectors = {
197
48
  id: createSelector(state => state.id),
198
49
  labelId: createSelector(state => state.labelId),
@@ -1393,13 +1244,6 @@ const triggerStateAttributesMapping = {
1393
1244
  } : null
1394
1245
  };
1395
1246
 
1396
- function getDefaultLabelId(id) {
1397
- return id == null ? undefined : `${id}-label`;
1398
- }
1399
- function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
1400
- return fieldLabelId ?? localLabelId;
1401
- }
1402
-
1403
1247
  const BOUNDARY_OFFSET = 2;
1404
1248
 
1405
1249
  /**
@@ -3363,4 +3207,4 @@ const ComboboxChipRemove = /*#__PURE__*/React.forwardRef(function ComboboxChipRe
3363
3207
  });
3364
3208
  if (process.env.NODE_ENV !== "production") ComboboxChipRemove.displayName = "ComboboxChipRemove";
3365
3209
 
3366
- export { useCoreFilter as A, AriaCombobox as B, ComboboxRoot as C, stringifyAsLabel as D, useComboboxInputValueContext as E, ComboboxLabel as a, ComboboxValue as b, ComboboxInput as c, ComboboxInputGroup as d, ComboboxTrigger as e, ComboboxList as f, ComboboxStatus as g, ComboboxPortal as h, ComboboxBackdrop as i, ComboboxPositioner as j, ComboboxPopup as k, ComboboxArrow as l, ComboboxIcon as m, ComboboxGroup as n, ComboboxGroupLabel as o, ComboboxItem as p, ComboboxItemIndicator as q, ComboboxChips as r, ComboboxChip as s, ComboboxChipRemove as t, ComboboxRow as u, ComboboxCollection as v, ComboboxEmpty as w, ComboboxClear as x, useComboboxFilter as y, useFilteredItems as z };
3210
+ export { useCoreFilter as A, AriaCombobox as B, ComboboxRoot as C, useComboboxInputValueContext as D, ComboboxLabel as a, ComboboxValue as b, ComboboxInput as c, ComboboxInputGroup as d, ComboboxTrigger as e, ComboboxList as f, ComboboxStatus as g, ComboboxPortal as h, ComboboxBackdrop as i, ComboboxPositioner as j, ComboboxPopup as k, ComboboxArrow as l, ComboboxIcon as m, ComboboxGroup as n, ComboboxGroupLabel as o, ComboboxItem as p, ComboboxItemIndicator as q, ComboboxChips as r, ComboboxChip as s, ComboboxChipRemove as t, ComboboxRow as u, ComboboxCollection as v, ComboboxEmpty as w, ComboboxClear as x, useComboboxFilter as y, useFilteredItems as z };
@@ -28,12 +28,14 @@ require('../BottomSheet-cjs.js');
28
28
  require('../ScrollAreaViewport-cjs.js');
29
29
  require('../InternalBackdrop-cjs.js');
30
30
  require('../useButton-cjs.js');
31
+ require('../CSPContext-cjs.js');
31
32
  require('../clamp-cjs.js');
32
33
  require('../OverlaySeparator-cjs.js');
33
34
  require('../Separator-cjs.js');
34
35
  require('../DrawerTitle-cjs.js');
35
36
  require('../MenuSubmenuTrigger-cjs.js');
36
37
  require('../useCompositeListItem-cjs.js');
38
+ require('../ToolbarRootContext-cjs.js');
37
39
  require('../Content-cjs.js');
38
40
  require('../Emphasis-cjs.js');
39
41
 
@@ -26,11 +26,13 @@ import '../BottomSheet-es.js';
26
26
  import '../ScrollAreaViewport-es.js';
27
27
  import '../InternalBackdrop-es.js';
28
28
  import '../useButton-es.js';
29
+ import '../CSPContext-es.js';
29
30
  import '../clamp-es.js';
30
31
  import '../OverlaySeparator-es.js';
31
32
  import '../Separator-es.js';
32
33
  import '../DrawerTitle-es.js';
33
34
  import '../MenuSubmenuTrigger-es.js';
34
35
  import '../useCompositeListItem-es.js';
36
+ import '../ToolbarRootContext-es.js';
35
37
  import '../Content-es.js';
36
38
  import '../Emphasis-es.js';
@@ -19,6 +19,7 @@ require('../floating-ui.utils.dom-cjs.js');
19
19
  require('../useButton-cjs.js');
20
20
  require('react-dom');
21
21
  require('react/jsx-runtime');
22
+ require('../CSPContext-cjs.js');
22
23
  require('../clamp-cjs.js');
23
24
  require('../Heading-cjs.js');
24
25
  require('../BottomSheet-cjs.js');
@@ -17,6 +17,7 @@ import '../floating-ui.utils.dom-es.js';
17
17
  import '../useButton-es.js';
18
18
  import 'react-dom';
19
19
  import 'react/jsx-runtime';
20
+ import '../CSPContext-es.js';
20
21
  import '../clamp-es.js';
21
22
  import '../Heading-es.js';
22
23
  import '../BottomSheet-es.js';
@@ -5,6 +5,7 @@ var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
5
5
  var useRenderElement = require('./useRenderElement-cjs.js');
6
6
  var InternalBackdrop = require('./InternalBackdrop-cjs.js');
7
7
  var useButton = require('./useButton-cjs.js');
8
+ var CSPContext = require('./CSPContext-cjs.js');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
 
10
11
  function _interopNamespaceDefault(e) {
@@ -213,7 +214,7 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
213
214
  tabIndex: -1,
214
215
  hidden: !mounted,
215
216
  onKeyDown(event) {
216
- if (ScrollAreaViewport.COMPOSITE_KEYS.has(event.key)) {
217
+ if (CSPContext.COMPOSITE_KEYS.has(event.key)) {
217
218
  event.stopPropagation();
218
219
  }
219
220
  },
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
- import { u as useDialogRootContext, j as useDialogPortalContext, C as COMPOSITE_KEYS, k as DialogStore } from './ScrollAreaViewport-es.js';
2
+ import { u as useDialogRootContext, j as useDialogPortalContext, k as DialogStore } from './ScrollAreaViewport-es.js';
3
3
  import { u as useRenderElement } from './useRenderElement-es.js';
4
4
  import { p as popupStateMapping, C as CommonPopupDataAttributes, F as FloatingFocusManager } from './InternalBackdrop-es.js';
5
- import { t as transitionStatusMapping, b as useBaseUiId, d as useOpenChangeComplete, c as createChangeEventDetails, i as imperativeAction } from './useButton-es.js';
5
+ import { t as transitionStatusMapping, u as useBaseUiId, f as useOpenChangeComplete, d as createChangeEventDetails, i as imperativeAction } from './useButton-es.js';
6
+ import { C as COMPOSITE_KEYS } from './CSPContext-es.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
 
8
9
  const stateAttributesMapping$2 = {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { u as useDialogRootContext } from './ScrollAreaViewport-es.js';
3
3
  import { u as useRenderElement } from './useRenderElement-es.js';
4
- import { u as useButton, c as createChangeEventDetails, a as closePress, b as useBaseUiId } from './useButton-es.js';
4
+ import { c as useButton, d as createChangeEventDetails, e as closePress, u as useBaseUiId } from './useButton-es.js';
5
5
 
6
6
  /**
7
7
  * A button that closes the dialog.
@@ -8,9 +8,10 @@ var Button = require('./Button-cjs.js');
8
8
  var Icon = require('./Icon-cjs.js');
9
9
  var useRenderElement = require('./useRenderElement-cjs.js');
10
10
  var useButton = require('./useButton-cjs.js');
11
- var useLabel = require('./useLabel-cjs.js');
11
+ var useLabelableId = require('./useLabelableId-cjs.js');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
13
  var NumberFieldInput = require('./NumberFieldInput-cjs.js');
14
+ var useLabel = require('./useLabel-cjs.js');
14
15
 
15
16
  function _interopNamespaceDefault(e) {
16
17
  var n = Object.create(null);
@@ -54,7 +55,7 @@ const LabelableProvider = function LabelableProvider(props) {
54
55
  const registrationsRef = useRenderElement.useRefWithInit(() => new Map());
55
56
  const {
56
57
  messageIds: parentMessageIds
57
- } = useLabel.useLabelableContext();
58
+ } = useLabelableId.useLabelableContext();
58
59
  const registerControlId = useButton.useStableCallback((source, nextId) => {
59
60
  const registrations = registrationsRef.current;
60
61
  if (nextId === undefined) {
@@ -96,14 +97,14 @@ const LabelableProvider = function LabelableProvider(props) {
96
97
  setMessageIds,
97
98
  getDescriptionProps
98
99
  }), [controlId, registerControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
99
- return /*#__PURE__*/jsxRuntime.jsx(useLabel.LabelableContext.Provider, {
100
+ return /*#__PURE__*/jsxRuntime.jsx(useLabelableId.LabelableContext.Provider, {
100
101
  value: contextValue,
101
102
  children: props.children
102
103
  });
103
104
  };
104
105
  if (process.env.NODE_ENV !== "production") LabelableProvider.displayName = "LabelableProvider";
105
106
 
106
- const validityKeys = Object.keys(useLabel.DEFAULT_VALIDITY_STATE);
107
+ const validityKeys = Object.keys(useLabelableId.DEFAULT_VALIDITY_STATE);
107
108
  function isOnlyValueMissing(state) {
108
109
  if (!state || state.valid || !state.valueMissing) {
109
110
  return false;
@@ -126,7 +127,7 @@ function useFieldValidation(params) {
126
127
  const {
127
128
  formRef,
128
129
  clearErrors
129
- } = useLabel.useFormContext();
130
+ } = useLabelableId.useFormContext();
130
131
  const {
131
132
  setValidityData,
132
133
  validate,
@@ -141,7 +142,7 @@ function useFieldValidation(params) {
141
142
  const {
142
143
  controlId,
143
144
  getDescriptionProps
144
- } = useLabel.useLabelableContext();
145
+ } = useLabelableId.useLabelableContext();
145
146
  const timeout = useButton.useTimeout();
146
147
  const inputRef = React__namespace.useRef(null);
147
148
  const commit = useButton.useStableCallback(async (value, revalidate = false) => {
@@ -161,7 +162,7 @@ function useFieldValidation(params) {
161
162
  const nextValidityData = {
162
163
  value,
163
164
  state: {
164
- ...useLabel.DEFAULT_VALIDITY_STATE,
165
+ ...useLabelableId.DEFAULT_VALIDITY_STATE,
165
166
  valid: true
166
167
  },
167
168
  error: '',
@@ -174,7 +175,7 @@ function useFieldValidation(params) {
174
175
  if (currentFieldData) {
175
176
  formRef.current.fields.set(controlId, {
176
177
  ...currentFieldData,
177
- ...useLabel.getCombinedFieldValidityData(nextValidityData, false) // invalid = false
178
+ ...useLabelableId.getCombinedFieldValidityData(nextValidityData, false) // invalid = false
178
179
  });
179
180
  }
180
181
  }
@@ -286,7 +287,7 @@ function useFieldValidation(params) {
286
287
  formRef.current.fields.set(controlId, {
287
288
  ...currentFieldData,
288
289
  // Keep Form-level errors part of overall field validity for submit blocking/focus logic.
289
- ...useLabel.getCombinedFieldValidityData(nextValidityData, invalid)
290
+ ...useLabelableId.getCombinedFieldValidityData(nextValidityData, invalid)
290
291
  });
291
292
  }
292
293
  }
@@ -338,7 +339,7 @@ const FieldRootInner = /*#__PURE__*/React__namespace.forwardRef(function FieldRo
338
339
  errors,
339
340
  validationMode: formValidationMode,
340
341
  submitAttemptedRef
341
- } = useLabel.useFormContext();
342
+ } = useLabelableId.useFormContext();
342
343
  const {
343
344
  render,
344
345
  className,
@@ -384,7 +385,7 @@ const FieldRootInner = /*#__PURE__*/React__namespace.forwardRef(function FieldRo
384
385
  const hasFormError = !!name && Object.hasOwn(errors, name) && errors[name] !== undefined;
385
386
  const invalid = invalidProp === true || hasFormError;
386
387
  const [validityData, setValidityData] = React__namespace.useState({
387
- state: useLabel.DEFAULT_VALIDITY_STATE,
388
+ state: useLabelableId.DEFAULT_VALIDITY_STATE,
388
389
  error: '',
389
390
  errors: [],
390
391
  value: null,
@@ -443,9 +444,9 @@ const FieldRootInner = /*#__PURE__*/React__namespace.forwardRef(function FieldRo
443
444
  ref: forwardedRef,
444
445
  state,
445
446
  props: elementProps,
446
- stateAttributesMapping: useLabel.fieldValidityMapping
447
+ stateAttributesMapping: useLabelableId.fieldValidityMapping
447
448
  });
448
- return /*#__PURE__*/jsxRuntime.jsx(useLabel.FieldRootContext.Provider, {
449
+ return /*#__PURE__*/jsxRuntime.jsx(useLabelableId.FieldRootContext.Provider, {
449
450
  value: contextValue,
450
451
  children: element
451
452
  });
@@ -482,10 +483,10 @@ const FieldLabel = /*#__PURE__*/React__namespace.forwardRef(function FieldLabel(
482
483
  nativeLabel = true,
483
484
  ...elementProps
484
485
  } = componentProps;
485
- const fieldRootContext = useLabel.useFieldRootContext(false);
486
+ const fieldRootContext = useLabelableId.useFieldRootContext(false);
486
487
  const {
487
488
  labelId
488
- } = useLabel.useLabelableContext();
489
+ } = useLabelableId.useLabelableContext();
489
490
  const labelRef = React__namespace.useRef(null);
490
491
  const labelProps = useLabel.useLabel({
491
492
  id: labelId ?? idProp,
@@ -515,14 +516,14 @@ const FieldLabel = /*#__PURE__*/React__namespace.forwardRef(function FieldLabel(
515
516
  ref: [forwardedRef, labelRef],
516
517
  state: fieldRootContext.state,
517
518
  props: [labelProps, elementProps],
518
- stateAttributesMapping: useLabel.fieldValidityMapping
519
+ stateAttributesMapping: useLabelableId.fieldValidityMapping
519
520
  });
520
521
  return element;
521
522
  });
522
523
  if (process.env.NODE_ENV !== "production") FieldLabel.displayName = "FieldLabel";
523
524
 
524
525
  const stateAttributesMapping = {
525
- ...useLabel.fieldValidityMapping,
526
+ ...useLabelableId.fieldValidityMapping,
526
527
  ...useButton.transitionStatusMapping
527
528
  };
528
529
 
@@ -545,13 +546,13 @@ const FieldError = /*#__PURE__*/React__namespace.forwardRef(function FieldError(
545
546
  validityData,
546
547
  state: fieldState,
547
548
  name
548
- } = useLabel.useFieldRootContext(false);
549
+ } = useLabelableId.useFieldRootContext(false);
549
550
  const {
550
551
  setMessageIds
551
- } = useLabel.useLabelableContext();
552
+ } = useLabelableId.useLabelableContext();
552
553
  const {
553
554
  errors
554
- } = useLabel.useFormContext();
555
+ } = useLabelableId.useFormContext();
555
556
  const formError = name ? errors[name] : null;
556
557
  let rendered = false;
557
558
  if (formError || match === true) {
@@ -637,10 +638,10 @@ const FieldDescription = /*#__PURE__*/React__namespace.forwardRef(function Field
637
638
  ...elementProps
638
639
  } = componentProps;
639
640
  const id = useButton.useBaseUiId(idProp);
640
- const fieldRootContext = useLabel.useFieldRootContext(false);
641
+ const fieldRootContext = useLabelableId.useFieldRootContext(false);
641
642
  const {
642
643
  setMessageIds
643
- } = useLabel.useLabelableContext();
644
+ } = useLabelableId.useLabelableContext();
644
645
  useButton.useIsoLayoutEffect(() => {
645
646
  if (!id) {
646
647
  return undefined;
@@ -656,7 +657,7 @@ const FieldDescription = /*#__PURE__*/React__namespace.forwardRef(function Field
656
657
  props: [{
657
658
  id
658
659
  }, elementProps],
659
- stateAttributesMapping: useLabel.fieldValidityMapping
660
+ stateAttributesMapping: useLabelableId.fieldValidityMapping
660
661
  });
661
662
  return element;
662
663
  });
@@ -6,10 +6,11 @@ import { A as ActivityIndicator } from './ActivityIndicator-es.js';
6
6
  import { B as Button } from './Button-es.js';
7
7
  import { I as Icon } from './Icon-es.js';
8
8
  import { f as formatErrorMessage, a as useRefWithInit, m as mergeProps, E as EMPTY_OBJECT, u as useRenderElement } from './useRenderElement-es.js';
9
- import { b as useBaseUiId, e as useStableCallback, f as useTimeout, S as SafeReact, g as error, t as transitionStatusMapping, h as useTransitionStatus, j as useIsoLayoutEffect, d as useOpenChangeComplete } from './useButton-es.js';
10
- import { u as useLabelableContext, L as LabelableContext, a as useFormContext, D as DEFAULT_VALIDITY_STATE, g as getCombinedFieldValidityData, f as fieldValidityMapping, F as FieldRootContext, b as useFieldRootContext, c as useLabel } from './useLabel-es.js';
9
+ import { u as useBaseUiId, b as useStableCallback, h as useTimeout, S as SafeReact, j as error, t as transitionStatusMapping, k as useTransitionStatus, a as useIsoLayoutEffect, f as useOpenChangeComplete } from './useButton-es.js';
10
+ import { u as useLabelableContext, L as LabelableContext, a as useFormContext, D as DEFAULT_VALIDITY_STATE, g as getCombinedFieldValidityData, f as fieldValidityMapping, F as FieldRootContext, b as useFieldRootContext } from './useLabelableId-es.js';
11
11
  import { jsx } from 'react/jsx-runtime';
12
12
  import { N as NumberFieldRoot, a as NumberFieldGroup, b as NumberFieldInput, c as NumberFieldIncrement, d as NumberFieldDecrement } from './NumberFieldInput-es.js';
13
+ import { u as useLabel } from './useLabel-es.js';
13
14
 
14
15
  const FieldsetRootContext = /*#__PURE__*/React.createContext({
15
16
  legendId: undefined,
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { f as floor, t as tabbable, i as isTabbable, a as focusable } from './index.esm-es.js';
4
- import { f as getComputedStyle, i as isShadowRoot, g as getNodeName, c as isNode, a as isHTMLElement, k as getWindow, j as isWebKit$1, b as isElement, d as isLastTraversableNode, e as getParentNode, o as isOverflowElement } from './floating-ui.utils.dom-es.js';
4
+ import { f as getComputedStyle, i as isShadowRoot, g as getNodeName, c as isNode, a as isHTMLElement, o as getWindow, j as isWebKit$1, b as isElement, d as isLastTraversableNode, e as getParentNode, m as isOverflowElement } from './floating-ui.utils.dom-es.js';
5
5
  import { f as formatErrorMessage, a as useRefWithInit, i as isReactVersionAtLeast, N as NOOP, u as useRenderElement, E as EMPTY_OBJECT, b as useMergedRefs } from './useRenderElement-es.js';
6
- import { j as useIsoLayoutEffect, e as useStableCallback, C as ARROW_UP, A as ARROW_DOWN, s as stopEvent, w as ARROW_LEFT, x as ARROW_RIGHT, o as ownerDocument, r as contains, q as activeElement, _ as isSafari, I as visuallyHidden, c as createChangeEventDetails, y as focusOut, l as useId, p as isTypeableCombobox, n as useValueAsRef, f as useTimeout, ab as useAnimationFrame, m as getFloatingFocusElement, ai as resolveRef, a2 as triggerHover, a4 as outsidePress, z as isVirtualClick, B as isVirtualPointerEvent, af as isWebKit, V as isTypeableElement, k as getTarget, U as isMouseLikePointerType, aj as isClickLikeEvent, $ as triggerPress, ak as isReactEvent, a0 as escapeKey, T as Timeout, al as isEventTargetWithin, am as isRootElement, an as FOCUSABLE_ATTRIBUTE, ao as ACTIVE_KEY, ap as SELECTED_KEY, F as isIOS, Q as useValueChanged, ac as TransitionStatusDataAttributes, aq as AnimationFrame } from './useButton-es.js';
6
+ import { a as useIsoLayoutEffect, b as useStableCallback, C as ARROW_UP, A as ARROW_DOWN, s as stopEvent, w as ARROW_LEFT, x as ARROW_RIGHT, o as ownerDocument, r as contains, q as activeElement, a6 as isSafari, I as visuallyHidden, d as createChangeEventDetails, y as focusOut, l as useId, p as isTypeableCombobox, n as useValueAsRef, h as useTimeout, W as useAnimationFrame, m as getFloatingFocusElement, ai as resolveRef, aa as triggerHover, U as outsidePress, z as isVirtualClick, B as isVirtualPointerEvent, X as isWebKit, a1 as isTypeableElement, g as getTarget, a0 as isMouseLikePointerType, aj as isClickLikeEvent, a7 as triggerPress, ak as isReactEvent, a8 as escapeKey, T as Timeout, al as isEventTargetWithin, am as isRootElement, an as FOCUSABLE_ATTRIBUTE, ao as ACTIVE_KEY, ap as SELECTED_KEY, F as isIOS, Q as useValueChanged, aq as TransitionStatusDataAttributes, ar as AnimationFrame } from './useButton-es.js';
7
7
  import { jsx, jsxs } from 'react/jsx-runtime';
8
8
  import * as ReactDOM from 'react-dom';
9
9
 
@@ -4201,4 +4201,4 @@ const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop
4201
4201
  });
4202
4202
  if (process.env.NODE_ENV !== "production") InternalBackdrop.displayName = "InternalBackdrop";
4203
4203
 
4204
- export { useStore as $, useOnFirstRender as A, useFloatingNodeId as B, CommonPopupDataAttributes as C, DISABLED_TRANSITIONS_STYLE as D, useOpenInteractionType as E, FloatingFocusManager as F, useScrollLock as G, useDismiss as H, InternalBackdrop as I, useInteractions as J, FloatingTree as K, fastComponentRef as L, useClick as M, getTabbableBeforeElement as N, isOutsideEvent as O, PopupTriggerMap as P, getTabbableAfterElement as Q, ReactStore as R, getNextTabbable as S, TYPEAHEAD_RESET_MS as T, pressableTriggerOpenStateMapping as U, FocusGuard as V, PATIENT_CLICK_THRESHOLD as W, triggerOpenStateMapping as X, BASE_UI_SWIPE_IGNORE_SELECTOR as Y, CLICK_TRIGGER_IDENTIFIER as Z, Store as _, FloatingRootStore as a, useFloatingTree as b, getMaxListIndex as c, createGridCellMap as d, isListIndexDisabled as e, getGridNavigatedIndex as f, getMinListIndex as g, getGridCellIndices as h, isIndexOutOfListBounds as i, getGridCellIndexOfCorner as j, findNonDisabledListIndex as k, enqueueFocus as l, isElementVisible as m, useDirection as n, createAttribute as o, popupStateMapping as p, getNodeChildren as q, FloatingPortal as r, POPUP_COLLISION_AVOIDANCE as s, inertValue as t, useFloatingParentNodeId as u, FloatingNode as v, DROPDOWN_COLLISION_AVOIDANCE as w, createSelector as x, FloatingTreeStore as y, fastComponent as z };
4204
+ export { BASE_UI_SWIPE_IGNORE_SELECTOR as $, inertValue as A, DROPDOWN_COLLISION_AVOIDANCE as B, CommonPopupDataAttributes as C, DISABLED_TRANSITIONS_STYLE as D, CLICK_TRIGGER_IDENTIFIER as E, FloatingFocusManager as F, triggerOpenStateMapping as G, createAttribute as H, InternalBackdrop as I, getNodeChildren as J, POPUP_COLLISION_AVOIDANCE as K, FloatingNode as L, FloatingTreeStore as M, fastComponent as N, useFloatingNodeId as O, PopupTriggerMap as P, FloatingTree as Q, ReactStore as R, Store as S, TYPEAHEAD_RESET_MS as T, fastComponentRef as U, getTabbableBeforeElement as V, isOutsideEvent as W, getTabbableAfterElement as X, getNextTabbable as Y, FocusGuard as Z, PATIENT_CLICK_THRESHOLD as _, FloatingRootStore as a, useFloatingTree as b, getMaxListIndex as c, createGridCellMap as d, isListIndexDisabled as e, getGridNavigatedIndex as f, getMinListIndex as g, getGridCellIndices as h, isIndexOutOfListBounds as i, getGridCellIndexOfCorner as j, findNonDisabledListIndex as k, enqueueFocus as l, isElementVisible as m, useDirection as n, createSelector as o, popupStateMapping as p, useOpenInteractionType as q, useStore as r, useClick as s, useDismiss as t, useFloatingParentNodeId as u, useInteractions as v, useOnFirstRender as w, pressableTriggerOpenStateMapping as x, FloatingPortal as y, useScrollLock as z };
@@ -25,12 +25,14 @@ require('../BottomSheet-cjs.js');
25
25
  require('../ScrollAreaViewport-cjs.js');
26
26
  require('../InternalBackdrop-cjs.js');
27
27
  require('../useButton-cjs.js');
28
+ require('../CSPContext-cjs.js');
28
29
  require('../clamp-cjs.js');
29
30
  require('../OverlaySeparator-cjs.js');
30
31
  require('../Separator-cjs.js');
31
32
  require('../DrawerTitle-cjs.js');
32
33
  require('../MenuSubmenuTrigger-cjs.js');
33
34
  require('../useCompositeListItem-cjs.js');
35
+ require('../ToolbarRootContext-cjs.js');
34
36
 
35
37
 
36
38
 
@@ -23,9 +23,11 @@ import '../BottomSheet-es.js';
23
23
  import '../ScrollAreaViewport-es.js';
24
24
  import '../InternalBackdrop-es.js';
25
25
  import '../useButton-es.js';
26
+ import '../CSPContext-es.js';
26
27
  import '../clamp-es.js';
27
28
  import '../OverlaySeparator-es.js';
28
29
  import '../Separator-es.js';
29
30
  import '../DrawerTitle-es.js';
30
31
  import '../MenuSubmenuTrigger-es.js';
31
32
  import '../useCompositeListItem-es.js';
33
+ import '../ToolbarRootContext-es.js';
package/dist/Menu-cjs.js CHANGED
@@ -14,8 +14,8 @@ var floatingUi_reactDom = require('./floating-ui.react-dom-cjs.js');
14
14
  var useRenderElement = require('./useRenderElement-cjs.js');
15
15
  var buttonRenderAdapter = require('./buttonRenderAdapter-cjs.js');
16
16
  var BottomSheet = require('./BottomSheet-cjs.js');
17
- var OverlaySeparator = require('./OverlaySeparator-cjs.js');
18
17
  var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
18
+ var OverlaySeparator = require('./OverlaySeparator-cjs.js');
19
19
  var DrawerTitle = require('./DrawerTitle-cjs.js');
20
20
  var MenuSubmenuTrigger$1 = require('./MenuSubmenuTrigger-cjs.js');
21
21
 
package/dist/Menu-es.js CHANGED
@@ -12,8 +12,8 @@ import { o as offset, f as flip, d as size, b as autoUpdate } from './floating-u
12
12
  import { m as mergeProps } from './useRenderElement-es.js';
13
13
  import { n as normalizeBaseUiButtonProps, i as isAtlantisButtonRenderTarget, s as stripNativeTypeFromButtonRenderTarget, r as renderAtlantisButtonTarget } from './buttonRenderAdapter-es.js';
14
14
  import { a as BottomSheet } from './BottomSheet-es.js';
15
- import { O as OverlaySeparator } from './OverlaySeparator-es.js';
16
15
  import { D as DrawerTrigger } from './ScrollAreaViewport-es.js';
16
+ import { O as OverlaySeparator } from './OverlaySeparator-es.js';
17
17
  import { D as DrawerTitle, a as DrawerClose } from './DrawerTitle-es.js';
18
18
  import { M as MenuTrigger$1, a as MenuLinkItem, b as MenuItem$1, c as MenuRadioItem$1, d as MenuRadioItemIndicator, e as MenuSubmenuTrigger$1, f as MenuRoot, g as MenuPortal$1, h as MenuBackdrop, i as MenuPositioner, j as MenuPopup, k as MenuRadioGroup$1, l as MenuGroup$1, m as MenuSubmenuRoot, n as MenuGroupLabel$1 } from './MenuSubmenuTrigger-es.js';
19
19
 
@@ -6,8 +6,10 @@ var InternalBackdrop = require('./InternalBackdrop-cjs.js');
6
6
  var useButton = require('./useButton-cjs.js');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
  var useCompositeListItem = require('./useCompositeListItem-cjs.js');
9
- var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
9
+ var ToolbarRootContext = require('./ToolbarRootContext-cjs.js');
10
+ var CSPContext = require('./CSPContext-cjs.js');
10
11
  var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
12
+ var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
11
13
  var ReactDOM = require('react-dom');
12
14
 
13
15
  function _interopNamespaceDefault(e) {
@@ -1350,16 +1352,6 @@ const MenuLinkItem = /*#__PURE__*/React__namespace.forwardRef(function MenuLinkI
1350
1352
  });
1351
1353
  if (process.env.NODE_ENV !== "production") MenuLinkItem.displayName = "MenuLinkItem";
1352
1354
 
1353
- const ToolbarRootContext = /*#__PURE__*/React__namespace.createContext(undefined);
1354
- if (process.env.NODE_ENV !== "production") ToolbarRootContext.displayName = "ToolbarRootContext";
1355
- function useToolbarRootContext(optional) {
1356
- const context = React__namespace.useContext(ToolbarRootContext);
1357
- if (context === undefined && !optional) {
1358
- throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : useRenderElement.formatErrorMessage(69));
1359
- }
1360
- return context;
1361
- }
1362
-
1363
1355
  const stateAttributesMapping = {
1364
1356
  ...InternalBackdrop.popupStateMapping,
1365
1357
  ...useButton.transitionStatusMapping
@@ -1385,7 +1377,7 @@ const MenuPopup = /*#__PURE__*/React__namespace.forwardRef(function MenuPopup(co
1385
1377
  side,
1386
1378
  align
1387
1379
  } = useMenuPositionerContext();
1388
- const insideToolbar = useToolbarRootContext(true) != null;
1380
+ const insideToolbar = ToolbarRootContext.useToolbarRootContext(true) != null;
1389
1381
  const open = store.useState('open');
1390
1382
  const transitionStatus = store.useState('transitionStatus');
1391
1383
  const popupProps = store.useState('popupProps');
@@ -1441,7 +1433,7 @@ const MenuPopup = /*#__PURE__*/React__namespace.forwardRef(function MenuPopup(co
1441
1433
  stateAttributesMapping,
1442
1434
  props: [popupProps, {
1443
1435
  onKeyDown(event) {
1444
- if (insideToolbar && ScrollAreaViewport.COMPOSITE_KEYS.has(event.key)) {
1436
+ if (insideToolbar && CSPContext.COMPOSITE_KEYS.has(event.key)) {
1445
1437
  event.stopPropagation();
1446
1438
  }
1447
1439
  }