@sanity/ui 2.8.3 → 2.8.5
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.esm.js +11 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/dialog/__workshop__/nested.tsx +12 -2
- package/src/core/components/dialog/dialog.tsx +14 -18
- package/src/core/hooks/useClickOutsideEvent.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ function useClickOutsideEvent(listener, elementsArg = () => EMPTY_ARRAY, boundar
|
|
|
188
188
|
return document.addEventListener("mousedown", handleEvent), () => {
|
|
189
189
|
document.removeEventListener("mousedown", handleEvent);
|
|
190
190
|
};
|
|
191
|
-
}, [hasListener, onEvent]);
|
|
191
|
+
}, [hasListener, onEvent]), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
192
192
|
}
|
|
193
193
|
function useCustomValidity(ref, customValidity) {
|
|
194
194
|
react.useEffect(() => {
|
|
@@ -5127,8 +5127,8 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5127
5127
|
scheme,
|
|
5128
5128
|
shadow: shadowProp,
|
|
5129
5129
|
width: widthProp
|
|
5130
|
-
} = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), width = useArrayProp(widthProp), ref = react.useRef(null),
|
|
5131
|
-
react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(
|
|
5130
|
+
} = props, portal = usePortal(), portalElement = portalProp ? ((_a = portal.elements) == null ? void 0 : _a[portalProp]) || null : portal.element, boundaryElement = useBoundaryElement().element, radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), width = useArrayProp(widthProp), ref = react.useRef(null), contentRef = react.useRef(null), layer = useLayer(), { isTopLayer } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
|
|
5131
|
+
return react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(
|
|
5132
5132
|
forwardedContentRef,
|
|
5133
5133
|
() => contentRef.current
|
|
5134
5134
|
), react.useEffect(() => {
|
|
@@ -5142,21 +5142,13 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5142
5142
|
},
|
|
5143
5143
|
[boundaryElement, isTopLayer, onClose, portalElement]
|
|
5144
5144
|
)
|
|
5145
|
-
),
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
[boundaryElement, isTopLayer, onClickOutside, portalElement]
|
|
5153
|
-
),
|
|
5154
|
-
[rootElement]
|
|
5155
|
-
);
|
|
5156
|
-
const setRef = react.useCallback((el) => {
|
|
5157
|
-
setRootElement(el), ref.current = el;
|
|
5158
|
-
}, []);
|
|
5159
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: /* @__PURE__ */ jsxRuntime.jsx(DialogCardRoot, { radius, ref: setRef, scheme, shadow, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogLayout, { direction: "column", children: [
|
|
5145
|
+
), useClickOutsideEvent(
|
|
5146
|
+
isTopLayer && onClickOutside && ((event) => {
|
|
5147
|
+
const target = event.target;
|
|
5148
|
+
target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
|
|
5149
|
+
}),
|
|
5150
|
+
() => [ref.current]
|
|
5151
|
+
), /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: /* @__PURE__ */ jsxRuntime.jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogLayout, { direction: "column", children: [
|
|
5160
5152
|
showHeader && /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "center", padding: 3, children: [
|
|
5161
5153
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
|
|
5162
5154
|
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|