@mmb-digital/ds-lilly 0.10.36 → 0.10.38
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/ds-lilly.js +16 -4
- package/package.json +1 -1
package/dist/ds-lilly.js
CHANGED
|
@@ -98729,6 +98729,9 @@ var Dropdown2 = function (_a) {
|
|
|
98729
98729
|
var arrayNodes = toArray(nodes);
|
|
98730
98730
|
return arrayNodes.reduce(function (acc, current) {
|
|
98731
98731
|
var _a, _b;
|
|
98732
|
+
if (Array.isArray(current)) {
|
|
98733
|
+
getMenuItems(current).forEach(function (child) { return acc.push(child); });
|
|
98734
|
+
}
|
|
98732
98735
|
if (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.isValidElement(current)) {
|
|
98733
98736
|
if (current.type === Dropdown2Item || current.type === Dropdown2Divider) {
|
|
98734
98737
|
acc.push(current);
|
|
@@ -98752,7 +98755,7 @@ var Dropdown2 = function (_a) {
|
|
|
98752
98755
|
tooltipRef.current = ref;
|
|
98753
98756
|
setTooltipRef(ref);
|
|
98754
98757
|
};
|
|
98755
|
-
var isItemDisabled = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (item) { var _a
|
|
98758
|
+
var isItemDisabled = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (item) { var _a; return ((_a = item === null || item === void 0 ? void 0 : item.props) === null || _a === void 0 ? void 0 : _a.isDisabled) === true || item.type !== Dropdown2Item; }, []);
|
|
98756
98759
|
var detectSelectedItemIndex = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function () {
|
|
98757
98760
|
return menuItems.reduce(function (acc, item, index) {
|
|
98758
98761
|
var _a;
|
|
@@ -98763,6 +98766,7 @@ var Dropdown2 = function (_a) {
|
|
|
98763
98766
|
}, undefined);
|
|
98764
98767
|
}, [menuItems]);
|
|
98765
98768
|
var getNextActiveItemIndex = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (fromIndex) {
|
|
98769
|
+
if (fromIndex === void 0) { fromIndex = 0; }
|
|
98766
98770
|
return menuItems.reduce(function (acc, item, index) {
|
|
98767
98771
|
if (acc === undefined && index > fromIndex && !isItemDisabled(item)) {
|
|
98768
98772
|
acc = index;
|
|
@@ -98794,7 +98798,7 @@ var Dropdown2 = function (_a) {
|
|
|
98794
98798
|
onScrollToEnd && onScrollToEnd();
|
|
98795
98799
|
}
|
|
98796
98800
|
};
|
|
98797
|
-
var
|
|
98801
|
+
var handleKeyDown = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (event) {
|
|
98798
98802
|
var key = event.key;
|
|
98799
98803
|
switch (key) {
|
|
98800
98804
|
case KEYS.Tab:
|
|
@@ -98834,6 +98838,13 @@ var Dropdown2 = function (_a) {
|
|
|
98834
98838
|
event.preventDefault();
|
|
98835
98839
|
setFocusedItemIndex(menuItems.length - 1);
|
|
98836
98840
|
break;
|
|
98841
|
+
case KEYS.Enter:
|
|
98842
|
+
case KEYS.Space:
|
|
98843
|
+
event.preventDefault();
|
|
98844
|
+
var menuItem = menuItems[focusedItemIndex];
|
|
98845
|
+
if (menuItem && menuItem.props.onKeyDown) {
|
|
98846
|
+
menuItem.props.onKeyDown(event);
|
|
98847
|
+
}
|
|
98837
98848
|
}
|
|
98838
98849
|
}, [
|
|
98839
98850
|
visible,
|
|
@@ -98850,7 +98861,7 @@ var Dropdown2 = function (_a) {
|
|
|
98850
98861
|
'aria-haspopup': true,
|
|
98851
98862
|
'aria-controls': forceDropdownId,
|
|
98852
98863
|
'aria-expanded': false,
|
|
98853
|
-
|
|
98864
|
+
onKeyDown: handleKeyDown
|
|
98854
98865
|
};
|
|
98855
98866
|
if (visible) {
|
|
98856
98867
|
triggerComponentProps['aria-expanded'] = true;
|
|
@@ -98879,13 +98890,14 @@ var Dropdown2 = function (_a) {
|
|
|
98879
98890
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", Dropdown2_assign({ ref: setRef, "data-testid": testId }, getTooltipProps({
|
|
98880
98891
|
className: classBinder_cx('c-dropdown', { 'c-dropdown--fullWidth': hasSameWidthAsTrigger }, theme)
|
|
98881
98892
|
}), { onBlur: onBlur, onScroll: handleScroll }),
|
|
98882
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("ul", { ref: menuRef, "aria-activedescendant": focusedItemIndex !== -1 ? forceDropdownId + "-menuItem-" + focusedItemIndex : '', "aria-hidden": false, "aria-multiselectable": false, className: classBinder_cx('c-dropdown__menu', theme), "data-testid": testId, id: forceDropdownId, role: "listbox", tabIndex: 0, onBlur: onBlur,
|
|
98893
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("ul", { ref: menuRef, "aria-activedescendant": focusedItemIndex !== -1 ? forceDropdownId + "-menuItem-" + focusedItemIndex : '', "aria-hidden": false, "aria-multiselectable": false, className: classBinder_cx('c-dropdown__menu', theme), "data-testid": testId, id: forceDropdownId, role: "listbox", tabIndex: 0, onBlur: onBlur, onKeyDown: handleKeyDown }, menuItems.map(function (menuItem, index) {
|
|
98883
98894
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98884
98895
|
// @ts-ignore
|
|
98885
98896
|
return Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["cloneElement"])(menuItem, {
|
|
98886
98897
|
key: "menuItem-" + index,
|
|
98887
98898
|
id: forceDropdownId + "-menuItem-" + index,
|
|
98888
98899
|
isFocused: focusedItemIndex === index,
|
|
98900
|
+
onKeyDown: handleKeyDown,
|
|
98889
98901
|
onMouseOver: function () { return setFocusedItemIndex(index); }
|
|
98890
98902
|
});
|
|
98891
98903
|
}))),
|