@sanity/ui 1.1.0 → 1.2.1

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89;
4
4
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
5
  Object.defineProperty(exports, '__esModule', {
6
6
  value: true
@@ -5275,6 +5275,18 @@ class ErrorBoundary extends react.Component {
5275
5275
  return this.props.children;
5276
5276
  }
5277
5277
  }
5278
+ function getLayerContext(contextValue) {
5279
+ if (!isRecord(contextValue) || contextValue.version !== 0) {
5280
+ throw new Error("the context value is not compatible");
5281
+ }
5282
+ if (!contextValue) {
5283
+ throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
5284
+ }
5285
+ if (contextValue.version === 0) {
5286
+ return contextValue;
5287
+ }
5288
+ throw new Error("could not get layer context");
5289
+ }
5278
5290
  const key$5 = Symbol.for("@sanity/ui/context/layer");
5279
5291
  globalScope[key$5] = globalScope[key$5] || react.createContext(null);
5280
5292
  const LayerContext = globalScope[key$5];
@@ -5283,57 +5295,215 @@ function useLayer() {
5283
5295
  if (!value) {
5284
5296
  throw new Error("useLayer(): missing context value");
5285
5297
  }
5286
- if (!isRecord(value) || value.version !== 0) {
5287
- throw new Error("useLayer(): the context value is not compatible");
5298
+ try {
5299
+ return getLayerContext(value);
5300
+ } catch (err) {
5301
+ if (err instanceof Error) {
5302
+ throw new Error("useLayer(): ".concat(err.message));
5303
+ } else {
5304
+ throw new Error("useLayer(): ".concat(err));
5305
+ }
5288
5306
  }
5289
- return value;
5307
+ }
5308
+ function _raf(fn) {
5309
+ const frameId = requestAnimationFrame(fn);
5310
+ return () => {
5311
+ cancelAnimationFrame(frameId);
5312
+ };
5313
+ }
5314
+ function _raf2(fn) {
5315
+ let innerDispose = null;
5316
+ const outerDispose = _raf(() => {
5317
+ innerDispose = _raf(fn);
5318
+ });
5319
+ return () => {
5320
+ if (innerDispose) innerDispose();
5321
+ outerDispose();
5322
+ };
5323
+ }
5324
+ function _isEnterToClickElement(element) {
5325
+ return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
5326
+ }
5327
+ function isHTMLElement(node) {
5328
+ return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
5329
+ }
5330
+ function isHTMLAnchorElement(element) {
5331
+ return isHTMLElement(element) && element.nodeName === "A";
5332
+ }
5333
+ function isHTMLInputElement(element) {
5334
+ return isHTMLElement(element) && element.nodeName === "INPUT";
5335
+ }
5336
+ function isHTMLButtonElement(element) {
5337
+ return isHTMLElement(element) && element.nodeName === "BUTTON";
5338
+ }
5339
+ function isHTMLSelectElement(element) {
5340
+ return isHTMLElement(element) && element.nodeName === "SELECT";
5341
+ }
5342
+ function isHTMLTextAreaElement(element) {
5343
+ return isHTMLElement(element) && element.nodeName === "TEXTAREA";
5344
+ }
5345
+ function containsOrEqualsElement(element, node) {
5346
+ return element.contains(node) || element === node;
5347
+ }
5348
+ function _hasFocus(element) {
5349
+ return Boolean(document.activeElement) && element.contains(document.activeElement);
5350
+ }
5351
+ function isFocusable(element) {
5352
+ if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
5353
+ return true;
5354
+ }
5355
+ if (isHTMLAnchorElement(element)) {
5356
+ return Boolean(element.href) && element.rel !== "ignore";
5357
+ }
5358
+ if (isHTMLInputElement(element)) {
5359
+ return element.type !== "hidden" && element.type !== "file" && !element.disabled;
5360
+ }
5361
+ if (isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element)) {
5362
+ return !element.disabled;
5363
+ }
5364
+ return false;
5365
+ }
5366
+ function attemptFocus(element) {
5367
+ if (!isFocusable(element)) {
5368
+ return false;
5369
+ }
5370
+ try {
5371
+ element.focus();
5372
+ } catch (_) {}
5373
+ return document.activeElement === element;
5374
+ }
5375
+ function focusFirstDescendant(element) {
5376
+ for (let i = 0; i < element.childNodes.length; i++) {
5377
+ const child = element.childNodes[i];
5378
+ if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) {
5379
+ return true;
5380
+ }
5381
+ }
5382
+ return false;
5383
+ }
5384
+ function focusLastDescendant(element) {
5385
+ for (let i = element.childNodes.length - 1; i >= 0; i--) {
5386
+ const child = element.childNodes[i];
5387
+ if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) {
5388
+ return true;
5389
+ }
5390
+ }
5391
+ return false;
5392
+ }
5393
+ function _isScrollable(el) {
5394
+ if (!(el instanceof Element)) return false;
5395
+ const style = window.getComputedStyle(el);
5396
+ return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
5290
5397
  }
