dash-ui-kit 1.0.6 → 1.0.8
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/react/components/badge/index.d.ts +10 -2
- package/dist/react/components/icons/index.d.ts +1 -0
- package/dist/react/components/index.d.ts +1 -1
- package/dist/react/components/input/index.d.ts +3 -2
- package/dist/react/components/text/index.d.ts +1 -1
- package/dist/react/components/valueCard/index.d.ts +1 -1
- package/dist/react/index.cjs.js +1335 -324
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +1335 -325
- package/dist/react/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
package/dist/react/index.esm.js
CHANGED
|
@@ -149,7 +149,7 @@ function createSlotClone(ownerName) {
|
|
|
149
149
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
150
150
|
const { children, ...slotProps } = props;
|
|
151
151
|
if (React.isValidElement(children)) {
|
|
152
|
-
const childrenRef = getElementRef$
|
|
152
|
+
const childrenRef = getElementRef$3(children);
|
|
153
153
|
const props2 = mergeProps(slotProps, children.props);
|
|
154
154
|
if (children.type !== React.Fragment) {
|
|
155
155
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
@@ -189,7 +189,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
189
189
|
}
|
|
190
190
|
return { ...slotProps, ...overrideProps };
|
|
191
191
|
}
|
|
192
|
-
function getElementRef$
|
|
192
|
+
function getElementRef$3(element) {
|
|
193
193
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
194
194
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
195
195
|
if (mayWarn) {
|
|
@@ -267,7 +267,7 @@ function createCollection(name) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
// src/primitive.tsx
|
|
270
|
-
function composeEventHandlers$
|
|
270
|
+
function composeEventHandlers$2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
271
271
|
return function handleEvent(event) {
|
|
272
272
|
originalEventHandler?.(event);
|
|
273
273
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
@@ -383,7 +383,7 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
383
383
|
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
function useStateMachine$
|
|
386
|
+
function useStateMachine$2(initialState, machine) {
|
|
387
387
|
return React.useReducer((state, event) => {
|
|
388
388
|
const nextState = machine[state][event];
|
|
389
389
|
return nextState ?? state;
|
|
@@ -391,22 +391,22 @@ function useStateMachine$1(initialState, machine) {
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
// src/presence.tsx
|
|
394
|
-
var Presence$
|
|
394
|
+
var Presence$2 = (props) => {
|
|
395
395
|
const { present, children } = props;
|
|
396
|
-
const presence = usePresence$
|
|
396
|
+
const presence = usePresence$2(present);
|
|
397
397
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
398
|
-
const ref = useComposedRefs(presence.ref, getElementRef$
|
|
398
|
+
const ref = useComposedRefs(presence.ref, getElementRef$2(child));
|
|
399
399
|
const forceMount = typeof children === "function";
|
|
400
400
|
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
401
401
|
};
|
|
402
|
-
Presence$
|
|
403
|
-
function usePresence$
|
|
402
|
+
Presence$2.displayName = "Presence";
|
|
403
|
+
function usePresence$2(present) {
|
|
404
404
|
const [node, setNode] = React.useState();
|
|
405
405
|
const stylesRef = React.useRef(null);
|
|
406
406
|
const prevPresentRef = React.useRef(present);
|
|
407
407
|
const prevAnimationNameRef = React.useRef("none");
|
|
408
408
|
const initialState = present ? "mounted" : "unmounted";
|
|
409
|
-
const [state, send] = useStateMachine$
|
|
409
|
+
const [state, send] = useStateMachine$2(initialState, {
|
|
410
410
|
mounted: {
|
|
411
411
|
UNMOUNT: "unmounted",
|
|
412
412
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -420,7 +420,7 @@ function usePresence$1(present) {
|
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
React.useEffect(() => {
|
|
423
|
-
const currentAnimationName = getAnimationName$
|
|
423
|
+
const currentAnimationName = getAnimationName$2(stylesRef.current);
|
|
424
424
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
425
425
|
}, [state]);
|
|
426
426
|
useLayoutEffect2(() => {
|
|
@@ -429,7 +429,7 @@ function usePresence$1(present) {
|
|
|
429
429
|
const hasPresentChanged = wasPresent !== present;
|
|
430
430
|
if (hasPresentChanged) {
|
|
431
431
|
const prevAnimationName = prevAnimationNameRef.current;
|
|
432
|
-
const currentAnimationName = getAnimationName$
|
|
432
|
+
const currentAnimationName = getAnimationName$2(styles);
|
|
433
433
|
if (present) {
|
|
434
434
|
send("MOUNT");
|
|
435
435
|
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
@@ -450,7 +450,7 @@ function usePresence$1(present) {
|
|
|
450
450
|
let timeoutId;
|
|
451
451
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
452
452
|
const handleAnimationEnd = (event) => {
|
|
453
|
-
const currentAnimationName = getAnimationName$
|
|
453
|
+
const currentAnimationName = getAnimationName$2(stylesRef.current);
|
|
454
454
|
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
455
455
|
if (event.target === node && isCurrentAnimation) {
|
|
456
456
|
send("ANIMATION_END");
|
|
@@ -467,7 +467,7 @@ function usePresence$1(present) {
|
|
|
467
467
|
};
|
|
468
468
|
const handleAnimationStart = (event) => {
|
|
469
469
|
if (event.target === node) {
|
|
470
|
-
prevAnimationNameRef.current = getAnimationName$
|
|
470
|
+
prevAnimationNameRef.current = getAnimationName$2(stylesRef.current);
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
473
|
node.addEventListener("animationstart", handleAnimationStart);
|
|
@@ -491,10 +491,10 @@ function usePresence$1(present) {
|
|
|
491
491
|
}, [])
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
-
function getAnimationName$
|
|
494
|
+
function getAnimationName$2(styles) {
|
|
495
495
|
return styles?.animationName || "none";
|
|
496
496
|
}
|
|
497
|
-
function getElementRef$
|
|
497
|
+
function getElementRef$2(element) {
|
|
498
498
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
499
499
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
500
500
|
if (mayWarn) {
|
|
@@ -510,11 +510,11 @@ function getElementRef$1(element) {
|
|
|
510
510
|
|
|
511
511
|
// packages/react/id/src/id.tsx
|
|
512
512
|
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
513
|
-
var count$
|
|
513
|
+
var count$2 = 0;
|
|
514
514
|
function useId(deterministicId) {
|
|
515
515
|
const [id, setId] = React.useState(useReactId());
|
|
516
516
|
useLayoutEffect2(() => {
|
|
517
|
-
setId((reactId) => reactId ?? String(count$
|
|
517
|
+
setId((reactId) => reactId ?? String(count$2++));
|
|
518
518
|
}, [deterministicId]);
|
|
519
519
|
return (id ? `radix-${id}` : "");
|
|
520
520
|
}
|
|
@@ -549,7 +549,7 @@ var Collapsible = React.forwardRef(
|
|
|
549
549
|
children: /* @__PURE__ */ jsx(
|
|
550
550
|
Primitive.div,
|
|
551
551
|
{
|
|
552
|
-
"data-state": getState$
|
|
552
|
+
"data-state": getState$3(open),
|
|
553
553
|
"data-disabled": disabled ? "" : void 0,
|
|
554
554
|
...collapsibleProps,
|
|
555
555
|
ref: forwardedRef
|
|
@@ -560,40 +560,40 @@ var Collapsible = React.forwardRef(
|
|
|
560
560
|
}
|
|
561
561
|
);
|
|
562
562
|
Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
563
|
-
var TRIGGER_NAME$
|
|
563
|
+
var TRIGGER_NAME$5 = "CollapsibleTrigger";
|
|
564
564
|
var CollapsibleTrigger = React.forwardRef(
|
|
565
565
|
(props, forwardedRef) => {
|
|
566
566
|
const { __scopeCollapsible, ...triggerProps } = props;
|
|
567
|
-
const context = useCollapsibleContext(TRIGGER_NAME$
|
|
567
|
+
const context = useCollapsibleContext(TRIGGER_NAME$5, __scopeCollapsible);
|
|
568
568
|
return /* @__PURE__ */ jsx(
|
|
569
569
|
Primitive.button,
|
|
570
570
|
{
|
|
571
571
|
type: "button",
|
|
572
572
|
"aria-controls": context.contentId,
|
|
573
573
|
"aria-expanded": context.open || false,
|
|
574
|
-
"data-state": getState$
|
|
574
|
+
"data-state": getState$3(context.open),
|
|
575
575
|
"data-disabled": context.disabled ? "" : void 0,
|
|
576
576
|
disabled: context.disabled,
|
|
577
577
|
...triggerProps,
|
|
578
578
|
ref: forwardedRef,
|
|
579
|
-
onClick: composeEventHandlers$
|
|
579
|
+
onClick: composeEventHandlers$2(props.onClick, context.onOpenToggle)
|
|
580
580
|
}
|
|
581
581
|
);
|
|
582
582
|
}
|
|
583
583
|
);
|
|
584
|
-
CollapsibleTrigger.displayName = TRIGGER_NAME$
|
|
585
|
-
var CONTENT_NAME$
|
|
584
|
+
CollapsibleTrigger.displayName = TRIGGER_NAME$5;
|
|
585
|
+
var CONTENT_NAME$7 = "CollapsibleContent";
|
|
586
586
|
var CollapsibleContent = React.forwardRef(
|
|
587
587
|
(props, forwardedRef) => {
|
|
588
588
|
const { forceMount, ...contentProps } = props;
|
|
589
|
-
const context = useCollapsibleContext(CONTENT_NAME$
|
|
590
|
-
return /* @__PURE__ */ jsx(Presence$
|
|
589
|
+
const context = useCollapsibleContext(CONTENT_NAME$7, props.__scopeCollapsible);
|
|
590
|
+
return /* @__PURE__ */ jsx(Presence$2, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
|
|
591
591
|
}
|
|
592
592
|
);
|
|
593
|
-
CollapsibleContent.displayName = CONTENT_NAME$
|
|
593
|
+
CollapsibleContent.displayName = CONTENT_NAME$7;
|
|
594
594
|
var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
595
595
|
const { __scopeCollapsible, present, children, ...contentProps } = props;
|
|
596
|
-
const context = useCollapsibleContext(CONTENT_NAME$
|
|
596
|
+
const context = useCollapsibleContext(CONTENT_NAME$7, __scopeCollapsible);
|
|
597
597
|
const [isPresent, setIsPresent] = React.useState(present);
|
|
598
598
|
const ref = React.useRef(null);
|
|
599
599
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
@@ -630,7 +630,7 @@ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
630
630
|
return /* @__PURE__ */ jsx(
|
|
631
631
|
Primitive.div,
|
|
632
632
|
{
|
|
633
|
-
"data-state": getState$
|
|
633
|
+
"data-state": getState$3(context.open),
|
|
634
634
|
"data-disabled": context.disabled ? "" : void 0,
|
|
635
635
|
id: context.contentId,
|
|
636
636
|
hidden: !isOpen,
|
|
@@ -645,12 +645,12 @@ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
645
645
|
}
|
|
646
646
|
);
|
|
647
647
|
});
|
|
648
|
-
function getState$
|
|
648
|
+
function getState$3(open) {
|
|
649
649
|
return open ? "open" : "closed";
|
|
650
650
|
}
|
|
651
651
|
var Root$3 = Collapsible;
|
|
652
|
-
var Trigger$
|
|
653
|
-
var Content$
|
|
652
|
+
var Trigger$4 = CollapsibleTrigger;
|
|
653
|
+
var Content$4 = CollapsibleContent;
|
|
654
654
|
|
|
655
655
|
// packages/react/direction/src/direction.tsx
|
|
656
656
|
var DirectionContext = React.createContext(void 0);
|
|
@@ -751,7 +751,7 @@ var AccordionImpl = React__default.forwardRef(
|
|
|
751
751
|
const getItems = useCollection$2(__scopeAccordion);
|
|
752
752
|
const direction = useDirection(dir);
|
|
753
753
|
const isDirectionLTR = direction === "ltr";
|
|
754
|
-
const handleKeyDown = composeEventHandlers$
|
|
754
|
+
const handleKeyDown = composeEventHandlers$2(props.onKeyDown, (event) => {
|
|
755
755
|
if (!ACCORDION_KEYS.includes(event.key)) return;
|
|
756
756
|
const target = event.target;
|
|
757
757
|
const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
|
|
@@ -855,7 +855,7 @@ var AccordionItem = React__default.forwardRef(
|
|
|
855
855
|
Root$3,
|
|
856
856
|
{
|
|
857
857
|
"data-orientation": accordionContext.orientation,
|
|
858
|
-
"data-state": getState$
|
|
858
|
+
"data-state": getState$2(open),
|
|
859
859
|
...collapsibleScope,
|
|
860
860
|
...accordionItemProps,
|
|
861
861
|
ref: forwardedRef,
|
|
@@ -885,7 +885,7 @@ var AccordionHeader = React__default.forwardRef(
|
|
|
885
885
|
Primitive.h3,
|
|
886
886
|
{
|
|
887
887
|
"data-orientation": accordionContext.orientation,
|
|
888
|
-
"data-state": getState$
|
|
888
|
+
"data-state": getState$2(itemContext.open),
|
|
889
889
|
"data-disabled": itemContext.disabled ? "" : void 0,
|
|
890
890
|
...headerProps,
|
|
891
891
|
ref: forwardedRef
|
|
@@ -894,16 +894,16 @@ var AccordionHeader = React__default.forwardRef(
|
|
|
894
894
|
}
|
|
895
895
|
);
|
|
896
896
|
AccordionHeader.displayName = HEADER_NAME;
|
|
897
|
-
var TRIGGER_NAME$
|
|
897
|
+
var TRIGGER_NAME$4 = "AccordionTrigger";
|
|
898
898
|
var AccordionTrigger = React__default.forwardRef(
|
|
899
899
|
(props, forwardedRef) => {
|
|
900
900
|
const { __scopeAccordion, ...triggerProps } = props;
|
|
901
901
|
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
902
|
-
const itemContext = useAccordionItemContext(TRIGGER_NAME$
|
|
903
|
-
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME$
|
|
902
|
+
const itemContext = useAccordionItemContext(TRIGGER_NAME$4, __scopeAccordion);
|
|
903
|
+
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME$4, __scopeAccordion);
|
|
904
904
|
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
905
905
|
return /* @__PURE__ */ jsx(Collection$2.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsx(
|
|
906
|
-
Trigger$
|
|
906
|
+
Trigger$4,
|
|
907
907
|
{
|
|
908
908
|
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
|
|
909
909
|
"data-orientation": accordionContext.orientation,
|
|
@@ -915,16 +915,16 @@ var AccordionTrigger = React__default.forwardRef(
|
|
|
915
915
|
) });
|
|
916
916
|
}
|
|
917
917
|
);
|
|
918
|
-
AccordionTrigger.displayName = TRIGGER_NAME$
|
|
919
|
-
var CONTENT_NAME$
|
|
918
|
+
AccordionTrigger.displayName = TRIGGER_NAME$4;
|
|
919
|
+
var CONTENT_NAME$6 = "AccordionContent";
|
|
920
920
|
var AccordionContent = React__default.forwardRef(
|
|
921
921
|
(props, forwardedRef) => {
|
|
922
922
|
const { __scopeAccordion, ...contentProps } = props;
|
|
923
923
|
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
924
|
-
const itemContext = useAccordionItemContext(CONTENT_NAME$
|
|
924
|
+
const itemContext = useAccordionItemContext(CONTENT_NAME$6, __scopeAccordion);
|
|
925
925
|
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
926
926
|
return /* @__PURE__ */ jsx(
|
|
927
|
-
Content$
|
|
927
|
+
Content$4,
|
|
928
928
|
{
|
|
929
929
|
role: "region",
|
|
930
930
|
"aria-labelledby": itemContext.triggerId,
|
|
@@ -941,14 +941,14 @@ var AccordionContent = React__default.forwardRef(
|
|
|
941
941
|
);
|
|
942
942
|
}
|
|
943
943
|
);
|
|
944
|
-
AccordionContent.displayName = CONTENT_NAME$
|
|
945
|
-
function getState$
|
|
944
|
+
AccordionContent.displayName = CONTENT_NAME$6;
|
|
945
|
+
function getState$2(open) {
|
|
946
946
|
return open ? "open" : "closed";
|
|
947
947
|
}
|
|
948
|
-
var Root2$
|
|
948
|
+
var Root2$5 = Accordion$1;
|
|
949
949
|
var Item$2 = AccordionItem;
|
|
950
950
|
var Trigger2 = AccordionTrigger;
|
|
951
|
-
var Content2$
|
|
951
|
+
var Content2$2 = AccordionContent;
|
|
952
952
|
|
|
953
953
|
const ThemeContext = /*#__PURE__*/createContext(undefined);
|
|
954
954
|
/**
|
|
@@ -1972,6 +1972,25 @@ const PendingIcon = ({
|
|
|
1972
1972
|
})
|
|
1973
1973
|
})]
|
|
1974
1974
|
});
|
|
1975
|
+
const SearchIcon = ({
|
|
1976
|
+
color = '#0C1C33',
|
|
1977
|
+
size = 16,
|
|
1978
|
+
className = '',
|
|
1979
|
+
onClick
|
|
1980
|
+
}) => jsx("svg", {
|
|
1981
|
+
width: size,
|
|
1982
|
+
height: size,
|
|
1983
|
+
viewBox: '0 0 16 16',
|
|
1984
|
+
fill: 'none',
|
|
1985
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
1986
|
+
className: className,
|
|
1987
|
+
onClick: onClick,
|
|
1988
|
+
color: color,
|
|
1989
|
+
children: jsx("path", {
|
|
1990
|
+
d: 'M14.569 14.0977L10.6623 10.191C11.5815 9.14938 12.0591 7.79092 11.9941 6.40327C11.9292 5.01564 11.3267 3.70776 10.3143 2.75659C9.30178 1.80542 7.95892 1.28563 6.56994 1.30729C5.18095 1.32895 3.85492 1.89036 2.87264 2.87264C1.89036 3.85492 1.32895 5.18095 1.30729 6.56994C1.28563 7.95892 1.80542 9.30178 2.75659 10.3143C3.70776 11.3267 5.01564 11.9292 6.40327 11.9941C7.79092 12.0591 9.14938 11.5815 10.191 10.6623L14.0977 14.569L14.569 14.0977ZM6.66665 11.3333C5.74364 11.3333 4.84138 11.0596 4.07396 10.5468C3.30653 10.0341 2.70839 9.30518 2.35518 8.45245C2.00197 7.59978 1.90956 6.66145 2.08962 5.7562C2.26968 4.85095 2.71414 4.01943 3.36678 3.36678C4.01943 2.71414 4.85095 2.26968 5.7562 2.08962C6.66145 1.90956 7.59978 2.00197 8.45245 2.35518C9.30518 2.70839 10.0341 3.30653 10.5468 4.07396C11.0596 4.84138 11.3333 5.74364 11.3333 6.66665C11.3319 7.90385 10.8398 9.09005 9.96492 9.96492C9.09005 10.8398 7.90385 11.3319 6.66665 11.3333Z',
|
|
1991
|
+
fill: 'currentColor'
|
|
1992
|
+
})
|
|
1993
|
+
});
|
|
1975
1994
|
|
|
1976
1995
|
const accordionRootStyles = cva(`
|
|
1977
1996
|
w-full
|
|
@@ -2087,7 +2106,7 @@ const Accordion = ({
|
|
|
2087
2106
|
theme,
|
|
2088
2107
|
border
|
|
2089
2108
|
}) + (className ? ` ${className}` : '');
|
|
2090
|
-
return jsx(Root2$
|
|
2109
|
+
return jsx(Root2$5, {
|
|
2091
2110
|
type: 'single',
|
|
2092
2111
|
collapsible: true,
|
|
2093
2112
|
className: rootClasses,
|
|
@@ -2120,7 +2139,7 @@ const Accordion = ({
|
|
|
2120
2139
|
className: `${separatorStyles({
|
|
2121
2140
|
theme
|
|
2122
2141
|
})} group-data-[state=closed]:opacity-0 group-data-[state=open]:opacity-100`
|
|
2123
|
-
}), jsx(Content2$
|
|
2142
|
+
}), jsx(Content2$2, {
|
|
2124
2143
|
forceMount: true,
|
|
2125
2144
|
className: accordionContentStyles(),
|
|
2126
2145
|
children: jsx("div", {
|
|
@@ -2132,19 +2151,28 @@ const Accordion = ({
|
|
|
2132
2151
|
});
|
|
2133
2152
|
};
|
|
2134
2153
|
|
|
2135
|
-
const Badge =
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2154
|
+
const Badge = _a => {
|
|
2155
|
+
var {
|
|
2156
|
+
children,
|
|
2157
|
+
variant = 'default',
|
|
2158
|
+
color = 'blue',
|
|
2159
|
+
size = 'sm',
|
|
2160
|
+
borderRadius,
|
|
2161
|
+
className = '',
|
|
2162
|
+
onClick
|
|
2163
|
+
} = _a,
|
|
2164
|
+
props = __rest(_a, ["children", "variant", "color", "size", "borderRadius", "className", "onClick"]);
|
|
2165
|
+
const baseClasses = 'inline-flex items-center justify-center font-medium transition-colors';
|
|
2166
|
+
// Size classes with default border radius
|
|
2144
2167
|
const sizeClasses = {
|
|
2145
|
-
xxs: 'px-1 py-1 text-xs gap-2',
|
|
2146
|
-
|
|
2147
|
-
|
|
2168
|
+
xxs: 'px-1 py-1 text-xs gap-2 rounded-full',
|
|
2169
|
+
xs: 'px-[0.5rem] py-[0.25rem] text-xs rounded-full',
|
|
2170
|
+
sm: 'px-[2.125rem] py-[0.625rem] text-xs rounded-full',
|
|
2171
|
+
xl: 'px-[2.25rem] py-4 text-lg rounded-full'
|
|
2172
|
+
};
|
|
2173
|
+
// Border radius classes (overrides size border radius)
|
|
2174
|
+
const borderRadiusClasses = {
|
|
2175
|
+
xs: 'rounded-[0.25rem]'
|
|
2148
2176
|
};
|
|
2149
2177
|
// Color and variant combination classes
|
|
2150
2178
|
const getVariantClasses = () => {
|
|
@@ -2169,8 +2197,8 @@ const Badge = ({
|
|
|
2169
2197
|
},
|
|
2170
2198
|
'light-gray': {
|
|
2171
2199
|
default: 'text-[#6B7280]',
|
|
2172
|
-
flat: 'bg-[
|
|
2173
|
-
solid: 'bg-[#
|
|
2200
|
+
flat: 'bg-[#0C1C33]/5 text-[#0C1C33]',
|
|
2201
|
+
solid: 'bg-[#0C1C33]/15 text-[#0C1C33]',
|
|
2174
2202
|
bordered: 'outline outline-1 outline-[#6B7280] text-[#6B7280]'
|
|
2175
2203
|
},
|
|
2176
2204
|
turquoise: {
|
|
@@ -2194,11 +2222,13 @@ const Badge = ({
|
|
|
2194
2222
|
};
|
|
2195
2223
|
return colorMap[color][variant];
|
|
2196
2224
|
};
|
|
2197
|
-
const classes = [baseClasses, sizeClasses[size], getVariantClasses(), className].filter(Boolean).join(' ');
|
|
2198
|
-
return jsx("span", {
|
|
2225
|
+
const classes = [baseClasses, sizeClasses[size], getVariantClasses(), borderRadius && borderRadiusClasses[borderRadius], className].filter(Boolean).join(' ');
|
|
2226
|
+
return jsx("span", Object.assign({
|
|
2199
2227
|
className: classes,
|
|
2228
|
+
onClick: onClick
|
|
2229
|
+
}, props, {
|
|
2200
2230
|
children: children
|
|
2201
|
-
});
|
|
2231
|
+
}));
|
|
2202
2232
|
};
|
|
2203
2233
|
|
|
2204
2234
|
const styles = cva(`
|
|
@@ -2483,14 +2513,15 @@ const Button = _a => {
|
|
|
2483
2513
|
const input = cva('w-full transition-all font-inter placeholder:text-opacity-60 text-[0.875rem] leading-[1.0625rem]', {
|
|
2484
2514
|
variants: {
|
|
2485
2515
|
theme: {
|
|
2486
|
-
light: 'text-[#111111] placeholder:text-[rgba(17,17,17,0.6)]
|
|
2487
|
-
dark: 'text-white placeholder:text-gray-400
|
|
2516
|
+
light: 'text-[#111111] placeholder:text-[rgba(17,17,17,0.6)]',
|
|
2517
|
+
dark: 'text-white placeholder:text-gray-400'
|
|
2488
2518
|
},
|
|
2489
2519
|
colorScheme: {
|
|
2490
2520
|
default: 'focus:ring-blue-500/20',
|
|
2491
2521
|
brand: 'focus:ring-dash-brand/20',
|
|
2492
2522
|
error: 'focus:ring-red-500/20',
|
|
2493
|
-
success: 'focus:ring-green-500/20'
|
|
2523
|
+
success: 'focus:ring-green-500/20',
|
|
2524
|
+
'light-gray': 'focus:ring-[#6B7280]/20'
|
|
2494
2525
|
},
|
|
2495
2526
|
size: {
|
|
2496
2527
|
sm: 'dash-block-sm font-light',
|
|
@@ -2498,7 +2529,8 @@ const input = cva('w-full transition-all font-inter placeholder:text-opacity-60
|
|
|
2498
2529
|
xl: 'dash-block-xl font-light'
|
|
2499
2530
|
},
|
|
2500
2531
|
variant: {
|
|
2501
|
-
outlined: 'outline outline-1 outline-offset-[-1px]'
|
|
2532
|
+
outlined: 'outline outline-1 outline-offset-[-1px]',
|
|
2533
|
+
filled: 'border-none'
|
|
2502
2534
|
},
|
|
2503
2535
|
disabled: {
|
|
2504
2536
|
false: '',
|
|
@@ -2523,11 +2555,52 @@ const input = cva('w-full transition-all font-inter placeholder:text-opacity-60
|
|
|
2523
2555
|
variant: 'outlined',
|
|
2524
2556
|
colorScheme: 'success',
|
|
2525
2557
|
class: 'outline-green-500 focus:outline-green-500'
|
|
2558
|
+
}, {
|
|
2559
|
+
variant: 'outlined',
|
|
2560
|
+
colorScheme: 'light-gray',
|
|
2561
|
+
class: 'outline-[#6B7280]/50 focus:outline-[#6B7280]'
|
|
2526
2562
|
},
|
|
2527
2563
|
// Outlined variant with focus ring
|
|
2528
2564
|
{
|
|
2529
2565
|
variant: 'outlined',
|
|
2530
2566
|
class: 'focus:ring-2'
|
|
2567
|
+
},
|
|
2568
|
+
// Outlined variant background
|
|
2569
|
+
{
|
|
2570
|
+
variant: 'outlined',
|
|
2571
|
+
theme: 'light',
|
|
2572
|
+
class: 'bg-white'
|
|
2573
|
+
}, {
|
|
2574
|
+
variant: 'outlined',
|
|
2575
|
+
theme: 'dark',
|
|
2576
|
+
class: 'bg-gray-800'
|
|
2577
|
+
},
|
|
2578
|
+
// Filled variant colors
|
|
2579
|
+
{
|
|
2580
|
+
variant: 'filled',
|
|
2581
|
+
colorScheme: 'default',
|
|
2582
|
+
class: 'bg-[rgba(76,126,255,0.15)] focus:bg-[rgba(76,126,255,0.2)]'
|
|
2583
|
+
}, {
|
|
2584
|
+
variant: 'filled',
|
|
2585
|
+
colorScheme: 'brand',
|
|
2586
|
+
class: 'bg-dash-brand/15 focus:bg-dash-brand/20'
|
|
2587
|
+
}, {
|
|
2588
|
+
variant: 'filled',
|
|
2589
|
+
colorScheme: 'error',
|
|
2590
|
+
class: 'bg-red-500/15 focus:bg-red-500/20'
|
|
2591
|
+
}, {
|
|
2592
|
+
variant: 'filled',
|
|
2593
|
+
colorScheme: 'success',
|
|
2594
|
+
class: 'bg-green-500/15 focus:bg-green-500/20'
|
|
2595
|
+
}, {
|
|
2596
|
+
variant: 'filled',
|
|
2597
|
+
colorScheme: 'light-gray',
|
|
2598
|
+
class: 'bg-[#0C1C33]/5 focus:bg-[#0C1C33]/10'
|
|
2599
|
+
},
|
|
2600
|
+
// Filled variant with focus ring
|
|
2601
|
+
{
|
|
2602
|
+
variant: 'filled',
|
|
2603
|
+
class: 'focus:ring-2'
|
|
2531
2604
|
}],
|
|
2532
2605
|
defaultVariants: {
|
|
2533
2606
|
theme: 'light',
|
|
@@ -2563,13 +2636,16 @@ const Input = _a => {
|
|
|
2563
2636
|
disabled = false,
|
|
2564
2637
|
type,
|
|
2565
2638
|
prefix,
|
|
2639
|
+
prefixClassName = '',
|
|
2566
2640
|
showPasswordToggle = true
|
|
2567
2641
|
} = _a,
|
|
2568
|
-
props = __rest(_a, ["className", "colorScheme", "size", "variant", "error", "success", "disabled", "type", "prefix", "showPasswordToggle"]);
|
|
2642
|
+
props = __rest(_a, ["className", "colorScheme", "size", "variant", "error", "success", "disabled", "type", "prefix", "prefixClassName", "showPasswordToggle"]);
|
|
2569
2643
|
const {
|
|
2570
2644
|
theme
|
|
2571
2645
|
} = useTheme();
|
|
2572
2646
|
const [showPassword, setShowPassword] = useState(false);
|
|
2647
|
+
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
2648
|
+
const prefixRef = useRef(null);
|
|
2573
2649
|
// Determine color scheme based on state
|
|
2574
2650
|
let finalColorScheme = colorScheme;
|
|
2575
2651
|
if (error) finalColorScheme = 'error';else if (success) finalColorScheme = 'success';
|
|
@@ -2586,25 +2662,26 @@ const Input = _a => {
|
|
|
2586
2662
|
const togglePasswordVisibility = () => {
|
|
2587
2663
|
setShowPassword(!showPassword);
|
|
2588
2664
|
};
|
|
2589
|
-
//
|
|
2590
|
-
|
|
2591
|
-
if (
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2665
|
+
// Measure actual prefix width
|
|
2666
|
+
useEffect(() => {
|
|
2667
|
+
if (prefixRef.current) {
|
|
2668
|
+
const width = prefixRef.current.offsetWidth;
|
|
2669
|
+
// Convert px to rem (assuming 16px base) and add base padding (1rem) + extra space (0.5rem)
|
|
2670
|
+
setPrefixWidth(width / 16 + 1.5);
|
|
2671
|
+
}
|
|
2672
|
+
}, [prefix]);
|
|
2596
2673
|
// Render with prefix
|
|
2597
2674
|
if (hasPrefix) {
|
|
2598
|
-
const leftPadding = getPrefixPadding();
|
|
2599
2675
|
return jsxs("div", {
|
|
2600
2676
|
className: 'relative',
|
|
2601
2677
|
children: [jsx("div", {
|
|
2602
|
-
|
|
2678
|
+
ref: prefixRef,
|
|
2679
|
+
className: `absolute left-4 top-1/2 -translate-y-1/2 z-10 text-[0.875rem] opacity-60 pointer-events-none select-none ${prefixClassName}`,
|
|
2603
2680
|
children: prefix
|
|
2604
2681
|
}), jsx("input", Object.assign({
|
|
2605
2682
|
className: `${classes}${isPassword && showPasswordToggle ? ' pr-12' : ''}`,
|
|
2606
2683
|
style: {
|
|
2607
|
-
paddingLeft: `${
|
|
2684
|
+
paddingLeft: prefixWidth ? `${prefixWidth}rem` : '1rem'
|
|
2608
2685
|
},
|
|
2609
2686
|
disabled: disabled,
|
|
2610
2687
|
type: inputType
|
|
@@ -3016,6 +3093,7 @@ const valueCard = cva('flex items-center transition-all outline outline-1 outlin
|
|
|
3016
3093
|
yellow: 'bg-dash-yellow-light !outline-dash-yellow'
|
|
3017
3094
|
},
|
|
3018
3095
|
size: {
|
|
3096
|
+
xs: 'px-[0.5rem] py-[0.25rem] rounded-[0.25rem]',
|
|
3019
3097
|
sm: 'dash-block-sm',
|
|
3020
3098
|
md: 'dash-block-md',
|
|
3021
3099
|
xl: 'dash-block-xl'
|
|
@@ -3167,7 +3245,7 @@ function clamp$1(value, [min, max]) {
|
|
|
3167
3245
|
}
|
|
3168
3246
|
|
|
3169
3247
|
// packages/core/primitive/src/primitive.tsx
|
|
3170
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
3248
|
+
function composeEventHandlers$1(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
3171
3249
|
return function handleEvent(event) {
|
|
3172
3250
|
originalEventHandler?.(event);
|
|
3173
3251
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
@@ -3199,17 +3277,17 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
3199
3277
|
}, [onEscapeKeyDown, ownerDocument]);
|
|
3200
3278
|
}
|
|
3201
3279
|
|
|
3202
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
3203
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
3204
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
3205
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
3206
|
-
var originalBodyPointerEvents;
|
|
3207
|
-
var DismissableLayerContext = React.createContext({
|
|
3280
|
+
var DISMISSABLE_LAYER_NAME$1 = "DismissableLayer";
|
|
3281
|
+
var CONTEXT_UPDATE$1 = "dismissableLayer.update";
|
|
3282
|
+
var POINTER_DOWN_OUTSIDE$1 = "dismissableLayer.pointerDownOutside";
|
|
3283
|
+
var FOCUS_OUTSIDE$1 = "dismissableLayer.focusOutside";
|
|
3284
|
+
var originalBodyPointerEvents$1;
|
|
3285
|
+
var DismissableLayerContext$1 = React.createContext({
|
|
3208
3286
|
layers: /* @__PURE__ */ new Set(),
|
|
3209
3287
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
3210
3288
|
branches: /* @__PURE__ */ new Set()
|
|
3211
3289
|
});
|
|
3212
|
-
var DismissableLayer = React.forwardRef(
|
|
3290
|
+
var DismissableLayer$1 = React.forwardRef(
|
|
3213
3291
|
(props, forwardedRef) => {
|
|
3214
3292
|
const {
|
|
3215
3293
|
disableOutsidePointerEvents = false,
|
|
@@ -3220,7 +3298,7 @@ var DismissableLayer = React.forwardRef(
|
|
|
3220
3298
|
onDismiss,
|
|
3221
3299
|
...layerProps
|
|
3222
3300
|
} = props;
|
|
3223
|
-
const context = React.useContext(DismissableLayerContext);
|
|
3301
|
+
const context = React.useContext(DismissableLayerContext$1);
|
|
3224
3302
|
const [node, setNode] = React.useState(null);
|
|
3225
3303
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
3226
3304
|
const [, force] = React.useState({});
|
|
@@ -3231,7 +3309,7 @@ var DismissableLayer = React.forwardRef(
|
|
|
3231
3309
|
const index = node ? layers.indexOf(node) : -1;
|
|
3232
3310
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
3233
3311
|
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
3234
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
3312
|
+
const pointerDownOutside = usePointerDownOutside$1((event) => {
|
|
3235
3313
|
const target = event.target;
|
|
3236
3314
|
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
3237
3315
|
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
@@ -3239,7 +3317,7 @@ var DismissableLayer = React.forwardRef(
|
|
|
3239
3317
|
onInteractOutside?.(event);
|
|
3240
3318
|
if (!event.defaultPrevented) onDismiss?.();
|
|
3241
3319
|
}, ownerDocument);
|
|
3242
|
-
const focusOutside = useFocusOutside((event) => {
|
|
3320
|
+
const focusOutside = useFocusOutside$1((event) => {
|
|
3243
3321
|
const target = event.target;
|
|
3244
3322
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
3245
3323
|
if (isFocusInBranch) return;
|
|
@@ -3260,16 +3338,16 @@ var DismissableLayer = React.forwardRef(
|
|
|
3260
3338
|
if (!node) return;
|
|
3261
3339
|
if (disableOutsidePointerEvents) {
|
|
3262
3340
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
3263
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
3341
|
+
originalBodyPointerEvents$1 = ownerDocument.body.style.pointerEvents;
|
|
3264
3342
|
ownerDocument.body.style.pointerEvents = "none";
|
|
3265
3343
|
}
|
|
3266
3344
|
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
3267
3345
|
}
|
|
3268
3346
|
context.layers.add(node);
|
|
3269
|
-
dispatchUpdate();
|
|
3347
|
+
dispatchUpdate$1();
|
|
3270
3348
|
return () => {
|
|
3271
3349
|
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
3272
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
3350
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents$1;
|
|
3273
3351
|
}
|
|
3274
3352
|
};
|
|
3275
3353
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -3278,13 +3356,13 @@ var DismissableLayer = React.forwardRef(
|
|
|
3278
3356
|
if (!node) return;
|
|
3279
3357
|
context.layers.delete(node);
|
|
3280
3358
|
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
3281
|
-
dispatchUpdate();
|
|
3359
|
+
dispatchUpdate$1();
|
|
3282
3360
|
};
|
|
3283
3361
|
}, [node, context]);
|
|
3284
3362
|
React.useEffect(() => {
|
|
3285
3363
|
const handleUpdate = () => force({});
|
|
3286
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
3287
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
3364
|
+
document.addEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
3365
|
+
return () => document.removeEventListener(CONTEXT_UPDATE$1, handleUpdate);
|
|
3288
3366
|
}, []);
|
|
3289
3367
|
return /* @__PURE__ */ jsx(
|
|
3290
3368
|
Primitive.div,
|
|
@@ -3295,9 +3373,9 @@ var DismissableLayer = React.forwardRef(
|
|
|
3295
3373
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
3296
3374
|
...props.style
|
|
3297
3375
|
},
|
|
3298
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
3299
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
3300
|
-
onPointerDownCapture: composeEventHandlers(
|
|
3376
|
+
onFocusCapture: composeEventHandlers$1(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
3377
|
+
onBlurCapture: composeEventHandlers$1(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
3378
|
+
onPointerDownCapture: composeEventHandlers$1(
|
|
3301
3379
|
props.onPointerDownCapture,
|
|
3302
3380
|
pointerDownOutside.onPointerDownCapture
|
|
3303
3381
|
)
|
|
@@ -3305,10 +3383,10 @@ var DismissableLayer = React.forwardRef(
|
|
|
3305
3383
|
);
|
|
3306
3384
|
}
|
|
3307
3385
|
);
|
|
3308
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
3309
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
3310
|
-
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
3311
|
-
const context = React.useContext(DismissableLayerContext);
|
|
3386
|
+
DismissableLayer$1.displayName = DISMISSABLE_LAYER_NAME$1;
|
|
3387
|
+
var BRANCH_NAME$1 = "DismissableLayerBranch";
|
|
3388
|
+
var DismissableLayerBranch$1 = React.forwardRef((props, forwardedRef) => {
|
|
3389
|
+
const context = React.useContext(DismissableLayerContext$1);
|
|
3312
3390
|
const ref = React.useRef(null);
|
|
3313
3391
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
3314
3392
|
React.useEffect(() => {
|
|
@@ -3322,8 +3400,8 @@ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
|
3322
3400
|
}, [context.branches]);
|
|
3323
3401
|
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
3324
3402
|
});
|
|
3325
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
3326
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
3403
|
+
DismissableLayerBranch$1.displayName = BRANCH_NAME$1;
|
|
3404
|
+
function usePointerDownOutside$1(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
3327
3405
|
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
3328
3406
|
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
3329
3407
|
const handleClickRef = React.useRef(() => {
|
|
@@ -3332,8 +3410,8 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
3332
3410
|
const handlePointerDown = (event) => {
|
|
3333
3411
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
3334
3412
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
3335
|
-
handleAndDispatchCustomEvent(
|
|
3336
|
-
POINTER_DOWN_OUTSIDE,
|
|
3413
|
+
handleAndDispatchCustomEvent$1(
|
|
3414
|
+
POINTER_DOWN_OUTSIDE$1,
|
|
3337
3415
|
handlePointerDownOutside,
|
|
3338
3416
|
eventDetail,
|
|
3339
3417
|
{ discrete: true }
|
|
@@ -3366,14 +3444,14 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
3366
3444
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
3367
3445
|
};
|
|
3368
3446
|
}
|
|
3369
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
3447
|
+
function useFocusOutside$1(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
3370
3448
|
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
3371
3449
|
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
3372
3450
|
React.useEffect(() => {
|
|
3373
3451
|
const handleFocus = (event) => {
|
|
3374
3452
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
3375
3453
|
const eventDetail = { originalEvent: event };
|
|
3376
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
3454
|
+
handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE$1, handleFocusOutside, eventDetail, {
|
|
3377
3455
|
discrete: false
|
|
3378
3456
|
});
|
|
3379
3457
|
}
|
|
@@ -3386,11 +3464,11 @@ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
|
3386
3464
|
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
3387
3465
|
};
|
|
3388
3466
|
}
|
|
3389
|
-
function dispatchUpdate() {
|
|
3390
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
3467
|
+
function dispatchUpdate$1() {
|
|
3468
|
+
const event = new CustomEvent(CONTEXT_UPDATE$1);
|
|
3391
3469
|
document.dispatchEvent(event);
|
|
3392
3470
|
}
|
|
3393
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
3471
|
+
function handleAndDispatchCustomEvent$1(name, handler, detail, { discrete }) {
|
|
3394
3472
|
const target = detail.originalEvent.target;
|
|
3395
3473
|
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
3396
3474
|
if (handler) target.addEventListener(name, handler, { once: true });
|
|
@@ -3401,22 +3479,22 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
3401
3479
|
}
|
|
3402
3480
|
}
|
|
3403
3481
|
|
|
3404
|
-
var count = 0;
|
|
3405
|
-
function useFocusGuards() {
|
|
3482
|
+
var count$1 = 0;
|
|
3483
|
+
function useFocusGuards$1() {
|
|
3406
3484
|
React.useEffect(() => {
|
|
3407
3485
|
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
3408
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
3409
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
3410
|
-
count++;
|
|
3486
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard$1());
|
|
3487
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard$1());
|
|
3488
|
+
count$1++;
|
|
3411
3489
|
return () => {
|
|
3412
|
-
if (count === 1) {
|
|
3490
|
+
if (count$1 === 1) {
|
|
3413
3491
|
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
3414
3492
|
}
|
|
3415
|
-
count--;
|
|
3493
|
+
count$1--;
|
|
3416
3494
|
};
|
|
3417
3495
|
}, []);
|
|
3418
3496
|
}
|
|
3419
|
-
function createFocusGuard() {
|
|
3497
|
+
function createFocusGuard$1() {
|
|
3420
3498
|
const element = document.createElement("span");
|
|
3421
3499
|
element.setAttribute("data-radix-focus-guard", "");
|
|
3422
3500
|
element.tabIndex = 0;
|
|
@@ -5808,7 +5886,7 @@ const arrow = (options, deps) => ({
|
|
|
5808
5886
|
|
|
5809
5887
|
// src/arrow.tsx
|
|
5810
5888
|
var NAME$1 = "Arrow";
|
|
5811
|
-
var Arrow$
|
|
5889
|
+
var Arrow$2 = React.forwardRef((props, forwardedRef) => {
|
|
5812
5890
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
5813
5891
|
return /* @__PURE__ */ jsx(
|
|
5814
5892
|
Primitive.svg,
|
|
@@ -5823,8 +5901,8 @@ var Arrow$1 = React.forwardRef((props, forwardedRef) => {
|
|
|
5823
5901
|
}
|
|
5824
5902
|
);
|
|
5825
5903
|
});
|
|
5826
|
-
Arrow$
|
|
5827
|
-
var Root$2 = Arrow$
|
|
5904
|
+
Arrow$2.displayName = NAME$1;
|
|
5905
|
+
var Root$2 = Arrow$2;
|
|
5828
5906
|
|
|
5829
5907
|
// packages/react/use-size/src/use-size.tsx
|
|
5830
5908
|
function useSize(element) {
|
|
@@ -5862,20 +5940,20 @@ function useSize(element) {
|
|
|
5862
5940
|
return size;
|
|
5863
5941
|
}
|
|
5864
5942
|
|
|
5865
|
-
var POPPER_NAME = "Popper";
|
|
5866
|
-
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
5867
|
-
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
5868
|
-
var Popper = (props) => {
|
|
5943
|
+
var POPPER_NAME$1 = "Popper";
|
|
5944
|
+
var [createPopperContext$1, createPopperScope$1] = createContextScope(POPPER_NAME$1);
|
|
5945
|
+
var [PopperProvider$1, usePopperContext$1] = createPopperContext$1(POPPER_NAME$1);
|
|
5946
|
+
var Popper$1 = (props) => {
|
|
5869
5947
|
const { __scopePopper, children } = props;
|
|
5870
5948
|
const [anchor, setAnchor] = React.useState(null);
|
|
5871
|
-
return /* @__PURE__ */ jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
5949
|
+
return /* @__PURE__ */ jsx(PopperProvider$1, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
5872
5950
|
};
|
|
5873
|
-
Popper.displayName = POPPER_NAME;
|
|
5874
|
-
var ANCHOR_NAME = "PopperAnchor";
|
|
5875
|
-
var PopperAnchor = React.forwardRef(
|
|
5951
|
+
Popper$1.displayName = POPPER_NAME$1;
|
|
5952
|
+
var ANCHOR_NAME$2 = "PopperAnchor";
|
|
5953
|
+
var PopperAnchor$1 = React.forwardRef(
|
|
5876
5954
|
(props, forwardedRef) => {
|
|
5877
5955
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
5878
|
-
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
5956
|
+
const context = usePopperContext$1(ANCHOR_NAME$2, __scopePopper);
|
|
5879
5957
|
const ref = React.useRef(null);
|
|
5880
5958
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
5881
5959
|
React.useEffect(() => {
|
|
@@ -5884,10 +5962,10 @@ var PopperAnchor = React.forwardRef(
|
|
|
5884
5962
|
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
5885
5963
|
}
|
|
5886
5964
|
);
|
|
5887
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
5888
|
-
var CONTENT_NAME$
|
|
5889
|
-
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$
|
|
5890
|
-
var PopperContent = React.forwardRef(
|
|
5965
|
+
PopperAnchor$1.displayName = ANCHOR_NAME$2;
|
|
5966
|
+
var CONTENT_NAME$5 = "PopperContent";
|
|
5967
|
+
var [PopperContentProvider$1, useContentContext$1] = createPopperContext$1(CONTENT_NAME$5);
|
|
5968
|
+
var PopperContent$1 = React.forwardRef(
|
|
5891
5969
|
(props, forwardedRef) => {
|
|
5892
5970
|
const {
|
|
5893
5971
|
__scopePopper,
|
|
@@ -5905,7 +5983,7 @@ var PopperContent = React.forwardRef(
|
|
|
5905
5983
|
onPlaced,
|
|
5906
5984
|
...contentProps
|
|
5907
5985
|
} = props;
|
|
5908
|
-
const context = usePopperContext(CONTENT_NAME$
|
|
5986
|
+
const context = usePopperContext$1(CONTENT_NAME$5, __scopePopper);
|
|
5909
5987
|
const [content, setContent] = React.useState(null);
|
|
5910
5988
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
5911
5989
|
const [arrow$1, setArrow] = React.useState(null);
|
|
@@ -5918,7 +5996,7 @@ var PopperContent = React.forwardRef(
|
|
|
5918
5996
|
const hasExplicitBoundaries = boundary.length > 0;
|
|
5919
5997
|
const detectOverflowOptions = {
|
|
5920
5998
|
padding: collisionPadding,
|
|
5921
|
-
boundary: boundary.filter(isNotNull),
|
|
5999
|
+
boundary: boundary.filter(isNotNull$1),
|
|
5922
6000
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
5923
6001
|
altBoundary: hasExplicitBoundaries
|
|
5924
6002
|
};
|
|
@@ -5956,11 +6034,11 @@ var PopperContent = React.forwardRef(
|
|
|
5956
6034
|
}
|
|
5957
6035
|
}),
|
|
5958
6036
|
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
5959
|
-
transformOrigin({ arrowWidth, arrowHeight }),
|
|
6037
|
+
transformOrigin$1({ arrowWidth, arrowHeight }),
|
|
5960
6038
|
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
5961
6039
|
]
|
|
5962
6040
|
});
|
|
5963
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
6041
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
5964
6042
|
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
5965
6043
|
useLayoutEffect2(() => {
|
|
5966
6044
|
if (isPositioned) {
|
|
@@ -5999,7 +6077,7 @@ var PopperContent = React.forwardRef(
|
|
|
5999
6077
|
},
|
|
6000
6078
|
dir: props.dir,
|
|
6001
6079
|
children: /* @__PURE__ */ jsx(
|
|
6002
|
-
PopperContentProvider,
|
|
6080
|
+
PopperContentProvider$1,
|
|
6003
6081
|
{
|
|
6004
6082
|
scope: __scopePopper,
|
|
6005
6083
|
placedSide,
|
|
@@ -6028,18 +6106,18 @@ var PopperContent = React.forwardRef(
|
|
|
6028
6106
|
);
|
|
6029
6107
|
}
|
|
6030
6108
|
);
|
|
6031
|
-
PopperContent.displayName = CONTENT_NAME$
|
|
6032
|
-
var ARROW_NAME$
|
|
6033
|
-
var OPPOSITE_SIDE = {
|
|
6109
|
+
PopperContent$1.displayName = CONTENT_NAME$5;
|
|
6110
|
+
var ARROW_NAME$3 = "PopperArrow";
|
|
6111
|
+
var OPPOSITE_SIDE$1 = {
|
|
6034
6112
|
top: "bottom",
|
|
6035
6113
|
right: "left",
|
|
6036
6114
|
bottom: "top",
|
|
6037
6115
|
left: "right"
|
|
6038
6116
|
};
|
|
6039
|
-
var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
6117
|
+
var PopperArrow$1 = React.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
6040
6118
|
const { __scopePopper, ...arrowProps } = props;
|
|
6041
|
-
const contentContext = useContentContext(ARROW_NAME$
|
|
6042
|
-
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
6119
|
+
const contentContext = useContentContext$1(ARROW_NAME$3, __scopePopper);
|
|
6120
|
+
const baseSide = OPPOSITE_SIDE$1[contentContext.placedSide];
|
|
6043
6121
|
return (
|
|
6044
6122
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
6045
6123
|
// doesn't report size as we'd expect on SVG elements.
|
|
@@ -6083,11 +6161,11 @@ var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
|
6083
6161
|
)
|
|
6084
6162
|
);
|
|
6085
6163
|
});
|
|
6086
|
-
PopperArrow.displayName = ARROW_NAME$
|
|
6087
|
-
function isNotNull(value) {
|
|
6164
|
+
PopperArrow$1.displayName = ARROW_NAME$3;
|
|
6165
|
+
function isNotNull$1(value) {
|
|
6088
6166
|
return value !== null;
|
|
6089
6167
|
}
|
|
6090
|
-
var transformOrigin = (options) => ({
|
|
6168
|
+
var transformOrigin$1 = (options) => ({
|
|
6091
6169
|
name: "transformOrigin",
|
|
6092
6170
|
options,
|
|
6093
6171
|
fn(data) {
|
|
@@ -6096,7 +6174,7 @@ var transformOrigin = (options) => ({
|
|
|
6096
6174
|
const isArrowHidden = cannotCenterArrow;
|
|
6097
6175
|
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
6098
6176
|
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
6099
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
6177
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement$1(placement);
|
|
6100
6178
|
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
6101
6179
|
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
6102
6180
|
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
@@ -6118,24 +6196,24 @@ var transformOrigin = (options) => ({
|
|
|
6118
6196
|
return { data: { x, y } };
|
|
6119
6197
|
}
|
|
6120
6198
|
});
|
|
6121
|
-
function getSideAndAlignFromPlacement(placement) {
|
|
6199
|
+
function getSideAndAlignFromPlacement$1(placement) {
|
|
6122
6200
|
const [side, align = "center"] = placement.split("-");
|
|
6123
6201
|
return [side, align];
|
|
6124
6202
|
}
|
|
6125
|
-
var Root2$
|
|
6126
|
-
var Anchor = PopperAnchor;
|
|
6127
|
-
var Content$
|
|
6128
|
-
var Arrow = PopperArrow;
|
|
6203
|
+
var Root2$4 = Popper$1;
|
|
6204
|
+
var Anchor$1 = PopperAnchor$1;
|
|
6205
|
+
var Content$3 = PopperContent$1;
|
|
6206
|
+
var Arrow$1 = PopperArrow$1;
|
|
6129
6207
|
|
|
6130
|
-
var PORTAL_NAME$
|
|
6131
|
-
var Portal$
|
|
6208
|
+
var PORTAL_NAME$3 = "Portal";
|
|
6209
|
+
var Portal$3 = React.forwardRef((props, forwardedRef) => {
|
|
6132
6210
|
const { container: containerProp, ...portalProps } = props;
|
|
6133
6211
|
const [mounted, setMounted] = React.useState(false);
|
|
6134
6212
|
useLayoutEffect2(() => setMounted(true), []);
|
|
6135
6213
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
6136
6214
|
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
6137
6215
|
});
|
|
6138
|
-
Portal$
|
|
6216
|
+
Portal$3.displayName = PORTAL_NAME$3;
|
|
6139
6217
|
|
|
6140
6218
|
// packages/react/use-previous/src/use-previous.tsx
|
|
6141
6219
|
function usePrevious(value) {
|
|
@@ -7016,9 +7094,9 @@ var SELECT_NAME = "Select";
|
|
|
7016
7094
|
var [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(SELECT_NAME);
|
|
7017
7095
|
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
|
|
7018
7096
|
createCollectionScope$1,
|
|
7019
|
-
createPopperScope
|
|
7097
|
+
createPopperScope$1
|
|
7020
7098
|
]);
|
|
7021
|
-
var usePopperScope = createPopperScope();
|
|
7099
|
+
var usePopperScope$1 = createPopperScope$1();
|
|
7022
7100
|
var [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
7023
7101
|
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
7024
7102
|
var Select$1 = (props) => {
|
|
@@ -7038,7 +7116,7 @@ var Select$1 = (props) => {
|
|
|
7038
7116
|
required,
|
|
7039
7117
|
form
|
|
7040
7118
|
} = props;
|
|
7041
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
7119
|
+
const popperScope = usePopperScope$1(__scopeSelect);
|
|
7042
7120
|
const [trigger, setTrigger] = React.useState(null);
|
|
7043
7121
|
const [valueNode, setValueNode] = React.useState(null);
|
|
7044
7122
|
const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
|
|
@@ -7059,7 +7137,7 @@ var Select$1 = (props) => {
|
|
|
7059
7137
|
const isFormControl = trigger ? form || !!trigger.closest("form") : true;
|
|
7060
7138
|
const [nativeOptionsSet, setNativeOptionsSet] = React.useState(/* @__PURE__ */ new Set());
|
|
7061
7139
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
7062
|
-
return /* @__PURE__ */ jsx(Root2$
|
|
7140
|
+
return /* @__PURE__ */ jsx(Root2$4, { ...popperScope, children: /* @__PURE__ */ jsxs(
|
|
7063
7141
|
SelectProvider,
|
|
7064
7142
|
{
|
|
7065
7143
|
required,
|
|
@@ -7120,12 +7198,12 @@ var Select$1 = (props) => {
|
|
|
7120
7198
|
) });
|
|
7121
7199
|
};
|
|
7122
7200
|
Select$1.displayName = SELECT_NAME;
|
|
7123
|
-
var TRIGGER_NAME$
|
|
7201
|
+
var TRIGGER_NAME$3 = "SelectTrigger";
|
|
7124
7202
|
var SelectTrigger = React.forwardRef(
|
|
7125
7203
|
(props, forwardedRef) => {
|
|
7126
7204
|
const { __scopeSelect, disabled = false, ...triggerProps } = props;
|
|
7127
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
7128
|
-
const context = useSelectContext(TRIGGER_NAME$
|
|
7205
|
+
const popperScope = usePopperScope$1(__scopeSelect);
|
|
7206
|
+
const context = useSelectContext(TRIGGER_NAME$3, __scopeSelect);
|
|
7129
7207
|
const isDisabled = context.disabled || disabled;
|
|
7130
7208
|
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
7131
7209
|
const getItems = useCollection$1(__scopeSelect);
|
|
@@ -7150,7 +7228,7 @@ var SelectTrigger = React.forwardRef(
|
|
|
7150
7228
|
};
|
|
7151
7229
|
}
|
|
7152
7230
|
};
|
|
7153
|
-
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
7231
|
+
return /* @__PURE__ */ jsx(Anchor$1, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
7154
7232
|
Primitive.button,
|
|
7155
7233
|
{
|
|
7156
7234
|
type: "button",
|
|
@@ -7166,13 +7244,13 @@ var SelectTrigger = React.forwardRef(
|
|
|
7166
7244
|
"data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0,
|
|
7167
7245
|
...triggerProps,
|
|
7168
7246
|
ref: composedRefs,
|
|
7169
|
-
onClick: composeEventHandlers(triggerProps.onClick, (event) => {
|
|
7247
|
+
onClick: composeEventHandlers$1(triggerProps.onClick, (event) => {
|
|
7170
7248
|
event.currentTarget.focus();
|
|
7171
7249
|
if (pointerTypeRef.current !== "mouse") {
|
|
7172
7250
|
handleOpen(event);
|
|
7173
7251
|
}
|
|
7174
7252
|
}),
|
|
7175
|
-
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
7253
|
+
onPointerDown: composeEventHandlers$1(triggerProps.onPointerDown, (event) => {
|
|
7176
7254
|
pointerTypeRef.current = event.pointerType;
|
|
7177
7255
|
const target = event.target;
|
|
7178
7256
|
if (target.hasPointerCapture(event.pointerId)) {
|
|
@@ -7183,7 +7261,7 @@ var SelectTrigger = React.forwardRef(
|
|
|
7183
7261
|
event.preventDefault();
|
|
7184
7262
|
}
|
|
7185
7263
|
}),
|
|
7186
|
-
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
7264
|
+
onKeyDown: composeEventHandlers$1(triggerProps.onKeyDown, (event) => {
|
|
7187
7265
|
const isTypingAhead = searchRef.current !== "";
|
|
7188
7266
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
7189
7267
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -7197,7 +7275,7 @@ var SelectTrigger = React.forwardRef(
|
|
|
7197
7275
|
) });
|
|
7198
7276
|
}
|
|
7199
7277
|
);
|
|
7200
|
-
SelectTrigger.displayName = TRIGGER_NAME$
|
|
7278
|
+
SelectTrigger.displayName = TRIGGER_NAME$3;
|
|
7201
7279
|
var VALUE_NAME = "SelectValue";
|
|
7202
7280
|
var SelectValue = React.forwardRef(
|
|
7203
7281
|
(props, forwardedRef) => {
|
|
@@ -7229,15 +7307,15 @@ var SelectIcon = React.forwardRef(
|
|
|
7229
7307
|
}
|
|
7230
7308
|
);
|
|
7231
7309
|
SelectIcon.displayName = ICON_NAME;
|
|
7232
|
-
var PORTAL_NAME$
|
|
7310
|
+
var PORTAL_NAME$2 = "SelectPortal";
|
|
7233
7311
|
var SelectPortal = (props) => {
|
|
7234
|
-
return /* @__PURE__ */ jsx(Portal$
|
|
7312
|
+
return /* @__PURE__ */ jsx(Portal$3, { asChild: true, ...props });
|
|
7235
7313
|
};
|
|
7236
|
-
SelectPortal.displayName = PORTAL_NAME$
|
|
7237
|
-
var CONTENT_NAME$
|
|
7314
|
+
SelectPortal.displayName = PORTAL_NAME$2;
|
|
7315
|
+
var CONTENT_NAME$4 = "SelectContent";
|
|
7238
7316
|
var SelectContent = React.forwardRef(
|
|
7239
7317
|
(props, forwardedRef) => {
|
|
7240
|
-
const context = useSelectContext(CONTENT_NAME$
|
|
7318
|
+
const context = useSelectContext(CONTENT_NAME$4, props.__scopeSelect);
|
|
7241
7319
|
const [fragment, setFragment] = React.useState();
|
|
7242
7320
|
useLayoutEffect2(() => {
|
|
7243
7321
|
setFragment(new DocumentFragment());
|
|
@@ -7252,11 +7330,11 @@ var SelectContent = React.forwardRef(
|
|
|
7252
7330
|
return /* @__PURE__ */ jsx(SelectContentImpl, { ...props, ref: forwardedRef });
|
|
7253
7331
|
}
|
|
7254
7332
|
);
|
|
7255
|
-
SelectContent.displayName = CONTENT_NAME$
|
|
7333
|
+
SelectContent.displayName = CONTENT_NAME$4;
|
|
7256
7334
|
var CONTENT_MARGIN = 10;
|
|
7257
|
-
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$
|
|
7335
|
+
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$4);
|
|
7258
7336
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
7259
|
-
var Slot$
|
|
7337
|
+
var Slot$2 = createSlot("SelectContent.RemoveScroll");
|
|
7260
7338
|
var SelectContentImpl = React.forwardRef(
|
|
7261
7339
|
(props, forwardedRef) => {
|
|
7262
7340
|
const {
|
|
@@ -7280,7 +7358,7 @@ var SelectContentImpl = React.forwardRef(
|
|
|
7280
7358
|
//
|
|
7281
7359
|
...contentProps
|
|
7282
7360
|
} = props;
|
|
7283
|
-
const context = useSelectContext(CONTENT_NAME$
|
|
7361
|
+
const context = useSelectContext(CONTENT_NAME$4, __scopeSelect);
|
|
7284
7362
|
const [content, setContent] = React.useState(null);
|
|
7285
7363
|
const [viewport, setViewport] = React.useState(null);
|
|
7286
7364
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
@@ -7294,7 +7372,7 @@ var SelectContentImpl = React.forwardRef(
|
|
|
7294
7372
|
React.useEffect(() => {
|
|
7295
7373
|
if (content) return hideOthers(content);
|
|
7296
7374
|
}, [content]);
|
|
7297
|
-
useFocusGuards();
|
|
7375
|
+
useFocusGuards$1();
|
|
7298
7376
|
const focusFirst = React.useCallback(
|
|
7299
7377
|
(candidates) => {
|
|
7300
7378
|
const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);
|
|
@@ -7419,7 +7497,7 @@ var SelectContentImpl = React.forwardRef(
|
|
|
7419
7497
|
position,
|
|
7420
7498
|
isPositioned,
|
|
7421
7499
|
searchRef,
|
|
7422
|
-
children: /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot$
|
|
7500
|
+
children: /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot$2, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
|
|
7423
7501
|
FocusScope,
|
|
7424
7502
|
{
|
|
7425
7503
|
asChild: true,
|
|
@@ -7427,12 +7505,12 @@ var SelectContentImpl = React.forwardRef(
|
|
|
7427
7505
|
onMountAutoFocus: (event) => {
|
|
7428
7506
|
event.preventDefault();
|
|
7429
7507
|
},
|
|
7430
|
-
onUnmountAutoFocus: composeEventHandlers(onCloseAutoFocus, (event) => {
|
|
7508
|
+
onUnmountAutoFocus: composeEventHandlers$1(onCloseAutoFocus, (event) => {
|
|
7431
7509
|
context.trigger?.focus({ preventScroll: true });
|
|
7432
7510
|
event.preventDefault();
|
|
7433
7511
|
}),
|
|
7434
7512
|
children: /* @__PURE__ */ jsx(
|
|
7435
|
-
DismissableLayer,
|
|
7513
|
+
DismissableLayer$1,
|
|
7436
7514
|
{
|
|
7437
7515
|
asChild: true,
|
|
7438
7516
|
disableOutsidePointerEvents: true,
|
|
@@ -7460,7 +7538,7 @@ var SelectContentImpl = React.forwardRef(
|
|
|
7460
7538
|
outline: "none",
|
|
7461
7539
|
...contentProps.style
|
|
7462
7540
|
},
|
|
7463
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
7541
|
+
onKeyDown: composeEventHandlers$1(contentProps.onKeyDown, (event) => {
|
|
7464
7542
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
7465
7543
|
if (event.key === "Tab") event.preventDefault();
|
|
7466
7544
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -7493,8 +7571,8 @@ SelectContentImpl.displayName = CONTENT_IMPL_NAME;
|
|
|
7493
7571
|
var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition";
|
|
7494
7572
|
var SelectItemAlignedPosition = React.forwardRef((props, forwardedRef) => {
|
|
7495
7573
|
const { __scopeSelect, onPlaced, ...popperProps } = props;
|
|
7496
|
-
const context = useSelectContext(CONTENT_NAME$
|
|
7497
|
-
const contentContext = useSelectContentContext(CONTENT_NAME$
|
|
7574
|
+
const context = useSelectContext(CONTENT_NAME$4, __scopeSelect);
|
|
7575
|
+
const contentContext = useSelectContentContext(CONTENT_NAME$4, __scopeSelect);
|
|
7498
7576
|
const [contentWrapper, setContentWrapper] = React.useState(null);
|
|
7499
7577
|
const [content, setContent] = React.useState(null);
|
|
7500
7578
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
@@ -7662,9 +7740,9 @@ var SelectPopperPosition = React.forwardRef((props, forwardedRef) => {
|
|
|
7662
7740
|
collisionPadding = CONTENT_MARGIN,
|
|
7663
7741
|
...popperProps
|
|
7664
7742
|
} = props;
|
|
7665
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
7743
|
+
const popperScope = usePopperScope$1(__scopeSelect);
|
|
7666
7744
|
return /* @__PURE__ */ jsx(
|
|
7667
|
-
Content$
|
|
7745
|
+
Content$3,
|
|
7668
7746
|
{
|
|
7669
7747
|
...popperScope,
|
|
7670
7748
|
...popperProps,
|
|
@@ -7688,7 +7766,7 @@ var SelectPopperPosition = React.forwardRef((props, forwardedRef) => {
|
|
|
7688
7766
|
);
|
|
7689
7767
|
});
|
|
7690
7768
|
SelectPopperPosition.displayName = POPPER_POSITION_NAME;
|
|
7691
|
-
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME$
|
|
7769
|
+
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME$4, {});
|
|
7692
7770
|
var VIEWPORT_NAME = "SelectViewport";
|
|
7693
7771
|
var SelectViewport = React.forwardRef(
|
|
7694
7772
|
(props, forwardedRef) => {
|
|
@@ -7727,7 +7805,7 @@ var SelectViewport = React.forwardRef(
|
|
|
7727
7805
|
overflow: "hidden auto",
|
|
7728
7806
|
...viewportProps.style
|
|
7729
7807
|
},
|
|
7730
|
-
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
7808
|
+
onScroll: composeEventHandlers$1(viewportProps.onScroll, (event) => {
|
|
7731
7809
|
const viewport = event.currentTarget;
|
|
7732
7810
|
const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;
|
|
7733
7811
|
if (shouldExpandOnScrollRef?.current && contentWrapper) {
|
|
@@ -7840,18 +7918,18 @@ var SelectItem = React.forwardRef(
|
|
|
7840
7918
|
tabIndex: disabled ? void 0 : -1,
|
|
7841
7919
|
...itemProps,
|
|
7842
7920
|
ref: composedRefs,
|
|
7843
|
-
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
7844
|
-
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
7845
|
-
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
7921
|
+
onFocus: composeEventHandlers$1(itemProps.onFocus, () => setIsFocused(true)),
|
|
7922
|
+
onBlur: composeEventHandlers$1(itemProps.onBlur, () => setIsFocused(false)),
|
|
7923
|
+
onClick: composeEventHandlers$1(itemProps.onClick, () => {
|
|
7846
7924
|
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
7847
7925
|
}),
|
|
7848
|
-
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
7926
|
+
onPointerUp: composeEventHandlers$1(itemProps.onPointerUp, () => {
|
|
7849
7927
|
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
7850
7928
|
}),
|
|
7851
|
-
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
7929
|
+
onPointerDown: composeEventHandlers$1(itemProps.onPointerDown, (event) => {
|
|
7852
7930
|
pointerTypeRef.current = event.pointerType;
|
|
7853
7931
|
}),
|
|
7854
|
-
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
7932
|
+
onPointerMove: composeEventHandlers$1(itemProps.onPointerMove, (event) => {
|
|
7855
7933
|
pointerTypeRef.current = event.pointerType;
|
|
7856
7934
|
if (disabled) {
|
|
7857
7935
|
contentContext.onItemLeave?.();
|
|
@@ -7859,12 +7937,12 @@ var SelectItem = React.forwardRef(
|
|
|
7859
7937
|
event.currentTarget.focus({ preventScroll: true });
|
|
7860
7938
|
}
|
|
7861
7939
|
}),
|
|
7862
|
-
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
7940
|
+
onPointerLeave: composeEventHandlers$1(itemProps.onPointerLeave, (event) => {
|
|
7863
7941
|
if (event.currentTarget === document.activeElement) {
|
|
7864
7942
|
contentContext.onItemLeave?.();
|
|
7865
7943
|
}
|
|
7866
7944
|
}),
|
|
7867
|
-
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
7945
|
+
onKeyDown: composeEventHandlers$1(itemProps.onKeyDown, (event) => {
|
|
7868
7946
|
const isTypingAhead = contentContext.searchRef?.current !== "";
|
|
7869
7947
|
if (isTypingAhead && event.key === " ") return;
|
|
7870
7948
|
if (SELECTION_KEYS.includes(event.key)) handleSelect();
|
|
@@ -8012,18 +8090,18 @@ var SelectScrollButtonImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
8012
8090
|
...scrollIndicatorProps,
|
|
8013
8091
|
ref: forwardedRef,
|
|
8014
8092
|
style: { flexShrink: 0, ...scrollIndicatorProps.style },
|
|
8015
|
-
onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {
|
|
8093
|
+
onPointerDown: composeEventHandlers$1(scrollIndicatorProps.onPointerDown, () => {
|
|
8016
8094
|
if (autoScrollTimerRef.current === null) {
|
|
8017
8095
|
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
8018
8096
|
}
|
|
8019
8097
|
}),
|
|
8020
|
-
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
8098
|
+
onPointerMove: composeEventHandlers$1(scrollIndicatorProps.onPointerMove, () => {
|
|
8021
8099
|
contentContext.onItemLeave?.();
|
|
8022
8100
|
if (autoScrollTimerRef.current === null) {
|
|
8023
8101
|
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
8024
8102
|
}
|
|
8025
8103
|
}),
|
|
8026
|
-
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
8104
|
+
onPointerLeave: composeEventHandlers$1(scrollIndicatorProps.onPointerLeave, () => {
|
|
8027
8105
|
clearAutoScrollTimer();
|
|
8028
8106
|
})
|
|
8029
8107
|
}
|
|
@@ -8037,17 +8115,17 @@ var SelectSeparator = React.forwardRef(
|
|
|
8037
8115
|
}
|
|
8038
8116
|
);
|
|
8039
8117
|
SelectSeparator.displayName = SEPARATOR_NAME;
|
|
8040
|
-
var ARROW_NAME = "SelectArrow";
|
|
8118
|
+
var ARROW_NAME$2 = "SelectArrow";
|
|
8041
8119
|
var SelectArrow = React.forwardRef(
|
|
8042
8120
|
(props, forwardedRef) => {
|
|
8043
8121
|
const { __scopeSelect, ...arrowProps } = props;
|
|
8044
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
8045
|
-
const context = useSelectContext(ARROW_NAME, __scopeSelect);
|
|
8046
|
-
const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);
|
|
8047
|
-
return context.open && contentContext.position === "popper" ? /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
8122
|
+
const popperScope = usePopperScope$1(__scopeSelect);
|
|
8123
|
+
const context = useSelectContext(ARROW_NAME$2, __scopeSelect);
|
|
8124
|
+
const contentContext = useSelectContentContext(ARROW_NAME$2, __scopeSelect);
|
|
8125
|
+
return context.open && contentContext.position === "popper" ? /* @__PURE__ */ jsx(Arrow$1, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
8048
8126
|
}
|
|
8049
8127
|
);
|
|
8050
|
-
SelectArrow.displayName = ARROW_NAME;
|
|
8128
|
+
SelectArrow.displayName = ARROW_NAME$2;
|
|
8051
8129
|
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
8052
8130
|
var SelectBubbleInput = React.forwardRef(
|
|
8053
8131
|
({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
@@ -8124,12 +8202,12 @@ function findNextItem(items, search, currentItem) {
|
|
|
8124
8202
|
function wrapArray$1(array, startIndex) {
|
|
8125
8203
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
8126
8204
|
}
|
|
8127
|
-
var Root2$
|
|
8128
|
-
var Trigger$
|
|
8205
|
+
var Root2$3 = Select$1;
|
|
8206
|
+
var Trigger$3 = SelectTrigger;
|
|
8129
8207
|
var Value = SelectValue;
|
|
8130
8208
|
var Icon = SelectIcon;
|
|
8131
|
-
var Portal$
|
|
8132
|
-
var Content2 = SelectContent;
|
|
8209
|
+
var Portal$2 = SelectPortal;
|
|
8210
|
+
var Content2$1 = SelectContent;
|
|
8133
8211
|
var Viewport = SelectViewport;
|
|
8134
8212
|
var Item$1 = SelectItem;
|
|
8135
8213
|
var ItemText = SelectItemText;
|
|
@@ -8290,13 +8368,13 @@ const Select = _a => {
|
|
|
8290
8368
|
const iconClasses = selectIcon({
|
|
8291
8369
|
size
|
|
8292
8370
|
});
|
|
8293
|
-
return jsxs(Root2$
|
|
8371
|
+
return jsxs(Root2$3, {
|
|
8294
8372
|
value: value,
|
|
8295
8373
|
defaultValue: defaultValue,
|
|
8296
8374
|
onValueChange: onChange,
|
|
8297
8375
|
disabled: disabled,
|
|
8298
8376
|
name: name,
|
|
8299
|
-
children: [jsxs(Trigger$
|
|
8377
|
+
children: [jsxs(Trigger$3, {
|
|
8300
8378
|
className: triggerClasses,
|
|
8301
8379
|
children: [jsx("div", {
|
|
8302
8380
|
className: 'w-full flex-1 text-left',
|
|
@@ -8309,8 +8387,8 @@ const Select = _a => {
|
|
|
8309
8387
|
className: iconClasses
|
|
8310
8388
|
})
|
|
8311
8389
|
})]
|
|
8312
|
-
}), jsx(Portal$
|
|
8313
|
-
children: jsx(Content2, {
|
|
8390
|
+
}), jsx(Portal$2, {
|
|
8391
|
+
children: jsx(Content2$1, {
|
|
8314
8392
|
className: contentClasses,
|
|
8315
8393
|
position: 'popper',
|
|
8316
8394
|
sideOffset: 5,
|
|
@@ -9548,97 +9626,1029 @@ function NotActive(_a) {
|
|
|
9548
9626
|
}));
|
|
9549
9627
|
}
|
|
9550
9628
|
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
*/
|
|
9558
|
-
function copyToClipboard(copyText = '', callback) {
|
|
9559
|
-
navigator.clipboard.writeText(copyText).then(() => {
|
|
9560
|
-
const result = {
|
|
9561
|
-
status: true
|
|
9562
|
-
};
|
|
9563
|
-
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
9564
|
-
}).catch(err => {
|
|
9565
|
-
const result = {
|
|
9566
|
-
status: false,
|
|
9567
|
-
message: err
|
|
9568
|
-
};
|
|
9569
|
-
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
9570
|
-
});
|
|
9571
|
-
}
|
|
9572
|
-
|
|
9573
|
-
const copyBtn = cva('p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors', {
|
|
9574
|
-
variants: {
|
|
9575
|
-
theme: {
|
|
9576
|
-
light: 'hover:text-gray-600 active:text-gray-800',
|
|
9577
|
-
dark: 'hover:text-gray-300 active:text-gray-100'
|
|
9578
|
-
}
|
|
9579
|
-
},
|
|
9580
|
-
defaultVariants: {
|
|
9581
|
-
theme: 'light'
|
|
9582
|
-
}
|
|
9583
|
-
});
|
|
9584
|
-
const CopyButton = _a => {
|
|
9585
|
-
var {
|
|
9586
|
-
text,
|
|
9587
|
-
className,
|
|
9588
|
-
onCopy
|
|
9589
|
-
} = _a,
|
|
9590
|
-
props = __rest(_a, ["text", "className", "onCopy"]);
|
|
9591
|
-
const {
|
|
9592
|
-
theme
|
|
9593
|
-
} = useTheme();
|
|
9594
|
-
return jsx("button", Object.assign({
|
|
9595
|
-
type: 'button',
|
|
9596
|
-
className: `${copyBtn({
|
|
9597
|
-
theme
|
|
9598
|
-
})} ${className !== null && className !== void 0 ? className : ''} hover:cursor-pointer`,
|
|
9599
|
-
onClick: e => {
|
|
9600
|
-
e.stopPropagation();
|
|
9601
|
-
e.preventDefault();
|
|
9602
|
-
copyToClipboard(text, onCopy);
|
|
9629
|
+
// src/primitive.tsx
|
|
9630
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
9631
|
+
return function handleEvent(event) {
|
|
9632
|
+
originalEventHandler?.(event);
|
|
9633
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
9634
|
+
return ourEventHandler?.(event);
|
|
9603
9635
|
}
|
|
9604
|
-
}
|
|
9605
|
-
|
|
9606
|
-
className: 'w-4 h-4 transition',
|
|
9607
|
-
color: theme === 'light' ? '#000000' : '#ffffff'
|
|
9608
|
-
})
|
|
9609
|
-
}));
|
|
9610
|
-
};
|
|
9636
|
+
};
|
|
9637
|
+
}
|
|
9611
9638
|
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
true: 'overflow-hidden'
|
|
9622
|
-
},
|
|
9623
|
-
highlight: {
|
|
9624
|
-
default: '',
|
|
9625
|
-
dim: '',
|
|
9626
|
-
highlight: '',
|
|
9627
|
-
first: '',
|
|
9628
|
-
last: '',
|
|
9629
|
-
both: ''
|
|
9630
|
-
}
|
|
9631
|
-
},
|
|
9632
|
-
defaultVariants: {
|
|
9633
|
-
theme: 'light',
|
|
9634
|
-
ellipsis: false,
|
|
9635
|
-
highlight: 'default'
|
|
9636
|
-
}
|
|
9639
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
9640
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
9641
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
9642
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
9643
|
+
var originalBodyPointerEvents;
|
|
9644
|
+
var DismissableLayerContext = React.createContext({
|
|
9645
|
+
layers: /* @__PURE__ */ new Set(),
|
|
9646
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
9647
|
+
branches: /* @__PURE__ */ new Set()
|
|
9637
9648
|
});
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9649
|
+
var DismissableLayer = React.forwardRef(
|
|
9650
|
+
(props, forwardedRef) => {
|
|
9651
|
+
const {
|
|
9652
|
+
disableOutsidePointerEvents = false,
|
|
9653
|
+
onEscapeKeyDown,
|
|
9654
|
+
onPointerDownOutside,
|
|
9655
|
+
onFocusOutside,
|
|
9656
|
+
onInteractOutside,
|
|
9657
|
+
onDismiss,
|
|
9658
|
+
...layerProps
|
|
9659
|
+
} = props;
|
|
9660
|
+
const context = React.useContext(DismissableLayerContext);
|
|
9661
|
+
const [node, setNode] = React.useState(null);
|
|
9662
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
9663
|
+
const [, force] = React.useState({});
|
|
9664
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
9665
|
+
const layers = Array.from(context.layers);
|
|
9666
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
9667
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
9668
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
9669
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
9670
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
9671
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
9672
|
+
const target = event.target;
|
|
9673
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
9674
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
9675
|
+
onPointerDownOutside?.(event);
|
|
9676
|
+
onInteractOutside?.(event);
|
|
9677
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
9678
|
+
}, ownerDocument);
|
|
9679
|
+
const focusOutside = useFocusOutside((event) => {
|
|
9680
|
+
const target = event.target;
|
|
9681
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
9682
|
+
if (isFocusInBranch) return;
|
|
9683
|
+
onFocusOutside?.(event);
|
|
9684
|
+
onInteractOutside?.(event);
|
|
9685
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
9686
|
+
}, ownerDocument);
|
|
9687
|
+
useEscapeKeydown((event) => {
|
|
9688
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
9689
|
+
if (!isHighestLayer) return;
|
|
9690
|
+
onEscapeKeyDown?.(event);
|
|
9691
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
9692
|
+
event.preventDefault();
|
|
9693
|
+
onDismiss();
|
|
9694
|
+
}
|
|
9695
|
+
}, ownerDocument);
|
|
9696
|
+
React.useEffect(() => {
|
|
9697
|
+
if (!node) return;
|
|
9698
|
+
if (disableOutsidePointerEvents) {
|
|
9699
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
9700
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
9701
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
9702
|
+
}
|
|
9703
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
9704
|
+
}
|
|
9705
|
+
context.layers.add(node);
|
|
9706
|
+
dispatchUpdate();
|
|
9707
|
+
return () => {
|
|
9708
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
9709
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
9710
|
+
}
|
|
9711
|
+
};
|
|
9712
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
9713
|
+
React.useEffect(() => {
|
|
9714
|
+
return () => {
|
|
9715
|
+
if (!node) return;
|
|
9716
|
+
context.layers.delete(node);
|
|
9717
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
9718
|
+
dispatchUpdate();
|
|
9719
|
+
};
|
|
9720
|
+
}, [node, context]);
|
|
9721
|
+
React.useEffect(() => {
|
|
9722
|
+
const handleUpdate = () => force({});
|
|
9723
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
9724
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
9725
|
+
}, []);
|
|
9726
|
+
return /* @__PURE__ */ jsx(
|
|
9727
|
+
Primitive.div,
|
|
9728
|
+
{
|
|
9729
|
+
...layerProps,
|
|
9730
|
+
ref: composedRefs,
|
|
9731
|
+
style: {
|
|
9732
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
9733
|
+
...props.style
|
|
9734
|
+
},
|
|
9735
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
9736
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
9737
|
+
onPointerDownCapture: composeEventHandlers(
|
|
9738
|
+
props.onPointerDownCapture,
|
|
9739
|
+
pointerDownOutside.onPointerDownCapture
|
|
9740
|
+
)
|
|
9741
|
+
}
|
|
9742
|
+
);
|
|
9743
|
+
}
|
|
9744
|
+
);
|
|
9745
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
9746
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
9747
|
+
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
9748
|
+
const context = React.useContext(DismissableLayerContext);
|
|
9749
|
+
const ref = React.useRef(null);
|
|
9750
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
9751
|
+
React.useEffect(() => {
|
|
9752
|
+
const node = ref.current;
|
|
9753
|
+
if (node) {
|
|
9754
|
+
context.branches.add(node);
|
|
9755
|
+
return () => {
|
|
9756
|
+
context.branches.delete(node);
|
|
9757
|
+
};
|
|
9758
|
+
}
|
|
9759
|
+
}, [context.branches]);
|
|
9760
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
9761
|
+
});
|
|
9762
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
9763
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
9764
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
9765
|
+
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
9766
|
+
const handleClickRef = React.useRef(() => {
|
|
9767
|
+
});
|
|
9768
|
+
React.useEffect(() => {
|
|
9769
|
+
const handlePointerDown = (event) => {
|
|
9770
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
9771
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
9772
|
+
handleAndDispatchCustomEvent(
|
|
9773
|
+
POINTER_DOWN_OUTSIDE,
|
|
9774
|
+
handlePointerDownOutside,
|
|
9775
|
+
eventDetail,
|
|
9776
|
+
{ discrete: true }
|
|
9777
|
+
);
|
|
9778
|
+
};
|
|
9779
|
+
const eventDetail = { originalEvent: event };
|
|
9780
|
+
if (event.pointerType === "touch") {
|
|
9781
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
9782
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
9783
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
9784
|
+
} else {
|
|
9785
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
9786
|
+
}
|
|
9787
|
+
} else {
|
|
9788
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
9789
|
+
}
|
|
9790
|
+
isPointerInsideReactTreeRef.current = false;
|
|
9791
|
+
};
|
|
9792
|
+
const timerId = window.setTimeout(() => {
|
|
9793
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
9794
|
+
}, 0);
|
|
9795
|
+
return () => {
|
|
9796
|
+
window.clearTimeout(timerId);
|
|
9797
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
9798
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
9799
|
+
};
|
|
9800
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
9801
|
+
return {
|
|
9802
|
+
// ensures we check React component tree (not just DOM tree)
|
|
9803
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
9804
|
+
};
|
|
9805
|
+
}
|
|
9806
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
9807
|
+
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
9808
|
+
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
9809
|
+
React.useEffect(() => {
|
|
9810
|
+
const handleFocus = (event) => {
|
|
9811
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
9812
|
+
const eventDetail = { originalEvent: event };
|
|
9813
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
9814
|
+
discrete: false
|
|
9815
|
+
});
|
|
9816
|
+
}
|
|
9817
|
+
};
|
|
9818
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
9819
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
9820
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
9821
|
+
return {
|
|
9822
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
9823
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
9824
|
+
};
|
|
9825
|
+
}
|
|
9826
|
+
function dispatchUpdate() {
|
|
9827
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
9828
|
+
document.dispatchEvent(event);
|
|
9829
|
+
}
|
|
9830
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
9831
|
+
const target = detail.originalEvent.target;
|
|
9832
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
9833
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
9834
|
+
if (discrete) {
|
|
9835
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
9836
|
+
} else {
|
|
9837
|
+
target.dispatchEvent(event);
|
|
9838
|
+
}
|
|
9839
|
+
}
|
|
9840
|
+
|
|
9841
|
+
var count = 0;
|
|
9842
|
+
function useFocusGuards() {
|
|
9843
|
+
React.useEffect(() => {
|
|
9844
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
9845
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
9846
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
9847
|
+
count++;
|
|
9848
|
+
return () => {
|
|
9849
|
+
if (count === 1) {
|
|
9850
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
9851
|
+
}
|
|
9852
|
+
count--;
|
|
9853
|
+
};
|
|
9854
|
+
}, []);
|
|
9855
|
+
}
|
|
9856
|
+
function createFocusGuard() {
|
|
9857
|
+
const element = document.createElement("span");
|
|
9858
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
9859
|
+
element.tabIndex = 0;
|
|
9860
|
+
element.style.outline = "none";
|
|
9861
|
+
element.style.opacity = "0";
|
|
9862
|
+
element.style.position = "fixed";
|
|
9863
|
+
element.style.pointerEvents = "none";
|
|
9864
|
+
return element;
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9867
|
+
var POPPER_NAME = "Popper";
|
|
9868
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
9869
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
9870
|
+
var Popper = (props) => {
|
|
9871
|
+
const { __scopePopper, children } = props;
|
|
9872
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
9873
|
+
return /* @__PURE__ */ jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
9874
|
+
};
|
|
9875
|
+
Popper.displayName = POPPER_NAME;
|
|
9876
|
+
var ANCHOR_NAME$1 = "PopperAnchor";
|
|
9877
|
+
var PopperAnchor = React.forwardRef(
|
|
9878
|
+
(props, forwardedRef) => {
|
|
9879
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
9880
|
+
const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
|
|
9881
|
+
const ref = React.useRef(null);
|
|
9882
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
9883
|
+
const anchorRef = React.useRef(null);
|
|
9884
|
+
React.useEffect(() => {
|
|
9885
|
+
const previousAnchor = anchorRef.current;
|
|
9886
|
+
anchorRef.current = virtualRef?.current || ref.current;
|
|
9887
|
+
if (previousAnchor !== anchorRef.current) {
|
|
9888
|
+
context.onAnchorChange(anchorRef.current);
|
|
9889
|
+
}
|
|
9890
|
+
});
|
|
9891
|
+
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
9892
|
+
}
|
|
9893
|
+
);
|
|
9894
|
+
PopperAnchor.displayName = ANCHOR_NAME$1;
|
|
9895
|
+
var CONTENT_NAME$3 = "PopperContent";
|
|
9896
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$3);
|
|
9897
|
+
var PopperContent = React.forwardRef(
|
|
9898
|
+
(props, forwardedRef) => {
|
|
9899
|
+
const {
|
|
9900
|
+
__scopePopper,
|
|
9901
|
+
side = "bottom",
|
|
9902
|
+
sideOffset = 0,
|
|
9903
|
+
align = "center",
|
|
9904
|
+
alignOffset = 0,
|
|
9905
|
+
arrowPadding = 0,
|
|
9906
|
+
avoidCollisions = true,
|
|
9907
|
+
collisionBoundary = [],
|
|
9908
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
9909
|
+
sticky = "partial",
|
|
9910
|
+
hideWhenDetached = false,
|
|
9911
|
+
updatePositionStrategy = "optimized",
|
|
9912
|
+
onPlaced,
|
|
9913
|
+
...contentProps
|
|
9914
|
+
} = props;
|
|
9915
|
+
const context = usePopperContext(CONTENT_NAME$3, __scopePopper);
|
|
9916
|
+
const [content, setContent] = React.useState(null);
|
|
9917
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
9918
|
+
const [arrow$1, setArrow] = React.useState(null);
|
|
9919
|
+
const arrowSize = useSize(arrow$1);
|
|
9920
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
9921
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
9922
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
9923
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
9924
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
9925
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
9926
|
+
const detectOverflowOptions = {
|
|
9927
|
+
padding: collisionPadding,
|
|
9928
|
+
boundary: boundary.filter(isNotNull),
|
|
9929
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
9930
|
+
altBoundary: hasExplicitBoundaries
|
|
9931
|
+
};
|
|
9932
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
9933
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
9934
|
+
strategy: "fixed",
|
|
9935
|
+
placement: desiredPlacement,
|
|
9936
|
+
whileElementsMounted: (...args) => {
|
|
9937
|
+
const cleanup = autoUpdate(...args, {
|
|
9938
|
+
animationFrame: updatePositionStrategy === "always"
|
|
9939
|
+
});
|
|
9940
|
+
return cleanup;
|
|
9941
|
+
},
|
|
9942
|
+
elements: {
|
|
9943
|
+
reference: context.anchor
|
|
9944
|
+
},
|
|
9945
|
+
middleware: [
|
|
9946
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
9947
|
+
avoidCollisions && shift({
|
|
9948
|
+
mainAxis: true,
|
|
9949
|
+
crossAxis: false,
|
|
9950
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
9951
|
+
...detectOverflowOptions
|
|
9952
|
+
}),
|
|
9953
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
9954
|
+
size({
|
|
9955
|
+
...detectOverflowOptions,
|
|
9956
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
9957
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
9958
|
+
const contentStyle = elements.floating.style;
|
|
9959
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
9960
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
9961
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
9962
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
9963
|
+
}
|
|
9964
|
+
}),
|
|
9965
|
+
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
9966
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
9967
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
9968
|
+
]
|
|
9969
|
+
});
|
|
9970
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
9971
|
+
const handlePlaced = useCallbackRef$1(onPlaced);
|
|
9972
|
+
useLayoutEffect2(() => {
|
|
9973
|
+
if (isPositioned) {
|
|
9974
|
+
handlePlaced?.();
|
|
9975
|
+
}
|
|
9976
|
+
}, [isPositioned, handlePlaced]);
|
|
9977
|
+
const arrowX = middlewareData.arrow?.x;
|
|
9978
|
+
const arrowY = middlewareData.arrow?.y;
|
|
9979
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
9980
|
+
const [contentZIndex, setContentZIndex] = React.useState();
|
|
9981
|
+
useLayoutEffect2(() => {
|
|
9982
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
9983
|
+
}, [content]);
|
|
9984
|
+
return /* @__PURE__ */ jsx(
|
|
9985
|
+
"div",
|
|
9986
|
+
{
|
|
9987
|
+
ref: refs.setFloating,
|
|
9988
|
+
"data-radix-popper-content-wrapper": "",
|
|
9989
|
+
style: {
|
|
9990
|
+
...floatingStyles,
|
|
9991
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
9992
|
+
// keep off the page when measuring
|
|
9993
|
+
minWidth: "max-content",
|
|
9994
|
+
zIndex: contentZIndex,
|
|
9995
|
+
["--radix-popper-transform-origin"]: [
|
|
9996
|
+
middlewareData.transformOrigin?.x,
|
|
9997
|
+
middlewareData.transformOrigin?.y
|
|
9998
|
+
].join(" "),
|
|
9999
|
+
// hide the content if using the hide middleware and should be hidden
|
|
10000
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
10001
|
+
// as if the PopperContent isn't there at all
|
|
10002
|
+
...middlewareData.hide?.referenceHidden && {
|
|
10003
|
+
visibility: "hidden",
|
|
10004
|
+
pointerEvents: "none"
|
|
10005
|
+
}
|
|
10006
|
+
},
|
|
10007
|
+
dir: props.dir,
|
|
10008
|
+
children: /* @__PURE__ */ jsx(
|
|
10009
|
+
PopperContentProvider,
|
|
10010
|
+
{
|
|
10011
|
+
scope: __scopePopper,
|
|
10012
|
+
placedSide,
|
|
10013
|
+
onArrowChange: setArrow,
|
|
10014
|
+
arrowX,
|
|
10015
|
+
arrowY,
|
|
10016
|
+
shouldHideArrow: cannotCenterArrow,
|
|
10017
|
+
children: /* @__PURE__ */ jsx(
|
|
10018
|
+
Primitive.div,
|
|
10019
|
+
{
|
|
10020
|
+
"data-side": placedSide,
|
|
10021
|
+
"data-align": placedAlign,
|
|
10022
|
+
...contentProps,
|
|
10023
|
+
ref: composedRefs,
|
|
10024
|
+
style: {
|
|
10025
|
+
...contentProps.style,
|
|
10026
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
10027
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
10028
|
+
animation: !isPositioned ? "none" : void 0
|
|
10029
|
+
}
|
|
10030
|
+
}
|
|
10031
|
+
)
|
|
10032
|
+
}
|
|
10033
|
+
)
|
|
10034
|
+
}
|
|
10035
|
+
);
|
|
10036
|
+
}
|
|
10037
|
+
);
|
|
10038
|
+
PopperContent.displayName = CONTENT_NAME$3;
|
|
10039
|
+
var ARROW_NAME$1 = "PopperArrow";
|
|
10040
|
+
var OPPOSITE_SIDE = {
|
|
10041
|
+
top: "bottom",
|
|
10042
|
+
right: "left",
|
|
10043
|
+
bottom: "top",
|
|
10044
|
+
left: "right"
|
|
10045
|
+
};
|
|
10046
|
+
var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
10047
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
10048
|
+
const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
|
|
10049
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
10050
|
+
return (
|
|
10051
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
10052
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
10053
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
10054
|
+
/* @__PURE__ */ jsx(
|
|
10055
|
+
"span",
|
|
10056
|
+
{
|
|
10057
|
+
ref: contentContext.onArrowChange,
|
|
10058
|
+
style: {
|
|
10059
|
+
position: "absolute",
|
|
10060
|
+
left: contentContext.arrowX,
|
|
10061
|
+
top: contentContext.arrowY,
|
|
10062
|
+
[baseSide]: 0,
|
|
10063
|
+
transformOrigin: {
|
|
10064
|
+
top: "",
|
|
10065
|
+
right: "0 0",
|
|
10066
|
+
bottom: "center 0",
|
|
10067
|
+
left: "100% 0"
|
|
10068
|
+
}[contentContext.placedSide],
|
|
10069
|
+
transform: {
|
|
10070
|
+
top: "translateY(100%)",
|
|
10071
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
10072
|
+
bottom: `rotate(180deg)`,
|
|
10073
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
10074
|
+
}[contentContext.placedSide],
|
|
10075
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
10076
|
+
},
|
|
10077
|
+
children: /* @__PURE__ */ jsx(
|
|
10078
|
+
Root$2,
|
|
10079
|
+
{
|
|
10080
|
+
...arrowProps,
|
|
10081
|
+
ref: forwardedRef,
|
|
10082
|
+
style: {
|
|
10083
|
+
...arrowProps.style,
|
|
10084
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
10085
|
+
display: "block"
|
|
10086
|
+
}
|
|
10087
|
+
}
|
|
10088
|
+
)
|
|
10089
|
+
}
|
|
10090
|
+
)
|
|
10091
|
+
);
|
|
10092
|
+
});
|
|
10093
|
+
PopperArrow.displayName = ARROW_NAME$1;
|
|
10094
|
+
function isNotNull(value) {
|
|
10095
|
+
return value !== null;
|
|
10096
|
+
}
|
|
10097
|
+
var transformOrigin = (options) => ({
|
|
10098
|
+
name: "transformOrigin",
|
|
10099
|
+
options,
|
|
10100
|
+
fn(data) {
|
|
10101
|
+
const { placement, rects, middlewareData } = data;
|
|
10102
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
10103
|
+
const isArrowHidden = cannotCenterArrow;
|
|
10104
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
10105
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
10106
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
10107
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
10108
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
10109
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
10110
|
+
let x = "";
|
|
10111
|
+
let y = "";
|
|
10112
|
+
if (placedSide === "bottom") {
|
|
10113
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
10114
|
+
y = `${-arrowHeight}px`;
|
|
10115
|
+
} else if (placedSide === "top") {
|
|
10116
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
10117
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
10118
|
+
} else if (placedSide === "right") {
|
|
10119
|
+
x = `${-arrowHeight}px`;
|
|
10120
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
10121
|
+
} else if (placedSide === "left") {
|
|
10122
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
10123
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
10124
|
+
}
|
|
10125
|
+
return { data: { x, y } };
|
|
10126
|
+
}
|
|
10127
|
+
});
|
|
10128
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
10129
|
+
const [side, align = "center"] = placement.split("-");
|
|
10130
|
+
return [side, align];
|
|
10131
|
+
}
|
|
10132
|
+
var Root2$2 = Popper;
|
|
10133
|
+
var Anchor = PopperAnchor;
|
|
10134
|
+
var Content$2 = PopperContent;
|
|
10135
|
+
var Arrow = PopperArrow;
|
|
10136
|
+
|
|
10137
|
+
function useStateMachine$1(initialState, machine) {
|
|
10138
|
+
return React.useReducer((state, event) => {
|
|
10139
|
+
const nextState = machine[state][event];
|
|
10140
|
+
return nextState ?? state;
|
|
10141
|
+
}, initialState);
|
|
10142
|
+
}
|
|
10143
|
+
|
|
10144
|
+
// src/presence.tsx
|
|
10145
|
+
var Presence$1 = (props) => {
|
|
10146
|
+
const { present, children } = props;
|
|
10147
|
+
const presence = usePresence$1(present);
|
|
10148
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
10149
|
+
const ref = useComposedRefs(presence.ref, getElementRef$1(child));
|
|
10150
|
+
const forceMount = typeof children === "function";
|
|
10151
|
+
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
10152
|
+
};
|
|
10153
|
+
Presence$1.displayName = "Presence";
|
|
10154
|
+
function usePresence$1(present) {
|
|
10155
|
+
const [node, setNode] = React.useState();
|
|
10156
|
+
const stylesRef = React.useRef(null);
|
|
10157
|
+
const prevPresentRef = React.useRef(present);
|
|
10158
|
+
const prevAnimationNameRef = React.useRef("none");
|
|
10159
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
10160
|
+
const [state, send] = useStateMachine$1(initialState, {
|
|
10161
|
+
mounted: {
|
|
10162
|
+
UNMOUNT: "unmounted",
|
|
10163
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
10164
|
+
},
|
|
10165
|
+
unmountSuspended: {
|
|
10166
|
+
MOUNT: "mounted",
|
|
10167
|
+
ANIMATION_END: "unmounted"
|
|
10168
|
+
},
|
|
10169
|
+
unmounted: {
|
|
10170
|
+
MOUNT: "mounted"
|
|
10171
|
+
}
|
|
10172
|
+
});
|
|
10173
|
+
React.useEffect(() => {
|
|
10174
|
+
const currentAnimationName = getAnimationName$1(stylesRef.current);
|
|
10175
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
10176
|
+
}, [state]);
|
|
10177
|
+
useLayoutEffect2(() => {
|
|
10178
|
+
const styles = stylesRef.current;
|
|
10179
|
+
const wasPresent = prevPresentRef.current;
|
|
10180
|
+
const hasPresentChanged = wasPresent !== present;
|
|
10181
|
+
if (hasPresentChanged) {
|
|
10182
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
10183
|
+
const currentAnimationName = getAnimationName$1(styles);
|
|
10184
|
+
if (present) {
|
|
10185
|
+
send("MOUNT");
|
|
10186
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
10187
|
+
send("UNMOUNT");
|
|
10188
|
+
} else {
|
|
10189
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
10190
|
+
if (wasPresent && isAnimating) {
|
|
10191
|
+
send("ANIMATION_OUT");
|
|
10192
|
+
} else {
|
|
10193
|
+
send("UNMOUNT");
|
|
10194
|
+
}
|
|
10195
|
+
}
|
|
10196
|
+
prevPresentRef.current = present;
|
|
10197
|
+
}
|
|
10198
|
+
}, [present, send]);
|
|
10199
|
+
useLayoutEffect2(() => {
|
|
10200
|
+
if (node) {
|
|
10201
|
+
let timeoutId;
|
|
10202
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
10203
|
+
const handleAnimationEnd = (event) => {
|
|
10204
|
+
const currentAnimationName = getAnimationName$1(stylesRef.current);
|
|
10205
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
10206
|
+
if (event.target === node && isCurrentAnimation) {
|
|
10207
|
+
send("ANIMATION_END");
|
|
10208
|
+
if (!prevPresentRef.current) {
|
|
10209
|
+
const currentFillMode = node.style.animationFillMode;
|
|
10210
|
+
node.style.animationFillMode = "forwards";
|
|
10211
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
10212
|
+
if (node.style.animationFillMode === "forwards") {
|
|
10213
|
+
node.style.animationFillMode = currentFillMode;
|
|
10214
|
+
}
|
|
10215
|
+
});
|
|
10216
|
+
}
|
|
10217
|
+
}
|
|
10218
|
+
};
|
|
10219
|
+
const handleAnimationStart = (event) => {
|
|
10220
|
+
if (event.target === node) {
|
|
10221
|
+
prevAnimationNameRef.current = getAnimationName$1(stylesRef.current);
|
|
10222
|
+
}
|
|
10223
|
+
};
|
|
10224
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
10225
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
10226
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
10227
|
+
return () => {
|
|
10228
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
10229
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
10230
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
10231
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
10232
|
+
};
|
|
10233
|
+
} else {
|
|
10234
|
+
send("ANIMATION_END");
|
|
10235
|
+
}
|
|
10236
|
+
}, [node, send]);
|
|
10237
|
+
return {
|
|
10238
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
10239
|
+
ref: React.useCallback((node2) => {
|
|
10240
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
10241
|
+
setNode(node2);
|
|
10242
|
+
}, [])
|
|
10243
|
+
};
|
|
10244
|
+
}
|
|
10245
|
+
function getAnimationName$1(styles) {
|
|
10246
|
+
return styles?.animationName || "none";
|
|
10247
|
+
}
|
|
10248
|
+
function getElementRef$1(element) {
|
|
10249
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
10250
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10251
|
+
if (mayWarn) {
|
|
10252
|
+
return element.ref;
|
|
10253
|
+
}
|
|
10254
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
10255
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10256
|
+
if (mayWarn) {
|
|
10257
|
+
return element.props.ref;
|
|
10258
|
+
}
|
|
10259
|
+
return element.props.ref || element.ref;
|
|
10260
|
+
}
|
|
10261
|
+
|
|
10262
|
+
var POPOVER_NAME = "Popover";
|
|
10263
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
10264
|
+
createPopperScope
|
|
10265
|
+
]);
|
|
10266
|
+
var usePopperScope = createPopperScope();
|
|
10267
|
+
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
10268
|
+
var Popover = (props) => {
|
|
10269
|
+
const {
|
|
10270
|
+
__scopePopover,
|
|
10271
|
+
children,
|
|
10272
|
+
open: openProp,
|
|
10273
|
+
defaultOpen,
|
|
10274
|
+
onOpenChange,
|
|
10275
|
+
modal = false
|
|
10276
|
+
} = props;
|
|
10277
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
10278
|
+
const triggerRef = React.useRef(null);
|
|
10279
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
10280
|
+
const [open, setOpen] = useControllableState({
|
|
10281
|
+
prop: openProp,
|
|
10282
|
+
defaultProp: defaultOpen ?? false,
|
|
10283
|
+
onChange: onOpenChange,
|
|
10284
|
+
caller: POPOVER_NAME
|
|
10285
|
+
});
|
|
10286
|
+
return /* @__PURE__ */ jsx(Root2$2, { ...popperScope, children: /* @__PURE__ */ jsx(
|
|
10287
|
+
PopoverProvider,
|
|
10288
|
+
{
|
|
10289
|
+
scope: __scopePopover,
|
|
10290
|
+
contentId: useId(),
|
|
10291
|
+
triggerRef,
|
|
10292
|
+
open,
|
|
10293
|
+
onOpenChange: setOpen,
|
|
10294
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
10295
|
+
hasCustomAnchor,
|
|
10296
|
+
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
10297
|
+
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
|
|
10298
|
+
modal,
|
|
10299
|
+
children
|
|
10300
|
+
}
|
|
10301
|
+
) });
|
|
10302
|
+
};
|
|
10303
|
+
Popover.displayName = POPOVER_NAME;
|
|
10304
|
+
var ANCHOR_NAME = "PopoverAnchor";
|
|
10305
|
+
var PopoverAnchor = React.forwardRef(
|
|
10306
|
+
(props, forwardedRef) => {
|
|
10307
|
+
const { __scopePopover, ...anchorProps } = props;
|
|
10308
|
+
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
10309
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
10310
|
+
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
10311
|
+
React.useEffect(() => {
|
|
10312
|
+
onCustomAnchorAdd();
|
|
10313
|
+
return () => onCustomAnchorRemove();
|
|
10314
|
+
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
10315
|
+
return /* @__PURE__ */ jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
10316
|
+
}
|
|
10317
|
+
);
|
|
10318
|
+
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
10319
|
+
var TRIGGER_NAME$2 = "PopoverTrigger";
|
|
10320
|
+
var PopoverTrigger = React.forwardRef(
|
|
10321
|
+
(props, forwardedRef) => {
|
|
10322
|
+
const { __scopePopover, ...triggerProps } = props;
|
|
10323
|
+
const context = usePopoverContext(TRIGGER_NAME$2, __scopePopover);
|
|
10324
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
10325
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
10326
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
10327
|
+
Primitive.button,
|
|
10328
|
+
{
|
|
10329
|
+
type: "button",
|
|
10330
|
+
"aria-haspopup": "dialog",
|
|
10331
|
+
"aria-expanded": context.open,
|
|
10332
|
+
"aria-controls": context.contentId,
|
|
10333
|
+
"data-state": getState$1(context.open),
|
|
10334
|
+
...triggerProps,
|
|
10335
|
+
ref: composedTriggerRef,
|
|
10336
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
10337
|
+
}
|
|
10338
|
+
);
|
|
10339
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
|
|
10340
|
+
}
|
|
10341
|
+
);
|
|
10342
|
+
PopoverTrigger.displayName = TRIGGER_NAME$2;
|
|
10343
|
+
var PORTAL_NAME$1 = "PopoverPortal";
|
|
10344
|
+
var [PortalProvider$1, usePortalContext$1] = createPopoverContext(PORTAL_NAME$1, {
|
|
10345
|
+
forceMount: void 0
|
|
10346
|
+
});
|
|
10347
|
+
var PopoverPortal = (props) => {
|
|
10348
|
+
const { __scopePopover, forceMount, children, container } = props;
|
|
10349
|
+
const context = usePopoverContext(PORTAL_NAME$1, __scopePopover);
|
|
10350
|
+
return /* @__PURE__ */ jsx(PortalProvider$1, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence$1, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$3, { asChild: true, container, children }) }) });
|
|
10351
|
+
};
|
|
10352
|
+
PopoverPortal.displayName = PORTAL_NAME$1;
|
|
10353
|
+
var CONTENT_NAME$2 = "PopoverContent";
|
|
10354
|
+
var PopoverContent = React.forwardRef(
|
|
10355
|
+
(props, forwardedRef) => {
|
|
10356
|
+
const portalContext = usePortalContext$1(CONTENT_NAME$2, props.__scopePopover);
|
|
10357
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
10358
|
+
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
10359
|
+
return /* @__PURE__ */ jsx(Presence$1, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
10360
|
+
}
|
|
10361
|
+
);
|
|
10362
|
+
PopoverContent.displayName = CONTENT_NAME$2;
|
|
10363
|
+
var Slot$1 = createSlot("PopoverContent.RemoveScroll");
|
|
10364
|
+
var PopoverContentModal = React.forwardRef(
|
|
10365
|
+
(props, forwardedRef) => {
|
|
10366
|
+
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
10367
|
+
const contentRef = React.useRef(null);
|
|
10368
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
10369
|
+
const isRightClickOutsideRef = React.useRef(false);
|
|
10370
|
+
React.useEffect(() => {
|
|
10371
|
+
const content = contentRef.current;
|
|
10372
|
+
if (content) return hideOthers(content);
|
|
10373
|
+
}, []);
|
|
10374
|
+
return /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot$1, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
|
|
10375
|
+
PopoverContentImpl,
|
|
10376
|
+
{
|
|
10377
|
+
...props,
|
|
10378
|
+
ref: composedRefs,
|
|
10379
|
+
trapFocus: context.open,
|
|
10380
|
+
disableOutsidePointerEvents: true,
|
|
10381
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
10382
|
+
event.preventDefault();
|
|
10383
|
+
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
10384
|
+
}),
|
|
10385
|
+
onPointerDownOutside: composeEventHandlers(
|
|
10386
|
+
props.onPointerDownOutside,
|
|
10387
|
+
(event) => {
|
|
10388
|
+
const originalEvent = event.detail.originalEvent;
|
|
10389
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
10390
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
10391
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
10392
|
+
},
|
|
10393
|
+
{ checkForDefaultPrevented: false }
|
|
10394
|
+
),
|
|
10395
|
+
onFocusOutside: composeEventHandlers(
|
|
10396
|
+
props.onFocusOutside,
|
|
10397
|
+
(event) => event.preventDefault(),
|
|
10398
|
+
{ checkForDefaultPrevented: false }
|
|
10399
|
+
)
|
|
10400
|
+
}
|
|
10401
|
+
) });
|
|
10402
|
+
}
|
|
10403
|
+
);
|
|
10404
|
+
var PopoverContentNonModal = React.forwardRef(
|
|
10405
|
+
(props, forwardedRef) => {
|
|
10406
|
+
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
10407
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
10408
|
+
const hasPointerDownOutsideRef = React.useRef(false);
|
|
10409
|
+
return /* @__PURE__ */ jsx(
|
|
10410
|
+
PopoverContentImpl,
|
|
10411
|
+
{
|
|
10412
|
+
...props,
|
|
10413
|
+
ref: forwardedRef,
|
|
10414
|
+
trapFocus: false,
|
|
10415
|
+
disableOutsidePointerEvents: false,
|
|
10416
|
+
onCloseAutoFocus: (event) => {
|
|
10417
|
+
props.onCloseAutoFocus?.(event);
|
|
10418
|
+
if (!event.defaultPrevented) {
|
|
10419
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
10420
|
+
event.preventDefault();
|
|
10421
|
+
}
|
|
10422
|
+
hasInteractedOutsideRef.current = false;
|
|
10423
|
+
hasPointerDownOutsideRef.current = false;
|
|
10424
|
+
},
|
|
10425
|
+
onInteractOutside: (event) => {
|
|
10426
|
+
props.onInteractOutside?.(event);
|
|
10427
|
+
if (!event.defaultPrevented) {
|
|
10428
|
+
hasInteractedOutsideRef.current = true;
|
|
10429
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
10430
|
+
hasPointerDownOutsideRef.current = true;
|
|
10431
|
+
}
|
|
10432
|
+
}
|
|
10433
|
+
const target = event.target;
|
|
10434
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
10435
|
+
if (targetIsTrigger) event.preventDefault();
|
|
10436
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
10437
|
+
event.preventDefault();
|
|
10438
|
+
}
|
|
10439
|
+
}
|
|
10440
|
+
}
|
|
10441
|
+
);
|
|
10442
|
+
}
|
|
10443
|
+
);
|
|
10444
|
+
var PopoverContentImpl = React.forwardRef(
|
|
10445
|
+
(props, forwardedRef) => {
|
|
10446
|
+
const {
|
|
10447
|
+
__scopePopover,
|
|
10448
|
+
trapFocus,
|
|
10449
|
+
onOpenAutoFocus,
|
|
10450
|
+
onCloseAutoFocus,
|
|
10451
|
+
disableOutsidePointerEvents,
|
|
10452
|
+
onEscapeKeyDown,
|
|
10453
|
+
onPointerDownOutside,
|
|
10454
|
+
onFocusOutside,
|
|
10455
|
+
onInteractOutside,
|
|
10456
|
+
...contentProps
|
|
10457
|
+
} = props;
|
|
10458
|
+
const context = usePopoverContext(CONTENT_NAME$2, __scopePopover);
|
|
10459
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
10460
|
+
useFocusGuards();
|
|
10461
|
+
return /* @__PURE__ */ jsx(
|
|
10462
|
+
FocusScope,
|
|
10463
|
+
{
|
|
10464
|
+
asChild: true,
|
|
10465
|
+
loop: true,
|
|
10466
|
+
trapped: trapFocus,
|
|
10467
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
10468
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
10469
|
+
children: /* @__PURE__ */ jsx(
|
|
10470
|
+
DismissableLayer,
|
|
10471
|
+
{
|
|
10472
|
+
asChild: true,
|
|
10473
|
+
disableOutsidePointerEvents,
|
|
10474
|
+
onInteractOutside,
|
|
10475
|
+
onEscapeKeyDown,
|
|
10476
|
+
onPointerDownOutside,
|
|
10477
|
+
onFocusOutside,
|
|
10478
|
+
onDismiss: () => context.onOpenChange(false),
|
|
10479
|
+
children: /* @__PURE__ */ jsx(
|
|
10480
|
+
Content$2,
|
|
10481
|
+
{
|
|
10482
|
+
"data-state": getState$1(context.open),
|
|
10483
|
+
role: "dialog",
|
|
10484
|
+
id: context.contentId,
|
|
10485
|
+
...popperScope,
|
|
10486
|
+
...contentProps,
|
|
10487
|
+
ref: forwardedRef,
|
|
10488
|
+
style: {
|
|
10489
|
+
...contentProps.style,
|
|
10490
|
+
// re-namespace exposed content custom properties
|
|
10491
|
+
...{
|
|
10492
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
10493
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
10494
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
10495
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
10496
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
)
|
|
10501
|
+
}
|
|
10502
|
+
)
|
|
10503
|
+
}
|
|
10504
|
+
);
|
|
10505
|
+
}
|
|
10506
|
+
);
|
|
10507
|
+
var CLOSE_NAME$1 = "PopoverClose";
|
|
10508
|
+
var PopoverClose = React.forwardRef(
|
|
10509
|
+
(props, forwardedRef) => {
|
|
10510
|
+
const { __scopePopover, ...closeProps } = props;
|
|
10511
|
+
const context = usePopoverContext(CLOSE_NAME$1, __scopePopover);
|
|
10512
|
+
return /* @__PURE__ */ jsx(
|
|
10513
|
+
Primitive.button,
|
|
10514
|
+
{
|
|
10515
|
+
type: "button",
|
|
10516
|
+
...closeProps,
|
|
10517
|
+
ref: forwardedRef,
|
|
10518
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
10519
|
+
}
|
|
10520
|
+
);
|
|
10521
|
+
}
|
|
10522
|
+
);
|
|
10523
|
+
PopoverClose.displayName = CLOSE_NAME$1;
|
|
10524
|
+
var ARROW_NAME = "PopoverArrow";
|
|
10525
|
+
var PopoverArrow = React.forwardRef(
|
|
10526
|
+
(props, forwardedRef) => {
|
|
10527
|
+
const { __scopePopover, ...arrowProps } = props;
|
|
10528
|
+
const popperScope = usePopperScope(__scopePopover);
|
|
10529
|
+
return /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
10530
|
+
}
|
|
10531
|
+
);
|
|
10532
|
+
PopoverArrow.displayName = ARROW_NAME;
|
|
10533
|
+
function getState$1(open) {
|
|
10534
|
+
return open ? "open" : "closed";
|
|
10535
|
+
}
|
|
10536
|
+
var Root2$1 = Popover;
|
|
10537
|
+
var Trigger$2 = PopoverTrigger;
|
|
10538
|
+
var Portal$1 = PopoverPortal;
|
|
10539
|
+
var Content2 = PopoverContent;
|
|
10540
|
+
var Arrow2 = PopoverArrow;
|
|
10541
|
+
|
|
10542
|
+
/**
|
|
10543
|
+
* Copy a string to the clipboard and invoke a callback with the result.
|
|
10544
|
+
*
|
|
10545
|
+
* @param copyText The text to copy. Defaults to empty string.
|
|
10546
|
+
* @param callback Optional callback that will be called with { status: true } on success,
|
|
10547
|
+
* or { status: false, message: error } on failure.
|
|
10548
|
+
*/
|
|
10549
|
+
function copyToClipboard(copyText = '', callback) {
|
|
10550
|
+
navigator.clipboard.writeText(copyText).then(() => {
|
|
10551
|
+
const result = {
|
|
10552
|
+
status: true
|
|
10553
|
+
};
|
|
10554
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
10555
|
+
}).catch(err => {
|
|
10556
|
+
const result = {
|
|
10557
|
+
status: false,
|
|
10558
|
+
message: err
|
|
10559
|
+
};
|
|
10560
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
10561
|
+
});
|
|
10562
|
+
}
|
|
10563
|
+
|
|
10564
|
+
const copyBtn = cva('p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors', {
|
|
10565
|
+
variants: {
|
|
10566
|
+
theme: {
|
|
10567
|
+
light: 'hover:text-gray-600 active:text-gray-800',
|
|
10568
|
+
dark: 'hover:text-gray-300 active:text-gray-100'
|
|
10569
|
+
}
|
|
10570
|
+
},
|
|
10571
|
+
defaultVariants: {
|
|
10572
|
+
theme: 'light'
|
|
10573
|
+
}
|
|
10574
|
+
});
|
|
10575
|
+
const CopyButton = _a => {
|
|
10576
|
+
var {
|
|
10577
|
+
text,
|
|
10578
|
+
className,
|
|
10579
|
+
onCopy
|
|
10580
|
+
} = _a,
|
|
10581
|
+
props = __rest(_a, ["text", "className", "onCopy"]);
|
|
10582
|
+
const {
|
|
10583
|
+
theme
|
|
10584
|
+
} = useTheme();
|
|
10585
|
+
const [open, setOpen] = useState(false);
|
|
10586
|
+
const handleCopy = e => {
|
|
10587
|
+
e.stopPropagation();
|
|
10588
|
+
e.preventDefault();
|
|
10589
|
+
copyToClipboard(text, onCopy);
|
|
10590
|
+
setOpen(true);
|
|
10591
|
+
setTimeout(() => setOpen(false), 1000);
|
|
10592
|
+
};
|
|
10593
|
+
return jsxs(Root2$1, {
|
|
10594
|
+
open: open,
|
|
10595
|
+
children: [jsx(Trigger$2, {
|
|
10596
|
+
asChild: true,
|
|
10597
|
+
children: jsx("button", Object.assign({
|
|
10598
|
+
type: 'button',
|
|
10599
|
+
className: `${copyBtn({
|
|
10600
|
+
theme
|
|
10601
|
+
})} ${className !== null && className !== void 0 ? className : ''} hover:cursor-pointer`,
|
|
10602
|
+
onClick: handleCopy
|
|
10603
|
+
}, props, {
|
|
10604
|
+
children: jsx(CopyIcon, {
|
|
10605
|
+
className: 'w-4 h-4 transition',
|
|
10606
|
+
color: theme === 'light' ? '#000000' : '#ffffff'
|
|
10607
|
+
})
|
|
10608
|
+
}))
|
|
10609
|
+
}), jsx(Portal$1, {
|
|
10610
|
+
children: jsxs(Content2, {
|
|
10611
|
+
className: 'bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg',
|
|
10612
|
+
side: 'top',
|
|
10613
|
+
sideOffset: 5,
|
|
10614
|
+
children: ["Copied", jsx(Arrow2, {
|
|
10615
|
+
className: 'fill-white'
|
|
10616
|
+
})]
|
|
10617
|
+
})
|
|
10618
|
+
})]
|
|
10619
|
+
});
|
|
10620
|
+
};
|
|
10621
|
+
|
|
10622
|
+
/** CVA for the root container, now with light/dark theme */
|
|
10623
|
+
const identifier = cva('flex items-center font-dash-grotesque text-sm font-normal break-all', {
|
|
10624
|
+
variants: {
|
|
10625
|
+
theme: {
|
|
10626
|
+
light: 'text-gray-900',
|
|
10627
|
+
dark: 'text-white'
|
|
10628
|
+
},
|
|
10629
|
+
ellipsis: {
|
|
10630
|
+
false: '',
|
|
10631
|
+
true: 'overflow-hidden'
|
|
10632
|
+
},
|
|
10633
|
+
highlight: {
|
|
10634
|
+
default: '',
|
|
10635
|
+
dim: '',
|
|
10636
|
+
highlight: '',
|
|
10637
|
+
first: '',
|
|
10638
|
+
last: '',
|
|
10639
|
+
both: ''
|
|
10640
|
+
}
|
|
10641
|
+
},
|
|
10642
|
+
defaultVariants: {
|
|
10643
|
+
theme: 'light',
|
|
10644
|
+
ellipsis: false,
|
|
10645
|
+
highlight: 'default'
|
|
10646
|
+
}
|
|
10647
|
+
});
|
|
10648
|
+
/** CVA for each symbol span: inherits root color or dims */
|
|
10649
|
+
const symbol = cva('flex-1', {
|
|
10650
|
+
variants: {
|
|
10651
|
+
dim: {
|
|
9642
10652
|
false: 'text-inherit',
|
|
9643
10653
|
true: 'text-gray-500'
|
|
9644
10654
|
}
|
|
@@ -10468,7 +11478,7 @@ var DialogTrigger = React.forwardRef(
|
|
|
10468
11478
|
"data-state": getState(context.open),
|
|
10469
11479
|
...triggerProps,
|
|
10470
11480
|
ref: composedTriggerRef,
|
|
10471
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
11481
|
+
onClick: composeEventHandlers$1(props.onClick, context.onOpenToggle)
|
|
10472
11482
|
}
|
|
10473
11483
|
);
|
|
10474
11484
|
}
|
|
@@ -10481,7 +11491,7 @@ var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
|
10481
11491
|
var DialogPortal = (props) => {
|
|
10482
11492
|
const { __scopeDialog, forceMount, children, container } = props;
|
|
10483
11493
|
const context = useDialogContext(PORTAL_NAME, __scopeDialog);
|
|
10484
|
-
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$
|
|
11494
|
+
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$3, { asChild: true, container, children: child }) })) });
|
|
10485
11495
|
};
|
|
10486
11496
|
DialogPortal.displayName = PORTAL_NAME;
|
|
10487
11497
|
var OVERLAY_NAME = "DialogOverlay";
|
|
@@ -10540,17 +11550,17 @@ var DialogContentModal = React.forwardRef(
|
|
|
10540
11550
|
ref: composedRefs,
|
|
10541
11551
|
trapFocus: context.open,
|
|
10542
11552
|
disableOutsidePointerEvents: true,
|
|
10543
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
11553
|
+
onCloseAutoFocus: composeEventHandlers$1(props.onCloseAutoFocus, (event) => {
|
|
10544
11554
|
event.preventDefault();
|
|
10545
11555
|
context.triggerRef.current?.focus();
|
|
10546
11556
|
}),
|
|
10547
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
11557
|
+
onPointerDownOutside: composeEventHandlers$1(props.onPointerDownOutside, (event) => {
|
|
10548
11558
|
const originalEvent = event.detail.originalEvent;
|
|
10549
11559
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
10550
11560
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
10551
11561
|
if (isRightClick) event.preventDefault();
|
|
10552
11562
|
}),
|
|
10553
|
-
onFocusOutside: composeEventHandlers(
|
|
11563
|
+
onFocusOutside: composeEventHandlers$1(
|
|
10554
11564
|
props.onFocusOutside,
|
|
10555
11565
|
(event) => event.preventDefault()
|
|
10556
11566
|
)
|
|
@@ -10604,7 +11614,7 @@ var DialogContentImpl = React.forwardRef(
|
|
|
10604
11614
|
const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
|
|
10605
11615
|
const contentRef = React.useRef(null);
|
|
10606
11616
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
10607
|
-
useFocusGuards();
|
|
11617
|
+
useFocusGuards$1();
|
|
10608
11618
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10609
11619
|
/* @__PURE__ */ jsx(
|
|
10610
11620
|
FocusScope,
|
|
@@ -10615,7 +11625,7 @@ var DialogContentImpl = React.forwardRef(
|
|
|
10615
11625
|
onMountAutoFocus: onOpenAutoFocus,
|
|
10616
11626
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
10617
11627
|
children: /* @__PURE__ */ jsx(
|
|
10618
|
-
DismissableLayer,
|
|
11628
|
+
DismissableLayer$1,
|
|
10619
11629
|
{
|
|
10620
11630
|
role: "dialog",
|
|
10621
11631
|
id: context.contentId,
|
|
@@ -10665,7 +11675,7 @@ var DialogClose = React.forwardRef(
|
|
|
10665
11675
|
type: "button",
|
|
10666
11676
|
...closeProps,
|
|
10667
11677
|
ref: forwardedRef,
|
|
10668
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
11678
|
+
onClick: composeEventHandlers$1(props.onClick, () => context.onOpenChange(false))
|
|
10669
11679
|
}
|
|
10670
11680
|
);
|
|
10671
11681
|
}
|
|
@@ -10959,10 +11969,10 @@ var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
10959
11969
|
...groupProps,
|
|
10960
11970
|
ref: composedRefs,
|
|
10961
11971
|
style: { outline: "none", ...props.style },
|
|
10962
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
11972
|
+
onMouseDown: composeEventHandlers$1(props.onMouseDown, () => {
|
|
10963
11973
|
isClickFocusRef.current = true;
|
|
10964
11974
|
}),
|
|
10965
|
-
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
11975
|
+
onFocus: composeEventHandlers$1(props.onFocus, (event) => {
|
|
10966
11976
|
const isKeyboardFocus = !isClickFocusRef.current;
|
|
10967
11977
|
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
10968
11978
|
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
@@ -10980,7 +11990,7 @@ var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
10980
11990
|
}
|
|
10981
11991
|
isClickFocusRef.current = false;
|
|
10982
11992
|
}),
|
|
10983
|
-
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
11993
|
+
onBlur: composeEventHandlers$1(props.onBlur, () => setIsTabbingBackOut(false))
|
|
10984
11994
|
}
|
|
10985
11995
|
)
|
|
10986
11996
|
}
|
|
@@ -11023,12 +12033,12 @@ var RovingFocusGroupItem = React.forwardRef(
|
|
|
11023
12033
|
"data-orientation": context.orientation,
|
|
11024
12034
|
...itemProps,
|
|
11025
12035
|
ref: forwardedRef,
|
|
11026
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
12036
|
+
onMouseDown: composeEventHandlers$1(props.onMouseDown, (event) => {
|
|
11027
12037
|
if (!focusable) event.preventDefault();
|
|
11028
12038
|
else context.onItemFocus(id);
|
|
11029
12039
|
}),
|
|
11030
|
-
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
11031
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
12040
|
+
onFocus: composeEventHandlers$1(props.onFocus, () => context.onItemFocus(id)),
|
|
12041
|
+
onKeyDown: composeEventHandlers$1(props.onKeyDown, (event) => {
|
|
11032
12042
|
if (event.key === "Tab" && event.shiftKey) {
|
|
11033
12043
|
context.onItemShiftTab();
|
|
11034
12044
|
return;
|
|
@@ -11197,17 +12207,17 @@ var TabsTrigger = React.forwardRef(
|
|
|
11197
12207
|
id: triggerId,
|
|
11198
12208
|
...triggerProps,
|
|
11199
12209
|
ref: forwardedRef,
|
|
11200
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
12210
|
+
onMouseDown: composeEventHandlers$1(props.onMouseDown, (event) => {
|
|
11201
12211
|
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
11202
12212
|
context.onValueChange(value);
|
|
11203
12213
|
} else {
|
|
11204
12214
|
event.preventDefault();
|
|
11205
12215
|
}
|
|
11206
12216
|
}),
|
|
11207
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
12217
|
+
onKeyDown: composeEventHandlers$1(props.onKeyDown, (event) => {
|
|
11208
12218
|
if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
|
|
11209
12219
|
}),
|
|
11210
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
12220
|
+
onFocus: composeEventHandlers$1(props.onFocus, () => {
|
|
11211
12221
|
const isAutomaticActivation = context.activationMode !== "manual";
|
|
11212
12222
|
if (!isSelected && !disabled && isAutomaticActivation) {
|
|
11213
12223
|
context.onValueChange(value);
|
|
@@ -11410,5 +12420,5 @@ const Tabs = ({
|
|
|
11410
12420
|
});
|
|
11411
12421
|
};
|
|
11412
12422
|
|
|
11413
|
-
export { Accordion, ArrowIcon, Avatar, Badge, BigNumber, BroadcastedIcon, BurgerMenuIcon, Button, CalendarIcon, ChainSmallIcon, CheckIcon, CheckmarkIcon, ChevronIcon, CircleProcessIcon, CopyButton, CopyIcon, CreditsIcon, CrossIcon, DashLogo, DateBlock, DeleteIcon, DashDialog as Dialog, EditIcon, ErrorIcon, EyeClosedIcon, EyeOpenIcon, FaceIcon, FilterIcon, FingerprintIcon, Heading, Identifier, Input, KebabMenuIcon, KeyIcon, List$1 as List, LockIcon, NotActive, OverlayMenu, OverlaySelect, PendingIcon, PlusIcon, PooledIcon, ProgressStepBar, ProtectedMessageIcon, QuestionMessageIcon, QueuedIcon, Select, SettingsIcon, ShieldSmallIcon, SignIcon, SignLockIcon, SmartphoneIcon, SuccessIcon, Switch, Tabs, Text, Textarea, ThemeProvider, TimeDelta, TransactionStatusIcon, ValueCard, WalletIcon, WebIcon, useTheme };
|
|
12423
|
+
export { Accordion, ArrowIcon, Avatar, Badge, BigNumber, BroadcastedIcon, BurgerMenuIcon, Button, CalendarIcon, ChainSmallIcon, CheckIcon, CheckmarkIcon, ChevronIcon, CircleProcessIcon, CopyButton, CopyIcon, CreditsIcon, CrossIcon, DashLogo, DateBlock, DeleteIcon, DashDialog as Dialog, EditIcon, ErrorIcon, EyeClosedIcon, EyeOpenIcon, FaceIcon, FilterIcon, FingerprintIcon, Heading, Identifier, Input, KebabMenuIcon, KeyIcon, List$1 as List, LockIcon, NotActive, OverlayMenu, OverlaySelect, PendingIcon, PlusIcon, PooledIcon, ProgressStepBar, ProtectedMessageIcon, QuestionMessageIcon, QueuedIcon, SearchIcon, Select, SettingsIcon, ShieldSmallIcon, SignIcon, SignLockIcon, SmartphoneIcon, SuccessIcon, Switch, Tabs, Text, Textarea, ThemeProvider, TimeDelta, TransactionStatusIcon, ValueCard, WalletIcon, WebIcon, useTheme };
|
|
11414
12424
|
//# sourceMappingURL=index.esm.js.map
|