@sanity/ui 3.0.0-static.10 → 3.0.0-static.3

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.
Files changed (106) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +105 -143
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.js +1 -1
  4. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  5. package/dist/_chunks-cjs/v3_v2.js +251 -0
  6. package/dist/_chunks-cjs/v3_v2.js.map +1 -0
  7. package/dist/_chunks-es/_visual-editing.mjs +106 -144
  8. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  9. package/dist/_chunks-es/v3_v2.mjs +252 -0
  10. package/dist/_chunks-es/v3_v2.mjs.map +1 -0
  11. package/dist/_visual-editing.d.mts +11 -14
  12. package/dist/_visual-editing.d.ts +11 -14
  13. package/dist/cli.js +1 -1
  14. package/dist/css.d.mts +1006 -282
  15. package/dist/css.d.ts +1006 -282
  16. package/dist/css.js +743 -852
  17. package/dist/css.js.map +1 -1
  18. package/dist/css.mjs +743 -852
  19. package/dist/css.mjs.map +1 -1
  20. package/dist/index.d.mts +11 -14
  21. package/dist/index.d.ts +11 -14
  22. package/dist/index.js +31 -17
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +33 -19
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/sanity-palette.css +9 -1
  27. package/dist/sanity-theme.css +1 -1
  28. package/dist/system.css +1023 -1448
  29. package/dist/theme.d.mts +119 -85
  30. package/dist/theme.d.ts +119 -85
  31. package/dist/theme.js +219 -432
  32. package/dist/theme.js.map +1 -1
  33. package/dist/theme.mjs +202 -413
  34. package/dist/theme.mjs.map +1 -1
  35. package/package.json +2 -2
  36. package/src/cli/buildCommand.ts +2 -2
  37. package/src/css/_comp.ts +0 -1
  38. package/src/css/aspects/flex/flexJustify.style.ts +3 -3
  39. package/src/css/aspects/grid/types.ts +2 -2
  40. package/src/css/aspects/index.ts +0 -1
  41. package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
  42. package/src/css/compile/compilePalette.ts +41 -8
  43. package/src/css/compile/compileRule.ts +0 -1
  44. package/src/css/compile/compileStyle.ts +1 -1
  45. package/src/css/compile/compileTheme_v3.ts +55 -46
  46. package/src/css/index.ts +2 -2
  47. package/src/css/primitives/_input/__workshop__/index.ts +1 -1
  48. package/src/css/primitives/_selectable/_contants.ts +1 -1
  49. package/src/css/primitives/badge/badge.style.ts +1 -1
  50. package/src/css/primitives/box/box.style.ts +1 -1
  51. package/src/css/primitives/box/box.ts +0 -2
  52. package/src/css/primitives/box/types.ts +0 -2
  53. package/src/css/primitives/button/_constants.ts +1 -1
  54. package/src/css/primitives/button/button.style.ts +13 -32
  55. package/src/css/primitives/card/_constants.ts +2 -2
  56. package/src/css/primitives/card/card.style.ts +44 -116
  57. package/src/css/primitives/card/card.ts +1 -1
  58. package/src/css/primitives/card/rules.ts +473 -0
  59. package/src/css/primitives/card/types.ts +1 -0
  60. package/src/css/primitives/kbd/kbd.style.ts +1 -1
  61. package/src/css/primitives/popover/popover.ts +0 -4
  62. package/src/css/primitives/switch/switch.style.ts +83 -8
  63. package/src/css/primitives/text/text.style.ts +3 -11
  64. package/src/css/system.style.ts +0 -4
  65. package/src/css/types.ts +188 -202
  66. package/src/css/varNames.ts +76 -110
  67. package/src/css/vars.ts +76 -109
  68. package/src/theme/defaults/config.ts +2 -2
  69. package/src/theme/defaults/fonts.ts +4 -4
  70. package/src/theme/palette/constants.ts +3 -1
  71. package/src/theme/palette/types.ts +12 -0
  72. package/src/theme/v3/buildTheme_v3.ts +2 -1
  73. package/src/theme/v3/color/buildColor_v3.ts +38 -43
  74. package/src/theme/v3/color/card.ts +38 -43
  75. package/src/theme/v3/color/color.ts +38 -42
  76. package/src/theme/v3/defaults.ts +72 -69
  77. package/src/theme/v3/resolveTokens.ts +38 -43
  78. package/src/theme/v3/types.ts +3 -0
  79. package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
  80. package/src/ui/StyleTags.tsx +1 -1
  81. package/src/ui/components/autocomplete/__workshop__/async.tsx +1 -0
  82. package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
  83. package/src/ui/components/autocomplete/autocomplete.tsx +11 -2
  84. package/src/ui/components/dialog/dialog.tsx +4 -3
  85. package/src/ui/constants.ts +0 -6
  86. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +2 -0
  87. package/src/ui/primitives/box/box.tsx +2 -9
  88. package/src/ui/primitives/button/button.tsx +11 -12
  89. package/src/ui/primitives/card/card.tsx +5 -4
  90. package/src/ui/primitives/code/code.tsx +1 -1
  91. package/src/ui/primitives/heading/heading.tsx +1 -1
  92. package/src/ui/primitives/kbd/kbd.tsx +2 -2
  93. package/src/ui/primitives/popover/popover.tsx +75 -5
  94. package/src/ui/primitives/popover/popoverCard.tsx +39 -45
  95. package/src/ui/primitives/select/select.tsx +3 -3
  96. package/src/ui/primitives/stack/stack.tsx +5 -10
  97. package/src/ui/primitives/text/text.tsx +1 -1
  98. package/src/ui/primitives/textInput/textInput.tsx +1 -1
  99. package/src/ui/primitives/tooltip/tooltip.tsx +3 -2
  100. package/src/css/aspects/minWidth/index.ts +0 -2
  101. package/src/css/aspects/minWidth/minWidth.style.ts +0 -13
  102. package/src/css/aspects/minWidth/minWidth.ts +0 -6
  103. package/src/css/aspects/minWidth/types.ts +0 -7
  104. package/src/css/primitives/stack/index.ts +0 -1
  105. package/src/css/primitives/stack/stack.style.ts +0 -9
  106. package/src/css/primitives/stack/stack.ts +0 -6
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, EMPTY_ARRAY, useElementSize, Code, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, createGlobalScopedContext, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Container, usePrefersReducedMotion, Z_OFFSETS, Portal, Layer, containsOrEqualsElement, Grid, LayerProvider, isRecord, Selectable } from "./_chunks-es/_visual-editing.mjs";
2
- import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, CardProvider, Checkbox, ConditionalWrapper, ElementQuery, Heading, Hotkeys, Inline, KBD, Label, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Radio, Select, Spinner, SrOnly, Switch, Tab, TabList, TextArea, ThemeColorProvider, ThemeProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, VirtualList, _ResizeObserver, _elementSizeObserver, _getArrayProp, _isScrollable, createColorTheme, hexToRgb, hslToRgb, multiply, parseColor, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useCard, useCustomValidity, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTheme_v2, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.mjs";
1
+ import { isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, EMPTY_ARRAY, useElementSize, Code, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, createGlobalScopedContext, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Container, useTheme_v2, usePrefersReducedMotion, Portal, Layer, containsOrEqualsElement, Grid, LayerProvider, isRecord, Selectable } from "./_chunks-es/_visual-editing.mjs";
2
+ import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, CardProvider, Checkbox, ConditionalWrapper, ElementQuery, Heading, Hotkeys, Inline, KBD, Label, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Radio, Select, Spinner, SrOnly, Switch, Tab, TabList, TextArea, ThemeColorProvider, ThemeProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, VirtualList, _ResizeObserver, _elementSizeObserver, _getArrayProp, _isScrollable, createColorTheme, hexToRgb, hslToRgb, multiply, parseColor, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useCard, useCustomValidity, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.mjs";
3
3
  import { composeClassNames, breadcrumbs, dialogContainer, dialogCardRoot, dialogLayout, dialogHeader, dialogContent, dialogFooter, dialog, skeleton, textSkeleton, labelSkeleton, headingSkeleton, codeSkeleton, toast, toastLoadingBar, toastLoadingBarMask, toastLoadingBarProgress, toastLayer, treeItem, compilePalette, compileTheme, compileSystem } from "@sanity/ui/css";
