@sanity/ui 4.0.0-static.31 → 4.0.0-static.32
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/index.d.ts +8 -1
- package/dist/index.js +1076 -510
- package/dist/index.js.map +1 -1
- package/package.json +9 -10
- package/src/core/components/autocomplete/Autocomplete.tsx +80 -48
- package/src/core/components/breadcrumbs/Breadcrumbs.tsx +74 -41
- package/src/core/components/dialog/DialogContext.ts +1 -1
- package/src/core/components/dialog/__workshop__/Panes.tsx +5 -21
- package/src/core/components/dialog/__workshop__/styles.css.ts +18 -0
- package/src/core/components/menu/Menu.test.tsx +2 -6
- package/src/core/components/menu/Menu.tsx +13 -14
- package/src/core/components/menu/MenuContext.ts +2 -3
- package/src/core/components/menu/MenuGroup.tsx +2 -0
- package/src/core/components/menu/useMenu.ts +2 -2
- package/src/core/components/menu/useMenuController.ts +5 -5
- package/src/core/components/toast/ToastContext.ts +1 -1
- package/src/core/components/tree/Tree.tsx +1 -0
- package/src/core/components/tree/TreeContext.ts +1 -1
- package/src/core/components/tree/TreeItem.tsx +17 -14
- package/src/core/components/virtualList/VirtualList.tsx +86 -44
- package/src/core/hooks/useGlobalKeyDown.ts +11 -4
- package/src/core/lib/createGlobalScopedContext.ts +2 -2
- package/src/core/primitives/avatar/Avatar.tsx +1 -0
- package/src/core/primitives/button/Button.tsx +2 -1
- package/src/core/primitives/button/__workshop__/SanityUploadButton.tsx +10 -25
- package/src/core/primitives/button/__workshop__/Styled1.tsx +2 -8
- package/src/core/primitives/button/__workshop__/index.ts +0 -5
- package/src/core/primitives/button/__workshop__/styles.css.ts +30 -0
- package/src/core/primitives/card/CardContext.ts +1 -1
- package/src/core/primitives/card/__workshop__/Styled.tsx +2 -5
- package/src/core/primitives/flex/__workshop__/Example.tsx +7 -15
- package/src/core/primitives/flex/__workshop__/styles.css.ts +12 -0
- package/src/core/primitives/inline/Inline.tsx +1 -0
- package/src/core/primitives/layer/LayerContext.ts +1 -1
- package/src/core/primitives/popover/Popover.tsx +146 -130
- package/src/core/primitives/popover/floating-ui/size.ts +17 -16
- package/src/core/primitives/skeleton/Skeleton.tsx +2 -2
- package/src/core/primitives/text/__workshop__/Colored.tsx +5 -10
- package/src/core/primitives/tooltip/Tooltip.tsx +69 -41
- package/src/core/primitives/tooltip/tooltipDelayGroup/TooltipDelayGroupContext.tsx +1 -1
- package/src/core/utils/boundaryElement/BoundaryElementContext.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/CustomMedia.tsx +3 -25
- package/src/core/utils/elementQuery/__workshop__/styles.css.ts +31 -0
- package/src/core/utils/portal/Portal.test.tsx +6 -6
- package/src/core/utils/portal/PortalContext.ts +1 -1
- package/src/core/utils/portal/PortalProvider.tsx +5 -37
- package/src/core/primitives/button/__workshop__/Styled2.tsx +0 -19
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
|
|
3
|
-
import { useState, isValidElement, useDebugValue, useSyncExternalStore, createContext, use, useRef, useImperativeHandle, useEffect, useMemo, useCallback, cloneElement, useReducer, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
|
|
4
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
|
|
4
|
+
import { useState, isValidElement, useDebugValue, useSyncExternalStore, createContext, use, useRef, useImperativeHandle, useEffect, cloneElement, useReducer, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
|
|
5
5
|
import { box, text, textOverflow, animatedSpinnerIcon, spinner, button, buttonLoadingBox, _arrow, vars, _arrowSvg, _arrowStrokeMask, _arrowStroke, _arrowShape, card, BREAKPOINTS, popoverCard, popover, _selectable, stack, textInput, textInputPrefix, textInputElement, _inputElement, _inputPresentation, textInputSuffix, breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, kbd, menu, menuDivider, toast, toastLayer, treeItem, label, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, tooltip, root } from "@sanity/ui/css";
|
|
6
6
|
import { isValidElementType } from "react-is";
|
|
7
|
-
import { detectOverflow, autoPlacement, flip, offset, shift, arrow, hide,
|
|
7
|
+
import { detectOverflow, useFloating, autoPlacement, flip, offset, shift, arrow, hide, autoUpdate } from "@floating-ui/react-dom";
|
|
8
8
|
import { motion, AnimatePresence } from "framer-motion";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
10
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
@@ -353,77 +353,79 @@ function Spinner(props) {
|
|
|
353
353
|
}
|
|
354
354
|
const DEFAULT_BUTTON_ELEMENT = "button";
|
|
355
355
|
function Button(props) {
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
const $ = c(88), t0 = props;
|
|
357
|
+
let Element2, IconComponent, IconRightComponent, align, children, className, disabled, flex, fontSize, gap, gapX, gapY, href, justify, loading, mode, muted, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, radius, rest, selected, text2, textAlign, textOverflow2, textWeight, tone, type, width;
|
|
358
|
+
if ($[0] !== props.padding || $[1] !== t0) {
|
|
359
|
+
const {
|
|
360
|
+
align: t12,
|
|
361
|
+
as: t22,
|
|
362
|
+
children: t32,
|
|
363
|
+
className: t42,
|
|
364
|
+
disabled: t52,
|
|
365
|
+
flex: t62,
|
|
366
|
+
fontSize: t72,
|
|
367
|
+
gap: _gap,
|
|
368
|
+
gapX: t82,
|
|
369
|
+
gapY: t92,
|
|
370
|
+
icon: t10,
|
|
371
|
+
iconRight: t11,
|
|
372
|
+
justify: t122,
|
|
373
|
+
loading: t13,
|
|
374
|
+
mode: t14,
|
|
375
|
+
muted: t15,
|
|
376
|
+
padding: t16,
|
|
377
|
+
paddingX: t17,
|
|
378
|
+
paddingY: t18,
|
|
379
|
+
paddingTop: t19,
|
|
380
|
+
paddingBottom: t20,
|
|
381
|
+
paddingLeft: t21,
|
|
382
|
+
paddingRight: t222,
|
|
383
|
+
radius: t23,
|
|
384
|
+
selected: t24,
|
|
385
|
+
text: t25,
|
|
386
|
+
textAlign: t26,
|
|
387
|
+
textOverflow: t27,
|
|
388
|
+
textWeight: t28,
|
|
389
|
+
tone: t29,
|
|
390
|
+
type: t30,
|
|
391
|
+
width: t31,
|
|
392
|
+
...t322
|
|
393
|
+
} = t0;
|
|
394
|
+
children = t32, className = t42, disabled = t52, flex = t62, gapX = t82, gapY = t92, IconComponent = t10, IconRightComponent = t11, loading = t13, paddingX = t17, paddingY = t18, paddingTop = t19, paddingBottom = t20, paddingLeft = t21, paddingRight = t222, selected = t24, text2 = t25, textAlign = t26, width = t31, rest = t322, align = t12 === void 0 ? "center" : t12, Element2 = t22 === void 0 ? DEFAULT_BUTTON_ELEMENT : t22, fontSize = t72 === void 0 ? 1 : t72, justify = t122 === void 0 ? "center" : t122, mode = t14 === void 0 ? "default" : t14, muted = t15 === void 0 ? !1 : t15, padding = t16 === void 0 ? 3 : t16, radius = t23 === void 0 ? 2 : t23, textOverflow2 = t27 === void 0 ? "ellipsis" : t27, textWeight = t28 === void 0 ? "medium" : t28, tone = t29 === void 0 ? "default" : t29, type = t30 === void 0 ? "button" : t30, gap = _gap ?? props.padding ?? 3, href = void 0, "href" in rest && (href = typeof rest.href == "string" ? rest.href : void 0, delete rest.href), $[0] = props.padding, $[1] = t0, $[2] = Element2, $[3] = IconComponent, $[4] = IconRightComponent, $[5] = align, $[6] = children, $[7] = className, $[8] = disabled, $[9] = flex, $[10] = fontSize, $[11] = gap, $[12] = gapX, $[13] = gapY, $[14] = href, $[15] = justify, $[16] = loading, $[17] = mode, $[18] = muted, $[19] = padding, $[20] = paddingBottom, $[21] = paddingLeft, $[22] = paddingRight, $[23] = paddingTop, $[24] = paddingX, $[25] = paddingY, $[26] = radius, $[27] = rest, $[28] = selected, $[29] = text2, $[30] = textAlign, $[31] = textOverflow2, $[32] = textWeight, $[33] = tone, $[34] = type, $[35] = width;
|
|
395
|
+
} else
|
|
396
|
+
Element2 = $[2], IconComponent = $[3], IconRightComponent = $[4], align = $[5], children = $[6], className = $[7], disabled = $[8], flex = $[9], fontSize = $[10], gap = $[11], gapX = $[12], gapY = $[13], href = $[14], justify = $[15], loading = $[16], mode = $[17], muted = $[18], padding = $[19], paddingBottom = $[20], paddingLeft = $[21], paddingRight = $[22], paddingTop = $[23], paddingX = $[24], paddingY = $[25], radius = $[26], rest = $[27], selected = $[28], text2 = $[29], textAlign = $[30], textOverflow2 = $[31], textWeight = $[32], tone = $[33], type = $[34], width = $[35];
|
|
397
|
+
let t1;
|
|
398
|
+
$[36] !== className || $[37] !== flex || $[38] !== mode || $[39] !== radius || $[40] !== tone || $[41] !== width ? (t1 = button({
|
|
360
399
|
className,
|
|
361
|
-
disabled,
|
|
362
400
|
flex,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
} =
|
|
391
|
-
let href;
|
|
392
|
-
return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxs(
|
|
393
|
-
Element2,
|
|
394
|
-
{
|
|
395
|
-
"data-ui": "Button",
|
|
396
|
-
...rest,
|
|
397
|
-
className: button({
|
|
398
|
-
className,
|
|
399
|
-
flex,
|
|
400
|
-
mode,
|
|
401
|
-
radius,
|
|
402
|
-
tone,
|
|
403
|
-
width
|
|
404
|
-
}),
|
|
405
|
-
"data-disabled": loading || disabled ? "" : props["data-disabled"],
|
|
406
|
-
"data-selected": selected ? "" : props["data-selected"],
|
|
407
|
-
disabled: !!(loading || disabled),
|
|
408
|
-
href: disabled ? void 0 : href,
|
|
409
|
-
type,
|
|
410
|
-
children: [
|
|
411
|
-
!!loading && /* @__PURE__ */ jsx(Box, { alignItems: "center", as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }),
|
|
412
|
-
(IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
|
|
413
|
-
IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
414
|
-
isValidElement(IconComponent) && IconComponent,
|
|
415
|
-
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
416
|
-
] }),
|
|
417
|
-
text2 && /* @__PURE__ */ jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight, children: text2 }) }),
|
|
418
|
-
IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
419
|
-
isValidElement(IconRightComponent) && IconRightComponent,
|
|
420
|
-
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
421
|
-
] })
|
|
422
|
-
] }),
|
|
423
|
-
children && /* @__PURE__ */ jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
|
|
424
|
-
]
|
|
425
|
-
}
|
|
426
|
-
);
|
|
401
|
+
mode,
|
|
402
|
+
radius,
|
|
403
|
+
tone,
|
|
404
|
+
width
|
|
405
|
+
}), $[36] = className, $[37] = flex, $[38] = mode, $[39] = radius, $[40] = tone, $[41] = width, $[42] = t1) : t1 = $[42];
|
|
406
|
+
const t2 = loading || disabled ? "" : props["data-disabled"], t3 = selected ? "" : props["data-selected"], t4 = !!(loading || disabled), t5 = disabled ? void 0 : href;
|
|
407
|
+
let t6;
|
|
408
|
+
$[43] !== fontSize || $[44] !== loading ? (t6 = !!loading && /* @__PURE__ */ jsx(Box, { alignItems: "center", as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }), $[43] = fontSize, $[44] = loading, $[45] = t6) : t6 = $[45];
|
|
409
|
+
let t7;
|
|
410
|
+
$[46] !== IconComponent || $[47] !== IconRightComponent || $[48] !== align || $[49] !== fontSize || $[50] !== gap || $[51] !== gapX || $[52] !== gapY || $[53] !== justify || $[54] !== muted || $[55] !== padding || $[56] !== paddingBottom || $[57] !== paddingLeft || $[58] !== paddingRight || $[59] !== paddingTop || $[60] !== paddingX || $[61] !== paddingY || $[62] !== text2 || $[63] !== textAlign || $[64] !== textOverflow2 || $[65] !== textWeight ? (t7 = (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
|
|
411
|
+
IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
412
|
+
isValidElement(IconComponent) && IconComponent,
|
|
413
|
+
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
414
|
+
] }),
|
|
415
|
+
text2 && /* @__PURE__ */ jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight, children: text2 }) }),
|
|
416
|
+
IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
417
|
+
isValidElement(IconRightComponent) && IconRightComponent,
|
|
418
|
+
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
419
|
+
] })
|
|
420
|
+
] }), $[46] = IconComponent, $[47] = IconRightComponent, $[48] = align, $[49] = fontSize, $[50] = gap, $[51] = gapX, $[52] = gapY, $[53] = justify, $[54] = muted, $[55] = padding, $[56] = paddingBottom, $[57] = paddingLeft, $[58] = paddingRight, $[59] = paddingTop, $[60] = paddingX, $[61] = paddingY, $[62] = text2, $[63] = textAlign, $[64] = textOverflow2, $[65] = textWeight, $[66] = t7) : t7 = $[66];
|
|
421
|
+
let t8;
|
|
422
|
+
$[67] !== children || $[68] !== padding || $[69] !== paddingBottom || $[70] !== paddingLeft || $[71] !== paddingRight || $[72] !== paddingTop || $[73] !== paddingX || $[74] !== paddingY ? (t8 = children && /* @__PURE__ */ jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children }), $[67] = children, $[68] = padding, $[69] = paddingBottom, $[70] = paddingLeft, $[71] = paddingRight, $[72] = paddingTop, $[73] = paddingX, $[74] = paddingY, $[75] = t8) : t8 = $[75];
|
|
423
|
+
let t9;
|
|
424
|
+
return $[76] !== Element2 || $[77] !== rest || $[78] !== t1 || $[79] !== t2 || $[80] !== t3 || $[81] !== t4 || $[82] !== t5 || $[83] !== t6 || $[84] !== t7 || $[85] !== t8 || $[86] !== type ? (t9 = /* @__PURE__ */ jsxs(Element2, { "data-ui": "Button", ...rest, className: t1, "data-disabled": t2, "data-selected": t3, disabled: t4, href: t5, type, children: [
|
|
425
|
+
t6,
|
|
426
|
+
t7,
|
|
427
|
+
t8
|
|
428
|
+
] }), $[76] = Element2, $[77] = rest, $[78] = t1, $[79] = t2, $[80] = t3, $[81] = t4, $[82] = t5, $[83] = t6, $[84] = t7, $[85] = t8, $[86] = type, $[87] = t9) : t9 = $[87], t9;
|
|
427
429
|
}
|
|
428
430
|
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
429
431
|
const $ = c(4);
|
|
@@ -437,9 +439,9 @@ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
|
437
439
|
return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], useSyncExternalStore(t0, t1, getServerSnapshot2);
|
|
438
440
|
}
|
|
439
441
|
function usePrefersReducedMotion(t0) {
|
|
440
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$
|
|
442
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$c : t0);
|
|
441
443
|
}
|
|
442
|
-
function _temp$
|
|
444
|
+
function _temp$c() {
|
|
443
445
|
return !1;
|
|
444
446
|
}
|
|
445
447
|
const origin = {
|
|
@@ -488,7 +490,7 @@ function createGlobalScopedContext(key2, defaultValue) {
|
|
|
488
490
|
const symbolMap = globalScope;
|
|
489
491
|
return symbolMap[symbol] = symbolMap[symbol] || createContext(defaultValue), symbolMap[symbol];
|
|
490
492
|
}
|
|
491
|
-
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/
|
|
493
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v4/boundaryElement", null), DEFAULT_VALUE = {
|
|
492
494
|
version: 0,
|
|
493
495
|
element: null
|
|
494
496
|
};
|
|
@@ -502,7 +504,7 @@ function getElementRef(element) {
|
|
|
502
504
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
503
505
|
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
504
506
|
}
|
|
505
|
-
const CardContext = createGlobalScopedContext("@sanity/ui/
|
|
507
|
+
const CardContext = createGlobalScopedContext("@sanity/ui/v4/card", null);
|
|
506
508
|
function CardProvider(props) {
|
|
507
509
|
const $ = c(7), {
|
|
508
510
|
children,
|
|
@@ -526,7 +528,7 @@ function useCard() {
|
|
|
526
528
|
throw new Error("useCard(): missing context value");
|
|
527
529
|
return card2;
|
|
528
530
|
}
|
|
529
|
-
const key = "@sanity/ui/
|
|
531
|
+
const key = "@sanity/ui/v4/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
|
|
530
532
|
elementMap[elementKey] = null;
|
|
531
533
|
const defaultContextValue = {
|
|
532
534
|
version: 0,
|
|
@@ -564,7 +566,7 @@ function getLayerContext(contextValue) {
|
|
|
564
566
|
return contextValue;
|
|
565
567
|
throw new Error("could not get layer context");
|
|
566
568
|
}
|
|
567
|
-
const LayerContext = createGlobalScopedContext("@sanity/ui/
|
|
569
|
+
const LayerContext = createGlobalScopedContext("@sanity/ui/v4/layer", null);
|
|
568
570
|
function useLayer() {
|
|
569
571
|
const value = use(LayerContext);
|
|
570
572
|
if (!value)
|
|
@@ -591,9 +593,11 @@ const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER
|
|
|
591
593
|
};
|
|
592
594
|
function size(options) {
|
|
593
595
|
const {
|
|
594
|
-
apply,
|
|
595
596
|
margins,
|
|
596
|
-
padding = 0
|
|
597
|
+
padding = 0,
|
|
598
|
+
constrainSize,
|
|
599
|
+
matchReferenceWidth,
|
|
600
|
+
referenceWidthRef
|
|
597
601
|
} = options;
|
|
598
602
|
return {
|
|
599
603
|
name: "@sanity/ui/size",
|
|
@@ -615,12 +619,9 @@ function size(options) {
|
|
|
615
619
|
});
|
|
616
620
|
let maxWidth = 1 / 0, maxHeight = 1 / 0;
|
|
617
621
|
const floatingW = floating.width, floatingH = floating.height;
|
|
618
|
-
placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom))
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
elements,
|
|
622
|
-
referenceWidth: reference.width - margins[1] - margins[3]
|
|
623
|
-
});
|
|
622
|
+
placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
|
|
623
|
+
const availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
|
|
624
|
+
referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
624
625
|
const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
|
|
625
626
|
return floatingW !== targetW || floatingH !== targetH ? {
|
|
626
627
|
reset: {
|
|
@@ -907,13 +908,13 @@ function LayerProvider(props) {
|
|
|
907
908
|
[childLevel]: prevLen + 1
|
|
908
909
|
};
|
|
909
910
|
return setSize(Object.keys(nextState).length), nextState;
|
|
910
|
-
}) : setSize(_temp$
|
|
911
|
+
}) : setSize(_temp$b), () => {
|
|
911
912
|
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
912
913
|
const nextState_0 = {
|
|
913
914
|
...state_0
|
|
914
915
|
};
|
|
915
916
|
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
916
|
-
}) : setSize(_temp2$
|
|
917
|
+
}) : setSize(_temp2$3), parentDispose?.();
|
|
917
918
|
};
|
|
918
919
|
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
919
920
|
const registerChild = t3;
|
|
@@ -932,10 +933,10 @@ function LayerProvider(props) {
|
|
|
932
933
|
let t7;
|
|
933
934
|
return $[16] !== children || $[17] !== value ? (t7 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t7) : t7 = $[18], t7;
|
|
934
935
|
}
|
|
935
|
-
function _temp2$
|
|
936
|
+
function _temp2$3(v_0) {
|
|
936
937
|
return v_0 - 1;
|
|
937
938
|
}
|
|
938
|
-
function _temp$
|
|
939
|
+
function _temp$b(v) {
|
|
939
940
|
return v + 1;
|
|
940
941
|
}
|
|
941
942
|
const DEFAULT_LAYER_ELEMENT = "div";
|
|
@@ -1036,77 +1037,80 @@ function ViewportOverlay() {
|
|
|
1036
1037
|
} }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
|
|
1037
1038
|
}
|
|
1038
1039
|
function Popover(props) {
|
|
1039
|
-
const boundaryElementContext = useBoundaryElement(),
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1040
|
+
const $ = c(111), boundaryElementContext = useBoundaryElement(), t0 = props;
|
|
1041
|
+
let _fallbackPlacements, _floatingBoundary, _referenceBoundary, childProp, className, content2, disabled, forwardedRef, matchReferenceWidth, modal, open, padding, portal, referenceElement, rest, scheme, t1, t10, t11, t12, t13, t14, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
|
|
1042
|
+
if ($[0] !== t0) {
|
|
1043
|
+
const {
|
|
1044
|
+
__unstable_margins: t152,
|
|
1045
|
+
animate: t162,
|
|
1046
|
+
arrow: t172,
|
|
1047
|
+
as: t182,
|
|
1048
|
+
children: t192,
|
|
1049
|
+
className: t202,
|
|
1050
|
+
constrainSize: t212,
|
|
1051
|
+
content: t222,
|
|
1052
|
+
disabled: t232,
|
|
1053
|
+
fallbackPlacements: t242,
|
|
1054
|
+
matchReferenceWidth: t252,
|
|
1055
|
+
floatingBoundary: t262,
|
|
1056
|
+
modal: t272,
|
|
1057
|
+
onActivate,
|
|
1058
|
+
open: t282,
|
|
1059
|
+
overflow: t292,
|
|
1060
|
+
padding: t302,
|
|
1061
|
+
placement: t312,
|
|
1062
|
+
placementStrategy: t32,
|
|
1063
|
+
portal: t33,
|
|
1064
|
+
preventOverflow: t34,
|
|
1065
|
+
radius: t35,
|
|
1066
|
+
ref: t36,
|
|
1067
|
+
referenceBoundary: t37,
|
|
1068
|
+
referenceElement: t38,
|
|
1069
|
+
scheme: t39,
|
|
1070
|
+
shadow: t40,
|
|
1071
|
+
tone: t41,
|
|
1072
|
+
width: t42,
|
|
1073
|
+
zOffset: t43,
|
|
1074
|
+
updateRef: t44,
|
|
1075
|
+
...t45
|
|
1076
|
+
} = t0;
|
|
1077
|
+
t1 = t152, t2 = t162, t3 = t172, t4 = t182, childProp = t192, className = t202, t5 = t212, content2 = t222, disabled = t232, _fallbackPlacements = t242, matchReferenceWidth = t252, _floatingBoundary = t262, modal = t272, open = t282, t6 = t292, padding = t302, t7 = t312, t8 = t32, portal = t33, t9 = t34, t10 = t35, forwardedRef = t36, _referenceBoundary = t37, referenceElement = t38, scheme = t39, t11 = t40, t12 = t41, t13 = t42, t14 = t43, updateRef = t44, rest = t45, $[0] = t0, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = childProp, $[5] = className, $[6] = content2, $[7] = disabled, $[8] = forwardedRef, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = padding, $[13] = portal, $[14] = referenceElement, $[15] = rest, $[16] = scheme, $[17] = t1, $[18] = t10, $[19] = t11, $[20] = t12, $[21] = t13, $[22] = t14, $[23] = t2, $[24] = t3, $[25] = t4, $[26] = t5, $[27] = t6, $[28] = t7, $[29] = t8, $[30] = t9, $[31] = updateRef;
|
|
1078
|
+
} else
|
|
1079
|
+
_fallbackPlacements = $[1], _floatingBoundary = $[2], _referenceBoundary = $[3], childProp = $[4], className = $[5], content2 = $[6], disabled = $[7], forwardedRef = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], padding = $[12], portal = $[13], referenceElement = $[14], rest = $[15], scheme = $[16], t1 = $[17], t10 = $[18], t11 = $[19], t12 = $[20], t13 = $[21], t14 = $[22], t2 = $[23], t3 = $[24], t4 = $[25], t5 = $[26], t6 = $[27], t7 = $[28], t8 = $[29], t9 = $[30], updateRef = $[31];
|
|
1080
|
+
const margins = t1 === void 0 ? DEFAULT_POPOVER_MARGINS : t1, _animate = t2 === void 0 ? !1 : t2, arrowProp = t3 === void 0 ? !1 : t3, as = t4 === void 0 ? DEFAULT_POPOVER_ELEMENT : t4, constrainSize = t5 === void 0 ? !1 : t5, overflow = t6 === void 0 ? "hidden" : t6, placementProp = t7 === void 0 ? "bottom" : t7, placementStrategy = t8 === void 0 ? "flip" : t8, preventOverflow = t9 === void 0 ? !0 : t9, radius = t10 === void 0 ? 3 : t10, shadow = t11 === void 0 ? 3 : t11, tone = t12 === void 0 ? "inherit" : t12, widthProp = t13 === void 0 ? "auto" : t13, zOffsetProp = t14 === void 0 ? Z_OFFSETS.popover : t14, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElementContext.element, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null);
|
|
1081
|
+
let t15;
|
|
1082
|
+
$[32] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => ref.current, $[32] = t15) : t15 = $[32], useImperativeHandle(forwardedRef, t15);
|
|
1083
|
+
const referenceWidthRef = useRef(void 0);
|
|
1084
|
+
let t16;
|
|
1085
|
+
$[33] !== animate || $[34] !== arrowProp || $[35] !== constrainSize || $[36] !== fallbackPlacements || $[37] !== floatingBoundary || $[38] !== margins || $[39] !== matchReferenceWidth || $[40] !== placementProp || $[41] !== placementStrategy || $[42] !== preventOverflow || $[43] !== referenceBoundary ? (t16 = {
|
|
1086
|
+
animate,
|
|
1087
|
+
arrowProp,
|
|
1088
|
+
arrowRef,
|
|
1089
|
+
constrainSize,
|
|
1090
|
+
fallbackPlacements,
|
|
1091
|
+
floatingBoundary,
|
|
1092
|
+
margins,
|
|
1050
1093
|
matchReferenceWidth,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
...rest
|
|
1072
|
-
} = props, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
1073
|
-
useImperativeHandle(forwardedRef, () => ref.current);
|
|
1074
|
-
const referenceWidthRef = useRef(void 0), middleware = useMemo(() => {
|
|
1075
|
-
const ret = [];
|
|
1076
|
-
return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(autoPlacement({
|
|
1077
|
-
allowedPlacements: [placementProp].concat(fallbackPlacements)
|
|
1078
|
-
})) : ret.push(flip({
|
|
1079
|
-
boundary: floatingBoundary || void 0,
|
|
1080
|
-
fallbackPlacements,
|
|
1081
|
-
padding: DEFAULT_POPOVER_PADDING,
|
|
1082
|
-
rootBoundary
|
|
1083
|
-
}))), ret.push(offset({
|
|
1084
|
-
mainAxis: DEFAULT_POPOVER_DISTANCE
|
|
1085
|
-
})), (constrainSize || matchReferenceWidth) && ret.push(size({
|
|
1086
|
-
apply({
|
|
1087
|
-
availableWidth,
|
|
1088
|
-
availableHeight,
|
|
1089
|
-
elements,
|
|
1090
|
-
referenceWidth
|
|
1091
|
-
}) {
|
|
1092
|
-
referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
1093
|
-
},
|
|
1094
|
-
boundaryElement: floatingBoundary || void 0,
|
|
1095
|
-
margins,
|
|
1096
|
-
padding: DEFAULT_POPOVER_PADDING
|
|
1097
|
-
})), preventOverflow && ret.push(shift({
|
|
1098
|
-
boundary: floatingBoundary || void 0,
|
|
1099
|
-
rootBoundary,
|
|
1100
|
-
padding: DEFAULT_POPOVER_PADDING
|
|
1101
|
-
})), arrowProp && ret.push(arrow({
|
|
1102
|
-
element: arrowRef,
|
|
1103
|
-
padding: DEFAULT_POPOVER_PADDING
|
|
1104
|
-
})), animate && ret.push(origin), ret.push(hide({
|
|
1105
|
-
boundary: referenceBoundary || void 0,
|
|
1106
|
-
padding: DEFAULT_POPOVER_PADDING,
|
|
1107
|
-
strategy: "referenceHidden"
|
|
1108
|
-
})), ret;
|
|
1109
|
-
}, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
1094
|
+
placementProp,
|
|
1095
|
+
placementStrategy,
|
|
1096
|
+
preventOverflow,
|
|
1097
|
+
referenceBoundary,
|
|
1098
|
+
referenceWidthRef,
|
|
1099
|
+
rootBoundary: "viewport"
|
|
1100
|
+
}, $[33] = animate, $[34] = arrowProp, $[35] = constrainSize, $[36] = fallbackPlacements, $[37] = floatingBoundary, $[38] = margins, $[39] = matchReferenceWidth, $[40] = placementProp, $[41] = placementStrategy, $[42] = preventOverflow, $[43] = referenceBoundary, $[44] = t16) : t16 = $[44];
|
|
1101
|
+
const middleware = useMiddleware$1(t16);
|
|
1102
|
+
let t17;
|
|
1103
|
+
$[45] !== referenceElement ? (t17 = referenceElement ? {
|
|
1104
|
+
reference: referenceElement
|
|
1105
|
+
} : void 0, $[45] = referenceElement, $[46] = t17) : t17 = $[46];
|
|
1106
|
+
let t18;
|
|
1107
|
+
$[47] !== middleware || $[48] !== placementProp || $[49] !== t17 ? (t18 = {
|
|
1108
|
+
middleware,
|
|
1109
|
+
placement: placementProp,
|
|
1110
|
+
whileElementsMounted: autoUpdate,
|
|
1111
|
+
elements: t17
|
|
1112
|
+
}, $[47] = middleware, $[48] = placementProp, $[49] = t17, $[50] = t18) : t18 = $[50];
|
|
1113
|
+
const {
|
|
1110
1114
|
x,
|
|
1111
1115
|
y,
|
|
1112
1116
|
middlewareData,
|
|
@@ -1114,38 +1118,139 @@ function Popover(props) {
|
|
|
1114
1118
|
refs,
|
|
1115
1119
|
strategy,
|
|
1116
1120
|
update
|
|
1117
|
-
} = useFloating(
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
whileElementsMounted: autoUpdate,
|
|
1121
|
-
elements: referenceElement ? {
|
|
1122
|
-
reference: referenceElement
|
|
1123
|
-
} : void 0
|
|
1124
|
-
}), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = useCallback((arrowEl) => {
|
|
1125
|
-
arrowRef.current = arrowEl;
|
|
1126
|
-
}, []), setFloating = useCallback((node) => {
|
|
1121
|
+
} = useFloating(t18), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY;
|
|
1122
|
+
let t19;
|
|
1123
|
+
$[51] !== refs ? (t19 = (node) => {
|
|
1127
1124
|
ref.current = node, refs.setFloating(node);
|
|
1128
|
-
}, [refs
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1125
|
+
}, $[51] = refs, $[52] = t19) : t19 = $[52];
|
|
1126
|
+
const setFloating = t19;
|
|
1127
|
+
let t20;
|
|
1128
|
+
$[53] !== childProp ? (t20 = childProp ? getElementRef(childProp) : null, $[53] = childProp, $[54] = t20) : t20 = $[54];
|
|
1129
|
+
let t21;
|
|
1130
|
+
$[55] !== refs.reference.current ? (t21 = () => refs.reference.current, $[55] = refs.reference.current, $[56] = t21) : t21 = $[56], useImperativeHandle(t20, t21);
|
|
1131
|
+
let t22;
|
|
1132
|
+
bb0: {
|
|
1133
|
+
if (referenceElement) {
|
|
1134
|
+
t22 = childProp;
|
|
1135
|
+
break bb0;
|
|
1136
|
+
}
|
|
1137
|
+
if (!childProp) {
|
|
1138
|
+
t22 = null;
|
|
1139
|
+
break bb0;
|
|
1140
|
+
}
|
|
1141
|
+
let t232;
|
|
1142
|
+
$[57] !== childProp || $[58] !== refs.setReference ? (t232 = cloneElement(childProp, {
|
|
1143
|
+
ref: refs.setReference
|
|
1144
|
+
}), $[57] = childProp, $[58] = refs.setReference, $[59] = t232) : t232 = $[59], t22 = t232;
|
|
1145
|
+
}
|
|
1146
|
+
const child = t22;
|
|
1147
|
+
let t23, t24;
|
|
1148
|
+
if ($[60] !== update ? (t23 = () => update, t24 = [update], $[60] = update, $[61] = t23, $[62] = t24) : (t23 = $[61], t24 = $[62]), useImperativeHandle(updateRef, t23, t24), disabled) {
|
|
1149
|
+
let t252;
|
|
1150
|
+
return $[63] !== childProp ? (t252 = childProp || /* @__PURE__ */ jsx(Fragment, {}), $[63] = childProp, $[64] = t252) : t252 = $[64], t252;
|
|
1151
|
+
}
|
|
1152
|
+
let t25;
|
|
1153
|
+
$[65] !== modal ? (t25 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[65] = modal, $[66] = t25) : t25 = $[66];
|
|
1154
|
+
let t26;
|
|
1155
|
+
$[67] !== className ? (t26 = popover({
|
|
1156
|
+
className
|
|
1157
|
+
}), $[67] = className, $[68] = t26) : t26 = $[68];
|
|
1158
|
+
let t27;
|
|
1159
|
+
$[69] !== animate || $[70] !== arrowProp || $[71] !== arrowX || $[72] !== arrowY || $[73] !== as || $[74] !== content2 || $[75] !== margins || $[76] !== originX || $[77] !== originY || $[78] !== overflow || $[79] !== padding || $[80] !== placement || $[81] !== radius || $[82] !== referenceHidden || $[83] !== rest || $[84] !== scheme || $[85] !== setFloating || $[86] !== shadow || $[87] !== strategy || $[88] !== t26 || $[89] !== tone || $[90] !== widthProp || $[91] !== x || $[92] !== y || $[93] !== zOffset ? (t27 = /* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef, arrowX, arrowY, as, className: t26, hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, tone, strategy, x, y, zOffset, children: content2 }), $[69] = animate, $[70] = arrowProp, $[71] = arrowX, $[72] = arrowY, $[73] = as, $[74] = content2, $[75] = margins, $[76] = originX, $[77] = originY, $[78] = overflow, $[79] = padding, $[80] = placement, $[81] = radius, $[82] = referenceHidden, $[83] = rest, $[84] = scheme, $[85] = setFloating, $[86] = shadow, $[87] = strategy, $[88] = t26, $[89] = tone, $[90] = widthProp, $[91] = x, $[92] = y, $[93] = zOffset, $[94] = t27) : t27 = $[94];
|
|
1160
|
+
let t28;
|
|
1161
|
+
$[95] !== t25 || $[96] !== t27 ? (t28 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1162
|
+
t25,
|
|
1163
|
+
t27
|
|
1164
|
+
] }), $[95] = t25, $[96] = t27, $[97] = t28) : t28 = $[97];
|
|
1165
|
+
const node_0 = t28;
|
|
1166
|
+
let t29;
|
|
1167
|
+
$[98] !== card2 || $[99] !== node_0 || $[100] !== open || $[101] !== portal || $[102] !== scheme || $[103] !== tone ? (t29 = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0), $[98] = card2, $[99] = node_0, $[100] = open, $[101] = portal, $[102] = scheme, $[103] = tone, $[104] = t29) : t29 = $[104];
|
|
1168
|
+
const children = t29;
|
|
1169
|
+
let t30;
|
|
1170
|
+
$[105] !== animate || $[106] !== children ? (t30 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[105] = animate, $[106] = children, $[107] = t30) : t30 = $[107];
|
|
1171
|
+
let t31;
|
|
1172
|
+
return $[108] !== child || $[109] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1173
|
+
t30,
|
|
1147
1174
|
child
|
|
1148
|
-
] });
|
|
1175
|
+
] }), $[108] = child, $[109] = t30, $[110] = t31) : t31 = $[110], t31;
|
|
1176
|
+
}
|
|
1177
|
+
function useMiddleware$1(t0) {
|
|
1178
|
+
const $ = c(36), {
|
|
1179
|
+
animate,
|
|
1180
|
+
arrowProp,
|
|
1181
|
+
arrowRef,
|
|
1182
|
+
constrainSize,
|
|
1183
|
+
fallbackPlacements,
|
|
1184
|
+
floatingBoundary,
|
|
1185
|
+
margins,
|
|
1186
|
+
matchReferenceWidth,
|
|
1187
|
+
placementProp,
|
|
1188
|
+
placementStrategy,
|
|
1189
|
+
preventOverflow,
|
|
1190
|
+
referenceBoundary,
|
|
1191
|
+
referenceWidthRef,
|
|
1192
|
+
rootBoundary
|
|
1193
|
+
} = t0;
|
|
1194
|
+
let ret;
|
|
1195
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== placementProp || $[9] !== placementStrategy || $[10] !== preventOverflow || $[11] !== referenceBoundary || $[12] !== referenceWidthRef || $[13] !== rootBoundary) {
|
|
1196
|
+
if (ret = [], constrainSize || preventOverflow)
|
|
1197
|
+
if (placementStrategy === "autoPlacement") {
|
|
1198
|
+
let t12;
|
|
1199
|
+
$[15] !== fallbackPlacements || $[16] !== placementProp ? (t12 = autoPlacement({
|
|
1200
|
+
allowedPlacements: [placementProp].concat(fallbackPlacements)
|
|
1201
|
+
}), $[15] = fallbackPlacements, $[16] = placementProp, $[17] = t12) : t12 = $[17], ret.push(t12);
|
|
1202
|
+
} else {
|
|
1203
|
+
const t12 = floatingBoundary || void 0;
|
|
1204
|
+
let t22;
|
|
1205
|
+
$[18] !== fallbackPlacements || $[19] !== rootBoundary || $[20] !== t12 ? (t22 = flip({
|
|
1206
|
+
boundary: t12,
|
|
1207
|
+
fallbackPlacements,
|
|
1208
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
1209
|
+
rootBoundary
|
|
1210
|
+
}), $[18] = fallbackPlacements, $[19] = rootBoundary, $[20] = t12, $[21] = t22) : t22 = $[21], ret.push(t22);
|
|
1211
|
+
}
|
|
1212
|
+
let t1;
|
|
1213
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({
|
|
1214
|
+
mainAxis: DEFAULT_POPOVER_DISTANCE
|
|
1215
|
+
}), $[22] = t1) : t1 = $[22], ret.push(t1), constrainSize || matchReferenceWidth) {
|
|
1216
|
+
const t22 = floatingBoundary || void 0;
|
|
1217
|
+
let t32;
|
|
1218
|
+
$[23] !== constrainSize || $[24] !== margins || $[25] !== matchReferenceWidth || $[26] !== referenceWidthRef || $[27] !== t22 ? (t32 = size({
|
|
1219
|
+
boundaryElement: t22,
|
|
1220
|
+
constrainSize,
|
|
1221
|
+
margins,
|
|
1222
|
+
matchReferenceWidth,
|
|
1223
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
1224
|
+
referenceWidthRef
|
|
1225
|
+
}), $[23] = constrainSize, $[24] = margins, $[25] = matchReferenceWidth, $[26] = referenceWidthRef, $[27] = t22, $[28] = t32) : t32 = $[28], ret.push(t32);
|
|
1226
|
+
}
|
|
1227
|
+
if (preventOverflow) {
|
|
1228
|
+
const t22 = floatingBoundary || void 0;
|
|
1229
|
+
let t32;
|
|
1230
|
+
$[29] !== rootBoundary || $[30] !== t22 ? (t32 = shift({
|
|
1231
|
+
boundary: t22,
|
|
1232
|
+
rootBoundary,
|
|
1233
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
1234
|
+
}), $[29] = rootBoundary, $[30] = t22, $[31] = t32) : t32 = $[31], ret.push(t32);
|
|
1235
|
+
}
|
|
1236
|
+
if (arrowProp) {
|
|
1237
|
+
let t22;
|
|
1238
|
+
$[32] !== arrowRef ? (t22 = arrow({
|
|
1239
|
+
element: arrowRef,
|
|
1240
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
1241
|
+
}), $[32] = arrowRef, $[33] = t22) : t22 = $[33], ret.push(t22);
|
|
1242
|
+
}
|
|
1243
|
+
animate && ret.push(origin);
|
|
1244
|
+
const t2 = referenceBoundary || void 0;
|
|
1245
|
+
let t3;
|
|
1246
|
+
$[34] !== t2 ? (t3 = hide({
|
|
1247
|
+
boundary: t2,
|
|
1248
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
1249
|
+
strategy: "referenceHidden"
|
|
1250
|
+
}), $[34] = t2, $[35] = t3) : t3 = $[35], ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = placementProp, $[9] = placementStrategy, $[10] = preventOverflow, $[11] = referenceBoundary, $[12] = referenceWidthRef, $[13] = rootBoundary, $[14] = ret;
|
|
1251
|
+
} else
|
|
1252
|
+
ret = $[14];
|
|
1253
|
+
return ret;
|
|
1149
1254
|
}
|
|
1150
1255
|
const DEFAULT_SELECTABLE_ELEMENT = "button";
|
|
1151
1256
|
function Selectable(props) {
|
|
@@ -1231,14 +1336,14 @@ function TextInput(props) {
|
|
|
1231
1336
|
const Element2 = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, type = t8 === void 0 ? "text" : t8, ref = useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
|
|
1232
1337
|
let t9;
|
|
1233
1338
|
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[23] = t9) : t9 = $[23], useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
|
|
1234
|
-
const handleClearMouseDown = _temp$
|
|
1339
|
+
const handleClearMouseDown = _temp$a;
|
|
1235
1340
|
let t10;
|
|
1236
1341
|
$[24] !== onClear ? (t10 = (event_0) => {
|
|
1237
1342
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
1238
1343
|
}, $[24] = onClear, $[25] = t10) : t10 = $[25];
|
|
1239
1344
|
const handleClearClick = t10;
|
|
1240
1345
|
let t11;
|
|
1241
|
-
$[26] !== responsivePadding ? (t11 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$
|
|
1346
|
+
$[26] !== responsivePadding ? (t11 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$2)), $[26] = responsivePadding, $[27] = t11) : t11 = $[27];
|
|
1242
1347
|
const clearButtonBoxPadding = t11;
|
|
1243
1348
|
let t12;
|
|
1244
1349
|
$[28] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[28] = responsivePadding, $[29] = t12) : t12 = $[29];
|
|
@@ -1304,11 +1409,11 @@ function _temp3(t0) {
|
|
|
1304
1409
|
const [key_0, value_0] = t0;
|
|
1305
1410
|
return value_0 === 0 ? [key_0, 0] : value_0 === 1 ? [key_0, 0] : value_0 === 2 ? [key_0, 1] : [key_0, typeof value_0 == "number" ? value_0 - 1 : 0];
|
|
1306
1411
|
}
|
|
1307
|
-
function _temp2$
|
|
1412
|
+
function _temp2$2(t0) {
|
|
1308
1413
|
const [key2, value] = t0;
|
|
1309
1414
|
return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
|
|
1310
1415
|
}
|
|
1311
|
-
function _temp$
|
|
1416
|
+
function _temp$a(event) {
|
|
1312
1417
|
event.preventDefault(), event.stopPropagation();
|
|
1313
1418
|
}
|
|
1314
1419
|
function AutocompleteOption(props) {
|
|
@@ -1375,16 +1480,18 @@ function autocompleteReducer(state, msg) {
|
|
|
1375
1480
|
}
|
|
1376
1481
|
const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_AUTOCOMPLETE_ELEMENT = "input", DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
1377
1482
|
function Autocomplete(props) {
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
|
|
1483
|
+
const $ = c(181), t0 = props;
|
|
1484
|
+
let customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, valueProp;
|
|
1485
|
+
$[0] !== t0 ? ({
|
|
1486
|
+
as: t1,
|
|
1487
|
+
border: t2,
|
|
1381
1488
|
customValidity,
|
|
1382
1489
|
disabled,
|
|
1383
1490
|
filterOption: filterOptionProp,
|
|
1384
|
-
fontSize
|
|
1491
|
+
fontSize: t3,
|
|
1385
1492
|
icon,
|
|
1386
1493
|
id,
|
|
1387
|
-
listBox
|
|
1494
|
+
listBox: t4,
|
|
1388
1495
|
loading,
|
|
1389
1496
|
onBlur,
|
|
1390
1497
|
onChange,
|
|
@@ -1394,36 +1501,61 @@ function Autocomplete(props) {
|
|
|
1394
1501
|
openButton,
|
|
1395
1502
|
openOnFocus,
|
|
1396
1503
|
options: optionsProp,
|
|
1397
|
-
padding:
|
|
1398
|
-
popover:
|
|
1504
|
+
padding: t5,
|
|
1505
|
+
popover: t6,
|
|
1399
1506
|
prefix,
|
|
1400
|
-
radius
|
|
1507
|
+
radius: t7,
|
|
1401
1508
|
readOnly,
|
|
1402
1509
|
ref: forwardedRef,
|
|
1403
1510
|
relatedElements,
|
|
1404
1511
|
renderOption: renderOptionProp,
|
|
1405
1512
|
renderPopover,
|
|
1406
|
-
renderValue
|
|
1513
|
+
renderValue: t8,
|
|
1407
1514
|
suffix,
|
|
1408
1515
|
value: valueProp,
|
|
1409
1516
|
...rest
|
|
1410
|
-
} =
|
|
1411
|
-
|
|
1517
|
+
} = t0, $[0] = t0, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = forwardedRef, $[5] = icon, $[6] = id, $[7] = loading, $[8] = onBlur, $[9] = onChange, $[10] = onFocus, $[11] = onQueryChange, $[12] = onSelect, $[13] = openButton, $[14] = openOnFocus, $[15] = optionsProp, $[16] = prefix, $[17] = readOnly, $[18] = relatedElements, $[19] = renderOptionProp, $[20] = renderPopover, $[21] = rest, $[22] = suffix, $[23] = t1, $[24] = t2, $[25] = t3, $[26] = t4, $[27] = t5, $[28] = t6, $[29] = t7, $[30] = t8, $[31] = valueProp) : (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], forwardedRef = $[4], icon = $[5], id = $[6], loading = $[7], onBlur = $[8], onChange = $[9], onFocus = $[10], onQueryChange = $[11], onSelect = $[12], openButton = $[13], openOnFocus = $[14], optionsProp = $[15], prefix = $[16], readOnly = $[17], relatedElements = $[18], renderOptionProp = $[19], renderPopover = $[20], rest = $[21], suffix = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], t7 = $[29], t8 = $[30], valueProp = $[31]);
|
|
1518
|
+
const as = t1 === void 0 ? DEFAULT_AUTOCOMPLETE_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, listBox = t4 === void 0 ? EMPTY_RECORD : t4, paddingProp = t5 === void 0 ? 3 : t5, popover2 = t6 === void 0 ? EMPTY_RECORD : t6, radius = t7 === void 0 ? 2 : t7, renderValue = t8 === void 0 ? DEFAULT_RENDER_VALUE : t8, t9 = valueProp || null, t10 = valueProp || null;
|
|
1519
|
+
let t11;
|
|
1520
|
+
$[32] !== t10 || $[33] !== t9 ? (t11 = {
|
|
1521
|
+
activeValue: t9,
|
|
1412
1522
|
focused: !1,
|
|
1413
1523
|
listFocused: !1,
|
|
1414
1524
|
query: null,
|
|
1415
|
-
value:
|
|
1416
|
-
}
|
|
1525
|
+
value: t10
|
|
1526
|
+
}, $[32] = t10, $[33] = t9, $[34] = t11) : t11 = $[34];
|
|
1527
|
+
const [state, dispatch] = useReducer(autocompleteReducer, t11), {
|
|
1417
1528
|
activeValue,
|
|
1418
1529
|
focused,
|
|
1419
1530
|
listFocused,
|
|
1420
1531
|
query,
|
|
1421
1532
|
value
|
|
1422
|
-
} = state
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1533
|
+
} = state;
|
|
1534
|
+
let t12;
|
|
1535
|
+
$[35] !== fontSize || $[36] !== paddingProp ? (t12 = (t132) => {
|
|
1536
|
+
const {
|
|
1537
|
+
value: value_0
|
|
1538
|
+
} = t132;
|
|
1539
|
+
return /* @__PURE__ */ jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) });
|
|
1540
|
+
}, $[35] = fontSize, $[36] = paddingProp, $[37] = t12) : t12 = $[37];
|
|
1541
|
+
const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t12, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
|
|
1542
|
+
let t13, t14;
|
|
1543
|
+
$[38] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[38] = inputElement, $[39] = t13, $[40] = t14) : (t13 = $[39], t14 = $[40]), useImperativeHandle(inputElementRef, t13, t14);
|
|
1544
|
+
let t15, t16;
|
|
1545
|
+
$[41] !== inputElement ? (t15 = () => inputElement, t16 = [inputElement], $[41] = inputElement, $[42] = t15, $[43] = t16) : (t15 = $[42], t16 = $[43]), useImperativeHandle(forwardedRef, t15, t16);
|
|
1546
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp);
|
|
1547
|
+
let t17;
|
|
1548
|
+
$[44] !== options || $[45] !== value ? (t17 = value !== null ? options.find((o) => o.value === value) : void 0, $[44] = options, $[45] = value, $[46] = t17) : t17 = $[46];
|
|
1549
|
+
const currentOption = t17;
|
|
1550
|
+
let t18;
|
|
1551
|
+
if ($[47] !== filterOption || $[48] !== options || $[49] !== query) {
|
|
1552
|
+
let t192;
|
|
1553
|
+
$[51] !== filterOption || $[52] !== query ? (t192 = (option) => query ? filterOption(query, option) : !0, $[51] = filterOption, $[52] = query, $[53] = t192) : t192 = $[53], t18 = options.filter(t192), $[47] = filterOption, $[48] = options, $[49] = query, $[50] = t18;
|
|
1554
|
+
} else
|
|
1555
|
+
t18 = $[50];
|
|
1556
|
+
const filteredOptions = t18, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
|
|
1557
|
+
let t19;
|
|
1558
|
+
$[54] !== onBlur || $[55] !== onQueryChange || $[56] !== relatedElements ? (t19 = (event) => {
|
|
1427
1559
|
setTimeout(() => {
|
|
1428
1560
|
if (popoverMouseWithinRef.current)
|
|
1429
1561
|
return;
|
|
@@ -1440,20 +1572,30 @@ function Autocomplete(props) {
|
|
|
1440
1572
|
type: "root/blur"
|
|
1441
1573
|
}), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
1442
1574
|
}, 0);
|
|
1443
|
-
}, [onBlur, onQueryChange, relatedElements
|
|
1575
|
+
}, $[54] = onBlur, $[55] = onQueryChange, $[56] = relatedElements, $[57] = t19) : t19 = $[57];
|
|
1576
|
+
const handleRootBlur = t19;
|
|
1577
|
+
let t20;
|
|
1578
|
+
$[58] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_0) => {
|
|
1444
1579
|
const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
|
|
1445
1580
|
listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
|
|
1446
1581
|
type: "root/setListFocused",
|
|
1447
1582
|
listFocused: listFocused_0
|
|
1448
1583
|
}));
|
|
1449
|
-
}, []
|
|
1584
|
+
}, $[58] = t20) : t20 = $[58];
|
|
1585
|
+
const handleRootFocus = t20;
|
|
1586
|
+
let t21;
|
|
1587
|
+
$[59] !== onChange || $[60] !== onQueryChange || $[61] !== onSelect ? (t21 = (v) => {
|
|
1450
1588
|
dispatch({
|
|
1451
1589
|
type: "value/change",
|
|
1452
1590
|
value: v
|
|
1453
1591
|
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
1454
|
-
}, [onChange,
|
|
1592
|
+
}, $[59] = onChange, $[60] = onQueryChange, $[61] = onSelect, $[62] = t21) : t21 = $[62];
|
|
1593
|
+
const handleOptionSelect = t21;
|
|
1594
|
+
let t22;
|
|
1595
|
+
$[63] !== activeValue || $[64] !== filteredOptions || $[65] !== filteredOptionsLen || $[66] !== onQueryChange ? (t22 = (event_1) => {
|
|
1455
1596
|
if (event_1.key === "ArrowDown") {
|
|
1456
|
-
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
1597
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
1598
|
+
return;
|
|
1457
1599
|
const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
|
|
1458
1600
|
nextActiveOption && dispatch({
|
|
1459
1601
|
type: "root/setActiveValue",
|
|
@@ -1463,7 +1605,8 @@ function Autocomplete(props) {
|
|
|
1463
1605
|
return;
|
|
1464
1606
|
}
|
|
1465
1607
|
if (event_1.key === "ArrowUp") {
|
|
1466
|
-
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
1608
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
1609
|
+
return;
|
|
1467
1610
|
const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
|
|
1468
1611
|
nextActiveOption_0 && dispatch({
|
|
1469
1612
|
type: "root/setActiveValue",
|
|
@@ -1483,35 +1626,58 @@ function Autocomplete(props) {
|
|
|
1483
1626
|
inputElementRef.current?.focus();
|
|
1484
1627
|
return;
|
|
1485
1628
|
}
|
|
1486
|
-
}, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange
|
|
1629
|
+
}, $[63] = activeValue, $[64] = filteredOptions, $[65] = filteredOptionsLen, $[66] = onQueryChange, $[67] = t22) : t22 = $[67];
|
|
1630
|
+
const handleRootKeyDown = t22;
|
|
1631
|
+
let t23;
|
|
1632
|
+
$[68] !== onQueryChange ? (t23 = (event_2) => {
|
|
1487
1633
|
const nextQuery = event_2.currentTarget.value;
|
|
1488
1634
|
dispatch({
|
|
1489
1635
|
type: "input/change",
|
|
1490
1636
|
query: nextQuery
|
|
1491
1637
|
}), onQueryChange && onQueryChange(nextQuery);
|
|
1492
|
-
}, [onQueryChange
|
|
1638
|
+
}, $[68] = onQueryChange, $[69] = t23) : t23 = $[69];
|
|
1639
|
+
const handleInputChange = t23;
|
|
1640
|
+
let t24;
|
|
1641
|
+
$[70] !== currentOption || $[71] !== renderValue || $[72] !== value ? (t24 = () => {
|
|
1493
1642
|
dispatch({
|
|
1494
1643
|
type: "root/open",
|
|
1495
1644
|
query: value ? renderValue(value, currentOption) : ""
|
|
1496
1645
|
});
|
|
1497
|
-
}, [currentOption, renderValue, value
|
|
1646
|
+
}, $[70] = currentOption, $[71] = renderValue, $[72] = value, $[73] = t24) : t24 = $[73];
|
|
1647
|
+
const dispatchOpen = t24;
|
|
1648
|
+
let t25;
|
|
1649
|
+
$[74] !== dispatchOpen || $[75] !== focused || $[76] !== onFocus || $[77] !== openOnFocus ? (t25 = (event_3) => {
|
|
1498
1650
|
focused || (dispatch({
|
|
1499
1651
|
type: "input/focus"
|
|
1500
1652
|
}), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
|
|
1501
|
-
}, [focused, onFocus, openOnFocus,
|
|
1653
|
+
}, $[74] = dispatchOpen, $[75] = focused, $[76] = onFocus, $[77] = openOnFocus, $[78] = t25) : t25 = $[78];
|
|
1654
|
+
const handleInputFocus = t25;
|
|
1655
|
+
let t26;
|
|
1656
|
+
$[79] === Symbol.for("react.memo_cache_sentinel") ? (t26 = () => {
|
|
1502
1657
|
popoverMouseWithinRef.current = !0;
|
|
1503
|
-
}, []
|
|
1658
|
+
}, $[79] = t26) : t26 = $[79];
|
|
1659
|
+
const handlePopoverMouseEnter = t26;
|
|
1660
|
+
let t27;
|
|
1661
|
+
$[80] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
|
|
1504
1662
|
popoverMouseWithinRef.current = !1;
|
|
1505
|
-
}, []
|
|
1663
|
+
}, $[80] = t27) : t27 = $[80];
|
|
1664
|
+
const handlePopoverMouseLeave = t27;
|
|
1665
|
+
let t28;
|
|
1666
|
+
$[81] !== onChange || $[82] !== onQueryChange ? (t28 = () => {
|
|
1506
1667
|
dispatch({
|
|
1507
1668
|
type: "root/clear"
|
|
1508
1669
|
}), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
1509
|
-
}, [onChange, onQueryChange
|
|
1670
|
+
}, $[81] = onChange, $[82] = onQueryChange, $[83] = t28) : t28 = $[83];
|
|
1671
|
+
const handleClearButtonClick = t28;
|
|
1672
|
+
let t29;
|
|
1673
|
+
$[84] === Symbol.for("react.memo_cache_sentinel") ? (t29 = () => {
|
|
1510
1674
|
dispatch({
|
|
1511
1675
|
type: "input/focus"
|
|
1512
1676
|
});
|
|
1513
|
-
}, []);
|
|
1514
|
-
|
|
1677
|
+
}, $[84] = t29) : t29 = $[84];
|
|
1678
|
+
const handleClearButtonFocus = t29;
|
|
1679
|
+
let t30, t31;
|
|
1680
|
+
$[85] !== valueProp ? (t30 = () => {
|
|
1515
1681
|
if (valueProp !== valuePropRef.current) {
|
|
1516
1682
|
valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
|
|
1517
1683
|
type: "value/change",
|
|
@@ -1523,14 +1689,19 @@ function Autocomplete(props) {
|
|
|
1523
1689
|
type: "value/change",
|
|
1524
1690
|
value: valueProp || null
|
|
1525
1691
|
}));
|
|
1526
|
-
}, [valueProp]), useEffect(
|
|
1692
|
+
}, t31 = [valueProp], $[85] = valueProp, $[86] = t30, $[87] = t31) : (t30 = $[86], t31 = $[87]), useEffect(t30, t31);
|
|
1693
|
+
let t32, t33;
|
|
1694
|
+
$[88] !== focused ? (t32 = () => {
|
|
1527
1695
|
!focused && valueRef.current && dispatch({
|
|
1528
1696
|
type: "root/setActiveValue",
|
|
1529
1697
|
value: valueRef.current
|
|
1530
1698
|
});
|
|
1531
|
-
}, [focused]), useEffect(
|
|
1699
|
+
}, t33 = [focused], $[88] = focused, $[89] = t32, $[90] = t33) : (t32 = $[89], t33 = $[90]), useEffect(t32, t33);
|
|
1700
|
+
let t34, t35;
|
|
1701
|
+
$[91] !== activeValue || $[92] !== filteredOptions ? (t34 = () => {
|
|
1532
1702
|
const listElement = listBoxElementRef.current;
|
|
1533
|
-
if (!listElement)
|
|
1703
|
+
if (!listElement)
|
|
1704
|
+
return;
|
|
1534
1705
|
const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
1535
1706
|
if (activeOption_1) {
|
|
1536
1707
|
const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
|
|
@@ -1540,41 +1711,128 @@ function Autocomplete(props) {
|
|
|
1540
1711
|
focusFirstDescendant(activeItemElement);
|
|
1541
1712
|
}
|
|
1542
1713
|
}
|
|
1543
|
-
}, [activeValue, filteredOptions]);
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1714
|
+
}, t35 = [activeValue, filteredOptions], $[91] = activeValue, $[92] = filteredOptions, $[93] = t34, $[94] = t35) : (t34 = $[93], t35 = $[94]), useEffect(t34, t35);
|
|
1715
|
+
let t36;
|
|
1716
|
+
bb0: {
|
|
1717
|
+
if (!loading && !disabled && value) {
|
|
1718
|
+
let t372;
|
|
1719
|
+
$[95] === Symbol.for("react.memo_cache_sentinel") ? (t372 = {
|
|
1547
1720
|
"aria-label": "Clear",
|
|
1548
1721
|
onFocus: handleClearButtonFocus
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1722
|
+
}, $[95] = t372) : t372 = $[95], t36 = t372;
|
|
1723
|
+
break bb0;
|
|
1724
|
+
}
|
|
1725
|
+
t36 = void 0;
|
|
1726
|
+
}
|
|
1727
|
+
const clearButton = t36;
|
|
1728
|
+
let t37;
|
|
1729
|
+
$[96] !== padding ? (t37 = Object.fromEntries(Object.entries(padding).map(_temp$9)), $[96] = padding, $[97] = t37) : t37 = $[97];
|
|
1730
|
+
const openButtonBoxPadding = t37;
|
|
1731
|
+
let t38;
|
|
1732
|
+
$[98] !== padding ? (t38 = Object.values(padding).map(_temp2$1), $[98] = padding, $[99] = t38) : t38 = $[99];
|
|
1733
|
+
const openButtonPadding = t38, openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD;
|
|
1734
|
+
let t39;
|
|
1735
|
+
$[100] !== dispatchOpen || $[101] !== openButtonProps ? (t39 = (event_4) => {
|
|
1551
1736
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
1552
|
-
}, [
|
|
1737
|
+
}, $[100] = dispatchOpen, $[101] = openButtonProps, $[102] = t39) : t39 = $[102];
|
|
1738
|
+
const handleOpenClick = t39;
|
|
1739
|
+
let t40;
|
|
1740
|
+
$[103] !== disabled || $[104] !== expanded || $[105] !== fontSize || $[106] !== handleOpenClick || $[107] !== openButton || $[108] !== openButtonBoxPadding || $[109] !== openButtonPadding || $[110] !== openButtonProps || $[111] !== readOnly ? (t40 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[103] = disabled, $[104] = expanded, $[105] = fontSize, $[106] = handleOpenClick, $[107] = openButton, $[108] = openButtonBoxPadding, $[109] = openButtonPadding, $[110] = openButtonProps, $[111] = readOnly, $[112] = t40) : t40 = $[112];
|
|
1741
|
+
const openButtonNode = t40;
|
|
1742
|
+
let t41;
|
|
1743
|
+
bb1: {
|
|
1744
|
+
if (query === null) {
|
|
1745
|
+
if (value !== null) {
|
|
1746
|
+
let t422;
|
|
1747
|
+
$[113] !== currentOption || $[114] !== renderValue || $[115] !== value ? (t422 = renderValue(value, currentOption), $[113] = currentOption, $[114] = renderValue, $[115] = value, $[116] = t422) : t422 = $[116], t41 = t422;
|
|
1748
|
+
break bb1;
|
|
1749
|
+
}
|
|
1750
|
+
t41 = "";
|
|
1751
|
+
break bb1;
|
|
1752
|
+
}
|
|
1753
|
+
t41 = query;
|
|
1754
|
+
}
|
|
1755
|
+
const inputValue = t41;
|
|
1756
|
+
let t42;
|
|
1757
|
+
$[117] !== listFocused ? (t42 = (event_5) => {
|
|
1553
1758
|
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
1554
|
-
}, [
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1759
|
+
}, $[117] = listFocused, $[118] = t42) : t42 = $[118];
|
|
1760
|
+
const handleListBoxKeyDown = t42;
|
|
1761
|
+
let t43;
|
|
1762
|
+
bb2: {
|
|
1763
|
+
if (filteredOptions.length === 0) {
|
|
1764
|
+
t43 = null;
|
|
1765
|
+
break bb2;
|
|
1766
|
+
}
|
|
1767
|
+
let t442;
|
|
1768
|
+
if ($[119] !== activeValue || $[120] !== currentOption || $[121] !== filteredOptions || $[122] !== handleOptionSelect || $[123] !== id || $[124] !== listFocused || $[125] !== loading || $[126] !== renderOption) {
|
|
1769
|
+
let t453;
|
|
1770
|
+
$[128] !== activeValue || $[129] !== currentOption || $[130] !== handleOptionSelect || $[131] !== id || $[132] !== listFocused || $[133] !== loading || $[134] !== renderOption ? (t453 = (option_0) => {
|
|
1771
|
+
const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
|
|
1772
|
+
return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
|
|
1773
|
+
disabled: loading,
|
|
1774
|
+
selected: active,
|
|
1775
|
+
tabIndex: listFocused && active ? 0 : -1
|
|
1776
|
+
}) }, option_0.value);
|
|
1777
|
+
}, $[128] = activeValue, $[129] = currentOption, $[130] = handleOptionSelect, $[131] = id, $[132] = listFocused, $[133] = loading, $[134] = renderOption, $[135] = t453) : t453 = $[135], t442 = filteredOptions.map(t453), $[119] = activeValue, $[120] = currentOption, $[121] = filteredOptions, $[122] = handleOptionSelect, $[123] = id, $[124] = listFocused, $[125] = loading, $[126] = renderOption, $[127] = t442;
|
|
1778
|
+
} else
|
|
1779
|
+
t442 = $[127];
|
|
1780
|
+
let t452;
|
|
1781
|
+
$[136] !== listBoxId || $[137] !== t442 ? (t452 = /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: t442 }), $[136] = listBoxId, $[137] = t442, $[138] = t452) : t452 = $[138];
|
|
1782
|
+
let t462;
|
|
1783
|
+
$[139] !== handleListBoxKeyDown || $[140] !== listBox || $[141] !== t452 ? (t462 = /* @__PURE__ */ jsx(Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t452 }), $[139] = handleListBoxKeyDown, $[140] = listBox, $[141] = t452, $[142] = t462) : t462 = $[142], t43 = t462;
|
|
1784
|
+
}
|
|
1785
|
+
const content2 = t43;
|
|
1786
|
+
let t44;
|
|
1787
|
+
bb3: {
|
|
1788
|
+
if (renderPopover) {
|
|
1789
|
+
const t453 = !expanded;
|
|
1790
|
+
let t462;
|
|
1791
|
+
$[143] !== content2 || $[144] !== inputElement || $[145] !== renderPopover || $[146] !== t453 ? (t462 = /* @__PURE__ */ jsx(RenderPopover, { content: content2, hidden: t453, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[143] = content2, $[144] = inputElement, $[145] = renderPopover, $[146] = t453, $[147] = t462) : t462 = $[147], t44 = t462;
|
|
1792
|
+
break bb3;
|
|
1793
|
+
}
|
|
1794
|
+
if (filteredOptionsLen === 0) {
|
|
1795
|
+
t44 = null;
|
|
1796
|
+
break bb3;
|
|
1797
|
+
}
|
|
1798
|
+
let t452;
|
|
1799
|
+
$[148] !== content2 || $[149] !== expanded || $[150] !== inputElement || $[151] !== popover2 ? (t452 = /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover2 }), $[148] = content2, $[149] = expanded, $[150] = inputElement, $[151] = popover2, $[152] = t452) : t452 = $[152], t44 = t452;
|
|
1800
|
+
}
|
|
1801
|
+
const results = t44, t45 = loading && AnimatedSpinnerIcon, t46 = suffix || openButtonNode;
|
|
1802
|
+
let t47;
|
|
1803
|
+
$[153] !== activeItemId || $[154] !== as || $[155] !== border || $[156] !== clearButton || $[157] !== customValidity || $[158] !== disabled || $[159] !== expanded || $[160] !== fontSize || $[161] !== handleClearButtonClick || $[162] !== handleInputChange || $[163] !== handleInputFocus || $[164] !== icon || $[165] !== id || $[166] !== inputValue || $[167] !== listBoxId || $[168] !== padding || $[169] !== prefix || $[170] !== radius || $[171] !== readOnly || $[172] !== rest || $[173] !== t45 || $[174] !== t46 ? (t47 = /* @__PURE__ */ jsx(TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: t45, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t46, value: inputValue }), $[153] = activeItemId, $[154] = as, $[155] = border, $[156] = clearButton, $[157] = customValidity, $[158] = disabled, $[159] = expanded, $[160] = fontSize, $[161] = handleClearButtonClick, $[162] = handleInputChange, $[163] = handleInputFocus, $[164] = icon, $[165] = id, $[166] = inputValue, $[167] = listBoxId, $[168] = padding, $[169] = prefix, $[170] = radius, $[171] = readOnly, $[172] = rest, $[173] = t45, $[174] = t46, $[175] = t47) : t47 = $[175];
|
|
1804
|
+
let t48;
|
|
1805
|
+
return $[176] !== handleRootBlur || $[177] !== handleRootKeyDown || $[178] !== results || $[179] !== t47 ? (t48 = /* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
|
|
1806
|
+
t47,
|
|
1807
|
+
results
|
|
1808
|
+
] }), $[176] = handleRootBlur, $[177] = handleRootKeyDown, $[178] = results, $[179] = t47, $[180] = t48) : t48 = $[180], t48;
|
|
1809
|
+
}
|
|
1810
|
+
function _temp2$1(v_0) {
|
|
1811
|
+
return Math.max(v_0 - 1, 0);
|
|
1812
|
+
}
|
|
1813
|
+
function _temp$9(t0) {
|
|
1814
|
+
const [key2, value_1] = t0;
|
|
1815
|
+
return value_1 === 0 ? [key2, 0] : value_1 === 1 ? [key2, 1] : value_1 === 2 ? [key2, 1] : [key2, value_1 - 2];
|
|
1816
|
+
}
|
|
1817
|
+
function RenderPopover({
|
|
1818
|
+
renderPopover,
|
|
1819
|
+
content: content2,
|
|
1820
|
+
hidden,
|
|
1821
|
+
inputElement,
|
|
1822
|
+
onMouseEnter,
|
|
1823
|
+
onMouseLeave,
|
|
1824
|
+
resultsPopoverElementRef
|
|
1825
|
+
}) {
|
|
1826
|
+
return renderPopover({
|
|
1562
1827
|
content: content2,
|
|
1563
|
-
hidden
|
|
1564
|
-
inputElement
|
|
1565
|
-
onMouseEnter
|
|
1566
|
-
onMouseLeave
|
|
1567
|
-
}, resultsPopoverElementRef)
|
|
1568
|
-
return (
|
|
1569
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
1570
|
-
/* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
|
|
1571
|
-
input,
|
|
1572
|
-
results
|
|
1573
|
-
] })
|
|
1574
|
-
);
|
|
1828
|
+
hidden,
|
|
1829
|
+
inputElement,
|
|
1830
|
+
onMouseEnter,
|
|
1831
|
+
onMouseLeave
|
|
1832
|
+
}, resultsPopoverElementRef);
|
|
1575
1833
|
}
|
|
1576
1834
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
1577
|
-
const $ = c(9), elementsArg = t0 === void 0 ? _temp$
|
|
1835
|
+
const $ = c(9), elementsArg = t0 === void 0 ? _temp$8 : t0;
|
|
1578
1836
|
let t1;
|
|
1579
1837
|
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
1580
1838
|
if (!listener)
|
|
@@ -1604,38 +1862,97 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
1604
1862
|
let t3;
|
|
1605
1863
|
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
1606
1864
|
}
|
|
1607
|
-
function _temp$
|
|
1865
|
+
function _temp$8() {
|
|
1608
1866
|
return EMPTY_ARRAY;
|
|
1609
1867
|
}
|
|
1610
1868
|
const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
|
|
1611
1869
|
function Breadcrumbs(props) {
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1870
|
+
const $ = c(37), t0 = props;
|
|
1871
|
+
let children, className, expandButtonProps, maxLength, rest, separator, t1, t2, t3, t4;
|
|
1872
|
+
$[0] !== t0 ? ({
|
|
1873
|
+
as: t1,
|
|
1614
1874
|
children,
|
|
1615
1875
|
className,
|
|
1616
1876
|
expandButton: expandButtonProps,
|
|
1617
|
-
gap
|
|
1618
|
-
gapX,
|
|
1619
|
-
gapY,
|
|
1877
|
+
gap: t2,
|
|
1878
|
+
gapX: t3,
|
|
1879
|
+
gapY: t4,
|
|
1620
1880
|
maxLength,
|
|
1621
1881
|
separator,
|
|
1622
1882
|
...rest
|
|
1623
|
-
} =
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1883
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = expandButtonProps, $[4] = maxLength, $[5] = rest, $[6] = separator, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4) : (children = $[1], className = $[2], expandButtonProps = $[3], maxLength = $[4], rest = $[5], separator = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10]);
|
|
1884
|
+
const as = t1 === void 0 ? DEFAULT_BREADCRUMBS_ELEMENT : t1, gap = t2 === void 0 ? 2 : t2, gapX = t3 === void 0 ? gap : t3, gapY = t4 === void 0 ? gap : t4, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
|
|
1885
|
+
let t5;
|
|
1886
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => setOpen(!1), $[11] = t5) : t5 = $[11];
|
|
1887
|
+
const collapse = t5;
|
|
1888
|
+
let t6;
|
|
1889
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => setOpen(!0), $[12] = t6) : t6 = $[12];
|
|
1890
|
+
const expand = t6;
|
|
1891
|
+
let t7;
|
|
1892
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [expandElementRef.current, popoverElementRef.current], $[13] = t7) : t7 = $[13], useClickOutsideEvent(collapse, t7);
|
|
1893
|
+
let t8;
|
|
1894
|
+
$[14] !== children ? (t8 = Children.toArray(children).filter(isValidElement), $[14] = children, $[15] = t8) : t8 = $[15];
|
|
1895
|
+
const rawItems = t8;
|
|
1896
|
+
let t9;
|
|
1897
|
+
$[16] !== expandButtonProps || $[17] !== gapY || $[18] !== maxLength || $[19] !== open || $[20] !== rawItems ? (t9 = {
|
|
1898
|
+
collapse,
|
|
1899
|
+
expand,
|
|
1900
|
+
expandElementRef,
|
|
1901
|
+
maxLength,
|
|
1902
|
+
open,
|
|
1903
|
+
popoverElementRef,
|
|
1904
|
+
rawItems,
|
|
1905
|
+
gapY,
|
|
1906
|
+
expandButtonProps
|
|
1907
|
+
}, $[16] = expandButtonProps, $[17] = gapY, $[18] = maxLength, $[19] = open, $[20] = rawItems, $[21] = t9) : t9 = $[21];
|
|
1908
|
+
const items = useItems(t9);
|
|
1909
|
+
let t10;
|
|
1910
|
+
$[22] !== className ? (t10 = breadcrumbs({
|
|
1634
1911
|
className
|
|
1635
|
-
}),
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1912
|
+
}), $[22] = className, $[23] = t10) : t10 = $[23];
|
|
1913
|
+
let t11;
|
|
1914
|
+
if ($[24] !== items || $[25] !== separator) {
|
|
1915
|
+
let t122;
|
|
1916
|
+
$[27] !== separator ? (t122 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1917
|
+
itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
|
|
1918
|
+
/* @__PURE__ */ jsx(Box, { as: "li", children: item })
|
|
1919
|
+
] }, itemIndex), $[27] = separator, $[28] = t122) : t122 = $[28], t11 = items.map(t122), $[24] = items, $[25] = separator, $[26] = t11;
|
|
1920
|
+
} else
|
|
1921
|
+
t11 = $[26];
|
|
1922
|
+
let t12;
|
|
1923
|
+
return $[29] !== as || $[30] !== gap || $[31] !== gapX || $[32] !== gapY || $[33] !== rest || $[34] !== t10 || $[35] !== t11 ? (t12 = /* @__PURE__ */ jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: t10, gap, gapX, gapY, children: t11 }), $[29] = as, $[30] = gap, $[31] = gapX, $[32] = gapY, $[33] = rest, $[34] = t10, $[35] = t11, $[36] = t12) : t12 = $[36], t12;
|
|
1924
|
+
}
|
|
1925
|
+
function useItems(t0) {
|
|
1926
|
+
const $ = c(30), {
|
|
1927
|
+
collapse,
|
|
1928
|
+
expand,
|
|
1929
|
+
expandElementRef,
|
|
1930
|
+
maxLength,
|
|
1931
|
+
open,
|
|
1932
|
+
popoverElementRef,
|
|
1933
|
+
rawItems,
|
|
1934
|
+
gapY,
|
|
1935
|
+
expandButtonProps
|
|
1936
|
+
} = t0, len = rawItems.length;
|
|
1937
|
+
if (maxLength && len > maxLength) {
|
|
1938
|
+
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
1939
|
+
let t1;
|
|
1940
|
+
if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandButtonProps || $[5] !== expandElementRef || $[6] !== gapY || $[7] !== len || $[8] !== open || $[9] !== popoverElementRef || $[10] !== rawItems) {
|
|
1941
|
+
const t2 = rawItems.slice(0, beforeLength - 1);
|
|
1942
|
+
let t3;
|
|
1943
|
+
$[12] !== afterLength || $[13] !== beforeLength || $[14] !== len || $[15] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[12] = afterLength, $[13] = beforeLength, $[14] = len, $[15] = rawItems, $[16] = t3) : t3 = $[16];
|
|
1944
|
+
let t4;
|
|
1945
|
+
$[17] !== gapY || $[18] !== t3 ? (t4 = /* @__PURE__ */ jsx(Stack, { as: "ol", gap: gapY, overflow: "auto", children: t3 }), $[17] = gapY, $[18] = t3, $[19] = t4) : t4 = $[19];
|
|
1946
|
+
const t5 = open ? collapse : expand;
|
|
1947
|
+
let t6;
|
|
1948
|
+
$[20] !== expandButtonProps || $[21] !== expandElementRef || $[22] !== open || $[23] !== t5 ? (t6 = /* @__PURE__ */ jsx(Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: t5, ref: expandElementRef, selected: open }), $[20] = expandButtonProps, $[21] = expandElementRef, $[22] = open, $[23] = t5, $[24] = t6) : t6 = $[24];
|
|
1949
|
+
let t7;
|
|
1950
|
+
$[25] !== open || $[26] !== popoverElementRef || $[27] !== t4 || $[28] !== t6 ? (t7 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t4, open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: t6 }, "button"), $[25] = open, $[26] = popoverElementRef, $[27] = t4, $[28] = t6, $[29] = t7) : t7 = $[29], t1 = [...t2, t7, ...rawItems.slice(len - afterLength)], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandButtonProps, $[5] = expandElementRef, $[6] = gapY, $[7] = len, $[8] = open, $[9] = popoverElementRef, $[10] = rawItems, $[11] = t1;
|
|
1951
|
+
} else
|
|
1952
|
+
t1 = $[11];
|
|
1953
|
+
return t1;
|
|
1954
|
+
}
|
|
1955
|
+
return rawItems;
|
|
1639
1956
|
}
|
|
1640
1957
|
const DEFAULT_CONTAINER_ELEMENT = "div";
|
|
1641
1958
|
function Container(props) {
|
|
@@ -1656,18 +1973,18 @@ function Container(props) {
|
|
|
1656
1973
|
let t4;
|
|
1657
1974
|
return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
|
|
1658
1975
|
}
|
|
1659
|
-
function useGlobalKeyDown(onKeyDown) {
|
|
1660
|
-
const $ = c(
|
|
1976
|
+
function useGlobalKeyDown(onKeyDown, options) {
|
|
1977
|
+
const $ = c(7);
|
|
1661
1978
|
let t0;
|
|
1662
1979
|
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
1663
1980
|
const handleKeyDown = useEffectEvent(t0);
|
|
1664
1981
|
let t1;
|
|
1665
|
-
$[2] !== handleKeyDown ? (t1 = () => {
|
|
1982
|
+
$[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
|
|
1666
1983
|
const handler = (event_0) => handleKeyDown(event_0);
|
|
1667
|
-
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
1668
|
-
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[
|
|
1984
|
+
return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
|
|
1985
|
+
}, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
|
|
1669
1986
|
let t2;
|
|
1670
|
-
$[
|
|
1987
|
+
$[5] !== options ? (t2 = [options], $[5] = options, $[6] = t2) : t2 = $[6], useEffect(t1, t2);
|
|
1671
1988
|
}
|
|
1672
1989
|
function isTargetWithinScope(boundaryElement, portalElement, target) {
|
|
1673
1990
|
return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
|
|
@@ -1766,7 +2083,7 @@ function DialogCard(props) {
|
|
|
1766
2083
|
t19
|
|
1767
2084
|
] }), $[55] = as, $[56] = rest, $[57] = t12, $[58] = t18, $[59] = t19, $[60] = t20) : t20 = $[60], t20;
|
|
1768
2085
|
}
|
|
1769
|
-
const DialogContext = createGlobalScopedContext("@sanity/ui/
|
|
2086
|
+
const DialogContext = createGlobalScopedContext("@sanity/ui/v4/dialog", {
|
|
1770
2087
|
version: 0
|
|
1771
2088
|
});
|
|
1772
2089
|
function useDialog() {
|
|
@@ -1925,7 +2242,7 @@ function Hotkeys(props) {
|
|
|
1925
2242
|
let t4;
|
|
1926
2243
|
return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Hotkeys", ...rest, display: "flex", gap, gapX, gapY, children: t3 }), $[19] = as, $[20] = gap, $[21] = gapX, $[22] = gapY, $[23] = rest, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
|
|
1927
2244
|
}
|
|
1928
|
-
const MenuContext = createGlobalScopedContext("@sanity/ui/
|
|
2245
|
+
const MenuContext = createGlobalScopedContext("@sanity/ui/v4/menu", null);
|
|
1929
2246
|
function _isFocusable(element) {
|
|
1930
2247
|
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
1931
2248
|
}
|
|
@@ -1963,16 +2280,24 @@ function _sortElements(rootElement, elements) {
|
|
|
1963
2280
|
elements.sort(_sort);
|
|
1964
2281
|
}
|
|
1965
2282
|
function useMenuController(props) {
|
|
1966
|
-
const {
|
|
2283
|
+
const $ = c(21), {
|
|
1967
2284
|
onKeyDown,
|
|
1968
2285
|
originElement,
|
|
1969
2286
|
shouldFocus,
|
|
1970
2287
|
rootElementRef
|
|
1971
|
-
} = props
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2288
|
+
} = props;
|
|
2289
|
+
let t0;
|
|
2290
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|
|
2291
|
+
const elementsRef = useRef(t0), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), [activeElement, setActiveElement] = useState(null);
|
|
2292
|
+
let t1;
|
|
2293
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (nextActiveIndex) => {
|
|
2294
|
+
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
|
|
2295
|
+
}, $[1] = t1) : t1 = $[1];
|
|
2296
|
+
const setActiveIndex = t1;
|
|
2297
|
+
let t2;
|
|
2298
|
+
$[2] !== rootElementRef ? (t2 = (element, selected) => {
|
|
2299
|
+
if (!element)
|
|
2300
|
+
return _temp$7;
|
|
1976
2301
|
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
1977
2302
|
const selectedIndex = elementsRef.current.indexOf(element);
|
|
1978
2303
|
setActiveIndex(selectedIndex);
|
|
@@ -1981,7 +2306,10 @@ function useMenuController(props) {
|
|
|
1981
2306
|
const idx = elementsRef.current.indexOf(element);
|
|
1982
2307
|
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
1983
2308
|
};
|
|
1984
|
-
}, [rootElementRef,
|
|
2309
|
+
}, $[2] = rootElementRef, $[3] = t2) : t2 = $[3];
|
|
2310
|
+
const mount = t2;
|
|
2311
|
+
let t3;
|
|
2312
|
+
$[4] !== onKeyDown || $[5] !== originElement ? (t3 = (event) => {
|
|
1985
2313
|
if (event.key === "Tab") {
|
|
1986
2314
|
originElement && originElement.focus();
|
|
1987
2315
|
return;
|
|
@@ -1989,7 +2317,8 @@ function useMenuController(props) {
|
|
|
1989
2317
|
if (event.key === "Home") {
|
|
1990
2318
|
event.preventDefault(), event.stopPropagation();
|
|
1991
2319
|
const el = _getFocusableElements(elementsRef.current)[0];
|
|
1992
|
-
if (!el)
|
|
2320
|
+
if (!el)
|
|
2321
|
+
return;
|
|
1993
2322
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
1994
2323
|
setActiveIndex(currentIndex);
|
|
1995
2324
|
return;
|
|
@@ -1997,7 +2326,8 @@ function useMenuController(props) {
|
|
|
1997
2326
|
if (event.key === "End") {
|
|
1998
2327
|
event.preventDefault(), event.stopPropagation();
|
|
1999
2328
|
const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
|
|
2000
|
-
if (!el_0)
|
|
2329
|
+
if (!el_0)
|
|
2330
|
+
return;
|
|
2001
2331
|
const currentIndex_0 = elementsRef.current.indexOf(el_0);
|
|
2002
2332
|
setActiveIndex(currentIndex_0);
|
|
2003
2333
|
return;
|
|
@@ -2005,7 +2335,8 @@ function useMenuController(props) {
|
|
|
2005
2335
|
if (event.key === "ArrowUp") {
|
|
2006
2336
|
event.preventDefault(), event.stopPropagation();
|
|
2007
2337
|
const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
|
|
2008
|
-
if (focusableLen === 0)
|
|
2338
|
+
if (focusableLen === 0)
|
|
2339
|
+
return;
|
|
2009
2340
|
const focusedElement = elementsRef.current[activeIndexRef.current];
|
|
2010
2341
|
let focusedIndex = focusableElements_1.indexOf(focusedElement);
|
|
2011
2342
|
focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
|
|
@@ -2016,7 +2347,8 @@ function useMenuController(props) {
|
|
|
2016
2347
|
if (event.key === "ArrowDown") {
|
|
2017
2348
|
event.preventDefault(), event.stopPropagation();
|
|
2018
2349
|
const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
|
|
2019
|
-
if (focusableLen_0 === 0)
|
|
2350
|
+
if (focusableLen_0 === 0)
|
|
2351
|
+
return;
|
|
2020
2352
|
const focusedElement_0 = elementsRef.current[activeIndexRef.current];
|
|
2021
2353
|
let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
|
|
2022
2354
|
focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
|
|
@@ -2025,14 +2357,23 @@ function useMenuController(props) {
|
|
|
2025
2357
|
return;
|
|
2026
2358
|
}
|
|
2027
2359
|
onKeyDown && onKeyDown(event);
|
|
2028
|
-
}, [onKeyDown, originElement,
|
|
2360
|
+
}, $[4] = onKeyDown, $[5] = originElement, $[6] = t3) : t3 = $[6];
|
|
2361
|
+
const handleKeyDown = t3;
|
|
2362
|
+
let t4;
|
|
2363
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = (event_0) => {
|
|
2029
2364
|
const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
|
|
2030
2365
|
setActiveIndex(currentIndex_3);
|
|
2031
|
-
}, [
|
|
2366
|
+
}, $[7] = t4) : t4 = $[7];
|
|
2367
|
+
const handleItemMouseEnter = t4;
|
|
2368
|
+
let t5;
|
|
2369
|
+
$[8] !== rootElementRef ? (t5 = () => {
|
|
2032
2370
|
setActiveIndex(-2), rootElementRef.current?.focus();
|
|
2033
|
-
}, [rootElementRef,
|
|
2034
|
-
|
|
2035
|
-
|
|
2371
|
+
}, $[8] = rootElementRef, $[9] = t5) : t5 = $[9];
|
|
2372
|
+
const handleItemMouseLeave = t5;
|
|
2373
|
+
let t6, t7;
|
|
2374
|
+
$[10] !== activeIndex || $[11] !== rootElementRef || $[12] !== shouldFocus ? (t6 = () => {
|
|
2375
|
+
if (!rootElementRef.current)
|
|
2376
|
+
return;
|
|
2036
2377
|
const rafId = requestAnimationFrame(() => {
|
|
2037
2378
|
if (activeIndex === -1) {
|
|
2038
2379
|
if (shouldFocus === "first") {
|
|
@@ -2054,18 +2395,22 @@ function useMenuController(props) {
|
|
|
2054
2395
|
(elementsRef.current[activeIndex] || null)?.focus();
|
|
2055
2396
|
});
|
|
2056
2397
|
return () => cancelAnimationFrame(rafId);
|
|
2057
|
-
}, [activeIndex,
|
|
2398
|
+
}, t7 = [activeIndex, rootElementRef, setActiveIndex, shouldFocus], $[10] = activeIndex, $[11] = rootElementRef, $[12] = shouldFocus, $[13] = t6, $[14] = t7) : (t6 = $[13], t7 = $[14]), useEffect(t6, t7);
|
|
2399
|
+
let t8;
|
|
2400
|
+
return $[15] !== activeElement || $[16] !== activeIndex || $[17] !== handleItemMouseLeave || $[18] !== handleKeyDown || $[19] !== mount ? (t8 = {
|
|
2058
2401
|
activeElement,
|
|
2059
2402
|
activeIndex,
|
|
2060
2403
|
handleItemMouseEnter,
|
|
2061
2404
|
handleItemMouseLeave,
|
|
2062
2405
|
handleKeyDown,
|
|
2063
2406
|
mount
|
|
2064
|
-
};
|
|
2407
|
+
}, $[15] = activeElement, $[16] = activeIndex, $[17] = handleItemMouseLeave, $[18] = handleKeyDown, $[19] = mount, $[20] = t8) : t8 = $[20], t8;
|
|
2408
|
+
}
|
|
2409
|
+
function _temp$7() {
|
|
2065
2410
|
}
|
|
2066
2411
|
const DEFAULT_MENU_ELEMENT = "div";
|
|
2067
2412
|
function Menu(props) {
|
|
2068
|
-
const $ = c(
|
|
2413
|
+
const $ = c(56), t0 = props;
|
|
2069
2414
|
let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
|
|
2070
2415
|
$[0] !== t0 ? ({
|
|
2071
2416
|
as: t1,
|
|
@@ -2121,10 +2466,9 @@ function Menu(props) {
|
|
|
2121
2466
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
2122
2467
|
}, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
|
|
2123
2468
|
let t11;
|
|
2124
|
-
$[31] !== activeElement || $[32] !==
|
|
2125
|
-
version:
|
|
2469
|
+
$[31] !== activeElement || $[32] !== handleItemMouseEnter || $[33] !== handleItemMouseLeave || $[34] !== mount || $[35] !== onClickOutside || $[36] !== onEscape || $[37] !== onItemClick || $[38] !== registerElement ? (t11 = {
|
|
2470
|
+
version: 2,
|
|
2126
2471
|
activeElement,
|
|
2127
|
-
activeIndex,
|
|
2128
2472
|
mount,
|
|
2129
2473
|
onClickOutside,
|
|
2130
2474
|
onEscape,
|
|
@@ -2132,18 +2476,18 @@ function Menu(props) {
|
|
|
2132
2476
|
onItemMouseEnter: handleItemMouseEnter,
|
|
2133
2477
|
onItemMouseLeave: handleItemMouseLeave,
|
|
2134
2478
|
registerElement
|
|
2135
|
-
}, $[31] = activeElement, $[32] =
|
|
2479
|
+
}, $[31] = activeElement, $[32] = handleItemMouseEnter, $[33] = handleItemMouseLeave, $[34] = mount, $[35] = onClickOutside, $[36] = onEscape, $[37] = onItemClick, $[38] = registerElement, $[39] = t11) : t11 = $[39];
|
|
2136
2480
|
const value = t11;
|
|
2137
2481
|
let t12;
|
|
2138
|
-
$[
|
|
2482
|
+
$[40] !== className ? (t12 = menu({
|
|
2139
2483
|
className
|
|
2140
|
-
}), $[
|
|
2484
|
+
}), $[40] = className, $[41] = t12) : t12 = $[41];
|
|
2141
2485
|
let t13;
|
|
2142
|
-
$[
|
|
2486
|
+
$[42] !== children || $[43] !== gap ? (t13 = /* @__PURE__ */ jsx(Stack, { gap, children }), $[42] = children, $[43] = gap, $[44] = t13) : t13 = $[44];
|
|
2143
2487
|
let t14;
|
|
2144
|
-
$[
|
|
2488
|
+
$[45] !== as || $[46] !== handleKeyDown || $[47] !== handleRefChange || $[48] !== padding || $[49] !== rest || $[50] !== t12 || $[51] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "Menu", ...rest, as, className: t12, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t13 }), $[45] = as, $[46] = handleKeyDown, $[47] = handleRefChange, $[48] = padding, $[49] = rest, $[50] = t12, $[51] = t13, $[52] = t14) : t14 = $[52];
|
|
2145
2489
|
let t15;
|
|
2146
|
-
return $[
|
|
2490
|
+
return $[53] !== t14 || $[54] !== value ? (t15 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t14 }), $[53] = t14, $[54] = value, $[55] = t15) : t15 = $[55], t15;
|
|
2147
2491
|
}
|
|
2148
2492
|
function MenuButton(props) {
|
|
2149
2493
|
const $ = c(57), {
|
|
@@ -2300,7 +2644,7 @@ function useMenu() {
|
|
|
2300
2644
|
const value = use(MenuContext);
|
|
2301
2645
|
if (!value)
|
|
2302
2646
|
throw new Error("useMenu(): missing context value");
|
|
2303
|
-
if (!isRecord(value) || value.version !==
|
|
2647
|
+
if (!isRecord(value) || value.version !== 2)
|
|
2304
2648
|
throw new Error("useMenu(): the context value is not compatible");
|
|
2305
2649
|
return value;
|
|
2306
2650
|
}
|
|
@@ -2709,7 +3053,7 @@ function _temp$5() {
|
|
|
2709
3053
|
return !0;
|
|
2710
3054
|
}
|
|
2711
3055
|
const subscribe = () => () => {
|
|
2712
|
-
}, ToastContext = createGlobalScopedContext("@sanity/ui/
|
|
3056
|
+
}, ToastContext = createGlobalScopedContext("@sanity/ui/v4/toast", null), DEFAULT_GRID_ELEMENT = "div";
|
|
2713
3057
|
function Grid(props) {
|
|
2714
3058
|
const $ = c(8), t0 = props;
|
|
2715
3059
|
let children, rest, t1;
|
|
@@ -2864,7 +3208,7 @@ function _focusItemElement(el) {
|
|
|
2864
3208
|
firstChild && firstChild instanceof HTMLElement && firstChild.focus();
|
|
2865
3209
|
}
|
|
2866
3210
|
}
|
|
2867
|
-
const TreeContext = createGlobalScopedContext("@sanity/ui/
|
|
3211
|
+
const TreeContext = createGlobalScopedContext("@sanity/ui/v4/tree", null), DEFAULT_TREE_ELEMENT = "div";
|
|
2868
3212
|
function Tree(props) {
|
|
2869
3213
|
const $ = c(38), t0 = props;
|
|
2870
3214
|
let children, forwardedRef, onFocus, rest, t1;
|
|
@@ -3038,97 +3382,135 @@ const TreeGroup = function(props) {
|
|
|
3038
3382
|
return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.gap ? (t3 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.gap, $[8] = t3) : t3 = $[8], t3;
|
|
3039
3383
|
}, DEFAULT_TREE_ITEM_ELEMENT = "a";
|
|
3040
3384
|
function TreeItem(props) {
|
|
3041
|
-
const
|
|
3385
|
+
const $ = c(129), t0 = props;
|
|
3386
|
+
let IconComponent, children, className, href, idProp, muted, onClick, rest, t1, t2, t3, t4, t5, t6, t7, text2, weight;
|
|
3387
|
+
$[0] !== t0 ? ({
|
|
3042
3388
|
children,
|
|
3043
3389
|
className,
|
|
3044
|
-
expanded:
|
|
3045
|
-
fontSize
|
|
3390
|
+
expanded: t1,
|
|
3391
|
+
fontSize: t2,
|
|
3046
3392
|
href,
|
|
3047
3393
|
icon: IconComponent,
|
|
3048
3394
|
id: idProp,
|
|
3049
|
-
linkAs
|
|
3395
|
+
linkAs: t3,
|
|
3050
3396
|
muted,
|
|
3051
3397
|
onClick,
|
|
3052
|
-
padding
|
|
3053
|
-
radius
|
|
3054
|
-
selected
|
|
3055
|
-
space
|
|
3398
|
+
padding: t4,
|
|
3399
|
+
radius: t5,
|
|
3400
|
+
selected: t6,
|
|
3401
|
+
space: t7,
|
|
3056
3402
|
text: text2,
|
|
3057
3403
|
weight,
|
|
3058
3404
|
...rest
|
|
3059
|
-
} =
|
|
3405
|
+
} = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = className, $[4] = href, $[5] = idProp, $[6] = muted, $[7] = onClick, $[8] = rest, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4, $[13] = t5, $[14] = t6, $[15] = t7, $[16] = text2, $[17] = weight) : (IconComponent = $[1], children = $[2], className = $[3], href = $[4], idProp = $[5], muted = $[6], onClick = $[7], rest = $[8], t1 = $[9], t2 = $[10], t3 = $[11], t4 = $[12], t5 = $[13], t6 = $[14], t7 = $[15], text2 = $[16], weight = $[17]);
|
|
3406
|
+
const expandedProp = t1 === void 0 ? !1 : t1, fontSize = t2 === void 0 ? 1 : t2, linkAs = t3 === void 0 ? "a" : t3, padding = t4 === void 0 ? 2 : t4, radius = t5 === void 0 ? 2 : t5, selected = t6 === void 0 ? !1 : t6, space = t7 === void 0 ? 2 : t7, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
|
|
3060
3407
|
path,
|
|
3061
3408
|
registerItem,
|
|
3062
3409
|
setExpanded,
|
|
3063
3410
|
setFocusedElement
|
|
3064
|
-
} = tree, _id = useId(), id = idProp || _id
|
|
3411
|
+
} = tree, _id = useId(), id = idProp || _id;
|
|
3412
|
+
let t8, t9;
|
|
3413
|
+
if ($[18] !== id || $[19] !== path) {
|
|
3414
|
+
const itemPath = path.concat([id || ""]);
|
|
3415
|
+
t8 = itemPath, t9 = itemPath.join("/"), $[18] = id, $[19] = path, $[20] = t8, $[21] = t9;
|
|
3416
|
+
} else
|
|
3417
|
+
t8 = $[20], t9 = $[21];
|
|
3418
|
+
let t10;
|
|
3419
|
+
$[22] !== t8 || $[23] !== t9 ? (t10 = [t8, t9], $[22] = t8, $[23] = t9, $[24] = t10) : t10 = $[24];
|
|
3420
|
+
const [itemPath_0, itemKey] = t10, itemState = tree.state[itemKey], expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, focused = tree.focusedElement && tree.focusedElement === rootElement, tabIndex = focused ? 0 : -1, t11 = tree.level + 1;
|
|
3421
|
+
let t12;
|
|
3422
|
+
$[25] !== itemPath_0 || $[26] !== t11 || $[27] !== tree ? (t12 = {
|
|
3065
3423
|
...tree,
|
|
3066
|
-
level:
|
|
3067
|
-
path:
|
|
3068
|
-
}
|
|
3424
|
+
level: t11,
|
|
3425
|
+
path: itemPath_0
|
|
3426
|
+
}, $[25] = itemPath_0, $[26] = t11, $[27] = tree, $[28] = t12) : t12 = $[28];
|
|
3427
|
+
const contextValue = t12;
|
|
3428
|
+
let t13;
|
|
3429
|
+
$[29] !== expanded || $[30] !== itemKey || $[31] !== onClick || $[32] !== rootElement || $[33] !== setExpanded || $[34] !== setFocusedElement ? (t13 = (event) => {
|
|
3069
3430
|
onClick && onClick(event);
|
|
3070
3431
|
const target = event.target;
|
|
3071
|
-
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(
|
|
3072
|
-
}, [expanded, itemKey, onClick, setExpanded, setFocusedElement
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3432
|
+
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
3433
|
+
}, $[29] = expanded, $[30] = itemKey, $[31] = onClick, $[32] = rootElement, $[33] = setExpanded, $[34] = setFocusedElement, $[35] = t13) : t13 = $[35];
|
|
3434
|
+
const handleClick = t13;
|
|
3435
|
+
let t14;
|
|
3436
|
+
$[36] !== focused || $[37] !== rootElement ? (t14 = (event_0) => {
|
|
3437
|
+
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
3438
|
+
}, $[36] = focused, $[37] = rootElement, $[38] = t14) : t14 = $[38];
|
|
3439
|
+
const handleKeyDown = t14;
|
|
3440
|
+
let t15, t16;
|
|
3441
|
+
$[39] !== expanded || $[40] !== itemKey || $[41] !== registerItem || $[42] !== rootElement || $[43] !== selected ? (t15 = () => {
|
|
3442
|
+
if (rootElement)
|
|
3443
|
+
return registerItem(rootElement, itemKey, expanded, selected);
|
|
3444
|
+
}, t16 = [expanded, itemKey, registerItem, rootElement, selected], $[39] = expanded, $[40] = itemKey, $[41] = registerItem, $[42] = rootElement, $[43] = selected, $[44] = t15, $[45] = t16) : (t15 = $[44], t16 = $[45]), useEffect(t15, t16);
|
|
3445
|
+
const t17 = IconComponent || children ? "visible" : "hidden";
|
|
3446
|
+
let t18;
|
|
3447
|
+
$[46] !== t17 ? (t18 = {
|
|
3448
|
+
visibility: t17,
|
|
3449
|
+
pointerEvents: "none"
|
|
3450
|
+
}, $[46] = t17, $[47] = t18) : t18 = $[47];
|
|
3451
|
+
let t19;
|
|
3452
|
+
$[48] !== IconComponent || $[49] !== fontSize || $[50] !== muted || $[51] !== weight ? (t19 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[48] = IconComponent, $[49] = fontSize, $[50] = muted, $[51] = weight, $[52] = t19) : t19 = $[52];
|
|
3453
|
+
let t20;
|
|
3454
|
+
$[53] !== IconComponent || $[54] !== expanded || $[55] !== fontSize || $[56] !== muted || $[57] !== weight ? (t20 = !IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
|
|
3455
|
+
transform: expanded ? "rotate(90deg)" : void 0
|
|
3456
|
+
} }) }), $[53] = IconComponent, $[54] = expanded, $[55] = fontSize, $[56] = muted, $[57] = weight, $[58] = t20) : t20 = $[58];
|
|
3457
|
+
let t21;
|
|
3458
|
+
$[59] !== t18 || $[60] !== t19 || $[61] !== t20 ? (t21 = /* @__PURE__ */ jsxs(Box, { style: t18, children: [
|
|
3459
|
+
t19,
|
|
3460
|
+
t20
|
|
3461
|
+
] }), $[59] = t18, $[60] = t19, $[61] = t20, $[62] = t21) : t21 = $[62];
|
|
3462
|
+
let t22;
|
|
3463
|
+
$[63] !== fontSize || $[64] !== muted || $[65] !== text2 || $[66] !== weight ? (t22 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text2 }) }), $[63] = fontSize, $[64] = muted, $[65] = text2, $[66] = weight, $[67] = t22) : t22 = $[67];
|
|
3464
|
+
let t23;
|
|
3465
|
+
$[68] !== padding || $[69] !== space || $[70] !== t21 || $[71] !== t22 ? (t23 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
|
|
3466
|
+
t21,
|
|
3467
|
+
t22
|
|
3468
|
+
] }), $[68] = padding, $[69] = space, $[70] = t21, $[71] = t22, $[72] = t23) : t23 = $[72];
|
|
3469
|
+
const content2 = t23;
|
|
3470
|
+
if (href) {
|
|
3471
|
+
const t242 = selected ? "" : void 0, t252 = rest;
|
|
3472
|
+
let t262;
|
|
3473
|
+
$[73] !== className ? (t262 = treeItem({
|
|
3474
|
+
className
|
|
3475
|
+
}), $[73] = className, $[74] = t262) : t262 = $[74];
|
|
3476
|
+
const t272 = `calc(${vars.space[2]} * ${tree.level})`;
|
|
3477
|
+
let t282;
|
|
3478
|
+
$[75] !== t272 ? (t282 = {
|
|
3479
|
+
paddingLeft: t272
|
|
3480
|
+
}, $[75] = t272, $[76] = t282) : t282 = $[76];
|
|
3481
|
+
let t292;
|
|
3482
|
+
$[77] !== content2 || $[78] !== expanded || $[79] !== href || $[80] !== linkAs || $[81] !== radius || $[82] !== selected || $[83] !== t282 || $[84] !== tabIndex ? (t292 = /* @__PURE__ */ jsx(Selectable, { "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, radius, ref: treeitemRef, role: "treeitem", selected, tabIndex, style: t282, children: content2 }), $[77] = content2, $[78] = expanded, $[79] = href, $[80] = linkAs, $[81] = radius, $[82] = selected, $[83] = t282, $[84] = tabIndex, $[85] = t292) : t292 = $[85];
|
|
3483
|
+
let t302;
|
|
3484
|
+
$[86] !== children || $[87] !== expanded ? (t302 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[86] = children, $[87] = expanded, $[88] = t302) : t302 = $[88];
|
|
3485
|
+
let t312;
|
|
3486
|
+
$[89] !== contextValue || $[90] !== t302 ? (t312 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t302 }), $[89] = contextValue, $[90] = t302, $[91] = t312) : t312 = $[91];
|
|
3487
|
+
let t322;
|
|
3488
|
+
return $[92] !== handleClick || $[93] !== id || $[94] !== itemKey || $[95] !== t242 || $[96] !== t252 || $[97] !== t262 || $[98] !== t292 || $[99] !== t312 ? (t322 = /* @__PURE__ */ jsxs(Box, { "data-selected": t242, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...t252, as: "li", className: t262, onClick: handleClick, ref: setRootElement, role: "none", children: [
|
|
3489
|
+
t292,
|
|
3490
|
+
t312
|
|
3491
|
+
] }), $[92] = handleClick, $[93] = id, $[94] = itemKey, $[95] = t242, $[96] = t252, $[97] = t262, $[98] = t292, $[99] = t312, $[100] = t322) : t322 = $[100], t322;
|
|
3492
|
+
}
|
|
3493
|
+
const t24 = selected ? "" : void 0, t25 = rest;
|
|
3494
|
+
let t26;
|
|
3495
|
+
$[101] !== className ? (t26 = treeItem({
|
|
3114
3496
|
className
|
|
3115
|
-
}),
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
] });
|
|
3497
|
+
}), $[101] = className, $[102] = t26) : t26 = $[102];
|
|
3498
|
+
const t27 = focused ? "" : void 0, t28 = `calc(${vars.space[2]} * ${tree.level})`;
|
|
3499
|
+
let t29;
|
|
3500
|
+
$[103] !== t28 ? (t29 = {
|
|
3501
|
+
paddingLeft: t28
|
|
3502
|
+
}, $[103] = t28, $[104] = t29) : t29 = $[104];
|
|
3503
|
+
let t30;
|
|
3504
|
+
$[105] !== content2 || $[106] !== radius || $[107] !== selected || $[108] !== t27 || $[109] !== t29 ? (t30 = /* @__PURE__ */ jsx(Selectable, { as: "button", "data-focused": t27, "data-ui": "TreeItem__box", radius, selected, style: t29, children: content2 }), $[105] = content2, $[106] = radius, $[107] = selected, $[108] = t27, $[109] = t29, $[110] = t30) : t30 = $[110];
|
|
3505
|
+
let t31;
|
|
3506
|
+
$[111] !== children || $[112] !== expanded ? (t31 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[111] = children, $[112] = expanded, $[113] = t31) : t31 = $[113];
|
|
3507
|
+
let t32;
|
|
3508
|
+
$[114] !== contextValue || $[115] !== t31 ? (t32 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t31 }), $[114] = contextValue, $[115] = t31, $[116] = t32) : t32 = $[116];
|
|
3509
|
+
let t33;
|
|
3510
|
+
return $[117] !== expanded || $[118] !== handleClick || $[119] !== handleKeyDown || $[120] !== id || $[121] !== itemKey || $[122] !== t24 || $[123] !== t25 || $[124] !== t26 || $[125] !== t30 || $[126] !== t32 || $[127] !== tabIndex ? (t33 = /* @__PURE__ */ jsxs(Box, { "data-selected": t24, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...t25, "aria-expanded": expanded, className: t26, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
|
|
3511
|
+
t30,
|
|
3512
|
+
t32
|
|
3513
|
+
] }), $[117] = expanded, $[118] = handleClick, $[119] = handleKeyDown, $[120] = id, $[121] = itemKey, $[122] = t24, $[123] = t25, $[124] = t26, $[125] = t30, $[126] = t32, $[127] = tabIndex, $[128] = t33) : t33 = $[128], t33;
|
|
3132
3514
|
}
|
|
3133
3515
|
function _isScrollable(el) {
|
|
3134
3516
|
if (!(el instanceof Element)) return !1;
|
|
@@ -3137,21 +3519,32 @@ function _isScrollable(el) {
|
|
|
3137
3519
|
}
|
|
3138
3520
|
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
|
|
3139
3521
|
function VirtualList(props) {
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
|
|
3522
|
+
const $ = c(44), t0 = props;
|
|
3523
|
+
let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
|
|
3524
|
+
$[0] !== t0 ? ({
|
|
3525
|
+
as: t1,
|
|
3526
|
+
gap: t2,
|
|
3143
3527
|
getItemKey,
|
|
3144
|
-
items
|
|
3528
|
+
items: t3,
|
|
3145
3529
|
onChange,
|
|
3146
3530
|
renderItem,
|
|
3147
3531
|
ref: forwardedRef,
|
|
3148
3532
|
...rest
|
|
3149
|
-
} =
|
|
3150
|
-
|
|
3151
|
-
|
|
3533
|
+
} = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
|
|
3534
|
+
const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
|
|
3535
|
+
let t4;
|
|
3536
|
+
$[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
|
|
3537
|
+
const items = t4, ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1), [gapValue, setGapValue] = useState(0);
|
|
3538
|
+
let t5;
|
|
3539
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], useImperativeHandle(forwardedRef, t5);
|
|
3540
|
+
let t6, t7;
|
|
3541
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
|
|
3542
|
+
if (!ref.current)
|
|
3543
|
+
return;
|
|
3152
3544
|
const scrollEl = findScrollable(ref.current.parentNode);
|
|
3153
3545
|
if (scrollEl) {
|
|
3154
|
-
if (!(scrollEl instanceof HTMLElement))
|
|
3546
|
+
if (!(scrollEl instanceof HTMLElement))
|
|
3547
|
+
return;
|
|
3155
3548
|
const handleScroll = () => {
|
|
3156
3549
|
setScrollTop(scrollEl.scrollTop);
|
|
3157
3550
|
};
|
|
@@ -3175,9 +3568,10 @@ function VirtualList(props) {
|
|
|
3175
3568
|
}), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
|
|
3176
3569
|
window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
|
|
3177
3570
|
};
|
|
3178
|
-
}, []);
|
|
3571
|
+
}, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), useEffect(t6, t7);
|
|
3179
3572
|
const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
|
|
3180
|
-
|
|
3573
|
+
let t8, t9;
|
|
3574
|
+
$[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
|
|
3181
3575
|
onChange?.({
|
|
3182
3576
|
fromIndex,
|
|
3183
3577
|
gap: gapValue,
|
|
@@ -3186,23 +3580,90 @@ function VirtualList(props) {
|
|
|
3186
3580
|
scrollTop,
|
|
3187
3581
|
toIndex
|
|
3188
3582
|
});
|
|
3189
|
-
}, [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex]), useEffect(
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
]
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3583
|
+
}, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), useEffect(t8, t9);
|
|
3584
|
+
let t10;
|
|
3585
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => {
|
|
3586
|
+
startTransition(() => setItemHeight(-1));
|
|
3587
|
+
}, $[23] = t10) : t10 = $[23];
|
|
3588
|
+
let t11;
|
|
3589
|
+
$[24] !== renderItem ? (t11 = [renderItem], $[24] = renderItem, $[25] = t11) : t11 = $[25], useEffect(t10, t11);
|
|
3590
|
+
let t12;
|
|
3591
|
+
$[26] !== fromIndex || $[27] !== gap || $[28] !== gapValue || $[29] !== getItemKey || $[30] !== itemHeight || $[31] !== items || $[32] !== renderItem || $[33] !== toIndex ? (t12 = {
|
|
3592
|
+
fromIndex,
|
|
3593
|
+
gap,
|
|
3594
|
+
getItemKey,
|
|
3595
|
+
itemHeight,
|
|
3596
|
+
items,
|
|
3597
|
+
renderItem,
|
|
3598
|
+
toIndex,
|
|
3599
|
+
gapValue,
|
|
3600
|
+
setGapValue,
|
|
3601
|
+
setItemHeight
|
|
3602
|
+
}, $[26] = fromIndex, $[27] = gap, $[28] = gapValue, $[29] = getItemKey, $[30] = itemHeight, $[31] = items, $[32] = renderItem, $[33] = toIndex, $[34] = t12) : t12 = $[34];
|
|
3603
|
+
const children = useChildren(t12);
|
|
3604
|
+
let t13;
|
|
3605
|
+
$[35] !== height ? (t13 = {
|
|
3203
3606
|
height
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3607
|
+
}, $[35] = height, $[36] = t13) : t13 = $[36];
|
|
3608
|
+
const wrapperStyle = t13;
|
|
3609
|
+
let t14;
|
|
3610
|
+
$[37] !== children || $[38] !== wrapperStyle ? (t14 = /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[37] = children, $[38] = wrapperStyle, $[39] = t14) : t14 = $[39];
|
|
3611
|
+
let t15;
|
|
3612
|
+
return $[40] !== as || $[41] !== rest || $[42] !== t14 ? (t15 = /* @__PURE__ */ jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t14 }), $[40] = as, $[41] = rest, $[42] = t14, $[43] = t15) : t15 = $[43], t15;
|
|
3613
|
+
}
|
|
3614
|
+
function useChildren(t0) {
|
|
3615
|
+
const $ = c(32), {
|
|
3616
|
+
fromIndex,
|
|
3617
|
+
gap,
|
|
3618
|
+
getItemKey,
|
|
3619
|
+
itemHeight,
|
|
3620
|
+
items,
|
|
3621
|
+
renderItem,
|
|
3622
|
+
toIndex,
|
|
3623
|
+
gapValue,
|
|
3624
|
+
setGapValue,
|
|
3625
|
+
setItemHeight
|
|
3626
|
+
} = t0;
|
|
3627
|
+
if (!renderItem || items.length === 0)
|
|
3628
|
+
return null;
|
|
3629
|
+
if (itemHeight === -1) {
|
|
3630
|
+
let t12;
|
|
3631
|
+
$[0] !== setItemHeight ? (t12 = (el) => {
|
|
3632
|
+
el && setItemHeight(el.offsetHeight);
|
|
3633
|
+
}, $[0] = setItemHeight, $[1] = t12) : t12 = $[1];
|
|
3634
|
+
let t2;
|
|
3635
|
+
$[2] !== items[0] || $[3] !== renderItem ? (t2 = renderItem(items[0]), $[2] = items[0], $[3] = renderItem, $[4] = t2) : t2 = $[4];
|
|
3636
|
+
let t3;
|
|
3637
|
+
$[5] !== t12 || $[6] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { ref: t12, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t2 }, 0), $[5] = t12, $[6] = t2, $[7] = t3) : t3 = $[7];
|
|
3638
|
+
let t4;
|
|
3639
|
+
$[8] !== setGapValue ? (t4 = (el_0) => {
|
|
3640
|
+
el_0 && setGapValue(el_0.offsetHeight);
|
|
3641
|
+
}, $[8] = setGapValue, $[9] = t4) : t4 = $[9];
|
|
3642
|
+
const t5 = vars.space[gap];
|
|
3643
|
+
let t6;
|
|
3644
|
+
$[10] !== t5 ? (t6 = {
|
|
3645
|
+
height: t5
|
|
3646
|
+
}, $[10] = t5, $[11] = t6) : t6 = $[11];
|
|
3647
|
+
let t7;
|
|
3648
|
+
$[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsx("div", { ref: t4, style: t6 }), $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14];
|
|
3649
|
+
let t8;
|
|
3650
|
+
return $[15] !== t3 || $[16] !== t7 ? (t8 = [/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3651
|
+
t3,
|
|
3652
|
+
t7
|
|
3653
|
+
] })], $[15] = t3, $[16] = t7, $[17] = t8) : t8 = $[17], t8;
|
|
3654
|
+
}
|
|
3655
|
+
let t1;
|
|
3656
|
+
if ($[18] !== fromIndex || $[19] !== gapValue || $[20] !== getItemKey || $[21] !== itemHeight || $[22] !== items || $[23] !== renderItem || $[24] !== toIndex) {
|
|
3657
|
+
let t2;
|
|
3658
|
+
$[26] !== fromIndex || $[27] !== gapValue || $[28] !== getItemKey || $[29] !== itemHeight || $[30] !== renderItem ? (t2 = (item, _itemIndex) => {
|
|
3659
|
+
const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
|
|
3660
|
+
return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
|
|
3661
|
+
top: itemIndex * (itemHeight + gapValue)
|
|
3662
|
+
}, children: node }, key2);
|
|
3663
|
+
}, $[26] = fromIndex, $[27] = gapValue, $[28] = getItemKey, $[29] = itemHeight, $[30] = renderItem, $[31] = t2) : t2 = $[31], t1 = items.slice(fromIndex, toIndex).map(t2), $[18] = fromIndex, $[19] = gapValue, $[20] = getItemKey, $[21] = itemHeight, $[22] = items, $[23] = renderItem, $[24] = toIndex, $[25] = t1;
|
|
3664
|
+
} else
|
|
3665
|
+
t1 = $[25];
|
|
3666
|
+
return t1;
|
|
3206
3667
|
}
|
|
3207
3668
|
function findScrollable(parentNode) {
|
|
3208
3669
|
let _scrollEl = parentNode;
|
|
@@ -3719,7 +4180,7 @@ function Skeleton(props) {
|
|
|
3719
4180
|
let t2, t3;
|
|
3720
4181
|
$[0] !== delay ? (t2 = () => {
|
|
3721
4182
|
if (!delay)
|
|
3722
|
-
return
|
|
4183
|
+
return;
|
|
3723
4184
|
const timeout = setTimeout(() => {
|
|
3724
4185
|
setVisible(!0);
|
|
3725
4186
|
}, delay);
|
|
@@ -3730,7 +4191,7 @@ function Skeleton(props) {
|
|
|
3730
4191
|
const t4 = "Skeleton", t5 = skeleton({
|
|
3731
4192
|
className,
|
|
3732
4193
|
...rest
|
|
3733
|
-
}), t6 = animated ? "" : void 0, t7 = visible ? "" : void 0;
|
|
4194
|
+
}), t6 = animated ? "" : void 0, t7 = !delay || visible ? "" : void 0;
|
|
3734
4195
|
let t8;
|
|
3735
4196
|
return $[3] !== As || $[4] !== rest || $[5] !== t5 || $[6] !== t6 || $[7] !== t7 ? (t8 = /* @__PURE__ */ jsx(As, { "data-ui": t4, ...rest, className: t5, "data-animated": t6, "data-visible": t7 }), $[3] = As, $[4] = rest, $[5] = t5, $[6] = t6, $[7] = t7, $[8] = t8) : t8 = $[8], t8;
|
|
3736
4197
|
}
|
|
@@ -3941,7 +4402,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
3941
4402
|
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
3942
4403
|
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
3943
4404
|
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
3944
|
-
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/
|
|
4405
|
+
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v4/tooltipDelayGroup", null);
|
|
3945
4406
|
function useTooltipDelayGroup() {
|
|
3946
4407
|
return use(TooltipDelayGroupContext);
|
|
3947
4408
|
}
|
|
@@ -3999,64 +4460,71 @@ function TooltipLayer(props) {
|
|
|
3999
4460
|
}
|
|
4000
4461
|
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
4001
4462
|
function Tooltip(props) {
|
|
4002
|
-
const boundaryElementContext = useBoundaryElement(),
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4463
|
+
const $ = c(143), boundaryElementContext = useBoundaryElement(), t0 = props;
|
|
4464
|
+
let _boundaryElement, _fallbackPlacements, childProp, className, content2, delay, disabled, forwardedRef, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, t8, t9;
|
|
4465
|
+
$[0] !== t0 ? ({
|
|
4466
|
+
animate: t1,
|
|
4467
|
+
arrow: t2,
|
|
4468
|
+
as: t3,
|
|
4469
|
+
boundaryElement: _boundaryElement,
|
|
4007
4470
|
children: childProp,
|
|
4008
4471
|
className,
|
|
4009
4472
|
content: content2,
|
|
4010
4473
|
delay,
|
|
4011
4474
|
disabled,
|
|
4012
|
-
fallbackPlacements
|
|
4013
|
-
padding
|
|
4014
|
-
placement:
|
|
4475
|
+
fallbackPlacements: _fallbackPlacements,
|
|
4476
|
+
padding: t4,
|
|
4477
|
+
placement: t5,
|
|
4015
4478
|
portal: portalProp,
|
|
4016
|
-
radius
|
|
4479
|
+
radius: t6,
|
|
4017
4480
|
ref: forwardedRef,
|
|
4018
4481
|
scheme,
|
|
4019
|
-
shadow
|
|
4020
|
-
zOffset
|
|
4021
|
-
tone
|
|
4482
|
+
shadow: t7,
|
|
4483
|
+
zOffset: t8,
|
|
4484
|
+
tone: t9,
|
|
4022
4485
|
...rest
|
|
4023
|
-
} =
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4486
|
+
} = t0, $[0] = t0, $[1] = _boundaryElement, $[2] = _fallbackPlacements, $[3] = childProp, $[4] = className, $[5] = content2, $[6] = delay, $[7] = disabled, $[8] = forwardedRef, $[9] = portalProp, $[10] = rest, $[11] = scheme, $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t4, $[16] = t5, $[17] = t6, $[18] = t7, $[19] = t8, $[20] = t9) : (_boundaryElement = $[1], _fallbackPlacements = $[2], childProp = $[3], className = $[4], content2 = $[5], delay = $[6], disabled = $[7], forwardedRef = $[8], portalProp = $[9], rest = $[10], scheme = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16], t6 = $[17], t7 = $[18], t8 = $[19], t9 = $[20]);
|
|
4487
|
+
const _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_TOOLTIP_ELEMENT : t3, padding = t4 === void 0 ? 2 : t4, placementProp = t5 === void 0 ? "bottom" : t5, radius = t6 === void 0 ? 3 : t6, shadow = t7 === void 0 ? 2 : t7, zOffset = t8 === void 0 ? Z_OFFSETS.tooltip : t8, tone = t9 === void 0 ? "inherit" : t9, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
|
|
4488
|
+
let t10;
|
|
4489
|
+
$[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => ref.current, $[21] = t10) : t10 = $[21], useImperativeHandle(forwardedRef, t10);
|
|
4490
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element;
|
|
4491
|
+
let t11;
|
|
4492
|
+
$[22] !== animate || $[23] !== arrowProp || $[24] !== boundaryElement || $[25] !== fallbackPlacements ? (t11 = {
|
|
4493
|
+
animate,
|
|
4494
|
+
arrowProp,
|
|
4495
|
+
arrowRef,
|
|
4496
|
+
boundaryElement,
|
|
4497
|
+
fallbackPlacements,
|
|
4498
|
+
rootBoundary: "viewport"
|
|
4499
|
+
}, $[22] = animate, $[23] = arrowProp, $[24] = boundaryElement, $[25] = fallbackPlacements, $[26] = t11) : t11 = $[26];
|
|
4500
|
+
const middleware = useMiddleware(t11);
|
|
4501
|
+
let t12;
|
|
4502
|
+
$[27] !== referenceElement ? (t12 = {
|
|
4503
|
+
reference: referenceElement
|
|
4504
|
+
}, $[27] = referenceElement, $[28] = t12) : t12 = $[28];
|
|
4505
|
+
let t13;
|
|
4506
|
+
$[29] !== middleware || $[30] !== placementProp || $[31] !== t12 ? (t13 = {
|
|
4507
|
+
middleware,
|
|
4508
|
+
placement: placementProp,
|
|
4509
|
+
whileElementsMounted: autoUpdate,
|
|
4510
|
+
elements: t12,
|
|
4511
|
+
transform: !1
|
|
4512
|
+
}, $[29] = middleware, $[30] = placementProp, $[31] = t12, $[32] = t13) : t13 = $[32];
|
|
4513
|
+
const {
|
|
4043
4514
|
floatingStyles,
|
|
4044
4515
|
placement,
|
|
4045
4516
|
middlewareData,
|
|
4046
4517
|
refs,
|
|
4047
4518
|
update
|
|
4048
|
-
} = useFloating(
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
elements: {
|
|
4053
|
-
reference: referenceElement
|
|
4054
|
-
},
|
|
4055
|
-
transform: !1
|
|
4056
|
-
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
|
|
4519
|
+
} = useFloating(t13), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup();
|
|
4520
|
+
let t14;
|
|
4521
|
+
$[33] !== delayGroupContext ? (t14 = delayGroupContext || {}, $[33] = delayGroupContext, $[34] = t14) : t14 = $[34];
|
|
4522
|
+
const {
|
|
4057
4523
|
setIsGroupActive,
|
|
4058
4524
|
setOpenTooltipId
|
|
4059
|
-
} =
|
|
4525
|
+
} = t14, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
|
|
4526
|
+
let t15;
|
|
4527
|
+
$[35] !== closeDelay || $[36] !== isInsideGroup || $[37] !== openDelay || $[38] !== setIsGroupActive || $[39] !== setIsOpen || $[40] !== setOpenTooltipId || $[41] !== tooltipId ? (t15 = (open, immediate) => {
|
|
4060
4528
|
if (isInsideGroup)
|
|
4061
4529
|
if (open) {
|
|
4062
4530
|
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
@@ -4067,65 +4535,173 @@ function Tooltip(props) {
|
|
|
4067
4535
|
}
|
|
4068
4536
|
else
|
|
4069
4537
|
setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
4070
|
-
}, [isInsideGroup, openDelay, setIsGroupActive,
|
|
4538
|
+
}, $[35] = closeDelay, $[36] = isInsideGroup, $[37] = openDelay, $[38] = setIsGroupActive, $[39] = setIsOpen, $[40] = setOpenTooltipId, $[41] = tooltipId, $[42] = t15) : t15 = $[42];
|
|
4539
|
+
const handleIsOpenChange = t15;
|
|
4540
|
+
let t16;
|
|
4541
|
+
$[43] !== childProp?.props || $[44] !== handleIsOpenChange ? (t16 = (e) => {
|
|
4071
4542
|
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
4072
|
-
}, [childProp?.props, handleIsOpenChange
|
|
4543
|
+
}, $[43] = childProp?.props, $[44] = handleIsOpenChange, $[45] = t16) : t16 = $[45];
|
|
4544
|
+
const handleBlur = t16;
|
|
4545
|
+
let t17;
|
|
4546
|
+
$[46] !== childProp?.props || $[47] !== handleIsOpenChange ? (t17 = (e_0) => {
|
|
4073
4547
|
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
4074
|
-
}, [childProp?.props, handleIsOpenChange
|
|
4548
|
+
}, $[46] = childProp?.props, $[47] = handleIsOpenChange, $[48] = t17) : t17 = $[48];
|
|
4549
|
+
const handleClick = t17;
|
|
4550
|
+
let t18;
|
|
4551
|
+
$[49] !== childProp?.props || $[50] !== handleIsOpenChange ? (t18 = (e_1) => {
|
|
4075
4552
|
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
4076
|
-
}, [childProp?.props, handleIsOpenChange
|
|
4553
|
+
}, $[49] = childProp?.props, $[50] = handleIsOpenChange, $[51] = t18) : t18 = $[51];
|
|
4554
|
+
const handleContextMenu = t18;
|
|
4555
|
+
let t19;
|
|
4556
|
+
$[52] !== childProp?.props || $[53] !== handleIsOpenChange ? (t19 = (e_2) => {
|
|
4077
4557
|
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
4078
|
-
}, [childProp?.props, handleIsOpenChange
|
|
4558
|
+
}, $[52] = childProp?.props, $[53] = handleIsOpenChange, $[54] = t19) : t19 = $[54];
|
|
4559
|
+
const handleFocus = t19;
|
|
4560
|
+
let t20;
|
|
4561
|
+
$[55] !== childProp?.props || $[56] !== handleIsOpenChange ? (t20 = (e_3) => {
|
|
4079
4562
|
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
4080
|
-
}, [childProp?.props, handleIsOpenChange
|
|
4563
|
+
}, $[55] = childProp?.props, $[56] = handleIsOpenChange, $[57] = t20) : t20 = $[57];
|
|
4564
|
+
const handleMouseEnter = t20;
|
|
4565
|
+
let t21;
|
|
4566
|
+
$[58] !== childProp?.props || $[59] !== handleIsOpenChange ? (t21 = (e_4) => {
|
|
4081
4567
|
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
4082
|
-
}, [childProp?.props, handleIsOpenChange]);
|
|
4083
|
-
|
|
4568
|
+
}, $[58] = childProp?.props, $[59] = handleIsOpenChange, $[60] = t21) : t21 = $[60];
|
|
4569
|
+
const handleMouseLeave = t21;
|
|
4570
|
+
let t22;
|
|
4571
|
+
$[61] !== handleIsOpenChange || $[62] !== isInsideGroup || $[63] !== referenceElement || $[64] !== showTooltip ? (t22 = {
|
|
4084
4572
|
handleIsOpenChange,
|
|
4085
4573
|
referenceElement,
|
|
4086
4574
|
showTooltip,
|
|
4087
4575
|
isInsideGroup
|
|
4088
|
-
}),
|
|
4576
|
+
}, $[61] = handleIsOpenChange, $[62] = isInsideGroup, $[63] = referenceElement, $[64] = showTooltip, $[65] = t22) : t22 = $[65], useCloseOnMouseLeave(t22);
|
|
4577
|
+
let t23, t24;
|
|
4578
|
+
$[66] !== disabled || $[67] !== handleIsOpenChange || $[68] !== showTooltip ? (t23 = () => {
|
|
4089
4579
|
disabled && showTooltip && handleIsOpenChange(!1);
|
|
4090
|
-
}, [disabled, handleIsOpenChange, showTooltip]), useEffect(
|
|
4580
|
+
}, t24 = [disabled, handleIsOpenChange, showTooltip], $[66] = disabled, $[67] = handleIsOpenChange, $[68] = showTooltip, $[69] = t23, $[70] = t24) : (t23 = $[69], t24 = $[70]), useEffect(t23, t24);
|
|
4581
|
+
let t25, t26;
|
|
4582
|
+
$[71] !== content2 || $[72] !== handleIsOpenChange || $[73] !== showTooltip ? (t25 = () => {
|
|
4091
4583
|
!content2 && showTooltip && handleIsOpenChange(!1);
|
|
4092
|
-
}, [content2, handleIsOpenChange, showTooltip]), useEffect(
|
|
4093
|
-
|
|
4094
|
-
|
|
4584
|
+
}, t26 = [content2, handleIsOpenChange, showTooltip], $[71] = content2, $[72] = handleIsOpenChange, $[73] = showTooltip, $[74] = t25, $[75] = t26) : (t25 = $[74], t26 = $[75]), useEffect(t25, t26);
|
|
4585
|
+
let t27, t28;
|
|
4586
|
+
$[76] !== handleIsOpenChange || $[77] !== showTooltip ? (t27 = () => {
|
|
4587
|
+
if (!showTooltip)
|
|
4588
|
+
return;
|
|
4589
|
+
const handleWindowKeyDown = function(event) {
|
|
4095
4590
|
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
4096
|
-
}
|
|
4591
|
+
};
|
|
4097
4592
|
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
4098
4593
|
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
4099
4594
|
};
|
|
4100
|
-
}, [handleIsOpenChange, showTooltip]),
|
|
4595
|
+
}, t28 = [handleIsOpenChange, showTooltip], $[76] = handleIsOpenChange, $[77] = showTooltip, $[78] = t27, $[79] = t28) : (t27 = $[78], t28 = $[79]), useEffect(t27, t28);
|
|
4596
|
+
let t29;
|
|
4597
|
+
$[80] !== boundaryElement || $[81] !== portalElement?.offsetWidth ? (t29 = () => {
|
|
4101
4598
|
const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
4102
4599
|
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
|
|
4103
|
-
}, [boundaryElement, portalElement]);
|
|
4104
|
-
|
|
4600
|
+
}, $[80] = boundaryElement, $[81] = portalElement?.offsetWidth, $[82] = t29) : t29 = $[82];
|
|
4601
|
+
let t30;
|
|
4602
|
+
$[83] !== boundaryElement || $[84] !== portalElement ? (t30 = [boundaryElement, portalElement], $[83] = boundaryElement, $[84] = portalElement, $[85] = t30) : t30 = $[85], useLayoutEffect(t29, t30);
|
|
4603
|
+
let t31;
|
|
4604
|
+
$[86] !== update ? (t31 = (arrowEl) => {
|
|
4105
4605
|
arrowRef.current = arrowEl, update();
|
|
4106
|
-
}, [update
|
|
4606
|
+
}, $[86] = update, $[87] = t31) : t31 = $[87];
|
|
4607
|
+
const setArrow = t31;
|
|
4608
|
+
let t32;
|
|
4609
|
+
$[88] !== refs ? (t32 = (node) => {
|
|
4107
4610
|
ref.current = node, refs.setFloating(node);
|
|
4108
|
-
}, [refs
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4611
|
+
}, $[88] = refs, $[89] = t32) : t32 = $[89];
|
|
4612
|
+
const setFloating = t32;
|
|
4613
|
+
let t33;
|
|
4614
|
+
bb0: {
|
|
4615
|
+
if (!childProp) {
|
|
4616
|
+
t33 = null;
|
|
4617
|
+
break bb0;
|
|
4618
|
+
}
|
|
4619
|
+
let t342;
|
|
4620
|
+
$[90] !== childProp || $[91] !== handleBlur || $[92] !== handleClick || $[93] !== handleContextMenu || $[94] !== handleFocus || $[95] !== handleMouseEnter || $[96] !== handleMouseLeave ? (t342 = cloneElement(childProp, {
|
|
4621
|
+
onBlur: handleBlur,
|
|
4622
|
+
onFocus: handleFocus,
|
|
4623
|
+
onMouseEnter: handleMouseEnter,
|
|
4624
|
+
onMouseLeave: handleMouseLeave,
|
|
4625
|
+
onClick: handleClick,
|
|
4626
|
+
onContextMenu: handleContextMenu,
|
|
4627
|
+
ref: setReferenceElement
|
|
4628
|
+
}), $[90] = childProp, $[91] = handleBlur, $[92] = handleClick, $[93] = handleContextMenu, $[94] = handleFocus, $[95] = handleMouseEnter, $[96] = handleMouseLeave, $[97] = t342) : t342 = $[97], t33 = t342;
|
|
4629
|
+
}
|
|
4630
|
+
const child = t33;
|
|
4631
|
+
let t34;
|
|
4632
|
+
$[98] !== childProp ? (t34 = childProp ? getElementRef(childProp) : null, $[98] = childProp, $[99] = t34) : t34 = $[99];
|
|
4633
|
+
let t35, t36;
|
|
4634
|
+
if ($[100] !== referenceElement ? (t35 = () => referenceElement, t36 = [referenceElement], $[100] = referenceElement, $[101] = t35, $[102] = t36) : (t35 = $[101], t36 = $[102]), useImperativeHandle(t34, t35, t36), !child) {
|
|
4635
|
+
let t372;
|
|
4636
|
+
return $[103] === Symbol.for("react.memo_cache_sentinel") ? (t372 = /* @__PURE__ */ jsx(Fragment, {}), $[103] = t372) : t372 = $[103], t372;
|
|
4637
|
+
}
|
|
4638
|
+
if (disabled)
|
|
4639
|
+
return child;
|
|
4640
|
+
let t37;
|
|
4641
|
+
$[104] !== className ? (t37 = tooltip({
|
|
4120
4642
|
className
|
|
4121
|
-
}),
|
|
4643
|
+
}), $[104] = className, $[105] = t37) : t37 = $[105];
|
|
4644
|
+
const t38 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0;
|
|
4645
|
+
let t39;
|
|
4646
|
+
$[106] !== floatingStyles || $[107] !== t38 ? (t39 = {
|
|
4122
4647
|
...floatingStyles,
|
|
4123
|
-
maxWidth:
|
|
4124
|
-
},
|
|
4125
|
-
|
|
4126
|
-
|
|
4648
|
+
maxWidth: t38
|
|
4649
|
+
}, $[106] = floatingStyles, $[107] = t38, $[108] = t39) : t39 = $[108];
|
|
4650
|
+
let t40;
|
|
4651
|
+
$[109] !== animate || $[110] !== arrowProp || $[111] !== arrowX || $[112] !== arrowY || $[113] !== as || $[114] !== content2 || $[115] !== originX || $[116] !== originY || $[117] !== padding || $[118] !== placement || $[119] !== radius || $[120] !== rest || $[121] !== scheme || $[122] !== setArrow || $[123] !== setFloating || $[124] !== shadow || $[125] !== t37 || $[126] !== t39 || $[127] !== tone || $[128] !== zOffset ? (t40 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: t37, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: t39, tone, zOffset, children: content2 }), $[109] = animate, $[110] = arrowProp, $[111] = arrowX, $[112] = arrowY, $[113] = as, $[114] = content2, $[115] = originX, $[116] = originY, $[117] = padding, $[118] = placement, $[119] = radius, $[120] = rest, $[121] = scheme, $[122] = setArrow, $[123] = setFloating, $[124] = shadow, $[125] = t37, $[126] = t39, $[127] = tone, $[128] = zOffset, $[129] = t40) : t40 = $[129];
|
|
4652
|
+
const node_0 = t40;
|
|
4653
|
+
let t41;
|
|
4654
|
+
$[130] !== card2 || $[131] !== node_0 || $[132] !== portalProp || $[133] !== scheme || $[134] !== showTooltip || $[135] !== tone ? (t41 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0), $[130] = card2, $[131] = node_0, $[132] = portalProp, $[133] = scheme, $[134] = showTooltip, $[135] = tone, $[136] = t41) : t41 = $[136];
|
|
4655
|
+
const children = t41;
|
|
4656
|
+
let t42;
|
|
4657
|
+
$[137] !== animate || $[138] !== children ? (t42 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[137] = animate, $[138] = children, $[139] = t42) : t42 = $[139];
|
|
4658
|
+
let t43;
|
|
4659
|
+
return $[140] !== child || $[141] !== t42 ? (t43 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4660
|
+
t42,
|
|
4127
4661
|
child
|
|
4128
|
-
] });
|
|
4662
|
+
] }), $[140] = child, $[141] = t42, $[142] = t43) : t43 = $[142], t43;
|
|
4663
|
+
}
|
|
4664
|
+
function useMiddleware(t0) {
|
|
4665
|
+
const $ = c(17), {
|
|
4666
|
+
animate,
|
|
4667
|
+
arrowProp,
|
|
4668
|
+
arrowRef,
|
|
4669
|
+
boundaryElement,
|
|
4670
|
+
fallbackPlacements,
|
|
4671
|
+
rootBoundary
|
|
4672
|
+
} = t0;
|
|
4673
|
+
let ret;
|
|
4674
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
|
|
4675
|
+
ret = [];
|
|
4676
|
+
const t1 = boundaryElement || void 0;
|
|
4677
|
+
let t2;
|
|
4678
|
+
$[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
|
|
4679
|
+
boundary: t1,
|
|
4680
|
+
fallbackPlacements,
|
|
4681
|
+
padding: DEFAULT_TOOLTIP_PADDING,
|
|
4682
|
+
rootBoundary
|
|
4683
|
+
}), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
|
|
4684
|
+
let t3;
|
|
4685
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({
|
|
4686
|
+
mainAxis: DEFAULT_TOOLTIP_DISTANCE
|
|
4687
|
+
}), $[11] = t3) : t3 = $[11], ret.push(t3);
|
|
4688
|
+
const t4 = boundaryElement || void 0;
|
|
4689
|
+
let t5;
|
|
4690
|
+
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
4691
|
+
boundary: t4,
|
|
4692
|
+
rootBoundary,
|
|
4693
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
4694
|
+
}), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
|
|
4695
|
+
let t6;
|
|
4696
|
+
$[15] !== arrowRef ? (t6 = arrow({
|
|
4697
|
+
element: arrowRef,
|
|
4698
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
4699
|
+
}), $[15] = arrowRef, $[16] = t6) : t6 = $[16], ret.push(t6);
|
|
4700
|
+
}
|
|
4701
|
+
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
|
|
4702
|
+
} else
|
|
4703
|
+
ret = $[6];
|
|
4704
|
+
return ret;
|
|
4129
4705
|
}
|
|
4130
4706
|
function useCloseOnMouseLeave(t0) {
|
|
4131
4707
|
const $ = c(10), {
|
|
@@ -4256,8 +4832,8 @@ function PortalProvider(props) {
|
|
|
4256
4832
|
const $ = c(9), {
|
|
4257
4833
|
children,
|
|
4258
4834
|
element,
|
|
4259
|
-
__unstable_elements:
|
|
4260
|
-
} = props,
|
|
4835
|
+
__unstable_elements: elements
|
|
4836
|
+
} = props, parentPortal = use(PortalContext);
|
|
4261
4837
|
let t0;
|
|
4262
4838
|
$[0] !== elements || $[1] !== parentPortal ? (t0 = () => elements?.default ?? (parentPortal.element || document.body), $[0] = elements, $[1] = parentPortal, $[2] = t0) : t0 = $[2];
|
|
4263
4839
|
const fallbackElement = useSyncExternalStore(emptySubscribe, t0, _temp), t1 = element || fallbackElement;
|
|
@@ -4270,23 +4846,13 @@ function PortalProvider(props) {
|
|
|
4270
4846
|
}, $[3] = elements, $[4] = t1, $[5] = t2) : t2 = $[5];
|
|
4271
4847
|
const value = t2;
|
|
4272
4848
|
let t3;
|
|
4273
|
-
return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext
|
|
4849
|
+
return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
|
|
4274
4850
|
}
|
|
4275
4851
|
function _temp() {
|
|
4276
4852
|
return null;
|
|
4277
4853
|
}
|
|
4278
4854
|
const emptySubscribe = () => () => {
|
|
4279
4855
|
};
|
|
4280
|
-
function useUnique(value) {
|
|
4281
|
-
const valueRef = useRef(value);
|
|
4282
|
-
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
4283
|
-
}
|
|
4284
|
-
function _isEqual(objA, objB) {
|
|
4285
|
-
if (!objA || !objB)
|
|
4286
|
-
return objA === objB;
|
|
4287
|
-
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
4288
|
-
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
4289
|
-
}
|
|
4290
4856
|
function RootProvider(props) {
|
|
4291
4857
|
const $ = c(10), {
|
|
4292
4858
|
boundaryElement: t0,
|