5291
5398
  function LayerProvider(props) {
5399
+ var _a;
5292
5400
  const {
5293
5401
  children,
5294
5402
  zOffset: zOffsetProp = 0
5295
5403
  } = props;
5296
- const parent = react.useContext(LayerContext);
5404
+ const parentContextValue = react.useContext(LayerContext);
5405
+ const parent = parentContextValue && getLayerContext(parentContextValue);
5406
+ const parentRegisterChild = parent == null ? void 0 : parent.registerChild;
5407
+ const parentLevel = (_a = parent == null ? void 0 : parent.level) != null ? _a : 0;
5408
+ const level = parentLevel + 1;
5297
5409
  const zOffset = useArrayProp(zOffsetProp);
5298
5410
  const maxMediaIndex = zOffset.length - 1;
5299
5411
  const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
5300
5412
  const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
5413
+ const [, setChildLayers] = react.useState({});
5301
5414
  const [size, setSize] = react.useState(0);
5302
- const registerChild = react.useCallback(() => {
5303
- setSize(v => v + 1);
5304
- return () => setSize(v => v - 1);
5305
- }, []);
5306
- const parentRegisterChild = parent == null ? void 0 : parent.registerChild;
5307
- react.useEffect(() => {
5308
- if (!parentRegisterChild) return;
5309
- return parentRegisterChild();
5415
+ const isTopLayer = size === 0;
5416
+ const registerChild = react.useCallback(childLevel => {
5417
+ const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
5418
+ if (childLevel !== void 0) {
5419
+ setChildLayers(state => {
5420
+ var _a2;
5421
+ const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0;
5422
+ const nextState = {
5423
+ ...state,
5424
+ [childLevel]: prevLen + 1
5425
+ };
5426
+ setSize(Object.keys(nextState).length);
5427
+ return nextState;
5428
+ });
5429
+ } else {
5430
+ setSize(v => v + 1);
5431
+ }
5432
+ return () => {
5433
+ if (childLevel !== void 0) {
5434
+ setChildLayers(state => {
5435
+ const nextState = {
5436
+ ...state
5437
+ };
5438
+ if (nextState[childLevel] === 1) {
5439
+ delete nextState[childLevel];
5440
+ setSize(Object.keys(nextState).length);
5441
+ } else {
5442
+ nextState[childLevel] -= 1;
5443
+ }
5444
+ return nextState;
5445
+ });
5446
+ } else {
5447
+ setSize(v => v - 1);
5448
+ }
5449
+ parentDispose == null ? void 0 : parentDispose();
5450
+ };
5310
5451
  }, [parentRegisterChild]);
5452
+ react.useEffect(() => parentRegisterChild == null ? void 0 : parentRegisterChild(level), [level, parentRegisterChild]);
5311
5453
  const value = react.useMemo(() => ({
5312
5454
  version: 0,
5313
- isTopLayer: size === 0,
5455
+ isTopLayer,
5456
+ level,
5314
5457
  registerChild,
5315
5458
  size,
5316
5459
  zIndex
5317
- }), [size, registerChild, zIndex]);
5460
+ }), [isTopLayer, level, registerChild, size, zIndex]);
5318
5461
  return /* @__PURE__ */jsxRuntime.jsx(LayerContext.Provider, {
5319
5462
  value,
5320
5463
  children
5321
5464
  });
5322
5465
  }
