@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.
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90, _templateObject91, _templateObject92, _templateObject93;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90;
2
2
 
3
3
  const _excluded = ["color", "layer"],
4
4
  _excluded2 = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"],
@@ -21,33 +21,34 @@ const _excluded = ["color", "layer"],
21
21
  _excluded19 = ["children", "style"],
22
22
  _excluded20 = ["children", "zOffset"],
23
23
  _excluded21 = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"],
24
- _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"],
25
- _excluded23 = ["className", "disabled", "style", "customValidity", "readOnly"],
26
- _excluded24 = ["children", "customValidity", "disabled", "fontSize", "padding", "radius", "readOnly", "space"],
27
- _excluded25 = ["as", "space"],
28
- _excluded26 = ["checked", "className", "disabled", "indeterminate", "readOnly", "style"],
29
- _excluded27 = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"],
30
- _excluded28 = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"],
31
- _excluded29 = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"],
32
- _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"],
33
- _excluded31 = ["children", "maxLength", "separator", "space"],
34
- _excluded32 = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"],
35
- _excluded33 = ["fontSize", "keys", "padding", "radius", "space"],
36
- _excluded34 = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"],
37
- _excluded35 = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"],
38
- _excluded36 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"],
39
- _excluded37 = ["animated", "delay", "radius"],
40
- _excluded38 = ["size"],
24
+ _excluded22 = ["__unstable_margins", "arrow", "arrowRef", "arrowX", "arrowY", "availableHeight", "availableWidth", "boundaryWidth", "children", "padding", "placement", "overflow", "radius", "referenceWidth", "scheme", "shadow", "strategy", "tone", "width", "x", "y"],
25
+ _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"],
26
+ _excluded24 = ["className", "disabled", "style", "customValidity", "readOnly"],
27
+ _excluded25 = ["children", "customValidity", "disabled", "fontSize", "padding", "radius", "readOnly", "space"],
28
+ _excluded26 = ["as", "space"],
29
+ _excluded27 = ["checked", "className", "disabled", "indeterminate", "readOnly", "style"],
30
+ _excluded28 = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"],
31
+ _excluded29 = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"],
32
+ _excluded30 = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "padding", "placement", "portal", "scheme", "shadow", "zOffset"],
33
+ _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"],
34
+ _excluded32 = ["children", "maxLength", "separator", "space"],
35
+ _excluded33 = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"],
36
+ _excluded34 = ["fontSize", "keys", "padding", "radius", "space"],
37
+ _excluded35 = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"],
38
+ _excluded36 = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"],
39
+ _excluded37 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"],
40
+ _excluded38 = ["animated", "delay", "radius"],
41
41
  _excluded39 = ["size"],
42
42
  _excluded40 = ["size"],
43
43
  _excluded41 = ["size"],
44
- _excluded42 = ["icon", "id", "focused", "fontSize", "label", "onClick", "onFocus", "padding", "selected"],
45
- _excluded43 = ["children"],
46
- _excluded44 = ["flex"],
47
- _excluded45 = ["closable", "description", "onClose", "title", "status"],
48
- _excluded46 = ["children", "space"],
49
- _excluded47 = ["children", "expanded"],
50
- _excluded48 = ["children", "expanded", "fontSize", "href", "icon", "id", "muted", "onClick", "padding", "selected", "space", "text", "weight"];
44
+ _excluded42 = ["size"],
45
+ _excluded43 = ["icon", "id", "focused", "fontSize", "label", "onClick", "onFocus", "padding", "selected"],
46
+ _excluded44 = ["children"],
47
+ _excluded45 = ["flex"],
48
+ _excluded46 = ["closable", "description", "onClose", "title", "status"],
49
+ _excluded47 = ["children", "space"],
50
+ _excluded48 = ["children", "expanded"],
51
+ _excluded49 = ["children", "expanded", "fontSize", "href", "icon", "id", "muted", "onClick", "padding", "selected", "space", "text", "weight"];
51
52
 
52
53
  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); }
53
54
 
@@ -64,18 +65,23 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
64
65
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
65
66
 
66
67
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
67
- import { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, useReducer, Children, Fragment as Fragment$1, memo } from 'react';
68
+ import { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1 } from 'react';
68
69
  import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
69
70
  import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
70
71
  import { white as white$1, black as black$1, hues } from '@sanity/color';
71
72
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
72
73
  import Refractor from 'react-refractor';
