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