@sanity/ui 0.38.3-next.30 → 0.38.3-next.36

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/sanity-ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90, _templateObject91, _templateObject92, _templateObject93;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90;
4
4
 
5
5
  const _excluded = ["color", "layer"],
6
6
  _excluded2 = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"],
@@ -23,33 +23,34 @@ const _excluded = ["color", "layer"],
23
23
  _excluded19 = ["children", "style"],
24
24
  _excluded20 = ["children", "zOffset"],
25
25
  _excluded21 = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"],
26
- _excluded22 = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "content", "constrainSize", "disabled", "fallbackPlacements", "open", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "matchReferenceWidth", "shadow", "scheme", "style", "tether", "tetherOffset", "tone", "width", "zOffset"],
27
- _excluded23 = ["className", "disabled", "style", "customValidity", "readOnly"],
28
- _excluded24 = ["children", "customValidity", "disabled", "fontSize", "padding", "radius", "readOnly", "space"],
29
- _excluded25 = ["as", "space"],
30
- _excluded26 = ["checked", "className", "disabled", "indeterminate", "readOnly", "style"],
31
- _excluded27 = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"],
32
- _excluded28 = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"],
33
- _excluded29 = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"],
34
- _excluded30 = ["border", "customValidity", "disabled", "filterOption", "fontSize", "icon", "id", "listBox", "loading", "onBlur", "onChange", "onFocus", "onQueryChange", "onSelect", "openButton", "options", "padding", "popover", "prefix", "radius", "readOnly", "relatedElements", "renderOption", "renderPopover", "renderValue", "suffix", "value"],
35
- _excluded31 = ["children", "maxLength", "separator", "space"],
36
- _excluded32 = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"],
37
- _excluded33 = ["fontSize", "keys", "padding", "radius", "space"],
38
- _excluded34 = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"],
39
- _excluded35 = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"],
40
- _excluded36 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"],
41
- _excluded37 = ["animated", "delay", "radius"],
42
- _excluded38 = ["size"],
26
+ _excluded22 = ["__unstable_margins", "arrow", "arrowRef", "arrowX", "arrowY", "availableHeight", "availableWidth", "boundaryWidth", "children", "padding", "placement", "overflow", "radius", "referenceWidth", "scheme", "shadow", "strategy", "tone", "width", "x", "y"],
27
+ _excluded23 = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "constrainSize", "content", "disabled", "fallbackPlacements", "matchReferenceWidth", "open", "overflow", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "scheme", "shadow", "tether", "tetherOffset", "tone", "width", "zOffset"],
28
+ _excluded24 = ["className", "disabled", "style", "customValidity", "readOnly"],
29
+ _excluded25 = ["children", "customValidity", "disabled", "fontSize", "padding", "radius", "readOnly", "space"],
30
+ _excluded26 = ["as", "space"],
31
+ _excluded27 = ["checked", "className", "disabled", "indeterminate", "readOnly", "style"],
32
+ _excluded28 = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"],
33
+ _excluded29 = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"],
34
+ _excluded30 = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "padding", "placement", "portal", "scheme", "shadow", "zOffset"],
35
+ _excluded31 = ["border", "customValidity", "disabled", "filterOption", "fontSize", "icon", "id", "listBox", "loading", "onBlur", "onChange", "onFocus", "onQueryChange", "onSelect", "openButton", "options", "padding", "popover", "prefix", "radius", "readOnly", "relatedElements", "renderOption", "renderPopover", "renderValue", "suffix", "value"],
36
+ _excluded32 = ["children", "maxLength", "separator", "space"],
37
+ _excluded33 = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"],
38
+ _excluded34 = ["fontSize", "keys", "padding", "radius", "space"],
39
+ _excluded35 = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"],
40
+ _excluded36 = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"],
41
+ _excluded37 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"],
42
+ _excluded38 = ["animated", "delay", "radius"],
43
43
  _excluded39 = ["size"],
44
44
  _excluded40 = ["size"],
45
45
  _excluded41 = ["size"],
46
- _excluded42 = ["icon", "id", "focused", "fontSize", "label", "onClick", "onFocus", "padding", "selected"],
47
- _excluded43 = ["children"],
48
- _excluded44 = ["flex"],
49
- _excluded45 = ["closable", "description", "onClose", "title", "status"],
50
- _excluded46 = ["children", "space"],
51
- _excluded47 = ["children", "expanded"],
52
- _excluded48 = ["children", "expanded", "fontSize", "href", "icon", "id", "muted", "onClick", "padding", "selected", "space", "text", "weight"];
46
+ _excluded42 = ["size"],
47
+ _excluded43 = ["icon", "id", "focused", "fontSize", "label", "onClick", "onFocus", "padding", "selected"],
48
+ _excluded44 = ["children"],
49
+ _excluded45 = ["flex"],
50
+ _excluded46 = ["closable", "description", "onClose", "title", "status"],
51
+ _excluded47 = ["children", "space"],
52
+ _excluded48 = ["children", "expanded"],
53
+ _excluded49 = ["children", "expanded", "fontSize", "href", "icon", "id", "muted", "onClick", "padding", "selected", "space", "text", "weight"];
53
54
 
54
55
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
55
56
 
@@ -83,12 +84,10 @@ var icons = require('@sanity/icons');
83
84
 
84
85
  var Refractor = require('react-refractor');
85
86
 
86
- var reactPopper = require('react-popper');
87
+ var reactDom$1 = require('@floating-ui/react-dom');
87
88
 
88
89
  var reactDom = require('react-dom');
89
90
 
90
- var maxSizeModifier = require('popper-max-size-modifier');
91
-
92
91
  var framerMotion = require('framer-motion');
93
92
 
