@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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- 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;
1
+ 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;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useMemo, useState, useRef, useEffect, createContext, useContext, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1, startTransition } from 'react';
@@ -5262,6 +5262,18 @@ class ErrorBoundary extends Component {
5262
5262
  return this.props.children;
5263
5263
  }
5264
5264
  }
5265
+ function getLayerContext(contextValue) {
5266
+ if (!isRecord(contextValue) || contextValue.version !== 0) {
5267
+ throw new Error("the context value is not compatible");
5268
+ }
5269
+ if (!contextValue) {
5270
+ throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
5271
+ }
5272
+ if (contextValue.version === 0) {
5273
+ return contextValue;
5274
+ }
5275
+ throw new Error("could not get layer context");
5276
+ }
5265
5277
  const key$5 = Symbol.for("@sanity/ui/context/layer");
5266
5278
  globalScope[key$5] = globalScope[key$5] || createContext(null);
5267
5279
  const LayerContext = globalScope[key$5];
@@ -5270,57 +5282,215 @@ function useLayer() {
5270
5282
  if (!value) {
5271
5283
  throw new Error("useLayer(): missing context value");
5272
5284
  }
5273
- if (!isRecord(value) || value.version !== 0) {
5274
- throw new Error("useLayer(): the context value is not compatible");
5285
+ try {
5286
+ return getLayerContext(value);
5287
+ } catch (err) {
5288
+ if (err instanceof Error) {
5289
+ throw new Error("useLayer(): ".concat(err.message));
5290
+ } else {
5291
+ throw new Error("useLayer(): ".concat(err));
5292
+ }
5275
5293
  }
5276
- return value;
5294
+ }
5295
+ function _raf(fn) {
5296
+ const frameId = requestAnimationFrame(fn);
5297
+ return () => {
5298
+ cancelAnimationFrame(frameId);
5299
+ };
5300
+ }
5301
+ function _raf2(fn) {
5302
+ let innerDispose = null;
5303
+ const outerDispose = _raf(() => {
5304
+ innerDispose = _raf(fn);
5305
+ });
5306
+ return () => {
5307
+ if (innerDispose) innerDispose();
5308
+ outerDispose();
5309
+ };
5310
+ }
5311
+ function _isEnterToClickElement(element) {
5312
+ return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
5313
+ }
5314
+ function isHTMLElement(node) {
5315
+ return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
5316
+ }
5317
+ function isHTMLAnchorElement(element) {
5318
+ return isHTMLElement(element) && element.nodeName === "A";
5319
+ }
5320
+ function isHTMLInputElement(element) {
5321
+ return isHTMLElement(element) && element.nodeName === "INPUT";
5322
+ }
5323
+ function isHTMLButtonElement(element) {
5324
+ return isHTMLElement(element) && element.nodeName === "BUTTON";
5325
+ }
5326
+ function isHTMLSelectElement(element) {
5327
+ return isHTMLElement(element) && element.nodeName === "SELECT";
5328
+ }
5329
+ function isHTMLTextAreaElement(element) {
5330
+ return isHTMLElement(element) && element.nodeName === "TEXTAREA";
5331
+ }
5332
+ function containsOrEqualsElement(element, node) {
5333
+ return element.contains(node) || element === node;
5334
+ }
5335
+ function _hasFocus(element) {
5336
+ return Boolean(document.activeElement) && element.contains(document.activeElement);
5337
+ }
5338
+ function isFocusable(element) {
5339
+ if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
5340
+ return true;
5341
+ }
5342
+ if (isHTMLAnchorElement(element)) {
5343
+ return Boolean(element.href) && element.rel !== "ignore";
5344
+ }
5345
+ if (isHTMLInputElement(element)) {
5346
+ return element.type !== "hidden" && element.type !== "file" && !element.disabled;
5347
+ }
5348
+ if (isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element)) {
5349
+ return !element.disabled;
5350
+ }
5351
+ return false;
5352
+ }
5353
+ function attemptFocus(element) {
5354
+ if (!isFocusable(element)) {
5355
+ return false;
5356
+ }
5357
+ try {
5358
+ element.focus();
5359
+ } catch (_) {}
5360
+ return document.activeElement === element;
5361
+ }
5362
+ function focusFirstDescendant(element) {
5363
+ for (let i = 0; i < element.childNodes.length; i++) {
5364
+ const child = element.childNodes[i];
5365
+ if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) {
5366
+ return true;
5367
+ }
5368
+ }
5369
+ return false;
5370
+ }
5371
+ function focusLastDescendant(element) {
5372
+ for (let i = element.childNodes.length - 1; i >= 0; i--) {
5373
+ const child = element.childNodes[i];
5374
+ if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) {
5375
+ return true;
5376
+ }
5377
+ }
5378
+ return false;
5379
+ }
5380
+ function _isScrollable(el) {
5381
+ if (!(el instanceof Element)) return false;
5382
+ const style = window.getComputedStyle(el);
5383
+ return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
5277
5384
  }
