@dust-tt/sparkle 0.2.254 → 0.2.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3883 -451
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/BarHeader.js +3 -3
- package/dist/esm/components/BarHeader.js.map +1 -1
- package/dist/esm/components/Breadcrumbs.js +1 -1
- package/dist/esm/components/Breadcrumbs.js.map +1 -1
- package/dist/esm/components/Button.d.ts +5 -3
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +11 -3
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Citation.d.ts.map +1 -1
- package/dist/esm/components/Citation.js +1 -1
- package/dist/esm/components/Citation.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts.map +1 -1
- package/dist/esm/components/DataTable.js +1 -2
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/Dialog.d.ts +2 -1
- package/dist/esm/components/Dialog.d.ts.map +1 -1
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/components/DropdownMenu.d.ts +2 -2
- package/dist/esm/components/DropdownMenu.d.ts.map +1 -1
- package/dist/esm/components/DropdownMenu.js +8 -5
- package/dist/esm/components/DropdownMenu.js.map +1 -1
- package/dist/esm/components/ElementDialog.d.ts +1 -1
- package/dist/esm/components/ElementDialog.d.ts.map +1 -1
- package/dist/esm/components/ElementDialog.js +2 -2
- package/dist/esm/components/ElementDialog.js.map +1 -1
- package/dist/esm/components/IconButton.d.ts +2 -2
- package/dist/esm/components/IconButton.d.ts.map +1 -1
- package/dist/esm/components/IconButton.js +2 -2
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/IconToggleButton.d.ts +2 -2
- package/dist/esm/components/IconToggleButton.d.ts.map +1 -1
- package/dist/esm/components/IconToggleButton.js +2 -2
- package/dist/esm/components/IconToggleButton.js.map +1 -1
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/Searchbar.d.ts.map +1 -1
- package/dist/esm/components/Searchbar.js.map +1 -1
- package/dist/esm/components/Tab.js +1 -1
- package/dist/esm/components/Tab.js.map +1 -1
- package/dist/esm/components/Tooltip.d.ts +13 -7
- package/dist/esm/components/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip.js +18 -42
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/Tree.js +1 -1
- package/dist/esm/components/Tree.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -1
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/icons/solid/Dot.d.ts +5 -0
- package/dist/esm/icons/solid/Dot.d.ts.map +1 -0
- package/dist/esm/icons/solid/Dot.js +6 -0
- package/dist/esm/icons/solid/Dot.js.map +1 -0
- package/dist/esm/icons/solid/MagnifyingGlass.d.ts.map +1 -1
- package/dist/esm/icons/solid/MagnifyingGlass.js +2 -1
- package/dist/esm/icons/solid/MagnifyingGlass.js.map +1 -1
- package/dist/esm/icons/solid/index.d.ts +1 -0
- package/dist/esm/icons/solid/index.d.ts.map +1 -1
- package/dist/esm/icons/solid/index.js +1 -0
- package/dist/esm/icons/solid/index.js.map +1 -1
- package/dist/esm/icons/src/solid/dot.svg +3 -0
- package/dist/esm/icons/src/solid/magnifying-glass.svg +2 -1
- package/dist/esm/icons/src/stroke/dot.svg +3 -0
- package/dist/esm/icons/stroke/Dot.d.ts +5 -0
- package/dist/esm/icons/stroke/Dot.d.ts.map +1 -0
- package/dist/esm/icons/stroke/Dot.js +6 -0
- package/dist/esm/icons/stroke/Dot.js.map +1 -0
- package/dist/esm/icons/stroke/index.d.ts +1 -0
- package/dist/esm/icons/stroke/index.d.ts.map +1 -1
- package/dist/esm/icons/stroke/index.js +1 -0
- package/dist/esm/icons/stroke/index.js.map +1 -1
- package/dist/esm/stories/Button.stories.d.ts +2 -0
- package/dist/esm/stories/Button.stories.d.ts.map +1 -1
- package/dist/esm/stories/Button.stories.js +14 -3
- package/dist/esm/stories/Button.stories.js.map +1 -1
- package/dist/esm/stories/Citation.stories.js +1 -1
- package/dist/esm/stories/Citation.stories.js.map +1 -1
- package/dist/esm/stories/DataTable.stories.d.ts.map +1 -1
- package/dist/esm/stories/DataTable.stories.js.map +1 -1
- package/dist/esm/stories/Dialog.stories.d.ts.map +1 -1
- package/dist/esm/stories/Dialog.stories.js +1 -1
- package/dist/esm/stories/Dialog.stories.js.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.js +2 -2
- package/dist/esm/stories/DropdownMenu.stories.js.map +1 -1
- package/dist/esm/stories/IconButton.stories.js +3 -3
- package/dist/esm/stories/IconButton.stories.js.map +1 -1
- package/dist/esm/stories/TextArea.stories.d.ts.map +1 -1
- package/dist/esm/stories/TextArea.stories.js +18 -3
- package/dist/esm/stories/TextArea.stories.js.map +1 -1
- package/dist/esm/stories/Tooltip.stories.d.ts +3 -8
- package/dist/esm/stories/Tooltip.stories.d.ts.map +1 -1
- package/dist/esm/stories/Tooltip.stories.js +10 -23
- package/dist/esm/stories/Tooltip.stories.js.map +1 -1
- package/dist/esm/stories/Tree.stories.d.ts.map +1 -1
- package/dist/esm/stories/Tree.stories.js +4 -3
- package/dist/esm/stories/Tree.stories.js.map +1 -1
- package/dist/sparkle.css +98 -68
- package/package.json +4 -1
- package/src/components/BarHeader.tsx +0 -3
- package/src/components/Breadcrumbs.tsx +2 -2
- package/src/components/Button.tsx +16 -14
- package/src/components/Citation.tsx +1 -7
- package/src/components/DataTable.tsx +11 -8
- package/src/components/Dialog.tsx +4 -4
- package/src/components/DropdownMenu.tsx +41 -31
- package/src/components/ElementDialog.tsx +4 -1
- package/src/components/IconButton.tsx +8 -6
- package/src/components/IconToggleButton.tsx +8 -6
- package/src/components/Input.tsx +1 -1
- package/src/components/Searchbar.tsx +2 -4
- package/src/components/Tab.tsx +1 -1
- package/src/components/Tooltip.tsx +48 -78
- package/src/components/Tree.tsx +5 -1
- package/src/components/index.ts +7 -1
- package/src/icons/solid/Dot.tsx +15 -0
- package/src/icons/solid/MagnifyingGlass.tsx +7 -1
- package/src/icons/solid/index.ts +1 -0
- package/src/icons/src/solid/dot.svg +3 -0
- package/src/icons/src/solid/magnifying-glass.svg +2 -1
- package/src/icons/src/stroke/dot.svg +3 -0
- package/src/icons/stroke/Dot.tsx +20 -0
- package/src/icons/stroke/index.ts +1 -0
- package/src/stories/Button.stories.tsx +47 -3
- package/src/stories/Citation.stories.tsx +1 -1
- package/src/stories/DataTable.stories.tsx +3 -1
- package/src/stories/Dialog.stories.tsx +1 -0
- package/src/stories/DropdownMenu.stories.tsx +6 -3
- package/src/stories/IconButton.stories.tsx +3 -3
- package/src/stories/TextArea.stories.tsx +19 -4
- package/src/stories/Tooltip.stories.tsx +31 -50
- package/src/stories/Tree.stories.tsx +12 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var url = require('url');
|
|
5
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var url = require('url');
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -295,6 +295,9 @@ var SvgDocumentText$1 = function (props) { return (React__namespace.createElemen
|
|
|
295
295
|
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M20 9v13H4V2h9v7h7ZM8 7v2h3V7H8Zm0 4v2h8v-2H8Zm0 4v2h8v-2H8Z", clipRule: "evenodd" }),
|
|
296
296
|
React__namespace.createElement("path", { fill: "currentColor", d: "M20 7h-5V2.003L20 7Z" }))); };
|
|
297
297
|
|
|
298
|
+
var SvgDot$1 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
299
|
+
React__namespace.createElement("path", { fill: "currentColor", d: "M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z" }))); };
|
|
300
|
+
|
|
298
301
|
var SvgDust$1 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
299
302
|
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 7a5 5 0 0 0-5-5H2v10h4.998A2.5 2.5 0 0 0 7 17H2v5h5a2.5 2.5 0 0 0 0-5h5v5h5v-5h5v-5h-5a5 5 0 0 0 5-5V2H12v5Zm-5 3a3 3 0 0 0 0-6v6Zm7-3a3 3 0 1 0 6 0h-6Zm-2 0a5 5 0 0 0 5 5H7a5 5 0 0 0 5-5Z", clipRule: "evenodd" }))); };
|
|
300
303
|
|
|
@@ -410,7 +413,8 @@ var SvgMagic$1 = function (props) { return (React__namespace.createElement("svg"
|
|
|
410
413
|
React__namespace.createElement("path", { fill: "currentColor", d: "m16.02 17.435 1.415-1.414 4.242 4.242-1.414 1.415-4.242-4.243ZM4.364 4.657l4.984 1.058a2 2 0 0 0 1.394-.213l4.61-2.586.354 5.028a2 2 0 0 0 .677 1.363l4.019 3.522-4.83 1.912a2 2 0 0 0-1.123 1.123l-1.913 4.83-3.522-4.018a2 2 0 0 0-1.363-.677l-5.028-.355 2.586-4.61a2 2 0 0 0 .213-1.393L4.364 4.657Z" }))); };
|
|
411
414
|
|
|
412
415
|
var SvgMagnifyingGlass$1 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
413
|
-
React__namespace.createElement("path", { fill: "currentColor", d: "
|
|
416
|
+
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M17.364 17.364A9 9 0 1 1 4.636 4.636a9 9 0 0 1 12.728 12.728Zm-2.121-2.121a6 6 0 1 1-8.486-8.485 6 6 0 0 1 8.486 8.485Z", clipRule: "evenodd" }),
|
|
417
|
+
React__namespace.createElement("path", { fill: "currentColor", d: "m22.374 20.253-3.535-3.535-2.121 2.12 3.535 3.536 2.121-2.121Z" }))); };
|
|
414
418
|
|
|
415
419
|
var SvgMarkPen$1 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
416
420
|
React__namespace.createElement("path", { fill: "currentColor", d: "m15.95 2.39 5.657 5.657a1 1 0 0 1 0 1.414l-7.778 7.778-2.122.707-1.414 1.415a1 1 0 0 1-1.414 0l-4.243-4.243a1 1 0 0 1 0-1.414L6.05 12.29l.707-2.122 7.779-7.778a1 1 0 0 1 1.414 0Zm.707 3.536-6.364 6.364 1.414 1.414 6.364-6.364-1.414-1.414ZM4.283 16.886l2.828 2.828-1.414 1.415-4.243-1.415 2.829-2.828Z" }))); };
|
|
@@ -40382,449 +40386,89 @@ Avatar.Stack = function (_a) {
|
|
|
40382
40386
|
React.createElement(Avatar, { size: size, name: "+" + String(Number(nbMoreItems) < 10 ? nbMoreItems : ""), isRounded: isRounded, clickable: true })))));
|
|
40383
40387
|
};
|
|
40384
40388
|
|
|
40385
|
-
|
|
40386
|
-
|
|
40387
|
-
|
|
40388
|
-
|
|
40389
|
-
|
|
40390
|
-
|
|
40391
|
-
"2xl": "s-h-20 s-w-20",
|
|
40392
|
-
};
|
|
40393
|
-
function Icon(_a) {
|
|
40394
|
-
var IconComponent = _a.visual, _b = _a.size, size = _b === void 0 ? "sm" : _b, _c = _a.className, className = _c === void 0 ? "" : _c;
|
|
40395
|
-
return IconComponent ? (React.createElement(IconComponent, { className: classNames(className, "s-shrink-0", IconSizes[size]) })) : null;
|
|
40396
|
-
}
|
|
40397
|
-
|
|
40398
|
-
function Tooltip(_a) {
|
|
40399
|
-
var children = _a.children, label = _a.label, _b = _a.position, position = _b === void 0 ? "above" : _b, contentChildren = _a.contentChildren;
|
|
40400
|
-
var _c = __read(React.useState(false), 2), isHovered = _c[0], setIsHovered = _c[1];
|
|
40401
|
-
var _d = __read(React.useState(null), 2), timerId = _d[0], setTimerId = _d[1];
|
|
40402
|
-
var _e = __read(React.useState(false), 2), isTouchDevice = _e[0], setIsTouchDevice = _e[1];
|
|
40403
|
-
var handleMouseOver = function () {
|
|
40404
|
-
var id = window.setTimeout(function () {
|
|
40405
|
-
setIsHovered(true);
|
|
40406
|
-
}, 600);
|
|
40407
|
-
setTimerId(id);
|
|
40408
|
-
};
|
|
40409
|
-
var handleMouseLeave = function () {
|
|
40410
|
-
if (timerId !== null) {
|
|
40411
|
-
clearTimeout(timerId);
|
|
40412
|
-
}
|
|
40413
|
-
setIsHovered(false);
|
|
40414
|
-
};
|
|
40415
|
-
React.useEffect(function () {
|
|
40416
|
-
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
40417
|
-
return function () {
|
|
40418
|
-
if (timerId) {
|
|
40419
|
-
window.clearTimeout(timerId);
|
|
40420
|
-
}
|
|
40421
|
-
};
|
|
40422
|
-
}, [timerId]);
|
|
40423
|
-
if (isTouchDevice) {
|
|
40424
|
-
return React.createElement(React.Fragment, null, children);
|
|
40425
|
-
}
|
|
40426
|
-
var baseClasses = classNames("s-absolute s-z-10 s-px-3 s-py-2 s-text-sm s-rounded-xl s-border s-shadow-md s-transition-all s-duration-500 s-ease-out s-transform", "s-border-structure-100 dark:s-border-structure-50-dark s-bg-structure-0 dark:s-bg-structure-100-dark s-text-element-700 dark:s-text-element-600-dark");
|
|
40427
|
-
var hiddenClasses = "s-translate-y-2 s-opacity-0 s-pointer-events-none"; // Added s-pointer-events-none
|
|
40428
|
-
var visibleClasses = "-s-translate-y-0 s-opacity-100";
|
|
40429
|
-
var hiddenOnMobileClasses = "s-hidden sm:s-block";
|
|
40430
|
-
var tooltipCenterClasses = "s-left-1/2 -s-translate-x-1/2";
|
|
40431
|
-
var tooltipPositionClasses = position === "above" ? "s-bottom-full s-mb-2" : "s-top-full s-mt-2";
|
|
40432
|
-
// if tooltip text is too long we need to wrap it
|
|
40433
|
-
var labelLength = (label === null || label === void 0 ? void 0 : label.length) || 0;
|
|
40434
|
-
var labelClasses = labelLength > 80 ? "s-w-[38em]" : "s-whitespace-nowrap";
|
|
40435
|
-
return (React.createElement("div", { onMouseEnter: handleMouseOver, onMouseLeave: handleMouseLeave, className: "s-relative s-inline-block" },
|
|
40436
|
-
children,
|
|
40437
|
-
React.createElement("div", { className: classNames("".concat(isHovered ? visibleClasses : hiddenClasses), baseClasses, hiddenOnMobileClasses, tooltipPositionClasses, tooltipCenterClasses, contentChildren ? "" : labelClasses), onAnimationEnd: function () { return setIsHovered(false); } }, contentChildren || label)));
|
|
40438
|
-
}
|
|
40439
|
-
|
|
40440
|
-
var textClasses = {
|
|
40441
|
-
xs: "s-text-xs s-font-semibold",
|
|
40442
|
-
sm: "s-text-sm s-font-semibold",
|
|
40443
|
-
md: "s-text-base s-font-bold",
|
|
40444
|
-
lg: "s-text-lg s-font-bold",
|
|
40445
|
-
};
|
|
40446
|
-
var sizeClasses$4 = {
|
|
40447
|
-
xs: "s-gap-x-1 s-px-3 s-h-7",
|
|
40448
|
-
sm: "s-gap-x-1 s-px-4 s-h-9",
|
|
40449
|
-
md: "s-gap-x-1.5 s-px-5 s-h-12",
|
|
40450
|
-
lg: "s-gap-x-3 s-px-6 s-h-16",
|
|
40451
|
-
};
|
|
40452
|
-
var sizeAvatarClasses = {
|
|
40453
|
-
xs: "s-gap-x-1 s-pl-0.5 s-pr-3 s-py-0.5",
|
|
40454
|
-
sm: "s-gap-x-1 s-pl-0.5 s-pr-4 s-py-0.5",
|
|
40455
|
-
md: "s-gap-x-1.5 s-pl-1 s-pr-5 s-py-1",
|
|
40456
|
-
lg: "s-gap-x-2 s-pl-0 s-pr-6 s-py-0",
|
|
40457
|
-
};
|
|
40458
|
-
var containerClasses = {
|
|
40459
|
-
xs: "s-px-0.5",
|
|
40460
|
-
sm: "s-px-1",
|
|
40461
|
-
md: "s-px-1",
|
|
40462
|
-
lg: "s-px-1",
|
|
40463
|
-
};
|
|
40464
|
-
var variantClasses$2 = {
|
|
40465
|
-
primary: {
|
|
40466
|
-
base: "s-text-white s-bg-action-500 s-border-action-600",
|
|
40467
|
-
hover: "hover:s-bg-action-400 hover:s-border-action-500",
|
|
40468
|
-
active: "active:s-bg-action-600 active:s-border-action-700",
|
|
40469
|
-
disabled: "s-text-white s-bg-action-200 s-border-action-200",
|
|
40470
|
-
dark: {
|
|
40471
|
-
base: "",
|
|
40472
|
-
hover: "",
|
|
40473
|
-
active: "",
|
|
40474
|
-
disabled: "dark:s-text-action-700-dark dark:s-bg-action-100-dark dark:s-border-action-200-dark dark:s-saturate-50",
|
|
40475
|
-
},
|
|
40476
|
-
},
|
|
40477
|
-
primaryWarning: {
|
|
40478
|
-
base: "s-text-white s-bg-warning-500 s-border-warning-600",
|
|
40479
|
-
hover: "hover:s-bg-warning-400 hover:s-border-warning-500",
|
|
40480
|
-
active: "active:s-bg-warning-600 active:s-border-warning-700",
|
|
40481
|
-
disabled: "s-text-white s-bg-warning-200 s-border-warning-200",
|
|
40482
|
-
dark: {
|
|
40483
|
-
base: "",
|
|
40484
|
-
hover: "",
|
|
40485
|
-
active: "",
|
|
40486
|
-
disabled: "dark:s-text-warning-700-dark dark:s-bg-warning-100-dark dark:s-border-warning-200-dark dark:s-saturate-50",
|
|
40487
|
-
},
|
|
40488
|
-
},
|
|
40489
|
-
secondary: {
|
|
40490
|
-
base: "s-text-action-500 s-border-structure-200 s-bg-structure-0",
|
|
40491
|
-
hover: "hover:s-bg-action-50 hover:s-border-action-200",
|
|
40492
|
-
active: "active:s-bg-action-100 active:s-border-action-500",
|
|
40493
|
-
disabled: "s-text-action-300 s-border-structure-200 s-bg-structure-0",
|
|
40494
|
-
dark: {
|
|
40495
|
-
base: "dark:s-text-action-600-dark dark:s-border-structure-200-dark dark:s-bg-structure-100-dark",
|
|
40496
|
-
hover: "dark:hover:s-text-action-700-dark dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
40497
|
-
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
40498
|
-
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
40499
|
-
},
|
|
40500
|
-
},
|
|
40501
|
-
secondaryWarning: {
|
|
40502
|
-
base: "s-text-warning-500 s-border-structure-200 s-bg-structure-0",
|
|
40503
|
-
hover: "hover:s-bg-warning-50 hover:s-border-warning-200",
|
|
40504
|
-
active: "active:s-bg-warning-100 active:s-border-warning-500",
|
|
40505
|
-
disabled: "s-text-warning-300 s-border-structure-200 s-bg-structure-0",
|
|
40506
|
-
dark: {
|
|
40507
|
-
base: "dark:s-text-warning-600-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
40508
|
-
hover: "dark:hover:s-bg-warning-50-dark dark:hover:s-border-warning-300-dark",
|
|
40509
|
-
active: "dark:active:s-bg-warning-100-dark dark:active:s-border-warning-500-dark",
|
|
40510
|
-
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
40511
|
-
},
|
|
40512
|
-
},
|
|
40513
|
-
tertiary: {
|
|
40514
|
-
base: "s-text-element-800 s-border-structure-200 s-bg-structure-0",
|
|
40515
|
-
hover: "hover:s-bg-action-50 hover:s-text-action-500 hover:s-border-action-200",
|
|
40516
|
-
active: "active:s-bg-action-100 active:s-text-action-600 active:s-border-action-500",
|
|
40517
|
-
disabled: "s-text-element-500 s-border-structure-200 s-bg-structure-0",
|
|
40518
|
-
dark: {
|
|
40519
|
-
base: "dark:s-text-element-800-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
40520
|
-
hover: "dark:hover:s-text-action-300 dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
40521
|
-
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
40522
|
-
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
40523
|
-
},
|
|
40524
|
-
},
|
|
40525
|
-
avatar: {
|
|
40526
|
-
base: "s-text-element-800 s-border-structure-200 s-bg-structure-0",
|
|
40527
|
-
hover: "hover:s-bg-action-50 hover:s-text-action-500 hover:s-border-action-200",
|
|
40528
|
-
active: "active:s-bg-action-100 active:s-text-action-600 active:s-border-action-500",
|
|
40529
|
-
disabled: "s-text-element-500 s-border-structure-200 s-bg-structure-0",
|
|
40530
|
-
dark: {
|
|
40531
|
-
base: "dark:s-text-element-700-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
40532
|
-
hover: "dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
40533
|
-
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
40534
|
-
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
40535
|
-
},
|
|
40536
|
-
},
|
|
40537
|
-
};
|
|
40538
|
-
var transitionClasses = "s-transition-all s-ease-out s-duration-200 s-cursor-pointer";
|
|
40539
|
-
var magnifyingClasses = "hover:s-scale-105 hover:s-drop-shadow-md active:s-scale-100 active:s-drop-shadow-none";
|
|
40540
|
-
function Button(_a) {
|
|
40541
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
40542
|
-
var _o = _a.variant, variant = _o === void 0 ? "primary" : _o, _p = _a.type, type = _p === void 0 ? "button" : _p, _q = _a.size, size = _q === void 0 ? "sm" : _q, onClick = _a.onClick, _r = _a.disabled, disabled = _r === void 0 ? false : _r, _s = _a.labelVisible, labelVisible = _s === void 0 ? true : _s, label = _a.label, icon = _a.icon, _t = _a.className, className = _t === void 0 ? "" : _t, _u = _a.tooltipPosition, tooltipPosition = _u === void 0 ? "above" : _u, _v = _a.hasMagnifying, hasMagnifying = _v === void 0 ? true : _v, _w = _a.disabledTooltip, disabledTooltip = _w === void 0 ? false : _w, avatar = _a.avatar;
|
|
40543
|
-
var buttonClasses = classNames("s-inline-flex s-items-center s-border s-scale-100 s-box-border s-whitespace-nowrap s-rounded-full", !avatar ? sizeClasses$4[size] : sizeAvatarClasses[size], textClasses[size], className);
|
|
40544
|
-
if (disabled) {
|
|
40545
|
-
buttonClasses = classNames(buttonClasses, (_b = variantClasses$2[variant]) === null || _b === void 0 ? void 0 : _b.disabled, (_c = variantClasses$2[variant]) === null || _c === void 0 ? void 0 : _c.dark.disabled, disabled ? "s-cursor-default" : "");
|
|
40546
|
-
}
|
|
40547
|
-
else {
|
|
40548
|
-
buttonClasses = classNames(buttonClasses, transitionClasses, hasMagnifying ? magnifyingClasses : "", (_d = variantClasses$2[variant]) === null || _d === void 0 ? void 0 : _d.base, (_e = variantClasses$2[variant]) === null || _e === void 0 ? void 0 : _e.hover, (_f = variantClasses$2[variant]) === null || _f === void 0 ? void 0 : _f.active, (_h = (_g = variantClasses$2[variant]) === null || _g === void 0 ? void 0 : _g.dark) === null || _h === void 0 ? void 0 : _h.base, (_k = (_j = variantClasses$2[variant]) === null || _j === void 0 ? void 0 : _j.dark) === null || _k === void 0 ? void 0 : _k.hover, (_m = (_l = variantClasses$2[variant]) === null || _l === void 0 ? void 0 : _l.dark) === null || _m === void 0 ? void 0 : _m.active);
|
|
40549
|
-
}
|
|
40550
|
-
var finalContainerClasses = classNames(containerClasses[size]);
|
|
40551
|
-
var buttonBase = (React.createElement("button", { type: "button", className: buttonClasses, onClick: onClick, disabled: disabled, "aria-label": label },
|
|
40552
|
-
icon && React.createElement(Icon, { visual: icon, size: size }),
|
|
40553
|
-
avatar && React.createElement(Avatar, { size: size, visual: avatar, isRounded: true }),
|
|
40554
|
-
labelVisible ? (React.createElement("div", { className: classNames("s-truncate", finalContainerClasses) }, label)) : null,
|
|
40555
|
-
type === "menu" && (React.createElement(Icon, { className: "s-opacity-50", visual: SvgChevronDown$1, size: size })),
|
|
40556
|
-
type === "select" && (React.createElement(Icon, { className: "s-opacity-60", visual: SvgChevronUpDown$1, size: size }))));
|
|
40557
|
-
return labelVisible || disabledTooltip ? (buttonBase) : (React.createElement(Tooltip, { label: label, position: tooltipPosition }, buttonBase));
|
|
40558
|
-
}
|
|
40559
|
-
Button.List = function (_a) {
|
|
40560
|
-
var children = _a.children, _b = _a.isWrapping, isWrapping = _b === void 0 ? false : _b, className = _a.className;
|
|
40561
|
-
var modifiedChildren = React.Children.map(children, function (child) {
|
|
40562
|
-
// Check if this child is a Button
|
|
40563
|
-
if (React.isValidElement(child) && child.type === Button) {
|
|
40564
|
-
// Clone the element with hasMagnifying set to false
|
|
40565
|
-
return React.cloneElement(child, { hasMagnifying: false });
|
|
40566
|
-
}
|
|
40567
|
-
return child;
|
|
40568
|
-
});
|
|
40569
|
-
return (React.createElement("div", { className: classNames(className ? className : "", "s-flex") },
|
|
40570
|
-
React.createElement("div", { className: classNames("s-flex s-flex-row s-gap-2", isWrapping ? "s-flex-wrap" : "s-flex-nowrap") }, modifiedChildren)));
|
|
40571
|
-
};
|
|
40572
|
-
|
|
40573
|
-
var aLink = function (_a) {
|
|
40574
|
-
var href = _a.href, className = _a.className, ariaCurrent = _a.ariaCurrent, ariaLabel = _a.ariaLabel, onClick = _a.onClick, children = _a.children, target = _a.target, rel = _a.rel;
|
|
40575
|
-
var hrefAsString = typeof href !== "string" ? url.format(href) : href;
|
|
40576
|
-
return (React.createElement("a", { href: hrefAsString, className: className, "aria-current": ariaCurrent, "aria-label": ariaLabel, onClick: onClick, target: target, rel: rel }, children));
|
|
40577
|
-
};
|
|
40578
|
-
var noHrefLink = function (_a) {
|
|
40579
|
-
var className = _a.className, ariaCurrent = _a.ariaCurrent, ariaLabel = _a.ariaLabel, onClick = _a.onClick, children = _a.children;
|
|
40580
|
-
return (React.createElement("a", { className: className, "aria-current": ariaCurrent, "arria-label": ariaLabel, onClick: onClick }, children));
|
|
40581
|
-
};
|
|
40582
|
-
var SparkleContext = React.createContext({
|
|
40583
|
-
components: {
|
|
40584
|
-
link: aLink,
|
|
40585
|
-
},
|
|
40586
|
-
});
|
|
40587
|
-
|
|
40588
|
-
var variantClasses$1 = {
|
|
40589
|
-
primary: "s-bg-structure-50 s-border s-border-structure-200",
|
|
40590
|
-
secondary: "s-bg-structure-0 s-border s-border-structure-100",
|
|
40591
|
-
tertiary: "s-border-structure-100/0 s-border s-border-structure-0",
|
|
40592
|
-
};
|
|
40593
|
-
var hoverVariantClasses = {
|
|
40594
|
-
primary: "hover:s-bg-white hover:s-border-structure-100 active:s-bg-structure-100 active:s-border-structure-200 s-cursor-pointer",
|
|
40595
|
-
secondary: "hover:s-bg-structure-50 hover:s-border-structure-200 active:s-bg-structure-100 active:s-border-structure-300 s-cursor-pointer",
|
|
40596
|
-
tertiary: "hover:s-bg-structure-50 hover:s-border-structure-100 active:s-bg-structure-100 active:s-border-structure-200 s-cursor-pointer",
|
|
40597
|
-
};
|
|
40598
|
-
var sizeClasses$3 = {
|
|
40599
|
-
sm: "s-p-3 s-rounded-xl",
|
|
40600
|
-
md: "s-p-4 s-rounded-2xl",
|
|
40601
|
-
lg: "s-p-5 s-rounded-3xl",
|
|
40602
|
-
};
|
|
40603
|
-
function CardButton(_a) {
|
|
40604
|
-
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.className, className = _d === void 0 ? "" : _d, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, href = _a.href, _e = _a.target, target = _e === void 0 ? "_blank" : _e, _f = _a.rel, rel = _f === void 0 ? "" : _f, replace = _a.replace, shallow = _a.shallow;
|
|
40605
|
-
var components = React.useContext(SparkleContext).components;
|
|
40606
|
-
var Link = href ? components.link : noHrefLink;
|
|
40607
|
-
var commonClasses = classNames("s-flex s-group s-transition s-duration-200 s-overflow-hidden", onClick ? hoverVariantClasses[variant] : "", variantClasses$1[variant], sizeClasses$3[size], className);
|
|
40608
|
-
if (href) {
|
|
40609
|
-
return (React.createElement(Link, { href: href, className: commonClasses, replace: replace, shallow: shallow, target: target, rel: rel }, children));
|
|
40610
|
-
}
|
|
40611
|
-
else {
|
|
40612
|
-
return (React.createElement("div", { className: commonClasses, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, children));
|
|
40389
|
+
// packages/core/primitive/src/primitive.tsx
|
|
40390
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
40391
|
+
return function handleEvent(event) {
|
|
40392
|
+
originalEventHandler?.(event);
|
|
40393
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
40394
|
+
return ourEventHandler?.(event);
|
|
40613
40395
|
}
|
|
40396
|
+
};
|
|
40614
40397
|
}
|
|
40615
40398
|
|
|
40616
|
-
|
|
40617
|
-
|
|
40618
|
-
|
|
40619
|
-
|
|
40620
|
-
|
|
40621
|
-
|
|
40622
|
-
|
|
40623
|
-
};
|
|
40624
|
-
var getWindowWidth = function () { return (isBrowser ? window.innerWidth : 0); };
|
|
40625
|
-
var titleClassNames = {
|
|
40626
|
-
base: "s-truncate s-font-medium s-text-element-900 s-w-full",
|
|
40627
|
-
list: "s-text-base",
|
|
40628
|
-
minimal: "s-overflow-hidden s-whitespace-nowrap ".concat(getWindowWidth() <= breakpoints$1.sm
|
|
40629
|
-
? "s-text-sm"
|
|
40630
|
-
: getWindowWidth() <= breakpoints$1.md
|
|
40631
|
-
? "s-text-base"
|
|
40632
|
-
: ""),
|
|
40633
|
-
};
|
|
40634
|
-
var subtitleClassNames = {
|
|
40635
|
-
base: "s-font-normal s-text-element-700 s-truncate s-w-full",
|
|
40636
|
-
list: "s-text-sm",
|
|
40637
|
-
minimal: "s-overflow-hidden s-whitespace-nowrap ".concat(getWindowWidth() <= breakpoints$1.sm
|
|
40638
|
-
? "s-text-xs"
|
|
40639
|
-
: getWindowWidth() <= breakpoints$1.md
|
|
40640
|
-
? "s-text-xs"
|
|
40641
|
-
: "s-text-sm"),
|
|
40642
|
-
};
|
|
40643
|
-
var descriptionClassNames = {
|
|
40644
|
-
base: "s-font-normal s-mb-1",
|
|
40645
|
-
list: "s-text-base s-text-element-800 s-line-clamp-3",
|
|
40646
|
-
};
|
|
40647
|
-
function renderVariantContent(props) {
|
|
40648
|
-
switch (props.variant) {
|
|
40649
|
-
case "list":
|
|
40650
|
-
return React.createElement(ListVariantContent, __assign({}, props));
|
|
40651
|
-
case "minimal":
|
|
40652
|
-
return React.createElement(MinimalVariantContent, __assign({}, props));
|
|
40653
|
-
default:
|
|
40654
|
-
return React.createElement(React.Fragment, null);
|
|
40655
|
-
}
|
|
40399
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
40400
|
+
function setRef$2(ref, value) {
|
|
40401
|
+
if (typeof ref === "function") {
|
|
40402
|
+
ref(value);
|
|
40403
|
+
} else if (ref !== null && ref !== void 0) {
|
|
40404
|
+
ref.current = value;
|
|
40405
|
+
}
|
|
40656
40406
|
}
|
|
40657
|
-
|
|
40658
|
-
|
|
40659
|
-
return (React.createElement("div", { className: "s-flex s-gap-2" },
|
|
40660
|
-
React.createElement(Avatar, { name: "Avatar of ".concat(title), visual: pictureUrl, size: "lg" }),
|
|
40661
|
-
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-2" },
|
|
40662
|
-
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-row s-gap-3" },
|
|
40663
|
-
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-0" },
|
|
40664
|
-
React.createElement("div", { className: classNames(titleClassNames["base"], titleClassNames.list) },
|
|
40665
|
-
"@",
|
|
40666
|
-
title),
|
|
40667
|
-
subtitle && (React.createElement("div", { className: classNames(subtitleClassNames["base"], subtitleClassNames.list) },
|
|
40668
|
-
"By: ",
|
|
40669
|
-
subtitle)))),
|
|
40670
|
-
React.createElement("div", { className: classNames(descriptionClassNames["base"], descriptionClassNames.list) }, description))));
|
|
40671
|
-
};
|
|
40672
|
-
var MinimalVariantContent = function (_a) {
|
|
40673
|
-
var title = _a.title, pictureUrl = _a.pictureUrl, subtitle = _a.subtitle, _b = _a.hasAction, hasAction = _b === void 0 ? true : _b, actionElement = _a.actionElement, description = _a.description, onClick = _a.onClick, onActionClick = _a.onActionClick;
|
|
40674
|
-
var actionButton = actionElement !== null && actionElement !== void 0 ? actionElement : (React.createElement(Button, { label: "", icon: SvgMore$1, variant: "tertiary", size: "sm", labelVisible: false, hasMagnifying: false, disabledTooltip: true, onClick: function (e) {
|
|
40675
|
-
e.stopPropagation();
|
|
40676
|
-
onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick();
|
|
40677
|
-
} }));
|
|
40678
|
-
return (React.createElement(React.Fragment, null,
|
|
40679
|
-
React.createElement("div", { id: "assistant-container", className: "s-flex s-grow s-flex-col s-justify-start s-gap-2 s-overflow-hidden s-py-1", onClick: function (e) {
|
|
40680
|
-
e.stopPropagation();
|
|
40681
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
40682
|
-
} },
|
|
40683
|
-
React.createElement("div", { className: "s-flex s-flex-row s-justify-between s-gap-2 s-overflow-hidden" },
|
|
40684
|
-
React.createElement("div", { id: "preview", className: "s-flex s-w-full s-min-w-0 s-flex-row s-items-center s-gap-2" },
|
|
40685
|
-
React.createElement("div", { id: "avatar-column", className: "s-w-fit" },
|
|
40686
|
-
React.createElement(Avatar, { name: "Avatar of ".concat(title), visual: pictureUrl, size: "md" })),
|
|
40687
|
-
React.createElement("div", { id: "details-column", className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-0 s-overflow-hidden" },
|
|
40688
|
-
React.createElement("div", { className: classNames(titleClassNames["base"], titleClassNames.minimal) },
|
|
40689
|
-
"@",
|
|
40690
|
-
title),
|
|
40691
|
-
React.createElement("div", { className: classNames(subtitleClassNames["base"], subtitleClassNames.minimal) },
|
|
40692
|
-
"By: ",
|
|
40693
|
-
subtitle))),
|
|
40694
|
-
React.createElement("div", { id: "actions-column", className: "s-flex s-w-fit s-shrink-0" }, hasAction && actionButton)),
|
|
40695
|
-
React.createElement("div", { className: "s-line-clamp-2 s-text-sm s-text-element-700" }, description))));
|
|
40696
|
-
};
|
|
40697
|
-
function AssistantPreview(props) {
|
|
40698
|
-
var onClick = props.onClick, variant = props.variant;
|
|
40699
|
-
// State to manage the visibility of the play button
|
|
40700
|
-
var _a = __read(React.useState(false), 2), isHovered = _a[0], setIsHovered = _a[1];
|
|
40701
|
-
return (React.createElement(CardButton, { variant: variant === "minimal" ? "secondary" : "tertiary", className: classNames("s-flex s-flex-col s-gap-2 s-border"), size: variant === "minimal" ? "sm" : "lg", onClick: onClick, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, renderVariantContent(__assign(__assign({}, props), { isHovered: isHovered }))));
|
|
40407
|
+
function composeRefs$2(...refs) {
|
|
40408
|
+
return (node) => refs.forEach((ref) => setRef$2(ref, node));
|
|
40702
40409
|
}
|
|
40703
|
-
|
|
40704
|
-
|
|
40705
|
-
var iconClasses$5 = {
|
|
40706
|
-
primary: {
|
|
40707
|
-
base: "s-text-action-500",
|
|
40708
|
-
hover: "hover:s-text-action-400",
|
|
40709
|
-
active: "active:s-text-action-600",
|
|
40710
|
-
disabled: "s-text-element-500",
|
|
40711
|
-
dark: {
|
|
40712
|
-
base: "dark:s-text-action-500-dark",
|
|
40713
|
-
hover: "dark:hover:s-text-action-500-dark",
|
|
40714
|
-
active: "dark:active:s-text-action-600-dark",
|
|
40715
|
-
disabled: "dark:s-text-element-500-dark",
|
|
40716
|
-
},
|
|
40717
|
-
},
|
|
40718
|
-
warning: {
|
|
40719
|
-
base: "s-text-warning-500",
|
|
40720
|
-
hover: "hover:s-text-warning-400",
|
|
40721
|
-
active: "active:s-text-warning-600",
|
|
40722
|
-
disabled: "s-text-element-500",
|
|
40723
|
-
dark: {
|
|
40724
|
-
base: "dark:s-text-warning-500-dark",
|
|
40725
|
-
hover: "dark:hover:s-text-warning-500-dark",
|
|
40726
|
-
active: "dark:active:s-text-warning-600-dark",
|
|
40727
|
-
disabled: "dark:s-text-element-500-dark",
|
|
40728
|
-
},
|
|
40729
|
-
},
|
|
40730
|
-
secondary: {
|
|
40731
|
-
base: "s-text-element-900",
|
|
40732
|
-
hover: "hover:s-text-action-400",
|
|
40733
|
-
active: "active:s-text-action-600",
|
|
40734
|
-
disabled: "s-text-element-500",
|
|
40735
|
-
dark: {
|
|
40736
|
-
base: "dark:s-text-element-900-dark",
|
|
40737
|
-
hover: "dark:hover:s-text-action-500-dark",
|
|
40738
|
-
active: "dark:active:s-text-action-600-dark",
|
|
40739
|
-
disabled: "dark:s-text-element-500-dark",
|
|
40740
|
-
},
|
|
40741
|
-
},
|
|
40742
|
-
tertiary: {
|
|
40743
|
-
base: "s-text-element-700",
|
|
40744
|
-
hover: "hover:s-text-action-400",
|
|
40745
|
-
active: "active:s-text-action-600",
|
|
40746
|
-
disabled: "s-text-element-500",
|
|
40747
|
-
dark: {
|
|
40748
|
-
base: "dark:s-text-element-700-dark",
|
|
40749
|
-
hover: "dark:hover:s-text-action-500-dark",
|
|
40750
|
-
active: "dark:active:s-text-action-600-dark",
|
|
40751
|
-
disabled: "dark:s-text-element-500-dark",
|
|
40752
|
-
},
|
|
40753
|
-
},
|
|
40754
|
-
white: {
|
|
40755
|
-
base: "s-text-white",
|
|
40756
|
-
hover: "hover:s-text-slate-100",
|
|
40757
|
-
active: "active:s-text-slate-200",
|
|
40758
|
-
disabled: "s-text-white/50",
|
|
40759
|
-
dark: {
|
|
40760
|
-
base: "s-text-white",
|
|
40761
|
-
hover: "hover:s-text-slate-100",
|
|
40762
|
-
active: "active:s-text-slate-200",
|
|
40763
|
-
disabled: "s-text-white/50",
|
|
40764
|
-
},
|
|
40765
|
-
},
|
|
40766
|
-
};
|
|
40767
|
-
function IconButton(_a) {
|
|
40768
|
-
var _b = _a.variant, variant = _b === void 0 ? "tertiary" : _b, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "above" : _d, icon = _a.icon, _e = _a.className, className = _e === void 0 ? "" : _e, _f = _a.size, size = _f === void 0 ? "sm" : _f;
|
|
40769
|
-
// Choose the correct group of classes based on 'type'
|
|
40770
|
-
var iconGroup = iconClasses$5[variant];
|
|
40771
|
-
var finalIconClasses = classNames(className, baseClasses$3, iconGroup.base, disabled ? iconGroup.disabled : iconGroup.hover, disabled ? "" : iconGroup.active, iconGroup.dark.base, disabled ? iconGroup.dark.disabled : iconGroup.dark.hover, disabled ? "" : iconGroup.dark.active);
|
|
40772
|
-
var IconButtonContent = (React.createElement("button", { className: finalIconClasses, onClick: disabled ? undefined : onClick, disabled: disabled }, icon && React.createElement(Icon, { visual: icon, size: size })));
|
|
40773
|
-
return tooltip ? (React.createElement(Tooltip, { label: tooltip, position: tooltipPosition }, IconButtonContent)) : (IconButtonContent);
|
|
40410
|
+
function useComposedRefs$1(...refs) {
|
|
40411
|
+
return React__namespace.useCallback(composeRefs$2(...refs), refs);
|
|
40774
40412
|
}
|
|
40775
40413
|
|
|
40776
|
-
|
|
40777
|
-
|
|
40778
|
-
|
|
40779
|
-
|
|
40780
|
-
|
|
40781
|
-
|
|
40782
|
-
|
|
40783
|
-
|
|
40784
|
-
|
|
40785
|
-
|
|
40786
|
-
|
|
40787
|
-
|
|
40788
|
-
|
|
40789
|
-
|
|
40790
|
-
|
|
40791
|
-
|
|
40792
|
-
|
|
40793
|
-
|
|
40794
|
-
|
|
40795
|
-
|
|
40796
|
-
|
|
40414
|
+
// packages/react/context/src/createContext.tsx
|
|
40415
|
+
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
40416
|
+
let defaultContexts = [];
|
|
40417
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
40418
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
40419
|
+
const index = defaultContexts.length;
|
|
40420
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
40421
|
+
const Provider = (props) => {
|
|
40422
|
+
const { scope, children, ...context } = props;
|
|
40423
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
40424
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
40425
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
40426
|
+
};
|
|
40427
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
40428
|
+
function useContext2(consumerName, scope) {
|
|
40429
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
40430
|
+
const context = React__namespace.useContext(Context);
|
|
40431
|
+
if (context) return context;
|
|
40432
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
40433
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
40434
|
+
}
|
|
40435
|
+
return [Provider, useContext2];
|
|
40436
|
+
}
|
|
40437
|
+
const createScope = () => {
|
|
40438
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
40439
|
+
return React__namespace.createContext(defaultContext);
|
|
40440
|
+
});
|
|
40441
|
+
return function useScope(scope) {
|
|
40442
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
40443
|
+
return React__namespace.useMemo(
|
|
40444
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
40445
|
+
[scope, contexts]
|
|
40446
|
+
);
|
|
40447
|
+
};
|
|
40448
|
+
};
|
|
40449
|
+
createScope.scopeName = scopeName;
|
|
40450
|
+
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
40797
40451
|
}
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
|
|
40801
|
-
|
|
40802
|
-
|
|
40803
|
-
|
|
40804
|
-
|
|
40805
|
-
|
|
40806
|
-
|
|
40452
|
+
function composeContextScopes$1(...scopes) {
|
|
40453
|
+
const baseScope = scopes[0];
|
|
40454
|
+
if (scopes.length === 1) return baseScope;
|
|
40455
|
+
const createScope = () => {
|
|
40456
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
40457
|
+
useScope: createScope2(),
|
|
40458
|
+
scopeName: createScope2.scopeName
|
|
40459
|
+
}));
|
|
40460
|
+
return function useComposedScopes(overrideScopes) {
|
|
40461
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
40462
|
+
const scopeProps = useScope(overrideScopes);
|
|
40463
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
40464
|
+
return { ...nextScopes2, ...currentScope };
|
|
40465
|
+
}, {});
|
|
40466
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
40467
|
+
};
|
|
40468
|
+
};
|
|
40469
|
+
createScope.scopeName = baseScope.scopeName;
|
|
40470
|
+
return createScope;
|
|
40807
40471
|
}
|
|
40808
|
-
BarHeader.ButtonBar = function (props) {
|
|
40809
|
-
switch (props.variant) {
|
|
40810
|
-
case "back":
|
|
40811
|
-
return (React.createElement(Button, { size: "sm", icon: SvgChevronLeft$1, variant: "tertiary", label: "Back", tooltipPosition: "below", labelVisible: false, onClick: props.onBack }));
|
|
40812
|
-
case "close":
|
|
40813
|
-
return (React.createElement(Button, { size: "sm", icon: SvgXMark$1, variant: "tertiary", label: "Close", tooltipPosition: "below", labelVisible: false, onClick: props.onClose }));
|
|
40814
|
-
case "validate":
|
|
40815
|
-
return (React.createElement(React.Fragment, null,
|
|
40816
|
-
React.createElement(Button, { size: "sm", label: "Cancel", variant: "tertiary", onClick: props.onCancel, disabled: !props.onCancel || props.isSaving }),
|
|
40817
|
-
React.createElement(Button, { size: "sm", label: props.isSaving
|
|
40818
|
-
? props.savingLabel || "Processing..."
|
|
40819
|
-
: props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
|
|
40820
|
-
case "conversation":
|
|
40821
|
-
return (React.createElement(React.Fragment, null,
|
|
40822
|
-
React.createElement(Button, { size: "sm", label: "Delete", icon: SvgTrash$1, variant: "tertiary", labelVisible: false, tooltipPosition: "below", onClick: props.onDelete }),
|
|
40823
|
-
React.createElement(Button, { size: "sm", label: "Share", icon: SvgArrowUpOnSquare$1, variant: "tertiary", onClick: props.onShare })));
|
|
40824
|
-
default:
|
|
40825
|
-
return null;
|
|
40826
|
-
}
|
|
40827
|
-
};
|
|
40828
40472
|
|
|
40829
40473
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
40830
40474
|
|
|
@@ -71733,6 +71377,3783 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
71733
71377
|
|
|
71734
71378
|
var reactDomExports = reactDom.exports;
|
|
71735
71379
|
|
|
71380
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
71381
|
+
function setRef$1(ref, value) {
|
|
71382
|
+
if (typeof ref === "function") {
|
|
71383
|
+
ref(value);
|
|
71384
|
+
} else if (ref !== null && ref !== void 0) {
|
|
71385
|
+
ref.current = value;
|
|
71386
|
+
}
|
|
71387
|
+
}
|
|
71388
|
+
function composeRefs$1(...refs) {
|
|
71389
|
+
return (node) => refs.forEach((ref) => setRef$1(ref, node));
|
|
71390
|
+
}
|
|
71391
|
+
|
|
71392
|
+
// packages/react/slot/src/Slot.tsx
|
|
71393
|
+
var Slot = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71394
|
+
const { children, ...slotProps } = props;
|
|
71395
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
71396
|
+
const slottable = childrenArray.find(isSlottable);
|
|
71397
|
+
if (slottable) {
|
|
71398
|
+
const newElement = slottable.props.children;
|
|
71399
|
+
const newChildren = childrenArray.map((child) => {
|
|
71400
|
+
if (child === slottable) {
|
|
71401
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
71402
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
71403
|
+
} else {
|
|
71404
|
+
return child;
|
|
71405
|
+
}
|
|
71406
|
+
});
|
|
71407
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
71408
|
+
}
|
|
71409
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
71410
|
+
});
|
|
71411
|
+
Slot.displayName = "Slot";
|
|
71412
|
+
var SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71413
|
+
const { children, ...slotProps } = props;
|
|
71414
|
+
if (React__namespace.isValidElement(children)) {
|
|
71415
|
+
const childrenRef = getElementRef$1(children);
|
|
71416
|
+
return React__namespace.cloneElement(children, {
|
|
71417
|
+
...mergeProps(slotProps, children.props),
|
|
71418
|
+
// @ts-ignore
|
|
71419
|
+
ref: forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef
|
|
71420
|
+
});
|
|
71421
|
+
}
|
|
71422
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
71423
|
+
});
|
|
71424
|
+
SlotClone.displayName = "SlotClone";
|
|
71425
|
+
var Slottable = ({ children }) => {
|
|
71426
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
71427
|
+
};
|
|
71428
|
+
function isSlottable(child) {
|
|
71429
|
+
return React__namespace.isValidElement(child) && child.type === Slottable;
|
|
71430
|
+
}
|
|
71431
|
+
function mergeProps(slotProps, childProps) {
|
|
71432
|
+
const overrideProps = { ...childProps };
|
|
71433
|
+
for (const propName in childProps) {
|
|
71434
|
+
const slotPropValue = slotProps[propName];
|
|
71435
|
+
const childPropValue = childProps[propName];
|
|
71436
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
71437
|
+
if (isHandler) {
|
|
71438
|
+
if (slotPropValue && childPropValue) {
|
|
71439
|
+
overrideProps[propName] = (...args) => {
|
|
71440
|
+
childPropValue(...args);
|
|
71441
|
+
slotPropValue(...args);
|
|
71442
|
+
};
|
|
71443
|
+
} else if (slotPropValue) {
|
|
71444
|
+
overrideProps[propName] = slotPropValue;
|
|
71445
|
+
}
|
|
71446
|
+
} else if (propName === "style") {
|
|
71447
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
71448
|
+
} else if (propName === "className") {
|
|
71449
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
71450
|
+
}
|
|
71451
|
+
}
|
|
71452
|
+
return { ...slotProps, ...overrideProps };
|
|
71453
|
+
}
|
|
71454
|
+
function getElementRef$1(element) {
|
|
71455
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
71456
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
71457
|
+
if (mayWarn) {
|
|
71458
|
+
return element.ref;
|
|
71459
|
+
}
|
|
71460
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
71461
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
71462
|
+
if (mayWarn) {
|
|
71463
|
+
return element.props.ref;
|
|
71464
|
+
}
|
|
71465
|
+
return element.props.ref || element.ref;
|
|
71466
|
+
}
|
|
71467
|
+
|
|
71468
|
+
// packages/react/primitive/src/Primitive.tsx
|
|
71469
|
+
var NODES = [
|
|
71470
|
+
"a",
|
|
71471
|
+
"button",
|
|
71472
|
+
"div",
|
|
71473
|
+
"form",
|
|
71474
|
+
"h2",
|
|
71475
|
+
"h3",
|
|
71476
|
+
"img",
|
|
71477
|
+
"input",
|
|
71478
|
+
"label",
|
|
71479
|
+
"li",
|
|
71480
|
+
"nav",
|
|
71481
|
+
"ol",
|
|
71482
|
+
"p",
|
|
71483
|
+
"span",
|
|
71484
|
+
"svg",
|
|
71485
|
+
"ul"
|
|
71486
|
+
];
|
|
71487
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
71488
|
+
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71489
|
+
const { asChild, ...primitiveProps } = props;
|
|
71490
|
+
const Comp = asChild ? Slot : node;
|
|
71491
|
+
if (typeof window !== "undefined") {
|
|
71492
|
+
window[Symbol.for("radix-ui")] = true;
|
|
71493
|
+
}
|
|
71494
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
71495
|
+
});
|
|
71496
|
+
Node.displayName = `Primitive.${node}`;
|
|
71497
|
+
return { ...primitive, [node]: Node };
|
|
71498
|
+
}, {});
|
|
71499
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
71500
|
+
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
71501
|
+
}
|
|
71502
|
+
|
|
71503
|
+
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
71504
|
+
function useCallbackRef(callback) {
|
|
71505
|
+
const callbackRef = React__namespace.useRef(callback);
|
|
71506
|
+
React__namespace.useEffect(() => {
|
|
71507
|
+
callbackRef.current = callback;
|
|
71508
|
+
});
|
|
71509
|
+
return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
71510
|
+
}
|
|
71511
|
+
|
|
71512
|
+
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
71513
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
71514
|
+
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
71515
|
+
React__namespace.useEffect(() => {
|
|
71516
|
+
const handleKeyDown = (event) => {
|
|
71517
|
+
if (event.key === "Escape") {
|
|
71518
|
+
onEscapeKeyDown(event);
|
|
71519
|
+
}
|
|
71520
|
+
};
|
|
71521
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
71522
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
71523
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
71524
|
+
}
|
|
71525
|
+
|
|
71526
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
71527
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
71528
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
71529
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
71530
|
+
var originalBodyPointerEvents;
|
|
71531
|
+
var DismissableLayerContext = React__namespace.createContext({
|
|
71532
|
+
layers: /* @__PURE__ */ new Set(),
|
|
71533
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
71534
|
+
branches: /* @__PURE__ */ new Set()
|
|
71535
|
+
});
|
|
71536
|
+
var DismissableLayer = React__namespace.forwardRef(
|
|
71537
|
+
(props, forwardedRef) => {
|
|
71538
|
+
const {
|
|
71539
|
+
disableOutsidePointerEvents = false,
|
|
71540
|
+
onEscapeKeyDown,
|
|
71541
|
+
onPointerDownOutside,
|
|
71542
|
+
onFocusOutside,
|
|
71543
|
+
onInteractOutside,
|
|
71544
|
+
onDismiss,
|
|
71545
|
+
...layerProps
|
|
71546
|
+
} = props;
|
|
71547
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71548
|
+
const [node, setNode] = React__namespace.useState(null);
|
|
71549
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
71550
|
+
const [, force] = React__namespace.useState({});
|
|
71551
|
+
const composedRefs = useComposedRefs$1(forwardedRef, (node2) => setNode(node2));
|
|
71552
|
+
const layers = Array.from(context.layers);
|
|
71553
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
71554
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
71555
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
71556
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
71557
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
71558
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
71559
|
+
const target = event.target;
|
|
71560
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71561
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
71562
|
+
onPointerDownOutside?.(event);
|
|
71563
|
+
onInteractOutside?.(event);
|
|
71564
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
71565
|
+
}, ownerDocument);
|
|
71566
|
+
const focusOutside = useFocusOutside((event) => {
|
|
71567
|
+
const target = event.target;
|
|
71568
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
71569
|
+
if (isFocusInBranch) return;
|
|
71570
|
+
onFocusOutside?.(event);
|
|
71571
|
+
onInteractOutside?.(event);
|
|
71572
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
71573
|
+
}, ownerDocument);
|
|
71574
|
+
useEscapeKeydown((event) => {
|
|
71575
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
71576
|
+
if (!isHighestLayer) return;
|
|
71577
|
+
onEscapeKeyDown?.(event);
|
|
71578
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
71579
|
+
event.preventDefault();
|
|
71580
|
+
onDismiss();
|
|
71581
|
+
}
|
|
71582
|
+
}, ownerDocument);
|
|
71583
|
+
React__namespace.useEffect(() => {
|
|
71584
|
+
if (!node) return;
|
|
71585
|
+
if (disableOutsidePointerEvents) {
|
|
71586
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
71587
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
71588
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
71589
|
+
}
|
|
71590
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
71591
|
+
}
|
|
71592
|
+
context.layers.add(node);
|
|
71593
|
+
dispatchUpdate();
|
|
71594
|
+
return () => {
|
|
71595
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
71596
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
71597
|
+
}
|
|
71598
|
+
};
|
|
71599
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
71600
|
+
React__namespace.useEffect(() => {
|
|
71601
|
+
return () => {
|
|
71602
|
+
if (!node) return;
|
|
71603
|
+
context.layers.delete(node);
|
|
71604
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
71605
|
+
dispatchUpdate();
|
|
71606
|
+
};
|
|
71607
|
+
}, [node, context]);
|
|
71608
|
+
React__namespace.useEffect(() => {
|
|
71609
|
+
const handleUpdate = () => force({});
|
|
71610
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71611
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
71612
|
+
}, []);
|
|
71613
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71614
|
+
Primitive.div,
|
|
71615
|
+
{
|
|
71616
|
+
...layerProps,
|
|
71617
|
+
ref: composedRefs,
|
|
71618
|
+
style: {
|
|
71619
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
71620
|
+
...props.style
|
|
71621
|
+
},
|
|
71622
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
71623
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
71624
|
+
onPointerDownCapture: composeEventHandlers(
|
|
71625
|
+
props.onPointerDownCapture,
|
|
71626
|
+
pointerDownOutside.onPointerDownCapture
|
|
71627
|
+
)
|
|
71628
|
+
}
|
|
71629
|
+
);
|
|
71630
|
+
}
|
|
71631
|
+
);
|
|
71632
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
71633
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
71634
|
+
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
71635
|
+
const context = React__namespace.useContext(DismissableLayerContext);
|
|
71636
|
+
const ref = React__namespace.useRef(null);
|
|
71637
|
+
const composedRefs = useComposedRefs$1(forwardedRef, ref);
|
|
71638
|
+
React__namespace.useEffect(() => {
|
|
71639
|
+
const node = ref.current;
|
|
71640
|
+
if (node) {
|
|
71641
|
+
context.branches.add(node);
|
|
71642
|
+
return () => {
|
|
71643
|
+
context.branches.delete(node);
|
|
71644
|
+
};
|
|
71645
|
+
}
|
|
71646
|
+
}, [context.branches]);
|
|
71647
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
71648
|
+
});
|
|
71649
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
71650
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
71651
|
+
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
71652
|
+
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
71653
|
+
const handleClickRef = React__namespace.useRef(() => {
|
|
71654
|
+
});
|
|
71655
|
+
React__namespace.useEffect(() => {
|
|
71656
|
+
const handlePointerDown = (event) => {
|
|
71657
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
71658
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
71659
|
+
handleAndDispatchCustomEvent(
|
|
71660
|
+
POINTER_DOWN_OUTSIDE,
|
|
71661
|
+
handlePointerDownOutside,
|
|
71662
|
+
eventDetail,
|
|
71663
|
+
{ discrete: true }
|
|
71664
|
+
);
|
|
71665
|
+
};
|
|
71666
|
+
const eventDetail = { originalEvent: event };
|
|
71667
|
+
if (event.pointerType === "touch") {
|
|
71668
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
71669
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
71670
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
71671
|
+
} else {
|
|
71672
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
71673
|
+
}
|
|
71674
|
+
} else {
|
|
71675
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
71676
|
+
}
|
|
71677
|
+
isPointerInsideReactTreeRef.current = false;
|
|
71678
|
+
};
|
|
71679
|
+
const timerId = window.setTimeout(() => {
|
|
71680
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
71681
|
+
}, 0);
|
|
71682
|
+
return () => {
|
|
71683
|
+
window.clearTimeout(timerId);
|
|
71684
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
71685
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
71686
|
+
};
|
|
71687
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
71688
|
+
return {
|
|
71689
|
+
// ensures we check React component tree (not just DOM tree)
|
|
71690
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
71691
|
+
};
|
|
71692
|
+
}
|
|
71693
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
71694
|
+
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
71695
|
+
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
71696
|
+
React__namespace.useEffect(() => {
|
|
71697
|
+
const handleFocus = (event) => {
|
|
71698
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
71699
|
+
const eventDetail = { originalEvent: event };
|
|
71700
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
71701
|
+
discrete: false
|
|
71702
|
+
});
|
|
71703
|
+
}
|
|
71704
|
+
};
|
|
71705
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
71706
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
71707
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
71708
|
+
return {
|
|
71709
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
71710
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
71711
|
+
};
|
|
71712
|
+
}
|
|
71713
|
+
function dispatchUpdate() {
|
|
71714
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
71715
|
+
document.dispatchEvent(event);
|
|
71716
|
+
}
|
|
71717
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
71718
|
+
const target = detail.originalEvent.target;
|
|
71719
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
71720
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
71721
|
+
if (discrete) {
|
|
71722
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
71723
|
+
} else {
|
|
71724
|
+
target.dispatchEvent(event);
|
|
71725
|
+
}
|
|
71726
|
+
}
|
|
71727
|
+
|
|
71728
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
71729
|
+
var useLayoutEffect2$1 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
71730
|
+
};
|
|
71731
|
+
|
|
71732
|
+
// packages/react/id/src/id.tsx
|
|
71733
|
+
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
71734
|
+
var count$1 = 0;
|
|
71735
|
+
function useId(deterministicId) {
|
|
71736
|
+
const [id, setId] = React__namespace.useState(useReactId());
|
|
71737
|
+
useLayoutEffect2$1(() => {
|
|
71738
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count$1++));
|
|
71739
|
+
}, [deterministicId]);
|
|
71740
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
71741
|
+
}
|
|
71742
|
+
|
|
71743
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
71744
|
+
const min$1 = Math.min;
|
|
71745
|
+
const max$1 = Math.max;
|
|
71746
|
+
const round = Math.round;
|
|
71747
|
+
const floor = Math.floor;
|
|
71748
|
+
const createCoords = v => ({
|
|
71749
|
+
x: v,
|
|
71750
|
+
y: v
|
|
71751
|
+
});
|
|
71752
|
+
const oppositeSideMap = {
|
|
71753
|
+
left: 'right',
|
|
71754
|
+
right: 'left',
|
|
71755
|
+
bottom: 'top',
|
|
71756
|
+
top: 'bottom'
|
|
71757
|
+
};
|
|
71758
|
+
const oppositeAlignmentMap = {
|
|
71759
|
+
start: 'end',
|
|
71760
|
+
end: 'start'
|
|
71761
|
+
};
|
|
71762
|
+
function clamp(start, value, end) {
|
|
71763
|
+
return max$1(start, min$1(value, end));
|
|
71764
|
+
}
|
|
71765
|
+
function evaluate(value, param) {
|
|
71766
|
+
return typeof value === 'function' ? value(param) : value;
|
|
71767
|
+
}
|
|
71768
|
+
function getSide(placement) {
|
|
71769
|
+
return placement.split('-')[0];
|
|
71770
|
+
}
|
|
71771
|
+
function getAlignment(placement) {
|
|
71772
|
+
return placement.split('-')[1];
|
|
71773
|
+
}
|
|
71774
|
+
function getOppositeAxis(axis) {
|
|
71775
|
+
return axis === 'x' ? 'y' : 'x';
|
|
71776
|
+
}
|
|
71777
|
+
function getAxisLength(axis) {
|
|
71778
|
+
return axis === 'y' ? 'height' : 'width';
|
|
71779
|
+
}
|
|
71780
|
+
function getSideAxis(placement) {
|
|
71781
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
71782
|
+
}
|
|
71783
|
+
function getAlignmentAxis(placement) {
|
|
71784
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
71785
|
+
}
|
|
71786
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
71787
|
+
if (rtl === void 0) {
|
|
71788
|
+
rtl = false;
|
|
71789
|
+
}
|
|
71790
|
+
const alignment = getAlignment(placement);
|
|
71791
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
71792
|
+
const length = getAxisLength(alignmentAxis);
|
|
71793
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
71794
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
71795
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
71796
|
+
}
|
|
71797
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
71798
|
+
}
|
|
71799
|
+
function getExpandedPlacements(placement) {
|
|
71800
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
71801
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
71802
|
+
}
|
|
71803
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
71804
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
71805
|
+
}
|
|
71806
|
+
function getSideList(side, isStart, rtl) {
|
|
71807
|
+
const lr = ['left', 'right'];
|
|
71808
|
+
const rl = ['right', 'left'];
|
|
71809
|
+
const tb = ['top', 'bottom'];
|
|
71810
|
+
const bt = ['bottom', 'top'];
|
|
71811
|
+
switch (side) {
|
|
71812
|
+
case 'top':
|
|
71813
|
+
case 'bottom':
|
|
71814
|
+
if (rtl) return isStart ? rl : lr;
|
|
71815
|
+
return isStart ? lr : rl;
|
|
71816
|
+
case 'left':
|
|
71817
|
+
case 'right':
|
|
71818
|
+
return isStart ? tb : bt;
|
|
71819
|
+
default:
|
|
71820
|
+
return [];
|
|
71821
|
+
}
|
|
71822
|
+
}
|
|
71823
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
71824
|
+
const alignment = getAlignment(placement);
|
|
71825
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
71826
|
+
if (alignment) {
|
|
71827
|
+
list = list.map(side => side + "-" + alignment);
|
|
71828
|
+
if (flipAlignment) {
|
|
71829
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
71830
|
+
}
|
|
71831
|
+
}
|
|
71832
|
+
return list;
|
|
71833
|
+
}
|
|
71834
|
+
function getOppositePlacement(placement) {
|
|
71835
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
71836
|
+
}
|
|
71837
|
+
function expandPaddingObject(padding) {
|
|
71838
|
+
return {
|
|
71839
|
+
top: 0,
|
|
71840
|
+
right: 0,
|
|
71841
|
+
bottom: 0,
|
|
71842
|
+
left: 0,
|
|
71843
|
+
...padding
|
|
71844
|
+
};
|
|
71845
|
+
}
|
|
71846
|
+
function getPaddingObject(padding) {
|
|
71847
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
71848
|
+
top: padding,
|
|
71849
|
+
right: padding,
|
|
71850
|
+
bottom: padding,
|
|
71851
|
+
left: padding
|
|
71852
|
+
};
|
|
71853
|
+
}
|
|
71854
|
+
function rectToClientRect(rect) {
|
|
71855
|
+
return {
|
|
71856
|
+
...rect,
|
|
71857
|
+
top: rect.y,
|
|
71858
|
+
left: rect.x,
|
|
71859
|
+
right: rect.x + rect.width,
|
|
71860
|
+
bottom: rect.y + rect.height
|
|
71861
|
+
};
|
|
71862
|
+
}
|
|
71863
|
+
|
|
71864
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
71865
|
+
let {
|
|
71866
|
+
reference,
|
|
71867
|
+
floating
|
|
71868
|
+
} = _ref;
|
|
71869
|
+
const sideAxis = getSideAxis(placement);
|
|
71870
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
71871
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
71872
|
+
const side = getSide(placement);
|
|
71873
|
+
const isVertical = sideAxis === 'y';
|
|
71874
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
71875
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
71876
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
71877
|
+
let coords;
|
|
71878
|
+
switch (side) {
|
|
71879
|
+
case 'top':
|
|
71880
|
+
coords = {
|
|
71881
|
+
x: commonX,
|
|
71882
|
+
y: reference.y - floating.height
|
|
71883
|
+
};
|
|
71884
|
+
break;
|
|
71885
|
+
case 'bottom':
|
|
71886
|
+
coords = {
|
|
71887
|
+
x: commonX,
|
|
71888
|
+
y: reference.y + reference.height
|
|
71889
|
+
};
|
|
71890
|
+
break;
|
|
71891
|
+
case 'right':
|
|
71892
|
+
coords = {
|
|
71893
|
+
x: reference.x + reference.width,
|
|
71894
|
+
y: commonY
|
|
71895
|
+
};
|
|
71896
|
+
break;
|
|
71897
|
+
case 'left':
|
|
71898
|
+
coords = {
|
|
71899
|
+
x: reference.x - floating.width,
|
|
71900
|
+
y: commonY
|
|
71901
|
+
};
|
|
71902
|
+
break;
|
|
71903
|
+
default:
|
|
71904
|
+
coords = {
|
|
71905
|
+
x: reference.x,
|
|
71906
|
+
y: reference.y
|
|
71907
|
+
};
|
|
71908
|
+
}
|
|
71909
|
+
switch (getAlignment(placement)) {
|
|
71910
|
+
case 'start':
|
|
71911
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
71912
|
+
break;
|
|
71913
|
+
case 'end':
|
|
71914
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
71915
|
+
break;
|
|
71916
|
+
}
|
|
71917
|
+
return coords;
|
|
71918
|
+
}
|
|
71919
|
+
|
|
71920
|
+
/**
|
|
71921
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
71922
|
+
* next to a reference element when it is given a certain positioning strategy.
|
|
71923
|
+
*
|
|
71924
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
71925
|
+
* write one for the platform you are using Floating UI with.
|
|
71926
|
+
*/
|
|
71927
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
71928
|
+
const {
|
|
71929
|
+
placement = 'bottom',
|
|
71930
|
+
strategy = 'absolute',
|
|
71931
|
+
middleware = [],
|
|
71932
|
+
platform
|
|
71933
|
+
} = config;
|
|
71934
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
71935
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
71936
|
+
let rects = await platform.getElementRects({
|
|
71937
|
+
reference,
|
|
71938
|
+
floating,
|
|
71939
|
+
strategy
|
|
71940
|
+
});
|
|
71941
|
+
let {
|
|
71942
|
+
x,
|
|
71943
|
+
y
|
|
71944
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
71945
|
+
let statefulPlacement = placement;
|
|
71946
|
+
let middlewareData = {};
|
|
71947
|
+
let resetCount = 0;
|
|
71948
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
71949
|
+
const {
|
|
71950
|
+
name,
|
|
71951
|
+
fn
|
|
71952
|
+
} = validMiddleware[i];
|
|
71953
|
+
const {
|
|
71954
|
+
x: nextX,
|
|
71955
|
+
y: nextY,
|
|
71956
|
+
data,
|
|
71957
|
+
reset
|
|
71958
|
+
} = await fn({
|
|
71959
|
+
x,
|
|
71960
|
+
y,
|
|
71961
|
+
initialPlacement: placement,
|
|
71962
|
+
placement: statefulPlacement,
|
|
71963
|
+
strategy,
|
|
71964
|
+
middlewareData,
|
|
71965
|
+
rects,
|
|
71966
|
+
platform,
|
|
71967
|
+
elements: {
|
|
71968
|
+
reference,
|
|
71969
|
+
floating
|
|
71970
|
+
}
|
|
71971
|
+
});
|
|
71972
|
+
x = nextX != null ? nextX : x;
|
|
71973
|
+
y = nextY != null ? nextY : y;
|
|
71974
|
+
middlewareData = {
|
|
71975
|
+
...middlewareData,
|
|
71976
|
+
[name]: {
|
|
71977
|
+
...middlewareData[name],
|
|
71978
|
+
...data
|
|
71979
|
+
}
|
|
71980
|
+
};
|
|
71981
|
+
if (reset && resetCount <= 50) {
|
|
71982
|
+
resetCount++;
|
|
71983
|
+
if (typeof reset === 'object') {
|
|
71984
|
+
if (reset.placement) {
|
|
71985
|
+
statefulPlacement = reset.placement;
|
|
71986
|
+
}
|
|
71987
|
+
if (reset.rects) {
|
|
71988
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
71989
|
+
reference,
|
|
71990
|
+
floating,
|
|
71991
|
+
strategy
|
|
71992
|
+
}) : reset.rects;
|
|
71993
|
+
}
|
|
71994
|
+
({
|
|
71995
|
+
x,
|
|
71996
|
+
y
|
|
71997
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
71998
|
+
}
|
|
71999
|
+
i = -1;
|
|
72000
|
+
continue;
|
|
72001
|
+
}
|
|
72002
|
+
}
|
|
72003
|
+
return {
|
|
72004
|
+
x,
|
|
72005
|
+
y,
|
|
72006
|
+
placement: statefulPlacement,
|
|
72007
|
+
strategy,
|
|
72008
|
+
middlewareData
|
|
72009
|
+
};
|
|
72010
|
+
};
|
|
72011
|
+
|
|
72012
|
+
/**
|
|
72013
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
72014
|
+
* element is overflowing a given clipping boundary on each side.
|
|
72015
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
72016
|
+
* - negative = how many pixels left before it will overflow
|
|
72017
|
+
* - 0 = lies flush with the boundary
|
|
72018
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
72019
|
+
*/
|
|
72020
|
+
async function detectOverflow(state, options) {
|
|
72021
|
+
var _await$platform$isEle;
|
|
72022
|
+
if (options === void 0) {
|
|
72023
|
+
options = {};
|
|
72024
|
+
}
|
|
72025
|
+
const {
|
|
72026
|
+
x,
|
|
72027
|
+
y,
|
|
72028
|
+
platform,
|
|
72029
|
+
rects,
|
|
72030
|
+
elements,
|
|
72031
|
+
strategy
|
|
72032
|
+
} = state;
|
|
72033
|
+
const {
|
|
72034
|
+
boundary = 'clippingAncestors',
|
|
72035
|
+
rootBoundary = 'viewport',
|
|
72036
|
+
elementContext = 'floating',
|
|
72037
|
+
altBoundary = false,
|
|
72038
|
+
padding = 0
|
|
72039
|
+
} = evaluate(options, state);
|
|
72040
|
+
const paddingObject = getPaddingObject(padding);
|
|
72041
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
72042
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
72043
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
72044
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
72045
|
+
boundary,
|
|
72046
|
+
rootBoundary,
|
|
72047
|
+
strategy
|
|
72048
|
+
}));
|
|
72049
|
+
const rect = elementContext === 'floating' ? {
|
|
72050
|
+
...rects.floating,
|
|
72051
|
+
x,
|
|
72052
|
+
y
|
|
72053
|
+
} : rects.reference;
|
|
72054
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
72055
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
72056
|
+
x: 1,
|
|
72057
|
+
y: 1
|
|
72058
|
+
} : {
|
|
72059
|
+
x: 1,
|
|
72060
|
+
y: 1
|
|
72061
|
+
};
|
|
72062
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
72063
|
+
rect,
|
|
72064
|
+
offsetParent,
|
|
72065
|
+
strategy
|
|
72066
|
+
}) : rect);
|
|
72067
|
+
return {
|
|
72068
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
72069
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
72070
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
72071
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
72072
|
+
};
|
|
72073
|
+
}
|
|
72074
|
+
|
|
72075
|
+
/**
|
|
72076
|
+
* Provides data to position an inner element of the floating element so that it
|
|
72077
|
+
* appears centered to the reference element.
|
|
72078
|
+
* @see https://floating-ui.com/docs/arrow
|
|
72079
|
+
*/
|
|
72080
|
+
const arrow$2 = options => ({
|
|
72081
|
+
name: 'arrow',
|
|
72082
|
+
options,
|
|
72083
|
+
async fn(state) {
|
|
72084
|
+
const {
|
|
72085
|
+
x,
|
|
72086
|
+
y,
|
|
72087
|
+
placement,
|
|
72088
|
+
rects,
|
|
72089
|
+
platform,
|
|
72090
|
+
elements,
|
|
72091
|
+
middlewareData
|
|
72092
|
+
} = state;
|
|
72093
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
72094
|
+
const {
|
|
72095
|
+
element,
|
|
72096
|
+
padding = 0
|
|
72097
|
+
} = evaluate(options, state) || {};
|
|
72098
|
+
if (element == null) {
|
|
72099
|
+
return {};
|
|
72100
|
+
}
|
|
72101
|
+
const paddingObject = getPaddingObject(padding);
|
|
72102
|
+
const coords = {
|
|
72103
|
+
x,
|
|
72104
|
+
y
|
|
72105
|
+
};
|
|
72106
|
+
const axis = getAlignmentAxis(placement);
|
|
72107
|
+
const length = getAxisLength(axis);
|
|
72108
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
72109
|
+
const isYAxis = axis === 'y';
|
|
72110
|
+
const minProp = isYAxis ? 'top' : 'left';
|
|
72111
|
+
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
72112
|
+
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
72113
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
72114
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
72115
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
72116
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
72117
|
+
|
|
72118
|
+
// DOM platform can return `window` as the `offsetParent`.
|
|
72119
|
+
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
72120
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
72121
|
+
}
|
|
72122
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
72123
|
+
|
|
72124
|
+
// If the padding is large enough that it causes the arrow to no longer be
|
|
72125
|
+
// centered, modify the padding so that it is centered.
|
|
72126
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
72127
|
+
const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
|
|
72128
|
+
const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
|
|
72129
|
+
|
|
72130
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
72131
|
+
// point is outside the floating element's bounds.
|
|
72132
|
+
const min$1$1 = minPadding;
|
|
72133
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
72134
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
72135
|
+
const offset = clamp(min$1$1, center, max);
|
|
72136
|
+
|
|
72137
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
72138
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
72139
|
+
// floating element itself. To ensure `shift()` continues to take action,
|
|
72140
|
+
// a single reset is performed when this is true.
|
|
72141
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
72142
|
+
const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max : 0;
|
|
72143
|
+
return {
|
|
72144
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
72145
|
+
data: {
|
|
72146
|
+
[axis]: offset,
|
|
72147
|
+
centerOffset: center - offset - alignmentOffset,
|
|
72148
|
+
...(shouldAddOffset && {
|
|
72149
|
+
alignmentOffset
|
|
72150
|
+
})
|
|
72151
|
+
},
|
|
72152
|
+
reset: shouldAddOffset
|
|
72153
|
+
};
|
|
72154
|
+
}
|
|
72155
|
+
});
|
|
72156
|
+
|
|
72157
|
+
/**
|
|
72158
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
72159
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
72160
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
72161
|
+
* @see https://floating-ui.com/docs/flip
|
|
72162
|
+
*/
|
|
72163
|
+
const flip$1 = function (options) {
|
|
72164
|
+
if (options === void 0) {
|
|
72165
|
+
options = {};
|
|
72166
|
+
}
|
|
72167
|
+
return {
|
|
72168
|
+
name: 'flip',
|
|
72169
|
+
options,
|
|
72170
|
+
async fn(state) {
|
|
72171
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
72172
|
+
const {
|
|
72173
|
+
placement,
|
|
72174
|
+
middlewareData,
|
|
72175
|
+
rects,
|
|
72176
|
+
initialPlacement,
|
|
72177
|
+
platform,
|
|
72178
|
+
elements
|
|
72179
|
+
} = state;
|
|
72180
|
+
const {
|
|
72181
|
+
mainAxis: checkMainAxis = true,
|
|
72182
|
+
crossAxis: checkCrossAxis = true,
|
|
72183
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
72184
|
+
fallbackStrategy = 'bestFit',
|
|
72185
|
+
fallbackAxisSideDirection = 'none',
|
|
72186
|
+
flipAlignment = true,
|
|
72187
|
+
...detectOverflowOptions
|
|
72188
|
+
} = evaluate(options, state);
|
|
72189
|
+
|
|
72190
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
72191
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
72192
|
+
// work.
|
|
72193
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
72194
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
72195
|
+
return {};
|
|
72196
|
+
}
|
|
72197
|
+
const side = getSide(placement);
|
|
72198
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
72199
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
72200
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
72201
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
72202
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
72203
|
+
}
|
|
72204
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
72205
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
72206
|
+
const overflows = [];
|
|
72207
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
72208
|
+
if (checkMainAxis) {
|
|
72209
|
+
overflows.push(overflow[side]);
|
|
72210
|
+
}
|
|
72211
|
+
if (checkCrossAxis) {
|
|
72212
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
72213
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
72214
|
+
}
|
|
72215
|
+
overflowsData = [...overflowsData, {
|
|
72216
|
+
placement,
|
|
72217
|
+
overflows
|
|
72218
|
+
}];
|
|
72219
|
+
|
|
72220
|
+
// One or more sides is overflowing.
|
|
72221
|
+
if (!overflows.every(side => side <= 0)) {
|
|
72222
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
72223
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
72224
|
+
const nextPlacement = placements[nextIndex];
|
|
72225
|
+
if (nextPlacement) {
|
|
72226
|
+
// Try next placement and re-run the lifecycle.
|
|
72227
|
+
return {
|
|
72228
|
+
data: {
|
|
72229
|
+
index: nextIndex,
|
|
72230
|
+
overflows: overflowsData
|
|
72231
|
+
},
|
|
72232
|
+
reset: {
|
|
72233
|
+
placement: nextPlacement
|
|
72234
|
+
}
|
|
72235
|
+
};
|
|
72236
|
+
}
|
|
72237
|
+
|
|
72238
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
72239
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
72240
|
+
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;
|
|
72241
|
+
|
|
72242
|
+
// Otherwise fallback.
|
|
72243
|
+
if (!resetPlacement) {
|
|
72244
|
+
switch (fallbackStrategy) {
|
|
72245
|
+
case 'bestFit':
|
|
72246
|
+
{
|
|
72247
|
+
var _overflowsData$map$so;
|
|
72248
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
72249
|
+
if (placement) {
|
|
72250
|
+
resetPlacement = placement;
|
|
72251
|
+
}
|
|
72252
|
+
break;
|
|
72253
|
+
}
|
|
72254
|
+
case 'initialPlacement':
|
|
72255
|
+
resetPlacement = initialPlacement;
|
|
72256
|
+
break;
|
|
72257
|
+
}
|
|
72258
|
+
}
|
|
72259
|
+
if (placement !== resetPlacement) {
|
|
72260
|
+
return {
|
|
72261
|
+
reset: {
|
|
72262
|
+
placement: resetPlacement
|
|
72263
|
+
}
|
|
72264
|
+
};
|
|
72265
|
+
}
|
|
72266
|
+
}
|
|
72267
|
+
return {};
|
|
72268
|
+
}
|
|
72269
|
+
};
|
|
72270
|
+
};
|
|
72271
|
+
|
|
72272
|
+
function getSideOffsets(overflow, rect) {
|
|
72273
|
+
return {
|
|
72274
|
+
top: overflow.top - rect.height,
|
|
72275
|
+
right: overflow.right - rect.width,
|
|
72276
|
+
bottom: overflow.bottom - rect.height,
|
|
72277
|
+
left: overflow.left - rect.width
|
|
72278
|
+
};
|
|
72279
|
+
}
|
|
72280
|
+
function isAnySideFullyClipped(overflow) {
|
|
72281
|
+
return sides.some(side => overflow[side] >= 0);
|
|
72282
|
+
}
|
|
72283
|
+
/**
|
|
72284
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
72285
|
+
* when it is not in the same clipping context as the reference element.
|
|
72286
|
+
* @see https://floating-ui.com/docs/hide
|
|
72287
|
+
*/
|
|
72288
|
+
const hide$1 = function (options) {
|
|
72289
|
+
if (options === void 0) {
|
|
72290
|
+
options = {};
|
|
72291
|
+
}
|
|
72292
|
+
return {
|
|
72293
|
+
name: 'hide',
|
|
72294
|
+
options,
|
|
72295
|
+
async fn(state) {
|
|
72296
|
+
const {
|
|
72297
|
+
rects
|
|
72298
|
+
} = state;
|
|
72299
|
+
const {
|
|
72300
|
+
strategy = 'referenceHidden',
|
|
72301
|
+
...detectOverflowOptions
|
|
72302
|
+
} = evaluate(options, state);
|
|
72303
|
+
switch (strategy) {
|
|
72304
|
+
case 'referenceHidden':
|
|
72305
|
+
{
|
|
72306
|
+
const overflow = await detectOverflow(state, {
|
|
72307
|
+
...detectOverflowOptions,
|
|
72308
|
+
elementContext: 'reference'
|
|
72309
|
+
});
|
|
72310
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
72311
|
+
return {
|
|
72312
|
+
data: {
|
|
72313
|
+
referenceHiddenOffsets: offsets,
|
|
72314
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
72315
|
+
}
|
|
72316
|
+
};
|
|
72317
|
+
}
|
|
72318
|
+
case 'escaped':
|
|
72319
|
+
{
|
|
72320
|
+
const overflow = await detectOverflow(state, {
|
|
72321
|
+
...detectOverflowOptions,
|
|
72322
|
+
altBoundary: true
|
|
72323
|
+
});
|
|
72324
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
72325
|
+
return {
|
|
72326
|
+
data: {
|
|
72327
|
+
escapedOffsets: offsets,
|
|
72328
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
72329
|
+
}
|
|
72330
|
+
};
|
|
72331
|
+
}
|
|
72332
|
+
default:
|
|
72333
|
+
{
|
|
72334
|
+
return {};
|
|
72335
|
+
}
|
|
72336
|
+
}
|
|
72337
|
+
}
|
|
72338
|
+
};
|
|
72339
|
+
};
|
|
72340
|
+
|
|
72341
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
72342
|
+
// Derivable.
|
|
72343
|
+
async function convertValueToCoords(state, options) {
|
|
72344
|
+
const {
|
|
72345
|
+
placement,
|
|
72346
|
+
platform,
|
|
72347
|
+
elements
|
|
72348
|
+
} = state;
|
|
72349
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
72350
|
+
const side = getSide(placement);
|
|
72351
|
+
const alignment = getAlignment(placement);
|
|
72352
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
72353
|
+
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
72354
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
72355
|
+
const rawValue = evaluate(options, state);
|
|
72356
|
+
|
|
72357
|
+
// eslint-disable-next-line prefer-const
|
|
72358
|
+
let {
|
|
72359
|
+
mainAxis,
|
|
72360
|
+
crossAxis,
|
|
72361
|
+
alignmentAxis
|
|
72362
|
+
} = typeof rawValue === 'number' ? {
|
|
72363
|
+
mainAxis: rawValue,
|
|
72364
|
+
crossAxis: 0,
|
|
72365
|
+
alignmentAxis: null
|
|
72366
|
+
} : {
|
|
72367
|
+
mainAxis: 0,
|
|
72368
|
+
crossAxis: 0,
|
|
72369
|
+
alignmentAxis: null,
|
|
72370
|
+
...rawValue
|
|
72371
|
+
};
|
|
72372
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
72373
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
72374
|
+
}
|
|
72375
|
+
return isVertical ? {
|
|
72376
|
+
x: crossAxis * crossAxisMulti,
|
|
72377
|
+
y: mainAxis * mainAxisMulti
|
|
72378
|
+
} : {
|
|
72379
|
+
x: mainAxis * mainAxisMulti,
|
|
72380
|
+
y: crossAxis * crossAxisMulti
|
|
72381
|
+
};
|
|
72382
|
+
}
|
|
72383
|
+
|
|
72384
|
+
/**
|
|
72385
|
+
* Modifies the placement by translating the floating element along the
|
|
72386
|
+
* specified axes.
|
|
72387
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
72388
|
+
* object may be passed.
|
|
72389
|
+
* @see https://floating-ui.com/docs/offset
|
|
72390
|
+
*/
|
|
72391
|
+
const offset$1 = function (options) {
|
|
72392
|
+
if (options === void 0) {
|
|
72393
|
+
options = 0;
|
|
72394
|
+
}
|
|
72395
|
+
return {
|
|
72396
|
+
name: 'offset',
|
|
72397
|
+
options,
|
|
72398
|
+
async fn(state) {
|
|
72399
|
+
const {
|
|
72400
|
+
x,
|
|
72401
|
+
y
|
|
72402
|
+
} = state;
|
|
72403
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
72404
|
+
return {
|
|
72405
|
+
x: x + diffCoords.x,
|
|
72406
|
+
y: y + diffCoords.y,
|
|
72407
|
+
data: diffCoords
|
|
72408
|
+
};
|
|
72409
|
+
}
|
|
72410
|
+
};
|
|
72411
|
+
};
|
|
72412
|
+
|
|
72413
|
+
/**
|
|
72414
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
72415
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
72416
|
+
* @see https://floating-ui.com/docs/shift
|
|
72417
|
+
*/
|
|
72418
|
+
const shift$1 = function (options) {
|
|
72419
|
+
if (options === void 0) {
|
|
72420
|
+
options = {};
|
|
72421
|
+
}
|
|
72422
|
+
return {
|
|
72423
|
+
name: 'shift',
|
|
72424
|
+
options,
|
|
72425
|
+
async fn(state) {
|
|
72426
|
+
const {
|
|
72427
|
+
x,
|
|
72428
|
+
y,
|
|
72429
|
+
placement
|
|
72430
|
+
} = state;
|
|
72431
|
+
const {
|
|
72432
|
+
mainAxis: checkMainAxis = true,
|
|
72433
|
+
crossAxis: checkCrossAxis = false,
|
|
72434
|
+
limiter = {
|
|
72435
|
+
fn: _ref => {
|
|
72436
|
+
let {
|
|
72437
|
+
x,
|
|
72438
|
+
y
|
|
72439
|
+
} = _ref;
|
|
72440
|
+
return {
|
|
72441
|
+
x,
|
|
72442
|
+
y
|
|
72443
|
+
};
|
|
72444
|
+
}
|
|
72445
|
+
},
|
|
72446
|
+
...detectOverflowOptions
|
|
72447
|
+
} = evaluate(options, state);
|
|
72448
|
+
const coords = {
|
|
72449
|
+
x,
|
|
72450
|
+
y
|
|
72451
|
+
};
|
|
72452
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
72453
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
72454
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
72455
|
+
let mainAxisCoord = coords[mainAxis];
|
|
72456
|
+
let crossAxisCoord = coords[crossAxis];
|
|
72457
|
+
if (checkMainAxis) {
|
|
72458
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
72459
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
72460
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
72461
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
72462
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
72463
|
+
}
|
|
72464
|
+
if (checkCrossAxis) {
|
|
72465
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
72466
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
72467
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
72468
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
72469
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
72470
|
+
}
|
|
72471
|
+
const limitedCoords = limiter.fn({
|
|
72472
|
+
...state,
|
|
72473
|
+
[mainAxis]: mainAxisCoord,
|
|
72474
|
+
[crossAxis]: crossAxisCoord
|
|
72475
|
+
});
|
|
72476
|
+
return {
|
|
72477
|
+
...limitedCoords,
|
|
72478
|
+
data: {
|
|
72479
|
+
x: limitedCoords.x - x,
|
|
72480
|
+
y: limitedCoords.y - y
|
|
72481
|
+
}
|
|
72482
|
+
};
|
|
72483
|
+
}
|
|
72484
|
+
};
|
|
72485
|
+
};
|
|
72486
|
+
/**
|
|
72487
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
72488
|
+
*/
|
|
72489
|
+
const limitShift$1 = function (options) {
|
|
72490
|
+
if (options === void 0) {
|
|
72491
|
+
options = {};
|
|
72492
|
+
}
|
|
72493
|
+
return {
|
|
72494
|
+
options,
|
|
72495
|
+
fn(state) {
|
|
72496
|
+
const {
|
|
72497
|
+
x,
|
|
72498
|
+
y,
|
|
72499
|
+
placement,
|
|
72500
|
+
rects,
|
|
72501
|
+
middlewareData
|
|
72502
|
+
} = state;
|
|
72503
|
+
const {
|
|
72504
|
+
offset = 0,
|
|
72505
|
+
mainAxis: checkMainAxis = true,
|
|
72506
|
+
crossAxis: checkCrossAxis = true
|
|
72507
|
+
} = evaluate(options, state);
|
|
72508
|
+
const coords = {
|
|
72509
|
+
x,
|
|
72510
|
+
y
|
|
72511
|
+
};
|
|
72512
|
+
const crossAxis = getSideAxis(placement);
|
|
72513
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
72514
|
+
let mainAxisCoord = coords[mainAxis];
|
|
72515
|
+
let crossAxisCoord = coords[crossAxis];
|
|
72516
|
+
const rawOffset = evaluate(offset, state);
|
|
72517
|
+
const computedOffset = typeof rawOffset === 'number' ? {
|
|
72518
|
+
mainAxis: rawOffset,
|
|
72519
|
+
crossAxis: 0
|
|
72520
|
+
} : {
|
|
72521
|
+
mainAxis: 0,
|
|
72522
|
+
crossAxis: 0,
|
|
72523
|
+
...rawOffset
|
|
72524
|
+
};
|
|
72525
|
+
if (checkMainAxis) {
|
|
72526
|
+
const len = mainAxis === 'y' ? 'height' : 'width';
|
|
72527
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
72528
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
72529
|
+
if (mainAxisCoord < limitMin) {
|
|
72530
|
+
mainAxisCoord = limitMin;
|
|
72531
|
+
} else if (mainAxisCoord > limitMax) {
|
|
72532
|
+
mainAxisCoord = limitMax;
|
|
72533
|
+
}
|
|
72534
|
+
}
|
|
72535
|
+
if (checkCrossAxis) {
|
|
72536
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
72537
|
+
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
72538
|
+
const isOriginSide = ['top', 'left'].includes(getSide(placement));
|
|
72539
|
+
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);
|
|
72540
|
+
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);
|
|
72541
|
+
if (crossAxisCoord < limitMin) {
|
|
72542
|
+
crossAxisCoord = limitMin;
|
|
72543
|
+
} else if (crossAxisCoord > limitMax) {
|
|
72544
|
+
crossAxisCoord = limitMax;
|
|
72545
|
+
}
|
|
72546
|
+
}
|
|
72547
|
+
return {
|
|
72548
|
+
[mainAxis]: mainAxisCoord,
|
|
72549
|
+
[crossAxis]: crossAxisCoord
|
|
72550
|
+
};
|
|
72551
|
+
}
|
|
72552
|
+
};
|
|
72553
|
+
};
|
|
72554
|
+
|
|
72555
|
+
/**
|
|
72556
|
+
* Provides data that allows you to change the size of the floating element —
|
|
72557
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
72558
|
+
* width of the reference element.
|
|
72559
|
+
* @see https://floating-ui.com/docs/size
|
|
72560
|
+
*/
|
|
72561
|
+
const size$1 = function (options) {
|
|
72562
|
+
if (options === void 0) {
|
|
72563
|
+
options = {};
|
|
72564
|
+
}
|
|
72565
|
+
return {
|
|
72566
|
+
name: 'size',
|
|
72567
|
+
options,
|
|
72568
|
+
async fn(state) {
|
|
72569
|
+
const {
|
|
72570
|
+
placement,
|
|
72571
|
+
rects,
|
|
72572
|
+
platform,
|
|
72573
|
+
elements
|
|
72574
|
+
} = state;
|
|
72575
|
+
const {
|
|
72576
|
+
apply = () => {},
|
|
72577
|
+
...detectOverflowOptions
|
|
72578
|
+
} = evaluate(options, state);
|
|
72579
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
72580
|
+
const side = getSide(placement);
|
|
72581
|
+
const alignment = getAlignment(placement);
|
|
72582
|
+
const isYAxis = getSideAxis(placement) === 'y';
|
|
72583
|
+
const {
|
|
72584
|
+
width,
|
|
72585
|
+
height
|
|
72586
|
+
} = rects.floating;
|
|
72587
|
+
let heightSide;
|
|
72588
|
+
let widthSide;
|
|
72589
|
+
if (side === 'top' || side === 'bottom') {
|
|
72590
|
+
heightSide = side;
|
|
72591
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
72592
|
+
} else {
|
|
72593
|
+
widthSide = side;
|
|
72594
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
72595
|
+
}
|
|
72596
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
72597
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
72598
|
+
const noShift = !state.middlewareData.shift;
|
|
72599
|
+
let availableHeight = overflowAvailableHeight;
|
|
72600
|
+
let availableWidth = overflowAvailableWidth;
|
|
72601
|
+
if (isYAxis) {
|
|
72602
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
72603
|
+
availableWidth = alignment || noShift ? min$1(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
72604
|
+
} else {
|
|
72605
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
72606
|
+
availableHeight = alignment || noShift ? min$1(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
72607
|
+
}
|
|
72608
|
+
if (noShift && !alignment) {
|
|
72609
|
+
const xMin = max$1(overflow.left, 0);
|
|
72610
|
+
const xMax = max$1(overflow.right, 0);
|
|
72611
|
+
const yMin = max$1(overflow.top, 0);
|
|
72612
|
+
const yMax = max$1(overflow.bottom, 0);
|
|
72613
|
+
if (isYAxis) {
|
|
72614
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
|
|
72615
|
+
} else {
|
|
72616
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
|
|
72617
|
+
}
|
|
72618
|
+
}
|
|
72619
|
+
await apply({
|
|
72620
|
+
...state,
|
|
72621
|
+
availableWidth,
|
|
72622
|
+
availableHeight
|
|
72623
|
+
});
|
|
72624
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
72625
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
72626
|
+
return {
|
|
72627
|
+
reset: {
|
|
72628
|
+
rects: true
|
|
72629
|
+
}
|
|
72630
|
+
};
|
|
72631
|
+
}
|
|
72632
|
+
return {};
|
|
72633
|
+
}
|
|
72634
|
+
};
|
|
72635
|
+
};
|
|
72636
|
+
|
|
72637
|
+
function getNodeName(node) {
|
|
72638
|
+
if (isNode(node)) {
|
|
72639
|
+
return (node.nodeName || '').toLowerCase();
|
|
72640
|
+
}
|
|
72641
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
72642
|
+
// returning `#document` an infinite loop won't occur.
|
|
72643
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
72644
|
+
return '#document';
|
|
72645
|
+
}
|
|
72646
|
+
function getWindow(node) {
|
|
72647
|
+
var _node$ownerDocument;
|
|
72648
|
+
return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
72649
|
+
}
|
|
72650
|
+
function getDocumentElement(node) {
|
|
72651
|
+
var _ref;
|
|
72652
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
72653
|
+
}
|
|
72654
|
+
function isNode(value) {
|
|
72655
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
72656
|
+
}
|
|
72657
|
+
function isElement(value) {
|
|
72658
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
72659
|
+
}
|
|
72660
|
+
function isHTMLElement(value) {
|
|
72661
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
72662
|
+
}
|
|
72663
|
+
function isShadowRoot(value) {
|
|
72664
|
+
// Browsers without `ShadowRoot` support.
|
|
72665
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
72666
|
+
return false;
|
|
72667
|
+
}
|
|
72668
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
72669
|
+
}
|
|
72670
|
+
function isOverflowElement(element) {
|
|
72671
|
+
const {
|
|
72672
|
+
overflow,
|
|
72673
|
+
overflowX,
|
|
72674
|
+
overflowY,
|
|
72675
|
+
display
|
|
72676
|
+
} = getComputedStyle$1(element);
|
|
72677
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
72678
|
+
}
|
|
72679
|
+
function isTableElement(element) {
|
|
72680
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
72681
|
+
}
|
|
72682
|
+
function isContainingBlock(element) {
|
|
72683
|
+
const webkit = isWebKit();
|
|
72684
|
+
const css = getComputedStyle$1(element);
|
|
72685
|
+
|
|
72686
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
72687
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
72688
|
+
}
|
|
72689
|
+
function getContainingBlock(element) {
|
|
72690
|
+
let currentNode = getParentNode(element);
|
|
72691
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
72692
|
+
if (isContainingBlock(currentNode)) {
|
|
72693
|
+
return currentNode;
|
|
72694
|
+
} else {
|
|
72695
|
+
currentNode = getParentNode(currentNode);
|
|
72696
|
+
}
|
|
72697
|
+
}
|
|
72698
|
+
return null;
|
|
72699
|
+
}
|
|
72700
|
+
function isWebKit() {
|
|
72701
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
72702
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
72703
|
+
}
|
|
72704
|
+
function isLastTraversableNode(node) {
|
|
72705
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
72706
|
+
}
|
|
72707
|
+
function getComputedStyle$1(element) {
|
|
72708
|
+
return getWindow(element).getComputedStyle(element);
|
|
72709
|
+
}
|
|
72710
|
+
function getNodeScroll(element) {
|
|
72711
|
+
if (isElement(element)) {
|
|
72712
|
+
return {
|
|
72713
|
+
scrollLeft: element.scrollLeft,
|
|
72714
|
+
scrollTop: element.scrollTop
|
|
72715
|
+
};
|
|
72716
|
+
}
|
|
72717
|
+
return {
|
|
72718
|
+
scrollLeft: element.pageXOffset,
|
|
72719
|
+
scrollTop: element.pageYOffset
|
|
72720
|
+
};
|
|
72721
|
+
}
|
|
72722
|
+
function getParentNode(node) {
|
|
72723
|
+
if (getNodeName(node) === 'html') {
|
|
72724
|
+
return node;
|
|
72725
|
+
}
|
|
72726
|
+
const result =
|
|
72727
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
72728
|
+
node.assignedSlot ||
|
|
72729
|
+
// DOM Element detected.
|
|
72730
|
+
node.parentNode ||
|
|
72731
|
+
// ShadowRoot detected.
|
|
72732
|
+
isShadowRoot(node) && node.host ||
|
|
72733
|
+
// Fallback.
|
|
72734
|
+
getDocumentElement(node);
|
|
72735
|
+
return isShadowRoot(result) ? result.host : result;
|
|
72736
|
+
}
|
|
72737
|
+
function getNearestOverflowAncestor(node) {
|
|
72738
|
+
const parentNode = getParentNode(node);
|
|
72739
|
+
if (isLastTraversableNode(parentNode)) {
|
|
72740
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
72741
|
+
}
|
|
72742
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
72743
|
+
return parentNode;
|
|
72744
|
+
}
|
|
72745
|
+
return getNearestOverflowAncestor(parentNode);
|
|
72746
|
+
}
|
|
72747
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
72748
|
+
var _node$ownerDocument2;
|
|
72749
|
+
if (list === void 0) {
|
|
72750
|
+
list = [];
|
|
72751
|
+
}
|
|
72752
|
+
if (traverseIframes === void 0) {
|
|
72753
|
+
traverseIframes = true;
|
|
72754
|
+
}
|
|
72755
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
72756
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
72757
|
+
const win = getWindow(scrollableAncestor);
|
|
72758
|
+
if (isBody) {
|
|
72759
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
72760
|
+
}
|
|
72761
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
72762
|
+
}
|
|
72763
|
+
|
|
72764
|
+
function getCssDimensions(element) {
|
|
72765
|
+
const css = getComputedStyle$1(element);
|
|
72766
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
72767
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
72768
|
+
let width = parseFloat(css.width) || 0;
|
|
72769
|
+
let height = parseFloat(css.height) || 0;
|
|
72770
|
+
const hasOffset = isHTMLElement(element);
|
|
72771
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
72772
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
72773
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
72774
|
+
if (shouldFallback) {
|
|
72775
|
+
width = offsetWidth;
|
|
72776
|
+
height = offsetHeight;
|
|
72777
|
+
}
|
|
72778
|
+
return {
|
|
72779
|
+
width,
|
|
72780
|
+
height,
|
|
72781
|
+
$: shouldFallback
|
|
72782
|
+
};
|
|
72783
|
+
}
|
|
72784
|
+
|
|
72785
|
+
function unwrapElement(element) {
|
|
72786
|
+
return !isElement(element) ? element.contextElement : element;
|
|
72787
|
+
}
|
|
72788
|
+
|
|
72789
|
+
function getScale(element) {
|
|
72790
|
+
const domElement = unwrapElement(element);
|
|
72791
|
+
if (!isHTMLElement(domElement)) {
|
|
72792
|
+
return createCoords(1);
|
|
72793
|
+
}
|
|
72794
|
+
const rect = domElement.getBoundingClientRect();
|
|
72795
|
+
const {
|
|
72796
|
+
width,
|
|
72797
|
+
height,
|
|
72798
|
+
$
|
|
72799
|
+
} = getCssDimensions(domElement);
|
|
72800
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
72801
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
72802
|
+
|
|
72803
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
72804
|
+
|
|
72805
|
+
if (!x || !Number.isFinite(x)) {
|
|
72806
|
+
x = 1;
|
|
72807
|
+
}
|
|
72808
|
+
if (!y || !Number.isFinite(y)) {
|
|
72809
|
+
y = 1;
|
|
72810
|
+
}
|
|
72811
|
+
return {
|
|
72812
|
+
x,
|
|
72813
|
+
y
|
|
72814
|
+
};
|
|
72815
|
+
}
|
|
72816
|
+
|
|
72817
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
72818
|
+
function getVisualOffsets(element) {
|
|
72819
|
+
const win = getWindow(element);
|
|
72820
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
72821
|
+
return noOffsets;
|
|
72822
|
+
}
|
|
72823
|
+
return {
|
|
72824
|
+
x: win.visualViewport.offsetLeft,
|
|
72825
|
+
y: win.visualViewport.offsetTop
|
|
72826
|
+
};
|
|
72827
|
+
}
|
|
72828
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
72829
|
+
if (isFixed === void 0) {
|
|
72830
|
+
isFixed = false;
|
|
72831
|
+
}
|
|
72832
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
72833
|
+
return false;
|
|
72834
|
+
}
|
|
72835
|
+
return isFixed;
|
|
72836
|
+
}
|
|
72837
|
+
|
|
72838
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
72839
|
+
if (includeScale === void 0) {
|
|
72840
|
+
includeScale = false;
|
|
72841
|
+
}
|
|
72842
|
+
if (isFixedStrategy === void 0) {
|
|
72843
|
+
isFixedStrategy = false;
|
|
72844
|
+
}
|
|
72845
|
+
const clientRect = element.getBoundingClientRect();
|
|
72846
|
+
const domElement = unwrapElement(element);
|
|
72847
|
+
let scale = createCoords(1);
|
|
72848
|
+
if (includeScale) {
|
|
72849
|
+
if (offsetParent) {
|
|
72850
|
+
if (isElement(offsetParent)) {
|
|
72851
|
+
scale = getScale(offsetParent);
|
|
72852
|
+
}
|
|
72853
|
+
} else {
|
|
72854
|
+
scale = getScale(element);
|
|
72855
|
+
}
|
|
72856
|
+
}
|
|
72857
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
72858
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
72859
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
72860
|
+
let width = clientRect.width / scale.x;
|
|
72861
|
+
let height = clientRect.height / scale.y;
|
|
72862
|
+
if (domElement) {
|
|
72863
|
+
const win = getWindow(domElement);
|
|
72864
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
72865
|
+
let currentIFrame = win.frameElement;
|
|
72866
|
+
while (currentIFrame && offsetParent && offsetWin !== win) {
|
|
72867
|
+
const iframeScale = getScale(currentIFrame);
|
|
72868
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
72869
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
72870
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
72871
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
72872
|
+
x *= iframeScale.x;
|
|
72873
|
+
y *= iframeScale.y;
|
|
72874
|
+
width *= iframeScale.x;
|
|
72875
|
+
height *= iframeScale.y;
|
|
72876
|
+
x += left;
|
|
72877
|
+
y += top;
|
|
72878
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
72879
|
+
}
|
|
72880
|
+
}
|
|
72881
|
+
return rectToClientRect({
|
|
72882
|
+
width,
|
|
72883
|
+
height,
|
|
72884
|
+
x,
|
|
72885
|
+
y
|
|
72886
|
+
});
|
|
72887
|
+
}
|
|
72888
|
+
|
|
72889
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
72890
|
+
let {
|
|
72891
|
+
rect,
|
|
72892
|
+
offsetParent,
|
|
72893
|
+
strategy
|
|
72894
|
+
} = _ref;
|
|
72895
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
72896
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
72897
|
+
if (offsetParent === documentElement) {
|
|
72898
|
+
return rect;
|
|
72899
|
+
}
|
|
72900
|
+
let scroll = {
|
|
72901
|
+
scrollLeft: 0,
|
|
72902
|
+
scrollTop: 0
|
|
72903
|
+
};
|
|
72904
|
+
let scale = createCoords(1);
|
|
72905
|
+
const offsets = createCoords(0);
|
|
72906
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
72907
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
72908
|
+
scroll = getNodeScroll(offsetParent);
|
|
72909
|
+
}
|
|
72910
|
+
if (isHTMLElement(offsetParent)) {
|
|
72911
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
72912
|
+
scale = getScale(offsetParent);
|
|
72913
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
72914
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
72915
|
+
}
|
|
72916
|
+
}
|
|
72917
|
+
return {
|
|
72918
|
+
width: rect.width * scale.x,
|
|
72919
|
+
height: rect.height * scale.y,
|
|
72920
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
72921
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
72922
|
+
};
|
|
72923
|
+
}
|
|
72924
|
+
|
|
72925
|
+
function getClientRects(element) {
|
|
72926
|
+
return Array.from(element.getClientRects());
|
|
72927
|
+
}
|
|
72928
|
+
|
|
72929
|
+
function getWindowScrollBarX(element) {
|
|
72930
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
72931
|
+
// incorrect for RTL.
|
|
72932
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
72933
|
+
}
|
|
72934
|
+
|
|
72935
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
72936
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
72937
|
+
function getDocumentRect(element) {
|
|
72938
|
+
const html = getDocumentElement(element);
|
|
72939
|
+
const scroll = getNodeScroll(element);
|
|
72940
|
+
const body = element.ownerDocument.body;
|
|
72941
|
+
const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
72942
|
+
const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
72943
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
72944
|
+
const y = -scroll.scrollTop;
|
|
72945
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
72946
|
+
x += max$1(html.clientWidth, body.clientWidth) - width;
|
|
72947
|
+
}
|
|
72948
|
+
return {
|
|
72949
|
+
width,
|
|
72950
|
+
height,
|
|
72951
|
+
x,
|
|
72952
|
+
y
|
|
72953
|
+
};
|
|
72954
|
+
}
|
|
72955
|
+
|
|
72956
|
+
function getViewportRect(element, strategy) {
|
|
72957
|
+
const win = getWindow(element);
|
|
72958
|
+
const html = getDocumentElement(element);
|
|
72959
|
+
const visualViewport = win.visualViewport;
|
|
72960
|
+
let width = html.clientWidth;
|
|
72961
|
+
let height = html.clientHeight;
|
|
72962
|
+
let x = 0;
|
|
72963
|
+
let y = 0;
|
|
72964
|
+
if (visualViewport) {
|
|
72965
|
+
width = visualViewport.width;
|
|
72966
|
+
height = visualViewport.height;
|
|
72967
|
+
const visualViewportBased = isWebKit();
|
|
72968
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
72969
|
+
x = visualViewport.offsetLeft;
|
|
72970
|
+
y = visualViewport.offsetTop;
|
|
72971
|
+
}
|
|
72972
|
+
}
|
|
72973
|
+
return {
|
|
72974
|
+
width,
|
|
72975
|
+
height,
|
|
72976
|
+
x,
|
|
72977
|
+
y
|
|
72978
|
+
};
|
|
72979
|
+
}
|
|
72980
|
+
|
|
72981
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
72982
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
72983
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
72984
|
+
const top = clientRect.top + element.clientTop;
|
|
72985
|
+
const left = clientRect.left + element.clientLeft;
|
|
72986
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
72987
|
+
const width = element.clientWidth * scale.x;
|
|
72988
|
+
const height = element.clientHeight * scale.y;
|
|
72989
|
+
const x = left * scale.x;
|
|
72990
|
+
const y = top * scale.y;
|
|
72991
|
+
return {
|
|
72992
|
+
width,
|
|
72993
|
+
height,
|
|
72994
|
+
x,
|
|
72995
|
+
y
|
|
72996
|
+
};
|
|
72997
|
+
}
|
|
72998
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
72999
|
+
let rect;
|
|
73000
|
+
if (clippingAncestor === 'viewport') {
|
|
73001
|
+
rect = getViewportRect(element, strategy);
|
|
73002
|
+
} else if (clippingAncestor === 'document') {
|
|
73003
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
73004
|
+
} else if (isElement(clippingAncestor)) {
|
|
73005
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
73006
|
+
} else {
|
|
73007
|
+
const visualOffsets = getVisualOffsets(element);
|
|
73008
|
+
rect = {
|
|
73009
|
+
...clippingAncestor,
|
|
73010
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
73011
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
73012
|
+
};
|
|
73013
|
+
}
|
|
73014
|
+
return rectToClientRect(rect);
|
|
73015
|
+
}
|
|
73016
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
73017
|
+
const parentNode = getParentNode(element);
|
|
73018
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
73019
|
+
return false;
|
|
73020
|
+
}
|
|
73021
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
73022
|
+
}
|
|
73023
|
+
|
|
73024
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
73025
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
73026
|
+
// of the given element up the tree.
|
|
73027
|
+
function getClippingElementAncestors(element, cache) {
|
|
73028
|
+
const cachedResult = cache.get(element);
|
|
73029
|
+
if (cachedResult) {
|
|
73030
|
+
return cachedResult;
|
|
73031
|
+
}
|
|
73032
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
73033
|
+
let currentContainingBlockComputedStyle = null;
|
|
73034
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
73035
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
73036
|
+
|
|
73037
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
73038
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
73039
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
73040
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
73041
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
73042
|
+
currentContainingBlockComputedStyle = null;
|
|
73043
|
+
}
|
|
73044
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
73045
|
+
if (shouldDropCurrentNode) {
|
|
73046
|
+
// Drop non-containing blocks.
|
|
73047
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
73048
|
+
} else {
|
|
73049
|
+
// Record last containing block for next iteration.
|
|
73050
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
73051
|
+
}
|
|
73052
|
+
currentNode = getParentNode(currentNode);
|
|
73053
|
+
}
|
|
73054
|
+
cache.set(element, result);
|
|
73055
|
+
return result;
|
|
73056
|
+
}
|
|
73057
|
+
|
|
73058
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
73059
|
+
// clipping ancestors.
|
|
73060
|
+
function getClippingRect(_ref) {
|
|
73061
|
+
let {
|
|
73062
|
+
element,
|
|
73063
|
+
boundary,
|
|
73064
|
+
rootBoundary,
|
|
73065
|
+
strategy
|
|
73066
|
+
} = _ref;
|
|
73067
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
73068
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
73069
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
73070
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
73071
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
73072
|
+
accRect.top = max$1(rect.top, accRect.top);
|
|
73073
|
+
accRect.right = min$1(rect.right, accRect.right);
|
|
73074
|
+
accRect.bottom = min$1(rect.bottom, accRect.bottom);
|
|
73075
|
+
accRect.left = max$1(rect.left, accRect.left);
|
|
73076
|
+
return accRect;
|
|
73077
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
73078
|
+
return {
|
|
73079
|
+
width: clippingRect.right - clippingRect.left,
|
|
73080
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
73081
|
+
x: clippingRect.left,
|
|
73082
|
+
y: clippingRect.top
|
|
73083
|
+
};
|
|
73084
|
+
}
|
|
73085
|
+
|
|
73086
|
+
function getDimensions(element) {
|
|
73087
|
+
return getCssDimensions(element);
|
|
73088
|
+
}
|
|
73089
|
+
|
|
73090
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
73091
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
73092
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
73093
|
+
const isFixed = strategy === 'fixed';
|
|
73094
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
73095
|
+
let scroll = {
|
|
73096
|
+
scrollLeft: 0,
|
|
73097
|
+
scrollTop: 0
|
|
73098
|
+
};
|
|
73099
|
+
const offsets = createCoords(0);
|
|
73100
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
73101
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
73102
|
+
scroll = getNodeScroll(offsetParent);
|
|
73103
|
+
}
|
|
73104
|
+
if (isOffsetParentAnElement) {
|
|
73105
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
73106
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
73107
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
73108
|
+
} else if (documentElement) {
|
|
73109
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
73110
|
+
}
|
|
73111
|
+
}
|
|
73112
|
+
return {
|
|
73113
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
73114
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
73115
|
+
width: rect.width,
|
|
73116
|
+
height: rect.height
|
|
73117
|
+
};
|
|
73118
|
+
}
|
|
73119
|
+
|
|
73120
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
73121
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
73122
|
+
return null;
|
|
73123
|
+
}
|
|
73124
|
+
if (polyfill) {
|
|
73125
|
+
return polyfill(element);
|
|
73126
|
+
}
|
|
73127
|
+
return element.offsetParent;
|
|
73128
|
+
}
|
|
73129
|
+
|
|
73130
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
73131
|
+
// such as table ancestors and cross browser bugs.
|
|
73132
|
+
function getOffsetParent(element, polyfill) {
|
|
73133
|
+
const window = getWindow(element);
|
|
73134
|
+
if (!isHTMLElement(element)) {
|
|
73135
|
+
return window;
|
|
73136
|
+
}
|
|
73137
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
73138
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
73139
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
73140
|
+
}
|
|
73141
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
73142
|
+
return window;
|
|
73143
|
+
}
|
|
73144
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
73145
|
+
}
|
|
73146
|
+
|
|
73147
|
+
const getElementRects = async function (_ref) {
|
|
73148
|
+
let {
|
|
73149
|
+
reference,
|
|
73150
|
+
floating,
|
|
73151
|
+
strategy
|
|
73152
|
+
} = _ref;
|
|
73153
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
73154
|
+
const getDimensionsFn = this.getDimensions;
|
|
73155
|
+
return {
|
|
73156
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
73157
|
+
floating: {
|
|
73158
|
+
x: 0,
|
|
73159
|
+
y: 0,
|
|
73160
|
+
...(await getDimensionsFn(floating))
|
|
73161
|
+
}
|
|
73162
|
+
};
|
|
73163
|
+
};
|
|
73164
|
+
|
|
73165
|
+
function isRTL(element) {
|
|
73166
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
73167
|
+
}
|
|
73168
|
+
|
|
73169
|
+
const platform = {
|
|
73170
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
73171
|
+
getDocumentElement,
|
|
73172
|
+
getClippingRect,
|
|
73173
|
+
getOffsetParent,
|
|
73174
|
+
getElementRects,
|
|
73175
|
+
getClientRects,
|
|
73176
|
+
getDimensions,
|
|
73177
|
+
getScale,
|
|
73178
|
+
isElement,
|
|
73179
|
+
isRTL
|
|
73180
|
+
};
|
|
73181
|
+
|
|
73182
|
+
// https://samthor.au/2021/observing-dom/
|
|
73183
|
+
function observeMove(element, onMove) {
|
|
73184
|
+
let io = null;
|
|
73185
|
+
let timeoutId;
|
|
73186
|
+
const root = getDocumentElement(element);
|
|
73187
|
+
function cleanup() {
|
|
73188
|
+
clearTimeout(timeoutId);
|
|
73189
|
+
io && io.disconnect();
|
|
73190
|
+
io = null;
|
|
73191
|
+
}
|
|
73192
|
+
function refresh(skip, threshold) {
|
|
73193
|
+
if (skip === void 0) {
|
|
73194
|
+
skip = false;
|
|
73195
|
+
}
|
|
73196
|
+
if (threshold === void 0) {
|
|
73197
|
+
threshold = 1;
|
|
73198
|
+
}
|
|
73199
|
+
cleanup();
|
|
73200
|
+
const {
|
|
73201
|
+
left,
|
|
73202
|
+
top,
|
|
73203
|
+
width,
|
|
73204
|
+
height
|
|
73205
|
+
} = element.getBoundingClientRect();
|
|
73206
|
+
if (!skip) {
|
|
73207
|
+
onMove();
|
|
73208
|
+
}
|
|
73209
|
+
if (!width || !height) {
|
|
73210
|
+
return;
|
|
73211
|
+
}
|
|
73212
|
+
const insetTop = floor(top);
|
|
73213
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
73214
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
73215
|
+
const insetLeft = floor(left);
|
|
73216
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
73217
|
+
const options = {
|
|
73218
|
+
rootMargin,
|
|
73219
|
+
threshold: max$1(0, min$1(1, threshold)) || 1
|
|
73220
|
+
};
|
|
73221
|
+
let isFirstUpdate = true;
|
|
73222
|
+
function handleObserve(entries) {
|
|
73223
|
+
const ratio = entries[0].intersectionRatio;
|
|
73224
|
+
if (ratio !== threshold) {
|
|
73225
|
+
if (!isFirstUpdate) {
|
|
73226
|
+
return refresh();
|
|
73227
|
+
}
|
|
73228
|
+
if (!ratio) {
|
|
73229
|
+
timeoutId = setTimeout(() => {
|
|
73230
|
+
refresh(false, 1e-7);
|
|
73231
|
+
}, 100);
|
|
73232
|
+
} else {
|
|
73233
|
+
refresh(false, ratio);
|
|
73234
|
+
}
|
|
73235
|
+
}
|
|
73236
|
+
isFirstUpdate = false;
|
|
73237
|
+
}
|
|
73238
|
+
|
|
73239
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
73240
|
+
// error.
|
|
73241
|
+
try {
|
|
73242
|
+
io = new IntersectionObserver(handleObserve, {
|
|
73243
|
+
...options,
|
|
73244
|
+
// Handle <iframe>s
|
|
73245
|
+
root: root.ownerDocument
|
|
73246
|
+
});
|
|
73247
|
+
} catch (e) {
|
|
73248
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
73249
|
+
}
|
|
73250
|
+
io.observe(element);
|
|
73251
|
+
}
|
|
73252
|
+
refresh(true);
|
|
73253
|
+
return cleanup;
|
|
73254
|
+
}
|
|
73255
|
+
|
|
73256
|
+
/**
|
|
73257
|
+
* Automatically updates the position of the floating element when necessary.
|
|
73258
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
73259
|
+
* visible on the screen.
|
|
73260
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
73261
|
+
* removed from the DOM or hidden from the screen.
|
|
73262
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
73263
|
+
*/
|
|
73264
|
+
function autoUpdate(reference, floating, update, options) {
|
|
73265
|
+
if (options === void 0) {
|
|
73266
|
+
options = {};
|
|
73267
|
+
}
|
|
73268
|
+
const {
|
|
73269
|
+
ancestorScroll = true,
|
|
73270
|
+
ancestorResize = true,
|
|
73271
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
73272
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
73273
|
+
animationFrame = false
|
|
73274
|
+
} = options;
|
|
73275
|
+
const referenceEl = unwrapElement(reference);
|
|
73276
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
73277
|
+
ancestors.forEach(ancestor => {
|
|
73278
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
73279
|
+
passive: true
|
|
73280
|
+
});
|
|
73281
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
73282
|
+
});
|
|
73283
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
73284
|
+
let reobserveFrame = -1;
|
|
73285
|
+
let resizeObserver = null;
|
|
73286
|
+
if (elementResize) {
|
|
73287
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
73288
|
+
let [firstEntry] = _ref;
|
|
73289
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
73290
|
+
// Prevent update loops when using the `size` middleware.
|
|
73291
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
73292
|
+
resizeObserver.unobserve(floating);
|
|
73293
|
+
cancelAnimationFrame(reobserveFrame);
|
|
73294
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
73295
|
+
resizeObserver && resizeObserver.observe(floating);
|
|
73296
|
+
});
|
|
73297
|
+
}
|
|
73298
|
+
update();
|
|
73299
|
+
});
|
|
73300
|
+
if (referenceEl && !animationFrame) {
|
|
73301
|
+
resizeObserver.observe(referenceEl);
|
|
73302
|
+
}
|
|
73303
|
+
resizeObserver.observe(floating);
|
|
73304
|
+
}
|
|
73305
|
+
let frameId;
|
|
73306
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
73307
|
+
if (animationFrame) {
|
|
73308
|
+
frameLoop();
|
|
73309
|
+
}
|
|
73310
|
+
function frameLoop() {
|
|
73311
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
73312
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
73313
|
+
update();
|
|
73314
|
+
}
|
|
73315
|
+
prevRefRect = nextRefRect;
|
|
73316
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
73317
|
+
}
|
|
73318
|
+
update();
|
|
73319
|
+
return () => {
|
|
73320
|
+
ancestors.forEach(ancestor => {
|
|
73321
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
73322
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
73323
|
+
});
|
|
73324
|
+
cleanupIo && cleanupIo();
|
|
73325
|
+
resizeObserver && resizeObserver.disconnect();
|
|
73326
|
+
resizeObserver = null;
|
|
73327
|
+
if (animationFrame) {
|
|
73328
|
+
cancelAnimationFrame(frameId);
|
|
73329
|
+
}
|
|
73330
|
+
};
|
|
73331
|
+
}
|
|
73332
|
+
|
|
73333
|
+
/**
|
|
73334
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
73335
|
+
* next to a reference element when it is given a certain CSS positioning
|
|
73336
|
+
* strategy.
|
|
73337
|
+
*/
|
|
73338
|
+
const computePosition = (reference, floating, options) => {
|
|
73339
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
73340
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
73341
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
73342
|
+
const cache = new Map();
|
|
73343
|
+
const mergedOptions = {
|
|
73344
|
+
platform,
|
|
73345
|
+
...options
|
|
73346
|
+
};
|
|
73347
|
+
const platformWithCache = {
|
|
73348
|
+
...mergedOptions.platform,
|
|
73349
|
+
_c: cache
|
|
73350
|
+
};
|
|
73351
|
+
return computePosition$1(reference, floating, {
|
|
73352
|
+
...mergedOptions,
|
|
73353
|
+
platform: platformWithCache
|
|
73354
|
+
});
|
|
73355
|
+
};
|
|
73356
|
+
|
|
73357
|
+
var index$3 = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
73358
|
+
|
|
73359
|
+
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
|
73360
|
+
// functions
|
|
73361
|
+
function deepEqual(a, b) {
|
|
73362
|
+
if (a === b) {
|
|
73363
|
+
return true;
|
|
73364
|
+
}
|
|
73365
|
+
if (typeof a !== typeof b) {
|
|
73366
|
+
return false;
|
|
73367
|
+
}
|
|
73368
|
+
if (typeof a === 'function' && a.toString() === b.toString()) {
|
|
73369
|
+
return true;
|
|
73370
|
+
}
|
|
73371
|
+
let length;
|
|
73372
|
+
let i;
|
|
73373
|
+
let keys;
|
|
73374
|
+
if (a && b && typeof a === 'object') {
|
|
73375
|
+
if (Array.isArray(a)) {
|
|
73376
|
+
length = a.length;
|
|
73377
|
+
if (length !== b.length) return false;
|
|
73378
|
+
for (i = length; i-- !== 0;) {
|
|
73379
|
+
if (!deepEqual(a[i], b[i])) {
|
|
73380
|
+
return false;
|
|
73381
|
+
}
|
|
73382
|
+
}
|
|
73383
|
+
return true;
|
|
73384
|
+
}
|
|
73385
|
+
keys = Object.keys(a);
|
|
73386
|
+
length = keys.length;
|
|
73387
|
+
if (length !== Object.keys(b).length) {
|
|
73388
|
+
return false;
|
|
73389
|
+
}
|
|
73390
|
+
for (i = length; i-- !== 0;) {
|
|
73391
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
73392
|
+
return false;
|
|
73393
|
+
}
|
|
73394
|
+
}
|
|
73395
|
+
for (i = length; i-- !== 0;) {
|
|
73396
|
+
const key = keys[i];
|
|
73397
|
+
if (key === '_owner' && a.$$typeof) {
|
|
73398
|
+
continue;
|
|
73399
|
+
}
|
|
73400
|
+
if (!deepEqual(a[key], b[key])) {
|
|
73401
|
+
return false;
|
|
73402
|
+
}
|
|
73403
|
+
}
|
|
73404
|
+
return true;
|
|
73405
|
+
}
|
|
73406
|
+
return a !== a && b !== b;
|
|
73407
|
+
}
|
|
73408
|
+
|
|
73409
|
+
function getDPR(element) {
|
|
73410
|
+
if (typeof window === 'undefined') {
|
|
73411
|
+
return 1;
|
|
73412
|
+
}
|
|
73413
|
+
const win = element.ownerDocument.defaultView || window;
|
|
73414
|
+
return win.devicePixelRatio || 1;
|
|
73415
|
+
}
|
|
73416
|
+
|
|
73417
|
+
function roundByDPR(element, value) {
|
|
73418
|
+
const dpr = getDPR(element);
|
|
73419
|
+
return Math.round(value * dpr) / dpr;
|
|
73420
|
+
}
|
|
73421
|
+
|
|
73422
|
+
function useLatestRef(value) {
|
|
73423
|
+
const ref = React__namespace.useRef(value);
|
|
73424
|
+
index$3(() => {
|
|
73425
|
+
ref.current = value;
|
|
73426
|
+
});
|
|
73427
|
+
return ref;
|
|
73428
|
+
}
|
|
73429
|
+
|
|
73430
|
+
/**
|
|
73431
|
+
* Provides data to position a floating element.
|
|
73432
|
+
* @see https://floating-ui.com/docs/useFloating
|
|
73433
|
+
*/
|
|
73434
|
+
function useFloating(options) {
|
|
73435
|
+
if (options === void 0) {
|
|
73436
|
+
options = {};
|
|
73437
|
+
}
|
|
73438
|
+
const {
|
|
73439
|
+
placement = 'bottom',
|
|
73440
|
+
strategy = 'absolute',
|
|
73441
|
+
middleware = [],
|
|
73442
|
+
platform,
|
|
73443
|
+
elements: {
|
|
73444
|
+
reference: externalReference,
|
|
73445
|
+
floating: externalFloating
|
|
73446
|
+
} = {},
|
|
73447
|
+
transform = true,
|
|
73448
|
+
whileElementsMounted,
|
|
73449
|
+
open
|
|
73450
|
+
} = options;
|
|
73451
|
+
const [data, setData] = React__namespace.useState({
|
|
73452
|
+
x: 0,
|
|
73453
|
+
y: 0,
|
|
73454
|
+
strategy,
|
|
73455
|
+
placement,
|
|
73456
|
+
middlewareData: {},
|
|
73457
|
+
isPositioned: false
|
|
73458
|
+
});
|
|
73459
|
+
const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
|
|
73460
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
73461
|
+
setLatestMiddleware(middleware);
|
|
73462
|
+
}
|
|
73463
|
+
const [_reference, _setReference] = React__namespace.useState(null);
|
|
73464
|
+
const [_floating, _setFloating] = React__namespace.useState(null);
|
|
73465
|
+
const setReference = React__namespace.useCallback(node => {
|
|
73466
|
+
if (node !== referenceRef.current) {
|
|
73467
|
+
referenceRef.current = node;
|
|
73468
|
+
_setReference(node);
|
|
73469
|
+
}
|
|
73470
|
+
}, []);
|
|
73471
|
+
const setFloating = React__namespace.useCallback(node => {
|
|
73472
|
+
if (node !== floatingRef.current) {
|
|
73473
|
+
floatingRef.current = node;
|
|
73474
|
+
_setFloating(node);
|
|
73475
|
+
}
|
|
73476
|
+
}, []);
|
|
73477
|
+
const referenceEl = externalReference || _reference;
|
|
73478
|
+
const floatingEl = externalFloating || _floating;
|
|
73479
|
+
const referenceRef = React__namespace.useRef(null);
|
|
73480
|
+
const floatingRef = React__namespace.useRef(null);
|
|
73481
|
+
const dataRef = React__namespace.useRef(data);
|
|
73482
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
73483
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
73484
|
+
const platformRef = useLatestRef(platform);
|
|
73485
|
+
const update = React__namespace.useCallback(() => {
|
|
73486
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
73487
|
+
return;
|
|
73488
|
+
}
|
|
73489
|
+
const config = {
|
|
73490
|
+
placement,
|
|
73491
|
+
strategy,
|
|
73492
|
+
middleware: latestMiddleware
|
|
73493
|
+
};
|
|
73494
|
+
if (platformRef.current) {
|
|
73495
|
+
config.platform = platformRef.current;
|
|
73496
|
+
}
|
|
73497
|
+
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
|
73498
|
+
const fullData = {
|
|
73499
|
+
...data,
|
|
73500
|
+
isPositioned: true
|
|
73501
|
+
};
|
|
73502
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
73503
|
+
dataRef.current = fullData;
|
|
73504
|
+
reactDomExports.flushSync(() => {
|
|
73505
|
+
setData(fullData);
|
|
73506
|
+
});
|
|
73507
|
+
}
|
|
73508
|
+
});
|
|
73509
|
+
}, [latestMiddleware, placement, strategy, platformRef]);
|
|
73510
|
+
index$3(() => {
|
|
73511
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
73512
|
+
dataRef.current.isPositioned = false;
|
|
73513
|
+
setData(data => ({
|
|
73514
|
+
...data,
|
|
73515
|
+
isPositioned: false
|
|
73516
|
+
}));
|
|
73517
|
+
}
|
|
73518
|
+
}, [open]);
|
|
73519
|
+
const isMountedRef = React__namespace.useRef(false);
|
|
73520
|
+
index$3(() => {
|
|
73521
|
+
isMountedRef.current = true;
|
|
73522
|
+
return () => {
|
|
73523
|
+
isMountedRef.current = false;
|
|
73524
|
+
};
|
|
73525
|
+
}, []);
|
|
73526
|
+
index$3(() => {
|
|
73527
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
73528
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
73529
|
+
if (referenceEl && floatingEl) {
|
|
73530
|
+
if (whileElementsMountedRef.current) {
|
|
73531
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
73532
|
+
}
|
|
73533
|
+
update();
|
|
73534
|
+
}
|
|
73535
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
73536
|
+
const refs = React__namespace.useMemo(() => ({
|
|
73537
|
+
reference: referenceRef,
|
|
73538
|
+
floating: floatingRef,
|
|
73539
|
+
setReference,
|
|
73540
|
+
setFloating
|
|
73541
|
+
}), [setReference, setFloating]);
|
|
73542
|
+
const elements = React__namespace.useMemo(() => ({
|
|
73543
|
+
reference: referenceEl,
|
|
73544
|
+
floating: floatingEl
|
|
73545
|
+
}), [referenceEl, floatingEl]);
|
|
73546
|
+
const floatingStyles = React__namespace.useMemo(() => {
|
|
73547
|
+
const initialStyles = {
|
|
73548
|
+
position: strategy,
|
|
73549
|
+
left: 0,
|
|
73550
|
+
top: 0
|
|
73551
|
+
};
|
|
73552
|
+
if (!elements.floating) {
|
|
73553
|
+
return initialStyles;
|
|
73554
|
+
}
|
|
73555
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
73556
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
73557
|
+
if (transform) {
|
|
73558
|
+
return {
|
|
73559
|
+
...initialStyles,
|
|
73560
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
73561
|
+
...(getDPR(elements.floating) >= 1.5 && {
|
|
73562
|
+
willChange: 'transform'
|
|
73563
|
+
})
|
|
73564
|
+
};
|
|
73565
|
+
}
|
|
73566
|
+
return {
|
|
73567
|
+
position: strategy,
|
|
73568
|
+
left: x,
|
|
73569
|
+
top: y
|
|
73570
|
+
};
|
|
73571
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
73572
|
+
return React__namespace.useMemo(() => ({
|
|
73573
|
+
...data,
|
|
73574
|
+
update,
|
|
73575
|
+
refs,
|
|
73576
|
+
elements,
|
|
73577
|
+
floatingStyles
|
|
73578
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
73579
|
+
}
|
|
73580
|
+
|
|
73581
|
+
/**
|
|
73582
|
+
* Provides data to position an inner element of the floating element so that it
|
|
73583
|
+
* appears centered to the reference element.
|
|
73584
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
73585
|
+
* @see https://floating-ui.com/docs/arrow
|
|
73586
|
+
*/
|
|
73587
|
+
const arrow$1 = options => {
|
|
73588
|
+
function isRef(value) {
|
|
73589
|
+
return {}.hasOwnProperty.call(value, 'current');
|
|
73590
|
+
}
|
|
73591
|
+
return {
|
|
73592
|
+
name: 'arrow',
|
|
73593
|
+
options,
|
|
73594
|
+
fn(state) {
|
|
73595
|
+
const {
|
|
73596
|
+
element,
|
|
73597
|
+
padding
|
|
73598
|
+
} = typeof options === 'function' ? options(state) : options;
|
|
73599
|
+
if (element && isRef(element)) {
|
|
73600
|
+
if (element.current != null) {
|
|
73601
|
+
return arrow$2({
|
|
73602
|
+
element: element.current,
|
|
73603
|
+
padding
|
|
73604
|
+
}).fn(state);
|
|
73605
|
+
}
|
|
73606
|
+
return {};
|
|
73607
|
+
}
|
|
73608
|
+
if (element) {
|
|
73609
|
+
return arrow$2({
|
|
73610
|
+
element,
|
|
73611
|
+
padding
|
|
73612
|
+
}).fn(state);
|
|
73613
|
+
}
|
|
73614
|
+
return {};
|
|
73615
|
+
}
|
|
73616
|
+
};
|
|
73617
|
+
};
|
|
73618
|
+
|
|
73619
|
+
/**
|
|
73620
|
+
* Modifies the placement by translating the floating element along the
|
|
73621
|
+
* specified axes.
|
|
73622
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
73623
|
+
* object may be passed.
|
|
73624
|
+
* @see https://floating-ui.com/docs/offset
|
|
73625
|
+
*/
|
|
73626
|
+
const offset = (options, deps) => ({
|
|
73627
|
+
...offset$1(options),
|
|
73628
|
+
options: [options, deps]
|
|
73629
|
+
});
|
|
73630
|
+
|
|
73631
|
+
/**
|
|
73632
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
73633
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
73634
|
+
* @see https://floating-ui.com/docs/shift
|
|
73635
|
+
*/
|
|
73636
|
+
const shift = (options, deps) => ({
|
|
73637
|
+
...shift$1(options),
|
|
73638
|
+
options: [options, deps]
|
|
73639
|
+
});
|
|
73640
|
+
|
|
73641
|
+
/**
|
|
73642
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
73643
|
+
*/
|
|
73644
|
+
const limitShift = (options, deps) => ({
|
|
73645
|
+
...limitShift$1(options),
|
|
73646
|
+
options: [options, deps]
|
|
73647
|
+
});
|
|
73648
|
+
|
|
73649
|
+
/**
|
|
73650
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
73651
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
73652
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
73653
|
+
* @see https://floating-ui.com/docs/flip
|
|
73654
|
+
*/
|
|
73655
|
+
const flip = (options, deps) => ({
|
|
73656
|
+
...flip$1(options),
|
|
73657
|
+
options: [options, deps]
|
|
73658
|
+
});
|
|
73659
|
+
|
|
73660
|
+
/**
|
|
73661
|
+
* Provides data that allows you to change the size of the floating element —
|
|
73662
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
73663
|
+
* width of the reference element.
|
|
73664
|
+
* @see https://floating-ui.com/docs/size
|
|
73665
|
+
*/
|
|
73666
|
+
const size = (options, deps) => ({
|
|
73667
|
+
...size$1(options),
|
|
73668
|
+
options: [options, deps]
|
|
73669
|
+
});
|
|
73670
|
+
|
|
73671
|
+
/**
|
|
73672
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
73673
|
+
* when it is not in the same clipping context as the reference element.
|
|
73674
|
+
* @see https://floating-ui.com/docs/hide
|
|
73675
|
+
*/
|
|
73676
|
+
const hide = (options, deps) => ({
|
|
73677
|
+
...hide$1(options),
|
|
73678
|
+
options: [options, deps]
|
|
73679
|
+
});
|
|
73680
|
+
|
|
73681
|
+
/**
|
|
73682
|
+
* Provides data to position an inner element of the floating element so that it
|
|
73683
|
+
* appears centered to the reference element.
|
|
73684
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
73685
|
+
* @see https://floating-ui.com/docs/arrow
|
|
73686
|
+
*/
|
|
73687
|
+
const arrow = (options, deps) => ({
|
|
73688
|
+
...arrow$1(options),
|
|
73689
|
+
options: [options, deps]
|
|
73690
|
+
});
|
|
73691
|
+
|
|
73692
|
+
// packages/react/arrow/src/Arrow.tsx
|
|
73693
|
+
var NAME$1 = "Arrow";
|
|
73694
|
+
var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
73695
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
73696
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73697
|
+
Primitive.svg,
|
|
73698
|
+
{
|
|
73699
|
+
...arrowProps,
|
|
73700
|
+
ref: forwardedRef,
|
|
73701
|
+
width,
|
|
73702
|
+
height,
|
|
73703
|
+
viewBox: "0 0 30 10",
|
|
73704
|
+
preserveAspectRatio: "none",
|
|
73705
|
+
children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
73706
|
+
}
|
|
73707
|
+
);
|
|
73708
|
+
});
|
|
73709
|
+
Arrow$1.displayName = NAME$1;
|
|
73710
|
+
var Root$1 = Arrow$1;
|
|
73711
|
+
|
|
73712
|
+
// packages/react/context/src/createContext.tsx
|
|
73713
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
73714
|
+
let defaultContexts = [];
|
|
73715
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
73716
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
73717
|
+
const index = defaultContexts.length;
|
|
73718
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
73719
|
+
function Provider(props) {
|
|
73720
|
+
const { scope, children, ...context } = props;
|
|
73721
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
73722
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
73723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
73724
|
+
}
|
|
73725
|
+
function useContext2(consumerName, scope) {
|
|
73726
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
73727
|
+
const context = React__namespace.useContext(Context);
|
|
73728
|
+
if (context) return context;
|
|
73729
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
73730
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
73731
|
+
}
|
|
73732
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
73733
|
+
return [Provider, useContext2];
|
|
73734
|
+
}
|
|
73735
|
+
const createScope = () => {
|
|
73736
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
73737
|
+
return React__namespace.createContext(defaultContext);
|
|
73738
|
+
});
|
|
73739
|
+
return function useScope(scope) {
|
|
73740
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
73741
|
+
return React__namespace.useMemo(
|
|
73742
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
73743
|
+
[scope, contexts]
|
|
73744
|
+
);
|
|
73745
|
+
};
|
|
73746
|
+
};
|
|
73747
|
+
createScope.scopeName = scopeName;
|
|
73748
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
73749
|
+
}
|
|
73750
|
+
function composeContextScopes(...scopes) {
|
|
73751
|
+
const baseScope = scopes[0];
|
|
73752
|
+
if (scopes.length === 1) return baseScope;
|
|
73753
|
+
const createScope = () => {
|
|
73754
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
73755
|
+
useScope: createScope2(),
|
|
73756
|
+
scopeName: createScope2.scopeName
|
|
73757
|
+
}));
|
|
73758
|
+
return function useComposedScopes(overrideScopes) {
|
|
73759
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
73760
|
+
const scopeProps = useScope(overrideScopes);
|
|
73761
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
73762
|
+
return { ...nextScopes2, ...currentScope };
|
|
73763
|
+
}, {});
|
|
73764
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
73765
|
+
};
|
|
73766
|
+
};
|
|
73767
|
+
createScope.scopeName = baseScope.scopeName;
|
|
73768
|
+
return createScope;
|
|
73769
|
+
}
|
|
73770
|
+
|
|
73771
|
+
// packages/react/use-size/src/useSize.tsx
|
|
73772
|
+
function useSize(element) {
|
|
73773
|
+
const [size, setSize] = React__namespace.useState(void 0);
|
|
73774
|
+
useLayoutEffect2$1(() => {
|
|
73775
|
+
if (element) {
|
|
73776
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
73777
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
73778
|
+
if (!Array.isArray(entries)) {
|
|
73779
|
+
return;
|
|
73780
|
+
}
|
|
73781
|
+
if (!entries.length) {
|
|
73782
|
+
return;
|
|
73783
|
+
}
|
|
73784
|
+
const entry = entries[0];
|
|
73785
|
+
let width;
|
|
73786
|
+
let height;
|
|
73787
|
+
if ("borderBoxSize" in entry) {
|
|
73788
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
73789
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
73790
|
+
width = borderSize["inlineSize"];
|
|
73791
|
+
height = borderSize["blockSize"];
|
|
73792
|
+
} else {
|
|
73793
|
+
width = element.offsetWidth;
|
|
73794
|
+
height = element.offsetHeight;
|
|
73795
|
+
}
|
|
73796
|
+
setSize({ width, height });
|
|
73797
|
+
});
|
|
73798
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
73799
|
+
return () => resizeObserver.unobserve(element);
|
|
73800
|
+
} else {
|
|
73801
|
+
setSize(void 0);
|
|
73802
|
+
}
|
|
73803
|
+
}, [element]);
|
|
73804
|
+
return size;
|
|
73805
|
+
}
|
|
73806
|
+
|
|
73807
|
+
var POPPER_NAME = "Popper";
|
|
73808
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
73809
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
73810
|
+
var Popper = (props) => {
|
|
73811
|
+
const { __scopePopper, children } = props;
|
|
73812
|
+
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
73813
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
73814
|
+
};
|
|
73815
|
+
Popper.displayName = POPPER_NAME;
|
|
73816
|
+
var ANCHOR_NAME = "PopperAnchor";
|
|
73817
|
+
var PopperAnchor = React__namespace.forwardRef(
|
|
73818
|
+
(props, forwardedRef) => {
|
|
73819
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
73820
|
+
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
73821
|
+
const ref = React__namespace.useRef(null);
|
|
73822
|
+
const composedRefs = useComposedRefs$1(forwardedRef, ref);
|
|
73823
|
+
React__namespace.useEffect(() => {
|
|
73824
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
73825
|
+
});
|
|
73826
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
73827
|
+
}
|
|
73828
|
+
);
|
|
73829
|
+
PopperAnchor.displayName = ANCHOR_NAME;
|
|
73830
|
+
var CONTENT_NAME$1 = "PopperContent";
|
|
73831
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
|
|
73832
|
+
var PopperContent = React__namespace.forwardRef(
|
|
73833
|
+
(props, forwardedRef) => {
|
|
73834
|
+
const {
|
|
73835
|
+
__scopePopper,
|
|
73836
|
+
side = "bottom",
|
|
73837
|
+
sideOffset = 0,
|
|
73838
|
+
align = "center",
|
|
73839
|
+
alignOffset = 0,
|
|
73840
|
+
arrowPadding = 0,
|
|
73841
|
+
avoidCollisions = true,
|
|
73842
|
+
collisionBoundary = [],
|
|
73843
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
73844
|
+
sticky = "partial",
|
|
73845
|
+
hideWhenDetached = false,
|
|
73846
|
+
updatePositionStrategy = "optimized",
|
|
73847
|
+
onPlaced,
|
|
73848
|
+
...contentProps
|
|
73849
|
+
} = props;
|
|
73850
|
+
const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
|
|
73851
|
+
const [content, setContent] = React__namespace.useState(null);
|
|
73852
|
+
const composedRefs = useComposedRefs$1(forwardedRef, (node) => setContent(node));
|
|
73853
|
+
const [arrow$1, setArrow] = React__namespace.useState(null);
|
|
73854
|
+
const arrowSize = useSize(arrow$1);
|
|
73855
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
73856
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
73857
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
73858
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
73859
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
73860
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
73861
|
+
const detectOverflowOptions = {
|
|
73862
|
+
padding: collisionPadding,
|
|
73863
|
+
boundary: boundary.filter(isNotNull),
|
|
73864
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
73865
|
+
altBoundary: hasExplicitBoundaries
|
|
73866
|
+
};
|
|
73867
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
73868
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
73869
|
+
strategy: "fixed",
|
|
73870
|
+
placement: desiredPlacement,
|
|
73871
|
+
whileElementsMounted: (...args) => {
|
|
73872
|
+
const cleanup = autoUpdate(...args, {
|
|
73873
|
+
animationFrame: updatePositionStrategy === "always"
|
|
73874
|
+
});
|
|
73875
|
+
return cleanup;
|
|
73876
|
+
},
|
|
73877
|
+
elements: {
|
|
73878
|
+
reference: context.anchor
|
|
73879
|
+
},
|
|
73880
|
+
middleware: [
|
|
73881
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
73882
|
+
avoidCollisions && shift({
|
|
73883
|
+
mainAxis: true,
|
|
73884
|
+
crossAxis: false,
|
|
73885
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
73886
|
+
...detectOverflowOptions
|
|
73887
|
+
}),
|
|
73888
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
73889
|
+
size({
|
|
73890
|
+
...detectOverflowOptions,
|
|
73891
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
73892
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
73893
|
+
const contentStyle = elements.floating.style;
|
|
73894
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
73895
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
73896
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
73897
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
73898
|
+
}
|
|
73899
|
+
}),
|
|
73900
|
+
arrow$1 && arrow({ element: arrow$1, padding: arrowPadding }),
|
|
73901
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
73902
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
73903
|
+
]
|
|
73904
|
+
});
|
|
73905
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
73906
|
+
const handlePlaced = useCallbackRef(onPlaced);
|
|
73907
|
+
useLayoutEffect2$1(() => {
|
|
73908
|
+
if (isPositioned) {
|
|
73909
|
+
handlePlaced?.();
|
|
73910
|
+
}
|
|
73911
|
+
}, [isPositioned, handlePlaced]);
|
|
73912
|
+
const arrowX = middlewareData.arrow?.x;
|
|
73913
|
+
const arrowY = middlewareData.arrow?.y;
|
|
73914
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
73915
|
+
const [contentZIndex, setContentZIndex] = React__namespace.useState();
|
|
73916
|
+
useLayoutEffect2$1(() => {
|
|
73917
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
73918
|
+
}, [content]);
|
|
73919
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73920
|
+
"div",
|
|
73921
|
+
{
|
|
73922
|
+
ref: refs.setFloating,
|
|
73923
|
+
"data-radix-popper-content-wrapper": "",
|
|
73924
|
+
style: {
|
|
73925
|
+
...floatingStyles,
|
|
73926
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
73927
|
+
// keep off the page when measuring
|
|
73928
|
+
minWidth: "max-content",
|
|
73929
|
+
zIndex: contentZIndex,
|
|
73930
|
+
["--radix-popper-transform-origin"]: [
|
|
73931
|
+
middlewareData.transformOrigin?.x,
|
|
73932
|
+
middlewareData.transformOrigin?.y
|
|
73933
|
+
].join(" "),
|
|
73934
|
+
// hide the content if using the hide middleware and should be hidden
|
|
73935
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
73936
|
+
// as if the PopperContent isn't there at all
|
|
73937
|
+
...middlewareData.hide?.referenceHidden && {
|
|
73938
|
+
visibility: "hidden",
|
|
73939
|
+
pointerEvents: "none"
|
|
73940
|
+
}
|
|
73941
|
+
},
|
|
73942
|
+
dir: props.dir,
|
|
73943
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
73944
|
+
PopperContentProvider,
|
|
73945
|
+
{
|
|
73946
|
+
scope: __scopePopper,
|
|
73947
|
+
placedSide,
|
|
73948
|
+
onArrowChange: setArrow,
|
|
73949
|
+
arrowX,
|
|
73950
|
+
arrowY,
|
|
73951
|
+
shouldHideArrow: cannotCenterArrow,
|
|
73952
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
73953
|
+
Primitive.div,
|
|
73954
|
+
{
|
|
73955
|
+
"data-side": placedSide,
|
|
73956
|
+
"data-align": placedAlign,
|
|
73957
|
+
...contentProps,
|
|
73958
|
+
ref: composedRefs,
|
|
73959
|
+
style: {
|
|
73960
|
+
...contentProps.style,
|
|
73961
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
73962
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
73963
|
+
animation: !isPositioned ? "none" : void 0
|
|
73964
|
+
}
|
|
73965
|
+
}
|
|
73966
|
+
)
|
|
73967
|
+
}
|
|
73968
|
+
)
|
|
73969
|
+
}
|
|
73970
|
+
);
|
|
73971
|
+
}
|
|
73972
|
+
);
|
|
73973
|
+
PopperContent.displayName = CONTENT_NAME$1;
|
|
73974
|
+
var ARROW_NAME$1 = "PopperArrow";
|
|
73975
|
+
var OPPOSITE_SIDE = {
|
|
73976
|
+
top: "bottom",
|
|
73977
|
+
right: "left",
|
|
73978
|
+
bottom: "top",
|
|
73979
|
+
left: "right"
|
|
73980
|
+
};
|
|
73981
|
+
var PopperArrow = React__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
73982
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
73983
|
+
const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
|
|
73984
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
73985
|
+
return (
|
|
73986
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
73987
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
73988
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
73989
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
73990
|
+
"span",
|
|
73991
|
+
{
|
|
73992
|
+
ref: contentContext.onArrowChange,
|
|
73993
|
+
style: {
|
|
73994
|
+
position: "absolute",
|
|
73995
|
+
left: contentContext.arrowX,
|
|
73996
|
+
top: contentContext.arrowY,
|
|
73997
|
+
[baseSide]: 0,
|
|
73998
|
+
transformOrigin: {
|
|
73999
|
+
top: "",
|
|
74000
|
+
right: "0 0",
|
|
74001
|
+
bottom: "center 0",
|
|
74002
|
+
left: "100% 0"
|
|
74003
|
+
}[contentContext.placedSide],
|
|
74004
|
+
transform: {
|
|
74005
|
+
top: "translateY(100%)",
|
|
74006
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
74007
|
+
bottom: `rotate(180deg)`,
|
|
74008
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
74009
|
+
}[contentContext.placedSide],
|
|
74010
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
74011
|
+
},
|
|
74012
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74013
|
+
Root$1,
|
|
74014
|
+
{
|
|
74015
|
+
...arrowProps,
|
|
74016
|
+
ref: forwardedRef,
|
|
74017
|
+
style: {
|
|
74018
|
+
...arrowProps.style,
|
|
74019
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
74020
|
+
display: "block"
|
|
74021
|
+
}
|
|
74022
|
+
}
|
|
74023
|
+
)
|
|
74024
|
+
}
|
|
74025
|
+
)
|
|
74026
|
+
);
|
|
74027
|
+
});
|
|
74028
|
+
PopperArrow.displayName = ARROW_NAME$1;
|
|
74029
|
+
function isNotNull(value) {
|
|
74030
|
+
return value !== null;
|
|
74031
|
+
}
|
|
74032
|
+
var transformOrigin = (options) => ({
|
|
74033
|
+
name: "transformOrigin",
|
|
74034
|
+
options,
|
|
74035
|
+
fn(data) {
|
|
74036
|
+
const { placement, rects, middlewareData } = data;
|
|
74037
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
74038
|
+
const isArrowHidden = cannotCenterArrow;
|
|
74039
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
74040
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
74041
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
74042
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
74043
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
74044
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
74045
|
+
let x = "";
|
|
74046
|
+
let y = "";
|
|
74047
|
+
if (placedSide === "bottom") {
|
|
74048
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
74049
|
+
y = `${-arrowHeight}px`;
|
|
74050
|
+
} else if (placedSide === "top") {
|
|
74051
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
74052
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
74053
|
+
} else if (placedSide === "right") {
|
|
74054
|
+
x = `${-arrowHeight}px`;
|
|
74055
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
74056
|
+
} else if (placedSide === "left") {
|
|
74057
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
74058
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
74059
|
+
}
|
|
74060
|
+
return { data: { x, y } };
|
|
74061
|
+
}
|
|
74062
|
+
});
|
|
74063
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
74064
|
+
const [side, align = "center"] = placement.split("-");
|
|
74065
|
+
return [side, align];
|
|
74066
|
+
}
|
|
74067
|
+
var Root2 = Popper;
|
|
74068
|
+
var Anchor = PopperAnchor;
|
|
74069
|
+
var Content = PopperContent;
|
|
74070
|
+
var Arrow = PopperArrow;
|
|
74071
|
+
|
|
74072
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
74073
|
+
function setRef(ref, value) {
|
|
74074
|
+
if (typeof ref === "function") {
|
|
74075
|
+
ref(value);
|
|
74076
|
+
} else if (ref !== null && ref !== void 0) {
|
|
74077
|
+
ref.current = value;
|
|
74078
|
+
}
|
|
74079
|
+
}
|
|
74080
|
+
function composeRefs(...refs) {
|
|
74081
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
74082
|
+
}
|
|
74083
|
+
function useComposedRefs(...refs) {
|
|
74084
|
+
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
74085
|
+
}
|
|
74086
|
+
|
|
74087
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
74088
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React__namespace.useLayoutEffect : () => {
|
|
74089
|
+
};
|
|
74090
|
+
|
|
74091
|
+
function useStateMachine(initialState, machine) {
|
|
74092
|
+
return React__namespace.useReducer((state, event) => {
|
|
74093
|
+
const nextState = machine[state][event];
|
|
74094
|
+
return nextState ?? state;
|
|
74095
|
+
}, initialState);
|
|
74096
|
+
}
|
|
74097
|
+
|
|
74098
|
+
// packages/react/presence/src/Presence.tsx
|
|
74099
|
+
var Presence = (props) => {
|
|
74100
|
+
const { present, children } = props;
|
|
74101
|
+
const presence = usePresence(present);
|
|
74102
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
74103
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
74104
|
+
const forceMount = typeof children === "function";
|
|
74105
|
+
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
74106
|
+
};
|
|
74107
|
+
Presence.displayName = "Presence";
|
|
74108
|
+
function usePresence(present) {
|
|
74109
|
+
const [node, setNode] = React__namespace.useState();
|
|
74110
|
+
const stylesRef = React__namespace.useRef({});
|
|
74111
|
+
const prevPresentRef = React__namespace.useRef(present);
|
|
74112
|
+
const prevAnimationNameRef = React__namespace.useRef("none");
|
|
74113
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
74114
|
+
const [state, send] = useStateMachine(initialState, {
|
|
74115
|
+
mounted: {
|
|
74116
|
+
UNMOUNT: "unmounted",
|
|
74117
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
74118
|
+
},
|
|
74119
|
+
unmountSuspended: {
|
|
74120
|
+
MOUNT: "mounted",
|
|
74121
|
+
ANIMATION_END: "unmounted"
|
|
74122
|
+
},
|
|
74123
|
+
unmounted: {
|
|
74124
|
+
MOUNT: "mounted"
|
|
74125
|
+
}
|
|
74126
|
+
});
|
|
74127
|
+
React__namespace.useEffect(() => {
|
|
74128
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
74129
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
74130
|
+
}, [state]);
|
|
74131
|
+
useLayoutEffect2(() => {
|
|
74132
|
+
const styles = stylesRef.current;
|
|
74133
|
+
const wasPresent = prevPresentRef.current;
|
|
74134
|
+
const hasPresentChanged = wasPresent !== present;
|
|
74135
|
+
if (hasPresentChanged) {
|
|
74136
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
74137
|
+
const currentAnimationName = getAnimationName(styles);
|
|
74138
|
+
if (present) {
|
|
74139
|
+
send("MOUNT");
|
|
74140
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
74141
|
+
send("UNMOUNT");
|
|
74142
|
+
} else {
|
|
74143
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
74144
|
+
if (wasPresent && isAnimating) {
|
|
74145
|
+
send("ANIMATION_OUT");
|
|
74146
|
+
} else {
|
|
74147
|
+
send("UNMOUNT");
|
|
74148
|
+
}
|
|
74149
|
+
}
|
|
74150
|
+
prevPresentRef.current = present;
|
|
74151
|
+
}
|
|
74152
|
+
}, [present, send]);
|
|
74153
|
+
useLayoutEffect2(() => {
|
|
74154
|
+
if (node) {
|
|
74155
|
+
let timeoutId;
|
|
74156
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
74157
|
+
const handleAnimationEnd = (event) => {
|
|
74158
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
74159
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
74160
|
+
if (event.target === node && isCurrentAnimation) {
|
|
74161
|
+
send("ANIMATION_END");
|
|
74162
|
+
if (!prevPresentRef.current) {
|
|
74163
|
+
const currentFillMode = node.style.animationFillMode;
|
|
74164
|
+
node.style.animationFillMode = "forwards";
|
|
74165
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
74166
|
+
if (node.style.animationFillMode === "forwards") {
|
|
74167
|
+
node.style.animationFillMode = currentFillMode;
|
|
74168
|
+
}
|
|
74169
|
+
});
|
|
74170
|
+
}
|
|
74171
|
+
}
|
|
74172
|
+
};
|
|
74173
|
+
const handleAnimationStart = (event) => {
|
|
74174
|
+
if (event.target === node) {
|
|
74175
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
74176
|
+
}
|
|
74177
|
+
};
|
|
74178
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
74179
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
74180
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
74181
|
+
return () => {
|
|
74182
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
74183
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
74184
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
74185
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
74186
|
+
};
|
|
74187
|
+
} else {
|
|
74188
|
+
send("ANIMATION_END");
|
|
74189
|
+
}
|
|
74190
|
+
}, [node, send]);
|
|
74191
|
+
return {
|
|
74192
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
74193
|
+
ref: React__namespace.useCallback((node2) => {
|
|
74194
|
+
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
74195
|
+
setNode(node2);
|
|
74196
|
+
}, [])
|
|
74197
|
+
};
|
|
74198
|
+
}
|
|
74199
|
+
function getAnimationName(styles) {
|
|
74200
|
+
return styles?.animationName || "none";
|
|
74201
|
+
}
|
|
74202
|
+
function getElementRef(element) {
|
|
74203
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
74204
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
74205
|
+
if (mayWarn) {
|
|
74206
|
+
return element.ref;
|
|
74207
|
+
}
|
|
74208
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
74209
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
74210
|
+
if (mayWarn) {
|
|
74211
|
+
return element.props.ref;
|
|
74212
|
+
}
|
|
74213
|
+
return element.props.ref || element.ref;
|
|
74214
|
+
}
|
|
74215
|
+
|
|
74216
|
+
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
74217
|
+
function useControllableState({
|
|
74218
|
+
prop,
|
|
74219
|
+
defaultProp,
|
|
74220
|
+
onChange = () => {
|
|
74221
|
+
}
|
|
74222
|
+
}) {
|
|
74223
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
74224
|
+
const isControlled = prop !== void 0;
|
|
74225
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
74226
|
+
const handleChange = useCallbackRef(onChange);
|
|
74227
|
+
const setValue = React__namespace.useCallback(
|
|
74228
|
+
(nextValue) => {
|
|
74229
|
+
if (isControlled) {
|
|
74230
|
+
const setter = nextValue;
|
|
74231
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
74232
|
+
if (value2 !== prop) handleChange(value2);
|
|
74233
|
+
} else {
|
|
74234
|
+
setUncontrolledProp(nextValue);
|
|
74235
|
+
}
|
|
74236
|
+
},
|
|
74237
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
74238
|
+
);
|
|
74239
|
+
return [value, setValue];
|
|
74240
|
+
}
|
|
74241
|
+
function useUncontrolledState({
|
|
74242
|
+
defaultProp,
|
|
74243
|
+
onChange
|
|
74244
|
+
}) {
|
|
74245
|
+
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
74246
|
+
const [value] = uncontrolledState;
|
|
74247
|
+
const prevValueRef = React__namespace.useRef(value);
|
|
74248
|
+
const handleChange = useCallbackRef(onChange);
|
|
74249
|
+
React__namespace.useEffect(() => {
|
|
74250
|
+
if (prevValueRef.current !== value) {
|
|
74251
|
+
handleChange(value);
|
|
74252
|
+
prevValueRef.current = value;
|
|
74253
|
+
}
|
|
74254
|
+
}, [value, prevValueRef, handleChange]);
|
|
74255
|
+
return uncontrolledState;
|
|
74256
|
+
}
|
|
74257
|
+
|
|
74258
|
+
// packages/react/visually-hidden/src/VisuallyHidden.tsx
|
|
74259
|
+
var NAME = "VisuallyHidden";
|
|
74260
|
+
var VisuallyHidden = React__namespace.forwardRef(
|
|
74261
|
+
(props, forwardedRef) => {
|
|
74262
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74263
|
+
Primitive.span,
|
|
74264
|
+
{
|
|
74265
|
+
...props,
|
|
74266
|
+
ref: forwardedRef,
|
|
74267
|
+
style: {
|
|
74268
|
+
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
74269
|
+
position: "absolute",
|
|
74270
|
+
border: 0,
|
|
74271
|
+
width: 1,
|
|
74272
|
+
height: 1,
|
|
74273
|
+
padding: 0,
|
|
74274
|
+
margin: -1,
|
|
74275
|
+
overflow: "hidden",
|
|
74276
|
+
clip: "rect(0, 0, 0, 0)",
|
|
74277
|
+
whiteSpace: "nowrap",
|
|
74278
|
+
wordWrap: "normal",
|
|
74279
|
+
...props.style
|
|
74280
|
+
}
|
|
74281
|
+
}
|
|
74282
|
+
);
|
|
74283
|
+
}
|
|
74284
|
+
);
|
|
74285
|
+
VisuallyHidden.displayName = NAME;
|
|
74286
|
+
var Root = VisuallyHidden;
|
|
74287
|
+
|
|
74288
|
+
var [createTooltipContext, createTooltipScope] = createContextScope$1("Tooltip", [
|
|
74289
|
+
createPopperScope
|
|
74290
|
+
]);
|
|
74291
|
+
var usePopperScope = createPopperScope();
|
|
74292
|
+
var PROVIDER_NAME = "TooltipProvider";
|
|
74293
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
74294
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
74295
|
+
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
74296
|
+
var TooltipProvider$1 = (props) => {
|
|
74297
|
+
const {
|
|
74298
|
+
__scopeTooltip,
|
|
74299
|
+
delayDuration = DEFAULT_DELAY_DURATION,
|
|
74300
|
+
skipDelayDuration = 300,
|
|
74301
|
+
disableHoverableContent = false,
|
|
74302
|
+
children
|
|
74303
|
+
} = props;
|
|
74304
|
+
const [isOpenDelayed, setIsOpenDelayed] = React__namespace.useState(true);
|
|
74305
|
+
const isPointerInTransitRef = React__namespace.useRef(false);
|
|
74306
|
+
const skipDelayTimerRef = React__namespace.useRef(0);
|
|
74307
|
+
React__namespace.useEffect(() => {
|
|
74308
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
74309
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
74310
|
+
}, []);
|
|
74311
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74312
|
+
TooltipProviderContextProvider,
|
|
74313
|
+
{
|
|
74314
|
+
scope: __scopeTooltip,
|
|
74315
|
+
isOpenDelayed,
|
|
74316
|
+
delayDuration,
|
|
74317
|
+
onOpen: React__namespace.useCallback(() => {
|
|
74318
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
74319
|
+
setIsOpenDelayed(false);
|
|
74320
|
+
}, []),
|
|
74321
|
+
onClose: React__namespace.useCallback(() => {
|
|
74322
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
74323
|
+
skipDelayTimerRef.current = window.setTimeout(
|
|
74324
|
+
() => setIsOpenDelayed(true),
|
|
74325
|
+
skipDelayDuration
|
|
74326
|
+
);
|
|
74327
|
+
}, [skipDelayDuration]),
|
|
74328
|
+
isPointerInTransitRef,
|
|
74329
|
+
onPointerInTransitChange: React__namespace.useCallback((inTransit) => {
|
|
74330
|
+
isPointerInTransitRef.current = inTransit;
|
|
74331
|
+
}, []),
|
|
74332
|
+
disableHoverableContent,
|
|
74333
|
+
children
|
|
74334
|
+
}
|
|
74335
|
+
);
|
|
74336
|
+
};
|
|
74337
|
+
TooltipProvider$1.displayName = PROVIDER_NAME;
|
|
74338
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
74339
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
74340
|
+
var Tooltip$1 = (props) => {
|
|
74341
|
+
const {
|
|
74342
|
+
__scopeTooltip,
|
|
74343
|
+
children,
|
|
74344
|
+
open: openProp,
|
|
74345
|
+
defaultOpen = false,
|
|
74346
|
+
onOpenChange,
|
|
74347
|
+
disableHoverableContent: disableHoverableContentProp,
|
|
74348
|
+
delayDuration: delayDurationProp
|
|
74349
|
+
} = props;
|
|
74350
|
+
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
74351
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
74352
|
+
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
74353
|
+
const contentId = useId();
|
|
74354
|
+
const openTimerRef = React__namespace.useRef(0);
|
|
74355
|
+
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
74356
|
+
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
74357
|
+
const wasOpenDelayedRef = React__namespace.useRef(false);
|
|
74358
|
+
const [open = false, setOpen] = useControllableState({
|
|
74359
|
+
prop: openProp,
|
|
74360
|
+
defaultProp: defaultOpen,
|
|
74361
|
+
onChange: (open2) => {
|
|
74362
|
+
if (open2) {
|
|
74363
|
+
providerContext.onOpen();
|
|
74364
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
74365
|
+
} else {
|
|
74366
|
+
providerContext.onClose();
|
|
74367
|
+
}
|
|
74368
|
+
onOpenChange?.(open2);
|
|
74369
|
+
}
|
|
74370
|
+
});
|
|
74371
|
+
const stateAttribute = React__namespace.useMemo(() => {
|
|
74372
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
74373
|
+
}, [open]);
|
|
74374
|
+
const handleOpen = React__namespace.useCallback(() => {
|
|
74375
|
+
window.clearTimeout(openTimerRef.current);
|
|
74376
|
+
wasOpenDelayedRef.current = false;
|
|
74377
|
+
setOpen(true);
|
|
74378
|
+
}, [setOpen]);
|
|
74379
|
+
const handleClose = React__namespace.useCallback(() => {
|
|
74380
|
+
window.clearTimeout(openTimerRef.current);
|
|
74381
|
+
setOpen(false);
|
|
74382
|
+
}, [setOpen]);
|
|
74383
|
+
const handleDelayedOpen = React__namespace.useCallback(() => {
|
|
74384
|
+
window.clearTimeout(openTimerRef.current);
|
|
74385
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
74386
|
+
wasOpenDelayedRef.current = true;
|
|
74387
|
+
setOpen(true);
|
|
74388
|
+
}, delayDuration);
|
|
74389
|
+
}, [delayDuration, setOpen]);
|
|
74390
|
+
React__namespace.useEffect(() => {
|
|
74391
|
+
return () => window.clearTimeout(openTimerRef.current);
|
|
74392
|
+
}, []);
|
|
74393
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74394
|
+
TooltipContextProvider,
|
|
74395
|
+
{
|
|
74396
|
+
scope: __scopeTooltip,
|
|
74397
|
+
contentId,
|
|
74398
|
+
open,
|
|
74399
|
+
stateAttribute,
|
|
74400
|
+
trigger,
|
|
74401
|
+
onTriggerChange: setTrigger,
|
|
74402
|
+
onTriggerEnter: React__namespace.useCallback(() => {
|
|
74403
|
+
if (providerContext.isOpenDelayed) handleDelayedOpen();
|
|
74404
|
+
else handleOpen();
|
|
74405
|
+
}, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen]),
|
|
74406
|
+
onTriggerLeave: React__namespace.useCallback(() => {
|
|
74407
|
+
if (disableHoverableContent) {
|
|
74408
|
+
handleClose();
|
|
74409
|
+
} else {
|
|
74410
|
+
window.clearTimeout(openTimerRef.current);
|
|
74411
|
+
}
|
|
74412
|
+
}, [handleClose, disableHoverableContent]),
|
|
74413
|
+
onOpen: handleOpen,
|
|
74414
|
+
onClose: handleClose,
|
|
74415
|
+
disableHoverableContent,
|
|
74416
|
+
children
|
|
74417
|
+
}
|
|
74418
|
+
) });
|
|
74419
|
+
};
|
|
74420
|
+
Tooltip$1.displayName = TOOLTIP_NAME;
|
|
74421
|
+
var TRIGGER_NAME = "TooltipTrigger";
|
|
74422
|
+
var TooltipTrigger$1 = React__namespace.forwardRef(
|
|
74423
|
+
(props, forwardedRef) => {
|
|
74424
|
+
const { __scopeTooltip, ...triggerProps } = props;
|
|
74425
|
+
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
74426
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
|
|
74427
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
74428
|
+
const ref = React__namespace.useRef(null);
|
|
74429
|
+
const composedRefs = useComposedRefs$1(forwardedRef, ref, context.onTriggerChange);
|
|
74430
|
+
const isPointerDownRef = React__namespace.useRef(false);
|
|
74431
|
+
const hasPointerMoveOpenedRef = React__namespace.useRef(false);
|
|
74432
|
+
const handlePointerUp = React__namespace.useCallback(() => isPointerDownRef.current = false, []);
|
|
74433
|
+
React__namespace.useEffect(() => {
|
|
74434
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
74435
|
+
}, [handlePointerUp]);
|
|
74436
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74437
|
+
Primitive.button,
|
|
74438
|
+
{
|
|
74439
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
74440
|
+
"data-state": context.stateAttribute,
|
|
74441
|
+
...triggerProps,
|
|
74442
|
+
ref: composedRefs,
|
|
74443
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
74444
|
+
if (event.pointerType === "touch") return;
|
|
74445
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
74446
|
+
context.onTriggerEnter();
|
|
74447
|
+
hasPointerMoveOpenedRef.current = true;
|
|
74448
|
+
}
|
|
74449
|
+
}),
|
|
74450
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
74451
|
+
context.onTriggerLeave();
|
|
74452
|
+
hasPointerMoveOpenedRef.current = false;
|
|
74453
|
+
}),
|
|
74454
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
74455
|
+
isPointerDownRef.current = true;
|
|
74456
|
+
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
74457
|
+
}),
|
|
74458
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
74459
|
+
if (!isPointerDownRef.current) context.onOpen();
|
|
74460
|
+
}),
|
|
74461
|
+
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
74462
|
+
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
74463
|
+
}
|
|
74464
|
+
) });
|
|
74465
|
+
}
|
|
74466
|
+
);
|
|
74467
|
+
TooltipTrigger$1.displayName = TRIGGER_NAME;
|
|
74468
|
+
var PORTAL_NAME = "TooltipPortal";
|
|
74469
|
+
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
74470
|
+
forceMount: void 0
|
|
74471
|
+
});
|
|
74472
|
+
var CONTENT_NAME = "TooltipContent";
|
|
74473
|
+
var TooltipContent$1 = React__namespace.forwardRef(
|
|
74474
|
+
(props, forwardedRef) => {
|
|
74475
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74476
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
74477
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74478
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
74479
|
+
}
|
|
74480
|
+
);
|
|
74481
|
+
var TooltipContentHoverable = React__namespace.forwardRef((props, forwardedRef) => {
|
|
74482
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74483
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
|
|
74484
|
+
const ref = React__namespace.useRef(null);
|
|
74485
|
+
const composedRefs = useComposedRefs$1(forwardedRef, ref);
|
|
74486
|
+
const [pointerGraceArea, setPointerGraceArea] = React__namespace.useState(null);
|
|
74487
|
+
const { trigger, onClose } = context;
|
|
74488
|
+
const content = ref.current;
|
|
74489
|
+
const { onPointerInTransitChange } = providerContext;
|
|
74490
|
+
const handleRemoveGraceArea = React__namespace.useCallback(() => {
|
|
74491
|
+
setPointerGraceArea(null);
|
|
74492
|
+
onPointerInTransitChange(false);
|
|
74493
|
+
}, [onPointerInTransitChange]);
|
|
74494
|
+
const handleCreateGraceArea = React__namespace.useCallback(
|
|
74495
|
+
(event, hoverTarget) => {
|
|
74496
|
+
const currentTarget = event.currentTarget;
|
|
74497
|
+
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
74498
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
74499
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
74500
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
74501
|
+
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
|
|
74502
|
+
setPointerGraceArea(graceArea);
|
|
74503
|
+
onPointerInTransitChange(true);
|
|
74504
|
+
},
|
|
74505
|
+
[onPointerInTransitChange]
|
|
74506
|
+
);
|
|
74507
|
+
React__namespace.useEffect(() => {
|
|
74508
|
+
return () => handleRemoveGraceArea();
|
|
74509
|
+
}, [handleRemoveGraceArea]);
|
|
74510
|
+
React__namespace.useEffect(() => {
|
|
74511
|
+
if (trigger && content) {
|
|
74512
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
74513
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
74514
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
74515
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
74516
|
+
return () => {
|
|
74517
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
74518
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
74519
|
+
};
|
|
74520
|
+
}
|
|
74521
|
+
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
74522
|
+
React__namespace.useEffect(() => {
|
|
74523
|
+
if (pointerGraceArea) {
|
|
74524
|
+
const handleTrackPointerGrace = (event) => {
|
|
74525
|
+
const target = event.target;
|
|
74526
|
+
const pointerPosition = { x: event.clientX, y: event.clientY };
|
|
74527
|
+
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
|
|
74528
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
74529
|
+
if (hasEnteredTarget) {
|
|
74530
|
+
handleRemoveGraceArea();
|
|
74531
|
+
} else if (isPointerOutsideGraceArea) {
|
|
74532
|
+
handleRemoveGraceArea();
|
|
74533
|
+
onClose();
|
|
74534
|
+
}
|
|
74535
|
+
};
|
|
74536
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
74537
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
74538
|
+
}
|
|
74539
|
+
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
74540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
74541
|
+
});
|
|
74542
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
74543
|
+
var TooltipContentImpl = React__namespace.forwardRef(
|
|
74544
|
+
(props, forwardedRef) => {
|
|
74545
|
+
const {
|
|
74546
|
+
__scopeTooltip,
|
|
74547
|
+
children,
|
|
74548
|
+
"aria-label": ariaLabel,
|
|
74549
|
+
onEscapeKeyDown,
|
|
74550
|
+
onPointerDownOutside,
|
|
74551
|
+
...contentProps
|
|
74552
|
+
} = props;
|
|
74553
|
+
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
74554
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
74555
|
+
const { onClose } = context;
|
|
74556
|
+
React__namespace.useEffect(() => {
|
|
74557
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
74558
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
74559
|
+
}, [onClose]);
|
|
74560
|
+
React__namespace.useEffect(() => {
|
|
74561
|
+
if (context.trigger) {
|
|
74562
|
+
const handleScroll = (event) => {
|
|
74563
|
+
const target = event.target;
|
|
74564
|
+
if (target?.contains(context.trigger)) onClose();
|
|
74565
|
+
};
|
|
74566
|
+
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
74567
|
+
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
74568
|
+
}
|
|
74569
|
+
}, [context.trigger, onClose]);
|
|
74570
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74571
|
+
DismissableLayer,
|
|
74572
|
+
{
|
|
74573
|
+
asChild: true,
|
|
74574
|
+
disableOutsidePointerEvents: false,
|
|
74575
|
+
onEscapeKeyDown,
|
|
74576
|
+
onPointerDownOutside,
|
|
74577
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
74578
|
+
onDismiss: onClose,
|
|
74579
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74580
|
+
Content,
|
|
74581
|
+
{
|
|
74582
|
+
"data-state": context.stateAttribute,
|
|
74583
|
+
...popperScope,
|
|
74584
|
+
...contentProps,
|
|
74585
|
+
ref: forwardedRef,
|
|
74586
|
+
style: {
|
|
74587
|
+
...contentProps.style,
|
|
74588
|
+
// re-namespace exposed content custom properties
|
|
74589
|
+
...{
|
|
74590
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
74591
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
74592
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
74593
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
74594
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
74595
|
+
}
|
|
74596
|
+
},
|
|
74597
|
+
children: [
|
|
74598
|
+
/* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
|
|
74599
|
+
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
74600
|
+
]
|
|
74601
|
+
}
|
|
74602
|
+
)
|
|
74603
|
+
}
|
|
74604
|
+
);
|
|
74605
|
+
}
|
|
74606
|
+
);
|
|
74607
|
+
TooltipContent$1.displayName = CONTENT_NAME;
|
|
74608
|
+
var ARROW_NAME = "TooltipArrow";
|
|
74609
|
+
var TooltipArrow = React__namespace.forwardRef(
|
|
74610
|
+
(props, forwardedRef) => {
|
|
74611
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
74612
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
74613
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
74614
|
+
ARROW_NAME,
|
|
74615
|
+
__scopeTooltip
|
|
74616
|
+
);
|
|
74617
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
74618
|
+
}
|
|
74619
|
+
);
|
|
74620
|
+
TooltipArrow.displayName = ARROW_NAME;
|
|
74621
|
+
function getExitSideFromRect(point, rect) {
|
|
74622
|
+
const top = Math.abs(rect.top - point.y);
|
|
74623
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
74624
|
+
const right = Math.abs(rect.right - point.x);
|
|
74625
|
+
const left = Math.abs(rect.left - point.x);
|
|
74626
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
74627
|
+
case left:
|
|
74628
|
+
return "left";
|
|
74629
|
+
case right:
|
|
74630
|
+
return "right";
|
|
74631
|
+
case top:
|
|
74632
|
+
return "top";
|
|
74633
|
+
case bottom:
|
|
74634
|
+
return "bottom";
|
|
74635
|
+
default:
|
|
74636
|
+
throw new Error("unreachable");
|
|
74637
|
+
}
|
|
74638
|
+
}
|
|
74639
|
+
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
|
|
74640
|
+
const paddedExitPoints = [];
|
|
74641
|
+
switch (exitSide) {
|
|
74642
|
+
case "top":
|
|
74643
|
+
paddedExitPoints.push(
|
|
74644
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
|
|
74645
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
74646
|
+
);
|
|
74647
|
+
break;
|
|
74648
|
+
case "bottom":
|
|
74649
|
+
paddedExitPoints.push(
|
|
74650
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
74651
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
|
|
74652
|
+
);
|
|
74653
|
+
break;
|
|
74654
|
+
case "left":
|
|
74655
|
+
paddedExitPoints.push(
|
|
74656
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
|
|
74657
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
74658
|
+
);
|
|
74659
|
+
break;
|
|
74660
|
+
case "right":
|
|
74661
|
+
paddedExitPoints.push(
|
|
74662
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
74663
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
|
|
74664
|
+
);
|
|
74665
|
+
break;
|
|
74666
|
+
}
|
|
74667
|
+
return paddedExitPoints;
|
|
74668
|
+
}
|
|
74669
|
+
function getPointsFromRect(rect) {
|
|
74670
|
+
const { top, right, bottom, left } = rect;
|
|
74671
|
+
return [
|
|
74672
|
+
{ x: left, y: top },
|
|
74673
|
+
{ x: right, y: top },
|
|
74674
|
+
{ x: right, y: bottom },
|
|
74675
|
+
{ x: left, y: bottom }
|
|
74676
|
+
];
|
|
74677
|
+
}
|
|
74678
|
+
function isPointInPolygon(point, polygon) {
|
|
74679
|
+
const { x, y } = point;
|
|
74680
|
+
let inside = false;
|
|
74681
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
74682
|
+
const xi = polygon[i].x;
|
|
74683
|
+
const yi = polygon[i].y;
|
|
74684
|
+
const xj = polygon[j].x;
|
|
74685
|
+
const yj = polygon[j].y;
|
|
74686
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
74687
|
+
if (intersect) inside = !inside;
|
|
74688
|
+
}
|
|
74689
|
+
return inside;
|
|
74690
|
+
}
|
|
74691
|
+
function getHull(points) {
|
|
74692
|
+
const newPoints = points.slice();
|
|
74693
|
+
newPoints.sort((a, b) => {
|
|
74694
|
+
if (a.x < b.x) return -1;
|
|
74695
|
+
else if (a.x > b.x) return 1;
|
|
74696
|
+
else if (a.y < b.y) return -1;
|
|
74697
|
+
else if (a.y > b.y) return 1;
|
|
74698
|
+
else return 0;
|
|
74699
|
+
});
|
|
74700
|
+
return getHullPresorted(newPoints);
|
|
74701
|
+
}
|
|
74702
|
+
function getHullPresorted(points) {
|
|
74703
|
+
if (points.length <= 1) return points.slice();
|
|
74704
|
+
const upperHull = [];
|
|
74705
|
+
for (let i = 0; i < points.length; i++) {
|
|
74706
|
+
const p = points[i];
|
|
74707
|
+
while (upperHull.length >= 2) {
|
|
74708
|
+
const q = upperHull[upperHull.length - 1];
|
|
74709
|
+
const r = upperHull[upperHull.length - 2];
|
|
74710
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
|
|
74711
|
+
else break;
|
|
74712
|
+
}
|
|
74713
|
+
upperHull.push(p);
|
|
74714
|
+
}
|
|
74715
|
+
upperHull.pop();
|
|
74716
|
+
const lowerHull = [];
|
|
74717
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
74718
|
+
const p = points[i];
|
|
74719
|
+
while (lowerHull.length >= 2) {
|
|
74720
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
74721
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
74722
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
|
|
74723
|
+
else break;
|
|
74724
|
+
}
|
|
74725
|
+
lowerHull.push(p);
|
|
74726
|
+
}
|
|
74727
|
+
lowerHull.pop();
|
|
74728
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
74729
|
+
return upperHull;
|
|
74730
|
+
} else {
|
|
74731
|
+
return upperHull.concat(lowerHull);
|
|
74732
|
+
}
|
|
74733
|
+
}
|
|
74734
|
+
var Provider = TooltipProvider$1;
|
|
74735
|
+
var Root3 = Tooltip$1;
|
|
74736
|
+
var Trigger = TooltipTrigger$1;
|
|
74737
|
+
var Content2 = TooltipContent$1;
|
|
74738
|
+
|
|
74739
|
+
var TooltipProvider = Provider;
|
|
74740
|
+
var TooltipRoot = Root3;
|
|
74741
|
+
var TooltipTrigger = Trigger;
|
|
74742
|
+
var TooltipContent = React__namespace.forwardRef(function (_a, ref) {
|
|
74743
|
+
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
|
|
74744
|
+
return (React__namespace.createElement(Content2, __assign({ ref: ref, sideOffset: sideOffset, className: classNames("s-bg-primary-50 s-text-primary-700 s-z-50 s-max-w-xs s-overflow-hidden s-rounded-md s-border s-bg-white s-px-3 s-py-1.5 s-text-sm s-shadow-md", "s-animate-in s-fade-in-0 s-zoom-in-95", "data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=closed]:s-zoom-out-95 data-[side=bottom]:s-slide-in-from-top-2 data-[side=left]:s-slide-in-from-right-2 data-[side=right]:s-slide-in-from-left-2 data-[side=top]:s-slide-in-from-bottom-2", className || "") }, props)));
|
|
74745
|
+
});
|
|
74746
|
+
function Tooltip(_a) {
|
|
74747
|
+
var trigger = _a.trigger, label = _a.label, props = __rest(_a, ["trigger", "label"]);
|
|
74748
|
+
return (React__namespace.createElement(TooltipProvider, null,
|
|
74749
|
+
React__namespace.createElement(TooltipRoot, null,
|
|
74750
|
+
React__namespace.createElement(TooltipTrigger, null, trigger),
|
|
74751
|
+
React__namespace.createElement(TooltipContent, __assign({}, props), label))));
|
|
74752
|
+
}
|
|
74753
|
+
TooltipContent.displayName = Content2.displayName;
|
|
74754
|
+
|
|
74755
|
+
var IconSizes = {
|
|
74756
|
+
xs: "s-h-4 s-w-4",
|
|
74757
|
+
sm: "s-h-5 s-w-5",
|
|
74758
|
+
md: "s-h-6 s-w-6",
|
|
74759
|
+
lg: "s-h-8 s-w-8",
|
|
74760
|
+
xl: "s-h-12 s-w-12",
|
|
74761
|
+
"2xl": "s-h-20 s-w-20",
|
|
74762
|
+
};
|
|
74763
|
+
function Icon(_a) {
|
|
74764
|
+
var IconComponent = _a.visual, _b = _a.size, size = _b === void 0 ? "sm" : _b, _c = _a.className, className = _c === void 0 ? "" : _c;
|
|
74765
|
+
return IconComponent ? (React.createElement(IconComponent, { className: classNames(className, "s-shrink-0", IconSizes[size]) })) : null;
|
|
74766
|
+
}
|
|
74767
|
+
|
|
74768
|
+
var textClasses = {
|
|
74769
|
+
xs: "s-text-xs s-font-semibold",
|
|
74770
|
+
sm: "s-text-sm s-font-semibold",
|
|
74771
|
+
md: "s-text-base s-font-bold",
|
|
74772
|
+
lg: "s-text-lg s-font-bold",
|
|
74773
|
+
};
|
|
74774
|
+
var sizeClasses$4 = {
|
|
74775
|
+
xs: "s-gap-x-1 s-px-3 s-h-7",
|
|
74776
|
+
sm: "s-gap-x-1 s-px-4 s-h-9",
|
|
74777
|
+
md: "s-gap-x-1.5 s-px-5 s-h-12",
|
|
74778
|
+
lg: "s-gap-x-3 s-px-6 s-h-16",
|
|
74779
|
+
};
|
|
74780
|
+
var sizeAvatarClasses = {
|
|
74781
|
+
xs: "s-gap-x-1 s-pl-0.5 s-pr-3 s-py-0.5",
|
|
74782
|
+
sm: "s-gap-x-1 s-pl-0.5 s-pr-4 s-py-0.5",
|
|
74783
|
+
md: "s-gap-x-1.5 s-pl-1 s-pr-5 s-py-1",
|
|
74784
|
+
lg: "s-gap-x-2 s-pl-0 s-pr-6 s-py-0",
|
|
74785
|
+
};
|
|
74786
|
+
var containerClasses = {
|
|
74787
|
+
xs: "s-px-0.5",
|
|
74788
|
+
sm: "s-px-1",
|
|
74789
|
+
md: "s-px-1",
|
|
74790
|
+
lg: "s-px-1",
|
|
74791
|
+
};
|
|
74792
|
+
var variantClasses$2 = {
|
|
74793
|
+
primary: {
|
|
74794
|
+
base: "s-text-white s-bg-action-500 s-border-action-600",
|
|
74795
|
+
hover: "hover:s-bg-action-400 hover:s-border-action-500",
|
|
74796
|
+
active: "active:s-bg-action-600 active:s-border-action-700",
|
|
74797
|
+
disabled: "s-text-white s-bg-action-200 s-border-action-200",
|
|
74798
|
+
dark: {
|
|
74799
|
+
base: "",
|
|
74800
|
+
hover: "",
|
|
74801
|
+
active: "",
|
|
74802
|
+
disabled: "dark:s-text-action-700-dark dark:s-bg-action-100-dark dark:s-border-action-200-dark dark:s-saturate-50",
|
|
74803
|
+
},
|
|
74804
|
+
},
|
|
74805
|
+
primaryWarning: {
|
|
74806
|
+
base: "s-text-white s-bg-warning-500 s-border-warning-600",
|
|
74807
|
+
hover: "hover:s-bg-warning-400 hover:s-border-warning-500",
|
|
74808
|
+
active: "active:s-bg-warning-600 active:s-border-warning-700",
|
|
74809
|
+
disabled: "s-text-white s-bg-warning-200 s-border-warning-200",
|
|
74810
|
+
dark: {
|
|
74811
|
+
base: "",
|
|
74812
|
+
hover: "",
|
|
74813
|
+
active: "",
|
|
74814
|
+
disabled: "dark:s-text-warning-700-dark dark:s-bg-warning-100-dark dark:s-border-warning-200-dark dark:s-saturate-50",
|
|
74815
|
+
},
|
|
74816
|
+
},
|
|
74817
|
+
secondary: {
|
|
74818
|
+
base: "s-text-action-500 s-border-structure-200 s-bg-structure-0",
|
|
74819
|
+
hover: "hover:s-bg-action-50 hover:s-border-action-200",
|
|
74820
|
+
active: "active:s-bg-action-100 active:s-border-action-500",
|
|
74821
|
+
disabled: "s-text-action-300 s-border-structure-200 s-bg-structure-0",
|
|
74822
|
+
dark: {
|
|
74823
|
+
base: "dark:s-text-action-600-dark dark:s-border-structure-200-dark dark:s-bg-structure-100-dark",
|
|
74824
|
+
hover: "dark:hover:s-text-action-700-dark dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
74825
|
+
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
74826
|
+
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
74827
|
+
},
|
|
74828
|
+
},
|
|
74829
|
+
secondaryWarning: {
|
|
74830
|
+
base: "s-text-warning-500 s-border-structure-200 s-bg-structure-0",
|
|
74831
|
+
hover: "hover:s-bg-warning-50 hover:s-border-warning-200",
|
|
74832
|
+
active: "active:s-bg-warning-100 active:s-border-warning-500",
|
|
74833
|
+
disabled: "s-text-warning-300 s-border-structure-200 s-bg-structure-0",
|
|
74834
|
+
dark: {
|
|
74835
|
+
base: "dark:s-text-warning-600-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
74836
|
+
hover: "dark:hover:s-bg-warning-50-dark dark:hover:s-border-warning-300-dark",
|
|
74837
|
+
active: "dark:active:s-bg-warning-100-dark dark:active:s-border-warning-500-dark",
|
|
74838
|
+
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
74839
|
+
},
|
|
74840
|
+
},
|
|
74841
|
+
tertiary: {
|
|
74842
|
+
base: "s-text-element-800 s-border-structure-200 s-bg-structure-0",
|
|
74843
|
+
hover: "hover:s-bg-action-50 hover:s-text-action-500 hover:s-border-action-200",
|
|
74844
|
+
active: "active:s-bg-action-100 active:s-text-action-600 active:s-border-action-500",
|
|
74845
|
+
disabled: "s-text-element-500 s-border-structure-200 s-bg-structure-0",
|
|
74846
|
+
dark: {
|
|
74847
|
+
base: "dark:s-text-element-800-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
74848
|
+
hover: "dark:hover:s-text-action-300 dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
74849
|
+
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
74850
|
+
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
74851
|
+
},
|
|
74852
|
+
},
|
|
74853
|
+
avatar: {
|
|
74854
|
+
base: "s-text-element-800 s-border-structure-200 s-bg-structure-0",
|
|
74855
|
+
hover: "hover:s-bg-action-50 hover:s-text-action-500 hover:s-border-action-200",
|
|
74856
|
+
active: "active:s-bg-action-100 active:s-text-action-600 active:s-border-action-500",
|
|
74857
|
+
disabled: "s-text-element-500 s-border-structure-200 s-bg-structure-0",
|
|
74858
|
+
dark: {
|
|
74859
|
+
base: "dark:s-text-element-700-dark dark:s-border-structure-300-dark dark:s-bg-structure-100-dark",
|
|
74860
|
+
hover: "dark:hover:s-bg-action-50-dark dark:hover:s-border-action-300-dark",
|
|
74861
|
+
active: "dark:active:s-bg-action-100-dark dark:active:s-border-action-500-dark",
|
|
74862
|
+
disabled: "dark:s-text-element-600-dark dark:s-border-structure-100-dark dark:s-bg-structure-200-dark",
|
|
74863
|
+
},
|
|
74864
|
+
},
|
|
74865
|
+
};
|
|
74866
|
+
var transitionClasses = "s-transition-all s-ease-out s-duration-200 s-cursor-pointer";
|
|
74867
|
+
var magnifyingClasses = "hover:s-scale-105 hover:s-drop-shadow-md active:s-scale-100 active:s-drop-shadow-none";
|
|
74868
|
+
function Button(_a) {
|
|
74869
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
74870
|
+
var _o = _a.variant, variant = _o === void 0 ? "primary" : _o, _p = _a.type, type = _p === void 0 ? "button" : _p, _q = _a.size, size = _q === void 0 ? "sm" : _q, onClick = _a.onClick, _r = _a.disabled, disabled = _r === void 0 ? false : _r, _s = _a.labelVisible, labelVisible = _s === void 0 ? true : _s, label = _a.label, icon = _a.icon, _t = _a.className, className = _t === void 0 ? "" : _t, tooltipPosition = _a.tooltipPosition, _u = _a.hasMagnifying, hasMagnifying = _u === void 0 ? true : _u, _v = _a.disabledTooltip, disabledTooltip = _v === void 0 ? false : _v, avatar = _a.avatar;
|
|
74871
|
+
var buttonClasses = classNames("s-inline-flex s-items-center s-border s-scale-100 s-box-border s-whitespace-nowrap s-rounded-full", !avatar ? sizeClasses$4[size] : sizeAvatarClasses[size], textClasses[size], className);
|
|
74872
|
+
if (disabled) {
|
|
74873
|
+
buttonClasses = classNames(buttonClasses, (_b = variantClasses$2[variant]) === null || _b === void 0 ? void 0 : _b.disabled, (_c = variantClasses$2[variant]) === null || _c === void 0 ? void 0 : _c.dark.disabled, disabled ? "s-cursor-default" : "");
|
|
74874
|
+
}
|
|
74875
|
+
else {
|
|
74876
|
+
buttonClasses = classNames(buttonClasses, transitionClasses, hasMagnifying ? magnifyingClasses : "", (_d = variantClasses$2[variant]) === null || _d === void 0 ? void 0 : _d.base, (_e = variantClasses$2[variant]) === null || _e === void 0 ? void 0 : _e.hover, (_f = variantClasses$2[variant]) === null || _f === void 0 ? void 0 : _f.active, (_h = (_g = variantClasses$2[variant]) === null || _g === void 0 ? void 0 : _g.dark) === null || _h === void 0 ? void 0 : _h.base, (_k = (_j = variantClasses$2[variant]) === null || _j === void 0 ? void 0 : _j.dark) === null || _k === void 0 ? void 0 : _k.hover, (_m = (_l = variantClasses$2[variant]) === null || _l === void 0 ? void 0 : _l.dark) === null || _m === void 0 ? void 0 : _m.active);
|
|
74877
|
+
}
|
|
74878
|
+
var finalContainerClasses = classNames(containerClasses[size]);
|
|
74879
|
+
var buttonBase = (React.createElement("button", { type: "button", className: buttonClasses, onClick: onClick, disabled: disabled, "aria-label": label },
|
|
74880
|
+
icon && React.createElement(Icon, { visual: icon, size: size }),
|
|
74881
|
+
avatar && React.createElement(Avatar, { size: size, visual: avatar, isRounded: true }),
|
|
74882
|
+
labelVisible ? (React.createElement("div", { className: classNames("s-truncate", finalContainerClasses) }, label)) : null,
|
|
74883
|
+
type === "menu" && (React.createElement(Icon, { className: "s-opacity-50", visual: SvgChevronDown$1, size: size })),
|
|
74884
|
+
type === "select" && (React.createElement(Icon, { className: "s-opacity-60", visual: SvgChevronUpDown$1, size: size }))));
|
|
74885
|
+
return labelVisible || disabledTooltip ? (buttonBase) : (React.createElement(Tooltip, { trigger: buttonBase, label: label, side: tooltipPosition }));
|
|
74886
|
+
}
|
|
74887
|
+
Button.List = function (_a) {
|
|
74888
|
+
var children = _a.children, _b = _a.isWrapping, isWrapping = _b === void 0 ? false : _b, className = _a.className;
|
|
74889
|
+
var modifiedChildren = React.Children.map(children, function (child) {
|
|
74890
|
+
// Check if this child is a Button
|
|
74891
|
+
if (React.isValidElement(child) && child.type === Button) {
|
|
74892
|
+
// Clone the element with hasMagnifying set to false
|
|
74893
|
+
return React.cloneElement(child, { hasMagnifying: false });
|
|
74894
|
+
}
|
|
74895
|
+
return child;
|
|
74896
|
+
});
|
|
74897
|
+
return (React.createElement("div", { className: classNames(className ? className : "", "s-flex") },
|
|
74898
|
+
React.createElement("div", { className: classNames("s-flex s-flex-row s-gap-2", isWrapping ? "s-flex-wrap" : "s-flex-nowrap") }, modifiedChildren)));
|
|
74899
|
+
};
|
|
74900
|
+
|
|
74901
|
+
var aLink = function (_a) {
|
|
74902
|
+
var href = _a.href, className = _a.className, ariaCurrent = _a.ariaCurrent, ariaLabel = _a.ariaLabel, onClick = _a.onClick, children = _a.children, target = _a.target, rel = _a.rel;
|
|
74903
|
+
var hrefAsString = typeof href !== "string" ? url.format(href) : href;
|
|
74904
|
+
return (React.createElement("a", { href: hrefAsString, className: className, "aria-current": ariaCurrent, "aria-label": ariaLabel, onClick: onClick, target: target, rel: rel }, children));
|
|
74905
|
+
};
|
|
74906
|
+
var noHrefLink = function (_a) {
|
|
74907
|
+
var className = _a.className, ariaCurrent = _a.ariaCurrent, ariaLabel = _a.ariaLabel, onClick = _a.onClick, children = _a.children;
|
|
74908
|
+
return (React.createElement("a", { className: className, "aria-current": ariaCurrent, "arria-label": ariaLabel, onClick: onClick }, children));
|
|
74909
|
+
};
|
|
74910
|
+
var SparkleContext = React.createContext({
|
|
74911
|
+
components: {
|
|
74912
|
+
link: aLink,
|
|
74913
|
+
},
|
|
74914
|
+
});
|
|
74915
|
+
|
|
74916
|
+
var variantClasses$1 = {
|
|
74917
|
+
primary: "s-bg-structure-50 s-border s-border-structure-200",
|
|
74918
|
+
secondary: "s-bg-structure-0 s-border s-border-structure-100",
|
|
74919
|
+
tertiary: "s-border-structure-100/0 s-border s-border-structure-0",
|
|
74920
|
+
};
|
|
74921
|
+
var hoverVariantClasses = {
|
|
74922
|
+
primary: "hover:s-bg-white hover:s-border-structure-100 active:s-bg-structure-100 active:s-border-structure-200 s-cursor-pointer",
|
|
74923
|
+
secondary: "hover:s-bg-structure-50 hover:s-border-structure-200 active:s-bg-structure-100 active:s-border-structure-300 s-cursor-pointer",
|
|
74924
|
+
tertiary: "hover:s-bg-structure-50 hover:s-border-structure-100 active:s-bg-structure-100 active:s-border-structure-200 s-cursor-pointer",
|
|
74925
|
+
};
|
|
74926
|
+
var sizeClasses$3 = {
|
|
74927
|
+
sm: "s-p-3 s-rounded-xl",
|
|
74928
|
+
md: "s-p-4 s-rounded-2xl",
|
|
74929
|
+
lg: "s-p-5 s-rounded-3xl",
|
|
74930
|
+
};
|
|
74931
|
+
function CardButton(_a) {
|
|
74932
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.className, className = _d === void 0 ? "" : _d, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, href = _a.href, _e = _a.target, target = _e === void 0 ? "_blank" : _e, _f = _a.rel, rel = _f === void 0 ? "" : _f, replace = _a.replace, shallow = _a.shallow;
|
|
74933
|
+
var components = React.useContext(SparkleContext).components;
|
|
74934
|
+
var Link = href ? components.link : noHrefLink;
|
|
74935
|
+
var commonClasses = classNames("s-flex s-group s-transition s-duration-200 s-overflow-hidden", onClick ? hoverVariantClasses[variant] : "", variantClasses$1[variant], sizeClasses$3[size], className);
|
|
74936
|
+
if (href) {
|
|
74937
|
+
return (React.createElement(Link, { href: href, className: commonClasses, replace: replace, shallow: shallow, target: target, rel: rel }, children));
|
|
74938
|
+
}
|
|
74939
|
+
else {
|
|
74940
|
+
return (React.createElement("div", { className: commonClasses, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, children));
|
|
74941
|
+
}
|
|
74942
|
+
}
|
|
74943
|
+
|
|
74944
|
+
var isBrowser = typeof window !== "undefined";
|
|
74945
|
+
var breakpoints$1 = {
|
|
74946
|
+
sm: 640, // Tailwind's default for `sm`
|
|
74947
|
+
md: 768, // Tailwind's default for `md`
|
|
74948
|
+
lg: 1024, // Tailwind's default for `lg`
|
|
74949
|
+
xl: 1280, // Tailwind's default for `xl`
|
|
74950
|
+
xxl: 1536, // Tailwind's default for `2xl`
|
|
74951
|
+
};
|
|
74952
|
+
var getWindowWidth = function () { return (isBrowser ? window.innerWidth : 0); };
|
|
74953
|
+
var titleClassNames = {
|
|
74954
|
+
base: "s-truncate s-font-medium s-text-element-900 s-w-full",
|
|
74955
|
+
list: "s-text-base",
|
|
74956
|
+
minimal: "s-overflow-hidden s-whitespace-nowrap ".concat(getWindowWidth() <= breakpoints$1.sm
|
|
74957
|
+
? "s-text-sm"
|
|
74958
|
+
: getWindowWidth() <= breakpoints$1.md
|
|
74959
|
+
? "s-text-base"
|
|
74960
|
+
: ""),
|
|
74961
|
+
};
|
|
74962
|
+
var subtitleClassNames = {
|
|
74963
|
+
base: "s-font-normal s-text-element-700 s-truncate s-w-full",
|
|
74964
|
+
list: "s-text-sm",
|
|
74965
|
+
minimal: "s-overflow-hidden s-whitespace-nowrap ".concat(getWindowWidth() <= breakpoints$1.sm
|
|
74966
|
+
? "s-text-xs"
|
|
74967
|
+
: getWindowWidth() <= breakpoints$1.md
|
|
74968
|
+
? "s-text-xs"
|
|
74969
|
+
: "s-text-sm"),
|
|
74970
|
+
};
|
|
74971
|
+
var descriptionClassNames = {
|
|
74972
|
+
base: "s-font-normal s-mb-1",
|
|
74973
|
+
list: "s-text-base s-text-element-800 s-line-clamp-3",
|
|
74974
|
+
};
|
|
74975
|
+
function renderVariantContent(props) {
|
|
74976
|
+
switch (props.variant) {
|
|
74977
|
+
case "list":
|
|
74978
|
+
return React.createElement(ListVariantContent, __assign({}, props));
|
|
74979
|
+
case "minimal":
|
|
74980
|
+
return React.createElement(MinimalVariantContent, __assign({}, props));
|
|
74981
|
+
default:
|
|
74982
|
+
return React.createElement(React.Fragment, null);
|
|
74983
|
+
}
|
|
74984
|
+
}
|
|
74985
|
+
var ListVariantContent = function (_a) {
|
|
74986
|
+
var description = _a.description, title = _a.title, pictureUrl = _a.pictureUrl, subtitle = _a.subtitle;
|
|
74987
|
+
return (React.createElement("div", { className: "s-flex s-gap-2" },
|
|
74988
|
+
React.createElement(Avatar, { name: "Avatar of ".concat(title), visual: pictureUrl, size: "lg" }),
|
|
74989
|
+
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-2" },
|
|
74990
|
+
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-row s-gap-3" },
|
|
74991
|
+
React.createElement("div", { className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-0" },
|
|
74992
|
+
React.createElement("div", { className: classNames(titleClassNames["base"], titleClassNames.list) },
|
|
74993
|
+
"@",
|
|
74994
|
+
title),
|
|
74995
|
+
subtitle && (React.createElement("div", { className: classNames(subtitleClassNames["base"], subtitleClassNames.list) },
|
|
74996
|
+
"By: ",
|
|
74997
|
+
subtitle)))),
|
|
74998
|
+
React.createElement("div", { className: classNames(descriptionClassNames["base"], descriptionClassNames.list) }, description))));
|
|
74999
|
+
};
|
|
75000
|
+
var MinimalVariantContent = function (_a) {
|
|
75001
|
+
var title = _a.title, pictureUrl = _a.pictureUrl, subtitle = _a.subtitle, _b = _a.hasAction, hasAction = _b === void 0 ? true : _b, actionElement = _a.actionElement, description = _a.description, onClick = _a.onClick, onActionClick = _a.onActionClick;
|
|
75002
|
+
var actionButton = actionElement !== null && actionElement !== void 0 ? actionElement : (React.createElement(Button, { label: "", icon: SvgMore$1, variant: "tertiary", size: "sm", labelVisible: false, hasMagnifying: false, disabledTooltip: true, onClick: function (e) {
|
|
75003
|
+
e.stopPropagation();
|
|
75004
|
+
onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick();
|
|
75005
|
+
} }));
|
|
75006
|
+
return (React.createElement(React.Fragment, null,
|
|
75007
|
+
React.createElement("div", { id: "assistant-container", className: "s-flex s-grow s-flex-col s-justify-start s-gap-2 s-overflow-hidden s-py-1", onClick: function (e) {
|
|
75008
|
+
e.stopPropagation();
|
|
75009
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
75010
|
+
} },
|
|
75011
|
+
React.createElement("div", { className: "s-flex s-flex-row s-justify-between s-gap-2 s-overflow-hidden" },
|
|
75012
|
+
React.createElement("div", { id: "preview", className: "s-flex s-w-full s-min-w-0 s-flex-row s-items-center s-gap-2" },
|
|
75013
|
+
React.createElement("div", { id: "avatar-column", className: "s-w-fit" },
|
|
75014
|
+
React.createElement(Avatar, { name: "Avatar of ".concat(title), visual: pictureUrl, size: "md" })),
|
|
75015
|
+
React.createElement("div", { id: "details-column", className: "s-flex s-w-full s-min-w-0 s-flex-col s-items-start s-gap-0 s-overflow-hidden" },
|
|
75016
|
+
React.createElement("div", { className: classNames(titleClassNames["base"], titleClassNames.minimal) },
|
|
75017
|
+
"@",
|
|
75018
|
+
title),
|
|
75019
|
+
React.createElement("div", { className: classNames(subtitleClassNames["base"], subtitleClassNames.minimal) },
|
|
75020
|
+
"By: ",
|
|
75021
|
+
subtitle))),
|
|
75022
|
+
React.createElement("div", { id: "actions-column", className: "s-flex s-w-fit s-shrink-0" }, hasAction && actionButton)),
|
|
75023
|
+
React.createElement("div", { className: "s-line-clamp-2 s-text-sm s-text-element-700" }, description))));
|
|
75024
|
+
};
|
|
75025
|
+
function AssistantPreview(props) {
|
|
75026
|
+
var onClick = props.onClick, variant = props.variant;
|
|
75027
|
+
// State to manage the visibility of the play button
|
|
75028
|
+
var _a = __read(React.useState(false), 2), isHovered = _a[0], setIsHovered = _a[1];
|
|
75029
|
+
return (React.createElement(CardButton, { variant: variant === "minimal" ? "secondary" : "tertiary", className: classNames("s-flex s-flex-col s-gap-2 s-border"), size: variant === "minimal" ? "sm" : "lg", onClick: onClick, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, renderVariantContent(__assign(__assign({}, props), { isHovered: isHovered }))));
|
|
75030
|
+
}
|
|
75031
|
+
|
|
75032
|
+
var baseClasses$3 = "s-transition-all s-ease-out s-duration-300 s-cursor-pointer hover:s-scale-110";
|
|
75033
|
+
var iconClasses$5 = {
|
|
75034
|
+
primary: {
|
|
75035
|
+
base: "s-text-action-500",
|
|
75036
|
+
hover: "hover:s-text-action-400",
|
|
75037
|
+
active: "active:s-text-action-600",
|
|
75038
|
+
disabled: "s-text-element-500",
|
|
75039
|
+
dark: {
|
|
75040
|
+
base: "dark:s-text-action-500-dark",
|
|
75041
|
+
hover: "dark:hover:s-text-action-500-dark",
|
|
75042
|
+
active: "dark:active:s-text-action-600-dark",
|
|
75043
|
+
disabled: "dark:s-text-element-500-dark",
|
|
75044
|
+
},
|
|
75045
|
+
},
|
|
75046
|
+
warning: {
|
|
75047
|
+
base: "s-text-warning-500",
|
|
75048
|
+
hover: "hover:s-text-warning-400",
|
|
75049
|
+
active: "active:s-text-warning-600",
|
|
75050
|
+
disabled: "s-text-element-500",
|
|
75051
|
+
dark: {
|
|
75052
|
+
base: "dark:s-text-warning-500-dark",
|
|
75053
|
+
hover: "dark:hover:s-text-warning-500-dark",
|
|
75054
|
+
active: "dark:active:s-text-warning-600-dark",
|
|
75055
|
+
disabled: "dark:s-text-element-500-dark",
|
|
75056
|
+
},
|
|
75057
|
+
},
|
|
75058
|
+
secondary: {
|
|
75059
|
+
base: "s-text-element-900",
|
|
75060
|
+
hover: "hover:s-text-action-400",
|
|
75061
|
+
active: "active:s-text-action-600",
|
|
75062
|
+
disabled: "s-text-element-500",
|
|
75063
|
+
dark: {
|
|
75064
|
+
base: "dark:s-text-element-900-dark",
|
|
75065
|
+
hover: "dark:hover:s-text-action-500-dark",
|
|
75066
|
+
active: "dark:active:s-text-action-600-dark",
|
|
75067
|
+
disabled: "dark:s-text-element-500-dark",
|
|
75068
|
+
},
|
|
75069
|
+
},
|
|
75070
|
+
tertiary: {
|
|
75071
|
+
base: "s-text-element-700",
|
|
75072
|
+
hover: "hover:s-text-action-400",
|
|
75073
|
+
active: "active:s-text-action-600",
|
|
75074
|
+
disabled: "s-text-element-500",
|
|
75075
|
+
dark: {
|
|
75076
|
+
base: "dark:s-text-element-700-dark",
|
|
75077
|
+
hover: "dark:hover:s-text-action-500-dark",
|
|
75078
|
+
active: "dark:active:s-text-action-600-dark",
|
|
75079
|
+
disabled: "dark:s-text-element-500-dark",
|
|
75080
|
+
},
|
|
75081
|
+
},
|
|
75082
|
+
white: {
|
|
75083
|
+
base: "s-text-white",
|
|
75084
|
+
hover: "hover:s-text-slate-100",
|
|
75085
|
+
active: "active:s-text-slate-200",
|
|
75086
|
+
disabled: "s-text-white/50",
|
|
75087
|
+
dark: {
|
|
75088
|
+
base: "s-text-white",
|
|
75089
|
+
hover: "hover:s-text-slate-100",
|
|
75090
|
+
active: "active:s-text-slate-200",
|
|
75091
|
+
disabled: "s-text-white/50",
|
|
75092
|
+
},
|
|
75093
|
+
},
|
|
75094
|
+
};
|
|
75095
|
+
function IconButton(_a) {
|
|
75096
|
+
var _b = _a.variant, variant = _b === void 0 ? "tertiary" : _b, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "top" : _d, icon = _a.icon, _e = _a.className, className = _e === void 0 ? "" : _e, _f = _a.size, size = _f === void 0 ? "sm" : _f;
|
|
75097
|
+
// Choose the correct group of classes based on 'type'
|
|
75098
|
+
var iconGroup = iconClasses$5[variant];
|
|
75099
|
+
var finalIconClasses = classNames(className, baseClasses$3, iconGroup.base, disabled ? iconGroup.disabled : iconGroup.hover, disabled ? "" : iconGroup.active, iconGroup.dark.base, disabled ? iconGroup.dark.disabled : iconGroup.dark.hover, disabled ? "" : iconGroup.dark.active);
|
|
75100
|
+
var IconButtonContent = (React.createElement("button", { className: finalIconClasses, onClick: disabled ? undefined : onClick, disabled: disabled }, icon && React.createElement(Icon, { visual: icon, size: size })));
|
|
75101
|
+
return tooltip ? (React.createElement(Tooltip, { trigger: IconButtonContent, label: tooltip, side: tooltipPosition })) : (IconButtonContent);
|
|
75102
|
+
}
|
|
75103
|
+
|
|
75104
|
+
var variantClasses = {
|
|
75105
|
+
info: "s-bg-indigo-300 s-text-indigo-950",
|
|
75106
|
+
incident: "s-bg-amber-300 s-text-amber-950",
|
|
75107
|
+
error: "s-bg-red-300 s-text-red-950",
|
|
75108
|
+
};
|
|
75109
|
+
function Banner(_a) {
|
|
75110
|
+
var _b = _a.variant, variant = _b === void 0 ? "info" : _b, _c = _a.allowDismiss, allowDismiss = _c === void 0 ? true : _c, _d = _a.className, className = _d === void 0 ? "" : _d, _e = _a.hidden, hidden = _e === void 0 ? false : _e, onDismiss = _a.onDismiss, children = _a.children;
|
|
75111
|
+
var _f = __read(React.useState(true), 2), isDismissed = _f[0], setIsDismissed = _f[1];
|
|
75112
|
+
React.useEffect(function () {
|
|
75113
|
+
setIsDismissed(hidden);
|
|
75114
|
+
}, [hidden]);
|
|
75115
|
+
return isDismissed ? (React.createElement(React.Fragment, null)) : (React.createElement("div", { className: classNames(variantClasses[variant], "sm:s-before:flex-1 s-flex s-min-h-16 s-items-center s-px-6 s-py-4 s-text-sm sm:s-px-3.5", className) },
|
|
75116
|
+
children,
|
|
75117
|
+
allowDismiss && (React.createElement("div", { className: "s-flex s-flex-1 s-items-center s-justify-end" },
|
|
75118
|
+
React.createElement("span", { className: "s-sr-only" }, "Dismiss"),
|
|
75119
|
+
React.createElement(IconButton, { icon: SvgXMark$1, size: "sm", variant: "secondary", onClick: function () {
|
|
75120
|
+
setIsDismissed(true);
|
|
75121
|
+
if (onDismiss) {
|
|
75122
|
+
onDismiss();
|
|
75123
|
+
}
|
|
75124
|
+
} })))));
|
|
75125
|
+
}
|
|
75126
|
+
|
|
75127
|
+
function BarHeader(_a) {
|
|
75128
|
+
var title = _a.title, leftActions = _a.leftActions, rightActions = _a.rightActions, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
75129
|
+
var titleClasses = classNames("s-text-element-800 dark:s-text-element-800-dark", "s-text-base s-font-bold s-truncate s-grow");
|
|
75130
|
+
var buttonBarClasses = "s-flex s-gap-1";
|
|
75131
|
+
return (React.createElement("div", { className: classNames("s-fixed s-left-0 s-right-0 s-top-0 s-z-30 s-flex s-h-16 s-flex-row s-items-center s-gap-3 s-border-b s-px-4 s-backdrop-blur", "s-border-structure-300/30 s-bg-white/80", "dark:s-border-structure-300-dark/30 dark:s-bg-structure-50-dark/80", className) },
|
|
75132
|
+
leftActions && React.createElement("div", { className: buttonBarClasses }, leftActions),
|
|
75133
|
+
React.createElement("div", { className: titleClasses }, title),
|
|
75134
|
+
rightActions && React.createElement("div", { className: buttonBarClasses }, rightActions)));
|
|
75135
|
+
}
|
|
75136
|
+
BarHeader.ButtonBar = function (props) {
|
|
75137
|
+
switch (props.variant) {
|
|
75138
|
+
case "back":
|
|
75139
|
+
return (React.createElement(Button, { size: "sm", icon: SvgChevronLeft$1, variant: "tertiary", label: "Back", labelVisible: false, onClick: props.onBack }));
|
|
75140
|
+
case "close":
|
|
75141
|
+
return (React.createElement(Button, { size: "sm", icon: SvgXMark$1, variant: "tertiary", label: "Close", labelVisible: false, onClick: props.onClose }));
|
|
75142
|
+
case "validate":
|
|
75143
|
+
return (React.createElement(React.Fragment, null,
|
|
75144
|
+
React.createElement(Button, { size: "sm", label: "Cancel", variant: "tertiary", onClick: props.onCancel, disabled: !props.onCancel || props.isSaving }),
|
|
75145
|
+
React.createElement(Button, { size: "sm", label: props.isSaving
|
|
75146
|
+
? props.savingLabel || "Processing..."
|
|
75147
|
+
: props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
|
|
75148
|
+
case "conversation":
|
|
75149
|
+
return (React.createElement(React.Fragment, null,
|
|
75150
|
+
React.createElement(Button, { size: "sm", label: "Delete", icon: SvgTrash$1, variant: "tertiary", labelVisible: false, onClick: props.onDelete }),
|
|
75151
|
+
React.createElement(Button, { size: "sm", label: "Share", icon: SvgArrowUpOnSquare$1, variant: "tertiary", onClick: props.onShare })));
|
|
75152
|
+
default:
|
|
75153
|
+
return null;
|
|
75154
|
+
}
|
|
75155
|
+
};
|
|
75156
|
+
|
|
71736
75157
|
var i$4=Object.defineProperty;var d$5=(t,e,n)=>e in t?i$4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var r$3=(t,e,n)=>(d$5(t,typeof e!="symbol"?e+"":e,n),n);let o$6 = class o{constructor(){r$3(this,"current",this.detect());r$3(this,"handoffState","pending");r$3(this,"currentId",0);}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e);}reset(){this.set(this.detect());}nextId(){return ++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window=="undefined"||typeof document=="undefined"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete");}get isHandoffComplete(){return this.handoffState==="complete"}};let s$9=new o$6;
|
|
71737
75158
|
|
|
71738
75159
|
let l$5=(e,f)=>{s$9.isServer?React.useEffect(e,f):React.useLayoutEffect(e,f);};
|
|
@@ -72002,7 +75423,7 @@ function DropdownMenu(_a) {
|
|
|
72002
75423
|
React.createElement(qe$1, { as: "div", className: classNames(className, "s-relative s-inline-block") }, children)));
|
|
72003
75424
|
}
|
|
72004
75425
|
DropdownMenu.Button = React.forwardRef(function DropdownMenuButton(_a, forwardedRef) {
|
|
72005
|
-
var label = _a.label, _b = _a.type, type = _b === void 0 ? "menu" : _b, _c = _a.size, size = _c === void 0 ? "sm" : _c, tooltip = _a.tooltip, icon = _a.icon, children = _a.children, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "
|
|
75426
|
+
var label = _a.label, _b = _a.type, type = _b === void 0 ? "menu" : _b, _c = _a.size, size = _c === void 0 ? "sm" : _c, tooltip = _a.tooltip, icon = _a.icon, children = _a.children, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "top" : _d, _e = _a.className, className = _e === void 0 ? "" : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, onClick = _a.onClick;
|
|
72006
75427
|
var contextRef = React.useContext(ButtonRefContext);
|
|
72007
75428
|
var finalLabelClasses = classNames(labelClasses$1.base, labelSizeClasses[size], labelClasses$1.dark.base, !disabled ? labelClasses$1.active : "", !disabled ? labelClasses$1.dark.active : "", !disabled ? labelClasses$1.hover : "", !disabled ? labelClasses$1.dark.hover : "", disabled ? labelClasses$1.disabled : "");
|
|
72008
75429
|
var finalIconClasses = classNames(iconClasses$3.base, iconClasses$3.dark.base, !disabled ? iconClasses$3.hover : "", !disabled ? iconClasses$3.dark.hover : "", disabled ? iconClasses$3.disabled : "");
|
|
@@ -72019,22 +75440,25 @@ DropdownMenu.Button = React.forwardRef(function DropdownMenuButton(_a, forwarded
|
|
|
72019
75440
|
}
|
|
72020
75441
|
};
|
|
72021
75442
|
if (children) {
|
|
72022
|
-
return (React.createElement(qe$1.Button, { as: "div", disabled: disabled, ref: aggregatedRef, className: classNames(disabled ? "s-cursor-default" : "s-cursor-pointer", className, "s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0", label ? "s-gap-1.5" : "s-gap-0"), onClick: function (e) { return e.stopPropagation(); } }, tooltip ? (React.createElement(Tooltip, {
|
|
75443
|
+
return (React.createElement(qe$1.Button, { as: "div", disabled: disabled, ref: aggregatedRef, className: classNames(disabled ? "s-cursor-default" : "s-cursor-pointer", className, "s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0", label ? "s-gap-1.5" : "s-gap-0"), onClick: function (e) { return e.stopPropagation(); } }, tooltip ? (React.createElement(Tooltip, { trigger: children, label: tooltip, side: tooltipPosition })) : (children)));
|
|
72023
75444
|
}
|
|
72024
75445
|
var chevronIcon = type === "select"
|
|
72025
75446
|
? SvgChevronUpDown$1
|
|
72026
75447
|
: type === "submenu"
|
|
72027
75448
|
? SvgChevronRight$1
|
|
72028
75449
|
: SvgChevronDown$1;
|
|
72029
|
-
return (React.createElement(React.Fragment, null, tooltip ? (React.createElement(Tooltip, {
|
|
72030
|
-
|
|
75450
|
+
return (React.createElement(React.Fragment, null, tooltip ? (React.createElement(Tooltip, { trigger: React.createElement(qe$1.Button, { disabled: disabled, ref: aggregatedRef, className: classNames(disabled ? "s-cursor-default" : "s-cursor-pointer", className, "s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0", label
|
|
75451
|
+
? size === "md"
|
|
75452
|
+
? "s-gap-2"
|
|
75453
|
+
: "s-gap-1.5"
|
|
75454
|
+
: "s-gap-0.5"), onClick: function (e) {
|
|
72031
75455
|
e.stopPropagation();
|
|
72032
75456
|
if (onClick) {
|
|
72033
75457
|
onClick();
|
|
72034
75458
|
}
|
|
72035
75459
|
} },
|
|
72036
75460
|
React.createElement(Icon, { visual: icon, size: size, className: finalIconClasses }),
|
|
72037
|
-
React.createElement(Icon, { visual: chevronIcon, size: size === "sm" ? "xs" : "sm", className: finalChevronClasses })))) : (React.createElement(qe$1.Button, { disabled: disabled, ref: aggregatedRef, className: classNames(disabled ? "s-cursor-default" : "s-cursor-pointer", className, "s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0", label ? (size === "md" ? "s-gap-2" : "s-gap-1.5") : "s-gap-0.5", type === "submenu" ? "s-opacity-50" : ""), onClick: function (e) {
|
|
75461
|
+
React.createElement(Icon, { visual: chevronIcon, size: size === "sm" ? "xs" : "sm", className: finalChevronClasses })), label: tooltip, side: tooltipPosition })) : (React.createElement(qe$1.Button, { disabled: disabled, ref: aggregatedRef, className: classNames(disabled ? "s-cursor-default" : "s-cursor-pointer", className, "s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0", label ? (size === "md" ? "s-gap-2" : "s-gap-1.5") : "s-gap-0.5", type === "submenu" ? "s-opacity-50" : ""), onClick: function (e) {
|
|
72038
75462
|
e.stopPropagation();
|
|
72039
75463
|
if (onClick) {
|
|
72040
75464
|
onClick();
|
|
@@ -72325,6 +75749,9 @@ var SvgDocumentText = function (props) { return (React__namespace.createElement(
|
|
|
72325
75749
|
React__namespace.createElement("path", { fill: "currentColor", d: "M8 7h3v2H8V7ZM8 11h8v2H8v-2ZM8 15h8v2H8v-2Z" }),
|
|
72326
75750
|
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M20 8v14H4V2h9.997L20 8Zm-2 1h-5V4H6v16h12V9Z", clipRule: "evenodd" }))); };
|
|
72327
75751
|
|
|
75752
|
+
var SvgDot = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
75753
|
+
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm4-2a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z", clipRule: "evenodd" }))); };
|
|
75754
|
+
|
|
72328
75755
|
var SvgDust = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
|
|
72329
75756
|
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M7 2a5 5 0 0 1 0 10h15v5h-5v5h-5v-5H7a2.5 2.5 0 0 1-.002-5H2V2h5Zm3 5a3 3 0 0 1-3 3H4V4h3a3 3 0 0 1 3 3Zm-3 7a.5.5 0 0 0 0 1h7v6h1v-6h5v-1H7Z", clipRule: "evenodd" }),
|
|
72330
75757
|
React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M7 17a2.5 2.5 0 0 1 0 5H2v-5h5Zm-3 2h3a.5.5 0 0 1 0 1H4v-1ZM17 12a5 5 0 0 0 5-5V2H12v5a5 5 0 0 0 5 5Zm-3-5a3 3 0 1 0 6 0V4h-6v3Z", clipRule: "evenodd" }))); };
|
|
@@ -72627,7 +76054,7 @@ function Breadcrumbs(_a) {
|
|
|
72627
76054
|
})));
|
|
72628
76055
|
}
|
|
72629
76056
|
function truncateWithTooltip(text, length) {
|
|
72630
|
-
return text.length > length ? (React.createElement(Tooltip, {
|
|
76057
|
+
return text.length > length ? (React.createElement(Tooltip, { trigger: "".concat(text.substring(0, length - 1)).concat(ELLIPSIS_STRING), label: text })) : (text);
|
|
72631
76058
|
}
|
|
72632
76059
|
|
|
72633
76060
|
function Checkbox(_a) {
|
|
@@ -99477,7 +102904,7 @@ function Citation(_a) {
|
|
|
99477
102904
|
isLoading && (React.createElement("div", { className: "s-absolute s-inset-0 s-flex s-items-center s-justify-center" },
|
|
99478
102905
|
React.createElement(Spinner, { size: "xs", variant: "color" }))),
|
|
99479
102906
|
React.createElement("div", { className: isLoading ? "s-opacity-50" : "" }, cardContent)));
|
|
99480
|
-
return href ?
|
|
102907
|
+
return href ? React.createElement(Tooltip, { trigger: cardButton, label: title }) : cardButton;
|
|
99481
102908
|
}
|
|
99482
102909
|
|
|
99483
102910
|
var animation$1 = {
|
|
@@ -103561,8 +106988,7 @@ function getSize(columnDef) {
|
|
|
103561
106988
|
DataTable.CellContent = function CellContent(_a) {
|
|
103562
106989
|
var children = _a.children, className = _a.className, avatarUrl = _a.avatarUrl, avatarTooltipLabel = _a.avatarTooltipLabel, roundedAvatar = _a.roundedAvatar, icon = _a.icon, iconClassName = _a.iconClassName, description = _a.description, props = __rest(_a, ["children", "className", "avatarUrl", "avatarTooltipLabel", "roundedAvatar", "icon", "iconClassName", "description"]);
|
|
103563
106990
|
return (React.createElement("div", __assign({ className: classNames("s-flex s-w-full s-items-center s-py-2", className || "") }, props),
|
|
103564
|
-
avatarUrl && avatarTooltipLabel && (React.createElement(Tooltip, {
|
|
103565
|
-
React.createElement(Avatar, { visual: avatarUrl, size: "xs", className: "s-mr-2", isRounded: roundedAvatar !== null && roundedAvatar !== void 0 ? roundedAvatar : false }))),
|
|
106991
|
+
avatarUrl && avatarTooltipLabel && (React.createElement(Tooltip, { trigger: React.createElement(Avatar, { visual: avatarUrl, size: "xs", className: "s-mr-2", isRounded: roundedAvatar !== null && roundedAvatar !== void 0 ? roundedAvatar : false }), label: avatarTooltipLabel })),
|
|
103566
106992
|
avatarUrl && !avatarTooltipLabel && (React.createElement(Avatar, { visual: avatarUrl, size: "xs", className: "s-mr-2", isRounded: roundedAvatar !== null && roundedAvatar !== void 0 ? roundedAvatar : false })),
|
|
103567
106993
|
icon && (React.createElement(Icon, { visual: icon, size: "sm", className: classNames("s-mr-2 s-text-element-800", iconClassName || "") })),
|
|
103568
106994
|
React.createElement("div", { className: "s-flex s-shrink s-truncate" },
|
|
@@ -104272,7 +107698,7 @@ function DropzoneOverlay(_a) {
|
|
|
104272
107698
|
}
|
|
104273
107699
|
|
|
104274
107700
|
function ElementDialog(_a) {
|
|
104275
|
-
var openOnElement = _a.openOnElement, closeDialogFn = _a.closeDialogFn, onValidate = _a.onValidate, onCancel = _a.onCancel, props = __rest(_a, ["openOnElement", "closeDialogFn", "onValidate", "onCancel"]);
|
|
107701
|
+
var openOnElement = _a.openOnElement, closeDialogFn = _a.closeDialogFn, onValidate = _a.onValidate, onCancel = _a.onCancel, children = _a.children, props = __rest(_a, ["openOnElement", "closeDialogFn", "onValidate", "onCancel", "children"]);
|
|
104276
107702
|
var _b = __read(React.useState(false), 2), isClosingTransition = _b[0], setIsClosingTransition = _b[1];
|
|
104277
107703
|
var transitionOnClose = React.useCallback(function () {
|
|
104278
107704
|
setIsClosingTransition(true);
|
|
@@ -104281,7 +107707,7 @@ function ElementDialog(_a) {
|
|
|
104281
107707
|
setIsClosingTransition(false);
|
|
104282
107708
|
}, 200);
|
|
104283
107709
|
}, [closeDialogFn]);
|
|
104284
|
-
return (React.createElement(Dialog, __assign({ isOpen: openOnElement !== null && !isClosingTransition, onCancel: function () { return onCancel(transitionOnClose); }, onValidate: function () { return onValidate(transitionOnClose); } }, props)));
|
|
107710
|
+
return (React.createElement(Dialog, __assign({ isOpen: openOnElement !== null && !isClosingTransition, onCancel: function () { return onCancel(transitionOnClose); }, onValidate: function () { return onValidate(transitionOnClose); } }, props), children));
|
|
104285
107711
|
}
|
|
104286
107712
|
|
|
104287
107713
|
var _a;
|
|
@@ -107187,7 +110613,7 @@ var iconClasses$2 = {
|
|
|
107187
110613
|
},
|
|
107188
110614
|
};
|
|
107189
110615
|
function IconToggleButton(_a) {
|
|
107190
|
-
var _b = _a.variant, variant = _b === void 0 ? "tertiary" : _b, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "
|
|
110616
|
+
var _b = _a.variant, variant = _b === void 0 ? "tertiary" : _b, onClick = _a.onClick, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.tooltipPosition, tooltipPosition = _d === void 0 ? "top" : _d, icon = _a.icon, iconSelected = _a.iconSelected, _e = _a.className, className = _e === void 0 ? "" : _e, _f = _a.selected, selected = _f === void 0 ? false : _f, _g = _a.size, size = _g === void 0 ? "sm" : _g;
|
|
107191
110617
|
var iconGroup = iconClasses$2[variant];
|
|
107192
110618
|
var finalIconClasses = classNames(className, baseClasses$1, disabled
|
|
107193
110619
|
? iconGroup.disabled
|
|
@@ -107203,7 +110629,7 @@ function IconToggleButton(_a) {
|
|
|
107203
110629
|
onClick === null || onClick === void 0 ? void 0 : onClick(e); // Run passed onClick event
|
|
107204
110630
|
}
|
|
107205
110631
|
}, disabled: disabled }, icon && (React.createElement(Icon, { visual: selected && iconSelected ? iconSelected : icon, size: size }))));
|
|
107206
|
-
return tooltip ? (React.createElement(Tooltip, { label: tooltip,
|
|
110632
|
+
return tooltip ? (React.createElement(Tooltip, { trigger: IconButtonToggleContent, label: tooltip, side: tooltipPosition })) : (IconButtonToggleContent);
|
|
107207
110633
|
}
|
|
107208
110634
|
|
|
107209
110635
|
var sizeInputClasses = {
|
|
@@ -129177,7 +132603,7 @@ function Tab(_a) {
|
|
|
129177
132603
|
variant === "stepper" && i < tabs.length - 1 && (React.createElement(Icon, { visual: SvgChevronRight$1, className: "s-mx-2 s-text-element-500", size: "sm" })))));
|
|
129178
132604
|
return tab.hideLabel ? (tab.label ? (React.createElement(React.Fragment, { key: "tab-".concat(i) },
|
|
129179
132605
|
React.createElement("div", { className: tabSizingClasses[(_c = tab.sizing) !== null && _c !== void 0 ? _c : "hug"] },
|
|
129180
|
-
React.createElement(Tooltip, { label: tab.label }
|
|
132606
|
+
React.createElement(Tooltip, { trigger: content, label: tab.label })),
|
|
129181
132607
|
tab.hasSeparator && (React.createElement("div", { className: "s-flex s-h-full s-grow", key: "sep-".concat(i) })))) : (React.createElement(React.Fragment, { key: "tab-".concat(i) },
|
|
129182
132608
|
React.createElement("div", { className: tabSizingClasses[(_d = tab.sizing) !== null && _d !== void 0 ? _d : "hug"] }, content),
|
|
129183
132609
|
tab.hasSeparator && (React.createElement("div", { className: "s-flex s-h-full s-grow", key: "sep-".concat(i) }))))) : (React.createElement(React.Fragment, { key: "tab-".concat(i) },
|
|
@@ -129275,7 +132701,7 @@ Tree.Item = function (_a) {
|
|
|
129275
132701
|
};
|
|
129276
132702
|
Tree.Empty = function (_a) {
|
|
129277
132703
|
var label = _a.label;
|
|
129278
|
-
return React.createElement("div", { className: "s-pl-
|
|
132704
|
+
return (React.createElement("div", { className: "s-py-1 s-pl-6 s-text-sm s-font-medium s-text-element-700" }, label));
|
|
129279
132705
|
};
|
|
129280
132706
|
|
|
129281
132707
|
function ZoomableImageCitationWrapper(_a) {
|
|
@@ -129610,6 +133036,8 @@ exports.DocumentPlusStrokeIcon = SvgDocumentPlus;
|
|
|
129610
133036
|
exports.DocumentStrokeIcon = SvgDocument;
|
|
129611
133037
|
exports.DocumentTextIcon = SvgDocumentText$1;
|
|
129612
133038
|
exports.DocumentTextStrokeIcon = SvgDocumentText;
|
|
133039
|
+
exports.DotIcon = SvgDot$1;
|
|
133040
|
+
exports.DotStrokeIcon = SvgDot;
|
|
129613
133041
|
exports.DriveLogo = SvgDrive;
|
|
129614
133042
|
exports.DropdownMenu = DropdownMenu;
|
|
129615
133043
|
exports.DropzoneOverlay = DropzoneOverlay;
|
|
@@ -129820,6 +133248,10 @@ exports.TextArea = TextArea;
|
|
|
129820
133248
|
exports.TimeIcon = SvgTime$1;
|
|
129821
133249
|
exports.TimeStrokeIcon = SvgTime;
|
|
129822
133250
|
exports.Tooltip = Tooltip;
|
|
133251
|
+
exports.TooltipContent = TooltipContent;
|
|
133252
|
+
exports.TooltipProvider = TooltipProvider;
|
|
133253
|
+
exports.TooltipRoot = TooltipRoot;
|
|
133254
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
129823
133255
|
exports.TranslateIcon = SvgTranslate$1;
|
|
129824
133256
|
exports.TranslateStrokeIcon = SvgTranslate;
|
|
129825
133257
|
exports.TrashIcon = SvgTrash$1;
|