5323
- const Root$m = styled__default.default.div(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5466
+ const Root$m = styled__default.default.div({
5467
+ position: "relative"
5468
+ });
5324
5469
  const LayerChildren = react.forwardRef(function LayerChildren2(props, ref) {
5325
5470
  const {
5326
5471
  children,
5472
+ onActivate,
5473
+ onFocus,
5327
5474
  style = EMPTY_RECORD,
5328
5475
  ...restProps
5329
5476
  } = props;
5330
5477
  const {
5331
- zIndex
5478
+ zIndex,
5479
+ isTopLayer
5332
5480
  } = useLayer();
5481
+ const lastFocusedRef = react.useRef(null);
5482
+ const forwardedRef = useForwardedRef(ref);
5483
+ const isTopLayerRef = react.useRef(isTopLayer);
5484
+ react.useEffect(() => {
5485
+ const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer;
5486
+ if (becameTopLayer) {
5487
+ onActivate == null ? void 0 : onActivate({
5488
+ activeElement: lastFocusedRef.current
5489
+ });
5490
+ }
5491
+ isTopLayerRef.current = isTopLayer;
5492
+ }, [isTopLayer, onActivate]);
5493
+ const handleFocus = react.useCallback(event => {
5494
+ onFocus == null ? void 0 : onFocus(event);
5495
+ const rootElement = forwardedRef.current;
5496
+ const target = document.activeElement;
5497
+ if (!isTopLayer || !rootElement || !target) return;
5498
+ if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {
5499
+ lastFocusedRef.current = target;
5500
+ }
5501
+ }, [forwardedRef, isTopLayer, onFocus]);
5333
5502
  return /* @__PURE__ */jsxRuntime.jsx(Root$m, {
5334
5503
  ...restProps,
5335
5504
  "data-ui": "Layer",
5336
- ref,
5505
+ onFocus: handleFocus,
5506
+ ref: forwardedRef,
5337
5507
  style: {
5338
5508
  ...style,
5339
5509
  zIndex
@@ -5440,7 +5610,7 @@ function PortalProvider(props) {
5440
5610
  children
5441
5611
  });
5442
5612
  }
5443
- const Root$l = styled__default.default.div(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5613
+ const Root$l = styled__default.default.div(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5444
5614
  const SrOnly = react.forwardRef(function SrOnly2(props, ref) {
5445
5615
  const {
5446
5616
  as,
@@ -5454,95 +5624,8 @@ const SrOnly = react.forwardRef(function SrOnly2(props, ref) {
5454
5624
  children
5455
5625
  });
5456
5626
  });
5457
- function _raf(fn) {
5458
- const frameId = requestAnimationFrame(fn);
5459
- return () => {
5460
- cancelAnimationFrame(frameId);
5461
- };
5462
- }
5463
- function _raf2(fn) {
5464
- let innerDispose = null;
5465
- const outerDispose = _raf(() => {
5466
- innerDispose = _raf(fn);
5467
- });
5468
- return () => {
5469
- if (innerDispose) innerDispose();
5470
- outerDispose();
5471
- };
5472
- }
5473
- function _isEnterToClickElement(element) {
5474
- return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
5475
- }
5476
- function isHTMLElement(node) {
5477
- return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
5478
- }
5479
- function isHTMLAnchorElement(element) {
5480
- return isHTMLElement(element) && element.nodeName === "A";
5481
- }
5482
- function isHTMLInputElement(element) {
5483
- return isHTMLElement(element) && element.nodeName === "INPUT";
5484
- }
5485
- function isHTMLButtonElement(element) {
5486
- return isHTMLElement(element) && element.nodeName === "BUTTON";
5487
- }
5488
- function isHTMLSelectElement(element) {
5489
- return isHTMLElement(element) && element.nodeName === "SELECT";
5490
- }
5491
- function isHTMLTextAreaElement(element) {
5492
- return isHTMLElement(element) && element.nodeName === "TEXTAREA";
5493
- }
5494
- function _hasFocus(element) {
5495
- return Boolean(document.activeElement) && element.contains(document.activeElement);
5496
- }
5497
- function isFocusable(element) {
5498
- if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
5499
- return true;
5500
- }
5501
- if (isHTMLAnchorElement(element)) {
5502
- return Boolean(element.href) && element.rel !== "ignore";
5503
- }
5504
- if (isHTMLInputElement(element)) {
5505
- return element.type !== "hidden" && element.type !== "file" && !element.disabled;
5506
- }
5507
- if (isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element)) {
5508
- return !element.disabled;
5509
- }
5510
- return false;
5511
- }
5512
- function attemptFocus(element) {
5513
- if (!isFocusable(element)) {
5514
- return false;
5515
- }
5516
- try {
5517
- element.focus();
5518
- } catch (_) {}
5519
- return document.activeElement === element;
5520
- }
5521
- function focusFirstDescendant(element) {
5522
- for (let i = 0; i < element.childNodes.length; i++) {
5523
- const child = element.childNodes[i];
5524
- if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) {
5525
- return true;
5526
- }
5527
- }
5528
- return false;
5529
- }
5530
- function focusLastDescendant(element) {
5531
- for (let i = element.childNodes.length - 1; i >= 0; i--) {
5532
- const child = element.childNodes[i];
5533
- if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) {
5534
- return true;
5535
- }
5536
- }
5537
- return false;
5538
- }
5539
- function _isScrollable(el) {
5540
- if (!(el instanceof Element)) return false;
5541
- const style = window.getComputedStyle(el);
5542
- return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
5543
- }
5544
- const Root$k = styled__default.default.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5545
- const ItemWrapper = styled__default.default.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5627
+ const Root$k = styled__default.default.div(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5628
+ const ItemWrapper = styled__default.default.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5546
5629
  const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
5547
5630
  const {
5548
5631
  as = "div",
@@ -5731,9 +5814,9 @@ function size(options) {
5731
5814
  }
5732
5815
  };
5733
5816
  }
5734
- const Root$j = styled__default.default.div(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: ", "px;\n height: ", "px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ", "px ", "px;\n }\n\n [data-placement^='top'] > & {\n bottom: -", "px;\n }\n\n [data-placement^='right'] > & {\n left: -", "px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -", "px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -", "px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])), DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH);
5735
- const BorderPath = styled__default.default.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
5736
- const ShapePath = styled__default.default.path(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
5817
+ const Root$j = styled__default.default.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: ", "px;\n height: ", "px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ", "px ", "px;\n }\n\n [data-placement^='top'] > & {\n bottom: -", "px;\n }\n\n [data-placement^='right'] > & {\n left: -", "px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -", "px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -", "px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])), DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH);
5818
+ const BorderPath = styled__default.default.path(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
5819
+ const ShapePath = styled__default.default.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
5737
5820
  const PopoverArrow = react.forwardRef(function PopoverArrow2(props, ref) {
5738
5821
  return /* @__PURE__ */jsxRuntime.jsx(Root$j, {
5739
5822
  "data-ui": "Popover__arrow",
@@ -5768,7 +5851,7 @@ function popoverCardStyle(props) {
5768
5851
  };
5769
5852
  }
5770
5853
  const Root$i = react.memo(styled__default.default(Card)(popoverCardStyle));
5771
- const PopoverContainer = react.memo(styled__default.default(Container)(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
5854
+ const PopoverContainer = react.memo(styled__default.default(Container)(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
5772
5855
  const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref) {
5773
5856
  const {
5774
5857
  __unstable_margins: marginsProp,
@@ -6020,7 +6103,7 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6020
6103
  }));
6021
6104
  Popover.displayName = "Popover";
6022
6105
  function radioBaseStyle() {
6023
- return styled.css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
6106
+ return styled.css(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
6024
6107
  }
6025
6108
  function inputElementStyle(props) {
6026
6109
  const {
@@ -6032,7 +6115,7 @@ function inputElementStyle(props) {
6032
6115
  } = theme.sanity;
6033
6116
  const color = theme.sanity.color.input;
6034
6117
  const dist = (input.radio.size - input.radio.markSize) / 2;
6035
- return styled.css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
6118
+ return styled.css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
6036
6119
  color: color.default.enabled.border,
6037
6120
  width: input.border.width
6038
6121
  }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
@@ -6074,14 +6157,14 @@ const Radio = react.forwardRef(function Radio2(props, forwardedRef) {
6074
6157
  });
6075
6158
  });
6076
6159
  function rootStyle() {
6077
- return styled.css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6160
+ return styled.css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6078
6161
  }
6079
6162
  function inputBaseStyle(props) {
6080
6163
  const {
6081
6164
  theme
6082
6165
  } = props;
6083
6166
  const font = theme.sanity.fonts.text;
6084
- return styled.css(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ", ";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])), font.family);
6167
+ return styled.css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ", ";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])), font.family);
6085
6168
  }