94
93
  function _interopDefaultLegacy(e) {
@@ -103,10 +102,14 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
103
102
 
104
103
  var Refractor__default = /*#__PURE__*/_interopDefaultLegacy(Refractor);
105
104
 
106
- var maxSizeModifier__default = /*#__PURE__*/_interopDefaultLegacy(maxSizeModifier);
107
-
108
105
  const EMPTY_ARRAY = [];
109
106
  const EMPTY_RECORD = {};
107
+ const FLOATING_STATIC_SIDES = {
108
+ top: "bottom",
109
+ right: "left",
110
+ bottom: "top",
111
+ left: "right"
112
+ };
110
113
 
111
114
  function _fillCSSObject(keys, value) {
112
115
  return keys.reduce((style, key) => {
@@ -513,7 +516,7 @@ var parseDimension = function (pixel) {
513
516
  return parseFloat(pixel || '0');
514
517
  };
515
518
 
516
- var size = function (inlineSize, blockSize, switchSizes) {
519
+ var size$1 = function (inlineSize, blockSize, switchSizes) {
517
520
  if (inlineSize === void 0) {
518
521
  inlineSize = 0;
519
522
  }
@@ -530,9 +533,9 @@ var size = function (inlineSize, blockSize, switchSizes) {
530
533
  };
531
534
 
532
535
  var zeroBoxes = freeze({
533
- devicePixelContentBoxSize: size(),
534
- borderBoxSize: size(),
535
- contentBoxSize: size(),
536
+ devicePixelContentBoxSize: size$1(),
537
+ borderBoxSize: size$1(),
538
+ contentBoxSize: size$1(),
536
539
  contentRect: new DOMRectReadOnly(0, 0, 0, 0)
537
540
  });
538
541
 
@@ -577,9 +580,9 @@ var calculateBoxSizes = function (target, forceRecalculation) {
577
580
  var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;
578
581
  var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;
579
582
  var boxes = freeze({
580
- devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
581
- borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),
582
- contentBoxSize: size(contentWidth, contentHeight, switchSizes),
583
+ devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
584
+ borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
585
+ contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
583
586
  contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
584
587
  });
585
588
  cache.set(target, boxes);
@@ -6211,12 +6214,12 @@ const VirtualList = react.forwardRef(function VirtualList2(props, ref) {
6211
6214
  })
6212
6215
  }));
6213
6216
  });
6214
- const Root$j = styled__default["default"].div(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 27px;\n height: 27px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 13.5px 13.5px;\n }\n\n [data-popper-placement^='top'] > div > & {\n bottom: -27px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
6217
+ const Root$j = styled__default["default"].div(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 27px;\n height: 27px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 13.5px 13.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"])));
6215
6218
  const BorderPath = styled__default["default"].path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6216
6219
  const ShapePath = styled__default["default"].path(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6217
6220
  const PopoverArrow = react.forwardRef(function PopoverArrow2(props, ref) {
6218
6221
  return /* @__PURE__ */jsxRuntime.jsx(Root$j, _objectSpread(_objectSpread({
6219
- "data-ui": "PopoverArrow"
6222
+ "data-ui": "Popover__arrow"
6220
6223
  }, props), {}, {
6221
6224
  ref,
6222
6225
  children: /* @__PURE__ */jsxRuntime.jsxs("svg", {
@@ -6234,315 +6237,290 @@ const PopoverArrow = react.forwardRef(function PopoverArrow2(props, ref) {
6234
6237
  }));
6235
6238
  });
6236
6239
 
6237
- function getPopoverModifiers(props) {
6240
+ function popoverCardStyle(props) {
6238
6241
  const {
6239
- allowedAutoPlacements,
6240
- arrow,
6241
- arrowElement,
6242
- boundaryElement,
6243
- constrainSize,
6244
- distance,
6245
- fallbackPlacements,
6246
- margins,
6247
- matchReferenceWidth,
6248
- open,
6249
- preventOverflow,
6250
- skidding,
6251
- tether,
6252
- tetherOffset
6242
+ $boundaryWidth
6253
6243
  } = props;
6254
-
6255
- if (!open) {
6256
- return [];
6257
- }
6258
-
6259
- const detectOverflowOptions = {
6260
- altAxis: !constrainSize,
6261
- boundary: boundaryElement || void 0,
6262
- padding: 8,
6263
- tether,
6264
- tetherOffset
6244
+ return {
6245
+ maxWidth: $boundaryWidth ? "".concat($boundaryWidth - 16, "px") : "calc(100% - 16px)"
6265
6246
  };
6266
- return [constrainSize && _objectSpread(_objectSpread({}, maxSizeModifier__default["default"]), {}, {
6267
- options: detectOverflowOptions
6268
- }), constrainSize && {
6269
- name: "applyMaxSize",
6270
- enabled: true,
6271
- phase: "beforeWrite",
6272
- requires: ["maxSize"],
6273
-
6274
- fn(_ref21) {
6275
- let {
6276
- state
6277
- } = _ref21;
6278
- const {
6279
- width,
6280
- height
6281
- } = state.modifiersData.maxSize;
6282
- state.styles.popper = _objectSpread(_objectSpread({}, state.styles.popper), {}, {
6283
- maxWidth: "".concat(width, "px"),
6284
- maxHeight: "".concat(height, "px")
6285
- });
6286
- }
6247
+ }
6287
6248
 
6288
- }, arrow && {
6289
- name: "arrow",
6290
- options: {
6291
- element: arrowElement,
6292
- padding: 4
6293
- }
6294
- }, (constrainSize || preventOverflow) && {
6295
- name: "preventOverflow",
6296
- options: detectOverflowOptions
6297
- }, {
6298
- name: "offset",
6299
- options: {
6300
- offset: [skidding, distance]
6301
- }
6302
- }, margins && {
6303
- name: "margins",
6304
- enabled: true,
6305
- phase: "beforeRead",
6306
- fn: _ref22 => {
6307
- let {
6308
- state
6309
- } = _ref22;
6310
- const {
6311
- rects
6312
- } = state;
6313
-
6314
- if (rects.reference) {
6315
- rects.reference.x += margins[3];
6316
- rects.reference.y += margins[1];
6317
- rects.reference.width -= margins[1] + margins[3];
6318
- rects.reference.height -= margins[0] + margins[2];
6319
- }
6320
- }
6321
- }, {
6322
- name: "flip",
6323
- options: {
6324
- allowedAutoPlacements,
6325
- boundary: boundaryElement || void 0,
6326
- fallbackPlacements,
6327
- padding: 8
6328
- }
6329
- }, matchReferenceWidth && {
6330
- name: "matchWidth",
6331
- enabled: true,
6332
- phase: "beforeWrite",
6333
- requires: ["computeStyles"],
6334
-
6335
- fn(_ref23) {
6336
- let {
6337
- state
6338
- } = _ref23;
6339
- const {
6340
- width
6341
- } = state.rects.reference;
6342
- state.styles.popper.width = "".concat(width, "px");
6343
- },
6249
+ const Root$i = react.memo(styled__default["default"](Card)(popoverCardStyle));
6250
+ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref) {
6251
+ const {
6252
+ __unstable_margins: marginsProp,
6253
+ arrow,
6254
+ arrowRef,
6255
+ arrowX,
6256
+ arrowY,
6257
+ availableHeight,
6258
+ availableWidth,
6259
+ boundaryWidth,
6260
+ children,
6261
+ padding,
6262
+ placement,
6263
+ overflow,
6264
+ radius,
6265
+ referenceWidth: referenceWidthProp,
6266
+ scheme,
6267
+ shadow,
6268
+ strategy,
6269
+ tone,
6270
+ width,
6271
+ x: xProp,
6272
+ y: yProp
6273
+ } = props,
6274
+ restProps = _objectWithoutProperties(props, _excluded22);
6344
6275
 
6345
- effect: _ref24 => {
6346
- let {
6347
- state
6348
- } = _ref24;
6349
- const refElement = state.elements.reference;
6276
+ const {
6277
+ zIndex
6278
+ } = useLayer();
6279
+ const margins = react.useMemo(() => marginsProp || [0, 0, 0, 0], [marginsProp]);
6280
+ const referenceWidth = referenceWidthProp ? referenceWidthProp - margins[1] - margins[3] : void 0;
6281
+ const x = (xProp != null ? xProp : 0) + margins[3];
6282
+ const y = (yProp != null ? yProp : 0) + margins[0];
6283
+ const maxWidth = availableWidth ? Math.min(availableWidth - 8, referenceWidth || Infinity) : void 0;
6284
+ const rootStyle = react.useMemo(() => ({
6285
+ position: strategy,
6286
+ top: y,
6287
+ left: x,
6288
+ zIndex,
6289
+ width: referenceWidth,
6290
+ maxWidth: referenceWidth ? void 0 : maxWidth
6291
+ }), [referenceWidth, maxWidth, strategy, x, y, zIndex]);
6292
+ const wrapperStyle = react.useMemo(() => ({
6293
+ minHeight: 25,
6294
+ maxHeight: availableHeight ? availableHeight - 8 : void 0
6295
+ }), [availableHeight]);
6296
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6297
+ const arrowStyle = react.useMemo(() => {
6298
+ const style = {
6299
+ left: arrowX !== null ? arrowX : void 0,
6300
+ top: arrowY !== null ? arrowY : void 0,
6301
+ right: void 0,
6302
+ bottom: void 0
6303
+ };
6304
+ if (staticSide) style[staticSide] = -27;
6305
+ return style;
6306
+ }, [arrowX, arrowY, staticSide]);
6307
+ return /* @__PURE__ */jsxRuntime.jsxs(Root$i, _objectSpread(_objectSpread({}, restProps), {}, {
6308
+ $boundaryWidth: boundaryWidth,
6309
+ "data-placement": placement,
6310
+ "data-ui": "Popover",
6311
+ radius,
6312
+ ref,
6313
+ scheme,
6314
+ shadow,
6315
+ style: rootStyle,
6316
+ tone,
6317
+ $width: width,
6318
+ children: [/* @__PURE__ */jsxRuntime.jsx(Box, {
6319
+ "data-ui": "Popover__wrapper",
6320
+ overflow,
6321
+ padding,
6322
+ sizing: "border",
6323
+ style: wrapperStyle,
6324
+ children
6325
+ }), arrow && /* @__PURE__ */jsxRuntime.jsx(PopoverArrow, {
6326
+ ref: arrowRef,
6327
+ style: arrowStyle
6328
+ })]
6329
+ }));
6330
+ }));
6331
+ PopoverCard.displayName = "PopoverCard";
6332
+
6333
+ function size(scope) {
6334
+ return reactDom$1.size({
6335
+ apply(args) {
6336
+ if (scope.constrainSize) {
6337
+ scope.setAvailableWidth(args.availableWidth);
6338
+ scope.setAvailableHeight(args.availableHeight);
6339
+ }
6350
6340
 
6351
- if (refElement instanceof HTMLElement) {
6352
- state.elements.popper.style.width = "".concat(refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0), "px");
6341
+ if (scope.matchReferenceWidth) {
6342
+ scope.setReferenceWidth(args.rects.reference.width);
6353
6343
  }
6354
- }
6355
- }].filter(Boolean);
6356
- }
6344
+ },
6357
6345
 
6358
- function usePopoverModifiers(props) {
6359
- const {
6360
- allowedAutoPlacements,
6361
- arrow,
6362
- arrowElement,
6363
- boundaryElement,
6364
- constrainSize,
6365
- distance,
6366
- fallbackPlacements,
6367
- margins,
6368
- matchReferenceWidth,
6369
- open,
6370
- preventOverflow,
6371
- skidding,
6372
- tether,
6373
- tetherOffset
6374
- } = props;
6375
- return react.useMemo(() => {
6376
- return getPopoverModifiers({
6377
- allowedAutoPlacements,
6378
- arrow,
6379
- arrowElement,
6380
- boundaryElement,
6381
- constrainSize,
6382
- distance,
6383
- fallbackPlacements,
6384
- margins,
6385
- matchReferenceWidth,
6386
- open,
6387
- preventOverflow,
6388
- skidding,
6389
- tether,
6390
- tetherOffset
6391
- });
6392
- }, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
6346
+ boundary: scope.boundaryElement || void 0
6347
+ });
6393
6348
  }
6394
6349
 
6395
- const Root$i = styled__default["default"](Layer)(_ref25 => {
6396
- let {
6397
- $preventOverflow
6398
- } = _ref25;
6399
- return styled.css(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n pointer-events: none;\n display: flex;\n flex-direction: column;\n max-width: calc(100% - 16px);\n\n & > * {\n min-height: 0;\n }\n\n /* Hide the popover when the reference element is out of bounds */\n ", "\n "])), $preventOverflow && styled.css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n "]))));
6400
- });
6401
- const PopoverCard = styled__default["default"](Card)(_ref26 => {
6402
- let {
6403
- $constrainSize
6404
- } = _ref26;
6405
- return styled.css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n flex: 1;\n max-height: ", ";\n pointer-events: all;\n\n && {\n display: flex;\n }\n\n flex-direction: column;\n\n & > * {\n min-height: 0;\n }\n\n ", "\n "])), $constrainSize && "100%", responsiveContainerWidthStyle);
6406
- });
6407
- const Popover = react.forwardRef(function Popover2(props, ref) {
6408
- var _a;
6350
+ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6351
+ var _a, _b, _c, _d;
6409
6352
 
6410
- const boundaryElementContext = useBoundaryElement();
6411
6353
  const theme = useTheme();
6354
+ const boundaryElementContext = useBoundaryElement();
6412
6355
 
6413
6356
  const {
6414
6357
  __unstable_margins: margins,
6415
6358
  allowedAutoPlacements,
6416
- arrow = true,
6417
- boundaryElement: boundaryElementProp = boundaryElementContext.element,
6418
- children: child,
6359
+ arrow: arrowProp = true,
6360
+ boundaryElement = boundaryElementContext.element,
6361
+ children: childProp,
6362
+ constrainSize = false,
6419
6363
  content,
6420
- constrainSize,
6421
6364
  disabled,
6422
6365
  fallbackPlacements,
6423
- open = false,
6424
- padding,
6425
- placement = "bottom",
6426
- portal: portalProp = false,
6427
- preventOverflow,
6428
- radius = 3,
6429
- referenceElement: referenceElementProp,
6430
- matchReferenceWidth,
6431
- shadow = 3,
6366
+ matchReferenceWidth: matchReferenceWidthProp,
6367
+ open,
6368
+ overflow = props.constrainSize ? "auto" : void 0,
6369
+ padding: paddingProp,
6370
+ placement: placementProp = "bottom",
6371
+ portal,
6372
+ preventOverflow = true,
6373
+ radius: radiusProp = 3,
6374
+ referenceElement,
6432
6375
  scheme,
6433
- style = EMPTY_RECORD,
6376
+ shadow: shadowProp = 3,
6434
6377
  tether,
6435
6378
  tetherOffset,
6436
6379
  tone = "inherit",
6437
- width: widthProp = 0,
6438
- zOffset = (_a = theme.sanity.layer) == null ? void 0 : _a.popover.zOffset
6380
+ width: widthProp = void 0,
6381
+ zOffset: zOffsetProp = (_a = theme.sanity.layer) == null ? void 0 : _a.popover.zOffset
6439
6382
  } = props,
6440
- restProps = _objectWithoutProperties(props, _excluded22);
6383
+ restProps = _objectWithoutProperties(props, _excluded23);
6441
6384
 
6385
+ const boundarySize = (_b = useElementSize(boundaryElement)) == null ? void 0 : _b.border;
6386
+ const padding = useArrayProp(paddingProp);
6387
+ const radius = useArrayProp(radiusProp);
6388
+ const shadow = useArrayProp(shadowProp);
6389
+ const width = useArrayProp(widthProp);
6390
+ const zOffset = useArrayProp(zOffsetProp);
6391
+ const [availableWidth, setAvailableWidth] = react.useState(void 0);
6392
+ const [availableHeight, setAvailableHeight] = react.useState(void 0);
6393
+ const [referenceWidth, setReferenceWidth] = react.useState(void 0);
6442
6394
  const forwardedRef = useForwardedRef(ref);
6443
- const portal = usePortal();
6444
- const [referenceElement, setReferenceElement] = react.useState(null);
6445
- const [popperElement, setPopperElement] = react.useState(null);
6446
- const [arrowElement, setArrowElement] = react.useState(null);
6447
- const popperReferenceElement = referenceElementProp || referenceElement;
6448
- const width = useArrayProp(matchReferenceWidth ? "auto" : widthProp);
6449
- const modifiers = usePopoverModifiers({
6450
- allowedAutoPlacements,
6451
- arrow,
6452
- arrowElement,
6453
- boundaryElement: boundaryElementProp || portal.boundaryElement,
6454
- constrainSize,
6455
- distance: arrow ? 4 : 0,
6456
- fallbackPlacements,
6457
- margins,
6458
- matchReferenceWidth,
6459
- open,
6460
- preventOverflow,
6461
- skidding: 0,
6462
- tether,
6463
- tetherOffset
6464
- });
6465
- const popper = reactPopper.usePopper(popperReferenceElement, popperElement, {
6395
+ const arrowRef = react.useRef(null);
6396
+ const rootBoundary = "viewport";
6397
+ const middleware = react.useMemo(() => {
6398
+ const ret = [];
6399
+
6400
+ if (constrainSize || preventOverflow) {
6401
+ ret.push(reactDom$1.flip({
6402
+ boundary: boundaryElement || void 0,
6403
+ fallbackPlacements,
6404
+ padding: 8,
6405
+ rootBoundary
6406
+ }));
6407
+ }
6408
+
6409
+ ret.push(size({
6410
+ boundaryElement,
6411
+ constrainSize,
6412
+ matchReferenceWidth: matchReferenceWidthProp,
6413
+ setAvailableHeight,
6414
+ setAvailableWidth,
6415
+ setReferenceWidth
6416
+ }));
6417
+ ret.push(reactDom$1.offset({
6418
+ mainAxis: arrowProp ? 4 : 0
6419
+ }));
6420
+
6421
+ if (preventOverflow) {
6422
+ ret.push(reactDom$1.shift({
6423
+ boundary: boundaryElement || void 0,
6424
+ rootBoundary,
6425
+ padding: 8
6426
+ }));
6427
+ }
6428
+
6429
+ if (arrowProp) {
6430
+ ret.push(reactDom$1.arrow({
6431
+ element: arrowRef,
6432
+ padding: 4
6433
+ }));
6434
+ }
6435
+
6436
+ return ret;
6437
+ }, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, matchReferenceWidthProp, preventOverflow]);
6438
+ const {
6439
+ x,
6440
+ y,
6466
6441
  placement,
6467
- modifiers
6442
+ reference,
6443
+ floating,
6444
+ middlewareData,
6445
+ strategy
6446
+ } = reactDom$1.useFloating({
6447
+ middleware,
6448
+ placement: placementProp,
6449
+ whileElementsMounted: reactDom$1.autoUpdate
6468
6450
  });
6469
- const {
6470
- attributes,
6471
- forceUpdate,
6472
- styles
6473
- } = popper;
6474
- const setRef = react.useCallback(el => {
6475
- const childRef = child.ref;
6476
- setReferenceElement(el);
6451
+ const arrowX = (_c = middlewareData.arrow) == null ? void 0 : _c.x;
6452
+ const arrowY = (_d = middlewareData.arrow) == null ? void 0 : _d.y;
6453
+ const setArrow = react.useCallback(arrowEl => {
6454
+ arrowRef.current = arrowEl;
6455
+ }, []);
6456
+ const setFloating = react.useCallback(node => {
6457
+ forwardedRef.current = node;
6458
+ floating(node);
6459
+ }, [floating, forwardedRef]);
6460
+ const setReference = react.useCallback(node => {
6461
+ reference(node);
6462
+ const childRef = childProp == null ? void 0 : childProp.ref;
6477
6463
 
6478
6464
  if (typeof childRef === "function") {
6479
- childRef(el);
6465
+ childRef(node);
6480
6466
  } else if (childRef) {
6481
- childRef.current = el;
6467
+ childRef.current = node;
6482
6468
  }
6483
- }, [child]);
6484
- const setRootRef = react.useCallback(el => {
6485
- setPopperElement(el);
6486
- forwardedRef.current = el;
6487
- }, [forwardedRef]);
6488
- const popoverStyle = react.useMemo(() => _objectSpread(_objectSpread({}, style), styles.popper), [style, styles]);
6489
- const updateTimeoutRef = react.useRef(null);
6469
+ }, [childProp, reference]);
6470
+ const child = react.useMemo(() => {
6471
+ if (!childProp || referenceElement) return null;
6472
+ return react.cloneElement(childProp, {
6473
+ ref: setReference
6474
+ });
6475
+ }, [childProp, referenceElement, setReference]);
6490
6476
  react.useEffect(() => {
6491
- if (updateTimeoutRef.current) {
6492
- clearTimeout(updateTimeoutRef.current);
6493
- updateTimeoutRef.current = null;
6494
- }
6495
-
6496
- updateTimeoutRef.current = setTimeout(() => {
6497
- if (forceUpdate) {
6498
- try {
6499
- forceUpdate();
6500
- } catch (_) {}
6501
- }
6502
- }, 0);
6503
- }, [content, forceUpdate, open, popperReferenceElement]);
6477
+ if (referenceElement) reference(referenceElement);
6478
+ }, [reference, referenceElement]);
6504
6479
 
6505
6480
  if (disabled) {
6506
- return child || /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {});
6481
+ return childProp || /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {});
6507
6482
  }
6508
6483
 
6509
- const node = /* @__PURE__ */jsxRuntime.jsx(Root$i, _objectSpread(_objectSpread(_objectSpread({
6510
- "data-ui": "Popover"
6511
- }, restProps), {}, {
6512
- $preventOverflow: preventOverflow,
6513
- ref: setRootRef,
6514
- style: popoverStyle,
6515
- zOffset
6516
- }, attributes.popper), {}, {
6517
- children: /* @__PURE__ */jsxRuntime.jsxs(PopoverCard, {
6518
- $constrainSize: constrainSize,
6519
- $width: width,
6520
- "data-ui": "PopoverCard",
6484
+ const popover = /* @__PURE__ */jsxRuntime.jsx(LayerProvider, {
6485
+ zOffset,
6486
+ children: /* @__PURE__ */jsxRuntime.jsx(PopoverCard, _objectSpread(_objectSpread({}, restProps), {}, {
6487
+ __unstable_margins: margins,
6488
+ arrow: arrowProp,
6489
+ arrowRef: setArrow,
6490
+ arrowX,
6491
+ arrowY,
6492
+ availableWidth: constrainSize ? availableWidth : void 0,
6493
+ availableHeight: constrainSize ? availableHeight : void 0,
6494
+ boundaryWidth: boundarySize == null ? void 0 : boundarySize.width,
6495
+ overflow,
6521
6496
  padding,
6497
+ placement,
6522
6498
  radius,
6499
+ ref: setFloating,
6500
+ referenceWidth: matchReferenceWidthProp ? referenceWidth : void 0,
6523
6501
  scheme,
6524
6502
  shadow,
6503
+ strategy,
6525
6504
  tone,
6526
- children: [arrow && /* @__PURE__ */jsxRuntime.jsx(PopoverArrow, {
6527
- ref: setArrowElement,
6528
- style: styles.arrow
6529
- }), content]
6530
- })
6531
- }));
6505
+ x,
6506
+ y,
6507
+ width,
6508
+ children: content
6509
+ }))
6510
+ });
6532
6511
  return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
6533
- children: [child && !referenceElementProp ? react.cloneElement(child, {
6534
- ref: setRef
6535
- }) : child || /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {}), open && /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
6536
- children: [portalProp && /* @__PURE__ */jsxRuntime.jsx(Portal, {
6537
- __unstable_name: typeof portalProp === "string" ? portalProp : void 0,
6538
- children: node
6539
- }), !portalProp && node]
6540
- })]
6512
+ children: [open && /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
6513
+ children: portal ? /* @__PURE__ */jsxRuntime.jsx(Portal, {
6514
+ __unstable_name: typeof portal === "string" ? portal : void 0,
6515
+ children: popover
6516
+ }) : popover
6517
+ }), child]
6541
6518
  });
