@sanity/ui 2.8.2 → 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 +13 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +16 -7
- package/src/core/components/dialog/dialog.tsx +14 -18
package/dist/index.esm.js
CHANGED
|
@@ -4982,8 +4982,8 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4982
4982
|
appearance: none;
|
|
4983
4983
|
margin: -4px;
|
|
4984
4984
|
`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
4985
|
-
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1),
|
|
4986
|
-
|
|
4985
|
+
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
|
|
4986
|
+
useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
|
|
4987
4987
|
const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
|
|
4988
4988
|
const len = rawItems.length;
|
|
4989
4989
|
if (maxLength && len > maxLength) {
|
|
@@ -4998,7 +4998,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4998
4998
|
open,
|
|
4999
4999
|
placement: "top",
|
|
5000
5000
|
portal: !0,
|
|
5001
|
-
ref:
|
|
5001
|
+
ref: popoverElementRef,
|
|
5002
5002
|
children: /* @__PURE__ */ jsx(
|
|
5003
5003
|
ExpandButton,
|
|
5004
5004
|
{
|
|
@@ -5006,7 +5006,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
5006
5006
|
mode: "bleed",
|
|
5007
5007
|
onClick: open ? collapse : expand,
|
|
5008
5008
|
padding: 1,
|
|
5009
|
-
ref:
|
|
5009
|
+
ref: expandElementRef,
|
|
5010
5010
|
selected: open,
|
|
5011
5011
|
text: "\u2026"
|
|
5012
5012
|
}
|
|
@@ -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),
|
|
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
|
-
),
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
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(
|