@jobber/components 8.14.0 → 8.15.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.
- package/FilterPicker.d.ts +1 -0
- package/{Combobox.js → FilterPicker.js} +3 -3
- package/dist/Autocomplete-es.js +1 -1
- package/dist/BottomSheet-cjs.js +109 -77
- package/dist/BottomSheet-es.js +103 -75
- package/dist/Card/index.cjs +1 -2
- package/dist/Card/index.mjs +1 -2
- package/dist/DataDump/index.cjs +1 -2
- package/dist/DataDump/index.mjs +1 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +11 -11
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +11 -11
- package/dist/DataList/components/DataListFilters/index.cjs +11 -11
- package/dist/DataList/components/DataListFilters/index.mjs +11 -11
- package/dist/DataList/index.cjs +11 -11
- package/dist/DataList/index.mjs +11 -11
- package/dist/DataListSort-cjs.js +5 -5
- package/dist/DataListSort-es.js +5 -5
- package/dist/FilterPicker/FilterPicker.d.ts +11 -0
- package/dist/{Combobox/Combobox.types.d.ts → FilterPicker/FilterPicker.types.d.ts} +51 -51
- package/dist/FilterPicker/FilterPickerProvider.d.ts +18 -0
- package/dist/FilterPicker/components/FilterPickerAction/FilterPickerAction.d.ts +3 -0
- package/dist/FilterPicker/components/FilterPickerAction/index.cjs +12 -0
- package/dist/FilterPicker/components/FilterPickerAction/index.d.ts +1 -0
- package/dist/FilterPicker/components/FilterPickerAction/index.mjs +6 -0
- package/dist/FilterPicker/components/FilterPickerActivator/FilterPickerActivator.d.ts +3 -0
- package/dist/{Combobox/components/ComboboxActivator → FilterPicker/components/FilterPickerActivator}/index.cjs +3 -3
- package/dist/FilterPicker/components/FilterPickerActivator/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxActivator → FilterPicker/components/FilterPickerActivator}/index.mjs +2 -2
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContent.d.ts +3 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentHeader/FilterPickerContentHeader.d.ts +3 -0
- package/dist/{Combobox/components/ComboboxContent/ComboboxContentHeader → FilterPicker/components/FilterPickerContent/FilterPickerContentHeader}/index.cjs +2 -2
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentHeader/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxContent/ComboboxContentHeader → FilterPicker/components/FilterPickerContent/FilterPickerContentHeader}/index.mjs +1 -1
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/FilterPickerContentList.d.ts +3 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/FilterPickerContentList.module.css.d.ts +13 -0
- package/dist/{Combobox/components/ComboboxContent/ComboboxContentList → FilterPicker/components/FilterPickerContent/FilterPickerContentList}/index.cjs +5 -5
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxContent/ComboboxContentList → FilterPicker/components/FilterPickerContent/FilterPickerContentList}/index.mjs +4 -4
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/FilterPickerContentSearch.d.ts +3 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/index.cjs +10 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/index.d.ts +1 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentSearch/index.mjs +4 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerLoadMore/FilterPickerLoadMore.d.ts +6 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerLoadMore/index.cjs +9 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerLoadMore/index.d.ts +1 -0
- package/dist/FilterPicker/components/FilterPickerContent/FilterPickerLoadMore/index.mjs +3 -0
- package/dist/{Combobox/components/ComboboxContent → FilterPicker/components/FilterPickerContent}/index.cjs +8 -8
- package/dist/FilterPicker/components/FilterPickerContent/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxContent → FilterPicker/components/FilterPickerContent}/index.mjs +7 -7
- package/dist/FilterPicker/components/FilterPickerOption/FilterPickerOption.d.ts +3 -0
- package/dist/{Combobox/components/ComboboxOption → FilterPicker/components/FilterPickerOption}/index.cjs +3 -3
- package/dist/FilterPicker/components/FilterPickerOption/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxOption → FilterPicker/components/FilterPickerOption}/index.mjs +2 -2
- package/dist/FilterPicker/components/FilterPickerTrigger/FilterPickerTrigger.d.ts +3 -0
- package/dist/{Combobox/components/ComboboxTrigger → FilterPicker/components/FilterPickerTrigger}/index.cjs +3 -3
- package/dist/FilterPicker/components/FilterPickerTrigger/index.d.ts +1 -0
- package/dist/{Combobox/components/ComboboxTrigger → FilterPicker/components/FilterPickerTrigger}/index.mjs +2 -2
- package/dist/FilterPicker/constants.d.ts +1 -0
- package/dist/FilterPicker/hooks/useFilterPicker.d.ts +17 -0
- package/dist/FilterPicker/hooks/useFilterPickerAccessibility.d.ts +9 -0
- package/dist/FilterPicker/hooks/useFilterPickerActivatorAccessibility.d.ts +2 -0
- package/dist/FilterPicker/hooks/useFilterPickerContent.d.ts +9 -0
- package/dist/FilterPicker/hooks/useFilterPickerValidation.d.ts +12 -0
- package/dist/FilterPicker/hooks/useMakeFilterPickerHandlers.d.ts +8 -0
- package/dist/{Combobox → FilterPicker}/index.cjs +13 -13
- package/dist/FilterPicker/index.d.ts +3 -0
- package/dist/{Combobox → FilterPicker}/index.mjs +11 -11
- package/dist/{Combobox-cjs.js → FilterPicker-cjs.js} +25 -25
- package/dist/{Combobox-es.js → FilterPicker-es.js} +25 -25
- package/dist/{ComboboxAction-cjs.js → FilterPickerAction-cjs.js} +5 -5
- package/dist/{ComboboxAction-es.js → FilterPickerAction-es.js} +5 -5
- package/dist/{ComboboxActivator-cjs.js → FilterPickerActivator-cjs.js} +8 -8
- package/dist/{ComboboxActivator-es.js → FilterPickerActivator-es.js} +9 -9
- package/dist/{ComboboxContent-cjs.js → FilterPickerContent-cjs.js} +19 -19
- package/dist/{ComboboxContent-es.js → FilterPickerContent-es.js} +20 -20
- package/dist/{ComboboxContentHeader-cjs.js → FilterPickerContentHeader-cjs.js} +4 -4
- package/dist/{ComboboxContentHeader-es.js → FilterPickerContentHeader-es.js} +4 -4
- package/dist/{ComboboxContentList-cjs.js → FilterPickerContentList-cjs.js} +7 -7
- package/dist/{ComboboxContentList-es.js → FilterPickerContentList-es.js} +7 -7
- package/dist/{ComboboxContentSearch-cjs.js → FilterPickerContentSearch-cjs.js} +4 -4
- package/dist/{ComboboxContentSearch-es.js → FilterPickerContentSearch-es.js} +4 -4
- package/dist/FilterPickerLoadMore-cjs.js +16 -0
- package/dist/{ComboboxLoadMore-es.js → FilterPickerLoadMore-es.js} +4 -4
- package/dist/{ComboboxOption-cjs.js → FilterPickerOption-cjs.js} +5 -5
- package/dist/{ComboboxOption-es.js → FilterPickerOption-es.js} +5 -5
- package/dist/FilterPickerProvider-cjs.js +13 -0
- package/dist/FilterPickerProvider-es.js +10 -0
- package/dist/{ComboboxTrigger-cjs.js → FilterPickerTrigger-cjs.js} +4 -4
- package/dist/{ComboboxTrigger-es.js → FilterPickerTrigger-es.js} +4 -4
- package/dist/InputNumberExperimental-cjs.js +3 -4
- package/dist/InputNumberExperimental-es.js +2 -3
- package/dist/Menu/index.cjs +1 -2
- package/dist/Menu/index.mjs +1 -2
- package/dist/Menu-cjs.js +11 -56
- package/dist/Menu-es.js +4 -49
- package/dist/MenuSubmenuTrigger-cjs.js +160 -345
- package/dist/MenuSubmenuTrigger-es.js +4 -186
- package/dist/Modal/index.mjs +1 -1
- package/dist/NumberFieldInput-cjs.js +3 -4
- package/dist/NumberFieldInput-es.js +2 -3
- package/dist/Page/index.cjs +1 -2
- package/dist/Page/index.mjs +1 -2
- package/dist/{DrawerRoot-cjs.js → ScrollAreaViewport-cjs.js} +1042 -3
- package/dist/{DrawerRoot-es.js → ScrollAreaViewport-es.js} +1035 -5
- package/dist/constants-cjs.js +2 -2
- package/dist/constants-es.js +2 -2
- package/dist/docs/Autocomplete/Autocomplete.md +1 -1
- package/dist/docs/Chip/Chip.md +4 -4
- package/dist/docs/DataList/DataList.md +16 -15
- package/dist/docs/{Combobox/Combobox.md → FilterPicker/FilterPicker.md} +91 -85
- package/dist/docs/Menu/Menu.md +1 -1
- package/dist/docs/MultiSelect/MultiSelect.md +1 -1
- package/dist/docs/Tabs/Tabs.md +2 -2
- package/dist/docs/index.md +1 -1
- package/dist/docs/usage-guidelines/usage-guidelines.md +5 -5
- package/dist/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +14 -15
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +12 -13
- package/dist/primitives/BottomSheet/BottomSheet.d.ts +15 -16
- package/dist/primitives/BottomSheet/BottomSheet.types.d.ts +27 -0
- package/dist/primitives/BottomSheet/BottomSheet.utils.d.ts +6 -0
- package/dist/primitives/BottomSheet/index.cjs +7 -2
- package/dist/primitives/BottomSheet/index.d.ts +1 -0
- package/dist/primitives/BottomSheet/index.mjs +7 -2
- package/dist/primitives/InputNumberExperimental/index.cjs +1 -2
- package/dist/primitives/InputNumberExperimental/index.mjs +1 -2
- package/dist/primitives/index.cjs +7 -8
- package/dist/primitives/index.mjs +7 -8
- package/dist/styles.css +115 -54
- package/dist/unstyledPrimitives/index.cjs +665 -297
- package/dist/unstyledPrimitives/index.d.ts +1 -0
- package/dist/unstyledPrimitives/index.mjs +375 -8
- package/dist/useRenderElement-es.js +1 -1
- package/dist/useValueChanged-cjs.js +251 -1
- package/dist/useValueChanged-es.js +248 -2
- package/dist/utils/meta/meta.json +5 -5
- package/package.json +6 -6
- package/rollup.config.mjs +2 -2
- package/Combobox.d.ts +0 -1
- package/dist/Combobox/Combobox.d.ts +0 -11
- package/dist/Combobox/ComboboxProvider.d.ts +0 -18
- package/dist/Combobox/components/ComboboxAction/ComboboxAction.d.ts +0 -3
- package/dist/Combobox/components/ComboboxAction/index.cjs +0 -12
- package/dist/Combobox/components/ComboboxAction/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxAction/index.mjs +0 -6
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +0 -3
- package/dist/Combobox/components/ComboboxActivator/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +0 -3
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +0 -3
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +0 -3
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +0 -3
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +0 -10
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +0 -4
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/ComboboxLoadMore.d.ts +0 -6
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +0 -9
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +0 -3
- package/dist/Combobox/components/ComboboxContent/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxOption/ComboboxOption.d.ts +0 -3
- package/dist/Combobox/components/ComboboxOption/index.d.ts +0 -1
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +0 -3
- package/dist/Combobox/components/ComboboxTrigger/index.d.ts +0 -1
- package/dist/Combobox/constants.d.ts +0 -1
- package/dist/Combobox/hooks/useCombobox.d.ts +0 -17
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +0 -9
- package/dist/Combobox/hooks/useComboboxActivatorAccessibility.d.ts +0 -2
- package/dist/Combobox/hooks/useComboboxContent.d.ts +0 -9
- package/dist/Combobox/hooks/useComboboxValidation.d.ts +0 -12
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +0 -8
- package/dist/Combobox/index.d.ts +0 -3
- package/dist/ComboboxLoadMore-cjs.js +0 -16
- package/dist/ComboboxProvider-cjs.js +0 -13
- package/dist/ComboboxProvider-es.js +0 -10
- package/dist/useBaseUiId-cjs.js +0 -275
- package/dist/useBaseUiId-es.js +0 -251
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var ScrollAreaViewport = require('../ScrollAreaViewport-cjs.js');
|
|
4
4
|
var MenuSubmenuTrigger = require('../MenuSubmenuTrigger-cjs.js');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var useRenderElement = require('../useRenderElement-cjs.js');
|
|
7
|
-
var useBaseUiId = require('../useBaseUiId-cjs.js');
|
|
8
7
|
var useValueChanged = require('../useValueChanged-cjs.js');
|
|
9
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
9
|
var floatingUi_utils_dom = require('../floating-ui.utils.dom-cjs.js');
|
|
@@ -49,8 +48,8 @@ const DialogDescription = /*#__PURE__*/React__namespace.forwardRef(function Dial
|
|
|
49
48
|
} = componentProps;
|
|
50
49
|
const {
|
|
51
50
|
store
|
|
52
|
-
} =
|
|
53
|
-
const id =
|
|
51
|
+
} = ScrollAreaViewport.useDialogRootContext();
|
|
52
|
+
const id = useValueChanged.useBaseUiId(idProp);
|
|
54
53
|
store.useSyncedValueWithCleanup('descriptionElementId', id);
|
|
55
54
|
return useRenderElement.useRenderElement('p', componentProps, {
|
|
56
55
|
ref: forwardedRef,
|
|
@@ -95,7 +94,7 @@ const DrawerIndent = /*#__PURE__*/React__namespace.forwardRef(function DrawerInd
|
|
|
95
94
|
className,
|
|
96
95
|
...elementProps
|
|
97
96
|
} = componentProps;
|
|
98
|
-
const providerContext =
|
|
97
|
+
const providerContext = ScrollAreaViewport.useDrawerProviderContext();
|
|
99
98
|
const active = providerContext?.active ?? false;
|
|
100
99
|
const visualStateStore = providerContext?.visualStateStore;
|
|
101
100
|
const indentRef = React__namespace.useRef(null);
|
|
@@ -110,22 +109,22 @@ const DrawerIndent = /*#__PURE__*/React__namespace.forwardRef(function DrawerInd
|
|
|
110
109
|
frontmostHeight
|
|
111
110
|
} = visualStateStore.getSnapshot();
|
|
112
111
|
if (swipeProgress <= 0) {
|
|
113
|
-
element.style.setProperty(
|
|
112
|
+
element.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, '0');
|
|
114
113
|
} else {
|
|
115
|
-
element.style.setProperty(
|
|
114
|
+
element.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, `${swipeProgress}`);
|
|
116
115
|
}
|
|
117
116
|
if (frontmostHeight <= 0) {
|
|
118
|
-
element.style.removeProperty(
|
|
117
|
+
element.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
119
118
|
} else {
|
|
120
|
-
element.style.setProperty(
|
|
119
|
+
element.style.setProperty(ScrollAreaViewport.DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
121
120
|
}
|
|
122
121
|
};
|
|
123
122
|
syncVisualState();
|
|
124
123
|
const unsubscribe = visualStateStore.subscribe(syncVisualState);
|
|
125
124
|
return () => {
|
|
126
125
|
unsubscribe();
|
|
127
|
-
element.style.setProperty(
|
|
128
|
-
element.style.removeProperty(
|
|
126
|
+
element.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, '0');
|
|
127
|
+
element.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
129
128
|
};
|
|
130
129
|
}, [visualStateStore]);
|
|
131
130
|
const state = {
|
|
@@ -136,7 +135,7 @@ const DrawerIndent = /*#__PURE__*/React__namespace.forwardRef(function DrawerInd
|
|
|
136
135
|
state,
|
|
137
136
|
props: [{
|
|
138
137
|
style: {
|
|
139
|
-
[
|
|
138
|
+
[ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress]: '0'
|
|
140
139
|
}
|
|
141
140
|
}, elementProps],
|
|
142
141
|
stateAttributesMapping: stateAttributesMapping$8
|
|
@@ -169,7 +168,7 @@ const DrawerIndentBackground = /*#__PURE__*/React__namespace.forwardRef(function
|
|
|
169
168
|
className,
|
|
170
169
|
...elementProps
|
|
171
170
|
} = componentProps;
|
|
172
|
-
const providerContext =
|
|
171
|
+
const providerContext = ScrollAreaViewport.useDrawerProviderContext();
|
|
173
172
|
const active = providerContext?.active ?? false;
|
|
174
173
|
const state = {
|
|
175
174
|
active
|
|
@@ -224,7 +223,7 @@ function DrawerProvider(props) {
|
|
|
224
223
|
active,
|
|
225
224
|
visualStateStore
|
|
226
225
|
}), [active, removeDrawer, setDrawerOpen, visualStateStore]);
|
|
227
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
226
|
+
return /*#__PURE__*/jsxRuntime.jsx(ScrollAreaViewport.DrawerProviderContext.Provider, {
|
|
228
227
|
value: contextValue,
|
|
229
228
|
children: children
|
|
230
229
|
});
|
|
@@ -270,19 +269,19 @@ let DialogViewportDataAttributes = function (DialogViewportDataAttributes) {
|
|
|
270
269
|
/**
|
|
271
270
|
* Present when the dialog is open.
|
|
272
271
|
*/
|
|
273
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["open"] =
|
|
272
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["open"] = ScrollAreaViewport.CommonPopupDataAttributes.open] = "open";
|
|
274
273
|
/**
|
|
275
274
|
* Present when the dialog is closed.
|
|
276
275
|
*/
|
|
277
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] =
|
|
276
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] = ScrollAreaViewport.CommonPopupDataAttributes.closed] = "closed";
|
|
278
277
|
/**
|
|
279
278
|
* Present when the dialog is animating in.
|
|
280
279
|
*/
|
|
281
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] =
|
|
280
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] = ScrollAreaViewport.CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
282
281
|
/**
|
|
283
282
|
* Present when the dialog is animating out.
|
|
284
283
|
*/
|
|
285
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] =
|
|
284
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] = ScrollAreaViewport.CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
286
285
|
/**
|
|
287
286
|
* Present when the dialog is nested within another dialog.
|
|
288
287
|
*/
|
|
@@ -295,7 +294,7 @@ let DialogViewportDataAttributes = function (DialogViewportDataAttributes) {
|
|
|
295
294
|
}({});
|
|
296
295
|
|
|
297
296
|
const stateAttributesMapping$6 = {
|
|
298
|
-
...
|
|
297
|
+
...ScrollAreaViewport.popupStateMapping,
|
|
299
298
|
...useValueChanged.transitionStatusMapping,
|
|
300
299
|
nested(value) {
|
|
301
300
|
return value ? {
|
|
@@ -322,10 +321,10 @@ const DialogViewport = /*#__PURE__*/React__namespace.forwardRef(function DialogV
|
|
|
322
321
|
children,
|
|
323
322
|
...elementProps
|
|
324
323
|
} = componentProps;
|
|
325
|
-
const keepMounted =
|
|
324
|
+
const keepMounted = ScrollAreaViewport.useDialogPortalContext();
|
|
326
325
|
const {
|
|
327
326
|
store
|
|
328
|
-
} =
|
|
327
|
+
} = ScrollAreaViewport.useDialogRootContext();
|
|
329
328
|
const open = store.useState('open');
|
|
330
329
|
const nested = store.useState('nested');
|
|
331
330
|
const transitionStatus = store.useState('transitionStatus');
|
|
@@ -366,7 +365,7 @@ class DialogHandle {
|
|
|
366
365
|
*/
|
|
367
366
|
|
|
368
367
|
constructor(store) {
|
|
369
|
-
this.store = store ?? new
|
|
368
|
+
this.store = store ?? new ScrollAreaViewport.DialogStore();
|
|
370
369
|
}
|
|
371
370
|
|
|
372
371
|
/**
|
|
@@ -759,7 +758,7 @@ function useSwipeDismiss(options) {
|
|
|
759
758
|
function getTargetAtPoint(position, nativeEvent) {
|
|
760
759
|
const doc = useValueChanged.ownerDocument(elementRef.current);
|
|
761
760
|
const elementAtPoint = getElementAtPoint(doc, position.x, position.y);
|
|
762
|
-
const target = elementAtPoint ??
|
|
761
|
+
const target = elementAtPoint ?? ScrollAreaViewport.getTarget(nativeEvent);
|
|
763
762
|
return target;
|
|
764
763
|
}
|
|
765
764
|
function findGestureScrollableTouchTarget(target, root) {
|
|
@@ -950,7 +949,7 @@ function useSwipeDismiss(options) {
|
|
|
950
949
|
if (!enabled || !isSwipingRef.current) {
|
|
951
950
|
return;
|
|
952
951
|
}
|
|
953
|
-
const target =
|
|
952
|
+
const target = ScrollAreaViewport.getTarget(event.nativeEvent);
|
|
954
953
|
if (isTouchLikeEvent(event) && !swipeFromScrollableRef.current) {
|
|
955
954
|
const boundaryElement = event.currentTarget;
|
|
956
955
|
if (findGestureScrollableTouchTarget(target, boundaryElement)) {
|
|
@@ -1151,7 +1150,7 @@ function useSwipeDismiss(options) {
|
|
|
1151
1150
|
const doc = useValueChanged.ownerDocument(element);
|
|
1152
1151
|
const body = doc.body;
|
|
1153
1152
|
const scrollTarget = body ? findGestureScrollableTouchTarget(target, body) : null;
|
|
1154
|
-
if (scrollTarget && (
|
|
1153
|
+
if (scrollTarget && (ScrollAreaViewport.contains(element, scrollTarget) || ScrollAreaViewport.contains(scrollTarget, element))) {
|
|
1155
1154
|
const deltaX = currentPos.x - pendingStartPos.x;
|
|
1156
1155
|
const deltaY = currentPos.y - pendingStartPos.y;
|
|
1157
1156
|
const canSwipeFromEdge = canSwipeFromScrollEdgeOnPendingMove(scrollTarget, deltaX, deltaY);
|
|
@@ -1395,11 +1394,11 @@ let DrawerSwipeAreaDataAttributes = function (DrawerSwipeAreaDataAttributes) {
|
|
|
1395
1394
|
/**
|
|
1396
1395
|
* Present when the drawer is open.
|
|
1397
1396
|
*/
|
|
1398
|
-
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["open"] =
|
|
1397
|
+
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["open"] = ScrollAreaViewport.CommonPopupDataAttributes.open] = "open";
|
|
1399
1398
|
/**
|
|
1400
1399
|
* Present when the drawer is closed.
|
|
1401
1400
|
*/
|
|
1402
|
-
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["closed"] =
|
|
1401
|
+
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["closed"] = ScrollAreaViewport.CommonPopupDataAttributes.closed] = "closed";
|
|
1403
1402
|
/**
|
|
1404
1403
|
* Present when the swipe area is disabled.
|
|
1405
1404
|
*/
|
|
@@ -1474,12 +1473,12 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1474
1473
|
} = componentProps;
|
|
1475
1474
|
const {
|
|
1476
1475
|
store
|
|
1477
|
-
} =
|
|
1476
|
+
} = ScrollAreaViewport.useDialogRootContext();
|
|
1478
1477
|
const {
|
|
1479
1478
|
swipeDirection,
|
|
1480
1479
|
frontmostHeight
|
|
1481
|
-
} =
|
|
1482
|
-
const providerContext =
|
|
1480
|
+
} = ScrollAreaViewport.useDrawerRootContext();
|
|
1481
|
+
const providerContext = ScrollAreaViewport.useDrawerProviderContext();
|
|
1483
1482
|
const [swipeActive, setSwipeActive] = React__namespace.useState(false);
|
|
1484
1483
|
const releaseDismissTimeout = useValueChanged.useTimeout();
|
|
1485
1484
|
const swipeAreaRef = React__namespace.useRef(null);
|
|
@@ -1492,8 +1491,8 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1492
1491
|
const closedOffsetRef = React__namespace.useRef(null);
|
|
1493
1492
|
const appliedSwipeStylesRef = React__namespace.useRef(false);
|
|
1494
1493
|
const popupTransitionRef = React__namespace.useRef(null);
|
|
1495
|
-
const swipeAreaId =
|
|
1496
|
-
const registerTrigger =
|
|
1494
|
+
const swipeAreaId = useValueChanged.useBaseUiId(componentProps.id);
|
|
1495
|
+
const registerTrigger = ScrollAreaViewport.useTriggerRegistration(swipeAreaId, store);
|
|
1497
1496
|
const open = store.useState('open');
|
|
1498
1497
|
const resolvedSwipeDirection = swipeDirectionProp ?? oppositeSwipeDirection[swipeDirection];
|
|
1499
1498
|
const dismissDirection = oppositeSwipeDirection[resolvedSwipeDirection];
|
|
@@ -1582,21 +1581,21 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1582
1581
|
const movementY = isHorizontal ? 0 : movement;
|
|
1583
1582
|
const openProgress = Math.max(0, Math.min(1, clampedDisplacement / closedOffset));
|
|
1584
1583
|
const backdropProgress = Math.max(0, Math.min(1, 1 - openProgress));
|
|
1585
|
-
popupElement.style.setProperty(
|
|
1586
|
-
popupElement.style.setProperty(
|
|
1587
|
-
popupElement.setAttribute(
|
|
1584
|
+
popupElement.style.setProperty(ScrollAreaViewport.DrawerPopupCssVars.swipeMovementX, `${movementX}px`);
|
|
1585
|
+
popupElement.style.setProperty(ScrollAreaViewport.DrawerPopupCssVars.swipeMovementY, `${movementY}px`);
|
|
1586
|
+
popupElement.setAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping, '');
|
|
1588
1587
|
if (popupTransitionRef.current === null) {
|
|
1589
1588
|
popupTransitionRef.current = popupElement.style.transition;
|
|
1590
1589
|
}
|
|
1591
1590
|
popupElement.style.transition = 'none';
|
|
1592
1591
|
const backdropElement = store.context.backdropRef.current;
|
|
1593
1592
|
if (backdropElement) {
|
|
1594
|
-
backdropElement.setAttribute(
|
|
1595
|
-
backdropElement.style.setProperty(
|
|
1593
|
+
backdropElement.setAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping, '');
|
|
1594
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, `${backdropProgress}`);
|
|
1596
1595
|
if (openProgress > 0 && frontmostHeight > 0) {
|
|
1597
|
-
backdropElement.style.setProperty(
|
|
1596
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1598
1597
|
} else {
|
|
1599
|
-
backdropElement.style.removeProperty(
|
|
1598
|
+
backdropElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
1600
1599
|
}
|
|
1601
1600
|
}
|
|
1602
1601
|
providerContext?.visualStateStore.set({
|
|
@@ -1608,9 +1607,9 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1608
1607
|
const clearSwipeStyles = useValueChanged.useStableCallback(() => {
|
|
1609
1608
|
const popupElement = store.context.popupRef.current;
|
|
1610
1609
|
if (popupElement && appliedSwipeStylesRef.current) {
|
|
1611
|
-
popupElement.style.removeProperty(
|
|
1612
|
-
popupElement.style.removeProperty(
|
|
1613
|
-
popupElement.removeAttribute(
|
|
1610
|
+
popupElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.swipeMovementX);
|
|
1611
|
+
popupElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.swipeMovementY);
|
|
1612
|
+
popupElement.removeAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping);
|
|
1614
1613
|
}
|
|
1615
1614
|
if (popupElement && popupTransitionRef.current !== null) {
|
|
1616
1615
|
popupElement.style.transition = popupTransitionRef.current;
|
|
@@ -1618,9 +1617,9 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1618
1617
|
}
|
|
1619
1618
|
const backdropElement = store.context.backdropRef.current;
|
|
1620
1619
|
if (backdropElement) {
|
|
1621
|
-
backdropElement.removeAttribute(
|
|
1622
|
-
backdropElement.style.setProperty(
|
|
1623
|
-
backdropElement.style.removeProperty(
|
|
1620
|
+
backdropElement.removeAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping);
|
|
1621
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, '0');
|
|
1622
|
+
backdropElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
1624
1623
|
}
|
|
1625
1624
|
providerContext?.visualStateStore.set({
|
|
1626
1625
|
swipeProgress: 0,
|
|
@@ -1647,8 +1646,8 @@ const DrawerSwipeArea = /*#__PURE__*/React__namespace.forwardRef(function Drawer
|
|
|
1647
1646
|
elementRef: swipeAreaRef,
|
|
1648
1647
|
trackDrag: false,
|
|
1649
1648
|
movementCssVars: {
|
|
1650
|
-
x:
|
|
1651
|
-
y:
|
|
1649
|
+
x: ScrollAreaViewport.DrawerPopupCssVars.swipeMovementX,
|
|
1650
|
+
y: ScrollAreaViewport.DrawerPopupCssVars.swipeMovementY
|
|
1652
1651
|
},
|
|
1653
1652
|
onSwipeStart(event) {
|
|
1654
1653
|
disableDismissForSwipe();
|
|
@@ -1791,7 +1790,7 @@ const MIN_SWIPE_RELEASE_DURATION_MS = 80;
|
|
|
1791
1790
|
const MAX_SWIPE_RELEASE_DURATION_MS = 360;
|
|
1792
1791
|
const MIN_SWIPE_RELEASE_SCALAR = 0.1;
|
|
1793
1792
|
const MAX_SWIPE_RELEASE_SCALAR = 1;
|
|
1794
|
-
const DRAWER_CONTENT_SELECTOR = `[${
|
|
1793
|
+
const DRAWER_CONTENT_SELECTOR = `[${ScrollAreaViewport.DRAWER_CONTENT_ATTRIBUTE}]`;
|
|
1795
1794
|
/**
|
|
1796
1795
|
* A positioning container for the drawer popup that can be made scrollable.
|
|
1797
1796
|
* Renders a `<div>` element.
|
|
@@ -1807,15 +1806,15 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
1807
1806
|
} = props;
|
|
1808
1807
|
const {
|
|
1809
1808
|
store
|
|
1810
|
-
} =
|
|
1809
|
+
} = ScrollAreaViewport.useDialogRootContext();
|
|
1811
1810
|
const {
|
|
1812
1811
|
swipeDirection,
|
|
1813
1812
|
notifyParentSwipingChange,
|
|
1814
1813
|
notifyParentSwipeProgressChange,
|
|
1815
1814
|
frontmostHeight,
|
|
1816
1815
|
snapToSequentialPoints
|
|
1817
|
-
} =
|
|
1818
|
-
const providerContext =
|
|
1816
|
+
} = ScrollAreaViewport.useDrawerRootContext();
|
|
1817
|
+
const providerContext = ScrollAreaViewport.useDrawerProviderContext();
|
|
1819
1818
|
const visualStateStore = providerContext?.visualStateStore;
|
|
1820
1819
|
const open = store.useState('open');
|
|
1821
1820
|
const mounted = store.useState('mounted');
|
|
@@ -1834,7 +1833,7 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
1834
1833
|
activeSnapPointOffset,
|
|
1835
1834
|
setActiveSnapPoint,
|
|
1836
1835
|
popupHeight
|
|
1837
|
-
} =
|
|
1836
|
+
} = ScrollAreaViewport.useDrawerSnapPoints();
|
|
1838
1837
|
const [swipeRelease, setSwipeRelease] = React__namespace.useState(null);
|
|
1839
1838
|
const pendingSwipeCloseSnapPointRef = React__namespace.useRef(undefined);
|
|
1840
1839
|
const resetSwipeRef = React__namespace.useRef(null);
|
|
@@ -1914,15 +1913,15 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
1914
1913
|
return;
|
|
1915
1914
|
}
|
|
1916
1915
|
if (!isActive || swipeProgress <= 0) {
|
|
1917
|
-
backdropElement.style.setProperty(
|
|
1918
|
-
backdropElement.style.removeProperty(
|
|
1916
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, '0');
|
|
1917
|
+
backdropElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
1919
1918
|
return;
|
|
1920
1919
|
}
|
|
1921
|
-
backdropElement.style.setProperty(
|
|
1920
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, `${swipeProgress}`);
|
|
1922
1921
|
if (frontmostHeight > 0) {
|
|
1923
|
-
backdropElement.style.setProperty(
|
|
1922
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1924
1923
|
} else {
|
|
1925
|
-
backdropElement.style.removeProperty(
|
|
1924
|
+
backdropElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
1926
1925
|
}
|
|
1927
1926
|
});
|
|
1928
1927
|
function resolveSwipeRelease({
|
|
@@ -1997,8 +1996,8 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
1997
1996
|
ignoreSelectorWhenTouch: false,
|
|
1998
1997
|
ignoreScrollableAncestors: true,
|
|
1999
1998
|
movementCssVars: {
|
|
2000
|
-
x:
|
|
2001
|
-
y:
|
|
1999
|
+
x: ScrollAreaViewport.DrawerPopupCssVars.swipeMovementX,
|
|
2000
|
+
y: ScrollAreaViewport.DrawerPopupCssVars.swipeMovementY
|
|
2002
2001
|
},
|
|
2003
2002
|
onSwipeStart(event) {
|
|
2004
2003
|
if ('touches' in event || 'pointerType' in event && event.pointerType === 'touch') {
|
|
@@ -2015,7 +2014,7 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2015
2014
|
}
|
|
2016
2015
|
const anchorElement = floatingUi_utils_dom.isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
2017
2016
|
const focusElement = floatingUi_utils_dom.isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
2018
|
-
if (!
|
|
2017
|
+
if (!ScrollAreaViewport.contains(popupElement, anchorElement) && !ScrollAreaViewport.contains(popupElement, focusElement)) {
|
|
2019
2018
|
return;
|
|
2020
2019
|
}
|
|
2021
2020
|
selection.removeAllRanges();
|
|
@@ -2040,7 +2039,7 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2040
2039
|
}
|
|
2041
2040
|
const doc = popupElement.ownerDocument;
|
|
2042
2041
|
const elementAtPoint = getElementAtPoint(doc, position.x, position.y);
|
|
2043
|
-
if (!elementAtPoint || !
|
|
2042
|
+
if (!elementAtPoint || !ScrollAreaViewport.contains(popupElement, elementAtPoint)) {
|
|
2044
2043
|
return false;
|
|
2045
2044
|
}
|
|
2046
2045
|
const nativeEvent = details.nativeEvent;
|
|
@@ -2265,8 +2264,8 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2265
2264
|
});
|
|
2266
2265
|
const backdropElement = store.context.backdropRef.current;
|
|
2267
2266
|
if (backdropElement) {
|
|
2268
|
-
backdropElement.style.setProperty(
|
|
2269
|
-
backdropElement.style.removeProperty(
|
|
2267
|
+
backdropElement.style.setProperty(ScrollAreaViewport.DrawerBackdropCssVars.swipeProgress, '0');
|
|
2268
|
+
backdropElement.style.removeProperty(ScrollAreaViewport.DrawerPopupCssVars.height);
|
|
2270
2269
|
}
|
|
2271
2270
|
const dismissEventDetails = useValueChanged.createChangeEventDetails(useValueChanged.swipe, event);
|
|
2272
2271
|
store.setOpen(false, dismissEventDetails);
|
|
@@ -2531,7 +2530,7 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2531
2530
|
const target = floatingUi_utils_dom.isElement(event.target) ? event.target : null;
|
|
2532
2531
|
let scrollTarget = null;
|
|
2533
2532
|
let hasCrossAxisScrollableContent = false;
|
|
2534
|
-
if (rootElement && target &&
|
|
2533
|
+
if (rootElement && target && ScrollAreaViewport.contains(rootElement, target)) {
|
|
2535
2534
|
scrollTarget = findScrollableTouchTarget(target, rootElement, scrollAxis);
|
|
2536
2535
|
hasCrossAxisScrollableContent = findScrollableTouchTarget(target, rootElement, crossScrollAxis) != null;
|
|
2537
2536
|
}
|
|
@@ -2580,7 +2579,7 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2580
2579
|
// Suppress DialogViewport's generic nested dialog attribute.
|
|
2581
2580
|
['data-nested-dialog-open']: undefined
|
|
2582
2581
|
}),
|
|
2583
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
2582
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ScrollAreaViewport.DrawerViewportContext.Provider, {
|
|
2584
2583
|
value: swipeProviderValue,
|
|
2585
2584
|
children: children
|
|
2586
2585
|
})
|
|
@@ -2589,25 +2588,25 @@ const DrawerViewport = /*#__PURE__*/React__namespace.forwardRef(function DrawerV
|
|
|
2589
2588
|
if (process.env.NODE_ENV !== "production") DrawerViewport.displayName = "DrawerViewport";
|
|
2590
2589
|
function setSwipeDismissedElements(popupElement, backdropElement, dismissed) {
|
|
2591
2590
|
if (dismissed) {
|
|
2592
|
-
popupElement?.setAttribute(
|
|
2593
|
-
backdropElement?.setAttribute(
|
|
2591
|
+
popupElement?.setAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swipeDismiss, '');
|
|
2592
|
+
backdropElement?.setAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swipeDismiss, '');
|
|
2594
2593
|
return;
|
|
2595
2594
|
}
|
|
2596
|
-
popupElement?.removeAttribute(
|
|
2597
|
-
backdropElement?.removeAttribute(
|
|
2595
|
+
popupElement?.removeAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swipeDismiss);
|
|
2596
|
+
backdropElement?.removeAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swipeDismiss);
|
|
2598
2597
|
}
|
|
2599
2598
|
function setBackdropSwipingAttribute(backdropElement, swiping) {
|
|
2600
2599
|
if (!backdropElement) {
|
|
2601
2600
|
return;
|
|
2602
2601
|
}
|
|
2603
2602
|
if (swiping) {
|
|
2604
|
-
backdropElement.setAttribute(
|
|
2603
|
+
backdropElement.setAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping, '');
|
|
2605
2604
|
return;
|
|
2606
2605
|
}
|
|
2607
|
-
backdropElement.removeAttribute(
|
|
2606
|
+
backdropElement.removeAttribute(ScrollAreaViewport.DrawerPopupDataAttributes.swiping);
|
|
2608
2607
|
}
|
|
2609
2608
|
function isSwipeIgnoredTarget(target) {
|
|
2610
|
-
return Boolean(target?.closest(
|
|
2609
|
+
return Boolean(target?.closest(ScrollAreaViewport.BASE_UI_SWIPE_IGNORE_SELECTOR));
|
|
2611
2610
|
}
|
|
2612
2611
|
function isDrawerContentTarget(target) {
|
|
2613
2612
|
return Boolean(target?.closest(DRAWER_CONTENT_SELECTOR));
|
|
@@ -2628,11 +2627,11 @@ function isTextSelectionControl(target) {
|
|
|
2628
2627
|
function hasExpandedSelectionWithinTarget(selection, target) {
|
|
2629
2628
|
const anchorElement = floatingUi_utils_dom.isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
2630
2629
|
const focusElement = floatingUi_utils_dom.isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
2631
|
-
return selection.containsNode(target, true) ||
|
|
2630
|
+
return selection.containsNode(target, true) || ScrollAreaViewport.contains(target, anchorElement) || ScrollAreaViewport.contains(target, focusElement);
|
|
2632
2631
|
}
|
|
2633
2632
|
function shouldIgnoreSwipeForTextSelection(doc, rootElement) {
|
|
2634
2633
|
const activeElement = doc.activeElement;
|
|
2635
|
-
const activeElementWithinRoot = Boolean(activeElement &&
|
|
2634
|
+
const activeElementWithinRoot = Boolean(activeElement && ScrollAreaViewport.contains(rootElement, activeElement));
|
|
2636
2635
|
if (activeElementWithinRoot && isTextSelectionControl(activeElement)) {
|
|
2637
2636
|
const {
|
|
2638
2637
|
selectionStart,
|
|
@@ -2741,22 +2740,22 @@ function shouldDismissFromStartEdge(direction, axis) {
|
|
|
2741
2740
|
return null;
|
|
2742
2741
|
}
|
|
2743
2742
|
|
|
2744
|
-
var index_parts$
|
|
2743
|
+
var index_parts$4 = /*#__PURE__*/Object.freeze({
|
|
2745
2744
|
__proto__: null,
|
|
2746
|
-
Backdrop:
|
|
2745
|
+
Backdrop: ScrollAreaViewport.DrawerBackdrop,
|
|
2747
2746
|
Close: MenuSubmenuTrigger.DrawerClose,
|
|
2748
|
-
Content:
|
|
2747
|
+
Content: ScrollAreaViewport.DrawerContent,
|
|
2749
2748
|
Description: DrawerDescription,
|
|
2750
2749
|
Handle: DialogHandle,
|
|
2751
2750
|
Indent: DrawerIndent,
|
|
2752
2751
|
IndentBackground: DrawerIndentBackground,
|
|
2753
|
-
Popup:
|
|
2754
|
-
Portal:
|
|
2752
|
+
Popup: ScrollAreaViewport.DrawerPopup,
|
|
2753
|
+
Portal: ScrollAreaViewport.DrawerPortal,
|
|
2755
2754
|
Provider: DrawerProvider,
|
|
2756
|
-
Root:
|
|
2755
|
+
Root: ScrollAreaViewport.DrawerRoot,
|
|
2757
2756
|
SwipeArea: DrawerSwipeArea,
|
|
2758
2757
|
Title: MenuSubmenuTrigger.DrawerTitle,
|
|
2759
|
-
Trigger:
|
|
2758
|
+
Trigger: ScrollAreaViewport.DrawerTrigger,
|
|
2760
2759
|
Viewport: DrawerViewport,
|
|
2761
2760
|
createHandle: createDialogHandle
|
|
2762
2761
|
});
|
|
@@ -2792,7 +2791,7 @@ const MenuArrow = /*#__PURE__*/React__namespace.forwardRef(function MenuArrow(co
|
|
|
2792
2791
|
};
|
|
2793
2792
|
return useRenderElement.useRenderElement('div', componentProps, {
|
|
2794
2793
|
ref: [arrowRef, forwardedRef],
|
|
2795
|
-
stateAttributesMapping:
|
|
2794
|
+
stateAttributesMapping: ScrollAreaViewport.popupStateMapping,
|
|
2796
2795
|
state,
|
|
2797
2796
|
props: {
|
|
2798
2797
|
style: arrowStyles,
|
|
@@ -2804,7 +2803,7 @@ const MenuArrow = /*#__PURE__*/React__namespace.forwardRef(function MenuArrow(co
|
|
|
2804
2803
|
if (process.env.NODE_ENV !== "production") MenuArrow.displayName = "MenuArrow";
|
|
2805
2804
|
|
|
2806
2805
|
const stateAttributesMapping$4 = {
|
|
2807
|
-
...
|
|
2806
|
+
...ScrollAreaViewport.popupStateMapping,
|
|
2808
2807
|
...useValueChanged.transitionStatusMapping
|
|
2809
2808
|
};
|
|
2810
2809
|
|
|
@@ -2883,7 +2882,7 @@ const MenuCheckboxItem = /*#__PURE__*/React__namespace.forwardRef(function MenuC
|
|
|
2883
2882
|
label
|
|
2884
2883
|
});
|
|
2885
2884
|
const menuPositionerContext = MenuSubmenuTrigger.useMenuPositionerContext(true);
|
|
2886
|
-
const id =
|
|
2885
|
+
const id = useValueChanged.useBaseUiId(idProp);
|
|
2887
2886
|
const {
|
|
2888
2887
|
store
|
|
2889
2888
|
} = MenuSubmenuTrigger.useMenuRootContext();
|
|
@@ -3211,7 +3210,7 @@ function usePopupViewport(parameters) {
|
|
|
3211
3210
|
cssVars,
|
|
3212
3211
|
children
|
|
3213
3212
|
} = parameters;
|
|
3214
|
-
const direction =
|
|
3213
|
+
const direction = ScrollAreaViewport.useDirection();
|
|
3215
3214
|
const activeTrigger = store.useState('activeTriggerElement');
|
|
3216
3215
|
const activeTriggerId = store.useState('activeTriggerId');
|
|
3217
3216
|
const open = store.useState('open');
|
|
@@ -3308,7 +3307,7 @@ function usePopupViewport(parameters) {
|
|
|
3308
3307
|
childrenToRender = /*#__PURE__*/jsxRuntime.jsxs(React__namespace.Fragment, {
|
|
3309
3308
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3310
3309
|
"data-previous": true,
|
|
3311
|
-
inert:
|
|
3310
|
+
inert: ScrollAreaViewport.inertValue(true),
|
|
3312
3311
|
ref: previousContainerRef,
|
|
3313
3312
|
style: {
|
|
3314
3313
|
...(previousContentDimensions ? {
|
|
@@ -3553,7 +3552,7 @@ function createMenuHandle() {
|
|
|
3553
3552
|
return new MenuHandle();
|
|
3554
3553
|
}
|
|
3555
3554
|
|
|
3556
|
-
var index_parts$
|
|
3555
|
+
var index_parts$3 = /*#__PURE__*/Object.freeze({
|
|
3557
3556
|
__proto__: null,
|
|
3558
3557
|
Arrow: MenuArrow,
|
|
3559
3558
|
Backdrop: MenuBackdrop,
|
|
@@ -3579,6 +3578,374 @@ var index_parts$2 = /*#__PURE__*/Object.freeze({
|
|
|
3579
3578
|
createHandle: createMenuHandle
|
|
3580
3579
|
});
|
|
3581
3580
|
|
|
3581
|
+
const ScrollAreaScrollbarContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
3582
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaScrollbarContext.displayName = "ScrollAreaScrollbarContext";
|
|
3583
|
+
function useScrollAreaScrollbarContext() {
|
|
3584
|
+
const context = React__namespace.useContext(ScrollAreaScrollbarContext);
|
|
3585
|
+
if (context === undefined) {
|
|
3586
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: ScrollAreaScrollbarContext is missing. ScrollAreaScrollbar parts must be placed within <ScrollArea.Scrollbar>.' : useRenderElement.formatErrorMessage(54));
|
|
3587
|
+
}
|
|
3588
|
+
return context;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
let ScrollAreaScrollbarCssVars = /*#__PURE__*/function (ScrollAreaScrollbarCssVars) {
|
|
3592
|
+
/**
|
|
3593
|
+
* The scroll area thumb's height.
|
|
3594
|
+
* @type {number}
|
|
3595
|
+
*/
|
|
3596
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbHeight"] = "--scroll-area-thumb-height";
|
|
3597
|
+
/**
|
|
3598
|
+
* The scroll area thumb's width.
|
|
3599
|
+
* @type {number}
|
|
3600
|
+
*/
|
|
3601
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbWidth"] = "--scroll-area-thumb-width";
|
|
3602
|
+
return ScrollAreaScrollbarCssVars;
|
|
3603
|
+
}({});
|
|
3604
|
+
|
|
3605
|
+
/**
|
|
3606
|
+
* A vertical or horizontal scrollbar for the scroll area.
|
|
3607
|
+
* Renders a `<div>` element.
|
|
3608
|
+
*
|
|
3609
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3610
|
+
*/
|
|
3611
|
+
const ScrollAreaScrollbar = /*#__PURE__*/React__namespace.forwardRef(function ScrollAreaScrollbar(componentProps, forwardedRef) {
|
|
3612
|
+
const {
|
|
3613
|
+
render,
|
|
3614
|
+
className,
|
|
3615
|
+
orientation = 'vertical',
|
|
3616
|
+
keepMounted = false,
|
|
3617
|
+
...elementProps
|
|
3618
|
+
} = componentProps;
|
|
3619
|
+
const {
|
|
3620
|
+
hovering,
|
|
3621
|
+
scrollingX,
|
|
3622
|
+
scrollingY,
|
|
3623
|
+
hiddenState,
|
|
3624
|
+
overflowEdges,
|
|
3625
|
+
scrollbarYRef,
|
|
3626
|
+
scrollbarXRef,
|
|
3627
|
+
viewportRef,
|
|
3628
|
+
thumbYRef,
|
|
3629
|
+
thumbXRef,
|
|
3630
|
+
handlePointerDown,
|
|
3631
|
+
handlePointerUp,
|
|
3632
|
+
rootId,
|
|
3633
|
+
thumbSize,
|
|
3634
|
+
hasMeasuredScrollbar
|
|
3635
|
+
} = ScrollAreaViewport.useScrollAreaRootContext();
|
|
3636
|
+
const state = {
|
|
3637
|
+
hovering,
|
|
3638
|
+
scrolling: {
|
|
3639
|
+
horizontal: scrollingX,
|
|
3640
|
+
vertical: scrollingY
|
|
3641
|
+
}[orientation],
|
|
3642
|
+
orientation,
|
|
3643
|
+
hasOverflowX: !hiddenState.x,
|
|
3644
|
+
hasOverflowY: !hiddenState.y,
|
|
3645
|
+
overflowXStart: overflowEdges.xStart,
|
|
3646
|
+
overflowXEnd: overflowEdges.xEnd,
|
|
3647
|
+
overflowYStart: overflowEdges.yStart,
|
|
3648
|
+
overflowYEnd: overflowEdges.yEnd,
|
|
3649
|
+
cornerHidden: hiddenState.corner
|
|
3650
|
+
};
|
|
3651
|
+
const direction = ScrollAreaViewport.useDirection();
|
|
3652
|
+
const hideTrackUntilMeasured = !hasMeasuredScrollbar && !keepMounted;
|
|
3653
|
+
React__namespace.useEffect(() => {
|
|
3654
|
+
const viewportEl = viewportRef.current;
|
|
3655
|
+
const scrollbarEl = orientation === 'vertical' ? scrollbarYRef.current : scrollbarXRef.current;
|
|
3656
|
+
if (!scrollbarEl) {
|
|
3657
|
+
return undefined;
|
|
3658
|
+
}
|
|
3659
|
+
function handleWheel(event) {
|
|
3660
|
+
if (!viewportEl || !scrollbarEl || event.ctrlKey) {
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3663
|
+
event.preventDefault();
|
|
3664
|
+
if (orientation === 'vertical') {
|
|
3665
|
+
if (viewportEl.scrollTop === 0 && event.deltaY < 0) {
|
|
3666
|
+
return;
|
|
3667
|
+
}
|
|
3668
|
+
} else if (viewportEl.scrollLeft === 0 && event.deltaX < 0) {
|
|
3669
|
+
return;
|
|
3670
|
+
}
|
|
3671
|
+
if (orientation === 'vertical') {
|
|
3672
|
+
if (viewportEl.scrollTop === viewportEl.scrollHeight - viewportEl.clientHeight && event.deltaY > 0) {
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
} else if (viewportEl.scrollLeft === viewportEl.scrollWidth - viewportEl.clientWidth && event.deltaX > 0) {
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
if (orientation === 'vertical') {
|
|
3679
|
+
viewportEl.scrollTop += event.deltaY;
|
|
3680
|
+
} else {
|
|
3681
|
+
viewportEl.scrollLeft += event.deltaX;
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
scrollbarEl.addEventListener('wheel', handleWheel, {
|
|
3685
|
+
passive: false
|
|
3686
|
+
});
|
|
3687
|
+
return () => {
|
|
3688
|
+
scrollbarEl.removeEventListener('wheel', handleWheel);
|
|
3689
|
+
};
|
|
3690
|
+
}, [orientation, scrollbarXRef, scrollbarYRef, viewportRef]);
|
|
3691
|
+
const props = {
|
|
3692
|
+
...(rootId && {
|
|
3693
|
+
'data-id': `${rootId}-scrollbar`
|
|
3694
|
+
}),
|
|
3695
|
+
onPointerDown(event) {
|
|
3696
|
+
if (event.button !== 0) {
|
|
3697
|
+
return;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
// Ignore clicks on thumb
|
|
3701
|
+
if (event.currentTarget !== event.target) {
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
if (!viewportRef.current) {
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3707
|
+
|
|
3708
|
+
// Handle Y-axis (vertical) scroll
|
|
3709
|
+
if (thumbYRef.current && scrollbarYRef.current && orientation === 'vertical') {
|
|
3710
|
+
const thumbYOffset = ScrollAreaViewport.getOffset(thumbYRef.current, 'margin', 'y');
|
|
3711
|
+
const scrollbarYOffset = ScrollAreaViewport.getOffset(scrollbarYRef.current, 'padding', 'y');
|
|
3712
|
+
const thumbHeight = thumbYRef.current.offsetHeight;
|
|
3713
|
+
const trackRectY = scrollbarYRef.current.getBoundingClientRect();
|
|
3714
|
+
const clickY = event.clientY - trackRectY.top - thumbHeight / 2 - scrollbarYOffset + thumbYOffset / 2;
|
|
3715
|
+
const scrollableContentHeight = viewportRef.current.scrollHeight;
|
|
3716
|
+
const viewportHeight = viewportRef.current.clientHeight;
|
|
3717
|
+
const maxThumbOffsetY = scrollbarYRef.current.offsetHeight - thumbHeight - scrollbarYOffset - thumbYOffset;
|
|
3718
|
+
const scrollRatioY = clickY / maxThumbOffsetY;
|
|
3719
|
+
const newScrollTop = scrollRatioY * (scrollableContentHeight - viewportHeight);
|
|
3720
|
+
viewportRef.current.scrollTop = newScrollTop;
|
|
3721
|
+
}
|
|
3722
|
+
if (thumbXRef.current && scrollbarXRef.current && orientation === 'horizontal') {
|
|
3723
|
+
const thumbXOffset = ScrollAreaViewport.getOffset(thumbXRef.current, 'margin', 'x');
|
|
3724
|
+
const scrollbarXOffset = ScrollAreaViewport.getOffset(scrollbarXRef.current, 'padding', 'x');
|
|
3725
|
+
const thumbWidth = thumbXRef.current.offsetWidth;
|
|
3726
|
+
const trackRectX = scrollbarXRef.current.getBoundingClientRect();
|
|
3727
|
+
const clickX = event.clientX - trackRectX.left - thumbWidth / 2 - scrollbarXOffset + thumbXOffset / 2;
|
|
3728
|
+
const scrollableContentWidth = viewportRef.current.scrollWidth;
|
|
3729
|
+
const viewportWidth = viewportRef.current.clientWidth;
|
|
3730
|
+
const maxThumbOffsetX = scrollbarXRef.current.offsetWidth - thumbWidth - scrollbarXOffset - thumbXOffset;
|
|
3731
|
+
const scrollRatioX = clickX / maxThumbOffsetX;
|
|
3732
|
+
let newScrollLeft;
|
|
3733
|
+
if (direction === 'rtl') {
|
|
3734
|
+
// In RTL, invert the scroll direction
|
|
3735
|
+
newScrollLeft = (1 - scrollRatioX) * (scrollableContentWidth - viewportWidth);
|
|
3736
|
+
|
|
3737
|
+
// Adjust for browsers that use negative scrollLeft in RTL
|
|
3738
|
+
if (viewportRef.current.scrollLeft <= 0) {
|
|
3739
|
+
newScrollLeft = -newScrollLeft;
|
|
3740
|
+
}
|
|
3741
|
+
} else {
|
|
3742
|
+
newScrollLeft = scrollRatioX * (scrollableContentWidth - viewportWidth);
|
|
3743
|
+
}
|
|
3744
|
+
viewportRef.current.scrollLeft = newScrollLeft;
|
|
3745
|
+
}
|
|
3746
|
+
handlePointerDown(event);
|
|
3747
|
+
},
|
|
3748
|
+
onPointerUp: handlePointerUp,
|
|
3749
|
+
style: {
|
|
3750
|
+
position: 'absolute',
|
|
3751
|
+
touchAction: 'none',
|
|
3752
|
+
WebkitUserSelect: 'none',
|
|
3753
|
+
userSelect: 'none',
|
|
3754
|
+
visibility: hideTrackUntilMeasured ? 'hidden' : undefined,
|
|
3755
|
+
...(orientation === 'vertical' && {
|
|
3756
|
+
top: 0,
|
|
3757
|
+
bottom: `var(${ScrollAreaViewport.ScrollAreaRootCssVars.scrollAreaCornerHeight})`,
|
|
3758
|
+
insetInlineEnd: 0,
|
|
3759
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbHeight]: `${thumbSize.height}px`
|
|
3760
|
+
}),
|
|
3761
|
+
...(orientation === 'horizontal' && {
|
|
3762
|
+
insetInlineStart: 0,
|
|
3763
|
+
insetInlineEnd: `var(${ScrollAreaViewport.ScrollAreaRootCssVars.scrollAreaCornerWidth})`,
|
|
3764
|
+
bottom: 0,
|
|
3765
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbWidth]: `${thumbSize.width}px`
|
|
3766
|
+
})
|
|
3767
|
+
}
|
|
3768
|
+
};
|
|
3769
|
+
const element = useRenderElement.useRenderElement('div', componentProps, {
|
|
3770
|
+
ref: [forwardedRef, orientation === 'vertical' ? scrollbarYRef : scrollbarXRef],
|
|
3771
|
+
state,
|
|
3772
|
+
props: [props, elementProps],
|
|
3773
|
+
stateAttributesMapping: ScrollAreaViewport.scrollAreaStateAttributesMapping
|
|
3774
|
+
});
|
|
3775
|
+
const contextValue = React__namespace.useMemo(() => ({
|
|
3776
|
+
orientation
|
|
3777
|
+
}), [orientation]);
|
|
3778
|
+
const isHidden = orientation === 'vertical' ? hiddenState.y : hiddenState.x;
|
|
3779
|
+
const shouldRender = keepMounted || !isHidden;
|
|
3780
|
+
if (!shouldRender) {
|
|
3781
|
+
return null;
|
|
3782
|
+
}
|
|
3783
|
+
return /*#__PURE__*/jsxRuntime.jsx(ScrollAreaScrollbarContext.Provider, {
|
|
3784
|
+
value: contextValue,
|
|
3785
|
+
children: element
|
|
3786
|
+
});
|
|
3787
|
+
});
|
|
3788
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaScrollbar.displayName = "ScrollAreaScrollbar";
|
|
3789
|
+
|
|
3790
|
+
/**
|
|
3791
|
+
* A container for the content of the scroll area.
|
|
3792
|
+
* Renders a `<div>` element.
|
|
3793
|
+
*
|
|
3794
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3795
|
+
*/
|
|
3796
|
+
const ScrollAreaContent = /*#__PURE__*/React__namespace.forwardRef(function ScrollAreaContent(componentProps, forwardedRef) {
|
|
3797
|
+
const {
|
|
3798
|
+
render,
|
|
3799
|
+
className,
|
|
3800
|
+
...elementProps
|
|
3801
|
+
} = componentProps;
|
|
3802
|
+
const contentWrapperRef = React__namespace.useRef(null);
|
|
3803
|
+
const {
|
|
3804
|
+
computeThumbPosition
|
|
3805
|
+
} = ScrollAreaViewport.useScrollAreaViewportContext();
|
|
3806
|
+
const {
|
|
3807
|
+
viewportState
|
|
3808
|
+
} = ScrollAreaViewport.useScrollAreaRootContext();
|
|
3809
|
+
useValueChanged.useIsoLayoutEffect(() => {
|
|
3810
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
3811
|
+
return undefined;
|
|
3812
|
+
}
|
|
3813
|
+
let hasInitialized = false;
|
|
3814
|
+
const ro = new ResizeObserver(() => {
|
|
3815
|
+
// ResizeObserver fires once upon observing, so we skip the initial call
|
|
3816
|
+
// to avoid double-calculating the thumb position on mount.
|
|
3817
|
+
if (!hasInitialized) {
|
|
3818
|
+
hasInitialized = true;
|
|
3819
|
+
return;
|
|
3820
|
+
}
|
|
3821
|
+
computeThumbPosition();
|
|
3822
|
+
});
|
|
3823
|
+
if (contentWrapperRef.current) {
|
|
3824
|
+
ro.observe(contentWrapperRef.current);
|
|
3825
|
+
}
|
|
3826
|
+
return () => {
|
|
3827
|
+
ro.disconnect();
|
|
3828
|
+
};
|
|
3829
|
+
}, [computeThumbPosition]);
|
|
3830
|
+
const element = useRenderElement.useRenderElement('div', componentProps, {
|
|
3831
|
+
ref: [forwardedRef, contentWrapperRef],
|
|
3832
|
+
state: viewportState,
|
|
3833
|
+
stateAttributesMapping: ScrollAreaViewport.scrollAreaStateAttributesMapping,
|
|
3834
|
+
props: [{
|
|
3835
|
+
role: 'presentation',
|
|
3836
|
+
style: {
|
|
3837
|
+
minWidth: 'fit-content'
|
|
3838
|
+
}
|
|
3839
|
+
}, elementProps]
|
|
3840
|
+
});
|
|
3841
|
+
return element;
|
|
3842
|
+
});
|
|
3843
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaContent.displayName = "ScrollAreaContent";
|
|
3844
|
+
|
|
3845
|
+
/**
|
|
3846
|
+
* The draggable part of the scrollbar that indicates the current scroll position.
|
|
3847
|
+
* Renders a `<div>` element.
|
|
3848
|
+
*
|
|
3849
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3850
|
+
*/
|
|
3851
|
+
const ScrollAreaThumb = /*#__PURE__*/React__namespace.forwardRef(function ScrollAreaThumb(componentProps, forwardedRef) {
|
|
3852
|
+
const {
|
|
3853
|
+
render,
|
|
3854
|
+
className,
|
|
3855
|
+
...elementProps
|
|
3856
|
+
} = componentProps;
|
|
3857
|
+
const {
|
|
3858
|
+
thumbYRef,
|
|
3859
|
+
thumbXRef,
|
|
3860
|
+
handlePointerDown,
|
|
3861
|
+
handlePointerMove,
|
|
3862
|
+
handlePointerUp,
|
|
3863
|
+
setScrollingX,
|
|
3864
|
+
setScrollingY,
|
|
3865
|
+
hasMeasuredScrollbar
|
|
3866
|
+
} = ScrollAreaViewport.useScrollAreaRootContext();
|
|
3867
|
+
const {
|
|
3868
|
+
orientation
|
|
3869
|
+
} = useScrollAreaScrollbarContext();
|
|
3870
|
+
const state = {
|
|
3871
|
+
orientation
|
|
3872
|
+
};
|
|
3873
|
+
const element = useRenderElement.useRenderElement('div', componentProps, {
|
|
3874
|
+
ref: [forwardedRef, orientation === 'vertical' ? thumbYRef : thumbXRef],
|
|
3875
|
+
state,
|
|
3876
|
+
props: [{
|
|
3877
|
+
onPointerDown: handlePointerDown,
|
|
3878
|
+
onPointerMove: handlePointerMove,
|
|
3879
|
+
onPointerUp(event) {
|
|
3880
|
+
if (orientation === 'vertical') {
|
|
3881
|
+
setScrollingY(false);
|
|
3882
|
+
}
|
|
3883
|
+
if (orientation === 'horizontal') {
|
|
3884
|
+
setScrollingX(false);
|
|
3885
|
+
}
|
|
3886
|
+
handlePointerUp(event);
|
|
3887
|
+
},
|
|
3888
|
+
style: {
|
|
3889
|
+
visibility: hasMeasuredScrollbar ? undefined : 'hidden',
|
|
3890
|
+
...(orientation === 'vertical' && {
|
|
3891
|
+
height: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbHeight})`
|
|
3892
|
+
}),
|
|
3893
|
+
...(orientation === 'horizontal' && {
|
|
3894
|
+
width: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbWidth})`
|
|
3895
|
+
})
|
|
3896
|
+
}
|
|
3897
|
+
}, elementProps]
|
|
3898
|
+
});
|
|
3899
|
+
return element;
|
|
3900
|
+
});
|
|
3901
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaThumb.displayName = "ScrollAreaThumb";
|
|
3902
|
+
|
|
3903
|
+
/**
|
|
3904
|
+
* A small rectangular area that appears at the intersection of horizontal and vertical scrollbars.
|
|
3905
|
+
* Renders a `<div>` element.
|
|
3906
|
+
*
|
|
3907
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3908
|
+
*/
|
|
3909
|
+
const ScrollAreaCorner = /*#__PURE__*/React__namespace.forwardRef(function ScrollAreaCorner(componentProps, forwardedRef) {
|
|
3910
|
+
const {
|
|
3911
|
+
render,
|
|
3912
|
+
className,
|
|
3913
|
+
...elementProps
|
|
3914
|
+
} = componentProps;
|
|
3915
|
+
const {
|
|
3916
|
+
cornerRef,
|
|
3917
|
+
cornerSize,
|
|
3918
|
+
hiddenState
|
|
3919
|
+
} = ScrollAreaViewport.useScrollAreaRootContext();
|
|
3920
|
+
const element = useRenderElement.useRenderElement('div', componentProps, {
|
|
3921
|
+
ref: [forwardedRef, cornerRef],
|
|
3922
|
+
props: [{
|
|
3923
|
+
style: {
|
|
3924
|
+
position: 'absolute',
|
|
3925
|
+
bottom: 0,
|
|
3926
|
+
insetInlineEnd: 0,
|
|
3927
|
+
width: cornerSize.width,
|
|
3928
|
+
height: cornerSize.height
|
|
3929
|
+
}
|
|
3930
|
+
}, elementProps]
|
|
3931
|
+
});
|
|
3932
|
+
if (hiddenState.corner) {
|
|
3933
|
+
return null;
|
|
3934
|
+
}
|
|
3935
|
+
return element;
|
|
3936
|
+
});
|
|
3937
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaCorner.displayName = "ScrollAreaCorner";
|
|
3938
|
+
|
|
3939
|
+
var index_parts$2 = /*#__PURE__*/Object.freeze({
|
|
3940
|
+
__proto__: null,
|
|
3941
|
+
Content: ScrollAreaContent,
|
|
3942
|
+
Corner: ScrollAreaCorner,
|
|
3943
|
+
Root: ScrollAreaViewport.ScrollAreaRoot,
|
|
3944
|
+
Scrollbar: ScrollAreaScrollbar,
|
|
3945
|
+
Thumb: ScrollAreaThumb,
|
|
3946
|
+
Viewport: ScrollAreaViewport.ScrollAreaViewport
|
|
3947
|
+
});
|
|
3948
|
+
|
|
3582
3949
|
const ComboboxRootContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
3583
3950
|
if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
|
|
3584
3951
|
const ComboboxFloatingContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
@@ -3766,16 +4133,16 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
|
|
|
3766
4133
|
}
|
|
3767
4134
|
|
|
3768
4135
|
const selectors = {
|
|
3769
|
-
id:
|
|
3770
|
-
labelId:
|
|
3771
|
-
query:
|
|
3772
|
-
items:
|
|
3773
|
-
selectedValue:
|
|
3774
|
-
hasSelectionChips:
|
|
4136
|
+
id: ScrollAreaViewport.createSelector(state => state.id),
|
|
4137
|
+
labelId: ScrollAreaViewport.createSelector(state => state.labelId),
|
|
4138
|
+
query: ScrollAreaViewport.createSelector(state => state.query),
|
|
4139
|
+
items: ScrollAreaViewport.createSelector(state => state.items),
|
|
4140
|
+
selectedValue: ScrollAreaViewport.createSelector(state => state.selectedValue),
|
|
4141
|
+
hasSelectionChips: ScrollAreaViewport.createSelector(state => {
|
|
3775
4142
|
const selectedValue = state.selectedValue;
|
|
3776
4143
|
return Array.isArray(selectedValue) && selectedValue.length > 0;
|
|
3777
4144
|
}),
|
|
3778
|
-
hasSelectedValue:
|
|
4145
|
+
hasSelectedValue: ScrollAreaViewport.createSelector(state => {
|
|
3779
4146
|
const {
|
|
3780
4147
|
selectedValue,
|
|
3781
4148
|
selectionMode
|
|
@@ -3788,17 +4155,17 @@ const selectors = {
|
|
|
3788
4155
|
}
|
|
3789
4156
|
return true;
|
|
3790
4157
|
}),
|
|
3791
|
-
hasNullItemLabel:
|
|
4158
|
+
hasNullItemLabel: ScrollAreaViewport.createSelector((state, enabled) => {
|
|
3792
4159
|
return enabled ? hasNullItemLabel(state.items) : false;
|
|
3793
4160
|
}),
|
|
3794
|
-
open:
|
|
3795
|
-
mounted:
|
|
3796
|
-
forceMounted:
|
|
3797
|
-
inline:
|
|
3798
|
-
activeIndex:
|
|
3799
|
-
selectedIndex:
|
|
3800
|
-
isActive:
|
|
3801
|
-
isSelected:
|
|
4161
|
+
open: ScrollAreaViewport.createSelector(state => state.open),
|
|
4162
|
+
mounted: ScrollAreaViewport.createSelector(state => state.mounted),
|
|
4163
|
+
forceMounted: ScrollAreaViewport.createSelector(state => state.forceMounted),
|
|
4164
|
+
inline: ScrollAreaViewport.createSelector(state => state.inline),
|
|
4165
|
+
activeIndex: ScrollAreaViewport.createSelector(state => state.activeIndex),
|
|
4166
|
+
selectedIndex: ScrollAreaViewport.createSelector(state => state.selectedIndex),
|
|
4167
|
+
isActive: ScrollAreaViewport.createSelector((state, index) => state.activeIndex === index),
|
|
4168
|
+
isSelected: ScrollAreaViewport.createSelector((state, itemValue) => {
|
|
3802
4169
|
const comparer = state.isItemEqualToValue;
|
|
3803
4170
|
const selectedValue = state.selectedValue;
|
|
3804
4171
|
if (Array.isArray(selectedValue)) {
|
|
@@ -3806,44 +4173,44 @@ const selectors = {
|
|
|
3806
4173
|
}
|
|
3807
4174
|
return compareItemEquality(itemValue, selectedValue, comparer);
|
|
3808
4175
|
}),
|
|
3809
|
-
transitionStatus:
|
|
3810
|
-
popupProps:
|
|
3811
|
-
inputProps:
|
|
3812
|
-
triggerProps:
|
|
3813
|
-
getItemProps:
|
|
3814
|
-
positionerElement:
|
|
3815
|
-
listElement:
|
|
3816
|
-
triggerElement:
|
|
3817
|
-
inputElement:
|
|
3818
|
-
inputGroupElement:
|
|
3819
|
-
popupSide:
|
|
3820
|
-
openMethod:
|
|
3821
|
-
inputInsidePopup:
|
|
3822
|
-
selectionMode:
|
|
3823
|
-
listRef:
|
|
3824
|
-
labelsRef:
|
|
3825
|
-
popupRef:
|
|
3826
|
-
emptyRef:
|
|
3827
|
-
inputRef:
|
|
3828
|
-
keyboardActiveRef:
|
|
3829
|
-
chipsContainerRef:
|
|
3830
|
-
clearRef:
|
|
3831
|
-
valuesRef:
|
|
3832
|
-
allValuesRef:
|
|
3833
|
-
name:
|
|
3834
|
-
disabled:
|
|
3835
|
-
readOnly:
|
|
3836
|
-
required:
|
|
3837
|
-
grid:
|
|
3838
|
-
isGrouped:
|
|
3839
|
-
virtualized:
|
|
3840
|
-
onOpenChangeComplete:
|
|
3841
|
-
openOnInputClick:
|
|
3842
|
-
itemToStringLabel:
|
|
3843
|
-
isItemEqualToValue:
|
|
3844
|
-
modal:
|
|
3845
|
-
autoHighlight:
|
|
3846
|
-
submitOnItemClick:
|
|
4176
|
+
transitionStatus: ScrollAreaViewport.createSelector(state => state.transitionStatus),
|
|
4177
|
+
popupProps: ScrollAreaViewport.createSelector(state => state.popupProps),
|
|
4178
|
+
inputProps: ScrollAreaViewport.createSelector(state => state.inputProps),
|
|
4179
|
+
triggerProps: ScrollAreaViewport.createSelector(state => state.triggerProps),
|
|
4180
|
+
getItemProps: ScrollAreaViewport.createSelector(state => state.getItemProps),
|
|
4181
|
+
positionerElement: ScrollAreaViewport.createSelector(state => state.positionerElement),
|
|
4182
|
+
listElement: ScrollAreaViewport.createSelector(state => state.listElement),
|
|
4183
|
+
triggerElement: ScrollAreaViewport.createSelector(state => state.triggerElement),
|
|
4184
|
+
inputElement: ScrollAreaViewport.createSelector(state => state.inputElement),
|
|
4185
|
+
inputGroupElement: ScrollAreaViewport.createSelector(state => state.inputGroupElement),
|
|
4186
|
+
popupSide: ScrollAreaViewport.createSelector(state => state.popupSide),
|
|
4187
|
+
openMethod: ScrollAreaViewport.createSelector(state => state.openMethod),
|
|
4188
|
+
inputInsidePopup: ScrollAreaViewport.createSelector(state => state.inputInsidePopup),
|
|
4189
|
+
selectionMode: ScrollAreaViewport.createSelector(state => state.selectionMode),
|
|
4190
|
+
listRef: ScrollAreaViewport.createSelector(state => state.listRef),
|
|
4191
|
+
labelsRef: ScrollAreaViewport.createSelector(state => state.labelsRef),
|
|
4192
|
+
popupRef: ScrollAreaViewport.createSelector(state => state.popupRef),
|
|
4193
|
+
emptyRef: ScrollAreaViewport.createSelector(state => state.emptyRef),
|
|
4194
|
+
inputRef: ScrollAreaViewport.createSelector(state => state.inputRef),
|
|
4195
|
+
keyboardActiveRef: ScrollAreaViewport.createSelector(state => state.keyboardActiveRef),
|
|
4196
|
+
chipsContainerRef: ScrollAreaViewport.createSelector(state => state.chipsContainerRef),
|
|
4197
|
+
clearRef: ScrollAreaViewport.createSelector(state => state.clearRef),
|
|
4198
|
+
valuesRef: ScrollAreaViewport.createSelector(state => state.valuesRef),
|
|
4199
|
+
allValuesRef: ScrollAreaViewport.createSelector(state => state.allValuesRef),
|
|
4200
|
+
name: ScrollAreaViewport.createSelector(state => state.name),
|
|
4201
|
+
disabled: ScrollAreaViewport.createSelector(state => state.disabled),
|
|
4202
|
+
readOnly: ScrollAreaViewport.createSelector(state => state.readOnly),
|
|
4203
|
+
required: ScrollAreaViewport.createSelector(state => state.required),
|
|
4204
|
+
grid: ScrollAreaViewport.createSelector(state => state.grid),
|
|
4205
|
+
isGrouped: ScrollAreaViewport.createSelector(state => state.isGrouped),
|
|
4206
|
+
virtualized: ScrollAreaViewport.createSelector(state => state.virtualized),
|
|
4207
|
+
onOpenChangeComplete: ScrollAreaViewport.createSelector(state => state.onOpenChangeComplete),
|
|
4208
|
+
openOnInputClick: ScrollAreaViewport.createSelector(state => state.openOnInputClick),
|
|
4209
|
+
itemToStringLabel: ScrollAreaViewport.createSelector(state => state.itemToStringLabel),
|
|
4210
|
+
isItemEqualToValue: ScrollAreaViewport.createSelector(state => state.isItemEqualToValue),
|
|
4211
|
+
modal: ScrollAreaViewport.createSelector(state => state.modal),
|
|
4212
|
+
autoHighlight: ScrollAreaViewport.createSelector(state => state.autoHighlight),
|
|
4213
|
+
submitOnItemClick: ScrollAreaViewport.createSelector(state => state.submitOnItemClick)
|
|
3847
4214
|
};
|
|
3848
4215
|
|
|
3849
4216
|
/**
|
|
@@ -4191,7 +4558,7 @@ function AriaCombobox(props) {
|
|
|
4191
4558
|
}
|
|
4192
4559
|
return filteredItems;
|
|
4193
4560
|
}, [filteredItems, isGrouped]);
|
|
4194
|
-
const store = useRenderElement.useRefWithInit(() => new
|
|
4561
|
+
const store = useRenderElement.useRefWithInit(() => new ScrollAreaViewport.Store({
|
|
4195
4562
|
id,
|
|
4196
4563
|
labelId: undefined,
|
|
4197
4564
|
selectedValue,
|
|
@@ -4268,15 +4635,15 @@ function AriaCombobox(props) {
|
|
|
4268
4635
|
}, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]);
|
|
4269
4636
|
const onItemHighlighted = useValueChanged.useStableCallback(onItemHighlightedProp);
|
|
4270
4637
|
const onOpenChangeComplete = useValueChanged.useStableCallback(onOpenChangeCompleteProp);
|
|
4271
|
-
const activeIndex =
|
|
4272
|
-
const selectedIndex =
|
|
4273
|
-
const positionerElement =
|
|
4274
|
-
const listElement =
|
|
4275
|
-
const triggerElement =
|
|
4276
|
-
const inputElement =
|
|
4277
|
-
const inputGroupElement =
|
|
4278
|
-
const inline =
|
|
4279
|
-
const inputInsidePopup =
|
|
4638
|
+
const activeIndex = ScrollAreaViewport.useStore(store, selectors.activeIndex);
|
|
4639
|
+
const selectedIndex = ScrollAreaViewport.useStore(store, selectors.selectedIndex);
|
|
4640
|
+
const positionerElement = ScrollAreaViewport.useStore(store, selectors.positionerElement);
|
|
4641
|
+
const listElement = ScrollAreaViewport.useStore(store, selectors.listElement);
|
|
4642
|
+
const triggerElement = ScrollAreaViewport.useStore(store, selectors.triggerElement);
|
|
4643
|
+
const inputElement = ScrollAreaViewport.useStore(store, selectors.inputElement);
|
|
4644
|
+
const inputGroupElement = ScrollAreaViewport.useStore(store, selectors.inputGroupElement);
|
|
4645
|
+
const inline = ScrollAreaViewport.useStore(store, selectors.inline);
|
|
4646
|
+
const inputInsidePopup = ScrollAreaViewport.useStore(store, selectors.inputInsidePopup);
|
|
4280
4647
|
const triggerRef = useValueChanged.useValueAsRef(triggerElement);
|
|
4281
4648
|
const {
|
|
4282
4649
|
mounted,
|
|
@@ -4286,7 +4653,7 @@ function AriaCombobox(props) {
|
|
|
4286
4653
|
const {
|
|
4287
4654
|
openMethod,
|
|
4288
4655
|
triggerProps
|
|
4289
|
-
} =
|
|
4656
|
+
} = ScrollAreaViewport.useOpenInteractionType(open);
|
|
4290
4657
|
NumberFieldInput.useField({
|
|
4291
4658
|
id,
|
|
4292
4659
|
name,
|
|
@@ -4438,7 +4805,7 @@ function AriaCombobox(props) {
|
|
|
4438
4805
|
}
|
|
4439
4806
|
itemValue = valuesRef.current[activeIndex];
|
|
4440
4807
|
}
|
|
4441
|
-
const targetEl =
|
|
4808
|
+
const targetEl = ScrollAreaViewport.getTarget(event);
|
|
4442
4809
|
const overrideEvent = selectionEventRef.current ?? event;
|
|
4443
4810
|
selectionEventRef.current = null;
|
|
4444
4811
|
const eventDetails = useValueChanged.createChangeEventDetails(useValueChanged.itemPress, overrideEvent);
|
|
@@ -4727,7 +5094,7 @@ function AriaCombobox(props) {
|
|
|
4727
5094
|
}
|
|
4728
5095
|
};
|
|
4729
5096
|
}, [inputElement, open, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete]);
|
|
4730
|
-
const click =
|
|
5097
|
+
const click = ScrollAreaViewport.useClick(floatingRootContext, {
|
|
4731
5098
|
enabled: !readOnly && !disabled && openOnInputClick,
|
|
4732
5099
|
event: 'mousedown-only',
|
|
4733
5100
|
toggle: false,
|
|
@@ -4736,7 +5103,7 @@ function AriaCombobox(props) {
|
|
|
4736
5103
|
touchOpenDelay: inputInsidePopup ? 0 : 50,
|
|
4737
5104
|
reason: useValueChanged.inputPress
|
|
4738
5105
|
});
|
|
4739
|
-
const dismiss =
|
|
5106
|
+
const dismiss = ScrollAreaViewport.useDismiss(floatingRootContext, {
|
|
4740
5107
|
enabled: !readOnly && !disabled && !inline,
|
|
4741
5108
|
outsidePressEvent: {
|
|
4742
5109
|
mouse: 'sloppy',
|
|
@@ -4748,8 +5115,8 @@ function AriaCombobox(props) {
|
|
|
4748
5115
|
// Without a popup, let the Escape key bubble the event up to other popups' handlers.
|
|
4749
5116
|
bubbles: inline ? true : undefined,
|
|
4750
5117
|
outsidePress(event) {
|
|
4751
|
-
const target =
|
|
4752
|
-
return !
|
|
5118
|
+
const target = ScrollAreaViewport.getTarget(event);
|
|
5119
|
+
return !ScrollAreaViewport.contains(triggerElement, target) && !ScrollAreaViewport.contains(clearRef.current, target) && !ScrollAreaViewport.contains(chipsContainerRef.current, target) && !ScrollAreaViewport.contains(inputGroupElement, target);
|
|
4753
5120
|
}
|
|
4754
5121
|
});
|
|
4755
5122
|
const listNavigation = MenuSubmenuTrigger.useListNavigation(floatingRootContext, {
|
|
@@ -4792,8 +5159,8 @@ function AriaCombobox(props) {
|
|
|
4792
5159
|
getReferenceProps,
|
|
4793
5160
|
getFloatingProps,
|
|
4794
5161
|
getItemProps
|
|
4795
|
-
} =
|
|
4796
|
-
|
|
5162
|
+
} = ScrollAreaViewport.useInteractions([role, click, dismiss, listNavigation]);
|
|
5163
|
+
ScrollAreaViewport.useOnFirstRender(() => {
|
|
4797
5164
|
store.update({
|
|
4798
5165
|
inline: inlineProp,
|
|
4799
5166
|
popupProps: getFloatingProps(),
|
|
@@ -4955,7 +5322,7 @@ function AriaCombobox(props) {
|
|
|
4955
5322
|
}
|
|
4956
5323
|
|
|
4957
5324
|
const triggerStateAttributesMapping = {
|
|
4958
|
-
...
|
|
5325
|
+
...ScrollAreaViewport.pressableTriggerOpenStateMapping,
|
|
4959
5326
|
...NumberFieldInput.fieldValidityMapping,
|
|
4960
5327
|
popupSide: side => side ? {
|
|
4961
5328
|
'data-popup-side': side
|
|
@@ -5002,24 +5369,24 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
|
|
|
5002
5369
|
const {
|
|
5003
5370
|
filteredItems
|
|
5004
5371
|
} = useComboboxDerivedItemsContext();
|
|
5005
|
-
const selectionMode =
|
|
5006
|
-
const comboboxDisabled =
|
|
5007
|
-
const readOnly =
|
|
5008
|
-
const required =
|
|
5009
|
-
const mounted =
|
|
5010
|
-
const popupSideValue =
|
|
5011
|
-
const positionerElement =
|
|
5012
|
-
const listElement =
|
|
5013
|
-
const triggerProps =
|
|
5014
|
-
const triggerElement =
|
|
5015
|
-
const inputInsidePopup =
|
|
5016
|
-
const rootId =
|
|
5017
|
-
const comboboxLabelId =
|
|
5018
|
-
const open =
|
|
5019
|
-
const selectedValue =
|
|
5020
|
-
const activeIndex =
|
|
5021
|
-
const selectedIndex =
|
|
5022
|
-
const hasSelectedValue =
|
|
5372
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
5373
|
+
const comboboxDisabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
5374
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
5375
|
+
const required = ScrollAreaViewport.useStore(store, selectors.required);
|
|
5376
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
5377
|
+
const popupSideValue = ScrollAreaViewport.useStore(store, selectors.popupSide);
|
|
5378
|
+
const positionerElement = ScrollAreaViewport.useStore(store, selectors.positionerElement);
|
|
5379
|
+
const listElement = ScrollAreaViewport.useStore(store, selectors.listElement);
|
|
5380
|
+
const triggerProps = ScrollAreaViewport.useStore(store, selectors.triggerProps);
|
|
5381
|
+
const triggerElement = ScrollAreaViewport.useStore(store, selectors.triggerElement);
|
|
5382
|
+
const inputInsidePopup = ScrollAreaViewport.useStore(store, selectors.inputInsidePopup);
|
|
5383
|
+
const rootId = ScrollAreaViewport.useStore(store, selectors.id);
|
|
5384
|
+
const comboboxLabelId = ScrollAreaViewport.useStore(store, selectors.labelId);
|
|
5385
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
5386
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
5387
|
+
const activeIndex = ScrollAreaViewport.useStore(store, selectors.activeIndex);
|
|
5388
|
+
const selectedIndex = ScrollAreaViewport.useStore(store, selectors.selectedIndex);
|
|
5389
|
+
const hasSelectedValue = ScrollAreaViewport.useStore(store, selectors.hasSelectedValue);
|
|
5023
5390
|
const floatingRootContext = useComboboxFloatingContext();
|
|
5024
5391
|
const inputValue = useComboboxInputValueContext();
|
|
5025
5392
|
const focusTimeout = useValueChanged.useTimeout();
|
|
@@ -5063,14 +5430,14 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
|
|
|
5063
5430
|
});
|
|
5064
5431
|
const {
|
|
5065
5432
|
reference: triggerClickProps
|
|
5066
|
-
} =
|
|
5433
|
+
} = ScrollAreaViewport.useClick(floatingRootContext, {
|
|
5067
5434
|
enabled: !readOnly && !comboboxDisabled,
|
|
5068
5435
|
event: 'mousedown'
|
|
5069
5436
|
});
|
|
5070
5437
|
const {
|
|
5071
5438
|
buttonRef,
|
|
5072
5439
|
getButtonProps
|
|
5073
|
-
} =
|
|
5440
|
+
} = useValueChanged.useButton({
|
|
5074
5441
|
native: nativeButton,
|
|
5075
5442
|
disabled
|
|
5076
5443
|
});
|
|
@@ -5108,7 +5475,7 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
|
|
|
5108
5475
|
},
|
|
5109
5476
|
onBlur(event) {
|
|
5110
5477
|
// If focus is moving into the popup, don't count it as a blur.
|
|
5111
|
-
if (
|
|
5478
|
+
if (ScrollAreaViewport.contains(positionerElement, event.relatedTarget)) {
|
|
5112
5479
|
return;
|
|
5113
5480
|
}
|
|
5114
5481
|
setTouched(true);
|
|
@@ -5142,10 +5509,10 @@ const ComboboxTrigger = /*#__PURE__*/React__namespace.forwardRef(function Combob
|
|
|
5142
5509
|
if (!triggerElement) {
|
|
5143
5510
|
return;
|
|
5144
5511
|
}
|
|
5145
|
-
const mouseUpTarget =
|
|
5512
|
+
const mouseUpTarget = ScrollAreaViewport.getTarget(mouseEvent);
|
|
5146
5513
|
const positioner = store.state.positionerElement;
|
|
5147
5514
|
const list = store.state.listElement;
|
|
5148
|
-
if (
|
|
5515
|
+
if (ScrollAreaViewport.contains(triggerElement, mouseUpTarget) || ScrollAreaViewport.contains(positioner, mouseUpTarget) || ScrollAreaViewport.contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) {
|
|
5149
5516
|
return;
|
|
5150
5517
|
}
|
|
5151
5518
|
const bounds = MenuSubmenuTrigger.getPseudoElementBounds(triggerElement);
|
|
@@ -5203,7 +5570,7 @@ const ComboboxInternalDismissButton = /*#__PURE__*/React__namespace.forwardRef(f
|
|
|
5203
5570
|
const {
|
|
5204
5571
|
buttonRef,
|
|
5205
5572
|
getButtonProps
|
|
5206
|
-
} =
|
|
5573
|
+
} = useValueChanged.useButton({
|
|
5207
5574
|
native: false
|
|
5208
5575
|
});
|
|
5209
5576
|
const mergedRef = useRenderElement.useMergedRefs(forwardedRef, buttonRef);
|
|
@@ -5252,30 +5619,30 @@ const ComboboxInput = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
5252
5619
|
// `inputValue` can't be placed in the store.
|
|
5253
5620
|
// https://github.com/mui/base-ui/issues/2703
|
|
5254
5621
|
const inputValue = useComboboxInputValueContext();
|
|
5255
|
-
const direction =
|
|
5256
|
-
const required =
|
|
5257
|
-
const comboboxDisabled =
|
|
5258
|
-
const readOnly =
|
|
5259
|
-
const name =
|
|
5260
|
-
const selectionMode =
|
|
5261
|
-
const autoHighlightMode =
|
|
5262
|
-
const inputProps =
|
|
5263
|
-
const triggerProps =
|
|
5264
|
-
const open =
|
|
5265
|
-
const mounted =
|
|
5266
|
-
const selectedValue =
|
|
5267
|
-
const popupSideValue =
|
|
5268
|
-
const positionerElement =
|
|
5269
|
-
const rootId =
|
|
5270
|
-
const inline =
|
|
5271
|
-
const modal =
|
|
5622
|
+
const direction = ScrollAreaViewport.useDirection();
|
|
5623
|
+
const required = ScrollAreaViewport.useStore(store, selectors.required);
|
|
5624
|
+
const comboboxDisabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
5625
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
5626
|
+
const name = ScrollAreaViewport.useStore(store, selectors.name);
|
|
5627
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
5628
|
+
const autoHighlightMode = ScrollAreaViewport.useStore(store, selectors.autoHighlight);
|
|
5629
|
+
const inputProps = ScrollAreaViewport.useStore(store, selectors.inputProps);
|
|
5630
|
+
const triggerProps = ScrollAreaViewport.useStore(store, selectors.triggerProps);
|
|
5631
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
5632
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
5633
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
5634
|
+
const popupSideValue = ScrollAreaViewport.useStore(store, selectors.popupSide);
|
|
5635
|
+
const positionerElement = ScrollAreaViewport.useStore(store, selectors.positionerElement);
|
|
5636
|
+
const rootId = ScrollAreaViewport.useStore(store, selectors.id);
|
|
5637
|
+
const inline = ScrollAreaViewport.useStore(store, selectors.inline);
|
|
5638
|
+
const modal = ScrollAreaViewport.useStore(store, selectors.modal);
|
|
5272
5639
|
const autoHighlightEnabled = Boolean(autoHighlightMode);
|
|
5273
5640
|
const popupSide = mounted && positionerElement ? popupSideValue : null;
|
|
5274
5641
|
const disabled = fieldDisabled || comboboxDisabled || disabledProp;
|
|
5275
5642
|
const listEmpty = filteredItems.length === 0;
|
|
5276
5643
|
const isInsidePopup = hasPositionerParent || inline;
|
|
5277
5644
|
const focusManagerModal = !isInsidePopup || modal;
|
|
5278
|
-
const id =
|
|
5645
|
+
const id = useValueChanged.useBaseUiId(idProp ?? (!isInsidePopup ? rootId : undefined));
|
|
5279
5646
|
const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, undefined);
|
|
5280
5647
|
const fieldStateForInput = hasPositionerParent ? NumberFieldInput.DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
|
|
5281
5648
|
const [composingValue, setComposingValue] = React__namespace.useState(null);
|
|
@@ -5612,14 +5979,14 @@ const ComboboxInputGroup = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
5612
5979
|
const {
|
|
5613
5980
|
filteredItems
|
|
5614
5981
|
} = useComboboxDerivedItemsContext();
|
|
5615
|
-
const open =
|
|
5616
|
-
const mounted =
|
|
5617
|
-
const popupSideValue =
|
|
5618
|
-
const positionerElement =
|
|
5619
|
-
const comboboxDisabled =
|
|
5620
|
-
const readOnly =
|
|
5621
|
-
const hasSelectedValue =
|
|
5622
|
-
const selectionMode =
|
|
5982
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
5983
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
5984
|
+
const popupSideValue = ScrollAreaViewport.useStore(store, selectors.popupSide);
|
|
5985
|
+
const positionerElement = ScrollAreaViewport.useStore(store, selectors.positionerElement);
|
|
5986
|
+
const comboboxDisabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
5987
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
5988
|
+
const hasSelectedValue = ScrollAreaViewport.useStore(store, selectors.hasSelectedValue);
|
|
5989
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
5623
5990
|
const popupSide = mounted && positionerElement ? popupSideValue : null;
|
|
5624
5991
|
const disabled = fieldDisabled || comboboxDisabled;
|
|
5625
5992
|
const listEmpty = filteredItems.length === 0;
|
|
@@ -5670,7 +6037,7 @@ if (process.env.NODE_ENV !== "production") ComboboxIcon.displayName = "ComboboxI
|
|
|
5670
6037
|
|
|
5671
6038
|
const stateAttributesMapping$2 = {
|
|
5672
6039
|
...useValueChanged.transitionStatusMapping,
|
|
5673
|
-
...
|
|
6040
|
+
...ScrollAreaViewport.triggerOpenStateMapping
|
|
5674
6041
|
};
|
|
5675
6042
|
|
|
5676
6043
|
/**
|
|
@@ -5690,12 +6057,12 @@ const ComboboxClear = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
5690
6057
|
disabled: fieldDisabled
|
|
5691
6058
|
} = NumberFieldInput.useFieldRootContext();
|
|
5692
6059
|
const store = useComboboxRootContext();
|
|
5693
|
-
const selectionMode =
|
|
5694
|
-
const comboboxDisabled =
|
|
5695
|
-
const readOnly =
|
|
5696
|
-
const open =
|
|
5697
|
-
const selectedValue =
|
|
5698
|
-
const hasSelectionChips =
|
|
6060
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
6061
|
+
const comboboxDisabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
6062
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
6063
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6064
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
6065
|
+
const hasSelectionChips = ScrollAreaViewport.useStore(store, selectors.hasSelectionChips);
|
|
5699
6066
|
const inputValue = useComboboxInputValueContext();
|
|
5700
6067
|
let visible = false;
|
|
5701
6068
|
if (selectionMode === 'none') {
|
|
@@ -5709,7 +6076,7 @@ const ComboboxClear = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
5709
6076
|
const {
|
|
5710
6077
|
buttonRef,
|
|
5711
6078
|
getButtonProps
|
|
5712
|
-
} =
|
|
6079
|
+
} = useValueChanged.useButton({
|
|
5713
6080
|
native: nativeButton,
|
|
5714
6081
|
disabled
|
|
5715
6082
|
});
|
|
@@ -5824,15 +6191,15 @@ const ComboboxList = /*#__PURE__*/React__namespace.forwardRef(function ComboboxL
|
|
|
5824
6191
|
const {
|
|
5825
6192
|
filteredItems
|
|
5826
6193
|
} = useComboboxDerivedItemsContext();
|
|
5827
|
-
const items =
|
|
5828
|
-
const labelsRef =
|
|
5829
|
-
const listRef =
|
|
5830
|
-
const selectionMode =
|
|
5831
|
-
const grid =
|
|
5832
|
-
const popupProps =
|
|
5833
|
-
const disabled =
|
|
5834
|
-
const readOnly =
|
|
5835
|
-
const virtualized =
|
|
6194
|
+
const items = ScrollAreaViewport.useStore(store, selectors.items);
|
|
6195
|
+
const labelsRef = ScrollAreaViewport.useStore(store, selectors.labelsRef);
|
|
6196
|
+
const listRef = ScrollAreaViewport.useStore(store, selectors.listRef);
|
|
6197
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
6198
|
+
const grid = ScrollAreaViewport.useStore(store, selectors.grid);
|
|
6199
|
+
const popupProps = ScrollAreaViewport.useStore(store, selectors.popupProps);
|
|
6200
|
+
const disabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
6201
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
6202
|
+
const virtualized = ScrollAreaViewport.useStore(store, selectors.virtualized);
|
|
5836
6203
|
const multiple = selectionMode === 'multiple';
|
|
5837
6204
|
const empty = filteredItems.length === 0;
|
|
5838
6205
|
const setPositionerElement = useValueChanged.useStableCallback(element => {
|
|
@@ -5944,15 +6311,15 @@ const ComboboxPortal = /*#__PURE__*/React__namespace.forwardRef(function Combobo
|
|
|
5944
6311
|
...portalProps
|
|
5945
6312
|
} = props;
|
|
5946
6313
|
const store = useComboboxRootContext();
|
|
5947
|
-
const mounted =
|
|
5948
|
-
const forceMounted =
|
|
6314
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
6315
|
+
const forceMounted = ScrollAreaViewport.useStore(store, selectors.forceMounted);
|
|
5949
6316
|
const shouldRender = mounted || keepMounted || forceMounted;
|
|
5950
6317
|
if (!shouldRender) {
|
|
5951
6318
|
return null;
|
|
5952
6319
|
}
|
|
5953
6320
|
return /*#__PURE__*/jsxRuntime.jsx(ComboboxPortalContext.Provider, {
|
|
5954
6321
|
value: keepMounted,
|
|
5955
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
6322
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ScrollAreaViewport.FloatingPortal, {
|
|
5956
6323
|
ref: forwardedRef,
|
|
5957
6324
|
...portalProps
|
|
5958
6325
|
})
|
|
@@ -5961,7 +6328,7 @@ const ComboboxPortal = /*#__PURE__*/React__namespace.forwardRef(function Combobo
|
|
|
5961
6328
|
if (process.env.NODE_ENV !== "production") ComboboxPortal.displayName = "ComboboxPortal";
|
|
5962
6329
|
|
|
5963
6330
|
const stateAttributesMapping$1 = {
|
|
5964
|
-
...
|
|
6331
|
+
...ScrollAreaViewport.popupStateMapping,
|
|
5965
6332
|
...useValueChanged.transitionStatusMapping
|
|
5966
6333
|
};
|
|
5967
6334
|
|
|
@@ -5976,9 +6343,9 @@ const ComboboxBackdrop = /*#__PURE__*/React__namespace.forwardRef(function Combo
|
|
|
5976
6343
|
...elementProps
|
|
5977
6344
|
} = componentProps;
|
|
5978
6345
|
const store = useComboboxRootContext();
|
|
5979
|
-
const open =
|
|
5980
|
-
const mounted =
|
|
5981
|
-
const transitionStatus =
|
|
6346
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6347
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
6348
|
+
const transitionStatus = ScrollAreaViewport.useStore(store, selectors.transitionStatus);
|
|
5982
6349
|
const state = {
|
|
5983
6350
|
open,
|
|
5984
6351
|
transitionStatus
|
|
@@ -6014,7 +6381,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6014
6381
|
arrowPadding = 5,
|
|
6015
6382
|
sticky = false,
|
|
6016
6383
|
disableAnchorTracking = false,
|
|
6017
|
-
collisionAvoidance =
|
|
6384
|
+
collisionAvoidance = ScrollAreaViewport.DROPDOWN_COLLISION_AVOIDANCE,
|
|
6018
6385
|
...elementProps
|
|
6019
6386
|
} = componentProps;
|
|
6020
6387
|
const store = useComboboxRootContext();
|
|
@@ -6023,15 +6390,15 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6023
6390
|
} = useComboboxDerivedItemsContext();
|
|
6024
6391
|
const floatingRootContext = useComboboxFloatingContext();
|
|
6025
6392
|
const keepMounted = useComboboxPortalContext();
|
|
6026
|
-
const modal =
|
|
6027
|
-
const open =
|
|
6028
|
-
const mounted =
|
|
6029
|
-
const openMethod =
|
|
6030
|
-
const triggerElement =
|
|
6031
|
-
const inputElement =
|
|
6032
|
-
const inputGroupElement =
|
|
6033
|
-
const inputInsidePopup =
|
|
6034
|
-
const transitionStatus =
|
|
6393
|
+
const modal = ScrollAreaViewport.useStore(store, selectors.modal);
|
|
6394
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6395
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
6396
|
+
const openMethod = ScrollAreaViewport.useStore(store, selectors.openMethod);
|
|
6397
|
+
const triggerElement = ScrollAreaViewport.useStore(store, selectors.triggerElement);
|
|
6398
|
+
const inputElement = ScrollAreaViewport.useStore(store, selectors.inputElement);
|
|
6399
|
+
const inputGroupElement = ScrollAreaViewport.useStore(store, selectors.inputGroupElement);
|
|
6400
|
+
const inputInsidePopup = ScrollAreaViewport.useStore(store, selectors.inputInsidePopup);
|
|
6401
|
+
const transitionStatus = ScrollAreaViewport.useStore(store, selectors.transitionStatus);
|
|
6035
6402
|
const empty = filteredItems.length === 0;
|
|
6036
6403
|
const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement);
|
|
6037
6404
|
const positioning = MenuSubmenuTrigger.useAnchorPositioning({
|
|
@@ -6052,7 +6419,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6052
6419
|
collisionAvoidance,
|
|
6053
6420
|
lazyFlip: true
|
|
6054
6421
|
});
|
|
6055
|
-
|
|
6422
|
+
ScrollAreaViewport.useScrollLock(open && modal && openMethod !== 'touch', triggerElement);
|
|
6056
6423
|
const defaultProps = React__namespace.useMemo(() => {
|
|
6057
6424
|
const style = {
|
|
6058
6425
|
...positioning.positionerStyles
|
|
@@ -6092,12 +6459,12 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6092
6459
|
state,
|
|
6093
6460
|
ref: [forwardedRef, setPositionerElement],
|
|
6094
6461
|
props: [defaultProps, MenuSubmenuTrigger.getDisabledMountTransitionStyles(transitionStatus), elementProps],
|
|
6095
|
-
stateAttributesMapping:
|
|
6462
|
+
stateAttributesMapping: ScrollAreaViewport.popupStateMapping
|
|
6096
6463
|
});
|
|
6097
6464
|
return /*#__PURE__*/jsxRuntime.jsxs(ComboboxPositionerContext.Provider, {
|
|
6098
6465
|
value: contextValue,
|
|
6099
|
-
children: [mounted && modal && /*#__PURE__*/jsxRuntime.jsx(
|
|
6100
|
-
inert:
|
|
6466
|
+
children: [mounted && modal && /*#__PURE__*/jsxRuntime.jsx(ScrollAreaViewport.InternalBackdrop, {
|
|
6467
|
+
inert: ScrollAreaViewport.inertValue(!open),
|
|
6101
6468
|
cutout: inputGroupElement ?? inputElement ?? triggerElement
|
|
6102
6469
|
}), element]
|
|
6103
6470
|
});
|
|
@@ -6105,7 +6472,7 @@ const ComboboxPositioner = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6105
6472
|
if (process.env.NODE_ENV !== "production") ComboboxPositioner.displayName = "ComboboxPositioner";
|
|
6106
6473
|
|
|
6107
6474
|
const stateAttributesMapping = {
|
|
6108
|
-
...
|
|
6475
|
+
...ScrollAreaViewport.popupStateMapping,
|
|
6109
6476
|
...useValueChanged.transitionStatusMapping
|
|
6110
6477
|
};
|
|
6111
6478
|
|
|
@@ -6127,13 +6494,13 @@ const ComboboxPopup = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6127
6494
|
const {
|
|
6128
6495
|
filteredItems
|
|
6129
6496
|
} = useComboboxDerivedItemsContext();
|
|
6130
|
-
const mounted =
|
|
6131
|
-
const open =
|
|
6132
|
-
const openMethod =
|
|
6133
|
-
const transitionStatus =
|
|
6134
|
-
const inputInsidePopup =
|
|
6135
|
-
const inputElement =
|
|
6136
|
-
const modal =
|
|
6497
|
+
const mounted = ScrollAreaViewport.useStore(store, selectors.mounted);
|
|
6498
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6499
|
+
const openMethod = ScrollAreaViewport.useStore(store, selectors.openMethod);
|
|
6500
|
+
const transitionStatus = ScrollAreaViewport.useStore(store, selectors.transitionStatus);
|
|
6501
|
+
const inputInsidePopup = ScrollAreaViewport.useStore(store, selectors.inputInsidePopup);
|
|
6502
|
+
const inputElement = ScrollAreaViewport.useStore(store, selectors.inputElement);
|
|
6503
|
+
const modal = ScrollAreaViewport.useStore(store, selectors.modal);
|
|
6137
6504
|
const empty = filteredItems.length === 0;
|
|
6138
6505
|
useValueChanged.useOpenChangeComplete({
|
|
6139
6506
|
open,
|
|
@@ -6159,8 +6526,8 @@ const ComboboxPopup = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6159
6526
|
role: inputInsidePopup ? 'dialog' : 'presentation',
|
|
6160
6527
|
tabIndex: -1,
|
|
6161
6528
|
onFocus(event) {
|
|
6162
|
-
const target =
|
|
6163
|
-
if (openMethod !== 'touch' && (
|
|
6529
|
+
const target = ScrollAreaViewport.getTarget(event.nativeEvent);
|
|
6530
|
+
if (openMethod !== 'touch' && (ScrollAreaViewport.contains(store.state.listElement, target) || target === event.currentTarget)) {
|
|
6164
6531
|
store.state.inputRef.current?.focus();
|
|
6165
6532
|
}
|
|
6166
6533
|
}
|
|
@@ -6180,7 +6547,7 @@ const ComboboxPopup = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6180
6547
|
resolvedFinalFocus = inputInsidePopup ? undefined : false;
|
|
6181
6548
|
}
|
|
6182
6549
|
const focusManagerModal = !inputInsidePopup || modal;
|
|
6183
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
6550
|
+
return /*#__PURE__*/jsxRuntime.jsx(ScrollAreaViewport.FloatingFocusManager, {
|
|
6184
6551
|
context: floatingRootContext,
|
|
6185
6552
|
disabled: !mounted,
|
|
6186
6553
|
modal: focusManagerModal,
|
|
@@ -6215,7 +6582,7 @@ const ComboboxArrow = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6215
6582
|
arrowUncentered,
|
|
6216
6583
|
arrowStyles
|
|
6217
6584
|
} = useComboboxPositionerContext();
|
|
6218
|
-
const open =
|
|
6585
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6219
6586
|
const state = {
|
|
6220
6587
|
open,
|
|
6221
6588
|
side,
|
|
@@ -6224,7 +6591,7 @@ const ComboboxArrow = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6224
6591
|
};
|
|
6225
6592
|
return useRenderElement.useRenderElement('div', componentProps, {
|
|
6226
6593
|
ref: [arrowRef, forwardedRef],
|
|
6227
|
-
stateAttributesMapping:
|
|
6594
|
+
stateAttributesMapping: ScrollAreaViewport.popupStateMapping,
|
|
6228
6595
|
state,
|
|
6229
6596
|
props: {
|
|
6230
6597
|
style: arrowStyles,
|
|
@@ -6293,7 +6660,7 @@ const ComboboxGroupLabel = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6293
6660
|
const {
|
|
6294
6661
|
setLabelId
|
|
6295
6662
|
} = useComboboxGroupContext();
|
|
6296
|
-
const id =
|
|
6663
|
+
const id = useValueChanged.useBaseUiId(idProp);
|
|
6297
6664
|
useValueChanged.useIsoLayoutEffect(() => {
|
|
6298
6665
|
setLabelId(id);
|
|
6299
6666
|
return () => {
|
|
@@ -6349,18 +6716,18 @@ const ComboboxItem = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__name
|
|
|
6349
6716
|
flatFilteredItems,
|
|
6350
6717
|
hasItems
|
|
6351
6718
|
} = useComboboxDerivedItemsContext();
|
|
6352
|
-
const open =
|
|
6353
|
-
const selectionMode =
|
|
6354
|
-
const readOnly =
|
|
6355
|
-
const virtualized =
|
|
6356
|
-
const isItemEqualToValue =
|
|
6719
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
6720
|
+
const selectionMode = ScrollAreaViewport.useStore(store, selectors.selectionMode);
|
|
6721
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
6722
|
+
const virtualized = ScrollAreaViewport.useStore(store, selectors.virtualized);
|
|
6723
|
+
const isItemEqualToValue = ScrollAreaViewport.useStore(store, selectors.isItemEqualToValue);
|
|
6357
6724
|
const selectable = selectionMode !== 'none';
|
|
6358
6725
|
const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
|
|
6359
6726
|
const hasRegistered = listItem.index !== -1;
|
|
6360
|
-
const rootId =
|
|
6361
|
-
const highlighted =
|
|
6362
|
-
const matchesSelectedValue =
|
|
6363
|
-
const getItemProps =
|
|
6727
|
+
const rootId = ScrollAreaViewport.useStore(store, selectors.id);
|
|
6728
|
+
const highlighted = ScrollAreaViewport.useStore(store, selectors.isActive, index);
|
|
6729
|
+
const matchesSelectedValue = ScrollAreaViewport.useStore(store, selectors.isSelected, itemValue);
|
|
6730
|
+
const getItemProps = ScrollAreaViewport.useStore(store, selectors.getItemProps);
|
|
6364
6731
|
const itemRef = React__namespace.useRef(null);
|
|
6365
6732
|
const id = rootId != null && hasRegistered ? `${rootId}-${index}` : undefined;
|
|
6366
6733
|
const selected = matchesSelectedValue && selectable;
|
|
@@ -6420,7 +6787,7 @@ const ComboboxItem = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__name
|
|
|
6420
6787
|
const {
|
|
6421
6788
|
getButtonProps,
|
|
6422
6789
|
buttonRef
|
|
6423
|
-
} =
|
|
6790
|
+
} = useValueChanged.useButton({
|
|
6424
6791
|
disabled,
|
|
6425
6792
|
focusableWhenDisabled: true,
|
|
6426
6793
|
native: nativeButton,
|
|
@@ -6557,7 +6924,7 @@ function ComboboxRoot(props) {
|
|
|
6557
6924
|
}
|
|
6558
6925
|
|
|
6559
6926
|
function useRegisteredLabelId(idProp, setLabelId) {
|
|
6560
|
-
const id =
|
|
6927
|
+
const id = useValueChanged.useBaseUiId(idProp);
|
|
6561
6928
|
useValueChanged.useIsoLayoutEffect(() => {
|
|
6562
6929
|
setLabelId(id);
|
|
6563
6930
|
return () => {
|
|
@@ -6599,7 +6966,7 @@ function useLabel(params = {}) {
|
|
|
6599
6966
|
}
|
|
6600
6967
|
}
|
|
6601
6968
|
function handleInteraction(event) {
|
|
6602
|
-
const target =
|
|
6969
|
+
const target = ScrollAreaViewport.getTarget(event.nativeEvent);
|
|
6603
6970
|
if (target?.closest('button,input,select,textarea')) {
|
|
6604
6971
|
return;
|
|
6605
6972
|
}
|
|
@@ -6651,10 +7018,10 @@ const ComboboxLabel = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6651
7018
|
delete elementPropsWithoutId.id;
|
|
6652
7019
|
const fieldRootContext = NumberFieldInput.useFieldRootContext();
|
|
6653
7020
|
const store = useComboboxRootContext();
|
|
6654
|
-
const inputInsidePopup =
|
|
6655
|
-
const triggerElement =
|
|
6656
|
-
const inputElement =
|
|
6657
|
-
const rootId =
|
|
7021
|
+
const inputInsidePopup = ScrollAreaViewport.useStore(store, selectors.inputInsidePopup);
|
|
7022
|
+
const triggerElement = ScrollAreaViewport.useStore(store, selectors.triggerElement);
|
|
7023
|
+
const inputElement = ScrollAreaViewport.useStore(store, selectors.inputElement);
|
|
7024
|
+
const rootId = ScrollAreaViewport.useStore(store, selectors.id);
|
|
6658
7025
|
const defaultLabelId = getDefaultLabelId(rootId);
|
|
6659
7026
|
const localControlId = triggerElement?.id ?? (inputInsidePopup ? rootId : undefined);
|
|
6660
7027
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6665,7 +7032,7 @@ const ComboboxLabel = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6665
7032
|
}
|
|
6666
7033
|
const ownerStackMessage = useValueChanged.SafeReact.captureOwnerStack?.() || '';
|
|
6667
7034
|
const message = '<Combobox.Label> labels <Combobox.Trigger> only. ' + 'When <Combobox.Input> is the form control, use a native <label> or <Field.Label> instead.';
|
|
6668
|
-
|
|
7035
|
+
useValueChanged.error(`${message}${ownerStackMessage}`);
|
|
6669
7036
|
}, [inputElement, inputInsidePopup]);
|
|
6670
7037
|
}
|
|
6671
7038
|
const labelProps = useLabel({
|
|
@@ -6690,13 +7057,13 @@ function ComboboxValue(props) {
|
|
|
6690
7057
|
placeholder
|
|
6691
7058
|
} = props;
|
|
6692
7059
|
const store = useComboboxRootContext();
|
|
6693
|
-
const itemToStringLabel =
|
|
6694
|
-
const selectedValue =
|
|
6695
|
-
const items =
|
|
6696
|
-
const multiple =
|
|
6697
|
-
const hasSelectedValue =
|
|
7060
|
+
const itemToStringLabel = ScrollAreaViewport.useStore(store, selectors.itemToStringLabel);
|
|
7061
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
7062
|
+
const items = ScrollAreaViewport.useStore(store, selectors.items);
|
|
7063
|
+
const multiple = ScrollAreaViewport.useStore(store, selectors.selectionMode) === 'multiple';
|
|
7064
|
+
const hasSelectedValue = ScrollAreaViewport.useStore(store, selectors.hasSelectedValue);
|
|
6698
7065
|
const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
|
|
6699
|
-
const hasNullLabel =
|
|
7066
|
+
const hasNullLabel = ScrollAreaViewport.useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
|
|
6700
7067
|
let children = null;
|
|
6701
7068
|
if (typeof childrenProp === 'function') {
|
|
6702
7069
|
children = childrenProp(selectedValue);
|
|
@@ -6782,8 +7149,8 @@ const ComboboxChips = /*#__PURE__*/React__namespace.forwardRef(function Combobox
|
|
|
6782
7149
|
...elementProps
|
|
6783
7150
|
} = componentProps;
|
|
6784
7151
|
const store = useComboboxRootContext();
|
|
6785
|
-
const open =
|
|
6786
|
-
const hasSelectionChips =
|
|
7152
|
+
const open = ScrollAreaViewport.useStore(store, selectors.open);
|
|
7153
|
+
const hasSelectionChips = ScrollAreaViewport.useStore(store, selectors.hasSelectionChips);
|
|
6787
7154
|
const [highlightedChipIndex, setHighlightedChipIndex] = React__namespace.useState(undefined);
|
|
6788
7155
|
if (open && highlightedChipIndex !== undefined) {
|
|
6789
7156
|
setHighlightedChipIndex(undefined);
|
|
@@ -6833,9 +7200,9 @@ const ComboboxChip = /*#__PURE__*/React__namespace.forwardRef(function ComboboxC
|
|
|
6833
7200
|
setHighlightedChipIndex,
|
|
6834
7201
|
chipsRef
|
|
6835
7202
|
} = useComboboxChipsContext();
|
|
6836
|
-
const disabled =
|
|
6837
|
-
const readOnly =
|
|
6838
|
-
const selectedValue =
|
|
7203
|
+
const disabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
7204
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
7205
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
6839
7206
|
const {
|
|
6840
7207
|
ref,
|
|
6841
7208
|
index
|
|
@@ -6942,15 +7309,15 @@ const ComboboxChipRemove = /*#__PURE__*/React__namespace.forwardRef(function Com
|
|
|
6942
7309
|
const {
|
|
6943
7310
|
index
|
|
6944
7311
|
} = useComboboxChipContext();
|
|
6945
|
-
const comboboxDisabled =
|
|
6946
|
-
const readOnly =
|
|
6947
|
-
const selectedValue =
|
|
6948
|
-
const isItemEqualToValue =
|
|
7312
|
+
const comboboxDisabled = ScrollAreaViewport.useStore(store, selectors.disabled);
|
|
7313
|
+
const readOnly = ScrollAreaViewport.useStore(store, selectors.readOnly);
|
|
7314
|
+
const selectedValue = ScrollAreaViewport.useStore(store, selectors.selectedValue);
|
|
7315
|
+
const isItemEqualToValue = ScrollAreaViewport.useStore(store, selectors.isItemEqualToValue);
|
|
6949
7316
|
const disabled = comboboxDisabled || disabledProp;
|
|
6950
7317
|
const {
|
|
6951
7318
|
buttonRef,
|
|
6952
7319
|
getButtonProps
|
|
6953
|
-
} =
|
|
7320
|
+
} = useValueChanged.useButton({
|
|
6954
7321
|
native: nativeButton,
|
|
6955
7322
|
disabled: disabled || readOnly,
|
|
6956
7323
|
focusableWhenDisabled: true
|
|
@@ -7422,7 +7789,8 @@ function useRender(params) {
|
|
|
7422
7789
|
|
|
7423
7790
|
exports.Separator = Separator.Separator;
|
|
7424
7791
|
exports.Combobox = index_parts$1;
|
|
7425
|
-
exports.Drawer = index_parts$
|
|
7426
|
-
exports.Menu = index_parts$
|
|
7792
|
+
exports.Drawer = index_parts$4;
|
|
7793
|
+
exports.Menu = index_parts$3;
|
|
7427
7794
|
exports.NumberField = index_parts;
|
|
7795
|
+
exports.ScrollArea = index_parts$2;
|
|
7428
7796
|
exports.useRender = useRender;
|