6542
- });
6519
+ }));
6520
+ Popover.displayName = "Popover";
6543
6521
 
6544
6522
  function radioBaseStyle() {
6545
- return styled.css(_templateObject39 || (_templateObject39 = _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 "])));
6523
+ return styled.css(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
6546
6524
  }
6547
6525
 
6548
6526
  function inputElementStyle(props) {
@@ -6555,7 +6533,7 @@ function inputElementStyle(props) {
6555
6533
  } = theme.sanity;
6556
6534
  const color = theme.sanity.color.input;
6557
6535
  const dist = (input.radio.size - input.radio.markSize) / 2;
6558
- return styled.css(_templateObject40 || (_templateObject40 = _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({
6536
+ return styled.css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
6559
6537
  color: color.default.enabled.border,
6560
6538
  width: input.border.width
6561
6539
  }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
@@ -6580,7 +6558,7 @@ const Radio = react.forwardRef(function Radio2(props, forwardedRef) {
6580
6558
  customValidity,
6581
6559
  readOnly
6582
6560
  } = props,
6583
- restProps = _objectWithoutProperties(props, _excluded23);
6561
+ restProps = _objectWithoutProperties(props, _excluded24);
6584
6562
 
6585
6563
  const ref = useForwardedRef(forwardedRef);
6586
6564
  useCustomValidity(ref, customValidity);
@@ -6600,7 +6578,7 @@ const Radio = react.forwardRef(function Radio2(props, forwardedRef) {
6600
6578
  });
6601
6579
 
6602
6580
  function rootStyle() {
6603
- return styled.css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6581
+ return styled.css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6604
6582
  }
6605
6583
 
6606
6584
  function inputBaseStyle(props) {
@@ -6608,7 +6586,7 @@ function inputBaseStyle(props) {
6608
6586
  theme
6609
6587
  } = props;
6610
6588
  const font = theme.sanity.fonts.text;
6611
- return styled.css(_templateObject42 || (_templateObject42 = _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);
6589
+ return styled.css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ", ";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])), font.family);
6612
6590
  }
6613
6591
 
6614
6592
  function inputColorStyle(props) {
@@ -6620,7 +6598,7 @@ function inputColorStyle(props) {
6620
6598
  input
6621
6599
  } = theme.sanity;
6622
6600
  const color = theme.sanity.color.input;
6623
- return styled.css(_templateObject43 || (_templateObject43 = _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({
6601
+ return styled.css(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
6624
6602
  color: color.default.enabled.border,
6625
6603
  width: input.border.width
6626
6604
  }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
@@ -6668,7 +6646,7 @@ function iconBoxStyle(props) {
6668
6646
  theme
6669
6647
  } = props;
6670
6648
  const color = theme.sanity.color.input;
6671
- return styled.css(_templateObject44 || (_templateObject44 = _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);
6649
+ return styled.css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
6672
6650
  }
6673
6651
 
6674
6652
  const selectStyle = {
@@ -6690,7 +6668,7 @@ const Select = react.forwardRef(function Select2(props, forwardedRef) {
6690
6668
  readOnly,
6691
6669
  space = 3
6692
6670
  } = props,
6693
- restProps = _objectWithoutProperties(props, _excluded24);
6671
+ restProps = _objectWithoutProperties(props, _excluded25);
6694
6672
 
6695
6673
  const ref = useForwardedRef(forwardedRef);
6696
6674
  useCustomValidity(ref, customValidity);
@@ -6750,7 +6728,7 @@ const Stack = react.forwardRef(function Stack2(props, ref) {
6750
6728
  as,
6751
6729
  space
6752
6730
  } = props,
6753
- restProps = _objectWithoutProperties(props, _excluded25);
6731
+ restProps = _objectWithoutProperties(props, _excluded26);
6754
6732
 
6755
6733
  return /* @__PURE__ */jsxRuntime.jsx(Root$f, _objectSpread(_objectSpread({
6756
6734
  "data-as": typeof as === "string" ? as : void 0,
@@ -6763,11 +6741,11 @@ const Stack = react.forwardRef(function Stack2(props, ref) {
6763
6741
  });
6764
6742
 
6765
6743
  function switchBaseStyles() {
6766
- return styled.css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6744
+ return styled.css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6767
6745
  }
6768
6746
 
6769
6747
  function switchInputStyles() {
6770
- return styled.css(_templateObject46 || (_templateObject46 = _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 "])));
6748
+ return styled.css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));
6771
6749
  }
6772
6750
 
6773
6751
  function switchRepresentationStyles(props) {
@@ -6779,7 +6757,7 @@ function switchRepresentationStyles(props) {
6779
6757
  input
6780
6758
  } = theme.sanity;
6781
6759
  const color = theme.sanity.color.button.default;
6782
- return styled.css(_templateObject47 || (_templateObject47 = _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({
6760
+ return styled.css(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
6783
6761
  focusRing
6784
6762
  }), 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);
6785
6763
  }
@@ -6791,7 +6769,7 @@ function switchTrackStyles(props) {
6791
6769
  const {
6792
6770
  input
6793
6771
  } = theme.sanity;
6794
- return styled.css(_templateObject48 || (_templateObject48 = _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));
6772
+ return styled.css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2));
6795
6773
  }
6796
6774
 
6797
6775
  function switchThumbStyles(props) {
@@ -6809,7 +6787,7 @@ function switchThumbStyles(props) {
6809
6787
  const checkedOffset = trackWidth - trackPadding * 2 - size;
6810
6788
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
6811
6789
  const checked = $indeterminate !== true && props.$checked === true;
6812
- return styled.css(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && styled.css(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && styled.css(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6790
+ return styled.css(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && styled.css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && styled.css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6813
6791
  }
6814
6792
 
6815
6793
  const Root$e = styled__default["default"].span(switchBaseStyles);
@@ -6826,7 +6804,7 @@ const Switch = react.forwardRef(function Switch2(props, forwardedRef) {
6826
6804
  readOnly,
6827
6805
  style
6828
6806
  } = props,
6829
- restProps = _objectWithoutProperties(props, _excluded26);
6807
+ restProps = _objectWithoutProperties(props, _excluded27);
6830
6808
 
6831
6809
  const ref = useForwardedRef(forwardedRef);
6832
6810
  react.useEffect(() => {
@@ -6856,7 +6834,7 @@ const Switch = react.forwardRef(function Switch2(props, forwardedRef) {
6856
6834
  });
6857
6835
  });
6858
6836
  const Root$d = styled__default["default"].span(textInputRootStyle);
6859
- const InputRoot$1 = styled__default["default"].span(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6837
+ const InputRoot$1 = styled__default["default"].span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6860
6838
  const Input$1 = styled__default["default"].textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6861
6839
  const Presentation$1 = styled__default["default"].div(responsiveRadiusStyle, textInputRepresentationStyle);
6862
6840
  const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
@@ -6869,7 +6847,7 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
6869
6847
  radius = 1,
6870
6848
  weight
6871
6849
  } = props,
6872
- restProps = _objectWithoutProperties(props, _excluded27);
6850
+ restProps = _objectWithoutProperties(props, _excluded28);
6873
6851
 
6874
6852
  const ref = useForwardedRef(forwardedRef);
6875
6853
  const rootTheme = useRootTheme();
@@ -6907,18 +6885,18 @@ const CLEAR_BUTTON_BOX_STYLE = {
6907
6885
  const Root$c = styled__default["default"](Card).attrs({
6908
6886
  forwardedAs: "span"
6909
6887
  })(textInputRootStyle);
6910
- const InputRoot = styled__default["default"].span(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6888
+ const InputRoot = styled__default["default"].span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6911
6889
  const Prefix = styled__default["default"](Card).attrs({
6912
6890
  forwardedAs: "span"
6913
- })(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6891
+ })(_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"])));
6914
6892
  const Suffix = styled__default["default"](Card).attrs({
6915
6893
  forwardedAs: "span"
6916
- })(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
6894
+ })(_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"])));
6917
6895
  const Input = styled__default["default"].input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6918
6896
  const Presentation = styled__default["default"].span(responsiveRadiusStyle, textInputRepresentationStyle);
6919
- const LeftBox = styled__default["default"](Box)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6920
- const RightBox = styled__default["default"](Box)(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6921
- const RightCard = styled__default["default"](Card)(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6897
+ const LeftBox = styled__default["default"](Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6898
+ const RightBox = styled__default["default"](Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6899
+ const RightCard = styled__default["default"](Card)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6922
6900
  const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6923
6901
  const {
6924
6902
  border = true,
@@ -6938,7 +6916,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6938
6916
  type = "text",
6939
6917
  weight
6940
6918
  } = props,
6941
- restProps = _objectWithoutProperties(props, _excluded28);
6919
+ restProps = _objectWithoutProperties(props, _excluded29);
6942
6920
 
6943
6921
  const ref = useForwardedRef(forwardedRef);
6944
6922
  const rootTheme = useRootTheme();
@@ -7064,13 +7042,15 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
7064
7042
  }), suffixNode]
7065
7043
  });
7066
7044
  });
7067
- const Root$b = styled__default["default"].div(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\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-popper-placement^='top'] > div > & {\n bottom: -15px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -15px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -15px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -15px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
7068
- const Border = styled__default["default"].path(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
7069
- const Shape = styled__default["default"].path(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
7045
+ const Root$b = styled__default["default"].div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
7046
+ const Border = styled__default["default"].path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
7047
+ const Shape = styled__default["default"].path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
7070
7048
  const TooltipArrow = react.forwardRef(function TooltipArrow2(props, ref) {
7071
7049
  const restProps = _extends({}, props);
7072
7050
 
7073
- return /* @__PURE__ */jsxRuntime.jsx(Root$b, _objectSpread(_objectSpread({}, restProps), {}, {
7051
+ return /* @__PURE__ */jsxRuntime.jsx(Root$b, _objectSpread(_objectSpread({
7052
+ "data-ui": "Tooltip__arrow"
7053
+ }, restProps), {}, {
7074
7054
  ref,
7075
7055
  children: /* @__PURE__ */jsxRuntime.jsxs("svg", {
7076
7056
  width: "15",
@@ -7084,63 +7064,87 @@ const TooltipArrow = react.forwardRef(function TooltipArrow2(props, ref) {
7084
7064
  })
7085
7065
  }));
7086
7066
  });
7087
- const Root$a = styled__default["default"](Layer)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
7067
+ const Root$a = styled__default["default"](Layer)(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
7088
7068
  const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7089
- var _a;
7069
+ var _a, _b, _c;
7090
7070
 
7091
7071
  const boundaryElementContext = useBoundaryElement();
7092
7072
  const theme = useTheme();
7093
7073
 
7094
7074
  const {
7095
- allowedAutoPlacements,
7096
7075
  boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
7097
- children,
7076
+ children: childProp,
7098
7077
  content,
7099
7078
  disabled,
7100
7079
  fallbackPlacements: fallbackPlacementsProp,
7101
- placement = "bottom",
7080
+ padding,
7081
+ placement: placementProp = "bottom",
7102
7082
  portal,
7103
7083
  scheme,
7084
+ shadow = 2,
7104
7085
  zOffset = (_a = theme.sanity.layer) == null ? void 0 : _a.tooltip.zOffset
7105
7086
  } = props,
7106
- restProps = _objectWithoutProperties(props, _excluded29);
7087
+ restProps = _objectWithoutProperties(props, _excluded30);
7107
7088
 
7108
7089
  const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7109
7090
  const forwardedRef = useForwardedRef(ref);
7110
7091
  const [referenceElement, setReferenceElement] = react.useState(null);
7111
- const [popperElement, setPopperElement] = react.useState(null);
7112
- const [arrowElement, setArrowElement] = react.useState(null);
7113
- const popper = reactPopper.usePopper(referenceElement, popperElement, {
7092
+ const arrowRef = react.useRef(null);
7093
+ const rootBoundary = "viewport";
7094
+ const middleware = react.useMemo(() => {
7095
+ const ret = [];
7096
+ ret.push(reactDom$1.flip({
7097
+ boundary: boundaryElement || void 0,
7098
+ fallbackPlacements,
7099
+ padding: 4,
7100
+ rootBoundary
7101
+ }));
7102
+ ret.push(reactDom$1.offset({
7103
+ mainAxis: 3
7104
+ }));
7105
+ ret.push(reactDom$1.shift({
7106
+ boundary: boundaryElement || void 0,
7107
+ rootBoundary,
7108
+ padding: 4
7109
+ }));
7110
+ ret.push(reactDom$1.arrow({
7111
+ element: arrowRef,
7112
+ padding: 2
7113
+ }));
7114
+ return ret;
7115
+ }, [boundaryElement, fallbackPlacements]);
7116
+ const {
7117
+ x,
7118
+ y,
7114
7119
  placement,
7115
- modifiers: [{
7116
- name: "arrow",
7117
- options: {
7118
- element: arrowElement,
7119
- padding: 4
7120
- }
7121
- }, {
7122
- name: "preventOverflow",
7123
- options: {
7124
- altAxis: true,
7125
- boundary: boundaryElement || void 0,
7126
- padding: 4
7127
- }
7128
- }, {
7129
- name: "offset",
7130
- options: {
7131
- offset: [0, 3]
7132
- }
7133
- }, {
7134
- name: "flip",
7135
- options: {
7136
- allowedAutoPlacements,
7137
- fallbackPlacements
7138
- }
7139
- }]
7120
+ reference,
7121
+ floating,
7122
+ middlewareData,
7123
+ update,
7124
+ strategy
7125
+ } = reactDom$1.useFloating({
7126
+ middleware,
7127
+ placement: placementProp,
7128
+ whileElementsMounted: reactDom$1.autoUpdate
7140
7129
  });
7141
- const {
7142
- forceUpdate
7143
- } = popper;
7130
+ const rootStyle = react.useMemo(() => ({
7131
+ position: strategy,
7132
+ top: y != null ? y : 0,
7133
+ left: x != null ? x : 0
7134
+ }), [strategy, x, y]);
7135
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
7136
+ const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
7137
+ const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
7138
+ const arrowStyle = react.useMemo(() => {
7139
+ const style = {
7140
+ left: arrowX !== null ? arrowX : void 0,
7141
+ top: arrowY !== null ? arrowY : void 0,
7142
+ right: void 0,
7143
+ bottom: void 0
7144
+ };
7145
+ if (staticSide) style[staticSide] = -15;
7146
+ return style;
7147
+ }, [arrowX, arrowY, staticSide]);
7144
7148
  const [isOpen, setIsOpen] = react.useState(false);
7145
7149
  const handleBlur = react.useCallback(() => setIsOpen(false), []);
7146
7150
  const handleFocus = react.useCallback(() => setIsOpen(true), []);
@@ -7164,73 +7168,76 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7164
7168
  window.removeEventListener("mousemove", handleWindowMouseMove);
7165
7169
  };
7166
7170
  }, [isOpen, referenceElement]);
7167
- const updateTimeoutRef = react.useRef(null);
7168
- react.useEffect(() => {
7169
- if (updateTimeoutRef.current) {
7170
- clearTimeout(updateTimeoutRef.current);
7171
- updateTimeoutRef.current = null;
7172
- }
7173
-
7174
- updateTimeoutRef.current = setTimeout(() => {
7175
- if (forceUpdate) {
7176
- try {
7177
- forceUpdate();
7178
- } catch (_) {}
7179
- }
7180
- }, 0);
7181
- }, [forceUpdate, content]);
7182
7171
  react.useEffect(() => {
7183
7172
  if (disabled) setIsOpen(false);
7184
7173
  }, [disabled]);
7185
7174
  react.useEffect(() => {
7186
7175
  if (!content) setIsOpen(false);
7187
7176
  }, [content]);
7177
+ react.useEffect(() => reference(referenceElement), [reference, referenceElement]);
7178
+ const setArrow = react.useCallback(arrowEl => {
7179
+ arrowRef.current = arrowEl;
7180
+ update();
7181
+ }, [update]);
7182
+ const setFloating = react.useCallback(node => {
7183
+ forwardedRef.current = node;
7184
+ floating(node);
7185
+ }, [floating, forwardedRef]);
7186
+ const childRef = childProp == null ? void 0 : childProp.ref;
7187
+ const setReference = react.useCallback(node => {
7188
+ if (typeof childRef === "function") {
7189
+ childRef(node);
7190
+ } else if (childRef) {
7191
+ childRef.current = node;
7192
+ }
7188
7193
 
7189
- const setRef = el => {
7190
- setPopperElement(el);
7191
- forwardedRef.current = el;
7192
- };
7193
-
7194
- if (!children) return /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {});
7195
- if (disabled) return children;
7196
- const referenceProps = {
7197
- onBlur: handleBlur,
7198
- onFocus: handleFocus,
7199
- onMouseEnter: handleMouseEnter,
7200
- onMouseLeave: handleMouseLeave,
7201
- ref: setReferenceElement
7202
- };
7203
- const referenceNode = react.cloneElement(children, referenceProps);
7204
- const popperNode = /* @__PURE__ */jsxRuntime.jsx(Root$a, _objectSpread(_objectSpread(_objectSpread({
7194
+ setReferenceElement(node);
7195
+ }, [childRef]);
7196
+ const child = react.useMemo(() => {
7197
+ if (!childProp) return null;
7198
+ return react.cloneElement(childProp, {
7199
+ onBlur: handleBlur,
7200
+ onFocus: handleFocus,
7201
+ onMouseEnter: handleMouseEnter,
7202
+ onMouseLeave: handleMouseLeave,
7203
+ ref: setReference
7204
+ });
7205
+ }, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
7206
+ if (!child) return /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {});
7207
+ if (disabled) return child;
7208
+ const root = /* @__PURE__ */jsxRuntime.jsx(Root$a, _objectSpread(_objectSpread({
7205
7209
  "data-ui": "Tooltip"
7206
- }, restProps), popper.attributes.popper), {}, {
7207
- ref: setRef,
7208
- style: popper.styles.popper,
7210
+ }, restProps), {}, {
7211
+ ref: setFloating,
7212
+ style: rootStyle,
7209
7213
  zOffset,
7210
7214
  children: /* @__PURE__ */jsxRuntime.jsxs(Card, {
7215
+ "data-ui": "Tooltip__card",
7216
+ "data-placement": placement,
7217
+ padding,
7211
7218
  radius: 2,
7212
7219
  scheme,
7213
- shadow: 3,
7220
+ shadow,
7214
7221
  children: [content, /* @__PURE__ */jsxRuntime.jsx(TooltipArrow, {
7215
- ref: setArrowElement,
7216
- style: popper.styles.arrow
7222
+ ref: setArrow,
7223
+ style: arrowStyle
7217
7224
  })]
7218
7225
  })
7219
7226
  }));
7220
7227
  return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
7221
- children: [referenceNode, isOpen && /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
7222
- children: [portal && /* @__PURE__ */jsxRuntime.jsx(Portal, {
7228
+ children: [child, isOpen && /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
7229
+ children: portal ? /* @__PURE__ */jsxRuntime.jsx(Portal, {
7223
7230
  __unstable_name: typeof portal === "string" ? portal : void 0,
7224
- children: popperNode
7225
- }), !portal && popperNode]
7231
+ children: root
7232
+ }) : root
7226
7233
  })]
7227
7234
  });
7228
7235
  });
7229
- const Root$9 = styled__default["default"].div(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
7230
- const ListBox = styled__default["default"](Box)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
7231
- const ResultsPopover = styled__default["default"](Popover)(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n & > div {\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n"])));
7232
- const rotate = styled.keyframes(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
7233
- const AnimatedSpinnerIcon = styled__default["default"](icons.SpinnerIcon)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
7236
+ const Root$9 = styled__default["default"].div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
7237
+ const ListBox = styled__default["default"](Box)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
7238
+ const ResultsPopover = styled__default["default"](Popover)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n"])));
7239
+ const rotate = styled.keyframes(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
7240
+ const AnimatedSpinnerIcon = styled__default["default"](icons.SpinnerIcon)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
7234
7241
 
7235
7242
  function AutocompleteOption(props) {
7236
7243
  const {
@@ -7329,13 +7336,13 @@ function autocompleteReducer(state, msg) {
7329
7336
  }
7330
7337
 
7331
7338
  const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"];
7332
- const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 1, 1];
7333
- const AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start";
7334
- const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["top-start"];
7339
+ const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
7340
+ const AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom";
7341
+ const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom", "top"];
7335
7342
 
7336
- const defaultRenderValue = (value, option) => option ? option.value : value;
7343
+ const DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value;
7337
7344
 
7338
- const defaultFilterOption = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
7345
+ const DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
7339
7346
 
7340
7347
  const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, ref) {
7341
7348
  const {
@@ -7346,7 +7353,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7346
7353
  fontSize = 2,
7347
7354
  icon,
7348
7355
  id,
7349
- listBox = {},
7356
+ listBox = EMPTY_RECORD,
7350
7357
  loading,
7351
7358
  onBlur,
7352
7359
  onChange,
@@ -7356,18 +7363,18 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7356
7363
  openButton,
7357
7364
  options: optionsProp,
7358
7365
  padding: paddingProp = 3,
7359
- popover = {},
7366
+ popover = EMPTY_RECORD,
7360
7367
  prefix,
7361
7368
  radius = 3,
7362
7369
  readOnly,
7363
7370
  relatedElements,
7364
7371
  renderOption: renderOptionProp,
7365
7372
  renderPopover,
7366
- renderValue = defaultRenderValue,
7373
+ renderValue = DEFAULT_RENDER_VALUE,
7367
7374
  suffix,
7368
7375
  value: valueProp
7369
7376
  } = props,
7370
- restProps = _objectWithoutProperties(props, _excluded30);
7377
+ restProps = _objectWithoutProperties(props, _excluded31);
7371
7378
 
7372
7379
  const [state, dispatch] = react.useReducer(autocompleteReducer, {
7373
7380
  activeValue: valueProp || null,
@@ -7383,10 +7390,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7383
7390
  query,
7384
7391
  value
7385
7392
  } = state;
7386
- const defaultRenderOption = react.useCallback(_ref27 => {
7393
+ const defaultRenderOption = react.useCallback(_ref21 => {
7387
7394
  let {
7388
7395
  value: value2
7389
- } = _ref27;
7396
+ } = _ref21;
7390
7397
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7391
7398
  "data-as": "button",
7392
7399
  padding: paddingProp,
@@ -7400,7 +7407,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7400
7407
  });
7401
7408
  }, [fontSize, paddingProp]);
7402
7409
  const renderOption = typeof renderOptionProp === "function" ? renderOptionProp : defaultRenderOption;
7403
- const filterOption = typeof filterOptionProp === "function" ? filterOptionProp : defaultFilterOption;
7410
+ const filterOption = typeof filterOptionProp === "function" ? filterOptionProp : DEFAULT_FILTER_OPTION;
7404
7411
  const rootElementRef = react.useRef(null);
7405
7412
  const resultsPopoverElementRef = react.useRef(null);
7406
7413
  const inputElementRef = react.useRef(null);
@@ -7637,12 +7644,7 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7637
7644
  if (v === 2) return 1;
7638
7645
  return v - 2;
7639
7646
  }), [padding]);
7640
- const openButtonPadding = react.useMemo(() => padding.map(v => {
7641
- if (v === 0) return 0;
7642
- if (v === 1) return 0;
7643
- if (v === 2) return 1;
7644
- return v - 1;
7645
- }), [padding]);
7647
+ const openButtonPadding = react.useMemo(() => padding.map(v => Math.max(v - 1, 0)), [padding]);
7646
7648
  const openButtonProps = react.useMemo(() => typeof openButton === "object" ? openButton : EMPTY_RECORD, [openButton]);
7647
7649
  const handleOpenClick = react.useCallback(event => {
7648
7650
  dispatch({
@@ -7794,8 +7796,8 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7794
7796
  });
7795
7797
  });
7796
7798
  const Autocomplete = InnerAutocomplete;
7797
- const Root$8 = styled__default["default"].ol(_templateObject68 || (_templateObject68 = _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"])));
7798
- const ExpandButton = styled__default["default"](Button)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7799
+ const Root$8 = styled__default["default"].ol(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
7800
+ const ExpandButton = styled__default["default"](Button)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7799
7801
  const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7800
7802
  const {
7801
7803
  children,
@@ -7803,7 +7805,7 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7803
7805
  separator,
7804
7806
  space: spaceRaw = 2
7805
7807
  } = props,
7806
- restProps = _objectWithoutProperties(props, _excluded31);
7808
+ restProps = _objectWithoutProperties(props, _excluded32);
7807
7809
 
7808
7810
  const space = useArrayProp(spaceRaw);
7809
7811
  const [open, setOpen] = react.useState(false);
@@ -7869,10 +7871,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7869
7871
  }));
7870
7872
  });
7871
7873
 
7872
- function dialogStyle(_ref28) {
7874
+ function dialogStyle(_ref22) {
7873
7875
  let {
7874
7876
  theme
7875
- } = _ref28;
7877
+ } = _ref22;
7876
7878
  const color = theme.sanity.color.base;
7877
7879
  return {
7878
7880
  "&:not([hidden])": {
@@ -7914,12 +7916,12 @@ function useDialog() {
7914
7916
  }
7915
7917
 
7916
7918
  const Root$7 = styled__default["default"](Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
7917
- const DialogContainer = styled__default["default"](Container)(_templateObject70 || (_templateObject70 = _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"])));
7918
- const DialogCardRoot = styled__default["default"](Card)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
7919
- const DialogLayout = styled__default["default"](Flex)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7920
- const DialogHeader = styled__default["default"](Card)(_templateObject73 || (_templateObject73 = _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"])));
7921
- const DialogContent = styled__default["default"](Box)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7922
- const DialogFooter = styled__default["default"](Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7919
+ const DialogContainer = styled__default["default"](Container)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
7920
+ const DialogCardRoot = styled__default["default"](Card)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
7921
+ const DialogLayout = styled__default["default"](Flex)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7922
+ const DialogHeader = styled__default["default"](Card)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
7923
+ const DialogContent = styled__default["default"](Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7924
+ const DialogFooter = styled__default["default"](Box)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7923
7925
  const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
7924
7926
  const {
7925
7927
  __unstable_autoFocus: autoFocus,
@@ -8046,7 +8048,7 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
8046
8048
  width: widthProp = 0,
8047
8049
  zOffset: zOffsetProp = dialog.zOffset || ((_a = theme.sanity.layer) == null ? void 0 : _a.dialog.zOffset)
8048
8050
  } = props,
8049
- restProps = _objectWithoutProperties(props, _excluded32);
8051
+ restProps = _objectWithoutProperties(props, _excluded33);
8050
8052
 
8051
8053
  const cardRadius = useArrayProp(cardRadiusProp);
8052
8054
  const padding = useArrayProp(paddingProp);
@@ -8131,8 +8133,8 @@ function DialogProvider(props) {
8131
8133
  });
8132
8134
  }
8133
8135
 
8134
- const Root$6 = styled__default["default"].kbd(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
8135
- const Key = styled__default["default"](KBD)(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
8136
+ const Root$6 = styled__default["default"].kbd(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
8137
+ const Key = styled__default["default"](KBD)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
8136
8138
  const Hotkeys = react.forwardRef(function Hotkeys2(props, ref) {
8137
8139
  const {
8138
8140
  fontSize,
@@ -8141,7 +8143,7 @@ const Hotkeys = react.forwardRef(function Hotkeys2(props, ref) {
8141
8143
  radius,
8142
8144
  space: spaceProp = 1
8143
8145
  } = props,
8144
- restProps = _objectWithoutProperties(props, _excluded33);
8146
+ restProps = _objectWithoutProperties(props, _excluded34);
8145
8147
 
8146
8148
  const space = useArrayProp(spaceProp);
8147
8149
 
@@ -8403,7 +8405,7 @@ function useMenuController(props) {
8403
8405
  };
8404
8406
  }
8405
8407
 
8406
- const Root$5 = styled__default["default"](Box)(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
8408
+ const Root$5 = styled__default["default"](Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
8407
8409
  const Menu = react.forwardRef(function Menu2(props, ref) {
8408
8410
  const {
8409
8411
  children,
@@ -8420,7 +8422,7 @@ const Menu = react.forwardRef(function Menu2(props, ref) {
8420
8422
  shouldFocus = props.focusFirst && "first" || props.focusLast && "last" || null,
8421
8423
  space = 1
8422
8424
  } = props,
8423
- restProps = _objectWithoutProperties(props, _excluded34);
8425
+ restProps = _objectWithoutProperties(props, _excluded35);
8424
8426
 
8425
8427
  const forwardedRef = useForwardedRef(ref);
8426
8428
  const {
@@ -8637,10 +8639,10 @@ const MenuButton = react.forwardRef(function MenuButton2(props, ref) {
8637
8639
  children: button || /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {})
8638
8640
  }));
8639
8641
  });
8640
- const MenuDivider = styled__default["default"].hr(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8642
+ const MenuDivider = styled__default["default"].hr(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8641
8643
 
8642
8644
  function selectableBaseStyle() {
8643
- return styled.css(_templateObject80 || (_templateObject80 = _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 "])));
8645
+ return styled.css(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
8644
8646
  }
8645
8647
 
8646
8648
  function selectableColorStyle(props) {
@@ -8656,7 +8658,7 @@ function selectableColorStyle(props) {
8656
8658
  selectable
8657
8659
  } = theme.sanity.color;
8658
8660
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8659
- return styled.css(_templateObject81 || (_templateObject81 = _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);
8661
+ return styled.css(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
8660
8662
  }
8661
8663
 
8662
8664
  const Selectable = styled__default["default"](Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
@@ -8689,7 +8691,7 @@ function MenuGroup(props) {
8689
8691
  text,
8690
8692
  tone = "default"
8691
8693
  } = props,
8692
- restProps = _objectWithoutProperties(props, _excluded35);
8694
+ restProps = _objectWithoutProperties(props, _excluded36);
8693
8695
 
8694
8696
  const menu = useMenu();
8695
8697
  const {
@@ -8838,7 +8840,7 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
8838
8840
  text,
8839
8841
  tone = "default"
8840
8842
  } = props,
8841
- restProps = _objectWithoutProperties(props, _excluded36);
8843
+ restProps = _objectWithoutProperties(props, _excluded37);
8842
8844
 
8843
8845
  const menu = useMenu();
8844
8846
  const {
@@ -8928,18 +8930,18 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
8928
8930
  }))]
8929
8931
  }));
8930
8932
  });
8931
- const keyframe = styled.keyframes(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8932
- const animation = styled.css(_templateObject83 || (_templateObject83 = _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);
8933
- const skeletonStyle = styled.css(_templateObject84 || (_templateObject84 = _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"])), _ref29 => {
8933
+ const keyframe = styled.keyframes(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8934
+ const animation = styled.css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8935
+ const skeletonStyle = styled.css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref23 => {
8934
8936
  let {
8935
8937
  $visible
8936
- } = _ref29;
8938
+ } = _ref23;
8937
8939
  return $visible ? 1 : 0;
8938
- }, _ref30 => {
8940
+ }, _ref24 => {
8939
8941
  let {
8940
8942
  $animated
8941
- } = _ref30;
8942
- return $animated ? animation : styled.css(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8943
+ } = _ref24;
8944
+ return $animated ? animation : styled.css(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8943
8945
  });
8944
8946
  const Root$4 = styled__default["default"](Box)(responsiveRadiusStyle, skeletonStyle);
8945
8947
  const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
@@ -8948,7 +8950,7 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
8948
8950
  delay,
8949
8951
  radius
8950
8952
  } = props,
8951
- restProps = _objectWithoutProperties(props, _excluded37);
8953
+ restProps = _objectWithoutProperties(props, _excluded38);
8952
8954
 
8953
8955
  const [visible, setVisible] = react.useState(delay ? false : true);
8954
8956
  react.useEffect(() => {
@@ -8970,12 +8972,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
8970
8972
  ref
8971
8973
  }));
8972
8974
  });
8973
- const Root$3 = styled__default["default"](Skeleton)(_ref31 => {
8975
+ const Root$3 = styled__default["default"](Skeleton)(_ref25 => {
8974
8976
  let {
8975
8977
  $size,
8976
8978
  $style,
8977
8979
  theme
8978
- } = _ref31;
8980
+ } = _ref25;
8979
8981
  const {
8980
8982
  media
8981
8983
  } = theme.sanity;
@@ -8995,7 +8997,7 @@ const TextSkeleton = react.forwardRef(function TextSkeleton2(props, ref) {
8995
8997
  const {
8996
8998
  size = 2
8997
8999
  } = props,
8998
- restProps = _objectWithoutProperties(props, _excluded38);
9000
+ restProps = _objectWithoutProperties(props, _excluded39);
8999
9001
 
9000
9002
  const $size = useArrayProp(size);
9001
9003
  return /* @__PURE__ */jsxRuntime.jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9008,7 +9010,7 @@ const LabelSkeleton = react.forwardRef(function TextSkeleton3(props, ref) {
9008
9010
  const {
9009
9011
  size = 2
9010
9012
  } = props,
9011
- restProps = _objectWithoutProperties(props, _excluded39);
9013
+ restProps = _objectWithoutProperties(props, _excluded40);
9012
9014
 
9013
9015
  const $size = useArrayProp(size);
9014
9016
  return /* @__PURE__ */jsxRuntime.jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9021,7 +9023,7 @@ const HeadingSkeleton = react.forwardRef(function TextSkeleton4(props, ref) {
9021
9023
  const {
9022
9024
  size = 2
9023
9025
  } = props,
9024
- restProps = _objectWithoutProperties(props, _excluded40);
9026
+ restProps = _objectWithoutProperties(props, _excluded41);
9025
9027
 
9026
9028
  const $size = useArrayProp(size);
9027
9029
  return /* @__PURE__ */jsxRuntime.jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9034,7 +9036,7 @@ const CodeSkeleton = react.forwardRef(function TextSkeleton5(props, ref) {
9034
9036
  const {
9035
9037
  size = 2
9036
9038
  } = props,
9037
- restProps = _objectWithoutProperties(props, _excluded41);
9039
+ restProps = _objectWithoutProperties(props, _excluded42);
9038
9040
 
9039
9041
  const $size = useArrayProp(size);
9040
9042
  return /* @__PURE__ */jsxRuntime.jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9055,7 +9057,7 @@ const Tab = react.forwardRef(function Tab2(props, forwardedRef) {
9055
9057
  padding = 2,
9056
9058
  selected
9057
9059
  } = props,
9058
- restProps = _objectWithoutProperties(props, _excluded42);
9060
+ restProps = _objectWithoutProperties(props, _excluded43);
9059
9061
 
9060
9062
  const elementRef = react.useRef(null);
9061
9063
  const focusedRef = react.useRef(false);
@@ -9108,7 +9110,7 @@ const TabList = react.forwardRef(function TabList2(props, ref) {
9108
9110
  const {
9109
9111
  children: childrenProp
9110
9112
  } = props,
9111
- restProps = _objectWithoutProperties(props, _excluded43);
9113
+ restProps = _objectWithoutProperties(props, _excluded44);
9112
9114
 
9113
9115
  const [focusedIndex, setFocusedIndex] = react.useState(-1);
9114
9116
  const children = react.useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]);
@@ -9143,7 +9145,7 @@ const TabPanel = react.forwardRef(function TabPanel2(props, ref) {
9143
9145
  const {
9144
9146
  flex
9145
9147
  } = props,
9146
- restProps = _objectWithoutProperties(props, _excluded44);
9148
+ restProps = _objectWithoutProperties(props, _excluded45);
9147
9149
 
9148
9150
  return /* @__PURE__ */jsxRuntime.jsx(Box, _objectSpread(_objectSpread({
9149
9151
  "data-ui": "TabPanel"
@@ -9167,8 +9169,8 @@ const ROLES = {
9167
9169
  success: "alert",
9168
9170
  info: "alert"
9169
9171
  };
9170
- const Root$2 = styled__default["default"](Card)(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
9171
- const TextBox = styled__default["default"](Flex)(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
9172
+ const Root$2 = styled__default["default"](Card)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
9173
+ const TextBox = styled__default["default"](Flex)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
9172
9174
 
9173
9175
  function Toast(props) {
9174
9176
  const {
@@ -9178,7 +9180,7 @@ function Toast(props) {
9178
9180
  title,
9179
9181
  status
9180
9182
  } = props,
9181
- restProps = _objectWithoutProperties(props, _excluded45);
9183
+ restProps = _objectWithoutProperties(props, _excluded46);
9182
9184
 
9183
9185
  const cardTone = status ? STATUS_CARD_TONE[status] : "default";
9184
9186
  const role = status ? ROLES[status] : "status";
@@ -9226,8 +9228,8 @@ function Toast(props) {
9226
9228
  const key$1 = Symbol.for("@sanity/ui/context/toast");
9227
9229
  globalScope[key$1] = globalScope[key$1] || react.createContext(null);
9228
9230
  const ToastContext = globalScope[key$1];
9229
- const Root$1 = styled__default["default"](Layer)(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
9230
- const ToastContainer = styled__default["default"].div(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
9231
+ const Root$1 = styled__default["default"](Layer)(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
9232
+ const ToastContainer = styled__default["default"].div(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
9231
9233
  let toastId = 0;
9232
9234
 
9233
9235
  function ToastProvider(props) {
@@ -9317,12 +9319,12 @@ function ToastProvider(props) {
9317
9319
  paddingY,
9318
9320
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9319
9321
  initial: false,
9320
- children: state.toasts.map(_ref32 => {
9322
+ children: state.toasts.map(_ref26 => {
9321
9323
  let {
9322
9324
  dismiss,
9323
9325
  id,
9324
9326
  params
9325
- } = _ref32;
9327
+ } = _ref26;
9326
9328
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9327
9329
  animate: {
9328
9330
  opacity: 1,
@@ -9477,7 +9479,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
9477
9479
  children,
9478
9480
  space = 1
9479
9481
  } = props,
9480
- restProps = _objectWithoutProperties(props, _excluded46);
9482
+ restProps = _objectWithoutProperties(props, _excluded47);
9481
9483
 
9482
9484
  const forwardedRef = useForwardedRef(ref);
9483
9485
  const [focusedElement, setFocusedElement] = react.useState(null);
@@ -9644,7 +9646,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
9644
9646
  Tree.displayName = "Tree";
9645
9647
 
9646
9648
  function treeItemRootStyle() {
9647
- return styled.css(_templateObject90 || (_templateObject90 = _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 "])));
9649
+ return styled.css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
9648
9650
  }
9649
9651
 
9650
9652
  function treeItemRootColorStyle(props) {
@@ -9658,7 +9660,7 @@ function treeItemRootColorStyle(props) {
9658
9660
  selectable
9659
9661
  } = theme.sanity.color;
9660
9662
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
9661
- return styled.css(_templateObject91 || (_templateObject91 = _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));
9663
+ return styled.css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", "\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
9662
9664
  }
9663
9665
 
9664
9666
  function treeItemBoxStyle(props) {
@@ -9669,7 +9671,7 @@ function treeItemBoxStyle(props) {
9669
9671
  const {
9670
9672
  space
9671
9673
  } = theme.sanity;
9672
- return styled.css(_templateObject92 || (_templateObject92 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9674
+ return styled.css(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9673
9675
  }
9674
9676
 
9675
9677
  function useTree() {
@@ -9687,7 +9689,7 @@ const TreeGroup = react.memo(function TreeGroup2(props) {
9687
9689
  children,
9688
9690
  expanded = false
9689
9691
  } = props,
9690
- restProps = _objectWithoutProperties(props, _excluded47);
9692
+ restProps = _objectWithoutProperties(props, _excluded48);
9691
9693
 
9692
9694
  const tree = useTree();
9693
9695
  return /* @__PURE__ */jsxRuntime.jsx(Stack, _objectSpread(_objectSpread({
@@ -9705,7 +9707,7 @@ const Root = react.memo(styled__default["default"].li(treeItemRootStyle, treeIte
9705
9707
  const TreeItemBox = styled__default["default"](Box).attrs({
9706
9708
  forwardedAs: "a"
9707
9709
  })(treeItemBoxStyle);
9708
- const ToggleArrowText = styled__default["default"](Text)(_templateObject93 || (_templateObject93 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9710
+ const ToggleArrowText = styled__default["default"](Text)(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9709
9711
  const TreeItem = react.memo(function TreeItem2(props) {
9710
9712
  const {
9711
9713
  children,
@@ -9722,7 +9724,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
9722
9724
  text,
9723
9725
  weight
9724
9726
  } = props,
9725
- restProps = _objectWithoutProperties(props, _excluded48);
9727
+ restProps = _objectWithoutProperties(props, _excluded49);
9726
9728
 
9727
9729
  const rootRef = react.useRef(null);
9728
9730
  const treeitemRef = react.useRef(null);