6086
6169
  function inputColorStyle(props) {
6087
6170
  const {
@@ -6092,7 +6175,7 @@ function inputColorStyle(props) {
6092
6175
  input
6093
6176
  } = theme.sanity;
6094
6177
  const color = theme.sanity.color.input;
6095
- return styled.css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
6178
+ return styled.css(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
6096
6179
  color: color.default.enabled.border,
6097
6180
  width: input.border.width
6098
6181
  }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
@@ -6136,7 +6219,7 @@ function iconBoxStyle(props) {
6136
6219
  theme
6137
6220
  } = props;
6138
6221
  const color = theme.sanity.color.input;
6139
- return styled.css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
6222
+ return styled.css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
6140
6223
  }
6141
6224
  const selectStyle = {
6142
6225
  root: rootStyle,
@@ -6224,10 +6307,10 @@ const Stack = react.forwardRef(function Stack2(props, ref) {
6224
6307
  });
6225
6308
  });
6226
6309
  function switchBaseStyles() {
6227
- return styled.css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6310
+ return styled.css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6228
6311
  }
6229
6312
  function switchInputStyles() {
6230
- return styled.css(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));
6313
+ return styled.css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));
6231
6314
  }
6232
6315
  function switchRepresentationStyles(props) {
6233
6316
  const {
@@ -6238,7 +6321,7 @@ function switchRepresentationStyles(props) {
6238
6321
  input
6239
6322
  } = theme.sanity;
6240
6323
  const color = theme.sanity.color.button.default;
6241
- return styled.css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
6324
+ return styled.css(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
6242
6325
  focusRing
6243
6326
  }), color.positive.enabled.bg, color.positive.enabled.fg, color.default.hovered.bg, color.default.hovered.fg, color.positive.hovered.bg, color.positive.hovered.fg, color.default.disabled.bg, color.default.disabled.fg);
