@sanity/ui 3.0.0-static.31 → 3.0.0-static.32

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 (35) hide show
  1. package/dist/_chunks-cjs/_visual-editing.cjs +49 -47
  2. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.js +49 -47
  4. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  5. package/dist/css/index.cjs +1 -3
  6. package/dist/css/index.cjs.map +1 -1
  7. package/dist/css/index.css +1 -1
  8. package/dist/css/index.d.cts +1 -1
  9. package/dist/css/index.d.ts +1 -1
  10. package/dist/css/index.js +1 -3
  11. package/dist/css/index.js.map +1 -1
  12. package/dist/index.cjs +80 -79
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +82 -81
  17. package/dist/index.js.map +1 -1
  18. package/package.json +1 -1
  19. package/src/core/{primitives/root/Root.tsx → Root.tsx} +5 -3
  20. package/src/core/{primitives/root/RootProvider.tsx → RootProvider.tsx} +5 -5
  21. package/src/core/__workshop__/boundary.tsx +28 -0
  22. package/src/core/__workshop__/index.ts +14 -0
  23. package/src/core/index.ts +4 -2
  24. package/src/core/primitives/card/card.tsx +4 -3
  25. package/src/core/primitives/card/useCard.ts +8 -2
  26. package/src/core/primitives/grid/types.ts +1 -1
  27. package/src/core/primitives/popover/popover.tsx +1 -4
  28. package/src/core/primitives/tooltip/tooltip.tsx +1 -4
  29. package/src/core/utils/portal/portal.tsx +1 -5
  30. package/src/css/components/toast/toast.css.ts +2 -2
  31. package/src/css/primitives/root/root.css.ts +5 -1
  32. package/src/css/primitives/root/root.ts +1 -1
  33. package/src/css/props/gridColumnStart/types.ts +1 -1
  34. package/src/core/primitives/root/__workshop__/boundary.tsx +0 -5
  35. package/src/core/primitives/root/__workshop__/index.ts +0 -8
