@sanity/ui 2.16.20 → 2.16.22
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.js +110 -59
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +106 -55
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs.map +1 -1
- package/dist/index.js +52 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -7
- package/src/core/components/toast/toast.tsx +1 -1
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +0 -1
- package/src/core/constants.ts +2 -2
- package/src/core/hooks/useClickOutside.test.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverCard.tsx +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refractor.mjs","sources":["../../src/core/primitives/code/refractor.tsx"],"sourcesContent":["import Refractor from 'react-refractor'\n\nexport default function LazyRefractor(\n props: Partial<Pick<React.ComponentProps<typeof Refractor>, 'language'>> & {\n value: React.ReactNode\n },\n) {\n const {language: languageProp, value} = props\n const language = typeof languageProp === 'string' ? languageProp : undefined\n const registered = language ? Refractor.hasLanguage(language as any) : false\n\n return (\n <>\n {!(language && registered) && <code>{value}</code>}\n {language && registered && <Refractor inline language={language} value={String(value)} />}\n </>\n )\n}\n\nLazyRefractor.displayName = 'LazyRefractor'\n"],"names":["LazyRefractor","props","$","_c","language","languageProp","value","undefined","t0","Refractor","hasLanguage","registered","t1","t2","String","t3","displayName"],"mappings":";;;AAEA,SAAeA,cAAAC,OAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAKb;AAAA,IAAAC,UAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAwCL,OACxCG,WAAiB,OAAOC,gBAAiB,
|
|
1
|
+
{"version":3,"file":"refractor.mjs","sources":["../../src/core/primitives/code/refractor.tsx"],"sourcesContent":["import Refractor from 'react-refractor'\n\nexport default function LazyRefractor(\n props: Partial<Pick<React.ComponentProps<typeof Refractor>, 'language'>> & {\n value: React.ReactNode\n },\n) {\n const {language: languageProp, value} = props\n const language = typeof languageProp === 'string' ? languageProp : undefined\n const registered = language ? Refractor.hasLanguage(language as any) : false\n\n return (\n <>\n {!(language && registered) && <code>{value}</code>}\n {language && registered && <Refractor inline language={language} value={String(value)} />}\n </>\n )\n}\n\nLazyRefractor.displayName = 'LazyRefractor'\n"],"names":["LazyRefractor","props","$","_c","language","languageProp","value","undefined","t0","Refractor","hasLanguage","registered","t1","t2","String","t3","displayName"],"mappings":";;;AAEA,SAAeA,cAAAC,OAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAKb;AAAA,IAAAC,UAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAwCL,OACxCG,WAAiB,OAAOC,gBAAiB,WAAxBA,eAAAE;AAA2D,MAAAC;AAAAN,WAAAE,YACzDI,KAAAJ,WAAWK,UAASC,YAAaN,QAAuB,IAAxD,IAAyDF,OAAAE,UAAAF,OAAAM,MAAAA,KAAAN,EAAA,CAAA;AAA5E,QAAAS,aAAmBH;AAAyD,MAAAI;AAAAV,IAAA,CAAA,MAAAE,YAAAF,SAAAS,cAAAT,EAAA,CAAA,MAAAI,SAIvEM,KAAA,EAAER,YAAAO,mCAA2B,QAAA,EAAOL,UAAAA,MAAAA,CAAM,GAAOJ,OAAAE,UAAAF,OAAAS,YAAAT,OAAAI,OAAAJ,OAAAU,MAAAA,KAAAV,EAAA,CAAA;AAAA,MAAAW;AAAAX,IAAA,CAAA,MAAAE,YAAAF,SAAAS,cAAAT,EAAA,CAAA,MAAAI,SACjDO,KAAAT,YAAAO,kCAA2B,WAAA,EAAU,QAAA,IAAiBP,UAAiB,OAAAU,OAAOR,KAAK,EAAA,CAAC,GAAIJ,OAAAE,UAAAF,OAAAS,YAAAT,OAAAI,OAAAJ,OAAAW,MAAAA,KAAAX,EAAA,CAAA;AAAA,MAAAa;AAAA,SAAAb,EAAA,EAAA,MAAAU,MAAAV,UAAAW,MAF3FE,sCACGH,UAAAA;AAAAA,IAAAA;AAAAA,IACAC;AAAAA,EAAAA,EAAAA,CAAwF,GACxFX,QAAAU,IAAAV,QAAAW,IAAAX,QAAAa,MAAAA,KAAAb,EAAA,EAAA,GAHHa;AAGG;AAIPf,cAAcgB,cAAc;"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"),
|
|
3
|
+
var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), react$1 = require("motion/react");
|
|
4
4
|
function _raf(fn) {
|
|
5
5
|
const frameId = requestAnimationFrame(fn);
|
|
6
6
|
return () => {
|
|
@@ -435,26 +435,63 @@ const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styledComponents.sty
|
|
|
435
435
|
displayName: "ExpandButton",
|
|
436
436
|
componentId: "sc-1es8h8q-1"
|
|
437
437
|
})`appearance:none;margin:-4px;`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
438
|
-
const
|
|
438
|
+
const $ = reactCompilerRuntime.c(44);
|
|
439
|
+
let children, maxLength, restProps, separator, t0;
|
|
440
|
+
$[0] !== props ? ({
|
|
439
441
|
children,
|
|
440
442
|
maxLength,
|
|
441
443
|
separator,
|
|
442
|
-
space:
|
|
444
|
+
space: t0,
|
|
443
445
|
...restProps
|
|
444
|
-
} = props,
|
|
445
|
-
_visualEditing.
|
|
446
|
-
|
|
446
|
+
} = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
|
|
447
|
+
const space = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0), [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null);
|
|
448
|
+
let t1;
|
|
449
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), $[6] = t1) : t1 = $[6];
|
|
450
|
+
const collapse = t1;
|
|
451
|
+
let t2;
|
|
452
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!0), $[7] = t2) : t2 = $[7];
|
|
453
|
+
const expand = t2;
|
|
454
|
+
let t3;
|
|
455
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => [expandElementRef.current, popoverElementRef.current], $[8] = t3) : t3 = $[8], _visualEditing.useClickOutsideEvent(collapse, t3);
|
|
456
|
+
let t4;
|
|
457
|
+
$[9] !== children ? (t4 = react.Children.toArray(children).filter(react.isValidElement), $[9] = children, $[10] = t4) : t4 = $[10];
|
|
458
|
+
const rawItems = t4;
|
|
459
|
+
let t5;
|
|
460
|
+
bb0: {
|
|
447
461
|
const len = rawItems.length;
|
|
448
462
|
if (maxLength && len > maxLength) {
|
|
449
463
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
450
|
-
|
|
464
|
+
let t62;
|
|
465
|
+
if ($[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== open || $[15] !== rawItems || $[16] !== space) {
|
|
466
|
+
const t72 = rawItems.slice(0, beforeLength - 1);
|
|
467
|
+
let t8;
|
|
468
|
+
$[18] !== afterLength || $[19] !== beforeLength || $[20] !== len || $[21] !== rawItems ? (t8 = rawItems.slice(beforeLength - 1, len - afterLength), $[18] = afterLength, $[19] = beforeLength, $[20] = len, $[21] = rawItems, $[22] = t8) : t8 = $[22];
|
|
469
|
+
let t9;
|
|
470
|
+
$[23] !== space || $[24] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", overflow: "auto", padding: space, space, children: t8 }), $[23] = space, $[24] = t8, $[25] = t9) : t9 = $[25];
|
|
471
|
+
const t10 = open ? collapse : expand;
|
|
472
|
+
let t11;
|
|
473
|
+
$[26] !== open || $[27] !== t10 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t10, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[26] = open, $[27] = t10, $[28] = t11) : t11 = $[28];
|
|
474
|
+
let t12;
|
|
475
|
+
$[29] !== open || $[30] !== t11 || $[31] !== t9 ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: t9, open, placement: "top", portal: !0, ref: popoverElementRef, children: t11 }, "button"), $[29] = open, $[30] = t11, $[31] = t9, $[32] = t12) : t12 = $[32], t62 = [...t72, t12, ...rawItems.slice(len - afterLength)], $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t62;
|
|
476
|
+
} else
|
|
477
|
+
t62 = $[17];
|
|
478
|
+
t5 = t62;
|
|
479
|
+
break bb0;
|
|
451
480
|
}
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
481
|
+
t5 = rawItems;
|
|
482
|
+
}
|
|
483
|
+
const items = t5;
|
|
484
|
+
let t6;
|
|
485
|
+
if ($[33] !== items || $[34] !== separator || $[35] !== space) {
|
|
486
|
+
let t72;
|
|
487
|
+
$[37] !== separator || $[38] !== space ? (t72 = (item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
488
|
+
itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
|
|
490
|
+
] }, itemIndex), $[37] = separator, $[38] = space, $[39] = t72) : t72 = $[39], t6 = items.map(t72), $[33] = items, $[34] = separator, $[35] = space, $[36] = t6;
|
|
491
|
+
} else
|
|
492
|
+
t6 = $[36];
|
|
493
|
+
let t7;
|
|
494
|
+
return $[40] !== ref || $[41] !== restProps || $[42] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t6 }), $[40] = ref, $[41] = restProps, $[42] = t6, $[43] = t7) : t7 = $[43], t7;
|
|
458
495
|
});
|
|
459
496
|
Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
|
|
460
497
|
function dialogStyle({
|
|
@@ -1128,7 +1165,7 @@ const container = {
|
|
|
1128
1165
|
visible: {
|
|
1129
1166
|
opacity: 1
|
|
1130
1167
|
}
|
|
1131
|
-
}, MotionToast =
|
|
1168
|
+
}, MotionToast = react$1.motion.create(StyledToast), MotionFlex = react$1.motion.create(_visualEditing.Flex), MotionText = react$1.motion.create(_visualEditing.Text), MotionLoadingBar = react$1.motion.create(LoadingBar), MotionLoadingBarProgress = react$1.motion.create(LoadingBarProgress);
|
|
1132
1169
|
function useMounted() {
|
|
1133
1170
|
return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
|
|
1134
1171
|
}
|
|
@@ -1203,7 +1240,7 @@ function ToastProvider(props) {
|
|
|
1203
1240
|
}, $[1] = t2) : t2 = $[1];
|
|
1204
1241
|
const value = t2;
|
|
1205
1242
|
let t3;
|
|
1206
|
-
$[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1243
|
+
$[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
|
|
1207
1244
|
let t4;
|
|
1208
1245
|
return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
|
|
1209
1246
|
children,
|