6244
6327
  }
@@ -6249,7 +6332,7 @@ function switchTrackStyles(props) {
6249
6332
  const {
6250
6333
  input
6251
6334
  } = theme.sanity;
6252
- return styled.css(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2));
6335
+ return styled.css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2));
6253
6336
  }
6254
6337
  function switchThumbStyles(props) {
6255
6338
  const {
@@ -6266,7 +6349,7 @@ function switchThumbStyles(props) {
6266
6349
  const checkedOffset = trackWidth - trackPadding * 2 - size;
6267
6350
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
6268
6351
  const checked = $indeterminate !== true && props.$checked === true;
6269
- return styled.css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && styled.css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && styled.css(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6352
+ return styled.css(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && styled.css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && styled.css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6270
6353
  }
6271
6354
  const Root$e = styled__default.default.span(switchBaseStyles);
6272
6355
  const Input$2 = styled__default.default.input(switchInputStyles);
@@ -6311,7 +6394,7 @@ const Switch = react.forwardRef(function Switch2(props, forwardedRef) {
6311
6394
  });
6312
6395
  });
6313
6396
  const Root$d = styled__default.default.span(textInputRootStyle);
6314
- const InputRoot$1 = styled__default.default.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6397
+ const InputRoot$1 = styled__default.default.span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6315
6398
  const Input$1 = styled__default.default.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6316
6399
  const Presentation$1 = styled__default.default.div(responsiveRadiusStyle, textInputRepresentationStyle);
6317
6400
  const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
@@ -6361,18 +6444,18 @@ const CLEAR_BUTTON_BOX_STYLE = {
6361
6444
  const Root$c = styled__default.default(Card).attrs({
6362
6445
  forwardedAs: "span"
6363
6446
  })(textInputRootStyle);
6364
- const InputRoot = styled__default.default.span(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6447
+ const InputRoot = styled__default.default.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6365
6448
  const Prefix = styled__default.default(Card).attrs({
6366
6449
  forwardedAs: "span"
6367
- })(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6450
+ })(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6368
6451
  const Suffix = styled__default.default(Card).attrs({
6369
6452
  forwardedAs: "span"
6370
- })(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6453
+ })(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6371
6454
  const Input = styled__default.default.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6372
6455
  const Presentation = styled__default.default.span(responsiveRadiusStyle, textInputRepresentationStyle);
6373
- const LeftBox = styled__default.default(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6374
- const RightBox = styled__default.default(Box)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6375
- const RightCard = styled__default.default(Card)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6456
+ const LeftBox = styled__default.default(Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6457
+ const RightBox = styled__default.default(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6458
+ const RightCard = styled__default.default(Card)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6376
6459
  const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6377
6460
  const {
6378
6461
  border = true,
@@ -6517,9 +6600,9 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6517
6600
  }), suffixNode]
6518
6601
  });
6519
6602
  });
6520
- const Root$b = styled__default.default.div(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
6521
- const Border = styled__default.default.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6522
- const Shape = styled__default.default.path(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6603
+ const Root$b = styled__default.default.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
6604
+ const Border = styled__default.default.path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6605
+ const Shape = styled__default.default.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6523
6606
  const TooltipArrow = react.forwardRef(function TooltipArrow2(props, ref) {
6524
6607
  const {
6525
6608
  ...restProps
@@ -6540,7 +6623,7 @@ const TooltipArrow = react.forwardRef(function TooltipArrow2(props, ref) {
6540
6623
  })
6541
6624
  });
6542
6625
  });
6543
- const Root$a = styled__default.default(Layer)(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6626
+ const Root$a = styled__default.default(Layer)(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6544
6627
  const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6545
6628
  var _a, _b, _c;
6546
6629
  const boundaryElementContext = useBoundaryElement();
@@ -6702,10 +6785,10 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6702
6785
  })]
6703
6786
  });
6704
6787
  });
