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

24 lines 1.17 kB
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React, { useContext } from 'react'; import generatedIcons from '../icon/generated/icons'; import { InternalIconContext } from './context'; function InternalIconProvider({ children, icons }) { const contextIcons = useContext(InternalIconContext); let iconsToProvide = generatedIcons; // Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations if (icons !== null) { const clonedIcons = { ...icons }; // Reset null icon values to their original definitions Object.keys(clonedIcons).forEach(name => { const iconName = name; if (iconName in generatedIcons && clonedIcons[iconName] === null) { clonedIcons[iconName] = generatedIcons[iconName]; } }); iconsToProvide = { ...contextIcons, ...clonedIcons }; } return React.createElement(InternalIconContext.Provider, { value: iconsToProvide }, children); } export default InternalIconProvider; //# sourceMappingURL=internal.js.map