@7shifts/sous-chef 4.5.0 → 4.5.1
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.js +46 -18
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +40 -15
- package/dist/index.modern.js.map +1 -1
- package/dist/overlay/DropdownList/domain.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -11442,17 +11442,25 @@ const DropdownSubmenu = forwardRef(({
|
|
|
11442
11442
|
left: -9999,
|
|
11443
11443
|
visibility: 'hidden'
|
|
11444
11444
|
};
|
|
11445
|
-
return
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11445
|
+
return (
|
|
11446
|
+
// Stop clicks on submenu content (e.g. form inputs) from bubbling
|
|
11447
|
+
// up to the parent DropdownListItem, which would otherwise close
|
|
11448
|
+
// the dropdown. The click handler is purely a propagation guard,
|
|
11449
|
+
// so no keyboard handler is needed.
|
|
11450
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
11451
|
+
React__default.createElement("div", {
|
|
11452
|
+
className: styles$1g['dropdown-submenu'],
|
|
11453
|
+
"data-submenu-direction": direction,
|
|
11454
|
+
style: position || DEFAULT_POSITION,
|
|
11455
|
+
onMouseEnter: openSubmenu,
|
|
11456
|
+
onFocus: openSubmenu,
|
|
11457
|
+
onMouseDown: e => e.stopPropagation(),
|
|
11458
|
+
onClick: e => e.stopPropagation(),
|
|
11459
|
+
role: "menu",
|
|
11460
|
+
tabIndex: -1,
|
|
11461
|
+
ref: ref
|
|
11462
|
+
}, children)
|
|
11463
|
+
);
|
|
11456
11464
|
});
|
|
11457
11465
|
|
|
11458
11466
|
const useSubmenu = ({
|
|
@@ -11604,6 +11612,16 @@ const DropdownListItem = ({
|
|
|
11604
11612
|
}
|
|
11605
11613
|
};
|
|
11606
11614
|
const handleClick = e => {
|
|
11615
|
+
// Keyboard events can bubble up from form controls rendered inside a
|
|
11616
|
+
// submenu. Ignore them so typing in a form doesn't activate the item
|
|
11617
|
+
// (or its submenu). Only Enter/Space should activate the item itself.
|
|
11618
|
+
if ('key' in e) {
|
|
11619
|
+
const target = e.target;
|
|
11620
|
+
const isFromFormControl = target.closest('input, textarea, select, [contenteditable="true"]') !== null;
|
|
11621
|
+
if (isFromFormControl || e.key !== 'Enter' && e.key !== ' ') {
|
|
11622
|
+
return;
|
|
11623
|
+
}
|
|
11624
|
+
}
|
|
11607
11625
|
e.stopPropagation();
|
|
11608
11626
|
if (disabled) {
|
|
11609
11627
|
return;
|
|
@@ -11616,7 +11634,6 @@ const DropdownListItem = ({
|
|
|
11616
11634
|
return;
|
|
11617
11635
|
} else {
|
|
11618
11636
|
notifySubmenuOpened();
|
|
11619
|
-
return;
|
|
11620
11637
|
}
|
|
11621
11638
|
}
|
|
11622
11639
|
if (!_isSelectable) {
|
|
@@ -11735,6 +11752,7 @@ const canInteractWithItem = child => {
|
|
|
11735
11752
|
}
|
|
11736
11753
|
return !child.props.disabled || false;
|
|
11737
11754
|
};
|
|
11755
|
+
const isDivider = child => getItemType(child) === 'DropdownListDivider';
|
|
11738
11756
|
const getItemType = child => {
|
|
11739
11757
|
const isDropdownListDivider = checkIsComponent(child, {
|
|
11740
11758
|
component: DropdownListDivider,
|
|
@@ -11774,6 +11792,7 @@ const DropdownList = ({
|
|
|
11774
11792
|
}
|
|
11775
11793
|
return {
|
|
11776
11794
|
disabled: !canInteractWithItem(child),
|
|
11795
|
+
divider: isDivider(child),
|
|
11777
11796
|
onClick: child.props.onClick,
|
|
11778
11797
|
href: child.props.href,
|
|
11779
11798
|
submenu: child.props.submenu
|
|
@@ -11816,13 +11835,19 @@ const DropdownList = ({
|
|
|
11816
11835
|
"data-testid": testId,
|
|
11817
11836
|
ref: listRef
|
|
11818
11837
|
}, React__default.Children.toArray(children).filter(Boolean).map((child, index) => {
|
|
11838
|
+
var _items$index, _items$index2;
|
|
11839
|
+
// A stale `focusedItem` index can drift onto a divider when
|
|
11840
|
+
// the list re-renders with different items, so gate the
|
|
11841
|
+
// highlight on the row being interactive (never a divider).
|
|
11842
|
+
const isInteractive = !((_items$index = items[index]) != null && _items$index.disabled);
|
|
11843
|
+
const divider = (_items$index2 = items[index]) == null ? void 0 : _items$index2.divider;
|
|
11819
11844
|
return React__default.createElement("li", {
|
|
11820
11845
|
key: index,
|
|
11821
11846
|
className: classnames(styles$1j['dropdown-list__item'], {
|
|
11822
|
-
[styles$1j['dropdown-list__item--hover']]: focusedItem === index
|
|
11847
|
+
[styles$1j['dropdown-list__item--hover']]: focusedItem === index && isInteractive
|
|
11823
11848
|
}),
|
|
11824
|
-
onMouseEnter: () => setFocusOnItem(index),
|
|
11825
|
-
role:
|
|
11849
|
+
onMouseEnter: divider ? undefined : () => setFocusOnItem(index),
|
|
11850
|
+
role: divider ? 'separator' : 'menuitem'
|
|
11826
11851
|
}, child);
|
|
11827
11852
|
}));
|
|
11828
11853
|
};
|