@sanity/ui 1.4.0 → 1.6.0

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;
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;
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';
@@ -7,7 +7,7 @@ import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css,
7
7
  import { white as white$1, black as black$1, hues } from '@sanity/color';
8
8
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
9
9
  import Refractor from 'react-refractor';
10
- import { detectOverflow, flip, offset, shift, arrow, hide, autoUpdate, useFloating } from '@floating-ui/react-dom';
10
+ import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from '@floating-ui/react-dom';
11
11
  import { createPortal } from 'react-dom';
12
12
  import { AnimatePresence, motion } from 'framer-motion';
13
13
  const EMPTY_ARRAY = [];
@@ -3063,9 +3063,9 @@ function getGlobalScope() {
3063
3063
  throw new Error("@sanity/ui: could not locate global scope");
3064
3064
  }
3065
3065
  const globalScope = getGlobalScope();
3066
- const key$8 = Symbol.for("@sanity/ui/context/theme");
3067
- globalScope[key$8] = globalScope[key$8] || createContext(null);
3068
- const ThemeContext = globalScope[key$8];
3066
+ const key$7 = Symbol.for("@sanity/ui/context/theme");
3067
+ globalScope[key$7] = globalScope[key$7] || createContext(null);
3068
+ const ThemeContext = globalScope[key$7];
3069
3069
  function ThemeProvider(props) {
3070
3070
  const parentTheme = useContext(ThemeContext);
3071
3071
  const {
@@ -5155,9 +5155,9 @@ const KBD = forwardRef(function KBD2(props, ref) {
5155
5155
  })
5156
5156
  });
5157
5157
  });
5158
- const key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
5159
- globalScope[key$7] = globalScope[key$7] || createContext(null);
5160
- const BoundaryElementContext = globalScope[key$7];
5158
+ const key$6 = Symbol.for("@sanity/ui/context/boundaryElement");
5159
+ globalScope[key$6] = globalScope[key$6] || createContext(null);
5160
+ const BoundaryElementContext = globalScope[key$6];
5161
5161
  function BoundaryElementProvider(props) {
5162
5162
  const {
5163
5163
  children,
@@ -5275,9 +5275,9 @@ function getLayerContext(contextValue) {
5275
5275
  }
5276
5276
  throw new Error("could not get layer context");
5277
5277
  }
5278
- const key$6 = Symbol.for("@sanity/ui/context/layer");
5279
- globalScope[key$6] = globalScope[key$6] || createContext(null);
5280
- const LayerContext = globalScope[key$6];
5278
+ const key$5 = Symbol.for("@sanity/ui/context/layer");
5279
+ globalScope[key$5] = globalScope[key$5] || createContext(null);
5280
+ const LayerContext = globalScope[key$5];
5281
5281
  function useLayer() {
5282
5282
  const value = useContext(LayerContext);
5283
5283
  if (!value) {
@@ -5514,7 +5514,7 @@ const Layer = forwardRef(function Layer2(props, ref) {
5514
5514
  })
5515
5515
  });
5516
5516
  });
5517
- const key$5 = Symbol.for("@sanity/ui/context/portal");
5517
+ const key$4 = Symbol.for("@sanity/ui/context/portal");
5518
5518
  const elementKey = Symbol.for("@sanity/ui/context/portal/element");
5519
5519
  globalScope[elementKey] = null;
5520
5520
  const defaultContextValue = {
@@ -5533,8 +5533,8 @@ const defaultContextValue = {
5533
5533
  return globalScope[elementKey];
5534
5534
  }
5535
5535
  };
5536
- globalScope[key$5] = globalScope[key$5] || createContext(defaultContextValue);
5537
- const PortalContext = globalScope[key$5];
5536
+ globalScope[key$4] = globalScope[key$4] || createContext(defaultContextValue);
5537
+ const PortalContext = globalScope[key$4];
5538
5538
  function usePortal() {
5539
5539
  const value = useContext(PortalContext);
5540
5540
  if (!value) {
@@ -5802,6 +5802,26 @@ function size(options) {
5802
5802
  }
5803
5803
  };
5804
5804
  }
5805
+ function calcCurrentWidth(params) {
5806
+ const {
5807
+ mediaIndex,
5808
+ theme,
5809
+ width
5810
+ } = params;
5811
+ const w = width[mediaIndex];
5812
+ const currentWidth = w === void 0 ? width[width.length - 1] : w;
5813
+ return typeof currentWidth === "number" ? theme.sanity.container[currentWidth] : void 0;
5814
+ }
5815
+ function calcMaxWidth(params) {
5816
+ const {
5817
+ boundaryWidth,
5818
+ currentWidth
5819
+ } = params;
5820
+ if (currentWidth === void 0 && boundaryWidth === void 0) {
5821
+ return void 0;
5822
+ }
5823
+ return Math.min(currentWidth != null ? currentWidth : Infinity, (boundaryWidth || Infinity) - DEFAULT_POPOVER_PADDING * 2);
5824
+ }
5805
5825
  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);
