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

39 lines 2.26 kB
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React from 'react'; import { useUniqueId } from '@awsui/component-toolkit/internal'; import { useFormFieldContext } from '../contexts/form-field'; import DropdownFooter from '../internal/components/dropdown-footer'; import ScreenreaderOnly from '../internal/components/screenreader-only'; import PlainList from '../select/parts/plain-list'; import VirtualList from '../select/parts/virtual-list'; import { useMultiselect } from './use-multiselect'; import styles from './styles.css.js'; const EmbeddedMultiselect = React.forwardRef(({ options, filteringType, ariaLabel, selectedOptions, deselectAriaLabel, virtualScroll, filteringText = '', ...restProps }, externalRef) => { const formFieldContext = useFormFieldContext(restProps); const ariaLabelId = useUniqueId('multiselect-ariaLabel-'); const footerId = useUniqueId('multiselect-footer-'); const multiselectProps = useMultiselect({ options, selectedOptions, filteringType, disabled: false, deselectAriaLabel, controlId: formFieldContext.controlId, ariaLabelId, footerId, filteringValue: filteringText, externalRef, keepOpen: true, embedded: true, ...restProps, }); const ListComponent = virtualScroll ? VirtualList : PlainList; const status = multiselectProps.dropdownStatus; return (React.createElement("div", { className: styles.embedded }, React.createElement(ListComponent, { menuProps: multiselectProps.getMenuProps(), getOptionProps: multiselectProps.getOptionProps, filteredOptions: multiselectProps.filteredOptions, filteringValue: filteringText, ref: multiselectProps.scrollToIndex, hasDropdownStatus: status.content !== null, checkboxes: true, useInteractiveGroups: true, screenReaderContent: multiselectProps.announcement, highlightType: multiselectProps.highlightType }), status.content && React.createElement(DropdownFooter, { content: status.content, id: footerId }), React.createElement(ScreenreaderOnly, { id: ariaLabelId }, ariaLabel))); }); export default EmbeddedMultiselect; //# sourceMappingURL=embedded.js.map