@dust-tt/sparkle 0.2.257 → 0.2.258-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 +14 -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 +10 -0
- package/dist/esm/stories/Popover.stories.d.ts.map +1 -0
- package/dist/esm/stories/Popover.stories.js +34 -0
- package/dist/esm/stories/Popover.stories.js.map +1 -0
- package/dist/sparkle.css +27 -0
- package/package.json +2 -1
- package/src/components/Popover.tsx +53 -0
- package/src/components/index.ts +2 -1
- package/src/stories/Popover.stories.tsx +93 -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;
|
|
@@ -40387,7 +40397,7 @@ Avatar.Stack = function (_a) {
|
|
|
40387
40397
|
};
|
|
40388
40398
|
|
|
40389
40399
|
// packages/core/primitive/src/primitive.tsx
|
|
40390
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
40400
|
+
function composeEventHandlers$1(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
40391
40401
|
return function handleEvent(event) {
|
|
40392
40402
|
originalEventHandler?.(event);
|
|
40393
40403
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
@@ -40397,22 +40407,22 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
40397
40407
|
}
|
|
40398
40408
|
|
|
40399
40409
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
40400
|
-
function setRef$
|
|
40410
|
+
function setRef$3(ref, value) {
|
|
40401
40411
|
if (typeof ref === "function") {
|
|
40402
40412
|
ref(value);
|
|
40403
40413
|
} else if (ref !== null && ref !== void 0) {
|
|
40404
40414
|
ref.current = value;
|
|
40405
40415
|
}
|
|
40406
40416
|
}
|
|
40407
|
-
function composeRefs$
|
|
40408
|
-
return (node) => refs.forEach((ref) => setRef$
|
|
40417
|
+
function composeRefs$3(...refs) {
|
|
40418
|
+
return (node) => refs.forEach((ref) => setRef$3(ref, node));
|
|
40409
40419
|
}
|
|
40410
|
-
function useComposedRefs$
|
|
40411
|
-
return React__namespace.useCallback(composeRefs$
|
|
40420
|
+
function useComposedRefs$2(...refs) {
|
|
40421
|
+
return React__namespace.useCallback(composeRefs$3(...refs), refs);
|
|
40412
40422
|
}
|
|
40413
40423
|
|
|
40414
40424
|
// packages/react/context/src/createContext.tsx
|
|
40415
|
-
function createContextScope$
|
|
40425
|
+
function createContextScope$3(scopeName, createContextScopeDeps = []) {
|
|
40416
40426
|
let defaultContexts = [];
|
|
40417
40427
|
function createContext3(rootComponentName, defaultContext) {
|
|
40418
40428
|
const BaseContext = React__namespace.createContext(defaultContext);
|
|
@@ -40447,9 +40457,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
|
40447
40457
|
};
|
|
40448
40458
|
};
|
|
40449
40459
|
createScope.scopeName = scopeName;
|
|
40450
|
-
return [createContext3, composeContextScopes$
|
|
40460
|
+
return [createContext3, composeContextScopes$3(createScope, ...createContextScopeDeps)];
|
|
40451
40461
|
}
|
|
40452
|
-
function composeContextScopes$
|
|
40462
|
+
function composeContextScopes$3(...scopes) {
|
|
40453
40463
|
const baseScope = scopes[0];
|
|
40454
40464
|
if (scopes.length === 1) return baseScope;
|
|
40455
40465
|
const createScope = () => {
|
|
@@ -71376,17 +71386,18 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
71376
71386
|
}
|
|
71377
71387
|
|
|
71378
71388
|
var reactDomExports = reactDom.exports;
|
|
71389
|
+
var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports);
|
|
71379
71390
|
|
|
71380
71391
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
71381
|
-
function setRef$
|
|
71392
|
+
function setRef$2(ref, value) {
|
|
71382
71393
|
if (typeof ref === "function") {
|
|
71383
71394
|
ref(value);
|
|
71384
71395
|
} else if (ref !== null && ref !== void 0) {
|
|
71385
71396
|
ref.current = value;
|
|
71386
71397
|
}
|
|
71387
71398
|
}
|
|
71388
|
-
function composeRefs$
|
|
71389
|
-
return (node) => refs.forEach((ref) => setRef$
|
|
71399
|
+
function composeRefs$2(...refs) {
|
|
71400
|
+
return (node) => refs.forEach((ref) => setRef$2(ref, node));
|
|
71390
71401
|
}
|
|
71391
71402
|
|
|
71392
71403
|
// packages/react/slot/src/Slot.tsx
|
|
@@ -71416,7 +71427,7 @@ var SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
71416
71427
|
return React__namespace.cloneElement(children, {
|
|
71417
71428
|
...mergeProps(slotProps, children.props),
|
|
71418
71429
|
// @ts-ignore
|
|
71419
|
-
ref: forwardedRef ? composeRefs$
|
|
71430
|
+
ref: forwardedRef ? composeRefs$2(forwardedRef, childrenRef) : childrenRef
|
|
71420
71431
|
});
|
|
71421
71432
|
}
|
|
71422
71433
|
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
@@ -71466,7 +71477,7 @@ function getElementRef$1(element) {
|
|
|
71466
71477
|
}
|
|
71467
71478
|
|
|
71468
71479
|
// packages/react/primitive/src/Primitive.tsx
|
|
71469
|
-
var NODES$
|
|
71480
|
+
var NODES$2 = [
|
|
71470
71481
|
"a",
|
|
71471
71482
|
"button",
|
|
71472
71483
|
"div",
|
|
@@ -71484,7 +71495,7 @@ var NODES$1 = [
|
|
|
71484
71495
|
"svg",
|
|
71485
71496
|
"ul"
|
|
71486
71497
|
];
|
|
71487
|
-
var Primitive$
|
|
71498
|
+
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
71488
71499
|
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71489
71500
|
const { asChild, ...primitiveProps } = props;
|
|
71490
71501
|
const Comp = asChild ? Slot : node;
|
|
@@ -71496,12 +71507,12 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
|
71496
71507
|
Node.displayName = `Primitive.${node}`;
|
|
71497
71508
|
return { ...primitive, [node]: Node };
|
|
71498
71509
|
}, {});
|
|
71499
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
71510
|
+
function dispatchDiscreteCustomEvent$1(target, event) {
|
|
71500
71511
|
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
71501
71512
|
}
|
|
71502
71513
|
|
|
71503
71514
|
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
71504
|
-
function useCallbackRef(callback) {
|
|
71515
|
+
function useCallbackRef$2(callback) {
|
|
71505
71516
|
const callbackRef = React__namespace.useRef(callback);
|
|
71506
71517
|
React__namespace.useEffect(() => {
|
|
71507
71518
|
callbackRef.current = callback;
|
|
@@ -71510,8 +71521,8 @@ function useCallbackRef(callback) {
|
|
|
71510
71521
|
}
|
|
71511
71522
|
|
|
71512
71523
|
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
71513
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
71514
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
71524
|
+
function useEscapeKeydown$1(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
71525
|
+
const onEscapeKeyDown = useCallbackRef$2(onEscapeKeyDownProp);
|
|
71515
71526
|
React__namespace.useEffect(() => {
|
|
71516
71527
|
const handleKeyDown = (event) => {
|
|
71517
71528
|
if (event.key === "Escape") {
|
|
@@ -71523,17 +71534,17 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
71523
71534
|
}, [onEscapeKeyDown, ownerDocument]);
|
|
71524
71535
|
}
|
|
71525
71536
|
|
|
71526
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
71527
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
71528
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
71529
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
71530
|
-
var originalBodyPointerEvents;
|
|
71531
|
-
var DismissableLayerContext = React__namespace.createContext({
|
|
71537
|
+
var DISMISSABLE_LAYER_NAME$1 = "DismissableLayer";
|
|
71538
|
+
var CONTEXT_UPDATE$1 = "dismissableLayer.update";
|
|
71539
|
+
var POINTER_DOWN_OUTSIDE$1 = "dismissableLayer.pointerDownOutside";
|
|
71540
|
+
var FOCUS_OUTSIDE$1 = "dismissableLayer.focusOutside";
|
|
71541
|
+
var originalBodyPointerEvents$1;
|
|
71542
|
+
var DismissableLayerContext$1 = React__namespace.createContext({
|
|
71532
71543
|
layers: /* @__PURE__ */ new Set(),
|
|
71533
71544
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
71534
71545
|
branches: /* @__PURE__ */ new Set()
|
|
71535
71546
|
});
|
|
71536
|
-
var DismissableLayer = React__namespace.forwardRef(
|
|
71547
|
+
var DismissableLayer$1 = React__namespace.forwardRef(
|
|
71537
71548
|
(props, forwardedRef) => {
|
|
71538
71549
|
const {
|
|
71539
71550
|
disableOutsidePointerEvents = false,
|
|
@@ -71544,18 +71555,18 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71544
71555
|
onDismiss,
|
|
71545
71556
|
...layerProps
|
|
71546
71557
|
} = props;
|
|
71547
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71558
|
+
const context = React__namespace.useContext(DismissableLayerContext$1);
|
|
71548
71559
|
const [node, setNode] = React__namespace.useState(null);
|
|
71549
71560
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
71550
71561
|
const [, force] = React__namespace.useState({});
|
|
71551
|
-
const composedRefs = useComposedRefs$
|
|
71562
|
+
const composedRefs = useComposedRefs$2(forwardedRef, (node2) => setNode(node2));
|
|
71552
71563
|
const layers = Array.from(context.layers);
|
|
71553
71564
|
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
71554
71565
|
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
71555
71566
|
const index = node ? layers.indexOf(node) : -1;
|
|
71556
71567
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
71557
71568
|
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
71558
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
71569
|
+
const pointerDownOutside = usePointerDownOutside$1((event) => {
|
|
71559
71570
|
const target = event.target;
|
|
71560
71571
|
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71561
71572
|
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
@@ -71563,7 +71574,7 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71563
71574
|
onInteractOutside?.(event);
|
|
71564
71575
|
if (!event.defaultPrevented) onDismiss?.();
|
|
71565
71576
|
}, ownerDocument);
|
|
71566
|
-
const focusOutside = useFocusOutside((event) => {
|
|
71577
|
+
const focusOutside = useFocusOutside$1((event) => {
|
|
71567
71578
|
const target = event.target;
|
|
71568
71579
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71569
71580
|
if (isFocusInBranch) return;
|
|
@@ -71571,7 +71582,7 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71571
71582
|
onInteractOutside?.(event);
|
|
71572
71583
|
if (!event.defaultPrevented) onDismiss?.();
|
|
71573
71584
|
}, ownerDocument);
|
|
71574
|
-
useEscapeKeydown((event) => {
|
|
71585
|
+
useEscapeKeydown$1((event) => {
|
|
71575
71586
|
const isHighestLayer = index === context.layers.size - 1;
|
|
71576
71587
|
if (!isHighestLayer) return;
|
|
71577
71588
|
onEscapeKeyDown?.(event);
|
|
@@ -71584,16 +71595,16 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71584
71595
|
if (!node) return;
|
|
71585
71596
|
if (disableOutsidePointerEvents) {
|
|
71586
71597
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
71587
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
71598
|
+
originalBodyPointerEvents$1 = ownerDocument.body.style.pointerEvents;
|
|
71588
71599
|
ownerDocument.body.style.pointerEvents = "none";
|
|
71589
71600
|
}
|
|
71590
71601
|
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
71591
71602
|
}
|
|
71592
71603
|
context.layers.add(node);
|
|
71593
|
-
dispatchUpdate();
|
|
71604
|
+
dispatchUpdate$1();
|
|
71594
71605
|
return () => {
|
|
71595
71606
|
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
71596
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
71607
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents$1;
|
|
71597
71608
|
}
|
|
71598
71609
|
};
|
|
71599
71610
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -71602,16 +71613,16 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71602
71613
|
if (!node) return;
|
|
71603
71614
|
context.layers.delete(node);
|
|
71604
71615
|
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
71605
|
-
dispatchUpdate();
|
|
71616
|
+
dispatchUpdate$1();
|
|
71606
71617
|
};
|
|
71607
71618
|
}, [node, context]);
|
|
71608
71619
|
React__namespace.useEffect(() => {
|
|
71609
71620
|
const handleUpdate = () => force({});
|
|
71610
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71611
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71621
|
+
document.addEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
71622
|
+
return () => document.removeEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
71612
71623
|
}, []);
|
|
71613
71624
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71614
|
-
Primitive$
|
|
71625
|
+
Primitive$2.div,
|
|
71615
71626
|
{
|
|
71616
71627
|
...layerProps,
|
|
71617
71628
|
ref: composedRefs,
|
|
@@ -71619,9 +71630,9 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71619
71630
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
71620
71631
|
...props.style
|
|
71621
71632
|
},
|
|
71622
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
71623
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
71624
|
-
onPointerDownCapture: composeEventHandlers(
|
|
71633
|
+
onFocusCapture: composeEventHandlers$1(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
71634
|
+
onBlurCapture: composeEventHandlers$1(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
71635
|
+
onPointerDownCapture: composeEventHandlers$1(
|
|
71625
71636
|
props.onPointerDownCapture,
|
|
71626
71637
|
pointerDownOutside.onPointerDownCapture
|
|
71627
71638
|
)
|
|
@@ -71629,12 +71640,12 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
71629
71640
|
);
|
|
71630
71641
|
}
|
|
71631
71642
|
);
|
|
71632
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
71633
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
71634
|
-
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71635
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71643
|
+
DismissableLayer$1.displayName = DISMISSABLE_LAYER_NAME$1;
|
|
71644
|
+
var BRANCH_NAME$1 = "DismissableLayerBranch";
|
|
71645
|
+
var DismissableLayerBranch$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71646
|
+
const context = React__namespace.useContext(DismissableLayerContext$1);
|
|
71636
71647
|
const ref = React__namespace.useRef(null);
|
|
71637
|
-
const composedRefs = useComposedRefs$
|
|
71648
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
71638
71649
|
React__namespace.useEffect(() => {
|
|
71639
71650
|
const node = ref.current;
|
|
71640
71651
|
if (node) {
|
|
@@ -71644,11 +71655,11 @@ var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
71644
71655
|
};
|
|
71645
71656
|
}
|
|
71646
71657
|
}, [context.branches]);
|
|
71647
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive$
|
|
71658
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive$2.div, { ...props, ref: composedRefs });
|
|
71648
71659
|
});
|
|
71649
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
71650
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
71651
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
71660
|
+
DismissableLayerBranch$1.displayName = BRANCH_NAME$1;
|
|
71661
|
+
function usePointerDownOutside$1(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
71662
|
+
const handlePointerDownOutside = useCallbackRef$2(onPointerDownOutside);
|
|
71652
71663
|
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
71653
71664
|
const handleClickRef = React__namespace.useRef(() => {
|
|
71654
71665
|
});
|
|
@@ -71656,8 +71667,8 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
71656
71667
|
const handlePointerDown = (event) => {
|
|
71657
71668
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
71658
71669
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
71659
|
-
handleAndDispatchCustomEvent(
|
|
71660
|
-
POINTER_DOWN_OUTSIDE,
|
|
71670
|
+
handleAndDispatchCustomEvent$1(
|
|
71671
|
+
POINTER_DOWN_OUTSIDE$1,
|
|
71661
71672
|
handlePointerDownOutside,
|
|
71662
71673
|
eventDetail,
|
|
71663
71674
|
{ discrete: true }
|
|
@@ -71690,14 +71701,14 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
71690
71701
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
71691
71702
|
};
|
|
71692
71703
|
}
|
|
71693
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
71694
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
71704
|
+
function useFocusOutside$1(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
71705
|
+
const handleFocusOutside = useCallbackRef$2(onFocusOutside);
|
|
71695
71706
|
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
71696
71707
|
React__namespace.useEffect(() => {
|
|
71697
71708
|
const handleFocus = (event) => {
|
|
71698
71709
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
71699
71710
|
const eventDetail = { originalEvent: event };
|
|
71700
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
71711
|
+
handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE$1, handleFocusOutside, eventDetail, {
|
|
71701
71712
|
discrete: false
|
|
71702
71713
|
});
|
|
71703
71714
|
}
|
|
@@ -71710,32 +71721,32 @@ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
|
71710
71721
|
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
71711
71722
|
};
|
|
71712
71723
|
}
|
|
71713
|
-
function dispatchUpdate() {
|
|
71714
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
71724
|
+
function dispatchUpdate$1() {
|
|
71725
|
+
const event = new CustomEvent(CONTEXT_UPDATE$1);
|
|
71715
71726
|
document.dispatchEvent(event);
|
|
71716
71727
|
}
|
|
71717
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
71728
|
+
function handleAndDispatchCustomEvent$1(name, handler, detail, { discrete }) {
|
|
71718
71729
|
const target = detail.originalEvent.target;
|
|
71719
71730
|
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
71720
71731
|
if (handler) target.addEventListener(name, handler, { once: true });
|
|
71721
71732
|
if (discrete) {
|
|
71722
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
71733
|
+
dispatchDiscreteCustomEvent$1(target, event);
|
|
71723
71734
|
} else {
|
|
71724
71735
|
target.dispatchEvent(event);
|
|
71725
71736
|
}
|
|
71726
71737
|
}
|
|
71727
71738
|
|
|
71728
71739
|
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
71729
|
-
var useLayoutEffect2$
|
|
71740
|
+
var useLayoutEffect2$2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
71730
71741
|
};
|
|
71731
71742
|
|
|
71732
71743
|
// packages/react/id/src/id.tsx
|
|
71733
|
-
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
71734
|
-
var count$
|
|
71735
|
-
function useId(deterministicId) {
|
|
71736
|
-
const [id, setId] = React__namespace.useState(useReactId());
|
|
71737
|
-
useLayoutEffect2$
|
|
71738
|
-
if (!deterministicId) setId((reactId) => reactId ?? String(count$
|
|
71744
|
+
var useReactId$1 = React__namespace["useId".toString()] || (() => void 0);
|
|
71745
|
+
var count$3 = 0;
|
|
71746
|
+
function useId$1(deterministicId) {
|
|
71747
|
+
const [id, setId] = React__namespace.useState(useReactId$1());
|
|
71748
|
+
useLayoutEffect2$2(() => {
|
|
71749
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count$3++));
|
|
71739
71750
|
}, [deterministicId]);
|
|
71740
71751
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
71741
71752
|
}
|
|
@@ -73690,11 +73701,11 @@ const arrow = (options, deps) => ({
|
|
|
73690
73701
|
});
|
|
73691
73702
|
|
|
73692
73703
|
// packages/react/arrow/src/Arrow.tsx
|
|
73693
|
-
var NAME$
|
|
73694
|
-
var Arrow$
|
|
73704
|
+
var NAME$3 = "Arrow";
|
|
73705
|
+
var Arrow$3 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
73695
73706
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
73696
73707
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73697
|
-
Primitive$
|
|
73708
|
+
Primitive$2.svg,
|
|
73698
73709
|
{
|
|
73699
73710
|
...arrowProps,
|
|
73700
73711
|
ref: forwardedRef,
|
|
@@ -73706,11 +73717,11 @@ var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
73706
73717
|
}
|
|
73707
73718
|
);
|
|
73708
73719
|
});
|
|
73709
|
-
Arrow$
|
|
73710
|
-
var Root$
|
|
73720
|
+
Arrow$3.displayName = NAME$3;
|
|
73721
|
+
var Root$3 = Arrow$3;
|
|
73711
73722
|
|
|
73712
73723
|
// packages/react/context/src/createContext.tsx
|
|
73713
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
73724
|
+
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
73714
73725
|
let defaultContexts = [];
|
|
73715
73726
|
function createContext3(rootComponentName, defaultContext) {
|
|
73716
73727
|
const BaseContext = React__namespace.createContext(defaultContext);
|
|
@@ -73745,9 +73756,9 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
73745
73756
|
};
|
|
73746
73757
|
};
|
|
73747
73758
|
createScope.scopeName = scopeName;
|
|
73748
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
73759
|
+
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
73749
73760
|
}
|
|
73750
|
-
function composeContextScopes(...scopes) {
|
|
73761
|
+
function composeContextScopes$2(...scopes) {
|
|
73751
73762
|
const baseScope = scopes[0];
|
|
73752
73763
|
if (scopes.length === 1) return baseScope;
|
|
73753
73764
|
const createScope = () => {
|
|
@@ -73769,9 +73780,9 @@ function composeContextScopes(...scopes) {
|
|
|
73769
73780
|
}
|
|
73770
73781
|
|
|
73771
73782
|
// packages/react/use-size/src/useSize.tsx
|
|
73772
|
-
function useSize(element) {
|
|
73783
|
+
function useSize$1(element) {
|
|
73773
73784
|
const [size, setSize] = React__namespace.useState(void 0);
|
|
73774
|
-
useLayoutEffect2$
|
|
73785
|
+
useLayoutEffect2$2(() => {
|
|
73775
73786
|
if (element) {
|
|
73776
73787
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
73777
73788
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -73804,32 +73815,32 @@ function useSize(element) {
|
|
|
73804
73815
|
return size;
|
|
73805
73816
|
}
|
|
73806
73817
|
|
|
73807
|
-
var POPPER_NAME = "Popper";
|
|
73808
|
-
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
73809
|
-
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
73810
|
-
var Popper = (props) => {
|
|
73818
|
+
var POPPER_NAME$1 = "Popper";
|
|
73819
|
+
var [createPopperContext$1, createPopperScope$1] = createContextScope$2(POPPER_NAME$1);
|
|
73820
|
+
var [PopperProvider$1, usePopperContext$1] = createPopperContext$1(POPPER_NAME$1);
|
|
73821
|
+
var Popper$1 = (props) => {
|
|
73811
73822
|
const { __scopePopper, children } = props;
|
|
73812
73823
|
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
73813
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
73824
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider$1, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
73814
73825
|
};
|
|
73815
|
-
Popper.displayName = POPPER_NAME;
|
|
73816
|
-
var ANCHOR_NAME = "PopperAnchor";
|
|
73817
|
-
var PopperAnchor = React__namespace.forwardRef(
|
|
73826
|
+
Popper$1.displayName = POPPER_NAME$1;
|
|
73827
|
+
var ANCHOR_NAME$2 = "PopperAnchor";
|
|
73828
|
+
var PopperAnchor$1 = React__namespace.forwardRef(
|
|
73818
73829
|
(props, forwardedRef) => {
|
|
73819
73830
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
73820
|
-
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
73831
|
+
const context = usePopperContext$1(ANCHOR_NAME$2, __scopePopper);
|
|
73821
73832
|
const ref = React__namespace.useRef(null);
|
|
73822
|
-
const composedRefs = useComposedRefs$
|
|
73833
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
73823
73834
|
React__namespace.useEffect(() => {
|
|
73824
73835
|
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
73825
73836
|
});
|
|
73826
|
-
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive$
|
|
73837
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive$2.div, { ...anchorProps, ref: composedRefs });
|
|
73827
73838
|
}
|
|
73828
73839
|
);
|
|
73829
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
73830
|
-
var CONTENT_NAME$
|
|
73831
|
-
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$
|
|
73832
|
-
var PopperContent = React__namespace.forwardRef(
|
|
73840
|
+
PopperAnchor$1.displayName = ANCHOR_NAME$2;
|
|
73841
|
+
var CONTENT_NAME$3 = "PopperContent";
|
|
73842
|
+
var [PopperContentProvider$1, useContentContext$1] = createPopperContext$1(CONTENT_NAME$3);
|
|
73843
|
+
var PopperContent$1 = React__namespace.forwardRef(
|
|
73833
73844
|
(props, forwardedRef) => {
|
|
73834
73845
|
const {
|
|
73835
73846
|
__scopePopper,
|
|
@@ -73847,11 +73858,11 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73847
73858
|
onPlaced,
|
|
73848
73859
|
...contentProps
|
|
73849
73860
|
} = props;
|
|
73850
|
-
const context = usePopperContext(CONTENT_NAME$
|
|
73861
|
+
const context = usePopperContext$1(CONTENT_NAME$3, __scopePopper);
|
|
73851
73862
|
const [content, setContent] = React__namespace.useState(null);
|
|
73852
|
-
const composedRefs = useComposedRefs$
|
|
73863
|
+
const composedRefs = useComposedRefs$2(forwardedRef, (node) => setContent(node));
|
|
73853
73864
|
const [arrow$1, setArrow] = React__namespace.useState(null);
|
|
73854
|
-
const arrowSize = useSize(arrow$1);
|
|
73865
|
+
const arrowSize = useSize$1(arrow$1);
|
|
73855
73866
|
const arrowWidth = arrowSize?.width ?? 0;
|
|
73856
73867
|
const arrowHeight = arrowSize?.height ?? 0;
|
|
73857
73868
|
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
@@ -73860,7 +73871,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73860
73871
|
const hasExplicitBoundaries = boundary.length > 0;
|
|
73861
73872
|
const detectOverflowOptions = {
|
|
73862
73873
|
padding: collisionPadding,
|
|
73863
|
-
boundary: boundary.filter(isNotNull),
|
|
73874
|
+
boundary: boundary.filter(isNotNull$1),
|
|
73864
73875
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
73865
73876
|
altBoundary: hasExplicitBoundaries
|
|
73866
73877
|
};
|
|
@@ -73898,13 +73909,13 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73898
73909
|
}
|
|
73899
73910
|
}),
|
|
73900
73911
|
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
73901
|
-
transformOrigin({ arrowWidth, arrowHeight }),
|
|
73912
|
+
transformOrigin$1({ arrowWidth, arrowHeight }),
|
|
73902
73913
|
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
73903
73914
|
]
|
|
73904
73915
|
});
|
|
73905
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
73906
|
-
const handlePlaced = useCallbackRef(onPlaced);
|
|
73907
|
-
useLayoutEffect2$
|
|
73916
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
73917
|
+
const handlePlaced = useCallbackRef$2(onPlaced);
|
|
73918
|
+
useLayoutEffect2$2(() => {
|
|
73908
73919
|
if (isPositioned) {
|
|
73909
73920
|
handlePlaced?.();
|
|
73910
73921
|
}
|
|
@@ -73913,7 +73924,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73913
73924
|
const arrowY = middlewareData.arrow?.y;
|
|
73914
73925
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
73915
73926
|
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
73916
|
-
useLayoutEffect2$
|
|
73927
|
+
useLayoutEffect2$2(() => {
|
|
73917
73928
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
73918
73929
|
}, [content]);
|
|
73919
73930
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -73941,7 +73952,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73941
73952
|
},
|
|
73942
73953
|
dir: props.dir,
|
|
73943
73954
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
73944
|
-
PopperContentProvider,
|
|
73955
|
+
PopperContentProvider$1,
|
|
73945
73956
|
{
|
|
73946
73957
|
scope: __scopePopper,
|
|
73947
73958
|
placedSide,
|
|
@@ -73950,7 +73961,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73950
73961
|
arrowY,
|
|
73951
73962
|
shouldHideArrow: cannotCenterArrow,
|
|
73952
73963
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
73953
|
-
Primitive$
|
|
73964
|
+
Primitive$2.div,
|
|
73954
73965
|
{
|
|
73955
73966
|
"data-side": placedSide,
|
|
73956
73967
|
"data-align": placedAlign,
|
|
@@ -73970,18 +73981,18 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
73970
73981
|
);
|
|
73971
73982
|
}
|
|
73972
73983
|
);
|
|
73973
|
-
PopperContent.displayName = CONTENT_NAME$
|
|
73974
|
-
var ARROW_NAME$
|
|
73975
|
-
var OPPOSITE_SIDE = {
|
|
73984
|
+
PopperContent$1.displayName = CONTENT_NAME$3;
|
|
73985
|
+
var ARROW_NAME$3 = "PopperArrow";
|
|
73986
|
+
var OPPOSITE_SIDE$1 = {
|
|
73976
73987
|
top: "bottom",
|
|
73977
73988
|
right: "left",
|
|
73978
73989
|
bottom: "top",
|
|
73979
73990
|
left: "right"
|
|
73980
73991
|
};
|
|
73981
|
-
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
73992
|
+
var PopperArrow$1 = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
73982
73993
|
const { __scopePopper, ...arrowProps } = props;
|
|
73983
|
-
const contentContext = useContentContext(ARROW_NAME$
|
|
73984
|
-
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
73994
|
+
const contentContext = useContentContext$1(ARROW_NAME$3, __scopePopper);
|
|
73995
|
+
const baseSide = OPPOSITE_SIDE$1[contentContext.placedSide];
|
|
73985
73996
|
return (
|
|
73986
73997
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
73987
73998
|
// doesn't report size as we'd expect on SVG elements.
|
|
@@ -74010,7 +74021,7 @@ var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwa
|
|
|
74010
74021
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
74011
74022
|
},
|
|
74012
74023
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74013
|
-
Root$
|
|
74024
|
+
Root$3,
|
|
74014
74025
|
{
|
|
74015
74026
|
...arrowProps,
|
|
74016
74027
|
ref: forwardedRef,
|
|
@@ -74025,11 +74036,11 @@ var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwa
|
|
|
74025
74036
|
)
|
|
74026
74037
|
);
|
|
74027
74038
|
});
|
|
74028
|
-
PopperArrow.displayName = ARROW_NAME$
|
|
74029
|
-
function isNotNull(value) {
|
|
74039
|
+
PopperArrow$1.displayName = ARROW_NAME$3;
|
|
74040
|
+
function isNotNull$1(value) {
|
|
74030
74041
|
return value !== null;
|
|
74031
74042
|
}
|
|
74032
|
-
var transformOrigin = (options) => ({
|
|
74043
|
+
var transformOrigin$1 = (options) => ({
|
|
74033
74044
|
name: "transformOrigin",
|
|
74034
74045
|
options,
|
|
74035
74046
|
fn(data) {
|
|
@@ -74038,7 +74049,7 @@ var transformOrigin = (options) => ({
|
|
|
74038
74049
|
const isArrowHidden = cannotCenterArrow;
|
|
74039
74050
|
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
74040
74051
|
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
74041
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
74052
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
74042
74053
|
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
74043
74054
|
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
74044
74055
|
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
@@ -74060,32 +74071,32 @@ var transformOrigin = (options) => ({
|
|
|
74060
74071
|
return { data: { x, y } };
|
|
74061
74072
|
}
|
|
74062
74073
|
});
|
|
74063
|
-
function getSideAndAlignFromPlacement(placement) {
|
|
74074
|
+
function getSideAndAlignFromPlacement$1(placement) {
|
|
74064
74075
|
const [side, align = "center"] = placement.split("-");
|
|
74065
74076
|
return [side, align];
|
|
74066
74077
|
}
|
|
74067
|
-
var Root2 = Popper;
|
|
74068
|
-
var Anchor = PopperAnchor;
|
|
74069
|
-
var Content = PopperContent;
|
|
74070
|
-
var Arrow = PopperArrow;
|
|
74078
|
+
var Root2$2 = Popper$1;
|
|
74079
|
+
var Anchor$1 = PopperAnchor$1;
|
|
74080
|
+
var Content$1 = PopperContent$1;
|
|
74081
|
+
var Arrow$2 = PopperArrow$1;
|
|
74071
74082
|
|
|
74072
74083
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
74073
|
-
function setRef(ref, value) {
|
|
74084
|
+
function setRef$1(ref, value) {
|
|
74074
74085
|
if (typeof ref === "function") {
|
|
74075
74086
|
ref(value);
|
|
74076
74087
|
} else if (ref !== null && ref !== void 0) {
|
|
74077
74088
|
ref.current = value;
|
|
74078
74089
|
}
|
|
74079
74090
|
}
|
|
74080
|
-
function composeRefs(...refs) {
|
|
74081
|
-
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
74091
|
+
function composeRefs$1(...refs) {
|
|
74092
|
+
return (node) => refs.forEach((ref) => setRef$1(ref, node));
|
|
74082
74093
|
}
|
|
74083
|
-
function useComposedRefs(...refs) {
|
|
74084
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
74094
|
+
function useComposedRefs$1(...refs) {
|
|
74095
|
+
return React__namespace.useCallback(composeRefs$1(...refs), refs);
|
|
74085
74096
|
}
|
|
74086
74097
|
|
|
74087
74098
|
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
74088
|
-
var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
74099
|
+
var useLayoutEffect2$1 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
74089
74100
|
};
|
|
74090
74101
|
|
|
74091
74102
|
function useStateMachine(initialState, machine) {
|
|
@@ -74100,7 +74111,7 @@ var Presence = (props) => {
|
|
|
74100
74111
|
const { present, children } = props;
|
|
74101
74112
|
const presence = usePresence(present);
|
|
74102
74113
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
74103
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
74114
|
+
const ref = useComposedRefs$1(presence.ref, getElementRef(child));
|
|
74104
74115
|
const forceMount = typeof children === "function";
|
|
74105
74116
|
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
74106
74117
|
};
|
|
@@ -74128,7 +74139,7 @@ function usePresence(present) {
|
|
|
74128
74139
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
74129
74140
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
74130
74141
|
}, [state]);
|
|
74131
|
-
useLayoutEffect2(() => {
|
|
74142
|
+
useLayoutEffect2$1(() => {
|
|
74132
74143
|
const styles = stylesRef.current;
|
|
74133
74144
|
const wasPresent = prevPresentRef.current;
|
|
74134
74145
|
const hasPresentChanged = wasPresent !== present;
|
|
@@ -74150,7 +74161,7 @@ function usePresence(present) {
|
|
|
74150
74161
|
prevPresentRef.current = present;
|
|
74151
74162
|
}
|
|
74152
74163
|
}, [present, send]);
|
|
74153
|
-
useLayoutEffect2(() => {
|
|
74164
|
+
useLayoutEffect2$1(() => {
|
|
74154
74165
|
if (node) {
|
|
74155
74166
|
let timeoutId;
|
|
74156
74167
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
@@ -74214,16 +74225,16 @@ function getElementRef(element) {
|
|
|
74214
74225
|
}
|
|
74215
74226
|
|
|
74216
74227
|
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
74217
|
-
function useControllableState({
|
|
74228
|
+
function useControllableState$1({
|
|
74218
74229
|
prop,
|
|
74219
74230
|
defaultProp,
|
|
74220
74231
|
onChange = () => {
|
|
74221
74232
|
}
|
|
74222
74233
|
}) {
|
|
74223
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
74234
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState$1({ defaultProp, onChange });
|
|
74224
74235
|
const isControlled = prop !== void 0;
|
|
74225
74236
|
const value = isControlled ? prop : uncontrolledProp;
|
|
74226
|
-
const handleChange = useCallbackRef(onChange);
|
|
74237
|
+
const handleChange = useCallbackRef$2(onChange);
|
|
74227
74238
|
const setValue = React__namespace.useCallback(
|
|
74228
74239
|
(nextValue) => {
|
|
74229
74240
|
if (isControlled) {
|
|
@@ -74238,14 +74249,14 @@ function useControllableState({
|
|
|
74238
74249
|
);
|
|
74239
74250
|
return [value, setValue];
|
|
74240
74251
|
}
|
|
74241
|
-
function useUncontrolledState({
|
|
74252
|
+
function useUncontrolledState$1({
|
|
74242
74253
|
defaultProp,
|
|
74243
74254
|
onChange
|
|
74244
74255
|
}) {
|
|
74245
74256
|
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
74246
74257
|
const [value] = uncontrolledState;
|
|
74247
74258
|
const prevValueRef = React__namespace.useRef(value);
|
|
74248
|
-
const handleChange = useCallbackRef(onChange);
|
|
74259
|
+
const handleChange = useCallbackRef$2(onChange);
|
|
74249
74260
|
React__namespace.useEffect(() => {
|
|
74250
74261
|
if (prevValueRef.current !== value) {
|
|
74251
74262
|
handleChange(value);
|
|
@@ -74256,11 +74267,11 @@ function useUncontrolledState({
|
|
|
74256
74267
|
}
|
|
74257
74268
|
|
|
74258
74269
|
// packages/react/visually-hidden/src/VisuallyHidden.tsx
|
|
74259
|
-
var NAME$
|
|
74270
|
+
var NAME$2 = "VisuallyHidden";
|
|
74260
74271
|
var VisuallyHidden = React__namespace.forwardRef(
|
|
74261
74272
|
(props, forwardedRef) => {
|
|
74262
74273
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74263
|
-
Primitive$
|
|
74274
|
+
Primitive$2.span,
|
|
74264
74275
|
{
|
|
74265
74276
|
...props,
|
|
74266
74277
|
ref: forwardedRef,
|
|
@@ -74282,13 +74293,13 @@ var VisuallyHidden = React__namespace.forwardRef(
|
|
|
74282
74293
|
);
|
|
74283
74294
|
}
|
|
74284
74295
|
);
|
|
74285
|
-
VisuallyHidden.displayName = NAME$
|
|
74286
|
-
var Root$
|
|
74296
|
+
VisuallyHidden.displayName = NAME$2;
|
|
74297
|
+
var Root$2 = VisuallyHidden;
|
|
74287
74298
|
|
|
74288
|
-
var [createTooltipContext, createTooltipScope] = createContextScope$
|
|
74289
|
-
createPopperScope
|
|
74299
|
+
var [createTooltipContext, createTooltipScope] = createContextScope$3("Tooltip", [
|
|
74300
|
+
createPopperScope$1
|
|
74290
74301
|
]);
|
|
74291
|
-
var usePopperScope = createPopperScope();
|
|
74302
|
+
var usePopperScope$1 = createPopperScope$1();
|
|
74292
74303
|
var PROVIDER_NAME = "TooltipProvider";
|
|
74293
74304
|
var DEFAULT_DELAY_DURATION = 700;
|
|
74294
74305
|
var TOOLTIP_OPEN = "tooltip.open";
|
|
@@ -74348,14 +74359,14 @@ var Tooltip$1 = (props) => {
|
|
|
74348
74359
|
delayDuration: delayDurationProp
|
|
74349
74360
|
} = props;
|
|
74350
74361
|
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
74351
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74362
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74352
74363
|
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
74353
|
-
const contentId = useId();
|
|
74364
|
+
const contentId = useId$1();
|
|
74354
74365
|
const openTimerRef = React__namespace.useRef(0);
|
|
74355
74366
|
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
74356
74367
|
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
74357
74368
|
const wasOpenDelayedRef = React__namespace.useRef(false);
|
|
74358
|
-
const [open = false, setOpen] = useControllableState({
|
|
74369
|
+
const [open = false, setOpen] = useControllableState$1({
|
|
74359
74370
|
prop: openProp,
|
|
74360
74371
|
defaultProp: defaultOpen,
|
|
74361
74372
|
onChange: (open2) => {
|
|
@@ -74390,7 +74401,7 @@ var Tooltip$1 = (props) => {
|
|
|
74390
74401
|
React__namespace.useEffect(() => {
|
|
74391
74402
|
return () => window.clearTimeout(openTimerRef.current);
|
|
74392
74403
|
}, []);
|
|
74393
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74404
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2$2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74394
74405
|
TooltipContextProvider,
|
|
74395
74406
|
{
|
|
74396
74407
|
scope: __scopeTooltip,
|
|
@@ -74418,71 +74429,71 @@ var Tooltip$1 = (props) => {
|
|
|
74418
74429
|
) });
|
|
74419
74430
|
};
|
|
74420
74431
|
Tooltip$1.displayName = TOOLTIP_NAME;
|
|
74421
|
-
var TRIGGER_NAME = "TooltipTrigger";
|
|
74432
|
+
var TRIGGER_NAME$1 = "TooltipTrigger";
|
|
74422
74433
|
var TooltipTrigger$1 = React__namespace.forwardRef(
|
|
74423
74434
|
(props, forwardedRef) => {
|
|
74424
74435
|
const { __scopeTooltip, ...triggerProps } = props;
|
|
74425
|
-
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
74426
|
-
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
74427
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74436
|
+
const context = useTooltipContext(TRIGGER_NAME$1, __scopeTooltip);
|
|
74437
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME$1, __scopeTooltip);
|
|
74438
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74428
74439
|
const ref = React__namespace.useRef(null);
|
|
74429
|
-
const composedRefs = useComposedRefs$
|
|
74440
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref, context.onTriggerChange);
|
|
74430
74441
|
const isPointerDownRef = React__namespace.useRef(false);
|
|
74431
74442
|
const hasPointerMoveOpenedRef = React__namespace.useRef(false);
|
|
74432
74443
|
const handlePointerUp = React__namespace.useCallback(() => isPointerDownRef.current = false, []);
|
|
74433
74444
|
React__namespace.useEffect(() => {
|
|
74434
74445
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
74435
74446
|
}, [handlePointerUp]);
|
|
74436
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74437
|
-
Primitive$
|
|
74447
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor$1, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74448
|
+
Primitive$2.button,
|
|
74438
74449
|
{
|
|
74439
74450
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
74440
74451
|
"data-state": context.stateAttribute,
|
|
74441
74452
|
...triggerProps,
|
|
74442
74453
|
ref: composedRefs,
|
|
74443
|
-
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
74454
|
+
onPointerMove: composeEventHandlers$1(props.onPointerMove, (event) => {
|
|
74444
74455
|
if (event.pointerType === "touch") return;
|
|
74445
74456
|
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
74446
74457
|
context.onTriggerEnter();
|
|
74447
74458
|
hasPointerMoveOpenedRef.current = true;
|
|
74448
74459
|
}
|
|
74449
74460
|
}),
|
|
74450
|
-
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
74461
|
+
onPointerLeave: composeEventHandlers$1(props.onPointerLeave, () => {
|
|
74451
74462
|
context.onTriggerLeave();
|
|
74452
74463
|
hasPointerMoveOpenedRef.current = false;
|
|
74453
74464
|
}),
|
|
74454
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
74465
|
+
onPointerDown: composeEventHandlers$1(props.onPointerDown, () => {
|
|
74455
74466
|
isPointerDownRef.current = true;
|
|
74456
74467
|
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
74457
74468
|
}),
|
|
74458
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
74469
|
+
onFocus: composeEventHandlers$1(props.onFocus, () => {
|
|
74459
74470
|
if (!isPointerDownRef.current) context.onOpen();
|
|
74460
74471
|
}),
|
|
74461
|
-
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
74462
|
-
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
74472
|
+
onBlur: composeEventHandlers$1(props.onBlur, context.onClose),
|
|
74473
|
+
onClick: composeEventHandlers$1(props.onClick, context.onClose)
|
|
74463
74474
|
}
|
|
74464
74475
|
) });
|
|
74465
74476
|
}
|
|
74466
74477
|
);
|
|
74467
|
-
TooltipTrigger$1.displayName = TRIGGER_NAME;
|
|
74468
|
-
var PORTAL_NAME = "TooltipPortal";
|
|
74469
|
-
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
74478
|
+
TooltipTrigger$1.displayName = TRIGGER_NAME$1;
|
|
74479
|
+
var PORTAL_NAME$2 = "TooltipPortal";
|
|
74480
|
+
var [PortalProvider$1, usePortalContext$1] = createTooltipContext(PORTAL_NAME$2, {
|
|
74470
74481
|
forceMount: void 0
|
|
74471
74482
|
});
|
|
74472
|
-
var CONTENT_NAME = "TooltipContent";
|
|
74483
|
+
var CONTENT_NAME$2 = "TooltipContent";
|
|
74473
74484
|
var TooltipContent$1 = React__namespace.forwardRef(
|
|
74474
74485
|
(props, forwardedRef) => {
|
|
74475
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74486
|
+
const portalContext = usePortalContext$1(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74476
74487
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
74477
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74488
|
+
const context = useTooltipContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74478
74489
|
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 }) });
|
|
74479
74490
|
}
|
|
74480
74491
|
);
|
|
74481
74492
|
var TooltipContentHoverable = React__namespace.forwardRef((props, forwardedRef) => {
|
|
74482
|
-
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74483
|
-
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74493
|
+
const context = useTooltipContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74494
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME$2, props.__scopeTooltip);
|
|
74484
74495
|
const ref = React__namespace.useRef(null);
|
|
74485
|
-
const composedRefs = useComposedRefs$
|
|
74496
|
+
const composedRefs = useComposedRefs$2(forwardedRef, ref);
|
|
74486
74497
|
const [pointerGraceArea, setPointerGraceArea] = React__namespace.useState(null);
|
|
74487
74498
|
const { trigger, onClose } = context;
|
|
74488
74499
|
const content = ref.current;
|
|
@@ -74550,8 +74561,8 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74550
74561
|
onPointerDownOutside,
|
|
74551
74562
|
...contentProps
|
|
74552
74563
|
} = props;
|
|
74553
|
-
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
74554
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74564
|
+
const context = useTooltipContext(CONTENT_NAME$2, __scopeTooltip);
|
|
74565
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74555
74566
|
const { onClose } = context;
|
|
74556
74567
|
React__namespace.useEffect(() => {
|
|
74557
74568
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
@@ -74568,7 +74579,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74568
74579
|
}
|
|
74569
74580
|
}, [context.trigger, onClose]);
|
|
74570
74581
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74571
|
-
DismissableLayer,
|
|
74582
|
+
DismissableLayer$1,
|
|
74572
74583
|
{
|
|
74573
74584
|
asChild: true,
|
|
74574
74585
|
disableOutsidePointerEvents: false,
|
|
@@ -74577,7 +74588,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74577
74588
|
onFocusOutside: (event) => event.preventDefault(),
|
|
74578
74589
|
onDismiss: onClose,
|
|
74579
74590
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74580
|
-
Content,
|
|
74591
|
+
Content$1,
|
|
74581
74592
|
{
|
|
74582
74593
|
"data-state": context.stateAttribute,
|
|
74583
74594
|
...popperScope,
|
|
@@ -74596,7 +74607,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74596
74607
|
},
|
|
74597
74608
|
children: [
|
|
74598
74609
|
/* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
|
|
74599
|
-
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root$
|
|
74610
|
+
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root$2, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
74600
74611
|
]
|
|
74601
74612
|
}
|
|
74602
74613
|
)
|
|
@@ -74604,20 +74615,20 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
74604
74615
|
);
|
|
74605
74616
|
}
|
|
74606
74617
|
);
|
|
74607
|
-
TooltipContent$1.displayName = CONTENT_NAME;
|
|
74608
|
-
var ARROW_NAME = "TooltipArrow";
|
|
74618
|
+
TooltipContent$1.displayName = CONTENT_NAME$2;
|
|
74619
|
+
var ARROW_NAME$2 = "TooltipArrow";
|
|
74609
74620
|
var TooltipArrow = React__namespace.forwardRef(
|
|
74610
74621
|
(props, forwardedRef) => {
|
|
74611
74622
|
const { __scopeTooltip, ...arrowProps } = props;
|
|
74612
|
-
const popperScope = usePopperScope(__scopeTooltip);
|
|
74623
|
+
const popperScope = usePopperScope$1(__scopeTooltip);
|
|
74613
74624
|
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
74614
|
-
ARROW_NAME,
|
|
74625
|
+
ARROW_NAME$2,
|
|
74615
74626
|
__scopeTooltip
|
|
74616
74627
|
);
|
|
74617
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
74628
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow$2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
74618
74629
|
}
|
|
74619
74630
|
);
|
|
74620
|
-
TooltipArrow.displayName = ARROW_NAME;
|
|
74631
|
+
TooltipArrow.displayName = ARROW_NAME$2;
|
|
74621
74632
|
function getExitSideFromRect(point, rect) {
|
|
74622
74633
|
const top = Math.abs(rect.top - point.y);
|
|
74623
74634
|
const bottom = Math.abs(rect.bottom - point.y);
|
|
@@ -74733,15 +74744,15 @@ function getHullPresorted(points) {
|
|
|
74733
74744
|
}
|
|
74734
74745
|
var Provider = TooltipProvider$1;
|
|
74735
74746
|
var Root3 = Tooltip$1;
|
|
74736
|
-
var Trigger = TooltipTrigger$1;
|
|
74737
|
-
var Content2 = TooltipContent$1;
|
|
74747
|
+
var Trigger$1 = TooltipTrigger$1;
|
|
74748
|
+
var Content2$1 = TooltipContent$1;
|
|
74738
74749
|
|
|
74739
74750
|
var TooltipProvider = Provider;
|
|
74740
74751
|
var TooltipRoot = Root3;
|
|
74741
|
-
var TooltipTrigger = Trigger;
|
|
74752
|
+
var TooltipTrigger = Trigger$1;
|
|
74742
74753
|
var TooltipContent = React__namespace.forwardRef(function (_a, ref) {
|
|
74743
74754
|
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
|
|
74744
|
-
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)));
|
|
74755
|
+
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)));
|
|
74745
74756
|
});
|
|
74746
74757
|
function Tooltip(_a) {
|
|
74747
74758
|
var trigger = _a.trigger, label = _a.label, props = __rest(_a, ["trigger", "label"]);
|
|
@@ -74750,7 +74761,7 @@ function Tooltip(_a) {
|
|
|
74750
74761
|
React__namespace.createElement(TooltipTrigger, null, trigger),
|
|
74751
74762
|
React__namespace.createElement(TooltipContent, __assign({}, props), label))));
|
|
74752
74763
|
}
|
|
74753
|
-
TooltipContent.displayName = Content2.displayName;
|
|
74764
|
+
TooltipContent.displayName = Content2$1.displayName;
|
|
74754
74765
|
|
|
74755
74766
|
var IconSizes = {
|
|
74756
74767
|
xs: "s-h-4 s-w-4",
|
|
@@ -104261,7 +104272,7 @@ const unique = (columnId, leafRows) => {
|
|
|
104261
104272
|
const uniqueCount = (columnId, leafRows) => {
|
|
104262
104273
|
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
104263
104274
|
};
|
|
104264
|
-
const count = (_columnId, leafRows) => {
|
|
104275
|
+
const count$2 = (_columnId, leafRows) => {
|
|
104265
104276
|
return leafRows.length;
|
|
104266
104277
|
};
|
|
104267
104278
|
const aggregationFns = {
|
|
@@ -104273,7 +104284,7 @@ const aggregationFns = {
|
|
|
104273
104284
|
median,
|
|
104274
104285
|
unique,
|
|
104275
104286
|
uniqueCount,
|
|
104276
|
-
count
|
|
104287
|
+
count: count$2
|
|
104277
104288
|
};
|
|
104278
104289
|
|
|
104279
104290
|
//
|
|
@@ -104807,9 +104818,9 @@ const ColumnSizing = {
|
|
|
104807
104818
|
};
|
|
104808
104819
|
}
|
|
104809
104820
|
};
|
|
104810
|
-
let passiveSupported = null;
|
|
104821
|
+
let passiveSupported$1 = null;
|
|
104811
104822
|
function passiveEventSupported() {
|
|
104812
|
-
if (typeof passiveSupported === 'boolean') return passiveSupported;
|
|
104823
|
+
if (typeof passiveSupported$1 === 'boolean') return passiveSupported$1;
|
|
104813
104824
|
let supported = false;
|
|
104814
104825
|
try {
|
|
104815
104826
|
const options = {
|
|
@@ -104824,8 +104835,8 @@ function passiveEventSupported() {
|
|
|
104824
104835
|
} catch (err) {
|
|
104825
104836
|
supported = false;
|
|
104826
104837
|
}
|
|
104827
|
-
passiveSupported = supported;
|
|
104828
|
-
return passiveSupported;
|
|
104838
|
+
passiveSupported$1 = supported;
|
|
104839
|
+
return passiveSupported$1;
|
|
104829
104840
|
}
|
|
104830
104841
|
function isTouchStartEvent(e) {
|
|
104831
104842
|
return e.type === 'touchstart';
|
|
@@ -124316,7 +124327,7 @@ var defaultConstructs = /*#__PURE__*/Object.freeze({
|
|
|
124316
124327
|
* @param {ParseOptions | null | undefined} [options]
|
|
124317
124328
|
* @returns {ParseContext}
|
|
124318
124329
|
*/
|
|
124319
|
-
function parse(options) {
|
|
124330
|
+
function parse$1(options) {
|
|
124320
124331
|
const settings = options || {};
|
|
124321
124332
|
const constructs =
|
|
124322
124333
|
/** @type {FullNormalizedExtension} */
|
|
@@ -124670,7 +124681,7 @@ function fromMarkdown(value, encoding, options) {
|
|
|
124670
124681
|
}
|
|
124671
124682
|
return compiler(options)(
|
|
124672
124683
|
postprocess(
|
|
124673
|
-
parse(options).document().write(preprocess()(value, encoding, true))
|
|
124684
|
+
parse$1(options).document().write(preprocess()(value, encoding, true))
|
|
124674
124685
|
)
|
|
124675
124686
|
)
|
|
124676
124687
|
}
|
|
@@ -132203,6 +132214,263 @@ function Notification(_a) {
|
|
|
132203
132214
|
description && (React.createElement("div", { className: "s-line-clamp-3 s-pr-2 s-text-sm s-font-normal s-text-element-700" }, description)))));
|
|
132204
132215
|
}
|
|
132205
132216
|
|
|
132217
|
+
// packages/react/primitive/src/Primitive.tsx
|
|
132218
|
+
var NODES$1 = [
|
|
132219
|
+
"a",
|
|
132220
|
+
"button",
|
|
132221
|
+
"div",
|
|
132222
|
+
"form",
|
|
132223
|
+
"h2",
|
|
132224
|
+
"h3",
|
|
132225
|
+
"img",
|
|
132226
|
+
"input",
|
|
132227
|
+
"label",
|
|
132228
|
+
"li",
|
|
132229
|
+
"nav",
|
|
132230
|
+
"ol",
|
|
132231
|
+
"p",
|
|
132232
|
+
"span",
|
|
132233
|
+
"svg",
|
|
132234
|
+
"ul"
|
|
132235
|
+
];
|
|
132236
|
+
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
132237
|
+
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132238
|
+
const { asChild, ...primitiveProps } = props;
|
|
132239
|
+
const Comp = asChild ? Slot : node;
|
|
132240
|
+
if (typeof window !== "undefined") {
|
|
132241
|
+
window[Symbol.for("radix-ui")] = true;
|
|
132242
|
+
}
|
|
132243
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
132244
|
+
});
|
|
132245
|
+
Node.displayName = `Primitive.${node}`;
|
|
132246
|
+
return { ...primitive, [node]: Node };
|
|
132247
|
+
}, {});
|
|
132248
|
+
|
|
132249
|
+
// packages/react/separator/src/Separator.tsx
|
|
132250
|
+
var NAME$1 = "Separator";
|
|
132251
|
+
var DEFAULT_ORIENTATION = "horizontal";
|
|
132252
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
132253
|
+
var Separator$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132254
|
+
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
132255
|
+
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
132256
|
+
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
132257
|
+
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
132258
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132259
|
+
Primitive$1.div,
|
|
132260
|
+
{
|
|
132261
|
+
"data-orientation": orientation,
|
|
132262
|
+
...semanticProps,
|
|
132263
|
+
...domProps,
|
|
132264
|
+
ref: forwardedRef
|
|
132265
|
+
}
|
|
132266
|
+
);
|
|
132267
|
+
});
|
|
132268
|
+
Separator$1.displayName = NAME$1;
|
|
132269
|
+
function isValidOrientation(orientation) {
|
|
132270
|
+
return ORIENTATIONS.includes(orientation);
|
|
132271
|
+
}
|
|
132272
|
+
var Root$1 = Separator$1;
|
|
132273
|
+
|
|
132274
|
+
var Separator = React__namespace.forwardRef(function (_a, ref) {
|
|
132275
|
+
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"]);
|
|
132276
|
+
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)));
|
|
132277
|
+
});
|
|
132278
|
+
Separator.displayName = Root$1.displayName;
|
|
132279
|
+
|
|
132280
|
+
function Page(_a) {
|
|
132281
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "normal" : _b;
|
|
132282
|
+
var mainVariantClasses = variant === "normal" ? "s-h-full s-py-16" : "s-h-full s-py-4 s-px-2";
|
|
132283
|
+
var divVariantClassNames = variant === "normal" ? "s-gap-6 s-px-6" : "s-gap-4";
|
|
132284
|
+
return (React.createElement("main", { className: mainVariantClasses },
|
|
132285
|
+
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)));
|
|
132286
|
+
}
|
|
132287
|
+
Page.Header = function (_a) {
|
|
132288
|
+
var title = _a.title, description = _a.description, icon = _a.icon;
|
|
132289
|
+
var iconClasses = "s-text-brand";
|
|
132290
|
+
return (React.createElement(Page.Vertical, { gap: "xs" },
|
|
132291
|
+
React.createElement(Icon, { visual: icon, className: iconClasses, size: "lg" }),
|
|
132292
|
+
React.createElement(Page.H, { variant: "h3" }, title),
|
|
132293
|
+
description && React.createElement(Page.P, { variant: "secondary" }, description)));
|
|
132294
|
+
};
|
|
132295
|
+
Page.SectionHeader = function (_a) {
|
|
132296
|
+
var title = _a.title, description = _a.description, action = _a.action;
|
|
132297
|
+
return (React.createElement(Page.Horizontal, { gap: "md" },
|
|
132298
|
+
React.createElement(Page.Vertical, { gap: "xs", sizing: "grow" },
|
|
132299
|
+
React.createElement(Page.H, { variant: "h5" }, title),
|
|
132300
|
+
React.createElement(Page.P, { variant: "secondary" }, description)),
|
|
132301
|
+
action && (React.createElement("div", null,
|
|
132302
|
+
React.createElement(Button, __assign({}, action))))));
|
|
132303
|
+
};
|
|
132304
|
+
Page.Separator = function () {
|
|
132305
|
+
return (React.createElement(Separator, null));
|
|
132306
|
+
};
|
|
132307
|
+
var PsizeClasses = {
|
|
132308
|
+
xs: "s-text-xs",
|
|
132309
|
+
sm: "s-text-sm",
|
|
132310
|
+
md: "s-text-base",
|
|
132311
|
+
lg: "s-text-lg",
|
|
132312
|
+
};
|
|
132313
|
+
Page.P = function (_a) {
|
|
132314
|
+
var children = _a.children, variant = _a.variant, _b = _a.size, size = _b === void 0 ? "sm" : _b;
|
|
132315
|
+
return (React.createElement("p", { className: classNames(PsizeClasses[size], variant === "secondary"
|
|
132316
|
+
? "s-text-element-700 dark:s-text-element-600-dark"
|
|
132317
|
+
: "s-text-element-900 dark:s-text-element-900-dark") }, children));
|
|
132318
|
+
};
|
|
132319
|
+
Page.H = function (_a) {
|
|
132320
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "h3" : _b;
|
|
132321
|
+
var Component = variant;
|
|
132322
|
+
var hSizes = {
|
|
132323
|
+
h1: "s-text-4xl s-font-bold",
|
|
132324
|
+
h2: "s-text-3xl s-font-bold",
|
|
132325
|
+
h3: "s-text-2xl s-font-bold",
|
|
132326
|
+
h4: "s-text-xl s-font-semibold",
|
|
132327
|
+
h5: "s-text-lg s-font-semibold",
|
|
132328
|
+
h6: "s-text-base s-font-semibold",
|
|
132329
|
+
};
|
|
132330
|
+
return (React.createElement(Component, { className: classNames("s-text-element-900 dark:s-text-element-900-dark", hSizes[variant]) }, children));
|
|
132331
|
+
};
|
|
132332
|
+
var gapSizes = {
|
|
132333
|
+
xs: "s-gap-1",
|
|
132334
|
+
sm: "s-gap-2",
|
|
132335
|
+
md: "s-gap-3",
|
|
132336
|
+
lg: "s-gap-5",
|
|
132337
|
+
xl: "s-gap-8",
|
|
132338
|
+
none: "",
|
|
132339
|
+
};
|
|
132340
|
+
Page.Layout = function (_a) {
|
|
132341
|
+
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;
|
|
132342
|
+
switch (direction) {
|
|
132343
|
+
case "horizontal":
|
|
132344
|
+
return (React.createElement(Page.Horizontal, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132345
|
+
case "vertical":
|
|
132346
|
+
return (React.createElement(Page.Vertical, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132347
|
+
case "fluid":
|
|
132348
|
+
return (React.createElement(Page.Fluid, { children: children, sizing: sizing, align: align, gap: gap }));
|
|
132349
|
+
default:
|
|
132350
|
+
return null;
|
|
132351
|
+
}
|
|
132352
|
+
};
|
|
132353
|
+
Page.Horizontal = function (_a) {
|
|
132354
|
+
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;
|
|
132355
|
+
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));
|
|
132356
|
+
};
|
|
132357
|
+
Page.Vertical = function (_a) {
|
|
132358
|
+
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;
|
|
132359
|
+
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));
|
|
132360
|
+
};
|
|
132361
|
+
Page.Fluid = function (_a) {
|
|
132362
|
+
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;
|
|
132363
|
+
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));
|
|
132364
|
+
};
|
|
132365
|
+
|
|
132366
|
+
function PaginatedCitationsGrid(_a) {
|
|
132367
|
+
var items = _a.items, _b = _a.maxItemsPerPage, maxItemsPerPage = _b === void 0 ? 9 : _b;
|
|
132368
|
+
var _c = __read(React.useState({
|
|
132369
|
+
pageIndex: 0,
|
|
132370
|
+
pageSize: maxItemsPerPage,
|
|
132371
|
+
}), 2), pagination = _c[0], setPagination = _c[1];
|
|
132372
|
+
var cols = 3;
|
|
132373
|
+
var rows = Math.ceil(Math.min(maxItemsPerPage, items.length) / cols);
|
|
132374
|
+
if (items.length === 0) {
|
|
132375
|
+
return null;
|
|
132376
|
+
}
|
|
132377
|
+
var pageIndex = pagination.pageIndex, pageSize = pagination.pageSize;
|
|
132378
|
+
// Calculate start index.
|
|
132379
|
+
var startIndex = pageIndex * pageSize;
|
|
132380
|
+
// Slice items for current page.
|
|
132381
|
+
var paginatedItems = items.slice(startIndex, startIndex + pageSize);
|
|
132382
|
+
return (React.createElement("div", { className: "s-flex s-w-full s-flex-col" },
|
|
132383
|
+
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) {
|
|
132384
|
+
return (React.createElement(Citation, { size: "xs", sizing: "fluid", key: idx, description: d.description, href: d.href, title: d.title, type: d.type }));
|
|
132385
|
+
})),
|
|
132386
|
+
React.createElement("div", { className: classNames("s-pt-3", items.length > maxItemsPerPage ? "s-visible" : "s-collapse") },
|
|
132387
|
+
React.createElement(Pagination, { rowCount: items.length, pagination: pagination, setPagination: setPagination, size: "xs", showDetails: false, showPageButtons: false }))));
|
|
132388
|
+
}
|
|
132389
|
+
|
|
132390
|
+
// packages/core/primitive/src/primitive.tsx
|
|
132391
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
132392
|
+
return function handleEvent(event) {
|
|
132393
|
+
originalEventHandler?.(event);
|
|
132394
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
132395
|
+
return ourEventHandler?.(event);
|
|
132396
|
+
}
|
|
132397
|
+
};
|
|
132398
|
+
}
|
|
132399
|
+
|
|
132400
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
132401
|
+
function setRef(ref, value) {
|
|
132402
|
+
if (typeof ref === "function") {
|
|
132403
|
+
ref(value);
|
|
132404
|
+
} else if (ref !== null && ref !== void 0) {
|
|
132405
|
+
ref.current = value;
|
|
132406
|
+
}
|
|
132407
|
+
}
|
|
132408
|
+
function composeRefs(...refs) {
|
|
132409
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
132410
|
+
}
|
|
132411
|
+
function useComposedRefs(...refs) {
|
|
132412
|
+
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
132413
|
+
}
|
|
132414
|
+
|
|
132415
|
+
// packages/react/context/src/createContext.tsx
|
|
132416
|
+
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
132417
|
+
let defaultContexts = [];
|
|
132418
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
132419
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
132420
|
+
const index = defaultContexts.length;
|
|
132421
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
132422
|
+
const Provider = (props) => {
|
|
132423
|
+
const { scope, children, ...context } = props;
|
|
132424
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
132425
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
132426
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
132427
|
+
};
|
|
132428
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
132429
|
+
function useContext2(consumerName, scope) {
|
|
132430
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
132431
|
+
const context = React__namespace.useContext(Context);
|
|
132432
|
+
if (context) return context;
|
|
132433
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
132434
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
132435
|
+
}
|
|
132436
|
+
return [Provider, useContext2];
|
|
132437
|
+
}
|
|
132438
|
+
const createScope = () => {
|
|
132439
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
132440
|
+
return React__namespace.createContext(defaultContext);
|
|
132441
|
+
});
|
|
132442
|
+
return function useScope(scope) {
|
|
132443
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
132444
|
+
return React__namespace.useMemo(
|
|
132445
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
132446
|
+
[scope, contexts]
|
|
132447
|
+
);
|
|
132448
|
+
};
|
|
132449
|
+
};
|
|
132450
|
+
createScope.scopeName = scopeName;
|
|
132451
|
+
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
132452
|
+
}
|
|
132453
|
+
function composeContextScopes$1(...scopes) {
|
|
132454
|
+
const baseScope = scopes[0];
|
|
132455
|
+
if (scopes.length === 1) return baseScope;
|
|
132456
|
+
const createScope = () => {
|
|
132457
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
132458
|
+
useScope: createScope2(),
|
|
132459
|
+
scopeName: createScope2.scopeName
|
|
132460
|
+
}));
|
|
132461
|
+
return function useComposedScopes(overrideScopes) {
|
|
132462
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
132463
|
+
const scopeProps = useScope(overrideScopes);
|
|
132464
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
132465
|
+
return { ...nextScopes2, ...currentScope };
|
|
132466
|
+
}, {});
|
|
132467
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
132468
|
+
};
|
|
132469
|
+
};
|
|
132470
|
+
createScope.scopeName = baseScope.scopeName;
|
|
132471
|
+
return createScope;
|
|
132472
|
+
}
|
|
132473
|
+
|
|
132206
132474
|
// packages/react/primitive/src/Primitive.tsx
|
|
132207
132475
|
var NODES = [
|
|
132208
132476
|
"a",
|
|
@@ -132234,147 +132502,2004 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
132234
132502
|
Node.displayName = `Primitive.${node}`;
|
|
132235
132503
|
return { ...primitive, [node]: Node };
|
|
132236
132504
|
}, {});
|
|
132505
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
132506
|
+
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
132507
|
+
}
|
|
132237
132508
|
|
|
132238
|
-
// packages/react/
|
|
132239
|
-
|
|
132240
|
-
|
|
132241
|
-
|
|
132242
|
-
|
|
132243
|
-
|
|
132244
|
-
|
|
132245
|
-
|
|
132246
|
-
|
|
132509
|
+
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
132510
|
+
function useCallbackRef$1(callback) {
|
|
132511
|
+
const callbackRef = React__namespace.useRef(callback);
|
|
132512
|
+
React__namespace.useEffect(() => {
|
|
132513
|
+
callbackRef.current = callback;
|
|
132514
|
+
});
|
|
132515
|
+
return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
132516
|
+
}
|
|
132517
|
+
|
|
132518
|
+
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
132519
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
132520
|
+
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
132521
|
+
React__namespace.useEffect(() => {
|
|
132522
|
+
const handleKeyDown = (event) => {
|
|
132523
|
+
if (event.key === "Escape") {
|
|
132524
|
+
onEscapeKeyDown(event);
|
|
132525
|
+
}
|
|
132526
|
+
};
|
|
132527
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
132528
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
132529
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
132530
|
+
}
|
|
132531
|
+
|
|
132532
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
132533
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
132534
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
132535
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
132536
|
+
var originalBodyPointerEvents;
|
|
132537
|
+
var DismissableLayerContext = React__namespace.createContext({
|
|
132538
|
+
layers: /* @__PURE__ */ new Set(),
|
|
132539
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
132540
|
+
branches: /* @__PURE__ */ new Set()
|
|
132541
|
+
});
|
|
132542
|
+
var DismissableLayer = React__namespace.forwardRef(
|
|
132543
|
+
(props, forwardedRef) => {
|
|
132544
|
+
const {
|
|
132545
|
+
disableOutsidePointerEvents = false,
|
|
132546
|
+
onEscapeKeyDown,
|
|
132547
|
+
onPointerDownOutside,
|
|
132548
|
+
onFocusOutside,
|
|
132549
|
+
onInteractOutside,
|
|
132550
|
+
onDismiss,
|
|
132551
|
+
...layerProps
|
|
132552
|
+
} = props;
|
|
132553
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
132554
|
+
const [node, setNode] = React__namespace.useState(null);
|
|
132555
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
132556
|
+
const [, force] = React__namespace.useState({});
|
|
132557
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
132558
|
+
const layers = Array.from(context.layers);
|
|
132559
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
132560
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
132561
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
132562
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
132563
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
132564
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
132565
|
+
const target = event.target;
|
|
132566
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
132567
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
132568
|
+
onPointerDownOutside?.(event);
|
|
132569
|
+
onInteractOutside?.(event);
|
|
132570
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
132571
|
+
}, ownerDocument);
|
|
132572
|
+
const focusOutside = useFocusOutside((event) => {
|
|
132573
|
+
const target = event.target;
|
|
132574
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
132575
|
+
if (isFocusInBranch) return;
|
|
132576
|
+
onFocusOutside?.(event);
|
|
132577
|
+
onInteractOutside?.(event);
|
|
132578
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
132579
|
+
}, ownerDocument);
|
|
132580
|
+
useEscapeKeydown((event) => {
|
|
132581
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
132582
|
+
if (!isHighestLayer) return;
|
|
132583
|
+
onEscapeKeyDown?.(event);
|
|
132584
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
132585
|
+
event.preventDefault();
|
|
132586
|
+
onDismiss();
|
|
132587
|
+
}
|
|
132588
|
+
}, ownerDocument);
|
|
132589
|
+
React__namespace.useEffect(() => {
|
|
132590
|
+
if (!node) return;
|
|
132591
|
+
if (disableOutsidePointerEvents) {
|
|
132592
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
132593
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
132594
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
132595
|
+
}
|
|
132596
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
132597
|
+
}
|
|
132598
|
+
context.layers.add(node);
|
|
132599
|
+
dispatchUpdate();
|
|
132600
|
+
return () => {
|
|
132601
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
132602
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
132603
|
+
}
|
|
132604
|
+
};
|
|
132605
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
132606
|
+
React__namespace.useEffect(() => {
|
|
132607
|
+
return () => {
|
|
132608
|
+
if (!node) return;
|
|
132609
|
+
context.layers.delete(node);
|
|
132610
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
132611
|
+
dispatchUpdate();
|
|
132612
|
+
};
|
|
132613
|
+
}, [node, context]);
|
|
132614
|
+
React__namespace.useEffect(() => {
|
|
132615
|
+
const handleUpdate = () => force({});
|
|
132616
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
132617
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
132618
|
+
}, []);
|
|
132619
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132620
|
+
Primitive.div,
|
|
132621
|
+
{
|
|
132622
|
+
...layerProps,
|
|
132623
|
+
ref: composedRefs,
|
|
132624
|
+
style: {
|
|
132625
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
132626
|
+
...props.style
|
|
132627
|
+
},
|
|
132628
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
132629
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
132630
|
+
onPointerDownCapture: composeEventHandlers(
|
|
132631
|
+
props.onPointerDownCapture,
|
|
132632
|
+
pointerDownOutside.onPointerDownCapture
|
|
132633
|
+
)
|
|
132634
|
+
}
|
|
132635
|
+
);
|
|
132636
|
+
}
|
|
132637
|
+
);
|
|
132638
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
132639
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
132640
|
+
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132641
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
132642
|
+
const ref = React__namespace.useRef(null);
|
|
132643
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
132644
|
+
React__namespace.useEffect(() => {
|
|
132645
|
+
const node = ref.current;
|
|
132646
|
+
if (node) {
|
|
132647
|
+
context.branches.add(node);
|
|
132648
|
+
return () => {
|
|
132649
|
+
context.branches.delete(node);
|
|
132650
|
+
};
|
|
132651
|
+
}
|
|
132652
|
+
}, [context.branches]);
|
|
132653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
132654
|
+
});
|
|
132655
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
132656
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
132657
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
132658
|
+
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
132659
|
+
const handleClickRef = React__namespace.useRef(() => {
|
|
132660
|
+
});
|
|
132661
|
+
React__namespace.useEffect(() => {
|
|
132662
|
+
const handlePointerDown = (event) => {
|
|
132663
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
132664
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
132665
|
+
handleAndDispatchCustomEvent(
|
|
132666
|
+
POINTER_DOWN_OUTSIDE,
|
|
132667
|
+
handlePointerDownOutside,
|
|
132668
|
+
eventDetail,
|
|
132669
|
+
{ discrete: true }
|
|
132670
|
+
);
|
|
132671
|
+
};
|
|
132672
|
+
const eventDetail = { originalEvent: event };
|
|
132673
|
+
if (event.pointerType === "touch") {
|
|
132674
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
132675
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
132676
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
132677
|
+
} else {
|
|
132678
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
132679
|
+
}
|
|
132680
|
+
} else {
|
|
132681
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
132682
|
+
}
|
|
132683
|
+
isPointerInsideReactTreeRef.current = false;
|
|
132684
|
+
};
|
|
132685
|
+
const timerId = window.setTimeout(() => {
|
|
132686
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
132687
|
+
}, 0);
|
|
132688
|
+
return () => {
|
|
132689
|
+
window.clearTimeout(timerId);
|
|
132690
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
132691
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
132692
|
+
};
|
|
132693
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
132694
|
+
return {
|
|
132695
|
+
// ensures we check React component tree (not just DOM tree)
|
|
132696
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
132697
|
+
};
|
|
132698
|
+
}
|
|
132699
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
132700
|
+
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
132701
|
+
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
132702
|
+
React__namespace.useEffect(() => {
|
|
132703
|
+
const handleFocus = (event) => {
|
|
132704
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
132705
|
+
const eventDetail = { originalEvent: event };
|
|
132706
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
132707
|
+
discrete: false
|
|
132708
|
+
});
|
|
132709
|
+
}
|
|
132710
|
+
};
|
|
132711
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
132712
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
132713
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
132714
|
+
return {
|
|
132715
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
132716
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
132717
|
+
};
|
|
132718
|
+
}
|
|
132719
|
+
function dispatchUpdate() {
|
|
132720
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
132721
|
+
document.dispatchEvent(event);
|
|
132722
|
+
}
|
|
132723
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
132724
|
+
const target = detail.originalEvent.target;
|
|
132725
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
132726
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
132727
|
+
if (discrete) {
|
|
132728
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
132729
|
+
} else {
|
|
132730
|
+
target.dispatchEvent(event);
|
|
132731
|
+
}
|
|
132732
|
+
}
|
|
132733
|
+
|
|
132734
|
+
var count$1 = 0;
|
|
132735
|
+
function useFocusGuards() {
|
|
132736
|
+
React__namespace.useEffect(() => {
|
|
132737
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
132738
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
132739
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
132740
|
+
count$1++;
|
|
132741
|
+
return () => {
|
|
132742
|
+
if (count$1 === 1) {
|
|
132743
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
132744
|
+
}
|
|
132745
|
+
count$1--;
|
|
132746
|
+
};
|
|
132747
|
+
}, []);
|
|
132748
|
+
}
|
|
132749
|
+
function createFocusGuard() {
|
|
132750
|
+
const element = document.createElement("span");
|
|
132751
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
132752
|
+
element.tabIndex = 0;
|
|
132753
|
+
element.style.outline = "none";
|
|
132754
|
+
element.style.opacity = "0";
|
|
132755
|
+
element.style.position = "fixed";
|
|
132756
|
+
element.style.pointerEvents = "none";
|
|
132757
|
+
return element;
|
|
132758
|
+
}
|
|
132759
|
+
|
|
132760
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
132761
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
132762
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
132763
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
132764
|
+
var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132765
|
+
const {
|
|
132766
|
+
loop = false,
|
|
132767
|
+
trapped = false,
|
|
132768
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
132769
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
132770
|
+
...scopeProps
|
|
132771
|
+
} = props;
|
|
132772
|
+
const [container, setContainer] = React__namespace.useState(null);
|
|
132773
|
+
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
132774
|
+
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
132775
|
+
const lastFocusedElementRef = React__namespace.useRef(null);
|
|
132776
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
132777
|
+
const focusScope = React__namespace.useRef({
|
|
132778
|
+
paused: false,
|
|
132779
|
+
pause() {
|
|
132780
|
+
this.paused = true;
|
|
132781
|
+
},
|
|
132782
|
+
resume() {
|
|
132783
|
+
this.paused = false;
|
|
132784
|
+
}
|
|
132785
|
+
}).current;
|
|
132786
|
+
React__namespace.useEffect(() => {
|
|
132787
|
+
if (trapped) {
|
|
132788
|
+
let handleFocusIn2 = function(event) {
|
|
132789
|
+
if (focusScope.paused || !container) return;
|
|
132790
|
+
const target = event.target;
|
|
132791
|
+
if (container.contains(target)) {
|
|
132792
|
+
lastFocusedElementRef.current = target;
|
|
132793
|
+
} else {
|
|
132794
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
132795
|
+
}
|
|
132796
|
+
}, handleFocusOut2 = function(event) {
|
|
132797
|
+
if (focusScope.paused || !container) return;
|
|
132798
|
+
const relatedTarget = event.relatedTarget;
|
|
132799
|
+
if (relatedTarget === null) return;
|
|
132800
|
+
if (!container.contains(relatedTarget)) {
|
|
132801
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
132802
|
+
}
|
|
132803
|
+
}, handleMutations2 = function(mutations) {
|
|
132804
|
+
const focusedElement = document.activeElement;
|
|
132805
|
+
if (focusedElement !== document.body) return;
|
|
132806
|
+
for (const mutation of mutations) {
|
|
132807
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
132808
|
+
}
|
|
132809
|
+
};
|
|
132810
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
132811
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
132812
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
132813
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
132814
|
+
return () => {
|
|
132815
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
132816
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
132817
|
+
mutationObserver.disconnect();
|
|
132818
|
+
};
|
|
132819
|
+
}
|
|
132820
|
+
}, [trapped, container, focusScope.paused]);
|
|
132821
|
+
React__namespace.useEffect(() => {
|
|
132822
|
+
if (container) {
|
|
132823
|
+
focusScopesStack.add(focusScope);
|
|
132824
|
+
const previouslyFocusedElement = document.activeElement;
|
|
132825
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
132826
|
+
if (!hasFocusedCandidate) {
|
|
132827
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
132828
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
132829
|
+
container.dispatchEvent(mountEvent);
|
|
132830
|
+
if (!mountEvent.defaultPrevented) {
|
|
132831
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
132832
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
132833
|
+
focus(container);
|
|
132834
|
+
}
|
|
132835
|
+
}
|
|
132836
|
+
}
|
|
132837
|
+
return () => {
|
|
132838
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
132839
|
+
setTimeout(() => {
|
|
132840
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
132841
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
132842
|
+
container.dispatchEvent(unmountEvent);
|
|
132843
|
+
if (!unmountEvent.defaultPrevented) {
|
|
132844
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
132845
|
+
}
|
|
132846
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
132847
|
+
focusScopesStack.remove(focusScope);
|
|
132848
|
+
}, 0);
|
|
132849
|
+
};
|
|
132850
|
+
}
|
|
132851
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
132852
|
+
const handleKeyDown = React__namespace.useCallback(
|
|
132853
|
+
(event) => {
|
|
132854
|
+
if (!loop && !trapped) return;
|
|
132855
|
+
if (focusScope.paused) return;
|
|
132856
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
132857
|
+
const focusedElement = document.activeElement;
|
|
132858
|
+
if (isTabKey && focusedElement) {
|
|
132859
|
+
const container2 = event.currentTarget;
|
|
132860
|
+
const [first, last] = getTabbableEdges(container2);
|
|
132861
|
+
const hasTabbableElementsInside = first && last;
|
|
132862
|
+
if (!hasTabbableElementsInside) {
|
|
132863
|
+
if (focusedElement === container2) event.preventDefault();
|
|
132864
|
+
} else {
|
|
132865
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
132866
|
+
event.preventDefault();
|
|
132867
|
+
if (loop) focus(first, { select: true });
|
|
132868
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
132869
|
+
event.preventDefault();
|
|
132870
|
+
if (loop) focus(last, { select: true });
|
|
132871
|
+
}
|
|
132872
|
+
}
|
|
132873
|
+
}
|
|
132874
|
+
},
|
|
132875
|
+
[loop, trapped, focusScope.paused]
|
|
132876
|
+
);
|
|
132877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
132878
|
+
});
|
|
132879
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
132880
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
132881
|
+
const previouslyFocusedElement = document.activeElement;
|
|
132882
|
+
for (const candidate of candidates) {
|
|
132883
|
+
focus(candidate, { select });
|
|
132884
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
132885
|
+
}
|
|
132886
|
+
}
|
|
132887
|
+
function getTabbableEdges(container) {
|
|
132888
|
+
const candidates = getTabbableCandidates(container);
|
|
132889
|
+
const first = findVisible(candidates, container);
|
|
132890
|
+
const last = findVisible(candidates.reverse(), container);
|
|
132891
|
+
return [first, last];
|
|
132892
|
+
}
|
|
132893
|
+
function getTabbableCandidates(container) {
|
|
132894
|
+
const nodes = [];
|
|
132895
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
132896
|
+
acceptNode: (node) => {
|
|
132897
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
132898
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
132899
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
132900
|
+
}
|
|
132901
|
+
});
|
|
132902
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
132903
|
+
return nodes;
|
|
132904
|
+
}
|
|
132905
|
+
function findVisible(elements, container) {
|
|
132906
|
+
for (const element of elements) {
|
|
132907
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
132908
|
+
}
|
|
132909
|
+
}
|
|
132910
|
+
function isHidden(node, { upTo }) {
|
|
132911
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
132912
|
+
while (node) {
|
|
132913
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
132914
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
132915
|
+
node = node.parentElement;
|
|
132916
|
+
}
|
|
132917
|
+
return false;
|
|
132918
|
+
}
|
|
132919
|
+
function isSelectableInput(element) {
|
|
132920
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
132921
|
+
}
|
|
132922
|
+
function focus(element, { select = false } = {}) {
|
|
132923
|
+
if (element && element.focus) {
|
|
132924
|
+
const previouslyFocusedElement = document.activeElement;
|
|
132925
|
+
element.focus({ preventScroll: true });
|
|
132926
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
132927
|
+
element.select();
|
|
132928
|
+
}
|
|
132929
|
+
}
|
|
132930
|
+
var focusScopesStack = createFocusScopesStack();
|
|
132931
|
+
function createFocusScopesStack() {
|
|
132932
|
+
let stack = [];
|
|
132933
|
+
return {
|
|
132934
|
+
add(focusScope) {
|
|
132935
|
+
const activeFocusScope = stack[0];
|
|
132936
|
+
if (focusScope !== activeFocusScope) {
|
|
132937
|
+
activeFocusScope?.pause();
|
|
132938
|
+
}
|
|
132939
|
+
stack = arrayRemove(stack, focusScope);
|
|
132940
|
+
stack.unshift(focusScope);
|
|
132941
|
+
},
|
|
132942
|
+
remove(focusScope) {
|
|
132943
|
+
stack = arrayRemove(stack, focusScope);
|
|
132944
|
+
stack[0]?.resume();
|
|
132945
|
+
}
|
|
132946
|
+
};
|
|
132947
|
+
}
|
|
132948
|
+
function arrayRemove(array, item) {
|
|
132949
|
+
const updatedArray = [...array];
|
|
132950
|
+
const index = updatedArray.indexOf(item);
|
|
132951
|
+
if (index !== -1) {
|
|
132952
|
+
updatedArray.splice(index, 1);
|
|
132953
|
+
}
|
|
132954
|
+
return updatedArray;
|
|
132955
|
+
}
|
|
132956
|
+
function removeLinks(items) {
|
|
132957
|
+
return items.filter((item) => item.tagName !== "A");
|
|
132958
|
+
}
|
|
132959
|
+
|
|
132960
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
132961
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
132962
|
+
};
|
|
132963
|
+
|
|
132964
|
+
// packages/react/id/src/id.tsx
|
|
132965
|
+
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
132966
|
+
var count = 0;
|
|
132967
|
+
function useId(deterministicId) {
|
|
132968
|
+
const [id, setId] = React__namespace.useState(useReactId());
|
|
132969
|
+
useLayoutEffect2(() => {
|
|
132970
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
132971
|
+
}, [deterministicId]);
|
|
132972
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
132973
|
+
}
|
|
132974
|
+
|
|
132975
|
+
// packages/react/arrow/src/Arrow.tsx
|
|
132976
|
+
var NAME = "Arrow";
|
|
132977
|
+
var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
132978
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
132247
132979
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132248
|
-
Primitive.
|
|
132980
|
+
Primitive.svg,
|
|
132249
132981
|
{
|
|
132250
|
-
|
|
132251
|
-
|
|
132252
|
-
|
|
132253
|
-
|
|
132982
|
+
...arrowProps,
|
|
132983
|
+
ref: forwardedRef,
|
|
132984
|
+
width,
|
|
132985
|
+
height,
|
|
132986
|
+
viewBox: "0 0 30 10",
|
|
132987
|
+
preserveAspectRatio: "none",
|
|
132988
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
132254
132989
|
}
|
|
132255
132990
|
);
|
|
132256
132991
|
});
|
|
132257
|
-
|
|
132258
|
-
|
|
132259
|
-
|
|
132992
|
+
Arrow$1.displayName = NAME;
|
|
132993
|
+
var Root = Arrow$1;
|
|
132994
|
+
|
|
132995
|
+
// packages/react/context/src/createContext.tsx
|
|
132996
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
132997
|
+
let defaultContexts = [];
|
|
132998
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
132999
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
133000
|
+
const index = defaultContexts.length;
|
|
133001
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
133002
|
+
function Provider(props) {
|
|
133003
|
+
const { scope, children, ...context } = props;
|
|
133004
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
133005
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
133006
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
133007
|
+
}
|
|
133008
|
+
function useContext2(consumerName, scope) {
|
|
133009
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
133010
|
+
const context = React__namespace.useContext(Context);
|
|
133011
|
+
if (context) return context;
|
|
133012
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
133013
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
133014
|
+
}
|
|
133015
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
133016
|
+
return [Provider, useContext2];
|
|
133017
|
+
}
|
|
133018
|
+
const createScope = () => {
|
|
133019
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
133020
|
+
return React__namespace.createContext(defaultContext);
|
|
133021
|
+
});
|
|
133022
|
+
return function useScope(scope) {
|
|
133023
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
133024
|
+
return React__namespace.useMemo(
|
|
133025
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
133026
|
+
[scope, contexts]
|
|
133027
|
+
);
|
|
133028
|
+
};
|
|
133029
|
+
};
|
|
133030
|
+
createScope.scopeName = scopeName;
|
|
133031
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
133032
|
+
}
|
|
133033
|
+
function composeContextScopes(...scopes) {
|
|
133034
|
+
const baseScope = scopes[0];
|
|
133035
|
+
if (scopes.length === 1) return baseScope;
|
|
133036
|
+
const createScope = () => {
|
|
133037
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
133038
|
+
useScope: createScope2(),
|
|
133039
|
+
scopeName: createScope2.scopeName
|
|
133040
|
+
}));
|
|
133041
|
+
return function useComposedScopes(overrideScopes) {
|
|
133042
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
133043
|
+
const scopeProps = useScope(overrideScopes);
|
|
133044
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
133045
|
+
return { ...nextScopes2, ...currentScope };
|
|
133046
|
+
}, {});
|
|
133047
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
133048
|
+
};
|
|
133049
|
+
};
|
|
133050
|
+
createScope.scopeName = baseScope.scopeName;
|
|
133051
|
+
return createScope;
|
|
132260
133052
|
}
|
|
132261
|
-
var Root = Separator$1;
|
|
132262
133053
|
|
|
132263
|
-
|
|
132264
|
-
|
|
132265
|
-
|
|
133054
|
+
// packages/react/use-size/src/useSize.tsx
|
|
133055
|
+
function useSize(element) {
|
|
133056
|
+
const [size, setSize] = React__namespace.useState(void 0);
|
|
133057
|
+
useLayoutEffect2(() => {
|
|
133058
|
+
if (element) {
|
|
133059
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
133060
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
133061
|
+
if (!Array.isArray(entries)) {
|
|
133062
|
+
return;
|
|
133063
|
+
}
|
|
133064
|
+
if (!entries.length) {
|
|
133065
|
+
return;
|
|
133066
|
+
}
|
|
133067
|
+
const entry = entries[0];
|
|
133068
|
+
let width;
|
|
133069
|
+
let height;
|
|
133070
|
+
if ("borderBoxSize" in entry) {
|
|
133071
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
133072
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
133073
|
+
width = borderSize["inlineSize"];
|
|
133074
|
+
height = borderSize["blockSize"];
|
|
133075
|
+
} else {
|
|
133076
|
+
width = element.offsetWidth;
|
|
133077
|
+
height = element.offsetHeight;
|
|
133078
|
+
}
|
|
133079
|
+
setSize({ width, height });
|
|
133080
|
+
});
|
|
133081
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
133082
|
+
return () => resizeObserver.unobserve(element);
|
|
133083
|
+
} else {
|
|
133084
|
+
setSize(void 0);
|
|
133085
|
+
}
|
|
133086
|
+
}, [element]);
|
|
133087
|
+
return size;
|
|
133088
|
+
}
|
|
133089
|
+
|
|
133090
|
+
var POPPER_NAME = "Popper";
|
|
133091
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
133092
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
133093
|
+
var Popper = (props) => {
|
|
133094
|
+
const { __scopePopper, children } = props;
|
|
133095
|
+
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
133096
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
133097
|
+
};
|
|
133098
|
+
Popper.displayName = POPPER_NAME;
|
|
133099
|
+
var ANCHOR_NAME$1 = "PopperAnchor";
|
|
133100
|
+
var PopperAnchor = React__namespace.forwardRef(
|
|
133101
|
+
(props, forwardedRef) => {
|
|
133102
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
133103
|
+
const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
|
|
133104
|
+
const ref = React__namespace.useRef(null);
|
|
133105
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
133106
|
+
React__namespace.useEffect(() => {
|
|
133107
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
133108
|
+
});
|
|
133109
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
133110
|
+
}
|
|
133111
|
+
);
|
|
133112
|
+
PopperAnchor.displayName = ANCHOR_NAME$1;
|
|
133113
|
+
var CONTENT_NAME$1 = "PopperContent";
|
|
133114
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
|
|
133115
|
+
var PopperContent = React__namespace.forwardRef(
|
|
133116
|
+
(props, forwardedRef) => {
|
|
133117
|
+
const {
|
|
133118
|
+
__scopePopper,
|
|
133119
|
+
side = "bottom",
|
|
133120
|
+
sideOffset = 0,
|
|
133121
|
+
align = "center",
|
|
133122
|
+
alignOffset = 0,
|
|
133123
|
+
arrowPadding = 0,
|
|
133124
|
+
avoidCollisions = true,
|
|
133125
|
+
collisionBoundary = [],
|
|
133126
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
133127
|
+
sticky = "partial",
|
|
133128
|
+
hideWhenDetached = false,
|
|
133129
|
+
updatePositionStrategy = "optimized",
|
|
133130
|
+
onPlaced,
|
|
133131
|
+
...contentProps
|
|
133132
|
+
} = props;
|
|
133133
|
+
const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
|
|
133134
|
+
const [content, setContent] = React__namespace.useState(null);
|
|
133135
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
133136
|
+
const [arrow$1, setArrow] = React__namespace.useState(null);
|
|
133137
|
+
const arrowSize = useSize(arrow$1);
|
|
133138
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
133139
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
133140
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
133141
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
133142
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
133143
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
133144
|
+
const detectOverflowOptions = {
|
|
133145
|
+
padding: collisionPadding,
|
|
133146
|
+
boundary: boundary.filter(isNotNull),
|
|
133147
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
133148
|
+
altBoundary: hasExplicitBoundaries
|
|
133149
|
+
};
|
|
133150
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
133151
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
133152
|
+
strategy: "fixed",
|
|
133153
|
+
placement: desiredPlacement,
|
|
133154
|
+
whileElementsMounted: (...args) => {
|
|
133155
|
+
const cleanup = autoUpdate(...args, {
|
|
133156
|
+
animationFrame: updatePositionStrategy === "always"
|
|
133157
|
+
});
|
|
133158
|
+
return cleanup;
|
|
133159
|
+
},
|
|
133160
|
+
elements: {
|
|
133161
|
+
reference: context.anchor
|
|
133162
|
+
},
|
|
133163
|
+
middleware: [
|
|
133164
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
133165
|
+
avoidCollisions && shift({
|
|
133166
|
+
mainAxis: true,
|
|
133167
|
+
crossAxis: false,
|
|
133168
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
133169
|
+
...detectOverflowOptions
|
|
133170
|
+
}),
|
|
133171
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
133172
|
+
size({
|
|
133173
|
+
...detectOverflowOptions,
|
|
133174
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
133175
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
133176
|
+
const contentStyle = elements.floating.style;
|
|
133177
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
133178
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
133179
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
133180
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
133181
|
+
}
|
|
133182
|
+
}),
|
|
133183
|
+
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
133184
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
133185
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
133186
|
+
]
|
|
133187
|
+
});
|
|
133188
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
133189
|
+
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
133190
|
+
useLayoutEffect2(() => {
|
|
133191
|
+
if (isPositioned) {
|
|
133192
|
+
handlePlaced?.();
|
|
133193
|
+
}
|
|
133194
|
+
}, [isPositioned, handlePlaced]);
|
|
133195
|
+
const arrowX = middlewareData.arrow?.x;
|
|
133196
|
+
const arrowY = middlewareData.arrow?.y;
|
|
133197
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
133198
|
+
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
133199
|
+
useLayoutEffect2(() => {
|
|
133200
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
133201
|
+
}, [content]);
|
|
133202
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
133203
|
+
"div",
|
|
133204
|
+
{
|
|
133205
|
+
ref: refs.setFloating,
|
|
133206
|
+
"data-radix-popper-content-wrapper": "",
|
|
133207
|
+
style: {
|
|
133208
|
+
...floatingStyles,
|
|
133209
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
133210
|
+
// keep off the page when measuring
|
|
133211
|
+
minWidth: "max-content",
|
|
133212
|
+
zIndex: contentZIndex,
|
|
133213
|
+
["--radix-popper-transform-origin"]: [
|
|
133214
|
+
middlewareData.transformOrigin?.x,
|
|
133215
|
+
middlewareData.transformOrigin?.y
|
|
133216
|
+
].join(" "),
|
|
133217
|
+
// hide the content if using the hide middleware and should be hidden
|
|
133218
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
133219
|
+
// as if the PopperContent isn't there at all
|
|
133220
|
+
...middlewareData.hide?.referenceHidden && {
|
|
133221
|
+
visibility: "hidden",
|
|
133222
|
+
pointerEvents: "none"
|
|
133223
|
+
}
|
|
133224
|
+
},
|
|
133225
|
+
dir: props.dir,
|
|
133226
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133227
|
+
PopperContentProvider,
|
|
133228
|
+
{
|
|
133229
|
+
scope: __scopePopper,
|
|
133230
|
+
placedSide,
|
|
133231
|
+
onArrowChange: setArrow,
|
|
133232
|
+
arrowX,
|
|
133233
|
+
arrowY,
|
|
133234
|
+
shouldHideArrow: cannotCenterArrow,
|
|
133235
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133236
|
+
Primitive.div,
|
|
133237
|
+
{
|
|
133238
|
+
"data-side": placedSide,
|
|
133239
|
+
"data-align": placedAlign,
|
|
133240
|
+
...contentProps,
|
|
133241
|
+
ref: composedRefs,
|
|
133242
|
+
style: {
|
|
133243
|
+
...contentProps.style,
|
|
133244
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
133245
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
133246
|
+
animation: !isPositioned ? "none" : void 0
|
|
133247
|
+
}
|
|
133248
|
+
}
|
|
133249
|
+
)
|
|
133250
|
+
}
|
|
133251
|
+
)
|
|
133252
|
+
}
|
|
133253
|
+
);
|
|
133254
|
+
}
|
|
133255
|
+
);
|
|
133256
|
+
PopperContent.displayName = CONTENT_NAME$1;
|
|
133257
|
+
var ARROW_NAME$1 = "PopperArrow";
|
|
133258
|
+
var OPPOSITE_SIDE = {
|
|
133259
|
+
top: "bottom",
|
|
133260
|
+
right: "left",
|
|
133261
|
+
bottom: "top",
|
|
133262
|
+
left: "right"
|
|
133263
|
+
};
|
|
133264
|
+
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
133265
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
133266
|
+
const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
|
|
133267
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
133268
|
+
return (
|
|
133269
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
133270
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
133271
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
133272
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
133273
|
+
"span",
|
|
133274
|
+
{
|
|
133275
|
+
ref: contentContext.onArrowChange,
|
|
133276
|
+
style: {
|
|
133277
|
+
position: "absolute",
|
|
133278
|
+
left: contentContext.arrowX,
|
|
133279
|
+
top: contentContext.arrowY,
|
|
133280
|
+
[baseSide]: 0,
|
|
133281
|
+
transformOrigin: {
|
|
133282
|
+
top: "",
|
|
133283
|
+
right: "0 0",
|
|
133284
|
+
bottom: "center 0",
|
|
133285
|
+
left: "100% 0"
|
|
133286
|
+
}[contentContext.placedSide],
|
|
133287
|
+
transform: {
|
|
133288
|
+
top: "translateY(100%)",
|
|
133289
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
133290
|
+
bottom: `rotate(180deg)`,
|
|
133291
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
133292
|
+
}[contentContext.placedSide],
|
|
133293
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
133294
|
+
},
|
|
133295
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133296
|
+
Root,
|
|
133297
|
+
{
|
|
133298
|
+
...arrowProps,
|
|
133299
|
+
ref: forwardedRef,
|
|
133300
|
+
style: {
|
|
133301
|
+
...arrowProps.style,
|
|
133302
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
133303
|
+
display: "block"
|
|
133304
|
+
}
|
|
133305
|
+
}
|
|
133306
|
+
)
|
|
133307
|
+
}
|
|
133308
|
+
)
|
|
133309
|
+
);
|
|
133310
|
+
});
|
|
133311
|
+
PopperArrow.displayName = ARROW_NAME$1;
|
|
133312
|
+
function isNotNull(value) {
|
|
133313
|
+
return value !== null;
|
|
133314
|
+
}
|
|
133315
|
+
var transformOrigin = (options) => ({
|
|
133316
|
+
name: "transformOrigin",
|
|
133317
|
+
options,
|
|
133318
|
+
fn(data) {
|
|
133319
|
+
const { placement, rects, middlewareData } = data;
|
|
133320
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
133321
|
+
const isArrowHidden = cannotCenterArrow;
|
|
133322
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
133323
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
133324
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
133325
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
133326
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
133327
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
133328
|
+
let x = "";
|
|
133329
|
+
let y = "";
|
|
133330
|
+
if (placedSide === "bottom") {
|
|
133331
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
133332
|
+
y = `${-arrowHeight}px`;
|
|
133333
|
+
} else if (placedSide === "top") {
|
|
133334
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
133335
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
133336
|
+
} else if (placedSide === "right") {
|
|
133337
|
+
x = `${-arrowHeight}px`;
|
|
133338
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
133339
|
+
} else if (placedSide === "left") {
|
|
133340
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
133341
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
133342
|
+
}
|
|
133343
|
+
return { data: { x, y } };
|
|
133344
|
+
}
|
|
132266
133345
|
});
|
|
132267
|
-
|
|
133346
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
133347
|
+
const [side, align = "center"] = placement.split("-");
|
|
133348
|
+
return [side, align];
|
|
133349
|
+
}
|
|
133350
|
+
var Root2$1 = Popper;
|
|
133351
|
+
var Anchor = PopperAnchor;
|
|
133352
|
+
var Content = PopperContent;
|
|
133353
|
+
var Arrow = PopperArrow;
|
|
132268
133354
|
|
|
132269
|
-
|
|
132270
|
-
|
|
132271
|
-
|
|
132272
|
-
|
|
132273
|
-
|
|
132274
|
-
|
|
133355
|
+
var PORTAL_NAME$1 = "Portal";
|
|
133356
|
+
var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
133357
|
+
const { container: containerProp, ...portalProps } = props;
|
|
133358
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
|
133359
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
133360
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
133361
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
133362
|
+
});
|
|
133363
|
+
Portal$1.displayName = PORTAL_NAME$1;
|
|
133364
|
+
|
|
133365
|
+
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
133366
|
+
function useControllableState({
|
|
133367
|
+
prop,
|
|
133368
|
+
defaultProp,
|
|
133369
|
+
onChange = () => {
|
|
133370
|
+
}
|
|
133371
|
+
}) {
|
|
133372
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
133373
|
+
const isControlled = prop !== void 0;
|
|
133374
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
133375
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
133376
|
+
const setValue = React__namespace.useCallback(
|
|
133377
|
+
(nextValue) => {
|
|
133378
|
+
if (isControlled) {
|
|
133379
|
+
const setter = nextValue;
|
|
133380
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
133381
|
+
if (value2 !== prop) handleChange(value2);
|
|
133382
|
+
} else {
|
|
133383
|
+
setUncontrolledProp(nextValue);
|
|
133384
|
+
}
|
|
133385
|
+
},
|
|
133386
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
133387
|
+
);
|
|
133388
|
+
return [value, setValue];
|
|
132275
133389
|
}
|
|
132276
|
-
|
|
132277
|
-
|
|
132278
|
-
|
|
132279
|
-
|
|
132280
|
-
|
|
132281
|
-
|
|
132282
|
-
|
|
133390
|
+
function useUncontrolledState({
|
|
133391
|
+
defaultProp,
|
|
133392
|
+
onChange
|
|
133393
|
+
}) {
|
|
133394
|
+
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
133395
|
+
const [value] = uncontrolledState;
|
|
133396
|
+
const prevValueRef = React__namespace.useRef(value);
|
|
133397
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
133398
|
+
React__namespace.useEffect(() => {
|
|
133399
|
+
if (prevValueRef.current !== value) {
|
|
133400
|
+
handleChange(value);
|
|
133401
|
+
prevValueRef.current = value;
|
|
133402
|
+
}
|
|
133403
|
+
}, [value, prevValueRef, handleChange]);
|
|
133404
|
+
return uncontrolledState;
|
|
133405
|
+
}
|
|
133406
|
+
|
|
133407
|
+
var getDefaultParent = function (originalTarget) {
|
|
133408
|
+
if (typeof document === 'undefined') {
|
|
133409
|
+
return null;
|
|
133410
|
+
}
|
|
133411
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
133412
|
+
return sampleTarget.ownerDocument.body;
|
|
132283
133413
|
};
|
|
132284
|
-
|
|
132285
|
-
|
|
132286
|
-
|
|
132287
|
-
|
|
132288
|
-
|
|
132289
|
-
|
|
132290
|
-
action && (React.createElement("div", null,
|
|
132291
|
-
React.createElement(Button, __assign({}, action))))));
|
|
133414
|
+
var counterMap = new WeakMap();
|
|
133415
|
+
var uncontrolledNodes = new WeakMap();
|
|
133416
|
+
var markerMap = {};
|
|
133417
|
+
var lockCount = 0;
|
|
133418
|
+
var unwrapHost = function (node) {
|
|
133419
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
132292
133420
|
};
|
|
132293
|
-
|
|
132294
|
-
return
|
|
133421
|
+
var correctTargets = function (parent, targets) {
|
|
133422
|
+
return targets
|
|
133423
|
+
.map(function (target) {
|
|
133424
|
+
if (parent.contains(target)) {
|
|
133425
|
+
return target;
|
|
133426
|
+
}
|
|
133427
|
+
var correctedTarget = unwrapHost(target);
|
|
133428
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
133429
|
+
return correctedTarget;
|
|
133430
|
+
}
|
|
133431
|
+
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
|
|
133432
|
+
return null;
|
|
133433
|
+
})
|
|
133434
|
+
.filter(function (x) { return Boolean(x); });
|
|
132295
133435
|
};
|
|
132296
|
-
|
|
132297
|
-
|
|
132298
|
-
|
|
132299
|
-
|
|
132300
|
-
|
|
133436
|
+
/**
|
|
133437
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
133438
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
133439
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
133440
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
133441
|
+
* @param {String} [controlAttribute] - html Attribute to control
|
|
133442
|
+
* @return {Undo} undo command
|
|
133443
|
+
*/
|
|
133444
|
+
var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
|
|
133445
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
133446
|
+
if (!markerMap[markerName]) {
|
|
133447
|
+
markerMap[markerName] = new WeakMap();
|
|
133448
|
+
}
|
|
133449
|
+
var markerCounter = markerMap[markerName];
|
|
133450
|
+
var hiddenNodes = [];
|
|
133451
|
+
var elementsToKeep = new Set();
|
|
133452
|
+
var elementsToStop = new Set(targets);
|
|
133453
|
+
var keep = function (el) {
|
|
133454
|
+
if (!el || elementsToKeep.has(el)) {
|
|
133455
|
+
return;
|
|
133456
|
+
}
|
|
133457
|
+
elementsToKeep.add(el);
|
|
133458
|
+
keep(el.parentNode);
|
|
133459
|
+
};
|
|
133460
|
+
targets.forEach(keep);
|
|
133461
|
+
var deep = function (parent) {
|
|
133462
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
133463
|
+
return;
|
|
133464
|
+
}
|
|
133465
|
+
Array.prototype.forEach.call(parent.children, function (node) {
|
|
133466
|
+
if (elementsToKeep.has(node)) {
|
|
133467
|
+
deep(node);
|
|
133468
|
+
}
|
|
133469
|
+
else {
|
|
133470
|
+
var attr = node.getAttribute(controlAttribute);
|
|
133471
|
+
var alreadyHidden = attr !== null && attr !== 'false';
|
|
133472
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
133473
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
133474
|
+
counterMap.set(node, counterValue);
|
|
133475
|
+
markerCounter.set(node, markerValue);
|
|
133476
|
+
hiddenNodes.push(node);
|
|
133477
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
133478
|
+
uncontrolledNodes.set(node, true);
|
|
133479
|
+
}
|
|
133480
|
+
if (markerValue === 1) {
|
|
133481
|
+
node.setAttribute(markerName, 'true');
|
|
133482
|
+
}
|
|
133483
|
+
if (!alreadyHidden) {
|
|
133484
|
+
node.setAttribute(controlAttribute, 'true');
|
|
133485
|
+
}
|
|
133486
|
+
}
|
|
133487
|
+
});
|
|
133488
|
+
};
|
|
133489
|
+
deep(parentNode);
|
|
133490
|
+
elementsToKeep.clear();
|
|
133491
|
+
lockCount++;
|
|
133492
|
+
return function () {
|
|
133493
|
+
hiddenNodes.forEach(function (node) {
|
|
133494
|
+
var counterValue = counterMap.get(node) - 1;
|
|
133495
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
133496
|
+
counterMap.set(node, counterValue);
|
|
133497
|
+
markerCounter.set(node, markerValue);
|
|
133498
|
+
if (!counterValue) {
|
|
133499
|
+
if (!uncontrolledNodes.has(node)) {
|
|
133500
|
+
node.removeAttribute(controlAttribute);
|
|
133501
|
+
}
|
|
133502
|
+
uncontrolledNodes.delete(node);
|
|
133503
|
+
}
|
|
133504
|
+
if (!markerValue) {
|
|
133505
|
+
node.removeAttribute(markerName);
|
|
133506
|
+
}
|
|
133507
|
+
});
|
|
133508
|
+
lockCount--;
|
|
133509
|
+
if (!lockCount) {
|
|
133510
|
+
// clear
|
|
133511
|
+
counterMap = new WeakMap();
|
|
133512
|
+
counterMap = new WeakMap();
|
|
133513
|
+
uncontrolledNodes = new WeakMap();
|
|
133514
|
+
markerMap = {};
|
|
133515
|
+
}
|
|
133516
|
+
};
|
|
132301
133517
|
};
|
|
132302
|
-
|
|
132303
|
-
|
|
132304
|
-
|
|
132305
|
-
|
|
132306
|
-
|
|
133518
|
+
/**
|
|
133519
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
133520
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
133521
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
133522
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
133523
|
+
* @return {Undo} undo command
|
|
133524
|
+
*/
|
|
133525
|
+
var hideOthers = function (originalTarget, parentNode, markerName) {
|
|
133526
|
+
if (markerName === void 0) { markerName = 'data-aria-hidden'; }
|
|
133527
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
133528
|
+
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
133529
|
+
if (!activeParentNode) {
|
|
133530
|
+
return function () { return null; };
|
|
133531
|
+
}
|
|
133532
|
+
// we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
|
|
133533
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
|
|
133534
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
|
|
132307
133535
|
};
|
|
132308
|
-
|
|
132309
|
-
|
|
132310
|
-
|
|
132311
|
-
|
|
132312
|
-
|
|
132313
|
-
|
|
132314
|
-
|
|
132315
|
-
|
|
132316
|
-
|
|
132317
|
-
|
|
133536
|
+
|
|
133537
|
+
var zeroRightClassName = 'right-scroll-bar-position';
|
|
133538
|
+
var fullWidthClassName = 'width-before-scroll-bar';
|
|
133539
|
+
var noScrollbarsClassName = 'with-scroll-bars-hidden';
|
|
133540
|
+
/**
|
|
133541
|
+
* Name of a CSS variable containing the amount of "hidden" scrollbar
|
|
133542
|
+
* ! might be undefined ! use will fallback!
|
|
133543
|
+
*/
|
|
133544
|
+
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
|
|
133545
|
+
|
|
133546
|
+
/**
|
|
133547
|
+
* Assigns a value for a given ref, no matter of the ref format
|
|
133548
|
+
* @param {RefObject} ref - a callback function or ref object
|
|
133549
|
+
* @param value - a new value
|
|
133550
|
+
*
|
|
133551
|
+
* @see https://github.com/theKashey/use-callback-ref#assignref
|
|
133552
|
+
* @example
|
|
133553
|
+
* const refObject = useRef();
|
|
133554
|
+
* const refFn = (ref) => {....}
|
|
133555
|
+
*
|
|
133556
|
+
* assignRef(refObject, "refValue");
|
|
133557
|
+
* assignRef(refFn, "refValue");
|
|
133558
|
+
*/
|
|
133559
|
+
function assignRef(ref, value) {
|
|
133560
|
+
if (typeof ref === 'function') {
|
|
133561
|
+
ref(value);
|
|
133562
|
+
}
|
|
133563
|
+
else if (ref) {
|
|
133564
|
+
ref.current = value;
|
|
133565
|
+
}
|
|
133566
|
+
return ref;
|
|
133567
|
+
}
|
|
133568
|
+
|
|
133569
|
+
/**
|
|
133570
|
+
* creates a MutableRef with ref change callback
|
|
133571
|
+
* @param initialValue - initial ref value
|
|
133572
|
+
* @param {Function} callback - a callback to run when value changes
|
|
133573
|
+
*
|
|
133574
|
+
* @example
|
|
133575
|
+
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
|
133576
|
+
* ref.current = 1;
|
|
133577
|
+
* // prints 0 -> 1
|
|
133578
|
+
*
|
|
133579
|
+
* @see https://reactjs.org/docs/hooks-reference.html#useref
|
|
133580
|
+
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
|
|
133581
|
+
* @returns {MutableRefObject}
|
|
133582
|
+
*/
|
|
133583
|
+
function useCallbackRef(initialValue, callback) {
|
|
133584
|
+
var ref = React.useState(function () { return ({
|
|
133585
|
+
// value
|
|
133586
|
+
value: initialValue,
|
|
133587
|
+
// last callback
|
|
133588
|
+
callback: callback,
|
|
133589
|
+
// "memoized" public interface
|
|
133590
|
+
facade: {
|
|
133591
|
+
get current() {
|
|
133592
|
+
return ref.value;
|
|
133593
|
+
},
|
|
133594
|
+
set current(value) {
|
|
133595
|
+
var last = ref.value;
|
|
133596
|
+
if (last !== value) {
|
|
133597
|
+
ref.value = value;
|
|
133598
|
+
ref.callback(value, last);
|
|
133599
|
+
}
|
|
133600
|
+
},
|
|
133601
|
+
},
|
|
133602
|
+
}); })[0];
|
|
133603
|
+
// update callback
|
|
133604
|
+
ref.callback = callback;
|
|
133605
|
+
return ref.facade;
|
|
133606
|
+
}
|
|
133607
|
+
|
|
133608
|
+
/**
|
|
133609
|
+
* Merges two or more refs together providing a single interface to set their value
|
|
133610
|
+
* @param {RefObject|Ref} refs
|
|
133611
|
+
* @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
|
|
133612
|
+
*
|
|
133613
|
+
* @see {@link mergeRefs} a version without buit-in memoization
|
|
133614
|
+
* @see https://github.com/theKashey/use-callback-ref#usemergerefs
|
|
133615
|
+
* @example
|
|
133616
|
+
* const Component = React.forwardRef((props, ref) => {
|
|
133617
|
+
* const ownRef = useRef();
|
|
133618
|
+
* const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
|
|
133619
|
+
* return <div ref={domRef}>...</div>
|
|
133620
|
+
* }
|
|
133621
|
+
*/
|
|
133622
|
+
function useMergeRefs(refs, defaultValue) {
|
|
133623
|
+
return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });
|
|
133624
|
+
}
|
|
133625
|
+
|
|
133626
|
+
function ItoI(a) {
|
|
133627
|
+
return a;
|
|
133628
|
+
}
|
|
133629
|
+
function innerCreateMedium(defaults, middleware) {
|
|
133630
|
+
if (middleware === void 0) { middleware = ItoI; }
|
|
133631
|
+
var buffer = [];
|
|
133632
|
+
var assigned = false;
|
|
133633
|
+
var medium = {
|
|
133634
|
+
read: function () {
|
|
133635
|
+
if (assigned) {
|
|
133636
|
+
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
|
|
133637
|
+
}
|
|
133638
|
+
if (buffer.length) {
|
|
133639
|
+
return buffer[buffer.length - 1];
|
|
133640
|
+
}
|
|
133641
|
+
return defaults;
|
|
133642
|
+
},
|
|
133643
|
+
useMedium: function (data) {
|
|
133644
|
+
var item = middleware(data, assigned);
|
|
133645
|
+
buffer.push(item);
|
|
133646
|
+
return function () {
|
|
133647
|
+
buffer = buffer.filter(function (x) { return x !== item; });
|
|
133648
|
+
};
|
|
133649
|
+
},
|
|
133650
|
+
assignSyncMedium: function (cb) {
|
|
133651
|
+
assigned = true;
|
|
133652
|
+
while (buffer.length) {
|
|
133653
|
+
var cbs = buffer;
|
|
133654
|
+
buffer = [];
|
|
133655
|
+
cbs.forEach(cb);
|
|
133656
|
+
}
|
|
133657
|
+
buffer = {
|
|
133658
|
+
push: function (x) { return cb(x); },
|
|
133659
|
+
filter: function () { return buffer; },
|
|
133660
|
+
};
|
|
133661
|
+
},
|
|
133662
|
+
assignMedium: function (cb) {
|
|
133663
|
+
assigned = true;
|
|
133664
|
+
var pendingQueue = [];
|
|
133665
|
+
if (buffer.length) {
|
|
133666
|
+
var cbs = buffer;
|
|
133667
|
+
buffer = [];
|
|
133668
|
+
cbs.forEach(cb);
|
|
133669
|
+
pendingQueue = buffer;
|
|
133670
|
+
}
|
|
133671
|
+
var executeQueue = function () {
|
|
133672
|
+
var cbs = pendingQueue;
|
|
133673
|
+
pendingQueue = [];
|
|
133674
|
+
cbs.forEach(cb);
|
|
133675
|
+
};
|
|
133676
|
+
var cycle = function () { return Promise.resolve().then(executeQueue); };
|
|
133677
|
+
cycle();
|
|
133678
|
+
buffer = {
|
|
133679
|
+
push: function (x) {
|
|
133680
|
+
pendingQueue.push(x);
|
|
133681
|
+
cycle();
|
|
133682
|
+
},
|
|
133683
|
+
filter: function (filter) {
|
|
133684
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
133685
|
+
return buffer;
|
|
133686
|
+
},
|
|
133687
|
+
};
|
|
133688
|
+
},
|
|
132318
133689
|
};
|
|
132319
|
-
return
|
|
133690
|
+
return medium;
|
|
133691
|
+
}
|
|
133692
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
133693
|
+
function createSidecarMedium(options) {
|
|
133694
|
+
if (options === void 0) { options = {}; }
|
|
133695
|
+
var medium = innerCreateMedium(null);
|
|
133696
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
133697
|
+
return medium;
|
|
133698
|
+
}
|
|
133699
|
+
|
|
133700
|
+
var SideCar$1 = function (_a) {
|
|
133701
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
133702
|
+
if (!sideCar) {
|
|
133703
|
+
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
|
|
133704
|
+
}
|
|
133705
|
+
var Target = sideCar.read();
|
|
133706
|
+
if (!Target) {
|
|
133707
|
+
throw new Error('Sidecar medium not found');
|
|
133708
|
+
}
|
|
133709
|
+
return React__namespace.createElement(Target, __assign({}, rest));
|
|
132320
133710
|
};
|
|
132321
|
-
|
|
132322
|
-
|
|
132323
|
-
|
|
132324
|
-
|
|
132325
|
-
|
|
132326
|
-
|
|
132327
|
-
|
|
133711
|
+
SideCar$1.isSideCarExport = true;
|
|
133712
|
+
function exportSidecar(medium, exported) {
|
|
133713
|
+
medium.useMedium(exported);
|
|
133714
|
+
return SideCar$1;
|
|
133715
|
+
}
|
|
133716
|
+
|
|
133717
|
+
var effectCar = createSidecarMedium();
|
|
133718
|
+
|
|
133719
|
+
var nothing = function () {
|
|
133720
|
+
return;
|
|
132328
133721
|
};
|
|
132329
|
-
|
|
132330
|
-
|
|
132331
|
-
|
|
132332
|
-
|
|
132333
|
-
|
|
132334
|
-
|
|
132335
|
-
|
|
132336
|
-
|
|
132337
|
-
|
|
132338
|
-
|
|
132339
|
-
|
|
132340
|
-
|
|
133722
|
+
/**
|
|
133723
|
+
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
133724
|
+
*/
|
|
133725
|
+
var RemoveScroll$1 = React__namespace.forwardRef(function (props, parentRef) {
|
|
133726
|
+
var ref = React__namespace.useRef(null);
|
|
133727
|
+
var _a = React__namespace.useState({
|
|
133728
|
+
onScrollCapture: nothing,
|
|
133729
|
+
onWheelCapture: nothing,
|
|
133730
|
+
onTouchMoveCapture: nothing,
|
|
133731
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
133732
|
+
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"]);
|
|
133733
|
+
var SideCar = sideCar;
|
|
133734
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
133735
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
133736
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
133737
|
+
enabled && (React__namespace.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
|
|
133738
|
+
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))));
|
|
133739
|
+
});
|
|
133740
|
+
RemoveScroll$1.defaultProps = {
|
|
133741
|
+
enabled: true,
|
|
133742
|
+
removeScrollBar: true,
|
|
133743
|
+
inert: false,
|
|
132341
133744
|
};
|
|
132342
|
-
|
|
132343
|
-
|
|
132344
|
-
|
|
133745
|
+
RemoveScroll$1.classNames = {
|
|
133746
|
+
fullWidth: fullWidthClassName,
|
|
133747
|
+
zeroRight: zeroRightClassName,
|
|
132345
133748
|
};
|
|
132346
|
-
|
|
132347
|
-
|
|
132348
|
-
|
|
133749
|
+
|
|
133750
|
+
var currentNonce;
|
|
133751
|
+
var getNonce = function () {
|
|
133752
|
+
if (currentNonce) {
|
|
133753
|
+
return currentNonce;
|
|
133754
|
+
}
|
|
133755
|
+
if (typeof __webpack_nonce__ !== 'undefined') {
|
|
133756
|
+
return __webpack_nonce__;
|
|
133757
|
+
}
|
|
133758
|
+
return undefined;
|
|
132349
133759
|
};
|
|
132350
|
-
|
|
132351
|
-
|
|
132352
|
-
|
|
133760
|
+
|
|
133761
|
+
function makeStyleTag() {
|
|
133762
|
+
if (!document)
|
|
133763
|
+
return null;
|
|
133764
|
+
var tag = document.createElement('style');
|
|
133765
|
+
tag.type = 'text/css';
|
|
133766
|
+
var nonce = getNonce();
|
|
133767
|
+
if (nonce) {
|
|
133768
|
+
tag.setAttribute('nonce', nonce);
|
|
133769
|
+
}
|
|
133770
|
+
return tag;
|
|
133771
|
+
}
|
|
133772
|
+
function injectStyles(tag, css) {
|
|
133773
|
+
// @ts-ignore
|
|
133774
|
+
if (tag.styleSheet) {
|
|
133775
|
+
// @ts-ignore
|
|
133776
|
+
tag.styleSheet.cssText = css;
|
|
133777
|
+
}
|
|
133778
|
+
else {
|
|
133779
|
+
tag.appendChild(document.createTextNode(css));
|
|
133780
|
+
}
|
|
133781
|
+
}
|
|
133782
|
+
function insertStyleTag(tag) {
|
|
133783
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
133784
|
+
head.appendChild(tag);
|
|
133785
|
+
}
|
|
133786
|
+
var stylesheetSingleton = function () {
|
|
133787
|
+
var counter = 0;
|
|
133788
|
+
var stylesheet = null;
|
|
133789
|
+
return {
|
|
133790
|
+
add: function (style) {
|
|
133791
|
+
if (counter == 0) {
|
|
133792
|
+
if ((stylesheet = makeStyleTag())) {
|
|
133793
|
+
injectStyles(stylesheet, style);
|
|
133794
|
+
insertStyleTag(stylesheet);
|
|
133795
|
+
}
|
|
133796
|
+
}
|
|
133797
|
+
counter++;
|
|
133798
|
+
},
|
|
133799
|
+
remove: function () {
|
|
133800
|
+
counter--;
|
|
133801
|
+
if (!counter && stylesheet) {
|
|
133802
|
+
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
133803
|
+
stylesheet = null;
|
|
133804
|
+
}
|
|
133805
|
+
},
|
|
133806
|
+
};
|
|
132353
133807
|
};
|
|
132354
133808
|
|
|
132355
|
-
|
|
132356
|
-
|
|
132357
|
-
|
|
132358
|
-
|
|
132359
|
-
|
|
132360
|
-
|
|
132361
|
-
|
|
132362
|
-
|
|
132363
|
-
|
|
133809
|
+
/**
|
|
133810
|
+
* creates a hook to control style singleton
|
|
133811
|
+
* @see {@link styleSingleton} for a safer component version
|
|
133812
|
+
* @example
|
|
133813
|
+
* ```tsx
|
|
133814
|
+
* const useStyle = styleHookSingleton();
|
|
133815
|
+
* ///
|
|
133816
|
+
* useStyle('body { overflow: hidden}');
|
|
133817
|
+
*/
|
|
133818
|
+
var styleHookSingleton = function () {
|
|
133819
|
+
var sheet = stylesheetSingleton();
|
|
133820
|
+
return function (styles, isDynamic) {
|
|
133821
|
+
React__namespace.useEffect(function () {
|
|
133822
|
+
sheet.add(styles);
|
|
133823
|
+
return function () {
|
|
133824
|
+
sheet.remove();
|
|
133825
|
+
};
|
|
133826
|
+
}, [styles && isDynamic]);
|
|
133827
|
+
};
|
|
133828
|
+
};
|
|
133829
|
+
|
|
133830
|
+
/**
|
|
133831
|
+
* create a Component to add styles on demand
|
|
133832
|
+
* - styles are added when first instance is mounted
|
|
133833
|
+
* - styles are removed when the last instance is unmounted
|
|
133834
|
+
* - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
|
|
133835
|
+
*/
|
|
133836
|
+
var styleSingleton = function () {
|
|
133837
|
+
var useStyle = styleHookSingleton();
|
|
133838
|
+
var Sheet = function (_a) {
|
|
133839
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
133840
|
+
useStyle(styles, dynamic);
|
|
132364
133841
|
return null;
|
|
133842
|
+
};
|
|
133843
|
+
return Sheet;
|
|
133844
|
+
};
|
|
133845
|
+
|
|
133846
|
+
var zeroGap = {
|
|
133847
|
+
left: 0,
|
|
133848
|
+
top: 0,
|
|
133849
|
+
right: 0,
|
|
133850
|
+
gap: 0,
|
|
133851
|
+
};
|
|
133852
|
+
var parse = function (x) { return parseInt(x || '', 10) || 0; };
|
|
133853
|
+
var getOffset = function (gapMode) {
|
|
133854
|
+
var cs = window.getComputedStyle(document.body);
|
|
133855
|
+
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
133856
|
+
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
133857
|
+
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
133858
|
+
return [parse(left), parse(top), parse(right)];
|
|
133859
|
+
};
|
|
133860
|
+
var getGapWidth = function (gapMode) {
|
|
133861
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
133862
|
+
if (typeof window === 'undefined') {
|
|
133863
|
+
return zeroGap;
|
|
133864
|
+
}
|
|
133865
|
+
var offsets = getOffset(gapMode);
|
|
133866
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
133867
|
+
var windowWidth = window.innerWidth;
|
|
133868
|
+
return {
|
|
133869
|
+
left: offsets[0],
|
|
133870
|
+
top: offsets[1],
|
|
133871
|
+
right: offsets[2],
|
|
133872
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
|
|
133873
|
+
};
|
|
133874
|
+
};
|
|
133875
|
+
|
|
133876
|
+
var Style = styleSingleton();
|
|
133877
|
+
var lockAttribute = 'data-scroll-locked';
|
|
133878
|
+
// important tip - once we measure scrollBar width and remove them
|
|
133879
|
+
// we could not repeat this operation
|
|
133880
|
+
// thus we are using style-singleton - only the first "yet correct" style will be applied.
|
|
133881
|
+
var getStyles = function (_a, allowRelative, gapMode, important) {
|
|
133882
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
133883
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
133884
|
+
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([
|
|
133885
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
133886
|
+
gapMode === 'margin' &&
|
|
133887
|
+
"\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 "),
|
|
133888
|
+
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
|
|
133889
|
+
]
|
|
133890
|
+
.filter(Boolean)
|
|
133891
|
+
.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");
|
|
133892
|
+
};
|
|
133893
|
+
var getCurrentUseCounter = function () {
|
|
133894
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
|
|
133895
|
+
return isFinite(counter) ? counter : 0;
|
|
133896
|
+
};
|
|
133897
|
+
var useLockAttribute = function () {
|
|
133898
|
+
React__namespace.useEffect(function () {
|
|
133899
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
133900
|
+
return function () {
|
|
133901
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
133902
|
+
if (newCounter <= 0) {
|
|
133903
|
+
document.body.removeAttribute(lockAttribute);
|
|
133904
|
+
}
|
|
133905
|
+
else {
|
|
133906
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
133907
|
+
}
|
|
133908
|
+
};
|
|
133909
|
+
}, []);
|
|
133910
|
+
};
|
|
133911
|
+
/**
|
|
133912
|
+
* Removes page scrollbar and blocks page scroll when mounted
|
|
133913
|
+
*/
|
|
133914
|
+
var RemoveScrollBar = function (_a) {
|
|
133915
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
|
|
133916
|
+
useLockAttribute();
|
|
133917
|
+
/*
|
|
133918
|
+
gap will be measured on every component mount
|
|
133919
|
+
however it will be used only by the "first" invocation
|
|
133920
|
+
due to singleton nature of <Style
|
|
133921
|
+
*/
|
|
133922
|
+
var gap = React__namespace.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
133923
|
+
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
133924
|
+
};
|
|
133925
|
+
|
|
133926
|
+
var passiveSupported = false;
|
|
133927
|
+
if (typeof window !== 'undefined') {
|
|
133928
|
+
try {
|
|
133929
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
133930
|
+
get: function () {
|
|
133931
|
+
passiveSupported = true;
|
|
133932
|
+
return true;
|
|
133933
|
+
},
|
|
133934
|
+
});
|
|
133935
|
+
// @ts-ignore
|
|
133936
|
+
window.addEventListener('test', options, options);
|
|
133937
|
+
// @ts-ignore
|
|
133938
|
+
window.removeEventListener('test', options, options);
|
|
132365
133939
|
}
|
|
132366
|
-
|
|
132367
|
-
|
|
132368
|
-
|
|
132369
|
-
|
|
132370
|
-
|
|
132371
|
-
|
|
132372
|
-
|
|
132373
|
-
|
|
132374
|
-
|
|
132375
|
-
|
|
132376
|
-
|
|
133940
|
+
catch (err) {
|
|
133941
|
+
passiveSupported = false;
|
|
133942
|
+
}
|
|
133943
|
+
}
|
|
133944
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
133945
|
+
|
|
133946
|
+
var alwaysContainsScroll = function (node) {
|
|
133947
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
133948
|
+
return node.tagName === 'TEXTAREA';
|
|
133949
|
+
};
|
|
133950
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
133951
|
+
if (!(node instanceof Element)) {
|
|
133952
|
+
return false;
|
|
133953
|
+
}
|
|
133954
|
+
var styles = window.getComputedStyle(node);
|
|
133955
|
+
return (
|
|
133956
|
+
// not-not-scrollable
|
|
133957
|
+
styles[overflow] !== 'hidden' &&
|
|
133958
|
+
// contains scroll inside self
|
|
133959
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
133960
|
+
};
|
|
133961
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
133962
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
133963
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
133964
|
+
var ownerDocument = node.ownerDocument;
|
|
133965
|
+
var current = node;
|
|
133966
|
+
do {
|
|
133967
|
+
// Skip over shadow root
|
|
133968
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
133969
|
+
current = current.host;
|
|
133970
|
+
}
|
|
133971
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
133972
|
+
if (isScrollable) {
|
|
133973
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
133974
|
+
if (scrollHeight > clientHeight) {
|
|
133975
|
+
return true;
|
|
133976
|
+
}
|
|
133977
|
+
}
|
|
133978
|
+
current = current.parentNode;
|
|
133979
|
+
} while (current && current !== ownerDocument.body);
|
|
133980
|
+
return false;
|
|
133981
|
+
};
|
|
133982
|
+
var getVScrollVariables = function (_a) {
|
|
133983
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
133984
|
+
return [
|
|
133985
|
+
scrollTop,
|
|
133986
|
+
scrollHeight,
|
|
133987
|
+
clientHeight,
|
|
133988
|
+
];
|
|
133989
|
+
};
|
|
133990
|
+
var getHScrollVariables = function (_a) {
|
|
133991
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
133992
|
+
return [
|
|
133993
|
+
scrollLeft,
|
|
133994
|
+
scrollWidth,
|
|
133995
|
+
clientWidth,
|
|
133996
|
+
];
|
|
133997
|
+
};
|
|
133998
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
133999
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
134000
|
+
};
|
|
134001
|
+
var getScrollVariables = function (axis, node) {
|
|
134002
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
134003
|
+
};
|
|
134004
|
+
var getDirectionFactor = function (axis, direction) {
|
|
134005
|
+
/**
|
|
134006
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
134007
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
134008
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
134009
|
+
*/
|
|
134010
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
134011
|
+
};
|
|
134012
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
134013
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
134014
|
+
var delta = directionFactor * sourceDelta;
|
|
134015
|
+
// find scrollable target
|
|
134016
|
+
var target = event.target;
|
|
134017
|
+
var targetInLock = endTarget.contains(target);
|
|
134018
|
+
var shouldCancelScroll = false;
|
|
134019
|
+
var isDeltaPositive = delta > 0;
|
|
134020
|
+
var availableScroll = 0;
|
|
134021
|
+
var availableScrollTop = 0;
|
|
134022
|
+
do {
|
|
134023
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
134024
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
134025
|
+
if (position || elementScroll) {
|
|
134026
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
134027
|
+
availableScroll += elementScroll;
|
|
134028
|
+
availableScrollTop += position;
|
|
134029
|
+
}
|
|
134030
|
+
}
|
|
134031
|
+
if (target instanceof ShadowRoot) {
|
|
134032
|
+
target = target.host;
|
|
134033
|
+
}
|
|
134034
|
+
else {
|
|
134035
|
+
target = target.parentNode;
|
|
134036
|
+
}
|
|
134037
|
+
} while (
|
|
134038
|
+
// portaled content
|
|
134039
|
+
(!targetInLock && target !== document.body) ||
|
|
134040
|
+
// self content
|
|
134041
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
134042
|
+
// handle epsilon around 0 (non standard zoom levels)
|
|
134043
|
+
if (isDeltaPositive &&
|
|
134044
|
+
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {
|
|
134045
|
+
shouldCancelScroll = true;
|
|
134046
|
+
}
|
|
134047
|
+
else if (!isDeltaPositive &&
|
|
134048
|
+
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {
|
|
134049
|
+
shouldCancelScroll = true;
|
|
134050
|
+
}
|
|
134051
|
+
return shouldCancelScroll;
|
|
134052
|
+
};
|
|
134053
|
+
|
|
134054
|
+
var getTouchXY = function (event) {
|
|
134055
|
+
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
134056
|
+
};
|
|
134057
|
+
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
|
|
134058
|
+
var extractRef = function (ref) {
|
|
134059
|
+
return ref && 'current' in ref ? ref.current : ref;
|
|
134060
|
+
};
|
|
134061
|
+
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
|
|
134062
|
+
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
|
|
134063
|
+
var idCounter = 0;
|
|
134064
|
+
var lockStack = [];
|
|
134065
|
+
function RemoveScrollSideCar(props) {
|
|
134066
|
+
var shouldPreventQueue = React__namespace.useRef([]);
|
|
134067
|
+
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
134068
|
+
var activeAxis = React__namespace.useRef();
|
|
134069
|
+
var id = React__namespace.useState(idCounter++)[0];
|
|
134070
|
+
var Style = React__namespace.useState(styleSingleton)[0];
|
|
134071
|
+
var lastProps = React__namespace.useRef(props);
|
|
134072
|
+
React__namespace.useEffect(function () {
|
|
134073
|
+
lastProps.current = props;
|
|
134074
|
+
}, [props]);
|
|
134075
|
+
React__namespace.useEffect(function () {
|
|
134076
|
+
if (props.inert) {
|
|
134077
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
134078
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
134079
|
+
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
|
|
134080
|
+
return function () {
|
|
134081
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
134082
|
+
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
|
|
134083
|
+
};
|
|
134084
|
+
}
|
|
134085
|
+
return;
|
|
134086
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
134087
|
+
var shouldCancelEvent = React__namespace.useCallback(function (event, parent) {
|
|
134088
|
+
if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {
|
|
134089
|
+
return !lastProps.current.allowPinchZoom;
|
|
134090
|
+
}
|
|
134091
|
+
var touch = getTouchXY(event);
|
|
134092
|
+
var touchStart = touchStartRef.current;
|
|
134093
|
+
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
|
|
134094
|
+
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
|
|
134095
|
+
var currentAxis;
|
|
134096
|
+
var target = event.target;
|
|
134097
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
|
|
134098
|
+
// allow horizontal touch move on Range inputs. They will not cause any scroll
|
|
134099
|
+
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
|
|
134100
|
+
return false;
|
|
134101
|
+
}
|
|
134102
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
134103
|
+
if (!canBeScrolledInMainDirection) {
|
|
134104
|
+
return true;
|
|
134105
|
+
}
|
|
134106
|
+
if (canBeScrolledInMainDirection) {
|
|
134107
|
+
currentAxis = moveDirection;
|
|
134108
|
+
}
|
|
134109
|
+
else {
|
|
134110
|
+
currentAxis = moveDirection === 'v' ? 'h' : 'v';
|
|
134111
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
134112
|
+
// other axis might be not scrollable
|
|
134113
|
+
}
|
|
134114
|
+
if (!canBeScrolledInMainDirection) {
|
|
134115
|
+
return false;
|
|
134116
|
+
}
|
|
134117
|
+
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
|
|
134118
|
+
activeAxis.current = currentAxis;
|
|
134119
|
+
}
|
|
134120
|
+
if (!currentAxis) {
|
|
134121
|
+
return true;
|
|
134122
|
+
}
|
|
134123
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
134124
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
|
|
134125
|
+
}, []);
|
|
134126
|
+
var shouldPrevent = React__namespace.useCallback(function (_event) {
|
|
134127
|
+
var event = _event;
|
|
134128
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
134129
|
+
// not the last active
|
|
134130
|
+
return;
|
|
134131
|
+
}
|
|
134132
|
+
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
|
|
134133
|
+
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];
|
|
134134
|
+
// self event, and should be canceled
|
|
134135
|
+
if (sourceEvent && sourceEvent.should) {
|
|
134136
|
+
if (event.cancelable) {
|
|
134137
|
+
event.preventDefault();
|
|
134138
|
+
}
|
|
134139
|
+
return;
|
|
134140
|
+
}
|
|
134141
|
+
// outside or shard event
|
|
134142
|
+
if (!sourceEvent) {
|
|
134143
|
+
var shardNodes = (lastProps.current.shards || [])
|
|
134144
|
+
.map(extractRef)
|
|
134145
|
+
.filter(Boolean)
|
|
134146
|
+
.filter(function (node) { return node.contains(event.target); });
|
|
134147
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
134148
|
+
if (shouldStop) {
|
|
134149
|
+
if (event.cancelable) {
|
|
134150
|
+
event.preventDefault();
|
|
134151
|
+
}
|
|
134152
|
+
}
|
|
134153
|
+
}
|
|
134154
|
+
}, []);
|
|
134155
|
+
var shouldCancel = React__namespace.useCallback(function (name, delta, target, should) {
|
|
134156
|
+
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
|
|
134157
|
+
shouldPreventQueue.current.push(event);
|
|
134158
|
+
setTimeout(function () {
|
|
134159
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
134160
|
+
}, 1);
|
|
134161
|
+
}, []);
|
|
134162
|
+
var scrollTouchStart = React__namespace.useCallback(function (event) {
|
|
134163
|
+
touchStartRef.current = getTouchXY(event);
|
|
134164
|
+
activeAxis.current = undefined;
|
|
134165
|
+
}, []);
|
|
134166
|
+
var scrollWheel = React__namespace.useCallback(function (event) {
|
|
134167
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
134168
|
+
}, []);
|
|
134169
|
+
var scrollTouchMove = React__namespace.useCallback(function (event) {
|
|
134170
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
134171
|
+
}, []);
|
|
134172
|
+
React__namespace.useEffect(function () {
|
|
134173
|
+
lockStack.push(Style);
|
|
134174
|
+
props.setCallbacks({
|
|
134175
|
+
onScrollCapture: scrollWheel,
|
|
134176
|
+
onWheelCapture: scrollWheel,
|
|
134177
|
+
onTouchMoveCapture: scrollTouchMove,
|
|
134178
|
+
});
|
|
134179
|
+
document.addEventListener('wheel', shouldPrevent, nonPassive);
|
|
134180
|
+
document.addEventListener('touchmove', shouldPrevent, nonPassive);
|
|
134181
|
+
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
134182
|
+
return function () {
|
|
134183
|
+
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
|
|
134184
|
+
document.removeEventListener('wheel', shouldPrevent, nonPassive);
|
|
134185
|
+
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
|
|
134186
|
+
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
134187
|
+
};
|
|
134188
|
+
}, []);
|
|
134189
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
134190
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
134191
|
+
inert ? React__namespace.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
134192
|
+
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
|
|
134193
|
+
}
|
|
134194
|
+
function getOutermostShadowParent(node) {
|
|
134195
|
+
var shadowParent = null;
|
|
134196
|
+
while (node !== null) {
|
|
134197
|
+
if (node instanceof ShadowRoot) {
|
|
134198
|
+
shadowParent = node.host;
|
|
134199
|
+
node = node.host;
|
|
134200
|
+
}
|
|
134201
|
+
node = node.parentNode;
|
|
134202
|
+
}
|
|
134203
|
+
return shadowParent;
|
|
134204
|
+
}
|
|
134205
|
+
|
|
134206
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
134207
|
+
|
|
134208
|
+
var ReactRemoveScroll = React__namespace.forwardRef(function (props, ref) { return (React__namespace.createElement(RemoveScroll$1, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
134209
|
+
ReactRemoveScroll.classNames = RemoveScroll$1.classNames;
|
|
134210
|
+
var RemoveScroll = ReactRemoveScroll;
|
|
134211
|
+
|
|
134212
|
+
var POPOVER_NAME = "Popover";
|
|
134213
|
+
var [createPopoverContext, createPopoverScope] = createContextScope$1(POPOVER_NAME, [
|
|
134214
|
+
createPopperScope
|
|
134215
|
+
]);
|
|
134216
|
+
var usePopperScope = createPopperScope();
|
|
134217
|
+
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
134218
|
+
var Popover$1 = (props) => {
|
|
134219
|
+
const {
|
|
134220
|
+
__scopePopover,
|
|
134221
|
+
children,
|
|
134222
|
+
open: openProp,
|
|
134223
|
+
defaultOpen,
|
|
134224
|
+
onOpenChange,
|
|
134225
|
+
modal = false
|
|
134226
|
+
} = props;
|
|
134227
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134228
|
+
const triggerRef = React__namespace.useRef(null);
|
|
134229
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React__namespace.useState(false);
|
|
134230
|
+
const [open = false, setOpen] = useControllableState({
|
|
134231
|
+
prop: openProp,
|
|
134232
|
+
defaultProp: defaultOpen,
|
|
134233
|
+
onChange: onOpenChange
|
|
134234
|
+
});
|
|
134235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134236
|
+
PopoverProvider,
|
|
134237
|
+
{
|
|
134238
|
+
scope: __scopePopover,
|
|
134239
|
+
contentId: useId(),
|
|
134240
|
+
triggerRef,
|
|
134241
|
+
open,
|
|
134242
|
+
onOpenChange: setOpen,
|
|
134243
|
+
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
134244
|
+
hasCustomAnchor,
|
|
134245
|
+
onCustomAnchorAdd: React__namespace.useCallback(() => setHasCustomAnchor(true), []),
|
|
134246
|
+
onCustomAnchorRemove: React__namespace.useCallback(() => setHasCustomAnchor(false), []),
|
|
134247
|
+
modal,
|
|
134248
|
+
children
|
|
134249
|
+
}
|
|
134250
|
+
) });
|
|
134251
|
+
};
|
|
134252
|
+
Popover$1.displayName = POPOVER_NAME;
|
|
134253
|
+
var ANCHOR_NAME = "PopoverAnchor";
|
|
134254
|
+
var PopoverAnchor = React__namespace.forwardRef(
|
|
134255
|
+
(props, forwardedRef) => {
|
|
134256
|
+
const { __scopePopover, ...anchorProps } = props;
|
|
134257
|
+
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
134258
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134259
|
+
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
134260
|
+
React__namespace.useEffect(() => {
|
|
134261
|
+
onCustomAnchorAdd();
|
|
134262
|
+
return () => onCustomAnchorRemove();
|
|
134263
|
+
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
134264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
134265
|
+
}
|
|
134266
|
+
);
|
|
134267
|
+
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
134268
|
+
var TRIGGER_NAME = "PopoverTrigger";
|
|
134269
|
+
var PopoverTrigger$1 = React__namespace.forwardRef(
|
|
134270
|
+
(props, forwardedRef) => {
|
|
134271
|
+
const { __scopePopover, ...triggerProps } = props;
|
|
134272
|
+
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
|
|
134273
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134274
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
134275
|
+
const trigger = /* @__PURE__ */ jsxRuntime.jsx(
|
|
134276
|
+
Primitive.button,
|
|
134277
|
+
{
|
|
134278
|
+
type: "button",
|
|
134279
|
+
"aria-haspopup": "dialog",
|
|
134280
|
+
"aria-expanded": context.open,
|
|
134281
|
+
"aria-controls": context.contentId,
|
|
134282
|
+
"data-state": getState(context.open),
|
|
134283
|
+
...triggerProps,
|
|
134284
|
+
ref: composedTriggerRef,
|
|
134285
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
134286
|
+
}
|
|
134287
|
+
);
|
|
134288
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
134289
|
+
}
|
|
134290
|
+
);
|
|
134291
|
+
PopoverTrigger$1.displayName = TRIGGER_NAME;
|
|
134292
|
+
var PORTAL_NAME = "PopoverPortal";
|
|
134293
|
+
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
|
|
134294
|
+
forceMount: void 0
|
|
134295
|
+
});
|
|
134296
|
+
var PopoverPortal = (props) => {
|
|
134297
|
+
const { __scopePopover, forceMount, children, container } = props;
|
|
134298
|
+
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
|
|
134299
|
+
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 }) }) });
|
|
134300
|
+
};
|
|
134301
|
+
PopoverPortal.displayName = PORTAL_NAME;
|
|
134302
|
+
var CONTENT_NAME = "PopoverContent";
|
|
134303
|
+
var PopoverContent$1 = React__namespace.forwardRef(
|
|
134304
|
+
(props, forwardedRef) => {
|
|
134305
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
|
|
134306
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
134307
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134308
|
+
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 }) });
|
|
134309
|
+
}
|
|
134310
|
+
);
|
|
134311
|
+
PopoverContent$1.displayName = CONTENT_NAME;
|
|
134312
|
+
var PopoverContentModal = React__namespace.forwardRef(
|
|
134313
|
+
(props, forwardedRef) => {
|
|
134314
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134315
|
+
const contentRef = React__namespace.useRef(null);
|
|
134316
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
134317
|
+
const isRightClickOutsideRef = React__namespace.useRef(false);
|
|
134318
|
+
React__namespace.useEffect(() => {
|
|
134319
|
+
const content = contentRef.current;
|
|
134320
|
+
if (content) return hideOthers(content);
|
|
134321
|
+
}, []);
|
|
134322
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134323
|
+
PopoverContentImpl,
|
|
134324
|
+
{
|
|
134325
|
+
...props,
|
|
134326
|
+
ref: composedRefs,
|
|
134327
|
+
trapFocus: context.open,
|
|
134328
|
+
disableOutsidePointerEvents: true,
|
|
134329
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
134330
|
+
event.preventDefault();
|
|
134331
|
+
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
134332
|
+
}),
|
|
134333
|
+
onPointerDownOutside: composeEventHandlers(
|
|
134334
|
+
props.onPointerDownOutside,
|
|
134335
|
+
(event) => {
|
|
134336
|
+
const originalEvent = event.detail.originalEvent;
|
|
134337
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
134338
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
134339
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
134340
|
+
},
|
|
134341
|
+
{ checkForDefaultPrevented: false }
|
|
134342
|
+
),
|
|
134343
|
+
onFocusOutside: composeEventHandlers(
|
|
134344
|
+
props.onFocusOutside,
|
|
134345
|
+
(event) => event.preventDefault(),
|
|
134346
|
+
{ checkForDefaultPrevented: false }
|
|
134347
|
+
)
|
|
134348
|
+
}
|
|
134349
|
+
) });
|
|
134350
|
+
}
|
|
134351
|
+
);
|
|
134352
|
+
var PopoverContentNonModal = React__namespace.forwardRef(
|
|
134353
|
+
(props, forwardedRef) => {
|
|
134354
|
+
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
134355
|
+
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
134356
|
+
const hasPointerDownOutsideRef = React__namespace.useRef(false);
|
|
134357
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134358
|
+
PopoverContentImpl,
|
|
134359
|
+
{
|
|
134360
|
+
...props,
|
|
134361
|
+
ref: forwardedRef,
|
|
134362
|
+
trapFocus: false,
|
|
134363
|
+
disableOutsidePointerEvents: false,
|
|
134364
|
+
onCloseAutoFocus: (event) => {
|
|
134365
|
+
props.onCloseAutoFocus?.(event);
|
|
134366
|
+
if (!event.defaultPrevented) {
|
|
134367
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
134368
|
+
event.preventDefault();
|
|
134369
|
+
}
|
|
134370
|
+
hasInteractedOutsideRef.current = false;
|
|
134371
|
+
hasPointerDownOutsideRef.current = false;
|
|
134372
|
+
},
|
|
134373
|
+
onInteractOutside: (event) => {
|
|
134374
|
+
props.onInteractOutside?.(event);
|
|
134375
|
+
if (!event.defaultPrevented) {
|
|
134376
|
+
hasInteractedOutsideRef.current = true;
|
|
134377
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
134378
|
+
hasPointerDownOutsideRef.current = true;
|
|
134379
|
+
}
|
|
134380
|
+
}
|
|
134381
|
+
const target = event.target;
|
|
134382
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
134383
|
+
if (targetIsTrigger) event.preventDefault();
|
|
134384
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
134385
|
+
event.preventDefault();
|
|
134386
|
+
}
|
|
134387
|
+
}
|
|
134388
|
+
}
|
|
134389
|
+
);
|
|
134390
|
+
}
|
|
134391
|
+
);
|
|
134392
|
+
var PopoverContentImpl = React__namespace.forwardRef(
|
|
134393
|
+
(props, forwardedRef) => {
|
|
134394
|
+
const {
|
|
134395
|
+
__scopePopover,
|
|
134396
|
+
trapFocus,
|
|
134397
|
+
onOpenAutoFocus,
|
|
134398
|
+
onCloseAutoFocus,
|
|
134399
|
+
disableOutsidePointerEvents,
|
|
134400
|
+
onEscapeKeyDown,
|
|
134401
|
+
onPointerDownOutside,
|
|
134402
|
+
onFocusOutside,
|
|
134403
|
+
onInteractOutside,
|
|
134404
|
+
...contentProps
|
|
134405
|
+
} = props;
|
|
134406
|
+
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
|
|
134407
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134408
|
+
useFocusGuards();
|
|
134409
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134410
|
+
FocusScope,
|
|
134411
|
+
{
|
|
134412
|
+
asChild: true,
|
|
134413
|
+
loop: true,
|
|
134414
|
+
trapped: trapFocus,
|
|
134415
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
134416
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
134417
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134418
|
+
DismissableLayer,
|
|
134419
|
+
{
|
|
134420
|
+
asChild: true,
|
|
134421
|
+
disableOutsidePointerEvents,
|
|
134422
|
+
onInteractOutside,
|
|
134423
|
+
onEscapeKeyDown,
|
|
134424
|
+
onPointerDownOutside,
|
|
134425
|
+
onFocusOutside,
|
|
134426
|
+
onDismiss: () => context.onOpenChange(false),
|
|
134427
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134428
|
+
Content,
|
|
134429
|
+
{
|
|
134430
|
+
"data-state": getState(context.open),
|
|
134431
|
+
role: "dialog",
|
|
134432
|
+
id: context.contentId,
|
|
134433
|
+
...popperScope,
|
|
134434
|
+
...contentProps,
|
|
134435
|
+
ref: forwardedRef,
|
|
134436
|
+
style: {
|
|
134437
|
+
...contentProps.style,
|
|
134438
|
+
// re-namespace exposed content custom properties
|
|
134439
|
+
...{
|
|
134440
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
134441
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
134442
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
134443
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
134444
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
134445
|
+
}
|
|
134446
|
+
}
|
|
134447
|
+
}
|
|
134448
|
+
)
|
|
134449
|
+
}
|
|
134450
|
+
)
|
|
134451
|
+
}
|
|
134452
|
+
);
|
|
134453
|
+
}
|
|
134454
|
+
);
|
|
134455
|
+
var CLOSE_NAME = "PopoverClose";
|
|
134456
|
+
var PopoverClose = React__namespace.forwardRef(
|
|
134457
|
+
(props, forwardedRef) => {
|
|
134458
|
+
const { __scopePopover, ...closeProps } = props;
|
|
134459
|
+
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
134460
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134461
|
+
Primitive.button,
|
|
134462
|
+
{
|
|
134463
|
+
type: "button",
|
|
134464
|
+
...closeProps,
|
|
134465
|
+
ref: forwardedRef,
|
|
134466
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
134467
|
+
}
|
|
134468
|
+
);
|
|
134469
|
+
}
|
|
134470
|
+
);
|
|
134471
|
+
PopoverClose.displayName = CLOSE_NAME;
|
|
134472
|
+
var ARROW_NAME = "PopoverArrow";
|
|
134473
|
+
var PopoverArrow = React__namespace.forwardRef(
|
|
134474
|
+
(props, forwardedRef) => {
|
|
134475
|
+
const { __scopePopover, ...arrowProps } = props;
|
|
134476
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
134477
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
134478
|
+
}
|
|
134479
|
+
);
|
|
134480
|
+
PopoverArrow.displayName = ARROW_NAME;
|
|
134481
|
+
function getState(open) {
|
|
134482
|
+
return open ? "open" : "closed";
|
|
134483
|
+
}
|
|
134484
|
+
var Root2 = Popover$1;
|
|
134485
|
+
var Trigger = PopoverTrigger$1;
|
|
134486
|
+
var Portal = PopoverPortal;
|
|
134487
|
+
var Content2 = PopoverContent$1;
|
|
134488
|
+
|
|
134489
|
+
var PopoverRoot = Root2;
|
|
134490
|
+
var PopoverTrigger = Trigger;
|
|
134491
|
+
var PopoverContent = React__namespace.forwardRef(function (_a, ref) {
|
|
134492
|
+
var className = _a.className, _b = _a.align, align = _b === void 0 ? "center" : _b, _c = _a.sideOffset, sideOffset = _c === void 0 ? 4 : _c, props = __rest(_a, ["className", "align", "sideOffset"]);
|
|
134493
|
+
return (React__namespace.createElement(Portal, null,
|
|
134494
|
+
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-w-72 s-rounded-lg s-border s-bg-background s-p-4 s-shadow-md s-outline-none", className !== null && className !== void 0 ? className : "") }, props))));
|
|
134495
|
+
});
|
|
134496
|
+
function Popover(_a) {
|
|
134497
|
+
var trigger = _a.trigger, content = _a.content, props = __rest(_a, ["trigger", "content"]);
|
|
134498
|
+
return (React__namespace.createElement(PopoverRoot, null,
|
|
134499
|
+
React__namespace.createElement(PopoverTrigger, null, trigger),
|
|
134500
|
+
React__namespace.createElement(PopoverContent, __assign({}, props), content)));
|
|
132377
134501
|
}
|
|
134502
|
+
PopoverContent.displayName = Content2.displayName;
|
|
132378
134503
|
|
|
132379
134504
|
function Popup(_a) {
|
|
132380
134505
|
var show = _a.show, chipLabel = _a.chipLabel, description = _a.description, buttonLabel = _a.buttonLabel, buttonClick = _a.buttonClick, className = _a.className, onClose = _a.onClose;
|
|
@@ -133252,6 +135377,10 @@ exports.PlusCircleIcon = SvgPlusCircle$1;
|
|
|
133252
135377
|
exports.PlusCircleStrokeIcon = SvgPlusCircle;
|
|
133253
135378
|
exports.PlusIcon = SvgPlus$1;
|
|
133254
135379
|
exports.PlusStrokeIcon = SvgPlus;
|
|
135380
|
+
exports.Popover = Popover;
|
|
135381
|
+
exports.PopoverContent = PopoverContent;
|
|
135382
|
+
exports.PopoverRoot = PopoverRoot;
|
|
135383
|
+
exports.PopoverTrigger = PopoverTrigger;
|
|
133255
135384
|
exports.Popup = Popup;
|
|
133256
135385
|
exports.PriceTable = PriceTable;
|
|
133257
135386
|
exports.PushpinIcon = SvgPushpin$1;
|