@sanity/ui 2.8.1 → 2.8.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.esm.js +19 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +16 -7
- package/src/core/components/dialog/dialog.tsx +12 -9
- package/src/core/components/menu/menu.tsx +7 -1
package/dist/index.js
CHANGED
|
@@ -4977,8 +4977,8 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4977
4977
|
appearance: none;
|
|
4978
4978
|
margin: -4px;
|
|
4979
4979
|
`, Breadcrumbs = react.forwardRef(function(props, ref) {
|
|
4980
|
-
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = react.useState(!1),
|
|
4981
|
-
|
|
4980
|
+
const { children, maxLength, separator, space: spaceRaw = 2, ...restProps } = props, space = useArrayProp(spaceRaw), [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
|
|
4981
|
+
useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
|
|
4982
4982
|
const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
|
|
4983
4983
|
const len = rawItems.length;
|
|
4984
4984
|
if (maxLength && len > maxLength) {
|
|
@@ -4993,7 +4993,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4993
4993
|
open,
|
|
4994
4994
|
placement: "top",
|
|
4995
4995
|
portal: !0,
|
|
4996
|
-
ref:
|
|
4996
|
+
ref: popoverElementRef,
|
|
4997
4997
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4998
4998
|
ExpandButton,
|
|
4999
4999
|
{
|
|
@@ -5001,7 +5001,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
5001
5001
|
mode: "bleed",
|
|
5002
5002
|
onClick: open ? collapse : expand,
|
|
5003
5003
|
padding: 1,
|
|
5004
|
-
ref:
|
|
5004
|
+
ref: expandElementRef,
|
|
5005
5005
|
selected: open,
|
|
5006
5006
|
text: "\u2026"
|
|
5007
5007
|
}
|
|
@@ -5143,11 +5143,14 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5143
5143
|
[boundaryElement, isTopLayer, onClose, portalElement]
|
|
5144
5144
|
)
|
|
5145
5145
|
), useClickOutside(
|
|
5146
|
-
(
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5146
|
+
react.useCallback(
|
|
5147
|
+
(event) => {
|
|
5148
|
+
if (!isTopLayer || !onClickOutside) return;
|
|
5149
|
+
const target = event.target;
|
|
5150
|
+
target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
|
|
5151
|
+
},
|
|
5152
|
+
[boundaryElement, isTopLayer, onClickOutside, portalElement]
|
|
5153
|
+
),
|
|
5151
5154
|
[rootElement]
|
|
5152
5155
|
);
|
|
5153
5156
|
const setRef = react.useCallback((el) => {
|
|
@@ -5484,7 +5487,13 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5484
5487
|
);
|
|
5485
5488
|
react.useEffect(() => {
|
|
5486
5489
|
onItemSelect && onItemSelect(activeIndex);
|
|
5487
|
-
}, [activeIndex, onItemSelect]), useClickOutside(
|
|
5490
|
+
}, [activeIndex, onItemSelect]), useClickOutside(
|
|
5491
|
+
react.useCallback(
|
|
5492
|
+
(event) => isTopLayer && onClickOutside && onClickOutside(event),
|
|
5493
|
+
[isTopLayer, onClickOutside]
|
|
5494
|
+
),
|
|
5495
|
+
[rootElement]
|
|
5496
|
+
), useGlobalKeyDown(
|
|
5488
5497
|
react.useCallback(
|
|
5489
5498
|
(event) => {
|
|
5490
5499
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|