@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.js
CHANGED
|
@@ -11431,19 +11431,29 @@ var DropdownSubmenu = React.forwardRef(function (_ref, ref) {
|
|
|
11431
11431
|
left: -9999,
|
|
11432
11432
|
visibility: 'hidden'
|
|
11433
11433
|
};
|
|
11434
|
-
return
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11434
|
+
return (
|
|
11435
|
+
// Stop clicks on submenu content (e.g. form inputs) from bubbling
|
|
11436
|
+
// up to the parent DropdownListItem, which would otherwise close
|
|
11437
|
+
// the dropdown. The click handler is purely a propagation guard,
|
|
11438
|
+
// so no keyboard handler is needed.
|
|
11439
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
11440
|
+
React__default["default"].createElement("div", {
|
|
11441
|
+
className: styles$1g['dropdown-submenu'],
|
|
11442
|
+
"data-submenu-direction": direction,
|
|
11443
|
+
style: position || DEFAULT_POSITION,
|
|
11444
|
+
onMouseEnter: openSubmenu,
|
|
11445
|
+
onFocus: openSubmenu,
|
|
11446
|
+
onMouseDown: function onMouseDown(e) {
|
|
11447
|
+
return e.stopPropagation();
|
|
11448
|
+
},
|
|
11449
|
+
onClick: function onClick(e) {
|
|
11450
|
+
return e.stopPropagation();
|
|
11451
|
+
},
|
|
11452
|
+
role: "menu",
|
|
11453
|
+
tabIndex: -1,
|
|
11454
|
+
ref: ref
|
|
11455
|
+
}, children)
|
|
11456
|
+
);
|
|
11447
11457
|
});
|
|
11448
11458
|
|
|
11449
11459
|
var useSubmenu = function useSubmenu(_ref) {
|
|
@@ -11601,6 +11611,16 @@ var DropdownListItem = function DropdownListItem(_ref) {
|
|
|
11601
11611
|
}
|
|
11602
11612
|
};
|
|
11603
11613
|
var handleClick = function handleClick(e) {
|
|
11614
|
+
// Keyboard events can bubble up from form controls rendered inside a
|
|
11615
|
+
// submenu. Ignore them so typing in a form doesn't activate the item
|
|
11616
|
+
// (or its submenu). Only Enter/Space should activate the item itself.
|
|
11617
|
+
if ('key' in e) {
|
|
11618
|
+
var _target = e.target;
|
|
11619
|
+
var isFromFormControl = _target.closest('input, textarea, select, [contenteditable="true"]') !== null;
|
|
11620
|
+
if (isFromFormControl || e.key !== 'Enter' && e.key !== ' ') {
|
|
11621
|
+
return;
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11604
11624
|
e.stopPropagation();
|
|
11605
11625
|
if (disabled) {
|
|
11606
11626
|
return;
|
|
@@ -11613,7 +11633,6 @@ var DropdownListItem = function DropdownListItem(_ref) {
|
|
|
11613
11633
|
return;
|
|
11614
11634
|
} else {
|
|
11615
11635
|
notifySubmenuOpened();
|
|
11616
|
-
return;
|
|
11617
11636
|
}
|
|
11618
11637
|
}
|
|
11619
11638
|
if (!isSelectable) {
|
|
@@ -11730,6 +11749,9 @@ var canInteractWithItem = function canInteractWithItem(child) {
|
|
|
11730
11749
|
}
|
|
11731
11750
|
return !child.props.disabled || false;
|
|
11732
11751
|
};
|
|
11752
|
+
var isDivider = function isDivider(child) {
|
|
11753
|
+
return getItemType(child) === 'DropdownListDivider';
|
|
11754
|
+
};
|
|
11733
11755
|
var getItemType = function getItemType(child) {
|
|
11734
11756
|
var isDropdownListDivider = checkIsComponent(child, {
|
|
11735
11757
|
component: DropdownListDivider,
|
|
@@ -11767,6 +11789,7 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
11767
11789
|
}
|
|
11768
11790
|
return {
|
|
11769
11791
|
disabled: !canInteractWithItem(child),
|
|
11792
|
+
divider: isDivider(child),
|
|
11770
11793
|
onClick: child.props.onClick,
|
|
11771
11794
|
href: child.props.href,
|
|
11772
11795
|
submenu: child.props.submenu
|
|
@@ -11808,14 +11831,19 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
11808
11831
|
"data-testid": testId,
|
|
11809
11832
|
ref: listRef
|
|
11810
11833
|
}, React__default["default"].Children.toArray(children).filter(Boolean).map(function (child, index) {
|
|
11811
|
-
var _classNames;
|
|
11834
|
+
var _items$index, _items$index2, _classNames;
|
|
11835
|
+
// A stale `focusedItem` index can drift onto a divider when
|
|
11836
|
+
// the list re-renders with different items, so gate the
|
|
11837
|
+
// highlight on the row being interactive (never a divider).
|
|
11838
|
+
var isInteractive = !((_items$index = items[index]) != null && _items$index.disabled);
|
|
11839
|
+
var divider = (_items$index2 = items[index]) == null ? void 0 : _items$index2.divider;
|
|
11812
11840
|
return React__default["default"].createElement("li", {
|
|
11813
11841
|
key: index,
|
|
11814
|
-
className: classnames__default["default"](styles$1j['dropdown-list__item'], (_classNames = {}, _classNames[styles$1j['dropdown-list__item--hover']] = focusedItem === index, _classNames)),
|
|
11815
|
-
onMouseEnter: function
|
|
11842
|
+
className: classnames__default["default"](styles$1j['dropdown-list__item'], (_classNames = {}, _classNames[styles$1j['dropdown-list__item--hover']] = focusedItem === index && isInteractive, _classNames)),
|
|
11843
|
+
onMouseEnter: divider ? undefined : function () {
|
|
11816
11844
|
return setFocusOnItem(index);
|
|
11817
11845
|
},
|
|
11818
|
-
role:
|
|
11846
|
+
role: divider ? 'separator' : 'menuitem'
|
|
11819
11847
|
}, child);
|
|
11820
11848
|
}));
|
|
11821
11849
|
};
|