5278
5385
  function LayerProvider(props) {
5386
+ var _a;
5279
5387
  const {
5280
5388
  children,
5281
5389
  zOffset: zOffsetProp = 0
5282
5390
  } = props;
5283
- const parent = useContext(LayerContext);
5391
+ const parentContextValue = useContext(LayerContext);
5392
+ const parent = parentContextValue && getLayerContext(parentContextValue);
5393
+ const parentRegisterChild = parent == null ? void 0 : parent.registerChild;
5394
+ const parentLevel = (_a = parent == null ? void 0 : parent.level) != null ? _a : 0;
5395
+ const level = parentLevel + 1;
5284
5396
  const zOffset = useArrayProp(zOffsetProp);
5285
5397
  const maxMediaIndex = zOffset.length - 1;
5286
5398
  const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
5287
5399
  const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
5400
+ const [, setChildLayers] = useState({});
5288
5401
  const [size, setSize] = useState(0);
5289
- const registerChild = useCallback(() => {
5290
- setSize(v => v + 1);
5291
- return () => setSize(v => v - 1);
5292
- }, []);
5293
- const parentRegisterChild = parent == null ? void 0 : parent.registerChild;
5294
- useEffect(() => {
5295
- if (!parentRegisterChild) return;
5296
- return parentRegisterChild();
5402
+ const isTopLayer = size === 0;
5403
+ const registerChild = useCallback(childLevel => {
5404
+ const parentDispose = parentRegisterChild == null ? void 0 : parentRegisterChild(childLevel);
5405
+ if (childLevel !== void 0) {
5406
+ setChildLayers(state => {
5407
+ var _a2;
5408
+ const prevLen = (_a2 = state[childLevel]) != null ? _a2 : 0;
5409
+ const nextState = {
5410
+ ...state,
5411
+ [childLevel]: prevLen + 1
5412
+ };
5413
+ setSize(Object.keys(nextState).length);
5414
+ return nextState;
5415
+ });
5416
+ } else {
5417
+ setSize(v => v + 1);
5418
+ }
5419
+ return () => {
5420
+ if (childLevel !== void 0) {
5421
+ setChildLayers(state => {
5422
+ const nextState = {
5423
+ ...state
5424
+ };
5425
+ if (nextState[childLevel] === 1) {
5426
+ delete nextState[childLevel];
5427
+ setSize(Object.keys(nextState).length);
5428
+ } else {
5429
+ nextState[childLevel] -= 1;
5430
+ }
5431
+ return nextState;
5432
+ });
5433
+ } else {
5434
+ setSize(v => v - 1);
5435
+ }
5436
+ parentDispose == null ? void 0 : parentDispose();
5437
+ };
5297
5438
  }, [parentRegisterChild]);
5439
+ useEffect(() => parentRegisterChild == null ? void 0 : parentRegisterChild(level), [level, parentRegisterChild]);
5298
5440
  const value = useMemo(() => ({
5299
5441
  version: 0,
5300
- isTopLayer: size === 0,
5442
+ isTopLayer,
5443
+ level,
5301
5444
  registerChild,
5302
5445
  size,
5303
5446
  zIndex
5304
- }), [size, registerChild, zIndex]);
5447
+ }), [isTopLayer, level, registerChild, size, zIndex]);
5305
5448
  return /* @__PURE__ */jsx(LayerContext.Provider, {
5306
5449
  value,
5307
5450
  children
5308
5451
  });
5309
5452
  }