6705
- const Root$9 = styled__default.default.div(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6706
- const ListBox = styled__default.default(Box)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6707
- const rotate = styled.keyframes(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6708
- const AnimatedSpinnerIcon = styled__default.default(icons.SpinnerIcon)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6788
+ const Root$9 = styled__default.default.div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6789
+ const ListBox = styled__default.default(Box)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6790
+ const rotate = styled.keyframes(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6791
+ const AnimatedSpinnerIcon = styled__default.default(icons.SpinnerIcon)(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6709
6792
  function AutocompleteOption(props) {
6710
6793
  const {
6711
6794
  children,
@@ -7229,8 +7312,8 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7229
7312
  });
7230
7313
  });
7231
7314
  const Autocomplete = InnerAutocomplete;
7232
- const Root$8 = styled__default.default.ol(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
7233
- const ExpandButton = styled__default.default(Button)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7315
+ const Root$8 = styled__default.default.ol(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
7316
+ const ExpandButton = styled__default.default(Button)(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7234
7317
  const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7235
7318
  const {
7236
7319
  children,
@@ -7340,14 +7423,19 @@ const DialogContext = globalScope[key$3];
7340
7423
  function useDialog() {
7341
7424
  return react.useContext(DialogContext);
7342
7425
  }
7426
+ function isTargetWithinScope(boundaryElement, portalElement, target) {
7427
+ if (!boundaryElement || !portalElement) return true;
7428
+ return containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
7429
+ }
7343
7430
  const Root$7 = styled__default.default(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
7344
- const DialogContainer = styled__default.default(Container)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
7345
- const DialogCardRoot = styled__default.default(Card)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
7346
- const DialogLayout = styled__default.default(Flex)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7347
- const DialogHeader = styled__default.default(Card)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
7348
- const DialogContent = styled__default.default(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7349
- const DialogFooter = styled__default.default(Box)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7431
+ const DialogContainer = styled__default.default(Container)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
7432
+ const DialogCardRoot = styled__default.default(Card)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
7433
+ const DialogLayout = styled__default.default(Flex)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7434
+ const DialogHeader = styled__default.default(Card)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
7435
+ const DialogContent = styled__default.default(Box)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7436
+ const DialogFooter = styled__default.default(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7350
7437
  const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
7438
+ var _a;
7351
7439
  const {
7352
7440
  __unstable_autoFocus: autoFocus,
7353
7441
  __unstable_hideCloseButton: hideCloseButton,
@@ -7358,11 +7446,15 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
7358
7446
  id,
7359
7447
  onClickOutside,
7360
7448
  onClose,
7449
+ portal: portalProp,
7361
7450
  radius: radiusProp,
7362
7451
  scheme,
7363
7452
  shadow: shadowProp,
7364
7453
  width: widthProp
7365
7454
  } = props;
7455
+ const portal = usePortal();
7456
+ const portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element;
7457
+ const boundaryElement = useBoundaryElement().element;
7366
7458
  const radius = useArrayProp(radiusProp);
7367
7459
  const shadow = useArrayProp(shadowProp);
7368
7460
  const width = useArrayProp(widthProp);
@@ -7384,16 +7476,24 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
7384
7476
  }, [autoFocus, forwardedRef]);
7385
7477
  useGlobalKeyDown(react.useCallback(event => {
7386
7478
  if (!isTopLayer || !onClose) return;
7479
+ const target = document.activeElement;
7480
+ if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
7481
+ return;
7482
+ }
7387
7483
  if (event.key === "Escape") {
7388
7484
  event.preventDefault();
7389
7485
  event.stopPropagation();
7390
7486
  onClose();
7391
7487
  }
7392
- }, [isTopLayer, onClose]));
7393
- useClickOutside(react.useCallback(() => {
7488
+ }, [boundaryElement, isTopLayer, onClose, portalElement]));
7489
+ useClickOutside(react.useCallback(event => {
7394
7490
  if (!isTopLayer || !onClickOutside) return;
7491
+ const target = event.target;
7492
+ if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
7493
+ return;
7494
+ }
7395
7495
  onClickOutside();
7396
- }, [isTopLayer, onClickOutside]), [rootElement]);
7496
+ }, [boundaryElement, isTopLayer, onClickOutside, portalElement]), [rootElement]);
7397
7497
  const setRef = react.useCallback(el => {
7398
7498
  setRootElement(el);
7399
7499
  forwardedRef.current = el;
@@ -7447,7 +7547,7 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
7447
7547
  });
7448
7548
  });
