UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

21 lines (20 loc) 913 B
export var isItemGroup = function (item) { return item && item.items !== undefined; }; export var isLinkItem = function (item) { return item && item.href !== undefined; }; export var getHighlightableItems = function (items, hasExpandableGroups, isInRestrictedView, expandedItem) { return (items !== null && items !== void 0 ? items : []).reduce(function (enabledItems, item) { if (item.disabled) { return enabledItems; } if (isItemGroup(item)) { if (hasExpandableGroups) { enabledItems.push(item); } if (!hasExpandableGroups || (isInRestrictedView && expandedItem === item)) { item.items.forEach(function (child) { return !child.disabled && enabledItems.push(child); }); } return enabledItems; } enabledItems.push(item); return enabledItems; }, []); };