4
4
  import { px, rem } from "@sanity/ui/css";
5
5
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
@@ -208,7 +208,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
208
208
  customValidity,
209
209
  disabled,
210
210
  filterOption: filterOptionProp,
211
- fontSize = 2,
211
+ fontSize = 1,
212
212
  icon,
213
213
  id,
214
214
  listBox = EMPTY_RECORD,
@@ -247,7 +247,16 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
247
247
  value
248
248
  } = state, defaultRenderOption = useCallback(({
249
249
  value: value_0
250
- }) => /* @__PURE__ */ jsx(Card, { as: "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
250
+ }) => /* @__PURE__ */ jsx(
251
+ Card,
252
+ {
253
+ as: "button",
254
+ padding: paddingProp,
255
+ radius: 2,
256
+ selectable: !0,
257
+ children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 })
258
+ }
259
+ ), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
251
260
  useImperativeHandle(forwardedRef, () => inputElementRef.current);
252
261
  const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp), currentOption = useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = useCallback((event) => {
253
262
  setTimeout(() => {
@@ -382,6 +391,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
382
391
  return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
383
392
  disabled: loading,
384
393
  selected: active,
394
+ selectable: !0,
385
395
  tabIndex: listFocused && active ? 0 : -1
386
396
  }) }, option_0.value);