73
- import { usePopper } from 'react-popper';
74
+ import { flip, offset, shift, arrow, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
74
75
  import { createPortal } from 'react-dom';
75
- import maxSizeModifier from 'popper-max-size-modifier';
76
76
  import { AnimatePresence, motion } from 'framer-motion';
77
77
  const EMPTY_ARRAY = [];
78
78
  const EMPTY_RECORD = {};
79
+ const FLOATING_STATIC_SIDES = {
80
+ top: "bottom",
81
+ right: "left",
82
+ bottom: "top",
83
+ left: "right"
84
+ };
79
85
 
80
86
  function _fillCSSObject(keys, value) {
81
87
  return keys.reduce((style, key) => {
@@ -482,7 +488,7 @@ var parseDimension = function (pixel) {
482
488
  return parseFloat(pixel || '0');
483
489
  };
484
490
 
485
- var size = function (inlineSize, blockSize, switchSizes) {
491
+ var size$1 = function (inlineSize, blockSize, switchSizes) {
486
492
  if (inlineSize === void 0) {
487
493
  inlineSize = 0;
488
494
  }
@@ -499,9 +505,9 @@ var size = function (inlineSize, blockSize, switchSizes) {
499
505
  };
500
506
 
501
507
  var zeroBoxes = freeze({
502
- devicePixelContentBoxSize: size(),
503
- borderBoxSize: size(),
504
- contentBoxSize: size(),
508
+ devicePixelContentBoxSize: size$1(),
509
+ borderBoxSize: size$1(),
510
+ contentBoxSize: size$1(),
505
511
  contentRect: new DOMRectReadOnly(0, 0, 0, 0)
506
512
  });
507
513
 
@@ -546,9 +552,9 @@ var calculateBoxSizes = function (target, forceRecalculation) {
546
552
  var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;
547
553
  var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;
548
554
  var boxes = freeze({
549
- devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
550
- borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),
551
- contentBoxSize: size(contentWidth, contentHeight, switchSizes),
555
+ devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
556
+ borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
557
+ contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
552
558
  contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
553
559
  });
554
560
  cache.set(target, boxes);
@@ -6180,12 +6186,12 @@ const VirtualList = forwardRef(function VirtualList2(props, ref) {
6180
6186
  })
6181
6187
  }));
6182
6188
  });
6183
- const Root$j = styled.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"])));
6189
+ const Root$j = styled.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"])));
6184
6190
  const BorderPath = styled.path(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
6185
6191
  const ShapePath = styled.path(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
6186
6192
  const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
6187
6193
  return /* @__PURE__ */jsx(Root$j, _objectSpread(_objectSpread({
6188
- "data-ui": "PopoverArrow"
6194
+ "data-ui": "Popover__arrow"
6189
6195
  }, props), {}, {
6190
6196
  ref,
6191
6197
  children: /* @__PURE__ */jsxs("svg", {
@@ -6203,315 +6209,290 @@ const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
6203
6209
  }));
6204
6210
  });
6205
6211
 
6206
- function getPopoverModifiers(props) {
6212
+ function popoverCardStyle(props) {
6207
6213
  const {
6208
- allowedAutoPlacements,
6209
- arrow,
6210
- arrowElement,
6211
- boundaryElement,
6212
- constrainSize,
6213
- distance,
6214
- fallbackPlacements,
6215
- margins,
6216
- matchReferenceWidth,
6217
- open,
6218
- preventOverflow,
6219
- skidding,
6220
- tether,
6221
- tetherOffset
6214
+ $boundaryWidth
6222
6215
  } = props;
6223
-
6224
- if (!open) {
6225
- return [];
6226
- }
6227
-
6228
- const detectOverflowOptions = {
6229
- altAxis: !constrainSize,
6230
- boundary: boundaryElement || void 0,
6231
- padding: 8,
6232
- tether,
6233
- tetherOffset
6216
+ return {
6217
+ maxWidth: $boundaryWidth ? "".concat($boundaryWidth - 16, "px") : "calc(100% - 16px)"
6234
6218
  };
6235
- return [constrainSize && _objectSpread(_objectSpread({}, maxSizeModifier), {}, {
6236
- options: detectOverflowOptions
6237
- }), constrainSize && {
6238
- name: "applyMaxSize",
6239
- enabled: true,
6240
- phase: "beforeWrite",
6241
- requires: ["maxSize"],
6242
-
6243
- fn(_ref21) {
6244
- let {
6245
- state
6246
- } = _ref21;
6247
- const {
6248
- width,
6249
- height
6250
- } = state.modifiersData.maxSize;
6251
- state.styles.popper = _objectSpread(_objectSpread({}, state.styles.popper), {}, {
6252
- maxWidth: "".concat(width, "px"),
6253
- maxHeight: "".concat(height, "px")
6254
- });
6255
- }
6219
+ }
6256
6220
 
6257
- }, arrow && {
6258
- name: "arrow",
6259
- options: {
6260
- element: arrowElement,
6261
- padding: 4
6262
- }
6263
- }, (constrainSize || preventOverflow) && {
6264
- name: "preventOverflow",
6265
- options: detectOverflowOptions
6266
- }, {
6267
- name: "offset",
6268
- options: {
6269
- offset: [skidding, distance]
6270
- }
6271
- }, margins && {
6272
- name: "margins",
6273
- enabled: true,
6274
- phase: "beforeRead",
6275
- fn: _ref22 => {
6276
- let {
6277
- state
6278
- } = _ref22;
6279
- const {
6280
- rects
6281
- } = state;
6282
-
6283
- if (rects.reference) {
6284
- rects.reference.x += margins[3];
6285
- rects.reference.y += margins[1];
6286
- rects.reference.width -= margins[1] + margins[3];
6287
- rects.reference.height -= margins[0] + margins[2];
6288
- }
6289
- }
6290
- }, {
6291
- name: "flip",
6292
- options: {
6293
- allowedAutoPlacements,
6294
- boundary: boundaryElement || void 0,
6295
- fallbackPlacements,
6296
- padding: 8
6297
- }
6298
- }, matchReferenceWidth && {
6299
- name: "matchWidth",
6300
- enabled: true,
6301
- phase: "beforeWrite",
6302
- requires: ["computeStyles"],
6303
-
6304
- fn(_ref23) {
6305
- let {
6306
- state
6307
- } = _ref23;
6308
- const {
6309
- width
6310
- } = state.rects.reference;
6311
- state.styles.popper.width = "".concat(width, "px");
6312
- },
6221
+ const Root$i = memo(styled(Card)(popoverCardStyle));
6222
+ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
6223
+ const {
6224
+ __unstable_margins: marginsProp,
6225
+ arrow,
6226
+ arrowRef,
6227
+ arrowX,
6228
+ arrowY,
6229
+ availableHeight,
6230
+ availableWidth,
6231
+ boundaryWidth,
6232
+ children,
6233
+ padding,
6234
+ placement,
6235
+ overflow,
6236
+ radius,
6237
+ referenceWidth: referenceWidthProp,
6238
+ scheme,
6239
+ shadow,
6240
+ strategy,
6241
+ tone,
6242
+ width,
6243
+ x: xProp,
6244
+ y: yProp
6245
+ } = props,
6246
+ restProps = _objectWithoutProperties(props, _excluded22);
6313
6247
 
6314
- effect: _ref24 => {
6315
- let {
6316
- state
6317
- } = _ref24;
6318
- const refElement = state.elements.reference;
6248
+ const {
6249
+ zIndex
6250
+ } = useLayer();
6251
+ const margins = useMemo(() => marginsProp || [0, 0, 0, 0], [marginsProp]);
6252
+ const referenceWidth = referenceWidthProp ? referenceWidthProp - margins[1] - margins[3] : void 0;
6253
+ const x = (xProp != null ? xProp : 0) + margins[3];
6254
+ const y = (yProp != null ? yProp : 0) + margins[0];
6255
+ const maxWidth = availableWidth ? Math.min(availableWidth - 8, referenceWidth || Infinity) : void 0;
6256
+ const rootStyle = useMemo(() => ({
6257
+ position: strategy,
6258
+ top: y,
6259
+ left: x,
6260
+ zIndex,
6261
+ width: referenceWidth,
6262
+ maxWidth: referenceWidth ? void 0 : maxWidth
6263
+ }), [referenceWidth, maxWidth, strategy, x, y, zIndex]);
6264
+ const wrapperStyle = useMemo(() => ({
6265
+ minHeight: 25,
6266
+ maxHeight: availableHeight ? availableHeight - 8 : void 0
6267
+ }), [availableHeight]);
6268
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6269
+ const arrowStyle = useMemo(() => {
6270
+ const style = {
6271
+ left: arrowX !== null ? arrowX : void 0,
6272
+ top: arrowY !== null ? arrowY : void 0,
6273
+ right: void 0,
6274
+ bottom: void 0
6275
+ };
6276
+ if (staticSide) style[staticSide] = -27;
6277
+ return style;
6278
+ }, [arrowX, arrowY, staticSide]);
6279
+ return /* @__PURE__ */jsxs(Root$i, _objectSpread(_objectSpread({}, restProps), {}, {
6280
+ $boundaryWidth: boundaryWidth,
6281
+ "data-placement": placement,
6282
+ "data-ui": "Popover",
6283
+ radius,
6284
+ ref,
6285
+ scheme,
6286
+ shadow,
6287
+ style: rootStyle,
6288
+ tone,
6289
+ $width: width,
6290
+ children: [/* @__PURE__ */jsx(Box, {
6291
+ "data-ui": "Popover__wrapper",
6292
+ overflow,
6293
+ padding,
6294
+ sizing: "border",
6295
+ style: wrapperStyle,
6296
+ children
6297
+ }), arrow && /* @__PURE__ */jsx(PopoverArrow, {
6298
+ ref: arrowRef,
6299
+ style: arrowStyle
6300
+ })]
6301
+ }));
6302
+ }));
6303
+ PopoverCard.displayName = "PopoverCard";
6304
+
6305
+ function size(scope) {
6306
+ return size$2({
6307
+ apply(args) {
6308
+ if (scope.constrainSize) {
6309
+ scope.setAvailableWidth(args.availableWidth);
6310
+ scope.setAvailableHeight(args.availableHeight);
6311
+ }
6319
6312
 
6320
- if (refElement instanceof HTMLElement) {
6321
- state.elements.popper.style.width = "".concat(refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0), "px");
6313
+ if (scope.matchReferenceWidth) {
6314
+ scope.setReferenceWidth(args.rects.reference.width);
6322
6315
  }
6323
- }
6324
- }].filter(Boolean);
6325
- }
6316
+ },
6326
6317
 
6327
- function usePopoverModifiers(props) {
6328
- const {
6329
- allowedAutoPlacements,
6330
- arrow,
6331
- arrowElement,
6332
- boundaryElement,
6333
- constrainSize,
6334
- distance,
6335
- fallbackPlacements,
6336
- margins,
6337
- matchReferenceWidth,
6338
- open,
6339
- preventOverflow,
6340
- skidding,
6341
- tether,
6342
- tetherOffset
6343
- } = props;
6344
- return useMemo(() => {
6345
- return getPopoverModifiers({
6346
- allowedAutoPlacements,
6347
- arrow,
6348
- arrowElement,
6349
- boundaryElement,
6350
- constrainSize,
6351
- distance,
6352
- fallbackPlacements,
6353
- margins,
6354
- matchReferenceWidth,
6355
- open,
6356
- preventOverflow,
6357
- skidding,
6358
- tether,
6359
- tetherOffset
6360
- });
6361
- }, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
6318
+ boundary: scope.boundaryElement || void 0
6319
+ });
6362
6320
  }
6363
6321
 
6364
- const Root$i = styled(Layer)(_ref25 => {
6365
- let {
6366
- $preventOverflow
6367
- } = _ref25;
6368
- return 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 && css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n "]))));
6369
- });
6370
- const PopoverCard = styled(Card)(_ref26 => {
6371
- let {
6372
- $constrainSize
6373
- } = _ref26;
6374
- return 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);
6375
- });
6376
- const Popover = forwardRef(function Popover2(props, ref) {
6377
- var _a;
6322
+ const Popover = memo(forwardRef(function Popover2(props, ref) {
6323
+ var _a, _b, _c, _d;
6378
6324
 
6379
- const boundaryElementContext = useBoundaryElement();
6380
6325
  const theme = useTheme();
6326
+ const boundaryElementContext = useBoundaryElement();
6381
6327
 
6382
6328
  const {
6383
6329
  __unstable_margins: margins,
6384
6330
  allowedAutoPlacements,
6385
- arrow = true,
6386
- boundaryElement: boundaryElementProp = boundaryElementContext.element,
6387
- children: child,
6331
+ arrow: arrowProp = true,
6332
+ boundaryElement = boundaryElementContext.element,
6333
+ children: childProp,
6334
+ constrainSize = false,
6388
6335
  content,
6389
- constrainSize,
6390
6336
  disabled,
6391
6337
  fallbackPlacements,
6392
- open = false,
6393
- padding,
6394
- placement = "bottom",
6395
- portal: portalProp = false,
6396
- preventOverflow,
6397
- radius = 3,
6398
- referenceElement: referenceElementProp,
6399
- matchReferenceWidth,
6400
- shadow = 3,
6338
+ matchReferenceWidth: matchReferenceWidthProp,
6339
+ open,
6340
+ overflow = props.constrainSize ? "auto" : void 0,
6341
+ padding: paddingProp,
6342
+ placement: placementProp = "bottom",
6343
+ portal,
6344
+ preventOverflow = true,
6345
+ radius: radiusProp = 3,
6346
+ referenceElement,
6401
6347
  scheme,
6402
- style = EMPTY_RECORD,
6348
+ shadow: shadowProp = 3,
6403
6349
  tether,
6404
6350
  tetherOffset,
6405
6351
  tone = "inherit",
6406
- width: widthProp = 0,
6407
- zOffset = (_a = theme.sanity.layer) == null ? void 0 : _a.popover.zOffset
6352
+ width: widthProp = void 0,
6353
+ zOffset: zOffsetProp = (_a = theme.sanity.layer) == null ? void 0 : _a.popover.zOffset
6408
6354
  } = props,
6409
- restProps = _objectWithoutProperties(props, _excluded22);
6355
+ restProps = _objectWithoutProperties(props, _excluded23);
6410
6356
 
6357
+ const boundarySize = (_b = useElementSize(boundaryElement)) == null ? void 0 : _b.border;
6358
+ const padding = useArrayProp(paddingProp);
6359
+ const radius = useArrayProp(radiusProp);
6360
+ const shadow = useArrayProp(shadowProp);
6361
+ const width = useArrayProp(widthProp);
6362
+ const zOffset = useArrayProp(zOffsetProp);
6363
+ const [availableWidth, setAvailableWidth] = useState(void 0);
6364
+ const [availableHeight, setAvailableHeight] = useState(void 0);
6365
+ const [referenceWidth, setReferenceWidth] = useState(void 0);
6411
6366
  const forwardedRef = useForwardedRef(ref);
6412
- const portal = usePortal();
6413
- const [referenceElement, setReferenceElement] = useState(null);
6414
- const [popperElement, setPopperElement] = useState(null);
6415
- const [arrowElement, setArrowElement] = useState(null);
6416
- const popperReferenceElement = referenceElementProp || referenceElement;
6417
- const width = useArrayProp(matchReferenceWidth ? "auto" : widthProp);
6418
- const modifiers = usePopoverModifiers({
6419
- allowedAutoPlacements,
6420
- arrow,
6421
- arrowElement,
6422
- boundaryElement: boundaryElementProp || portal.boundaryElement,
6423
- constrainSize,
6424
- distance: arrow ? 4 : 0,
6425
- fallbackPlacements,
6426
- margins,
6427
- matchReferenceWidth,
6428
- open,
6429
- preventOverflow,
6430
- skidding: 0,
6431
- tether,
6432
- tetherOffset
6433
- });
6434
- const popper = usePopper(popperReferenceElement, popperElement, {
6367
+ const arrowRef = useRef(null);
6368
+ const rootBoundary = "viewport";
6369
+ const middleware = useMemo(() => {
6370
+ const ret = [];
6371
+
6372
+ if (constrainSize || preventOverflow) {
6373
+ ret.push(flip({
6374
+ boundary: boundaryElement || void 0,
6375
+ fallbackPlacements,
6376
+ padding: 8,
6377
+ rootBoundary
6378
+ }));
6379
+ }
6380
+
6381
+ ret.push(size({
6382
+ boundaryElement,
6383
+ constrainSize,
6384
+ matchReferenceWidth: matchReferenceWidthProp,
6385
+ setAvailableHeight,
6386
+ setAvailableWidth,
6387
+ setReferenceWidth
6388
+ }));
6389
+ ret.push(offset({
6390
+ mainAxis: arrowProp ? 4 : 0
6391
+ }));
6392
+
6393
+ if (preventOverflow) {
6394
+ ret.push(shift({
6395
+ boundary: boundaryElement || void 0,
6396
+ rootBoundary,
6397
+ padding: 8
6398
+ }));
6399
+ }
6400
+
6401
+ if (arrowProp) {
6402
+ ret.push(arrow({
6403
+ element: arrowRef,
6404
+ padding: 4
6405
+ }));
6406
+ }
6407
+
6408
+ return ret;
6409
+ }, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, matchReferenceWidthProp, preventOverflow]);
6410
+ const {
6411
+ x,
6412
+ y,
6435
6413
  placement,
6436
- modifiers
6414
+ reference,
6415
+ floating,
6416
+ middlewareData,
6417
+ strategy
6418
+ } = useFloating({
6419
+ middleware,
6420
+ placement: placementProp,
6421
+ whileElementsMounted: autoUpdate
6437
6422
  });
6438
- const {
6439
- attributes,
6440
- forceUpdate,
6441
- styles
6442
- } = popper;
6443
- const setRef = useCallback(el => {
6444
- const childRef = child.ref;
6445
- setReferenceElement(el);
6423
+ const arrowX = (_c = middlewareData.arrow) == null ? void 0 : _c.x;
6424
+ const arrowY = (_d = middlewareData.arrow) == null ? void 0 : _d.y;
6425
+ const setArrow = useCallback(arrowEl => {
6426
+ arrowRef.current = arrowEl;
6427
+ }, []);
6428
+ const setFloating = useCallback(node => {
6429
+ forwardedRef.current = node;
6430
+ floating(node);
6431
+ }, [floating, forwardedRef]);
6432
+ const setReference = useCallback(node => {
6433
+ reference(node);
6434
+ const childRef = childProp == null ? void 0 : childProp.ref;
6446
6435
 
6447
6436
  if (typeof childRef === "function") {
6448
- childRef(el);
6437
+ childRef(node);
6449
6438
  } else if (childRef) {
6450
- childRef.current = el;
6439
+ childRef.current = node;
6451
6440
  }
6452
- }, [child]);
6453
- const setRootRef = useCallback(el => {
6454
- setPopperElement(el);
6455
- forwardedRef.current = el;
6456
- }, [forwardedRef]);
6457
- const popoverStyle = useMemo(() => _objectSpread(_objectSpread({}, style), styles.popper), [style, styles]);
6458
- const updateTimeoutRef = useRef(null);
6441
+ }, [childProp, reference]);
6442
+ const child = useMemo(() => {
6443
+ if (!childProp || referenceElement) return null;
6444
+ return cloneElement(childProp, {
6445
+ ref: setReference
6446
+ });
6447
+ }, [childProp, referenceElement, setReference]);
6459
6448
  useEffect(() => {
6460
- if (updateTimeoutRef.current) {
6461
- clearTimeout(updateTimeoutRef.current);
6462
- updateTimeoutRef.current = null;
6463
- }
6464
-
6465
- updateTimeoutRef.current = setTimeout(() => {
6466
- if (forceUpdate) {
6467
- try {
6468
- forceUpdate();
6469
- } catch (_) {}
6470
- }
6471
- }, 0);
6472
- }, [content, forceUpdate, open, popperReferenceElement]);
6449
+ if (referenceElement) reference(referenceElement);
6450
+ }, [reference, referenceElement]);
6473
6451
 
6474
6452
  if (disabled) {
6475
- return child || /* @__PURE__ */jsx(Fragment, {});
6453
+ return childProp || /* @__PURE__ */jsx(Fragment, {});
6476
6454
  }
6477
6455
 
6478
- const node = /* @__PURE__ */jsx(Root$i, _objectSpread(_objectSpread(_objectSpread({
6479
- "data-ui": "Popover"
6480
- }, restProps), {}, {
6481
- $preventOverflow: preventOverflow,
6482
- ref: setRootRef,
6483
- style: popoverStyle,
6484
- zOffset
6485
- }, attributes.popper), {}, {
6486
- children: /* @__PURE__ */jsxs(PopoverCard, {
6487
- $constrainSize: constrainSize,
6488
- $width: width,
6489
- "data-ui": "PopoverCard",
6456
+ const popover = /* @__PURE__ */jsx(LayerProvider, {
6457
+ zOffset,
6458
+ children: /* @__PURE__ */jsx(PopoverCard, _objectSpread(_objectSpread({}, restProps), {}, {
6459
+ __unstable_margins: margins,
6460
+ arrow: arrowProp,
6461
+ arrowRef: setArrow,
6462
+ arrowX,
6463
+ arrowY,
6464
+ availableWidth: constrainSize ? availableWidth : void 0,
6465
+ availableHeight: constrainSize ? availableHeight : void 0,
6466
+ boundaryWidth: boundarySize == null ? void 0 : boundarySize.width,
6467
+ overflow,
6490
6468
  padding,
6469
+ placement,
6491
6470
  radius,
6471
+ ref: setFloating,
6472
+ referenceWidth: matchReferenceWidthProp ? referenceWidth : void 0,
6492
6473
  scheme,
6493
6474
  shadow,
6475
+ strategy,
6494
6476
  tone,
6495
- children: [arrow && /* @__PURE__ */jsx(PopoverArrow, {
6496
- ref: setArrowElement,
6497
- style: styles.arrow
6498
- }), content]
6499
- })
6500
- }));
6477
+ x,
6478
+ y,
6479
+ width,
6480
+ children: content
6481
+ }))
6482
+ });
6501
6483
  return /* @__PURE__ */jsxs(Fragment, {
6502
- children: [child && !referenceElementProp ? cloneElement(child, {
6503
- ref: setRef
6504
- }) : child || /* @__PURE__ */jsx(Fragment, {}), open && /* @__PURE__ */jsxs(Fragment, {
6505
- children: [portalProp && /* @__PURE__ */jsx(Portal, {
6506
- __unstable_name: typeof portalProp === "string" ? portalProp : void 0,
6507
- children: node
6508
- }), !portalProp && node]
6509
- })]
6484
+ children: [open && /* @__PURE__ */jsx(Fragment, {
6485
+ children: portal ? /* @__PURE__ */jsx(Portal, {
6486
+ __unstable_name: typeof portal === "string" ? portal : void 0,
6487
+ children: popover
6488
+ }) : popover
6489
+ }), child]
6510
6490
  });
6511
- });
6491
+ }));
6492
+ Popover.displayName = "Popover";
6512
6493
 
6513
6494
  function radioBaseStyle() {
6514
- return 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 "])));
6495
+ return css(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
6515
6496
  }
6516
6497
 
6517
6498
  function inputElementStyle(props) {
@@ -6524,7 +6505,7 @@ function inputElementStyle(props) {
6524
6505
  } = theme.sanity;
6525
6506
  const color = theme.sanity.color.input;
6526
6507
  const dist = (input.radio.size - input.radio.markSize) / 2;
6527
- return 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({
6508
+ return css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
6528
6509
  color: color.default.enabled.border,
6529
6510
  width: input.border.width
6530
6511
  }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.fg, focusRingStyle({
@@ -6549,7 +6530,7 @@ const Radio = forwardRef(function Radio2(props, forwardedRef) {
6549
6530
  customValidity,
6550
6531
  readOnly
6551
6532
  } = props,
6552
- restProps = _objectWithoutProperties(props, _excluded23);
6533
+ restProps = _objectWithoutProperties(props, _excluded24);
6553
6534
 
6554
6535
  const ref = useForwardedRef(forwardedRef);
6555
6536
  useCustomValidity(ref, customValidity);
@@ -6569,7 +6550,7 @@ const Radio = forwardRef(function Radio2(props, forwardedRef) {
6569
6550
  });
6570
6551
 
6571
6552
  function rootStyle() {
6572
- return css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6553
+ return css(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6573
6554
  }
6574
6555
 
6575
6556
  function inputBaseStyle(props) {
@@ -6577,7 +6558,7 @@ function inputBaseStyle(props) {
6577
6558
  theme
6578
6559
  } = props;
6579
6560
  const font = theme.sanity.fonts.text;
6580
- return 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);
6561
+ return css(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ", ";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])), font.family);
6581
6562
  }
6582
6563
 
6583
6564
  function inputColorStyle(props) {
@@ -6589,7 +6570,7 @@ function inputColorStyle(props) {
6589
6570
  input
6590
6571
  } = theme.sanity;
6591
6572
  const color = theme.sanity.color.input;
6592
- return 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({
6573
+ return css(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
6593
6574
  color: color.default.enabled.border,
6594
6575
  width: input.border.width
6595
6576
  }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
@@ -6637,7 +6618,7 @@ function iconBoxStyle(props) {
6637
6618
  theme
6638
6619
  } = props;
6639
6620
  const color = theme.sanity.color.input;
6640
- return 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);
6621
+ return css(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
6641
6622
  }
6642
6623
 
6643
6624
  const selectStyle = {
@@ -6659,7 +6640,7 @@ const Select = forwardRef(function Select2(props, forwardedRef) {
6659
6640
  readOnly,
6660
6641
  space = 3
6661
6642
  } = props,
6662
- restProps = _objectWithoutProperties(props, _excluded24);
6643
+ restProps = _objectWithoutProperties(props, _excluded25);
6663
6644
 
6664
6645
  const ref = useForwardedRef(forwardedRef);
6665
6646
  useCustomValidity(ref, customValidity);
@@ -6719,7 +6700,7 @@ const Stack = forwardRef(function Stack2(props, ref) {
6719
6700
  as,
6720
6701
  space
6721
6702
  } = props,
6722
- restProps = _objectWithoutProperties(props, _excluded25);
6703
+ restProps = _objectWithoutProperties(props, _excluded26);
6723
6704
 
6724
6705
  return /* @__PURE__ */jsx(Root$f, _objectSpread(_objectSpread({
6725
6706
  "data-as": typeof as === "string" ? as : void 0,
@@ -6732,11 +6713,11 @@ const Stack = forwardRef(function Stack2(props, ref) {
6732
6713
  });
6733
6714
 
6734
6715
  function switchBaseStyles() {
6735
- return css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6716
+ return css(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6736
6717
  }
6737
6718
 
6738
6719
  function switchInputStyles() {
6739
- return 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 "])));
6720
+ return css(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));
6740
6721
  }
6741
6722
 
6742
6723
  function switchRepresentationStyles(props) {
@@ -6748,7 +6729,7 @@ function switchRepresentationStyles(props) {
6748
6729
  input
6749
6730
  } = theme.sanity;
6750
6731
  const color = theme.sanity.color.button.default;
6751
- return 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({
6732
+ return css(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
6752
6733
  focusRing
6753
6734
  }), 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);
6754
6735
  }
@@ -6760,7 +6741,7 @@ function switchTrackStyles(props) {
6760
6741
  const {
6761
6742
  input
6762
6743
  } = theme.sanity;
6763
- return 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));
6744
+ return css(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2));
6764
6745
  }
6765
6746
 
6766
6747
  function switchThumbStyles(props) {
@@ -6778,7 +6759,7 @@ function switchThumbStyles(props) {
6778
6759
  const checkedOffset = trackWidth - trackPadding * 2 - size;
6779
6760
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
6780
6761
  const checked = $indeterminate !== true && props.$checked === true;
6781
- return 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 && css(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6762
+ return css(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ", ";\n top: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n transition-property: transform;\n transition-duration: ", "ms;\n transition-timing-function: ", ";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ", "\n\n ", "\n "])), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), checkedOffset), $indeterminate && css(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n transform: translate3d(", "px, 0, 0);\n "])), indeterminateOffset));
6782
6763
  }
6783
6764
 
6784
6765
  const Root$e = styled.span(switchBaseStyles);
@@ -6795,7 +6776,7 @@ const Switch = forwardRef(function Switch2(props, forwardedRef) {
6795
6776
  readOnly,
6796
6777
  style
6797
6778
  } = props,
6798
- restProps = _objectWithoutProperties(props, _excluded26);
6779
+ restProps = _objectWithoutProperties(props, _excluded27);
6799
6780
 
6800
6781
  const ref = useForwardedRef(forwardedRef);
6801
6782
  useEffect(() => {
@@ -6825,7 +6806,7 @@ const Switch = forwardRef(function Switch2(props, forwardedRef) {
6825
6806
  });
6826
6807
  });
6827
6808
  const Root$d = styled.span(textInputRootStyle);
6828
- const InputRoot$1 = styled.span(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6809
+ const InputRoot$1 = styled.span(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6829
6810
  const Input$1 = styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6830
6811
  const Presentation$1 = styled.div(responsiveRadiusStyle, textInputRepresentationStyle);
6831
6812
  const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
@@ -6838,7 +6819,7 @@ const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
6838
6819
  radius = 1,
6839
6820
  weight
6840
6821
  } = props,
6841
- restProps = _objectWithoutProperties(props, _excluded27);
6822
+ restProps = _objectWithoutProperties(props, _excluded28);
6842
6823
 
6843
6824
  const ref = useForwardedRef(forwardedRef);
6844
6825
  const rootTheme = useRootTheme();
@@ -6876,18 +6857,18 @@ const CLEAR_BUTTON_BOX_STYLE = {
6876
6857
  const Root$c = styled(Card).attrs({
6877
6858
  forwardedAs: "span"
6878
6859
  })(textInputRootStyle);
6879
- const InputRoot = styled.span(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6860
+ const InputRoot = styled.span(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
6880
6861
  const Prefix = styled(Card).attrs({
6881
6862
  forwardedAs: "span"
6882
- })(_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"])));
6863
+ })(_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"])));
6883
6864
  const Suffix = styled(Card).attrs({
6884
6865
  forwardedAs: "span"
6885
- })(_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"])));
6866
+ })(_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"])));
6886
6867
  const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
6887
6868
  const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
6888
- const LeftBox = styled(Box)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6889
- const RightBox = styled(Box)(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6890
- const RightCard = styled(Card)(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6869
+ const LeftBox = styled(Box)(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));
6870
+ const RightBox = styled(Box)(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));
6871
+ const RightCard = styled(Card)(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));
6891
6872
  const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6892
6873
  const {
6893
6874
  border = true,
@@ -6907,7 +6888,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6907
6888
  type = "text",
6908
6889
  weight
6909
6890
  } = props,
6910
- restProps = _objectWithoutProperties(props, _excluded28);
6891
+ restProps = _objectWithoutProperties(props, _excluded29);
6911
6892
 
6912
6893
  const ref = useForwardedRef(forwardedRef);
6913
6894
  const rootTheme = useRootTheme();
@@ -7033,13 +7014,15 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
7033
7014
  }), suffixNode]
7034
7015
  });
7035
7016
  });
7036
- const Root$b = styled.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"])));
7037
- const Border = styled.path(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
7038
- const Shape = styled.path(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
7017
+ const Root$b = styled.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
7018
+ const Border = styled.path(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));
7019
+ const Shape = styled.path(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));
7039
7020
  const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
7040
7021
  const restProps = _extends({}, props);
7041
7022
 
7042
- return /* @__PURE__ */jsx(Root$b, _objectSpread(_objectSpread({}, restProps), {}, {
7023
+ return /* @__PURE__ */jsx(Root$b, _objectSpread(_objectSpread({
7024
+ "data-ui": "Tooltip__arrow"
7025
+ }, restProps), {}, {
7043
7026
  ref,
7044
7027
  children: /* @__PURE__ */jsxs("svg", {
7045
7028
  width: "15",
@@ -7053,63 +7036,87 @@ const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
7053
7036
  })
7054
7037
  }));
7055
7038
  });
7056
- const Root$a = styled(Layer)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
7039
+ const Root$a = styled(Layer)(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n pointer-events: none;\n"])));
7057
7040
  const Tooltip = forwardRef(function Tooltip2(props, ref) {
7058
- var _a;
7041
+ var _a, _b, _c;
7059
7042
 
7060
7043
  const boundaryElementContext = useBoundaryElement();
7061
7044
  const theme = useTheme();
7062
7045
 
7063
7046
  const {
7064
- allowedAutoPlacements,
7065
7047
  boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
7066
- children,
7048
+ children: childProp,
7067
7049
  content,
7068
7050
  disabled,
7069
7051
  fallbackPlacements: fallbackPlacementsProp,
7070
- placement = "bottom",
7052
+ padding,
7053
+ placement: placementProp = "bottom",
7071
7054
  portal,
7072
7055
  scheme,
7056
+ shadow = 2,
7073
7057
  zOffset = (_a = theme.sanity.layer) == null ? void 0 : _a.tooltip.zOffset
7074
7058
  } = props,
7075
- restProps = _objectWithoutProperties(props, _excluded29);
7059
+ restProps = _objectWithoutProperties(props, _excluded30);
7076
7060
 
7077
7061
  const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7078
7062
  const forwardedRef = useForwardedRef(ref);
7079
7063
  const [referenceElement, setReferenceElement] = useState(null);
7080
- const [popperElement, setPopperElement] = useState(null);
7081
- const [arrowElement, setArrowElement] = useState(null);
7082
- const popper = usePopper(referenceElement, popperElement, {
7064
+ const arrowRef = useRef(null);
7065
+ const rootBoundary = "viewport";
7066
+ const middleware = useMemo(() => {
7067
+ const ret = [];
7068
+ ret.push(flip({
7069
+ boundary: boundaryElement || void 0,
7070
+ fallbackPlacements,
7071
+ padding: 4,
7072
+ rootBoundary
7073
+ }));
7074
+ ret.push(offset({
7075
+ mainAxis: 3
7076
+ }));
7077
+ ret.push(shift({
7078
+ boundary: boundaryElement || void 0,
7079
+ rootBoundary,
7080
+ padding: 4
7081
+ }));
7082
+ ret.push(arrow({
7083
+ element: arrowRef,
7084
+ padding: 2
7085
+ }));
7086
+ return ret;
7087
+ }, [boundaryElement, fallbackPlacements]);
7088
+ const {
7089
+ x,
7090
+ y,
7083
7091
  placement,
7084
- modifiers: [{
7085
- name: "arrow",
7086
- options: {
7087
- element: arrowElement,
7088
- padding: 4
7089
- }
7090
- }, {
7091
- name: "preventOverflow",
7092
- options: {
7093
- altAxis: true,
7094
- boundary: boundaryElement || void 0,
7095
- padding: 4
7096
- }
7097
- }, {
7098
- name: "offset",
7099
- options: {
7100
- offset: [0, 3]
7101
- }
7102
- }, {
7103
- name: "flip",
7104
- options: {
7105
- allowedAutoPlacements,
7106
- fallbackPlacements
7107
- }
7108
- }]
7092
+ reference,
7093
+ floating,
7094
+ middlewareData,
7095
+ update,
7096
+ strategy
7097
+ } = useFloating({
7098
+ middleware,
7099
+ placement: placementProp,
7100
+ whileElementsMounted: autoUpdate
7109
7101
  });
7110
- const {
7111
- forceUpdate
7112
- } = popper;
7102
+ const rootStyle = useMemo(() => ({
7103
+ position: strategy,
7104
+ top: y != null ? y : 0,
7105
+ left: x != null ? x : 0
7106
+ }), [strategy, x, y]);
7107
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
7108
+ const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
7109
+ const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
7110
+ const arrowStyle = useMemo(() => {
7111
+ const style = {
7112
+ left: arrowX !== null ? arrowX : void 0,
7113
+ top: arrowY !== null ? arrowY : void 0,
7114
+ right: void 0,
7115
+ bottom: void 0
7116
+ };
7117
+ if (staticSide) style[staticSide] = -15;
7118
+ return style;
7119
+ }, [arrowX, arrowY, staticSide]);
7113
7120
  const [isOpen, setIsOpen] = useState(false);
7114
7121
  const handleBlur = useCallback(() => setIsOpen(false), []);
7115
7122
  const handleFocus = useCallback(() => setIsOpen(true), []);
@@ -7133,73 +7140,76 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7133
7140
  window.removeEventListener("mousemove", handleWindowMouseMove);
7134
7141
  };
7135
7142
  }, [isOpen, referenceElement]);
7136
- const updateTimeoutRef = useRef(null);
7137
- useEffect(() => {
7138
- if (updateTimeoutRef.current) {
7139
- clearTimeout(updateTimeoutRef.current);
7140
- updateTimeoutRef.current = null;
7141
- }
7142
-
7143
- updateTimeoutRef.current = setTimeout(() => {
7144
- if (forceUpdate) {
7145
- try {
7146
- forceUpdate();
7147
- } catch (_) {}
7148
- }
7149
- }, 0);
7150
- }, [forceUpdate, content]);
7151
7143
  useEffect(() => {
7152
7144
  if (disabled) setIsOpen(false);
7153
7145
  }, [disabled]);
7154
7146
  useEffect(() => {
7155
7147
  if (!content) setIsOpen(false);
7156
7148
  }, [content]);
7149
+ useEffect(() => reference(referenceElement), [reference, referenceElement]);
7150
+ const setArrow = useCallback(arrowEl => {
7151
+ arrowRef.current = arrowEl;
7152
+ update();
7153
+ }, [update]);
7154
+ const setFloating = useCallback(node => {
7155
+ forwardedRef.current = node;
7156
+ floating(node);
7157
+ }, [floating, forwardedRef]);
7158
+ const childRef = childProp == null ? void 0 : childProp.ref;
7159
+ const setReference = useCallback(node => {
7160
+ if (typeof childRef === "function") {
7161
+ childRef(node);
7162
+ } else if (childRef) {
7163
+ childRef.current = node;
7164
+ }
7157
7165
 
7158
- const setRef = el => {
7159
- setPopperElement(el);
7160
- forwardedRef.current = el;
7161
- };
7162
-
7163
- if (!children) return /* @__PURE__ */jsx(Fragment, {});
7164
- if (disabled) return children;
7165
- const referenceProps = {
7166
- onBlur: handleBlur,
7167
- onFocus: handleFocus,
7168
- onMouseEnter: handleMouseEnter,
7169
- onMouseLeave: handleMouseLeave,
7170
- ref: setReferenceElement
7171
- };
7172
- const referenceNode = cloneElement(children, referenceProps);
7173
- const popperNode = /* @__PURE__ */jsx(Root$a, _objectSpread(_objectSpread(_objectSpread({
7166
+ setReferenceElement(node);
7167
+ }, [childRef]);
7168
+ const child = useMemo(() => {
7169
+ if (!childProp) return null;
7170
+ return cloneElement(childProp, {
7171
+ onBlur: handleBlur,
7172
+ onFocus: handleFocus,
7173
+ onMouseEnter: handleMouseEnter,
7174
+ onMouseLeave: handleMouseLeave,
7175
+ ref: setReference
7176
+ });
7177
+ }, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
7178
+ if (!child) return /* @__PURE__ */jsx(Fragment, {});
7179
+ if (disabled) return child;
7180
+ const root = /* @__PURE__ */jsx(Root$a, _objectSpread(_objectSpread({
7174
7181
  "data-ui": "Tooltip"
7175
- }, restProps), popper.attributes.popper), {}, {
7176
- ref: setRef,
7177
- style: popper.styles.popper,
7182
+ }, restProps), {}, {
7183
+ ref: setFloating,
7184
+ style: rootStyle,
7178
7185
  zOffset,
7179
7186
  children: /* @__PURE__ */jsxs(Card, {
7187
+ "data-ui": "Tooltip__card",
7188
+ "data-placement": placement,
7189
+ padding,
7180
7190
  radius: 2,
7181
7191
  scheme,
7182
- shadow: 3,
7192
+ shadow,
7183
7193
  children: [content, /* @__PURE__ */jsx(TooltipArrow, {
7184
- ref: setArrowElement,
7185
- style: popper.styles.arrow
7194
+ ref: setArrow,
7195
+ style: arrowStyle
7186
7196
  })]
7187
7197
  })
7188
7198
  }));
7189
7199
  return /* @__PURE__ */jsxs(Fragment, {
7190
- children: [referenceNode, isOpen && /* @__PURE__ */jsxs(Fragment, {
7191
- children: [portal && /* @__PURE__ */jsx(Portal, {
7200
+ children: [child, isOpen && /* @__PURE__ */jsx(Fragment, {
7201
+ children: portal ? /* @__PURE__ */jsx(Portal, {
7192
7202
  __unstable_name: typeof portal === "string" ? portal : void 0,
7193
- children: popperNode
7194
- }), !portal && popperNode]
7203
+ children: root
7204
+ }) : root
7195
7205
  })]
7196
7206
  });
7197
7207
  });
7198
- const Root$9 = styled.div(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
7199
- const ListBox = styled(Box)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
7200
- const ResultsPopover = styled(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"])));
7201
- const rotate = keyframes(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
7202
- const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
7208
+ const Root$9 = styled.div(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n line-height: 0;\n"])));
7209
+ const ListBox = styled(Box)(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));
7210
+ const ResultsPopover = styled(Popover)(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n"])));
7211
+ const rotate = keyframes(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
7212
+ const AnimatedSpinnerIcon = styled(SpinnerIcon)(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n animation: ", " 500ms linear infinite;\n"])), rotate);
7203
7213
 
7204
7214
  function AutocompleteOption(props) {
7205
7215
  const {
@@ -7298,13 +7308,13 @@ function autocompleteReducer(state, msg) {
7298
7308
  }
7299
7309
 
7300
7310
  const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"];
7301
- const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 1, 1];
7302
- const AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start";
7303
- const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["top-start"];
7311
+ const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
7312
+ const AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom";
7313
+ const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom", "top"];
7304
7314
 
7305
- const defaultRenderValue = (value, option) => option ? option.value : value;
7315
+ const DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value;
7306
7316
 
7307
- const defaultFilterOption = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
7317
+ const DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
7308
7318
 
7309
7319
  const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7310
7320
  const {
@@ -7315,7 +7325,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7315
7325
  fontSize = 2,
7316
7326
  icon,
7317
7327
  id,
7318
- listBox = {},
7328
+ listBox = EMPTY_RECORD,
7319
7329
  loading,
7320
7330
  onBlur,
7321
7331
  onChange,
@@ -7325,18 +7335,18 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7325
7335
  openButton,
7326
7336
  options: optionsProp,
7327
7337
  padding: paddingProp = 3,
7328
- popover = {},
7338
+ popover = EMPTY_RECORD,
7329
7339
  prefix,
7330
7340
  radius = 3,
7331
7341
  readOnly,
7332
7342
  relatedElements,
7333
7343
  renderOption: renderOptionProp,
7334
7344
  renderPopover,
7335
- renderValue = defaultRenderValue,
7345
+ renderValue = DEFAULT_RENDER_VALUE,
7336
7346
  suffix,
7337
7347
  value: valueProp
7338
7348
  } = props,
7339
- restProps = _objectWithoutProperties(props, _excluded30);
7349
+ restProps = _objectWithoutProperties(props, _excluded31);
7340
7350
 
7341
7351
  const [state, dispatch] = useReducer(autocompleteReducer, {
7342
7352
  activeValue: valueProp || null,
@@ -7352,10 +7362,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7352
7362
  query,
7353
7363
  value
7354
7364
  } = state;
7355
- const defaultRenderOption = useCallback(_ref27 => {
7365
+ const defaultRenderOption = useCallback(_ref21 => {
7356
7366
  let {
7357
7367
  value: value2
7358
- } = _ref27;
7368
+ } = _ref21;
7359
7369
  return /* @__PURE__ */jsx(Card, {
7360
7370
  "data-as": "button",
7361
7371
  padding: paddingProp,
@@ -7369,7 +7379,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7369
7379
  });
7370
7380
  }, [fontSize, paddingProp]);
7371
7381
  const renderOption = typeof renderOptionProp === "function" ? renderOptionProp : defaultRenderOption;
7372
- const filterOption = typeof filterOptionProp === "function" ? filterOptionProp : defaultFilterOption;
7382
+ const filterOption = typeof filterOptionProp === "function" ? filterOptionProp : DEFAULT_FILTER_OPTION;
7373
7383
  const rootElementRef = useRef(null);
7374
7384
  const resultsPopoverElementRef = useRef(null);
7375
7385
  const inputElementRef = useRef(null);
@@ -7606,12 +7616,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7606
7616
  if (v === 2) return 1;
7607
7617
  return v - 2;
7608
7618
  }), [padding]);
7609
- const openButtonPadding = useMemo(() => padding.map(v => {
7610
- if (v === 0) return 0;
7611
- if (v === 1) return 0;
7612
- if (v === 2) return 1;
7613
- return v - 1;
7614
- }), [padding]);
7619
+ const openButtonPadding = useMemo(() => padding.map(v => Math.max(v - 1, 0)), [padding]);
7615
7620
  const openButtonProps = useMemo(() => typeof openButton === "object" ? openButton : EMPTY_RECORD, [openButton]);
7616
7621
  const handleOpenClick = useCallback(event => {
7617
7622
  dispatch({
@@ -7763,8 +7768,8 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7763
7768
  });
7764
7769
  });
7765
7770
  const Autocomplete = InnerAutocomplete;
7766
- const Root$8 = styled.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"])));
7767
- const ExpandButton = styled(Button)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7771
+ const Root$8 = styled.ol(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
7772
+ const ExpandButton = styled(Button)(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));
7768
7773
  const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7769
7774
  const {
7770
7775
  children,
@@ -7772,7 +7777,7 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7772
7777
  separator,
7773
7778
  space: spaceRaw = 2
7774
7779
  } = props,
7775
- restProps = _objectWithoutProperties(props, _excluded31);
7780
+ restProps = _objectWithoutProperties(props, _excluded32);
7776
7781
 
7777
7782
  const space = useArrayProp(spaceRaw);
7778
7783
  const [open, setOpen] = useState(false);
@@ -7838,10 +7843,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7838
7843
  }));
7839
7844
  });
7840
7845
 
7841
- function dialogStyle(_ref28) {
7846
+ function dialogStyle(_ref22) {
7842
7847
  let {
7843
7848
  theme
7844
- } = _ref28;
7849
+ } = _ref22;
7845
7850
  const color = theme.sanity.color.base;
7846
7851
  return {
7847
7852
  "&:not([hidden])": {
@@ -7883,12 +7888,12 @@ function useDialog() {
7883
7888
  }
7884
7889
 
7885
7890
  const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
7886
- const DialogContainer = styled(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"])));
7887
- const DialogCardRoot = styled(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"])));
7888
- const DialogLayout = styled(Flex)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7889
- const DialogHeader = styled(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"])));
7890
- const DialogContent = styled(Box)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7891
- const DialogFooter = styled(Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7891
+ const DialogContainer = styled(Container)(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
7892
+ const DialogCardRoot = styled(Card)(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
7893
+ const DialogLayout = styled(Flex)(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
7894
+ const DialogHeader = styled(Card)(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
7895
+ const DialogContent = styled(Box)(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
7896
+ const DialogFooter = styled(Box)(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
7892
7897
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
7893
7898
  const {
7894
7899
  __unstable_autoFocus: autoFocus,
@@ -8015,7 +8020,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
8015
8020
  width: widthProp = 0,
8016
8021
  zOffset: zOffsetProp = dialog.zOffset || ((_a = theme.sanity.layer) == null ? void 0 : _a.dialog.zOffset)
8017
8022
  } = props,
8018
- restProps = _objectWithoutProperties(props, _excluded32);
8023
+ restProps = _objectWithoutProperties(props, _excluded33);
8019
8024
 
8020
8025
  const cardRadius = useArrayProp(cardRadiusProp);
8021
8026
  const padding = useArrayProp(paddingProp);
@@ -8100,8 +8105,8 @@ function DialogProvider(props) {
8100
8105
  });
8101
8106
  }
8102
8107
 
8103
- const Root$6 = styled.kbd(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
8104
- const Key = styled(KBD)(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
8108
+ const Root$6 = styled.kbd(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
8109
+ const Key = styled(KBD)(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));
8105
8110
  const Hotkeys = forwardRef(function Hotkeys2(props, ref) {
8106
8111
  const {
8107
8112
  fontSize,
@@ -8110,7 +8115,7 @@ const Hotkeys = forwardRef(function Hotkeys2(props, ref) {
8110
8115
  radius,
8111
8116
  space: spaceProp = 1
8112
8117
  } = props,
8113
- restProps = _objectWithoutProperties(props, _excluded33);
8118
+ restProps = _objectWithoutProperties(props, _excluded34);
8114
8119
 
8115
8120
  const space = useArrayProp(spaceProp);
8116
8121
 
@@ -8372,7 +8377,7 @@ function useMenuController(props) {
8372
8377
  };
8373
8378
  }
8374
8379
 
8375
- const Root$5 = styled(Box)(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
8380
+ const Root$5 = styled(Box)(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));
8376
8381
  const Menu = forwardRef(function Menu2(props, ref) {
8377
8382
  const {
8378
8383
  children,
@@ -8389,7 +8394,7 @@ const Menu = forwardRef(function Menu2(props, ref) {
8389
8394
  shouldFocus = props.focusFirst && "first" || props.focusLast && "last" || null,
8390
8395
  space = 1
8391
8396
  } = props,
8392
- restProps = _objectWithoutProperties(props, _excluded34);
8397
+ restProps = _objectWithoutProperties(props, _excluded35);
8393
8398
 
8394
8399
  const forwardedRef = useForwardedRef(ref);
8395
8400
  const {
@@ -8606,10 +8611,10 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
8606
8611
  children: button || /* @__PURE__ */jsx(Fragment, {})
8607
8612
  }));
8608
8613
  });
8609
- const MenuDivider = styled.hr(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8614
+ const MenuDivider = styled.hr(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
8610
8615
 
8611
8616
  function selectableBaseStyle() {
8612
- return 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 "])));
8617
+ return css(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
8613
8618
  }
8614
8619
 
8615
8620
  function selectableColorStyle(props) {
@@ -8625,7 +8630,7 @@ function selectableColorStyle(props) {
8625
8630
  selectable
8626
8631
  } = theme.sanity.color;
8627
8632
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8628
- return 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);
8633
+ return css(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b = (_a = theme.sanity.styles) == null ? void 0 : _a.card) == null ? void 0 : _b.root);
8629
8634
  }
8630
8635
 
8631
8636
  const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
@@ -8658,7 +8663,7 @@ function MenuGroup(props) {
8658
8663
  text,
8659
8664
  tone = "default"
8660
8665
  } = props,
8661
- restProps = _objectWithoutProperties(props, _excluded35);
8666
+ restProps = _objectWithoutProperties(props, _excluded36);
8662
8667
 
8663
8668
  const menu = useMenu();
8664
8669
  const {
@@ -8807,7 +8812,7 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8807
8812
  text,
8808
8813
  tone = "default"
8809
8814
  } = props,
8810
- restProps = _objectWithoutProperties(props, _excluded36);
8815
+ restProps = _objectWithoutProperties(props, _excluded37);
8811
8816
 
8812
8817
  const menu = useMenu();
8813
8818
  const {
@@ -8897,18 +8902,18 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8897
8902
  }))]
8898
8903
  }));
8899
8904
  });
8900
- const keyframe = keyframes(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8901
- const animation = 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);
8902
- const skeletonStyle = 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 => {
8905
+ const keyframe = keyframes(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8906
+ const animation = css(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8907
+ const skeletonStyle = css(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref23 => {
8903
8908
  let {
8904
8909
  $visible
8905
- } = _ref29;
8910
+ } = _ref23;
8906
8911
  return $visible ? 1 : 0;
8907
- }, _ref30 => {
8912
+ }, _ref24 => {
8908
8913
  let {
8909
8914
  $animated
8910
- } = _ref30;
8911
- return $animated ? animation : css(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8915
+ } = _ref24;
8916
+ return $animated ? animation : css(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));
8912
8917
  });
8913
8918
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
8914
8919
  const Skeleton = forwardRef(function Skeleton2(props, ref) {
@@ -8917,7 +8922,7 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
8917
8922
  delay,
8918
8923
  radius
8919
8924
  } = props,
8920
- restProps = _objectWithoutProperties(props, _excluded37);
8925
+ restProps = _objectWithoutProperties(props, _excluded38);
8921
8926
 
8922
8927
  const [visible, setVisible] = useState(delay ? false : true);
8923
8928
  useEffect(() => {
@@ -8939,12 +8944,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
8939
8944
  ref
8940
8945
  }));
8941
8946
  });
8942
- const Root$3 = styled(Skeleton)(_ref31 => {
8947
+ const Root$3 = styled(Skeleton)(_ref25 => {
8943
8948
  let {
8944
8949
  $size,
8945
8950
  $style,
8946
8951
  theme
8947
- } = _ref31;
8952
+ } = _ref25;
8948
8953
  const {
8949
8954
  media
8950
8955
  } = theme.sanity;
@@ -8964,7 +8969,7 @@ const TextSkeleton = forwardRef(function TextSkeleton2(props, ref) {
8964
8969
  const {
8965
8970
  size = 2
8966
8971
  } = props,
8967
- restProps = _objectWithoutProperties(props, _excluded38);
8972
+ restProps = _objectWithoutProperties(props, _excluded39);
8968
8973
 
8969
8974
  const $size = useArrayProp(size);
8970
8975
  return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -8977,7 +8982,7 @@ const LabelSkeleton = forwardRef(function TextSkeleton3(props, ref) {
8977
8982
  const {
8978
8983
  size = 2
8979
8984
  } = props,
8980
- restProps = _objectWithoutProperties(props, _excluded39);
8985
+ restProps = _objectWithoutProperties(props, _excluded40);
8981
8986
 
8982
8987
  const $size = useArrayProp(size);
8983
8988
  return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -8990,7 +8995,7 @@ const HeadingSkeleton = forwardRef(function TextSkeleton4(props, ref) {
8990
8995
  const {
8991
8996
  size = 2
8992
8997
  } = props,
8993
- restProps = _objectWithoutProperties(props, _excluded40);
8998
+ restProps = _objectWithoutProperties(props, _excluded41);
8994
8999
 
8995
9000
  const $size = useArrayProp(size);
8996
9001
  return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9003,7 +9008,7 @@ const CodeSkeleton = forwardRef(function TextSkeleton5(props, ref) {
9003
9008
  const {
9004
9009
  size = 2
9005
9010
  } = props,
9006
- restProps = _objectWithoutProperties(props, _excluded41);
9011
+ restProps = _objectWithoutProperties(props, _excluded42);
9007
9012
 
9008
9013
  const $size = useArrayProp(size);
9009
9014
  return /* @__PURE__ */jsx(Root$3, _objectSpread(_objectSpread({}, restProps), {}, {
@@ -9024,7 +9029,7 @@ const Tab = forwardRef(function Tab2(props, forwardedRef) {
9024
9029
  padding = 2,
9025
9030
  selected
9026
9031
  } = props,
9027
- restProps = _objectWithoutProperties(props, _excluded42);
9032
+ restProps = _objectWithoutProperties(props, _excluded43);
9028
9033
 
9029
9034
  const elementRef = useRef(null);
9030
9035
  const focusedRef = useRef(false);
@@ -9077,7 +9082,7 @@ const TabList = forwardRef(function TabList2(props, ref) {
9077
9082
  const {
9078
9083
  children: childrenProp
9079
9084
  } = props,
9080
- restProps = _objectWithoutProperties(props, _excluded43);
9085
+ restProps = _objectWithoutProperties(props, _excluded44);
9081
9086
 
9082
9087
  const [focusedIndex, setFocusedIndex] = useState(-1);
9083
9088
  const children = useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]);
@@ -9112,7 +9117,7 @@ const TabPanel = forwardRef(function TabPanel2(props, ref) {
9112
9117
  const {
9113
9118
  flex
9114
9119
  } = props,
9115
- restProps = _objectWithoutProperties(props, _excluded44);
9120
+ restProps = _objectWithoutProperties(props, _excluded45);
9116
9121
 
9117
9122
  return /* @__PURE__ */jsx(Box, _objectSpread(_objectSpread({
9118
9123
  "data-ui": "TabPanel"
@@ -9136,8 +9141,8 @@ const ROLES = {
9136
9141
  success: "alert",
9137
9142
  info: "alert"
9138
9143
  };
9139
- const Root$2 = styled(Card)(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
9140
- const TextBox = styled(Flex)(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
9144
+ const Root$2 = styled(Card)(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n pointer-events: all;\n"])));
9145
+ const TextBox = styled(Flex)(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral(["\n overflow-x: auto;\n"])));
9141
9146
 
9142
9147
  function Toast(props) {
9143
9148
  const {
@@ -9147,7 +9152,7 @@ function Toast(props) {
9147
9152
  title,
9148
9153
  status
9149
9154
  } = props,
9150
- restProps = _objectWithoutProperties(props, _excluded45);
9155
+ restProps = _objectWithoutProperties(props, _excluded46);
9151
9156
 
9152
9157
  const cardTone = status ? STATUS_CARD_TONE[status] : "default";
9153
9158
  const role = status ? ROLES[status] : "status";
@@ -9195,8 +9200,8 @@ function Toast(props) {
9195
9200
  const key$1 = Symbol.for("@sanity/ui/context/toast");
9196
9201
  globalScope[key$1] = globalScope[key$1] || createContext(null);
9197
9202
  const ToastContext = globalScope[key$1];
9198
- const Root$1 = styled(Layer)(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
9199
- const ToastContainer = styled.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"])));
9203
+ const Root$1 = styled(Layer)(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));
9204
+ const ToastContainer = styled.div(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));
9200
9205
  let toastId = 0;
9201
9206
 
9202
9207
  function ToastProvider(props) {
@@ -9286,12 +9291,12 @@ function ToastProvider(props) {
9286
9291
  paddingY,
9287
9292
  children: /* @__PURE__ */jsx(AnimatePresence, {
9288
9293
  initial: false,
9289
- children: state.toasts.map(_ref32 => {
9294
+ children: state.toasts.map(_ref26 => {
9290
9295
  let {
9291
9296
  dismiss,
9292
9297
  id,
9293
9298
  params
9294
- } = _ref32;
9299
+ } = _ref26;
9295
9300
  return /* @__PURE__ */jsx(motion.div, {
9296
9301
  animate: {
9297
9302
  opacity: 1,
@@ -9446,7 +9451,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
9446
9451
  children,
9447
9452
  space = 1
9448
9453
  } = props,
9449
- restProps = _objectWithoutProperties(props, _excluded46);
9454
+ restProps = _objectWithoutProperties(props, _excluded47);
9450
9455
 
9451
9456
  const forwardedRef = useForwardedRef(ref);
9452
9457
  const [focusedElement, setFocusedElement] = useState(null);
@@ -9613,7 +9618,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
9613
9618
  Tree.displayName = "Tree";
9614
9619
 
9615
9620
  function treeItemRootStyle() {
9616
- return 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 "])));
9621
+ return css(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
9617
9622
  }
9618
9623
 
9619
9624
  function treeItemRootColorStyle(props) {
@@ -9627,7 +9632,7 @@ function treeItemRootColorStyle(props) {
9627
9632
  selectable
9628
9633
  } = theme.sanity.color;
9629
9634
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
9630
- return 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));
9635
+ return css(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", "\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
9631
9636
  }
9632
9637
 
9633
9638
  function treeItemBoxStyle(props) {
@@ -9638,7 +9643,7 @@ function treeItemBoxStyle(props) {
9638
9643
  const {
9639
9644
  space
9640
9645
  } = theme.sanity;
9641
- return css(_templateObject92 || (_templateObject92 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9646
+ return css(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral(["\n padding-left: ", ";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])), rem(space[2] * $level));
9642
9647
  }
9643
9648
 
9644
9649
  function useTree() {
@@ -9656,7 +9661,7 @@ const TreeGroup = memo(function TreeGroup2(props) {
9656
9661
  children,
9657
9662
  expanded = false
9658
9663
  } = props,
9659
- restProps = _objectWithoutProperties(props, _excluded47);
9664
+ restProps = _objectWithoutProperties(props, _excluded48);
9660
9665
 
9661
9666
  const tree = useTree();
9662
9667
  return /* @__PURE__ */jsx(Stack, _objectSpread(_objectSpread({
@@ -9674,7 +9679,7 @@ const Root = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle));
9674
9679
  const TreeItemBox = styled(Box).attrs({
9675
9680
  forwardedAs: "a"
9676
9681
  })(treeItemBoxStyle);
9677
- const ToggleArrowText = styled(Text)(_templateObject93 || (_templateObject93 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9682
+ const ToggleArrowText = styled(Text)(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));
9678
9683
  const TreeItem = memo(function TreeItem2(props) {
9679
9684
  const {
9680
9685
  children,
@@ -9691,7 +9696,7 @@ const TreeItem = memo(function TreeItem2(props) {
9691
9696
  text,
9692
9697
  weight
9693
9698
  } = props,
9694
- restProps = _objectWithoutProperties(props, _excluded48);
9699
+ restProps = _objectWithoutProperties(props, _excluded49);
9695
9700
 
9696
9701
  const rootRef = useRef(null);
9697
9702
  const treeitemRef = useRef(null);