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

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 (71) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +160 -207
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +161 -208
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +1 -3
  6. package/dist/_visual-editing.d.ts +1 -3
  7. package/dist/cli.js +1 -1
  8. package/dist/css.d.mts +115 -2
  9. package/dist/css.d.ts +115 -2
  10. package/dist/css.js +539 -402
  11. package/dist/css.js.map +1 -1
  12. package/dist/css.mjs +541 -404
  13. package/dist/css.mjs.map +1 -1
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +50 -17
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +45 -12
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/sanity-theme.css +1 -1
  21. package/dist/system.css +418 -182
  22. package/dist/theme.js +10 -11
  23. package/dist/theme.js.map +1 -1
  24. package/dist/theme.mjs +10 -11
  25. package/dist/theme.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/src/css/_resp.ts +0 -1
  28. package/src/css/aspects/font/font.style.ts +7 -66
  29. package/src/css/aspects/shadow/shadow.style.ts +16 -41
  30. package/src/css/compile/compilePalette.ts +4 -3
  31. package/src/css/compile/compileSystem.ts +0 -3
  32. package/src/css/compile/compileTheme_v3.ts +233 -219
  33. package/src/css/components/skeleton/skeleton.style.ts +8 -4
  34. package/src/css/constants.ts +9 -0
  35. package/src/css/index.ts +1 -0
  36. package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
  37. package/src/css/primitives/_arrow/_arrow.ts +4 -0
  38. package/src/css/primitives/_selectable/_selectable.style.ts +23 -23
  39. package/src/css/primitives/button/button.style.ts +48 -15
  40. package/src/css/primitives/card/card.style.ts +1 -1
  41. package/src/css/primitives/token/token.style.ts +37 -36
  42. package/src/css/responsiveRules.ts +12 -19
  43. package/src/css/types.ts +106 -3
  44. package/src/css/varNames.ts +101 -4
  45. package/src/css/vars.ts +52 -16
  46. package/src/theme/v3/buildTheme_v3.ts +1 -1
  47. package/src/theme/v3/{defaults.ts → defaultTokens.ts} +1 -2
  48. package/src/theme/v3/index.ts +1 -1
  49. package/src/theme/v3/resolveTokens.ts +9 -9
  50. package/src/ui/RootClassNames.tsx +41 -0
  51. package/src/ui/_compat/helpers.ts +72 -0
  52. package/src/ui/_compat/index.ts +2 -6
  53. package/src/ui/_compat/studioTheme.ts +7 -0
  54. package/src/ui/_compat/types.ts +0 -83
  55. package/src/ui/index.ts +1 -0
  56. package/src/ui/primitives/button/button.tsx +5 -6
  57. package/src/ui/primitives/popover/popover.tsx +25 -7
  58. package/src/ui/primitives/popover/popoverCard.tsx +46 -45
  59. package/src/ui/primitives/tooltip/tooltip.tsx +9 -2
  60. package/src/ui/primitives/tooltip/tooltipCard.tsx +1 -1
  61. package/src/ui/utils/arrow/arrow.tsx +3 -11
  62. package/src/ui/utils/elementQuery/elementQuery.tsx +10 -8
  63. package/src/ui/utils/virtualList/virtualList.tsx +37 -32
  64. package/src/css/components/breadcrumbs/rules.ts +0 -25
  65. package/src/css/components/dialog/rules.ts +0 -78
  66. package/src/css/components/skeleton/rules.ts +0 -113
  67. package/src/css/components/toast/rules.ts +0 -18
  68. package/src/css/components/tree/rules.ts +0 -168
  69. package/src/css/primitives/popover/rules.ts +0 -5
  70. package/src/css/primitives/spinner/rules.ts +0 -21
  71. package/src/css/primitives/token/rules.ts +0 -45
package/dist/index.d.mts CHANGED
@@ -1883,6 +1883,8 @@ export declare const rgbToHex: typeof rgbToHex_2
1883
1883
  */
1884
1884
  export declare const rgbToHsl: typeof rgbToHsl_2
1885
1885
 
1886
+ export declare function RootClassNames(props: {element: HTMLElement}): null
1887
+
1886
1888
  /**
1887
1889
  * @public
1888
1890
  * @deprecated Use `RootTheme` from `@sanity/ui/theme` instead.
@@ -2004,9 +2006,7 @@ export declare interface StackProps
2004
2006
  * @public
2005
2007
  * @deprecated Use `buildTheme` from `@sanity/ui/theme` instead.
2006
2008
  */
2007
- export declare const studioTheme: {
2008
- readonly value: RootTheme_2
2009
- }
2009
+ export declare const studioTheme: RootTheme_2
2010
2010
 
2011
2011
  /**
2012
2012
  * @public
@@ -2862,7 +2862,7 @@ export declare interface VirtualListChangeOpts {
2862
2862
  * @beta
2863
2863
  */
