@sanity/ui 3.0.0-static.26 → 3.0.0-static.27
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/_chunks-cjs/_visual-editing.cjs +197 -197
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +199 -199
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +1 -0
- package/dist/_visual-editing.d.ts +1 -0
- package/dist/css.cjs +1 -1
- package/dist/css.d.cts +1 -1
- package/dist/css.d.ts +1 -1
- package/dist/css.js +1 -1
- package/dist/index.cjs +141 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +143 -143
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2605 -1075
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2689 -1159
- package/dist/theme.js.map +1 -1
- package/dist/ui.css +1 -1
- package/exports/_visual-editing.ts +1 -1
- package/package.json +13 -26
- package/src/core/components/dialog/dialog.tsx +2 -9
- package/src/core/components/dialog/dialogCard.tsx +2 -1
- package/src/core/components/index.ts +1 -0
- package/src/core/components/menu/menu.tsx +1 -2
- package/src/core/components/toast/toastLayer.tsx +1 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
- package/src/core/primitives/badge/badge.tsx +2 -1
- package/src/core/primitives/index.ts +3 -0
- package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +2 -1
- package/src/core/primitives/popover/popoverLayer.tsx +2 -1
- package/src/core/primitives/stack/stack.tsx +1 -0
- package/src/core/primitives/switch/switch.tsx +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +2 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -1
- package/src/core/utils/getElementRef.ts +1 -0
- package/src/core/utils/index.ts +0 -4
- package/src/css/primitives/avatar/avatar.css.ts +5 -0
- package/src/css/primitives/badge/badge.css.ts +2 -1
- package/src/css/primitives/label/label.css.ts +1 -0
- package/src/css/props/width/types.ts +1 -1
- package/src/css/props/width/width.css.ts +3 -0
- package/src/theme/v2/build/buildTheme.test.ts +8 -8
- package/src/theme/v2/build/buildTheme.ts +32 -7
- /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/index.ts +0 -0
- /package/src/core/{utils → components}/virtualList/virtualList.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/arrow.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
- /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layer.test.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layer.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerCard.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layerProvider.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/types.ts +0 -0
- /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/srOnly.tsx +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), react = require("react"), styledComponents = require("styled-components"), css = require("@sanity/ui/css"), resizeObserver = require("@juggle/resize-observer"), useEffectEvent = require("use-effect-event"), icons = require("@sanity/icons"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"),
|
|
2
|
+
var jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), react = require("react"), styledComponents = require("styled-components"), css = require("@sanity/ui/css"), resizeObserver = require("@juggle/resize-observer"), useEffectEvent = require("use-effect-event"), icons = require("@sanity/icons"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), dynamic = require("@vanilla-extract/dynamic");
|
|
3
3
|
function getGlobalScope() {
|
|
4
4
|
if (typeof globalThis < "u") return globalThis;
|
|
5
5
|
if (typeof window < "u") return window;
|
|
@@ -351,6 +351,113 @@ function useResponsiveProp(val, defaultVal) {
|
|
|
351
351
|
const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
|
|
352
352
|
return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
|
|
353
353
|
}
|
|
354
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
355
|
+
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
356
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
357
|
+
}
|
|
358
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
359
|
+
return {
|
|
360
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
361
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function getRoundedCommands(points) {
|
|
365
|
+
const len = points.length, cmds = [];
|
|
366
|
+
for (let i = 0; i < len; i += 1) {
|
|
367
|
+
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
368
|
+
if (prevPoint && point.radius) {
|
|
369
|
+
const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
|
|
370
|
+
cmds.push({
|
|
371
|
+
type: "point",
|
|
372
|
+
...curveStart
|
|
373
|
+
}), cmds.push({
|
|
374
|
+
type: "curve",
|
|
375
|
+
curveEnd,
|
|
376
|
+
startControl,
|
|
377
|
+
endControl
|
|
378
|
+
});
|
|
379
|
+
} else
|
|
380
|
+
cmds.push({
|
|
381
|
+
type: "point",
|
|
382
|
+
...point
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
return cmds;
|
|
386
|
+
}
|
|
387
|
+
function compileCommands(cmds) {
|
|
388
|
+
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
389
|
+
}
|
|
390
|
+
const DEFAULT_ARROW_ELEMENT = "div";
|
|
391
|
+
function Arrow(props) {
|
|
392
|
+
const $ = reactCompilerRuntime.c(34), t0 = props;
|
|
393
|
+
let h, rest, style, t1, t2, w;
|
|
394
|
+
$[0] !== t0 ? ({
|
|
395
|
+
as: t1,
|
|
396
|
+
width: w,
|
|
397
|
+
height: h,
|
|
398
|
+
radius: t2,
|
|
399
|
+
style,
|
|
400
|
+
...rest
|
|
401
|
+
} = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
|
|
402
|
+
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
403
|
+
let t3;
|
|
404
|
+
const points = [{
|
|
405
|
+
x: 0,
|
|
406
|
+
y: 0
|
|
407
|
+
}, {
|
|
408
|
+
x: radius,
|
|
409
|
+
y: 0,
|
|
410
|
+
radius
|
|
411
|
+
}, {
|
|
412
|
+
x: center,
|
|
413
|
+
y: h - 1,
|
|
414
|
+
radius
|
|
415
|
+
}, {
|
|
416
|
+
x: w - radius,
|
|
417
|
+
y: 0,
|
|
418
|
+
radius
|
|
419
|
+
}, {
|
|
420
|
+
x: w,
|
|
421
|
+
y: 0
|
|
422
|
+
}], cmds = getRoundedCommands(points);
|
|
423
|
+
t3 = compileCommands(cmds);
|
|
424
|
+
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
425
|
+
let t4;
|
|
426
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
427
|
+
const t5 = `${w}px`;
|
|
428
|
+
let t6;
|
|
429
|
+
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
430
|
+
[css.vars.arrow.size]: t5
|
|
431
|
+
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
432
|
+
let t7;
|
|
433
|
+
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
434
|
+
...style,
|
|
435
|
+
...t6
|
|
436
|
+
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
437
|
+
let t8;
|
|
438
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
439
|
+
const t9 = `0 0 ${w} ${w}`;
|
|
440
|
+
let t10;
|
|
441
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
442
|
+
let t11;
|
|
443
|
+
$[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
|
|
444
|
+
let t12;
|
|
445
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
446
|
+
let t13;
|
|
447
|
+
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
448
|
+
let t14;
|
|
449
|
+
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
450
|
+
let t15;
|
|
451
|
+
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
452
|
+
let t16;
|
|
453
|
+
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
454
|
+
t11,
|
|
455
|
+
t13,
|
|
456
|
+
t15
|
|
457
|
+
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
458
|
+
let t17;
|
|
459
|
+
return $[29] !== Element || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
|
|
460
|
+
}
|
|
354
461
|
const DEFAULT_BOX_ELEMENT = "div";
|
|
355
462
|
function Box(props) {
|
|
356
463
|
const $ = reactCompilerRuntime.c(154), t0 = props;
|
|
@@ -784,202 +891,6 @@ function KBD(props) {
|
|
|
784
891
|
let t9;
|
|
785
892
|
return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
786
893
|
}
|
|
787
|
-
const origin = {
|
|
788
|
-
name: "@sanity/ui/origin",
|
|
789
|
-
fn({
|
|
790
|
-
middlewareData,
|
|
791
|
-
placement,
|
|
792
|
-
rects
|
|
793
|
-
}) {
|
|
794
|
-
const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
795
|
-
if (floatingWidth <= 0 || floatingHeight <= 0)
|
|
796
|
-
return {};
|
|
797
|
-
const isVerticalPlacement = ["bottom", "top"].includes(side), {
|
|
798
|
-
originX,
|
|
799
|
-
originY
|
|
800
|
-
} = isVerticalPlacement ? {
|
|
801
|
-
originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
|
|
802
|
-
originY: side === "bottom" ? 0 : 1
|
|
803
|
-
} : {
|
|
804
|
-
originX: side === "left" ? 1 : 0,
|
|
805
|
-
originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
|
|
806
|
-
};
|
|
807
|
-
return {
|
|
808
|
-
data: {
|
|
809
|
-
originX,
|
|
810
|
-
originY
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
function clamp(num, min, max) {
|
|
816
|
-
return Math.min(Math.max(num, min), max);
|
|
817
|
-
}
|
|
818
|
-
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
819
|
-
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
820
|
-
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
821
|
-
}
|
|
822
|
-
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
823
|
-
return {
|
|
824
|
-
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
825
|
-
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
function getRoundedCommands(points) {
|
|
829
|
-
const len = points.length, cmds = [];
|
|
830
|
-
for (let i = 0; i < len; i += 1) {
|
|
831
|
-
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
832
|
-
if (prevPoint && point.radius) {
|
|
833
|
-
const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
|
|
834
|
-
cmds.push({
|
|
835
|
-
type: "point",
|
|
836
|
-
...curveStart
|
|
837
|
-
}), cmds.push({
|
|
838
|
-
type: "curve",
|
|
839
|
-
curveEnd,
|
|
840
|
-
startControl,
|
|
841
|
-
endControl
|
|
842
|
-
});
|
|
843
|
-
} else
|
|
844
|
-
cmds.push({
|
|
845
|
-
type: "point",
|
|
846
|
-
...point
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
return cmds;
|
|
850
|
-
}
|
|
851
|
-
function compileCommands(cmds) {
|
|
852
|
-
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
853
|
-
}
|
|
854
|
-
const DEFAULT_ARROW_ELEMENT = "div";
|
|
855
|
-
function Arrow(props) {
|
|
856
|
-
const $ = reactCompilerRuntime.c(34), t0 = props;
|
|
857
|
-
let h, rest, style, t1, t2, w;
|
|
858
|
-
$[0] !== t0 ? ({
|
|
859
|
-
as: t1,
|
|
860
|
-
width: w,
|
|
861
|
-
height: h,
|
|
862
|
-
radius: t2,
|
|
863
|
-
style,
|
|
864
|
-
...rest
|
|
865
|
-
} = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
|
|
866
|
-
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
867
|
-
let t3;
|
|
868
|
-
const points = [{
|
|
869
|
-
x: 0,
|
|
870
|
-
y: 0
|
|
871
|
-
}, {
|
|
872
|
-
x: radius,
|
|
873
|
-
y: 0,
|
|
874
|
-
radius
|
|
875
|
-
}, {
|
|
876
|
-
x: center,
|
|
877
|
-
y: h - 1,
|
|
878
|
-
radius
|
|
879
|
-
}, {
|
|
880
|
-
x: w - radius,
|
|
881
|
-
y: 0,
|
|
882
|
-
radius
|
|
883
|
-
}, {
|
|
884
|
-
x: w,
|
|
885
|
-
y: 0
|
|
886
|
-
}], cmds = getRoundedCommands(points);
|
|
887
|
-
t3 = compileCommands(cmds);
|
|
888
|
-
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
889
|
-
let t4;
|
|
890
|
-
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
891
|
-
const t5 = `${w}px`;
|
|
892
|
-
let t6;
|
|
893
|
-
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
894
|
-
[css.vars.arrow.size]: t5
|
|
895
|
-
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
896
|
-
let t7;
|
|
897
|
-
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
898
|
-
...style,
|
|
899
|
-
...t6
|
|
900
|
-
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
901
|
-
let t8;
|
|
902
|
-
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
903
|
-
const t9 = `0 0 ${w} ${w}`;
|
|
904
|
-
let t10;
|
|
905
|
-
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
906
|
-
let t11;
|
|
907
|
-
$[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
|
|
908
|
-
let t12;
|
|
909
|
-
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
910
|
-
let t13;
|
|
911
|
-
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
912
|
-
let t14;
|
|
913
|
-
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
914
|
-
let t15;
|
|
915
|
-
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
916
|
-
let t16;
|
|
917
|
-
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
918
|
-
t11,
|
|
919
|
-
t13,
|
|
920
|
-
t15
|
|
921
|
-
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
922
|
-
let t17;
|
|
923
|
-
return $[29] !== Element || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
|
|
924
|
-
}
|
|
925
|
-
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
926
|
-
version: 0,
|
|
927
|
-
element: null
|
|
928
|
-
};
|
|
929
|
-
function useBoundaryElement() {
|
|
930
|
-
const value = react.useContext(BoundaryElementContext);
|
|
931
|
-
if (value && (!isRecord(value) || value.version !== 0))
|
|
932
|
-
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
933
|
-
return value || DEFAULT_VALUE;
|
|
934
|
-
}
|
|
935
|
-
function findMaxBreakpoints(media2, width) {
|
|
936
|
-
const ret = [];
|
|
937
|
-
for (let i = 0; i < media2.length; i += 1)
|
|
938
|
-
media2[i] > width && ret.push(i);
|
|
939
|
-
return ret;
|
|
940
|
-
}
|
|
941
|
-
function findMinBreakpoints(media2, width) {
|
|
942
|
-
const ret = [];
|
|
943
|
-
for (let i = 0; i < media2.length; i += 1)
|
|
944
|
-
media2[i] <= width && ret.push(i);
|
|
945
|
-
return ret;
|
|
946
|
-
}
|
|
947
|
-
const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
|
|
948
|
-
function ElementQuery(props) {
|
|
949
|
-
const $ = reactCompilerRuntime.c(21), t0 = props;
|
|
950
|
-
let children, forwardedRef, mediaProp, rest, t1;
|
|
951
|
-
$[0] !== t0 ? ({
|
|
952
|
-
as: t1,
|
|
953
|
-
children,
|
|
954
|
-
media: mediaProp,
|
|
955
|
-
ref: forwardedRef,
|
|
956
|
-
...rest
|
|
957
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
|
|
958
|
-
const Element = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
|
|
959
|
-
let t2;
|
|
960
|
-
t2 = elementSize?.border.width ?? window.innerWidth;
|
|
961
|
-
const width = t2;
|
|
962
|
-
let t3, t4;
|
|
963
|
-
if ($[6] !== breakpoints || $[7] !== width) {
|
|
964
|
-
const eq = findMaxBreakpoints(breakpoints, width);
|
|
965
|
-
t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
|
|
966
|
-
} else
|
|
967
|
-
t4 = $[8];
|
|
968
|
-
t3 = t4;
|
|
969
|
-
const max = t3;
|
|
970
|
-
let t5, t6;
|
|
971
|
-
if ($[9] !== breakpoints || $[10] !== width) {
|
|
972
|
-
const eq_0 = findMinBreakpoints(breakpoints, width);
|
|
973
|
-
t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
|
|
974
|
-
} else
|
|
975
|
-
t6 = $[11];
|
|
976
|
-
t5 = t6;
|
|
977
|
-
const min = t5;
|
|
978
|
-
let t7, t8;
|
|
979
|
-
$[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
|
|
980
|
-
let t9;
|
|
981
|
-
return $[15] !== Element || $[16] !== children || $[17] !== max || $[18] !== min || $[19] !== rest ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "ElementQuery", ...rest, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[15] = Element, $[16] = children, $[17] = max, $[18] = min, $[19] = rest, $[20] = t9) : t9 = $[20], t9;
|
|
982
|
-
}
|
|
983
894
|
function getLayerContext(contextValue) {
|
|
984
895
|
if (!isRecord(contextValue) || contextValue.version !== 0)
|
|
985
896
|
throw new Error("the context value is not compatible");
|
|
@@ -1110,6 +1021,95 @@ function Layer(props) {
|
|
|
1110
1021
|
let t4;
|
|
1111
1022
|
return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
|
|
1112
1023
|
}
|
|
1024
|
+
const origin = {
|
|
1025
|
+
name: "@sanity/ui/origin",
|
|
1026
|
+
fn({
|
|
1027
|
+
middlewareData,
|
|
1028
|
+
placement,
|
|
1029
|
+
rects
|
|
1030
|
+
}) {
|
|
1031
|
+
const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
1032
|
+
if (floatingWidth <= 0 || floatingHeight <= 0)
|
|
1033
|
+
return {};
|
|
1034
|
+
const isVerticalPlacement = ["bottom", "top"].includes(side), {
|
|
1035
|
+
originX,
|
|
1036
|
+
originY
|
|
1037
|
+
} = isVerticalPlacement ? {
|
|
1038
|
+
originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
|
|
1039
|
+
originY: side === "bottom" ? 0 : 1
|
|
1040
|
+
} : {
|
|
1041
|
+
originX: side === "left" ? 1 : 0,
|
|
1042
|
+
originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
|
|
1043
|
+
};
|
|
1044
|
+
return {
|
|
1045
|
+
data: {
|
|
1046
|
+
originX,
|
|
1047
|
+
originY
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
function clamp(num, min, max) {
|
|
1053
|
+
return Math.min(Math.max(num, min), max);
|
|
1054
|
+
}
|
|
1055
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
1056
|
+
version: 0,
|
|
1057
|
+
element: null
|
|
1058
|
+
};
|
|
1059
|
+
function useBoundaryElement() {
|
|
1060
|
+
const value = react.useContext(BoundaryElementContext);
|
|
1061
|
+
if (value && (!isRecord(value) || value.version !== 0))
|
|
1062
|
+
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
1063
|
+
return value || DEFAULT_VALUE;
|
|
1064
|
+
}
|
|
1065
|
+
function findMaxBreakpoints(media2, width) {
|
|
1066
|
+
const ret = [];
|
|
1067
|
+
for (let i = 0; i < media2.length; i += 1)
|
|
1068
|
+
media2[i] > width && ret.push(i);
|
|
1069
|
+
return ret;
|
|
1070
|
+
}
|
|
1071
|
+
function findMinBreakpoints(media2, width) {
|
|
1072
|
+
const ret = [];
|
|
1073
|
+
for (let i = 0; i < media2.length; i += 1)
|
|
1074
|
+
media2[i] <= width && ret.push(i);
|
|
1075
|
+
return ret;
|
|
1076
|
+
}
|
|
1077
|
+
const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
|
|
1078
|
+
function ElementQuery(props) {
|
|
1079
|
+
const $ = reactCompilerRuntime.c(21), t0 = props;
|
|
1080
|
+
let children, forwardedRef, mediaProp, rest, t1;
|
|
1081
|
+
$[0] !== t0 ? ({
|
|
1082
|
+
as: t1,
|
|
1083
|
+
children,
|
|
1084
|
+
media: mediaProp,
|
|
1085
|
+
ref: forwardedRef,
|
|
1086
|
+
...rest
|
|
1087
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
|
|
1088
|
+
const Element = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
|
|
1089
|
+
let t2;
|
|
1090
|
+
t2 = elementSize?.border.width ?? window.innerWidth;
|
|
1091
|
+
const width = t2;
|
|
1092
|
+
let t3, t4;
|
|
1093
|
+
if ($[6] !== breakpoints || $[7] !== width) {
|
|
1094
|
+
const eq = findMaxBreakpoints(breakpoints, width);
|
|
1095
|
+
t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
|
|
1096
|
+
} else
|
|
1097
|
+
t4 = $[8];
|
|
1098
|
+
t3 = t4;
|
|
1099
|
+
const max = t3;
|
|
1100
|
+
let t5, t6;
|
|
1101
|
+
if ($[9] !== breakpoints || $[10] !== width) {
|
|
1102
|
+
const eq_0 = findMinBreakpoints(breakpoints, width);
|
|
1103
|
+
t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
|
|
1104
|
+
} else
|
|
1105
|
+
t6 = $[11];
|
|
1106
|
+
t5 = t6;
|
|
1107
|
+
const min = t5;
|
|
1108
|
+
let t7, t8;
|
|
1109
|
+
$[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
|
|
1110
|
+
let t9;
|
|
1111
|
+
return $[15] !== Element || $[16] !== children || $[17] !== max || $[18] !== min || $[19] !== rest ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "ElementQuery", ...rest, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[15] = Element, $[16] = children, $[17] = max, $[18] = min, $[19] = rest, $[20] = t9) : t9 = $[20], t9;
|
|
1112
|
+
}
|
|
1113
1113
|
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
1114
1114
|
globalScope[elementKey] = null;
|
|
1115
1115
|
const defaultContextValue = {
|