387
397
  }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = useMemo(() => renderPopover ? renderPopover({
@@ -390,7 +400,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
390
400
  inputElement: inputElementRef.current,
391
401
  onMouseEnter: handlePopoverMouseEnter,
392
402
  onMouseLeave: handlePopoverMouseLeave
393
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
403
+ }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
394
404
  return (
395
405
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
396
406
  /* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
@@ -511,7 +521,9 @@ const DialogCard = forwardRef(function(props, forwardedRef) {
511
521
  });
512
522
  DialogCard.displayName = "ForwardRef(DialogCard)";
513
523
  const Dialog = forwardRef(function(props, ref) {
514
- const $ = c(66), context = useDialog();
524
+ const $ = c(66), context = useDialog(), {
525
+ layer
526
+ } = useTheme_v2();
515
527
  let _positionProp, _zOffsetProp, cardShadow, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, tone;
516
528
  $[0] !== props ? ({
517
529
  __unstable_autoFocus: t0,
@@ -538,7 +550,7 @@ const Dialog = forwardRef(function(props, ref) {
538
550
  tone,
539
551
  ...restProps
540
552
  } = props, $[0] = props, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = cardShadow, $[4] = children, $[5] = className, $[6] = contentRef, $[7] = footer, $[8] = header, $[9] = id, $[10] = onActivate, $[11] = onClickOutside, $[12] = onClose, $[13] = onFocus, $[14] = portalProp, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t2, $[20] = t3, $[21] = t4, $[22] = t5, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], cardShadow = $[3], children = $[4], className = $[5], contentRef = $[6], footer = $[7], header = $[8], id = $[9], onActivate = $[10], onClickOutside = $[11], onClose = $[12], onFocus = $[13], portalProp = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t2 = $[19], t3 = $[20], t4 = $[21], t5 = $[22], tone = $[23]);
541
- const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, _animate = t2 === void 0 ? !1 : t2, cardRadiusProp = t3 === void 0 ? 4 : t3, padding = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? Z_OFFSETS.dialog, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null);
553
+ const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, _animate = t2 === void 0 ? !1 : t2, cardRadiusProp = t3 === void 0 ? 4 : t3, padding = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, positionProp = _positionProp ?? (context.position || "fixed"), zOffsetProp = _zOffsetProp ?? (context.zOffset || layer.dialog.zOffset), animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null);
542
554
  let t6;
543
555
  $[24] !== onFocus ? (t6 = (event) => {
544
556
  onFocus?.(event);
@@ -1382,28 +1394,30 @@ const TreeGroup = memo(function(props) {
1382
1394
  });
1383
1395
  TreeItem.displayName = "Memo(TreeItem)";
1384
1396
  function StyleTags(props) {
1385
- const $ = c(10), {
1397
+ const $ = c(14), {
1386
1398
  theme: themeProp
1387
1399
  } = props;
1388
1400
  let t0;
1389
1401
  $[0] !== themeProp ? (t0 = themeProp ?? buildTheme_v3(), $[0] = themeProp, $[1] = t0) : t0 = $[1];
1390
1402
  const theme = t0;
1391
1403
  let t1;
1392
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx("style", { href: "sanity-palette", precedence: "palette", children: compilePalette() }), $[2] = t1) : t1 = $[2];
1404
+ $[2] !== theme._palette ? (t1 = compilePalette(theme._palette), $[2] = theme._palette, $[3] = t1) : t1 = $[3];
1393
1405
  let t2;
1394
- $[3] !== theme ? (t2 = compileTheme({
1395
- v3: theme
1396
- }), $[3] = theme, $[4] = t2) : t2 = $[4];
1406
+ $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx("style", { href: "sanity-palette", precedence: "palette", children: t1 }), $[4] = t1, $[5] = t2) : t2 = $[5];
1397
1407
  let t3;
1398
- $[5] !== t2 ? (t3 = /* @__PURE__ */ jsx("style", { href: "sanity-theme", precedence: "theme", children: t2 }), $[5] = t2, $[6] = t3) : t3 = $[6];
1408
+ $[6] !== theme ? (t3 = compileTheme({
1409
+ v3: theme
1410
+ }), $[6] = theme, $[7] = t3) : t3 = $[7];
1399
1411
  let t4;
1400
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx("style", { href: "sanity-system", precedence: "system", children: compileSystem() }), $[7] = t4) : t4 = $[7];
1412
+ $[8] !== t3 ? (t4 = /* @__PURE__ */ jsx("style", { href: "sanity-theme", precedence: "theme", children: t3 }), $[8] = t3, $[9] = t4) : t4 = $[9];
1401
1413
  let t5;
1402
- return $[8] !== t3 ? (t5 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
1403
- t1,
1404
- t3,
1405
- t4
1406
- ] }), $[8] = t3, $[9] = t5) : t5 = $[9], t5;
1414
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx("style", { href: "sanity-system", precedence: "system", children: compileSystem() }), $[10] = t5) : t5 = $[10];
1415
+ let t6;
1416
+ return $[11] !== t2 || $[12] !== t4 ? (t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
1417
+ t2,
1418
+ t4,
1419
+ t5
1420
+ ] }), $[11] = t2, $[12] = t4, $[13] = t6) : t6 = $[13], t6;
1407
1421
  }
1408
1422
  export {
1409
1423
  Arrow,