@sanity/ui 2.3.6-canary.2 → 2.3.6-canary.3
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.compiled.mjs +724 -389
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +160 -161
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +160 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +30 -33
- package/src/core/components/dialog/dialog.tsx +4 -2
- package/src/core/components/menu/menu.tsx +3 -1
- package/src/core/components/menu/menuGroup.tsx +2 -1
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/toast/toastProvider.tsx +26 -24
- package/src/core/components/tree/treeItem.styles.ts +21 -0
- package/src/core/components/tree/treeItem.tsx +31 -44
- package/src/core/primitives/avatar/avatar.tsx +8 -12
- package/src/core/primitives/avatar/avatarCounter.tsx +10 -15
- package/src/core/primitives/avatar/avatarStack.tsx +1 -4
- package/src/core/primitives/popover/popover.tsx +41 -44
- package/src/core/primitives/tooltip/tooltip.tsx +8 -5
- package/src/core/utils/elementQuery/elementQuery.tsx +4 -3
- package/src/core/utils/layer/getLayerContext.test.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -2
- package/src/core/utils/layer/layerProvider.tsx +32 -41
- package/src/core/utils/layer/types.ts +0 -1
package/dist/index.compiled.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { createContext, useContext, forwardRef, useId, useState, useEffect, Children, isValidElement, cloneElement, useRef, useSyncExternalStore, useImperativeHandle, Component, memo, useMemo, useCallback, useReducer, Fragment as Fragment$1, startTransition } from "react";
|
|
4
5
|
import { isValidElementType } from "react-is";
|
|
5
6
|
import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
8
8
|
import Refractor from "react-refractor";
|
|
9
9
|
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
|
|
@@ -1117,50 +1117,61 @@ function avatarStrokeStyle() {
|
|
|
1117
1117
|
const Root$B = styled.div(responsiveAvatarSizeStyle, avatarStyle.root), Arrow$1 = styled.div(avatarStyle.arrow), BgStroke = styled.ellipse(avatarStyle.bgStroke), Stroke = styled.ellipse(avatarStyle.stroke), Initials = styled.div(avatarStyle.initials), InitialsLabel = styled(Label)({
|
|
1118
1118
|
color: "inherit"
|
|
1119
1119
|
}), Image = styled.svg(avatarStyle.image), Avatar = forwardRef(function(props, ref) {
|
|
1120
|
-
const
|
|
1120
|
+
const $ = c(51);
|
|
1121
|
+
let t0, t1, t2, asProp, animateArrowFrom, arrowPositionProp, src, onImageLoadError, __unstable_hideInnerStroke, initials, restProps, title;
|
|
1122
|
+
$[0] !== props ? ({
|
|
1121
1123
|
__unstable_hideInnerStroke,
|
|
1122
1124
|
as: asProp,
|
|
1123
|
-
color
|
|
1125
|
+
color: t0,
|
|
1124
1126
|
src,
|
|
1125
1127
|
title,
|
|
1126
1128
|
initials,
|
|
1127
1129
|
onImageLoadError,
|
|
1128
1130
|
arrowPosition: arrowPositionProp,
|
|
1129
1131
|
animateArrowFrom,
|
|
1130
|
-
status
|
|
1131
|
-
size:
|
|
1132
|
+
status: t1,
|
|
1133
|
+
size: t2,
|
|
1132
1134
|
...restProps
|
|
1133
|
-
} = props,
|
|
1135
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = asProp, $[5] = animateArrowFrom, $[6] = arrowPositionProp, $[7] = src, $[8] = onImageLoadError, $[9] = __unstable_hideInnerStroke, $[10] = initials, $[11] = restProps, $[12] = title) : (t0 = $[1], t1 = $[2], t2 = $[3], asProp = $[4], animateArrowFrom = $[5], arrowPositionProp = $[6], src = $[7], onImageLoadError = $[8], __unstable_hideInnerStroke = $[9], initials = $[10], restProps = $[11], title = $[12]);
|
|
1136
|
+
const color = t0 === void 0 ? "gray" : t0, status = t1 === void 0 ? "online" : t1, sizeProp = t2 === void 0 ? 1 : t2, {
|
|
1134
1137
|
avatar
|
|
1135
|
-
} = useTheme_v2(), as = isValidElementType(asProp) ? asProp : "div", size2 =
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
+
} = useTheme_v2(), as = isValidElementType(asProp) ? asProp : "div", size2 = _getArrayProp(sizeProp), _sizeRem = (avatar.sizes[size2[0]] || avatar.sizes[0]).size, _radius = _sizeRem / 2, elementId = useId(), [arrowPosition, setArrowPosition] = useState(animateArrowFrom || arrowPositionProp || "inside"), [imageFailed, setImageFailed] = useState(!1), imageId = `avatar-image-${elementId}`;
|
|
1139
|
+
let t3, t4;
|
|
1140
|
+
$[13] !== arrowPosition || $[14] !== arrowPositionProp ? (t3 = () => {
|
|
1141
|
+
if (arrowPosition === arrowPositionProp)
|
|
1142
|
+
return;
|
|
1138
1143
|
const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
|
|
1139
1144
|
return () => cancelAnimationFrame(raf);
|
|
1140
|
-
}, [arrowPosition, arrowPositionProp]), useEffect(
|
|
1145
|
+
}, t4 = [arrowPosition, arrowPositionProp], $[13] = arrowPosition, $[14] = arrowPositionProp, $[15] = t3, $[16] = t4) : (t3 = $[15], t4 = $[16]), useEffect(t3, t4);
|
|
1146
|
+
let t5, t6;
|
|
1147
|
+
$[17] !== src ? (t5 = () => {
|
|
1141
1148
|
src && setImageFailed(!1);
|
|
1142
|
-
}, [src]);
|
|
1143
|
-
|
|
1149
|
+
}, t6 = [src], $[17] = src, $[18] = t5, $[19] = t6) : (t5 = $[18], t6 = $[19]), useEffect(t5, t6);
|
|
1150
|
+
let t7;
|
|
1151
|
+
$[20] !== onImageLoadError ? (t7 = () => {
|
|
1144
1152
|
setImageFailed(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
|
|
1145
|
-
}, [onImageLoadError
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1153
|
+
}, $[20] = onImageLoadError, $[21] = t7) : t7 = $[21];
|
|
1154
|
+
const handleImageError = t7;
|
|
1155
|
+
let t8;
|
|
1156
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t8 = (s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0, $[22] = t8) : t8 = $[22];
|
|
1157
|
+
const initialsSize = size2.map(t8), t9 = typeof as == "string" ? as : void 0;
|
|
1158
|
+
let t10;
|
|
1159
|
+
$[23] !== color ? (t10 = /* @__PURE__ */ jsx(Arrow$1, { children: /* @__PURE__ */ jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[23] = color, $[24] = t10) : t10 = $[24];
|
|
1160
|
+
let t11;
|
|
1161
|
+
$[25] !== imageFailed || $[26] !== src || $[27] !== _sizeRem || $[28] !== handleImageError || $[29] !== imageId || $[30] !== _radius || $[31] !== __unstable_hideInnerStroke ? (t11 = !imageFailed && src && /* @__PURE__ */ jsxs(Image, { viewBox: `0 0 ${_sizeRem} ${_sizeRem}`, fill: "none", children: [
|
|
1162
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", { id: imageId, patternContentUnits: "objectBoundingBox", width: "1", height: "1", children: /* @__PURE__ */ jsx("image", { href: src, width: "1", height: "1", onError: handleImageError }) }) }),
|
|
1163
|
+
/* @__PURE__ */ jsx("circle", { cx: _radius, cy: _radius, r: _radius, fill: `url(#${imageId})` }),
|
|
1164
|
+
!__unstable_hideInnerStroke && /* @__PURE__ */ jsx(BgStroke, { cx: _radius, cy: _radius, rx: _radius, ry: _radius, vectorEffect: "non-scaling-stroke" }),
|
|
1165
|
+
/* @__PURE__ */ jsx(Stroke, { cx: _radius, cy: _radius, rx: _radius, ry: _radius, vectorEffect: "non-scaling-stroke" })
|
|
1166
|
+
] }), $[25] = imageFailed, $[26] = src, $[27] = _sizeRem, $[28] = handleImageError, $[29] = imageId, $[30] = _radius, $[31] = __unstable_hideInnerStroke, $[32] = t11) : t11 = $[32];
|
|
1167
|
+
let t12;
|
|
1168
|
+
$[33] !== imageFailed || $[34] !== src || $[35] !== initials || $[36] !== initialsSize ? (t12 = (imageFailed || !src) && initials && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Initials, { children: /* @__PURE__ */ jsx(InitialsLabel, { forwardedAs: "span", size: initialsSize, weight: "medium", children: initials }) }) }), $[33] = imageFailed, $[34] = src, $[35] = initials, $[36] = initialsSize, $[37] = t12) : t12 = $[37];
|
|
1169
|
+
let t13;
|
|
1170
|
+
return $[38] !== as || $[39] !== t9 || $[40] !== restProps || $[41] !== color || $[42] !== size2 || $[43] !== title || $[44] !== arrowPosition || $[45] !== status || $[46] !== ref || $[47] !== t10 || $[48] !== t11 || $[49] !== t12 ? (t13 = /* @__PURE__ */ jsxs(Root$B, { as, "data-as": t9, "data-ui": "Avatar", ...restProps, $color: color, $size: size2, "aria-label": title, "data-arrow-position": arrowPosition, "data-status": status, ref, title, children: [
|
|
1171
|
+
t10,
|
|
1172
|
+
t11,
|
|
1173
|
+
t12
|
|
1174
|
+
] }), $[38] = as, $[39] = t9, $[40] = restProps, $[41] = color, $[42] = size2, $[43] = title, $[44] = arrowPosition, $[45] = status, $[46] = ref, $[47] = t10, $[48] = t11, $[49] = t12, $[50] = t13) : t13 = $[50], t13;
|
|
1164
1175
|
});
|
|
1165
1176
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
1166
1177
|
const {
|
|
@@ -1199,11 +1210,22 @@ function _avatarCounterBaseStyle(props) {
|
|
|
1199
1210
|
`;
|
|
1200
1211
|
}
|
|
1201
1212
|
const Root$A = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle), AvatarCounter = forwardRef(function(props, ref) {
|
|
1202
|
-
const {
|
|
1213
|
+
const $ = c(11), {
|
|
1203
1214
|
count,
|
|
1204
|
-
size:
|
|
1205
|
-
} = props,
|
|
1206
|
-
|
|
1215
|
+
size: size2
|
|
1216
|
+
} = props, t0 = size2 != null ? size2 : 1;
|
|
1217
|
+
let t1, $size;
|
|
1218
|
+
if ($[0] !== t0) {
|
|
1219
|
+
$size = _getArrayProp(t0);
|
|
1220
|
+
let t22;
|
|
1221
|
+
$[3] === Symbol.for("react.memo_cache_sentinel") ? (t22 = (s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0, $[3] = t22) : t22 = $[3], t1 = $size.map(t22), $[0] = t0, $[1] = t1, $[2] = $size;
|
|
1222
|
+
} else
|
|
1223
|
+
t1 = $[1], $size = $[2];
|
|
1224
|
+
const fontSize2 = t1;
|
|
1225
|
+
let t2;
|
|
1226
|
+
$[4] !== fontSize2 || $[5] !== count ? (t2 = /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }), $[4] = fontSize2, $[5] = count, $[6] = t2) : t2 = $[6];
|
|
1227
|
+
let t3;
|
|
1228
|
+
return $[7] !== $size || $[8] !== ref || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsx(Root$A, { $size, "data-ui": "AvatarCounter", ref, children: t2 }), $[7] = $size, $[8] = ref, $[9] = t2, $[10] = t3) : t3 = $[10], t3;
|
|
1207
1229
|
}), BASE_STYLES = css`
|
|
1208
1230
|
white-space: nowrap;
|
|
1209
1231
|
|
|
@@ -1233,19 +1255,34 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
1233
1255
|
});
|
|
1234
1256
|
}
|
|
1235
1257
|
const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = forwardRef(function(props, ref) {
|
|
1236
|
-
const
|
|
1258
|
+
const $ = c(31);
|
|
1259
|
+
let t0, t1, childrenProp, restProps;
|
|
1260
|
+
$[0] !== props ? ({
|
|
1237
1261
|
children: childrenProp,
|
|
1238
|
-
maxLength:
|
|
1239
|
-
size:
|
|
1262
|
+
maxLength: t0,
|
|
1263
|
+
size: t1,
|
|
1240
1264
|
...restProps
|
|
1241
|
-
} = props,
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1265
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = childrenProp, $[4] = restProps) : (t0 = $[1], t1 = $[2], childrenProp = $[3], restProps = $[4]);
|
|
1266
|
+
const maxLengthProp = t0 === void 0 ? 4 : t0, sizeProp = t1 === void 0 ? 1 : t1;
|
|
1267
|
+
let T0, t2, t3, t4, t5, t6, t7, t8;
|
|
1268
|
+
if ($[5] !== childrenProp || $[6] !== maxLengthProp || $[7] !== sizeProp || $[8] !== restProps || $[9] !== ref) {
|
|
1269
|
+
const children = Children.toArray(childrenProp).filter(isValidElement), maxLength = Math.max(maxLengthProp, 0);
|
|
1270
|
+
let t92, t10;
|
|
1271
|
+
$[18] !== sizeProp ? (t10 = _getArrayProp(sizeProp), $[18] = sizeProp, $[19] = t10) : t10 = $[19], t92 = t10;
|
|
1272
|
+
const size2 = t92, len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1273
|
+
T0 = Root$z, t2 = "AvatarStack", t3 = restProps, t4 = ref, t5 = size2, t6 = len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }), t7 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) });
|
|
1274
|
+
let t11;
|
|
1275
|
+
$[20] !== size2 ? (t11 = (child, childIndex) => /* @__PURE__ */ jsx("div", { children: cloneElement(child, {
|
|
1246
1276
|
size: size2
|
|
1247
|
-
}) }, String(childIndex)))
|
|
1248
|
-
|
|
1277
|
+
}) }, String(childIndex)), $[20] = size2, $[21] = t11) : t11 = $[21], t8 = visibleChildren.map(t11), $[5] = childrenProp, $[6] = maxLengthProp, $[7] = sizeProp, $[8] = restProps, $[9] = ref, $[10] = T0, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = t5, $[15] = t6, $[16] = t7, $[17] = t8;
|
|
1278
|
+
} else
|
|
1279
|
+
T0 = $[10], t2 = $[11], t3 = $[12], t4 = $[13], t5 = $[14], t6 = $[15], t7 = $[16], t8 = $[17];
|
|
1280
|
+
let t9;
|
|
1281
|
+
return $[22] !== T0 || $[23] !== t2 || $[24] !== t3 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 ? (t9 = /* @__PURE__ */ jsxs(T0, { "data-ui": t2, ...t3, ref: t4, $size: t5, children: [
|
|
1282
|
+
t6,
|
|
1283
|
+
t7,
|
|
1284
|
+
t8
|
|
1285
|
+
] }), $[22] = T0, $[23] = t2, $[24] = t3, $[25] = t4, $[26] = t5, $[27] = t6, $[28] = t7, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
|
|
1249
1286
|
}), Root$y = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = forwardRef(function(props, ref) {
|
|
1250
1287
|
const $ = c(109);
|
|
1251
1288
|
let t0, t1, t2, t3, column, columnStart, columnEnd, flex, height, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, row, rowStart, rowEnd, sizing, restProps;
|
|
@@ -3335,19 +3372,27 @@ function findMinBreakpoints(media, width) {
|
|
|
3335
3372
|
return ret;
|
|
3336
3373
|
}
|
|
3337
3374
|
const ElementQuery = forwardRef(function(props, forwardedRef) {
|
|
3338
|
-
|
|
3375
|
+
var _a;
|
|
3376
|
+
const $ = c(12), theme = useTheme_v2();
|
|
3377
|
+
let _media, restProps, children;
|
|
3378
|
+
$[0] !== props ? ({
|
|
3339
3379
|
children,
|
|
3340
|
-
media
|
|
3380
|
+
media: _media,
|
|
3341
3381
|
...restProps
|
|
3342
|
-
} = props,
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3382
|
+
} = props, $[0] = props, $[1] = _media, $[2] = restProps, $[3] = children) : (_media = $[1], restProps = $[2], children = $[3]);
|
|
3383
|
+
const media = _media != null ? _media : theme.media, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element);
|
|
3384
|
+
let t0;
|
|
3385
|
+
t0 = (_a = elementSize == null ? void 0 : elementSize.border.width) != null ? _a : window.innerWidth;
|
|
3386
|
+
const width = t0, max = findMaxBreakpoints(media, width), min = findMinBreakpoints(media, width);
|
|
3387
|
+
let t1;
|
|
3388
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => ref.current, $[4] = t1) : t1 = $[4], useImperativeHandle(forwardedRef, t1);
|
|
3389
|
+
let t2;
|
|
3390
|
+
$[5] === Symbol.for("react.memo_cache_sentinel") ? (t2 = (el) => {
|
|
3348
3391
|
ref.current = el, setElement(el);
|
|
3349
|
-
}, []);
|
|
3350
|
-
|
|
3392
|
+
}, $[5] = t2) : t2 = $[5];
|
|
3393
|
+
const setRef = t2, t3 = max.length ? max.join(" ") : void 0, t4 = min.length ? min.join(" ") : void 0;
|
|
3394
|
+
let t5;
|
|
3395
|
+
return $[6] !== restProps || $[7] !== t3 || $[8] !== t4 || $[9] !== setRef || $[10] !== children ? (t5 = /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": t3, "data-eq-min": t4, ref: setRef, children }), $[6] = restProps, $[7] = t3, $[8] = t4, $[9] = setRef, $[10] = children, $[11] = t5) : t5 = $[11], t5;
|
|
3351
3396
|
});
|
|
3352
3397
|
var __defProp = Object.defineProperty, __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key2] = value, __publicField = (obj, key2, value) => __defNormalProp(obj, key2 + "", value);
|
|
3353
3398
|
class ErrorBoundary extends Component {
|
|
@@ -3477,39 +3522,56 @@ function _isScrollable(el) {
|
|
|
3477
3522
|
}
|
|
3478
3523
|
function LayerProvider(props) {
|
|
3479
3524
|
var _a;
|
|
3480
|
-
const {
|
|
3525
|
+
const $ = c(22), {
|
|
3481
3526
|
children,
|
|
3482
|
-
zOffset:
|
|
3483
|
-
} = props, parentContextValue = useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue),
|
|
3527
|
+
zOffset: t0
|
|
3528
|
+
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext), parentRegisterChild = useContext(LayerContextRegisterChild), parent = parentContextValue && getLayerContext(parentContextValue), level = ((_a = parent == null ? void 0 : parent.level) != null ? _a : 0) + 1;
|
|
3529
|
+
let t1, t2;
|
|
3530
|
+
$[0] !== zOffsetProp ? (t2 = _getArrayProp(zOffsetProp), $[0] = zOffsetProp, $[1] = t2) : t2 = $[1], t1 = t2;
|
|
3531
|
+
const zOffset = t1, maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
3532
|
+
let t3;
|
|
3533
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[2] = t3) : t3 = $[2];
|
|
3534
|
+
const [childLayers, setChildLayers] = useState(t3);
|
|
3535
|
+
let t4, t5;
|
|
3536
|
+
$[3] !== childLayers ? (t5 = Object.keys(childLayers), $[3] = childLayers, $[4] = t5) : t5 = $[4], t4 = t5.length;
|
|
3537
|
+
const size2 = t4, isTopLayer = size2 === 0;
|
|
3538
|
+
let t6;
|
|
3539
|
+
$[5] !== parentRegisterChild ? (t6 = (childLevel) => {
|
|
3484
3540
|
const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
|
|
3485
|
-
return
|
|
3541
|
+
return setChildLayers((state) => {
|
|
3486
3542
|
var _a2;
|
|
3487
|
-
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0
|
|
3543
|
+
const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0;
|
|
3544
|
+
return {
|
|
3488
3545
|
...state,
|
|
3489
3546
|
[childLevel]: prevLen + 1
|
|
3490
3547
|
};
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
3548
|
+
}), () => {
|
|
3549
|
+
setChildLayers((state_0) => {
|
|
3494
3550
|
const nextState_0 = {
|
|
3495
3551
|
...state_0
|
|
3496
3552
|
};
|
|
3497
|
-
return nextState_0[childLevel] === 1 ?
|
|
3498
|
-
})
|
|
3553
|
+
return nextState_0[childLevel] === 1 ? delete nextState_0[childLevel] : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
3554
|
+
}), parentDispose == null || parentDispose();
|
|
3499
3555
|
};
|
|
3500
|
-
}, [parentRegisterChild]);
|
|
3501
|
-
|
|
3502
|
-
|
|
3556
|
+
}, $[5] = parentRegisterChild, $[6] = t6) : t6 = $[6];
|
|
3557
|
+
const registerChild = t6;
|
|
3558
|
+
let t7, t8;
|
|
3559
|
+
$[7] !== parentRegisterChild || $[8] !== level ? (t7 = () => parentRegisterChild == null ? void 0 : parentRegisterChild(level), t8 = [level, parentRegisterChild], $[7] = parentRegisterChild, $[8] = level, $[9] = t7, $[10] = t8) : (t7 = $[9], t8 = $[10]), useEffect(t7, t8);
|
|
3560
|
+
let t9, t10;
|
|
3561
|
+
$[11] !== isTopLayer || $[12] !== level || $[13] !== size2 || $[14] !== zIndex ? (t10 = {
|
|
3503
3562
|
version: 0,
|
|
3504
3563
|
isTopLayer,
|
|
3505
3564
|
level,
|
|
3506
|
-
registerChild,
|
|
3507
3565
|
size: size2,
|
|
3508
3566
|
zIndex
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3567
|
+
}, $[11] = isTopLayer, $[12] = level, $[13] = size2, $[14] = zIndex, $[15] = t10) : t10 = $[15], t9 = t10;
|
|
3568
|
+
const value = t9;
|
|
3569
|
+
let t11;
|
|
3570
|
+
$[16] !== registerChild || $[17] !== children ? (t11 = /* @__PURE__ */ jsx(LayerContextRegisterChild.Provider, { value: registerChild, children }), $[16] = registerChild, $[17] = children, $[18] = t11) : t11 = $[18];
|
|
3571
|
+
let t12;
|
|
3572
|
+
return $[19] !== value || $[20] !== t11 ? (t12 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children: t11 }), $[19] = value, $[20] = t11, $[21] = t12) : t12 = $[21], t12;
|
|
3511
3573
|
}
|
|
3512
|
-
const Root$j = styled.div({
|
|
3574
|
+
const LayerContextRegisterChild = createContext(null), Root$j = styled.div({
|
|
3513
3575
|
position: "relative"
|
|
3514
3576
|
}), LayerChildren = forwardRef(function(props, forwardedRef) {
|
|
3515
3577
|
const $ = c(23);
|
|
@@ -3911,42 +3973,61 @@ const MotionCard$1 = styled(motion(Card))`
|
|
|
3911
3973
|
}));
|
|
3912
3974
|
PopoverCard.displayName = "PopoverCard";
|
|
3913
3975
|
const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
3914
|
-
var _a, _b,
|
|
3915
|
-
const {
|
|
3976
|
+
var _a, _b, _c2, _d, _e, _f, _g, _h, _i;
|
|
3977
|
+
const $ = c(99), {
|
|
3916
3978
|
container,
|
|
3917
3979
|
layer
|
|
3918
|
-
} = useTheme_v2(), boundaryElementContext = useBoundaryElement()
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3980
|
+
} = useTheme_v2(), boundaryElementContext = useBoundaryElement();
|
|
3981
|
+
let t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, _boundaryElement, _referenceBoundary, _floatingBoundary, _fallbackPlacements, _zOffset, paddingProp, open, matchReferenceWidth, updateRef, children, referenceElement, disabled, restProps, scheme, content, portal;
|
|
3982
|
+
if ($[0] !== props) {
|
|
3983
|
+
const {
|
|
3984
|
+
__unstable_margins: t112,
|
|
3985
|
+
animate: t122,
|
|
3986
|
+
arrow: t132,
|
|
3987
|
+
boundaryElement: t142,
|
|
3988
|
+
children: t152,
|
|
3989
|
+
constrainSize: t162,
|
|
3990
|
+
content: t172,
|
|
3991
|
+
disabled: t182,
|
|
3992
|
+
fallbackPlacements: t192,
|
|
3993
|
+
matchReferenceWidth: t202,
|
|
3994
|
+
floatingBoundary: t212,
|
|
3995
|
+
onActivate,
|
|
3996
|
+
open: t222,
|
|
3997
|
+
overflow: t232,
|
|
3998
|
+
padding: t242,
|
|
3999
|
+
placement: t252,
|
|
4000
|
+
portal: t262,
|
|
4001
|
+
preventOverflow: t272,
|
|
4002
|
+
radius: t282,
|
|
4003
|
+
referenceBoundary: t292,
|
|
4004
|
+
referenceElement: t302,
|
|
4005
|
+
scheme: t312,
|
|
4006
|
+
shadow: t322,
|
|
4007
|
+
tone: t332,
|
|
4008
|
+
width: t342,
|
|
4009
|
+
zOffset: t352,
|
|
4010
|
+
updateRef: t362,
|
|
4011
|
+
...t37
|
|
4012
|
+
} = props;
|
|
4013
|
+
t0 = t112, t1 = t122, t2 = t132, _boundaryElement = t142, children = t152, t3 = t162, content = t172, disabled = t182, _fallbackPlacements = t192, matchReferenceWidth = t202, _floatingBoundary = t212, open = t222, t4 = t232, paddingProp = t242, t5 = t252, portal = t262, t6 = t272, t7 = t282, _referenceBoundary = t292, referenceElement = t302, scheme = t312, t8 = t322, t9 = t332, t10 = t342, _zOffset = t352, updateRef = t362, restProps = t37, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = t7, $[9] = t8, $[10] = t9, $[11] = t10, $[12] = _boundaryElement, $[13] = _referenceBoundary, $[14] = _floatingBoundary, $[15] = _fallbackPlacements, $[16] = _zOffset, $[17] = paddingProp, $[18] = open, $[19] = matchReferenceWidth, $[20] = updateRef, $[21] = children, $[22] = referenceElement, $[23] = disabled, $[24] = restProps, $[25] = scheme, $[26] = content, $[27] = portal;
|
|
4014
|
+
} else
|
|
4015
|
+
t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], t7 = $[8], t8 = $[9], t9 = $[10], t10 = $[11], _boundaryElement = $[12], _referenceBoundary = $[13], _floatingBoundary = $[14], _fallbackPlacements = $[15], _zOffset = $[16], paddingProp = $[17], open = $[18], matchReferenceWidth = $[19], updateRef = $[20], children = $[21], referenceElement = $[22], disabled = $[23], restProps = $[24], scheme = $[25], content = $[26], portal = $[27];
|
|
4016
|
+
const margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, constrainSize = t3 === void 0 ? !1 : t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, preventOverflow = t6 === void 0 ? !0 : t6, radiusProp = t7 === void 0 ? 3 : t7, shadowProp = t8 === void 0 ? 3 : t8, tone = t9 === void 0 ? "inherit" : t9, widthProp = t10 === void 0 ? "auto" : t10, boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext.element, referenceBoundary = (_a = _referenceBoundary != null ? _referenceBoundary : props.boundaryElement) != null ? _a : boundaryElementContext.element, floatingBoundary = (_b = _floatingBoundary != null ? _floatingBoundary : props.boundaryElement) != null ? _b : boundaryElementContext.element, fallbackPlacements = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS$1[(_c2 = props.placement) != null ? _c2 : "bottom"], zOffsetProp = _zOffset != null ? _zOffset : layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = (_d = useElementSize(boundaryElement)) == null ? void 0 : _d.border;
|
|
4017
|
+
let t11, t12;
|
|
4018
|
+
$[28] !== paddingProp ? (t12 = _getArrayProp(paddingProp), $[28] = paddingProp, $[29] = t12) : t12 = $[29], t11 = t12;
|
|
4019
|
+
const padding = t11;
|
|
4020
|
+
let t13, t14;
|
|
4021
|
+
$[30] !== radiusProp ? (t14 = _getArrayProp(radiusProp), $[30] = radiusProp, $[31] = t14) : t14 = $[31], t13 = t14;
|
|
4022
|
+
const radius = t13;
|
|
4023
|
+
let t15, t16;
|
|
4024
|
+
$[32] !== shadowProp ? (t16 = _getArrayProp(shadowProp), $[32] = shadowProp, $[33] = t16) : t16 = $[33], t15 = t16;
|
|
4025
|
+
const shadow = t15, widthArrayProp = _getArrayProp(widthProp);
|
|
4026
|
+
let t17, t18;
|
|
4027
|
+
$[34] !== zOffsetProp ? (t18 = _getArrayProp(zOffsetProp), $[34] = zOffsetProp, $[35] = t18) : t18 = $[35], t17 = t18;
|
|
4028
|
+
const zOffset = t17, ref = useRef(null), arrowRef = useRef(null);
|
|
4029
|
+
let t19;
|
|
4030
|
+
$[36] === Symbol.for("react.memo_cache_sentinel") ? (t19 = () => ref.current, $[36] = t19) : t19 = $[36], useImperativeHandle(forwardedRef, t19);
|
|
3950
4031
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize == null ? void 0 : boundarySize.width : void 0, width = calcCurrentWidth({
|
|
3951
4032
|
container,
|
|
3952
4033
|
mediaIndex,
|
|
@@ -3965,48 +4046,64 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
3965
4046
|
const referenceWidthRef = useRef();
|
|
3966
4047
|
useEffect(() => {
|
|
3967
4048
|
const floatingElement = ref.current;
|
|
3968
|
-
if (!open || !floatingElement)
|
|
4049
|
+
if (!open || !floatingElement)
|
|
4050
|
+
return;
|
|
3969
4051
|
const referenceWidth = referenceWidthRef.current;
|
|
3970
4052
|
matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
|
|
3971
4053
|
}, [width, matchReferenceWidth, maxWidth, open]);
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
4054
|
+
let t20;
|
|
4055
|
+
const ret = [];
|
|
4056
|
+
if (constrainSize || preventOverflow) {
|
|
4057
|
+
const t212 = floatingBoundary || void 0;
|
|
4058
|
+
let t222;
|
|
4059
|
+
$[37] !== t212 || $[38] !== fallbackPlacements ? (t222 = flip({
|
|
4060
|
+
boundary: t212,
|
|
3976
4061
|
fallbackPlacements,
|
|
3977
4062
|
padding: DEFAULT_POPOVER_PADDING,
|
|
3978
|
-
rootBoundary
|
|
3979
|
-
})), ret.push(
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
4063
|
+
rootBoundary: "viewport"
|
|
4064
|
+
}), $[37] = t212, $[38] = fallbackPlacements, $[39] = t222) : t222 = $[39], ret.push(t222);
|
|
4065
|
+
}
|
|
4066
|
+
let t21;
|
|
4067
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel") ? (t21 = offset({
|
|
4068
|
+
mainAxis: DEFAULT_POPOVER_DISTANCE
|
|
4069
|
+
}), $[40] = t21) : t21 = $[40], ret.push(t21), (constrainSize || matchReferenceWidth) && ret.push(size({
|
|
4070
|
+
apply(t222) {
|
|
4071
|
+
const {
|
|
3983
4072
|
availableWidth,
|
|
3984
4073
|
availableHeight,
|
|
3985
4074
|
elements,
|
|
3986
4075
|
referenceWidth: referenceWidth_0
|
|
3987
|
-
}
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4076
|
+
} = t222;
|
|
4077
|
+
referenceWidthRef.current = referenceWidth_0;
|
|
4078
|
+
const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
|
|
4079
|
+
matchReferenceWidth ? elements.floating.style.width = `${referenceWidth_0}px` : _currentWidth !== void 0 && (elements.floating.style.width = `${_currentWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, _maxWidth != null ? _maxWidth : 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
4080
|
+
},
|
|
4081
|
+
boundaryElement: floatingBoundary || void 0,
|
|
4082
|
+
constrainSize,
|
|
4083
|
+
margins,
|
|
4084
|
+
matchReferenceWidth,
|
|
4085
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
4086
|
+
})), preventOverflow) {
|
|
4087
|
+
const t222 = floatingBoundary || void 0;
|
|
4088
|
+
let t232;
|
|
4089
|
+
$[41] !== t222 ? (t232 = shift({
|
|
4090
|
+
boundary: t222,
|
|
4091
|
+
rootBoundary: "viewport",
|
|
4003
4092
|
padding: DEFAULT_POPOVER_PADDING
|
|
4004
|
-
})
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
},
|
|
4093
|
+
}), $[41] = t222, $[42] = t232) : t232 = $[42], ret.push(t232);
|
|
4094
|
+
}
|
|
4095
|
+
arrowProp && ret.push(arrow({
|
|
4096
|
+
element: arrowRef,
|
|
4097
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
4098
|
+
})), animate && ret.push(origin);
|
|
4099
|
+
const t22 = referenceBoundary || void 0;
|
|
4100
|
+
let t23;
|
|
4101
|
+
$[43] !== t22 ? (t23 = hide({
|
|
4102
|
+
boundary: t22,
|
|
4103
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
4104
|
+
strategy: "referenceHidden"
|
|
4105
|
+
}), $[43] = t22, $[44] = t23) : t23 = $[44], ret.push(t23), t20 = ret;
|
|
4106
|
+
const middleware = t20, {
|
|
4010
4107
|
x,
|
|
4011
4108
|
y,
|
|
4012
4109
|
middlewareData,
|
|
@@ -4018,30 +4115,54 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
|
|
|
4018
4115
|
middleware,
|
|
4019
4116
|
placement: placementProp,
|
|
4020
4117
|
whileElementsMounted: autoUpdate
|
|
4021
|
-
}), referenceHidden = (
|
|
4118
|
+
}), referenceHidden = (_e = middlewareData.hide) == null ? void 0 : _e.referenceHidden, arrowX = (_f = middlewareData.arrow) == null ? void 0 : _f.x, arrowY = (_g = middlewareData.arrow) == null ? void 0 : _g.y, originX = (_h = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _h.originX, originY = (_i = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _i.originY;
|
|
4119
|
+
let t24;
|
|
4120
|
+
$[45] === Symbol.for("react.memo_cache_sentinel") ? (t24 = (arrowEl) => {
|
|
4022
4121
|
arrowRef.current = arrowEl;
|
|
4023
|
-
}, []
|
|
4122
|
+
}, $[45] = t24) : t24 = $[45];
|
|
4123
|
+
const setArrow = t24;
|
|
4124
|
+
let t25;
|
|
4125
|
+
$[46] !== refs ? (t25 = (node) => {
|
|
4024
4126
|
ref.current = node, refs.setFloating(node);
|
|
4025
|
-
}, [refs
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
] });
|
|
4127
|
+
}, $[46] = refs, $[47] = t25) : t25 = $[47];
|
|
4128
|
+
const setFloating = t25;
|
|
4129
|
+
let t26, t27;
|
|
4130
|
+
$[48] !== update ? (t26 = () => update, t27 = [update], $[48] = update, $[49] = t26, $[50] = t27) : (t26 = $[49], t27 = $[50]), useImperativeHandle(updateRef, t26, t27);
|
|
4131
|
+
let t28, t29;
|
|
4132
|
+
if ($[51] !== children || $[52] !== refs || $[53] !== referenceElement ? (t28 = () => {
|
|
4133
|
+
children || refs.setReference(referenceElement || null);
|
|
4134
|
+
}, t29 = [children, referenceElement, refs], $[51] = children, $[52] = refs, $[53] = referenceElement, $[54] = t28, $[55] = t29) : (t28 = $[54], t29 = $[55]), useEffect(t28, t29), disabled) {
|
|
4135
|
+
let t302;
|
|
4136
|
+
return $[56] !== children ? (t302 = children || /* @__PURE__ */ jsx(Fragment, {}), $[56] = children, $[57] = t302) : t302 = $[57], t302;
|
|
4137
|
+
}
|
|
4138
|
+
let t30;
|
|
4139
|
+
$[58] !== restProps || $[59] !== margins || $[60] !== animate || $[61] !== arrowProp || $[62] !== setArrow || $[63] !== arrowX || $[64] !== arrowY || $[65] !== referenceHidden || $[66] !== overflow || $[67] !== padding || $[68] !== placement || $[69] !== radius || $[70] !== setFloating || $[71] !== scheme || $[72] !== shadow || $[73] !== originX || $[74] !== originY || $[75] !== strategy || $[76] !== tone || $[77] !== x || $[78] !== y || $[79] !== content ? (t30 = /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, width: matchReferenceWidth ? referenceWidthRef.current : width, x, y, children: content }), $[58] = restProps, $[59] = margins, $[60] = animate, $[61] = arrowProp, $[62] = setArrow, $[63] = arrowX, $[64] = arrowY, $[65] = referenceHidden, $[66] = overflow, $[67] = padding, $[68] = placement, $[69] = radius, $[70] = setFloating, $[71] = scheme, $[72] = shadow, $[73] = originX, $[74] = originY, $[75] = strategy, $[76] = tone, $[77] = x, $[78] = y, $[79] = content, $[80] = t30) : t30 = $[80];
|
|
4140
|
+
let t31;
|
|
4141
|
+
$[81] !== zOffset || $[82] !== t30 ? (t31 = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: t30 }), $[81] = zOffset, $[82] = t30, $[83] = t31) : t31 = $[83];
|
|
4142
|
+
const popover = t31;
|
|
4143
|
+
let t32;
|
|
4144
|
+
$[84] === Symbol.for("react.memo_cache_sentinel") ? (t32 = (children_0) => /* @__PURE__ */ jsx(AnimatePresence, { children: children_0 }), $[84] = t32) : t32 = $[84];
|
|
4145
|
+
let t33;
|
|
4146
|
+
$[85] !== open || $[86] !== portal || $[87] !== popover ? (t33 = open && /* @__PURE__ */ jsx(ConditionalWrapper, { condition: !!portal, wrapper: (children_1) => /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: children_1 }), children: popover }), $[85] = open, $[86] = portal, $[87] = popover, $[88] = t33) : t33 = $[88];
|
|
4147
|
+
let t34;
|
|
4148
|
+
$[89] !== animate || $[90] !== t33 ? (t34 = /* @__PURE__ */ jsx(ConditionalWrapper, { condition: animate, wrapper: t32, children: t33 }), $[89] = animate, $[90] = t33, $[91] = t34) : t34 = $[91];
|
|
4149
|
+
let t35;
|
|
4150
|
+
$[92] !== children || $[93] !== referenceElement || $[94] !== refs ? (t35 = children && !referenceElement && /* @__PURE__ */ jsx("div", { ref: (node_0) => {
|
|
4151
|
+
logDeprecatedWarning(), refs.setReference(node_0);
|
|
4152
|
+
}, style: {
|
|
4153
|
+
display: "contents"
|
|
4154
|
+
}, children }), $[92] = children, $[93] = referenceElement, $[94] = refs, $[95] = t35) : t35 = $[95];
|
|
4155
|
+
let t36;
|
|
4156
|
+
return $[96] !== t34 || $[97] !== t35 ? (t36 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4157
|
+
t34,
|
|
4158
|
+
t35
|
|
4159
|
+
] }), $[96] = t34, $[97] = t35, $[98] = t36) : t36 = $[98], t36;
|
|
4043
4160
|
}));
|
|
4044
4161
|
Popover.displayName = "Popover";
|
|
4162
|
+
let didWarn = !1;
|
|
4163
|
+
function logDeprecatedWarning() {
|
|
4164
|
+
didWarn || (console.warn("Popover: Please use the `referenceElement` prop instead of passing a children."), didWarn = !0);
|
|
4165
|
+
}
|
|
4045
4166
|
function radioBaseStyle() {
|
|
4046
4167
|
return css`
|
|
4047
4168
|
position: relative;
|
|
@@ -4901,29 +5022,29 @@ const Root$a = styled(Layer)`
|
|
|
4901
5022
|
$maxWidth
|
|
4902
5023
|
}) => $maxWidth}px;
|
|
4903
5024
|
`, Tooltip = forwardRef(function(props, forwardedRef) {
|
|
4904
|
-
var _a, _b, _c, _d, _e, _f
|
|
5025
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4905
5026
|
const boundaryElementContext = useBoundaryElement(), {
|
|
4906
5027
|
layer
|
|
4907
5028
|
} = useTheme_v2(), {
|
|
4908
5029
|
animate: _animate = !1,
|
|
4909
5030
|
arrow: arrowProp = !1,
|
|
4910
|
-
boundaryElement
|
|
5031
|
+
boundaryElement: _boundaryElement,
|
|
4911
5032
|
children: childProp,
|
|
4912
5033
|
content,
|
|
4913
5034
|
disabled,
|
|
4914
|
-
fallbackPlacements:
|
|
5035
|
+
fallbackPlacements: _fallbackPlacements,
|
|
4915
5036
|
padding = 2,
|
|
4916
5037
|
placement: placementProp = "bottom",
|
|
4917
5038
|
portal: portalProp,
|
|
4918
5039
|
radius = 2,
|
|
4919
5040
|
scheme,
|
|
4920
5041
|
shadow = 2,
|
|
4921
|
-
zOffset
|
|
5042
|
+
zOffset: _zOffset,
|
|
4922
5043
|
delay,
|
|
4923
5044
|
...restProps
|
|
4924
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useMemo(() => _getArrayProp(fallbackPlacementsProp), [fallbackPlacementsProp]), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
5045
|
+
} = props, zOffset = _zOffset != null ? _zOffset : layer.tooltip.zOffset, fallbackPlacementsProp = _fallbackPlacements != null ? _fallbackPlacements : DEFAULT_FALLBACK_PLACEMENTS[(_a = props.placement) != null ? _a : "bottom"], boundaryElement = _boundaryElement != null ? _boundaryElement : boundaryElementContext == null ? void 0 : boundaryElementContext.element, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useMemo(() => _getArrayProp(fallbackPlacementsProp), [fallbackPlacementsProp]), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
4925
5046
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
4926
|
-
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((
|
|
5047
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? ((_b = portal.elements) == null ? void 0 : _b[portalProp]) || null : portal.element, documentBodyOffsetWidth = useSyncExternalStore(
|
|
4927
5048
|
emptySubscribe,
|
|
4928
5049
|
() => document.body.offsetWidth,
|
|
4929
5050
|
// We don't actually know what the width of the body is during SSR, so we'll just assume it's 800px or larger
|
|
@@ -4958,7 +5079,7 @@ const Root$a = styled(Layer)`
|
|
|
4958
5079
|
middleware,
|
|
4959
5080
|
placement: placementProp,
|
|
4960
5081
|
whileElementsMounted: autoUpdate
|
|
4961
|
-
}), arrowX = (
|
|
5082
|
+
}), arrowX = (_c = middlewareData.arrow) == null ? void 0 : _c.x, arrowY = (_d = middlewareData.arrow) == null ? void 0 : _d.y, originX = (_e = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _e.originX, originY = (_f = middlewareData["@sanity/ui/origin"]) == null ? void 0 : _f.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), showTooltip = isOpen || (delayGroupContext == null ? void 0 : delayGroupContext.openTooltipId) === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.open) || 0, closeDelayProp = typeof delay == "number" ? delay : (delay == null ? void 0 : delay.close) || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = useCallback((open, immediate) => {
|
|
4962
5083
|
if (isInsideGroup)
|
|
4963
5084
|
if (open) {
|
|
4964
5085
|
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
@@ -4990,9 +5111,9 @@ const Root$a = styled(Layer)`
|
|
|
4990
5111
|
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
4991
5112
|
useEffect(() => {
|
|
4992
5113
|
if (!showTooltip) return;
|
|
4993
|
-
|
|
5114
|
+
const handleWindowMouseMove = (event) => {
|
|
4994
5115
|
referenceElement && (referenceElement === event.target || event.target instanceof Node && referenceElement.contains(event.target) || (handleIsOpenChange(!1), window.removeEventListener("mousemove", handleWindowMouseMove)));
|
|
4995
|
-
}
|
|
5116
|
+
};
|
|
4996
5117
|
return window.addEventListener("mousemove", handleWindowMouseMove), () => {
|
|
4997
5118
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
4998
5119
|
};
|
|
@@ -5160,7 +5281,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5160
5281
|
value: value_0
|
|
5161
5282
|
}) => /* @__PURE__ */ jsx(Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", children: value_0 }) }), [fontSize2, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
|
|
5162
5283
|
useImperativeHandle(forwardedRef, () => inputElementRef.current);
|
|
5163
|
-
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding =
|
|
5284
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp), currentOption = useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = (event) => {
|
|
5164
5285
|
setTimeout(() => {
|
|
5165
5286
|
if (popoverMouseWithinRef.current)
|
|
5166
5287
|
return;
|
|
@@ -5177,13 +5298,13 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5177
5298
|
type: "root/blur"
|
|
5178
5299
|
}), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
5179
5300
|
}, 0);
|
|
5180
|
-
},
|
|
5301
|
+
}, handleRootFocus = (event_0) => {
|
|
5181
5302
|
const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = (listBoxElement == null ? void 0 : listBoxElement.contains(focusedElement)) || !1;
|
|
5182
5303
|
listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
|
|
5183
5304
|
type: "root/setListFocused",
|
|
5184
5305
|
listFocused: listFocused_0
|
|
5185
5306
|
}));
|
|
5186
|
-
},
|
|
5307
|
+
}, handleOptionSelect = useCallback((v) => {
|
|
5187
5308
|
var _a;
|
|
5188
5309
|
dispatch({
|
|
5189
5310
|
type: "value/change",
|
|
@@ -5525,13 +5646,15 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5525
5646
|
return $[47] !== width || $[48] !== t18 ? (t19 = /* @__PURE__ */ jsx(DialogContainer, { "data-ui": "DialogCard", width, children: t18 }), $[47] = width, $[48] = t18, $[49] = t19) : t19 = $[49], t19;
|
|
5526
5647
|
}), Dialog = forwardRef(function(props, ref) {
|
|
5527
5648
|
var _a;
|
|
5528
|
-
const dialog = useDialog(), {
|
|
5649
|
+
const $ = c(75), dialog = useDialog(), {
|
|
5529
5650
|
layer
|
|
5530
|
-
} = useTheme_v2()
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5651
|
+
} = useTheme_v2();
|
|
5652
|
+
let t0, t1, t2, t3, t4, t5, t6, _position, _zOffset, portalProp, onFocus, id, contentRef, footer, header, onClickOutside, onClose, scheme, children, restProps, onActivate;
|
|
5653
|
+
$[0] !== props ? ({
|
|
5654
|
+
__unstable_autoFocus: t0,
|
|
5655
|
+
__unstable_hideCloseButton: t1,
|
|
5656
|
+
cardRadius: t2,
|
|
5657
|
+
cardShadow: t3,
|
|
5535
5658
|
children,
|
|
5536
5659
|
contentRef,
|
|
5537
5660
|
footer,
|
|
@@ -5541,15 +5664,33 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5541
5664
|
onClickOutside,
|
|
5542
5665
|
onClose,
|
|
5543
5666
|
onFocus,
|
|
5544
|
-
padding:
|
|
5667
|
+
padding: t4,
|
|
5545
5668
|
portal: portalProp,
|
|
5546
|
-
position:
|
|
5669
|
+
position: _position,
|
|
5547
5670
|
scheme,
|
|
5548
|
-
width:
|
|
5549
|
-
zOffset:
|
|
5550
|
-
animate:
|
|
5671
|
+
width: t5,
|
|
5672
|
+
zOffset: _zOffset,
|
|
5673
|
+
animate: t6,
|
|
5551
5674
|
...restProps
|
|
5552
|
-
} = props,
|
|
5675
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = _position, $[9] = _zOffset, $[10] = portalProp, $[11] = onFocus, $[12] = id, $[13] = contentRef, $[14] = footer, $[15] = header, $[16] = onClickOutside, $[17] = onClose, $[18] = scheme, $[19] = children, $[20] = restProps, $[21] = onActivate) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], _position = $[8], _zOffset = $[9], portalProp = $[10], onFocus = $[11], id = $[12], contentRef = $[13], footer = $[14], header = $[15], onClickOutside = $[16], onClose = $[17], scheme = $[18], children = $[19], restProps = $[20], onActivate = $[21]);
|
|
5676
|
+
const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 === void 0 ? !1 : t6, positionProp = _position != null ? _position : dialog.position || "fixed", zOffsetProp = _zOffset != null ? _zOffset : dialog.zOffset || layer.dialog.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element;
|
|
5677
|
+
let t7, t8;
|
|
5678
|
+
$[22] !== cardRadiusProp ? (t8 = _getArrayProp(cardRadiusProp), $[22] = cardRadiusProp, $[23] = t8) : t8 = $[23], t7 = t8;
|
|
5679
|
+
const cardRadius = t7;
|
|
5680
|
+
let t9, t10;
|
|
5681
|
+
$[24] !== paddingProp ? (t10 = _getArrayProp(paddingProp), $[24] = paddingProp, $[25] = t10) : t10 = $[25], t9 = t10;
|
|
5682
|
+
const padding = t9;
|
|
5683
|
+
let t11, t12;
|
|
5684
|
+
$[26] !== positionProp ? (t12 = _getArrayProp(positionProp), $[26] = positionProp, $[27] = t12) : t12 = $[27], t11 = t12;
|
|
5685
|
+
const position = t11;
|
|
5686
|
+
let t13, t14;
|
|
5687
|
+
$[28] !== widthProp ? (t14 = _getArrayProp(widthProp), $[28] = widthProp, $[29] = t14) : t14 = $[29], t13 = t14;
|
|
5688
|
+
const width = t13;
|
|
5689
|
+
let t15, t16;
|
|
5690
|
+
$[30] !== zOffsetProp ? (t16 = _getArrayProp(zOffsetProp), $[30] = zOffsetProp, $[31] = t16) : t16 = $[31], t15 = t16;
|
|
5691
|
+
const zOffset = t15, preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null);
|
|
5692
|
+
let t17;
|
|
5693
|
+
$[32] !== onFocus ? (t17 = (event) => {
|
|
5553
5694
|
onFocus == null || onFocus(event);
|
|
5554
5695
|
const target = event.target, cardElement = cardRef.current;
|
|
5555
5696
|
if (cardElement && target === preDivRef.current) {
|
|
@@ -5561,7 +5702,10 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5561
5702
|
return;
|
|
5562
5703
|
}
|
|
5563
5704
|
isHTMLElement(event.target) && (focusedElementRef.current = event.target);
|
|
5564
|
-
}, [
|
|
5705
|
+
}, $[32] = onFocus, $[33] = t17) : t17 = $[33];
|
|
5706
|
+
const handleFocus = t17, labelId = `${id}_label`, rootClickTimeoutRef = useRef();
|
|
5707
|
+
let t18;
|
|
5708
|
+
$[34] !== boundaryElement || $[35] !== portalElement ? (t18 = () => {
|
|
5565
5709
|
rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
|
|
5566
5710
|
const activeElement = document.activeElement;
|
|
5567
5711
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
@@ -5574,12 +5718,22 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5574
5718
|
target_0.focus();
|
|
5575
5719
|
}
|
|
5576
5720
|
}, 0);
|
|
5577
|
-
}, [boundaryElement, portalElement]);
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
] })
|
|
5721
|
+
}, $[34] = boundaryElement, $[35] = portalElement, $[36] = t18) : t18 = $[36];
|
|
5722
|
+
const handleRootClick = t18;
|
|
5723
|
+
let t19;
|
|
5724
|
+
$[37] !== preDivRef ? (t19 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[37] = preDivRef, $[38] = t19) : t19 = $[38];
|
|
5725
|
+
let t20;
|
|
5726
|
+
$[39] !== autoFocus || $[40] !== hideCloseButton || $[41] !== contentRef || $[42] !== footer || $[43] !== header || $[44] !== id || $[45] !== onClickOutside || $[46] !== onClose || $[47] !== portalProp || $[48] !== cardRadius || $[49] !== cardRef || $[50] !== scheme || $[51] !== cardShadow || $[52] !== width || $[53] !== children ? (t20 = /* @__PURE__ */ jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }), $[39] = autoFocus, $[40] = hideCloseButton, $[41] = contentRef, $[42] = footer, $[43] = header, $[44] = id, $[45] = onClickOutside, $[46] = onClose, $[47] = portalProp, $[48] = cardRadius, $[49] = cardRef, $[50] = scheme, $[51] = cardShadow, $[52] = width, $[53] = children, $[54] = t20) : t20 = $[54];
|
|
5727
|
+
let t21;
|
|
5728
|
+
$[55] !== postDivRef ? (t21 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[55] = postDivRef, $[56] = t21) : t21 = $[56];
|
|
5729
|
+
let t22;
|
|
5730
|
+
$[57] !== restProps || $[58] !== animate || $[59] !== padding || $[60] !== position || $[61] !== labelId || $[62] !== id || $[63] !== onActivate || $[64] !== handleRootClick || $[65] !== handleFocus || $[66] !== ref || $[67] !== zOffset || $[68] !== t19 || $[69] !== t20 || $[70] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Root$7, { ...restProps, $animate: animate, $padding: padding, $position: position, "aria-labelledby": labelId, "aria-modal": !0, "data-ui": "Dialog", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, ref, role: "dialog", zOffset, children: [
|
|
5731
|
+
t19,
|
|
5732
|
+
t20,
|
|
5733
|
+
t21
|
|
5734
|
+
] }), $[57] = restProps, $[58] = animate, $[59] = padding, $[60] = position, $[61] = labelId, $[62] = id, $[63] = onActivate, $[64] = handleRootClick, $[65] = handleFocus, $[66] = ref, $[67] = zOffset, $[68] = t19, $[69] = t20, $[70] = t21, $[71] = t22) : t22 = $[71];
|
|
5735
|
+
let t23;
|
|
5736
|
+
return $[72] !== portalProp || $[73] !== t22 ? (t23 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t22 }), $[72] = portalProp, $[73] = t22, $[74] = t23) : t23 = $[74], t23;
|
|
5583
5737
|
});
|
|
5584
5738
|
function DialogProvider(props) {
|
|
5585
5739
|
const $ = c(6), {
|
|
@@ -5813,28 +5967,41 @@ const Root$5 = styled(Box)`
|
|
|
5813
5967
|
outline: none;
|
|
5814
5968
|
overflow: auto;
|
|
5815
5969
|
`, Menu = forwardRef(function(props, forwardedRef) {
|
|
5970
|
+
const $ = c(58);
|
|
5971
|
+
let t0, t1, _shouldFocus, onKeyDown, originElement, onItemSelect, onClickOutside, onEscape, registerElement, onItemClick, children, restProps;
|
|
5972
|
+
if ($[0] !== props) {
|
|
5973
|
+
const {
|
|
5974
|
+
children: t22,
|
|
5975
|
+
focusFirst,
|
|
5976
|
+
focusLast,
|
|
5977
|
+
onClickOutside: t32,
|
|
5978
|
+
onEscape: t42,
|
|
5979
|
+
onItemClick: t52,
|
|
5980
|
+
onItemSelect: t62,
|
|
5981
|
+
onKeyDown: t72,
|
|
5982
|
+
originElement: t82,
|
|
5983
|
+
padding: t92,
|
|
5984
|
+
registerElement: t102,
|
|
5985
|
+
shouldFocus: t112,
|
|
5986
|
+
space: t122,
|
|
5987
|
+
...t132
|
|
5988
|
+
} = props;
|
|
5989
|
+
children = t22, onClickOutside = t32, onEscape = t42, onItemClick = t52, onItemSelect = t62, onKeyDown = t72, originElement = t82, t0 = t92, registerElement = t102, _shouldFocus = t112, t1 = t122, restProps = t132, $[0] = props, $[1] = t0, $[2] = t1, $[3] = _shouldFocus, $[4] = onKeyDown, $[5] = originElement, $[6] = onItemSelect, $[7] = onClickOutside, $[8] = onEscape, $[9] = registerElement, $[10] = onItemClick, $[11] = children, $[12] = restProps;
|
|
5990
|
+
} else
|
|
5991
|
+
t0 = $[1], t1 = $[2], _shouldFocus = $[3], onKeyDown = $[4], originElement = $[5], onItemSelect = $[6], onClickOutside = $[7], onEscape = $[8], registerElement = $[9], onItemClick = $[10], children = $[11], restProps = $[12];
|
|
5992
|
+
const padding = t0 === void 0 ? 1 : t0, space = t1 === void 0 ? 1 : t1, shouldFocus = _shouldFocus != null ? _shouldFocus : props.focusFirst && "first" || props.focusLast && "last" || null, ref = useRef(null);
|
|
5993
|
+
let t2;
|
|
5994
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[13] = t2) : t2 = $[13], useImperativeHandle(forwardedRef, t2);
|
|
5816
5995
|
const {
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
focusLast,
|
|
5822
|
-
onClickOutside,
|
|
5823
|
-
onEscape,
|
|
5824
|
-
onItemClick,
|
|
5825
|
-
onItemSelect,
|
|
5996
|
+
isTopLayer
|
|
5997
|
+
} = useLayer();
|
|
5998
|
+
let t3;
|
|
5999
|
+
$[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t3 = {
|
|
5826
6000
|
onKeyDown,
|
|
5827
6001
|
originElement,
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
shouldFocus = props.focusFirst && "first" || props.focusLast && "last" || null,
|
|
5831
|
-
space = 1,
|
|
5832
|
-
...restProps
|
|
5833
|
-
} = props, ref = useRef(null);
|
|
5834
|
-
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6002
|
+
shouldFocus
|
|
6003
|
+
}, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t3) : t3 = $[17];
|
|
5835
6004
|
const {
|
|
5836
|
-
isTopLayer
|
|
5837
|
-
} = useLayer(), {
|
|
5838
6005
|
activeElement,
|
|
5839
6006
|
activeIndex,
|
|
5840
6007
|
handleItemMouseEnter,
|
|
@@ -5843,22 +6010,31 @@ const Root$5 = styled(Box)`
|
|
|
5843
6010
|
mount,
|
|
5844
6011
|
rootElement,
|
|
5845
6012
|
setRootElement
|
|
5846
|
-
} = useMenuController(
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
shouldFocus
|
|
5850
|
-
}), handleRefChange = useCallback((el) => {
|
|
6013
|
+
} = useMenuController(t3);
|
|
6014
|
+
let t4;
|
|
6015
|
+
$[18] !== setRootElement ? (t4 = (el) => {
|
|
5851
6016
|
setRootElement(el), ref.current = el;
|
|
5852
|
-
}, [setRootElement]);
|
|
5853
|
-
|
|
6017
|
+
}, $[18] = setRootElement, $[19] = t4) : t4 = $[19];
|
|
6018
|
+
const handleRefChange = t4;
|
|
6019
|
+
let t5, t6;
|
|
6020
|
+
$[20] !== onItemSelect || $[21] !== activeIndex ? (t5 = () => {
|
|
5854
6021
|
onItemSelect && onItemSelect(activeIndex);
|
|
5855
|
-
}, [activeIndex, onItemSelect]
|
|
6022
|
+
}, t6 = [activeIndex, onItemSelect], $[20] = onItemSelect, $[21] = activeIndex, $[22] = t5, $[23] = t6) : (t5 = $[22], t6 = $[23]), useEffect(t5, t6);
|
|
6023
|
+
let t7;
|
|
6024
|
+
$[24] !== isTopLayer || $[25] !== onClickOutside ? (t7 = (event) => isTopLayer && onClickOutside && onClickOutside(event), $[24] = isTopLayer, $[25] = onClickOutside, $[26] = t7) : t7 = $[26];
|
|
6025
|
+
let t8;
|
|
6026
|
+
$[27] !== rootElement ? (t8 = [rootElement], $[27] = rootElement, $[28] = t8) : t8 = $[28], useClickOutside(t7, t8);
|
|
6027
|
+
let t9;
|
|
6028
|
+
$[29] !== isTopLayer || $[30] !== onEscape ? (t9 = (event_0) => {
|
|
5856
6029
|
isTopLayer && event_0.key === "Escape" && (event_0.stopPropagation(), onEscape && onEscape());
|
|
5857
|
-
}, [isTopLayer, onEscape])
|
|
6030
|
+
}, $[29] = isTopLayer, $[30] = onEscape, $[31] = t9) : t9 = $[31], useGlobalKeyDown(t9);
|
|
6031
|
+
let t10, t11;
|
|
6032
|
+
$[32] !== rootElement || $[33] !== registerElement ? (t10 = () => {
|
|
5858
6033
|
if (!(!rootElement || !registerElement))
|
|
5859
6034
|
return registerElement(rootElement);
|
|
5860
|
-
}, [registerElement, rootElement]);
|
|
5861
|
-
|
|
6035
|
+
}, t11 = [registerElement, rootElement], $[32] = rootElement, $[33] = registerElement, $[34] = t10, $[35] = t11) : (t10 = $[34], t11 = $[35]), useEffect(t10, t11);
|
|
6036
|
+
let t12, t13;
|
|
6037
|
+
$[36] !== activeElement || $[37] !== activeIndex || $[38] !== mount || $[39] !== onClickOutside || $[40] !== onEscape || $[41] !== onItemClick || $[42] !== handleItemMouseEnter || $[43] !== handleItemMouseLeave || $[44] !== registerElement ? (t13 = {
|
|
5862
6038
|
version: 0,
|
|
5863
6039
|
activeElement,
|
|
5864
6040
|
activeIndex,
|
|
@@ -5869,11 +6045,16 @@ const Root$5 = styled(Box)`
|
|
|
5869
6045
|
onItemMouseEnter: handleItemMouseEnter,
|
|
5870
6046
|
onItemMouseLeave: handleItemMouseLeave,
|
|
5871
6047
|
registerElement,
|
|
5872
|
-
// deprecated
|
|
5873
6048
|
onMouseEnter: handleItemMouseEnter,
|
|
5874
6049
|
onMouseLeave: handleItemMouseLeave
|
|
5875
|
-
}
|
|
5876
|
-
|
|
6050
|
+
}, $[36] = activeElement, $[37] = activeIndex, $[38] = mount, $[39] = onClickOutside, $[40] = onEscape, $[41] = onItemClick, $[42] = handleItemMouseEnter, $[43] = handleItemMouseLeave, $[44] = registerElement, $[45] = t13) : t13 = $[45], t12 = t13;
|
|
6051
|
+
const value = t12;
|
|
6052
|
+
let t14;
|
|
6053
|
+
$[46] !== space || $[47] !== children ? (t14 = /* @__PURE__ */ jsx(Stack, { space, children }), $[46] = space, $[47] = children, $[48] = t14) : t14 = $[48];
|
|
6054
|
+
let t15;
|
|
6055
|
+
$[49] !== restProps || $[50] !== handleKeyDown || $[51] !== padding || $[52] !== handleRefChange || $[53] !== t14 ? (t15 = /* @__PURE__ */ jsx(Root$5, { "data-ui": "Menu", ...restProps, onKeyDown: handleKeyDown, padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t14 }), $[49] = restProps, $[50] = handleKeyDown, $[51] = padding, $[52] = handleRefChange, $[53] = t14, $[54] = t15) : t15 = $[54];
|
|
6056
|
+
let t16;
|
|
6057
|
+
return $[55] !== value || $[56] !== t15 ? (t16 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t15 }), $[55] = value, $[56] = t15, $[57] = t16) : t16 = $[57], t16;
|
|
5877
6058
|
}), MenuButton = forwardRef(function(props, forwardedRef) {
|
|
5878
6059
|
const {
|
|
5879
6060
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
|
|
@@ -6087,20 +6268,23 @@ function useMenu() {
|
|
|
6087
6268
|
return value;
|
|
6088
6269
|
}
|
|
6089
6270
|
function MenuGroup(props) {
|
|
6090
|
-
const
|
|
6091
|
-
|
|
6271
|
+
const $ = c(76);
|
|
6272
|
+
let t0, t1, t2, t3, t4, t5, onClick, children, IconComponent, text, restProps, popover;
|
|
6273
|
+
$[0] !== props ? ({
|
|
6274
|
+
as: t0,
|
|
6092
6275
|
children,
|
|
6093
|
-
fontSize:
|
|
6276
|
+
fontSize: t1,
|
|
6094
6277
|
icon: IconComponent,
|
|
6095
6278
|
onClick,
|
|
6096
|
-
padding
|
|
6279
|
+
padding: t2,
|
|
6097
6280
|
popover,
|
|
6098
|
-
radius:
|
|
6099
|
-
space
|
|
6281
|
+
radius: t3,
|
|
6282
|
+
space: t4,
|
|
6100
6283
|
text,
|
|
6101
|
-
tone
|
|
6284
|
+
tone: t5,
|
|
6102
6285
|
...restProps
|
|
6103
|
-
} = props,
|
|
6286
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = onClick, $[8] = children, $[9] = IconComponent, $[10] = text, $[11] = restProps, $[12] = popover) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], onClick = $[7], children = $[8], IconComponent = $[9], text = $[10], restProps = $[11], popover = $[12]);
|
|
6287
|
+
const as = t0 === void 0 ? "button" : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radiusProp = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu = useMenu(), {
|
|
6104
6288
|
scheme
|
|
6105
6289
|
} = useRootTheme(), {
|
|
6106
6290
|
activeElement,
|
|
@@ -6108,27 +6292,54 @@ function MenuGroup(props) {
|
|
|
6108
6292
|
onClickOutside,
|
|
6109
6293
|
onEscape,
|
|
6110
6294
|
onItemClick,
|
|
6111
|
-
onItemMouseEnter
|
|
6295
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6112
6296
|
registerElement
|
|
6113
|
-
} = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), shouldFocusRef = useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1)
|
|
6297
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), shouldFocusRef = useRef(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1);
|
|
6298
|
+
let t6, t7;
|
|
6299
|
+
$[13] !== radiusProp ? (t7 = _getArrayProp(radiusProp), $[13] = radiusProp, $[14] = t7) : t7 = $[14], t6 = t7;
|
|
6300
|
+
const radius = t6;
|
|
6301
|
+
let t8;
|
|
6302
|
+
$[15] !== onItemMouseEnter ? (t8 = (event) => {
|
|
6114
6303
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
6115
|
-
}, [onItemMouseEnter
|
|
6304
|
+
}, $[15] = onItemMouseEnter, $[16] = t8) : t8 = $[16];
|
|
6305
|
+
const handleMouseEnter = t8;
|
|
6306
|
+
let t9;
|
|
6307
|
+
$[17] !== rootElement ? (t9 = (event_0) => {
|
|
6116
6308
|
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
6117
6309
|
rootElement == null || rootElement.focus();
|
|
6118
6310
|
}));
|
|
6119
|
-
}, [rootElement
|
|
6311
|
+
}, $[17] = rootElement, $[18] = t9) : t9 = $[18];
|
|
6312
|
+
const handleMenuKeyDown = t9;
|
|
6313
|
+
let t10;
|
|
6314
|
+
$[19] !== onClick ? (t10 = (event_1) => {
|
|
6120
6315
|
onClick && onClick(event_1), shouldFocusRef.current = "first", setOpen(!0), requestAnimationFrame(() => {
|
|
6121
6316
|
shouldFocusRef.current = null;
|
|
6122
6317
|
});
|
|
6123
|
-
}, [onClick
|
|
6318
|
+
}, $[19] = onClick, $[20] = t10) : t10 = $[20];
|
|
6319
|
+
const handleClick = t10;
|
|
6320
|
+
let t11;
|
|
6321
|
+
$[21] !== onItemClick ? (t11 = () => {
|
|
6124
6322
|
setOpen(!1), onItemClick && onItemClick();
|
|
6125
|
-
}, [onItemClick
|
|
6126
|
-
|
|
6323
|
+
}, $[21] = onItemClick, $[22] = t11) : t11 = $[22];
|
|
6324
|
+
const handleChildItemClick = t11;
|
|
6325
|
+
let t12;
|
|
6326
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => setWithinMenu(!0), $[23] = t12) : t12 = $[23];
|
|
6327
|
+
const handleMenuMouseEnter = t12;
|
|
6328
|
+
let t13, t14;
|
|
6329
|
+
$[24] !== mount || $[25] !== rootElement ? (t13 = () => mount(rootElement), t14 = [mount, rootElement], $[24] = mount, $[25] = rootElement, $[26] = t13, $[27] = t14) : (t13 = $[26], t14 = $[27]), useEffect(t13, t14);
|
|
6330
|
+
let t15, t16;
|
|
6331
|
+
$[28] !== active ? (t15 = () => {
|
|
6127
6332
|
active || setOpen(!1);
|
|
6128
|
-
}, [active]), useEffect(
|
|
6333
|
+
}, t16 = [active], $[28] = active, $[29] = t15, $[30] = t16) : (t15 = $[29], t16 = $[30]), useEffect(t15, t16);
|
|
6334
|
+
let t17, t18;
|
|
6335
|
+
$[31] !== open ? (t17 = () => {
|
|
6129
6336
|
open || setWithinMenu(!1);
|
|
6130
|
-
}, [open]);
|
|
6131
|
-
|
|
6337
|
+
}, t18 = [open], $[31] = open, $[32] = t17, $[33] = t18) : (t17 = $[32], t18 = $[33]), useEffect(t17, t18);
|
|
6338
|
+
let t19;
|
|
6339
|
+
$[34] !== onClickOutside || $[35] !== onEscape || $[36] !== handleChildItemClick || $[37] !== handleMenuKeyDown || $[38] !== registerElement || $[39] !== children ? (t19 = /* @__PURE__ */ jsx(Menu, { onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus: shouldFocusRef.current, children }), $[34] = onClickOutside, $[35] = onEscape, $[36] = handleChildItemClick, $[37] = handleMenuKeyDown, $[38] = registerElement, $[39] = children, $[40] = t19) : t19 = $[40];
|
|
6340
|
+
const childMenu = t19;
|
|
6341
|
+
let t20;
|
|
6342
|
+
$[41] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
|
|
6132
6343
|
const target = event_2.currentTarget;
|
|
6133
6344
|
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
6134
6345
|
shouldFocusRef.current = "first", setOpen(!0), setWithinMenu(!0), requestAnimationFrame(() => {
|
|
@@ -6136,27 +6347,43 @@ function MenuGroup(props) {
|
|
|
6136
6347
|
});
|
|
6137
6348
|
return;
|
|
6138
6349
|
}
|
|
6139
|
-
}, []);
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
] }) })
|
|
6350
|
+
}, $[41] = t20) : t20 = $[41];
|
|
6351
|
+
const handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as !== "button" ? withinMenu : void 0, t23 = !withinMenu && active ? "" : void 0, t24 = as === "button" ? "button" : void 0;
|
|
6352
|
+
let t25;
|
|
6353
|
+
$[42] !== IconComponent || $[43] !== fontSize2 ? (t25 = IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
6354
|
+
isValidElement(IconComponent) && IconComponent,
|
|
6355
|
+
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
6356
|
+
] }), $[42] = IconComponent, $[43] = fontSize2, $[44] = t25) : t25 = $[44];
|
|
6357
|
+
let t26;
|
|
6358
|
+
$[45] !== fontSize2 || $[46] !== text ? (t26 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[45] = fontSize2, $[46] = text, $[47] = t26) : t26 = $[47];
|
|
6359
|
+
let t27;
|
|
6360
|
+
$[48] === Symbol.for("react.memo_cache_sentinel") ? (t27 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[48] = t27) : t27 = $[48];
|
|
6361
|
+
let t28;
|
|
6362
|
+
$[49] !== fontSize2 ? (t28 = /* @__PURE__ */ jsx(Text, { size: fontSize2, children: t27 }), $[49] = fontSize2, $[50] = t28) : t28 = $[50];
|
|
6363
|
+
let t29;
|
|
6364
|
+
$[51] !== space || $[52] !== padding || $[53] !== t25 || $[54] !== t26 || $[55] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
|
|
6365
|
+
t25,
|
|
6366
|
+
t26,
|
|
6367
|
+
t28
|
|
6368
|
+
] }), $[51] = space, $[52] = padding, $[53] = t25, $[54] = t26, $[55] = t28, $[56] = t29) : t29 = $[56];
|
|
6369
|
+
let t30;
|
|
6370
|
+
$[57] !== as || $[58] !== restProps || $[59] !== t21 || $[60] !== t22 || $[61] !== t23 || $[62] !== radius || $[63] !== tone || $[64] !== scheme || $[65] !== handleClick || $[66] !== handleKeyDown || $[67] !== handleMouseEnter || $[68] !== t24 || $[69] !== t29 ? (t30 = /* @__PURE__ */ jsx(Selectable, { "data-as": as, "data-ui": "MenuGroup", forwardedAs: as, ...restProps, "aria-pressed": t21, "data-pressed": t22, "data-selected": t23, $radius: radius, $tone: tone, $scheme: scheme, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, ref: setRootElement, tabIndex: -1, type: t24, children: t29 }), $[57] = as, $[58] = restProps, $[59] = t21, $[60] = t22, $[61] = t23, $[62] = radius, $[63] = tone, $[64] = scheme, $[65] = handleClick, $[66] = handleKeyDown, $[67] = handleMouseEnter, $[68] = t24, $[69] = t29, $[70] = t30) : t30 = $[70];
|
|
6371
|
+
let t31;
|
|
6372
|
+
return $[71] !== popover || $[72] !== childMenu || $[73] !== open || $[74] !== t30 ? (t31 = /* @__PURE__ */ jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t30 }), $[71] = popover, $[72] = childMenu, $[73] = open, $[74] = t30, $[75] = t31) : t31 = $[75], t31;
|
|
6148
6373
|
}
|
|
6149
6374
|
const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
6150
|
-
const
|
|
6151
|
-
|
|
6375
|
+
const $ = c(78);
|
|
6376
|
+
let t0, t1, t2, t3, t4, t5, selectedProp, disabled, onClick, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, IconComponent, text, IconRightComponent, hotkeys, children, restProps;
|
|
6377
|
+
$[0] !== props ? ({
|
|
6378
|
+
as: t0,
|
|
6152
6379
|
children,
|
|
6153
6380
|
disabled,
|
|
6154
|
-
fontSize:
|
|
6381
|
+
fontSize: t1,
|
|
6155
6382
|
hotkeys,
|
|
6156
6383
|
icon: IconComponent,
|
|
6157
6384
|
iconRight: IconRightComponent,
|
|
6158
6385
|
onClick,
|
|
6159
|
-
padding
|
|
6386
|
+
padding: t2,
|
|
6160
6387
|
paddingX,
|
|
6161
6388
|
paddingY,
|
|
6162
6389
|
paddingTop,
|
|
@@ -6164,25 +6391,33 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6164
6391
|
paddingBottom,
|
|
6165
6392
|
paddingLeft,
|
|
6166
6393
|
pressed,
|
|
6167
|
-
radius
|
|
6394
|
+
radius: t3,
|
|
6168
6395
|
selected: selectedProp,
|
|
6169
|
-
space
|
|
6396
|
+
space: t4,
|
|
6170
6397
|
text,
|
|
6171
|
-
tone
|
|
6398
|
+
tone: t5,
|
|
6172
6399
|
...restProps
|
|
6173
|
-
} = props,
|
|
6400
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = selectedProp, $[8] = disabled, $[9] = onClick, $[10] = paddingX, $[11] = paddingY, $[12] = paddingTop, $[13] = paddingRight, $[14] = paddingBottom, $[15] = paddingLeft, $[16] = pressed, $[17] = IconComponent, $[18] = text, $[19] = IconRightComponent, $[20] = hotkeys, $[21] = children, $[22] = restProps) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], selectedProp = $[7], disabled = $[8], onClick = $[9], paddingX = $[10], paddingY = $[11], paddingTop = $[12], paddingRight = $[13], paddingBottom = $[14], paddingLeft = $[15], pressed = $[16], IconComponent = $[17], text = $[18], IconRightComponent = $[19], hotkeys = $[20], children = $[21], restProps = $[22]);
|
|
6401
|
+
const as = t0 === void 0 ? "button" : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, {
|
|
6174
6402
|
scheme
|
|
6175
6403
|
} = useRootTheme(), menu = useMenu(), {
|
|
6176
6404
|
activeElement,
|
|
6177
6405
|
mount,
|
|
6178
6406
|
onItemClick,
|
|
6179
|
-
onItemMouseEnter
|
|
6180
|
-
onItemMouseLeave
|
|
6181
|
-
} = menu, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
|
|
6182
|
-
|
|
6183
|
-
|
|
6407
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6408
|
+
onItemMouseLeave: _onItemMouseLeave
|
|
6409
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter != null ? _onItemMouseEnter : menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave != null ? _onItemMouseLeave : menu.onMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
|
|
6410
|
+
let t6;
|
|
6411
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], useImperativeHandle(forwardedRef, t6);
|
|
6412
|
+
let t7, t8;
|
|
6413
|
+
$[24] !== mount || $[25] !== rootElement || $[26] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [mount, rootElement, selectedProp], $[24] = mount, $[25] = rootElement, $[26] = selectedProp, $[27] = t7, $[28] = t8) : (t7 = $[27], t8 = $[28]), useEffect(t7, t8);
|
|
6414
|
+
let t9;
|
|
6415
|
+
$[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
|
|
6184
6416
|
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
6185
|
-
}, [disabled, onClick, onItemClick
|
|
6417
|
+
}, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
|
|
6418
|
+
const handleClick = t9;
|
|
6419
|
+
let t10, t11;
|
|
6420
|
+
$[33] !== padding || $[34] !== paddingX || $[35] !== paddingY || $[36] !== paddingTop || $[37] !== paddingRight || $[38] !== paddingBottom || $[39] !== paddingLeft ? (t11 = {
|
|
6186
6421
|
padding,
|
|
6187
6422
|
paddingX,
|
|
6188
6423
|
paddingY,
|
|
@@ -6190,27 +6425,50 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6190
6425
|
paddingRight,
|
|
6191
6426
|
paddingBottom,
|
|
6192
6427
|
paddingLeft
|
|
6193
|
-
}
|
|
6428
|
+
}, $[33] = padding, $[34] = paddingX, $[35] = paddingY, $[36] = paddingTop, $[37] = paddingRight, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = t11) : t11 = $[40], t10 = t11;
|
|
6429
|
+
const paddingProps = t10;
|
|
6430
|
+
let t12, t13;
|
|
6431
|
+
if ($[41] !== fontSize2) {
|
|
6432
|
+
let t142;
|
|
6433
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t142 = (s) => s - 1, $[43] = t142) : t142 = $[43], t13 = _getArrayProp(fontSize2).map(t142), $[41] = fontSize2, $[42] = t13;
|
|
6434
|
+
} else
|
|
6435
|
+
t13 = $[42];
|
|
6436
|
+
t12 = t13;
|
|
6437
|
+
const hotkeysFontSize = t12;
|
|
6438
|
+
let t14, t15;
|
|
6439
|
+
$[44] !== radius ? (t15 = _getArrayProp(radius), $[44] = radius, $[45] = t15) : t15 = $[45], t14 = t15;
|
|
6440
|
+
const $radius = t14;
|
|
6441
|
+
let t16, t17;
|
|
6442
|
+
$[46] === Symbol.for("react.memo_cache_sentinel") ? (t17 = _getArrayProp(0), $[46] = t17) : t17 = $[46], t16 = t17;
|
|
6443
|
+
const $padding = t16;
|
|
6444
|
+
let t18;
|
|
6445
|
+
$[47] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (el) => {
|
|
6194
6446
|
ref.current = el, setRootElement(el);
|
|
6195
|
-
}, []);
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
text && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
6203
|
-
hotkeys && /* @__PURE__ */ jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
|
|
6204
|
-
marginTop: -4,
|
|
6205
|
-
marginBottom: -4
|
|
6206
|
-
} }),
|
|
6207
|
-
IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
6208
|
-
isValidElement(IconRightComponent) && IconRightComponent,
|
|
6209
|
-
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
6210
|
-
] })
|
|
6447
|
+
}, $[47] = t18) : t18 = $[47];
|
|
6448
|
+
const setRef = t18, t19 = as === "button" && pressed, t20 = as !== "button" && pressed ? "" : void 0, t21 = active ? "" : void 0, t22 = disabled ? "" : void 0, t23 = disabled ? "default" : tone, t24 = as === "button" ? "button" : void 0;
|
|
6449
|
+
let t25;
|
|
6450
|
+
$[48] !== IconComponent || $[49] !== text || $[50] !== IconRightComponent || $[51] !== fontSize2 || $[52] !== hotkeys || $[53] !== hotkeysFontSize || $[54] !== space || $[55] !== paddingProps ? (t25 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
|
|
6451
|
+
IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
6452
|
+
isValidElement(IconComponent) && IconComponent,
|
|
6453
|
+
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
6211
6454
|
] }),
|
|
6212
|
-
|
|
6213
|
-
|
|
6455
|
+
text && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
6456
|
+
hotkeys && /* @__PURE__ */ jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
|
|
6457
|
+
marginTop: -4,
|
|
6458
|
+
marginBottom: -4
|
|
6459
|
+
} }),
|
|
6460
|
+
IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
6461
|
+
isValidElement(IconRightComponent) && IconRightComponent,
|
|
6462
|
+
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
6463
|
+
] })
|
|
6464
|
+
] }), $[48] = IconComponent, $[49] = text, $[50] = IconRightComponent, $[51] = fontSize2, $[52] = hotkeys, $[53] = hotkeysFontSize, $[54] = space, $[55] = paddingProps, $[56] = t25) : t25 = $[56];
|
|
6465
|
+
let t26;
|
|
6466
|
+
$[57] !== children || $[58] !== paddingProps ? (t26 = children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children }), $[57] = children, $[58] = paddingProps, $[59] = t26) : t26 = $[59];
|
|
6467
|
+
let t27;
|
|
6468
|
+
return $[60] !== restProps || $[61] !== t19 || $[62] !== t20 || $[63] !== t21 || $[64] !== t22 || $[65] !== as || $[66] !== $radius || $[67] !== t23 || $[68] !== scheme || $[69] !== disabled || $[70] !== handleClick || $[71] !== onItemMouseEnter || $[72] !== onItemMouseLeave || $[73] !== setRef || $[74] !== t24 || $[75] !== t25 || $[76] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Selectable, { "data-ui": "MenuItem", ...restProps, "aria-pressed": t19, "data-pressed": t20, "data-selected": t21, "data-disabled": t22, forwardedAs: as, $radius, $padding, $tone: t23, $scheme: scheme, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, type: t24, children: [
|
|
6469
|
+
t25,
|
|
6470
|
+
t26
|
|
6471
|
+
] }), $[60] = restProps, $[61] = t19, $[62] = t20, $[63] = t21, $[64] = t22, $[65] = as, $[66] = $radius, $[67] = t23, $[68] = scheme, $[69] = disabled, $[70] = handleClick, $[71] = onItemMouseEnter, $[72] = onItemMouseLeave, $[73] = setRef, $[74] = t24, $[75] = t25, $[76] = t26, $[77] = t27) : t27 = $[77], t27;
|
|
6214
6472
|
}), keyframe = keyframes`
|
|
6215
6473
|
0% {
|
|
6216
6474
|
background-position: 100%;
|
|
@@ -6494,15 +6752,86 @@ const subscribe = () => () => {
|
|
|
6494
6752
|
max-width: 420px;
|
|
6495
6753
|
width: 100%;
|
|
6496
6754
|
`;
|
|
6497
|
-
let toastId = 0;
|
|
6498
6755
|
function ToastProvider(props) {
|
|
6499
|
-
const {
|
|
6756
|
+
const $ = c(22), {
|
|
6500
6757
|
children,
|
|
6501
|
-
padding
|
|
6758
|
+
padding: t0,
|
|
6502
6759
|
paddingX,
|
|
6503
6760
|
paddingY,
|
|
6504
6761
|
zOffset
|
|
6505
|
-
} = props,
|
|
6762
|
+
} = props, padding = t0 === void 0 ? 4 : t0;
|
|
6763
|
+
let t1;
|
|
6764
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
6765
|
+
const [state, _setState] = useState(t1);
|
|
6766
|
+
let t2;
|
|
6767
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[1] = t2) : t2 = $[1];
|
|
6768
|
+
const toastsRef = useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
|
|
6769
|
+
let t3, t4;
|
|
6770
|
+
$[2] !== prefersReducedMotion ? (t4 = getVariants(prefersReducedMotion), $[2] = prefersReducedMotion, $[3] = t4) : t4 = $[3], t3 = t4;
|
|
6771
|
+
const variants = t3;
|
|
6772
|
+
let t5, t6;
|
|
6773
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (params) => {
|
|
6774
|
+
const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || crypto.randomUUID(), duration = params.duration || 5e3, dismiss = () => {
|
|
6775
|
+
var _a;
|
|
6776
|
+
const timeoutId = (_a = toastsRef.current[id]) == null ? void 0 : _a.timeoutId;
|
|
6777
|
+
setState((prevState) => {
|
|
6778
|
+
const idx = prevState.findIndex((t) => t.id === id);
|
|
6779
|
+
if (idx > -1) {
|
|
6780
|
+
const toasts = prevState.slice(0);
|
|
6781
|
+
return toasts.splice(idx, 1), toasts;
|
|
6782
|
+
}
|
|
6783
|
+
return prevState;
|
|
6784
|
+
}), timeoutId !== void 0 && (clearTimeout(timeoutId), delete toastsRef.current[id]);
|
|
6785
|
+
};
|
|
6786
|
+
return setState((prevState_0) => prevState_0.filter((t_0) => t_0.id !== id).concat([{
|
|
6787
|
+
dismiss,
|
|
6788
|
+
id,
|
|
6789
|
+
params: {
|
|
6790
|
+
...params,
|
|
6791
|
+
duration
|
|
6792
|
+
}
|
|
6793
|
+
}])), toastsRef.current[id] && (clearTimeout(toastsRef.current[id].timeoutId), delete toastsRef.current[id]), toastsRef.current[id] = {
|
|
6794
|
+
timeoutId: setTimeout(dismiss, duration)
|
|
6795
|
+
}, id;
|
|
6796
|
+
}, $[4] = t6) : t6 = $[4];
|
|
6797
|
+
const push = t6;
|
|
6798
|
+
let t7;
|
|
6799
|
+
$[5] !== push ? (t7 = {
|
|
6800
|
+
version: 0,
|
|
6801
|
+
push
|
|
6802
|
+
}, $[5] = push, $[6] = t7) : t7 = $[6], t5 = t7;
|
|
6803
|
+
const value = t5;
|
|
6804
|
+
let t8, t9;
|
|
6805
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => () => {
|
|
6806
|
+
for (const {
|
|
6807
|
+
timeoutId: timeoutId_0
|
|
6808
|
+
} of Object.values(toastsRef.current))
|
|
6809
|
+
clearTimeout(timeoutId_0);
|
|
6810
|
+
toastsRef.current = {};
|
|
6811
|
+
}, t9 = [], $[7] = t8, $[8] = t9) : (t8 = $[7], t9 = $[8]), useEffect(t8, t9);
|
|
6812
|
+
let t10;
|
|
6813
|
+
$[9] !== mounted || $[10] !== variants || $[11] !== prefersReducedMotion || $[12] !== state || $[13] !== padding || $[14] !== paddingX || $[15] !== paddingY || $[16] !== zOffset ? (t10 = mounted && /* @__PURE__ */ jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map((t112) => {
|
|
6814
|
+
const {
|
|
6815
|
+
dismiss: dismiss_0,
|
|
6816
|
+
id: id_0,
|
|
6817
|
+
params: params_0
|
|
6818
|
+
} = t112;
|
|
6819
|
+
return /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
|
|
6820
|
+
duration: 0
|
|
6821
|
+
} : {
|
|
6822
|
+
type: "spring",
|
|
6823
|
+
damping: 30,
|
|
6824
|
+
stiffness: 400
|
|
6825
|
+
}, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title }) }, id_0);
|
|
6826
|
+
}) }) }) }) }), $[9] = mounted, $[10] = variants, $[11] = prefersReducedMotion, $[12] = state, $[13] = padding, $[14] = paddingX, $[15] = paddingY, $[16] = zOffset, $[17] = t10) : t10 = $[17];
|
|
6827
|
+
let t11;
|
|
6828
|
+
return $[18] !== value || $[19] !== children || $[20] !== t10 ? (t11 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
6829
|
+
children,
|
|
6830
|
+
t10
|
|
6831
|
+
] }), $[18] = value, $[19] = children, $[20] = t10, $[21] = t11) : t11 = $[21], t11;
|
|
6832
|
+
}
|
|
6833
|
+
function getVariants(prefersReducedMotion) {
|
|
6834
|
+
return {
|
|
6506
6835
|
initial: {
|
|
6507
6836
|
opacity: 0,
|
|
6508
6837
|
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
@@ -6520,59 +6849,11 @@ function ToastProvider(props) {
|
|
|
6520
6849
|
opacity: [1, 1, 0],
|
|
6521
6850
|
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
6522
6851
|
scale: 0.5,
|
|
6523
|
-
transition:
|
|
6524
|
-
duration: 0
|
|
6525
|
-
} : {
|
|
6526
|
-
duration: 0.2
|
|
6852
|
+
transition: {
|
|
6853
|
+
duration: prefersReducedMotion ? 0 : 0.2
|
|
6527
6854
|
}
|
|
6528
6855
|
}
|
|
6529
|
-
}
|
|
6530
|
-
version: 0,
|
|
6531
|
-
push: (params) => {
|
|
6532
|
-
const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || String(toastId++), duration = params.duration || 5e3, dismiss = () => {
|
|
6533
|
-
var _a;
|
|
6534
|
-
const timeoutId = (_a = toastsRef.current[id]) == null ? void 0 : _a.timeoutId;
|
|
6535
|
-
setState((prevState) => {
|
|
6536
|
-
const idx = prevState.findIndex((t) => t.id === id);
|
|
6537
|
-
if (idx > -1) {
|
|
6538
|
-
const toasts = prevState.slice(0);
|
|
6539
|
-
return toasts.splice(idx, 1), toasts;
|
|
6540
|
-
}
|
|
6541
|
-
return prevState;
|
|
6542
|
-
}), timeoutId !== void 0 && (clearTimeout(timeoutId), delete toastsRef.current[id]);
|
|
6543
|
-
};
|
|
6544
|
-
return setState((prevState_0) => prevState_0.filter((t_0) => t_0.id !== id).concat([{
|
|
6545
|
-
dismiss,
|
|
6546
|
-
id,
|
|
6547
|
-
params: {
|
|
6548
|
-
...params,
|
|
6549
|
-
duration
|
|
6550
|
-
}
|
|
6551
|
-
}])), toastsRef.current[id] && (clearTimeout(toastsRef.current[id].timeoutId), delete toastsRef.current[id]), toastsRef.current[id] = {
|
|
6552
|
-
timeoutId: setTimeout(dismiss, duration)
|
|
6553
|
-
}, id;
|
|
6554
|
-
}
|
|
6555
|
-
}), []);
|
|
6556
|
-
return useEffect(() => () => {
|
|
6557
|
-
for (const {
|
|
6558
|
-
timeoutId: timeoutId_0
|
|
6559
|
-
} of Object.values(toastsRef.current))
|
|
6560
|
-
clearTimeout(timeoutId_0);
|
|
6561
|
-
toastsRef.current = {};
|
|
6562
|
-
}, []), /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
6563
|
-
children,
|
|
6564
|
-
mounted && /* @__PURE__ */ jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map(({
|
|
6565
|
-
dismiss: dismiss_0,
|
|
6566
|
-
id: id_0,
|
|
6567
|
-
params: params_0
|
|
6568
|
-
}) => /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
|
|
6569
|
-
duration: 0
|
|
6570
|
-
} : {
|
|
6571
|
-
type: "spring",
|
|
6572
|
-
damping: 30,
|
|
6573
|
-
stiffness: 400
|
|
6574
|
-
}, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title }) }, id_0)) }) }) }) })
|
|
6575
|
-
] });
|
|
6856
|
+
};
|
|
6576
6857
|
}
|
|
6577
6858
|
function useToast() {
|
|
6578
6859
|
const value = useContext(ToastContext);
|
|
@@ -6795,6 +7076,24 @@ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalSco
|
|
|
6795
7076
|
return $[35] !== contextValue || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t19 }), $[35] = contextValue, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
|
|
6796
7077
|
}));
|
|
6797
7078
|
Tree.displayName = "Tree";
|
|
7079
|
+
function useTree() {
|
|
7080
|
+
const tree = useContext(TreeContext);
|
|
7081
|
+
if (!tree)
|
|
7082
|
+
throw new Error("Tree: missing context value");
|
|
7083
|
+
return tree;
|
|
7084
|
+
}
|
|
7085
|
+
const TreeGroup = memo(function(props) {
|
|
7086
|
+
const $ = c(9);
|
|
7087
|
+
let t0, restProps, children;
|
|
7088
|
+
$[0] !== props ? ({
|
|
7089
|
+
children,
|
|
7090
|
+
expanded: t0,
|
|
7091
|
+
...restProps
|
|
7092
|
+
} = props, $[0] = props, $[1] = t0, $[2] = restProps, $[3] = children) : (t0 = $[1], restProps = $[2], children = $[3]);
|
|
7093
|
+
const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
|
|
7094
|
+
let t2;
|
|
7095
|
+
return $[4] !== restProps || $[5] !== t1 || $[6] !== tree.space || $[7] !== children ? (t2 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = restProps, $[5] = t1, $[6] = tree.space, $[7] = children, $[8] = t2) : t2 = $[8], t2;
|
|
7096
|
+
});
|
|
6798
7097
|
function treeItemRootStyle() {
|
|
6799
7098
|
return css`
|
|
6800
7099
|
&[role='none'] > [role='treeitem'] {
|
|
@@ -6887,88 +7186,124 @@ function treeItemBoxStyle(props) {
|
|
|
6887
7186
|
}
|
|
6888
7187
|
`;
|
|
6889
7188
|
}
|
|
6890
|
-
|
|
6891
|
-
const tree = useContext(TreeContext);
|
|
6892
|
-
if (!tree)
|
|
6893
|
-
throw new Error("Tree: missing context value");
|
|
6894
|
-
return tree;
|
|
6895
|
-
}
|
|
6896
|
-
const TreeGroup = memo(function(props) {
|
|
6897
|
-
const $ = c(9);
|
|
6898
|
-
let t0, restProps, children;
|
|
6899
|
-
$[0] !== props ? ({
|
|
6900
|
-
children,
|
|
6901
|
-
expanded: t0,
|
|
6902
|
-
...restProps
|
|
6903
|
-
} = props, $[0] = props, $[1] = t0, $[2] = restProps, $[3] = children) : (t0 = $[1], restProps = $[2], children = $[3]);
|
|
6904
|
-
const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
|
|
6905
|
-
let t2;
|
|
6906
|
-
return $[4] !== restProps || $[5] !== t1 || $[6] !== tree.space || $[7] !== children ? (t2 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = restProps, $[5] = t1, $[6] = tree.space, $[7] = children, $[8] = t2) : t2 = $[8], t2;
|
|
6907
|
-
}), Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styled(Box).attrs({
|
|
7189
|
+
const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle)), TreeItemBox = styled(Box).attrs({
|
|
6908
7190
|
forwardedAs: "a"
|
|
6909
7191
|
})(treeItemBoxStyle), ToggleArrowText = styled(Text)`
|
|
6910
7192
|
& > svg {
|
|
6911
7193
|
transition: transform 100ms;
|
|
6912
7194
|
}
|
|
6913
7195
|
`, TreeItem = memo(function(props) {
|
|
6914
|
-
const
|
|
7196
|
+
const $ = c(108);
|
|
7197
|
+
let t0, t1, t2, t3, t4, idProp, onClick, IconComponent, children, muted, text, weight, href, linkAs, restProps;
|
|
7198
|
+
$[0] !== props ? ({
|
|
6915
7199
|
children,
|
|
6916
|
-
expanded:
|
|
6917
|
-
fontSize:
|
|
7200
|
+
expanded: t0,
|
|
7201
|
+
fontSize: t1,
|
|
6918
7202
|
href,
|
|
6919
7203
|
icon: IconComponent,
|
|
6920
7204
|
id: idProp,
|
|
6921
7205
|
linkAs,
|
|
6922
7206
|
muted,
|
|
6923
7207
|
onClick,
|
|
6924
|
-
padding
|
|
6925
|
-
selected
|
|
6926
|
-
space
|
|
7208
|
+
padding: t2,
|
|
7209
|
+
selected: t3,
|
|
7210
|
+
space: t4,
|
|
6927
7211
|
text,
|
|
6928
7212
|
weight,
|
|
6929
7213
|
...restProps
|
|
6930
|
-
} = props,
|
|
7214
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = idProp, $[7] = onClick, $[8] = IconComponent, $[9] = children, $[10] = muted, $[11] = text, $[12] = weight, $[13] = href, $[14] = linkAs, $[15] = restProps) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], idProp = $[6], onClick = $[7], IconComponent = $[8], children = $[9], muted = $[10], text = $[11], weight = $[12], href = $[13], linkAs = $[14], restProps = $[15]);
|
|
7215
|
+
const expandedProp = t0 === void 0 ? !1 : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), {
|
|
6931
7216
|
path,
|
|
6932
7217
|
registerItem,
|
|
6933
7218
|
setExpanded,
|
|
6934
7219
|
setFocusedElement
|
|
6935
|
-
} = tree, _id = useId(), id = idProp || _id
|
|
7220
|
+
} = tree, _id = useId(), id = idProp || _id;
|
|
7221
|
+
let t5;
|
|
7222
|
+
const t6 = id || "";
|
|
7223
|
+
let t7;
|
|
7224
|
+
$[16] !== path || $[17] !== t6 ? (t7 = [...path, t6], $[16] = path, $[17] = t6, $[18] = t7) : t7 = $[18], t5 = t7;
|
|
7225
|
+
const itemPath = t5, itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = (itemState == null ? void 0 : itemState.expanded) === void 0 ? expandedProp : (itemState == null ? void 0 : itemState.expanded) || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1;
|
|
7226
|
+
let t8;
|
|
7227
|
+
const t9 = tree.level + 1;
|
|
7228
|
+
let t10;
|
|
7229
|
+
$[19] !== tree || $[20] !== t9 || $[21] !== itemPath ? (t10 = {
|
|
6936
7230
|
...tree,
|
|
6937
|
-
level:
|
|
7231
|
+
level: t9,
|
|
6938
7232
|
path: itemPath
|
|
6939
|
-
}
|
|
6940
|
-
|
|
7233
|
+
}, $[19] = tree, $[20] = t9, $[21] = itemPath, $[22] = t10) : t10 = $[22], t8 = t10;
|
|
7234
|
+
const contextValue = t8;
|
|
7235
|
+
let t11;
|
|
7236
|
+
$[23] !== onClick || $[24] !== setExpanded || $[25] !== itemKey || $[26] !== expanded || $[27] !== setFocusedElement ? (t11 = (event) => {
|
|
7237
|
+
onClick == null || onClick(event);
|
|
6941
7238
|
const target = event.target;
|
|
6942
7239
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
|
|
6943
|
-
}, [
|
|
7240
|
+
}, $[23] = onClick, $[24] = setExpanded, $[25] = itemKey, $[26] = expanded, $[27] = setFocusedElement, $[28] = t11) : t11 = $[28];
|
|
7241
|
+
const handleClick = t11;
|
|
7242
|
+
let t12;
|
|
7243
|
+
$[29] !== focused ? (t12 = (event_0) => {
|
|
6944
7244
|
if (focused && event_0.key === "Enter") {
|
|
6945
7245
|
const el = treeitemRef.current || rootRef.current;
|
|
6946
7246
|
el == null || el.click();
|
|
6947
7247
|
}
|
|
6948
|
-
}, [focused]);
|
|
6949
|
-
|
|
7248
|
+
}, $[29] = focused, $[30] = t12) : t12 = $[30];
|
|
7249
|
+
const handleKeyDown = t12;
|
|
7250
|
+
let t13, t14;
|
|
7251
|
+
$[31] !== registerItem || $[32] !== itemPath || $[33] !== expanded || $[34] !== selected ? (t13 = () => {
|
|
6950
7252
|
if (rootRef.current)
|
|
6951
7253
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
6952
|
-
}, [expanded, itemPath, registerItem, selected]);
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
7254
|
+
}, t14 = [expanded, itemPath, registerItem, selected], $[31] = registerItem, $[32] = itemPath, $[33] = expanded, $[34] = selected, $[35] = t13, $[36] = t14) : (t13 = $[35], t14 = $[36]), useEffect(t13, t14);
|
|
7255
|
+
let t15;
|
|
7256
|
+
const t16 = IconComponent || children ? "visible" : "hidden";
|
|
7257
|
+
let t17;
|
|
7258
|
+
$[37] !== t16 ? (t17 = {
|
|
7259
|
+
visibility: t16,
|
|
7260
|
+
pointerEvents: "none"
|
|
7261
|
+
}, $[37] = t16, $[38] = t17) : t17 = $[38];
|
|
7262
|
+
let t18;
|
|
7263
|
+
$[39] !== IconComponent || $[40] !== muted || $[41] !== fontSize2 || $[42] !== weight ? (t18 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[39] = IconComponent, $[40] = muted, $[41] = fontSize2, $[42] = weight, $[43] = t18) : t18 = $[43];
|
|
7264
|
+
let t19;
|
|
7265
|
+
$[44] !== IconComponent || $[45] !== expanded || $[46] !== muted || $[47] !== fontSize2 || $[48] !== weight ? (t19 = !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
|
|
7266
|
+
transform: expanded ? "rotate(90deg)" : void 0
|
|
7267
|
+
} }) }), $[44] = IconComponent, $[45] = expanded, $[46] = muted, $[47] = fontSize2, $[48] = weight, $[49] = t19) : t19 = $[49];
|
|
7268
|
+
let t20;
|
|
7269
|
+
$[50] !== space || $[51] !== t17 || $[52] !== t18 || $[53] !== t19 ? (t20 = /* @__PURE__ */ jsxs(Box, { marginRight: space, style: t17, children: [
|
|
7270
|
+
t18,
|
|
7271
|
+
t19
|
|
7272
|
+
] }), $[50] = space, $[51] = t17, $[52] = t18, $[53] = t19, $[54] = t20) : t20 = $[54];
|
|
7273
|
+
let t21;
|
|
7274
|
+
$[55] !== muted || $[56] !== fontSize2 || $[57] !== weight || $[58] !== text ? (t21 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) }), $[55] = muted, $[56] = fontSize2, $[57] = weight, $[58] = text, $[59] = t21) : t21 = $[59];
|
|
7275
|
+
let t22;
|
|
7276
|
+
$[60] !== padding || $[61] !== t20 || $[62] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
7277
|
+
t20,
|
|
7278
|
+
t21
|
|
7279
|
+
] }), $[60] = padding, $[61] = t20, $[62] = t21, $[63] = t22) : t22 = $[63], t15 = t22;
|
|
7280
|
+
const content = t15;
|
|
7281
|
+
if (href) {
|
|
7282
|
+
const t232 = selected ? "" : void 0;
|
|
7283
|
+
let t242;
|
|
7284
|
+
$[64] !== tree.level || $[65] !== expanded || $[66] !== linkAs || $[67] !== href || $[68] !== treeitemRef || $[69] !== tabIndex || $[70] !== content ? (t242 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }), $[64] = tree.level, $[65] = expanded, $[66] = linkAs, $[67] = href, $[68] = treeitemRef, $[69] = tabIndex, $[70] = content, $[71] = t242) : t242 = $[71];
|
|
7285
|
+
let t252;
|
|
7286
|
+
$[72] !== children || $[73] !== expanded ? (t252 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[72] = children, $[73] = expanded, $[74] = t252) : t252 = $[74];
|
|
7287
|
+
let t262;
|
|
7288
|
+
$[75] !== contextValue || $[76] !== t252 ? (t262 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t252 }), $[75] = contextValue, $[76] = t252, $[77] = t262) : t262 = $[77];
|
|
7289
|
+
let t272;
|
|
7290
|
+
return $[78] !== t232 || $[79] !== id || $[80] !== itemKey || $[81] !== restProps || $[82] !== handleClick || $[83] !== rootRef || $[84] !== t242 || $[85] !== t262 ? (t272 = /* @__PURE__ */ jsxs(Root, { "data-selected": t232, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: rootRef, role: "none", children: [
|
|
7291
|
+
t242,
|
|
7292
|
+
t262
|
|
7293
|
+
] }), $[78] = t232, $[79] = id, $[80] = itemKey, $[81] = restProps, $[82] = handleClick, $[83] = rootRef, $[84] = t242, $[85] = t262, $[86] = t272) : t272 = $[86], t272;
|
|
7294
|
+
}
|
|
7295
|
+
const t23 = selected ? "" : void 0;
|
|
7296
|
+
let t24;
|
|
7297
|
+
$[87] !== tree.level || $[88] !== content ? (t24 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }), $[87] = tree.level, $[88] = content, $[89] = t24) : t24 = $[89];
|
|
7298
|
+
let t25;
|
|
7299
|
+
$[90] !== children || $[91] !== expanded ? (t25 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[90] = children, $[91] = expanded, $[92] = t25) : t25 = $[92];
|
|
7300
|
+
let t26;
|
|
7301
|
+
$[93] !== contextValue || $[94] !== t25 ? (t26 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t25 }), $[93] = contextValue, $[94] = t25, $[95] = t26) : t26 = $[95];
|
|
7302
|
+
let t27;
|
|
7303
|
+
return $[96] !== t23 || $[97] !== id || $[98] !== itemKey || $[99] !== restProps || $[100] !== expanded || $[101] !== handleClick || $[102] !== handleKeyDown || $[103] !== rootRef || $[104] !== tabIndex || $[105] !== t24 || $[106] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Root, { "data-selected": t23, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
|
|
7304
|
+
t24,
|
|
7305
|
+
t26
|
|
7306
|
+
] }), $[96] = t23, $[97] = id, $[98] = itemKey, $[99] = restProps, $[100] = expanded, $[101] = handleClick, $[102] = handleKeyDown, $[103] = rootRef, $[104] = tabIndex, $[105] = t24, $[106] = t26, $[107] = t27) : t27 = $[107], t27;
|
|
6972
7307
|
});
|
|
6973
7308
|
export {
|
|
6974
7309
|
Arrow,
|