5310
- const Root$m = styled.div(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5453
+ const Root$m = styled.div({
5454
+ position: "relative"
5455
+ });
5311
5456
  const LayerChildren = forwardRef(function LayerChildren2(props, ref) {
5312
5457
  const {
5313
5458
  children,
5459
+ onActivate,
5460
+ onFocus,
5314
5461
  style = EMPTY_RECORD,
5315
5462
  ...restProps
5316
5463
  } = props;
5317
5464
  const {
5318
- zIndex
5465
+ zIndex,
5466
+ isTopLayer
5319
5467
  } = useLayer();
5468
+ const lastFocusedRef = useRef(null);
5469
+ const forwardedRef = useForwardedRef(ref);
5470
+ const isTopLayerRef = useRef(isTopLayer);
5471
+ useEffect(() => {
5472
+ const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer;
5473
+ if (becameTopLayer) {
5474
+ onActivate == null ? void 0 : onActivate({
5475
+ activeElement: lastFocusedRef.current
5476
+ });
5477
+ }
5478
+ isTopLayerRef.current = isTopLayer;
5479
+ }, [isTopLayer, onActivate]);
5480
+ const handleFocus = useCallback(event => {
5481
+ onFocus == null ? void 0 : onFocus(event);
5482
+ const rootElement = forwardedRef.current;
5483
+ const target = document.activeElement;
5484
+ if (!isTopLayer || !rootElement || !target) return;
5485
+ if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {
5486
+ lastFocusedRef.current = target;
5487
+ }
5488
+ }, [forwardedRef, isTopLayer, onFocus]);
5320
5489
  return /* @__PURE__ */jsx(Root$m, {
5321
5490
  ...restProps,
5322
5491
  "data-ui": "Layer",
5323
- ref,
5492
+ onFocus: handleFocus,
5493
+ ref: forwardedRef,
5324
5494
  style: {
5325
5495
  ...style,
5326
5496
  zIndex
@@ -5427,7 +5597,7 @@ function PortalProvider(props) {
5427
5597
  children
5428
5598
  });
5429
5599
  }
5430
- const Root$l = styled.div(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5600
+ const Root$l = styled.div(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5431
5601
  const SrOnly = forwardRef(function SrOnly2(props, ref) {
5432
5602
  const {
5433
5603
  as,
@@ -5441,95 +5611,8 @@ const SrOnly = forwardRef(function SrOnly2(props, ref) {
5441
5611
  children
5442
5612
  });
5443
5613
  });
5444
- function _raf(fn) {
5445
- const frameId = requestAnimationFrame(fn);
5446
- return () => {
5447
- cancelAnimationFrame(frameId);
5448
- };
5449
- }
5450
- function _raf2(fn) {
5451
- let innerDispose = null;
5452
- const outerDispose = _raf(() => {
5453
- innerDispose = _raf(fn);
5454
- });
5455
- return () => {
5456
- if (innerDispose) innerDispose();
5457
- outerDispose();
5458
- };
5459
- }
5460
- function _isEnterToClickElement(element) {
5461
- return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
5462
- }
5463
- function isHTMLElement(node) {
5464
- return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
5465
- }
5466
- function isHTMLAnchorElement(element) {
5467
- return isHTMLElement(element) && element.nodeName === "A";
5468
- }
5469
- function isHTMLInputElement(element) {
5470
- return isHTMLElement(element) && element.nodeName === "INPUT";
5471
- }
5472
- function isHTMLButtonElement(element) {
5473
- return isHTMLElement(element) && element.nodeName === "BUTTON";
5474
- }
5475
- function isHTMLSelectElement(element) {
5476
- return isHTMLElement(element) && element.nodeName === "SELECT";
5477
- }
5478
- function isHTMLTextAreaElement(element) {
5479
- return isHTMLElement(element) && element.nodeName === "TEXTAREA";
5480
- }
5481
- function _hasFocus(element) {
5482
- return Boolean(document.activeElement) && element.contains(document.activeElement);
5483
- }
5484
- function isFocusable(element) {
5485
- if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
5486
- return true;
5487
- }
5488
- if (isHTMLAnchorElement(element)) {
5489
- return Boolean(element.href) && element.rel !== "ignore";
5490
- }
5491
- if (isHTMLInputElement(element)) {
5492
- return element.type !== "hidden" && element.type !== "file" && !element.disabled;
5493
- }
5494
- if (isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element)) {
5495
- return !element.disabled;
5496
- }
5497
- return false;
5498
- }
5499
- function attemptFocus(element) {
5500
- if (!isFocusable(element)) {
5501
- return false;
5502
- }
5503
- try {
5504
- element.focus();
5505
- } catch (_) {}
5506
- return document.activeElement === element;
5507
- }
5508
- function focusFirstDescendant(element) {
5509
- for (let i = 0; i < element.childNodes.length; i++) {
5510
- const child = element.childNodes[i];
5511
- if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child))) {
5512
- return true;
5513
- }
5514
- }
5515
- return false;
5516
- }
5517
- function focusLastDescendant(element) {
5518
- for (let i = element.childNodes.length - 1; i >= 0; i--) {
5519
- const child = element.childNodes[i];
5520
- if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child))) {
5521
- return true;
5522
- }
5523
- }
5524
- return false;
5525
- }
5526
- function _isScrollable(el) {
5527
- if (!(el instanceof Element)) return false;
5528
- const style = window.getComputedStyle(el);
5529
- return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
5530
- }
5531
- const Root$k = styled.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5532
- const ItemWrapper = styled.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5614
+ const Root$k = styled.div(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n position: relative;\n"])));
5615
+ const ItemWrapper = styled.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5533
5616
  const VirtualList = forwardRef(function VirtualList2(props, ref) {
5534
5617
  const {
5535
5618
  as = "div",
@@ -5718,9 +5801,9 @@ function size(options) {
5718
5801
  }
5719
5802
  };
5720
5803
  }
5721
- const Root$j = styled.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);
5722
- const BorderPath = styled.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
5723
- const ShapePath = styled.path(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
5804
+ const Root$j = styled.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);
5805
+ const BorderPath = styled.path(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
5806
+ const ShapePath = styled.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
5724
5807
  const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
5725
5808
  return /* @__PURE__ */jsx(Root$j, {
5726
5809
  "data-ui": "Popover__arrow",
@@ -5755,7 +5838,7 @@ function popoverCardStyle(props) {
5755
5838
  };
5756
5839
  }
5757
5840
  const Root$i = memo(styled(Card)(popoverCardStyle));
5758
- const PopoverContainer = memo(styled(Container)(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
5841
+ const PopoverContainer = memo(styled(Container)(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
5759
5842
  const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5760
5843
  const {
5761
5844
  __unstable_margins: marginsProp,
@@ -6007,7 +6090,7 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6007
6090
  }));
6008
6091
  Popover.displayName = "Popover";
6009
6092
  function radioBaseStyle() {
6010
- return 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 "])));
6093
+ return 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 "])));
6011
6094
  }
6012
6095
  function inputElementStyle(props) {
6013
6096
  const {
@@ -6019,7 +6102,7 @@ function inputElementStyle(props) {
6019
6102
  } = theme.sanity;
6020
6103
  const color = theme.sanity.color.input;
6021
6104
  const dist = (input.radio.size - input.radio.markSize) / 2;
6022
- return 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({
6105
+ return 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({
6023
6106
  color: color.default.enabled.border,
6024
6107
  width: input.border.width
6025
6108
  }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
@@ -6061,14 +6144,14 @@ const Radio = forwardRef(function Radio2(props, forwardedRef) {
6061
6144
  });
6062
6145
  });
6063
6146
  function rootStyle() {
6064
- return css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6147
+ return css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6065
6148
  }
6066
6149
  function inputBaseStyle(props) {
6067
6150
  const {
6068
6151
  theme
6069
6152
  } = props;
6070
6153
  const font = theme.sanity.fonts.text;
6071
- return 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);
6154
+ return 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);
6072
6155
  }
6073
6156
  function inputColorStyle(props) {
6074
6157
  const {
@@ -6079,7 +6162,7 @@ function inputColorStyle(props) {
6079
6162
  input
6080
6163
  } = theme.sanity;
6081
6164
  const color = theme.sanity.color.input;
6082
- return 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({
6165
+ return 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({
6083
6166
  color: color.default.enabled.border,
6084
6167
  width: input.border.width
6085
6168
  }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
@@ -6123,7 +6206,7 @@ function iconBoxStyle(props) {
6123
6206
  theme
6124
6207
  } = props;
6125
6208
  const color = theme.sanity.color.input;
6126
- return 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);
6209
+ return 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);
6127
6210
  }
6128
6211
  const selectStyle = {
6129
6212
  root: rootStyle,
@@ -6211,10 +6294,10 @@ const Stack = forwardRef(function Stack2(props, ref) {
6211
6294
  });
6212
6295
  });
6213
6296
  function switchBaseStyles() {
6214
- return css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6297
+ return css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6215
6298
  }
6216
6299
  function switchInputStyles() {
6217
- return 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 "])));
6300
+ return 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 "])));
6218
6301
  }
6219
6302
  function switchRepresentationStyles(props) {
6220
6303
  const {
@@ -6225,7 +6308,7 @@ function switchRepresentationStyles(props) {
6225
6308
  input
6226
6309
  } = theme.sanity;
6227
6310
  const color = theme.sanity.color.button.default;
6228
- return 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({
6311
+ return 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({
6229
6312
  focusRing
6230
6313
  }), 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);
6231
6314
  }
@@ -6236,7 +6319,7 @@ function switchTrackStyles(props) {
6236
6319
  const {
6237
6320
  input
6238
6321
  } = theme.sanity;
6239
- return 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));
6322
+ return 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));
6240
6323
  }
6241
6324
  function switchThumbStyles(props) {
6242
6325
  const {
@@ -6253,7 +6336,7 @@ function switchThumbStyles(props) {
6253
6336
  const checkedOffset = trackWidth - trackPadding * 2 - size;
6254
6337
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
6255
6338
  const checked = $indeterminate !== true && props.$checked === true;
6256
- return 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 && css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6339
+ return 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 && css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6257
6340
  }
6258
6341
  const Root$e = styled.span(switchBaseStyles);
6259
6342
  const Input$2 = styled.input(switchInputStyles);
@@ -6298,7 +6381,7 @@ const Switch = forwardRef(function Switch2(props, forwardedRef) {
6298
6381
  });
6299
6382
  });
6300
6383
  const Root$d = styled.span(textInputRootStyle);
6301
- const InputRoot$1 = styled.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6384
+ const InputRoot$1 = styled.span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6302
6385
  const Input$1 = styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6303
6386
  const Presentation$1 = styled.div(responsiveRadiusStyle, textInputRepresentationStyle);
6304
6387
  const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
@@ -6348,18 +6431,18 @@ const CLEAR_BUTTON_BOX_STYLE = {
6348
6431
  const Root$c = styled(Card).attrs({
6349
6432
  forwardedAs: "span"
6350
6433
  })(textInputRootStyle);
6351
- const InputRoot = styled.span(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6434
+ const InputRoot = styled.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6352
6435
  const Prefix = styled(Card).attrs({
6353
6436
  forwardedAs: "span"
6354
- })(_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"])));
6437
+ })(_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"])));
6355
6438
  const Suffix = styled(Card).attrs({
6356
6439
  forwardedAs: "span"
6357
- })(_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"])));
6440
+ })(_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"])));
6358
6441
  const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6359
6442
  const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
6360
- const LeftBox = styled(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6361
- const RightBox = styled(Box)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6362
- const RightCard = styled(Card)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6443
+ const LeftBox = styled(Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6444
+ const RightBox = styled(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6445
+ const RightCard = styled(Card)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6363
6446
  const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6364
6447
  const {
6365
6448
  border = true,
@@ -6504,9 +6587,9 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6504
6587
  }), suffixNode]
6505
6588
  });
6506
6589
  });
6507
- const Root$b = styled.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"])));
6508
- const Border = styled.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6509
- const Shape = styled.path(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6590
+ const Root$b = styled.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"])));
6591
+ const Border = styled.path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6592
+ const Shape = styled.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6510
6593
  const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
6511
6594
  const {
6512
6595
  ...restProps
@@ -6527,7 +6610,7 @@ const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
6527
6610
  })
6528
6611
  });
6529
6612
  });
