@pega/cosmos-react-core 4.0.0-dev.12.1 → 4.0.0-dev.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +2 -1
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +10 -12
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +6 -6
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +1 -1
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +2 -2
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +3 -3
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +2 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Button/Button.d.ts +3 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +168 -142
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +5 -3
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +2 -0
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -0
- package/lib/components/ColorPicker/ColorPicker.test-ids.js +7 -0
- package/lib/components/ColorPicker/ColorPicker.test-ids.js.map +1 -0
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +7 -12
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +2 -2
- package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +2 -0
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -0
- package/lib/components/ComboBox/ComboxBox.test-ids.js +4 -0
- package/lib/components/ComboBox/ComboxBox.test-ids.js.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.js +24 -13
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +2 -0
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.test-ids.js +7 -0
- package/lib/components/CompositeInput/CompositeInput.test-ids.js.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.types.d.ts +2 -2
- package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts +6 -0
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +8 -2
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts +2 -0
- package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -0
- package/lib/components/Currency/Currency.test-ids.js +7 -0
- package/lib/components/Currency/Currency.test-ids.js.map +1 -0
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +6 -3
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +2 -2
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +25 -32
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts +1 -0
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +3 -0
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +20 -27
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +1 -9
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +11 -17
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +1 -1
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +1 -1
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +69 -7
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +2 -2
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts +3 -0
- package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.styles.js +29 -2
- package/lib/components/Dialog/Dialog.styles.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.d.ts +36 -14
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.types.js +0 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/FormDialog.d.ts +4 -1
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +4 -5
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.d.ts +0 -1
- package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +15 -13
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.styles.d.ts +6 -0
- package/lib/components/Dialog/InfoDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialog.styles.js +18 -0
- package/lib/components/Dialog/InfoDialog.styles.js.map +1 -0
- package/lib/components/EmojiPicker/EmojiPicker.styles.js +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +1 -1
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +8 -6
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +11 -9
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts +3 -0
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts.map +1 -0
- package/lib/components/FieldValueList/FieldValueList.test-ids.js +7 -0
- package/lib/components/FieldValueList/FieldValueList.test-ids.js.map +1 -0
- package/lib/components/FieldValueList/index.d.ts +1 -1
- package/lib/components/FieldValueList/index.d.ts.map +1 -1
- package/lib/components/FieldValueList/index.js.map +1 -1
- package/lib/components/File/File.test-ids.d.ts +2 -0
- package/lib/components/File/File.test-ids.d.ts.map +1 -0
- package/lib/components/File/File.test-ids.js +8 -0
- package/lib/components/File/File.test-ids.js.map +1 -0
- package/lib/components/File/FileInput.d.ts +2 -2
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +15 -4
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/Flex/Flex.d.ts +7 -1
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js +37 -10
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +3 -2
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +15 -10
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/FormField/FormField.test-ids.d.ts +3 -0
- package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -0
- package/lib/components/FormField/FormField.test-ids.js +10 -0
- package/lib/components/FormField/FormField.test-ids.js.map +1 -0
- package/lib/components/Icon/iconNames.d.ts +2 -2
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/phone-merge-solid.icon.d.ts +4 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.js +6 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.js.map +1 -0
- package/lib/components/Icon/icons/phone-merge.icon.d.ts +4 -0
- package/lib/components/Icon/icons/phone-merge.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/phone-merge.icon.js +6 -0
- package/lib/components/Icon/icons/phone-merge.icon.js.map +1 -0
- package/lib/components/IconPicker/IconPicker.js +2 -2
- package/lib/components/IconPicker/IconPicker.js.map +1 -1
- package/lib/components/Input/Input.d.ts +2 -2
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +6 -2
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.test-ids.d.ts +2 -0
- package/lib/components/Input/Input.test-ids.d.ts.map +1 -0
- package/lib/components/Input/Input.test-ids.js +4 -0
- package/lib/components/Input/Input.test-ids.js.map +1 -0
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +51 -19
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +3 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +2 -3
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +2 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.js +7 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.js.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +31 -8
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/ListToolbar/helpers.d.ts +10 -0
- package/lib/components/ListToolbar/helpers.d.ts.map +1 -0
- package/lib/components/ListToolbar/helpers.js +46 -0
- package/lib/components/ListToolbar/helpers.js.map +1 -0
- package/lib/components/ListToolbar/index.d.ts +1 -0
- package/lib/components/ListToolbar/index.d.ts.map +1 -1
- package/lib/components/ListToolbar/index.js +1 -0
- package/lib/components/ListToolbar/index.js.map +1 -1
- package/lib/components/LiveLog/LiveLog.d.ts.map +1 -1
- package/lib/components/LiveLog/LiveLog.js +17 -16
- package/lib/components/LiveLog/LiveLog.js.map +1 -1
- package/lib/components/Location/Location.test-ids.d.ts +2 -0
- package/lib/components/Location/Location.test-ids.d.ts.map +1 -0
- package/lib/components/Location/Location.test-ids.js +7 -0
- package/lib/components/Location/Location.test-ids.js.map +1 -0
- package/lib/components/Location/LocationInput.d.ts +2 -2
- package/lib/components/Location/LocationInput.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.js +17 -4
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +7 -5
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +5 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +80 -88
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.test-ids.d.ts +3 -0
- package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -0
- package/lib/components/Menu/Menu.test-ids.js +4 -0
- package/lib/components/Menu/Menu.test-ids.js.map +1 -0
- package/lib/components/Menu/Menu.types.d.ts +3 -3
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +70 -73
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +3 -3
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +3 -4
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +2 -0
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +2 -2
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +6 -4
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts +2 -0
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts.map +1 -0
- package/lib/components/MenuButton/MenuButton.test-ids.js +3 -0
- package/lib/components/MenuButton/MenuButton.test-ids.js.map +1 -0
- package/lib/components/MetaList/MetaList.d.ts +2 -2
- package/lib/components/MetaList/MetaList.d.ts.map +1 -1
- package/lib/components/MetaList/MetaList.js +5 -3
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/MetaList/MetaList.test-ids.d.ts +2 -0
- package/lib/components/MetaList/MetaList.test-ids.d.ts.map +1 -0
- package/lib/components/MetaList/MetaList.test-ids.js +3 -0
- package/lib/components/MetaList/MetaList.test-ids.js.map +1 -0
- package/lib/components/Modal/Modal.styles.js +1 -1
- package/lib/components/Modal/Modal.styles.js.map +1 -1
- package/lib/components/Modal/ModalManager.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js +5 -2
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/Number/Number.test-ids.d.ts +3 -0
- package/lib/components/Number/Number.test-ids.d.ts.map +1 -0
- package/lib/components/Number/Number.test-ids.js +14 -0
- package/lib/components/Number/Number.test-ids.js.map +1 -0
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +9 -6
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +2 -2
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
- package/lib/components/Number/NumberRangeInput.js +6 -4
- package/lib/components/Number/NumberRangeInput.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +2 -2
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts +2 -0
- package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -0
- package/lib/components/Phone/Phone.test-ids.js +8 -0
- package/lib/components/Phone/Phone.test-ids.js.map +1 -0
- package/lib/components/Phone/PhoneInput.d.ts +2 -2
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +6 -3
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +1 -0
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +37 -40
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/PopoverManager.d.ts.map +1 -1
- package/lib/components/Popover/PopoverManager.js +11 -10
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +1 -0
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +97 -1
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
- package/lib/components/Progress/Progress.styles.js +25 -20
- package/lib/components/Progress/Progress.styles.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts +2 -0
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +4 -4
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +1 -9
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +7 -4
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/Select.test-ids.d.ts +2 -0
- package/lib/components/Select/Select.test-ids.d.ts.map +1 -0
- package/lib/components/Select/Select.test-ids.js +4 -0
- package/lib/components/Select/Select.test-ids.js.map +1 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -1
- package/lib/components/Slider/Slider.js +7 -5
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
- package/lib/components/Slider/Slider.styles.js +114 -128
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts +2 -0
- package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -0
- package/lib/components/Slider/Slider.test-ids.js +4 -0
- package/lib/components/Slider/Slider.test-ids.js.map +1 -0
- package/lib/components/Slider/Slider.types.d.ts +2 -2
- package/lib/components/Slider/Slider.types.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/Slider/utils.d.ts.map +1 -1
- package/lib/components/Slider/utils.js +0 -1
- package/lib/components/Slider/utils.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +2 -2
- package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +6 -3
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts +2 -0
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts.map +1 -0
- package/lib/components/SummaryItem/SummaryItem.test-ids.js +8 -0
- package/lib/components/SummaryItem/SummaryItem.test-ids.js.map +1 -0
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +21 -18
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts +2 -2
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +6 -2
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts +2 -0
- package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -0
- package/lib/components/TextArea/TextArea.test-ids.js +4 -0
- package/lib/components/TextArea/TextArea.test-ids.js.map +1 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +3 -2
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +4 -1
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useChToPxConversionFactor.d.ts +3 -0
- package/lib/hooks/useChToPxConversionFactor.d.ts.map +1 -0
- package/lib/hooks/useChToPxConversionFactor.js +13 -0
- package/lib/hooks/useChToPxConversionFactor.js.map +1 -0
- package/lib/hooks/useElement.d.ts +1 -1
- package/lib/hooks/useElement.d.ts.map +1 -1
- package/lib/hooks/useI18n.d.ts +28 -9
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useScrollToggle.d.ts.map +1 -1
- package/lib/hooks/useScrollToggle.js +0 -1
- package/lib/hooks/useScrollToggle.js.map +1 -1
- package/lib/hooks/useTestIds.d.ts +10 -0
- package/lib/hooks/useTestIds.d.ts.map +1 -0
- package/lib/hooks/useTestIds.js +21 -0
- package/lib/hooks/useTestIds.js.map +1 -0
- package/lib/i18n/default.d.ts +28 -9
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +34 -14
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +28 -9
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/gradients.d.ts.map +1 -1
- package/lib/styles/gradients.js.map +1 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/theme.d.ts +16 -16
- package/lib/types/types.d.ts +14 -0
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/createTestIds.d.ts +4 -0
- package/lib/utils/createTestIds.d.ts.map +1 -0
- package/lib/utils/createTestIds.js +8 -0
- package/lib/utils/createTestIds.js.map +1 -0
- package/lib/utils/debounce.d.ts +2 -2
- package/lib/utils/debounce.d.ts.map +1 -1
- package/lib/utils/debounce.js +9 -10
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/getEdge.d.ts +7 -0
- package/lib/utils/getEdge.d.ts.map +1 -0
- package/lib/utils/getEdge.js +9 -0
- package/lib/utils/getEdge.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +4 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/kebabToCamel.d.ts +7 -0
- package/lib/utils/kebabToCamel.d.ts.map +1 -0
- package/lib/utils/kebabToCamel.js +10 -0
- package/lib/utils/kebabToCamel.js.map +1 -0
- package/lib/utils/throttle.d.ts +4 -0
- package/lib/utils/throttle.d.ts.map +1 -0
- package/lib/utils/throttle.js +15 -0
- package/lib/utils/throttle.js.map +1 -0
- package/package.json +2 -2
|
@@ -4,77 +4,24 @@ import { defaultThemeProp } from '../../theme';
|
|
|
4
4
|
import { StyledEmptyState } from '../EmptyState';
|
|
5
5
|
import { StyledIcon } from '../Icon';
|
|
6
6
|
import { StyledGrid } from '../Grid';
|
|
7
|
-
import { StyledBareButton } from '../Button/BareButton';
|
|
8
7
|
import { tryCatch } from '../../utils';
|
|
9
8
|
import { StyledText } from '../Text';
|
|
10
9
|
import { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';
|
|
11
10
|
import Button from '../Button';
|
|
12
|
-
const listMaxHeight = '50vh';
|
|
13
11
|
export const StyledExpandButton = styled(Button) `
|
|
14
12
|
align-self: center;
|
|
15
13
|
`;
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
const checkedBackground = theme.components['radio-check'][':checked']['background-color'];
|
|
19
|
-
const checkedForeground = tryCatch(() => readableColor(checkedBackground));
|
|
20
|
-
return css `
|
|
21
|
-
padding: calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
& > input[type='radio']:not(:checked) + ${StyledIcon} {
|
|
26
|
-
color: ${hoverCheckColor};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
& > input[type='checkbox'] + ${StyledIcon} {
|
|
30
|
-
border-color: ${theme.components['form-control'][':hover']['border-color']};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
> ${StyledGrid} {
|
|
35
|
-
flex-grow: 1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
> input {
|
|
39
|
-
${hideVisually}
|
|
40
|
-
|
|
41
|
-
& + ${StyledIcon} {
|
|
42
|
-
margin-inline-start: 0;
|
|
43
|
-
flex-shrink: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&[type='radio'] + ${StyledIcon} {
|
|
47
|
-
color: transparent;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&[type='radio']:checked + ${StyledIcon} {
|
|
51
|
-
color: ${checkedBackground};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&[type='checkbox'] + ${StyledIcon} {
|
|
55
|
-
border: 0.0625rem solid ${theme.components['radio-check']['border-color']};
|
|
56
|
-
border-radius: min(
|
|
57
|
-
calc(${theme.base['border-radius']} * ${theme.components.checkbox['border-radius']}),
|
|
58
|
-
0.25rem
|
|
59
|
-
);
|
|
60
|
-
color: transparent;
|
|
61
|
-
background-color: ${theme.components['radio-check']['background-color']};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&[type='checkbox']:checked + ${StyledIcon} {
|
|
65
|
-
background-color: ${checkedBackground};
|
|
66
|
-
border-color: ${theme.components['radio-check'][':checked']['border-color']};
|
|
67
|
-
color: ${checkedForeground};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
});
|
|
72
|
-
StyledItemLabel.defaultProps = defaultThemeProp;
|
|
73
|
-
export const StyledMenuItem = styled.li(({ theme: { base, components }, isParentItem }) => {
|
|
14
|
+
export const StyledCheckMarkIcon = styled(StyledIcon) ``;
|
|
15
|
+
export const StyledMenuItem = styled.li(({ theme: { base, components }, isParentItem, mode = 'action', 'aria-selected': isChecked = false, selectableParent = false }) => {
|
|
74
16
|
const activeColor = tryCatch(() => mix(0.85, base.palette['primary-background'], base.palette.interactive));
|
|
75
17
|
const hoverColor = tryCatch(() => mix(0.95, base.palette['primary-background'], base.palette.interactive));
|
|
18
|
+
const hoverCheckColor = tryCatch(() => rgba(components['radio-check'][':checked']['background-color'], base.transparency['transparent-5']));
|
|
19
|
+
const checkedBackground = components['radio-check'][':checked']['background-color'];
|
|
20
|
+
const checkedForeground = tryCatch(() => readableColor(checkedBackground));
|
|
76
21
|
return css `
|
|
77
22
|
min-height: ${base['hit-area']['mouse-min']};
|
|
23
|
+
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
24
|
+
cursor: pointer;
|
|
78
25
|
|
|
79
26
|
@media (pointer: coarse) {
|
|
80
27
|
min-height: ${base['hit-area']['finger-min']};
|
|
@@ -84,30 +31,80 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
|
|
|
84
31
|
background-color: ${activeColor};
|
|
85
32
|
}
|
|
86
33
|
|
|
34
|
+
&:hover {
|
|
35
|
+
${StyledCheckMarkIcon} {
|
|
36
|
+
visibility: visible;
|
|
37
|
+
${mode === 'single-select' &&
|
|
38
|
+
css `
|
|
39
|
+
color: ${isChecked ? checkedBackground : hoverCheckColor};
|
|
40
|
+
`}
|
|
41
|
+
${mode === 'multi-select' &&
|
|
42
|
+
css `
|
|
43
|
+
${!isChecked &&
|
|
44
|
+
css `
|
|
45
|
+
border-color: ${components['form-control'][':hover']['border-color']};
|
|
46
|
+
`}
|
|
47
|
+
`}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
87
51
|
&:hover:not([aria-disabled='true']) {
|
|
88
52
|
background-color: ${hoverColor};
|
|
89
53
|
}
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
> a:first-child {
|
|
55
|
+
a:first-of-type {
|
|
93
56
|
display: block;
|
|
94
57
|
width: 100%;
|
|
95
|
-
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
96
|
-
text-align: start;
|
|
97
58
|
text-decoration: none;
|
|
98
59
|
color: inherit;
|
|
99
|
-
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${isParentItem &&
|
|
63
|
+
!selectableParent &&
|
|
64
|
+
(mode === 'multi-select' || mode === 'single-select') &&
|
|
100
65
|
css `
|
|
101
|
-
|
|
66
|
+
padding-inline-start: calc(1.125rem + 2 * ${base.spacing});
|
|
67
|
+
`}
|
|
68
|
+
|
|
69
|
+
${StyledGrid} {
|
|
70
|
+
flex-grow: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${StyledCheckMarkIcon} {
|
|
74
|
+
margin-inline-start: 0;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
${mode === 'single-select' &&
|
|
77
|
+
css `
|
|
78
|
+
${isChecked
|
|
79
|
+
? css `
|
|
80
|
+
color: ${checkedBackground};
|
|
81
|
+
`
|
|
82
|
+
: css `
|
|
83
|
+
visibility: hidden;
|
|
84
|
+
`}
|
|
85
|
+
`}
|
|
86
|
+
${mode === 'multi-select' &&
|
|
87
|
+
css `
|
|
88
|
+
${isChecked
|
|
89
|
+
? css `
|
|
90
|
+
color: ${checkedForeground};
|
|
91
|
+
background-color: ${checkedBackground};
|
|
92
|
+
border: 0.0625rem solid ${components['radio-check'][':checked']['border-color']};
|
|
93
|
+
`
|
|
94
|
+
: css `
|
|
95
|
+
color: transparent;
|
|
96
|
+
border: 0.0625rem solid ${components['radio-check']['border-color']};
|
|
97
|
+
`}
|
|
98
|
+
border-radius: min(
|
|
99
|
+
calc(${base['border-radius']} * ${components.checkbox['border-radius']}),
|
|
100
|
+
0.25rem
|
|
101
|
+
);
|
|
102
102
|
`}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
&[aria-disabled='true'] {
|
|
106
|
-
|
|
107
|
-
${
|
|
108
|
-
background-color: ${components['form-control'][':disabled']['background-color']};
|
|
109
|
-
opacity: ${base['disabled-opacity']};
|
|
110
|
-
}
|
|
106
|
+
background-color: ${components['form-control'][':disabled']['background-color']};
|
|
107
|
+
opacity: ${base['disabled-opacity']};
|
|
111
108
|
}
|
|
112
109
|
`;
|
|
113
110
|
});
|
|
@@ -137,7 +134,7 @@ export const StyledSeparator = styled.li(({ theme }) => {
|
|
|
137
134
|
StyledSeparator.defaultProps = defaultThemeProp;
|
|
138
135
|
export const StyledMenuGroupList = styled.ul(({ theme }) => {
|
|
139
136
|
return css `
|
|
140
|
-
${StyledMenuItem}
|
|
137
|
+
${StyledMenuItem} {
|
|
141
138
|
padding-inline-start: calc(1.5 * ${theme.base.spacing});
|
|
142
139
|
}
|
|
143
140
|
`;
|
|
@@ -159,6 +156,7 @@ export const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {
|
|
|
159
156
|
const hoverColor = tryCatch(() => mix(0.95, base.palette['primary-background'], base.palette.interactive));
|
|
160
157
|
const activeColor = tryCatch(() => mix(0.85, base.palette['primary-background'], base.palette.interactive));
|
|
161
158
|
return css `
|
|
159
|
+
cursor: pointer;
|
|
162
160
|
width: 100%;
|
|
163
161
|
background-color: ${base.palette['primary-background']};
|
|
164
162
|
|
|
@@ -180,22 +178,18 @@ export const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {
|
|
|
180
178
|
&:hover:not([aria-disabled='true']):not([data-current='true']) {
|
|
181
179
|
background-color: ${hoverColor};
|
|
182
180
|
}
|
|
181
|
+
color: ${base.palette['foreground-color']};
|
|
182
|
+
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
183
|
+
text-align: start;
|
|
184
|
+
border-radius: inherit;
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
188
|
-
text-align: start;
|
|
189
|
-
border-radius: inherit;
|
|
190
|
-
|
|
191
|
-
> ${StyledGrid} {
|
|
192
|
-
grid-column-gap: ${base.spacing};
|
|
193
|
-
}
|
|
186
|
+
> ${StyledGrid} {
|
|
187
|
+
grid-column-gap: ${base.spacing};
|
|
188
|
+
}
|
|
194
189
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
190
|
+
${StyledIcon} {
|
|
191
|
+
/* Fixes vertical align issue increasing box size beyond square */
|
|
192
|
+
display: block;
|
|
199
193
|
}
|
|
200
194
|
`;
|
|
201
195
|
});
|
|
@@ -220,7 +214,6 @@ StyledMenuList.defaultProps = defaultThemeProp;
|
|
|
220
214
|
export const StyledMenuListContainer = styled.fieldset(({ theme }) => {
|
|
221
215
|
return css `
|
|
222
216
|
background-color: ${theme.base.palette['primary-background']};
|
|
223
|
-
max-height: ${listMaxHeight};
|
|
224
217
|
border: 0;
|
|
225
218
|
border-radius: inherit;
|
|
226
219
|
`;
|
|
@@ -238,7 +231,6 @@ export const StyledMenuListWrapper = styled.div(({ theme }) => css `
|
|
|
238
231
|
position: relative;
|
|
239
232
|
overflow: hidden;
|
|
240
233
|
transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
|
|
241
|
-
max-height: ${listMaxHeight};
|
|
242
234
|
|
|
243
235
|
& > fieldset:first-child {
|
|
244
236
|
position: relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,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CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CACpF,CAAC;IAEF,OAAO,GAAG,CAAA;;;;;;;;;;;;0BAYc,WAAW;;;MAG/B,wBAAwB;UACpB,qBAAqB;;;;;;;;iBAQd,KAAK,CAAC,IAAI,CAAC,OAAO;;;;uBAIZ,WAAW;;;;oBAId,WAAW;;GAE5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { hideVisually, mix, readableColor, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledIcon } from '../Icon';\nimport { StyledGrid } from '../Grid';\nimport { StyledBareButton } from '../Button/BareButton';\nimport { tryCatch } from '../../utils';\nimport { StyledText } from '../Text';\nimport { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';\nimport Button from '../Button';\n\nconst listMaxHeight = '50vh';\n\nexport const StyledExpandButton = styled(Button)`\n align-self: center;\n`;\n\nexport const StyledItemLabel = styled.label(({ theme }) => {\n const hoverCheckColor = tryCatch(() =>\n rgba(\n theme.components['radio-check'][':checked']['background-color'],\n theme.base.transparency['transparent-5']\n )\n );\n\n const checkedBackground = theme.components['radio-check'][':checked']['background-color'];\n const checkedForeground = tryCatch(() => readableColor(checkedBackground));\n\n return css`\n padding: calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};\n cursor: pointer;\n\n &:hover {\n & > input[type='radio']:not(:checked) + ${StyledIcon} {\n color: ${hoverCheckColor};\n }\n\n & > input[type='checkbox'] + ${StyledIcon} {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n\n > ${StyledGrid} {\n flex-grow: 1;\n }\n\n > input {\n ${hideVisually}\n\n & + ${StyledIcon} {\n margin-inline-start: 0;\n flex-shrink: 0;\n }\n\n &[type='radio'] + ${StyledIcon} {\n color: transparent;\n }\n\n &[type='radio']:checked + ${StyledIcon} {\n color: ${checkedBackground};\n }\n\n &[type='checkbox'] + ${StyledIcon} {\n border: 0.0625rem solid ${theme.components['radio-check']['border-color']};\n border-radius: min(\n calc(${theme.base['border-radius']} * ${theme.components.checkbox['border-radius']}),\n 0.25rem\n );\n color: transparent;\n background-color: ${theme.components['radio-check']['background-color']};\n }\n\n &[type='checkbox']:checked + ${StyledIcon} {\n background-color: ${checkedBackground};\n border-color: ${theme.components['radio-check'][':checked']['border-color']};\n color: ${checkedForeground};\n }\n }\n `;\n});\n\nStyledItemLabel.defaultProps = defaultThemeProp;\n\nexport const StyledMenuItem = styled.li<{ isParentItem: boolean }>(\n ({ theme: { base, components }, isParentItem }) => {\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n min-height: ${base['hit-area']['mouse-min']};\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n &:focus-within {\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']) {\n background-color: ${hoverColor};\n }\n\n > button:first-child,\n > a:first-child {\n display: block;\n width: 100%;\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n text-decoration: none;\n color: inherit;\n ${isParentItem &&\n css`\n padding-inline-start: calc(1.125rem + 2 * ${base.spacing});\n `}\n }\n\n &[aria-disabled='true'] {\n label,\n ${StyledBareButton} {\n background-color: ${components['form-control'][':disabled']['background-color']};\n opacity: ${base['disabled-opacity']};\n }\n }\n `;\n }\n);\n\nStyledMenuItem.defaultProps = defaultThemeProp;\n\nexport const StyledAncestors = styled.div`\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n\n & > ${StyledText} {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n`;\n\nexport const StyledVisibilityHidden = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledSeparator = styled.li(({ theme }) => {\n return css`\n height: 0.0625rem;\n background-color: ${theme.base.palette['border-line']};\n margin: ${theme.base.spacing} 0;\n `;\n});\n\nStyledSeparator.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupList = styled.ul(({ theme }) => {\n return css`\n ${StyledMenuItem} button {\n padding-inline-start: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledMenuGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupHeader = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area']['mouse-min']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${theme.base.palette['secondary-background']};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledMenuGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n width: 100%;\n background-color: ${base.palette['primary-background']};\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &:focus-within {\n box-shadow: ${base.shadow['focus-inset']};\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']):not([data-current='true']) {\n background-color: ${hoverColor};\n }\n\n & > ${StyledBareButton}, & > button {\n color: ${base.palette['foreground-color']};\n width: 100%;\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n border-radius: inherit;\n\n > ${StyledGrid} {\n grid-column-gap: ${base.spacing};\n }\n\n ${StyledIcon} {\n /* Fixes vertical align issue increasing box size beyond square */\n display: block;\n }\n }\n `;\n});\n\nStyledMenuListHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledEmptyState} {\n padding: ${theme.base.spacing};\n height: auto;\n }\n\n li:not(:first-child):not([role='presentation']) > ${StyledMenuGroupHeader} {\n margin-block-start: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n max-height: ${listMaxHeight};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n max-height: ${listMaxHeight};\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n const activeColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n return css`\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &[data-active-scope='true'] [data-current='true'] {\n background-color: ${activeColor};\n }\n\n ${StyledVisuallyHiddenText}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,MAAM,MAAM,WAAW,CAAC;AAI/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;CAE/C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA,EAAE,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAMrC,CAAC,EACC,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAC3B,YAAY,EACZ,IAAI,GAAG,QAAQ,EACf,eAAe,EAAE,SAAS,GAAG,KAAK,EAClC,gBAAgB,GAAG,KAAK,EACzB,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,QAAQ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C7C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;yBAGK,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;GAepF,CACF,CAAC;AAEF,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjD,MAAM,WAAW,GAAG,mBAAmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;IAC3E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAChC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CACpF,CAAC;IAEF,OAAO,GAAG,CAAA;;;;;;;;;;;;0BAYc,WAAW;;;MAG/B,wBAAwB;UACpB,qBAAqB;;;;;;;;iBAQd,KAAK,CAAC,IAAI,CAAC,OAAO;;;;uBAIZ,WAAW;;;;oBAId,WAAW;;GAE5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { hideVisually, mix, readableColor, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledIcon } from '../Icon';\nimport { StyledGrid } from '../Grid';\nimport { tryCatch } from '../../utils';\nimport { StyledText } from '../Text';\nimport { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';\nimport Button from '../Button';\n\nimport { MenuProps } from './Menu.types';\n\nexport const StyledExpandButton = styled(Button)`\n align-self: center;\n`;\n\nexport const StyledCheckMarkIcon = styled(StyledIcon)``;\n\nexport const StyledMenuItem = styled.li<{\n isParentItem: boolean;\n mode?: MenuProps['mode'];\n isChecked?: boolean;\n selectableParent?: boolean;\n}>(\n ({\n theme: { base, components },\n isParentItem,\n mode = 'action',\n 'aria-selected': isChecked = false,\n selectableParent = false\n }) => {\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverCheckColor = tryCatch(() =>\n rgba(\n components['radio-check'][':checked']['background-color'],\n base.transparency['transparent-5']\n )\n );\n\n const checkedBackground = components['radio-check'][':checked']['background-color'];\n const checkedForeground = tryCatch(() => readableColor(checkedBackground));\n\n return css`\n min-height: ${base['hit-area']['mouse-min']};\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n cursor: pointer;\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n &:focus-within {\n background-color: ${activeColor};\n }\n\n &:hover {\n ${StyledCheckMarkIcon} {\n visibility: visible;\n ${mode === 'single-select' &&\n css`\n color: ${isChecked ? checkedBackground : hoverCheckColor};\n `}\n ${mode === 'multi-select' &&\n css`\n ${!isChecked &&\n css`\n border-color: ${components['form-control'][':hover']['border-color']};\n `}\n `}\n }\n }\n\n &:hover:not([aria-disabled='true']) {\n background-color: ${hoverColor};\n }\n\n a:first-of-type {\n display: block;\n width: 100%;\n text-decoration: none;\n color: inherit;\n }\n\n ${isParentItem &&\n !selectableParent &&\n (mode === 'multi-select' || mode === 'single-select') &&\n css`\n padding-inline-start: calc(1.125rem + 2 * ${base.spacing});\n `}\n\n ${StyledGrid} {\n flex-grow: 1;\n }\n\n ${StyledCheckMarkIcon} {\n margin-inline-start: 0;\n flex-shrink: 0;\n ${mode === 'single-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedBackground};\n `\n : css`\n visibility: hidden;\n `}\n `}\n ${mode === 'multi-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedForeground};\n background-color: ${checkedBackground};\n border: 0.0625rem solid ${components['radio-check'][':checked']['border-color']};\n `\n : css`\n color: transparent;\n border: 0.0625rem solid ${components['radio-check']['border-color']};\n `}\n border-radius: min(\n calc(${base['border-radius']} * ${components.checkbox['border-radius']}),\n 0.25rem\n );\n `}\n }\n\n &[aria-disabled='true'] {\n background-color: ${components['form-control'][':disabled']['background-color']};\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nStyledMenuItem.defaultProps = defaultThemeProp;\n\nexport const StyledAncestors = styled.div`\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n\n & > ${StyledText} {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n`;\n\nexport const StyledVisibilityHidden = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledSeparator = styled.li(({ theme }) => {\n return css`\n height: 0.0625rem;\n background-color: ${theme.base.palette['border-line']};\n margin: ${theme.base.spacing} 0;\n `;\n});\n\nStyledSeparator.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupList = styled.ul(({ theme }) => {\n return css`\n ${StyledMenuItem} {\n padding-inline-start: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledMenuGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupHeader = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area']['mouse-min']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${theme.base.palette['secondary-background']};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledMenuGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n cursor: pointer;\n width: 100%;\n background-color: ${base.palette['primary-background']};\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &:focus-within {\n box-shadow: ${base.shadow['focus-inset']};\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']):not([data-current='true']) {\n background-color: ${hoverColor};\n }\n color: ${base.palette['foreground-color']};\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n border-radius: inherit;\n\n > ${StyledGrid} {\n grid-column-gap: ${base.spacing};\n }\n\n ${StyledIcon} {\n /* Fixes vertical align issue increasing box size beyond square */\n display: block;\n }\n `;\n});\n\nStyledMenuListHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledEmptyState} {\n padding: ${theme.base.spacing};\n height: auto;\n }\n\n li:not(:first-child):not([role='presentation']) > ${StyledMenuGroupHeader} {\n margin-block-start: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n const activeColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n return css`\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &[data-active-scope='true'] [data-current='true'] {\n background-color: ${activeColor};\n }\n\n ${StyledVisuallyHiddenText}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const getMenuTestIds: (testIdProp?: string | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
2
|
+
export declare const getMenuItemTestIds: (testIdProp?: string | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
3
|
+
//# sourceMappingURL=Menu.test-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iFAAqC,CAAC;AAEjE,eAAO,MAAM,kBAAkB,iFAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.test-ids.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,EAAE,EAAW,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,EAAE,EAAW,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\n\nexport const getMenuTestIds = createTestIds('menu', [] as const);\n\nexport const getMenuItemTestIds = createTestIds('menu-item', [] as const);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, ReactNode, Ref, RefObject, SetStateAction, MouseEvent } from 'react';
|
|
2
|
-
import { BaseProps, NoChildrenProp, OmitStrict, PropsWithDefaults } from '../../types';
|
|
2
|
+
import { BaseProps, NoChildrenProp, OmitStrict, PropsWithDefaults, TestIdProp } from '../../types';
|
|
3
3
|
import { MetaListProps } from '../MetaList';
|
|
4
4
|
import type { UseActiveDescendantConfig } from '../../hooks';
|
|
5
5
|
export type AcceptedMouseEventElement = HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;
|
|
@@ -56,7 +56,7 @@ export interface MenuListHeaderProps {
|
|
|
56
56
|
/** Internal handler. */
|
|
57
57
|
onClick: () => void;
|
|
58
58
|
}
|
|
59
|
-
export interface MenuObjectProps {
|
|
59
|
+
export interface MenuObjectProps extends TestIdProp {
|
|
60
60
|
/** A unique id within the entire tree of menu items. */
|
|
61
61
|
id: string;
|
|
62
62
|
}
|
|
@@ -73,7 +73,7 @@ export interface MenuListProps {
|
|
|
73
73
|
};
|
|
74
74
|
menuRole?: 'menu' | 'listbox';
|
|
75
75
|
}
|
|
76
|
-
export interface MenuProps extends BaseProps, NoChildrenProp {
|
|
76
|
+
export interface MenuProps extends TestIdProp, BaseProps, NoChildrenProp {
|
|
77
77
|
/** An array of MenuItemProps. */
|
|
78
78
|
items: (MenuItemProps | MenuGroupProps)[];
|
|
79
79
|
/** ID placed on the menu's list element. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../src/components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AgB,EAAE,QAAQ,CAAC,cAAc,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3E,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,2BAA2B,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.types.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dispatch, ReactNode, Ref, RefObject, SetStateAction, MouseEvent } from 'react';\n\nimport { BaseProps, NoChildrenProp, OmitStrict, PropsWithDefaults } from '../../types';\nimport { MetaListProps } from '../MetaList';\nimport type { UseActiveDescendantConfig } from '../../hooks';\n\nexport type AcceptedMouseEventElement = HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;\n\nexport interface MenuItemProps extends MenuObjectProps {\n /** The primary piece of item information as a string. */\n primary: string;\n /** Secondary info about an item. Useful for additional metadata or context. Will be overridden when ancestors are passed as a prop. */\n secondary?: MetaListProps['items'];\n /** A visual to assist identifying an item. e.g. Avatar or Icon. */\n visual?: ReactNode;\n /** A count to assist with number of associated items. */\n count?: number;\n /** An array of MenuItemProps to identify an item's ancestors by their primary value. Useful for flattened tree search results. */\n ancestors?: (MenuItemProps | MenuGroupProps)[];\n /** An array of either MenuItemProps or MenuGroupProps children. */\n items?: (MenuItemProps | MenuGroupProps)[];\n /**\n * For single or multi select menus, selected must be set true|false to render an item's radiobutton or checkbox.\n * May be set on parent or leaf items.\n */\n selected?: boolean;\n /**\n * FUTURE SUPPORT: Use to indicate an item has a partial selection, some but not all of its descendants are selected.\n */\n partial?: boolean;\n /** Will render the action item as link. Only use for leaf items. */\n href?: string;\n /**\n * Provide a description for an item that will render in a Tooltip when hovering that item.\n * This should be used only for VERY SPECIFIC UX scenarios.\n */\n tooltip?: string;\n /** Use this function to identify and set item selections. Recommend leveraging top level Menu onItemClick handler. */\n onClick?: (id: MenuItemProps['id'], e: MouseEvent<AcceptedMouseEventElement>) => void;\n onExpand?: MenuItemProps['onClick'];\n /** Determines if the MenuItem will be disabled. */\n disabled?: boolean;\n role?: 'menuitem' | 'option';\n}\n\nexport interface MenuGroupProps extends MenuObjectProps {\n /** Label of the group. */\n label: string;\n /** An array of MenuItemProps children. */\n items: MenuItemProps[];\n /** List-like role to apply to group items. */\n itemRole?: MenuItemProps['role'];\n}\n\nexport type ParentMenuItemProps = MenuItemProps & { items: NonNullable<MenuItemProps['items']> };\n\nexport interface MenuListHeaderProps {\n /** Text used to indicate an expanded parent item. */\n text: string;\n /** Internal handler. */\n onClick: () => void;\n}\n\nexport interface MenuObjectProps {\n /** A unique id within the entire tree of menu items. */\n id: string;\n}\n\nexport interface MenuListProps {\n items: ParentMenuItemProps['items'];\n id?: string;\n ref?: Ref<HTMLFieldSetElement>;\n parent?: {\n el: HTMLFieldSetElement;\n item: ParentMenuItemProps;\n siblingItems: ParentMenuItemProps['items'];\n setExpandedItem: Dispatch<SetStateAction<ParentMenuItemProps | undefined>>;\n returnFocusRef: RefObject<HTMLButtonElement>;\n };\n menuRole?: 'menu' | 'listbox';\n}\n\nexport interface MenuProps extends BaseProps, NoChildrenProp {\n /** An array of MenuItemProps. */\n items: (MenuItemProps | MenuGroupProps)[];\n /** ID placed on the menu's list element. */\n listId?: string;\n /**\n * Indicates intent for the menu.\n * As of now item types can not be mixed.\n * @default \"action\"\n */\n mode?: 'action' | 'multi-select' | 'single-select';\n role?: 'menu' | 'listbox';\n /**\n * Always recommended to go for default drill-down variant for better accessibility.\n * When flyout variant is selected, its recommended not to have more than 1 nested level\n * @default \"drill-down\"\n */\n variant?: 'drill-down' | 'flyout';\n /**\n * Use to accent(make bold) portions of the primary text.\n * Useful for filter/search results.\n * If passed a function, that function will be passed each items primary text.\n */\n accent?: RegExp | ((primary: string) => RegExp);\n /**\n * Item height will grow or shrink based on item count.\n * Use this indicate at which item the menu should begin its scroll.\n * @default 7\n */\n scrollAt?: number;\n /** A simple message to display when there are no items. */\n emptyText?: string;\n /**\n * A top level handler for all item clicks.\n * This is convenient way to detect which item was clicked to react by updating state or performing an action.\n * Both an item's onClick and this will be called if both are passed.\n */\n onItemClick?: MenuItemProps['onClick'];\n /**\n * A top level handler for all item pseudo focus events.\n * This is convenient way to detect which item is active to react by updating state or performing an action.\n */\n onItemActive?: (id: MenuItemProps['id']) => void;\n /**\n * A top level handler for clicks on parent items to expand their child items.\n * This is convenient way to detect when an item is expanded.\n * For lazy loading this would be a good time to set an item's items.\n * Both an item's onExpand and this will be called if both are passed.\n */\n onItemExpand?: MenuProps['onItemClick'];\n /**\n * A top level handler for capturing when nested items have been collapsed / \"back\" button clicks.\n */\n onItemCollapse?: (id: MenuItemProps['id']) => void;\n /**\n * Show a Progress indicator at the end of a list where newly loaded items will be appended.\n * @default false\n */\n loading?: boolean;\n /** Callback to fetch more items */\n loadMore?: (id?: MenuItemProps['id']) => void;\n /** Ref placed on the root menu element. */\n ref?: Ref<HTMLDivElement>;\n /** HTML ID. */\n id?: string;\n /**\n * Currently highlighted item.\n * Setting currentItemId assumes synthetic focus is being controlled entirely by the containing component,\n * and unbinds menu useActiveDescendant keydown controls.\n * @deprecated\n * */\n currentItemId?: string;\n /** Override for default active-descendant focus control element in menu */\n focusControlEl?: HTMLElement | undefined;\n /** Header region. */\n header?: ReactNode;\n /** Footer region. */\n footer?: ReactNode;\n /** Pauses evaluation of menu active descendants while true */\n pauseDescendantEvaluation?: UseActiveDescendantConfig['pauseDescendantEvaluation'];\n /**\n * Flag to indicate that Right/Left arrow navigation for expand/collapse parent items is not available.\n * Will accept enter if not selectable parent, otherwise falls back to shift + space.\n */\n arrowNavigationUnsupported?: boolean;\n /**\n * Additional information to announce to screen reader users. Read before menu navigation instructions.\n */\n 'aria-describedby'?: string;\n /** Label for menu or listbox element */\n 'aria-label'?: string;\n}\n\ntype MenuPropsWithDefaults = PropsWithDefaults<\n MenuProps,\n 'mode' | 'variant' | 'scrollAt' | 'loading'\n>;\nexport interface MenuContextProps extends OmitStrict<MenuPropsWithDefaults, 'ref' | 'items'> {\n radioName?: string;\n componentId: string;\n pushFlyoutId: (id: string) => void;\n flyOutActiveIdStack: string[];\n focusControl: HTMLElement | null;\n updateActiveDescendants: (options?: { preventScroll?: boolean }) => void;\n setFocusDescendant: Dispatch<SetStateAction<HTMLElement | null>>;\n setFocusReturnEl: Dispatch<SetStateAction<HTMLElement | null | undefined>>;\n getScopedItemId: (itemId: string) => string;\n updateParentDescendantStack?: (item: HTMLElement | null) => void;\n}\n\nexport interface NavItemsListProps {\n listRef: RefObject<HTMLUListElement>;\n cycle?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.types.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dispatch, ReactNode, Ref, RefObject, SetStateAction, MouseEvent } from 'react';\n\nimport { BaseProps, NoChildrenProp, OmitStrict, PropsWithDefaults, TestIdProp } from '../../types';\nimport { MetaListProps } from '../MetaList';\nimport type { UseActiveDescendantConfig } from '../../hooks';\n\nexport type AcceptedMouseEventElement = HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;\n\nexport interface MenuItemProps extends MenuObjectProps {\n /** The primary piece of item information as a string. */\n primary: string;\n /** Secondary info about an item. Useful for additional metadata or context. Will be overridden when ancestors are passed as a prop. */\n secondary?: MetaListProps['items'];\n /** A visual to assist identifying an item. e.g. Avatar or Icon. */\n visual?: ReactNode;\n /** A count to assist with number of associated items. */\n count?: number;\n /** An array of MenuItemProps to identify an item's ancestors by their primary value. Useful for flattened tree search results. */\n ancestors?: (MenuItemProps | MenuGroupProps)[];\n /** An array of either MenuItemProps or MenuGroupProps children. */\n items?: (MenuItemProps | MenuGroupProps)[];\n /**\n * For single or multi select menus, selected must be set true|false to render an item's radiobutton or checkbox.\n * May be set on parent or leaf items.\n */\n selected?: boolean;\n /**\n * FUTURE SUPPORT: Use to indicate an item has a partial selection, some but not all of its descendants are selected.\n */\n partial?: boolean;\n /** Will render the action item as link. Only use for leaf items. */\n href?: string;\n /**\n * Provide a description for an item that will render in a Tooltip when hovering that item.\n * This should be used only for VERY SPECIFIC UX scenarios.\n */\n tooltip?: string;\n /** Use this function to identify and set item selections. Recommend leveraging top level Menu onItemClick handler. */\n onClick?: (id: MenuItemProps['id'], e: MouseEvent<AcceptedMouseEventElement>) => void;\n onExpand?: MenuItemProps['onClick'];\n /** Determines if the MenuItem will be disabled. */\n disabled?: boolean;\n role?: 'menuitem' | 'option';\n}\n\nexport interface MenuGroupProps extends MenuObjectProps {\n /** Label of the group. */\n label: string;\n /** An array of MenuItemProps children. */\n items: MenuItemProps[];\n /** List-like role to apply to group items. */\n itemRole?: MenuItemProps['role'];\n}\n\nexport type ParentMenuItemProps = MenuItemProps & { items: NonNullable<MenuItemProps['items']> };\n\nexport interface MenuListHeaderProps {\n /** Text used to indicate an expanded parent item. */\n text: string;\n /** Internal handler. */\n onClick: () => void;\n}\n\nexport interface MenuObjectProps extends TestIdProp {\n /** A unique id within the entire tree of menu items. */\n id: string;\n}\n\nexport interface MenuListProps {\n items: ParentMenuItemProps['items'];\n id?: string;\n ref?: Ref<HTMLFieldSetElement>;\n parent?: {\n el: HTMLFieldSetElement;\n item: ParentMenuItemProps;\n siblingItems: ParentMenuItemProps['items'];\n setExpandedItem: Dispatch<SetStateAction<ParentMenuItemProps | undefined>>;\n returnFocusRef: RefObject<HTMLButtonElement>;\n };\n menuRole?: 'menu' | 'listbox';\n}\n\nexport interface MenuProps extends TestIdProp, BaseProps, NoChildrenProp {\n /** An array of MenuItemProps. */\n items: (MenuItemProps | MenuGroupProps)[];\n /** ID placed on the menu's list element. */\n listId?: string;\n /**\n * Indicates intent for the menu.\n * As of now item types can not be mixed.\n * @default \"action\"\n */\n mode?: 'action' | 'multi-select' | 'single-select';\n role?: 'menu' | 'listbox';\n /**\n * Always recommended to go for default drill-down variant for better accessibility.\n * When flyout variant is selected, its recommended not to have more than 1 nested level\n * @default \"drill-down\"\n */\n variant?: 'drill-down' | 'flyout';\n /**\n * Use to accent(make bold) portions of the primary text.\n * Useful for filter/search results.\n * If passed a function, that function will be passed each items primary text.\n */\n accent?: RegExp | ((primary: string) => RegExp);\n /**\n * Item height will grow or shrink based on item count.\n * Use this indicate at which item the menu should begin its scroll.\n * @default 7\n */\n scrollAt?: number;\n /** A simple message to display when there are no items. */\n emptyText?: string;\n /**\n * A top level handler for all item clicks.\n * This is convenient way to detect which item was clicked to react by updating state or performing an action.\n * Both an item's onClick and this will be called if both are passed.\n */\n onItemClick?: MenuItemProps['onClick'];\n /**\n * A top level handler for all item pseudo focus events.\n * This is convenient way to detect which item is active to react by updating state or performing an action.\n */\n onItemActive?: (id: MenuItemProps['id']) => void;\n /**\n * A top level handler for clicks on parent items to expand their child items.\n * This is convenient way to detect when an item is expanded.\n * For lazy loading this would be a good time to set an item's items.\n * Both an item's onExpand and this will be called if both are passed.\n */\n onItemExpand?: MenuProps['onItemClick'];\n /**\n * A top level handler for capturing when nested items have been collapsed / \"back\" button clicks.\n */\n onItemCollapse?: (id: MenuItemProps['id']) => void;\n /**\n * Show a Progress indicator at the end of a list where newly loaded items will be appended.\n * @default false\n */\n loading?: boolean;\n /** Callback to fetch more items */\n loadMore?: (id?: MenuItemProps['id']) => void;\n /** Ref placed on the root menu element. */\n ref?: Ref<HTMLDivElement>;\n /** HTML ID. */\n id?: string;\n /**\n * Currently highlighted item.\n * Setting currentItemId assumes synthetic focus is being controlled entirely by the containing component,\n * and unbinds menu useActiveDescendant keydown controls.\n * @deprecated\n * */\n currentItemId?: string;\n /** Override for default active-descendant focus control element in menu */\n focusControlEl?: HTMLElement | undefined;\n /** Header region. */\n header?: ReactNode;\n /** Footer region. */\n footer?: ReactNode;\n /** Pauses evaluation of menu active descendants while true */\n pauseDescendantEvaluation?: UseActiveDescendantConfig['pauseDescendantEvaluation'];\n /**\n * Flag to indicate that Right/Left arrow navigation for expand/collapse parent items is not available.\n * Will accept enter if not selectable parent, otherwise falls back to shift + space.\n */\n arrowNavigationUnsupported?: boolean;\n /**\n * Additional information to announce to screen reader users. Read before menu navigation instructions.\n */\n 'aria-describedby'?: string;\n /** Label for menu or listbox element */\n 'aria-label'?: string;\n}\n\ntype MenuPropsWithDefaults = PropsWithDefaults<\n MenuProps,\n 'mode' | 'variant' | 'scrollAt' | 'loading'\n>;\nexport interface MenuContextProps extends OmitStrict<MenuPropsWithDefaults, 'ref' | 'items'> {\n radioName?: string;\n componentId: string;\n pushFlyoutId: (id: string) => void;\n flyOutActiveIdStack: string[];\n focusControl: HTMLElement | null;\n updateActiveDescendants: (options?: { preventScroll?: boolean }) => void;\n setFocusDescendant: Dispatch<SetStateAction<HTMLElement | null>>;\n setFocusReturnEl: Dispatch<SetStateAction<HTMLElement | null | undefined>>;\n getScopedItemId: (itemId: string) => string;\n updateParentDescendantStack?: (item: HTMLElement | null) => void;\n}\n\nexport interface NavItemsListProps {\n listRef: RefObject<HTMLUListElement>;\n cycle?: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAAgD,MAAM,OAAO,CAAC;AAIlG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB3C,OAAO,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;AAgExE,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAyM7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, useCallback, useContext,
|
|
2
|
+
import { Fragment, useCallback, useContext, useMemo } from 'react';
|
|
3
3
|
import MetaList from '../MetaList';
|
|
4
4
|
import SummaryItem from '../SummaryItem';
|
|
5
5
|
import Flex from '../Flex';
|
|
@@ -11,13 +11,20 @@ import Text from '../Text';
|
|
|
11
11
|
import { Count } from '../Badges';
|
|
12
12
|
import BareButton from '../Button/BareButton';
|
|
13
13
|
import { replaceMatchWithElement } from '../../utils';
|
|
14
|
-
import { useElement, useI18n,
|
|
14
|
+
import { useElement, useI18n, useDirection, useLiveLog, useTestIds } from '../../hooks';
|
|
15
15
|
import Tooltip from '../Tooltip';
|
|
16
16
|
import Mark from '../Mark';
|
|
17
|
+
import Button from '../Button';
|
|
17
18
|
import menuHelpers from './helpers';
|
|
18
19
|
import MenuContext from './Menu.context';
|
|
19
|
-
import { StyledAncestors,
|
|
20
|
+
import { StyledAncestors, StyledCheckMarkIcon, StyledMenuItem } from './Menu.styles';
|
|
21
|
+
import { getMenuItemTestIds } from './Menu.test-ids';
|
|
20
22
|
registerIcon(caretLeftIcon, caretRightIcon, checkIcon);
|
|
23
|
+
const DrillDown = ({ expandHandler }) => {
|
|
24
|
+
const { end } = useDirection();
|
|
25
|
+
const icon = _jsx(Icon, { name: `caret-${end}` });
|
|
26
|
+
return expandHandler ? (_jsx(Button, { as: 'span', icon: true, variant: 'simple', "aria-hidden": true, onClick: expandHandler, children: icon })) : (icon);
|
|
27
|
+
};
|
|
21
28
|
const AncestorPath = ({ ancestors = [] }) => {
|
|
22
29
|
const truncatedPath = ancestors.length > 2;
|
|
23
30
|
const pathParts = truncatedPath ? [ancestors[0], ancestors[ancestors.length - 1]] : ancestors;
|
|
@@ -27,16 +34,16 @@ const AncestorPath = ({ ancestors = [] }) => {
|
|
|
27
34
|
return (_jsxs(Fragment, { children: [_jsx(Text, { variant: 'secondary', children: label }), i < arr.length - 1 && (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'secondary', children: _jsx(Icon, { name: `caret-${end}` }) }), truncatedPath && (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'secondary', children: "\u2026" }), _jsx(Text, { variant: 'secondary', children: _jsx(Icon, { name: `caret-${end}` }) })] }))] }))] }, label));
|
|
28
35
|
}) }));
|
|
29
36
|
};
|
|
30
|
-
const MenuItem = ({ id, primary, secondary, ancestors, visual, count, items, selected, partial, href, tooltip, onClick, onExpand, disabled, role = 'menuitem', ...restProps }) => {
|
|
37
|
+
const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, items, selected, partial, href, tooltip, onClick, onExpand, disabled, role = 'menuitem', ...restProps }) => {
|
|
31
38
|
const t = useI18n();
|
|
32
|
-
const { mode, onItemClick, accent,
|
|
33
|
-
const
|
|
39
|
+
const { mode, onItemClick, accent, variant: menuVariant, setFocusDescendant, getScopedItemId, arrowNavigationUnsupported } = useContext(MenuContext);
|
|
40
|
+
const testIds = useTestIds(testId, getMenuItemTestIds);
|
|
41
|
+
const { announcePolite } = useLiveLog();
|
|
34
42
|
const selectionMode = mode === 'single-select' || mode === 'multi-select';
|
|
35
|
-
const
|
|
36
|
-
const selectableParent = isParentItem && typeof selected === 'boolean';
|
|
37
|
-
const inputRef = useRef(null);
|
|
43
|
+
const selectableParent = items && typeof selected === 'boolean';
|
|
38
44
|
const itemId = useMemo(() => getScopedItemId(id), [id, getScopedItemId]);
|
|
39
|
-
const
|
|
45
|
+
const itemCountId = `${id}-count`;
|
|
46
|
+
const secondaryId = `${id}-secondary`;
|
|
40
47
|
const clickHandler = useCallback((e) => {
|
|
41
48
|
const mouseClick = e.detail !== 0;
|
|
42
49
|
if (mouseClick) {
|
|
@@ -50,9 +57,8 @@ const MenuItem = ({ id, primary, secondary, ancestors, visual, count, items, sel
|
|
|
50
57
|
}, [onClick, onItemClick, id]);
|
|
51
58
|
const expandHandler = useCallback((e) => {
|
|
52
59
|
onExpand?.(id, e);
|
|
60
|
+
e.stopPropagation();
|
|
53
61
|
}, [onExpand, id]);
|
|
54
|
-
const navigationInteractionId = `${id}-description`;
|
|
55
|
-
const secondaryId = `${id}-secondary`;
|
|
56
62
|
let accentedPrimary;
|
|
57
63
|
if (accent && !items) {
|
|
58
64
|
const accentRegex = typeof accent === 'function' ? accent(primary) : accent;
|
|
@@ -60,74 +66,65 @@ const MenuItem = ({ id, primary, secondary, ancestors, visual, count, items, sel
|
|
|
60
66
|
return _jsx(Mark, { children: str });
|
|
61
67
|
});
|
|
62
68
|
}
|
|
63
|
-
const secondaryContent = ancestors ? (_jsx(AncestorPath, { ancestors: ancestors })) : (secondary && _jsx(MetaList, { items: secondary, id: secondaryId
|
|
69
|
+
const secondaryContent = ancestors ? (_jsx(AncestorPath, { ancestors: ancestors })) : (secondary && _jsx(MetaList, { items: secondary, id: secondaryId }));
|
|
64
70
|
const [summaryItemRef, setSummaryItemRef] = useElement();
|
|
65
|
-
const summaryItem = (_jsxs(_Fragment, { children: [_jsx(SummaryItem, { ref: setSummaryItemRef, primary: accentedPrimary || (!items ? _jsx(Text, { children: primary }) : primary), secondary: secondaryContent, visual: visual, actions:
|
|
71
|
+
const summaryItem = (_jsxs(_Fragment, { children: [_jsx(SummaryItem, { ref: setSummaryItemRef, primary: accentedPrimary || (!items ? _jsx(Text, { children: primary }) : primary), secondary: secondaryContent, visual: visual, actions: items || count ? (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [count !== undefined && (_jsx(Count, { id: itemCountId, "aria-label": t('menu_item_count', [count]), children: count })), items && _jsx(DrillDown, { expandHandler: selectableParent ? expandHandler : undefined })] })) : undefined, container: {
|
|
66
72
|
colGap: 1
|
|
67
73
|
} }), tooltip && (_jsx(Tooltip, { target: summaryItemRef, hideDelay: 'none', showDelay: 'none', portal: true, children: tooltip }))] }));
|
|
68
|
-
let InteractiveWrap;
|
|
69
|
-
if (href) {
|
|
70
|
-
InteractiveWrap = href ? 'a' : BareButton;
|
|
71
|
-
}
|
|
72
|
-
else if (mode === 'action' || items) {
|
|
73
|
-
InteractiveWrap = BareButton;
|
|
74
|
-
}
|
|
75
|
-
const itemChild = InteractiveWrap ? (_jsx(InteractiveWrap, { onMouseDown: (e) => {
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
}, onClick: items ? expandHandler : clickHandler, onMouseEnter: menuVariant === 'flyout' ? expandHandler : undefined, href: href, tabIndex: '-1', disabled: disabled, children: summaryItem })) : (summaryItem);
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (inputRef.current) {
|
|
80
|
-
inputRef.current.indeterminate = !!partial;
|
|
81
|
-
}
|
|
82
|
-
}, [partial]);
|
|
83
|
-
const labelRef = useRef(null);
|
|
84
74
|
const itemLabel = useMemo(() => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
let label = '';
|
|
76
|
+
let collapsedLabel = '';
|
|
77
|
+
if (selectableParent && selectionMode) {
|
|
78
|
+
const selectedParentItemLabel = selected
|
|
79
|
+
? t('selected_noun', [primary])
|
|
80
|
+
: t('unselected_noun', [primary]);
|
|
81
|
+
collapsedLabel = t('menu_collapsed', [selectedParentItemLabel]);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
collapsedLabel = t('menu_collapsed', [primary]);
|
|
85
|
+
}
|
|
86
|
+
if (selectionMode && !items) {
|
|
87
|
+
label = selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
label = primary;
|
|
91
|
+
}
|
|
92
|
+
if (items) {
|
|
93
|
+
return arrowNavigationUnsupported
|
|
94
|
+
? t('menu_item_shift_space_expand_collapse', [collapsedLabel])
|
|
95
|
+
: t('menu_item_expand_arrow', [collapsedLabel]);
|
|
96
|
+
}
|
|
97
|
+
return label;
|
|
98
|
+
}, [selected, primary, items]);
|
|
99
|
+
const ariaDescribedBy = useMemo(() => {
|
|
90
100
|
const hasSecondary = !!secondary;
|
|
91
|
-
let idString
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
let idString;
|
|
102
|
+
if (hasSecondary) {
|
|
103
|
+
idString = secondaryId;
|
|
104
|
+
if (count !== undefined && count >= 0) {
|
|
105
|
+
idString = `${idString} ${itemCountId}`;
|
|
106
|
+
}
|
|
97
107
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const navigationInstructions = useMemo(() => {
|
|
101
|
-
if (arrowNavigationUnsupported) {
|
|
102
|
-
return t('menu_item_shift_space_expand_collapse');
|
|
108
|
+
else if (count !== undefined && count >= 0) {
|
|
109
|
+
idString = itemCountId;
|
|
103
110
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}, children: [_jsx("input", { ref: inputRef, type: mode === 'single-select' ? 'radio' : 'checkbox', name: mode === 'single-select' ? radioName : undefined, "aria-label": primary, checked: !!selected, disabled: disabled, onClick: clickHandler, onKeyDown: (e) => {
|
|
123
|
-
if (mode === 'single-select' && e.key === 'Enter') {
|
|
124
|
-
e.currentTarget.click();
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
// no-op since React will complain about a controlled input without an onChange
|
|
128
|
-
onChange: () => { }, onMouseDown: e => {
|
|
129
|
-
e.preventDefault();
|
|
130
|
-
}, tabIndex: -1 }), (mode === 'single-select' || mode === 'multi-select') && _jsx(Icon, { name: 'check' }), summaryItem] }), isParentItem && (_jsx(StyledExpandButton, { icon: true, variant: 'simple', onClick: expandHandler, tabIndex: '-1', children: _jsx(Icon, { name: `caret-${end}` }) }))] })) : (itemChild), !!items && (_jsx(StyledVisibilityHidden, { id: navigationInteractionId, children: navigationInstructions })), _jsx(StyledVisibilityHidden, { role: 'alert', children: interactionNotification })] }));
|
|
111
|
+
else
|
|
112
|
+
idString = '';
|
|
113
|
+
return idString;
|
|
114
|
+
}, [items, secondary, itemCountId, secondaryId]);
|
|
115
|
+
return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { alignItems: 'center', justify: 'between', gap: 1 }, id: itemId, as: StyledMenuItem, "aria-label": itemLabel, "aria-describedby": ariaDescribedBy, role: role, "aria-disabled": disabled, "data-expand": !!items, tabIndex: '-1', disabled: disabled, onMouseDown: (e) => {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
}, onClick: (e) => {
|
|
118
|
+
/** Announce only on keyboard selection since mouse selection will automatically detect and act on the DOM aria attribute changes */
|
|
119
|
+
if (e.detail === 0 && selected !== undefined) {
|
|
120
|
+
announcePolite({
|
|
121
|
+
/** selected is still not updated so putting the reverse logic. */
|
|
122
|
+
message: !selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]),
|
|
123
|
+
type: 'acknowledgement'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return items && typeof selected !== 'boolean' ? expandHandler(e) : clickHandler(e);
|
|
127
|
+
}, onMouseEnter: menuVariant === 'flyout' ? expandHandler : undefined, href: href, mode: mode, isParentItem: !!items, "aria-selected": !!selected, selectableParent: selectableParent, children: [selectionMode && (!items || selectableParent) && (_jsx(Icon, { as: StyledCheckMarkIcon, name: 'check' })), href && !selectionMode ? (_jsx(BareButton, { href: href, tabIndex: '-1', children: summaryItem })) : (summaryItem)] }));
|
|
131
128
|
};
|
|
132
129
|
export default MenuItem;
|
|
133
130
|
//# sourceMappingURL=MenuItem.js.map
|