UNPKG

@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

20 lines 938 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 export function splitItems(maybeItems, splitIndex, activeId) { const items = maybeItems !== null && maybeItems !== void 0 ? maybeItems : []; const visibleItems = items.slice(0, splitIndex); const overflowItems = items.slice(splitIndex); if (overflowItems.length === 1) { return { visibleItems: items, overflowItems: [] }; } if (activeId && overflowItems.length > 0 && visibleItems.length > 0) { const activeInOverflow = overflowItems.find(item => item.id === activeId); if (activeInOverflow) { overflowItems.splice(overflowItems.indexOf(activeInOverflow), 1); overflowItems.unshift(visibleItems.pop()); visibleItems.push(activeInOverflow); } } return { visibleItems, overflowItems }; } //# sourceMappingURL=drawers-helpers.js.map