@sanity/ui 2.8.3 → 2.8.4

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 CHANGED
@@ -5132,8 +5132,8 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
5132
5132
  scheme,
5133
5133
  shadow: shadowProp,
5134
5134
  width: widthProp
5135
- } = 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 = useRef(null), [rootElement, setRootElement] = useState(null), contentRef = useRef(null), layer = useLayer(), { isTopLayer } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
5136
- useImperativeHandle(forwardedRef, () => ref.current), useImperativeHandle(
5135
+ } = 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 = useRef(null), contentRef = useRef(null), layer = useLayer(), { isTopLayer } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
5136
+ return useImperativeHandle(forwardedRef, () => ref.current), useImperativeHandle(
5137
5137
  forwardedContentRef,
5138
5138
  () => contentRef.current
5139
5139
  ), useEffect(() => {
@@ -5147,21 +5147,13 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
5147
5147
  },
5148
5148
  [boundaryElement, isTopLayer, onClose, portalElement]
5149
5149
  )
5150
- ), useClickOutside(
5151
- useCallback(
5152
- (event) => {
5153
- if (!isTopLayer || !onClickOutside) return;
5154
- const target = event.target;
5155
- target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
5156
- },
5157
- [boundaryElement, isTopLayer, onClickOutside, portalElement]
5158
- ),
5159
- [rootElement]
5160
- );
5161
- const setRef = useCallback((el) => {
5162
- setRootElement(el), ref.current = el;
5163
- }, []);
5164
- return /* @__PURE__ */ jsx(DialogContainer, { "data-ui": "DialogCard", width, children: /* @__PURE__ */ jsx(DialogCardRoot, { radius, ref: setRef, scheme, shadow, children: /* @__PURE__ */ jsxs(DialogLayout, { direction: "column", children: [
5150
+ ), useClickOutsideEvent(
5151
+ isTopLayer && onClickOutside && ((event) => {
5152
+ const target = event.target;
5153
+ target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
5154
+ }),
5155
+ () => [ref.current]
5156
+ ), /* @__PURE__ */ jsx(DialogContainer, { "data-ui": "DialogCard", width, children: /* @__PURE__ */ jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: /* @__PURE__ */ jsxs(DialogLayout, { direction: "column", children: [
5165
5157
  showHeader && /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(Flex, { align: "center", padding: 3, children: [
5166
5158
  /* @__PURE__ */ jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
5167
5159
  showCloseButton && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(