@jobber/components 8.14.1 → 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/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/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/floating-ui.react-es.js +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.mjs +1 -2
- 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 +62 -1
- 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/package.json +2 -2
- package/dist/useBaseUiId-cjs.js +0 -275
- package/dist/useBaseUiId-es.js +0 -251
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { Drawer } from "@base-ui/react/drawer";
|
|
14
14
|
export { Menu } from "@base-ui/react/menu";
|
|
15
|
+
export { ScrollArea } from "@base-ui/react/scroll-area";
|
|
15
16
|
export { Combobox } from "@base-ui/react";
|
|
16
17
|
export { NumberField } from "@base-ui/react/number-field";
|
|
17
18
|
export { Separator } from "@base-ui/react/separator";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { u as useDialogRootContext,
|
|
2
|
-
import {
|
|
1
|
+
import { u as useDialogRootContext, aq as useDrawerProviderContext, ar as DrawerBackdropCssVars, as as DrawerPopupCssVars, at as DrawerProviderContext, au as CommonPopupDataAttributes, L as popupStateMapping, av as useDialogPortalContext, aw as DialogStore, o as contains, i as getTarget, ax as useDrawerRootContext, ao as useTriggerRegistration, ay as DrawerPopupDataAttributes, az as useDrawerSnapPoints, aA as DrawerViewportContext, aB as BASE_UI_SWIPE_IGNORE_SELECTOR, aC as DRAWER_CONTENT_ATTRIBUTE, c as DrawerBackdrop, f as DrawerContent, d as DrawerPopup, b as DrawerPortal, a as DrawerRoot, D as DrawerTrigger, Q as useDirection, V as inertValue, aD as useScrollAreaRootContext, aE as getOffset, aF as ScrollAreaRootCssVars, aG as scrollAreaStateAttributesMapping, aH as useScrollAreaViewportContext, S as ScrollAreaRoot, e as ScrollAreaViewport, Z as createSelector, aI as useStore, a4 as useOpenInteractionType, ag as useClick, a9 as useDismiss, ac as useInteractions, a2 as useOnFirstRender, aJ as Store, al as pressableTriggerOpenStateMapping, ap as triggerOpenStateMapping, O as FloatingPortal, a7 as useScrollLock, U as InternalBackdrop, X as DROPDOWN_COLLISION_AVOIDANCE, N as FloatingFocusManager } from '../ScrollAreaViewport-es.js';
|
|
2
|
+
import { a as DrawerClose, D as DrawerTitle, u as useMenuRootContext, o as useMenuPositionerContext, p as useContextMenuRootContext, q as useCompositeListItem, r as useMenuItem, R as REGULAR_ITEM, s as itemMapping, t as MenuStore, l as MenuGroup, n as MenuGroupLabel, c as MenuItem, b as MenuLinkItem, j as MenuPopup, h as MenuPortal, i as MenuPositioner, k as MenuRadioGroup, d as MenuRadioItem, e as MenuRadioItemIndicator, g as MenuRoot, m as MenuSubmenuRoot, f as MenuSubmenuTrigger, M as MenuTrigger, v as useFloatingRootContext, w as useListNavigation, x as useTypeahead, y as getPseudoElementBounds, C as CompositeList, z as useAnchorPositioning, A as getDisabledMountTransitionStyles, I as IndexGuessBehavior } from '../MenuSubmenuTrigger-es.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { u as useRenderElement, m as mergeProps, f as formatErrorMessage, N as NOOP, E as EMPTY_OBJECT, d as EMPTY_ARRAY,
|
|
5
|
-
import { u as useBaseUiId, a as
|
|
6
|
-
import { u as useIsoLayoutEffect, a as useStableCallback, t as transitionStatusMapping, k as createChangeEventDetails, V as imperativeAction, s as ownerDocument, g as clamp, c as useTimeout, a3 as swipe, D as useAnimationFrame, X as TransitionStatusDataAttributes, K as triggerHover, h as useControlled, P as itemPress, d as useTransitionStatus, e as useOpenChangeComplete, R as useAnimationsFinished, i as useValueAsRef, r as createGenericEventDetails, o as inputClear, m as inputChange, M as focusOut, Q as outsidePress, y as useValueChanged, n as none, a4 as inputPress, v as visuallyHiddenInput, l as visuallyHidden, z as stopEvent, L as listNavigation, B as closePress, a1 as isAndroid, a5 as isFirefox, J as escapeKey, a6 as clearPress, S as SafeReact, a7 as chipRemovePress, a8 as scrub, _ as isWebKit } from '../useValueChanged-es.js';
|
|
4
|
+
import { u as useRenderElement, m as mergeProps, f as formatErrorMessage, N as NOOP, E as EMPTY_OBJECT, d as EMPTY_ARRAY, a as useRefWithInit, b as useMergedRefs } from '../useRenderElement-es.js';
|
|
5
|
+
import { u as useBaseUiId, d as useIsoLayoutEffect, a as useStableCallback, t as transitionStatusMapping, k as createChangeEventDetails, U as imperativeAction, s as ownerDocument, g as clamp, b as useTimeout, a5 as swipe, Z as useAnimationFrame, X as TransitionStatusDataAttributes, K as triggerHover, h as useControlled, P as itemPress, c as useTransitionStatus, e as useOpenChangeComplete, R as useAnimationsFinished, i as useValueAsRef, r as createGenericEventDetails, o as inputClear, m as inputChange, M as focusOut, Q as outsidePress, z as useValueChanged, n as none, a6 as inputPress, v as visuallyHiddenInput, l as visuallyHidden, y as useButton, A as stopEvent, L as listNavigation, C as closePress, a3 as isAndroid, a7 as isFirefox, J as escapeKey, a8 as clearPress, a9 as SafeReact, aa as error, ab as chipRemovePress, ac as scrub, $ as isWebKit } from '../useValueChanged-es.js';
|
|
7
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
7
|
import { a as isHTMLElement, f as getComputedStyle, b as isElement, k as getWindow } from '../floating-ui.utils.dom-es.js';
|
|
9
8
|
import * as ReactDOM from 'react-dom';
|
|
@@ -2719,7 +2718,7 @@ function shouldDismissFromStartEdge(direction, axis) {
|
|
|
2719
2718
|
return null;
|
|
2720
2719
|
}
|
|
2721
2720
|
|
|
2722
|
-
var index_parts$
|
|
2721
|
+
var index_parts$4 = /*#__PURE__*/Object.freeze({
|
|
2723
2722
|
__proto__: null,
|
|
2724
2723
|
Backdrop: DrawerBackdrop,
|
|
2725
2724
|
Close: DrawerClose,
|
|
@@ -3531,7 +3530,7 @@ function createMenuHandle() {
|
|
|
3531
3530
|
return new MenuHandle();
|
|
3532
3531
|
}
|
|
3533
3532
|
|
|
3534
|
-
var index_parts$
|
|
3533
|
+
var index_parts$3 = /*#__PURE__*/Object.freeze({
|
|
3535
3534
|
__proto__: null,
|
|
3536
3535
|
Arrow: MenuArrow,
|
|
3537
3536
|
Backdrop: MenuBackdrop,
|
|
@@ -3557,6 +3556,374 @@ var index_parts$2 = /*#__PURE__*/Object.freeze({
|
|
|
3557
3556
|
createHandle: createMenuHandle
|
|
3558
3557
|
});
|
|
3559
3558
|
|
|
3559
|
+
const ScrollAreaScrollbarContext = /*#__PURE__*/React.createContext(undefined);
|
|
3560
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaScrollbarContext.displayName = "ScrollAreaScrollbarContext";
|
|
3561
|
+
function useScrollAreaScrollbarContext() {
|
|
3562
|
+
const context = React.useContext(ScrollAreaScrollbarContext);
|
|
3563
|
+
if (context === undefined) {
|
|
3564
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: ScrollAreaScrollbarContext is missing. ScrollAreaScrollbar parts must be placed within <ScrollArea.Scrollbar>.' : formatErrorMessage(54));
|
|
3565
|
+
}
|
|
3566
|
+
return context;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
let ScrollAreaScrollbarCssVars = /*#__PURE__*/function (ScrollAreaScrollbarCssVars) {
|
|
3570
|
+
/**
|
|
3571
|
+
* The scroll area thumb's height.
|
|
3572
|
+
* @type {number}
|
|
3573
|
+
*/
|
|
3574
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbHeight"] = "--scroll-area-thumb-height";
|
|
3575
|
+
/**
|
|
3576
|
+
* The scroll area thumb's width.
|
|
3577
|
+
* @type {number}
|
|
3578
|
+
*/
|
|
3579
|
+
ScrollAreaScrollbarCssVars["scrollAreaThumbWidth"] = "--scroll-area-thumb-width";
|
|
3580
|
+
return ScrollAreaScrollbarCssVars;
|
|
3581
|
+
}({});
|
|
3582
|
+
|
|
3583
|
+
/**
|
|
3584
|
+
* A vertical or horizontal scrollbar for the scroll area.
|
|
3585
|
+
* Renders a `<div>` element.
|
|
3586
|
+
*
|
|
3587
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3588
|
+
*/
|
|
3589
|
+
const ScrollAreaScrollbar = /*#__PURE__*/React.forwardRef(function ScrollAreaScrollbar(componentProps, forwardedRef) {
|
|
3590
|
+
const {
|
|
3591
|
+
render,
|
|
3592
|
+
className,
|
|
3593
|
+
orientation = 'vertical',
|
|
3594
|
+
keepMounted = false,
|
|
3595
|
+
...elementProps
|
|
3596
|
+
} = componentProps;
|
|
3597
|
+
const {
|
|
3598
|
+
hovering,
|
|
3599
|
+
scrollingX,
|
|
3600
|
+
scrollingY,
|
|
3601
|
+
hiddenState,
|
|
3602
|
+
overflowEdges,
|
|
3603
|
+
scrollbarYRef,
|
|
3604
|
+
scrollbarXRef,
|
|
3605
|
+
viewportRef,
|
|
3606
|
+
thumbYRef,
|
|
3607
|
+
thumbXRef,
|
|
3608
|
+
handlePointerDown,
|
|
3609
|
+
handlePointerUp,
|
|
3610
|
+
rootId,
|
|
3611
|
+
thumbSize,
|
|
3612
|
+
hasMeasuredScrollbar
|
|
3613
|
+
} = useScrollAreaRootContext();
|
|
3614
|
+
const state = {
|
|
3615
|
+
hovering,
|
|
3616
|
+
scrolling: {
|
|
3617
|
+
horizontal: scrollingX,
|
|
3618
|
+
vertical: scrollingY
|
|
3619
|
+
}[orientation],
|
|
3620
|
+
orientation,
|
|
3621
|
+
hasOverflowX: !hiddenState.x,
|
|
3622
|
+
hasOverflowY: !hiddenState.y,
|
|
3623
|
+
overflowXStart: overflowEdges.xStart,
|
|
3624
|
+
overflowXEnd: overflowEdges.xEnd,
|
|
3625
|
+
overflowYStart: overflowEdges.yStart,
|
|
3626
|
+
overflowYEnd: overflowEdges.yEnd,
|
|
3627
|
+
cornerHidden: hiddenState.corner
|
|
3628
|
+
};
|
|
3629
|
+
const direction = useDirection();
|
|
3630
|
+
const hideTrackUntilMeasured = !hasMeasuredScrollbar && !keepMounted;
|
|
3631
|
+
React.useEffect(() => {
|
|
3632
|
+
const viewportEl = viewportRef.current;
|
|
3633
|
+
const scrollbarEl = orientation === 'vertical' ? scrollbarYRef.current : scrollbarXRef.current;
|
|
3634
|
+
if (!scrollbarEl) {
|
|
3635
|
+
return undefined;
|
|
3636
|
+
}
|
|
3637
|
+
function handleWheel(event) {
|
|
3638
|
+
if (!viewportEl || !scrollbarEl || event.ctrlKey) {
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
event.preventDefault();
|
|
3642
|
+
if (orientation === 'vertical') {
|
|
3643
|
+
if (viewportEl.scrollTop === 0 && event.deltaY < 0) {
|
|
3644
|
+
return;
|
|
3645
|
+
}
|
|
3646
|
+
} else if (viewportEl.scrollLeft === 0 && event.deltaX < 0) {
|
|
3647
|
+
return;
|
|
3648
|
+
}
|
|
3649
|
+
if (orientation === 'vertical') {
|
|
3650
|
+
if (viewportEl.scrollTop === viewportEl.scrollHeight - viewportEl.clientHeight && event.deltaY > 0) {
|
|
3651
|
+
return;
|
|
3652
|
+
}
|
|
3653
|
+
} else if (viewportEl.scrollLeft === viewportEl.scrollWidth - viewportEl.clientWidth && event.deltaX > 0) {
|
|
3654
|
+
return;
|
|
3655
|
+
}
|
|
3656
|
+
if (orientation === 'vertical') {
|
|
3657
|
+
viewportEl.scrollTop += event.deltaY;
|
|
3658
|
+
} else {
|
|
3659
|
+
viewportEl.scrollLeft += event.deltaX;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
scrollbarEl.addEventListener('wheel', handleWheel, {
|
|
3663
|
+
passive: false
|
|
3664
|
+
});
|
|
3665
|
+
return () => {
|
|
3666
|
+
scrollbarEl.removeEventListener('wheel', handleWheel);
|
|
3667
|
+
};
|
|
3668
|
+
}, [orientation, scrollbarXRef, scrollbarYRef, viewportRef]);
|
|
3669
|
+
const props = {
|
|
3670
|
+
...(rootId && {
|
|
3671
|
+
'data-id': `${rootId}-scrollbar`
|
|
3672
|
+
}),
|
|
3673
|
+
onPointerDown(event) {
|
|
3674
|
+
if (event.button !== 0) {
|
|
3675
|
+
return;
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
// Ignore clicks on thumb
|
|
3679
|
+
if (event.currentTarget !== event.target) {
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3682
|
+
if (!viewportRef.current) {
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
// Handle Y-axis (vertical) scroll
|
|
3687
|
+
if (thumbYRef.current && scrollbarYRef.current && orientation === 'vertical') {
|
|
3688
|
+
const thumbYOffset = getOffset(thumbYRef.current, 'margin', 'y');
|
|
3689
|
+
const scrollbarYOffset = getOffset(scrollbarYRef.current, 'padding', 'y');
|
|
3690
|
+
const thumbHeight = thumbYRef.current.offsetHeight;
|
|
3691
|
+
const trackRectY = scrollbarYRef.current.getBoundingClientRect();
|
|
3692
|
+
const clickY = event.clientY - trackRectY.top - thumbHeight / 2 - scrollbarYOffset + thumbYOffset / 2;
|
|
3693
|
+
const scrollableContentHeight = viewportRef.current.scrollHeight;
|
|
3694
|
+
const viewportHeight = viewportRef.current.clientHeight;
|
|
3695
|
+
const maxThumbOffsetY = scrollbarYRef.current.offsetHeight - thumbHeight - scrollbarYOffset - thumbYOffset;
|
|
3696
|
+
const scrollRatioY = clickY / maxThumbOffsetY;
|
|
3697
|
+
const newScrollTop = scrollRatioY * (scrollableContentHeight - viewportHeight);
|
|
3698
|
+
viewportRef.current.scrollTop = newScrollTop;
|
|
3699
|
+
}
|
|
3700
|
+
if (thumbXRef.current && scrollbarXRef.current && orientation === 'horizontal') {
|
|
3701
|
+
const thumbXOffset = getOffset(thumbXRef.current, 'margin', 'x');
|
|
3702
|
+
const scrollbarXOffset = getOffset(scrollbarXRef.current, 'padding', 'x');
|
|
3703
|
+
const thumbWidth = thumbXRef.current.offsetWidth;
|
|
3704
|
+
const trackRectX = scrollbarXRef.current.getBoundingClientRect();
|
|
3705
|
+
const clickX = event.clientX - trackRectX.left - thumbWidth / 2 - scrollbarXOffset + thumbXOffset / 2;
|
|
3706
|
+
const scrollableContentWidth = viewportRef.current.scrollWidth;
|
|
3707
|
+
const viewportWidth = viewportRef.current.clientWidth;
|
|
3708
|
+
const maxThumbOffsetX = scrollbarXRef.current.offsetWidth - thumbWidth - scrollbarXOffset - thumbXOffset;
|
|
3709
|
+
const scrollRatioX = clickX / maxThumbOffsetX;
|
|
3710
|
+
let newScrollLeft;
|
|
3711
|
+
if (direction === 'rtl') {
|
|
3712
|
+
// In RTL, invert the scroll direction
|
|
3713
|
+
newScrollLeft = (1 - scrollRatioX) * (scrollableContentWidth - viewportWidth);
|
|
3714
|
+
|
|
3715
|
+
// Adjust for browsers that use negative scrollLeft in RTL
|
|
3716
|
+
if (viewportRef.current.scrollLeft <= 0) {
|
|
3717
|
+
newScrollLeft = -newScrollLeft;
|
|
3718
|
+
}
|
|
3719
|
+
} else {
|
|
3720
|
+
newScrollLeft = scrollRatioX * (scrollableContentWidth - viewportWidth);
|
|
3721
|
+
}
|
|
3722
|
+
viewportRef.current.scrollLeft = newScrollLeft;
|
|
3723
|
+
}
|
|
3724
|
+
handlePointerDown(event);
|
|
3725
|
+
},
|
|
3726
|
+
onPointerUp: handlePointerUp,
|
|
3727
|
+
style: {
|
|
3728
|
+
position: 'absolute',
|
|
3729
|
+
touchAction: 'none',
|
|
3730
|
+
WebkitUserSelect: 'none',
|
|
3731
|
+
userSelect: 'none',
|
|
3732
|
+
visibility: hideTrackUntilMeasured ? 'hidden' : undefined,
|
|
3733
|
+
...(orientation === 'vertical' && {
|
|
3734
|
+
top: 0,
|
|
3735
|
+
bottom: `var(${ScrollAreaRootCssVars.scrollAreaCornerHeight})`,
|
|
3736
|
+
insetInlineEnd: 0,
|
|
3737
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbHeight]: `${thumbSize.height}px`
|
|
3738
|
+
}),
|
|
3739
|
+
...(orientation === 'horizontal' && {
|
|
3740
|
+
insetInlineStart: 0,
|
|
3741
|
+
insetInlineEnd: `var(${ScrollAreaRootCssVars.scrollAreaCornerWidth})`,
|
|
3742
|
+
bottom: 0,
|
|
3743
|
+
[ScrollAreaScrollbarCssVars.scrollAreaThumbWidth]: `${thumbSize.width}px`
|
|
3744
|
+
})
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
const element = useRenderElement('div', componentProps, {
|
|
3748
|
+
ref: [forwardedRef, orientation === 'vertical' ? scrollbarYRef : scrollbarXRef],
|
|
3749
|
+
state,
|
|
3750
|
+
props: [props, elementProps],
|
|
3751
|
+
stateAttributesMapping: scrollAreaStateAttributesMapping
|
|
3752
|
+
});
|
|
3753
|
+
const contextValue = React.useMemo(() => ({
|
|
3754
|
+
orientation
|
|
3755
|
+
}), [orientation]);
|
|
3756
|
+
const isHidden = orientation === 'vertical' ? hiddenState.y : hiddenState.x;
|
|
3757
|
+
const shouldRender = keepMounted || !isHidden;
|
|
3758
|
+
if (!shouldRender) {
|
|
3759
|
+
return null;
|
|
3760
|
+
}
|
|
3761
|
+
return /*#__PURE__*/jsx(ScrollAreaScrollbarContext.Provider, {
|
|
3762
|
+
value: contextValue,
|
|
3763
|
+
children: element
|
|
3764
|
+
});
|
|
3765
|
+
});
|
|
3766
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaScrollbar.displayName = "ScrollAreaScrollbar";
|
|
3767
|
+
|
|
3768
|
+
/**
|
|
3769
|
+
* A container for the content of the scroll area.
|
|
3770
|
+
* Renders a `<div>` element.
|
|
3771
|
+
*
|
|
3772
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3773
|
+
*/
|
|
3774
|
+
const ScrollAreaContent = /*#__PURE__*/React.forwardRef(function ScrollAreaContent(componentProps, forwardedRef) {
|
|
3775
|
+
const {
|
|
3776
|
+
render,
|
|
3777
|
+
className,
|
|
3778
|
+
...elementProps
|
|
3779
|
+
} = componentProps;
|
|
3780
|
+
const contentWrapperRef = React.useRef(null);
|
|
3781
|
+
const {
|
|
3782
|
+
computeThumbPosition
|
|
3783
|
+
} = useScrollAreaViewportContext();
|
|
3784
|
+
const {
|
|
3785
|
+
viewportState
|
|
3786
|
+
} = useScrollAreaRootContext();
|
|
3787
|
+
useIsoLayoutEffect(() => {
|
|
3788
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
3789
|
+
return undefined;
|
|
3790
|
+
}
|
|
3791
|
+
let hasInitialized = false;
|
|
3792
|
+
const ro = new ResizeObserver(() => {
|
|
3793
|
+
// ResizeObserver fires once upon observing, so we skip the initial call
|
|
3794
|
+
// to avoid double-calculating the thumb position on mount.
|
|
3795
|
+
if (!hasInitialized) {
|
|
3796
|
+
hasInitialized = true;
|
|
3797
|
+
return;
|
|
3798
|
+
}
|
|
3799
|
+
computeThumbPosition();
|
|
3800
|
+
});
|
|
3801
|
+
if (contentWrapperRef.current) {
|
|
3802
|
+
ro.observe(contentWrapperRef.current);
|
|
3803
|
+
}
|
|
3804
|
+
return () => {
|
|
3805
|
+
ro.disconnect();
|
|
3806
|
+
};
|
|
3807
|
+
}, [computeThumbPosition]);
|
|
3808
|
+
const element = useRenderElement('div', componentProps, {
|
|
3809
|
+
ref: [forwardedRef, contentWrapperRef],
|
|
3810
|
+
state: viewportState,
|
|
3811
|
+
stateAttributesMapping: scrollAreaStateAttributesMapping,
|
|
3812
|
+
props: [{
|
|
3813
|
+
role: 'presentation',
|
|
3814
|
+
style: {
|
|
3815
|
+
minWidth: 'fit-content'
|
|
3816
|
+
}
|
|
3817
|
+
}, elementProps]
|
|
3818
|
+
});
|
|
3819
|
+
return element;
|
|
3820
|
+
});
|
|
3821
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaContent.displayName = "ScrollAreaContent";
|
|
3822
|
+
|
|
3823
|
+
/**
|
|
3824
|
+
* The draggable part of the scrollbar that indicates the current scroll position.
|
|
3825
|
+
* Renders a `<div>` element.
|
|
3826
|
+
*
|
|
3827
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3828
|
+
*/
|
|
3829
|
+
const ScrollAreaThumb = /*#__PURE__*/React.forwardRef(function ScrollAreaThumb(componentProps, forwardedRef) {
|
|
3830
|
+
const {
|
|
3831
|
+
render,
|
|
3832
|
+
className,
|
|
3833
|
+
...elementProps
|
|
3834
|
+
} = componentProps;
|
|
3835
|
+
const {
|
|
3836
|
+
thumbYRef,
|
|
3837
|
+
thumbXRef,
|
|
3838
|
+
handlePointerDown,
|
|
3839
|
+
handlePointerMove,
|
|
3840
|
+
handlePointerUp,
|
|
3841
|
+
setScrollingX,
|
|
3842
|
+
setScrollingY,
|
|
3843
|
+
hasMeasuredScrollbar
|
|
3844
|
+
} = useScrollAreaRootContext();
|
|
3845
|
+
const {
|
|
3846
|
+
orientation
|
|
3847
|
+
} = useScrollAreaScrollbarContext();
|
|
3848
|
+
const state = {
|
|
3849
|
+
orientation
|
|
3850
|
+
};
|
|
3851
|
+
const element = useRenderElement('div', componentProps, {
|
|
3852
|
+
ref: [forwardedRef, orientation === 'vertical' ? thumbYRef : thumbXRef],
|
|
3853
|
+
state,
|
|
3854
|
+
props: [{
|
|
3855
|
+
onPointerDown: handlePointerDown,
|
|
3856
|
+
onPointerMove: handlePointerMove,
|
|
3857
|
+
onPointerUp(event) {
|
|
3858
|
+
if (orientation === 'vertical') {
|
|
3859
|
+
setScrollingY(false);
|
|
3860
|
+
}
|
|
3861
|
+
if (orientation === 'horizontal') {
|
|
3862
|
+
setScrollingX(false);
|
|
3863
|
+
}
|
|
3864
|
+
handlePointerUp(event);
|
|
3865
|
+
},
|
|
3866
|
+
style: {
|
|
3867
|
+
visibility: hasMeasuredScrollbar ? undefined : 'hidden',
|
|
3868
|
+
...(orientation === 'vertical' && {
|
|
3869
|
+
height: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbHeight})`
|
|
3870
|
+
}),
|
|
3871
|
+
...(orientation === 'horizontal' && {
|
|
3872
|
+
width: `var(${ScrollAreaScrollbarCssVars.scrollAreaThumbWidth})`
|
|
3873
|
+
})
|
|
3874
|
+
}
|
|
3875
|
+
}, elementProps]
|
|
3876
|
+
});
|
|
3877
|
+
return element;
|
|
3878
|
+
});
|
|
3879
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaThumb.displayName = "ScrollAreaThumb";
|
|
3880
|
+
|
|
3881
|
+
/**
|
|
3882
|
+
* A small rectangular area that appears at the intersection of horizontal and vertical scrollbars.
|
|
3883
|
+
* Renders a `<div>` element.
|
|
3884
|
+
*
|
|
3885
|
+
* Documentation: [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area)
|
|
3886
|
+
*/
|
|
3887
|
+
const ScrollAreaCorner = /*#__PURE__*/React.forwardRef(function ScrollAreaCorner(componentProps, forwardedRef) {
|
|
3888
|
+
const {
|
|
3889
|
+
render,
|
|
3890
|
+
className,
|
|
3891
|
+
...elementProps
|
|
3892
|
+
} = componentProps;
|
|
3893
|
+
const {
|
|
3894
|
+
cornerRef,
|
|
3895
|
+
cornerSize,
|
|
3896
|
+
hiddenState
|
|
3897
|
+
} = useScrollAreaRootContext();
|
|
3898
|
+
const element = useRenderElement('div', componentProps, {
|
|
3899
|
+
ref: [forwardedRef, cornerRef],
|
|
3900
|
+
props: [{
|
|
3901
|
+
style: {
|
|
3902
|
+
position: 'absolute',
|
|
3903
|
+
bottom: 0,
|
|
3904
|
+
insetInlineEnd: 0,
|
|
3905
|
+
width: cornerSize.width,
|
|
3906
|
+
height: cornerSize.height
|
|
3907
|
+
}
|
|
3908
|
+
}, elementProps]
|
|
3909
|
+
});
|
|
3910
|
+
if (hiddenState.corner) {
|
|
3911
|
+
return null;
|
|
3912
|
+
}
|
|
3913
|
+
return element;
|
|
3914
|
+
});
|
|
3915
|
+
if (process.env.NODE_ENV !== "production") ScrollAreaCorner.displayName = "ScrollAreaCorner";
|
|
3916
|
+
|
|
3917
|
+
var index_parts$2 = /*#__PURE__*/Object.freeze({
|
|
3918
|
+
__proto__: null,
|
|
3919
|
+
Content: ScrollAreaContent,
|
|
3920
|
+
Corner: ScrollAreaCorner,
|
|
3921
|
+
Root: ScrollAreaRoot,
|
|
3922
|
+
Scrollbar: ScrollAreaScrollbar,
|
|
3923
|
+
Thumb: ScrollAreaThumb,
|
|
3924
|
+
Viewport: ScrollAreaViewport
|
|
3925
|
+
});
|
|
3926
|
+
|
|
3560
3927
|
const ComboboxRootContext = /*#__PURE__*/React.createContext(undefined);
|
|
3561
3928
|
if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
|
|
3562
3929
|
const ComboboxFloatingContext = /*#__PURE__*/React.createContext(undefined);
|
|
@@ -7398,4 +7765,4 @@ function useRender(params) {
|
|
|
7398
7765
|
return useRenderElement(params.defaultTagName ?? 'div', params, params);
|
|
7399
7766
|
}
|
|
7400
7767
|
|
|
7401
|
-
export { index_parts$1 as Combobox, index_parts$
|
|
7768
|
+
export { index_parts$1 as Combobox, index_parts$4 as Drawer, index_parts$3 as Menu, index_parts as NumberField, index_parts$2 as ScrollArea, Separator, useRender };
|
|
@@ -566,4 +566,4 @@ function renderTag(Tag, props) {
|
|
|
566
566
|
return /*#__PURE__*/React.createElement(Tag, props);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
export { EMPTY_OBJECT as E, NOOP as N,
|
|
569
|
+
export { EMPTY_OBJECT as E, NOOP as N, useRefWithInit as a, useMergedRefs as b, makeEventPreventable as c, EMPTY_ARRAY as d, formatErrorMessage as f, isReactVersionAtLeast as i, mergeProps as m, useRenderElement as u };
|