2864
2864
  export declare interface VirtualListProps<Item = any> extends Omit<StackProps, 'gap'> {
2865
- gap?: number
2865
+ gap?: Space
2866
2866
  getItemKey?: (item: Item, itemIndex: number) => string
2867
2867
  items?: Item[]
2868
2868
  onChange?: (opts: VirtualListChangeOpts) => void
package/dist/index.d.ts CHANGED
@@ -1883,6 +1883,8 @@ export declare const rgbToHex: typeof rgbToHex_2
1883
1883
  */
1884
1884
  export declare const rgbToHsl: typeof rgbToHsl_2
1885
1885
 
1886
+ export declare function RootClassNames(props: {element: HTMLElement}): null
1887
+
1886
1888
  /**
1887
1889
  * @public
1888
1890
  * @deprecated Use `RootTheme` from `@sanity/ui/theme` instead.
@@ -2004,9 +2006,7 @@ export declare interface StackProps
2004
2006
  * @public
2005
2007
  * @deprecated Use `buildTheme` from `@sanity/ui/theme` instead.
2006
2008
  */
2007
- export declare const studioTheme: {
2008
- readonly value: RootTheme_2
2009
- }
2009
+ export declare const studioTheme: RootTheme_2
2010
2010
 
2011
2011
  /**
2012
2012
  * @public
@@ -2862,7 +2862,7 @@ export declare interface VirtualListChangeOpts {
2862
2862
  * @beta
2863
2863
  */
2864
2864
  export declare interface VirtualListProps<Item = any> extends Omit<StackProps, 'gap'> {
2865
- gap?: number
2865
+ gap?: Space
2866
2866
  getItemKey?: (item: Item, itemIndex: number) => string
2867
2867
  items?: Item[]
2868
2868
  onChange?: (opts: VirtualListChangeOpts) => void
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), css = require("@sanity/ui/css"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), reactCompilerRuntime = require("react-compiler-runtime"), framerMotion = require("framer-motion"), theme = require("@sanity/ui/theme");
3
+ var theme = require("@sanity/ui/theme"), _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), reactCompilerRuntime = require("react-compiler-runtime"), css = require("@sanity/ui/css"), framerMotion = require("framer-motion");
4
+ const createColorTheme = theme.createColorTheme, hexToRgb = theme.hexToRgb, hslToRgb = theme.hslToRgb, multiply = theme.multiply, parseColor = theme.parseColor, rgbToHex = theme.rgbToHex, rgbToHsl = theme.rgbToHsl, rgba = theme.rgba, screen = theme.screen;
4
5
  function _responsive(media, values, callback) {
5
6
  return (values?.map(callback) || []).map((statement, mediaIndex) => mediaIndex === 0 ? statement : {
6
7
  [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
@@ -632,7 +633,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
632
633
  }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
633
634
  let t9;
634
635
  $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
635
- setOpen(_temp$2), setShouldFocus(null);
636
+ setOpen(_temp$3), setShouldFocus(null);
636
637
  }, $[12] = t9) : t9 = $[12];
637
638
  const handleButtonClick = t9;
638
639
  let t10;
@@ -742,7 +743,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
742
743
  return $[58] !== menu || $[59] !== open || $[60] !== popoverProps || $[61] !== t24 ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t24 }), $[58] = menu, $[59] = open, $[60] = popoverProps, $[61] = t24, $[62] = t25) : t25 = $[62], t25;
743
744
  });
744
745
  MenuButton.displayName = "ForwardRef(MenuButton)";
