@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
43 lines • 1.35 kB
JavaScript
import { traverseItems } from './create-items-tree';
export const isItemGroup = (item) => item && item.items !== undefined;
export const isLinkItem = (item) => item && item.href !== undefined;
export const isCheckboxItem = (item) => item && item.itemType === 'checkbox';
export const getItemTarget = (item) => (item.external ? '_blank' : undefined);
export function indexIncludes(source, target) {
for (let index = 0; index < source.length; index++) {
if (source[index] !== target[index]) {
return false;
}
}
return true;
}
export function indexEquals(left, right) {
if (left.length !== right.length) {
return false;
}
for (let index = 0; index < left.length; index++) {
if (left[index] !== right[index]) {
return false;
}
}
return true;
}
export function hasCheckboxItems(items) {
let hasCheckboxItems = false;
traverseItems(items, item => {
if (item.itemType === 'checkbox') {
hasCheckboxItems = true;
}
});
return hasCheckboxItems;
}
export function hasDisabledReasonItems(items) {
let hasDisabledReasons = false;
traverseItems(items, item => {
if (item.disabledReason) {
hasDisabledReasons = true;
}
});
return hasDisabledReasons;
}
//# sourceMappingURL=utils.js.map