package/dist/index.d.cts CHANGED
@@ -3018,7 +3018,7 @@ export declare function useArrayProp<T>(val: T | T[] | undefined, defaultVal?: T
3018
3018
  export declare function useBoundaryElement(): BoundaryElementContextValue
3019
3019
 
3020
3020
  /** @public */
3021
- export declare function useCard(): CardContextValue | null
3021
+ export declare function useCard(): CardContextValue
3022
3022
 
3023
3023
  /**
3024
3024
  * @public
package/dist/index.d.ts CHANGED
@@ -3018,7 +3018,7 @@ export declare function useArrayProp<T>(val: T | T[] | undefined, defaultVal?: T
3018
3018
  export declare function useBoundaryElement(): BoundaryElementContextValue
3019
3019
 
3020
3020
  /** @public */
3021
- export declare function useCard(): CardContextValue | null
3021
+ export declare function useCard(): CardContextValue
3022
3022
 
3023
3023
  /**
3024
3024
  * @public
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1 } from "@sanity/ui/theme";
2
- import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, _isEnterToClickElement, Selectable, Text, useResponsiveProp, EMPTY_ARRAY, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Card, createGlobalScopedContext, usePrefersReducedMotion, Portal, Z_OFFSETS, Layer, Grid, LayerProvider, isRecord, _getArrayProp, useCustomValidity, BoundaryElementContext, CardProvider, PortalProvider, useDelayedState, TooltipDelayGroupContext } from "./_chunks-es/_visual-editing.js";
2
+ import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, _isEnterToClickElement, Selectable, Text, useResponsiveProp, EMPTY_ARRAY, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Card, createGlobalScopedContext, usePrefersReducedMotion, Portal, Z_OFFSETS, Layer, Grid, LayerProvider, isRecord, _getArrayProp, useCustomValidity, useDelayedState, TooltipDelayGroupContext, BoundaryElementContext, CardProvider, PortalProvider } from "./_chunks-es/_visual-editing.js";
3
3
  import { Arrow, DEFAULT_ARROW_ELEMENT, DEFAULT_BOX_ELEMENT, DEFAULT_BUTTON_ELEMENT, DEFAULT_CARD_ELEMENT, DEFAULT_FLEX_ELEMENT, DEFAULT_GRID_ELEMENT, DEFAULT_HOTKEYS_ELEMENT, DEFAULT_KBD_ELEMENT, DEFAULT_LAYER_ELEMENT, DEFAULT_MENU_DIVIDER_ELEMENT, DEFAULT_MENU_ELEMENT, DEFAULT_MENU_GROUP_ELEMENT, DEFAULT_MENU_ITEM_ELEMENT, DEFAULT_POPOVER_ELEMENT, DEFAULT_SELECTABLE_ELEMENT, DEFAULT_SPINNER_ELEMENT, DEFAULT_STACK_ELEMENT, DEFAULT_TAB_ELEMENT, DEFAULT_TAB_LIST_ELEMENT, DEFAULT_TEXT_ELEMENT, DEFAULT_TEXT_INPUT_ELEMENT, DEFAULT_TOOLTIP_ELEMENT, Hotkeys, KBD, Menu, MenuDivider, MenuGroup, MenuItem, Spinner, Tab, TabList, ThemeColorProvider, ThemeProvider, Tooltip, _getResponsiveProp, useCard, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTheme_v2, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.js";
4
4
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
5
5
  import { ChevronDownIcon, CloseIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
6
6
  import { useReducer, useCallback, useRef, useImperativeHandle, useMemo, useEffect, cloneElement, useState, Children, isValidElement, Fragment, useContext, useSyncExternalStore, startTransition, memo, useId, lazy, Suspense, Component } from "react";
7
7
  import { c } from "react/compiler-runtime";
8
- import { breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, toast, toastLayer, treeItem, vars, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, box, root, select, _inputElement, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, BREAKPOINTS } from "@sanity/ui/css";
8
+ import { breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, toast, toastLayer, treeItem, vars, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, _inputElement, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, BREAKPOINTS, box, root } from "@sanity/ui/css";
9
9
  import { px, rem } from "@sanity/ui/css";
10
10
  import { motion, AnimatePresence } from "framer-motion";
11
11
  import { ResizeObserver } from "@juggle/resize-observer";
@@ -1858,85 +1858,6 @@ function Radio(props) {
1858
1858
  t9
1859
1859
  ] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
1860
1860
  }
1861
- function BoundaryElementProvider(props) {
1862
- const $ = c(5), {
1863
- children,
1864
- element
1865
- } = props;
1866
- let t0, t1;
1867
- $[0] !== element ? (t1 = {
1868
- version: 0,
1869
- element
1870
- }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
1871
- const value = t0;
1872
- let t2;
1873
- return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
1874
- }
1875
- function RootProvider(props) {
1876
- const $ = c(10), {
1877
- boundaryElement: t0,
1878
- children,
1879
- portalElement: t1,
1880
- scheme: t2,
1881
- tone: t3
1882
- } = props, boundaryElement = t0 === void 0 ? null : t0, portalElement = t1 === void 0 ? null : t1, scheme = t2 === void 0 ? "light" : t2, tone = t3 === void 0 ? "transparent" : t3;
1883
- let t4;
1884
- $[0] !== children || $[1] !== portalElement ? (t4 = /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children }), $[0] = children, $[1] = portalElement, $[2] = t4) : t4 = $[2];
1885
- let t5;
1886
- $[3] !== boundaryElement || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(BoundaryElementProvider, { element: boundaryElement, children: t4 }) }), $[3] = boundaryElement, $[4] = t4, $[5] = t5) : t5 = $[5];
1887
- let t6;
1888
- return $[6] !== scheme || $[7] !== t5 || $[8] !== tone ? (t6 = /* @__PURE__ */ jsx(LayerProvider, { children: /* @__PURE__ */ jsx(CardProvider, { scheme, tone, children: t5 }) }), $[6] = scheme, $[7] = t5, $[8] = tone, $[9] = t6) : t6 = $[9], t6;
1889
- }
1890
- const DEFAULT_ROOT_ELEMENT = "html";
1891
- function Root(props) {
1892
- const $ = c(33), t0 = props;
1893
- let children, className, forwardedRef, rest, t1, t2, t3, t4;
1894
- $[0] !== t0 ? ({
1895
- as: t1,
1896
- children,
1897
- className,
1898
- height: t2,
1899
- ref: forwardedRef,
1900
- scheme: t3,
1901
- tone: t4,
1902
- ...rest
1903
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = forwardedRef, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4) : (children = $[1], className = $[2], forwardedRef = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8]);
1904
- const as = t1 === void 0 ? DEFAULT_ROOT_ELEMENT : t1, height = t2 === void 0 ? "fill" : t2, scheme = t3 === void 0 ? "light" : t3, tone = t4 === void 0 ? "transparent" : t4, ref = useRef(null);
1905
- let t5;
1906
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[9] = t5) : t5 = $[9], useImperativeHandle(forwardedRef, t5);
1907
- const [portalElement, setPortalElement] = useState(null), [boundaryElement, setBoundaryElement] = useState(null);
1908
- let t6;
1909
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (el) => {
1910
- setBoundaryElement(el), ref.current = el;
1911
- }, $[10] = t6) : t6 = $[10];
1912
- const handleRef = t6;
1913
- let t7;
1914
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t7 = /* @__PURE__ */ jsx("div", { "data-portal": "", ref: setPortalElement }), $[11] = t7) : t7 = $[11];
1915
- let t8;
1916
- $[12] !== boundaryElement || $[13] !== children || $[14] !== portalElement || $[15] !== scheme || $[16] !== tone ? (t8 = /* @__PURE__ */ jsxs(RootProvider, { boundaryElement, portalElement, scheme, tone, children: [
1917
- children,
1918
- t7
1919
- ] }), $[12] = boundaryElement, $[13] = children, $[14] = portalElement, $[15] = scheme, $[16] = tone, $[17] = t8) : t8 = $[17];
1920
- let node = t8;
1921
- if (as === "html") {
1922
- let t92;
1923
- $[18] !== height ? (t92 = box({
1924
- height,
1925
- margin: 0
1926
- }), $[18] = height, $[19] = t92) : t92 = $[19];
1927
- let t102;
1928
- $[20] !== node || $[21] !== t92 ? (t102 = /* @__PURE__ */ jsx("body", { className: t92, children: node }), $[20] = node, $[21] = t92, $[22] = t102) : t102 = $[22], node = t102;
1929
- }
1930
- let t9;
1931
- $[23] !== className || $[24] !== height || $[25] !== scheme || $[26] !== tone ? (t9 = root({
1932
- className,
1933
- height,
1934
- scheme,
1935
- tone
1936
- }), $[23] = className, $[24] = height, $[25] = scheme, $[26] = tone, $[27] = t9) : t9 = $[27];
1937
- let t10;
1938
- return $[28] !== as || $[29] !== node || $[30] !== rest || $[31] !== t9 ? (t10 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Root", ...rest, className: t9, ref: handleRef, children: node }), $[28] = as, $[29] = node, $[30] = rest, $[31] = t9, $[32] = t10) : t10 = $[32], t10;
1939
- }
1940
1861
  const DEFAULT_SELECT_ELEMENT = "select";