745
- function _temp$2(v) {
746
+ function _temp$3(v) {
746
747
  return !v;
747
748
  }
748
749
  const Skeleton = react.forwardRef(function(props, ref) {
@@ -985,12 +986,12 @@ const container = {
985
986
  }
986
987
  }, MotionCard = framerMotion.motion.create(_visualEditing.Card), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text), MotionBox = framerMotion.motion.create(_visualEditing.Box);
987
988
  function useMounted() {
988
- return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
989
+ return react.useSyncExternalStore(subscribe, _temp$2, _temp2$1);
989
990
  }
990
- function _temp2() {
991
+ function _temp2$1() {
991
992
  return !1;
992
993
  }
993
- function _temp$1() {
994
+ function _temp$2() {
994
995
  return !0;
995
996
  }
996
997
  const subscribe = () => () => {
@@ -1056,14 +1057,14 @@ function ToastProvider(props) {
1056
1057
  }, $[1] = t3) : t3 = $[1], t2 = t3;
1057
1058
  const value = t2;
1058
1059
  let t4;
1059
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
1060
+ $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp$1) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
1060
1061
  let t5;
1061
1062
  return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1062
1063
  children,
1063
1064
  t4
1064
1065
  ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
1065
1066
  }
1066
- function _temp(t0) {
1067
+ function _temp$1(t0) {
1067
1068
  const {
1068
1069
  dismiss: dismiss_0,
1069
1070
  id: id_0,
@@ -1374,6 +1375,37 @@ const TreeGroup = react.memo(function(props) {
1374
1375
  ] });
1375
1376
  });
1376
1377
  TreeItem.displayName = "Memo(TreeItem)";
1378
+ function RootClassNames(props) {
1379
+ const $ = reactCompilerRuntime.c(7), {
1380
+ element
1381
+ } = props, {
1382
+ scheme,
1383
+ tone
1384
+ } = _visualEditing.useCard() ?? {};
1385
+ let t0;
1386
+ $[0] !== scheme || $[1] !== tone ? (t0 = () => {
1387
+ const els = document.querySelectorAll([css.scopeClassName("button"), css.scopeClassName("card"), css.scopeClassName("font")].map(_temp).join(", "));
1388
+ for (const el of els)
1389
+ el instanceof HTMLElement && (el.style.transition = "none");
1390
+ return _raf2(() => {
1391
+ document.documentElement.className = css.card({
1392
+ scheme,
1393
+ tone
1394
+ }) ?? "", _raf2(() => {
1395
+ for (const el_0 of els)
1396
+ el_0 instanceof HTMLElement && (el_0.style.transition = "");
1397
+ });
1398
+ }), _temp2;
1399
+ }, $[0] = scheme, $[1] = tone, $[2] = t0) : t0 = $[2];
1400
+ let t1;
1401
+ return $[3] !== element || $[4] !== scheme || $[5] !== tone ? (t1 = [element, scheme, tone], $[3] = element, $[4] = scheme, $[5] = tone, $[6] = t1) : t1 = $[6], react.useEffect(t0, t1), null;
1402
+ }
1403
+ function _temp2() {
1404
+ document.documentElement.className = "";
1405
+ }
1406
+ function _temp(n) {
1407
+ return `.${n}`;
1408
+ }
1377
1409
  function StyleTags(props) {
1378
1410
  const $ = reactCompilerRuntime.c(10), {
1379
1411
  theme: themeProp
@@ -1452,21 +1484,12 @@ exports._getArrayProp = _visualEditing._getArrayProp;
1452
1484
  exports._isEnterToClickElement = _visualEditing._isEnterToClickElement;
1453
1485
  exports._isScrollable = _visualEditing._isScrollable;
1454
1486
  exports.containsOrEqualsElement = _visualEditing.containsOrEqualsElement;
1455
- exports.createColorTheme = _visualEditing.createColorTheme;
1456
- exports.hexToRgb = _visualEditing.hexToRgb;
1457
- exports.hslToRgb = _visualEditing.hslToRgb;
1458
1487
  exports.isHTMLAnchorElement = _visualEditing.isHTMLAnchorElement;
1459
1488
  exports.isHTMLButtonElement = _visualEditing.isHTMLButtonElement;
1460
1489
  exports.isHTMLElement = _visualEditing.isHTMLElement;
1461
1490
  exports.isHTMLInputElement = _visualEditing.isHTMLInputElement;
1462
1491
  exports.isHTMLSelectElement = _visualEditing.isHTMLSelectElement;
1463
1492
  exports.isHTMLTextAreaElement = _visualEditing.isHTMLTextAreaElement;
1464
- exports.multiply = _visualEditing.multiply;
1465
- exports.parseColor = _visualEditing.parseColor;
1466
- exports.rgbToHex = _visualEditing.rgbToHex;
1467
- exports.rgbToHsl = _visualEditing.rgbToHsl;
1468
- exports.rgba = _visualEditing.rgba;
1469
- exports.screen = _visualEditing.screen;
1470
1493
  exports.studioTheme = _visualEditing.studioTheme;
1471
1494
  exports.useArrayProp = _visualEditing.useArrayProp;
1472
1495
  exports.useBoundaryElement = _visualEditing.useBoundaryElement;
@@ -1507,6 +1530,7 @@ exports.ErrorBoundary = ErrorBoundary;
1507
1530
  exports.HeadingSkeleton = HeadingSkeleton;
1508
1531
  exports.LabelSkeleton = LabelSkeleton;
1509
1532
  exports.MenuButton = MenuButton;
1533
+ exports.RootClassNames = RootClassNames;
1510
1534
  exports.Skeleton = Skeleton;
1511
1535
  exports.StyleTags = StyleTags;
1512
1536
  exports.TabPanel = TabPanel;
@@ -1520,9 +1544,18 @@ exports._raf = _raf;
1520
1544
  exports._raf2 = _raf2;
1521
1545
  exports._responsive = _responsive;
1522
1546
  exports.attemptFocus = attemptFocus;
1547
+ exports.createColorTheme = createColorTheme;
1523
1548
  exports.focusFirstDescendant = focusFirstDescendant;
1524
1549
  exports.focusLastDescendant = focusLastDescendant;
1550
+ exports.hexToRgb = hexToRgb;
1551
+ exports.hslToRgb = hslToRgb;
1525
1552
  exports.isFocusable = isFocusable;
1553
+ exports.multiply = multiply;
1554
+ exports.parseColor = parseColor;
1555
+ exports.rgbToHex = rgbToHex;
1556
+ exports.rgbToHsl = rgbToHsl;
1557
+ exports.rgba = rgba;
1558
+ exports.screen = screen;
1526
1559
  exports.useClickOutside = useClickOutside;
1527
1560
  exports.useDialog = useDialog;
1528
1561
  exports.useElementRect = useElementRect;