@sanity/ui 2.1.3-canary.0 → 2.1.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.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +10 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +29 -27
- package/src/core/components/menu/menuContext.ts +2 -5
- package/src/core/components/toast/toastContext.ts +2 -5
- package/src/core/components/tree/treeContext.ts +2 -5
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +3 -6
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +5 -6
- package/src/core/utils/layer/layerContext.ts +2 -5
- package/src/core/utils/portal/portalContext.ts +2 -4
package/dist/index.js
CHANGED
|
@@ -2818,9 +2818,10 @@ const Root$k = styledComponents.styled.div(
|
|
|
2818
2818
|
/* @__PURE__ */ jsxRuntime.jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: strokeWidth * 2 }),
|
|
2819
2819
|
/* @__PURE__ */ jsxRuntime.jsx(ShapePath, { d: fillPath })
|
|
2820
2820
|
] }) });
|
|
2821
|
-
}), key$7 = Symbol.for("@sanity/ui/context/boundaryElement")
|
|
2822
|
-
|
|
2823
|
-
|
|
2821
|
+
}), key$7 = Symbol.for("@sanity/ui/context/boundaryElement"), BoundaryElementContext = createGlobalScopedContext(
|
|
2822
|
+
key$7,
|
|
2823
|
+
null
|
|
2824
|
+
);
|
|
2824
2825
|
function BoundaryElementProvider(props) {
|
|
2825
2826
|
const { children, element } = props, value = react.useMemo(() => ({ version: 0, element }), [element]);
|
|
2826
2827
|
return /* @__PURE__ */ jsxRuntime.jsx(BoundaryElementContext.Provider, { value, children });
|
|
@@ -2908,9 +2909,7 @@ function getLayerContext(contextValue) {
|
|
|
2908
2909
|
return contextValue;
|
|
2909
2910
|
throw new Error("could not get layer context");
|
|
2910
2911
|
}
|
|
2911
|
-
const key$6 = Symbol.for("@sanity/ui/context/layer");
|
|
2912
|
-
globalScope[key$6] = globalScope[key$6] || react.createContext(null);
|
|
2913
|
-
const LayerContext = globalScope[key$6];
|
|
2912
|
+
const key$6 = Symbol.for("@sanity/ui/context/layer"), LayerContext = createGlobalScopedContext(key$6, null);
|
|
2914
2913
|
function useLayer() {
|
|
2915
2914
|
const value = react.useContext(LayerContext);
|
|
2916
2915
|
if (!value)
|
|
@@ -3064,9 +3063,7 @@ const defaultContextValue = {
|
|
|
3064
3063
|
get element() {
|
|
3065
3064
|
return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
|
|
3066
3065
|
}
|
|
3067
|
-
};
|
|
3068
|
-
globalScope[key$5] = globalScope[key$5] || react.createContext(defaultContextValue);
|
|
3069
|
-
const PortalContext = globalScope[key$5];
|
|
3066
|
+
}, PortalContext = createGlobalScopedContext(key$5, defaultContextValue);
|
|
3070
3067
|
function usePortal() {
|
|
3071
3068
|
const value = react.useContext(PortalContext);
|
|
3072
3069
|
if (!value)
|
|
@@ -4321,9 +4318,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4321
4318
|
})
|
|
4322
4319
|
);
|
|
4323
4320
|
TooltipCard.displayName = "TooltipCard";
|
|
4324
|
-
const key$4 = Symbol.for("@sanity/ui/context/tooltipDelayGroup");
|
|
4325
|
-
globalScope[key$4] = globalScope[key$4] || react.createContext(null);
|
|
4326
|
-
const TooltipDelayGroupContext = globalScope[key$4];
|
|
4321
|
+
const key$4 = Symbol.for("@sanity/ui/context/tooltipDelayGroup"), TooltipDelayGroupContext = createGlobalScopedContext(key$4, null);
|
|
4327
4322
|
function useTooltipDelayGroup() {
|
|
4328
4323
|
return react.useContext(TooltipDelayGroupContext);
|
|
4329
4324
|
}
|
|
@@ -5295,9 +5290,7 @@ const Root$6 = styledComponents.styled.kbd`
|
|
|
5295
5290
|
`, Hotkeys = react.forwardRef(function(props, ref) {
|
|
5296
5291
|
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
|
|
5297
5292
|
return !keys || keys.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : /* @__PURE__ */ jsxRuntime.jsx(Root$6, { "data-ui": "Hotkeys", ...restProps, ref, children: /* @__PURE__ */ jsxRuntime.jsx(Inline, { as: "span", space, children: keys.map((key2, i) => /* @__PURE__ */ jsxRuntime.jsx(Key, { fontSize: fontSize2, padding, radius, children: key2 }, i)) }) });
|
|
5298
|
-
}), key$2 = Symbol.for("@sanity/ui/context/menu");
|
|
5299
|
-
globalScope[key$2] = globalScope[key$2] || react.createContext(null);
|
|
5300
|
-
const MenuContext = globalScope[key$2];
|
|
5293
|
+
}), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
|
|
5301
5294
|
function _isFocusable(element) {
|
|
5302
5295
|
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
5303
5296
|
}
|
|
@@ -6234,9 +6227,7 @@ function useMounted() {
|
|
|
6234
6227
|
);
|
|
6235
6228
|
}
|
|
6236
6229
|
const subscribe = () => () => {
|
|
6237
|
-
}, key$1 = Symbol.for("@sanity/ui/context/toast")
|
|
6238
|
-
globalScope[key$1] = globalScope[key$1] || react.createContext(null);
|
|
6239
|
-
const ToastContext = globalScope[key$1], Root$1 = styledComponents.styled(Layer)`
|
|
6230
|
+
}, key$1 = Symbol.for("@sanity/ui/context/toast"), ToastContext = createGlobalScopedContext(key$1, null), Root$1 = styledComponents.styled(Layer)`
|
|
6240
6231
|
position: fixed;
|
|
6241
6232
|
top: 0;
|
|
6242
6233
|
left: 0;
|
|
@@ -6394,9 +6385,7 @@ function _focusItemElement(el) {
|
|
|
6394
6385
|
firstChild && firstChild instanceof HTMLElement && firstChild.focus();
|
|
6395
6386
|
}
|
|
6396
6387
|
}
|
|
6397
|
-
const key = Symbol.for("@sanity/ui/context/tree")
|
|
6398
|
-
globalScope[key] = globalScope[key] || react.createContext(null);
|
|
6399
|
-
const TreeContext = globalScope[key], Tree = react.memo(
|
|
6388
|
+
const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalScopedContext(key, null), Tree = react.memo(
|
|
6400
6389
|
react.forwardRef(function(props, ref) {
|
|
6401
6390
|
const { children, space = 1, onFocus, ...restProps } = props, forwardedRef = useForwardedRef(ref), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement), path = react.useMemo(() => [], []), [itemElements, setItemElements] = react.useState([]), [state, setState] = react.useState({}), stateRef = react.useRef(state);
|
|
6402
6391
|
react.useEffect(() => {
|