5806
5826
  const BorderPath = styled.path(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
5807
5827
  const ShapePath = styled.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
@@ -5824,22 +5844,14 @@ const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
5824
5844
  })
5825
5845
  });
5826
5846
  });
5827
- function popoverCardStyle(props) {
5828
- const {
5829
- $boundaryWidth
5830
- } = props;
5831
- return {
5832
- "&:not([hidden])": {
5833
- display: "flex"
5834
- },
5835
- flexDirection: "column",
5836
- width: "max-content",
5837
- minWidth: "min-content",
5838
- maxWidth: typeof $boundaryWidth === "number" ? "".concat($boundaryWidth - DEFAULT_POPOVER_PADDING * 2, "px") : void 0
5839
- };
5840
- }
5841
- const Root$i = memo(styled(Card)(popoverCardStyle));
5842
- const PopoverContainer = memo(styled(Container)(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));
5847
+ const Root$i = styled(Card)({
5848
+ "&:not([hidden])": {
5849
+ display: "flex"
5850
+ },
5851
+ flexDirection: "column",
5852
+ width: "max-content",
5853
+ minWidth: "min-content"
5854
+ });
5843
5855
  const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5844
5856
  const {
5845
5857
  __unstable_margins: marginsProp,
@@ -5847,7 +5859,6 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5847
5859
  arrowRef,
5848
5860
  arrowX,
5849
5861
  arrowY,
5850
- boundaryWidth,
5851
5862
  children,
5852
5863
  padding,
5853
5864
  placement,
@@ -5858,7 +5869,7 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5858
5869
  strategy,
5859
5870
  style,
5860
5871
  tone,
5861
- width = "auto",
5872
+ width,
5862
5873
  x: xProp,
5863
5874
  y: yProp,
5864
5875
  ...restProps
@@ -5873,9 +5884,10 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5873
5884
  position: strategy,
5874
5885
  top: y,
5875
5886
  left: x,
5887
+ width,
5876
5888
  zIndex,
5877
5889
  ...style
5878
- }), [strategy, style, x, y, zIndex]);
5890
+ }), [strategy, style, width, x, y, zIndex]);
5879
5891
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
5880
5892
  const arrowStyle = useMemo(() => {
5881
5893
  const style2 = {
@@ -5888,10 +5900,9 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5888
5900
  return style2;
5889
5901
  }, [arrowX, arrowY, staticSide]);
5890
5902
  return /* @__PURE__ */jsxs(Root$i, {
5903
+ "data-ui": "Popover",
5891
5904
  ...restProps,
5892
- $boundaryWidth: boundaryWidth,
5893
5905
  "data-placement": placement,
5894
- "data-ui": "Popover",
5895
5906
  radius,
5896
5907
  ref,
5897
5908
  scheme,
@@ -5899,14 +5910,17 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5899
5910
  sizing: "border",
5900
5911
  style: rootStyle,
5901
5912
  tone,
5902
- children: [/* @__PURE__ */jsx(PopoverContainer, {
5913
+ children: [/* @__PURE__ */jsx(Flex, {
5903
5914
  "data-ui": "Popover__wrapper",
5915
+ direction: "column",
5904
5916
  flex: 1,
5905
5917
  overflow,
5906
- padding,
5907
- sizing: "border",
5908
- width,
5909
- children
5918
+ children: /* @__PURE__ */jsx(Flex, {
5919
+ direction: "column",
5920
+ flex: 1,
5921
+ padding,
5922
+ children
5923
+ })
5910
5924
  }), arrow && /* @__PURE__ */jsx(PopoverArrow, {
5911
5925
  ref: arrowRef,
5912
5926
  style: arrowStyle
@@ -5914,19 +5928,8 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
5914
5928
  });
5915
5929
  }));
5916
5930
  PopoverCard.displayName = "PopoverCard";
5917
- const key$4 = Symbol.for("@sanity/ui/context/popover");
5918
- globalScope[key$4] = globalScope[key$4] || createContext(null);
5919
- const PopoverContext = globalScope[key$4];
5920
- const useOnForcedUpdate = eventHandler => {
5921
- const contextValue = useContext(PopoverContext);
5922
- useEffect(() => {
5923
- if ((contextValue == null ? void 0 : contextValue.lastUpdateId) !== null) {
5924
- eventHandler == null ? void 0 : eventHandler();
5925
- }
5926
- }, [contextValue == null ? void 0 : contextValue.lastUpdateId]);
5927
- };
5928
5931
  const Popover = memo(forwardRef(function Popover2(props, ref) {
5929
- var _a, _b, _c, _d, _e;
5932
+ var _a, _b, _c, _d, _e, _f, _g;
5930
5933
  const theme = useTheme();
5931
5934
  const boundaryElementContext = useBoundaryElement();
5932
5935
  const {
@@ -5938,7 +5941,8 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
5938
5941
  content,
5939
5942
  disabled,
5940
5943
  fallbackPlacements,
5941
- matchReferenceWidth: matchReferenceWidthProp,
5944
+ matchReferenceWidth,
5945
+ floatingBoundary = (_a = props.boundaryElement) != null ? _a : boundaryElementContext.element,
5942
5946
  open,
5943
5947
  overflow = "hidden",
5944
5948
  padding: paddingProp,
@@ -5946,28 +5950,65 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
5946
5950
  portal,
5947
5951
  preventOverflow = true,
5948
5952
  radius: radiusProp = 3,
5953
+ referenceBoundary = (_b = props.boundaryElement) != null ? _b : boundaryElementContext.element,
5949
5954
  referenceElement,
5950
5955
  scheme,
5951
5956
  shadow: shadowProp = 3,
5952
5957
  tone = "inherit",
5953
5958
  width: widthProp = "auto",
5954
- zOffset: zOffsetProp = (_a = theme.sanity.layer) == null ? void 0 : _a.popover.zOffset,
5959
+ zOffset: zOffsetProp = (_c = theme.sanity.layer) == null ? void 0 : _c.popover.zOffset,
5960
+ updateRef,
5955
5961
  ...restProps
5956
5962
  } = props;
5957
- const boundarySize = (_b = useElementSize(boundaryElement)) == null ? void 0 : _b.border;
5963
+ const boundarySize = (_d = useElementSize(boundaryElement)) == null ? void 0 : _d.border;
5958
5964
  const padding = useArrayProp(paddingProp);
5959
5965
  const radius = useArrayProp(radiusProp);
5960
5966
  const shadow = useArrayProp(shadowProp);
5961
- const width = useArrayProp(widthProp);
5967
+ const widthArrayProp = useArrayProp(widthProp);
5962
5968
  const zOffset = useArrayProp(zOffsetProp);
5963
5969
  const forwardedRef = useForwardedRef(ref);
5964
5970
  const arrowRef = useRef(null);
5965
5971
  const rootBoundary = "viewport";
5972
+ const mediaIndex = useMediaIndex();
5973
+ const boundaryWidth = constrainSize || preventOverflow ? boundarySize == null ? void 0 : boundarySize.width : void 0;
5974
+ const width = calcCurrentWidth({
5975
+ mediaIndex,
5976
+ theme,
5977
+ width: widthArrayProp
5978
+ });
5979
+ const widthRef = useRef(width);
5980
+ useEffect(() => {
5981
+ widthRef.current = width;
5982
+ }, [width]);
5983
+ const maxWidth = calcMaxWidth({
5984
+ boundaryWidth,
5985
+ currentWidth: width
5986
+ });
5987
+ const maxWidthRef = useRef(maxWidth);
5988
+ useEffect(() => {
5989
+ maxWidthRef.current = maxWidth;
5990
+ }, [maxWidth]);
5991
+ const referenceWidthRef = useRef();
5992
+ useEffect(() => {
5993
+ const floatingElement = forwardedRef.current;
5994
+ if (!open || !floatingElement) return;
5995
+ const referenceWidth = referenceWidthRef.current;
5996
+ if (matchReferenceWidth) {
5997
+ if (referenceWidth !== void 0) {
5998
+ floatingElement.style.width = "".concat(referenceWidth, "px");
5999
+ }
6000
+ } else if (width !== void 0) {
6001
+ floatingElement.style.width = "".concat(width, "px");
6002
+ }
6003
+ if (typeof maxWidth === "number") {
6004
+ floatingElement.style.maxWidth = "".concat(maxWidth, "px");
6005
+ }
6006
+ }, [width, forwardedRef, matchReferenceWidth, maxWidth, open]);
5966
6007
  const middleware = useMemo(() => {
5967
6008
  const ret = [];
5968
6009
  if (constrainSize || preventOverflow) {
5969
6010
  ret.push(flip({
5970
- boundary: boundaryElement || void 0,
6011
+ boundary: floatingBoundary || void 0,
5971
6012
  fallbackPlacements,
5972
6013
  padding: DEFAULT_POPOVER_PADDING,
5973
6014
  rootBoundary
@@ -5976,7 +6017,7 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
5976
6017
  ret.push(offset({
5977
6018
  mainAxis: arrowProp ? DEFAULT_POPOVER_DISTANCE : 0
5978
6019
  }));
5979
- if (constrainSize || matchReferenceWidthProp) {
6020
+ if (constrainSize || matchReferenceWidth) {
5980
6021
  ret.push(size({
5981
6022
  apply(_ref21) {
5982
6023
  let {
@@ -5985,24 +6026,29 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
5985
6026
  elements,
5986
6027
  referenceWidth
5987
6028
  } = _ref21;
5988
- if (matchReferenceWidthProp) {
6029
+ referenceWidthRef.current = referenceWidth;
6030
+ const _currentWidth = widthRef.current;
6031
+ const _maxWidth = maxWidthRef.current;
6032
+ if (matchReferenceWidth) {
5989
6033
  elements.floating.style.width = "".concat(referenceWidth, "px");
6034
+ } else if (_currentWidth !== void 0) {
6035
+ elements.floating.style.width = "".concat(_currentWidth, "px");
5990
6036
  }
5991
6037
  if (constrainSize) {
5992
- elements.floating.style.maxWidth = "".concat(availableWidth, "px");
6038
+ elements.floating.style.maxWidth = "".concat(Math.min(availableWidth, _maxWidth != null ? _maxWidth : Infinity), "px");
5993
6039
  elements.floating.style.maxHeight = "".concat(availableHeight, "px");
5994
6040
  }
5995
6041
  },
5996
- boundaryElement,
6042
+ boundaryElement: floatingBoundary || void 0,
5997
6043
  constrainSize,
5998
6044
  margins,
5999
- matchReferenceWidth: matchReferenceWidthProp,
6045
+ matchReferenceWidth,
6000
6046
  padding: DEFAULT_POPOVER_PADDING
6001
6047
  }));
6002
6048
  }
6003
6049
  if (preventOverflow) {
6004
6050
  ret.push(shift({
6005
- boundary: boundaryElement || void 0,
6051
+ boundary: floatingBoundary || void 0,
6006
6052
  rootBoundary,
6007
6053
  padding: DEFAULT_POPOVER_PADDING
6008
6054
  }));
@@ -6014,49 +6060,44 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6014
6060
  }));
6015
6061
  }
6016
6062
  ret.push(hide({
6017
- boundary: boundaryElement || void 0,
6063
+ boundary: referenceBoundary || void 0,
6018
6064
  padding: DEFAULT_POPOVER_PADDING,
6019
6065
  strategy: "referenceHidden"
6020
6066
  }));
6021
6067
  return ret;
6022
- }, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, margins, matchReferenceWidthProp, preventOverflow]);
6023
- const floatingProps = useMemo(() => ({
6024
- middleware,
6025
- placement: placementProp,
6026
- whileElementsMounted: autoUpdate
6027
- }), [middleware, placementProp]);
6068
+ }, [arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]);
6028
6069
  const {
6029
6070
  x,
6030
6071
  y,
6031
- placement,
6032
- reference: referenceRef,
6033
- floating: floatingRef,
6034
- update: floatingUpdate,
6035
6072
  middlewareData,
6036
- strategy
6037
- } = useFloating(floatingProps);
6038
- const handleForcedUpdate = useCallback(() => {
6039
- floatingUpdate();
6040
- }, [floatingUpdate]);
6041
- const referenceHidden = (_c = middlewareData.hide) == null ? void 0 : _c.referenceHidden;
6042
- const arrowX = (_d = middlewareData.arrow) == null ? void 0 : _d.x;
6043
- const arrowY = (_e = middlewareData.arrow) == null ? void 0 : _e.y;
6073
+ placement,
6074
+ refs,
6075
+ strategy,
6076
+ update
6077
+ } = useFloating({
6078
+ middleware,
6079
+ placement: placementProp,
6080
+ whileElementsMounted: autoUpdate
6081
+ });
6082
+ const referenceHidden = (_e = middlewareData.hide) == null ? void 0 : _e.referenceHidden;
6083
+ const arrowX = (_f = middlewareData.arrow) == null ? void 0 : _f.x;
6084
+ const arrowY = (_g = middlewareData.arrow) == null ? void 0 : _g.y;
6044
6085
  const setArrow = useCallback(arrowEl => {
6045
6086
  arrowRef.current = arrowEl;
6046
6087
  }, []);
6047
6088
  const setFloating = useCallback(node => {
6048
6089
  forwardedRef.current = node;
6049
- floatingRef(node);
6050
- }, [floatingRef, forwardedRef]);
6090
+ refs.setFloating(node);
6091
+ }, [forwardedRef, refs]);
6051
6092
  const setReference = useCallback(node => {
6052
- referenceRef(node);
6093
+ refs.setReference(node);
6053
6094
  const childRef = childProp == null ? void 0 : childProp.ref;
6054
6095
  if (typeof childRef === "function") {
6055
6096
  childRef(node);
6056
6097
  } else if (childRef) {
6057
6098
  childRef.current = node;
6058
6099
  }
6059
- }, [childProp, referenceRef]);
6100
+ }, [childProp, refs]);
6060
6101
  const child = useMemo(() => {
6061
6102
  if (!childProp || referenceElement) return null;
6062
6103
  return cloneElement(childProp, {
@@ -6064,9 +6105,17 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6064
6105
  });
6065
6106
  }, [childProp, referenceElement, setReference]);
6066
6107
  useEffect(() => {
6067
- referenceRef(referenceElement || null);
6068
- }, [referenceRef, referenceElement]);
6069
- useOnForcedUpdate(handleForcedUpdate);
6108
+ if (updateRef) {
6109
+ if (typeof updateRef === "function") {
6110
+ updateRef(update);
6111
+ } else if (updateRef) {
6112
+ updateRef.current = update;
6113
+ }
6114
+ }
6115
+ }, [update, updateRef]);
6116
+ useEffect(() => {
6117
+ refs.setReference(referenceElement || null);
6118
+ }, [referenceElement, refs]);
6070
6119
  if (disabled) {
6071
6120
  return childProp || /* @__PURE__ */jsx(Fragment, {});
6072
6121
  }