1941
1862
  function Select(props) {
1942
1863
  const $ = c(38), t0 = props;
@@ -2215,6 +2136,20 @@ function TooltipDelayGroupProvider(props) {
2215
2136
  let t3;
2216
2137
  return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
2217
2138
  }
2139
+ function BoundaryElementProvider(props) {
2140
+ const $ = c(5), {
2141
+ children,
2142
+ element
2143
+ } = props;
2144
+ let t0, t1;
2145
+ $[0] !== element ? (t1 = {
2146
+ version: 0,
2147
+ element
2148
+ }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
2149
+ const value = t0;
2150
+ let t2;
2151
+ return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
2152
+ }
2218
2153
  function findMaxBreakpoints(media, width) {
2219
2154
  const ret = [];
2220
2155
  for (let i = 0; i < media.length; i += 1)
@@ -2290,6 +2225,72 @@ class ErrorBoundary extends Component {
2290
2225
  return this.props.children;
2291
2226
  }
2292
2227
  }
2228
+ function RootProvider(props) {
2229
+ const $ = c(10), {
2230
+ boundaryElement: t0,
2231
+ children,
2232
+ portalElement: t1,
2233
+ scheme: t2,
2234
+ tone: t3
2235
+ } = props, boundaryElement = t0 === void 0 ? null : t0, portalElement = t1 === void 0 ? null : t1, scheme = t2 === void 0 ? "light" : t2, tone = t3 === void 0 ? "transparent" : t3;
2236
+ let t4;
2237
+ $[0] !== children || $[1] !== portalElement ? (t4 = /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children }), $[0] = children, $[1] = portalElement, $[2] = t4) : t4 = $[2];
2238
+ let t5;
2239
+ $[3] !== boundaryElement || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(BoundaryElementProvider, { element: boundaryElement, children: t4 }) }), $[3] = boundaryElement, $[4] = t4, $[5] = t5) : t5 = $[5];
2240
+ let t6;
2241
+ return $[6] !== scheme || $[7] !== t5 || $[8] !== tone ? (t6 = /* @__PURE__ */ jsx(LayerProvider, { children: /* @__PURE__ */ jsx(CardProvider, { scheme, tone, children: t5 }) }), $[6] = scheme, $[7] = t5, $[8] = tone, $[9] = t6) : t6 = $[9], t6;
2242
+ }
2243
+ const DEFAULT_ROOT_ELEMENT = "html";
2244
+ function Root(props) {
2245
+ const $ = c(35), t0 = props;
2246
+ let children, className, forwardedRef, height, rest, t1, t2, t3, t4;
2247
+ $[0] !== t0 ? ({
2248
+ as: t1,
2249
+ children,
2250
+ className,
2251
+ height,
2252
+ overflow: t2,
2253
+ ref: forwardedRef,
2254
+ scheme: t3,
2255
+ tone: t4,
2256
+ ...rest
2257
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = forwardedRef, $[4] = height, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4) : (children = $[1], className = $[2], forwardedRef = $[3], height = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9]);
2258
+ const as = t1 === void 0 ? DEFAULT_ROOT_ELEMENT : t1, overflow = t2 === void 0 ? "hidden" : t2, scheme = t3 === void 0 ? "light" : t3, tone = t4 === void 0 ? "transparent" : t4, ref = useRef(null);
2259
+ let t5;
2260
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[10] = t5) : t5 = $[10], useImperativeHandle(forwardedRef, t5);
2261
+ const [portalElement, setPortalElement] = useState(null), [boundaryElement, setBoundaryElement] = useState(null);
2262
+ let t6;
2263
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (el) => {
2264
+ setBoundaryElement(el), ref.current = el;
2265
+ }, $[11] = t6) : t6 = $[11];
2266
+ const handleRef = t6;
2267
+ let t7;
2268
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t7 = /* @__PURE__ */ jsx("div", { "data-portal": "", ref: setPortalElement }), $[12] = t7) : t7 = $[12];
2269
+ let t8;
2270
+ $[13] !== boundaryElement || $[14] !== children || $[15] !== portalElement || $[16] !== scheme || $[17] !== tone ? (t8 = /* @__PURE__ */ jsxs(RootProvider, { boundaryElement, portalElement, scheme, tone, children: [
2271
+ children,
2272
+ t7
2273
+ ] }), $[13] = boundaryElement, $[14] = children, $[15] = portalElement, $[16] = scheme, $[17] = tone, $[18] = t8) : t8 = $[18];
2274
+ let node = t8;
2275
+ if (as === "html") {
2276
+ let t92;
2277
+ $[19] !== height ? (t92 = box({
2278
+ height,
2279
+ margin: 0
2280
+ }), $[19] = height, $[20] = t92) : t92 = $[20];
2281
+ let t102;
2282
+ $[21] !== node || $[22] !== t92 ? (t102 = /* @__PURE__ */ jsx("body", { className: t92, children: node }), $[21] = node, $[22] = t92, $[23] = t102) : t102 = $[23], node = t102;
2283
+ }
2284
+ let t9;
2285
+ $[24] !== className || $[25] !== height || $[26] !== scheme || $[27] !== tone ? (t9 = root({
2286
+ className,
2287
+ height,
2288
+ scheme,
2289
+ tone
2290
+ }), $[24] = className, $[25] = height, $[26] = scheme, $[27] = tone, $[28] = t9) : t9 = $[28];
2291
+ let t10;
2292
+ return $[29] !== as || $[30] !== node || $[31] !== overflow || $[32] !== rest || $[33] !== t9 ? (t10 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Root", ...rest, className: t9, overflow, ref: handleRef, children: node }), $[29] = as, $[30] = node, $[31] = overflow, $[32] = rest, $[33] = t9, $[34] = t10) : t10 = $[34], t10;
2293
+ }
2293
2294
  export {
2294
2295
  Arrow,
2295
2296
  Autocomplete,