@sanity/ui 3.3.5 → 3.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -108,7 +108,7 @@ const StyledLabel = /* @__PURE__ */ styled.div.withConfig({
108
108
  })(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle), LabelComponent = forwardRef(function(props, ref) {
109
109
  let $ = c(26), accent, align, childrenProp, restProps, t0, t1, textOverflow, weight;
110
110
  $[0] === props ? (accent = $[1], align = $[2], childrenProp = $[3], restProps = $[4], t0 = $[5], t1 = $[6], textOverflow = $[7], weight = $[8]) : ({accent, align, children: childrenProp, muted: t0, size: t1, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = accent, $[2] = align, $[3] = childrenProp, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = textOverflow, $[8] = weight);
111
- let muted = t0 === void 0 ? !1 : t0, size = t1 === void 0 ? 2 : t1, children = childrenProp;
111
+ let muted = t0 !== void 0 && t0, size = t1 === void 0 ? 2 : t1, children = childrenProp;
112
112
  if (textOverflow === "ellipsis") {
113
113
  let t2;
114
114
  $[9] === children ? t2 = $[10] : (t2 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[9] = children, $[10] = t2), children = t2;
@@ -795,7 +795,7 @@ const StyledHeading = /* @__PURE__ */ styled.div.withConfig({
795
795
  })(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont), HeadingComponent = forwardRef(function(props, ref) {
796
796
  let $ = c(26), align, childrenProp, restProps, t0, t1, t2, textOverflow, weight;
797
797
  $[0] === props ? (align = $[1], childrenProp = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], textOverflow = $[7], weight = $[8]) : ({accent: t0, align, children: childrenProp, muted: t1, size: t2, textOverflow, weight, ...restProps} = props, $[0] = props, $[1] = align, $[2] = childrenProp, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = textOverflow, $[8] = weight);
798
- let accent = t0 === void 0 ? !1 : t0, muted = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
798
+ let accent = t0 !== void 0 && t0, muted = t1 !== void 0 && t1, size = t2 === void 0 ? 2 : t2, children = childrenProp;
799
799
  if (textOverflow === "ellipsis") {
800
800
  let t3;
801
801
  $[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children }), $[9] = children, $[10] = t3), children = t3;
@@ -1297,7 +1297,7 @@ const StyledTextArea = /* @__PURE__ */ styled.span.withConfig({
1297
1297
  })(responsiveRadiusStyle, textInputRepresentationStyle), TextArea = forwardRef(function(props, forwardedRef) {
1298
1298
  let $ = c(35), __unstable_disableFocusRing, customValidity, restProps, t0, t1, t2, t3, t4, weight;
1299
1299
  $[0] === props ? (__unstable_disableFocusRing = $[1], customValidity = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8], weight = $[9]) : ({border: t0, customValidity, disabled: t1, fontSize: t2, padding: t3, radius: t4, weight, __unstable_disableFocusRing, ...restProps} = props, $[0] = props, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4, $[9] = weight);
1300
- let border = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSize = t2 === void 0 ? 2 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, ref = useRef(null), rootTheme = useRootTheme(), t5;
1300
+ let border = t0 === void 0 || t0, disabled = t1 !== void 0 && t1, fontSize = t2 === void 0 ? 2 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, ref = useRef(null), rootTheme = useRootTheme(), t5;
1301
1301
  $[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[10] = t5) : t5 = $[10], useImperativeHandle(forwardedRef, t5), useCustomValidity(ref, customValidity);
1302
1302
  let t6 = rootTheme.scheme, t7 = rootTheme.tone, t8;
1303
1303
  $[11] === fontSize ? t8 = $[12] : (t8 = _getArrayProp(fontSize), $[11] = fontSize, $[12] = t8);
@@ -1455,7 +1455,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
1455
1455
  ], AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete = forwardRef(function(props, forwardedRef) {
1456
1456
  let $ = c(181), customValidity, disabled, filterOptionProp, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
1457
1457
  $[0] === props ? (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], icon = $[4], id = $[5], loading = $[6], onBlur = $[7], onChange = $[8], onFocus = $[9], onQueryChange = $[10], onSelect = $[11], openButton = $[12], openOnFocus = $[13], optionsProp = $[14], prefix = $[15], readOnly = $[16], relatedElements = $[17], renderOptionProp = $[18], renderPopover = $[19], restProps = $[20], suffix = $[21], t0 = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], valueProp = $[29]) : ({border: t0, customValidity, disabled, filterOption: filterOptionProp, fontSize: t1, icon, id, listBox: t2, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, options: optionsProp, padding: t3, popover: t4, prefix, radius: t5, readOnly, relatedElements, renderOption: renderOptionProp, renderPopover, renderValue: t6, suffix, value: valueProp, ...restProps} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = icon, $[5] = id, $[6] = loading, $[7] = onBlur, $[8] = onChange, $[9] = onFocus, $[10] = onQueryChange, $[11] = onSelect, $[12] = openButton, $[13] = openOnFocus, $[14] = optionsProp, $[15] = prefix, $[16] = readOnly, $[17] = relatedElements, $[18] = renderOptionProp, $[19] = renderPopover, $[20] = restProps, $[21] = suffix, $[22] = t0, $[23] = t1, $[24] = t2, $[25] = t3, $[26] = t4, $[27] = t5, $[28] = t6, $[29] = valueProp);
1458
- let border = t0 === void 0 ? !0 : t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null, t9;
1458
+ let border = t0 === void 0 || t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null, t9;
1459
1459
  $[30] !== t7 || $[31] !== t8 ? (t9 = {
1460
1460
  activeValue: t7,
1461
1461
  focused: !1,
@@ -1491,7 +1491,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
1491
1491
  let currentOption = t16, t17;
1492
1492
  if ($[46] !== filterOption || $[47] !== options || $[48] !== query) {
1493
1493
  let t18;
1494
- $[50] !== filterOption || $[51] !== query ? (t18 = (option) => query ? filterOption(query, option) : !0, $[50] = filterOption, $[51] = query, $[52] = t18) : t18 = $[52], t17 = options.filter(t18), $[46] = filterOption, $[47] = options, $[48] = query, $[49] = t17;
1494
+ $[50] !== filterOption || $[51] !== query ? (t18 = (option) => !query || filterOption(query, option), $[50] = filterOption, $[51] = query, $[52] = t18) : t18 = $[52], t17 = options.filter(t18), $[46] = filterOption, $[47] = options, $[48] = query, $[49] = t17;
1495
1495
  } else t17 = $[49];
1496
1496
  let filteredOptions = t17, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, t18;
1497
1497
  $[53] !== onBlur || $[54] !== onQueryChange || $[55] !== relatedElements ? (t18 = (event) => {
@@ -1951,7 +1951,7 @@ function useDialog() {
1951
1951
  return useContext(DialogContext);
1952
1952
  }
1953
1953
  function isTargetWithinScope(boundaryElement, portalElement, target) {
1954
- return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
1954
+ return !boundaryElement || !portalElement || containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
1955
1955
  }
1956
1956
  const StyledDialog = /* @__PURE__ */ styled(Layer).withConfig({
1957
1957
  displayName: "StyledDialog",
@@ -2069,7 +2069,7 @@ DialogCard.displayName = "ForwardRef(DialogCard)";
2069
2069
  const Dialog = forwardRef(function(props, ref) {
2070
2070
  let $ = c(70), dialog = useDialog(), { layer } = useTheme_v2(), _positionProp, _zOffsetProp, children, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, t6;
2071
2071
  $[0] === props ? (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], contentRef = $[4], footer = $[5], header = $[6], id = $[7], onActivate = $[8], onClickOutside = $[9], onClose = $[10], onFocus = $[11], portalProp = $[12], restProps = $[13], scheme = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21]) : ({__unstable_autoFocus: t0, __unstable_hideCloseButton: t1, cardRadius: t2, cardShadow: t3, children, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, padding: t4, portal: portalProp, position: _positionProp, scheme, width: t5, zOffset: _zOffsetProp, animate: t6, ...restProps} = props, $[0] = props, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = contentRef, $[5] = footer, $[6] = header, $[7] = id, $[8] = onActivate, $[9] = onClickOutside, $[10] = onClose, $[11] = onFocus, $[12] = portalProp, $[13] = restProps, $[14] = scheme, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6);
2072
- let autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 === void 0 ? !1 : t6, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, t7;
2072
+ let autoFocus = t0 === void 0 || t0, hideCloseButton = t1 !== void 0 && t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 !== void 0 && t6, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = !usePrefersReducedMotion() && _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, t7;
2073
2073
  $[22] === cardRadiusProp ? t7 = $[23] : (t7 = _getArrayProp(cardRadiusProp), $[22] = cardRadiusProp, $[23] = t7);
2074
2074
  let cardRadius = t7, t8;
2075
2075
  $[24] === paddingProp ? t8 = $[25] : (t8 = _getArrayProp(paddingProp), $[24] = paddingProp, $[25] = t8);
@@ -2189,7 +2189,7 @@ DialogProvider.displayName = "DialogProvider";
2189
2189
  * @public
2190
2190
  */
2191
2191
  const MenuButton = forwardRef(function(props, forwardedRef) {
2192
- let $ = c(62), { __unstable_disableRestoreFocusOnClose: t0, boundaryElement: deprecated_boundaryElement, button: buttonProp, id, menu: menuProp, onClose, onOpen, placement: deprecated_placement, popoverScheme: deprecated_popoverScheme, portal: t1, popover, popoverRadius: deprecated_popoverRadius, preventOverflow: deprecated_preventOverflow } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), t2;
2192
+ let $ = c(62), { __unstable_disableRestoreFocusOnClose: t0, boundaryElement: deprecated_boundaryElement, button: buttonProp, id, menu: menuProp, onClose, onOpen, placement: deprecated_placement, popoverScheme: deprecated_popoverScheme, portal: t1, popover, popoverRadius: deprecated_popoverRadius, preventOverflow: deprecated_preventOverflow } = props, disableRestoreFocusOnClose = t0 !== void 0 && t0, deprecated_portal = t1 === void 0 || t1, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), t2;
2193
2193
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
2194
2194
  let [menuElements, setChildMenuElements] = useState(t2), openRef = useRef(open), t3, t4;
2195
2195
  $[1] !== onOpen || $[2] !== open ? (t3 = () => {
@@ -2307,7 +2307,7 @@ const animation = css`background-image:linear-gradient( to right,var(--card-skel
2307
2307
  })(responsiveRadiusStyle, skeletonStyle), Skeleton = forwardRef(function(props, ref) {
2308
2308
  let $ = c(16), delay, radius, restProps, t0;
2309
2309
  $[0] === props ? (delay = $[1], radius = $[2], restProps = $[3], t0 = $[4]) : ({animated: t0, delay, radius, ...restProps} = props, $[0] = props, $[1] = delay, $[2] = radius, $[3] = restProps, $[4] = t0);
2310
- let animated = t0 === void 0 ? !1 : t0, [visible, setVisible] = useState(!delay), t1, t2;
2310
+ let animated = t0 !== void 0 && t0, [visible, setVisible] = useState(!delay), t1, t2;
2311
2311
  $[5] === delay ? (t1 = $[6], t2 = $[7]) : (t1 = () => {
2312
2312
  if (!delay) return;
2313
2313
  let timeout = setTimeout(() => {
@@ -2319,7 +2319,7 @@ const animation = css`background-image:linear-gradient( to right,var(--card-skel
2319
2319
  }, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2), useEffect(t1, t2);
2320
2320
  let t3;
2321
2321
  $[8] === radius ? t3 = $[9] : (t3 = _getArrayProp(radius), $[8] = radius, $[9] = t3);
2322
- let t4 = delay ? visible : !0, t5;
2322
+ let t4 = !delay || visible, t5;
2323
2323
  return $[10] !== animated || $[11] !== ref || $[12] !== restProps || $[13] !== t3 || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StyledSkeleton$1, {
2324
2324
  ...restProps,
2325
2325
  $animated: animated,
@@ -2909,7 +2909,7 @@ function useTree() {
2909
2909
  function TreeGroup(props) {
2910
2910
  let $ = c(9), children, restProps, t0;
2911
2911
  $[0] === props ? (children = $[1], restProps = $[2], t0 = $[3]) : ({children, expanded: t0, ...restProps} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0);
2912
- let expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded, t2;
2912
+ let expanded = t0 !== void 0 && t0, tree = useTree(), t1 = !expanded, t2;
2913
2913
  return $[4] !== children || $[5] !== restProps || $[6] !== t1 || $[7] !== tree.gap ? (t2 = /* @__PURE__ */ jsx(Stack, {
2914
2914
  as: "ul",
2915
2915
  "data-ui": "TreeGroup",
@@ -2938,7 +2938,7 @@ const StyledTreeItem = /* @__PURE__ */ styled.li.withConfig({
2938
2938
  function TreeItem(props) {
2939
2939
  let $ = c(114), IconComponent, children, gap, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
2940
2940
  $[0] === props ? (IconComponent = $[1], children = $[2], gap = $[3], href = $[4], idProp = $[5], linkAs = $[6], muted = $[7], onClick = $[8], restProps = $[9], t0 = $[10], t1 = $[11], t2 = $[12], t3 = $[13], t4 = $[14], text = $[15], weight = $[16]) : ({children, expanded: t0, fontSize: t1, href, icon: IconComponent, id: idProp, linkAs, muted, onClick, padding: t2, selected: t3, gap, space: t4, text, weight, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = gap, $[4] = href, $[5] = idProp, $[6] = linkAs, $[7] = muted, $[8] = onClick, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t4, $[15] = text, $[16] = weight);
2941
- let expandedProp = t0 === void 0 ? !1 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, spacing = gap === void 0 ? t4 === void 0 ? 2 : t4 : gap, [rootElement, _setRootElement] = useState(null), t5;
2941
+ let expandedProp = t0 !== void 0 && t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 !== void 0 && t3, spacing = gap === void 0 ? t4 === void 0 ? 2 : t4 : gap, [rootElement, _setRootElement] = useState(null), t5;
2942
2942
  $[17] === Symbol.for("react.memo_cache_sentinel") ? (t5 = (node) => {
2943
2943
  startTransition(() => _setRootElement(node));
2944
2944
  }, $[17] = t5) : t5 = $[17];