@@ -6079,7 +6128,6 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6079
6128
  arrowRef: setArrow,
6080
6129
  arrowX,
6081
6130
  arrowY,
6082
- boundaryWidth: preventOverflow ? boundarySize == null ? void 0 : boundarySize.width : void 0,
6083
6131
  hidden: referenceHidden,
6084
6132
  overflow,
6085
6133
  padding,
@@ -6090,9 +6138,9 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6090
6138
  shadow,
6091
6139
  strategy,
6092
6140
  tone,
6141
+ width: matchReferenceWidth ? referenceWidthRef.current : width,
6093
6142
  x,
6094
6143
  y,
6095
- width,
6096
6144
  children: content
6097
6145
  })
6098
6146
  });
@@ -6106,37 +6154,8 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6106
6154
  });
6107
6155
  }));
6108
6156
  Popover.displayName = "Popover";
6109
- const PopoverProvider = _ref22 => {
6110
- let {
6111
- children
6112
- } = _ref22;
6113
- const [lastUpdateId, setUpdateId] = useState(null);
6114
- const forceUpdate = useCallback(() => {
6115
- const newId = Math.random().toString(36).substr(2, 9);
6116
- setUpdateId(newId);
6117
- }, []);
6118
- const value = useMemo(() => ({
6119
- version: 0,
6120
- lastUpdateId,
6121
- forceUpdate
6122
- }), [lastUpdateId, forceUpdate]);
6123
- return /* @__PURE__ */jsx(PopoverContext.Provider, {
6124
- value,
6125
- children
6126
- });
6127
- };
6128
- function usePopover() {
6129
- const value = useContext(PopoverContext);
6130
- if (!value) {
6131
- throw new Error("usePopover(): missing context value");
6132
- }
6133
- if (!isRecord(value) || value.version !== 0) {
6134
- throw new Error("usePopover(): the context value is not compatible");
6135
- }
6136
- return value;
6137
- }
6138
6157
  function radioBaseStyle() {
6139
- 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 "])));
6158
+ return css(_templateObject35 || (_templateObject35 = _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 "])));
6140
6159
  }
6141
6160
  function inputElementStyle(props) {
6142
6161
  const {
@@ -6148,7 +6167,7 @@ function inputElementStyle(props) {
6148
6167
  } = theme.sanity;
6149
6168
  const color = theme.sanity.color.input;
6150
6169
  const dist = (input.radio.size - input.radio.markSize) / 2;
6151
- 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({
6170
+ return css(_templateObject36 || (_templateObject36 = _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({
6152
6171
  color: color.default.enabled.border,
6153
6172
  width: input.border.width
6154
6173
  }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
@@ -6190,14 +6209,14 @@ const Radio = forwardRef(function Radio2(props, forwardedRef) {
6190
6209
  });
6191
6210
  });
6192
6211
  function rootStyle() {
6193
- return css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6212
+ return css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6194
6213
  }
6195
6214
  function inputBaseStyle(props) {
6196
6215
  const {
6197
6216
  theme
6198
6217
  } = props;
6199
6218
  const font = theme.sanity.fonts.text;
6200
- 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);
6219
+ return css(_templateObject38 || (_templateObject38 = _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);
6201
6220
  }
6202
6221
  function inputColorStyle(props) {
6203
6222
  const {
@@ -6208,7 +6227,7 @@ function inputColorStyle(props) {
6208
6227
  input
6209
6228
  } = theme.sanity;
6210
6229
  const color = theme.sanity.color.input;
6211
- 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({
6230
+ return css(_templateObject39 || (_templateObject39 = _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({
6212
6231
  color: color.default.enabled.border,
6213
6232
  width: input.border.width
6214
6233
  }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
@@ -6252,7 +6271,7 @@ function iconBoxStyle(props) {
6252
6271
  theme
6253
6272
  } = props;
6254
6273
  const color = theme.sanity.color.input;
6255
- 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);
6274
+ return css(_templateObject40 || (_templateObject40 = _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);
6256
6275
  }
6257
6276
  const selectStyle = {
6258
6277
  root: rootStyle,
@@ -6340,10 +6359,10 @@ const Stack = forwardRef(function Stack2(props, ref) {
6340
6359
  });
6341
6360
  });
6342
6361
  function switchBaseStyles() {
6343
- return css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6362
+ return css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6344
6363
  }
6345
6364
  function switchInputStyles() {
6346
- 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 "])));
6365
+ return css(_templateObject42 || (_templateObject42 = _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 "])));
6347
6366
  }
6348
6367
  function switchRepresentationStyles(props) {
6349
6368
  const {
@@ -6354,7 +6373,7 @@ function switchRepresentationStyles(props) {
6354
6373
  input
6355
6374
  } = theme.sanity;
6356
6375
  const color = theme.sanity.color.button.default;
6357
- 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({
6376
+ return css(_templateObject43 || (_templateObject43 = _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({
6358
6377
  focusRing
6359
6378
  }), 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);
6360
6379
  }
@@ -6365,7 +6384,7 @@ function switchTrackStyles(props) {
6365
6384
  const {
6366
6385
  input
6367
6386
  } = theme.sanity;
6368
- 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));
6387
+ return css(_templateObject44 || (_templateObject44 = _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));
6369
6388
  }
6370
6389
  function switchThumbStyles(props) {
6371
6390
  const {
@@ -6382,7 +6401,7 @@ function switchThumbStyles(props) {
6382
6401
  const checkedOffset = trackWidth - trackPadding * 2 - size;
6383
6402
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
6384
6403
  const checked = $indeterminate !== true && props.$checked === true;
6385
- 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));
6404
+ return css(_templateObject45 || (_templateObject45 = _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(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6386
6405
  }
6387
6406
  const Root$e = styled.span(switchBaseStyles);
6388
6407
  const Input$2 = styled.input(switchInputStyles);
@@ -6427,7 +6446,7 @@ const Switch = forwardRef(function Switch2(props, forwardedRef) {
6427
6446
  });
6428
6447
  });
6429
6448
  const Root$d = styled.span(textInputRootStyle);
6430
- const InputRoot$1 = styled.span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6449
+ const InputRoot$1 = styled.span(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6431
6450
  const Input$1 = styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6432
6451
  const Presentation$1 = styled.div(responsiveRadiusStyle, textInputRepresentationStyle);
6433
6452
  const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
@@ -6477,18 +6496,18 @@ const CLEAR_BUTTON_BOX_STYLE = {
6477
6496
  const Root$c = styled(Card).attrs({
6478
6497
  forwardedAs: "span"
6479
6498
  })(textInputRootStyle);
6480
- const InputRoot = styled.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6499
+ const InputRoot = styled.span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6481
6500
  const Prefix = styled(Card).attrs({
6482
6501
  forwardedAs: "span"
6483
- })(_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"])));
6502
+ })(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6484
6503
  const Suffix = styled(Card).attrs({
6485
6504
  forwardedAs: "span"
6486
- })(_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"])));
6505
+ })(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6487
6506
  const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6488
6507
  const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
6489
- const LeftBox = styled(Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6490
- const RightBox = styled(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6491
- const RightCard = styled(Card)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6508
+ const LeftBox = styled(Box)(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6509
+ const RightBox = styled(Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6510
+ const RightCard = styled(Card)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6492
6511
  const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6493
6512
  const {
6494
6513
  border = true,
@@ -6633,9 +6652,9 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6633
6652
  }), suffixNode]
6634
6653
  });
6635
6654
  });
6636
- 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"])));
6637
- const Border = styled.path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6638
- const Shape = styled.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6655
+ const Root$b = styled.div(_templateObject55 || (_templateObject55 = _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"])));
6656
+ const Border = styled.path(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6657
+ const Shape = styled.path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6639
6658
  const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
6640
6659
  const {
6641
6660
  ...restProps
@@ -6656,7 +6675,7 @@ const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
6656
6675
  })
6657
6676
  });
6658
6677
  });
6659
- const Root$a = styled(Layer)(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6678
+ const Root$a = styled(Layer)(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
6660
6679
  const Tooltip = forwardRef(function Tooltip2(props, ref) {
6661
6680
  var _a, _b, _c;
6662
6681
  const boundaryElementContext = useBoundaryElement();
@@ -6706,9 +6725,8 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6706
6725
  x,
6707
6726
  y,
6708
6727
  placement,
6709
- reference,
6710
- floating,
6711
6728
  middlewareData,
6729
+ refs,
6712
6730
  update,
6713
6731
  strategy
6714
6732
  } = useFloating({
@@ -6760,15 +6778,15 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6760
6778
  useEffect(() => {
6761
6779
  if (!content) setIsOpen(false);
6762
6780
  }, [content]);
6763
- useEffect(() => reference(referenceElement), [reference, referenceElement]);
6781
+ useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
6764
6782
  const setArrow = useCallback(arrowEl => {
6765
6783
  arrowRef.current = arrowEl;
6766
6784
  update();
6767
6785
  }, [update]);
6768
6786
  const setFloating = useCallback(node => {
6769
6787
  forwardedRef.current = node;
6770
- floating(node);
6771
- }, [floating, forwardedRef]);
6788
+ refs.setFloating(node);
6789
+ }, [forwardedRef, refs]);
6772
6790
  const childRef = childProp == null ? void 0 : childProp.ref;
6773
6791
  const setReference = useCallback(node => {
6774
6792
  if (typeof childRef === "function") {
@@ -6818,10 +6836,10 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6818
6836
  })]
6819
6837
  });
6820
6838
  });
6821
- const Root$9 = styled.div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6822
- const ListBox = styled(Box)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6823
- const rotate = keyframes(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6824
- const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6839
+ const Root$9 = styled.div(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
6840
+ const ListBox = styled(Box)(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
6841
+ const rotate = keyframes(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6842
+ const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
6825
6843
  function AutocompleteOption(props) {
6826
6844
  const {
6827
6845
  children,
@@ -6966,10 +6984,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
6966
6984
  query,
6967
6985
  value
6968
6986
  } = state;
6969
- const defaultRenderOption = useCallback(_ref23 => {
6987
+ const defaultRenderOption = useCallback(_ref22 => {
6970
6988
  let {
6971
6989
  value: value2
6972
- } = _ref23;
6990
+ } = _ref22;
6973
6991
  return /* @__PURE__ */jsx(Card, {
6974
6992
  "data-as": "button",
6975
6993
  padding: paddingProp,
@@ -7345,8 +7363,8 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7345
7363
  });
7346
7364
  });
7347
7365
  const Autocomplete = InnerAutocomplete;
7348
- 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"])));
7349
- const ExpandButton = styled(Button)(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7366
+ const Root$8 = styled.ol(_templateObject63 || (_templateObject63 = _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"])));
7367
+ const ExpandButton = styled(Button)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7350
7368
  const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7351
7369
  const {
7352
7370
  children,
@@ -7416,10 +7434,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7416
7434
  }, itemIndex))
7417
7435
  });
7418
7436
  });
7419
- function dialogStyle(_ref24) {
7437
+ function dialogStyle(_ref23) {
7420
7438
  let {
7421
7439
  theme
7422
- } = _ref24;
7440
+ } = _ref23;
7423
7441
  const color = theme.sanity.color.base;
7424
7442
  return {
7425
7443
  "&:not([hidden])": {
@@ -7461,12 +7479,12 @@ function isTargetWithinScope(boundaryElement, portalElement, target) {
7461
7479
  return containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
7462
7480
  }
7463
7481
  const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
7464
- 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"])));
7465
- 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 overflow: clip;\n"])));
7466
- const DialogLayout = styled(Flex)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7467
- 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"])));
7468
- const DialogContent = styled(Box)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7469
- 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"])));
7482
+ const DialogContainer = styled(Container)(_templateObject65 || (_templateObject65 = _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"])));
7483
+ const DialogCardRoot = styled(Card)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n overflow: clip;\n"])));
7484
+ const DialogLayout = styled(Flex)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7485
+ const DialogHeader = styled(Card)(_templateObject68 || (_templateObject68 = _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"])));
7486
+ const DialogContent = styled(Box)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7487
+ const DialogFooter = styled(Box)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7470
7488
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
7471
7489
  var _a;
7472
7490
  const {
@@ -7710,8 +7728,8 @@ function DialogProvider(props) {
7710
7728
  children
7711
7729
  });
7712
7730
  }
7713
- const Root$6 = styled.kbd(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7714
- const Key = styled(KBD)(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7731
+ const Root$6 = styled.kbd(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
7732
+ const Key = styled(KBD)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
7715
7733
  const Hotkeys = forwardRef(function Hotkeys2(props, ref) {
7716
7734
  const {
7717
7735
  fontSize,
@@ -7932,7 +7950,7 @@ function useMenuController(props) {
7932
7950
  setRootElement
7933
7951
  };
7934
7952
  }
7935
- const Root$5 = styled(Box)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7953
+ const Root$5 = styled(Box)(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
7936
7954
  const Menu = forwardRef(function Menu2(props, ref) {
7937
7955
  const {
7938
7956
  children,
@@ -8029,6 +8047,7 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
8029
8047
  id,
8030
8048
  menu: menuProp,
8031
8049
  onClose,
8050
+ onOpen,
8032
8051
  placement: deprecated_placement,
8033
8052
  popoverScheme: deprecated_popoverScheme,
8034
8053
  portal: deprecated_portal = true,
@@ -8041,6 +8060,11 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
8041
8060
  const [buttonElement, setButtonElement] = useState(null);
8042
8061
  const [menuElements, setChildMenuElements] = useState([]);
8043
8062
  const openRef = useRef(open);
8063
+ useEffect(() => {
8064
+ if (onOpen && open && !openRef.current) {
8065
+ onOpen();
8066
+ }
8067
+ }, [onOpen, open]);
8044
8068
  useEffect(() => {
8045
8069
  if (onClose && !open && openRef.current) {
8046
8070
  onClose();
@@ -8159,9 +8183,9 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
8159
8183
  children: button || /* @__PURE__ */jsx(Fragment, {})
8160
8184
  });
8161
8185
  });
8162
- const MenuDivider = styled.hr(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8186
+ const MenuDivider = styled.hr(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8163
8187
  function selectableBaseStyle() {
8164
- 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 "])));
8188
+ return css(_templateObject75 || (_templateObject75 = _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 "])));
8165
8189
  }
8166
8190
  function selectableColorStyle(props) {
8167
8191
  var _a, _b;
@@ -8175,7 +8199,7 @@ function selectableColorStyle(props) {
8175
8199
  selectable
8176
8200
  } = theme.sanity.color;
8177
8201
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8178
- 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 &[data-hovered],\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 &[data-hovered],\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);
8202
+ return css(_templateObject76 || (_templateObject76 = _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 &[data-hovered],\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 &[data-hovered],\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);
8179
8203
  }
8180
8204
  const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8181
8205
  function useMenu() {
@@ -8437,18 +8461,18 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8437
8461
  })]
8438
8462
  });
8439
8463
  });
8440
- const keyframe = keyframes(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8441
- 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);
8442
- 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"])), _ref25 => {
8464
+ const keyframe = keyframes(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8465
+ const animation = css(_templateObject78 || (_templateObject78 = _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);
8466
+ const skeletonStyle = css(_templateObject79 || (_templateObject79 = _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 => {
8443
8467
  let {
8444
8468
  $visible
8445
- } = _ref25;
8469
+ } = _ref24;
8446
8470
  return $visible ? 1 : 0;
8447
- }, _ref26 => {
8471
+ }, _ref25 => {
8448
8472
  let {
8449
8473
  $animated
8450
- } = _ref26;
8451
- return $animated ? animation : css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8474
+ } = _ref25;
8475
+ return $animated ? animation : css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8452
8476
  });
8453
8477
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
8454
8478
  const Skeleton = forwardRef(function Skeleton2(props, ref) {
@@ -8478,12 +8502,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
8478
8502
  ref
8479
8503
  });
8480
8504
  });
8481
- const Root$3 = styled(Skeleton)(_ref27 => {
8505
+ const Root$3 = styled(Skeleton)(_ref26 => {
8482
8506
  let {
8483
8507
  $size,
8484
8508
  $style,
8485
8509
  theme
8486
- } = _ref27;
8510
+ } = _ref26;
8487
8511
  const {
8488
8512
  media
8489
8513
  } = theme.sanity;
@@ -8665,8 +8689,8 @@ const ROLES = {
8665
8689
  success: "alert",
8666
8690
  info: "alert"
8667
8691
  };
8668
- const Root$2 = styled(Card)(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8669
- const TextBox = styled(Flex)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8692
+ const Root$2 = styled(Card)(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
8693
+ const TextBox = styled(Flex)(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
8670
8694
  function Toast(props) {
8671
8695
  const {
8672
8696
  closable,
@@ -8726,8 +8750,8 @@ function useMounted() {
8726
8750
  const key$1 = Symbol.for("@sanity/ui/context/toast");
8727
8751
  globalScope[key$1] = globalScope[key$1] || createContext(null);
8728
8752
  const ToastContext = globalScope[key$1];
8729
- 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"])));
8730
- 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"])));
8753
+ const Root$1 = styled(Layer)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
8754
+ const ToastContainer = styled.div(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
8731
8755
  let toastId = 0;
8732
8756
  function ToastProvider(props) {
8733
8757
  const {
@@ -8804,12 +8828,12 @@ function ToastProvider(props) {
8804
8828
  paddingY,
8805
8829
  children: /* @__PURE__ */jsx(AnimatePresence, {
8806
8830
  initial: false,
8807
- children: state.map(_ref28 => {
8831
+ children: state.map(_ref27 => {
8808
8832
  let {
8809
8833
  dismiss,
8810
8834
  id,
8811
8835
  params
8812
- } = _ref28;
8836
+ } = _ref27;
8813
8837
  return /* @__PURE__ */jsx(motion.div, {
8814
8838
  animate: {
8815
8839
  opacity: 1,
@@ -9088,7 +9112,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
9088
9112
  }));
9089
9113
  Tree.displayName = "Tree";
9090
9114
  function treeItemRootStyle() {
9091
- 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 "])));
9115
+ return css(_templateObject85 || (_templateObject85 = _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 "])));
9092
9116
  }
9093
9117
  function treeItemRootColorStyle(props) {
9094
9118
  const {
@@ -9101,7 +9125,7 @@ function treeItemRootColorStyle(props) {
9101
9125
  selectable
9102
9126
  } = theme.sanity.color;
9103
9127
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
9104
- 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));
9128
+ return css(_templateObject86 || (_templateObject86 = _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));
9105
9129
  }
9106
9130
  function treeItemBoxStyle(props) {
9107
9131
  const {
@@ -9111,7 +9135,7 @@ function treeItemBoxStyle(props) {
9111
9135
  const {
9112
9136
  space
9113
9137
  } = theme.sanity;
9114
- return css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9138
+ return css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9115
9139
  }
9116
9140
  function useTree() {
9117
9141
  const tree = useContext(TreeContext);
@@ -9142,7 +9166,7 @@ const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle));
9142
9166
  const TreeItemBox = styled(Box).attrs({
9143
9167
  forwardedAs: "a"
9144
9168
  })(treeItemBoxStyle);
9145
- const ToggleArrowText = styled(Text)(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9169
+ const ToggleArrowText = styled(Text)(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9146
9170
  const TreeItem = memo(function TreeItem2(props) {
9147
9171
  const {
9148
9172
  children,
@@ -9289,5 +9313,5 @@ const TreeItem = memo(function TreeItem2(props) {
9289
9313
  })]
9290
9314
  });
9291
9315
  });
9292
- 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, PopoverProvider, 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, usePopover, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTree };
9316
+ 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 };
9293
9317
  //# sourceMappingURL=index.esm.js.map