7449
7549
  const Dialog = react.forwardRef(function Dialog2(props, ref) {
7450
- var _a;
7550
+ var _a, _b;
7451
7551
  const dialog = useDialog();
7452
7552
  const theme = useTheme();
7453
7553
  const {
@@ -7460,16 +7560,21 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
7460
7560
  footer,
7461
7561
  header,
7462
7562
  id,
7563
+ onActivate,
7463
7564
  onClickOutside,
7464
7565
  onClose,
7566
+ onFocus,
7465
7567
  padding: paddingProp = 4,
7466
- portal,
7568
+ portal: portalProp,
7467
7569
  position: positionProp = dialog.position || "fixed",
7468
7570
  scheme,
7469
7571
  width: widthProp = 0,
7470
7572
  zOffset: zOffsetProp = dialog.zOffset || ((_a = theme.sanity.layer) == null ? void 0 : _a.dialog.zOffset),
7471
7573
  ...restProps
7472
7574
  } = props;
7575
+ const portal = usePortal();
7576
+ const portalElement = portalProp ? ((_b = portal.elements) == null ? void 0 : _b[portalProp]) || null : portal.element;
7577
+ const boundaryElement = useBoundaryElement().element;
7473
7578
  const cardRadius = useArrayProp(cardRadiusProp);
7474
7579
  const padding = useArrayProp(paddingProp);
7475
7580
  const position = useArrayProp(positionProp);
@@ -7478,24 +7583,44 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
7478
7583
  const preDivRef = react.useRef(null);
7479
7584
  const postDivRef = react.useRef(null);
7480
7585
  const cardRef = react.useRef(null);
7586
+ const focusedElementRef = react.useRef(null);
7481
7587
  const handleFocus = react.useCallback(event => {
7588
+ onFocus == null ? void 0 : onFocus(event);
7482
7589
  const target = event.target;
7483
7590
  const cardElement = cardRef.current;
7484
- if (!cardElement) {
7485
- return;
7486
- }
7487
- if (target === preDivRef.current) {
7591
+ if (cardElement && target === preDivRef.current) {
7488
7592
  focusLastDescendant(cardElement);
7489
7593
  return;
7490
7594
  }
7491
- if (target === postDivRef.current) {
7595
+ if (cardElement && target === postDivRef.current) {
7492
7596
  focusFirstDescendant(cardElement);
7493
7597
  return;
7494
7598
  }
7495
- }, []);
7599
+ if (isHTMLElement(event.target)) {
7600
+ focusedElementRef.current = event.target;
7601
+ }
7602
+ }, [onFocus]);
7496
7603
  const labelId = "".concat(id, "_label");
7604
+ const rootClickTimeoutRef = react.useRef();
7605
+ const handleRootClick = react.useCallback(() => {
7606
+ if (rootClickTimeoutRef.current) {
7607
+ clearTimeout(rootClickTimeoutRef.current);
7608
+ }
7609
+ rootClickTimeoutRef.current = setTimeout(() => {
7610
+ const activeElement = document.activeElement;
7611
+ if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
7612
+ const target = focusedElementRef.current;
7613
+ if (!target || !document.body.contains(target)) {
7614
+ const cardElement = cardRef.current;
7615
+ if (cardElement) focusFirstDescendant(cardElement);
7616
+ return;
7617
+ }
7618
+ target.focus();
7619
+ }
7620
+ }, 0);
7621
+ }, [boundaryElement, portalElement]);
7497
7622
  return /* @__PURE__ */jsxRuntime.jsx(Portal, {
7498
- __unstable_name: portal,
7623
+ __unstable_name: portalProp,
7499
7624
  children: /* @__PURE__ */jsxRuntime.jsxs(Root$7, {
7500
7625
  ...restProps,
7501
7626
  $padding: padding,
@@ -7504,6 +7629,8 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
7504
7629
  "aria-modal": true,
7505
7630
  "data-ui": "Dialog",
7506
7631
  id,
7632
+ onActivate,
7633
+ onClick: handleRootClick,
7507
7634
  onFocus: handleFocus,
7508
7635
  ref,
7509
7636
  role: "dialog",
@@ -7520,6 +7647,7 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
7520
7647
  id,
7521
7648
  onClickOutside,
7522
7649
  onClose,
7650
+ portal: portalProp,
7523
7651
  radius: cardRadius,
7524
7652
  ref: cardRef,
7525
7653
  scheme,
@@ -7549,8 +7677,8 @@ function DialogProvider(props) {
7549
7677
  children
7550
7678
  });
7551
7679
  }
7552
- const Root$6 = styled__default.default.kbd(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7553
- const Key = styled__default.default(KBD)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7680
+ const Root$6 = styled__default.default.kbd(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7681
+ const Key = styled__default.default(KBD)(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7554
7682
  const Hotkeys = react.forwardRef(function Hotkeys2(props, ref) {
7555
7683
  const {
7556
7684
  fontSize,
@@ -7771,7 +7899,7 @@ function useMenuController(props) {
7771
7899
  setRootElement
7772
7900
  };
7773
7901
  }
7774
- const Root$5 = styled__default.default(Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7902
+ const Root$5 = styled__default.default(Box)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7775
7903
  const Menu = react.forwardRef(function Menu2(props, ref) {
7776
7904
  const {
7777
7905
  children,
@@ -7998,9 +8126,9 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
7998
8126
  children: button || /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {})
7999
8127
  });
8000
8128
  });
8001
- const MenuDivider = styled__default.default.hr(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8129
+ const MenuDivider = styled__default.default.hr(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8002
8130
  function selectableBaseStyle() {
8003
- return styled.css(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
8131
+ return styled.css(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
8004
8132
  }
8005
8133
  function selectableColorStyle(props) {
8006
8134
  var _a, _b;
@@ -8014,7 +8142,7 @@ function selectableColorStyle(props) {
8014
8142
  selectable
8015
8143
  } = theme.sanity.color;
8016
8144
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8017
- return styled.css(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
8145
+ return styled.css(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
8018
8146
  }
8019
8147
  const Selectable = styled__default.default(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8020
8148
  function useMenu() {
@@ -8276,9 +8404,9 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
8276
8404
  })]
8277
8405
  });
8278
8406
  });
8279
- const keyframe = styled.keyframes(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8280
- const animation = styled.css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8281
- const skeletonStyle = styled.css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref24 => {
8407
+ const keyframe = styled.keyframes(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8408
+ const animation = styled.css(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8409
+ const skeletonStyle = styled.css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref24 => {
8282
8410
  let {
8283
8411
  $visible
8284
8412
  } = _ref24;
@@ -8287,7 +8415,7 @@ const skeletonStyle = styled.css(_templateObject81 || (_templateObject81 = _tagg
8287
8415
  let {
8288
8416
  $animated
8289
8417
  } = _ref25;
8290
- return $animated ? animation : styled.css(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8418
+ return $animated ? animation : styled.css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8291
8419
  });
8292
8420
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
8293
8421
  const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
@@ -8504,8 +8632,8 @@ const ROLES = {
8504
8632
  success: "alert",
8505
8633
  info: "alert"
8506
8634
  };
8507
- const Root$2 = styled__default.default(Card)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8508
- const TextBox = styled__default.default(Flex)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8635
+ const Root$2 = styled__default.default(Card)(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8636
+ const TextBox = styled__default.default(Flex)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8509
8637
  function Toast(props) {
8510
8638
  const {
8511
8639
  closable,
@@ -8565,8 +8693,8 @@ function useMounted() {
8565
8693
  const key$1 = Symbol.for("@sanity/ui/context/toast");
8566
8694
  globalScope[key$1] = globalScope[key$1] || react.createContext(null);
8567
8695
  const ToastContext = globalScope[key$1];
8568
- const Root$1 = styled__default.default(Layer)(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
8569
- const ToastContainer = styled__default.default.div(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
8696
+ const Root$1 = styled__default.default(Layer)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
8697
+ const ToastContainer = styled__default.default.div(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
8570
8698
  let toastId = 0;
8571
8699
  function ToastProvider(props) {
8572
8700
  const {
@@ -8927,7 +9055,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
8927
9055
  }));
8928
9056
  Tree.displayName = "Tree";
8929
9057
  function treeItemRootStyle() {
8930
- return styled.css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
9058
+ return styled.css(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
8931
9059
  }
8932
9060
  function treeItemRootColorStyle(props) {
8933
9061
  const {
@@ -8940,7 +9068,7 @@ function treeItemRootColorStyle(props) {
8940
9068
  selectable
8941
9069
  } = theme.sanity.color;
8942
9070
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8943
- return styled.css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", "\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
9071
+ return styled.css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", "\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
8944
9072
  }
8945
9073
  function treeItemBoxStyle(props) {
8946
9074
  const {
@@ -8950,7 +9078,7 @@ function treeItemBoxStyle(props) {
8950
9078
  const {
8951
9079
  space
8952
9080
  } = theme.sanity;
8953
- return styled.css(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9081
+ return styled.css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
8954
9082
  }
8955
9083
  function useTree() {
8956
9084
  const tree = react.useContext(TreeContext);
@@ -8981,7 +9109,7 @@ const Root = react.memo(styled__default.default.li(treeItemRootStyle, treeItemRo
8981
9109
  const TreeItemBox = styled__default.default(Box).attrs({
8982
9110
  forwardedAs: "a"
8983
9111
  })(treeItemBoxStyle);
8984
- const ToggleArrowText = styled__default.default(Text)(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9112
+ const ToggleArrowText = styled__default.default(Text)(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
8985
9113
  const TreeItem = react.memo(function TreeItem2(props) {
8986
9114
  const {
8987
9115
  children,
@@ -9200,6 +9328,7 @@ exports._raf = _raf;
9200
9328
  exports._raf2 = _raf2;
9201
9329
  exports._responsive = _responsive;
9202
9330
  exports.attemptFocus = attemptFocus;
9331
+ exports.containsOrEqualsElement = containsOrEqualsElement;
9203
9332
  exports.createColorTheme = createColorTheme;
9204
9333
  exports.focusFirstDescendant = focusFirstDescendant;
9205
9334
  exports.focusLastDescendant = focusLastDescendant;