@sarunyu/system-one 4.9.31 → 4.9.34
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/AGENTS.md +3 -0
- package/DESIGN.md +2 -2
- package/dist/index.cjs +3580 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3579 -166
- package/dist/index.js.map +1 -1
- package/dist/src/components/date-input.d.ts.map +1 -1
- package/dist/src/components/notification.d.ts.map +1 -1
- package/dist/src/components/pagination.d.ts +32 -0
- package/dist/src/components/pagination.d.ts.map +1 -0
- package/dist/src/components/popover.d.ts +41 -0
- package/dist/src/components/popover.d.ts.map +1 -0
- package/dist/src/components/time-input.d.ts.map +1 -1
- package/dist/src/components/tooltip.d.ts +33 -0
- package/dist/src/components/tooltip.d.ts.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/llms.txt +109 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,9 +7,9 @@ const clsx = require("clsx");
|
|
|
7
7
|
const tailwindMerge = require("tailwind-merge");
|
|
8
8
|
const react = require("@phosphor-icons/react");
|
|
9
9
|
const reactDayPicker = require("react-day-picker");
|
|
10
|
-
const
|
|
10
|
+
const PopoverPrimitive = require("@radix-ui/react-popover");
|
|
11
11
|
const vaul = require("vaul");
|
|
12
|
-
const
|
|
12
|
+
const ReactDOM = require("react-dom");
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
15
15
|
if (e) {
|
|
@@ -27,7 +27,8 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
return Object.freeze(n);
|
|
28
28
|
}
|
|
29
29
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
30
|
-
const
|
|
30
|
+
const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
|
|
31
|
+
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
31
32
|
function cn(...inputs) {
|
|
32
33
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
34
|
}
|
|
@@ -74,7 +75,7 @@ const heightClass = {
|
|
|
74
75
|
xl: "h-10"
|
|
75
76
|
// 40px
|
|
76
77
|
};
|
|
77
|
-
function getPaddingClasses(
|
|
78
|
+
function getPaddingClasses(size2, hasLeft, hasRight) {
|
|
78
79
|
const pxMap = {
|
|
79
80
|
xs: { l: "pl-1.5", r: "pr-1.5" },
|
|
80
81
|
// 6px
|
|
@@ -95,8 +96,8 @@ function getPaddingClasses(size, hasLeft, hasRight) {
|
|
|
95
96
|
xl: { l: "pl-3", r: "pr-3" }
|
|
96
97
|
};
|
|
97
98
|
return [
|
|
98
|
-
hasLeft ? reducedMap[
|
|
99
|
-
hasRight ? reducedMap[
|
|
99
|
+
hasLeft ? reducedMap[size2].l : pxMap[size2].l,
|
|
100
|
+
hasRight ? reducedMap[size2].r : pxMap[size2].r
|
|
100
101
|
];
|
|
101
102
|
}
|
|
102
103
|
const iconSizeSpec = {
|
|
@@ -123,7 +124,7 @@ function getVariantClasses(variant, isDisabled) {
|
|
|
123
124
|
return "bg-primary-action text-on-primary-action border border-transparent hover:bg-primary-action-hover active:bg-primary-action-active";
|
|
124
125
|
}
|
|
125
126
|
const Button = React.forwardRef(function Button2({
|
|
126
|
-
size = "md",
|
|
127
|
+
size: size2 = "md",
|
|
127
128
|
variant = "primary",
|
|
128
129
|
children,
|
|
129
130
|
leftIcon,
|
|
@@ -138,7 +139,7 @@ const Button = React.forwardRef(function Button2({
|
|
|
138
139
|
}, ref) {
|
|
139
140
|
const isDisabled = variant === "disabled" || !!disabled;
|
|
140
141
|
const isGhost = variant === "outline-black" || variant === "plain-black";
|
|
141
|
-
const isIconOnly =
|
|
142
|
+
const isIconOnly = size2.startsWith("icon-");
|
|
142
143
|
const [ghostPressed, setGhostPressed] = React.useState(false);
|
|
143
144
|
const needsGhostPress = isGhost && isIconOnly && !isDisabled;
|
|
144
145
|
const ghostPressStyle = needsGhostPress && ghostPressed ? { backgroundColor: "var(--disabled-bg)", color: "var(--disabled)" } : void 0;
|
|
@@ -158,7 +159,7 @@ const Button = React.forwardRef(function Button2({
|
|
|
158
159
|
const cursorClass = isDisabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
159
160
|
const baseClasses = "inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors duration-150 select-none";
|
|
160
161
|
if (isIconOnly) {
|
|
161
|
-
const spec = iconSizeSpec[
|
|
162
|
+
const spec = iconSizeSpec[size2];
|
|
162
163
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
164
|
"button",
|
|
164
165
|
{
|
|
@@ -191,7 +192,7 @@ const Button = React.forwardRef(function Button2({
|
|
|
191
192
|
}
|
|
192
193
|
);
|
|
193
194
|
}
|
|
194
|
-
const labelSize =
|
|
195
|
+
const labelSize = size2;
|
|
195
196
|
const hasLeft = Boolean(leftIcon);
|
|
196
197
|
const hasRight = Boolean(rightIcon);
|
|
197
198
|
const paddingParts = getPaddingClasses(labelSize, hasLeft, hasRight);
|
|
@@ -245,13 +246,13 @@ const Button = React.forwardRef(function Button2({
|
|
|
245
246
|
);
|
|
246
247
|
});
|
|
247
248
|
Button.displayName = "Button";
|
|
248
|
-
function formatCount(
|
|
249
|
-
if (
|
|
250
|
-
return String(
|
|
249
|
+
function formatCount(count2, maxCount) {
|
|
250
|
+
if (count2 > maxCount) return `${maxCount}+`;
|
|
251
|
+
return String(count2);
|
|
251
252
|
}
|
|
252
253
|
function Badge({
|
|
253
254
|
variant = "button",
|
|
254
|
-
count = 0,
|
|
255
|
+
count: count2 = 0,
|
|
255
256
|
maxCount = 99,
|
|
256
257
|
label = "Filter",
|
|
257
258
|
iconOnly = false,
|
|
@@ -260,7 +261,7 @@ function Badge({
|
|
|
260
261
|
className,
|
|
261
262
|
...props
|
|
262
263
|
}) {
|
|
263
|
-
const hasCount =
|
|
264
|
+
const hasCount = count2 > 0;
|
|
264
265
|
const resolvedNotificationState = notificationState ?? (hasCount ? "noti" : "default");
|
|
265
266
|
const notificationIsFilled = resolvedNotificationState === "active" || resolvedNotificationState === "noti";
|
|
266
267
|
const showNotificationDot = resolvedNotificationState === "noti" && hasCount;
|
|
@@ -304,7 +305,7 @@ function Badge({
|
|
|
304
305
|
"absolute flex h-[14px] min-h-[14px] min-w-[14px] items-center justify-center rounded-[60px]",
|
|
305
306
|
variant === "notification" ? "-right-0.5 -top-0.5 bg-destructive px-[2.5px]" : "-right-1 -top-[7px] h-4 min-w-4 bg-primary-action"
|
|
306
307
|
),
|
|
307
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-xs leading-4 font-normal text-text-default-white", children: formatCount(
|
|
308
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-xs leading-4 font-normal text-text-default-white", children: formatCount(count2, maxCount) })
|
|
308
309
|
}
|
|
309
310
|
)
|
|
310
311
|
] });
|
|
@@ -418,7 +419,7 @@ function BannerMedia({ src, alt }) {
|
|
|
418
419
|
}
|
|
419
420
|
function DurationBadge({
|
|
420
421
|
duration,
|
|
421
|
-
size
|
|
422
|
+
size: size2
|
|
422
423
|
}) {
|
|
423
424
|
const isUpcoming = duration === "upcoming";
|
|
424
425
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -426,7 +427,7 @@ function DurationBadge({
|
|
|
426
427
|
{
|
|
427
428
|
className: cn(
|
|
428
429
|
"absolute flex items-center gap-[4px] rounded-[4px] bg-black/60",
|
|
429
|
-
|
|
430
|
+
size2 === "lg" ? "bottom-[6px] right-[6px] h-[20px] px-[4px]" : "bottom-[4px] right-[4px] h-[16px] px-[2px]"
|
|
430
431
|
),
|
|
431
432
|
children: [
|
|
432
433
|
isUpcoming && /* @__PURE__ */ jsxRuntime.jsx(react.BroadcastIcon, { size: 14, className: "text-white" }),
|
|
@@ -435,7 +436,7 @@ function DurationBadge({
|
|
|
435
436
|
{
|
|
436
437
|
className: cn(
|
|
437
438
|
"whitespace-nowrap font-normal text-white",
|
|
438
|
-
|
|
439
|
+
size2 === "lg" ? "text-[14px] leading-[20px]" : "text-[12px] leading-[16px]"
|
|
439
440
|
),
|
|
440
441
|
children: isUpcoming ? "Up Coming" : duration
|
|
441
442
|
}
|
|
@@ -475,15 +476,15 @@ function LockBadgeChip({ flush = false }) {
|
|
|
475
476
|
function LockBadge({
|
|
476
477
|
align = "left",
|
|
477
478
|
flush = false,
|
|
478
|
-
size = "desktop"
|
|
479
|
+
size: size2 = "desktop"
|
|
479
480
|
}) {
|
|
480
481
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
481
482
|
"div",
|
|
482
483
|
{
|
|
483
484
|
className: cn(
|
|
484
485
|
"absolute z-10",
|
|
485
|
-
flush ? "top-0" :
|
|
486
|
-
align === "left" ? flush ? "left-0" :
|
|
486
|
+
flush ? "top-0" : size2 === "mobile" ? "top-[6px]" : "top-[8px]",
|
|
487
|
+
align === "left" ? flush ? "left-0" : size2 === "mobile" ? "left-[6px]" : "left-[8px]" : flush ? "right-0" : size2 === "mobile" ? "right-[6px]" : "right-[8px]"
|
|
487
488
|
),
|
|
488
489
|
children: /* @__PURE__ */ jsxRuntime.jsx(LockBadgeChip, { flush })
|
|
489
490
|
}
|
|
@@ -522,7 +523,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
522
523
|
location,
|
|
523
524
|
showLocation = true,
|
|
524
525
|
showAudience = true,
|
|
525
|
-
count = "200/200",
|
|
526
|
+
count: count2 = "200/200",
|
|
526
527
|
tagStatus = "not-registered",
|
|
527
528
|
// news
|
|
528
529
|
category,
|
|
@@ -535,11 +536,11 @@ const Card = React.forwardRef(function Card2({
|
|
|
535
536
|
duration
|
|
536
537
|
}, ref) {
|
|
537
538
|
const isMobile = useIsMobile();
|
|
538
|
-
const
|
|
539
|
+
const size2 = sizeProp ?? (isMobile ? "mobile" : "desktop");
|
|
539
540
|
const bannerSrc = image ?? "";
|
|
540
541
|
if (variant === "default") {
|
|
541
|
-
const shellPadding =
|
|
542
|
-
const shellRadius =
|
|
542
|
+
const shellPadding = size2 === "desktop" ? "p-4" : "p-3";
|
|
543
|
+
const shellRadius = size2 === "mobile" ? "rounded-[6px]" : "rounded-[8px]";
|
|
543
544
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
545
|
"div",
|
|
545
546
|
{
|
|
@@ -555,7 +556,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
555
556
|
);
|
|
556
557
|
}
|
|
557
558
|
if (variant === "social") {
|
|
558
|
-
const isDesktop =
|
|
559
|
+
const isDesktop = size2 === "desktop";
|
|
559
560
|
const cardWidth = isDesktop ? "w-[587px]" : "w-[343px]";
|
|
560
561
|
const cardPadding = isDesktop ? "p-4" : "p-3";
|
|
561
562
|
const cardGap = isDesktop ? "gap-3" : "gap-2";
|
|
@@ -658,7 +659,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
658
659
|
);
|
|
659
660
|
}
|
|
660
661
|
if (variant === "live") {
|
|
661
|
-
const isDesktop =
|
|
662
|
+
const isDesktop = size2 === "desktop";
|
|
662
663
|
const cardWidth = isDesktop ? "w-[704px]" : "w-[343px]";
|
|
663
664
|
const imgWidth = isDesktop ? "w-[212px]" : "w-[149px]";
|
|
664
665
|
const imgHeight = isDesktop ? "h-[119px]" : "h-[84px]";
|
|
@@ -734,7 +735,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
734
735
|
}
|
|
735
736
|
);
|
|
736
737
|
}
|
|
737
|
-
if (variant === "news" &&
|
|
738
|
+
if (variant === "news" && size2 === "desktop") {
|
|
738
739
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
739
740
|
"div",
|
|
740
741
|
{
|
|
@@ -764,7 +765,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
764
765
|
}
|
|
765
766
|
);
|
|
766
767
|
}
|
|
767
|
-
if (variant === "news" &&
|
|
768
|
+
if (variant === "news" && size2 === "mobile") {
|
|
768
769
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
769
770
|
"div",
|
|
770
771
|
{
|
|
@@ -794,9 +795,9 @@ const Card = React.forwardRef(function Card2({
|
|
|
794
795
|
}
|
|
795
796
|
);
|
|
796
797
|
}
|
|
797
|
-
const widthClass =
|
|
798
|
-
const padding =
|
|
799
|
-
const bannerClass =
|
|
798
|
+
const widthClass = size2 === "desktop" ? "w-[308px]" : size2 === "tablet" ? "w-[224px]" : "w-[163px]";
|
|
799
|
+
const padding = size2 === "desktop" ? "p-4" : size2 === "tablet" ? "p-3" : "p-2.5";
|
|
800
|
+
const bannerClass = size2 === "desktop" ? "h-[173px]" : "aspect-video w-full";
|
|
800
801
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
801
802
|
"div",
|
|
802
803
|
{
|
|
@@ -819,7 +820,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
819
820
|
alt: variant === "news" ? "news banner" : "event banner"
|
|
820
821
|
}
|
|
821
822
|
),
|
|
822
|
-
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, { size })
|
|
823
|
+
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, { size: size2 })
|
|
823
824
|
]
|
|
824
825
|
}
|
|
825
826
|
),
|
|
@@ -837,7 +838,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
837
838
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
839
|
EventContent,
|
|
839
840
|
{
|
|
840
|
-
size,
|
|
841
|
+
size: size2,
|
|
841
842
|
padding,
|
|
842
843
|
title: title ?? "Lorem ipsum dolor sit amet consectetur. Lectus viverraasdasd",
|
|
843
844
|
date: date ?? "23 มิ.ย. 2567",
|
|
@@ -845,7 +846,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
845
846
|
location: location ?? "ณ หอประชุมศาสตราจารย์สังเวียน อินทรวิชัย ชั้น 7 ตลาดหลักทรัพย์แห่งประเทศไทย",
|
|
846
847
|
showLocation,
|
|
847
848
|
showAudience,
|
|
848
|
-
count,
|
|
849
|
+
count: count2,
|
|
849
850
|
tagStatus
|
|
850
851
|
}
|
|
851
852
|
)
|
|
@@ -855,7 +856,7 @@ const Card = React.forwardRef(function Card2({
|
|
|
855
856
|
});
|
|
856
857
|
Card.displayName = "Card";
|
|
857
858
|
function EventContent({
|
|
858
|
-
size,
|
|
859
|
+
size: size2,
|
|
859
860
|
padding,
|
|
860
861
|
title,
|
|
861
862
|
date,
|
|
@@ -863,10 +864,10 @@ function EventContent({
|
|
|
863
864
|
location,
|
|
864
865
|
showLocation,
|
|
865
866
|
showAudience,
|
|
866
|
-
count,
|
|
867
|
+
count: count2,
|
|
867
868
|
tagStatus
|
|
868
869
|
}) {
|
|
869
|
-
const titleGap =
|
|
870
|
+
const titleGap = size2 === "desktop" ? "gap-1.5" : "gap-1";
|
|
870
871
|
const tag = tagConfig[tagStatus];
|
|
871
872
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full shrink-0 bg-card", padding), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full flex-col items-start", titleGap), children: [
|
|
872
873
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-start gap-1", children: [
|
|
@@ -893,7 +894,7 @@ function EventContent({
|
|
|
893
894
|
showAudience && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] w-full items-center gap-1", children: [
|
|
894
895
|
/* @__PURE__ */ jsxRuntime.jsx(react.Users, { size: 16, weight: "regular", color: "var(--subtle-text)" }),
|
|
895
896
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-subtle-text", children: "ผู้เข้าร่วม" }),
|
|
896
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action", children:
|
|
897
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action", children: count2 })
|
|
897
898
|
] })
|
|
898
899
|
] }),
|
|
899
900
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-start", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1204,7 +1205,7 @@ const Toggle = React.forwardRef(function Toggle2({
|
|
|
1204
1205
|
const switchId = idProp ?? generatedId;
|
|
1205
1206
|
const hasText = label !== void 0 || description !== void 0;
|
|
1206
1207
|
const hasDescription = description !== void 0;
|
|
1207
|
-
const
|
|
1208
|
+
const size2 = sizeProp ?? (hasText ? "sm" : "md");
|
|
1208
1209
|
const trackBg = disabled ? checked ? "bg-switch-on-disabled" : "bg-switch-background" : checked ? "bg-primary-action" : "bg-switch-background";
|
|
1209
1210
|
const thumbBg = disabled && !checked ? "bg-switch-background" : "bg-[var(--fill-white-1000)]";
|
|
1210
1211
|
const switchEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1222,7 +1223,7 @@ const Toggle = React.forwardRef(function Toggle2({
|
|
|
1222
1223
|
"relative shrink-0 rounded-full p-0 transition-colors duration-200 ease-out",
|
|
1223
1224
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1224
1225
|
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1225
|
-
trackClass[
|
|
1226
|
+
trackClass[size2],
|
|
1226
1227
|
trackBg
|
|
1227
1228
|
),
|
|
1228
1229
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1232,9 +1233,9 @@ const Toggle = React.forwardRef(function Toggle2({
|
|
|
1232
1233
|
className: cn(
|
|
1233
1234
|
"pointer-events-none absolute rounded-full transition-transform duration-200 ease-out",
|
|
1234
1235
|
"shadow-[var(--toggle-knob-shadow)]",
|
|
1235
|
-
thumbClass[
|
|
1236
|
+
thumbClass[size2],
|
|
1236
1237
|
thumbBg,
|
|
1237
|
-
checked && thumbTranslate[
|
|
1238
|
+
checked && thumbTranslate[size2]
|
|
1238
1239
|
)
|
|
1239
1240
|
}
|
|
1240
1241
|
)
|
|
@@ -1402,13 +1403,13 @@ const multiplePaddingBySize = {
|
|
|
1402
1403
|
const Chip = React.forwardRef(function Chip2({
|
|
1403
1404
|
label = "Chips Text",
|
|
1404
1405
|
type = "single",
|
|
1405
|
-
size = "large",
|
|
1406
|
+
size: size2 = "large",
|
|
1406
1407
|
selected = false,
|
|
1407
1408
|
disabled = false,
|
|
1408
1409
|
onClick,
|
|
1409
1410
|
className
|
|
1410
1411
|
}, ref) {
|
|
1411
|
-
const s = sizeStyles$1[
|
|
1412
|
+
const s = sizeStyles$1[size2];
|
|
1412
1413
|
const isMultiple = type === "multiple";
|
|
1413
1414
|
const state = disabled ? selected ? "selected-disabled" : "disabled" : selected ? "selected" : "default";
|
|
1414
1415
|
const containerClass = state === "selected" ? "bg-primary-action border border-primary-action" : state === "selected-disabled" ? "bg-selected-light-bg border border-transparent" : state === "disabled" ? "bg-disabled-bg border border-transparent" : "bg-background border border-border";
|
|
@@ -1426,7 +1427,7 @@ const Chip = React.forwardRef(function Chip2({
|
|
|
1426
1427
|
className: cn(
|
|
1427
1428
|
"inline-flex items-center justify-center rounded-full whitespace-nowrap border transition-colors",
|
|
1428
1429
|
s.container,
|
|
1429
|
-
isMultiple && multiplePaddingBySize[
|
|
1430
|
+
isMultiple && multiplePaddingBySize[size2],
|
|
1430
1431
|
containerClass,
|
|
1431
1432
|
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1432
1433
|
className
|
|
@@ -1439,6 +1440,51 @@ const Chip = React.forwardRef(function Chip2({
|
|
|
1439
1440
|
);
|
|
1440
1441
|
});
|
|
1441
1442
|
Chip.displayName = "Chip";
|
|
1443
|
+
const PopoverContent = React.forwardRef(({ className, sideOffset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1444
|
+
PopoverPrimitive__namespace.Content,
|
|
1445
|
+
{
|
|
1446
|
+
ref,
|
|
1447
|
+
sideOffset,
|
|
1448
|
+
className: cn(
|
|
1449
|
+
"z-50 rounded-lg border border-border bg-popover p-3 outline-none shadow-popover text-popover-foreground [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1450
|
+
className
|
|
1451
|
+
),
|
|
1452
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
1453
|
+
...props,
|
|
1454
|
+
children
|
|
1455
|
+
}
|
|
1456
|
+
) }));
|
|
1457
|
+
PopoverContent.displayName = "PopoverContent";
|
|
1458
|
+
function Popover({
|
|
1459
|
+
children,
|
|
1460
|
+
content,
|
|
1461
|
+
side = "bottom",
|
|
1462
|
+
align = "start",
|
|
1463
|
+
alignOffset,
|
|
1464
|
+
avoidCollisions,
|
|
1465
|
+
sideOffset = 4,
|
|
1466
|
+
open,
|
|
1467
|
+
onOpenChange,
|
|
1468
|
+
className,
|
|
1469
|
+
contentStyle
|
|
1470
|
+
}) {
|
|
1471
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive__namespace.Root, { open, onOpenChange, children: [
|
|
1472
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { asChild: true, children }),
|
|
1473
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1474
|
+
PopoverContent,
|
|
1475
|
+
{
|
|
1476
|
+
side,
|
|
1477
|
+
align,
|
|
1478
|
+
alignOffset,
|
|
1479
|
+
avoidCollisions,
|
|
1480
|
+
sideOffset,
|
|
1481
|
+
className,
|
|
1482
|
+
style: contentStyle,
|
|
1483
|
+
children: content
|
|
1484
|
+
}
|
|
1485
|
+
)
|
|
1486
|
+
] });
|
|
1487
|
+
}
|
|
1442
1488
|
function Drawer({
|
|
1443
1489
|
...props
|
|
1444
1490
|
}) {
|
|
@@ -2631,36 +2677,23 @@ const DateInput = React.forwardRef(
|
|
|
2631
2677
|
showHeader: false,
|
|
2632
2678
|
rightSide: "none",
|
|
2633
2679
|
contentClassName: "pt-0",
|
|
2634
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto px-4 pt-2 pb-8 w-full", children: [
|
|
2680
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto px-4 pt-2 pb-8 w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
|
|
2635
2681
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerRangeCtx.Provider, { value: mode === "range", children: calendarContent }),
|
|
2636
2682
|
actionButtons
|
|
2637
2683
|
] })
|
|
2638
2684
|
}
|
|
2639
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
2640
|
-
|
|
2685
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2686
|
+
Popover,
|
|
2641
2687
|
{
|
|
2642
2688
|
open,
|
|
2643
2689
|
onOpenChange: handleOpenChange,
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
className: "z-50 rounded-[8px] bg-popover p-3 outline-none text-popover-foreground",
|
|
2652
|
-
style: {
|
|
2653
|
-
boxShadow: "var(--elevation-popover)",
|
|
2654
|
-
border: "1px solid var(--border-default)"
|
|
2655
|
-
},
|
|
2656
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2657
|
-
children: [
|
|
2658
|
-
calendarContent,
|
|
2659
|
-
actionButtons
|
|
2660
|
-
]
|
|
2661
|
-
}
|
|
2662
|
-
) })
|
|
2663
|
-
]
|
|
2690
|
+
align: "start",
|
|
2691
|
+
sideOffset: 4,
|
|
2692
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2693
|
+
calendarContent,
|
|
2694
|
+
actionButtons
|
|
2695
|
+
] }),
|
|
2696
|
+
children: triggerButton
|
|
2664
2697
|
}
|
|
2665
2698
|
),
|
|
2666
2699
|
belowMessage
|
|
@@ -2945,14 +2978,14 @@ const Dropdown = React.forwardRef(
|
|
|
2945
2978
|
]
|
|
2946
2979
|
}
|
|
2947
2980
|
),
|
|
2948
|
-
open && !forceState && options.length > 0 &&
|
|
2981
|
+
open && !forceState && options.length > 0 && ReactDOM.createPortal(
|
|
2949
2982
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2950
2983
|
"div",
|
|
2951
2984
|
{
|
|
2952
2985
|
ref: menuRef,
|
|
2953
2986
|
className: cn(
|
|
2954
2987
|
"bg-popover rounded-lg overflow-clip p-2 flex flex-col items-start text-popover-foreground",
|
|
2955
|
-
filteredOptions.length > 10 && "overflow-y-auto"
|
|
2988
|
+
filteredOptions.length > 10 && "overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
2956
2989
|
),
|
|
2957
2990
|
style: {
|
|
2958
2991
|
...menuStyle,
|
|
@@ -3069,7 +3102,7 @@ function StaticTag({
|
|
|
3069
3102
|
);
|
|
3070
3103
|
}
|
|
3071
3104
|
function OverflowBadge({
|
|
3072
|
-
count,
|
|
3105
|
+
count: count2,
|
|
3073
3106
|
disabled
|
|
3074
3107
|
}) {
|
|
3075
3108
|
const bg = disabled ? "bg-surface-chip-disabled" : "bg-selected-bg";
|
|
@@ -3088,7 +3121,7 @@ function OverflowBadge({
|
|
|
3088
3121
|
style: { color: textColor },
|
|
3089
3122
|
children: [
|
|
3090
3123
|
"+",
|
|
3091
|
-
|
|
3124
|
+
count2
|
|
3092
3125
|
]
|
|
3093
3126
|
}
|
|
3094
3127
|
)
|
|
@@ -3119,36 +3152,36 @@ function useChipLayout(selectedOptions, measureRef, containerRef) {
|
|
|
3119
3152
|
const RIGHT_SECTION_WIDTH = 60;
|
|
3120
3153
|
const budget = containerWidth * 0.72 - RIGHT_SECTION_WIDTH;
|
|
3121
3154
|
let used = 0;
|
|
3122
|
-
let
|
|
3155
|
+
let count2 = 0;
|
|
3123
3156
|
for (let i = 0; i < tagEls.length; i++) {
|
|
3124
3157
|
const w = tagEls[i].offsetWidth;
|
|
3125
|
-
const gap =
|
|
3158
|
+
const gap = count2 > 0 ? TAG_GAP : 0;
|
|
3126
3159
|
const nextUsed = used + gap + w;
|
|
3127
3160
|
if (nextUsed <= budget) {
|
|
3128
3161
|
used = nextUsed;
|
|
3129
|
-
|
|
3162
|
+
count2++;
|
|
3130
3163
|
} else {
|
|
3131
|
-
|
|
3164
|
+
count2++;
|
|
3132
3165
|
break;
|
|
3133
3166
|
}
|
|
3134
3167
|
}
|
|
3135
|
-
|
|
3136
|
-
const overflowCount = total -
|
|
3168
|
+
count2 = Math.max(1, count2);
|
|
3169
|
+
const overflowCount = total - count2;
|
|
3137
3170
|
const isFullWidth = used >= budget * 0.98;
|
|
3138
3171
|
let lastTagMaxWidth;
|
|
3139
3172
|
if (overflowCount > 0 || isFullWidth) {
|
|
3140
|
-
const prevTagsWidth = tagEls.slice(0,
|
|
3173
|
+
const prevTagsWidth = tagEls.slice(0, count2 - 1).reduce(
|
|
3141
3174
|
(sum, el, i) => sum + el.offsetWidth + (i > 0 ? TAG_GAP : 0),
|
|
3142
3175
|
0
|
|
3143
3176
|
);
|
|
3144
|
-
const gapBeforeLast =
|
|
3177
|
+
const gapBeforeLast = count2 > 1 ? TAG_GAP : 0;
|
|
3145
3178
|
const remaining = budget - prevTagsWidth - gapBeforeLast;
|
|
3146
|
-
((_b2 = tagEls[
|
|
3179
|
+
((_b2 = tagEls[count2 - 1]) == null ? void 0 : _b2.offsetWidth) ?? 0;
|
|
3147
3180
|
if (remaining > 0) {
|
|
3148
3181
|
lastTagMaxWidth = remaining;
|
|
3149
3182
|
}
|
|
3150
3183
|
}
|
|
3151
|
-
setLayout({ visibleCount:
|
|
3184
|
+
setLayout({ visibleCount: count2, lastTagMaxWidth });
|
|
3152
3185
|
};
|
|
3153
3186
|
calculate();
|
|
3154
3187
|
(_b = (_a = document.fonts) == null ? void 0 : _a.ready) == null ? void 0 : _b.then(calculate);
|
|
@@ -3518,7 +3551,7 @@ const DropdownMultiple = React.forwardRef(
|
|
|
3518
3551
|
]
|
|
3519
3552
|
}
|
|
3520
3553
|
),
|
|
3521
|
-
open && !isStatic && options.length > 0 &&
|
|
3554
|
+
open && !isStatic && options.length > 0 && ReactDOM.createPortal(
|
|
3522
3555
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3523
3556
|
"div",
|
|
3524
3557
|
{
|
|
@@ -3534,7 +3567,7 @@ const DropdownMultiple = React.forwardRef(
|
|
|
3534
3567
|
{
|
|
3535
3568
|
className: cn(
|
|
3536
3569
|
"w-full flex flex-col",
|
|
3537
|
-
filteredOptions.length > 10 && "overflow-y-auto"
|
|
3570
|
+
filteredOptions.length > 10 && "overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
3538
3571
|
),
|
|
3539
3572
|
style: filteredOptions.length > 10 ? { maxHeight: 10 * 48 } : void 0,
|
|
3540
3573
|
children: filteredOptions.length > 0 ? filteredOptions.map((opt) => {
|
|
@@ -4119,45 +4152,43 @@ const Notification = React.forwardRef(
|
|
|
4119
4152
|
});
|
|
4120
4153
|
onItemClick == null ? void 0 : onItemClick(item);
|
|
4121
4154
|
};
|
|
4122
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
) })
|
|
4160
|
-
] });
|
|
4155
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("inline-flex", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4156
|
+
Popover,
|
|
4157
|
+
{
|
|
4158
|
+
open: resolvedOpen,
|
|
4159
|
+
onOpenChange: handleOpenChange,
|
|
4160
|
+
side: "bottom",
|
|
4161
|
+
align: mobileAlign ? "start" : "end",
|
|
4162
|
+
alignOffset: (mobileAlign == null ? void 0 : mobileAlign.alignOffset) ?? 0,
|
|
4163
|
+
avoidCollisions: !mobileAlign,
|
|
4164
|
+
sideOffset: 10,
|
|
4165
|
+
className: cn("overflow-hidden bg-background shadow-lg p-0", panelClassName),
|
|
4166
|
+
contentStyle: { width: (mobileAlign == null ? void 0 : mobileAlign.width) ?? panelWidth },
|
|
4167
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-[480px] overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
|
|
4168
|
+
!hasItems && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: emptyText }),
|
|
4169
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: group.items.map((item, ii) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4170
|
+
NotificationRow,
|
|
4171
|
+
{
|
|
4172
|
+
item,
|
|
4173
|
+
onItemClick: handleItemClick,
|
|
4174
|
+
hideIndicator: item.id ? clickedItemIds.has(item.id) : false,
|
|
4175
|
+
demoteNewBackground: wasDismissed
|
|
4176
|
+
},
|
|
4177
|
+
item.id ?? `${gi}-${ii}`
|
|
4178
|
+
)) }) }, group.label ?? gi))
|
|
4179
|
+
] }),
|
|
4180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4181
|
+
Badge,
|
|
4182
|
+
{
|
|
4183
|
+
variant: "notification",
|
|
4184
|
+
count: displayCount,
|
|
4185
|
+
maxCount: 99,
|
|
4186
|
+
notificationState: displayCount > 0 ? "noti" : resolvedOpen ? "active" : "default",
|
|
4187
|
+
"aria-label": "Open notifications"
|
|
4188
|
+
}
|
|
4189
|
+
) })
|
|
4190
|
+
}
|
|
4191
|
+
) });
|
|
4161
4192
|
}
|
|
4162
4193
|
);
|
|
4163
4194
|
Notification.displayName = "Notification";
|
|
@@ -4429,7 +4460,7 @@ const SearchInput = React.forwardRef(
|
|
|
4429
4460
|
placeholder = "Placeholder",
|
|
4430
4461
|
value,
|
|
4431
4462
|
onChange,
|
|
4432
|
-
size = "lg",
|
|
4463
|
+
size: size2 = "lg",
|
|
4433
4464
|
className,
|
|
4434
4465
|
onClear
|
|
4435
4466
|
}, ref) {
|
|
@@ -4439,9 +4470,9 @@ const SearchInput = React.forwardRef(
|
|
|
4439
4470
|
const controlled = value !== void 0;
|
|
4440
4471
|
const currentValue = controlled ? value : internalValue;
|
|
4441
4472
|
const isFilled = currentValue.length > 0;
|
|
4442
|
-
const iconSize =
|
|
4443
|
-
const minHeight =
|
|
4444
|
-
const padding =
|
|
4473
|
+
const iconSize = size2 === "lg" ? 24 : 22;
|
|
4474
|
+
const minHeight = size2 === "sm" ? "h-[38px]" : "";
|
|
4475
|
+
const padding = size2 === "sm" ? "px-3.5 py-2" : "px-3.5 py-3";
|
|
4445
4476
|
const borderInset = focused ? "-1px" : "0px";
|
|
4446
4477
|
const borderRad = focused ? "9px" : "8px";
|
|
4447
4478
|
const borderColor = focused ? "var(--primary-action)" : "var(--border-default)";
|
|
@@ -4576,7 +4607,7 @@ function DefaultTabIcon({ className }) {
|
|
|
4576
4607
|
}
|
|
4577
4608
|
const Tab = React.forwardRef(function Tab2({
|
|
4578
4609
|
title = "Tab",
|
|
4579
|
-
size = "md",
|
|
4610
|
+
size: size2 = "md",
|
|
4580
4611
|
active = false,
|
|
4581
4612
|
disabled = false,
|
|
4582
4613
|
onClick,
|
|
@@ -4584,7 +4615,7 @@ const Tab = React.forwardRef(function Tab2({
|
|
|
4584
4615
|
icon,
|
|
4585
4616
|
notification
|
|
4586
4617
|
}, ref) {
|
|
4587
|
-
const s = sizeClasses[
|
|
4618
|
+
const s = sizeClasses[size2] ?? sizeClasses.md;
|
|
4588
4619
|
const hasIcon = Boolean(icon);
|
|
4589
4620
|
const hasNotification = notification !== void 0 && notification !== null;
|
|
4590
4621
|
const renderedIcon = icon === true ? /* @__PURE__ */ jsxRuntime.jsx(DefaultTabIcon, { className: s.iconSize }) : icon;
|
|
@@ -4661,12 +4692,12 @@ const Tab = React.forwardRef(function Tab2({
|
|
|
4661
4692
|
});
|
|
4662
4693
|
Tab.displayName = "Tab";
|
|
4663
4694
|
const TabGroup = React.forwardRef(
|
|
4664
|
-
function TabGroup2({ items = [], activeId, size = "md", onChange, className }, ref) {
|
|
4695
|
+
function TabGroup2({ items = [], activeId, size: size2 = "md", onChange, className }, ref) {
|
|
4665
4696
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "tablist", className: cn("flex", className), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4666
4697
|
Tab,
|
|
4667
4698
|
{
|
|
4668
4699
|
title: item.title,
|
|
4669
|
-
size,
|
|
4700
|
+
size: size2,
|
|
4670
4701
|
active: item.id === activeId,
|
|
4671
4702
|
disabled: item.disabled,
|
|
4672
4703
|
icon: item.icon,
|
|
@@ -4748,7 +4779,7 @@ function CloseIcon({ disabled, className }) {
|
|
|
4748
4779
|
}
|
|
4749
4780
|
const Tag = React.forwardRef(function Tag2({
|
|
4750
4781
|
text = "Tag",
|
|
4751
|
-
size = "large",
|
|
4782
|
+
size: size2 = "large",
|
|
4752
4783
|
state = "default",
|
|
4753
4784
|
variant = "gray",
|
|
4754
4785
|
icon = false,
|
|
@@ -4756,7 +4787,7 @@ const Tag = React.forwardRef(function Tag2({
|
|
|
4756
4787
|
className
|
|
4757
4788
|
}, ref) {
|
|
4758
4789
|
const isDisabled = state === "disabled";
|
|
4759
|
-
const s = sizeStyles[
|
|
4790
|
+
const s = sizeStyles[size2] ?? sizeStyles.large;
|
|
4760
4791
|
const v = variantStyles[variant] ?? variantStyles.gray;
|
|
4761
4792
|
const bgClass = state === "disabled" ? "bg-disabled-bg" : state === "hover" ? "bg-hover-bg" : v.bg;
|
|
4762
4793
|
const textClass = isDisabled ? "text-disabled" : v.text;
|
|
@@ -4915,7 +4946,7 @@ const Table = React.forwardRef(function Table2({ className, responsive = true, .
|
|
|
4915
4946
|
}
|
|
4916
4947
|
);
|
|
4917
4948
|
if (!responsive) return table;
|
|
4918
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TableScrollShadowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "w-full overflow-x-auto", children: table }) });
|
|
4949
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableScrollShadowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "w-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: table }) });
|
|
4919
4950
|
});
|
|
4920
4951
|
const TableRow = React.forwardRef(
|
|
4921
4952
|
function TableRow2({
|
|
@@ -5500,7 +5531,7 @@ function RangeSlotPicker({
|
|
|
5500
5531
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5501
5532
|
"div",
|
|
5502
5533
|
{
|
|
5503
|
-
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden",
|
|
5534
|
+
className: "overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
5504
5535
|
style: { maxHeight: 320, scrollbarWidth: "none", minWidth: 300 },
|
|
5505
5536
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5506
5537
|
"div",
|
|
@@ -5949,37 +5980,24 @@ const TimeInput = React.forwardRef(
|
|
|
5949
5980
|
showHeader: false,
|
|
5950
5981
|
rightSide: "none",
|
|
5951
5982
|
contentClassName: "pt-0",
|
|
5952
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto px-4 pt-2 pb-8 w-full", children: [
|
|
5983
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-auto px-4 pt-2 pb-8 w-full [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
|
|
5953
5984
|
pickerContent,
|
|
5954
5985
|
actionButtons
|
|
5955
5986
|
] })
|
|
5956
5987
|
}
|
|
5957
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
5958
|
-
|
|
5988
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5989
|
+
Popover,
|
|
5959
5990
|
{
|
|
5960
5991
|
open,
|
|
5961
5992
|
onOpenChange: handleOpenChange,
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
style: {
|
|
5971
|
-
boxShadow: "var(--elevation-popover)",
|
|
5972
|
-
border: "1px solid var(--border-default)",
|
|
5973
|
-
minWidth: mode === "single" ? 327 : void 0
|
|
5974
|
-
},
|
|
5975
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
5976
|
-
children: [
|
|
5977
|
-
pickerContent,
|
|
5978
|
-
actionButtons
|
|
5979
|
-
]
|
|
5980
|
-
}
|
|
5981
|
-
) })
|
|
5982
|
-
]
|
|
5993
|
+
align: "start",
|
|
5994
|
+
sideOffset: 4,
|
|
5995
|
+
className: cn("max-w-[340px]", mode === "single" && "min-w-[327px]"),
|
|
5996
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5997
|
+
pickerContent,
|
|
5998
|
+
actionButtons
|
|
5999
|
+
] }),
|
|
6000
|
+
children: triggerButton
|
|
5983
6001
|
}
|
|
5984
6002
|
),
|
|
5985
6003
|
belowMsg
|
|
@@ -6003,14 +6021,14 @@ const SIZE_CONFIG = {
|
|
|
6003
6021
|
};
|
|
6004
6022
|
function Avatar({
|
|
6005
6023
|
type = "photo",
|
|
6006
|
-
size = "m",
|
|
6024
|
+
size: size2 = "m",
|
|
6007
6025
|
status = false,
|
|
6008
6026
|
src,
|
|
6009
6027
|
alt = "",
|
|
6010
6028
|
initials,
|
|
6011
6029
|
className
|
|
6012
6030
|
}) {
|
|
6013
|
-
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG[
|
|
6031
|
+
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG[size2];
|
|
6014
6032
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative inline-flex shrink-0", container, className), children: [
|
|
6015
6033
|
type === "photo" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6016
6034
|
"img",
|
|
@@ -6086,12 +6104,12 @@ function subtractMask(avatarPx, overlapPx) {
|
|
|
6086
6104
|
}
|
|
6087
6105
|
function AvatarStack({
|
|
6088
6106
|
items,
|
|
6089
|
-
size = "small",
|
|
6090
|
-
max = 5,
|
|
6107
|
+
size: size2 = "small",
|
|
6108
|
+
max: max2 = 5,
|
|
6091
6109
|
className
|
|
6092
6110
|
}) {
|
|
6093
|
-
const { avatarSize, avatarPx, overlapPx } = STACK_CONFIG[
|
|
6094
|
-
const visible = items.slice(0,
|
|
6111
|
+
const { avatarSize, avatarPx, overlapPx } = STACK_CONFIG[size2];
|
|
6112
|
+
const visible = items.slice(0, max2);
|
|
6095
6113
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex shrink-0", className), children: visible.map((item, i) => {
|
|
6096
6114
|
const isLast = i === visible.length - 1;
|
|
6097
6115
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6140,6 +6158,3397 @@ function Breadcrumb({ items, className }) {
|
|
|
6140
6158
|
] }, index2);
|
|
6141
6159
|
}) });
|
|
6142
6160
|
}
|
|
6161
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
6162
|
+
return function handleEvent(event) {
|
|
6163
|
+
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
6164
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
6165
|
+
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
6166
|
+
}
|
|
6167
|
+
};
|
|
6168
|
+
}
|
|
6169
|
+
function setRef(ref, value) {
|
|
6170
|
+
if (typeof ref === "function") {
|
|
6171
|
+
return ref(value);
|
|
6172
|
+
} else if (ref !== null && ref !== void 0) {
|
|
6173
|
+
ref.current = value;
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6176
|
+
function composeRefs(...refs) {
|
|
6177
|
+
return (node) => {
|
|
6178
|
+
let hasCleanup = false;
|
|
6179
|
+
const cleanups = refs.map((ref) => {
|
|
6180
|
+
const cleanup = setRef(ref, node);
|
|
6181
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
6182
|
+
hasCleanup = true;
|
|
6183
|
+
}
|
|
6184
|
+
return cleanup;
|
|
6185
|
+
});
|
|
6186
|
+
if (hasCleanup) {
|
|
6187
|
+
return () => {
|
|
6188
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
6189
|
+
const cleanup = cleanups[i];
|
|
6190
|
+
if (typeof cleanup == "function") {
|
|
6191
|
+
cleanup();
|
|
6192
|
+
} else {
|
|
6193
|
+
setRef(refs[i], null);
|
|
6194
|
+
}
|
|
6195
|
+
}
|
|
6196
|
+
};
|
|
6197
|
+
}
|
|
6198
|
+
};
|
|
6199
|
+
}
|
|
6200
|
+
function useComposedRefs(...refs) {
|
|
6201
|
+
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
6202
|
+
}
|
|
6203
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
6204
|
+
let defaultContexts = [];
|
|
6205
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
6206
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
6207
|
+
const index2 = defaultContexts.length;
|
|
6208
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
6209
|
+
const Provider2 = (props) => {
|
|
6210
|
+
var _a;
|
|
6211
|
+
const { scope, children, ...context } = props;
|
|
6212
|
+
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
6213
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
6214
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
6215
|
+
};
|
|
6216
|
+
Provider2.displayName = rootComponentName + "Provider";
|
|
6217
|
+
function useContext2(consumerName, scope) {
|
|
6218
|
+
var _a;
|
|
6219
|
+
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
6220
|
+
const context = React__namespace.useContext(Context);
|
|
6221
|
+
if (context) return context;
|
|
6222
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
6223
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
6224
|
+
}
|
|
6225
|
+
return [Provider2, useContext2];
|
|
6226
|
+
}
|
|
6227
|
+
const createScope = () => {
|
|
6228
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
6229
|
+
return React__namespace.createContext(defaultContext);
|
|
6230
|
+
});
|
|
6231
|
+
return function useScope(scope) {
|
|
6232
|
+
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
6233
|
+
return React__namespace.useMemo(
|
|
6234
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
6235
|
+
[scope, contexts]
|
|
6236
|
+
);
|
|
6237
|
+
};
|
|
6238
|
+
};
|
|
6239
|
+
createScope.scopeName = scopeName;
|
|
6240
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
6241
|
+
}
|
|
6242
|
+
function composeContextScopes(...scopes) {
|
|
6243
|
+
const baseScope = scopes[0];
|
|
6244
|
+
if (scopes.length === 1) return baseScope;
|
|
6245
|
+
const createScope = () => {
|
|
6246
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
6247
|
+
useScope: createScope2(),
|
|
6248
|
+
scopeName: createScope2.scopeName
|
|
6249
|
+
}));
|
|
6250
|
+
return function useComposedScopes(overrideScopes) {
|
|
6251
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
6252
|
+
const scopeProps = useScope(overrideScopes);
|
|
6253
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
6254
|
+
return { ...nextScopes2, ...currentScope };
|
|
6255
|
+
}, {});
|
|
6256
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
6257
|
+
};
|
|
6258
|
+
};
|
|
6259
|
+
createScope.scopeName = baseScope.scopeName;
|
|
6260
|
+
return createScope;
|
|
6261
|
+
}
|
|
6262
|
+
var Slot = React__namespace.forwardRef((props, forwardedRef) => {
|
|
6263
|
+
const { children, ...slotProps } = props;
|
|
6264
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
6265
|
+
const slottable = childrenArray.find(isSlottable);
|
|
6266
|
+
if (slottable) {
|
|
6267
|
+
const newElement = slottable.props.children;
|
|
6268
|
+
const newChildren = childrenArray.map((child) => {
|
|
6269
|
+
if (child === slottable) {
|
|
6270
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
6271
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
6272
|
+
} else {
|
|
6273
|
+
return child;
|
|
6274
|
+
}
|
|
6275
|
+
});
|
|
6276
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
6277
|
+
}
|
|
6278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
6279
|
+
});
|
|
6280
|
+
Slot.displayName = "Slot";
|
|
6281
|
+
var SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
6282
|
+
const { children, ...slotProps } = props;
|
|
6283
|
+
if (React__namespace.isValidElement(children)) {
|
|
6284
|
+
const childrenRef = getElementRef$1(children);
|
|
6285
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
6286
|
+
if (children.type !== React__namespace.Fragment) {
|
|
6287
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
6288
|
+
}
|
|
6289
|
+
return React__namespace.cloneElement(children, props2);
|
|
6290
|
+
}
|
|
6291
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
6292
|
+
});
|
|
6293
|
+
SlotClone.displayName = "SlotClone";
|
|
6294
|
+
var Slottable = ({ children }) => {
|
|
6295
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
6296
|
+
};
|
|
6297
|
+
function isSlottable(child) {
|
|
6298
|
+
return React__namespace.isValidElement(child) && child.type === Slottable;
|
|
6299
|
+
}
|
|
6300
|
+
function mergeProps(slotProps, childProps) {
|
|
6301
|
+
const overrideProps = { ...childProps };
|
|
6302
|
+
for (const propName in childProps) {
|
|
6303
|
+
const slotPropValue = slotProps[propName];
|
|
6304
|
+
const childPropValue = childProps[propName];
|
|
6305
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
6306
|
+
if (isHandler) {
|
|
6307
|
+
if (slotPropValue && childPropValue) {
|
|
6308
|
+
overrideProps[propName] = (...args) => {
|
|
6309
|
+
childPropValue(...args);
|
|
6310
|
+
slotPropValue(...args);
|
|
6311
|
+
};
|
|
6312
|
+
} else if (slotPropValue) {
|
|
6313
|
+
overrideProps[propName] = slotPropValue;
|
|
6314
|
+
}
|
|
6315
|
+
} else if (propName === "style") {
|
|
6316
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
6317
|
+
} else if (propName === "className") {
|
|
6318
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
6319
|
+
}
|
|
6320
|
+
}
|
|
6321
|
+
return { ...slotProps, ...overrideProps };
|
|
6322
|
+
}
|
|
6323
|
+
function getElementRef$1(element) {
|
|
6324
|
+
var _a, _b;
|
|
6325
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
6326
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
6327
|
+
if (mayWarn) {
|
|
6328
|
+
return element.ref;
|
|
6329
|
+
}
|
|
6330
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
6331
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
6332
|
+
if (mayWarn) {
|
|
6333
|
+
return element.props.ref;
|
|
6334
|
+
}
|
|
6335
|
+
return element.props.ref || element.ref;
|
|
6336
|
+
}
|
|
6337
|
+
var NODES = [
|
|
6338
|
+
"a",
|
|
6339
|
+
"button",
|
|
6340
|
+
"div",
|
|
6341
|
+
"form",
|
|
6342
|
+
"h2",
|
|
6343
|
+
"h3",
|
|
6344
|
+
"img",
|
|
6345
|
+
"input",
|
|
6346
|
+
"label",
|
|
6347
|
+
"li",
|
|
6348
|
+
"nav",
|
|
6349
|
+
"ol",
|
|
6350
|
+
"p",
|
|
6351
|
+
"span",
|
|
6352
|
+
"svg",
|
|
6353
|
+
"ul"
|
|
6354
|
+
];
|
|
6355
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
6356
|
+
const Node2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
6357
|
+
const { asChild, ...primitiveProps } = props;
|
|
6358
|
+
const Comp = asChild ? Slot : node;
|
|
6359
|
+
if (typeof window !== "undefined") {
|
|
6360
|
+
window[Symbol.for("radix-ui")] = true;
|
|
6361
|
+
}
|
|
6362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
6363
|
+
});
|
|
6364
|
+
Node2.displayName = `Primitive.${node}`;
|
|
6365
|
+
return { ...primitive, [node]: Node2 };
|
|
6366
|
+
}, {});
|
|
6367
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
6368
|
+
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
6369
|
+
}
|
|
6370
|
+
function useCallbackRef(callback) {
|
|
6371
|
+
const callbackRef = React__namespace.useRef(callback);
|
|
6372
|
+
React__namespace.useEffect(() => {
|
|
6373
|
+
callbackRef.current = callback;
|
|
6374
|
+
});
|
|
6375
|
+
return React__namespace.useMemo(() => (...args) => {
|
|
6376
|
+
var _a;
|
|
6377
|
+
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
6378
|
+
}, []);
|
|
6379
|
+
}
|
|
6380
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
6381
|
+
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
6382
|
+
React__namespace.useEffect(() => {
|
|
6383
|
+
const handleKeyDown = (event) => {
|
|
6384
|
+
if (event.key === "Escape") {
|
|
6385
|
+
onEscapeKeyDown(event);
|
|
6386
|
+
}
|
|
6387
|
+
};
|
|
6388
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
6389
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
6390
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
6391
|
+
}
|
|
6392
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
6393
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
6394
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
6395
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
6396
|
+
var originalBodyPointerEvents;
|
|
6397
|
+
var DismissableLayerContext = React__namespace.createContext({
|
|
6398
|
+
layers: /* @__PURE__ */ new Set(),
|
|
6399
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
6400
|
+
branches: /* @__PURE__ */ new Set()
|
|
6401
|
+
});
|
|
6402
|
+
var DismissableLayer = React__namespace.forwardRef(
|
|
6403
|
+
(props, forwardedRef) => {
|
|
6404
|
+
const {
|
|
6405
|
+
disableOutsidePointerEvents = false,
|
|
6406
|
+
onEscapeKeyDown,
|
|
6407
|
+
onPointerDownOutside,
|
|
6408
|
+
onFocusOutside,
|
|
6409
|
+
onInteractOutside,
|
|
6410
|
+
onDismiss,
|
|
6411
|
+
...layerProps
|
|
6412
|
+
} = props;
|
|
6413
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
6414
|
+
const [node, setNode] = React__namespace.useState(null);
|
|
6415
|
+
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
6416
|
+
const [, force] = React__namespace.useState({});
|
|
6417
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
6418
|
+
const layers = Array.from(context.layers);
|
|
6419
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
6420
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
6421
|
+
const index2 = node ? layers.indexOf(node) : -1;
|
|
6422
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
6423
|
+
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
6424
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
6425
|
+
const target = event.target;
|
|
6426
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
6427
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
6428
|
+
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
6429
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
6430
|
+
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
6431
|
+
}, ownerDocument);
|
|
6432
|
+
const focusOutside = useFocusOutside((event) => {
|
|
6433
|
+
const target = event.target;
|
|
6434
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
6435
|
+
if (isFocusInBranch) return;
|
|
6436
|
+
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
6437
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
6438
|
+
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
6439
|
+
}, ownerDocument);
|
|
6440
|
+
useEscapeKeydown((event) => {
|
|
6441
|
+
const isHighestLayer = index2 === context.layers.size - 1;
|
|
6442
|
+
if (!isHighestLayer) return;
|
|
6443
|
+
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
6444
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
6445
|
+
event.preventDefault();
|
|
6446
|
+
onDismiss();
|
|
6447
|
+
}
|
|
6448
|
+
}, ownerDocument);
|
|
6449
|
+
React__namespace.useEffect(() => {
|
|
6450
|
+
if (!node) return;
|
|
6451
|
+
if (disableOutsidePointerEvents) {
|
|
6452
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
6453
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
6454
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
6455
|
+
}
|
|
6456
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
6457
|
+
}
|
|
6458
|
+
context.layers.add(node);
|
|
6459
|
+
dispatchUpdate();
|
|
6460
|
+
return () => {
|
|
6461
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
6462
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
6463
|
+
}
|
|
6464
|
+
};
|
|
6465
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
6466
|
+
React__namespace.useEffect(() => {
|
|
6467
|
+
return () => {
|
|
6468
|
+
if (!node) return;
|
|
6469
|
+
context.layers.delete(node);
|
|
6470
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
6471
|
+
dispatchUpdate();
|
|
6472
|
+
};
|
|
6473
|
+
}, [node, context]);
|
|
6474
|
+
React__namespace.useEffect(() => {
|
|
6475
|
+
const handleUpdate = () => force({});
|
|
6476
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
6477
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
6478
|
+
}, []);
|
|
6479
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6480
|
+
Primitive.div,
|
|
6481
|
+
{
|
|
6482
|
+
...layerProps,
|
|
6483
|
+
ref: composedRefs,
|
|
6484
|
+
style: {
|
|
6485
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
6486
|
+
...props.style
|
|
6487
|
+
},
|
|
6488
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
6489
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
6490
|
+
onPointerDownCapture: composeEventHandlers(
|
|
6491
|
+
props.onPointerDownCapture,
|
|
6492
|
+
pointerDownOutside.onPointerDownCapture
|
|
6493
|
+
)
|
|
6494
|
+
}
|
|
6495
|
+
);
|
|
6496
|
+
}
|
|
6497
|
+
);
|
|
6498
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
6499
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
6500
|
+
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
6501
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
6502
|
+
const ref = React__namespace.useRef(null);
|
|
6503
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
6504
|
+
React__namespace.useEffect(() => {
|
|
6505
|
+
const node = ref.current;
|
|
6506
|
+
if (node) {
|
|
6507
|
+
context.branches.add(node);
|
|
6508
|
+
return () => {
|
|
6509
|
+
context.branches.delete(node);
|
|
6510
|
+
};
|
|
6511
|
+
}
|
|
6512
|
+
}, [context.branches]);
|
|
6513
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
6514
|
+
});
|
|
6515
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
6516
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
6517
|
+
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
6518
|
+
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
6519
|
+
const handleClickRef = React__namespace.useRef(() => {
|
|
6520
|
+
});
|
|
6521
|
+
React__namespace.useEffect(() => {
|
|
6522
|
+
const handlePointerDown = (event) => {
|
|
6523
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
6524
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
6525
|
+
handleAndDispatchCustomEvent(
|
|
6526
|
+
POINTER_DOWN_OUTSIDE,
|
|
6527
|
+
handlePointerDownOutside,
|
|
6528
|
+
eventDetail,
|
|
6529
|
+
{ discrete: true }
|
|
6530
|
+
);
|
|
6531
|
+
};
|
|
6532
|
+
const eventDetail = { originalEvent: event };
|
|
6533
|
+
if (event.pointerType === "touch") {
|
|
6534
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
6535
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
6536
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
6537
|
+
} else {
|
|
6538
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
6539
|
+
}
|
|
6540
|
+
} else {
|
|
6541
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
6542
|
+
}
|
|
6543
|
+
isPointerInsideReactTreeRef.current = false;
|
|
6544
|
+
};
|
|
6545
|
+
const timerId = window.setTimeout(() => {
|
|
6546
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
6547
|
+
}, 0);
|
|
6548
|
+
return () => {
|
|
6549
|
+
window.clearTimeout(timerId);
|
|
6550
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
6551
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
6552
|
+
};
|
|
6553
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
6554
|
+
return {
|
|
6555
|
+
// ensures we check React component tree (not just DOM tree)
|
|
6556
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
6557
|
+
};
|
|
6558
|
+
}
|
|
6559
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
6560
|
+
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
6561
|
+
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
6562
|
+
React__namespace.useEffect(() => {
|
|
6563
|
+
const handleFocus = (event) => {
|
|
6564
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
6565
|
+
const eventDetail = { originalEvent: event };
|
|
6566
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
6567
|
+
discrete: false
|
|
6568
|
+
});
|
|
6569
|
+
}
|
|
6570
|
+
};
|
|
6571
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
6572
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
6573
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
6574
|
+
return {
|
|
6575
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
6576
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
6577
|
+
};
|
|
6578
|
+
}
|
|
6579
|
+
function dispatchUpdate() {
|
|
6580
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
6581
|
+
document.dispatchEvent(event);
|
|
6582
|
+
}
|
|
6583
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
6584
|
+
const target = detail.originalEvent.target;
|
|
6585
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
6586
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
6587
|
+
if (discrete) {
|
|
6588
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
6589
|
+
} else {
|
|
6590
|
+
target.dispatchEvent(event);
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
|
|
6594
|
+
};
|
|
6595
|
+
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
6596
|
+
var count = 0;
|
|
6597
|
+
function useId(deterministicId) {
|
|
6598
|
+
const [id, setId] = React__namespace.useState(useReactId());
|
|
6599
|
+
useLayoutEffect2(() => {
|
|
6600
|
+
setId((reactId) => reactId ?? String(count++));
|
|
6601
|
+
}, [deterministicId]);
|
|
6602
|
+
return id ? `radix-${id}` : "";
|
|
6603
|
+
}
|
|
6604
|
+
const sides = ["top", "right", "bottom", "left"];
|
|
6605
|
+
const min = Math.min;
|
|
6606
|
+
const max = Math.max;
|
|
6607
|
+
const round = Math.round;
|
|
6608
|
+
const floor = Math.floor;
|
|
6609
|
+
const createCoords = (v) => ({
|
|
6610
|
+
x: v,
|
|
6611
|
+
y: v
|
|
6612
|
+
});
|
|
6613
|
+
const oppositeSideMap = {
|
|
6614
|
+
left: "right",
|
|
6615
|
+
right: "left",
|
|
6616
|
+
bottom: "top",
|
|
6617
|
+
top: "bottom"
|
|
6618
|
+
};
|
|
6619
|
+
function clamp(start, value, end) {
|
|
6620
|
+
return max(start, min(value, end));
|
|
6621
|
+
}
|
|
6622
|
+
function evaluate(value, param) {
|
|
6623
|
+
return typeof value === "function" ? value(param) : value;
|
|
6624
|
+
}
|
|
6625
|
+
function getSide(placement) {
|
|
6626
|
+
return placement.split("-")[0];
|
|
6627
|
+
}
|
|
6628
|
+
function getAlignment(placement) {
|
|
6629
|
+
return placement.split("-")[1];
|
|
6630
|
+
}
|
|
6631
|
+
function getOppositeAxis(axis) {
|
|
6632
|
+
return axis === "x" ? "y" : "x";
|
|
6633
|
+
}
|
|
6634
|
+
function getAxisLength(axis) {
|
|
6635
|
+
return axis === "y" ? "height" : "width";
|
|
6636
|
+
}
|
|
6637
|
+
function getSideAxis(placement) {
|
|
6638
|
+
const firstChar = placement[0];
|
|
6639
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
6640
|
+
}
|
|
6641
|
+
function getAlignmentAxis(placement) {
|
|
6642
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
6643
|
+
}
|
|
6644
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
6645
|
+
if (rtl === void 0) {
|
|
6646
|
+
rtl = false;
|
|
6647
|
+
}
|
|
6648
|
+
const alignment = getAlignment(placement);
|
|
6649
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
6650
|
+
const length = getAxisLength(alignmentAxis);
|
|
6651
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
6652
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
6653
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
6654
|
+
}
|
|
6655
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
6656
|
+
}
|
|
6657
|
+
function getExpandedPlacements(placement) {
|
|
6658
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
6659
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
6660
|
+
}
|
|
6661
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
6662
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
6663
|
+
}
|
|
6664
|
+
const lrPlacement = ["left", "right"];
|
|
6665
|
+
const rlPlacement = ["right", "left"];
|
|
6666
|
+
const tbPlacement = ["top", "bottom"];
|
|
6667
|
+
const btPlacement = ["bottom", "top"];
|
|
6668
|
+
function getSideList(side, isStart, rtl) {
|
|
6669
|
+
switch (side) {
|
|
6670
|
+
case "top":
|
|
6671
|
+
case "bottom":
|
|
6672
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
6673
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
6674
|
+
case "left":
|
|
6675
|
+
case "right":
|
|
6676
|
+
return isStart ? tbPlacement : btPlacement;
|
|
6677
|
+
default:
|
|
6678
|
+
return [];
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
6682
|
+
const alignment = getAlignment(placement);
|
|
6683
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
6684
|
+
if (alignment) {
|
|
6685
|
+
list = list.map((side) => side + "-" + alignment);
|
|
6686
|
+
if (flipAlignment) {
|
|
6687
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6690
|
+
return list;
|
|
6691
|
+
}
|
|
6692
|
+
function getOppositePlacement(placement) {
|
|
6693
|
+
const side = getSide(placement);
|
|
6694
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
6695
|
+
}
|
|
6696
|
+
function expandPaddingObject(padding) {
|
|
6697
|
+
return {
|
|
6698
|
+
top: 0,
|
|
6699
|
+
right: 0,
|
|
6700
|
+
bottom: 0,
|
|
6701
|
+
left: 0,
|
|
6702
|
+
...padding
|
|
6703
|
+
};
|
|
6704
|
+
}
|
|
6705
|
+
function getPaddingObject(padding) {
|
|
6706
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
6707
|
+
top: padding,
|
|
6708
|
+
right: padding,
|
|
6709
|
+
bottom: padding,
|
|
6710
|
+
left: padding
|
|
6711
|
+
};
|
|
6712
|
+
}
|
|
6713
|
+
function rectToClientRect(rect) {
|
|
6714
|
+
const {
|
|
6715
|
+
x,
|
|
6716
|
+
y,
|
|
6717
|
+
width,
|
|
6718
|
+
height
|
|
6719
|
+
} = rect;
|
|
6720
|
+
return {
|
|
6721
|
+
width,
|
|
6722
|
+
height,
|
|
6723
|
+
top: y,
|
|
6724
|
+
left: x,
|
|
6725
|
+
right: x + width,
|
|
6726
|
+
bottom: y + height,
|
|
6727
|
+
x,
|
|
6728
|
+
y
|
|
6729
|
+
};
|
|
6730
|
+
}
|
|
6731
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
6732
|
+
let {
|
|
6733
|
+
reference,
|
|
6734
|
+
floating
|
|
6735
|
+
} = _ref;
|
|
6736
|
+
const sideAxis = getSideAxis(placement);
|
|
6737
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
6738
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
6739
|
+
const side = getSide(placement);
|
|
6740
|
+
const isVertical = sideAxis === "y";
|
|
6741
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
6742
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
6743
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
6744
|
+
let coords;
|
|
6745
|
+
switch (side) {
|
|
6746
|
+
case "top":
|
|
6747
|
+
coords = {
|
|
6748
|
+
x: commonX,
|
|
6749
|
+
y: reference.y - floating.height
|
|
6750
|
+
};
|
|
6751
|
+
break;
|
|
6752
|
+
case "bottom":
|
|
6753
|
+
coords = {
|
|
6754
|
+
x: commonX,
|
|
6755
|
+
y: reference.y + reference.height
|
|
6756
|
+
};
|
|
6757
|
+
break;
|
|
6758
|
+
case "right":
|
|
6759
|
+
coords = {
|
|
6760
|
+
x: reference.x + reference.width,
|
|
6761
|
+
y: commonY
|
|
6762
|
+
};
|
|
6763
|
+
break;
|
|
6764
|
+
case "left":
|
|
6765
|
+
coords = {
|
|
6766
|
+
x: reference.x - floating.width,
|
|
6767
|
+
y: commonY
|
|
6768
|
+
};
|
|
6769
|
+
break;
|
|
6770
|
+
default:
|
|
6771
|
+
coords = {
|
|
6772
|
+
x: reference.x,
|
|
6773
|
+
y: reference.y
|
|
6774
|
+
};
|
|
6775
|
+
}
|
|
6776
|
+
switch (getAlignment(placement)) {
|
|
6777
|
+
case "start":
|
|
6778
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
6779
|
+
break;
|
|
6780
|
+
case "end":
|
|
6781
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
6782
|
+
break;
|
|
6783
|
+
}
|
|
6784
|
+
return coords;
|
|
6785
|
+
}
|
|
6786
|
+
async function detectOverflow(state, options) {
|
|
6787
|
+
var _await$platform$isEle;
|
|
6788
|
+
if (options === void 0) {
|
|
6789
|
+
options = {};
|
|
6790
|
+
}
|
|
6791
|
+
const {
|
|
6792
|
+
x,
|
|
6793
|
+
y,
|
|
6794
|
+
platform: platform2,
|
|
6795
|
+
rects,
|
|
6796
|
+
elements,
|
|
6797
|
+
strategy
|
|
6798
|
+
} = state;
|
|
6799
|
+
const {
|
|
6800
|
+
boundary = "clippingAncestors",
|
|
6801
|
+
rootBoundary = "viewport",
|
|
6802
|
+
elementContext = "floating",
|
|
6803
|
+
altBoundary = false,
|
|
6804
|
+
padding = 0
|
|
6805
|
+
} = evaluate(options, state);
|
|
6806
|
+
const paddingObject = getPaddingObject(padding);
|
|
6807
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
6808
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
6809
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
6810
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
6811
|
+
boundary,
|
|
6812
|
+
rootBoundary,
|
|
6813
|
+
strategy
|
|
6814
|
+
}));
|
|
6815
|
+
const rect = elementContext === "floating" ? {
|
|
6816
|
+
x,
|
|
6817
|
+
y,
|
|
6818
|
+
width: rects.floating.width,
|
|
6819
|
+
height: rects.floating.height
|
|
6820
|
+
} : rects.reference;
|
|
6821
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
6822
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
6823
|
+
x: 1,
|
|
6824
|
+
y: 1
|
|
6825
|
+
} : {
|
|
6826
|
+
x: 1,
|
|
6827
|
+
y: 1
|
|
6828
|
+
};
|
|
6829
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
6830
|
+
elements,
|
|
6831
|
+
rect,
|
|
6832
|
+
offsetParent,
|
|
6833
|
+
strategy
|
|
6834
|
+
}) : rect);
|
|
6835
|
+
return {
|
|
6836
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
6837
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
6838
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
6839
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
6840
|
+
};
|
|
6841
|
+
}
|
|
6842
|
+
const MAX_RESET_COUNT = 50;
|
|
6843
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
6844
|
+
const {
|
|
6845
|
+
placement = "bottom",
|
|
6846
|
+
strategy = "absolute",
|
|
6847
|
+
middleware = [],
|
|
6848
|
+
platform: platform2
|
|
6849
|
+
} = config;
|
|
6850
|
+
const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
|
|
6851
|
+
...platform2,
|
|
6852
|
+
detectOverflow
|
|
6853
|
+
};
|
|
6854
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
6855
|
+
let rects = await platform2.getElementRects({
|
|
6856
|
+
reference,
|
|
6857
|
+
floating,
|
|
6858
|
+
strategy
|
|
6859
|
+
});
|
|
6860
|
+
let {
|
|
6861
|
+
x,
|
|
6862
|
+
y
|
|
6863
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
6864
|
+
let statefulPlacement = placement;
|
|
6865
|
+
let resetCount = 0;
|
|
6866
|
+
const middlewareData = {};
|
|
6867
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
6868
|
+
const currentMiddleware = middleware[i];
|
|
6869
|
+
if (!currentMiddleware) {
|
|
6870
|
+
continue;
|
|
6871
|
+
}
|
|
6872
|
+
const {
|
|
6873
|
+
name,
|
|
6874
|
+
fn
|
|
6875
|
+
} = currentMiddleware;
|
|
6876
|
+
const {
|
|
6877
|
+
x: nextX,
|
|
6878
|
+
y: nextY,
|
|
6879
|
+
data,
|
|
6880
|
+
reset
|
|
6881
|
+
} = await fn({
|
|
6882
|
+
x,
|
|
6883
|
+
y,
|
|
6884
|
+
initialPlacement: placement,
|
|
6885
|
+
placement: statefulPlacement,
|
|
6886
|
+
strategy,
|
|
6887
|
+
middlewareData,
|
|
6888
|
+
rects,
|
|
6889
|
+
platform: platformWithDetectOverflow,
|
|
6890
|
+
elements: {
|
|
6891
|
+
reference,
|
|
6892
|
+
floating
|
|
6893
|
+
}
|
|
6894
|
+
});
|
|
6895
|
+
x = nextX != null ? nextX : x;
|
|
6896
|
+
y = nextY != null ? nextY : y;
|
|
6897
|
+
middlewareData[name] = {
|
|
6898
|
+
...middlewareData[name],
|
|
6899
|
+
...data
|
|
6900
|
+
};
|
|
6901
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
6902
|
+
resetCount++;
|
|
6903
|
+
if (typeof reset === "object") {
|
|
6904
|
+
if (reset.placement) {
|
|
6905
|
+
statefulPlacement = reset.placement;
|
|
6906
|
+
}
|
|
6907
|
+
if (reset.rects) {
|
|
6908
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
6909
|
+
reference,
|
|
6910
|
+
floating,
|
|
6911
|
+
strategy
|
|
6912
|
+
}) : reset.rects;
|
|
6913
|
+
}
|
|
6914
|
+
({
|
|
6915
|
+
x,
|
|
6916
|
+
y
|
|
6917
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
6918
|
+
}
|
|
6919
|
+
i = -1;
|
|
6920
|
+
}
|
|
6921
|
+
}
|
|
6922
|
+
return {
|
|
6923
|
+
x,
|
|
6924
|
+
y,
|
|
6925
|
+
placement: statefulPlacement,
|
|
6926
|
+
strategy,
|
|
6927
|
+
middlewareData
|
|
6928
|
+
};
|
|
6929
|
+
};
|
|
6930
|
+
const arrow$3 = (options) => ({
|
|
6931
|
+
name: "arrow",
|
|
6932
|
+
options,
|
|
6933
|
+
async fn(state) {
|
|
6934
|
+
const {
|
|
6935
|
+
x,
|
|
6936
|
+
y,
|
|
6937
|
+
placement,
|
|
6938
|
+
rects,
|
|
6939
|
+
platform: platform2,
|
|
6940
|
+
elements,
|
|
6941
|
+
middlewareData
|
|
6942
|
+
} = state;
|
|
6943
|
+
const {
|
|
6944
|
+
element,
|
|
6945
|
+
padding = 0
|
|
6946
|
+
} = evaluate(options, state) || {};
|
|
6947
|
+
if (element == null) {
|
|
6948
|
+
return {};
|
|
6949
|
+
}
|
|
6950
|
+
const paddingObject = getPaddingObject(padding);
|
|
6951
|
+
const coords = {
|
|
6952
|
+
x,
|
|
6953
|
+
y
|
|
6954
|
+
};
|
|
6955
|
+
const axis = getAlignmentAxis(placement);
|
|
6956
|
+
const length = getAxisLength(axis);
|
|
6957
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
6958
|
+
const isYAxis = axis === "y";
|
|
6959
|
+
const minProp = isYAxis ? "top" : "left";
|
|
6960
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
6961
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
6962
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
6963
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
6964
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
6965
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
6966
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
6967
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
6968
|
+
}
|
|
6969
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
6970
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
6971
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
6972
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
6973
|
+
const min$1 = minPadding;
|
|
6974
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
6975
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
6976
|
+
const offset2 = clamp(min$1, center, max2);
|
|
6977
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
6978
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
6979
|
+
return {
|
|
6980
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
6981
|
+
data: {
|
|
6982
|
+
[axis]: offset2,
|
|
6983
|
+
centerOffset: center - offset2 - alignmentOffset,
|
|
6984
|
+
...shouldAddOffset && {
|
|
6985
|
+
alignmentOffset
|
|
6986
|
+
}
|
|
6987
|
+
},
|
|
6988
|
+
reset: shouldAddOffset
|
|
6989
|
+
};
|
|
6990
|
+
}
|
|
6991
|
+
});
|
|
6992
|
+
const flip$2 = function(options) {
|
|
6993
|
+
if (options === void 0) {
|
|
6994
|
+
options = {};
|
|
6995
|
+
}
|
|
6996
|
+
return {
|
|
6997
|
+
name: "flip",
|
|
6998
|
+
options,
|
|
6999
|
+
async fn(state) {
|
|
7000
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
7001
|
+
const {
|
|
7002
|
+
placement,
|
|
7003
|
+
middlewareData,
|
|
7004
|
+
rects,
|
|
7005
|
+
initialPlacement,
|
|
7006
|
+
platform: platform2,
|
|
7007
|
+
elements
|
|
7008
|
+
} = state;
|
|
7009
|
+
const {
|
|
7010
|
+
mainAxis: checkMainAxis = true,
|
|
7011
|
+
crossAxis: checkCrossAxis = true,
|
|
7012
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
7013
|
+
fallbackStrategy = "bestFit",
|
|
7014
|
+
fallbackAxisSideDirection = "none",
|
|
7015
|
+
flipAlignment = true,
|
|
7016
|
+
...detectOverflowOptions
|
|
7017
|
+
} = evaluate(options, state);
|
|
7018
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
7019
|
+
return {};
|
|
7020
|
+
}
|
|
7021
|
+
const side = getSide(placement);
|
|
7022
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
7023
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
7024
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
7025
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
7026
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
7027
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
7028
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
7029
|
+
}
|
|
7030
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
7031
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
7032
|
+
const overflows = [];
|
|
7033
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
7034
|
+
if (checkMainAxis) {
|
|
7035
|
+
overflows.push(overflow[side]);
|
|
7036
|
+
}
|
|
7037
|
+
if (checkCrossAxis) {
|
|
7038
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
7039
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
7040
|
+
}
|
|
7041
|
+
overflowsData = [...overflowsData, {
|
|
7042
|
+
placement,
|
|
7043
|
+
overflows
|
|
7044
|
+
}];
|
|
7045
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
7046
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
7047
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
7048
|
+
const nextPlacement = placements[nextIndex];
|
|
7049
|
+
if (nextPlacement) {
|
|
7050
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
7051
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
7052
|
+
// overflows the main axis.
|
|
7053
|
+
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
7054
|
+
return {
|
|
7055
|
+
data: {
|
|
7056
|
+
index: nextIndex,
|
|
7057
|
+
overflows: overflowsData
|
|
7058
|
+
},
|
|
7059
|
+
reset: {
|
|
7060
|
+
placement: nextPlacement
|
|
7061
|
+
}
|
|
7062
|
+
};
|
|
7063
|
+
}
|
|
7064
|
+
}
|
|
7065
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
7066
|
+
if (!resetPlacement) {
|
|
7067
|
+
switch (fallbackStrategy) {
|
|
7068
|
+
case "bestFit": {
|
|
7069
|
+
var _overflowsData$filter2;
|
|
7070
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
7071
|
+
if (hasFallbackAxisSideDirection) {
|
|
7072
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
7073
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
7074
|
+
// reading directions favoring greater width.
|
|
7075
|
+
currentSideAxis === "y";
|
|
7076
|
+
}
|
|
7077
|
+
return true;
|
|
7078
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
7079
|
+
if (placement2) {
|
|
7080
|
+
resetPlacement = placement2;
|
|
7081
|
+
}
|
|
7082
|
+
break;
|
|
7083
|
+
}
|
|
7084
|
+
case "initialPlacement":
|
|
7085
|
+
resetPlacement = initialPlacement;
|
|
7086
|
+
break;
|
|
7087
|
+
}
|
|
7088
|
+
}
|
|
7089
|
+
if (placement !== resetPlacement) {
|
|
7090
|
+
return {
|
|
7091
|
+
reset: {
|
|
7092
|
+
placement: resetPlacement
|
|
7093
|
+
}
|
|
7094
|
+
};
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
return {};
|
|
7098
|
+
}
|
|
7099
|
+
};
|
|
7100
|
+
};
|
|
7101
|
+
function getSideOffsets(overflow, rect) {
|
|
7102
|
+
return {
|
|
7103
|
+
top: overflow.top - rect.height,
|
|
7104
|
+
right: overflow.right - rect.width,
|
|
7105
|
+
bottom: overflow.bottom - rect.height,
|
|
7106
|
+
left: overflow.left - rect.width
|
|
7107
|
+
};
|
|
7108
|
+
}
|
|
7109
|
+
function isAnySideFullyClipped(overflow) {
|
|
7110
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
7111
|
+
}
|
|
7112
|
+
const hide$2 = function(options) {
|
|
7113
|
+
if (options === void 0) {
|
|
7114
|
+
options = {};
|
|
7115
|
+
}
|
|
7116
|
+
return {
|
|
7117
|
+
name: "hide",
|
|
7118
|
+
options,
|
|
7119
|
+
async fn(state) {
|
|
7120
|
+
const {
|
|
7121
|
+
rects,
|
|
7122
|
+
platform: platform2
|
|
7123
|
+
} = state;
|
|
7124
|
+
const {
|
|
7125
|
+
strategy = "referenceHidden",
|
|
7126
|
+
...detectOverflowOptions
|
|
7127
|
+
} = evaluate(options, state);
|
|
7128
|
+
switch (strategy) {
|
|
7129
|
+
case "referenceHidden": {
|
|
7130
|
+
const overflow = await platform2.detectOverflow(state, {
|
|
7131
|
+
...detectOverflowOptions,
|
|
7132
|
+
elementContext: "reference"
|
|
7133
|
+
});
|
|
7134
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
7135
|
+
return {
|
|
7136
|
+
data: {
|
|
7137
|
+
referenceHiddenOffsets: offsets,
|
|
7138
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
7139
|
+
}
|
|
7140
|
+
};
|
|
7141
|
+
}
|
|
7142
|
+
case "escaped": {
|
|
7143
|
+
const overflow = await platform2.detectOverflow(state, {
|
|
7144
|
+
...detectOverflowOptions,
|
|
7145
|
+
altBoundary: true
|
|
7146
|
+
});
|
|
7147
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
7148
|
+
return {
|
|
7149
|
+
data: {
|
|
7150
|
+
escapedOffsets: offsets,
|
|
7151
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
7152
|
+
}
|
|
7153
|
+
};
|
|
7154
|
+
}
|
|
7155
|
+
default: {
|
|
7156
|
+
return {};
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
};
|
|
7161
|
+
};
|
|
7162
|
+
const originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
7163
|
+
async function convertValueToCoords(state, options) {
|
|
7164
|
+
const {
|
|
7165
|
+
placement,
|
|
7166
|
+
platform: platform2,
|
|
7167
|
+
elements
|
|
7168
|
+
} = state;
|
|
7169
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
7170
|
+
const side = getSide(placement);
|
|
7171
|
+
const alignment = getAlignment(placement);
|
|
7172
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
7173
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
7174
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
7175
|
+
const rawValue = evaluate(options, state);
|
|
7176
|
+
let {
|
|
7177
|
+
mainAxis,
|
|
7178
|
+
crossAxis,
|
|
7179
|
+
alignmentAxis
|
|
7180
|
+
} = typeof rawValue === "number" ? {
|
|
7181
|
+
mainAxis: rawValue,
|
|
7182
|
+
crossAxis: 0,
|
|
7183
|
+
alignmentAxis: null
|
|
7184
|
+
} : {
|
|
7185
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
7186
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
7187
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
7188
|
+
};
|
|
7189
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
7190
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
7191
|
+
}
|
|
7192
|
+
return isVertical ? {
|
|
7193
|
+
x: crossAxis * crossAxisMulti,
|
|
7194
|
+
y: mainAxis * mainAxisMulti
|
|
7195
|
+
} : {
|
|
7196
|
+
x: mainAxis * mainAxisMulti,
|
|
7197
|
+
y: crossAxis * crossAxisMulti
|
|
7198
|
+
};
|
|
7199
|
+
}
|
|
7200
|
+
const offset$2 = function(options) {
|
|
7201
|
+
if (options === void 0) {
|
|
7202
|
+
options = 0;
|
|
7203
|
+
}
|
|
7204
|
+
return {
|
|
7205
|
+
name: "offset",
|
|
7206
|
+
options,
|
|
7207
|
+
async fn(state) {
|
|
7208
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
7209
|
+
const {
|
|
7210
|
+
x,
|
|
7211
|
+
y,
|
|
7212
|
+
placement,
|
|
7213
|
+
middlewareData
|
|
7214
|
+
} = state;
|
|
7215
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
7216
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
7217
|
+
return {};
|
|
7218
|
+
}
|
|
7219
|
+
return {
|
|
7220
|
+
x: x + diffCoords.x,
|
|
7221
|
+
y: y + diffCoords.y,
|
|
7222
|
+
data: {
|
|
7223
|
+
...diffCoords,
|
|
7224
|
+
placement
|
|
7225
|
+
}
|
|
7226
|
+
};
|
|
7227
|
+
}
|
|
7228
|
+
};
|
|
7229
|
+
};
|
|
7230
|
+
const shift$2 = function(options) {
|
|
7231
|
+
if (options === void 0) {
|
|
7232
|
+
options = {};
|
|
7233
|
+
}
|
|
7234
|
+
return {
|
|
7235
|
+
name: "shift",
|
|
7236
|
+
options,
|
|
7237
|
+
async fn(state) {
|
|
7238
|
+
const {
|
|
7239
|
+
x,
|
|
7240
|
+
y,
|
|
7241
|
+
placement,
|
|
7242
|
+
platform: platform2
|
|
7243
|
+
} = state;
|
|
7244
|
+
const {
|
|
7245
|
+
mainAxis: checkMainAxis = true,
|
|
7246
|
+
crossAxis: checkCrossAxis = false,
|
|
7247
|
+
limiter = {
|
|
7248
|
+
fn: (_ref) => {
|
|
7249
|
+
let {
|
|
7250
|
+
x: x2,
|
|
7251
|
+
y: y2
|
|
7252
|
+
} = _ref;
|
|
7253
|
+
return {
|
|
7254
|
+
x: x2,
|
|
7255
|
+
y: y2
|
|
7256
|
+
};
|
|
7257
|
+
}
|
|
7258
|
+
},
|
|
7259
|
+
...detectOverflowOptions
|
|
7260
|
+
} = evaluate(options, state);
|
|
7261
|
+
const coords = {
|
|
7262
|
+
x,
|
|
7263
|
+
y
|
|
7264
|
+
};
|
|
7265
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
7266
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
7267
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
7268
|
+
let mainAxisCoord = coords[mainAxis];
|
|
7269
|
+
let crossAxisCoord = coords[crossAxis];
|
|
7270
|
+
if (checkMainAxis) {
|
|
7271
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
7272
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
7273
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
7274
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
7275
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
7276
|
+
}
|
|
7277
|
+
if (checkCrossAxis) {
|
|
7278
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
7279
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
7280
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
7281
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
7282
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
7283
|
+
}
|
|
7284
|
+
const limitedCoords = limiter.fn({
|
|
7285
|
+
...state,
|
|
7286
|
+
[mainAxis]: mainAxisCoord,
|
|
7287
|
+
[crossAxis]: crossAxisCoord
|
|
7288
|
+
});
|
|
7289
|
+
return {
|
|
7290
|
+
...limitedCoords,
|
|
7291
|
+
data: {
|
|
7292
|
+
x: limitedCoords.x - x,
|
|
7293
|
+
y: limitedCoords.y - y,
|
|
7294
|
+
enabled: {
|
|
7295
|
+
[mainAxis]: checkMainAxis,
|
|
7296
|
+
[crossAxis]: checkCrossAxis
|
|
7297
|
+
}
|
|
7298
|
+
}
|
|
7299
|
+
};
|
|
7300
|
+
}
|
|
7301
|
+
};
|
|
7302
|
+
};
|
|
7303
|
+
const limitShift$2 = function(options) {
|
|
7304
|
+
if (options === void 0) {
|
|
7305
|
+
options = {};
|
|
7306
|
+
}
|
|
7307
|
+
return {
|
|
7308
|
+
options,
|
|
7309
|
+
fn(state) {
|
|
7310
|
+
const {
|
|
7311
|
+
x,
|
|
7312
|
+
y,
|
|
7313
|
+
placement,
|
|
7314
|
+
rects,
|
|
7315
|
+
middlewareData
|
|
7316
|
+
} = state;
|
|
7317
|
+
const {
|
|
7318
|
+
offset: offset2 = 0,
|
|
7319
|
+
mainAxis: checkMainAxis = true,
|
|
7320
|
+
crossAxis: checkCrossAxis = true
|
|
7321
|
+
} = evaluate(options, state);
|
|
7322
|
+
const coords = {
|
|
7323
|
+
x,
|
|
7324
|
+
y
|
|
7325
|
+
};
|
|
7326
|
+
const crossAxis = getSideAxis(placement);
|
|
7327
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
7328
|
+
let mainAxisCoord = coords[mainAxis];
|
|
7329
|
+
let crossAxisCoord = coords[crossAxis];
|
|
7330
|
+
const rawOffset = evaluate(offset2, state);
|
|
7331
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
7332
|
+
mainAxis: rawOffset,
|
|
7333
|
+
crossAxis: 0
|
|
7334
|
+
} : {
|
|
7335
|
+
mainAxis: 0,
|
|
7336
|
+
crossAxis: 0,
|
|
7337
|
+
...rawOffset
|
|
7338
|
+
};
|
|
7339
|
+
if (checkMainAxis) {
|
|
7340
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
7341
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
7342
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
7343
|
+
if (mainAxisCoord < limitMin) {
|
|
7344
|
+
mainAxisCoord = limitMin;
|
|
7345
|
+
} else if (mainAxisCoord > limitMax) {
|
|
7346
|
+
mainAxisCoord = limitMax;
|
|
7347
|
+
}
|
|
7348
|
+
}
|
|
7349
|
+
if (checkCrossAxis) {
|
|
7350
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
7351
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
7352
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
7353
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
7354
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
7355
|
+
if (crossAxisCoord < limitMin) {
|
|
7356
|
+
crossAxisCoord = limitMin;
|
|
7357
|
+
} else if (crossAxisCoord > limitMax) {
|
|
7358
|
+
crossAxisCoord = limitMax;
|
|
7359
|
+
}
|
|
7360
|
+
}
|
|
7361
|
+
return {
|
|
7362
|
+
[mainAxis]: mainAxisCoord,
|
|
7363
|
+
[crossAxis]: crossAxisCoord
|
|
7364
|
+
};
|
|
7365
|
+
}
|
|
7366
|
+
};
|
|
7367
|
+
};
|
|
7368
|
+
const size$2 = function(options) {
|
|
7369
|
+
if (options === void 0) {
|
|
7370
|
+
options = {};
|
|
7371
|
+
}
|
|
7372
|
+
return {
|
|
7373
|
+
name: "size",
|
|
7374
|
+
options,
|
|
7375
|
+
async fn(state) {
|
|
7376
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
7377
|
+
const {
|
|
7378
|
+
placement,
|
|
7379
|
+
rects,
|
|
7380
|
+
platform: platform2,
|
|
7381
|
+
elements
|
|
7382
|
+
} = state;
|
|
7383
|
+
const {
|
|
7384
|
+
apply = () => {
|
|
7385
|
+
},
|
|
7386
|
+
...detectOverflowOptions
|
|
7387
|
+
} = evaluate(options, state);
|
|
7388
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
7389
|
+
const side = getSide(placement);
|
|
7390
|
+
const alignment = getAlignment(placement);
|
|
7391
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
7392
|
+
const {
|
|
7393
|
+
width,
|
|
7394
|
+
height
|
|
7395
|
+
} = rects.floating;
|
|
7396
|
+
let heightSide;
|
|
7397
|
+
let widthSide;
|
|
7398
|
+
if (side === "top" || side === "bottom") {
|
|
7399
|
+
heightSide = side;
|
|
7400
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
7401
|
+
} else {
|
|
7402
|
+
widthSide = side;
|
|
7403
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
7404
|
+
}
|
|
7405
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
7406
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
7407
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
7408
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
7409
|
+
const noShift = !state.middlewareData.shift;
|
|
7410
|
+
let availableHeight = overflowAvailableHeight;
|
|
7411
|
+
let availableWidth = overflowAvailableWidth;
|
|
7412
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
7413
|
+
availableWidth = maximumClippingWidth;
|
|
7414
|
+
}
|
|
7415
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
7416
|
+
availableHeight = maximumClippingHeight;
|
|
7417
|
+
}
|
|
7418
|
+
if (noShift && !alignment) {
|
|
7419
|
+
const xMin = max(overflow.left, 0);
|
|
7420
|
+
const xMax = max(overflow.right, 0);
|
|
7421
|
+
const yMin = max(overflow.top, 0);
|
|
7422
|
+
const yMax = max(overflow.bottom, 0);
|
|
7423
|
+
if (isYAxis) {
|
|
7424
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
7425
|
+
} else {
|
|
7426
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
await apply({
|
|
7430
|
+
...state,
|
|
7431
|
+
availableWidth,
|
|
7432
|
+
availableHeight
|
|
7433
|
+
});
|
|
7434
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
7435
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
7436
|
+
return {
|
|
7437
|
+
reset: {
|
|
7438
|
+
rects: true
|
|
7439
|
+
}
|
|
7440
|
+
};
|
|
7441
|
+
}
|
|
7442
|
+
return {};
|
|
7443
|
+
}
|
|
7444
|
+
};
|
|
7445
|
+
};
|
|
7446
|
+
function hasWindow() {
|
|
7447
|
+
return typeof window !== "undefined";
|
|
7448
|
+
}
|
|
7449
|
+
function getNodeName(node) {
|
|
7450
|
+
if (isNode(node)) {
|
|
7451
|
+
return (node.nodeName || "").toLowerCase();
|
|
7452
|
+
}
|
|
7453
|
+
return "#document";
|
|
7454
|
+
}
|
|
7455
|
+
function getWindow(node) {
|
|
7456
|
+
var _node$ownerDocument;
|
|
7457
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
7458
|
+
}
|
|
7459
|
+
function getDocumentElement(node) {
|
|
7460
|
+
var _ref;
|
|
7461
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
7462
|
+
}
|
|
7463
|
+
function isNode(value) {
|
|
7464
|
+
if (!hasWindow()) {
|
|
7465
|
+
return false;
|
|
7466
|
+
}
|
|
7467
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
7468
|
+
}
|
|
7469
|
+
function isElement(value) {
|
|
7470
|
+
if (!hasWindow()) {
|
|
7471
|
+
return false;
|
|
7472
|
+
}
|
|
7473
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
7474
|
+
}
|
|
7475
|
+
function isHTMLElement(value) {
|
|
7476
|
+
if (!hasWindow()) {
|
|
7477
|
+
return false;
|
|
7478
|
+
}
|
|
7479
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
7480
|
+
}
|
|
7481
|
+
function isShadowRoot(value) {
|
|
7482
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
7483
|
+
return false;
|
|
7484
|
+
}
|
|
7485
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
7486
|
+
}
|
|
7487
|
+
function isOverflowElement(element) {
|
|
7488
|
+
const {
|
|
7489
|
+
overflow,
|
|
7490
|
+
overflowX,
|
|
7491
|
+
overflowY,
|
|
7492
|
+
display
|
|
7493
|
+
} = getComputedStyle$1(element);
|
|
7494
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
7495
|
+
}
|
|
7496
|
+
function isTableElement(element) {
|
|
7497
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
7498
|
+
}
|
|
7499
|
+
function isTopLayer(element) {
|
|
7500
|
+
try {
|
|
7501
|
+
if (element.matches(":popover-open")) {
|
|
7502
|
+
return true;
|
|
7503
|
+
}
|
|
7504
|
+
} catch (_e) {
|
|
7505
|
+
}
|
|
7506
|
+
try {
|
|
7507
|
+
return element.matches(":modal");
|
|
7508
|
+
} catch (_e) {
|
|
7509
|
+
return false;
|
|
7510
|
+
}
|
|
7511
|
+
}
|
|
7512
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
7513
|
+
const containRe = /paint|layout|strict|content/;
|
|
7514
|
+
const isNotNone = (value) => !!value && value !== "none";
|
|
7515
|
+
let isWebKitValue;
|
|
7516
|
+
function isContainingBlock(elementOrCss) {
|
|
7517
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
7518
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
7519
|
+
}
|
|
7520
|
+
function getContainingBlock(element) {
|
|
7521
|
+
let currentNode = getParentNode(element);
|
|
7522
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
7523
|
+
if (isContainingBlock(currentNode)) {
|
|
7524
|
+
return currentNode;
|
|
7525
|
+
} else if (isTopLayer(currentNode)) {
|
|
7526
|
+
return null;
|
|
7527
|
+
}
|
|
7528
|
+
currentNode = getParentNode(currentNode);
|
|
7529
|
+
}
|
|
7530
|
+
return null;
|
|
7531
|
+
}
|
|
7532
|
+
function isWebKit() {
|
|
7533
|
+
if (isWebKitValue == null) {
|
|
7534
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
7535
|
+
}
|
|
7536
|
+
return isWebKitValue;
|
|
7537
|
+
}
|
|
7538
|
+
function isLastTraversableNode(node) {
|
|
7539
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
7540
|
+
}
|
|
7541
|
+
function getComputedStyle$1(element) {
|
|
7542
|
+
return getWindow(element).getComputedStyle(element);
|
|
7543
|
+
}
|
|
7544
|
+
function getNodeScroll(element) {
|
|
7545
|
+
if (isElement(element)) {
|
|
7546
|
+
return {
|
|
7547
|
+
scrollLeft: element.scrollLeft,
|
|
7548
|
+
scrollTop: element.scrollTop
|
|
7549
|
+
};
|
|
7550
|
+
}
|
|
7551
|
+
return {
|
|
7552
|
+
scrollLeft: element.scrollX,
|
|
7553
|
+
scrollTop: element.scrollY
|
|
7554
|
+
};
|
|
7555
|
+
}
|
|
7556
|
+
function getParentNode(node) {
|
|
7557
|
+
if (getNodeName(node) === "html") {
|
|
7558
|
+
return node;
|
|
7559
|
+
}
|
|
7560
|
+
const result = (
|
|
7561
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
7562
|
+
node.assignedSlot || // DOM Element detected.
|
|
7563
|
+
node.parentNode || // ShadowRoot detected.
|
|
7564
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
7565
|
+
getDocumentElement(node)
|
|
7566
|
+
);
|
|
7567
|
+
return isShadowRoot(result) ? result.host : result;
|
|
7568
|
+
}
|
|
7569
|
+
function getNearestOverflowAncestor(node) {
|
|
7570
|
+
const parentNode = getParentNode(node);
|
|
7571
|
+
if (isLastTraversableNode(parentNode)) {
|
|
7572
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
7573
|
+
}
|
|
7574
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
7575
|
+
return parentNode;
|
|
7576
|
+
}
|
|
7577
|
+
return getNearestOverflowAncestor(parentNode);
|
|
7578
|
+
}
|
|
7579
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
7580
|
+
var _node$ownerDocument2;
|
|
7581
|
+
if (list === void 0) {
|
|
7582
|
+
list = [];
|
|
7583
|
+
}
|
|
7584
|
+
if (traverseIframes === void 0) {
|
|
7585
|
+
traverseIframes = true;
|
|
7586
|
+
}
|
|
7587
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
7588
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
7589
|
+
const win = getWindow(scrollableAncestor);
|
|
7590
|
+
if (isBody) {
|
|
7591
|
+
const frameElement = getFrameElement(win);
|
|
7592
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
7593
|
+
} else {
|
|
7594
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
function getFrameElement(win) {
|
|
7598
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
7599
|
+
}
|
|
7600
|
+
function getCssDimensions(element) {
|
|
7601
|
+
const css = getComputedStyle$1(element);
|
|
7602
|
+
let width = parseFloat(css.width) || 0;
|
|
7603
|
+
let height = parseFloat(css.height) || 0;
|
|
7604
|
+
const hasOffset = isHTMLElement(element);
|
|
7605
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
7606
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
7607
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
7608
|
+
if (shouldFallback) {
|
|
7609
|
+
width = offsetWidth;
|
|
7610
|
+
height = offsetHeight;
|
|
7611
|
+
}
|
|
7612
|
+
return {
|
|
7613
|
+
width,
|
|
7614
|
+
height,
|
|
7615
|
+
$: shouldFallback
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
function unwrapElement(element) {
|
|
7619
|
+
return !isElement(element) ? element.contextElement : element;
|
|
7620
|
+
}
|
|
7621
|
+
function getScale(element) {
|
|
7622
|
+
const domElement = unwrapElement(element);
|
|
7623
|
+
if (!isHTMLElement(domElement)) {
|
|
7624
|
+
return createCoords(1);
|
|
7625
|
+
}
|
|
7626
|
+
const rect = domElement.getBoundingClientRect();
|
|
7627
|
+
const {
|
|
7628
|
+
width,
|
|
7629
|
+
height,
|
|
7630
|
+
$
|
|
7631
|
+
} = getCssDimensions(domElement);
|
|
7632
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
7633
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
7634
|
+
if (!x || !Number.isFinite(x)) {
|
|
7635
|
+
x = 1;
|
|
7636
|
+
}
|
|
7637
|
+
if (!y || !Number.isFinite(y)) {
|
|
7638
|
+
y = 1;
|
|
7639
|
+
}
|
|
7640
|
+
return {
|
|
7641
|
+
x,
|
|
7642
|
+
y
|
|
7643
|
+
};
|
|
7644
|
+
}
|
|
7645
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
7646
|
+
function getVisualOffsets(element) {
|
|
7647
|
+
const win = getWindow(element);
|
|
7648
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
7649
|
+
return noOffsets;
|
|
7650
|
+
}
|
|
7651
|
+
return {
|
|
7652
|
+
x: win.visualViewport.offsetLeft,
|
|
7653
|
+
y: win.visualViewport.offsetTop
|
|
7654
|
+
};
|
|
7655
|
+
}
|
|
7656
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
7657
|
+
if (isFixed === void 0) {
|
|
7658
|
+
isFixed = false;
|
|
7659
|
+
}
|
|
7660
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
7661
|
+
return false;
|
|
7662
|
+
}
|
|
7663
|
+
return isFixed;
|
|
7664
|
+
}
|
|
7665
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
7666
|
+
if (includeScale === void 0) {
|
|
7667
|
+
includeScale = false;
|
|
7668
|
+
}
|
|
7669
|
+
if (isFixedStrategy === void 0) {
|
|
7670
|
+
isFixedStrategy = false;
|
|
7671
|
+
}
|
|
7672
|
+
const clientRect = element.getBoundingClientRect();
|
|
7673
|
+
const domElement = unwrapElement(element);
|
|
7674
|
+
let scale = createCoords(1);
|
|
7675
|
+
if (includeScale) {
|
|
7676
|
+
if (offsetParent) {
|
|
7677
|
+
if (isElement(offsetParent)) {
|
|
7678
|
+
scale = getScale(offsetParent);
|
|
7679
|
+
}
|
|
7680
|
+
} else {
|
|
7681
|
+
scale = getScale(element);
|
|
7682
|
+
}
|
|
7683
|
+
}
|
|
7684
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
7685
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
7686
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
7687
|
+
let width = clientRect.width / scale.x;
|
|
7688
|
+
let height = clientRect.height / scale.y;
|
|
7689
|
+
if (domElement) {
|
|
7690
|
+
const win = getWindow(domElement);
|
|
7691
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
7692
|
+
let currentWin = win;
|
|
7693
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
7694
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
7695
|
+
const iframeScale = getScale(currentIFrame);
|
|
7696
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
7697
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
7698
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
7699
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
7700
|
+
x *= iframeScale.x;
|
|
7701
|
+
y *= iframeScale.y;
|
|
7702
|
+
width *= iframeScale.x;
|
|
7703
|
+
height *= iframeScale.y;
|
|
7704
|
+
x += left;
|
|
7705
|
+
y += top;
|
|
7706
|
+
currentWin = getWindow(currentIFrame);
|
|
7707
|
+
currentIFrame = getFrameElement(currentWin);
|
|
7708
|
+
}
|
|
7709
|
+
}
|
|
7710
|
+
return rectToClientRect({
|
|
7711
|
+
width,
|
|
7712
|
+
height,
|
|
7713
|
+
x,
|
|
7714
|
+
y
|
|
7715
|
+
});
|
|
7716
|
+
}
|
|
7717
|
+
function getWindowScrollBarX(element, rect) {
|
|
7718
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
7719
|
+
if (!rect) {
|
|
7720
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
7721
|
+
}
|
|
7722
|
+
return rect.left + leftScroll;
|
|
7723
|
+
}
|
|
7724
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
7725
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
7726
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
7727
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
7728
|
+
return {
|
|
7729
|
+
x,
|
|
7730
|
+
y
|
|
7731
|
+
};
|
|
7732
|
+
}
|
|
7733
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
7734
|
+
let {
|
|
7735
|
+
elements,
|
|
7736
|
+
rect,
|
|
7737
|
+
offsetParent,
|
|
7738
|
+
strategy
|
|
7739
|
+
} = _ref;
|
|
7740
|
+
const isFixed = strategy === "fixed";
|
|
7741
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
7742
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
7743
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
7744
|
+
return rect;
|
|
7745
|
+
}
|
|
7746
|
+
let scroll = {
|
|
7747
|
+
scrollLeft: 0,
|
|
7748
|
+
scrollTop: 0
|
|
7749
|
+
};
|
|
7750
|
+
let scale = createCoords(1);
|
|
7751
|
+
const offsets = createCoords(0);
|
|
7752
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
7753
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
7754
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
7755
|
+
scroll = getNodeScroll(offsetParent);
|
|
7756
|
+
}
|
|
7757
|
+
if (isOffsetParentAnElement) {
|
|
7758
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
7759
|
+
scale = getScale(offsetParent);
|
|
7760
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
7761
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
7762
|
+
}
|
|
7763
|
+
}
|
|
7764
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
7765
|
+
return {
|
|
7766
|
+
width: rect.width * scale.x,
|
|
7767
|
+
height: rect.height * scale.y,
|
|
7768
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
7769
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
7770
|
+
};
|
|
7771
|
+
}
|
|
7772
|
+
function getClientRects(element) {
|
|
7773
|
+
return Array.from(element.getClientRects());
|
|
7774
|
+
}
|
|
7775
|
+
function getDocumentRect(element) {
|
|
7776
|
+
const html = getDocumentElement(element);
|
|
7777
|
+
const scroll = getNodeScroll(element);
|
|
7778
|
+
const body = element.ownerDocument.body;
|
|
7779
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
7780
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
7781
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
7782
|
+
const y = -scroll.scrollTop;
|
|
7783
|
+
if (getComputedStyle$1(body).direction === "rtl") {
|
|
7784
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
7785
|
+
}
|
|
7786
|
+
return {
|
|
7787
|
+
width,
|
|
7788
|
+
height,
|
|
7789
|
+
x,
|
|
7790
|
+
y
|
|
7791
|
+
};
|
|
7792
|
+
}
|
|
7793
|
+
const SCROLLBAR_MAX = 25;
|
|
7794
|
+
function getViewportRect(element, strategy) {
|
|
7795
|
+
const win = getWindow(element);
|
|
7796
|
+
const html = getDocumentElement(element);
|
|
7797
|
+
const visualViewport = win.visualViewport;
|
|
7798
|
+
let width = html.clientWidth;
|
|
7799
|
+
let height = html.clientHeight;
|
|
7800
|
+
let x = 0;
|
|
7801
|
+
let y = 0;
|
|
7802
|
+
if (visualViewport) {
|
|
7803
|
+
width = visualViewport.width;
|
|
7804
|
+
height = visualViewport.height;
|
|
7805
|
+
const visualViewportBased = isWebKit();
|
|
7806
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
7807
|
+
x = visualViewport.offsetLeft;
|
|
7808
|
+
y = visualViewport.offsetTop;
|
|
7809
|
+
}
|
|
7810
|
+
}
|
|
7811
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
7812
|
+
if (windowScrollbarX <= 0) {
|
|
7813
|
+
const doc = html.ownerDocument;
|
|
7814
|
+
const body = doc.body;
|
|
7815
|
+
const bodyStyles = getComputedStyle(body);
|
|
7816
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
7817
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
7818
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
7819
|
+
width -= clippingStableScrollbarWidth;
|
|
7820
|
+
}
|
|
7821
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
7822
|
+
width += windowScrollbarX;
|
|
7823
|
+
}
|
|
7824
|
+
return {
|
|
7825
|
+
width,
|
|
7826
|
+
height,
|
|
7827
|
+
x,
|
|
7828
|
+
y
|
|
7829
|
+
};
|
|
7830
|
+
}
|
|
7831
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
7832
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
7833
|
+
const top = clientRect.top + element.clientTop;
|
|
7834
|
+
const left = clientRect.left + element.clientLeft;
|
|
7835
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
7836
|
+
const width = element.clientWidth * scale.x;
|
|
7837
|
+
const height = element.clientHeight * scale.y;
|
|
7838
|
+
const x = left * scale.x;
|
|
7839
|
+
const y = top * scale.y;
|
|
7840
|
+
return {
|
|
7841
|
+
width,
|
|
7842
|
+
height,
|
|
7843
|
+
x,
|
|
7844
|
+
y
|
|
7845
|
+
};
|
|
7846
|
+
}
|
|
7847
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
7848
|
+
let rect;
|
|
7849
|
+
if (clippingAncestor === "viewport") {
|
|
7850
|
+
rect = getViewportRect(element, strategy);
|
|
7851
|
+
} else if (clippingAncestor === "document") {
|
|
7852
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
7853
|
+
} else if (isElement(clippingAncestor)) {
|
|
7854
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
7855
|
+
} else {
|
|
7856
|
+
const visualOffsets = getVisualOffsets(element);
|
|
7857
|
+
rect = {
|
|
7858
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
7859
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
7860
|
+
width: clippingAncestor.width,
|
|
7861
|
+
height: clippingAncestor.height
|
|
7862
|
+
};
|
|
7863
|
+
}
|
|
7864
|
+
return rectToClientRect(rect);
|
|
7865
|
+
}
|
|
7866
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
7867
|
+
const parentNode = getParentNode(element);
|
|
7868
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
7869
|
+
return false;
|
|
7870
|
+
}
|
|
7871
|
+
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
7872
|
+
}
|
|
7873
|
+
function getClippingElementAncestors(element, cache) {
|
|
7874
|
+
const cachedResult = cache.get(element);
|
|
7875
|
+
if (cachedResult) {
|
|
7876
|
+
return cachedResult;
|
|
7877
|
+
}
|
|
7878
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
7879
|
+
let currentContainingBlockComputedStyle = null;
|
|
7880
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
7881
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
7882
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
7883
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
7884
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
7885
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
7886
|
+
currentContainingBlockComputedStyle = null;
|
|
7887
|
+
}
|
|
7888
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
7889
|
+
if (shouldDropCurrentNode) {
|
|
7890
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
7891
|
+
} else {
|
|
7892
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
7893
|
+
}
|
|
7894
|
+
currentNode = getParentNode(currentNode);
|
|
7895
|
+
}
|
|
7896
|
+
cache.set(element, result);
|
|
7897
|
+
return result;
|
|
7898
|
+
}
|
|
7899
|
+
function getClippingRect(_ref) {
|
|
7900
|
+
let {
|
|
7901
|
+
element,
|
|
7902
|
+
boundary,
|
|
7903
|
+
rootBoundary,
|
|
7904
|
+
strategy
|
|
7905
|
+
} = _ref;
|
|
7906
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
7907
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
7908
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
7909
|
+
let top = firstRect.top;
|
|
7910
|
+
let right = firstRect.right;
|
|
7911
|
+
let bottom = firstRect.bottom;
|
|
7912
|
+
let left = firstRect.left;
|
|
7913
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
7914
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
7915
|
+
top = max(rect.top, top);
|
|
7916
|
+
right = min(rect.right, right);
|
|
7917
|
+
bottom = min(rect.bottom, bottom);
|
|
7918
|
+
left = max(rect.left, left);
|
|
7919
|
+
}
|
|
7920
|
+
return {
|
|
7921
|
+
width: right - left,
|
|
7922
|
+
height: bottom - top,
|
|
7923
|
+
x: left,
|
|
7924
|
+
y: top
|
|
7925
|
+
};
|
|
7926
|
+
}
|
|
7927
|
+
function getDimensions(element) {
|
|
7928
|
+
const {
|
|
7929
|
+
width,
|
|
7930
|
+
height
|
|
7931
|
+
} = getCssDimensions(element);
|
|
7932
|
+
return {
|
|
7933
|
+
width,
|
|
7934
|
+
height
|
|
7935
|
+
};
|
|
7936
|
+
}
|
|
7937
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
7938
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
7939
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
7940
|
+
const isFixed = strategy === "fixed";
|
|
7941
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
7942
|
+
let scroll = {
|
|
7943
|
+
scrollLeft: 0,
|
|
7944
|
+
scrollTop: 0
|
|
7945
|
+
};
|
|
7946
|
+
const offsets = createCoords(0);
|
|
7947
|
+
function setLeftRTLScrollbarOffset() {
|
|
7948
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
7949
|
+
}
|
|
7950
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
7951
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
7952
|
+
scroll = getNodeScroll(offsetParent);
|
|
7953
|
+
}
|
|
7954
|
+
if (isOffsetParentAnElement) {
|
|
7955
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
7956
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
7957
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
7958
|
+
} else if (documentElement) {
|
|
7959
|
+
setLeftRTLScrollbarOffset();
|
|
7960
|
+
}
|
|
7961
|
+
}
|
|
7962
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
7963
|
+
setLeftRTLScrollbarOffset();
|
|
7964
|
+
}
|
|
7965
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
7966
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
7967
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
7968
|
+
return {
|
|
7969
|
+
x,
|
|
7970
|
+
y,
|
|
7971
|
+
width: rect.width,
|
|
7972
|
+
height: rect.height
|
|
7973
|
+
};
|
|
7974
|
+
}
|
|
7975
|
+
function isStaticPositioned(element) {
|
|
7976
|
+
return getComputedStyle$1(element).position === "static";
|
|
7977
|
+
}
|
|
7978
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
7979
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
|
|
7980
|
+
return null;
|
|
7981
|
+
}
|
|
7982
|
+
if (polyfill) {
|
|
7983
|
+
return polyfill(element);
|
|
7984
|
+
}
|
|
7985
|
+
let rawOffsetParent = element.offsetParent;
|
|
7986
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
7987
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
7988
|
+
}
|
|
7989
|
+
return rawOffsetParent;
|
|
7990
|
+
}
|
|
7991
|
+
function getOffsetParent(element, polyfill) {
|
|
7992
|
+
const win = getWindow(element);
|
|
7993
|
+
if (isTopLayer(element)) {
|
|
7994
|
+
return win;
|
|
7995
|
+
}
|
|
7996
|
+
if (!isHTMLElement(element)) {
|
|
7997
|
+
let svgOffsetParent = getParentNode(element);
|
|
7998
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
7999
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
8000
|
+
return svgOffsetParent;
|
|
8001
|
+
}
|
|
8002
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
8003
|
+
}
|
|
8004
|
+
return win;
|
|
8005
|
+
}
|
|
8006
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
8007
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
8008
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
8009
|
+
}
|
|
8010
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
8011
|
+
return win;
|
|
8012
|
+
}
|
|
8013
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
8014
|
+
}
|
|
8015
|
+
const getElementRects = async function(data) {
|
|
8016
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
8017
|
+
const getDimensionsFn = this.getDimensions;
|
|
8018
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
8019
|
+
return {
|
|
8020
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
8021
|
+
floating: {
|
|
8022
|
+
x: 0,
|
|
8023
|
+
y: 0,
|
|
8024
|
+
width: floatingDimensions.width,
|
|
8025
|
+
height: floatingDimensions.height
|
|
8026
|
+
}
|
|
8027
|
+
};
|
|
8028
|
+
};
|
|
8029
|
+
function isRTL(element) {
|
|
8030
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
8031
|
+
}
|
|
8032
|
+
const platform = {
|
|
8033
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
8034
|
+
getDocumentElement,
|
|
8035
|
+
getClippingRect,
|
|
8036
|
+
getOffsetParent,
|
|
8037
|
+
getElementRects,
|
|
8038
|
+
getClientRects,
|
|
8039
|
+
getDimensions,
|
|
8040
|
+
getScale,
|
|
8041
|
+
isElement,
|
|
8042
|
+
isRTL
|
|
8043
|
+
};
|
|
8044
|
+
function rectsAreEqual(a, b) {
|
|
8045
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
8046
|
+
}
|
|
8047
|
+
function observeMove(element, onMove) {
|
|
8048
|
+
let io = null;
|
|
8049
|
+
let timeoutId;
|
|
8050
|
+
const root = getDocumentElement(element);
|
|
8051
|
+
function cleanup() {
|
|
8052
|
+
var _io;
|
|
8053
|
+
clearTimeout(timeoutId);
|
|
8054
|
+
(_io = io) == null || _io.disconnect();
|
|
8055
|
+
io = null;
|
|
8056
|
+
}
|
|
8057
|
+
function refresh(skip, threshold) {
|
|
8058
|
+
if (skip === void 0) {
|
|
8059
|
+
skip = false;
|
|
8060
|
+
}
|
|
8061
|
+
if (threshold === void 0) {
|
|
8062
|
+
threshold = 1;
|
|
8063
|
+
}
|
|
8064
|
+
cleanup();
|
|
8065
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
8066
|
+
const {
|
|
8067
|
+
left,
|
|
8068
|
+
top,
|
|
8069
|
+
width,
|
|
8070
|
+
height
|
|
8071
|
+
} = elementRectForRootMargin;
|
|
8072
|
+
if (!skip) {
|
|
8073
|
+
onMove();
|
|
8074
|
+
}
|
|
8075
|
+
if (!width || !height) {
|
|
8076
|
+
return;
|
|
8077
|
+
}
|
|
8078
|
+
const insetTop = floor(top);
|
|
8079
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
8080
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
8081
|
+
const insetLeft = floor(left);
|
|
8082
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
8083
|
+
const options = {
|
|
8084
|
+
rootMargin,
|
|
8085
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
8086
|
+
};
|
|
8087
|
+
let isFirstUpdate = true;
|
|
8088
|
+
function handleObserve(entries) {
|
|
8089
|
+
const ratio = entries[0].intersectionRatio;
|
|
8090
|
+
if (ratio !== threshold) {
|
|
8091
|
+
if (!isFirstUpdate) {
|
|
8092
|
+
return refresh();
|
|
8093
|
+
}
|
|
8094
|
+
if (!ratio) {
|
|
8095
|
+
timeoutId = setTimeout(() => {
|
|
8096
|
+
refresh(false, 1e-7);
|
|
8097
|
+
}, 1e3);
|
|
8098
|
+
} else {
|
|
8099
|
+
refresh(false, ratio);
|
|
8100
|
+
}
|
|
8101
|
+
}
|
|
8102
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
8103
|
+
refresh();
|
|
8104
|
+
}
|
|
8105
|
+
isFirstUpdate = false;
|
|
8106
|
+
}
|
|
8107
|
+
try {
|
|
8108
|
+
io = new IntersectionObserver(handleObserve, {
|
|
8109
|
+
...options,
|
|
8110
|
+
// Handle <iframe>s
|
|
8111
|
+
root: root.ownerDocument
|
|
8112
|
+
});
|
|
8113
|
+
} catch (_e) {
|
|
8114
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
8115
|
+
}
|
|
8116
|
+
io.observe(element);
|
|
8117
|
+
}
|
|
8118
|
+
refresh(true);
|
|
8119
|
+
return cleanup;
|
|
8120
|
+
}
|
|
8121
|
+
function autoUpdate(reference, floating, update, options) {
|
|
8122
|
+
if (options === void 0) {
|
|
8123
|
+
options = {};
|
|
8124
|
+
}
|
|
8125
|
+
const {
|
|
8126
|
+
ancestorScroll = true,
|
|
8127
|
+
ancestorResize = true,
|
|
8128
|
+
elementResize = typeof ResizeObserver === "function",
|
|
8129
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
8130
|
+
animationFrame = false
|
|
8131
|
+
} = options;
|
|
8132
|
+
const referenceEl = unwrapElement(reference);
|
|
8133
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
8134
|
+
ancestors.forEach((ancestor) => {
|
|
8135
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
8136
|
+
passive: true
|
|
8137
|
+
});
|
|
8138
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
8139
|
+
});
|
|
8140
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
8141
|
+
let reobserveFrame = -1;
|
|
8142
|
+
let resizeObserver = null;
|
|
8143
|
+
if (elementResize) {
|
|
8144
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
8145
|
+
let [firstEntry] = _ref;
|
|
8146
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
8147
|
+
resizeObserver.unobserve(floating);
|
|
8148
|
+
cancelAnimationFrame(reobserveFrame);
|
|
8149
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
8150
|
+
var _resizeObserver;
|
|
8151
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
8152
|
+
});
|
|
8153
|
+
}
|
|
8154
|
+
update();
|
|
8155
|
+
});
|
|
8156
|
+
if (referenceEl && !animationFrame) {
|
|
8157
|
+
resizeObserver.observe(referenceEl);
|
|
8158
|
+
}
|
|
8159
|
+
if (floating) {
|
|
8160
|
+
resizeObserver.observe(floating);
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
8163
|
+
let frameId;
|
|
8164
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
8165
|
+
if (animationFrame) {
|
|
8166
|
+
frameLoop();
|
|
8167
|
+
}
|
|
8168
|
+
function frameLoop() {
|
|
8169
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
8170
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
8171
|
+
update();
|
|
8172
|
+
}
|
|
8173
|
+
prevRefRect = nextRefRect;
|
|
8174
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
8175
|
+
}
|
|
8176
|
+
update();
|
|
8177
|
+
return () => {
|
|
8178
|
+
var _resizeObserver2;
|
|
8179
|
+
ancestors.forEach((ancestor) => {
|
|
8180
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
8181
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
8182
|
+
});
|
|
8183
|
+
cleanupIo == null || cleanupIo();
|
|
8184
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
8185
|
+
resizeObserver = null;
|
|
8186
|
+
if (animationFrame) {
|
|
8187
|
+
cancelAnimationFrame(frameId);
|
|
8188
|
+
}
|
|
8189
|
+
};
|
|
8190
|
+
}
|
|
8191
|
+
const offset$1 = offset$2;
|
|
8192
|
+
const shift$1 = shift$2;
|
|
8193
|
+
const flip$1 = flip$2;
|
|
8194
|
+
const size$1 = size$2;
|
|
8195
|
+
const hide$1 = hide$2;
|
|
8196
|
+
const arrow$2 = arrow$3;
|
|
8197
|
+
const limitShift$1 = limitShift$2;
|
|
8198
|
+
const computePosition = (reference, floating, options) => {
|
|
8199
|
+
const cache = /* @__PURE__ */ new Map();
|
|
8200
|
+
const mergedOptions = {
|
|
8201
|
+
platform,
|
|
8202
|
+
...options
|
|
8203
|
+
};
|
|
8204
|
+
const platformWithCache = {
|
|
8205
|
+
...mergedOptions.platform,
|
|
8206
|
+
_c: cache
|
|
8207
|
+
};
|
|
8208
|
+
return computePosition$1(reference, floating, {
|
|
8209
|
+
...mergedOptions,
|
|
8210
|
+
platform: platformWithCache
|
|
8211
|
+
});
|
|
8212
|
+
};
|
|
8213
|
+
var isClient = typeof document !== "undefined";
|
|
8214
|
+
var noop = function noop2() {
|
|
8215
|
+
};
|
|
8216
|
+
var index$1 = isClient ? React.useLayoutEffect : noop;
|
|
8217
|
+
function deepEqual(a, b) {
|
|
8218
|
+
if (a === b) {
|
|
8219
|
+
return true;
|
|
8220
|
+
}
|
|
8221
|
+
if (typeof a !== typeof b) {
|
|
8222
|
+
return false;
|
|
8223
|
+
}
|
|
8224
|
+
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
8225
|
+
return true;
|
|
8226
|
+
}
|
|
8227
|
+
let length;
|
|
8228
|
+
let i;
|
|
8229
|
+
let keys;
|
|
8230
|
+
if (a && b && typeof a === "object") {
|
|
8231
|
+
if (Array.isArray(a)) {
|
|
8232
|
+
length = a.length;
|
|
8233
|
+
if (length !== b.length) return false;
|
|
8234
|
+
for (i = length; i-- !== 0; ) {
|
|
8235
|
+
if (!deepEqual(a[i], b[i])) {
|
|
8236
|
+
return false;
|
|
8237
|
+
}
|
|
8238
|
+
}
|
|
8239
|
+
return true;
|
|
8240
|
+
}
|
|
8241
|
+
keys = Object.keys(a);
|
|
8242
|
+
length = keys.length;
|
|
8243
|
+
if (length !== Object.keys(b).length) {
|
|
8244
|
+
return false;
|
|
8245
|
+
}
|
|
8246
|
+
for (i = length; i-- !== 0; ) {
|
|
8247
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
8248
|
+
return false;
|
|
8249
|
+
}
|
|
8250
|
+
}
|
|
8251
|
+
for (i = length; i-- !== 0; ) {
|
|
8252
|
+
const key = keys[i];
|
|
8253
|
+
if (key === "_owner" && a.$$typeof) {
|
|
8254
|
+
continue;
|
|
8255
|
+
}
|
|
8256
|
+
if (!deepEqual(a[key], b[key])) {
|
|
8257
|
+
return false;
|
|
8258
|
+
}
|
|
8259
|
+
}
|
|
8260
|
+
return true;
|
|
8261
|
+
}
|
|
8262
|
+
return a !== a && b !== b;
|
|
8263
|
+
}
|
|
8264
|
+
function getDPR(element) {
|
|
8265
|
+
if (typeof window === "undefined") {
|
|
8266
|
+
return 1;
|
|
8267
|
+
}
|
|
8268
|
+
const win = element.ownerDocument.defaultView || window;
|
|
8269
|
+
return win.devicePixelRatio || 1;
|
|
8270
|
+
}
|
|
8271
|
+
function roundByDPR(element, value) {
|
|
8272
|
+
const dpr = getDPR(element);
|
|
8273
|
+
return Math.round(value * dpr) / dpr;
|
|
8274
|
+
}
|
|
8275
|
+
function useLatestRef(value) {
|
|
8276
|
+
const ref = React__namespace.useRef(value);
|
|
8277
|
+
index$1(() => {
|
|
8278
|
+
ref.current = value;
|
|
8279
|
+
});
|
|
8280
|
+
return ref;
|
|
8281
|
+
}
|
|
8282
|
+
function useFloating(options) {
|
|
8283
|
+
if (options === void 0) {
|
|
8284
|
+
options = {};
|
|
8285
|
+
}
|
|
8286
|
+
const {
|
|
8287
|
+
placement = "bottom",
|
|
8288
|
+
strategy = "absolute",
|
|
8289
|
+
middleware = [],
|
|
8290
|
+
platform: platform2,
|
|
8291
|
+
elements: {
|
|
8292
|
+
reference: externalReference,
|
|
8293
|
+
floating: externalFloating
|
|
8294
|
+
} = {},
|
|
8295
|
+
transform = true,
|
|
8296
|
+
whileElementsMounted,
|
|
8297
|
+
open
|
|
8298
|
+
} = options;
|
|
8299
|
+
const [data, setData] = React__namespace.useState({
|
|
8300
|
+
x: 0,
|
|
8301
|
+
y: 0,
|
|
8302
|
+
strategy,
|
|
8303
|
+
placement,
|
|
8304
|
+
middlewareData: {},
|
|
8305
|
+
isPositioned: false
|
|
8306
|
+
});
|
|
8307
|
+
const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
|
|
8308
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
8309
|
+
setLatestMiddleware(middleware);
|
|
8310
|
+
}
|
|
8311
|
+
const [_reference, _setReference] = React__namespace.useState(null);
|
|
8312
|
+
const [_floating, _setFloating] = React__namespace.useState(null);
|
|
8313
|
+
const setReference = React__namespace.useCallback((node) => {
|
|
8314
|
+
if (node !== referenceRef.current) {
|
|
8315
|
+
referenceRef.current = node;
|
|
8316
|
+
_setReference(node);
|
|
8317
|
+
}
|
|
8318
|
+
}, []);
|
|
8319
|
+
const setFloating = React__namespace.useCallback((node) => {
|
|
8320
|
+
if (node !== floatingRef.current) {
|
|
8321
|
+
floatingRef.current = node;
|
|
8322
|
+
_setFloating(node);
|
|
8323
|
+
}
|
|
8324
|
+
}, []);
|
|
8325
|
+
const referenceEl = externalReference || _reference;
|
|
8326
|
+
const floatingEl = externalFloating || _floating;
|
|
8327
|
+
const referenceRef = React__namespace.useRef(null);
|
|
8328
|
+
const floatingRef = React__namespace.useRef(null);
|
|
8329
|
+
const dataRef = React__namespace.useRef(data);
|
|
8330
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
8331
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
8332
|
+
const platformRef = useLatestRef(platform2);
|
|
8333
|
+
const openRef = useLatestRef(open);
|
|
8334
|
+
const update = React__namespace.useCallback(() => {
|
|
8335
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
8336
|
+
return;
|
|
8337
|
+
}
|
|
8338
|
+
const config = {
|
|
8339
|
+
placement,
|
|
8340
|
+
strategy,
|
|
8341
|
+
middleware: latestMiddleware
|
|
8342
|
+
};
|
|
8343
|
+
if (platformRef.current) {
|
|
8344
|
+
config.platform = platformRef.current;
|
|
8345
|
+
}
|
|
8346
|
+
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
8347
|
+
const fullData = {
|
|
8348
|
+
...data2,
|
|
8349
|
+
// The floating element's position may be recomputed while it's closed
|
|
8350
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
8351
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
8352
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
8353
|
+
isPositioned: openRef.current !== false
|
|
8354
|
+
};
|
|
8355
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
8356
|
+
dataRef.current = fullData;
|
|
8357
|
+
ReactDOM__namespace.flushSync(() => {
|
|
8358
|
+
setData(fullData);
|
|
8359
|
+
});
|
|
8360
|
+
}
|
|
8361
|
+
});
|
|
8362
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
8363
|
+
index$1(() => {
|
|
8364
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
8365
|
+
dataRef.current.isPositioned = false;
|
|
8366
|
+
setData((data2) => ({
|
|
8367
|
+
...data2,
|
|
8368
|
+
isPositioned: false
|
|
8369
|
+
}));
|
|
8370
|
+
}
|
|
8371
|
+
}, [open]);
|
|
8372
|
+
const isMountedRef = React__namespace.useRef(false);
|
|
8373
|
+
index$1(() => {
|
|
8374
|
+
isMountedRef.current = true;
|
|
8375
|
+
return () => {
|
|
8376
|
+
isMountedRef.current = false;
|
|
8377
|
+
};
|
|
8378
|
+
}, []);
|
|
8379
|
+
index$1(() => {
|
|
8380
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
8381
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
8382
|
+
if (referenceEl && floatingEl) {
|
|
8383
|
+
if (whileElementsMountedRef.current) {
|
|
8384
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
8385
|
+
}
|
|
8386
|
+
update();
|
|
8387
|
+
}
|
|
8388
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
8389
|
+
const refs = React__namespace.useMemo(() => ({
|
|
8390
|
+
reference: referenceRef,
|
|
8391
|
+
floating: floatingRef,
|
|
8392
|
+
setReference,
|
|
8393
|
+
setFloating
|
|
8394
|
+
}), [setReference, setFloating]);
|
|
8395
|
+
const elements = React__namespace.useMemo(() => ({
|
|
8396
|
+
reference: referenceEl,
|
|
8397
|
+
floating: floatingEl
|
|
8398
|
+
}), [referenceEl, floatingEl]);
|
|
8399
|
+
const floatingStyles = React__namespace.useMemo(() => {
|
|
8400
|
+
const initialStyles = {
|
|
8401
|
+
position: strategy,
|
|
8402
|
+
left: 0,
|
|
8403
|
+
top: 0
|
|
8404
|
+
};
|
|
8405
|
+
if (!elements.floating) {
|
|
8406
|
+
return initialStyles;
|
|
8407
|
+
}
|
|
8408
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
8409
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
8410
|
+
if (transform) {
|
|
8411
|
+
return {
|
|
8412
|
+
...initialStyles,
|
|
8413
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
8414
|
+
...getDPR(elements.floating) >= 1.5 && {
|
|
8415
|
+
willChange: "transform"
|
|
8416
|
+
}
|
|
8417
|
+
};
|
|
8418
|
+
}
|
|
8419
|
+
return {
|
|
8420
|
+
position: strategy,
|
|
8421
|
+
left: x,
|
|
8422
|
+
top: y
|
|
8423
|
+
};
|
|
8424
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
8425
|
+
return React__namespace.useMemo(() => ({
|
|
8426
|
+
...data,
|
|
8427
|
+
update,
|
|
8428
|
+
refs,
|
|
8429
|
+
elements,
|
|
8430
|
+
floatingStyles
|
|
8431
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
8432
|
+
}
|
|
8433
|
+
const arrow$1 = (options) => {
|
|
8434
|
+
function isRef(value) {
|
|
8435
|
+
return {}.hasOwnProperty.call(value, "current");
|
|
8436
|
+
}
|
|
8437
|
+
return {
|
|
8438
|
+
name: "arrow",
|
|
8439
|
+
options,
|
|
8440
|
+
fn(state) {
|
|
8441
|
+
const {
|
|
8442
|
+
element,
|
|
8443
|
+
padding
|
|
8444
|
+
} = typeof options === "function" ? options(state) : options;
|
|
8445
|
+
if (element && isRef(element)) {
|
|
8446
|
+
if (element.current != null) {
|
|
8447
|
+
return arrow$2({
|
|
8448
|
+
element: element.current,
|
|
8449
|
+
padding
|
|
8450
|
+
}).fn(state);
|
|
8451
|
+
}
|
|
8452
|
+
return {};
|
|
8453
|
+
}
|
|
8454
|
+
if (element) {
|
|
8455
|
+
return arrow$2({
|
|
8456
|
+
element,
|
|
8457
|
+
padding
|
|
8458
|
+
}).fn(state);
|
|
8459
|
+
}
|
|
8460
|
+
return {};
|
|
8461
|
+
}
|
|
8462
|
+
};
|
|
8463
|
+
};
|
|
8464
|
+
const offset = (options, deps) => {
|
|
8465
|
+
const result = offset$1(options);
|
|
8466
|
+
return {
|
|
8467
|
+
name: result.name,
|
|
8468
|
+
fn: result.fn,
|
|
8469
|
+
options: [options, deps]
|
|
8470
|
+
};
|
|
8471
|
+
};
|
|
8472
|
+
const shift = (options, deps) => {
|
|
8473
|
+
const result = shift$1(options);
|
|
8474
|
+
return {
|
|
8475
|
+
name: result.name,
|
|
8476
|
+
fn: result.fn,
|
|
8477
|
+
options: [options, deps]
|
|
8478
|
+
};
|
|
8479
|
+
};
|
|
8480
|
+
const limitShift = (options, deps) => {
|
|
8481
|
+
const result = limitShift$1(options);
|
|
8482
|
+
return {
|
|
8483
|
+
fn: result.fn,
|
|
8484
|
+
options: [options, deps]
|
|
8485
|
+
};
|
|
8486
|
+
};
|
|
8487
|
+
const flip = (options, deps) => {
|
|
8488
|
+
const result = flip$1(options);
|
|
8489
|
+
return {
|
|
8490
|
+
name: result.name,
|
|
8491
|
+
fn: result.fn,
|
|
8492
|
+
options: [options, deps]
|
|
8493
|
+
};
|
|
8494
|
+
};
|
|
8495
|
+
const size = (options, deps) => {
|
|
8496
|
+
const result = size$1(options);
|
|
8497
|
+
return {
|
|
8498
|
+
name: result.name,
|
|
8499
|
+
fn: result.fn,
|
|
8500
|
+
options: [options, deps]
|
|
8501
|
+
};
|
|
8502
|
+
};
|
|
8503
|
+
const hide = (options, deps) => {
|
|
8504
|
+
const result = hide$1(options);
|
|
8505
|
+
return {
|
|
8506
|
+
name: result.name,
|
|
8507
|
+
fn: result.fn,
|
|
8508
|
+
options: [options, deps]
|
|
8509
|
+
};
|
|
8510
|
+
};
|
|
8511
|
+
const arrow = (options, deps) => {
|
|
8512
|
+
const result = arrow$1(options);
|
|
8513
|
+
return {
|
|
8514
|
+
name: result.name,
|
|
8515
|
+
fn: result.fn,
|
|
8516
|
+
options: [options, deps]
|
|
8517
|
+
};
|
|
8518
|
+
};
|
|
8519
|
+
var NAME$1 = "Arrow";
|
|
8520
|
+
var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
8521
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
8522
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8523
|
+
Primitive.svg,
|
|
8524
|
+
{
|
|
8525
|
+
...arrowProps,
|
|
8526
|
+
ref: forwardedRef,
|
|
8527
|
+
width,
|
|
8528
|
+
height,
|
|
8529
|
+
viewBox: "0 0 30 10",
|
|
8530
|
+
preserveAspectRatio: "none",
|
|
8531
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
8532
|
+
}
|
|
8533
|
+
);
|
|
8534
|
+
});
|
|
8535
|
+
Arrow$1.displayName = NAME$1;
|
|
8536
|
+
var Root$1 = Arrow$1;
|
|
8537
|
+
function useSize(element) {
|
|
8538
|
+
const [size2, setSize] = React__namespace.useState(void 0);
|
|
8539
|
+
useLayoutEffect2(() => {
|
|
8540
|
+
if (element) {
|
|
8541
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
8542
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
8543
|
+
if (!Array.isArray(entries)) {
|
|
8544
|
+
return;
|
|
8545
|
+
}
|
|
8546
|
+
if (!entries.length) {
|
|
8547
|
+
return;
|
|
8548
|
+
}
|
|
8549
|
+
const entry = entries[0];
|
|
8550
|
+
let width;
|
|
8551
|
+
let height;
|
|
8552
|
+
if ("borderBoxSize" in entry) {
|
|
8553
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
8554
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
8555
|
+
width = borderSize["inlineSize"];
|
|
8556
|
+
height = borderSize["blockSize"];
|
|
8557
|
+
} else {
|
|
8558
|
+
width = element.offsetWidth;
|
|
8559
|
+
height = element.offsetHeight;
|
|
8560
|
+
}
|
|
8561
|
+
setSize({ width, height });
|
|
8562
|
+
});
|
|
8563
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
8564
|
+
return () => resizeObserver.unobserve(element);
|
|
8565
|
+
} else {
|
|
8566
|
+
setSize(void 0);
|
|
8567
|
+
}
|
|
8568
|
+
}, [element]);
|
|
8569
|
+
return size2;
|
|
8570
|
+
}
|
|
8571
|
+
var POPPER_NAME = "Popper";
|
|
8572
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
8573
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
8574
|
+
var Popper = (props) => {
|
|
8575
|
+
const { __scopePopper, children } = props;
|
|
8576
|
+
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
8577
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
8578
|
+
};
|
|
8579
|
+
Popper.displayName = POPPER_NAME;
|
|
8580
|
+
var ANCHOR_NAME = "PopperAnchor";
|
|
8581
|
+
var PopperAnchor = React__namespace.forwardRef(
|
|
8582
|
+
(props, forwardedRef) => {
|
|
8583
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
8584
|
+
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
8585
|
+
const ref = React__namespace.useRef(null);
|
|
8586
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8587
|
+
React__namespace.useEffect(() => {
|
|
8588
|
+
context.onAnchorChange((virtualRef == null ? void 0 : virtualRef.current) || ref.current);
|
|
8589
|
+
});
|
|
8590
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
8591
|
+
}
|
|
8592
|
+
);
|
|
8593
|
+
PopperAnchor.displayName = ANCHOR_NAME;
|
|
8594
|
+
var CONTENT_NAME$1 = "PopperContent";
|
|
8595
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
|
|
8596
|
+
var PopperContent = React__namespace.forwardRef(
|
|
8597
|
+
(props, forwardedRef) => {
|
|
8598
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8599
|
+
const {
|
|
8600
|
+
__scopePopper,
|
|
8601
|
+
side = "bottom",
|
|
8602
|
+
sideOffset = 0,
|
|
8603
|
+
align = "center",
|
|
8604
|
+
alignOffset = 0,
|
|
8605
|
+
arrowPadding = 0,
|
|
8606
|
+
avoidCollisions = true,
|
|
8607
|
+
collisionBoundary = [],
|
|
8608
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
8609
|
+
sticky = "partial",
|
|
8610
|
+
hideWhenDetached = false,
|
|
8611
|
+
updatePositionStrategy = "optimized",
|
|
8612
|
+
onPlaced,
|
|
8613
|
+
...contentProps
|
|
8614
|
+
} = props;
|
|
8615
|
+
const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
|
|
8616
|
+
const [content, setContent] = React__namespace.useState(null);
|
|
8617
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
8618
|
+
const [arrow$12, setArrow] = React__namespace.useState(null);
|
|
8619
|
+
const arrowSize = useSize(arrow$12);
|
|
8620
|
+
const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
|
|
8621
|
+
const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
|
|
8622
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
8623
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
8624
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
8625
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
8626
|
+
const detectOverflowOptions = {
|
|
8627
|
+
padding: collisionPadding,
|
|
8628
|
+
boundary: boundary.filter(isNotNull),
|
|
8629
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
8630
|
+
altBoundary: hasExplicitBoundaries
|
|
8631
|
+
};
|
|
8632
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
8633
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
8634
|
+
strategy: "fixed",
|
|
8635
|
+
placement: desiredPlacement,
|
|
8636
|
+
whileElementsMounted: (...args) => {
|
|
8637
|
+
const cleanup = autoUpdate(...args, {
|
|
8638
|
+
animationFrame: updatePositionStrategy === "always"
|
|
8639
|
+
});
|
|
8640
|
+
return cleanup;
|
|
8641
|
+
},
|
|
8642
|
+
elements: {
|
|
8643
|
+
reference: context.anchor
|
|
8644
|
+
},
|
|
8645
|
+
middleware: [
|
|
8646
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
8647
|
+
avoidCollisions && shift({
|
|
8648
|
+
mainAxis: true,
|
|
8649
|
+
crossAxis: false,
|
|
8650
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
8651
|
+
...detectOverflowOptions
|
|
8652
|
+
}),
|
|
8653
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
8654
|
+
size({
|
|
8655
|
+
...detectOverflowOptions,
|
|
8656
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
8657
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
8658
|
+
const contentStyle = elements.floating.style;
|
|
8659
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
8660
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
8661
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
8662
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
8663
|
+
}
|
|
8664
|
+
}),
|
|
8665
|
+
arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
|
|
8666
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
8667
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
8668
|
+
]
|
|
8669
|
+
});
|
|
8670
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
8671
|
+
const handlePlaced = useCallbackRef(onPlaced);
|
|
8672
|
+
useLayoutEffect2(() => {
|
|
8673
|
+
if (isPositioned) {
|
|
8674
|
+
handlePlaced == null ? void 0 : handlePlaced();
|
|
8675
|
+
}
|
|
8676
|
+
}, [isPositioned, handlePlaced]);
|
|
8677
|
+
const arrowX = (_a = middlewareData.arrow) == null ? void 0 : _a.x;
|
|
8678
|
+
const arrowY = (_b = middlewareData.arrow) == null ? void 0 : _b.y;
|
|
8679
|
+
const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
|
|
8680
|
+
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
8681
|
+
useLayoutEffect2(() => {
|
|
8682
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
8683
|
+
}, [content]);
|
|
8684
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8685
|
+
"div",
|
|
8686
|
+
{
|
|
8687
|
+
ref: refs.setFloating,
|
|
8688
|
+
"data-radix-popper-content-wrapper": "",
|
|
8689
|
+
style: {
|
|
8690
|
+
...floatingStyles,
|
|
8691
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
8692
|
+
// keep off the page when measuring
|
|
8693
|
+
minWidth: "max-content",
|
|
8694
|
+
zIndex: contentZIndex,
|
|
8695
|
+
["--radix-popper-transform-origin"]: [
|
|
8696
|
+
(_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
|
|
8697
|
+
(_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
|
|
8698
|
+
].join(" "),
|
|
8699
|
+
// hide the content if using the hide middleware and should be hidden
|
|
8700
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
8701
|
+
// as if the PopperContent isn't there at all
|
|
8702
|
+
...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
|
|
8703
|
+
visibility: "hidden",
|
|
8704
|
+
pointerEvents: "none"
|
|
8705
|
+
}
|
|
8706
|
+
},
|
|
8707
|
+
dir: props.dir,
|
|
8708
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8709
|
+
PopperContentProvider,
|
|
8710
|
+
{
|
|
8711
|
+
scope: __scopePopper,
|
|
8712
|
+
placedSide,
|
|
8713
|
+
onArrowChange: setArrow,
|
|
8714
|
+
arrowX,
|
|
8715
|
+
arrowY,
|
|
8716
|
+
shouldHideArrow: cannotCenterArrow,
|
|
8717
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8718
|
+
Primitive.div,
|
|
8719
|
+
{
|
|
8720
|
+
"data-side": placedSide,
|
|
8721
|
+
"data-align": placedAlign,
|
|
8722
|
+
...contentProps,
|
|
8723
|
+
ref: composedRefs,
|
|
8724
|
+
style: {
|
|
8725
|
+
...contentProps.style,
|
|
8726
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
8727
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
8728
|
+
animation: !isPositioned ? "none" : void 0
|
|
8729
|
+
}
|
|
8730
|
+
}
|
|
8731
|
+
)
|
|
8732
|
+
}
|
|
8733
|
+
)
|
|
8734
|
+
}
|
|
8735
|
+
);
|
|
8736
|
+
}
|
|
8737
|
+
);
|
|
8738
|
+
PopperContent.displayName = CONTENT_NAME$1;
|
|
8739
|
+
var ARROW_NAME$1 = "PopperArrow";
|
|
8740
|
+
var OPPOSITE_SIDE = {
|
|
8741
|
+
top: "bottom",
|
|
8742
|
+
right: "left",
|
|
8743
|
+
bottom: "top",
|
|
8744
|
+
left: "right"
|
|
8745
|
+
};
|
|
8746
|
+
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
8747
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
8748
|
+
const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
|
|
8749
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
8750
|
+
return (
|
|
8751
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
8752
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
8753
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
8754
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8755
|
+
"span",
|
|
8756
|
+
{
|
|
8757
|
+
ref: contentContext.onArrowChange,
|
|
8758
|
+
style: {
|
|
8759
|
+
position: "absolute",
|
|
8760
|
+
left: contentContext.arrowX,
|
|
8761
|
+
top: contentContext.arrowY,
|
|
8762
|
+
[baseSide]: 0,
|
|
8763
|
+
transformOrigin: {
|
|
8764
|
+
top: "",
|
|
8765
|
+
right: "0 0",
|
|
8766
|
+
bottom: "center 0",
|
|
8767
|
+
left: "100% 0"
|
|
8768
|
+
}[contentContext.placedSide],
|
|
8769
|
+
transform: {
|
|
8770
|
+
top: "translateY(100%)",
|
|
8771
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
8772
|
+
bottom: `rotate(180deg)`,
|
|
8773
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
8774
|
+
}[contentContext.placedSide],
|
|
8775
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
8776
|
+
},
|
|
8777
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8778
|
+
Root$1,
|
|
8779
|
+
{
|
|
8780
|
+
...arrowProps,
|
|
8781
|
+
ref: forwardedRef,
|
|
8782
|
+
style: {
|
|
8783
|
+
...arrowProps.style,
|
|
8784
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
8785
|
+
display: "block"
|
|
8786
|
+
}
|
|
8787
|
+
}
|
|
8788
|
+
)
|
|
8789
|
+
}
|
|
8790
|
+
)
|
|
8791
|
+
);
|
|
8792
|
+
});
|
|
8793
|
+
PopperArrow.displayName = ARROW_NAME$1;
|
|
8794
|
+
function isNotNull(value) {
|
|
8795
|
+
return value !== null;
|
|
8796
|
+
}
|
|
8797
|
+
var transformOrigin = (options) => ({
|
|
8798
|
+
name: "transformOrigin",
|
|
8799
|
+
options,
|
|
8800
|
+
fn(data) {
|
|
8801
|
+
var _a, _b, _c;
|
|
8802
|
+
const { placement, rects, middlewareData } = data;
|
|
8803
|
+
const cannotCenterArrow = ((_a = middlewareData.arrow) == null ? void 0 : _a.centerOffset) !== 0;
|
|
8804
|
+
const isArrowHidden = cannotCenterArrow;
|
|
8805
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
8806
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
8807
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
8808
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
8809
|
+
const arrowXCenter = (((_b = middlewareData.arrow) == null ? void 0 : _b.x) ?? 0) + arrowWidth / 2;
|
|
8810
|
+
const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
|
|
8811
|
+
let x = "";
|
|
8812
|
+
let y = "";
|
|
8813
|
+
if (placedSide === "bottom") {
|
|
8814
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
8815
|
+
y = `${-arrowHeight}px`;
|
|
8816
|
+
} else if (placedSide === "top") {
|
|
8817
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
8818
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
8819
|
+
} else if (placedSide === "right") {
|
|
8820
|
+
x = `${-arrowHeight}px`;
|
|
8821
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
8822
|
+
} else if (placedSide === "left") {
|
|
8823
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
8824
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
8825
|
+
}
|
|
8826
|
+
return { data: { x, y } };
|
|
8827
|
+
}
|
|
8828
|
+
});
|
|
8829
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
8830
|
+
const [side, align = "center"] = placement.split("-");
|
|
8831
|
+
return [side, align];
|
|
8832
|
+
}
|
|
8833
|
+
var Root2 = Popper;
|
|
8834
|
+
var Anchor = PopperAnchor;
|
|
8835
|
+
var Content = PopperContent;
|
|
8836
|
+
var Arrow = PopperArrow;
|
|
8837
|
+
var PORTAL_NAME$1 = "Portal";
|
|
8838
|
+
var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
8839
|
+
var _a;
|
|
8840
|
+
const { container: containerProp, ...portalProps } = props;
|
|
8841
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
|
8842
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
8843
|
+
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
8844
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
8845
|
+
});
|
|
8846
|
+
Portal$1.displayName = PORTAL_NAME$1;
|
|
8847
|
+
function useStateMachine(initialState, machine) {
|
|
8848
|
+
return React__namespace.useReducer((state, event) => {
|
|
8849
|
+
const nextState = machine[state][event];
|
|
8850
|
+
return nextState ?? state;
|
|
8851
|
+
}, initialState);
|
|
8852
|
+
}
|
|
8853
|
+
var Presence = (props) => {
|
|
8854
|
+
const { present, children } = props;
|
|
8855
|
+
const presence = usePresence(present);
|
|
8856
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
8857
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
8858
|
+
const forceMount = typeof children === "function";
|
|
8859
|
+
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
8860
|
+
};
|
|
8861
|
+
Presence.displayName = "Presence";
|
|
8862
|
+
function usePresence(present) {
|
|
8863
|
+
const [node, setNode] = React__namespace.useState();
|
|
8864
|
+
const stylesRef = React__namespace.useRef({});
|
|
8865
|
+
const prevPresentRef = React__namespace.useRef(present);
|
|
8866
|
+
const prevAnimationNameRef = React__namespace.useRef("none");
|
|
8867
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
8868
|
+
const [state, send] = useStateMachine(initialState, {
|
|
8869
|
+
mounted: {
|
|
8870
|
+
UNMOUNT: "unmounted",
|
|
8871
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
8872
|
+
},
|
|
8873
|
+
unmountSuspended: {
|
|
8874
|
+
MOUNT: "mounted",
|
|
8875
|
+
ANIMATION_END: "unmounted"
|
|
8876
|
+
},
|
|
8877
|
+
unmounted: {
|
|
8878
|
+
MOUNT: "mounted"
|
|
8879
|
+
}
|
|
8880
|
+
});
|
|
8881
|
+
React__namespace.useEffect(() => {
|
|
8882
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
8883
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
8884
|
+
}, [state]);
|
|
8885
|
+
useLayoutEffect2(() => {
|
|
8886
|
+
const styles = stylesRef.current;
|
|
8887
|
+
const wasPresent = prevPresentRef.current;
|
|
8888
|
+
const hasPresentChanged = wasPresent !== present;
|
|
8889
|
+
if (hasPresentChanged) {
|
|
8890
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
8891
|
+
const currentAnimationName = getAnimationName(styles);
|
|
8892
|
+
if (present) {
|
|
8893
|
+
send("MOUNT");
|
|
8894
|
+
} else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
|
|
8895
|
+
send("UNMOUNT");
|
|
8896
|
+
} else {
|
|
8897
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
8898
|
+
if (wasPresent && isAnimating) {
|
|
8899
|
+
send("ANIMATION_OUT");
|
|
8900
|
+
} else {
|
|
8901
|
+
send("UNMOUNT");
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
prevPresentRef.current = present;
|
|
8905
|
+
}
|
|
8906
|
+
}, [present, send]);
|
|
8907
|
+
useLayoutEffect2(() => {
|
|
8908
|
+
if (node) {
|
|
8909
|
+
let timeoutId;
|
|
8910
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
8911
|
+
const handleAnimationEnd = (event) => {
|
|
8912
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
8913
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
8914
|
+
if (event.target === node && isCurrentAnimation) {
|
|
8915
|
+
send("ANIMATION_END");
|
|
8916
|
+
if (!prevPresentRef.current) {
|
|
8917
|
+
const currentFillMode = node.style.animationFillMode;
|
|
8918
|
+
node.style.animationFillMode = "forwards";
|
|
8919
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
8920
|
+
if (node.style.animationFillMode === "forwards") {
|
|
8921
|
+
node.style.animationFillMode = currentFillMode;
|
|
8922
|
+
}
|
|
8923
|
+
});
|
|
8924
|
+
}
|
|
8925
|
+
}
|
|
8926
|
+
};
|
|
8927
|
+
const handleAnimationStart = (event) => {
|
|
8928
|
+
if (event.target === node) {
|
|
8929
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
8930
|
+
}
|
|
8931
|
+
};
|
|
8932
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
8933
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
8934
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
8935
|
+
return () => {
|
|
8936
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
8937
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
8938
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
8939
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
8940
|
+
};
|
|
8941
|
+
} else {
|
|
8942
|
+
send("ANIMATION_END");
|
|
8943
|
+
}
|
|
8944
|
+
}, [node, send]);
|
|
8945
|
+
return {
|
|
8946
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
8947
|
+
ref: React__namespace.useCallback((node2) => {
|
|
8948
|
+
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
8949
|
+
setNode(node2);
|
|
8950
|
+
}, [])
|
|
8951
|
+
};
|
|
8952
|
+
}
|
|
8953
|
+
function getAnimationName(styles) {
|
|
8954
|
+
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
8955
|
+
}
|
|
8956
|
+
function getElementRef(element) {
|
|
8957
|
+
var _a, _b;
|
|
8958
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
8959
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8960
|
+
if (mayWarn) {
|
|
8961
|
+
return element.ref;
|
|
8962
|
+
}
|
|
8963
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
8964
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8965
|
+
if (mayWarn) {
|
|
8966
|
+
return element.props.ref;
|
|
8967
|
+
}
|
|
8968
|
+
return element.props.ref || element.ref;
|
|
8969
|
+
}
|
|
8970
|
+
function useControllableState({
|
|
8971
|
+
prop,
|
|
8972
|
+
defaultProp,
|
|
8973
|
+
onChange = () => {
|
|
8974
|
+
}
|
|
8975
|
+
}) {
|
|
8976
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
8977
|
+
const isControlled = prop !== void 0;
|
|
8978
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
8979
|
+
const handleChange = useCallbackRef(onChange);
|
|
8980
|
+
const setValue = React__namespace.useCallback(
|
|
8981
|
+
(nextValue) => {
|
|
8982
|
+
if (isControlled) {
|
|
8983
|
+
const setter = nextValue;
|
|
8984
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
8985
|
+
if (value2 !== prop) handleChange(value2);
|
|
8986
|
+
} else {
|
|
8987
|
+
setUncontrolledProp(nextValue);
|
|
8988
|
+
}
|
|
8989
|
+
},
|
|
8990
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
8991
|
+
);
|
|
8992
|
+
return [value, setValue];
|
|
8993
|
+
}
|
|
8994
|
+
function useUncontrolledState({
|
|
8995
|
+
defaultProp,
|
|
8996
|
+
onChange
|
|
8997
|
+
}) {
|
|
8998
|
+
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
8999
|
+
const [value] = uncontrolledState;
|
|
9000
|
+
const prevValueRef = React__namespace.useRef(value);
|
|
9001
|
+
const handleChange = useCallbackRef(onChange);
|
|
9002
|
+
React__namespace.useEffect(() => {
|
|
9003
|
+
if (prevValueRef.current !== value) {
|
|
9004
|
+
handleChange(value);
|
|
9005
|
+
prevValueRef.current = value;
|
|
9006
|
+
}
|
|
9007
|
+
}, [value, prevValueRef, handleChange]);
|
|
9008
|
+
return uncontrolledState;
|
|
9009
|
+
}
|
|
9010
|
+
var NAME = "VisuallyHidden";
|
|
9011
|
+
var VisuallyHidden = React__namespace.forwardRef(
|
|
9012
|
+
(props, forwardedRef) => {
|
|
9013
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9014
|
+
Primitive.span,
|
|
9015
|
+
{
|
|
9016
|
+
...props,
|
|
9017
|
+
ref: forwardedRef,
|
|
9018
|
+
style: {
|
|
9019
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
9020
|
+
position: "absolute",
|
|
9021
|
+
border: 0,
|
|
9022
|
+
width: 1,
|
|
9023
|
+
height: 1,
|
|
9024
|
+
padding: 0,
|
|
9025
|
+
margin: -1,
|
|
9026
|
+
overflow: "hidden",
|
|
9027
|
+
clip: "rect(0, 0, 0, 0)",
|
|
9028
|
+
whiteSpace: "nowrap",
|
|
9029
|
+
wordWrap: "normal",
|
|
9030
|
+
...props.style
|
|
9031
|
+
}
|
|
9032
|
+
}
|
|
9033
|
+
);
|
|
9034
|
+
}
|
|
9035
|
+
);
|
|
9036
|
+
VisuallyHidden.displayName = NAME;
|
|
9037
|
+
var Root = VisuallyHidden;
|
|
9038
|
+
var [createTooltipContext] = createContextScope("Tooltip", [
|
|
9039
|
+
createPopperScope
|
|
9040
|
+
]);
|
|
9041
|
+
var usePopperScope = createPopperScope();
|
|
9042
|
+
var PROVIDER_NAME = "TooltipProvider";
|
|
9043
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
9044
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
9045
|
+
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
9046
|
+
var TooltipProvider = (props) => {
|
|
9047
|
+
const {
|
|
9048
|
+
__scopeTooltip,
|
|
9049
|
+
delayDuration = DEFAULT_DELAY_DURATION,
|
|
9050
|
+
skipDelayDuration = 300,
|
|
9051
|
+
disableHoverableContent = false,
|
|
9052
|
+
children
|
|
9053
|
+
} = props;
|
|
9054
|
+
const [isOpenDelayed, setIsOpenDelayed] = React__namespace.useState(true);
|
|
9055
|
+
const isPointerInTransitRef = React__namespace.useRef(false);
|
|
9056
|
+
const skipDelayTimerRef = React__namespace.useRef(0);
|
|
9057
|
+
React__namespace.useEffect(() => {
|
|
9058
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
9059
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
9060
|
+
}, []);
|
|
9061
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9062
|
+
TooltipProviderContextProvider,
|
|
9063
|
+
{
|
|
9064
|
+
scope: __scopeTooltip,
|
|
9065
|
+
isOpenDelayed,
|
|
9066
|
+
delayDuration,
|
|
9067
|
+
onOpen: React__namespace.useCallback(() => {
|
|
9068
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
9069
|
+
setIsOpenDelayed(false);
|
|
9070
|
+
}, []),
|
|
9071
|
+
onClose: React__namespace.useCallback(() => {
|
|
9072
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
9073
|
+
skipDelayTimerRef.current = window.setTimeout(
|
|
9074
|
+
() => setIsOpenDelayed(true),
|
|
9075
|
+
skipDelayDuration
|
|
9076
|
+
);
|
|
9077
|
+
}, [skipDelayDuration]),
|
|
9078
|
+
isPointerInTransitRef,
|
|
9079
|
+
onPointerInTransitChange: React__namespace.useCallback((inTransit) => {
|
|
9080
|
+
isPointerInTransitRef.current = inTransit;
|
|
9081
|
+
}, []),
|
|
9082
|
+
disableHoverableContent,
|
|
9083
|
+
children
|
|
9084
|
+
}
|
|
9085
|
+
);
|
|
9086
|
+
};
|
|
9087
|
+
TooltipProvider.displayName = PROVIDER_NAME;
|
|
9088
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
9089
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
9090
|
+
var Tooltip$1 = (props) => {
|
|
9091
|
+
const {
|
|
9092
|
+
__scopeTooltip,
|
|
9093
|
+
children,
|
|
9094
|
+
open: openProp,
|
|
9095
|
+
defaultOpen = false,
|
|
9096
|
+
onOpenChange,
|
|
9097
|
+
disableHoverableContent: disableHoverableContentProp,
|
|
9098
|
+
delayDuration: delayDurationProp
|
|
9099
|
+
} = props;
|
|
9100
|
+
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
9101
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
9102
|
+
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
9103
|
+
const contentId = useId();
|
|
9104
|
+
const openTimerRef = React__namespace.useRef(0);
|
|
9105
|
+
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
9106
|
+
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
9107
|
+
const wasOpenDelayedRef = React__namespace.useRef(false);
|
|
9108
|
+
const [open = false, setOpen] = useControllableState({
|
|
9109
|
+
prop: openProp,
|
|
9110
|
+
defaultProp: defaultOpen,
|
|
9111
|
+
onChange: (open2) => {
|
|
9112
|
+
if (open2) {
|
|
9113
|
+
providerContext.onOpen();
|
|
9114
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
9115
|
+
} else {
|
|
9116
|
+
providerContext.onClose();
|
|
9117
|
+
}
|
|
9118
|
+
onOpenChange == null ? void 0 : onOpenChange(open2);
|
|
9119
|
+
}
|
|
9120
|
+
});
|
|
9121
|
+
const stateAttribute = React__namespace.useMemo(() => {
|
|
9122
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
9123
|
+
}, [open]);
|
|
9124
|
+
const handleOpen = React__namespace.useCallback(() => {
|
|
9125
|
+
window.clearTimeout(openTimerRef.current);
|
|
9126
|
+
openTimerRef.current = 0;
|
|
9127
|
+
wasOpenDelayedRef.current = false;
|
|
9128
|
+
setOpen(true);
|
|
9129
|
+
}, [setOpen]);
|
|
9130
|
+
const handleClose = React__namespace.useCallback(() => {
|
|
9131
|
+
window.clearTimeout(openTimerRef.current);
|
|
9132
|
+
openTimerRef.current = 0;
|
|
9133
|
+
setOpen(false);
|
|
9134
|
+
}, [setOpen]);
|
|
9135
|
+
const handleDelayedOpen = React__namespace.useCallback(() => {
|
|
9136
|
+
window.clearTimeout(openTimerRef.current);
|
|
9137
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
9138
|
+
wasOpenDelayedRef.current = true;
|
|
9139
|
+
setOpen(true);
|
|
9140
|
+
openTimerRef.current = 0;
|
|
9141
|
+
}, delayDuration);
|
|
9142
|
+
}, [delayDuration, setOpen]);
|
|
9143
|
+
React__namespace.useEffect(() => {
|
|
9144
|
+
return () => {
|
|
9145
|
+
if (openTimerRef.current) {
|
|
9146
|
+
window.clearTimeout(openTimerRef.current);
|
|
9147
|
+
openTimerRef.current = 0;
|
|
9148
|
+
}
|
|
9149
|
+
};
|
|
9150
|
+
}, []);
|
|
9151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9152
|
+
TooltipContextProvider,
|
|
9153
|
+
{
|
|
9154
|
+
scope: __scopeTooltip,
|
|
9155
|
+
contentId,
|
|
9156
|
+
open,
|
|
9157
|
+
stateAttribute,
|
|
9158
|
+
trigger,
|
|
9159
|
+
onTriggerChange: setTrigger,
|
|
9160
|
+
onTriggerEnter: React__namespace.useCallback(() => {
|
|
9161
|
+
if (providerContext.isOpenDelayed) handleDelayedOpen();
|
|
9162
|
+
else handleOpen();
|
|
9163
|
+
}, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen]),
|
|
9164
|
+
onTriggerLeave: React__namespace.useCallback(() => {
|
|
9165
|
+
if (disableHoverableContent) {
|
|
9166
|
+
handleClose();
|
|
9167
|
+
} else {
|
|
9168
|
+
window.clearTimeout(openTimerRef.current);
|
|
9169
|
+
openTimerRef.current = 0;
|
|
9170
|
+
}
|
|
9171
|
+
}, [handleClose, disableHoverableContent]),
|
|
9172
|
+
onOpen: handleOpen,
|
|
9173
|
+
onClose: handleClose,
|
|
9174
|
+
disableHoverableContent,
|
|
9175
|
+
children
|
|
9176
|
+
}
|
|
9177
|
+
) });
|
|
9178
|
+
};
|
|
9179
|
+
Tooltip$1.displayName = TOOLTIP_NAME;
|
|
9180
|
+
var TRIGGER_NAME = "TooltipTrigger";
|
|
9181
|
+
var TooltipTrigger = React__namespace.forwardRef(
|
|
9182
|
+
(props, forwardedRef) => {
|
|
9183
|
+
const { __scopeTooltip, ...triggerProps } = props;
|
|
9184
|
+
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
9185
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
9186
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
9187
|
+
const ref = React__namespace.useRef(null);
|
|
9188
|
+
const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
|
|
9189
|
+
const isPointerDownRef = React__namespace.useRef(false);
|
|
9190
|
+
const hasPointerMoveOpenedRef = React__namespace.useRef(false);
|
|
9191
|
+
const handlePointerUp = React__namespace.useCallback(() => isPointerDownRef.current = false, []);
|
|
9192
|
+
React__namespace.useEffect(() => {
|
|
9193
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
9194
|
+
}, [handlePointerUp]);
|
|
9195
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9196
|
+
Primitive.button,
|
|
9197
|
+
{
|
|
9198
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
9199
|
+
"data-state": context.stateAttribute,
|
|
9200
|
+
...triggerProps,
|
|
9201
|
+
ref: composedRefs,
|
|
9202
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
9203
|
+
if (event.pointerType === "touch") return;
|
|
9204
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
9205
|
+
context.onTriggerEnter();
|
|
9206
|
+
hasPointerMoveOpenedRef.current = true;
|
|
9207
|
+
}
|
|
9208
|
+
}),
|
|
9209
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
9210
|
+
context.onTriggerLeave();
|
|
9211
|
+
hasPointerMoveOpenedRef.current = false;
|
|
9212
|
+
}),
|
|
9213
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
9214
|
+
isPointerDownRef.current = true;
|
|
9215
|
+
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
9216
|
+
}),
|
|
9217
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
9218
|
+
if (!isPointerDownRef.current) context.onOpen();
|
|
9219
|
+
}),
|
|
9220
|
+
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
9221
|
+
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
9222
|
+
}
|
|
9223
|
+
) });
|
|
9224
|
+
}
|
|
9225
|
+
);
|
|
9226
|
+
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
9227
|
+
var PORTAL_NAME = "TooltipPortal";
|
|
9228
|
+
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
9229
|
+
forceMount: void 0
|
|
9230
|
+
});
|
|
9231
|
+
var TooltipPortal = (props) => {
|
|
9232
|
+
const { __scopeTooltip, forceMount, children, container } = props;
|
|
9233
|
+
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
9234
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { asChild: true, container, children }) }) });
|
|
9235
|
+
};
|
|
9236
|
+
TooltipPortal.displayName = PORTAL_NAME;
|
|
9237
|
+
var CONTENT_NAME = "TooltipContent";
|
|
9238
|
+
var TooltipContent$1 = React__namespace.forwardRef(
|
|
9239
|
+
(props, forwardedRef) => {
|
|
9240
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
9241
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
9242
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
9243
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
9244
|
+
}
|
|
9245
|
+
);
|
|
9246
|
+
var TooltipContentHoverable = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9247
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
9248
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
9249
|
+
const ref = React__namespace.useRef(null);
|
|
9250
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
9251
|
+
const [pointerGraceArea, setPointerGraceArea] = React__namespace.useState(null);
|
|
9252
|
+
const { trigger, onClose } = context;
|
|
9253
|
+
const content = ref.current;
|
|
9254
|
+
const { onPointerInTransitChange } = providerContext;
|
|
9255
|
+
const handleRemoveGraceArea = React__namespace.useCallback(() => {
|
|
9256
|
+
setPointerGraceArea(null);
|
|
9257
|
+
onPointerInTransitChange(false);
|
|
9258
|
+
}, [onPointerInTransitChange]);
|
|
9259
|
+
const handleCreateGraceArea = React__namespace.useCallback(
|
|
9260
|
+
(event, hoverTarget) => {
|
|
9261
|
+
const currentTarget = event.currentTarget;
|
|
9262
|
+
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
9263
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
9264
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
9265
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
9266
|
+
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
|
|
9267
|
+
setPointerGraceArea(graceArea);
|
|
9268
|
+
onPointerInTransitChange(true);
|
|
9269
|
+
},
|
|
9270
|
+
[onPointerInTransitChange]
|
|
9271
|
+
);
|
|
9272
|
+
React__namespace.useEffect(() => {
|
|
9273
|
+
return () => handleRemoveGraceArea();
|
|
9274
|
+
}, [handleRemoveGraceArea]);
|
|
9275
|
+
React__namespace.useEffect(() => {
|
|
9276
|
+
if (trigger && content) {
|
|
9277
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
9278
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
9279
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
9280
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
9281
|
+
return () => {
|
|
9282
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
9283
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
9284
|
+
};
|
|
9285
|
+
}
|
|
9286
|
+
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
9287
|
+
React__namespace.useEffect(() => {
|
|
9288
|
+
if (pointerGraceArea) {
|
|
9289
|
+
const handleTrackPointerGrace = (event) => {
|
|
9290
|
+
const target = event.target;
|
|
9291
|
+
const pointerPosition = { x: event.clientX, y: event.clientY };
|
|
9292
|
+
const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
|
|
9293
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
9294
|
+
if (hasEnteredTarget) {
|
|
9295
|
+
handleRemoveGraceArea();
|
|
9296
|
+
} else if (isPointerOutsideGraceArea) {
|
|
9297
|
+
handleRemoveGraceArea();
|
|
9298
|
+
onClose();
|
|
9299
|
+
}
|
|
9300
|
+
};
|
|
9301
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
9302
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
9303
|
+
}
|
|
9304
|
+
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
9305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
9306
|
+
});
|
|
9307
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
9308
|
+
var TooltipContentImpl = React__namespace.forwardRef(
|
|
9309
|
+
(props, forwardedRef) => {
|
|
9310
|
+
const {
|
|
9311
|
+
__scopeTooltip,
|
|
9312
|
+
children,
|
|
9313
|
+
"aria-label": ariaLabel,
|
|
9314
|
+
onEscapeKeyDown,
|
|
9315
|
+
onPointerDownOutside,
|
|
9316
|
+
...contentProps
|
|
9317
|
+
} = props;
|
|
9318
|
+
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
9319
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
9320
|
+
const { onClose } = context;
|
|
9321
|
+
React__namespace.useEffect(() => {
|
|
9322
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
9323
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
9324
|
+
}, [onClose]);
|
|
9325
|
+
React__namespace.useEffect(() => {
|
|
9326
|
+
if (context.trigger) {
|
|
9327
|
+
const handleScroll = (event) => {
|
|
9328
|
+
const target = event.target;
|
|
9329
|
+
if (target == null ? void 0 : target.contains(context.trigger)) onClose();
|
|
9330
|
+
};
|
|
9331
|
+
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
9332
|
+
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
9333
|
+
}
|
|
9334
|
+
}, [context.trigger, onClose]);
|
|
9335
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9336
|
+
DismissableLayer,
|
|
9337
|
+
{
|
|
9338
|
+
asChild: true,
|
|
9339
|
+
disableOutsidePointerEvents: false,
|
|
9340
|
+
onEscapeKeyDown,
|
|
9341
|
+
onPointerDownOutside,
|
|
9342
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
9343
|
+
onDismiss: onClose,
|
|
9344
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9345
|
+
Content,
|
|
9346
|
+
{
|
|
9347
|
+
"data-state": context.stateAttribute,
|
|
9348
|
+
...popperScope,
|
|
9349
|
+
...contentProps,
|
|
9350
|
+
ref: forwardedRef,
|
|
9351
|
+
style: {
|
|
9352
|
+
...contentProps.style,
|
|
9353
|
+
// re-namespace exposed content custom properties
|
|
9354
|
+
...{
|
|
9355
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
9356
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
9357
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
9358
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
9359
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
9360
|
+
}
|
|
9361
|
+
},
|
|
9362
|
+
children: [
|
|
9363
|
+
/* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
|
|
9364
|
+
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
9365
|
+
]
|
|
9366
|
+
}
|
|
9367
|
+
)
|
|
9368
|
+
}
|
|
9369
|
+
);
|
|
9370
|
+
}
|
|
9371
|
+
);
|
|
9372
|
+
TooltipContent$1.displayName = CONTENT_NAME;
|
|
9373
|
+
var ARROW_NAME = "TooltipArrow";
|
|
9374
|
+
var TooltipArrow = React__namespace.forwardRef(
|
|
9375
|
+
(props, forwardedRef) => {
|
|
9376
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
9377
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
9378
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
9379
|
+
ARROW_NAME,
|
|
9380
|
+
__scopeTooltip
|
|
9381
|
+
);
|
|
9382
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
9383
|
+
}
|
|
9384
|
+
);
|
|
9385
|
+
TooltipArrow.displayName = ARROW_NAME;
|
|
9386
|
+
function getExitSideFromRect(point, rect) {
|
|
9387
|
+
const top = Math.abs(rect.top - point.y);
|
|
9388
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
9389
|
+
const right = Math.abs(rect.right - point.x);
|
|
9390
|
+
const left = Math.abs(rect.left - point.x);
|
|
9391
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
9392
|
+
case left:
|
|
9393
|
+
return "left";
|
|
9394
|
+
case right:
|
|
9395
|
+
return "right";
|
|
9396
|
+
case top:
|
|
9397
|
+
return "top";
|
|
9398
|
+
case bottom:
|
|
9399
|
+
return "bottom";
|
|
9400
|
+
default:
|
|
9401
|
+
throw new Error("unreachable");
|
|
9402
|
+
}
|
|
9403
|
+
}
|
|
9404
|
+
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
|
|
9405
|
+
const paddedExitPoints = [];
|
|
9406
|
+
switch (exitSide) {
|
|
9407
|
+
case "top":
|
|
9408
|
+
paddedExitPoints.push(
|
|
9409
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
|
|
9410
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
9411
|
+
);
|
|
9412
|
+
break;
|
|
9413
|
+
case "bottom":
|
|
9414
|
+
paddedExitPoints.push(
|
|
9415
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
9416
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
|
|
9417
|
+
);
|
|
9418
|
+
break;
|
|
9419
|
+
case "left":
|
|
9420
|
+
paddedExitPoints.push(
|
|
9421
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
|
|
9422
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
9423
|
+
);
|
|
9424
|
+
break;
|
|
9425
|
+
case "right":
|
|
9426
|
+
paddedExitPoints.push(
|
|
9427
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
9428
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
|
|
9429
|
+
);
|
|
9430
|
+
break;
|
|
9431
|
+
}
|
|
9432
|
+
return paddedExitPoints;
|
|
9433
|
+
}
|
|
9434
|
+
function getPointsFromRect(rect) {
|
|
9435
|
+
const { top, right, bottom, left } = rect;
|
|
9436
|
+
return [
|
|
9437
|
+
{ x: left, y: top },
|
|
9438
|
+
{ x: right, y: top },
|
|
9439
|
+
{ x: right, y: bottom },
|
|
9440
|
+
{ x: left, y: bottom }
|
|
9441
|
+
];
|
|
9442
|
+
}
|
|
9443
|
+
function isPointInPolygon(point, polygon) {
|
|
9444
|
+
const { x, y } = point;
|
|
9445
|
+
let inside = false;
|
|
9446
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
9447
|
+
const xi = polygon[i].x;
|
|
9448
|
+
const yi = polygon[i].y;
|
|
9449
|
+
const xj = polygon[j].x;
|
|
9450
|
+
const yj = polygon[j].y;
|
|
9451
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
9452
|
+
if (intersect) inside = !inside;
|
|
9453
|
+
}
|
|
9454
|
+
return inside;
|
|
9455
|
+
}
|
|
9456
|
+
function getHull(points) {
|
|
9457
|
+
const newPoints = points.slice();
|
|
9458
|
+
newPoints.sort((a, b) => {
|
|
9459
|
+
if (a.x < b.x) return -1;
|
|
9460
|
+
else if (a.x > b.x) return 1;
|
|
9461
|
+
else if (a.y < b.y) return -1;
|
|
9462
|
+
else if (a.y > b.y) return 1;
|
|
9463
|
+
else return 0;
|
|
9464
|
+
});
|
|
9465
|
+
return getHullPresorted(newPoints);
|
|
9466
|
+
}
|
|
9467
|
+
function getHullPresorted(points) {
|
|
9468
|
+
if (points.length <= 1) return points.slice();
|
|
9469
|
+
const upperHull = [];
|
|
9470
|
+
for (let i = 0; i < points.length; i++) {
|
|
9471
|
+
const p = points[i];
|
|
9472
|
+
while (upperHull.length >= 2) {
|
|
9473
|
+
const q = upperHull[upperHull.length - 1];
|
|
9474
|
+
const r = upperHull[upperHull.length - 2];
|
|
9475
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
9476
|
+
else break;
|
|
9477
|
+
}
|
|
9478
|
+
upperHull.push(p);
|
|
9479
|
+
}
|
|
9480
|
+
upperHull.pop();
|
|
9481
|
+
const lowerHull = [];
|
|
9482
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
9483
|
+
const p = points[i];
|
|
9484
|
+
while (lowerHull.length >= 2) {
|
|
9485
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
9486
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
9487
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
9488
|
+
else break;
|
|
9489
|
+
}
|
|
9490
|
+
lowerHull.push(p);
|
|
9491
|
+
}
|
|
9492
|
+
lowerHull.pop();
|
|
9493
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
9494
|
+
return upperHull;
|
|
9495
|
+
} else {
|
|
9496
|
+
return upperHull.concat(lowerHull);
|
|
9497
|
+
}
|
|
9498
|
+
}
|
|
9499
|
+
var Provider = TooltipProvider;
|
|
9500
|
+
var Root3 = Tooltip$1;
|
|
9501
|
+
var Trigger = TooltipTrigger;
|
|
9502
|
+
var Portal = TooltipPortal;
|
|
9503
|
+
var Content2 = TooltipContent$1;
|
|
9504
|
+
var Arrow2 = TooltipArrow;
|
|
9505
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9506
|
+
Content2,
|
|
9507
|
+
{
|
|
9508
|
+
ref,
|
|
9509
|
+
sideOffset,
|
|
9510
|
+
className: cn(
|
|
9511
|
+
"z-50 max-w-64 rounded-lg bg-[var(--bg-default-dark)] p-2 text-sm leading-normal text-[var(--text-default-white)]",
|
|
9512
|
+
className
|
|
9513
|
+
),
|
|
9514
|
+
...props,
|
|
9515
|
+
children: [
|
|
9516
|
+
children,
|
|
9517
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9518
|
+
Arrow2,
|
|
9519
|
+
{
|
|
9520
|
+
width: 8,
|
|
9521
|
+
height: 4,
|
|
9522
|
+
style: { fill: "var(--bg-default-dark)" }
|
|
9523
|
+
}
|
|
9524
|
+
)
|
|
9525
|
+
]
|
|
9526
|
+
}
|
|
9527
|
+
) }));
|
|
9528
|
+
TooltipContent.displayName = "TooltipContent";
|
|
9529
|
+
function Tooltip({
|
|
9530
|
+
children,
|
|
9531
|
+
content,
|
|
9532
|
+
side = "top",
|
|
9533
|
+
align = "center",
|
|
9534
|
+
delayDuration = 300,
|
|
9535
|
+
sideOffset = 6,
|
|
9536
|
+
className
|
|
9537
|
+
}) {
|
|
9538
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Provider, { delayDuration, children: /* @__PURE__ */ jsxRuntime.jsxs(Root3, { children: [
|
|
9539
|
+
/* @__PURE__ */ jsxRuntime.jsx(Trigger, { asChild: true, children }),
|
|
9540
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9541
|
+
TooltipContent,
|
|
9542
|
+
{
|
|
9543
|
+
side,
|
|
9544
|
+
align,
|
|
9545
|
+
sideOffset,
|
|
9546
|
+
className,
|
|
9547
|
+
children: content
|
|
9548
|
+
}
|
|
9549
|
+
)
|
|
9550
|
+
] }) });
|
|
9551
|
+
}
|
|
6143
9552
|
const index = {
|
|
6144
9553
|
Button,
|
|
6145
9554
|
Badge,
|
|
@@ -6176,6 +9585,8 @@ const index = {
|
|
|
6176
9585
|
Avatar,
|
|
6177
9586
|
AvatarStack,
|
|
6178
9587
|
Breadcrumb,
|
|
9588
|
+
Tooltip,
|
|
9589
|
+
Popover,
|
|
6179
9590
|
cn,
|
|
6180
9591
|
useIsMobile
|
|
6181
9592
|
};
|
|
@@ -6196,6 +9607,7 @@ exports.Input = Input;
|
|
|
6196
9607
|
exports.Modal = Modal;
|
|
6197
9608
|
exports.Notification = Notification;
|
|
6198
9609
|
exports.OptionList = OptionList;
|
|
9610
|
+
exports.Popover = Popover;
|
|
6199
9611
|
exports.Radio = Radio;
|
|
6200
9612
|
exports.SearchInput = SearchInput;
|
|
6201
9613
|
exports.StatusTag = StatusTag;
|
|
@@ -6214,6 +9626,7 @@ exports.Toast = Toast;
|
|
|
6214
9626
|
exports.ToastStack = ToastStack;
|
|
6215
9627
|
exports.Toaster = Toaster;
|
|
6216
9628
|
exports.Toggle = Toggle;
|
|
9629
|
+
exports.Tooltip = Tooltip;
|
|
6217
9630
|
exports.cn = cn;
|
|
6218
9631
|
exports.default = index;
|
|
6219
9632
|
exports.useIsMobile = useIsMobile;
|