6530
- const Root$a = styled(Layer)(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6613
+ const Root$a = styled(Layer)(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6531
6614
  const Tooltip = forwardRef(function Tooltip2(props, ref) {
6532
6615
  var _a, _b, _c;
6533
6616
  const boundaryElementContext = useBoundaryElement();
@@ -6689,10 +6772,10 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6689
6772
  })]
6690
6773
  });
6691
6774
  });
6692
- const Root$9 = styled.div(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6693
- const ListBox = styled(Box)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6694
- const rotate = keyframes(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6695
- const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6775
+ const Root$9 = styled.div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6776
+ const ListBox = styled(Box)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6777
+ const rotate = keyframes(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6778
+ const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6696
6779
  function AutocompleteOption(props) {
6697
6780
  const {
6698
6781
  children,
@@ -7216,8 +7299,8 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7216
7299
  });
7217
7300
  });
7218
7301
  const Autocomplete = InnerAutocomplete;
7219
- const Root$8 = styled.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"])));
7220
- const ExpandButton = styled(Button)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7302
+ const Root$8 = styled.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"])));
7303
+ const ExpandButton = styled(Button)(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7221
7304
  const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7222
7305
  const {
7223
7306
  children,
@@ -7327,14 +7410,19 @@ const DialogContext = globalScope[key$3];
7327
7410
  function useDialog() {
7328
7411
  return useContext(DialogContext);
7329
7412
  }
7413
+ function isTargetWithinScope(boundaryElement, portalElement, target) {
7414
+ if (!boundaryElement || !portalElement) return true;
7415
+ return containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
7416
+ }
7330
7417
  const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
7331
- const DialogContainer = styled(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"])));
7332
- const DialogCardRoot = styled(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"])));
7333
- const DialogLayout = styled(Flex)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7334
- const DialogHeader = styled(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"])));
7335
- const DialogContent = styled(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7336
- const DialogFooter = styled(Box)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7418
+ const DialogContainer = styled(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"])));
7419
+ const DialogCardRoot = styled(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"])));
7420
+ const DialogLayout = styled(Flex)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7421
+ const DialogHeader = styled(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"])));
7422
+ const DialogContent = styled(Box)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7423
+ const DialogFooter = styled(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7337
7424
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
7425
+ var _a;
7338
7426
  const {
7339
7427
  __unstable_autoFocus: autoFocus,
7340
7428
  __unstable_hideCloseButton: hideCloseButton,
@@ -7345,11 +7433,15 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
7345
7433
  id,
7346
7434
  onClickOutside,
7347
7435
  onClose,
7436
+ portal: portalProp,
7348
7437
  radius: radiusProp,
7349
7438
  scheme,
7350
7439
  shadow: shadowProp,
7351
7440
  width: widthProp
7352
7441
  } = props;
7442
+ const portal = usePortal();
7443
+ const portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element;
7444
+ const boundaryElement = useBoundaryElement().element;
7353
7445
  const radius = useArrayProp(radiusProp);
7354
7446
  const shadow = useArrayProp(shadowProp);
7355
7447
  const width = useArrayProp(widthProp);
@@ -7371,16 +7463,24 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
7371
7463
  }, [autoFocus, forwardedRef]);
7372
7464
  useGlobalKeyDown(useCallback(event => {
7373
7465
  if (!isTopLayer || !onClose) return;
7466
+ const target = document.activeElement;
7467
+ if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
7468
+ return;
7469
+ }
7374
7470
  if (event.key === "Escape") {
7375
7471
  event.preventDefault();
7376
7472
  event.stopPropagation();
7377
7473
  onClose();
7378
7474
  }
7379
- }, [isTopLayer, onClose]));
7380
- useClickOutside(useCallback(() => {
7475
+ }, [boundaryElement, isTopLayer, onClose, portalElement]));
7476
+ useClickOutside(useCallback(event => {
7381
7477
  if (!isTopLayer || !onClickOutside) return;
7478
+ const target = event.target;
7479
+ if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
7480
+ return;
7481
+ }
7382
7482
  onClickOutside();
7383
- }, [isTopLayer, onClickOutside]), [rootElement]);
7483
+ }, [boundaryElement, isTopLayer, onClickOutside, portalElement]), [rootElement]);
7384
7484
  const setRef = useCallback(el => {
7385
7485
  setRootElement(el);
7386
7486
  forwardedRef.current = el;
@@ -7434,7 +7534,7 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
7434
7534
  });
7435
7535
  });
7436
7536
  const Dialog = forwardRef(function Dialog2(props, ref) {
7437
- var _a;
7537
+ var _a, _b;
7438
7538
  const dialog = useDialog();
7439
7539
  const theme = useTheme();
7440
7540
  const {
@@ -7447,16 +7547,21 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
7447
7547
  footer,
7448
7548
  header,
7449
7549
  id,
7550
+ onActivate,
7450
7551
  onClickOutside,
7451
7552
  onClose,
7553
+ onFocus,
7452
7554
  padding: paddingProp = 4,
7453
- portal,
7555
+ portal: portalProp,
7454
7556
  position: positionProp = dialog.position || "fixed",
7455
7557
  scheme,
7456
7558
  width: widthProp = 0,
7457
7559
  zOffset: zOffsetProp = dialog.zOffset || ((_a = theme.sanity.layer) == null ? void 0 : _a.dialog.zOffset),
7458
7560
  ...restProps
7459
7561
  } = props;
7562
+ const portal = usePortal();
7563
+ const portalElement = portalProp ? ((_b = portal.elements) == null ? void 0 : _b[portalProp]) || null : portal.element;
7564
+ const boundaryElement = useBoundaryElement().element;
7460
7565
  const cardRadius = useArrayProp(cardRadiusProp);
7461
7566
  const padding = useArrayProp(paddingProp);
7462
7567
  const position = useArrayProp(positionProp);
@@ -7465,24 +7570,44 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
7465
7570
  const preDivRef = useRef(null);
7466
7571
  const postDivRef = useRef(null);
7467
7572
  const cardRef = useRef(null);
7573
+ const focusedElementRef = useRef(null);
7468
7574
  const handleFocus = useCallback(event => {
7575
+ onFocus == null ? void 0 : onFocus(event);
7469
7576
  const target = event.target;
7470
7577
  const cardElement = cardRef.current;
7471
- if (!cardElement) {
7472
- return;
7473
- }
7474
- if (target === preDivRef.current) {
7578
+ if (cardElement && target === preDivRef.current) {
7475
7579
  focusLastDescendant(cardElement);
7476
7580
  return;
7477
7581
  }
7478
- if (target === postDivRef.current) {
7582
+ if (cardElement && target === postDivRef.current) {
7479
7583
  focusFirstDescendant(cardElement);
7480
7584
  return;
7481
7585
  }
7482
- }, []);
7586
+ if (isHTMLElement(event.target)) {
7587
+ focusedElementRef.current = event.target;
7588
+ }
7589
+ }, [onFocus]);
7483
7590
  const labelId = "".concat(id, "_label");
7591
+ const rootClickTimeoutRef = useRef();
7592
+ const handleRootClick = useCallback(() => {
7593
+ if (rootClickTimeoutRef.current) {
7594
+ clearTimeout(rootClickTimeoutRef.current);
7595
+ }
7596
+ rootClickTimeoutRef.current = setTimeout(() => {
7597
+ const activeElement = document.activeElement;
7598
+ if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
7599
+ const target = focusedElementRef.current;
7600
+ if (!target || !document.body.contains(target)) {
7601
+ const cardElement = cardRef.current;
7602
+ if (cardElement) focusFirstDescendant(cardElement);
7603
+ return;
7604
+ }
7605
+ target.focus();
7606
+ }
7607
+ }, 0);
7608
+ }, [boundaryElement, portalElement]);
7484
7609
  return /* @__PURE__ */jsx(Portal, {
7485
- __unstable_name: portal,
7610
+ __unstable_name: portalProp,
7486
7611
  children: /* @__PURE__ */jsxs(Root$7, {
7487
7612
  ...restProps,
7488
7613
  $padding: padding,
@@ -7491,6 +7616,8 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
7491
7616
  "aria-modal": true,
7492
7617
  "data-ui": "Dialog",
7493
7618
  id,
7619
+ onActivate,
7620
+ onClick: handleRootClick,
7494
7621
  onFocus: handleFocus,
7495
7622
  ref,
7496
7623
  role: "dialog",
@@ -7507,6 +7634,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
7507
7634
  id,
7508
7635
  onClickOutside,
7509
7636
  onClose,
7637
+ portal: portalProp,
7510
7638
  radius: cardRadius,
7511
7639
  ref: cardRef,
7512
7640
  scheme,
@@ -7536,8 +7664,8 @@ function DialogProvider(props) {
7536
7664
  children
7537
7665
  });
7538
7666
  }
7539
- const Root$6 = styled.kbd(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7540
- const Key = styled(KBD)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7667
+ const Root$6 = styled.kbd(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7668
+ const Key = styled(KBD)(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7541
7669
  const Hotkeys = forwardRef(function Hotkeys2(props, ref) {
7542
7670
  const {
7543
7671
  fontSize,
@@ -7758,7 +7886,7 @@ function useMenuController(props) {
7758
7886
  setRootElement
7759
7887
  };
7760
7888
  }
7761
- const Root$5 = styled(Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7889
+ const Root$5 = styled(Box)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7762
7890
  const Menu = forwardRef(function Menu2(props, ref) {
7763
7891
  const {
7764
7892
  children,
@@ -7985,9 +8113,9 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
7985
8113
  children: button || /* @__PURE__ */jsx(Fragment, {})
7986
8114
  });
7987
8115
  });
7988
- const MenuDivider = styled.hr(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8116
+ const MenuDivider = styled.hr(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
7989
8117
  function selectableBaseStyle() {
7990
- return 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 "])));
8118
+ return 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 "])));
7991
8119
  }
7992
8120
  function selectableColorStyle(props) {
7993
8121
  var _a, _b;
@@ -8001,7 +8129,7 @@ function selectableColorStyle(props) {
8001
8129
  selectable
8002
8130
  } = theme.sanity.color;
8003
8131
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8004
- return 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);
8132
+ return 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);
8005
8133
  }
8006
8134
  const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8007
8135
  function useMenu() {
@@ -8263,9 +8391,9 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8263
8391
  })]
8264
8392
  });
8265
8393
  });
8266
- const keyframe = keyframes(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8267
- const animation = 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);
8268
- const skeletonStyle = 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 => {
8394
+ const keyframe = keyframes(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8395
+ const animation = 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);
8396
+ const skeletonStyle = 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 => {
8269
8397
  let {
8270
8398
  $visible
8271
8399
  } = _ref24;
@@ -8274,7 +8402,7 @@ const skeletonStyle = css(_templateObject81 || (_templateObject81 = _taggedTempl
8274
8402
  let {
8275
8403
  $animated
8276
8404
  } = _ref25;
8277
- return $animated ? animation : css(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8405
+ return $animated ? animation : css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8278
8406
  });
8279
8407
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
8280
8408
  const Skeleton = forwardRef(function Skeleton2(props, ref) {
@@ -8491,8 +8619,8 @@ const ROLES = {
8491
8619
  success: "alert",
8492
8620
  info: "alert"
8493
8621
  };
8494
- const Root$2 = styled(Card)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8495
- const TextBox = styled(Flex)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8622
+ const Root$2 = styled(Card)(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8623
+ const TextBox = styled(Flex)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8496
8624
  function Toast(props) {
8497
8625
  const {
8498
8626
  closable,
@@ -8552,8 +8680,8 @@ function useMounted() {
8552
8680
  const key$1 = Symbol.for("@sanity/ui/context/toast");
8553
8681
  globalScope[key$1] = globalScope[key$1] || createContext(null);
8554
8682
  const ToastContext = globalScope[key$1];
8555
- const Root$1 = styled(Layer)(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
8556
- const ToastContainer = styled.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"])));
8683
+ const Root$1 = styled(Layer)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
8684
+ const ToastContainer = styled.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"])));
8557
8685
  let toastId = 0;
8558
8686
  function ToastProvider(props) {
8559
8687
  const {
@@ -8914,7 +9042,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
8914
9042
  }));
8915
9043
  Tree.displayName = "Tree";
8916
9044
  function treeItemRootStyle() {
8917
- return 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 "])));
9045
+ return 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 "])));
8918
9046
  }
8919
9047
  function treeItemRootColorStyle(props) {
8920
9048
  const {
@@ -8927,7 +9055,7 @@ function treeItemRootColorStyle(props) {
8927
9055
  selectable
8928
9056
  } = theme.sanity.color;
8929
9057
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8930
- return 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));
9058
+ return 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));
8931
9059
  }
8932
9060
  function treeItemBoxStyle(props) {
8933
9061
  const {
@@ -8937,7 +9065,7 @@ function treeItemBoxStyle(props) {
8937
9065
  const {
8938
9066
  space
8939
9067
  } = theme.sanity;
8940
- return css(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9068
+ return css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
8941
9069
  }
8942
9070
  function useTree() {
8943
9071
  const tree = useContext(TreeContext);
@@ -8968,7 +9096,7 @@ const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle));
8968
9096
  const TreeItemBox = styled(Box).attrs({
8969
9097
  forwardedAs: "a"
8970
9098
  })(treeItemBoxStyle);
8971
- const ToggleArrowText = styled(Text)(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9099
+ const ToggleArrowText = styled(Text)(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
8972
9100
  const TreeItem = memo(function TreeItem2(props) {
8973
9101
  const {
8974
9102
  children,
@@ -9115,5 +9243,5 @@ const TreeItem = memo(function TreeItem2(props) {
9115
9243
  })]
9116
9244
  });
9117
9245
  });
9118
- export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTree };
9246
+ export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTree };
9119
9247
  //# sourceMappingURL=index.esm.js.map