@dust-tt/sparkle 0.2.259 → 0.2.260-rc-1
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/cjs/index.js +2432 -303
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Popover.d.ts +15 -0
- package/dist/esm/components/Popover.d.ts.map +1 -0
- package/dist/esm/components/Popover.js +20 -0
- package/dist/esm/components/Popover.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/stories/Popover.stories.d.ts +11 -0
- package/dist/esm/stories/Popover.stories.d.ts.map +1 -0
- package/dist/esm/stories/Popover.stories.js +33 -0
- package/dist/esm/stories/Popover.stories.js.map +1 -0
- package/dist/sparkle.css +33 -0
- package/package.json +2 -1
- package/src/components/Popover.tsx +67 -0
- package/src/components/index.ts +2 -1
- package/src/stories/Popover.stories.tsx +102 -0
package/dist/cjs/index.js
CHANGED
|
@@ -130,6 +130,16 @@ function __read(o, n) {
|
|
|
130
130
|
return ar;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
function __spreadArray(to, from, pack) {
|
|
134
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
135
|
+
if (ar || !(i in from)) {
|
|
136
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
137
|
+
ar[i] = from[i];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
141
|
+
}
|
|
142
|
+
|
|
133
143
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
134
144
|
var e = new Error(message);
|
|
135
145
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -40519,7 +40529,7 @@ Avatar.Stack = function (_a) {
|
|
|
40519
40529
|
};
|
|
40520
40530
|
|
|
40521
40531
|
// packages/core/primitive/src/primitive.tsx
|
|
40522
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
40532
|
+
function composeEventHandlers$1(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
40523
40533
|
return function handleEvent(event) {
|
|
40524
40534
|
originalEventHandler?.(event);
|
|
40525
40535
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
@@ -40529,22 +40539,22 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
40529
40539
|
}
|
|
40530
40540
|
|
|
40531
40541
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
40532
|
-
function setRef$
|
|
40542
|
+
function setRef$3(ref, value) {
|
|
40533
40543
|
if (typeof ref === "function") {
|
|
40534
40544
|
ref(value);
|
|
40535
40545
|
} else if (ref !== null && ref !== void 0) {
|
|
40536
40546
|
ref.current = value;
|
|
40537
40547
|
}
|
|
40538
40548
|
}
|
|
40539
|
-
function composeRefs$
|
|
40540
|
-
return (node) => refs.forEach((ref) => setRef$
|
|
40549
|
+
function composeRefs$3(...refs) {
|
|
40550
|
+
return (node) => refs.forEach((ref) => setRef$3(ref, node));
|
|
40541
40551
|
}
|
|
40542
|
-
function useComposedRefs$
|
|
40543
|
-
return React__namespace.useCallback(composeRefs$
|
|
40552
|
+
function useComposedRefs$2(...refs) {
|
|
40553
|
+
return React__namespace.useCallback(composeRefs$3(...refs), refs);
|
|
40544
40554
|
}
|
|
40545
40555
|
|
|
40546
40556
|
// packages/react/context/src/createContext.tsx
|
|
40547
|
-
function createContextScope$
|
|
40557
|
+
function createContextScope$3(scopeName, createContextScopeDeps = []) {
|
|
40548
40558
|
let defaultContexts = [];
|
|
40549
40559
|
function createContext3(rootComponentName, defaultContext) {
|
|
40550
40560
|
const BaseContext = React__namespace.createContext(defaultContext);
|
|
@@ -40579,9 +40589,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
|
40579
40589
|
};
|
|
40580
40590
|
};
|
|
40581
40591
|
createScope.scopeName = scopeName;
|
|
40582
|
-
return [createContext3, composeContextScopes$
|
|
40592
|
+
return [createContext3, composeContextScopes$3(createScope, ...createContextScopeDeps)];
|
|
40583
40593
|
}
|
|
40584
|
-
function composeContextScopes$
|
|
40594
|
+
function composeContextScopes$3(...scopes) {
|
|
40585
40595
|
const baseScope = scopes[0];
|
|
40586
40596
|
if (scopes.length === 1) return baseScope;
|
|
40587
40597
|
const createScope = () => {
|
|
@@ -71508,17 +71518,18 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
71508
71518
|
}
|
|
71509
71519
|
|
|
71510
71520
|
var reactDomExports = reactDom.exports;
|
|
71521
|
+
var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports);
|
|
71511
71522
|
|
|
71512
71523
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
71513
|
-
function setRef$
|
|
71524
|
+
function setRef$2(ref, value) {
|
|
71514
71525
|
if (typeof ref === "function") {
|
|
71515
71526
|
ref(value);
|
|
71516
71527
|
} else if (ref !== null && ref !== void 0) {
|
|
71517
71528
|
ref.current = value;
|
|
71518
71529
|
}
|
|
71519
71530
|
}
|
|
71520
|
-
function composeRefs$
|
|
71521
|
-
return (node) => refs.forEach((ref) => setRef$
|
|
71531
|
+
function composeRefs$2(...refs) {
|
|
71532
|
+
return (node) => refs.forEach((ref) => setRef$2(ref, node));
|
|
71522
71533
|
}
|
|
71523
71534
|
|
|
71524
71535
|
// packages/react/slot/src/Slot.tsx
|
|
@@ -71548,7 +71559,7 @@ var SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
71548
71559
|
return React__namespace.cloneElement(children, {
|
|
71549
71560
|
...mergeProps(slotProps, children.props),
|
|
71550
71561
|
// @ts-ignore
|
|
71551
|
-
ref: forwardedRef ? composeRefs$
|
|
71562
|
+
ref: forwardedRef ? composeRefs$2(forwardedRef, childrenRef) : childrenRef
|
|
71552
71563
|
});
|
|
71553
71564
|
}
|
|
71554
71565
|
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
@@ -71598,7 +71609,7 @@ function getElementRef$1(element) {
|
|
|
71598
71609
|
}
|
|
71599
71610
|
|
|
71600
71611
|
// packages/react/primitive/src/Primitive.tsx
|
|
71601
|
-
var NODES$
|
|
71612
|
+
var NODES$2 = [
|
|
71602
71613
|
"a",
|
|
71603
71614
|
"button",
|
|
71604
71615
|
"div",
|
|
@@ -71616,7 +71627,7 @@ var NODES$1 = [
|
|
|
71616
71627
|
"svg",
|
|
71617
71628
|
"ul"
|
|
71618
71629
|
];
|
|
71619
|
-
var Primitive$
|
|
71630
|
+
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
71620
71631
|
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71621
71632
|
const { asChild, ...primitiveProps } = props;
|
|
71622
71633
|
const Comp = asChild ? Slot : node;
|
|
@@ -71628,12 +71639,12 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
|
71628
71639
|
Node.displayName = `Primitive.${node}`;
|
|
71629
71640
|
return { ...primitive, [node]: Node };
|
|
71630
71641
|
}, {});
|
|
71631
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
71642
|
+
function dispatchDiscreteCustomEvent$1(target, event) {
|
|
71632
71643
|
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
71633
71644
|
}
|
|
71634
71645
|
|
|
71635
71646
|
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
71636
|
-
function useCallbackRef(callback) {
|
|
71647
|
+
function useCallbackRef$2(callback) {
|
|
71637
71648
|
const callbackRef = React__namespace.useRef(callback);
|
|
71638
71649
|
React__namespace.useEffect(() => {
|
|
71639
71650
|
callbackRef.current = callback;
|
|
@@ -71642,8 +71653,8 @@ function useCallbackRef(callback) {
|
|
|
71642
71653
|
}
|
|
71643
71654
|
|
|
71644
71655
|
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
71645
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
71646
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
71656
|
+
function useEscapeKeydown$1(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
71657
|
+
const onEscapeKeyDown = useCallbackRef$2(onEscapeKeyDownProp);
|
|
71647
71658
|
React__namespace.useEffect(() => {
|
|
71648
71659
|
const handleKeyDown = (event) => {
|
|
71649
71660
|
if (event.key === "Escape") {
|
|
@@ -71655,17 +71666,17 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
71655
71666
|
}, [onEscapeKeyDown, ownerDocument]);
|
|
71656
71667
|
}
|
|
71657
71668
|
|
|
71658
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
71659
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
71660
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
71661
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
71662
|
-
var originalBodyPointerEvents;
|
|
71663
|
-
var DismissableLayerContext = React__namespace.createContext({
|
|
71669
|
+
var DISMISSABLE_LAYER_NAME$1 = "DismissableLayer";
|
|
71670
|
+
var CONTEXT_UPDATE$1 = "dismissableLayer.update";
|
|
71671
|
+
var POINTER_DOWN_OUTSIDE$1 = "dismissableLayer.pointerDownOutside";
|
|
71672
|
+
var FOCUS_OUTSIDE$1 = "dismissableLayer.focusOutside";
|
|
71673
|
+
var originalBodyPointerEvents$1;
|
|
71674
|
+
var DismissableLayerContext$1 = React__namespace.createContext({
|
|
71664
71675
|
layers: /* @__PURE__ */ new Set(),
|
|
71665
71676
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
71666
71677
|
branches: /* @__PURE__ */ new Set()
|
|
71667
71678
|
});
|
|
71668
|
-
var DismissableLayer = React__namespace.forwardRef(
|
|
71679
|
+
var DismissableLayer$1 = React__namespace.forwardRef(
|
|
71669
71680
|
(props, forwardedRef) => {
|
|
71670
71681
|
const {
|
|
71671
71682
|
disableOutsidePointerEvents = false,
|
|
@@ -71676,18 +71687,18 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71676
71687
|
onDismiss,
|
|
71677
71688
|
...layerProps
|
|
71678
71689
|
} = props;
|
|
71679
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71690
|
+
const context = React__namespace.useContext(DismissableLayerContext$1);
|
|
71680
71691
|
const [node, setNode] = React__namespace.useState(null);
|
|
71681
71692
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
71682
71693
|
const [, force] = React__namespace.useState({});
|
|
71683
|
-
const composedRefs = useComposedRefs$
|
|
71694
|
+
const composedRefs = useComposedRefs$2(forwardedRef, (node2) => setNode(node2));
|
|
71684
71695
|
const layers = Array.from(context.layers);
|
|
71685
71696
|
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
71686
71697
|
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
71687
71698
|
const index = node ? layers.indexOf(node) : -1;
|
|
71688
71699
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
71689
71700
|
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
71690
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
71701
|
+
const pointerDownOutside = usePointerDownOutside$1((event) => {
|
|
71691
71702
|
const target = event.target;
|
|
71692
71703
|
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71693
71704
|
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
@@ -71695,7 +71706,7 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71695
71706
|
onInteractOutside?.(event);
|
|
71696
71707
|
if (!event.defaultPrevented) onDismiss?.();
|
|
71697
71708
|
}, ownerDocument);
|
|
71698
|
-
const focusOutside = useFocusOutside((event) => {
|
|
71709
|
+
const focusOutside = useFocusOutside$1((event) => {
|
|
71699
71710
|
const target = event.target;
|
|
71700
71711
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71701
71712
|
if (isFocusInBranch) return;
|
|
@@ -71703,7 +71714,7 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71703
71714
|
onInteractOutside?.(event);
|
|
71704
71715
|
if (!event.defaultPrevented) onDismiss?.();
|
|
71705
71716
|
}, ownerDocument);
|
|
71706
|
-
useEscapeKeydown((event) => {
|
|
71717
|
+
useEscapeKeydown$1((event) => {
|
|
71707
71718
|
const isHighestLayer = index === context.layers.size - 1;
|
|
71708
71719
|
if (!isHighestLayer) return;
|
|
71709
71720
|
onEscapeKeyDown?.(event);
|
|
@@ -71716,16 +71727,16 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71716
71727
|
if (!node) return;
|
|
71717
71728
|
if (disableOutsidePointerEvents) {
|
|
71718
71729
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
71719
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
71730
|
+
originalBodyPointerEvents$1 = ownerDocument.body.style.pointerEvents;
|
|
71720
71731
|
ownerDocument.body.style.pointerEvents = "none";
|
|
71721
71732
|
}
|
|
71722
71733
|
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
71723
71734
|
}
|
|
71724
71735
|
context.layers.add(node);
|
|
71725
|
-
dispatchUpdate();
|
|
71736
|
+
dispatchUpdate$1();
|
|
71726
71737
|
return () => {
|
|
71727
71738
|
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
71728
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
71739
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents$1;
|
|
71729
71740
|
}
|
|
71730
71741
|
};
|
|
71731
71742
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -71734,16 +71745,16 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71734
71745
|
if (!node) return;
|
|
71735
71746
|
context.layers.delete(node);
|
|
71736
71747
|
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
71737
|
-
dispatchUpdate();
|
|
71748
|
+
dispatchUpdate$1();
|
|
71738
71749
|
};
|
|
71739
71750
|
}, [node, context]);
|
|
71740
71751
|
React__namespace.useEffect(() => {
|
|
71741
71752
|
const handleUpdate = () => force({});
|
|
71742
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71743
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71753
|
+
document.addEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
71754
|
+
return () => document.removeEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
71744
71755
|
}, []);
|
|
71745
71756
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71746
|
-
Primitive$
|
|
71757
|
+
Primitive$2.div,
|
|
71747
71758
|
{
|
|
71748
71759
|
...layerProps,
|
|
71749
71760
|
ref: composedRefs,
|
|
@@ -71751,9 +71762,9 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71751
71762
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
71752
71763
|
...props.style
|
|
71753
71764
|
},
|
|
71754
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
71755
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
71756
|
-
onPointerDownCapture: composeEventHandlers(
|
|
71765
|
+
onFocusCapture: composeEventHandlers$1(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
71766
|
+
onBlurCapture: composeEventHandlers$1(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
71767
|
+
onPointerDownCapture: composeEventHandlers$1(
|
|
71757
71768
|
props.onPointerDownCapture,
|
|
71758
71769
|
pointerDownOutside.onPointerDownCapture
|
|
71759
71770
|
)
|
|
@@ -71761,12 +71772,12 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71761
71772
|
);
|
|
71762
71773
|
}
|
|
71763
71774
|
);
|
|
71764
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
71765
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
71766
|
-
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71767
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71775
|
+
DismissableLayer$1.displayName = DISMISSABLE_LAYER_NAME$1;
|
|
71776
|
+
var BRANCH_NAME$1 = "DismissableLayerBranch";
|
|
71777
|
+
var DismissableLayerBranch$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71778
|
+
const context = React__namespace.useContext(DismissableLayerContext$1);
|
|
71768
71779
|
const ref = React__namespace.useRef(null);
|
|
71769
|
-
const composedRefs = useComposedRefs$
|
|
71780
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
71770
71781
|
React__namespace.useEffect(() => {
|
|
71771
71782
|
const node = ref.current;
|
|
71772
71783
|
if (node) {
|
|
@@ -71776,11 +71787,11 @@ var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
71776
71787
|
};
|
|
71777
71788
|
}
|
|
71778
71789
|
}, [context.branches]);
|
|
71779
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive$
|
|
71790
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive$2.div, { ...props, ref: composedRefs });
|
|
71780
71791
|
});
|
|
71781
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
71782
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
71783
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
71792
|
+
DismissableLayerBranch$1.displayName = BRANCH_NAME$1;
|
|
71793
|
+
function usePointerDownOutside$1(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
71794
|
+
const handlePointerDownOutside = useCallbackRef$2(onPointerDownOutside);
|
|
71784
71795
|
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
71785
71796
|
const handleClickRef = React__namespace.useRef(() => {
|
|
71786
71797
|
});
|
|
@@ -71788,8 +71799,8 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
71788
71799
|
const handlePointerDown = (event) => {
|
|
71789
71800
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
71790
71801
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
71791
|
-
handleAndDispatchCustomEvent(
|
|
71792
|
-
POINTER_DOWN_OUTSIDE,
|
|
71802
|
+
handleAndDispatchCustomEvent$1(
|
|
71803
|
+
POINTER_DOWN_OUTSIDE$1,
|
|
71793
71804
|
handlePointerDownOutside,
|
|
71794
71805
|
eventDetail,
|
|
71795
71806
|
{ discrete: true }
|
|
@@ -71822,14 +71833,14 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
71822
71833
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
71823
71834
|
};
|
|
71824
71835
|
}
|
|
71825
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
71826
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
71836
|
+
function useFocusOutside$1(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
71837
|
+
const handleFocusOutside = useCallbackRef$2(onFocusOutside);
|
|
71827
71838
|
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
71828
71839
|
React__namespace.useEffect(() => {
|
|
71829
71840
|
const handleFocus = (event) => {
|
|
71830
71841
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
71831
71842
|
const eventDetail = { originalEvent: event };
|
|
71832
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
71843
|
+
handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE$1, handleFocusOutside, eventDetail, {
|
|
71833
71844
|
discrete: false
|
|
71834
71845
|
});
|
|
71835
71846
|
}
|
|
@@ -71842,32 +71853,32 @@ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
|
71842
71853
|
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
71843
71854
|
};
|
|
71844
71855
|
}
|
|
71845
|
-
function dispatchUpdate() {
|
|
71846
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
71856
|
+
function dispatchUpdate$1() {
|
|
71857
|
+
const event = new CustomEvent(CONTEXT_UPDATE$1);
|
|
71847
71858
|
document.dispatchEvent(event);
|
|
71848
71859
|
}
|
|
71849
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
71860
|
+
function handleAndDispatchCustomEvent$1(name, handler, detail, { discrete }) {
|
|
71850
71861
|
const target = detail.originalEvent.target;
|
|
71851
71862
|
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
71852
71863
|
if (handler) target.addEventListener(name, handler, { once: true });
|
|
71853
71864
|
if (discrete) {
|
|
71854
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
71865
|
+
dispatchDiscreteCustomEvent$1(target, event);
|
|
71855
71866
|
} else {
|
|
71856
71867
|
target.dispatchEvent(event);
|
|
71857
71868
|
}
|
|
71858
71869
|
}
|
|
71859
71870
|
|
|
71860
71871
|
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
71861
|
-
var useLayoutEffect2$
|
|
71872
|
+
var useLayoutEffect2$2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
71862
71873
|
};
|
|
71863
71874
|
|
|
71864
71875
|
// packages/react/id/src/id.tsx
|
|
71865
|
-
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
71866
|
-
var count$
|
|
71867
|
-
function useId(deterministicId) {
|
|
71868
|
-
const [id, setId] = React__namespace.useState(useReactId());
|
|
71869
|
-
useLayoutEffect2$
|
|
71870
|
-
if (!deterministicId) setId((reactId) => reactId ?? String(count$
|
|
71876
|
+
var useReactId$1 = React__namespace["useId".toString()] || (() => void 0);
|
|
71877
|
+
var count$3 = 0;
|
|
71878
|
+
function useId$1(deterministicId) {
|
|
71879
|
+
const [id, setId] = React__namespace.useState(useReactId$1());
|
|
71880
|
+
useLayoutEffect2$2(() => {
|
|
71881
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count$3++));
|
|
71871
71882
|
}, [deterministicId]);
|
|
71872
71883
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
71873
71884
|
}
|
|
@@ -73822,11 +73833,11 @@ const arrow = (options, deps) => ({
|
|
|
73822
73833
|
});
|
|
73823
73834
|
|
|
73824
73835
|
// packages/react/arrow/src/Arrow.tsx
|
|
73825
|
-
var NAME$
|
|
73826
|
-
var Arrow$
|
|
73836
|
+
var NAME$3 = "Arrow";
|
|
73837
|
+
var Arrow$3 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
73827
73838
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
73828
73839
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73829
|
-
Primitive$
|
|
73840
|
+
Primitive$2.svg,
|
|
73830
73841
|
{
|
|
73831
73842
|
...arrowProps,
|
|
73832
73843
|
ref: forwardedRef,
|
|
@@ -73838,11 +73849,11 @@ var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
73838
73849
|
}
|
|
73839
73850
|
);
|
|
73840
73851
|
});
|
|
73841
|
-
Arrow$
|
|
73842
|
-
var Root$
|
|
73852
|
+
Arrow$3.displayName = NAME$3;
|
|
73853
|
+
var Root$3 = Arrow$3;
|
|
73843
73854
|
|
|
73844
73855
|
// packages/react/context/src/createContext.tsx
|
|
73845
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
73856
|
+
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
73846
73857
|
let defaultContexts = [];
|
|
73847
73858
|
function createContext3(rootComponentName, defaultContext) {
|
|
73848
73859
|
const BaseContext = React__namespace.createContext(defaultContext);
|
|
@@ -73877,9 +73888,9 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
73877
73888
|
};
|
|
73878
73889
|
};
|
|
73879
73890
|
createScope.scopeName = scopeName;
|
|
73880
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
73891
|
+
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
73881
73892
|
}
|
|
73882
|
-
function composeContextScopes(...scopes) {
|
|
73893
|
+
function composeContextScopes$2(...scopes) {
|
|
73883
73894
|
const baseScope = scopes[0];
|
|
73884
73895
|
if (scopes.length === 1) return baseScope;
|
|
73885
73896
|
const createScope = () => {
|
|
@@ -73901,9 +73912,9 @@ function composeContextScopes(...scopes) {
|
|
|
73901
73912
|
}
|
|
73902
73913
|
|
|
73903
73914
|
// packages/react/use-size/src/useSize.tsx
|
|
73904
|
-
function useSize(element) {
|
|
73915
|
+
function useSize$1(element) {
|
|
73905
73916
|
const [size, setSize] = React__namespace.useState(void 0);
|
|
73906
|
-
useLayoutEffect2$
|
|
73917
|
+
useLayoutEffect2$2(() => {
|
|
73907
73918
|
if (element) {
|
|
73908
73919
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
73909
73920
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -73936,32 +73947,32 @@ function useSize(element) {
|
|
|
73936
73947
|
return size;
|
|
73937
73948
|
}
|
|
73938
73949
|
|
|
73939
|
-
var POPPER_NAME = "Popper";
|
|
73940
|
-
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
73941
|
-
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
73942
|
-
var Popper = (props) => {
|
|
73950
|
+
var POPPER_NAME$1 = "Popper";
|
|
73951
|
+
var [createPopperContext$1, createPopperScope$1] = createContextScope$2(POPPER_NAME$1);
|
|
73952
|
+
var [PopperProvider$1, usePopperContext$1] = createPopperContext$1(POPPER_NAME$1);
|
|
73953
|
+
var Popper$1 = (props) => {
|
|
73943
73954
|
const { __scopePopper, children } = props;
|
|
73944
73955
|
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
73945
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
73956
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider$1, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
73946
73957
|
};
|
|
73947
|
-
Popper.displayName = POPPER_NAME;
|
|
73948
|
-
var ANCHOR_NAME = "PopperAnchor";
|
|
73949
|
-
var PopperAnchor = React__namespace.forwardRef(
|
|
73958
|
+
Popper$1.displayName = POPPER_NAME$1;
|
|
73959
|
+
var ANCHOR_NAME$2 = "PopperAnchor";
|
|
73960
|
+
var PopperAnchor$1 = React__namespace.forwardRef(
|
|
73950
73961
|
(props, forwardedRef) => {
|
|
73951
73962
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
73952
|
-
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
73963
|
+
const context = usePopperContext$1(ANCHOR_NAME$2, __scopePopper);
|
|
73953
73964
|
const ref = React__namespace.useRef(null);
|
|
73954
|
-
const composedRefs = useComposedRefs$
|
|
73965
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
73955
73966
|
React__namespace.useEffect(() => {
|
|
73956
73967
|
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
73957
73968
|
});
|
|
73958
|
-
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive$
|
|
73969
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive$2.div, { ...anchorProps, ref: composedRefs });
|
|
73959
73970
|
}
|
|
73960
73971
|
);
|
|
73961
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
73962
|
-
var CONTENT_NAME$
|
|
73963
|
-
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$
|
|
73964
|
-
var PopperContent = React__namespace.forwardRef(
|
|
73972
|
+
PopperAnchor$1.displayName = ANCHOR_NAME$2;
|
|
73973
|
+
var CONTENT_NAME$3 = "PopperContent";
|
|
73974
|
+
var [PopperContentProvider$1, useContentContext$1] = createPopperContext$1(CONTENT_NAME$3);
|
|
73975
|
+
var PopperContent$1 = React__namespace.forwardRef(
|
|
73965
73976
|
(props, forwardedRef) => {
|
|
73966
73977
|
const {
|
|
73967
73978
|
__scopePopper,
|
|
@@ -73979,11 +73990,11 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73979
73990
|
onPlaced,
|
|
73980
73991
|
...contentProps
|
|
73981
73992
|
} = props;
|
|
73982
|
-
const context = usePopperContext(CONTENT_NAME$
|
|
73993
|
+
const context = usePopperContext$1(CONTENT_NAME$3, __scopePopper);
|
|
73983
73994
|
const [content, setContent] = React__namespace.useState(null);
|
|
73984
|
-
const composedRefs = useComposedRefs$
|
|
73995
|
+
const composedRefs = useComposedRefs$2(forwardedRef, (node) => setContent(node));
|
|
73985
73996
|
const [arrow$1, setArrow] = React__namespace.useState(null);
|
|
73986
|
-
const arrowSize = useSize(arrow$1);
|
|
73997
|
+
const arrowSize = useSize$1(arrow$1);
|
|
73987
73998
|
const arrowWidth = arrowSize?.width ?? 0;
|
|
73988
73999
|
const arrowHeight = arrowSize?.height ?? 0;
|
|
73989
74000
|
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
@@ -73992,7 +74003,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73992
74003
|
const hasExplicitBoundaries = boundary.length > 0;
|
|
73993
74004
|
const detectOverflowOptions = {
|
|
73994
74005
|
padding: collisionPadding,
|
|
73995
|
-
boundary: boundary.filter(isNotNull),
|
|
74006
|
+
boundary: boundary.filter(isNotNull$1),
|
|
73996
74007
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
73997
74008
|
altBoundary: hasExplicitBoundaries
|
|
73998
74009
|
};
|
|
@@ -74030,13 +74041,13 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
74030
74041
|
}
|
|
74031
74042
|
}),
|
|
74032
74043
|
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
74033
|
-
transformOrigin({ arrowWidth, arrowHeight }),
|
|
74044
|
+
transformOrigin$1({ arrowWidth, arrowHeight }),
|
|
74034
74045
|
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
74035
74046
|
]
|
|
74036
74047
|
});
|
|
74037
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
74038
|
-
const handlePlaced = useCallbackRef(onPlaced);
|
|
74039
|
-
useLayoutEffect2$
|
|
74048
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
74049
|
+
const handlePlaced = useCallbackRef$2(onPlaced);
|
|
74050
|
+
useLayoutEffect2$2(() => {
|
|
74040
74051
|
if (isPositioned) {
|
|
74041
74052
|
handlePlaced?.();
|
|
74042
74053
|
}
|
|
@@ -74045,7 +74056,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
74045
74056
|
const arrowY = middlewareData.arrow?.y;
|
|
74046
74057
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
74047
74058
|
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
74048
|
-
useLayoutEffect2$
|
|
74059
|
+
useLayoutEffect2$2(() => {
|
|
74049
74060
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
74050
74061
|
}, [content]);
|
|
74051
74062
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -74073,7 +74084,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
74073
74084
|
},
|
|
74074
74085
|
dir: props.dir,
|
|
74075
74086
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74076
|
-
PopperContentProvider,
|
|
74087
|
+
PopperContentProvider$1,
|
|
74077
74088
|
{
|
|
74078
74089
|
scope: __scopePopper,
|
|
74079
74090
|
placedSide,
|
|
@@ -74082,7 +74093,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
74082
74093
|
arrowY,
|
|
74083
74094
|
shouldHideArrow: cannotCenterArrow,
|
|
74084
74095
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74085
|
-
Primitive$
|
|
74096
|
+
Primitive$2.div,
|
|
74086
74097
|
{
|
|
74087
74098
|
"data-side": placedSide,
|
|
74088
74099
|
"data-align": placedAlign,
|
|
@@ -74102,18 +74113,18 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
74102
74113
|
);
|
|
74103
74114
|
}
|
|
74104
74115
|
);
|
|
74105
|
-
PopperContent.displayName = CONTENT_NAME$
|
|
74106
|
-
var ARROW_NAME$
|
|
74107
|
-
var OPPOSITE_SIDE = {
|
|
74116
|
+
PopperContent$1.displayName = CONTENT_NAME$3;
|
|
74117
|
+
var ARROW_NAME$3 = "PopperArrow";
|
|
74118
|
+
var OPPOSITE_SIDE$1 = {
|
|
74108
74119
|
top: "bottom",
|
|
74109
74120
|
right: "left",
|
|
74110
74121
|
bottom: "top",
|
|
74111
74122
|
left: "right"
|
|
74112
74123
|
};
|
|
74113
|
-
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
74124
|
+
var PopperArrow$1 = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
74114
74125
|
const { __scopePopper, ...arrowProps } = props;
|
|
74115
|
-
const contentContext = useContentContext(ARROW_NAME$
|
|
74116
|
-
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
74126
|
+
const contentContext = useContentContext$1(ARROW_NAME$3, __scopePopper);
|
|
74127
|
+
const baseSide = OPPOSITE_SIDE$1[contentContext.placedSide];
|
|
74117
74128
|
return (
|
|
74118
74129
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
74119
74130
|
// doesn't report size as we'd expect on SVG elements.
|
|
@@ -74142,7 +74153,7 @@ var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwa
|
|
|
74142
74153
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
74143
74154
|
},
|
|
74144
74155
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74145
|
-
Root$
|
|
74156
|
+
Root$3,
|
|
74146
74157
|
{
|
|
74147
74158
|
...arrowProps,
|
|
74148
74159
|
ref: forwardedRef,
|
|
@@ -74157,11 +74168,11 @@ var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwa
|
|
|
74157
74168
|
)
|
|
74158
74169
|
);
|
|
74159
74170
|
});
|
|
74160
|
-
PopperArrow.displayName = ARROW_NAME$
|
|
74161
|
-
function isNotNull(value) {
|
|
74171
|
+
PopperArrow$1.displayName = ARROW_NAME$3;
|
|
74172
|
+
function isNotNull$1(value) {
|
|
74162
74173
|
return value !== null;
|
|
74163
74174
|
}
|
|
74164
|
-
var transformOrigin = (options) => ({
|
|
74175
|
+
var transformOrigin$1 = (options) => ({
|
|
74165
74176
|
name: "transformOrigin",
|
|
74166
74177
|
options,
|
|
74167
74178
|
fn(data) {
|
|
@@ -74170,7 +74181,7 @@ var transformOrigin = (options) => ({
|
|
|
74170
74181
|
const isArrowHidden = cannotCenterArrow;
|
|
74171
74182
|
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
74172
74183
|
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
74173
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
74184
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
74174
74185
|
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
74175
74186
|
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
74176
74187
|
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
@@ -74192,32 +74203,32 @@ var transformOrigin = (options) => ({
|
|
|
74192
74203
|
return { data: { x, y } };
|
|
74193
74204
|
}
|
|
74194
74205
|
});
|
|
74195
|
-
function getSideAndAlignFromPlacement(placement) {
|
|
74206
|
+
function getSideAndAlignFromPlacement$1(placement) {
|
|
74196
74207
|
const [side, align = "center"] = placement.split("-");
|
|
74197
74208
|
return [side, align];
|
|
74198
74209
|
}
|
|
74199
|
-
var Root2 = Popper;
|
|
74200
|
-
var Anchor = PopperAnchor;
|
|
74201
|
-
var Content = PopperContent;
|
|
74202
|
-
var Arrow = PopperArrow;
|
|
74210
|
+
var Root2$2 = Popper$1;
|
|
74211
|
+
var Anchor$1 = PopperAnchor$1;
|
|
74212
|
+
var Content$1 = PopperContent$1;
|
|
74213
|
+
var Arrow$2 = PopperArrow$1;
|
|
74203
74214
|
|
|
74204
74215
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
74205
|
-
function setRef(ref, value) {
|
|
74216
|
+
function setRef$1(ref, value) {
|
|
74206
74217
|
if (typeof ref === "function") {
|
|
74207
74218
|
ref(value);
|
|
74208
74219
|
} else if (ref !== null && ref !== void 0) {
|
|
74209
74220
|
ref.current = value;
|
|
74210
74221
|
}
|
|
74211
74222
|
}
|
|
74212
|
-
function composeRefs(...refs) {
|
|
74213
|
-
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
74223
|
+
function composeRefs$1(...refs) {
|
|
74224
|
+
return (node) => refs.forEach((ref) => setRef$1(ref, node));
|
|
74214
74225
|
}
|
|
74215
|
-
function useComposedRefs(...refs) {
|
|
74216
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
74226
|
+
function useComposedRefs$1(...refs) {
|
|
74227
|
+
return React__namespace.useCallback(composeRefs$1(...refs), refs);
|
|
74217
74228
|
}
|
|
74218
74229
|
|
|
74219
74230
|
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
74220
|
-
var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
74231
|
+
var useLayoutEffect2$1 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
74221
74232
|
};
|
|
74222
74233
|
|
|
74223
74234
|
function useStateMachine(initialState, machine) {
|
|
@@ -74232,7 +74243,7 @@ var Presence = (props) => {
|
|
|
74232
74243
|
const { present, children } = props;
|
|
74233
74244
|
const presence = usePresence(present);
|
|
74234
74245
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
74235
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
74246
|
+
const ref = useComposedRefs$1(presence.ref, getElementRef(child));
|
|
74236
74247
|
const forceMount = typeof children === "function";
|
|
74237
74248
|
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
74238
74249
|
};
|
|
@@ -74260,7 +74271,7 @@ function usePresence(present) {
|
|
|
74260
74271
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
74261
74272
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
74262
74273
|
}, [state]);
|
|
74263
|
-
useLayoutEffect2(() => {
|
|
74274
|
+
useLayoutEffect2$1(() => {
|
|
74264
74275
|
const styles = stylesRef.current;
|
|
74265
74276
|
const wasPresent = prevPresentRef.current;
|
|
74266
74277
|
const hasPresentChanged = wasPresent !== present;
|
|
@@ -74282,7 +74293,7 @@ function usePresence(present) {
|
|
|
74282
74293
|
prevPresentRef.current = present;
|
|
74283
74294
|
}
|
|
74284
74295
|
}, [present, send]);
|
|
74285
|
-
useLayoutEffect2(() => {
|
|
74296
|
+
useLayoutEffect2$1(() => {
|
|
74286
74297
|
if (node) {
|
|
74287
74298
|
let timeoutId;
|
|
74288
74299
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
@@ -74346,16 +74357,16 @@ function getElementRef(element) {
|
|
|
74346
74357
|
}
|
|
74347
74358
|
|
|
74348
74359
|
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
74349
|
-
function useControllableState({
|
|
74360
|
+
function useControllableState$1({
|
|
74350
74361
|
prop,
|
|
74351
74362
|
defaultProp,
|
|
74352
74363
|
onChange = () => {
|
|
74353
74364
|
}
|
|
74354
74365
|
}) {
|
|
74355
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
74366
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState$1({ defaultProp, onChange });
|
|
74356
74367
|
const isControlled = prop !== void 0;
|
|
74357
74368
|
const value = isControlled ? prop : uncontrolledProp;
|
|
74358
|
-
const handleChange = useCallbackRef(onChange);
|
|
74369
|
+
const handleChange = useCallbackRef$2(onChange);
|
|
74359
74370
|
const setValue = React__namespace.useCallback(
|
|
74360
74371
|
(nextValue) => {
|
|
74361
74372
|
if (isControlled) {
|
|
@@ -74370,14 +74381,14 @@ function useControllableState({
|
|
|
74370
74381
|
);
|
|
74371
74382
|
return [value, setValue];
|
|
74372
74383
|
}
|
|
74373
|
-
function useUncontrolledState({
|
|
74384
|
+
function useUncontrolledState$1({
|
|
74374
74385
|
defaultProp,
|
|
74375
74386
|
onChange
|
|
74376
74387
|
}) {
|
|
74377
74388
|
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
74378
74389
|
const [value] = uncontrolledState;
|
|
74379
74390
|
const prevValueRef = React__namespace.useRef(value);
|
|
74380
|
-
const handleChange = useCallbackRef(onChange);
|
|
74391
|
+
const handleChange = useCallbackRef$2(onChange);
|
|
74381
74392
|
React__namespace.useEffect(() => {
|
|
74382
74393
|
if (prevValueRef.current !== value) {
|
|
74383
74394
|
handleChange(value);
|
|
@@ -74388,11 +74399,11 @@ function useUncontrolledState({
|
|
|
74388
74399
|
}
|
|
74389
74400
|
|
|
74390
74401
|
// packages/react/visually-hidden/src/VisuallyHidden.tsx
|
|
74391
|
-
var NAME$
|
|
74402
|
+
var NAME$2 = "VisuallyHidden";
|
|
74392
74403
|
var VisuallyHidden = React__namespace.forwardRef(
|
|
74393
74404
|
(props, forwardedRef) => {
|
|
74394
74405
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74395
|
-
Primitive$
|
|
74406
|
+
Primitive$2.span,
|
|
74396
74407
|
{
|
|
74397
74408
|
...props,
|
|
74398
74409
|
ref: forwardedRef,
|
|
@@ -74414,13 +74425,13 @@ var VisuallyHidden = React__namespace.forwardRef(
|
|
|
74414
74425
|
);
|
|
74415
74426
|
}
|
|
74416
74427
|
);
|
|
74417
|
-
VisuallyHidden.displayName = NAME$
|
|
74418
|
-
var Root$
|
|
74428
|
+
VisuallyHidden.displayName = NAME$2;
|
|
74429
|
+
var Root$2 = VisuallyHidden;
|
|
74419
74430
|
|
|
74420
|
-
var [createTooltipContext, createTooltipScope] = createContextScope$
|
|
74421
|
-
createPopperScope
|
|
74431
|
+
var [createTooltipContext, createTooltipScope] = createContextScope$3("Tooltip", [
|
|
74432
|
+
createPopperScope$1
|
|
74422
74433
|
]);
|
|
74423
|
-
var usePopperScope = createPopperScope();
|
|
74434
|
+
var usePopperScope$1 = createPopperScope$1();
|
|
74424
74435
|
var PROVIDER_NAME = "TooltipProvider";
|
|
74425
74436
|
var DEFAULT_DELAY_DURATION = 700;
|
|
74426
74437
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
@@ -74480,14 +74491,14 @@ var Tooltip$1 = (props) => {
|
|
|
74480
74491
|
delayDuration: delayDurationProp
|
|
74481
74492
|
} = props;
|
|
74482
74493
|
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
74483
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74494
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74484
74495
|
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
74485
|
-
const contentId = useId();
|
|
74496
|
+
const contentId = useId$1();
|
|
74486
74497
|
const openTimerRef = React__namespace.useRef(0);
|
|
74487
74498
|
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
74488
74499
|
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
74489
74500
|
const wasOpenDelayedRef = React__namespace.useRef(false);
|
|
74490
|
-
const [open = false, setOpen] = useControllableState({
|
|
74501
|
+
const [open = false, setOpen] = useControllableState$1({
|
|
74491
74502
|
prop: openProp,
|
|
74492
74503
|
defaultProp: defaultOpen,
|
|
74493
74504
|
onChange: (open2) => {
|
|
@@ -74522,7 +74533,7 @@ var Tooltip$1 = (props) => {
|
|
|
74522
74533
|
React__namespace.useEffect(() => {
|
|
74523
74534
|
return () => window.clearTimeout(openTimerRef.current);
|
|
74524
74535
|
}, []);
|
|
74525
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74536
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2$2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74526
74537
|
TooltipContextProvider,
|
|
74527
74538
|
{
|
|
74528
74539
|
scope: __scopeTooltip,
|
|
@@ -74550,71 +74561,71 @@ var Tooltip$1 = (props) => {
|
|
|
74550
74561
|
) });
|
|
74551
74562
|
};
|
|
74552
74563
|
Tooltip$1.displayName = TOOLTIP_NAME;
|
|
74553
|
-
var TRIGGER_NAME = "TooltipTrigger";
|
|
74564
|
+
var TRIGGER_NAME$1 = "TooltipTrigger";
|
|
74554
74565
|
var TooltipTrigger$1 = React__namespace.forwardRef(
|
|
74555
74566
|
(props, forwardedRef) => {
|
|
74556
74567
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
74557
|
-
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
74558
|
-
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
74559
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74568
|
+
const context = useTooltipContext(TRIGGER_NAME$1, __scopeTooltip);
|
|
74569
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME$1, __scopeTooltip);
|
|
74570
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74560
74571
|
const ref = React__namespace.useRef(null);
|
|
74561
|
-
const composedRefs = useComposedRefs$
|
|
74572
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref, context.onTriggerChange);
|
|
74562
74573
|
const isPointerDownRef = React__namespace.useRef(false);
|
|
74563
74574
|
const hasPointerMoveOpenedRef = React__namespace.useRef(false);
|
|
74564
74575
|
const handlePointerUp = React__namespace.useCallback(() => isPointerDownRef.current = false, []);
|
|
74565
74576
|
React__namespace.useEffect(() => {
|
|
74566
74577
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
74567
74578
|
}, [handlePointerUp]);
|
|
74568
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74569
|
-
Primitive$
|
|
74579
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor$1, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74580
|
+
Primitive$2.button,
|
|
74570
74581
|
{
|
|
74571
74582
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
74572
74583
|
"data-state": context.stateAttribute,
|
|
74573
74584
|
...triggerProps,
|
|
74574
74585
|
ref: composedRefs,
|
|
74575
|
-
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
74586
|
+
onPointerMove: composeEventHandlers$1(props.onPointerMove, (event) => {
|
|
74576
74587
|
if (event.pointerType === "touch") return;
|
|
74577
74588
|
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
74578
74589
|
context.onTriggerEnter();
|
|
74579
74590
|
hasPointerMoveOpenedRef.current = true;
|
|
74580
74591
|
}
|
|
74581
74592
|
}),
|
|
74582
|
-
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
74593
|
+
onPointerLeave: composeEventHandlers$1(props.onPointerLeave, () => {
|
|
74583
74594
|
context.onTriggerLeave();
|
|
74584
74595
|
hasPointerMoveOpenedRef.current = false;
|
|
74585
74596
|
}),
|
|
74586
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
74597
|
+
onPointerDown: composeEventHandlers$1(props.onPointerDown, () => {
|
|
74587
74598
|
isPointerDownRef.current = true;
|
|
74588
74599
|
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
74589
74600
|
}),
|
|
74590
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
74601
|
+
onFocus: composeEventHandlers$1(props.onFocus, () => {
|
|
74591
74602
|
if (!isPointerDownRef.current) context.onOpen();
|
|
74592
74603
|
}),
|
|
74593
|
-
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
74594
|
-
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
74604
|
+
onBlur: composeEventHandlers$1(props.onBlur, context.onClose),
|
|
74605
|
+
onClick: composeEventHandlers$1(props.onClick, context.onClose)
|
|
74595
74606
|
}
|
|
74596
74607
|
) });
|
|
74597
74608
|
}
|
|
74598
74609
|
);
|
|
74599
|
-
TooltipTrigger$1.displayName = TRIGGER_NAME;
|
|
74600
|
-
var PORTAL_NAME = "TooltipPortal";
|
|
74601
|
-
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
74610
|
+
TooltipTrigger$1.displayName = TRIGGER_NAME$1;
|
|
74611
|
+
var PORTAL_NAME$2 = "TooltipPortal";
|
|
74612
|
+
var [PortalProvider$1, usePortalContext$1] = createTooltipContext(PORTAL_NAME$2, {
|
|
74602
74613
|
forceMount: void 0
|
|
74603
74614
|
});
|
|
74604
|
-
var CONTENT_NAME = "TooltipContent";
|
|
74615
|
+
var CONTENT_NAME$2 = "TooltipContent";
|
|
74605
74616
|
var TooltipContent$1 = React__namespace.forwardRef(
|
|
74606
74617
|
(props, forwardedRef) => {
|
|
74607
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74618
|
+
const portalContext = usePortalContext$1(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74608
74619
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
74609
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74620
|
+
const context = useTooltipContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74610
74621
|
return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
74611
74622
|
}
|
|
74612
74623
|
);
|
|
74613
74624
|
var TooltipContentHoverable = React__namespace.forwardRef((props, forwardedRef) => {
|
|
74614
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74615
|
-
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74625
|
+
const context = useTooltipContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74626
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74616
74627
|
const ref = React__namespace.useRef(null);
|
|
74617
|
-
const composedRefs = useComposedRefs$
|
|
74628
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
74618
74629
|
const [pointerGraceArea, setPointerGraceArea] = React__namespace.useState(null);
|
|
74619
74630
|
const { trigger, onClose } = context;
|
|
74620
74631
|
const content = ref.current;
|
|
@@ -74682,8 +74693,8 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74682
74693
|
onPointerDownOutside,
|
|
74683
74694
|
...contentProps
|
|
74684
74695
|
} = props;
|
|
74685
|
-
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
74686
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74696
|
+
const context = useTooltipContext(CONTENT_NAME$2, __scopeTooltip);
|
|
74697
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74687
74698
|
const { onClose } = context;
|
|
74688
74699
|
React__namespace.useEffect(() => {
|
|
74689
74700
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
@@ -74700,7 +74711,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74700
74711
|
}
|
|
74701
74712
|
}, [context.trigger, onClose]);
|
|
74702
74713
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74703
|
-
DismissableLayer,
|
|
74714
|
+
DismissableLayer$1,
|
|
74704
74715
|
{
|
|
74705
74716
|
asChild: true,
|
|
74706
74717
|
disableOutsidePointerEvents: false,
|
|
@@ -74709,7 +74720,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74709
74720
|
onFocusOutside: (event) => event.preventDefault(),
|
|
74710
74721
|
onDismiss: onClose,
|
|
74711
74722
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74712
|
-
Content,
|
|
74723
|
+
Content$1,
|
|
74713
74724
|
{
|
|
74714
74725
|
"data-state": context.stateAttribute,
|
|
74715
74726
|
...popperScope,
|
|
@@ -74728,7 +74739,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74728
74739
|
},
|
|
74729
74740
|
children: [
|
|
74730
74741
|
/* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
|
|
74731
|
-
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root$
|
|
74742
|
+
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root$2, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
74732
74743
|
]
|
|
74733
74744
|
}
|
|
74734
74745
|
)
|
|
@@ -74736,20 +74747,20 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74736
74747
|
);
|
|
74737
74748
|
}
|
|
74738
74749
|
);
|
|
74739
|
-
TooltipContent$1.displayName = CONTENT_NAME;
|
|
74740
|
-
var ARROW_NAME = "TooltipArrow";
|
|
74750
|
+
TooltipContent$1.displayName = CONTENT_NAME$2;
|
|
74751
|
+
var ARROW_NAME$2 = "TooltipArrow";
|
|
74741
74752
|
var TooltipArrow = React__namespace.forwardRef(
|
|
74742
74753
|
(props, forwardedRef) => {
|
|
74743
74754
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
74744
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74755
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74745
74756
|
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
74746
|
-
ARROW_NAME,
|
|
74757
|
+
ARROW_NAME$2,
|
|
74747
74758
|
__scopeTooltip
|
|
74748
74759
|
);
|
|
74749
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
74760
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow$2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
74750
74761
|
}
|
|
74751
74762
|
);
|
|
74752
|
-
TooltipArrow.displayName = ARROW_NAME;
|
|
74763
|
+
TooltipArrow.displayName = ARROW_NAME$2;
|
|
74753
74764
|
function getExitSideFromRect(point, rect) {
|
|
74754
74765
|
const top = Math.abs(rect.top - point.y);
|
|
74755
74766
|
const bottom = Math.abs(rect.bottom - point.y);
|
|
@@ -74865,15 +74876,15 @@ function getHullPresorted(points) {
|
|
|
74865
74876
|
}
|
|
74866
74877
|
var Provider = TooltipProvider$1;
|
|
74867
74878
|
var Root3 = Tooltip$1;
|
|
74868
|
-
var Trigger = TooltipTrigger$1;
|
|
74869
|
-
var Content2 = TooltipContent$1;
|
|
74879
|
+
var Trigger$1 = TooltipTrigger$1;
|
|
74880
|
+
var Content2$1 = TooltipContent$1;
|
|
74870
74881
|
|
|
74871
74882
|
var TooltipProvider = Provider;
|
|
74872
74883
|
var TooltipRoot = Root3;
|
|
74873
|
-
var TooltipTrigger = Trigger;
|
|
74884
|
+
var TooltipTrigger = Trigger$1;
|
|
74874
74885
|
var TooltipContent = React__namespace.forwardRef(function (_a, ref) {
|
|
74875
74886
|
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
|
|
74876
|
-
return (React__namespace.createElement(Content2, __assign({ ref: ref, sideOffset: sideOffset, className: classNames("s-bg-primary-50 s-text-primary-700 s-z-50 s-max-w-xs s-overflow-hidden s-rounded-md s-border s-bg-white s-px-3 s-py-1.5 s-text-sm s-shadow-md", "s-animate-in s-fade-in-0 s-zoom-in-95", "data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=closed]:s-zoom-out-95 data-[side=bottom]:s-slide-in-from-top-2 data-[side=left]:s-slide-in-from-right-2 data-[side=right]:s-slide-in-from-left-2 data-[side=top]:s-slide-in-from-bottom-2", className || "") }, props)));
|
|
74887
|
+
return (React__namespace.createElement(Content2$1, __assign({ ref: ref, sideOffset: sideOffset, className: classNames("s-bg-primary-50 s-text-primary-700 s-z-50 s-max-w-xs s-overflow-hidden s-rounded-md s-border s-bg-white s-px-3 s-py-1.5 s-text-sm s-shadow-md", "s-animate-in s-fade-in-0 s-zoom-in-95", "data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=closed]:s-zoom-out-95 data-[side=bottom]:s-slide-in-from-top-2 data-[side=left]:s-slide-in-from-right-2 data-[side=right]:s-slide-in-from-left-2 data-[side=top]:s-slide-in-from-bottom-2", className || "") }, props)));
|
|
74877
74888
|
});
|
|
74878
74889
|
function Tooltip(_a) {
|
|
74879
74890
|
var trigger = _a.trigger, label = _a.label, props = __rest(_a, ["trigger", "label"]);
|
|
@@ -74882,7 +74893,7 @@ function Tooltip(_a) {
|
|
|
74882
74893
|
React__namespace.createElement(TooltipTrigger, null, trigger),
|
|
74883
74894
|
React__namespace.createElement(TooltipContent, __assign({}, props), label))));
|
|
74884
74895
|
}
|
|
74885
|
-
TooltipContent.displayName = Content2.displayName;
|
|
74896
|
+
TooltipContent.displayName = Content2$1.displayName;
|
|
74886
74897
|
|
|
74887
74898
|
var IconSizes = {
|
|
74888
74899
|
xs: "s-h-4 s-w-4",
|
|
@@ -104576,7 +104587,7 @@ const unique = (columnId, leafRows) => {
|
|
|
104576
104587
|
const uniqueCount = (columnId, leafRows) => {
|
|
104577
104588
|
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
104578
104589
|
};
|
|
104579
|
-
const count = (_columnId, leafRows) => {
|
|
104590
|
+
const count$2 = (_columnId, leafRows) => {
|
|
104580
104591
|
return leafRows.length;
|
|
104581
104592
|
};
|
|
104582
104593
|
const aggregationFns = {
|
|
@@ -104588,7 +104599,7 @@ const aggregationFns = {
|
|
|
104588
104599
|
median,
|
|
104589
104600
|
unique,
|
|
104590
104601
|
uniqueCount,
|
|
104591
|
-
count
|
|
104602
|
+
count: count$2
|
|
104592
104603
|
};
|
|
104593
104604
|
|
|
104594
104605
|
//
|
|
@@ -105122,9 +105133,9 @@ const ColumnSizing = {
|
|
|
105122
105133
|
};
|
|
105123
105134
|
}
|
|
105124
105135
|
};
|
|
105125
|
-
let passiveSupported = null;
|
|
105136
|
+
let passiveSupported$1 = null;
|
|
105126
105137
|
function passiveEventSupported() {
|
|
105127
|
-
if (typeof passiveSupported === 'boolean') return passiveSupported;
|
|
105138
|
+
if (typeof passiveSupported$1 === 'boolean') return passiveSupported$1;
|
|
105128
105139
|
let supported = false;
|
|
105129
105140
|
try {
|
|
105130
105141
|
const options = {
|
|
@@ -105139,8 +105150,8 @@ function passiveEventSupported() {
|
|
|
105139
105150
|
} catch (err) {
|
|
105140
105151
|
supported = false;
|
|
105141
105152
|
}
|
|
105142
|
-
passiveSupported = supported;
|
|
105143
|
-
return passiveSupported;
|
|
105153
|
+
passiveSupported$1 = supported;
|
|
105154
|
+
return passiveSupported$1;
|
|
105144
105155
|
}
|
|
105145
105156
|
function isTouchStartEvent(e) {
|
|
105146
105157
|
return e.type === 'touchstart';
|
|
@@ -124632,7 +124643,7 @@ var defaultConstructs = /*#__PURE__*/Object.freeze({
|
|
|
124632
124643
|
* @param {ParseOptions | null | undefined} [options]
|
|
124633
124644
|
* @returns {ParseContext}
|
|
124634
124645
|
*/
|
|
124635
|
-
function parse(options) {
|
|
124646
|
+
function parse$1(options) {
|
|
124636
124647
|
const settings = options || {};
|
|
124637
124648
|
const constructs =
|
|
124638
124649
|
/** @type {FullNormalizedExtension} */
|
|
@@ -124986,7 +124997,7 @@ function fromMarkdown(value, encoding, options) {
|
|
|
124986
124997
|
}
|
|
124987
124998
|
return compiler(options)(
|
|
124988
124999
|
postprocess(
|
|
124989
|
-
parse(options).document().write(preprocess()(value, encoding, true))
|
|
125000
|
+
parse$1(options).document().write(preprocess()(value, encoding, true))
|
|
124990
125001
|
)
|
|
124991
125002
|
)
|
|
124992
125003
|
}
|
|
@@ -132519,6 +132530,263 @@ function Notification(_a) {
|
|
|
132519
132530
|
description && (React.createElement("div", { className: "s-line-clamp-3 s-pr-2 s-text-sm s-font-normal s-text-element-700" }, description)))));
|
|
132520
132531
|
}
|
|
132521
132532
|
|
|
132533
|
+
// packages/react/primitive/src/Primitive.tsx
|
|
132534
|
+
var NODES$1 = [
|
|
132535
|
+
"a",
|
|
132536
|
+
"button",
|
|
132537
|
+
"div",
|
|
132538
|
+
"form",
|
|
132539
|
+
"h2",
|
|
132540
|
+
"h3",
|
|
132541
|
+
"img",
|
|
132542
|
+
"input",
|
|
132543
|
+
"label",
|
|
132544
|
+
"li",
|
|
132545
|
+
"nav",
|
|
132546
|
+
"ol",
|
|
132547
|
+
"p",
|
|
132548
|
+
"span",
|
|
132549
|
+
"svg",
|
|
132550
|
+
"ul"
|
|
132551
|
+
];
|
|
132552
|
+
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
132553
|
+
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132554
|
+
const { asChild, ...primitiveProps } = props;
|
|
132555
|
+
const Comp = asChild ? Slot : node;
|
|
132556
|
+
if (typeof window !== "undefined") {
|
|
132557
|
+
window[Symbol.for("radix-ui")] = true;
|
|
132558
|
+
}
|
|
132559
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
132560
|
+
});
|
|
132561
|
+
Node.displayName = `Primitive.${node}`;
|
|
132562
|
+
return { ...primitive, [node]: Node };
|
|
132563
|
+
}, {});
|
|
132564
|
+
|
|
132565
|
+
// packages/react/separator/src/Separator.tsx
|
|
132566
|
+
var NAME$1 = "Separator";
|
|
132567
|
+
var DEFAULT_ORIENTATION = "horizontal";
|
|
132568
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
132569
|
+
var Separator$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132570
|
+
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
132571
|
+
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
132572
|
+
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
132573
|
+
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
132574
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132575
|
+
Primitive$1.div,
|
|
132576
|
+
{
|
|
132577
|
+
"data-orientation": orientation,
|
|
132578
|
+
...semanticProps,
|
|
132579
|
+
...domProps,
|
|
132580
|
+
ref: forwardedRef
|
|
132581
|
+
}
|
|
132582
|
+
);
|
|
132583
|
+
});
|
|
132584
|
+
Separator$1.displayName = NAME$1;
|
|
132585
|
+
function isValidOrientation(orientation) {
|
|
132586
|
+
return ORIENTATIONS.includes(orientation);
|
|
132587
|
+
}
|
|
132588
|
+
var Root$1 = Separator$1;
|
|
132589
|
+
|
|
132590
|
+
var Separator = React__namespace.forwardRef(function (_a, ref) {
|
|
132591
|
+
var className = _a.className, _b = _a.orientation, orientation = _b === void 0 ? "horizontal" : _b, _c = _a.decorative, decorative = _c === void 0 ? true : _c, props = __rest(_a, ["className", "orientation", "decorative"]);
|
|
132592
|
+
return (React__namespace.createElement(Root$1, __assign({ ref: ref, decorative: decorative, orientation: orientation, className: classNames("s-bg-separator s-shrink-0", orientation === "horizontal" ? "s-h-[1px] s-w-full" : "s-h-full s-w-[1px]", className !== null && className !== void 0 ? className : "") }, props)));
|
|
132593
|
+
});
|
|
132594
|
+
Separator.displayName = Root$1.displayName;
|
|
132595
|
+
|
|
132596
|
+
function Page(_a) {
|
|
132597
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "normal" : _b;
|
|
132598
|
+
var mainVariantClasses = variant === "normal" ? "s-h-full s-py-16" : "s-h-full s-py-4 s-px-2";
|
|
132599
|
+
var divVariantClassNames = variant === "normal" ? "s-gap-6 s-px-6" : "s-gap-4";
|
|
132600
|
+
return (React.createElement("main", { className: mainVariantClasses },
|
|
132601
|
+
React.createElement("div", { className: classNames("s-mx-auto s-flex s-h-full s-max-w-4xl s-flex-col s-text-sm s-font-normal s-text-element-900", divVariantClassNames) }, children)));
|
|
132602
|
+
}
|
|
132603
|
+
Page.Header = function (_a) {
|
|
132604
|
+
var title = _a.title, description = _a.description, icon = _a.icon;
|
|
132605
|
+
var iconClasses = "s-text-brand";
|
|
132606
|
+
return (React.createElement(Page.Vertical, { gap: "xs" },
|
|
132607
|
+
React.createElement(Icon, { visual: icon, className: iconClasses, size: "lg" }),
|
|
132608
|
+
React.createElement(Page.H, { variant: "h3" }, title),
|
|
132609
|
+
description && React.createElement(Page.P, { variant: "secondary" }, description)));
|
|
132610
|
+
};
|
|
132611
|
+
Page.SectionHeader = function (_a) {
|
|
132612
|
+
var title = _a.title, description = _a.description, action = _a.action;
|
|
132613
|
+
return (React.createElement(Page.Horizontal, { gap: "md" },
|
|
132614
|
+
React.createElement(Page.Vertical, { gap: "xs", sizing: "grow" },
|
|
132615
|
+
React.createElement(Page.H, { variant: "h5" }, title),
|
|
132616
|
+
React.createElement(Page.P, { variant: "secondary" }, description)),
|
|
132617
|
+
action && (React.createElement("div", null,
|
|
132618
|
+
React.createElement(Button, __assign({}, action))))));
|
|
132619
|
+
};
|
|
132620
|
+
Page.Separator = function () {
|
|
132621
|
+
return (React.createElement(Separator, null));
|
|
132622
|
+
};
|
|
132623
|
+
var PsizeClasses = {
|
|
132624
|
+
xs: "s-text-xs",
|
|
132625
|
+
sm: "s-text-sm",
|
|
132626
|
+
md: "s-text-base",
|
|
132627
|
+
lg: "s-text-lg",
|
|
132628
|
+
};
|
|
132629
|
+
Page.P = function (_a) {
|
|
132630
|
+
var children = _a.children, variant = _a.variant, _b = _a.size, size = _b === void 0 ? "sm" : _b;
|
|
132631
|
+
return (React.createElement("p", { className: classNames(PsizeClasses[size], variant === "secondary"
|
|
132632
|
+
? "s-text-element-700 dark:s-text-element-600-dark"
|
|
132633
|
+
: "s-text-element-900 dark:s-text-element-900-dark") }, children));
|
|
132634
|
+
};
|
|
132635
|
+
Page.H = function (_a) {
|
|
132636
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "h3" : _b;
|
|
132637
|
+
var Component = variant;
|
|
132638
|
+
var hSizes = {
|
|
132639
|
+
h1: "s-text-4xl s-font-bold",
|
|
132640
|
+
h2: "s-text-3xl s-font-bold",
|
|
132641
|
+
h3: "s-text-2xl s-font-bold",
|
|
132642
|
+
h4: "s-text-xl s-font-semibold",
|
|
132643
|
+
h5: "s-text-lg s-font-semibold",
|
|
132644
|
+
h6: "s-text-base s-font-semibold",
|
|
132645
|
+
};
|
|
132646
|
+
return (React.createElement(Component, { className: classNames("s-text-element-900 dark:s-text-element-900-dark", hSizes[variant]) }, children));
|
|
132647
|
+
};
|
|
132648
|
+
var gapSizes = {
|
|
132649
|
+
xs: "s-gap-1",
|
|
132650
|
+
sm: "s-gap-2",
|
|
132651
|
+
md: "s-gap-3",
|
|
132652
|
+
lg: "s-gap-5",
|
|
132653
|
+
xl: "s-gap-8",
|
|
132654
|
+
none: "",
|
|
132655
|
+
};
|
|
132656
|
+
Page.Layout = function (_a) {
|
|
132657
|
+
var children = _a.children, _b = _a.direction, direction = _b === void 0 ? "vertical" : _b, sizing = _a.sizing, _c = _a.align, align = _c === void 0 ? "stretch" : _c, _d = _a.gap, gap = _d === void 0 ? "lg" : _d;
|
|
132658
|
+
switch (direction) {
|
|
132659
|
+
case "horizontal":
|
|
132660
|
+
return (React.createElement(Page.Horizontal, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132661
|
+
case "vertical":
|
|
132662
|
+
return (React.createElement(Page.Vertical, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132663
|
+
case "fluid":
|
|
132664
|
+
return (React.createElement(Page.Fluid, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132665
|
+
default:
|
|
132666
|
+
return null;
|
|
132667
|
+
}
|
|
132668
|
+
};
|
|
132669
|
+
Page.Horizontal = function (_a) {
|
|
132670
|
+
var children = _a.children, sizing = _a.sizing, _b = _a.align, align = _b === void 0 ? "left" : _b, _c = _a.gap, gap = _c === void 0 ? "lg" : _c;
|
|
132671
|
+
return (React.createElement("div", { className: classNames("s-flex s-flex-col sm:s-flex-row", sizing === "grow" ? "s-grow s-basis-0" : "", sizing === "shrink" ? "s-shrink" : "", gapSizes[gap], align === "left" ? "s-justify-start" : "", align === "center" ? "s-justify-center" : "", align === "right" ? "s-justify-end" : "", align === "stretch" ? "s-justify-stretch" : "") }, children));
|
|
132672
|
+
};
|
|
132673
|
+
Page.Vertical = function (_a) {
|
|
132674
|
+
var children = _a.children, sizing = _a.sizing, _b = _a.align, align = _b === void 0 ? "left" : _b, _c = _a.gap, gap = _c === void 0 ? "md" : _c;
|
|
132675
|
+
return (React.createElement("div", { className: classNames("s-flex s-flex-col", sizing === "grow" ? "s-grow s-basis-0" : "", sizing === "shrink" ? "s-shrink" : "", gapSizes[gap], align === "left" ? "s-items-start" : "", align === "center" ? "s-items-center" : "", align === "right" ? "s-items-end" : "") }, children));
|
|
132676
|
+
};
|
|
132677
|
+
Page.Fluid = function (_a) {
|
|
132678
|
+
var children = _a.children, sizing = _a.sizing, _b = _a.align, align = _b === void 0 ? "stretch" : _b, _c = _a.gap, gap = _c === void 0 ? "xs" : _c;
|
|
132679
|
+
return (React.createElement("div", { className: classNames("s-flex s-flex-wrap", sizing === "grow" ? "s-grow" : "", sizing === "shrink" ? "s-shrink" : "", gapSizes[gap], align === "left" ? "s-items-start" : "", align === "center" ? "s-items-center" : "", align === "right" ? "s-items-end" : "") }, children));
|
|
132680
|
+
};
|
|
132681
|
+
|
|
132682
|
+
function PaginatedCitationsGrid(_a) {
|
|
132683
|
+
var items = _a.items, _b = _a.maxItemsPerPage, maxItemsPerPage = _b === void 0 ? 9 : _b;
|
|
132684
|
+
var _c = __read(React.useState({
|
|
132685
|
+
pageIndex: 0,
|
|
132686
|
+
pageSize: maxItemsPerPage,
|
|
132687
|
+
}), 2), pagination = _c[0], setPagination = _c[1];
|
|
132688
|
+
var cols = 3;
|
|
132689
|
+
var rows = Math.ceil(Math.min(maxItemsPerPage, items.length) / cols);
|
|
132690
|
+
if (items.length === 0) {
|
|
132691
|
+
return null;
|
|
132692
|
+
}
|
|
132693
|
+
var pageIndex = pagination.pageIndex, pageSize = pagination.pageSize;
|
|
132694
|
+
// Calculate start index.
|
|
132695
|
+
var startIndex = pageIndex * pageSize;
|
|
132696
|
+
// Slice items for current page.
|
|
132697
|
+
var paginatedItems = items.slice(startIndex, startIndex + pageSize);
|
|
132698
|
+
return (React.createElement("div", { className: "s-flex s-w-full s-flex-col" },
|
|
132699
|
+
React.createElement("div", { className: classNames("s-grid s-w-full s-gap-2 s-overflow-x-hidden s-py-1", "s-grid-cols-".concat(cols), "s-grid-rows-".concat(rows)) }, paginatedItems.map(function (d, idx) {
|
|
132700
|
+
return (React.createElement(Citation, { size: "xs", sizing: "fluid", key: idx, description: d.description, href: d.href, title: d.title, type: d.type }));
|
|
132701
|
+
})),
|
|
132702
|
+
React.createElement("div", { className: classNames("s-pt-3", items.length > maxItemsPerPage ? "s-visible" : "s-collapse") },
|
|
132703
|
+
React.createElement(Pagination, { rowCount: items.length, pagination: pagination, setPagination: setPagination, size: "xs", showDetails: false, showPageButtons: false }))));
|
|
132704
|
+
}
|
|
132705
|
+
|
|
132706
|
+
// packages/core/primitive/src/primitive.tsx
|
|
132707
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
132708
|
+
return function handleEvent(event) {
|
|
132709
|
+
originalEventHandler?.(event);
|
|
132710
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
132711
|
+
return ourEventHandler?.(event);
|
|
132712
|
+
}
|
|
132713
|
+
};
|
|
132714
|
+
}
|
|
132715
|
+
|
|
132716
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
132717
|
+
function setRef(ref, value) {
|
|
132718
|
+
if (typeof ref === "function") {
|
|
132719
|
+
ref(value);
|
|
132720
|
+
} else if (ref !== null && ref !== void 0) {
|
|
132721
|
+
ref.current = value;
|
|
132722
|
+
}
|
|
132723
|
+
}
|
|
132724
|
+
function composeRefs(...refs) {
|
|
132725
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
132726
|
+
}
|
|
132727
|
+
function useComposedRefs(...refs) {
|
|
132728
|
+
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
132729
|
+
}
|
|
132730
|
+
|
|
132731
|
+
// packages/react/context/src/createContext.tsx
|
|
132732
|
+
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
132733
|
+
let defaultContexts = [];
|
|
132734
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
132735
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
132736
|
+
const index = defaultContexts.length;
|
|
132737
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
132738
|
+
const Provider = (props) => {
|
|
132739
|
+
const { scope, children, ...context } = props;
|
|
132740
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
132741
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
132742
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
132743
|
+
};
|
|
132744
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
132745
|
+
function useContext2(consumerName, scope) {
|
|
132746
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
132747
|
+
const context = React__namespace.useContext(Context);
|
|
132748
|
+
if (context) return context;
|
|
132749
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
132750
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
132751
|
+
}
|
|
132752
|
+
return [Provider, useContext2];
|
|
132753
|
+
}
|
|
132754
|
+
const createScope = () => {
|
|
132755
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
132756
|
+
return React__namespace.createContext(defaultContext);
|
|
132757
|
+
});
|
|
132758
|
+
return function useScope(scope) {
|
|
132759
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
132760
|
+
return React__namespace.useMemo(
|
|
132761
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
132762
|
+
[scope, contexts]
|
|
132763
|
+
);
|
|
132764
|
+
};
|
|
132765
|
+
};
|
|
132766
|
+
createScope.scopeName = scopeName;
|
|
132767
|
+
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
132768
|
+
}
|
|
132769
|
+
function composeContextScopes$1(...scopes) {
|
|
132770
|
+
const baseScope = scopes[0];
|
|
132771
|
+
if (scopes.length === 1) return baseScope;
|
|
132772
|
+
const createScope = () => {
|
|
132773
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
132774
|
+
useScope: createScope2(),
|
|
132775
|
+
scopeName: createScope2.scopeName
|
|
132776
|
+
}));
|
|
132777
|
+
return function useComposedScopes(overrideScopes) {
|
|
132778
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
132779
|
+
const scopeProps = useScope(overrideScopes);
|
|
132780
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
132781
|
+
return { ...nextScopes2, ...currentScope };
|
|
132782
|
+
}, {});
|
|
132783
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
132784
|
+
};
|
|
132785
|
+
};
|
|
132786
|
+
createScope.scopeName = baseScope.scopeName;
|
|
132787
|
+
return createScope;
|
|
132788
|
+
}
|
|
132789
|
+
|
|
132522
132790
|
// packages/react/primitive/src/Primitive.tsx
|
|
132523
132791
|
var NODES = [
|
|
132524
132792
|
"a",
|
|
@@ -132550,147 +132818,2004 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
132550
132818
|
Node.displayName = `Primitive.${node}`;
|
|
132551
132819
|
return { ...primitive, [node]: Node };
|
|
132552
132820
|
}, {});
|
|
132821
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
132822
|
+
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
132823
|
+
}
|
|
132553
132824
|
|
|
132554
|
-
// packages/react/
|
|
132555
|
-
|
|
132556
|
-
|
|
132557
|
-
|
|
132558
|
-
|
|
132559
|
-
|
|
132560
|
-
|
|
132561
|
-
|
|
132562
|
-
|
|
132825
|
+
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
132826
|
+
function useCallbackRef$1(callback) {
|
|
132827
|
+
const callbackRef = React__namespace.useRef(callback);
|
|
132828
|
+
React__namespace.useEffect(() => {
|
|
132829
|
+
callbackRef.current = callback;
|
|
132830
|
+
});
|
|
132831
|
+
return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
132832
|
+
}
|
|
132833
|
+
|
|
132834
|
+
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
132835
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
132836
|
+
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
132837
|
+
React__namespace.useEffect(() => {
|
|
132838
|
+
const handleKeyDown = (event) => {
|
|
132839
|
+
if (event.key === "Escape") {
|
|
132840
|
+
onEscapeKeyDown(event);
|
|
132841
|
+
}
|
|
132842
|
+
};
|
|
132843
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
132844
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
132845
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
132846
|
+
}
|
|
132847
|
+
|
|
132848
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
132849
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
132850
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
132851
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
132852
|
+
var originalBodyPointerEvents;
|
|
132853
|
+
var DismissableLayerContext = React__namespace.createContext({
|
|
132854
|
+
layers: /* @__PURE__ */ new Set(),
|
|
132855
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
132856
|
+
branches: /* @__PURE__ */ new Set()
|
|
132857
|
+
});
|
|
132858
|
+
var DismissableLayer = React__namespace.forwardRef(
|
|
132859
|
+
(props, forwardedRef) => {
|
|
132860
|
+
const {
|
|
132861
|
+
disableOutsidePointerEvents = false,
|
|
132862
|
+
onEscapeKeyDown,
|
|
132863
|
+
onPointerDownOutside,
|
|
132864
|
+
onFocusOutside,
|
|
132865
|
+
onInteractOutside,
|
|
132866
|
+
onDismiss,
|
|
132867
|
+
...layerProps
|
|
132868
|
+
} = props;
|
|
132869
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
132870
|
+
const [node, setNode] = React__namespace.useState(null);
|
|
132871
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
132872
|
+
const [, force] = React__namespace.useState({});
|
|
132873
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
132874
|
+
const layers = Array.from(context.layers);
|
|
132875
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
132876
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
132877
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
132878
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
132879
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
132880
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
132881
|
+
const target = event.target;
|
|
132882
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
132883
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
132884
|
+
onPointerDownOutside?.(event);
|
|
132885
|
+
onInteractOutside?.(event);
|
|
132886
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
132887
|
+
}, ownerDocument);
|
|
132888
|
+
const focusOutside = useFocusOutside((event) => {
|
|
132889
|
+
const target = event.target;
|
|
132890
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
132891
|
+
if (isFocusInBranch) return;
|
|
132892
|
+
onFocusOutside?.(event);
|
|
132893
|
+
onInteractOutside?.(event);
|
|
132894
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
132895
|
+
}, ownerDocument);
|
|
132896
|
+
useEscapeKeydown((event) => {
|
|
132897
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
132898
|
+
if (!isHighestLayer) return;
|
|
132899
|
+
onEscapeKeyDown?.(event);
|
|
132900
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
132901
|
+
event.preventDefault();
|
|
132902
|
+
onDismiss();
|
|
132903
|
+
}
|
|
132904
|
+
}, ownerDocument);
|
|
132905
|
+
React__namespace.useEffect(() => {
|
|
132906
|
+
if (!node) return;
|
|
132907
|
+
if (disableOutsidePointerEvents) {
|
|
132908
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
132909
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
132910
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
132911
|
+
}
|
|
132912
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
132913
|
+
}
|
|
132914
|
+
context.layers.add(node);
|
|
132915
|
+
dispatchUpdate();
|
|
132916
|
+
return () => {
|
|
132917
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
132918
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
132919
|
+
}
|
|
132920
|
+
};
|
|
132921
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
132922
|
+
React__namespace.useEffect(() => {
|
|
132923
|
+
return () => {
|
|
132924
|
+
if (!node) return;
|
|
132925
|
+
context.layers.delete(node);
|
|
132926
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
132927
|
+
dispatchUpdate();
|
|
132928
|
+
};
|
|
132929
|
+
}, [node, context]);
|
|
132930
|
+
React__namespace.useEffect(() => {
|
|
132931
|
+
const handleUpdate = () => force({});
|
|
132932
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
132933
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
132934
|
+
}, []);
|
|
132935
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132936
|
+
Primitive.div,
|
|
132937
|
+
{
|
|
132938
|
+
...layerProps,
|
|
132939
|
+
ref: composedRefs,
|
|
132940
|
+
style: {
|
|
132941
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
132942
|
+
...props.style
|
|
132943
|
+
},
|
|
132944
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
132945
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
132946
|
+
onPointerDownCapture: composeEventHandlers(
|
|
132947
|
+
props.onPointerDownCapture,
|
|
132948
|
+
pointerDownOutside.onPointerDownCapture
|
|
132949
|
+
)
|
|
132950
|
+
}
|
|
132951
|
+
);
|
|
132952
|
+
}
|
|
132953
|
+
);
|
|
132954
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
132955
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
132956
|
+
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132957
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
132958
|
+
const ref = React__namespace.useRef(null);
|
|
132959
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
132960
|
+
React__namespace.useEffect(() => {
|
|
132961
|
+
const node = ref.current;
|
|
132962
|
+
if (node) {
|
|
132963
|
+
context.branches.add(node);
|
|
132964
|
+
return () => {
|
|
132965
|
+
context.branches.delete(node);
|
|
132966
|
+
};
|
|
132967
|
+
}
|
|
132968
|
+
}, [context.branches]);
|
|
132969
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
132970
|
+
});
|
|
132971
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
132972
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
132973
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
132974
|
+
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
132975
|
+
const handleClickRef = React__namespace.useRef(() => {
|
|
132976
|
+
});
|
|
132977
|
+
React__namespace.useEffect(() => {
|
|
132978
|
+
const handlePointerDown = (event) => {
|
|
132979
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
132980
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
132981
|
+
handleAndDispatchCustomEvent(
|
|
132982
|
+
POINTER_DOWN_OUTSIDE,
|
|
132983
|
+
handlePointerDownOutside,
|
|
132984
|
+
eventDetail,
|
|
132985
|
+
{ discrete: true }
|
|
132986
|
+
);
|
|
132987
|
+
};
|
|
132988
|
+
const eventDetail = { originalEvent: event };
|
|
132989
|
+
if (event.pointerType === "touch") {
|
|
132990
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
132991
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
132992
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
132993
|
+
} else {
|
|
132994
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
132995
|
+
}
|
|
132996
|
+
} else {
|
|
132997
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
132998
|
+
}
|
|
132999
|
+
isPointerInsideReactTreeRef.current = false;
|
|
133000
|
+
};
|
|
133001
|
+
const timerId = window.setTimeout(() => {
|
|
133002
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
133003
|
+
}, 0);
|
|
133004
|
+
return () => {
|
|
133005
|
+
window.clearTimeout(timerId);
|
|
133006
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
133007
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
133008
|
+
};
|
|
133009
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
133010
|
+
return {
|
|
133011
|
+
// ensures we check React component tree (not just DOM tree)
|
|
133012
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
133013
|
+
};
|
|
133014
|
+
}
|
|
133015
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
133016
|
+
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
133017
|
+
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
133018
|
+
React__namespace.useEffect(() => {
|
|
133019
|
+
const handleFocus = (event) => {
|
|
133020
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
133021
|
+
const eventDetail = { originalEvent: event };
|
|
133022
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
133023
|
+
discrete: false
|
|
133024
|
+
});
|
|
133025
|
+
}
|
|
133026
|
+
};
|
|
133027
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
133028
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
133029
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
133030
|
+
return {
|
|
133031
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
133032
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
133033
|
+
};
|
|
133034
|
+
}
|
|
133035
|
+
function dispatchUpdate() {
|
|
133036
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
133037
|
+
document.dispatchEvent(event);
|
|
133038
|
+
}
|
|
133039
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
133040
|
+
const target = detail.originalEvent.target;
|
|
133041
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
133042
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
133043
|
+
if (discrete) {
|
|
133044
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
133045
|
+
} else {
|
|
133046
|
+
target.dispatchEvent(event);
|
|
133047
|
+
}
|
|
133048
|
+
}
|
|
133049
|
+
|
|
133050
|
+
var count$1 = 0;
|
|
133051
|
+
function useFocusGuards() {
|
|
133052
|
+
React__namespace.useEffect(() => {
|
|
133053
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
133054
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
133055
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
133056
|
+
count$1++;
|
|
133057
|
+
return () => {
|
|
133058
|
+
if (count$1 === 1) {
|
|
133059
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
133060
|
+
}
|
|
133061
|
+
count$1--;
|
|
133062
|
+
};
|
|
133063
|
+
}, []);
|
|
133064
|
+
}
|
|
133065
|
+
function createFocusGuard() {
|
|
133066
|
+
const element = document.createElement("span");
|
|
133067
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
133068
|
+
element.tabIndex = 0;
|
|
133069
|
+
element.style.outline = "none";
|
|
133070
|
+
element.style.opacity = "0";
|
|
133071
|
+
element.style.position = "fixed";
|
|
133072
|
+
element.style.pointerEvents = "none";
|
|
133073
|
+
return element;
|
|
133074
|
+
}
|
|
133075
|
+
|
|
133076
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
133077
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
133078
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
133079
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
133080
|
+
var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
|
|
133081
|
+
const {
|
|
133082
|
+
loop = false,
|
|
133083
|
+
trapped = false,
|
|
133084
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
133085
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
133086
|
+
...scopeProps
|
|
133087
|
+
} = props;
|
|
133088
|
+
const [container, setContainer] = React__namespace.useState(null);
|
|
133089
|
+
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
133090
|
+
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
133091
|
+
const lastFocusedElementRef = React__namespace.useRef(null);
|
|
133092
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
133093
|
+
const focusScope = React__namespace.useRef({
|
|
133094
|
+
paused: false,
|
|
133095
|
+
pause() {
|
|
133096
|
+
this.paused = true;
|
|
133097
|
+
},
|
|
133098
|
+
resume() {
|
|
133099
|
+
this.paused = false;
|
|
133100
|
+
}
|
|
133101
|
+
}).current;
|
|
133102
|
+
React__namespace.useEffect(() => {
|
|
133103
|
+
if (trapped) {
|
|
133104
|
+
let handleFocusIn2 = function(event) {
|
|
133105
|
+
if (focusScope.paused || !container) return;
|
|
133106
|
+
const target = event.target;
|
|
133107
|
+
if (container.contains(target)) {
|
|
133108
|
+
lastFocusedElementRef.current = target;
|
|
133109
|
+
} else {
|
|
133110
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
133111
|
+
}
|
|
133112
|
+
}, handleFocusOut2 = function(event) {
|
|
133113
|
+
if (focusScope.paused || !container) return;
|
|
133114
|
+
const relatedTarget = event.relatedTarget;
|
|
133115
|
+
if (relatedTarget === null) return;
|
|
133116
|
+
if (!container.contains(relatedTarget)) {
|
|
133117
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
133118
|
+
}
|
|
133119
|
+
}, handleMutations2 = function(mutations) {
|
|
133120
|
+
const focusedElement = document.activeElement;
|
|
133121
|
+
if (focusedElement !== document.body) return;
|
|
133122
|
+
for (const mutation of mutations) {
|
|
133123
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
133124
|
+
}
|
|
133125
|
+
};
|
|
133126
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
133127
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
133128
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
133129
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
133130
|
+
return () => {
|
|
133131
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
133132
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
133133
|
+
mutationObserver.disconnect();
|
|
133134
|
+
};
|
|
133135
|
+
}
|
|
133136
|
+
}, [trapped, container, focusScope.paused]);
|
|
133137
|
+
React__namespace.useEffect(() => {
|
|
133138
|
+
if (container) {
|
|
133139
|
+
focusScopesStack.add(focusScope);
|
|
133140
|
+
const previouslyFocusedElement = document.activeElement;
|
|
133141
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
133142
|
+
if (!hasFocusedCandidate) {
|
|
133143
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
133144
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
133145
|
+
container.dispatchEvent(mountEvent);
|
|
133146
|
+
if (!mountEvent.defaultPrevented) {
|
|
133147
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
133148
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
133149
|
+
focus(container);
|
|
133150
|
+
}
|
|
133151
|
+
}
|
|
133152
|
+
}
|
|
133153
|
+
return () => {
|
|
133154
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
133155
|
+
setTimeout(() => {
|
|
133156
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
133157
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
133158
|
+
container.dispatchEvent(unmountEvent);
|
|
133159
|
+
if (!unmountEvent.defaultPrevented) {
|
|
133160
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
133161
|
+
}
|
|
133162
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
133163
|
+
focusScopesStack.remove(focusScope);
|
|
133164
|
+
}, 0);
|
|
133165
|
+
};
|
|
133166
|
+
}
|
|
133167
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
133168
|
+
const handleKeyDown = React__namespace.useCallback(
|
|
133169
|
+
(event) => {
|
|
133170
|
+
if (!loop && !trapped) return;
|
|
133171
|
+
if (focusScope.paused) return;
|
|
133172
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
133173
|
+
const focusedElement = document.activeElement;
|
|
133174
|
+
if (isTabKey && focusedElement) {
|
|
133175
|
+
const container2 = event.currentTarget;
|
|
133176
|
+
const [first, last] = getTabbableEdges(container2);
|
|
133177
|
+
const hasTabbableElementsInside = first && last;
|
|
133178
|
+
if (!hasTabbableElementsInside) {
|
|
133179
|
+
if (focusedElement === container2) event.preventDefault();
|
|
133180
|
+
} else {
|
|
133181
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
133182
|
+
event.preventDefault();
|
|
133183
|
+
if (loop) focus(first, { select: true });
|
|
133184
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
133185
|
+
event.preventDefault();
|
|
133186
|
+
if (loop) focus(last, { select: true });
|
|
133187
|
+
}
|
|
133188
|
+
}
|
|
133189
|
+
}
|
|
133190
|
+
},
|
|
133191
|
+
[loop, trapped, focusScope.paused]
|
|
133192
|
+
);
|
|
133193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
133194
|
+
});
|
|
133195
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
133196
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
133197
|
+
const previouslyFocusedElement = document.activeElement;
|
|
133198
|
+
for (const candidate of candidates) {
|
|
133199
|
+
focus(candidate, { select });
|
|
133200
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
133201
|
+
}
|
|
133202
|
+
}
|
|
133203
|
+
function getTabbableEdges(container) {
|
|
133204
|
+
const candidates = getTabbableCandidates(container);
|
|
133205
|
+
const first = findVisible(candidates, container);
|
|
133206
|
+
const last = findVisible(candidates.reverse(), container);
|
|
133207
|
+
return [first, last];
|
|
133208
|
+
}
|
|
133209
|
+
function getTabbableCandidates(container) {
|
|
133210
|
+
const nodes = [];
|
|
133211
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
133212
|
+
acceptNode: (node) => {
|
|
133213
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
133214
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
133215
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
133216
|
+
}
|
|
133217
|
+
});
|
|
133218
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
133219
|
+
return nodes;
|
|
133220
|
+
}
|
|
133221
|
+
function findVisible(elements, container) {
|
|
133222
|
+
for (const element of elements) {
|
|
133223
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
133224
|
+
}
|
|
133225
|
+
}
|
|
133226
|
+
function isHidden(node, { upTo }) {
|
|
133227
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
133228
|
+
while (node) {
|
|
133229
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
133230
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
133231
|
+
node = node.parentElement;
|
|
133232
|
+
}
|
|
133233
|
+
return false;
|
|
133234
|
+
}
|
|
133235
|
+
function isSelectableInput(element) {
|
|
133236
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
133237
|
+
}
|
|
133238
|
+
function focus(element, { select = false } = {}) {
|
|
133239
|
+
if (element && element.focus) {
|
|
133240
|
+
const previouslyFocusedElement = document.activeElement;
|
|
133241
|
+
element.focus({ preventScroll: true });
|
|
133242
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
133243
|
+
element.select();
|
|
133244
|
+
}
|
|
133245
|
+
}
|
|
133246
|
+
var focusScopesStack = createFocusScopesStack();
|
|
133247
|
+
function createFocusScopesStack() {
|
|
133248
|
+
let stack = [];
|
|
133249
|
+
return {
|
|
133250
|
+
add(focusScope) {
|
|
133251
|
+
const activeFocusScope = stack[0];
|
|
133252
|
+
if (focusScope !== activeFocusScope) {
|
|
133253
|
+
activeFocusScope?.pause();
|
|
133254
|
+
}
|
|
133255
|
+
stack = arrayRemove(stack, focusScope);
|
|
133256
|
+
stack.unshift(focusScope);
|
|
133257
|
+
},
|
|
133258
|
+
remove(focusScope) {
|
|
133259
|
+
stack = arrayRemove(stack, focusScope);
|
|
133260
|
+
stack[0]?.resume();
|
|
133261
|
+
}
|
|
133262
|
+
};
|
|
133263
|
+
}
|
|
133264
|
+
function arrayRemove(array, item) {
|
|
133265
|
+
const updatedArray = [...array];
|
|
133266
|
+
const index = updatedArray.indexOf(item);
|
|
133267
|
+
if (index !== -1) {
|
|
133268
|
+
updatedArray.splice(index, 1);
|
|
133269
|
+
}
|
|
133270
|
+
return updatedArray;
|
|
133271
|
+
}
|
|
133272
|
+
function removeLinks(items) {
|
|
133273
|
+
return items.filter((item) => item.tagName !== "A");
|
|
133274
|
+
}
|
|
133275
|
+
|
|
133276
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
133277
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
133278
|
+
};
|
|
133279
|
+
|
|
133280
|
+
// packages/react/id/src/id.tsx
|
|
133281
|
+
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
133282
|
+
var count = 0;
|
|
133283
|
+
function useId(deterministicId) {
|
|
133284
|
+
const [id, setId] = React__namespace.useState(useReactId());
|
|
133285
|
+
useLayoutEffect2(() => {
|
|
133286
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
133287
|
+
}, [deterministicId]);
|
|
133288
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
133289
|
+
}
|
|
133290
|
+
|
|
133291
|
+
// packages/react/arrow/src/Arrow.tsx
|
|
133292
|
+
var NAME = "Arrow";
|
|
133293
|
+
var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
133294
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
132563
133295
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132564
|
-
Primitive.
|
|
133296
|
+
Primitive.svg,
|
|
132565
133297
|
{
|
|
132566
|
-
|
|
132567
|
-
|
|
132568
|
-
|
|
132569
|
-
|
|
133298
|
+
...arrowProps,
|
|
133299
|
+
ref: forwardedRef,
|
|
133300
|
+
width,
|
|
133301
|
+
height,
|
|
133302
|
+
viewBox: "0 0 30 10",
|
|
133303
|
+
preserveAspectRatio: "none",
|
|
133304
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
132570
133305
|
}
|
|
132571
133306
|
);
|
|
132572
133307
|
});
|
|
132573
|
-
|
|
132574
|
-
|
|
132575
|
-
|
|
133308
|
+
Arrow$1.displayName = NAME;
|
|
133309
|
+
var Root = Arrow$1;
|
|
133310
|
+
|
|
133311
|
+
// packages/react/context/src/createContext.tsx
|
|
133312
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
133313
|
+
let defaultContexts = [];
|
|
133314
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
133315
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
133316
|
+
const index = defaultContexts.length;
|
|
133317
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
133318
|
+
function Provider(props) {
|
|
133319
|
+
const { scope, children, ...context } = props;
|
|
133320
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
133321
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
133322
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
133323
|
+
}
|
|
133324
|
+
function useContext2(consumerName, scope) {
|
|
133325
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
133326
|
+
const context = React__namespace.useContext(Context);
|
|
133327
|
+
if (context) return context;
|
|
133328
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
133329
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
133330
|
+
}
|
|
133331
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
133332
|
+
return [Provider, useContext2];
|
|
133333
|
+
}
|
|
133334
|
+
const createScope = () => {
|
|
133335
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
133336
|
+
return React__namespace.createContext(defaultContext);
|
|
133337
|
+
});
|
|
133338
|
+
return function useScope(scope) {
|
|
133339
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
133340
|
+
return React__namespace.useMemo(
|
|
133341
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
133342
|
+
[scope, contexts]
|
|
133343
|
+
);
|
|
133344
|
+
};
|
|
133345
|
+
};
|
|
133346
|
+
createScope.scopeName = scopeName;
|
|
133347
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
133348
|
+
}
|
|
133349
|
+
function composeContextScopes(...scopes) {
|
|
133350
|
+
const baseScope = scopes[0];
|
|
133351
|
+
if (scopes.length === 1) return baseScope;
|
|
133352
|
+
const createScope = () => {
|
|
133353
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
133354
|
+
useScope: createScope2(),
|
|
133355
|
+
scopeName: createScope2.scopeName
|
|
133356
|
+
}));
|
|
133357
|
+
return function useComposedScopes(overrideScopes) {
|
|
133358
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
133359
|
+
const scopeProps = useScope(overrideScopes);
|
|
133360
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
133361
|
+
return { ...nextScopes2, ...currentScope };
|
|
133362
|
+
}, {});
|
|
133363
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
133364
|
+
};
|
|
133365
|
+
};
|
|
133366
|
+
createScope.scopeName = baseScope.scopeName;
|
|
133367
|
+
return createScope;
|
|
132576
133368
|
}
|
|
132577
|
-
var Root = Separator$1;
|
|
132578
133369
|
|
|
132579
|
-
|
|
132580
|
-
|
|
132581
|
-
|
|
133370
|
+
// packages/react/use-size/src/useSize.tsx
|
|
133371
|
+
function useSize(element) {
|
|
133372
|
+
const [size, setSize] = React__namespace.useState(void 0);
|
|
133373
|
+
useLayoutEffect2(() => {
|
|
133374
|
+
if (element) {
|
|
133375
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
133376
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
133377
|
+
if (!Array.isArray(entries)) {
|
|
133378
|
+
return;
|
|
133379
|
+
}
|
|
133380
|
+
if (!entries.length) {
|
|
133381
|
+
return;
|
|
133382
|
+
}
|
|
133383
|
+
const entry = entries[0];
|
|
133384
|
+
let width;
|
|
133385
|
+
let height;
|
|
133386
|
+
if ("borderBoxSize" in entry) {
|
|
133387
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
133388
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
133389
|
+
width = borderSize["inlineSize"];
|
|
133390
|
+
height = borderSize["blockSize"];
|
|
133391
|
+
} else {
|
|
133392
|
+
width = element.offsetWidth;
|
|
133393
|
+
height = element.offsetHeight;
|
|
133394
|
+
}
|
|
133395
|
+
setSize({ width, height });
|
|
133396
|
+
});
|
|
133397
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
133398
|
+
return () => resizeObserver.unobserve(element);
|
|
133399
|
+
} else {
|
|
133400
|
+
setSize(void 0);
|
|
133401
|
+
}
|
|
133402
|
+
}, [element]);
|
|
133403
|
+
return size;
|
|
133404
|
+
}
|
|
133405
|
+
|
|
133406
|
+
var POPPER_NAME = "Popper";
|
|
133407
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
133408
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
133409
|
+
var Popper = (props) => {
|
|
133410
|
+
const { __scopePopper, children } = props;
|
|
133411
|
+
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
133412
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
133413
|
+
};
|
|
133414
|
+
Popper.displayName = POPPER_NAME;
|
|
133415
|
+
var ANCHOR_NAME$1 = "PopperAnchor";
|
|
133416
|
+
var PopperAnchor = React__namespace.forwardRef(
|
|
133417
|
+
(props, forwardedRef) => {
|
|
133418
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
133419
|
+
const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
|
|
133420
|
+
const ref = React__namespace.useRef(null);
|
|
133421
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
133422
|
+
React__namespace.useEffect(() => {
|
|
133423
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
133424
|
+
});
|
|
133425
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
133426
|
+
}
|
|
133427
|
+
);
|
|
133428
|
+
PopperAnchor.displayName = ANCHOR_NAME$1;
|
|
133429
|
+
var CONTENT_NAME$1 = "PopperContent";
|
|
133430
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
|
|
133431
|
+
var PopperContent = React__namespace.forwardRef(
|
|
133432
|
+
(props, forwardedRef) => {
|
|
133433
|
+
const {
|
|
133434
|
+
__scopePopper,
|
|
133435
|
+
side = "bottom",
|
|
133436
|
+
sideOffset = 0,
|
|
133437
|
+
align = "center",
|
|
133438
|
+
alignOffset = 0,
|
|
133439
|
+
arrowPadding = 0,
|
|
133440
|
+
avoidCollisions = true,
|
|
133441
|
+
collisionBoundary = [],
|
|
133442
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
133443
|
+
sticky = "partial",
|
|
133444
|
+
hideWhenDetached = false,
|
|
133445
|
+
updatePositionStrategy = "optimized",
|
|
133446
|
+
onPlaced,
|
|
133447
|
+
...contentProps
|
|
133448
|
+
} = props;
|
|
133449
|
+
const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
|
|
133450
|
+
const [content, setContent] = React__namespace.useState(null);
|
|
133451
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
133452
|
+
const [arrow$1, setArrow] = React__namespace.useState(null);
|
|
133453
|
+
const arrowSize = useSize(arrow$1);
|
|
133454
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
133455
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
133456
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
133457
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
133458
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
133459
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
133460
|
+
const detectOverflowOptions = {
|
|
133461
|
+
padding: collisionPadding,
|
|
133462
|
+
boundary: boundary.filter(isNotNull),
|
|
133463
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
133464
|
+
altBoundary: hasExplicitBoundaries
|
|
133465
|
+
};
|
|
133466
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
133467
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
133468
|
+
strategy: "fixed",
|
|
133469
|
+
placement: desiredPlacement,
|
|
133470
|
+
whileElementsMounted: (...args) => {
|
|
133471
|
+
const cleanup = autoUpdate(...args, {
|
|
133472
|
+
animationFrame: updatePositionStrategy === "always"
|
|
133473
|
+
});
|
|
133474
|
+
return cleanup;
|
|
133475
|
+
},
|
|
133476
|
+
elements: {
|
|
133477
|
+
reference: context.anchor
|
|
133478
|
+
},
|
|
133479
|
+
middleware: [
|
|
133480
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
133481
|
+
avoidCollisions && shift({
|
|
133482
|
+
mainAxis: true,
|
|
133483
|
+
crossAxis: false,
|
|
133484
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
133485
|
+
...detectOverflowOptions
|
|
133486
|
+
}),
|
|
133487
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
133488
|
+
size({
|
|
133489
|
+
...detectOverflowOptions,
|
|
133490
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
133491
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
133492
|
+
const contentStyle = elements.floating.style;
|
|
133493
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
133494
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
133495
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
133496
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
133497
|
+
}
|
|
133498
|
+
}),
|
|
133499
|
+
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
133500
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
133501
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
133502
|
+
]
|
|
133503
|
+
});
|
|
133504
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
133505
|
+
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
133506
|
+
useLayoutEffect2(() => {
|
|
133507
|
+
if (isPositioned) {
|
|
133508
|
+
handlePlaced?.();
|
|
133509
|
+
}
|
|
133510
|
+
}, [isPositioned, handlePlaced]);
|
|
133511
|
+
const arrowX = middlewareData.arrow?.x;
|
|
133512
|
+
const arrowY = middlewareData.arrow?.y;
|
|
133513
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
133514
|
+
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
133515
|
+
useLayoutEffect2(() => {
|
|
133516
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
133517
|
+
}, [content]);
|
|
133518
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
133519
|
+
"div",
|
|
133520
|
+
{
|
|
133521
|
+
ref: refs.setFloating,
|
|
133522
|
+
"data-radix-popper-content-wrapper": "",
|
|
133523
|
+
style: {
|
|
133524
|
+
...floatingStyles,
|
|
133525
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
133526
|
+
// keep off the page when measuring
|
|
133527
|
+
minWidth: "max-content",
|
|
133528
|
+
zIndex: contentZIndex,
|
|
133529
|
+
["--radix-popper-transform-origin"]: [
|
|
133530
|
+
middlewareData.transformOrigin?.x,
|
|
133531
|
+
middlewareData.transformOrigin?.y
|
|
133532
|
+
].join(" "),
|
|
133533
|
+
// hide the content if using the hide middleware and should be hidden
|
|
133534
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
133535
|
+
// as if the PopperContent isn't there at all
|
|
133536
|
+
...middlewareData.hide?.referenceHidden && {
|
|
133537
|
+
visibility: "hidden",
|
|
133538
|
+
pointerEvents: "none"
|
|
133539
|
+
}
|
|
133540
|
+
},
|
|
133541
|
+
dir: props.dir,
|
|
133542
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133543
|
+
PopperContentProvider,
|
|
133544
|
+
{
|
|
133545
|
+
scope: __scopePopper,
|
|
133546
|
+
placedSide,
|
|
133547
|
+
onArrowChange: setArrow,
|
|
133548
|
+
arrowX,
|
|
133549
|
+
arrowY,
|
|
133550
|
+
shouldHideArrow: cannotCenterArrow,
|
|
133551
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133552
|
+
Primitive.div,
|
|
133553
|
+
{
|
|
133554
|
+
"data-side": placedSide,
|
|
133555
|
+
"data-align": placedAlign,
|
|
133556
|
+
...contentProps,
|
|
133557
|
+
ref: composedRefs,
|
|
133558
|
+
style: {
|
|
133559
|
+
...contentProps.style,
|
|
133560
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
133561
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
133562
|
+
animation: !isPositioned ? "none" : void 0
|
|
133563
|
+
}
|
|
133564
|
+
}
|
|
133565
|
+
)
|
|
133566
|
+
}
|
|
133567
|
+
)
|
|
133568
|
+
}
|
|
133569
|
+
);
|
|
133570
|
+
}
|
|
133571
|
+
);
|
|
133572
|
+
PopperContent.displayName = CONTENT_NAME$1;
|
|
133573
|
+
var ARROW_NAME$1 = "PopperArrow";
|
|
133574
|
+
var OPPOSITE_SIDE = {
|
|
133575
|
+
top: "bottom",
|
|
133576
|
+
right: "left",
|
|
133577
|
+
bottom: "top",
|
|
133578
|
+
left: "right"
|
|
133579
|
+
};
|
|
133580
|
+
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
133581
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
133582
|
+
const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
|
|
133583
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
133584
|
+
return (
|
|
133585
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
133586
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
133587
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
133588
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
133589
|
+
"span",
|
|
133590
|
+
{
|
|
133591
|
+
ref: contentContext.onArrowChange,
|
|
133592
|
+
style: {
|
|
133593
|
+
position: "absolute",
|
|
133594
|
+
left: contentContext.arrowX,
|
|
133595
|
+
top: contentContext.arrowY,
|
|
133596
|
+
[baseSide]: 0,
|
|
133597
|
+
transformOrigin: {
|
|
133598
|
+
top: "",
|
|
133599
|
+
right: "0 0",
|
|
133600
|
+
bottom: "center 0",
|
|
133601
|
+
left: "100% 0"
|
|
133602
|
+
}[contentContext.placedSide],
|
|
133603
|
+
transform: {
|
|
133604
|
+
top: "translateY(100%)",
|
|
133605
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
133606
|
+
bottom: `rotate(180deg)`,
|
|
133607
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
133608
|
+
}[contentContext.placedSide],
|
|
133609
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
133610
|
+
},
|
|
133611
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133612
|
+
Root,
|
|
133613
|
+
{
|
|
133614
|
+
...arrowProps,
|
|
133615
|
+
ref: forwardedRef,
|
|
133616
|
+
style: {
|
|
133617
|
+
...arrowProps.style,
|
|
133618
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
133619
|
+
display: "block"
|
|
133620
|
+
}
|
|
133621
|
+
}
|
|
133622
|
+
)
|
|
133623
|
+
}
|
|
133624
|
+
)
|
|
133625
|
+
);
|
|
133626
|
+
});
|
|
133627
|
+
PopperArrow.displayName = ARROW_NAME$1;
|
|
133628
|
+
function isNotNull(value) {
|
|
133629
|
+
return value !== null;
|
|
133630
|
+
}
|
|
133631
|
+
var transformOrigin = (options) => ({
|
|
133632
|
+
name: "transformOrigin",
|
|
133633
|
+
options,
|
|
133634
|
+
fn(data) {
|
|
133635
|
+
const { placement, rects, middlewareData } = data;
|
|
133636
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
133637
|
+
const isArrowHidden = cannotCenterArrow;
|
|
133638
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
133639
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
133640
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
133641
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
133642
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
133643
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
133644
|
+
let x = "";
|
|
133645
|
+
let y = "";
|
|
133646
|
+
if (placedSide === "bottom") {
|
|
133647
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
133648
|
+
y = `${-arrowHeight}px`;
|
|
133649
|
+
} else if (placedSide === "top") {
|
|
133650
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
133651
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
133652
|
+
} else if (placedSide === "right") {
|
|
133653
|
+
x = `${-arrowHeight}px`;
|
|
133654
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
133655
|
+
} else if (placedSide === "left") {
|
|
133656
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
133657
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
133658
|
+
}
|
|
133659
|
+
return { data: { x, y } };
|
|
133660
|
+
}
|
|
132582
133661
|
});
|
|
132583
|
-
|
|
133662
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
133663
|
+
const [side, align = "center"] = placement.split("-");
|
|
133664
|
+
return [side, align];
|
|
133665
|
+
}
|
|
133666
|
+
var Root2$1 = Popper;
|
|
133667
|
+
var Anchor = PopperAnchor;
|
|
133668
|
+
var Content = PopperContent;
|
|
133669
|
+
var Arrow = PopperArrow;
|
|
132584
133670
|
|
|
132585
|
-
|
|
132586
|
-
|
|
132587
|
-
|
|
132588
|
-
|
|
132589
|
-
|
|
132590
|
-
|
|
133671
|
+
var PORTAL_NAME$1 = "Portal";
|
|
133672
|
+
var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
133673
|
+
const { container: containerProp, ...portalProps } = props;
|
|
133674
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
|
133675
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
133676
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
133677
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
133678
|
+
});
|
|
133679
|
+
Portal$1.displayName = PORTAL_NAME$1;
|
|
133680
|
+
|
|
133681
|
+
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
133682
|
+
function useControllableState({
|
|
133683
|
+
prop,
|
|
133684
|
+
defaultProp,
|
|
133685
|
+
onChange = () => {
|
|
133686
|
+
}
|
|
133687
|
+
}) {
|
|
133688
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
133689
|
+
const isControlled = prop !== void 0;
|
|
133690
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
133691
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
133692
|
+
const setValue = React__namespace.useCallback(
|
|
133693
|
+
(nextValue) => {
|
|
133694
|
+
if (isControlled) {
|
|
133695
|
+
const setter = nextValue;
|
|
133696
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
133697
|
+
if (value2 !== prop) handleChange(value2);
|
|
133698
|
+
} else {
|
|
133699
|
+
setUncontrolledProp(nextValue);
|
|
133700
|
+
}
|
|
133701
|
+
},
|
|
133702
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
133703
|
+
);
|
|
133704
|
+
return [value, setValue];
|
|
132591
133705
|
}
|
|
132592
|
-
|
|
132593
|
-
|
|
132594
|
-
|
|
132595
|
-
|
|
132596
|
-
|
|
132597
|
-
|
|
132598
|
-
|
|
133706
|
+
function useUncontrolledState({
|
|
133707
|
+
defaultProp,
|
|
133708
|
+
onChange
|
|
133709
|
+
}) {
|
|
133710
|
+
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
133711
|
+
const [value] = uncontrolledState;
|
|
133712
|
+
const prevValueRef = React__namespace.useRef(value);
|
|
133713
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
133714
|
+
React__namespace.useEffect(() => {
|
|
133715
|
+
if (prevValueRef.current !== value) {
|
|
133716
|
+
handleChange(value);
|
|
133717
|
+
prevValueRef.current = value;
|
|
133718
|
+
}
|
|
133719
|
+
}, [value, prevValueRef, handleChange]);
|
|
133720
|
+
return uncontrolledState;
|
|
133721
|
+
}
|
|
133722
|
+
|
|
133723
|
+
var getDefaultParent = function (originalTarget) {
|
|
133724
|
+
if (typeof document === 'undefined') {
|
|
133725
|
+
return null;
|
|
133726
|
+
}
|
|
133727
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
133728
|
+
return sampleTarget.ownerDocument.body;
|
|
132599
133729
|
};
|
|
132600
|
-
|
|
132601
|
-
|
|
132602
|
-
|
|
132603
|
-
|
|
132604
|
-
|
|
132605
|
-
|
|
132606
|
-
action && (React.createElement("div", null,
|
|
132607
|
-
React.createElement(Button, __assign({}, action))))));
|
|
133730
|
+
var counterMap = new WeakMap();
|
|
133731
|
+
var uncontrolledNodes = new WeakMap();
|
|
133732
|
+
var markerMap = {};
|
|
133733
|
+
var lockCount = 0;
|
|
133734
|
+
var unwrapHost = function (node) {
|
|
133735
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
132608
133736
|
};
|
|
132609
|
-
|
|
132610
|
-
return
|
|
133737
|
+
var correctTargets = function (parent, targets) {
|
|
133738
|
+
return targets
|
|
133739
|
+
.map(function (target) {
|
|
133740
|
+
if (parent.contains(target)) {
|
|
133741
|
+
return target;
|
|
133742
|
+
}
|
|
133743
|
+
var correctedTarget = unwrapHost(target);
|
|
133744
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
133745
|
+
return correctedTarget;
|
|
133746
|
+
}
|
|
133747
|
+
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
|
|
133748
|
+
return null;
|
|
133749
|
+
})
|
|
133750
|
+
.filter(function (x) { return Boolean(x); });
|
|
132611
133751
|
};
|
|
132612
|
-
|
|
132613
|
-
|
|
132614
|
-
|
|
132615
|
-
|
|
132616
|
-
|
|
133752
|
+
/**
|
|
133753
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
133754
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
133755
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
133756
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
133757
|
+
* @param {String} [controlAttribute] - html Attribute to control
|
|
133758
|
+
* @return {Undo} undo command
|
|
133759
|
+
*/
|
|
133760
|
+
var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
|
|
133761
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
133762
|
+
if (!markerMap[markerName]) {
|
|
133763
|
+
markerMap[markerName] = new WeakMap();
|
|
133764
|
+
}
|
|
133765
|
+
var markerCounter = markerMap[markerName];
|
|
133766
|
+
var hiddenNodes = [];
|
|
133767
|
+
var elementsToKeep = new Set();
|
|
133768
|
+
var elementsToStop = new Set(targets);
|
|
133769
|
+
var keep = function (el) {
|
|
133770
|
+
if (!el || elementsToKeep.has(el)) {
|
|
133771
|
+
return;
|
|
133772
|
+
}
|
|
133773
|
+
elementsToKeep.add(el);
|
|
133774
|
+
keep(el.parentNode);
|
|
133775
|
+
};
|
|
133776
|
+
targets.forEach(keep);
|
|
133777
|
+
var deep = function (parent) {
|
|
133778
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
133779
|
+
return;
|
|
133780
|
+
}
|
|
133781
|
+
Array.prototype.forEach.call(parent.children, function (node) {
|
|
133782
|
+
if (elementsToKeep.has(node)) {
|
|
133783
|
+
deep(node);
|
|
133784
|
+
}
|
|
133785
|
+
else {
|
|
133786
|
+
var attr = node.getAttribute(controlAttribute);
|
|
133787
|
+
var alreadyHidden = attr !== null && attr !== 'false';
|
|
133788
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
133789
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
133790
|
+
counterMap.set(node, counterValue);
|
|
133791
|
+
markerCounter.set(node, markerValue);
|
|
133792
|
+
hiddenNodes.push(node);
|
|
133793
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
133794
|
+
uncontrolledNodes.set(node, true);
|
|
133795
|
+
}
|
|
133796
|
+
if (markerValue === 1) {
|
|
133797
|
+
node.setAttribute(markerName, 'true');
|
|
133798
|
+
}
|
|
133799
|
+
if (!alreadyHidden) {
|
|
133800
|
+
node.setAttribute(controlAttribute, 'true');
|
|
133801
|
+
}
|
|
133802
|
+
}
|
|
133803
|
+
});
|
|
133804
|
+
};
|
|
133805
|
+
deep(parentNode);
|
|
133806
|
+
elementsToKeep.clear();
|
|
133807
|
+
lockCount++;
|
|
133808
|
+
return function () {
|
|
133809
|
+
hiddenNodes.forEach(function (node) {
|
|
133810
|
+
var counterValue = counterMap.get(node) - 1;
|
|
133811
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
133812
|
+
counterMap.set(node, counterValue);
|
|
133813
|
+
markerCounter.set(node, markerValue);
|
|
133814
|
+
if (!counterValue) {
|
|
133815
|
+
if (!uncontrolledNodes.has(node)) {
|
|
133816
|
+
node.removeAttribute(controlAttribute);
|
|
133817
|
+
}
|
|
133818
|
+
uncontrolledNodes.delete(node);
|
|
133819
|
+
}
|
|
133820
|
+
if (!markerValue) {
|
|
133821
|
+
node.removeAttribute(markerName);
|
|
133822
|
+
}
|
|
133823
|
+
});
|
|
133824
|
+
lockCount--;
|
|
133825
|
+
if (!lockCount) {
|
|
133826
|
+
// clear
|
|
133827
|
+
counterMap = new WeakMap();
|
|
133828
|
+
counterMap = new WeakMap();
|
|
133829
|
+
uncontrolledNodes = new WeakMap();
|
|
133830
|
+
markerMap = {};
|
|
133831
|
+
}
|
|
133832
|
+
};
|
|
132617
133833
|
};
|
|
132618
|
-
|
|
132619
|
-
|
|
132620
|
-
|
|
132621
|
-
|
|
132622
|
-
|
|
133834
|
+
/**
|
|
133835
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
133836
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
133837
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
133838
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
133839
|
+
* @return {Undo} undo command
|
|
133840
|
+
*/
|
|
133841
|
+
var hideOthers = function (originalTarget, parentNode, markerName) {
|
|
133842
|
+
if (markerName === void 0) { markerName = 'data-aria-hidden'; }
|
|
133843
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
133844
|
+
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
133845
|
+
if (!activeParentNode) {
|
|
133846
|
+
return function () { return null; };
|
|
133847
|
+
}
|
|
133848
|
+
// we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
|
|
133849
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
|
|
133850
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
|
|
132623
133851
|
};
|
|
132624
|
-
|
|
132625
|
-
|
|
132626
|
-
|
|
132627
|
-
|
|
132628
|
-
|
|
132629
|
-
|
|
132630
|
-
|
|
132631
|
-
|
|
132632
|
-
|
|
132633
|
-
|
|
133852
|
+
|
|
133853
|
+
var zeroRightClassName = 'right-scroll-bar-position';
|
|
133854
|
+
var fullWidthClassName = 'width-before-scroll-bar';
|
|
133855
|
+
var noScrollbarsClassName = 'with-scroll-bars-hidden';
|
|
133856
|
+
/**
|
|
133857
|
+
* Name of a CSS variable containing the amount of "hidden" scrollbar
|
|
133858
|
+
* ! might be undefined ! use will fallback!
|
|
133859
|
+
*/
|
|
133860
|
+
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
|
|
133861
|
+
|
|
133862
|
+
/**
|
|
133863
|
+
* Assigns a value for a given ref, no matter of the ref format
|
|
133864
|
+
* @param {RefObject} ref - a callback function or ref object
|
|
133865
|
+
* @param value - a new value
|
|
133866
|
+
*
|
|
133867
|
+
* @see https://github.com/theKashey/use-callback-ref#assignref
|
|
133868
|
+
* @example
|
|
133869
|
+
* const refObject = useRef();
|
|
133870
|
+
* const refFn = (ref) => {....}
|
|
133871
|
+
*
|
|
133872
|
+
* assignRef(refObject, "refValue");
|
|
133873
|
+
* assignRef(refFn, "refValue");
|
|
133874
|
+
*/
|
|
133875
|
+
function assignRef(ref, value) {
|
|
133876
|
+
if (typeof ref === 'function') {
|
|
133877
|
+
ref(value);
|
|
133878
|
+
}
|
|
133879
|
+
else if (ref) {
|
|
133880
|
+
ref.current = value;
|
|
133881
|
+
}
|
|
133882
|
+
return ref;
|
|
133883
|
+
}
|
|
133884
|
+
|
|
133885
|
+
/**
|
|
133886
|
+
* creates a MutableRef with ref change callback
|
|
133887
|
+
* @param initialValue - initial ref value
|
|
133888
|
+
* @param {Function} callback - a callback to run when value changes
|
|
133889
|
+
*
|
|
133890
|
+
* @example
|
|
133891
|
+
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
|
133892
|
+
* ref.current = 1;
|
|
133893
|
+
* // prints 0 -> 1
|
|
133894
|
+
*
|
|
133895
|
+
* @see https://reactjs.org/docs/hooks-reference.html#useref
|
|
133896
|
+
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
|
|
133897
|
+
* @returns {MutableRefObject}
|
|
133898
|
+
*/
|
|
133899
|
+
function useCallbackRef(initialValue, callback) {
|
|
133900
|
+
var ref = React.useState(function () { return ({
|
|
133901
|
+
// value
|
|
133902
|
+
value: initialValue,
|
|
133903
|
+
// last callback
|
|
133904
|
+
callback: callback,
|
|
133905
|
+
// "memoized" public interface
|
|
133906
|
+
facade: {
|
|
133907
|
+
get current() {
|
|
133908
|
+
return ref.value;
|
|
133909
|
+
},
|
|
133910
|
+
set current(value) {
|
|
133911
|
+
var last = ref.value;
|
|
133912
|
+
if (last !== value) {
|
|
133913
|
+
ref.value = value;
|
|
133914
|
+
ref.callback(value, last);
|
|
133915
|
+
}
|
|
133916
|
+
},
|
|
133917
|
+
},
|
|
133918
|
+
}); })[0];
|
|
133919
|
+
// update callback
|
|
133920
|
+
ref.callback = callback;
|
|
133921
|
+
return ref.facade;
|
|
133922
|
+
}
|
|
133923
|
+
|
|
133924
|
+
/**
|
|
133925
|
+
* Merges two or more refs together providing a single interface to set their value
|
|
133926
|
+
* @param {RefObject|Ref} refs
|
|
133927
|
+
* @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
|
|
133928
|
+
*
|
|
133929
|
+
* @see {@link mergeRefs} a version without buit-in memoization
|
|
133930
|
+
* @see https://github.com/theKashey/use-callback-ref#usemergerefs
|
|
133931
|
+
* @example
|
|
133932
|
+
* const Component = React.forwardRef((props, ref) => {
|
|
133933
|
+
* const ownRef = useRef();
|
|
133934
|
+
* const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
|
|
133935
|
+
* return <div ref={domRef}>...</div>
|
|
133936
|
+
* }
|
|
133937
|
+
*/
|
|
133938
|
+
function useMergeRefs(refs, defaultValue) {
|
|
133939
|
+
return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });
|
|
133940
|
+
}
|
|
133941
|
+
|
|
133942
|
+
function ItoI(a) {
|
|
133943
|
+
return a;
|
|
133944
|
+
}
|
|
133945
|
+
function innerCreateMedium(defaults, middleware) {
|
|
133946
|
+
if (middleware === void 0) { middleware = ItoI; }
|
|
133947
|
+
var buffer = [];
|
|
133948
|
+
var assigned = false;
|
|
133949
|
+
var medium = {
|
|
133950
|
+
read: function () {
|
|
133951
|
+
if (assigned) {
|
|
133952
|
+
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
|
|
133953
|
+
}
|
|
133954
|
+
if (buffer.length) {
|
|
133955
|
+
return buffer[buffer.length - 1];
|
|
133956
|
+
}
|
|
133957
|
+
return defaults;
|
|
133958
|
+
},
|
|
133959
|
+
useMedium: function (data) {
|
|
133960
|
+
var item = middleware(data, assigned);
|
|
133961
|
+
buffer.push(item);
|
|
133962
|
+
return function () {
|
|
133963
|
+
buffer = buffer.filter(function (x) { return x !== item; });
|
|
133964
|
+
};
|
|
133965
|
+
},
|
|
133966
|
+
assignSyncMedium: function (cb) {
|
|
133967
|
+
assigned = true;
|
|
133968
|
+
while (buffer.length) {
|
|
133969
|
+
var cbs = buffer;
|
|
133970
|
+
buffer = [];
|
|
133971
|
+
cbs.forEach(cb);
|
|
133972
|
+
}
|
|
133973
|
+
buffer = {
|
|
133974
|
+
push: function (x) { return cb(x); },
|
|
133975
|
+
filter: function () { return buffer; },
|
|
133976
|
+
};
|
|
133977
|
+
},
|
|
133978
|
+
assignMedium: function (cb) {
|
|
133979
|
+
assigned = true;
|
|
133980
|
+
var pendingQueue = [];
|
|
133981
|
+
if (buffer.length) {
|
|
133982
|
+
var cbs = buffer;
|
|
133983
|
+
buffer = [];
|
|
133984
|
+
cbs.forEach(cb);
|
|
133985
|
+
pendingQueue = buffer;
|
|
133986
|
+
}
|
|
133987
|
+
var executeQueue = function () {
|
|
133988
|
+
var cbs = pendingQueue;
|
|
133989
|
+
pendingQueue = [];
|
|
133990
|
+
cbs.forEach(cb);
|
|
133991
|
+
};
|
|
133992
|
+
var cycle = function () { return Promise.resolve().then(executeQueue); };
|
|
133993
|
+
cycle();
|
|
133994
|
+
buffer = {
|
|
133995
|
+
push: function (x) {
|
|
133996
|
+
pendingQueue.push(x);
|
|
133997
|
+
cycle();
|
|
133998
|
+
},
|
|
133999
|
+
filter: function (filter) {
|
|
134000
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
134001
|
+
return buffer;
|
|
134002
|
+
},
|
|
134003
|
+
};
|
|
134004
|
+
},
|
|
132634
134005
|
};
|
|
132635
|
-
return
|
|
134006
|
+
return medium;
|
|
134007
|
+
}
|
|
134008
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
134009
|
+
function createSidecarMedium(options) {
|
|
134010
|
+
if (options === void 0) { options = {}; }
|
|
134011
|
+
var medium = innerCreateMedium(null);
|
|
134012
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
134013
|
+
return medium;
|
|
134014
|
+
}
|
|
134015
|
+
|
|
134016
|
+
var SideCar$1 = function (_a) {
|
|
134017
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
134018
|
+
if (!sideCar) {
|
|
134019
|
+
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
|
|
134020
|
+
}
|
|
134021
|
+
var Target = sideCar.read();
|
|
134022
|
+
if (!Target) {
|
|
134023
|
+
throw new Error('Sidecar medium not found');
|
|
134024
|
+
}
|
|
134025
|
+
return React__namespace.createElement(Target, __assign({}, rest));
|
|
132636
134026
|
};
|
|
132637
|
-
|
|
132638
|
-
|
|
132639
|
-
|
|
132640
|
-
|
|
132641
|
-
|
|
132642
|
-
|
|
132643
|
-
|
|
134027
|
+
SideCar$1.isSideCarExport = true;
|
|
134028
|
+
function exportSidecar(medium, exported) {
|
|
134029
|
+
medium.useMedium(exported);
|
|
134030
|
+
return SideCar$1;
|
|
134031
|
+
}
|
|
134032
|
+
|
|
134033
|
+
var effectCar = createSidecarMedium();
|
|
134034
|
+
|
|
134035
|
+
var nothing = function () {
|
|
134036
|
+
return;
|
|
132644
134037
|
};
|
|
132645
|
-
|
|
132646
|
-
|
|
132647
|
-
|
|
132648
|
-
|
|
132649
|
-
|
|
132650
|
-
|
|
132651
|
-
|
|
132652
|
-
|
|
132653
|
-
|
|
132654
|
-
|
|
132655
|
-
|
|
132656
|
-
|
|
134038
|
+
/**
|
|
134039
|
+
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
134040
|
+
*/
|
|
134041
|
+
var RemoveScroll$1 = React__namespace.forwardRef(function (props, parentRef) {
|
|
134042
|
+
var ref = React__namespace.useRef(null);
|
|
134043
|
+
var _a = React__namespace.useState({
|
|
134044
|
+
onScrollCapture: nothing,
|
|
134045
|
+
onWheelCapture: nothing,
|
|
134046
|
+
onTouchMoveCapture: nothing,
|
|
134047
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
134048
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
134049
|
+
var SideCar = sideCar;
|
|
134050
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
134051
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
134052
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
134053
|
+
enabled && (React__namespace.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
|
|
134054
|
+
forwardProps ? (React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React__namespace.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
|
|
134055
|
+
});
|
|
134056
|
+
RemoveScroll$1.defaultProps = {
|
|
134057
|
+
enabled: true,
|
|
134058
|
+
removeScrollBar: true,
|
|
134059
|
+
inert: false,
|
|
132657
134060
|
};
|
|
132658
|
-
|
|
132659
|
-
|
|
132660
|
-
|
|
134061
|
+
RemoveScroll$1.classNames = {
|
|
134062
|
+
fullWidth: fullWidthClassName,
|
|
134063
|
+
zeroRight: zeroRightClassName,
|
|
132661
134064
|
};
|
|
132662
|
-
|
|
132663
|
-
|
|
132664
|
-
|
|
134065
|
+
|
|
134066
|
+
var currentNonce;
|
|
134067
|
+
var getNonce = function () {
|
|
134068
|
+
if (currentNonce) {
|
|
134069
|
+
return currentNonce;
|
|
134070
|
+
}
|
|
134071
|
+
if (typeof __webpack_nonce__ !== 'undefined') {
|
|
134072
|
+
return __webpack_nonce__;
|
|
134073
|
+
}
|
|
134074
|
+
return undefined;
|
|
132665
134075
|
};
|
|
132666
|
-
|
|
132667
|
-
|
|
132668
|
-
|
|
134076
|
+
|
|
134077
|
+
function makeStyleTag() {
|
|
134078
|
+
if (!document)
|
|
134079
|
+
return null;
|
|
134080
|
+
var tag = document.createElement('style');
|
|
134081
|
+
tag.type = 'text/css';
|
|
134082
|
+
var nonce = getNonce();
|
|
134083
|
+
if (nonce) {
|
|
134084
|
+
tag.setAttribute('nonce', nonce);
|
|
134085
|
+
}
|
|
134086
|
+
return tag;
|
|
134087
|
+
}
|
|
134088
|
+
function injectStyles(tag, css) {
|
|
134089
|
+
// @ts-ignore
|
|
134090
|
+
if (tag.styleSheet) {
|
|
134091
|
+
// @ts-ignore
|
|
134092
|
+
tag.styleSheet.cssText = css;
|
|
134093
|
+
}
|
|
134094
|
+
else {
|
|
134095
|
+
tag.appendChild(document.createTextNode(css));
|
|
134096
|
+
}
|
|
134097
|
+
}
|
|
134098
|
+
function insertStyleTag(tag) {
|
|
134099
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
134100
|
+
head.appendChild(tag);
|
|
134101
|
+
}
|
|
134102
|
+
var stylesheetSingleton = function () {
|
|
134103
|
+
var counter = 0;
|
|
134104
|
+
var stylesheet = null;
|
|
134105
|
+
return {
|
|
134106
|
+
add: function (style) {
|
|
134107
|
+
if (counter == 0) {
|
|
134108
|
+
if ((stylesheet = makeStyleTag())) {
|
|
134109
|
+
injectStyles(stylesheet, style);
|
|
134110
|
+
insertStyleTag(stylesheet);
|
|
134111
|
+
}
|
|
134112
|
+
}
|
|
134113
|
+
counter++;
|
|
134114
|
+
},
|
|
134115
|
+
remove: function () {
|
|
134116
|
+
counter--;
|
|
134117
|
+
if (!counter && stylesheet) {
|
|
134118
|
+
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
134119
|
+
stylesheet = null;
|
|
134120
|
+
}
|
|
134121
|
+
},
|
|
134122
|
+
};
|
|
132669
134123
|
};
|
|
132670
134124
|
|
|
132671
|
-
|
|
132672
|
-
|
|
132673
|
-
|
|
132674
|
-
|
|
132675
|
-
|
|
132676
|
-
|
|
132677
|
-
|
|
132678
|
-
|
|
132679
|
-
|
|
134125
|
+
/**
|
|
134126
|
+
* creates a hook to control style singleton
|
|
134127
|
+
* @see {@link styleSingleton} for a safer component version
|
|
134128
|
+
* @example
|
|
134129
|
+
* ```tsx
|
|
134130
|
+
* const useStyle = styleHookSingleton();
|
|
134131
|
+
* ///
|
|
134132
|
+
* useStyle('body { overflow: hidden}');
|
|
134133
|
+
*/
|
|
134134
|
+
var styleHookSingleton = function () {
|
|
134135
|
+
var sheet = stylesheetSingleton();
|
|
134136
|
+
return function (styles, isDynamic) {
|
|
134137
|
+
React__namespace.useEffect(function () {
|
|
134138
|
+
sheet.add(styles);
|
|
134139
|
+
return function () {
|
|
134140
|
+
sheet.remove();
|
|
134141
|
+
};
|
|
134142
|
+
}, [styles && isDynamic]);
|
|
134143
|
+
};
|
|
134144
|
+
};
|
|
134145
|
+
|
|
134146
|
+
/**
|
|
134147
|
+
* create a Component to add styles on demand
|
|
134148
|
+
* - styles are added when first instance is mounted
|
|
134149
|
+
* - styles are removed when the last instance is unmounted
|
|
134150
|
+
* - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
|
|
134151
|
+
*/
|
|
134152
|
+
var styleSingleton = function () {
|
|
134153
|
+
var useStyle = styleHookSingleton();
|
|
134154
|
+
var Sheet = function (_a) {
|
|
134155
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
134156
|
+
useStyle(styles, dynamic);
|
|
132680
134157
|
return null;
|
|
134158
|
+
};
|
|
134159
|
+
return Sheet;
|
|
134160
|
+
};
|
|
134161
|
+
|
|
134162
|
+
var zeroGap = {
|
|
134163
|
+
left: 0,
|
|
134164
|
+
top: 0,
|
|
134165
|
+
right: 0,
|
|
134166
|
+
gap: 0,
|
|
134167
|
+
};
|
|
134168
|
+
var parse = function (x) { return parseInt(x || '', 10) || 0; };
|
|
134169
|
+
var getOffset = function (gapMode) {
|
|
134170
|
+
var cs = window.getComputedStyle(document.body);
|
|
134171
|
+
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
134172
|
+
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
134173
|
+
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
134174
|
+
return [parse(left), parse(top), parse(right)];
|
|
134175
|
+
};
|
|
134176
|
+
var getGapWidth = function (gapMode) {
|
|
134177
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
134178
|
+
if (typeof window === 'undefined') {
|
|
134179
|
+
return zeroGap;
|
|
134180
|
+
}
|
|
134181
|
+
var offsets = getOffset(gapMode);
|
|
134182
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
134183
|
+
var windowWidth = window.innerWidth;
|
|
134184
|
+
return {
|
|
134185
|
+
left: offsets[0],
|
|
134186
|
+
top: offsets[1],
|
|
134187
|
+
right: offsets[2],
|
|
134188
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
|
|
134189
|
+
};
|
|
134190
|
+
};
|
|
134191
|
+
|
|
134192
|
+
var Style = styleSingleton();
|
|
134193
|
+
var lockAttribute = 'data-scroll-locked';
|
|
134194
|
+
// important tip - once we measure scrollBar width and remove them
|
|
134195
|
+
// we could not repeat this operation
|
|
134196
|
+
// thus we are using style-singleton - only the first "yet correct" style will be applied.
|
|
134197
|
+
var getStyles = function (_a, allowRelative, gapMode, important) {
|
|
134198
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
134199
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
134200
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
134201
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
134202
|
+
gapMode === 'margin' &&
|
|
134203
|
+
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
134204
|
+
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
|
|
134205
|
+
]
|
|
134206
|
+
.filter(Boolean)
|
|
134207
|
+
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
134208
|
+
};
|
|
134209
|
+
var getCurrentUseCounter = function () {
|
|
134210
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
|
|
134211
|
+
return isFinite(counter) ? counter : 0;
|
|
134212
|
+
};
|
|
134213
|
+
var useLockAttribute = function () {
|
|
134214
|
+
React__namespace.useEffect(function () {
|
|
134215
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
134216
|
+
return function () {
|
|
134217
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
134218
|
+
if (newCounter <= 0) {
|
|
134219
|
+
document.body.removeAttribute(lockAttribute);
|
|
134220
|
+
}
|
|
134221
|
+
else {
|
|
134222
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
134223
|
+
}
|
|
134224
|
+
};
|
|
134225
|
+
}, []);
|
|
134226
|
+
};
|
|
134227
|
+
/**
|
|
134228
|
+
* Removes page scrollbar and blocks page scroll when mounted
|
|
134229
|
+
*/
|
|
134230
|
+
var RemoveScrollBar = function (_a) {
|
|
134231
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
|
|
134232
|
+
useLockAttribute();
|
|
134233
|
+
/*
|
|
134234
|
+
gap will be measured on every component mount
|
|
134235
|
+
however it will be used only by the "first" invocation
|
|
134236
|
+
due to singleton nature of <Style
|
|
134237
|
+
*/
|
|
134238
|
+
var gap = React__namespace.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
134239
|
+
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
134240
|
+
};
|
|
134241
|
+
|
|
134242
|
+
var passiveSupported = false;
|
|
134243
|
+
if (typeof window !== 'undefined') {
|
|
134244
|
+
try {
|
|
134245
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
134246
|
+
get: function () {
|
|
134247
|
+
passiveSupported = true;
|
|
134248
|
+
return true;
|
|
134249
|
+
},
|
|
134250
|
+
});
|
|
134251
|
+
// @ts-ignore
|
|
134252
|
+
window.addEventListener('test', options, options);
|
|
134253
|
+
// @ts-ignore
|
|
134254
|
+
window.removeEventListener('test', options, options);
|
|
132681
134255
|
}
|
|
132682
|
-
|
|
132683
|
-
|
|
132684
|
-
|
|
132685
|
-
|
|
132686
|
-
|
|
132687
|
-
|
|
132688
|
-
|
|
132689
|
-
|
|
132690
|
-
|
|
132691
|
-
|
|
132692
|
-
|
|
134256
|
+
catch (err) {
|
|
134257
|
+
passiveSupported = false;
|
|
134258
|
+
}
|
|
134259
|
+
}
|
|
134260
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
134261
|
+
|
|
134262
|
+
var alwaysContainsScroll = function (node) {
|
|
134263
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
134264
|
+
return node.tagName === 'TEXTAREA';
|
|
134265
|
+
};
|
|
134266
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
134267
|
+
if (!(node instanceof Element)) {
|
|
134268
|
+
return false;
|
|
134269
|
+
}
|
|
134270
|
+
var styles = window.getComputedStyle(node);
|
|
134271
|
+
return (
|
|
134272
|
+
// not-not-scrollable
|
|
134273
|
+
styles[overflow] !== 'hidden' &&
|
|
134274
|
+
// contains scroll inside self
|
|
134275
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
134276
|
+
};
|
|
134277
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
134278
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
134279
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
134280
|
+
var ownerDocument = node.ownerDocument;
|
|
134281
|
+
var current = node;
|
|
134282
|
+
do {
|
|
134283
|
+
// Skip over shadow root
|
|
134284
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
134285
|
+
current = current.host;
|
|
134286
|
+
}
|
|
134287
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
134288
|
+
if (isScrollable) {
|
|
134289
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
134290
|
+
if (scrollHeight > clientHeight) {
|
|
134291
|
+
return true;
|
|
134292
|
+
}
|
|
134293
|
+
}
|
|
134294
|
+
current = current.parentNode;
|
|
134295
|
+
} while (current && current !== ownerDocument.body);
|
|
134296
|
+
return false;
|
|
134297
|
+
};
|
|
134298
|
+
var getVScrollVariables = function (_a) {
|
|
134299
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
134300
|
+
return [
|
|
134301
|
+
scrollTop,
|
|
134302
|
+
scrollHeight,
|
|
134303
|
+
clientHeight,
|
|
134304
|
+
];
|
|
134305
|
+
};
|
|
134306
|
+
var getHScrollVariables = function (_a) {
|
|
134307
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
134308
|
+
return [
|
|
134309
|
+
scrollLeft,
|
|
134310
|
+
scrollWidth,
|
|
134311
|
+
clientWidth,
|
|
134312
|
+
];
|
|
134313
|
+
};
|
|
134314
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
134315
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
134316
|
+
};
|
|
134317
|
+
var getScrollVariables = function (axis, node) {
|
|
134318
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
134319
|
+
};
|
|
134320
|
+
var getDirectionFactor = function (axis, direction) {
|
|
134321
|
+
/**
|
|
134322
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
134323
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
134324
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
134325
|
+
*/
|
|
134326
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
134327
|
+
};
|
|
134328
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
134329
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
134330
|
+
var delta = directionFactor * sourceDelta;
|
|
134331
|
+
// find scrollable target
|
|
134332
|
+
var target = event.target;
|
|
134333
|
+
var targetInLock = endTarget.contains(target);
|
|
134334
|
+
var shouldCancelScroll = false;
|
|
134335
|
+
var isDeltaPositive = delta > 0;
|
|
134336
|
+
var availableScroll = 0;
|
|
134337
|
+
var availableScrollTop = 0;
|
|
134338
|
+
do {
|
|
134339
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
134340
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
134341
|
+
if (position || elementScroll) {
|
|
134342
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
134343
|
+
availableScroll += elementScroll;
|
|
134344
|
+
availableScrollTop += position;
|
|
134345
|
+
}
|
|
134346
|
+
}
|
|
134347
|
+
if (target instanceof ShadowRoot) {
|
|
134348
|
+
target = target.host;
|
|
134349
|
+
}
|
|
134350
|
+
else {
|
|
134351
|
+
target = target.parentNode;
|
|
134352
|
+
}
|
|
134353
|
+
} while (
|
|
134354
|
+
// portaled content
|
|
134355
|
+
(!targetInLock && target !== document.body) ||
|
|
134356
|
+
// self content
|
|
134357
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
134358
|
+
// handle epsilon around 0 (non standard zoom levels)
|
|
134359
|
+
if (isDeltaPositive &&
|
|
134360
|
+
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {
|
|
134361
|
+
shouldCancelScroll = true;
|
|
134362
|
+
}
|
|
134363
|
+
else if (!isDeltaPositive &&
|
|
134364
|
+
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {
|
|
134365
|
+
shouldCancelScroll = true;
|
|
134366
|
+
}
|
|
134367
|
+
return shouldCancelScroll;
|
|
134368
|
+
};
|
|
134369
|
+
|
|
134370
|
+
var getTouchXY = function (event) {
|
|
134371
|
+
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
134372
|
+
};
|
|
134373
|
+
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
|
|
134374
|
+
var extractRef = function (ref) {
|
|
134375
|
+
return ref && 'current' in ref ? ref.current : ref;
|
|
134376
|
+
};
|
|
134377
|
+
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
|
|
134378
|
+
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
|
|
134379
|
+
var idCounter = 0;
|
|
134380
|
+
var lockStack = [];
|
|
134381
|
+
function RemoveScrollSideCar(props) {
|
|
134382
|
+
var shouldPreventQueue = React__namespace.useRef([]);
|
|
134383
|
+
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
134384
|
+
var activeAxis = React__namespace.useRef();
|
|
134385
|
+
var id = React__namespace.useState(idCounter++)[0];
|
|
134386
|
+
var Style = React__namespace.useState(styleSingleton)[0];
|
|
134387
|
+
var lastProps = React__namespace.useRef(props);
|
|
134388
|
+
React__namespace.useEffect(function () {
|
|
134389
|
+
lastProps.current = props;
|
|
134390
|
+
}, [props]);
|
|
134391
|
+
React__namespace.useEffect(function () {
|
|
134392
|
+
if (props.inert) {
|
|
134393
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
134394
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
134395
|
+
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
|
|
134396
|
+
return function () {
|
|
134397
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
134398
|
+
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
|
|
134399
|
+
};
|
|
134400
|
+
}
|
|
134401
|
+
return;
|
|
134402
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
134403
|
+
var shouldCancelEvent = React__namespace.useCallback(function (event, parent) {
|
|
134404
|
+
if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {
|
|
134405
|
+
return !lastProps.current.allowPinchZoom;
|
|
134406
|
+
}
|
|
134407
|
+
var touch = getTouchXY(event);
|
|
134408
|
+
var touchStart = touchStartRef.current;
|
|
134409
|
+
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
|
|
134410
|
+
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
|
|
134411
|
+
var currentAxis;
|
|
134412
|
+
var target = event.target;
|
|
134413
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
|
|
134414
|
+
// allow horizontal touch move on Range inputs. They will not cause any scroll
|
|
134415
|
+
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
|
|
134416
|
+
return false;
|
|
134417
|
+
}
|
|
134418
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
134419
|
+
if (!canBeScrolledInMainDirection) {
|
|
134420
|
+
return true;
|
|
134421
|
+
}
|
|
134422
|
+
if (canBeScrolledInMainDirection) {
|
|
134423
|
+
currentAxis = moveDirection;
|
|
134424
|
+
}
|
|
134425
|
+
else {
|
|
134426
|
+
currentAxis = moveDirection === 'v' ? 'h' : 'v';
|
|
134427
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
134428
|
+
// other axis might be not scrollable
|
|
134429
|
+
}
|
|
134430
|
+
if (!canBeScrolledInMainDirection) {
|
|
134431
|
+
return false;
|
|
134432
|
+
}
|
|
134433
|
+
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
|
|
134434
|
+
activeAxis.current = currentAxis;
|
|
134435
|
+
}
|
|
134436
|
+
if (!currentAxis) {
|
|
134437
|
+
return true;
|
|
134438
|
+
}
|
|
134439
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
134440
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
|
|
134441
|
+
}, []);
|
|
134442
|
+
var shouldPrevent = React__namespace.useCallback(function (_event) {
|
|
134443
|
+
var event = _event;
|
|
134444
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
134445
|
+
// not the last active
|
|
134446
|
+
return;
|
|
134447
|
+
}
|
|
134448
|
+
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
|
|
134449
|
+
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];
|
|
134450
|
+
// self event, and should be canceled
|
|
134451
|
+
if (sourceEvent && sourceEvent.should) {
|
|
134452
|
+
if (event.cancelable) {
|
|
134453
|
+
event.preventDefault();
|
|
134454
|
+
}
|
|
134455
|
+
return;
|
|
134456
|
+
}
|
|
134457
|
+
// outside or shard event
|
|
134458
|
+
if (!sourceEvent) {
|
|
134459
|
+
var shardNodes = (lastProps.current.shards || [])
|
|
134460
|
+
.map(extractRef)
|
|
134461
|
+
.filter(Boolean)
|
|
134462
|
+
.filter(function (node) { return node.contains(event.target); });
|
|
134463
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
134464
|
+
if (shouldStop) {
|
|
134465
|
+
if (event.cancelable) {
|
|
134466
|
+
event.preventDefault();
|
|
134467
|
+
}
|
|
134468
|
+
}
|
|
134469
|
+
}
|
|
134470
|
+
}, []);
|
|
134471
|
+
var shouldCancel = React__namespace.useCallback(function (name, delta, target, should) {
|
|
134472
|
+
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
|
|
134473
|
+
shouldPreventQueue.current.push(event);
|
|
134474
|
+
setTimeout(function () {
|
|
134475
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
134476
|
+
}, 1);
|
|
134477
|
+
}, []);
|
|
134478
|
+
var scrollTouchStart = React__namespace.useCallback(function (event) {
|
|
134479
|
+
touchStartRef.current = getTouchXY(event);
|
|
134480
|
+
activeAxis.current = undefined;
|
|
134481
|
+
}, []);
|
|
134482
|
+
var scrollWheel = React__namespace.useCallback(function (event) {
|
|
134483
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
134484
|
+
}, []);
|
|
134485
|
+
var scrollTouchMove = React__namespace.useCallback(function (event) {
|
|
134486
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
134487
|
+
}, []);
|
|
134488
|
+
React__namespace.useEffect(function () {
|
|
134489
|
+
lockStack.push(Style);
|
|
134490
|
+
props.setCallbacks({
|
|
134491
|
+
onScrollCapture: scrollWheel,
|
|
134492
|
+
onWheelCapture: scrollWheel,
|
|
134493
|
+
onTouchMoveCapture: scrollTouchMove,
|
|
134494
|
+
});
|
|
134495
|
+
document.addEventListener('wheel', shouldPrevent, nonPassive);
|
|
134496
|
+
document.addEventListener('touchmove', shouldPrevent, nonPassive);
|
|
134497
|
+
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
134498
|
+
return function () {
|
|
134499
|
+
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
|
|
134500
|
+
document.removeEventListener('wheel', shouldPrevent, nonPassive);
|
|
134501
|
+
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
|
|
134502
|
+
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
134503
|
+
};
|
|
134504
|
+
}, []);
|
|
134505
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
134506
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
134507
|
+
inert ? React__namespace.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
134508
|
+
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
|
|
134509
|
+
}
|
|
134510
|
+
function getOutermostShadowParent(node) {
|
|
134511
|
+
var shadowParent = null;
|
|
134512
|
+
while (node !== null) {
|
|
134513
|
+
if (node instanceof ShadowRoot) {
|
|
134514
|
+
shadowParent = node.host;
|
|
134515
|
+
node = node.host;
|
|
134516
|
+
}
|
|
134517
|
+
node = node.parentNode;
|
|
134518
|
+
}
|
|
134519
|
+
return shadowParent;
|
|
134520
|
+
}
|
|
134521
|
+
|
|
134522
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
134523
|
+
|
|
134524
|
+
var ReactRemoveScroll = React__namespace.forwardRef(function (props, ref) { return (React__namespace.createElement(RemoveScroll$1, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
134525
|
+
ReactRemoveScroll.classNames = RemoveScroll$1.classNames;
|
|
134526
|
+
var RemoveScroll = ReactRemoveScroll;
|
|
134527
|
+
|
|
134528
|
+
var POPOVER_NAME = "Popover";
|
|
134529
|
+
var [createPopoverContext, createPopoverScope] = createContextScope$1(POPOVER_NAME, [
|
|
134530
|
+
createPopperScope
|
|
134531
|
+
]);
|
|
134532
|
+
var usePopperScope = createPopperScope();
|
|
134533
|
+
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
134534
|
+
var Popover$1 = (props) => {
|
|
134535
|
+
const {
|
|
134536
|
+
__scopePopover,
|
|
134537
|
+
children,
|
|
134538
|
+
open: openProp,
|
|
134539
|
+
defaultOpen,
|
|
134540
|
+
onOpenChange,
|
|
134541
|
+
modal = false
|
|
134542
|
+
} = props;
|
|
134543
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134544
|
+
const triggerRef = React__namespace.useRef(null);
|
|
134545
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React__namespace.useState(false);
|
|
134546
|
+
const [open = false, setOpen] = useControllableState({
|
|
134547
|
+
prop: openProp,
|
|
134548
|
+
defaultProp: defaultOpen,
|
|
134549
|
+
onChange: onOpenChange
|
|
134550
|
+
});
|
|
134551
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134552
|
+
PopoverProvider,
|
|
134553
|
+
{
|
|
134554
|
+
scope: __scopePopover,
|
|
134555
|
+
contentId: useId(),
|
|
134556
|
+
triggerRef,
|
|
134557
|
+
open,
|
|
134558
|
+
onOpenChange: setOpen,
|
|
134559
|
+
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
134560
|
+
hasCustomAnchor,
|
|
134561
|
+
onCustomAnchorAdd: React__namespace.useCallback(() => setHasCustomAnchor(true), []),
|
|
134562
|
+
onCustomAnchorRemove: React__namespace.useCallback(() => setHasCustomAnchor(false), []),
|
|
134563
|
+
modal,
|
|
134564
|
+
children
|
|
134565
|
+
}
|
|
134566
|
+
) });
|
|
134567
|
+
};
|
|
134568
|
+
Popover$1.displayName = POPOVER_NAME;
|
|
134569
|
+
var ANCHOR_NAME = "PopoverAnchor";
|
|
134570
|
+
var PopoverAnchor = React__namespace.forwardRef(
|
|
134571
|
+
(props, forwardedRef) => {
|
|
134572
|
+
const { __scopePopover, ...anchorProps } = props;
|
|
134573
|
+
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
134574
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134575
|
+
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
134576
|
+
React__namespace.useEffect(() => {
|
|
134577
|
+
onCustomAnchorAdd();
|
|
134578
|
+
return () => onCustomAnchorRemove();
|
|
134579
|
+
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
134580
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
134581
|
+
}
|
|
134582
|
+
);
|
|
134583
|
+
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
134584
|
+
var TRIGGER_NAME = "PopoverTrigger";
|
|
134585
|
+
var PopoverTrigger$1 = React__namespace.forwardRef(
|
|
134586
|
+
(props, forwardedRef) => {
|
|
134587
|
+
const { __scopePopover, ...triggerProps } = props;
|
|
134588
|
+
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
134589
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134590
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
134591
|
+
const trigger = /* @__PURE__ */ jsxRuntime.jsx(
|
|
134592
|
+
Primitive.button,
|
|
134593
|
+
{
|
|
134594
|
+
type: "button",
|
|
134595
|
+
"aria-haspopup": "dialog",
|
|
134596
|
+
"aria-expanded": context.open,
|
|
134597
|
+
"aria-controls": context.contentId,
|
|
134598
|
+
"data-state": getState(context.open),
|
|
134599
|
+
...triggerProps,
|
|
134600
|
+
ref: composedTriggerRef,
|
|
134601
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
134602
|
+
}
|
|
134603
|
+
);
|
|
134604
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
134605
|
+
}
|
|
134606
|
+
);
|
|
134607
|
+
PopoverTrigger$1.displayName = TRIGGER_NAME;
|
|
134608
|
+
var PORTAL_NAME = "PopoverPortal";
|
|
134609
|
+
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
|
|
134610
|
+
forceMount: void 0
|
|
134611
|
+
});
|
|
134612
|
+
var PopoverPortal = (props) => {
|
|
134613
|
+
const { __scopePopover, forceMount, children, container } = props;
|
|
134614
|
+
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
|
|
134615
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { asChild: true, container, children }) }) });
|
|
134616
|
+
};
|
|
134617
|
+
PopoverPortal.displayName = PORTAL_NAME;
|
|
134618
|
+
var CONTENT_NAME = "PopoverContent";
|
|
134619
|
+
var PopoverContent$1 = React__namespace.forwardRef(
|
|
134620
|
+
(props, forwardedRef) => {
|
|
134621
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
|
|
134622
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
134623
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134624
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntime.jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
134625
|
+
}
|
|
134626
|
+
);
|
|
134627
|
+
PopoverContent$1.displayName = CONTENT_NAME;
|
|
134628
|
+
var PopoverContentModal = React__namespace.forwardRef(
|
|
134629
|
+
(props, forwardedRef) => {
|
|
134630
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134631
|
+
const contentRef = React__namespace.useRef(null);
|
|
134632
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
134633
|
+
const isRightClickOutsideRef = React__namespace.useRef(false);
|
|
134634
|
+
React__namespace.useEffect(() => {
|
|
134635
|
+
const content = contentRef.current;
|
|
134636
|
+
if (content) return hideOthers(content);
|
|
134637
|
+
}, []);
|
|
134638
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134639
|
+
PopoverContentImpl,
|
|
134640
|
+
{
|
|
134641
|
+
...props,
|
|
134642
|
+
ref: composedRefs,
|
|
134643
|
+
trapFocus: context.open,
|
|
134644
|
+
disableOutsidePointerEvents: true,
|
|
134645
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
134646
|
+
event.preventDefault();
|
|
134647
|
+
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
134648
|
+
}),
|
|
134649
|
+
onPointerDownOutside: composeEventHandlers(
|
|
134650
|
+
props.onPointerDownOutside,
|
|
134651
|
+
(event) => {
|
|
134652
|
+
const originalEvent = event.detail.originalEvent;
|
|
134653
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
134654
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
134655
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
134656
|
+
},
|
|
134657
|
+
{ checkForDefaultPrevented: false }
|
|
134658
|
+
),
|
|
134659
|
+
onFocusOutside: composeEventHandlers(
|
|
134660
|
+
props.onFocusOutside,
|
|
134661
|
+
(event) => event.preventDefault(),
|
|
134662
|
+
{ checkForDefaultPrevented: false }
|
|
134663
|
+
)
|
|
134664
|
+
}
|
|
134665
|
+
) });
|
|
134666
|
+
}
|
|
134667
|
+
);
|
|
134668
|
+
var PopoverContentNonModal = React__namespace.forwardRef(
|
|
134669
|
+
(props, forwardedRef) => {
|
|
134670
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134671
|
+
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
134672
|
+
const hasPointerDownOutsideRef = React__namespace.useRef(false);
|
|
134673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134674
|
+
PopoverContentImpl,
|
|
134675
|
+
{
|
|
134676
|
+
...props,
|
|
134677
|
+
ref: forwardedRef,
|
|
134678
|
+
trapFocus: false,
|
|
134679
|
+
disableOutsidePointerEvents: false,
|
|
134680
|
+
onCloseAutoFocus: (event) => {
|
|
134681
|
+
props.onCloseAutoFocus?.(event);
|
|
134682
|
+
if (!event.defaultPrevented) {
|
|
134683
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
134684
|
+
event.preventDefault();
|
|
134685
|
+
}
|
|
134686
|
+
hasInteractedOutsideRef.current = false;
|
|
134687
|
+
hasPointerDownOutsideRef.current = false;
|
|
134688
|
+
},
|
|
134689
|
+
onInteractOutside: (event) => {
|
|
134690
|
+
props.onInteractOutside?.(event);
|
|
134691
|
+
if (!event.defaultPrevented) {
|
|
134692
|
+
hasInteractedOutsideRef.current = true;
|
|
134693
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
134694
|
+
hasPointerDownOutsideRef.current = true;
|
|
134695
|
+
}
|
|
134696
|
+
}
|
|
134697
|
+
const target = event.target;
|
|
134698
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
134699
|
+
if (targetIsTrigger) event.preventDefault();
|
|
134700
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
134701
|
+
event.preventDefault();
|
|
134702
|
+
}
|
|
134703
|
+
}
|
|
134704
|
+
}
|
|
134705
|
+
);
|
|
134706
|
+
}
|
|
134707
|
+
);
|
|
134708
|
+
var PopoverContentImpl = React__namespace.forwardRef(
|
|
134709
|
+
(props, forwardedRef) => {
|
|
134710
|
+
const {
|
|
134711
|
+
__scopePopover,
|
|
134712
|
+
trapFocus,
|
|
134713
|
+
onOpenAutoFocus,
|
|
134714
|
+
onCloseAutoFocus,
|
|
134715
|
+
disableOutsidePointerEvents,
|
|
134716
|
+
onEscapeKeyDown,
|
|
134717
|
+
onPointerDownOutside,
|
|
134718
|
+
onFocusOutside,
|
|
134719
|
+
onInteractOutside,
|
|
134720
|
+
...contentProps
|
|
134721
|
+
} = props;
|
|
134722
|
+
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
|
|
134723
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134724
|
+
useFocusGuards();
|
|
134725
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134726
|
+
FocusScope,
|
|
134727
|
+
{
|
|
134728
|
+
asChild: true,
|
|
134729
|
+
loop: true,
|
|
134730
|
+
trapped: trapFocus,
|
|
134731
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
134732
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
134733
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134734
|
+
DismissableLayer,
|
|
134735
|
+
{
|
|
134736
|
+
asChild: true,
|
|
134737
|
+
disableOutsidePointerEvents,
|
|
134738
|
+
onInteractOutside,
|
|
134739
|
+
onEscapeKeyDown,
|
|
134740
|
+
onPointerDownOutside,
|
|
134741
|
+
onFocusOutside,
|
|
134742
|
+
onDismiss: () => context.onOpenChange(false),
|
|
134743
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134744
|
+
Content,
|
|
134745
|
+
{
|
|
134746
|
+
"data-state": getState(context.open),
|
|
134747
|
+
role: "dialog",
|
|
134748
|
+
id: context.contentId,
|
|
134749
|
+
...popperScope,
|
|
134750
|
+
...contentProps,
|
|
134751
|
+
ref: forwardedRef,
|
|
134752
|
+
style: {
|
|
134753
|
+
...contentProps.style,
|
|
134754
|
+
// re-namespace exposed content custom properties
|
|
134755
|
+
...{
|
|
134756
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
134757
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
134758
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
134759
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
134760
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
134761
|
+
}
|
|
134762
|
+
}
|
|
134763
|
+
}
|
|
134764
|
+
)
|
|
134765
|
+
}
|
|
134766
|
+
)
|
|
134767
|
+
}
|
|
134768
|
+
);
|
|
134769
|
+
}
|
|
134770
|
+
);
|
|
134771
|
+
var CLOSE_NAME = "PopoverClose";
|
|
134772
|
+
var PopoverClose = React__namespace.forwardRef(
|
|
134773
|
+
(props, forwardedRef) => {
|
|
134774
|
+
const { __scopePopover, ...closeProps } = props;
|
|
134775
|
+
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
134776
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134777
|
+
Primitive.button,
|
|
134778
|
+
{
|
|
134779
|
+
type: "button",
|
|
134780
|
+
...closeProps,
|
|
134781
|
+
ref: forwardedRef,
|
|
134782
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
134783
|
+
}
|
|
134784
|
+
);
|
|
134785
|
+
}
|
|
134786
|
+
);
|
|
134787
|
+
PopoverClose.displayName = CLOSE_NAME;
|
|
134788
|
+
var ARROW_NAME = "PopoverArrow";
|
|
134789
|
+
var PopoverArrow = React__namespace.forwardRef(
|
|
134790
|
+
(props, forwardedRef) => {
|
|
134791
|
+
const { __scopePopover, ...arrowProps } = props;
|
|
134792
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134793
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
134794
|
+
}
|
|
134795
|
+
);
|
|
134796
|
+
PopoverArrow.displayName = ARROW_NAME;
|
|
134797
|
+
function getState(open) {
|
|
134798
|
+
return open ? "open" : "closed";
|
|
134799
|
+
}
|
|
134800
|
+
var Root2 = Popover$1;
|
|
134801
|
+
var Trigger = PopoverTrigger$1;
|
|
134802
|
+
var Portal = PopoverPortal;
|
|
134803
|
+
var Content2 = PopoverContent$1;
|
|
134804
|
+
|
|
134805
|
+
var PopoverRoot = Root2;
|
|
134806
|
+
var PopoverTrigger = Trigger;
|
|
134807
|
+
var PopoverContent = React__namespace.forwardRef(function (_a, ref) {
|
|
134808
|
+
var className = _a.className, _b = _a.align, align = _b === void 0 ? "center" : _b, _c = _a.sideOffset, sideOffset = _c === void 0 ? 4 : _c, _d = _a.fullWidth, fullWidth = _d === void 0 ? false : _d, props = __rest(_a, ["className", "align", "sideOffset", "fullWidth"]);
|
|
134809
|
+
return (React__namespace.createElement(Portal, null,
|
|
134810
|
+
React__namespace.createElement(Content2, __assign({ ref: ref, align: align, sideOffset: sideOffset, className: classNames("data-[state=open]:s-animate-in data-[state=open]:s-fade-in-0 data-[state=open]:s-zoom-in-95", "data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=closed]:s-zoom-out-95", "data-[side=bottom]:s-slide-in-from-top-2", "data-[side=left]:s-slide-in-from-right-2", "data-[side=right]:s-slide-in-from-left-2", "data-[side=top]:s-slide-in-from-bottom-2", "s-border-border s-text-primary-950 s-z-50 s-grow s-rounded-lg s-border s-bg-background s-shadow-md s-outline-none", fullWidth ? "" : "s-p-4", className !== null && className !== void 0 ? className : "") }, props))));
|
|
134811
|
+
});
|
|
134812
|
+
function Popover(_a) {
|
|
134813
|
+
var trigger = _a.trigger, content = _a.content, props = __rest(_a, ["trigger", "content"]);
|
|
134814
|
+
return (React__namespace.createElement(PopoverRoot, null,
|
|
134815
|
+
React__namespace.createElement(PopoverTrigger, null, trigger),
|
|
134816
|
+
React__namespace.createElement(PopoverContent, __assign({}, props), content)));
|
|
132693
134817
|
}
|
|
134818
|
+
PopoverContent.displayName = Content2.displayName;
|
|
132694
134819
|
|
|
132695
134820
|
function Popup(_a) {
|
|
132696
134821
|
var show = _a.show, chipLabel = _a.chipLabel, description = _a.description, buttonLabel = _a.buttonLabel, buttonClick = _a.buttonClick, className = _a.className, onClose = _a.onClose;
|
|
@@ -133582,6 +135707,10 @@ exports.PlusCircleIcon = SvgPlusCircle$3;
|
|
|
133582
135707
|
exports.PlusCircleStrokeIcon = SvgPlusCircle$1;
|
|
133583
135708
|
exports.PlusIcon = SvgPlus$3;
|
|
133584
135709
|
exports.PlusStrokeIcon = SvgPlus$1;
|
|
135710
|
+
exports.Popover = Popover;
|
|
135711
|
+
exports.PopoverContent = PopoverContent;
|
|
135712
|
+
exports.PopoverRoot = PopoverRoot;
|
|
135713
|
+
exports.PopoverTrigger = PopoverTrigger;
|
|
133585
135714
|
exports.Popup = Popup;
|
|
133586
135715
|
exports.PriceTable = PriceTable;
|
|
133587
135716
|
exports.PushpinIcon = SvgPushpin$3;
|