@pega/cosmos-react-core 7.0.0-build.9.1 → 7.0.0-rc.1
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/lib/components/AIButton/AIButton.d.ts +30 -2
- package/lib/components/AIButton/AIButton.d.ts.map +1 -1
- package/lib/components/AIButton/AIButton.js +7 -6
- package/lib/components/AIButton/AIButton.js.map +1 -1
- package/lib/components/Actions/Actions.d.ts +1 -1
- package/lib/components/Actions/Actions.d.ts.map +1 -1
- package/lib/components/Actions/Actions.js +6 -3
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +9 -7
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +26 -19
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +17 -5
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +5 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +50 -11
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +4 -0
- 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 +3 -1
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +1 -0
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/AppShellSearch.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellSearch.styles.js +2 -0
- package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +3 -3
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +1 -0
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts +1 -1
- package/lib/components/AppShell/style-utils.d.ts +3 -0
- package/lib/components/AppShell/style-utils.d.ts.map +1 -1
- package/lib/components/AppShell/style-utils.js +40 -1
- package/lib/components/AppShell/style-utils.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +2 -2
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +19 -19
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Avatar/Avatar.test-ids.d.ts +1 -1
- package/lib/components/Avatar/Avatar.test-ids.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.test-ids.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.test-ids.d.ts.map +1 -1
- package/lib/components/Badges/Alert.d.ts +1 -1
- package/lib/components/Badges/Badges.test-ids.d.ts +6 -6
- package/lib/components/Badges/Badges.test-ids.d.ts.map +1 -1
- package/lib/components/Badges/Count.d.ts +1 -1
- package/lib/components/Badges/Keyboard.d.ts +1 -1
- package/lib/components/Badges/Selection.d.ts +1 -1
- package/lib/components/Badges/Selection.d.ts.map +1 -1
- package/lib/components/Badges/Selection.js +23 -20
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Status.d.ts +1 -1
- package/lib/components/Badges/Status.d.ts.map +1 -1
- package/lib/components/Badges/Status.js +0 -1
- package/lib/components/Badges/Status.js.map +1 -1
- package/lib/components/Badges/Tag.d.ts +1 -1
- package/lib/components/Banner/Banner.d.ts +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +3 -1
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/Banner.test-ids.d.ts +1 -1
- package/lib/components/Banner/Banner.test-ids.d.ts.map +1 -1
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +87 -58
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +8 -0
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.d.ts +3 -33
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -5
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +6 -23
- package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +3 -4
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +2 -4
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +8 -5
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.js +7 -1
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +8 -26
- 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 +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +21 -32
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts +2 -3
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.js +2 -3
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.types.d.ts +4 -13
- 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 +1 -0
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +58 -30
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Configuration/ThemeOverride.d.ts +11 -0
- package/lib/components/Configuration/ThemeOverride.d.ts.map +1 -0
- package/lib/components/Configuration/ThemeOverride.js +23 -0
- package/lib/components/Configuration/ThemeOverride.js.map +1 -0
- package/lib/components/Configuration/connected-watcher.d.ts +17 -0
- package/lib/components/Configuration/connected-watcher.d.ts.map +1 -0
- package/lib/components/Configuration/connected-watcher.js +13 -0
- package/lib/components/Configuration/connected-watcher.js.map +1 -0
- package/lib/components/Configuration/index.d.ts +1 -0
- package/lib/components/Configuration/index.d.ts.map +1 -1
- package/lib/components/Configuration/index.js +1 -0
- package/lib/components/Configuration/index.js.map +1 -1
- package/lib/components/Configuration/withConfiguration.d.ts.map +1 -1
- package/lib/components/Configuration/withConfiguration.js.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.d.ts +5 -25
- package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.js.map +1 -1
- package/lib/components/CreditCard/CreditCardDisplay.d.ts +2 -4
- package/lib/components/CreditCard/CreditCardDisplay.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCardDisplay.js +1 -2
- package/lib/components/CreditCard/CreditCardDisplay.js.map +1 -1
- package/lib/components/CreditCard/CreditCardInput.d.ts +15 -5
- package/lib/components/CreditCard/CreditCardInput.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCardInput.js +1 -2
- package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts +1 -1
- package/lib/components/Currency/CurrencyInput.js +1 -1
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/DangerButton/DangerButton.js +2 -2
- package/lib/components/DangerButton/DangerButton.js.map +1 -1
- package/lib/components/DateTime/DateTime.test-ids.d.ts +11 -11
- package/lib/components/DateTime/DateTime.test-ids.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.test-ids.js +5 -1
- package/lib/components/DateTime/DateTime.test-ids.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +30 -27
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +2 -2
- package/lib/components/DateTime/Input/DateRangeInput.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 +24 -16
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +26 -25
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.d.ts +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +21 -10
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +13 -7
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +2 -7
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js +3 -3
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +17 -6
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +2 -2
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +5 -2
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +28 -17
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts +1 -0
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.js +13 -5
- package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +18 -11
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +2 -1
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts +9 -0
- package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/utils.js +16 -0
- package/lib/components/DateTime/Picker/utils.js.map +1 -1
- package/lib/components/DateTime/index.d.ts +1 -1
- package/lib/components/DateTime/index.d.ts.map +1 -1
- package/lib/components/DateTime/index.js +1 -1
- package/lib/components/DateTime/index.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts +1 -0
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +13 -11
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
- package/lib/components/Email/EmailDisplay.js +2 -2
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/lib/components/EmptyState/EmptyState.js +5 -2
- package/lib/components/EmptyState/EmptyState.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +6 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +37 -15
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +39 -20
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +14 -10
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +13 -5
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts +2 -2
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts.map +1 -1
- 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/CompactList.d.ts +15 -0
- package/lib/components/File/CompactList.d.ts.map +1 -0
- package/lib/components/File/CompactList.js +21 -0
- package/lib/components/File/CompactList.js.map +1 -0
- package/lib/components/File/File.test-ids.d.ts +1 -1
- package/lib/components/File/File.test-ids.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.d.ts +5 -0
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js +2 -2
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileDisplayList.d.ts +4 -2
- package/lib/components/File/FileDisplayList.d.ts.map +1 -1
- package/lib/components/File/FileDisplayList.js +9 -3
- package/lib/components/File/FileDisplayList.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +32 -8
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +169 -74
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileInput.styles.d.ts +26 -0
- package/lib/components/File/FileInput.styles.d.ts.map +1 -0
- package/lib/components/File/FileInput.styles.js +166 -0
- package/lib/components/File/FileInput.styles.js.map +1 -0
- package/lib/components/File/FileItem.d.ts +16 -0
- package/lib/components/File/FileItem.d.ts.map +1 -1
- package/lib/components/File/FileItem.js +82 -27
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileList.d.ts +9 -3
- package/lib/components/File/FileList.d.ts.map +1 -1
- package/lib/components/File/FileList.js +53 -9
- package/lib/components/File/FileList.js.map +1 -1
- package/lib/components/File/FileUploadItem.d.ts +4 -0
- package/lib/components/File/FileUploadItem.d.ts.map +1 -1
- package/lib/components/File/FileUploadItem.js +42 -38
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.d.ts +1 -1
- package/lib/components/Form/Form.test-ids.d.ts +1 -1
- package/lib/components/Form/Form.test-ids.d.ts.map +1 -1
- package/lib/components/FormField/FormField.d.ts +2 -2
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +62 -64
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/FormField/FormField.test-ids.d.ts +1 -1
- package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
- package/lib/components/Fullscreen/Fullscreen.d.ts +18 -0
- package/lib/components/Fullscreen/Fullscreen.d.ts.map +1 -0
- package/lib/components/Fullscreen/Fullscreen.js +56 -0
- package/lib/components/Fullscreen/Fullscreen.js.map +1 -0
- package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts +2 -0
- package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts.map +1 -0
- package/lib/components/Fullscreen/Fullscreen.test-ids.js +3 -0
- package/lib/components/Fullscreen/Fullscreen.test-ids.js.map +1 -0
- package/lib/components/Fullscreen/FullscreenButton.d.ts +6 -0
- package/lib/components/Fullscreen/FullscreenButton.d.ts.map +1 -0
- package/lib/components/Fullscreen/FullscreenButton.js +33 -0
- package/lib/components/Fullscreen/FullscreenButton.js.map +1 -0
- package/lib/components/Fullscreen/index.d.ts +4 -0
- package/lib/components/Fullscreen/index.d.ts.map +1 -0
- package/lib/components/Fullscreen/index.js +4 -0
- package/lib/components/Fullscreen/index.js.map +1 -0
- package/lib/components/HTML/HTML.d.ts +1 -1
- package/lib/components/HTML/HTML.test-ids.d.ts +1 -1
- package/lib/components/HTML/HTML.test-ids.d.ts.map +1 -1
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.js +2 -2
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- 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/calendar-now.icon.d.ts +5 -0
- package/lib/components/Icon/icons/calendar-now.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/calendar-now.icon.js +7 -0
- package/lib/components/Icon/icons/calendar-now.icon.js.map +1 -0
- package/lib/components/Icon/icons/preview.icon.d.ts +5 -0
- package/lib/components/Icon/icons/preview.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/preview.icon.js +7 -0
- package/lib/components/Icon/icons/preview.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/arrow-down.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-down.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/arrow-down.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-left.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-left.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/arrow-left.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-right.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-right.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/arrow-right.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-up.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/arrow-up.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/arrow-up.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/calendar-now.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/calendar-now.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/calendar-now.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/calendar-now.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/caret-down.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-down.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/caret-down.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-left.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-left.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/caret-left.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-right.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-right.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/caret-right.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-up.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/caret-up.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/caret-up.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/case-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/case-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/clipboard-pencil-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/clipboard-pencil-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/clock-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/clock-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/disc-stack-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/dock.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/dock.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/dock.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/dock.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/expression.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/expression.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/expression.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/expression.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/indent.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/indent.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/indent.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/indent.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/information-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/information-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/list-number.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/list-number.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/list-number.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/list-number.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/open.icon.d.ts.map +1 -1
- package/lib/components/Icon/streamline-icons/open.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/open.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/rule-library-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/rule-library-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/search-analytics-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/search-analytics-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamline-icons/undock.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/undock.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/undock.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/undock.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/unindent.icon.d.ts +5 -0
- package/lib/components/Icon/streamline-icons/unindent.icon.d.ts.map +1 -0
- package/lib/components/Icon/streamline-icons/unindent.icon.js +7 -0
- package/lib/components/Icon/streamline-icons/unindent.icon.js.map +1 -0
- package/lib/components/Icon/streamline-icons/warn-solid.icon.js +1 -1
- package/lib/components/Icon/streamline-icons/warn-solid.icon.js.map +1 -1
- package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
- package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
- package/lib/components/Icon/streamlineIconNames.js +7 -0
- package/lib/components/Icon/streamlineIconNames.js.map +1 -1
- package/lib/components/IconPicker/IconPicker.d.ts +7 -1
- package/lib/components/IconPicker/IconPicker.d.ts.map +1 -1
- package/lib/components/IconPicker/IconPicker.js +20 -14
- package/lib/components/IconPicker/IconPicker.js.map +1 -1
- package/lib/components/Input/Input.d.ts +5 -8
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +2 -3
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.test-ids.d.ts +1 -1
- package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.js +13 -6
- package/lib/components/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.test-ids.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.test-ids.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
- package/lib/components/Link/Link.d.ts +5 -2
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js +45 -17
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/Link/Link.test-ids.d.ts +1 -1
- package/lib/components/Link/Link.test-ids.d.ts.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 +8 -7
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +5 -5
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.js +4 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +7 -3
- 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/PresetMenuPopover.d.ts.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +2 -2
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
- package/lib/components/ListToolbar/helpers.d.ts.map +1 -1
- package/lib/components/ListToolbar/helpers.js.map +1 -1
- package/lib/components/Location/CurrentLocationButton.d.ts +1 -6
- package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +10 -20
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/Location.test-ids.d.ts +1 -1
- package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
- package/lib/components/Location/Location.types.d.ts +49 -17
- package/lib/components/Location/Location.types.d.ts.map +1 -1
- package/lib/components/Location/Location.types.js +9 -1
- package/lib/components/Location/Location.types.js.map +1 -1
- package/lib/components/Location/LocationDisplay.d.ts +5 -4
- package/lib/components/Location/LocationDisplay.d.ts.map +1 -1
- package/lib/components/Location/LocationDisplay.js +17 -4
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.d.ts +23 -18
- package/lib/components/Location/LocationInput.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.js +37 -15
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.d.ts +26 -12
- package/lib/components/Location/LocationView.d.ts.map +1 -1
- package/lib/components/Location/LocationView.js +103 -50
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/index.d.ts +2 -2
- package/lib/components/Location/index.d.ts.map +1 -1
- package/lib/components/Location/index.js +1 -1
- package/lib/components/Location/index.js.map +1 -1
- package/lib/components/Location/utils.d.ts +2 -2
- package/lib/components/Location/utils.d.ts.map +1 -1
- package/lib/components/Location/utils.js +67 -38
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/Menu.context.d.ts.map +1 -1
- package/lib/components/Menu/Menu.context.js +1 -0
- package/lib/components/Menu/Menu.context.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +6 -2
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +0 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +2 -9
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.test-ids.d.ts +2 -2
- package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +14 -2
- 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/Menu.utils.d.ts +4 -0
- package/lib/components/Menu/Menu.utils.d.ts.map +1 -0
- package/lib/components/Menu/Menu.utils.js +6 -0
- package/lib/components/Menu/Menu.utils.js.map +1 -0
- package/lib/components/Menu/MenuGroup.js +2 -2
- package/lib/components/Menu/MenuGroup.js.map +1 -1
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +3 -3
- 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/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +1 -3
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/Menu/index.d.ts +1 -0
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -0
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +8 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +24 -14
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts +1 -1
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts.map +1 -1
- package/lib/components/MetaList/MetaList.d.ts +1 -1
- package/lib/components/MetaList/MetaList.test-ids.d.ts +1 -1
- package/lib/components/MetaList/MetaList.test-ids.d.ts.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +31 -7
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +3 -1
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
- package/lib/components/Modal/Modal.styles.js +34 -17
- 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 -1
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +28 -1
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/Number/Number.test-ids.d.ts +2 -2
- package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.d.ts +5 -8
- package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.js +1 -2
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.d.ts +2 -4
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +15 -7
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +12 -30
- 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 +2 -4
- package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
- package/lib/components/Number/NumberRangeInput.js +7 -72
- package/lib/components/Number/NumberRangeInput.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +3 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.js +2 -0
- package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +41 -6
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +1 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +85 -31
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +20 -5
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +2 -0
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +20 -3
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +2 -2
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +11 -5
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Progress.d.ts.map +1 -1
- package/lib/components/Progress/Progress.js +2 -2
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts +1 -1
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
- package/lib/components/Progress/Progress.styles.js +7 -7
- package/lib/components/Progress/Progress.styles.js.map +1 -1
- package/lib/components/Progress/Progress.types.d.ts +4 -0
- package/lib/components/Progress/Progress.types.d.ts.map +1 -1
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts +6 -30
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +1 -2
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +19 -6
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +5 -1
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.d.ts +3 -3
- package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js +15 -15
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.test-ids.d.ts +1 -1
- package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +6 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +13 -5
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts +1 -1
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +9 -9
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/Tabs/Tab.d.ts +7 -3
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +83 -23
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +13 -2
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +60 -5
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts +0 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +97 -35
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/Tabs.styles.d.ts +17 -0
- package/lib/components/Tabs/Tabs.styles.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.styles.js +110 -0
- package/lib/components/Tabs/Tabs.styles.js.map +1 -0
- package/lib/components/Tabs/TabsContext.d.ts +6 -0
- package/lib/components/Tabs/TabsContext.d.ts.map +1 -0
- package/lib/components/Tabs/TabsContext.js +6 -0
- package/lib/components/Tabs/TabsContext.js.map +1 -0
- package/lib/components/Tabs/index.d.ts +1 -0
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/Tabs/index.js +1 -0
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.d.ts +1 -1
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +117 -21
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/Toaster.test-ids.d.ts +1 -1
- package/lib/components/Toaster/Toaster.test-ids.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.types.d.ts +17 -4
- package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.types.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +8 -3
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +20 -5
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.test-ids.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.test-ids.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.styles.d.ts +1 -1
- package/lib/components/Tree/Tree.d.ts +1 -1
- package/lib/components/Tree/Tree.test-ids.d.ts +2 -2
- package/lib/components/Tree/Tree.test-ids.d.ts.map +1 -1
- 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/useArrows.d.ts.map +1 -1
- package/lib/hooks/useArrows.js +3 -1
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/hooks/useEvent.d.ts +5 -0
- package/lib/hooks/useEvent.d.ts.map +1 -1
- package/lib/hooks/useEvent.js.map +1 -1
- package/lib/hooks/useFocusWithin.d.ts.map +1 -1
- package/lib/hooks/useFocusWithin.js +14 -8
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +155 -4
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useRefMap.d.ts +8 -0
- package/lib/hooks/useRefMap.d.ts.map +1 -0
- package/lib/hooks/useRefMap.js +27 -0
- package/lib/hooks/useRefMap.js.map +1 -0
- package/lib/hooks/useScrollToggle.d.ts.map +1 -1
- package/lib/hooks/useScrollToggle.js +1 -0
- package/lib/hooks/useScrollToggle.js.map +1 -1
- package/lib/hooks/useSimpleStoreInstance.d.ts +9 -0
- package/lib/hooks/useSimpleStoreInstance.d.ts.map +1 -0
- package/lib/hooks/useSimpleStoreInstance.js +13 -0
- package/lib/hooks/useSimpleStoreInstance.js.map +1 -0
- package/lib/hooks/useTestIds.d.ts +1 -1
- package/lib/hooks/useTestIds.d.ts.map +1 -1
- package/lib/hooks/useTestIds.js +1 -1
- package/lib/hooks/useTestIds.js.map +1 -1
- package/lib/i18n/default.d.ts +155 -4
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +178 -11
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +155 -4
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/styles/GlobalStyle.d.ts +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +6 -1
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/styles/mixins.d.ts +3 -0
- package/lib/styles/mixins.d.ts.map +1 -0
- package/lib/styles/mixins.js +14 -0
- package/lib/styles/mixins.js.map +1 -0
- package/lib/theme/ThemeMachine.d.ts.map +1 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/theme.d.ts +18 -24
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +9 -14
- package/lib/theme/themeOverrides.schema.json +13 -18
- package/lib/types/types.d.ts +6 -4
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/createStringMatcher.d.ts +1 -1
- package/lib/utils/createStringMatcher.d.ts.map +1 -1
- package/lib/utils/createStringMatcher.js +4 -1
- package/lib/utils/createStringMatcher.js.map +1 -1
- package/lib/utils/formatListToLocaleString.d.ts.map +1 -1
- package/lib/utils/formatListToLocaleString.js +5 -2
- package/lib/utils/formatListToLocaleString.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isPositionWithinRect.d.ts +12 -0
- package/lib/utils/isPositionWithinRect.d.ts.map +1 -0
- package/lib/utils/isPositionWithinRect.js +11 -0
- package/lib/utils/isPositionWithinRect.js.map +1 -0
- package/lib/utils/withTestIds.d.ts +1 -1
- package/package.json +10 -7
- package/lib/components/Location/types.d.ts +0 -45
- package/lib/components/Location/types.d.ts.map +0 -1
- package/lib/components/Location/types.js +0 -10
- package/lib/components/Location/types.js.map +0 -1
|
@@ -3,12 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useContext } from 'react';
|
|
4
4
|
import Flex from '../Flex';
|
|
5
5
|
import MenuContext from './Menu.context';
|
|
6
|
-
import { StyledMenuGroupHeader
|
|
6
|
+
import { StyledMenuGroupHeader } from './Menu.styles';
|
|
7
7
|
import MenuItem from './MenuItem';
|
|
8
8
|
const MenuGroup = ({ id, label, items, itemRole }) => {
|
|
9
9
|
const { componentId } = useContext(MenuContext);
|
|
10
10
|
const groupId = `${componentId}-${id}`;
|
|
11
|
-
return (_jsxs("li", { role: 'presentation', children: [_jsx(Flex, { container: { alignItems: 'center', pad: [0.5, 1] }, as: StyledMenuGroupHeader, id: groupId, children: label }), _jsx(
|
|
11
|
+
return (_jsxs("li", { role: 'presentation', children: [_jsx(Flex, { container: { alignItems: 'center', pad: [0.5, 1] }, as: StyledMenuGroupHeader, id: groupId, children: label }), _jsx("ul", { role: 'group', "aria-labelledby": groupId, children: items.length > 0 &&
|
|
12
12
|
items.map(item => {
|
|
13
13
|
return _createElement(MenuItem, { ...item, key: item.id, role: itemRole ?? 'menuitem' });
|
|
14
14
|
}) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuGroup.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuGroup.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"MenuGroup.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuGroup.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,SAAS,GAAqD,CAAC,EACnE,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACsB,EAAE,EAAE;IAClC,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAEhD,MAAM,OAAO,GAAG,GAAG,WAAW,IAAI,EAAE,EAAE,CAAC;IACvC,OAAO,CACL,cAAI,IAAI,EAAC,cAAc,aACrB,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAClD,EAAE,EAAE,qBAAqB,EACzB,EAAE,EAAE,OAAO,YAEV,KAAK,GACD,EACP,aAAI,IAAI,EAAC,OAAO,qBAAkB,OAAO,YACtC,KAAK,CAAC,MAAM,GAAG,CAAC;oBACf,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;wBACf,OAAO,eAAC,QAAQ,OAAK,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,IAAI,UAAU,GAAI,CAAC;oBAC5E,CAAC,CAAC,GACD,IACF,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useContext } from 'react';\nimport type { FunctionComponent } from 'react';\n\nimport type { ForwardProps } from '../../types';\nimport Flex from '../Flex';\n\nimport MenuContext from './Menu.context';\nimport { StyledMenuGroupHeader } from './Menu.styles';\nimport type { MenuGroupProps } from './Menu.types';\nimport MenuItem from './MenuItem';\n\nconst MenuGroup: FunctionComponent<MenuGroupProps & ForwardProps> = ({\n id,\n label,\n items,\n itemRole\n}: MenuGroupProps & ForwardProps) => {\n const { componentId } = useContext(MenuContext);\n\n const groupId = `${componentId}-${id}`;\n return (\n <li role='presentation'>\n <Flex\n container={{ alignItems: 'center', pad: [0.5, 1] }}\n as={StyledMenuGroupHeader}\n id={groupId}\n >\n {label}\n </Flex>\n <ul role='group' aria-labelledby={groupId}>\n {items.length > 0 &&\n items.map(item => {\n return <MenuItem {...item} key={item.id} role={itemRole ?? 'menuitem'} />;\n })}\n </ul>\n </li>\n );\n};\n\nexport default MenuGroup;\n"]}
|
|
@@ -2,7 +2,7 @@ import type { FunctionComponent } from 'react';
|
|
|
2
2
|
import type { ForwardProps } from '../../types';
|
|
3
3
|
import type { MenuItemProps } from './Menu.types';
|
|
4
4
|
declare const _default: FunctionComponent<MenuItemProps & ForwardProps> & {
|
|
5
|
-
getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
5
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
8
|
//# sourceMappingURL=MenuItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD,OAAO,KAAK,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD,OAAO,KAAK,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;;;;AA8Q7E,wBAAyD"}
|
|
@@ -36,7 +36,7 @@ const AncestorPath = ({ ancestors = [] }) => {
|
|
|
36
36
|
};
|
|
37
37
|
const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, items, selected, partial, href, tooltip, onClick, onExpand, disabled, role = 'menuitem', ...restProps }) => {
|
|
38
38
|
const t = useI18n();
|
|
39
|
-
const { mode, onItemClick, accent, variant: menuVariant, setFocusDescendant, getScopedItemId, arrowNavigationUnsupported } = useContext(MenuContext);
|
|
39
|
+
const { mode, onItemClick, itemLayout, accent, variant: menuVariant, setFocusDescendant, getScopedItemId, arrowNavigationUnsupported } = useContext(MenuContext);
|
|
40
40
|
const testIds = useTestIds(testId, getMenuItemTestIds);
|
|
41
41
|
const { announcePolite } = useLiveLog();
|
|
42
42
|
const selectionMode = mode === 'single-select' || mode === 'multi-select';
|
|
@@ -68,9 +68,9 @@ const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, it
|
|
|
68
68
|
}
|
|
69
69
|
const secondaryContent = ancestors ? (_jsx(AncestorPath, { ancestors: ancestors })) : (secondary && _jsx(MetaList, { items: secondary, id: secondaryId }));
|
|
70
70
|
const [summaryItemRef, setSummaryItemRef] = useElement();
|
|
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: {
|
|
71
|
+
const summaryItem = (_jsxs(_Fragment, { children: [_jsx(SummaryItem, { ref: setSummaryItemRef, primary: accentedPrimary || (!items ? _jsx(Text, { children: primary }) : primary), secondary: secondaryContent, layout: itemLayout, visual: visual, actions: items || count ? (_jsxs(Flex, { container: { gap: 1, alignItems: 'center', justify: '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: {
|
|
72
72
|
colGap: 1
|
|
73
|
-
} }), tooltip && (_jsx(Tooltip, { target: summaryItemRef, hideDelay: 'none', showDelay: '
|
|
73
|
+
} }), tooltip && (_jsx(Tooltip, { target: summaryItemRef, hideDelay: 'none', showDelay: 'short', children: tooltip }))] }));
|
|
74
74
|
const itemLabel = useMemo(() => {
|
|
75
75
|
let label = '';
|
|
76
76
|
let collapsedLabel = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,WAAW,MAAM,WAAW,CAAC;AAEpC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,YAAY,CAAC,aAAa,EAAE,cA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,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC5C,cAAc,CAAC;oBACb,kEAAkE;oBAClE,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;oBACpF,IAAI,EAAE,iBAAiB;iBACxB,CAAC,CAAC;aACJ;YACD,OAAO,KAAK,IAAI,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACrF,CAAC,EACD,YAAY,EAAE,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAClE,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,CAAC,CAAC,KAAK,mBACN,CAAC,CAAC,QAAQ,EACzB,gBAAgB,EAAE,gBAAgB,aAEjC,aAAa,IAAI,CAAC,CAAC,KAAK,IAAI,gBAAgB,CAAC,IAAI,KAAC,mBAAmB,IAAC,IAAI,EAAC,OAAO,GAAG,EAErF,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CACxB,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAC,IAAI,YAClC,WAAW,GACD,CACd,CAAC,CAAC,CAAC,CACF,WAAW,CACZ,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Fragment, useCallback, useContext, useMemo } from 'react';\nimport type { FunctionComponent, MouseEvent } from 'react';\n\nimport MetaList from '../MetaList';\nimport SummaryItem from '../SummaryItem';\nimport type { ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport Text from '../Text';\nimport { Count } from '../Badges';\nimport BareButton from '../Button/BareButton';\nimport { replaceMatchWithElement, withTestIds } from '../../utils';\nimport { useElement, useI18n, useDirection, useLiveLog, useTestIds } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Mark from '../Mark';\nimport Button from '../Button';\n\nimport menuHelpers from './helpers';\nimport type { AcceptedMouseEventElement, MenuItemProps } from './Menu.types';\nimport MenuContext from './Menu.context';\nimport { StyledAncestors, StyledCheckMarkIcon, StyledMenuItem } from './Menu.styles';\nimport { getMenuItemTestIds } from './Menu.test-ids';\n\nregisterIcon(caretLeftIcon, caretRightIcon, checkIcon);\n\nconst DrillDown = ({\n expandHandler\n}: {\n expandHandler?: (e: MouseEvent<AcceptedMouseEventElement>) => void;\n}) => {\n const { end } = useDirection();\n\n const icon = <Icon name={`caret-${end}`} />;\n\n return expandHandler ? (\n <Button as='span' icon variant='simple' aria-hidden onClick={expandHandler}>\n {icon}\n </Button>\n ) : (\n icon\n );\n};\n\nconst AncestorPath = ({ ancestors = [] }: Pick<MenuItemProps, 'ancestors'>) => {\n const truncatedPath = ancestors.length > 2;\n const pathParts = truncatedPath ? [ancestors[0], ancestors[ancestors.length - 1]] : ancestors;\n\n const { end } = useDirection();\n\n return (\n <Flex\n container={{ gap: 0.5, alignItems: 'center' }}\n as={StyledAncestors}\n title={ancestors.map(a => (menuHelpers.isItem(a) ? a.primary : a.label)).join(' > ')}\n >\n {pathParts.map((ancestor, i, arr) => {\n const label = menuHelpers.isItem(ancestor) ? ancestor.primary : ancestor.label;\n return (\n <Fragment key={label}>\n <Text variant='secondary'>{label}</Text>\n {i < arr.length - 1 && (\n <>\n <Text variant='secondary'>\n <Icon name={`caret-${end}`} />\n </Text>\n {truncatedPath && (\n <>\n <Text variant='secondary'>…</Text>\n <Text variant='secondary'>\n <Icon name={`caret-${end}`} />\n </Text>\n </>\n )}\n </>\n )}\n </Fragment>\n );\n })}\n </Flex>\n );\n};\n\nconst MenuItem: FunctionComponent<MenuItemProps & ForwardProps> = ({\n testId,\n id,\n primary,\n secondary,\n ancestors,\n visual,\n count,\n items,\n selected,\n partial,\n href,\n tooltip,\n onClick,\n onExpand,\n disabled,\n role = 'menuitem',\n ...restProps\n}: MenuItemProps & ForwardProps) => {\n const t = useI18n();\n const {\n mode,\n onItemClick,\n accent,\n variant: menuVariant,\n setFocusDescendant,\n getScopedItemId,\n arrowNavigationUnsupported\n } = useContext(MenuContext);\n\n const testIds = useTestIds(testId, getMenuItemTestIds);\n\n const { announcePolite } = useLiveLog();\n\n const selectionMode = mode === 'single-select' || mode === 'multi-select';\n const selectableParent = items && typeof selected === 'boolean';\n const itemId = useMemo(() => getScopedItemId(id), [id, getScopedItemId]);\n\n const itemCountId = `${id}-count`;\n const secondaryId = `${id}-secondary`;\n\n const clickHandler = useCallback(\n (e: MouseEvent<AcceptedMouseEventElement>) => {\n const mouseClick = e.detail > 0;\n\n if (mouseClick) {\n const target = e.target as HTMLElement;\n const focusAtEl =\n target.getAttribute('role') === role ? target : target.closest(`li[role=\"${role}\"]`);\n\n if (focusAtEl) setFocusDescendant(focusAtEl as HTMLElement);\n }\n onClick?.(id, e);\n onItemClick?.(id, e);\n },\n [onClick, onItemClick, id]\n );\n\n const expandHandler = useCallback(\n (e: MouseEvent<AcceptedMouseEventElement>) => {\n onExpand?.(id, e);\n e.stopPropagation();\n },\n [onExpand, id]\n );\n\n let accentedPrimary;\n if (accent && !items) {\n const accentRegex = typeof accent === 'function' ? accent(primary) : accent;\n accentedPrimary = replaceMatchWithElement(primary, accentRegex, str => {\n return <Mark>{str}</Mark>;\n });\n }\n\n const secondaryContent = ancestors ? (\n <AncestorPath ancestors={ancestors} />\n ) : (\n secondary && <MetaList items={secondary} id={secondaryId} />\n );\n\n const [summaryItemRef, setSummaryItemRef] = useElement();\n\n const summaryItem = (\n <>\n <SummaryItem\n ref={setSummaryItemRef}\n primary={accentedPrimary || (!items ? <Text>{primary}</Text> : primary)}\n secondary={secondaryContent}\n visual={visual}\n actions={\n items || count ? (\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n {count !== undefined && (\n <Count id={itemCountId} aria-label={t('menu_item_count', [count])}>\n {count}\n </Count>\n )}\n {items && <DrillDown expandHandler={selectableParent ? expandHandler : undefined} />}\n </Flex>\n ) : undefined\n }\n container={{\n colGap: 1\n }}\n />\n {tooltip && (\n <Tooltip target={summaryItemRef} hideDelay='none' showDelay='none' portal>\n {tooltip}\n </Tooltip>\n )}\n </>\n );\n\n const itemLabel = useMemo(() => {\n let label = '';\n let collapsedLabel = '';\n if (selectableParent && selectionMode) {\n const selectedParentItemLabel = selected\n ? t('selected_noun', [primary])\n : t('unselected_noun', [primary]);\n collapsedLabel = t('menu_collapsed', [selectedParentItemLabel]);\n } else {\n collapsedLabel = t('menu_collapsed', [primary]);\n }\n if (selectionMode && !items) {\n label = selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]);\n } else {\n label = primary;\n }\n if (items) {\n return arrowNavigationUnsupported\n ? t('menu_item_shift_space_expand_collapse', [collapsedLabel])\n : t('menu_item_expand_arrow', [collapsedLabel]);\n }\n return label;\n }, [selected, primary, items]);\n\n const ariaDescribedBy = useMemo(() => {\n const hasSecondary = !!secondary;\n let idString: string;\n\n if (hasSecondary) {\n idString = secondaryId;\n if (count !== undefined && count >= 0) {\n idString = `${idString} ${itemCountId}`;\n }\n } else if (count !== undefined && count >= 0) {\n idString = itemCountId;\n } else idString = '';\n\n return idString;\n }, [items, secondary, itemCountId, secondaryId]);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ alignItems: 'center', justify: 'between', gap: 1 }}\n id={itemId}\n as={StyledMenuItem}\n aria-label={itemLabel}\n aria-describedby={ariaDescribedBy}\n role={role}\n aria-disabled={disabled}\n data-expand={!!items}\n tabIndex={-1}\n disabled={disabled}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n e.preventDefault();\n }}\n onClick={(e: MouseEvent<AcceptedMouseEventElement>) => {\n if (disabled) {\n return;\n }\n /** Announce only on keyboard selection since mouse selection will automatically detect and act on the DOM aria attribute changes */\n if (e.detail === 0 && selected !== undefined) {\n announcePolite({\n /** selected is still not updated so putting the reverse logic. */\n message: !selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]),\n type: 'acknowledgement'\n });\n }\n return items && typeof selected !== 'boolean' ? expandHandler(e) : clickHandler(e);\n }}\n onMouseEnter={menuVariant === 'flyout' ? expandHandler : undefined}\n href={href}\n mode={mode}\n isParentItem={!!items}\n aria-selected={!!selected}\n selectableParent={selectableParent}\n >\n {selectionMode && (!items || selectableParent) && <StyledCheckMarkIcon name='check' />}\n\n {href && !selectionMode ? (\n <BareButton href={href} tabIndex='-1'>\n {summaryItem}\n </BareButton>\n ) : (\n summaryItem\n )}\n </Flex>\n );\n};\n\nexport default withTestIds(MenuItem, getMenuItemTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,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AAK,mBACN,CAAC,CAAC,QAAQ,EACzB,gBAAgB,EAAE,gBAAgB,aAEjC,aAAa,IAAI,CAAC,CAAC,KAAK,IAAI,gBAAgB,CAAC,IAAI,KAAC,mBAAmB,IAAC,IAAI,EAAC,OAAO,GAAG,EAErF,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CACxB,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAC,IAAI,YAClC,WAAW,GACD,CACd,CAAC,CAAC,CAAC,CACF,WAAW,CACZ,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Fragment, useCallback, useContext, useMemo } from 'react';\nimport type { FunctionComponent, MouseEvent } from 'react';\n\nimport MetaList from '../MetaList';\nimport SummaryItem from '../SummaryItem';\nimport type { ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport Text from '../Text';\nimport { Count } from '../Badges';\nimport BareButton from '../Button/BareButton';\nimport { replaceMatchWithElement, withTestIds } from '../../utils';\nimport { useElement, useI18n, useDirection, useLiveLog, useTestIds } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Mark from '../Mark';\nimport Button from '../Button';\n\nimport menuHelpers from './helpers';\nimport type { AcceptedMouseEventElement, MenuItemProps } from './Menu.types';\nimport MenuContext from './Menu.context';\nimport { StyledAncestors, StyledCheckMarkIcon, StyledMenuItem } from './Menu.styles';\nimport { getMenuItemTestIds } from './Menu.test-ids';\n\nregisterIcon(caretLeftIcon, caretRightIcon, checkIcon);\n\nconst DrillDown = ({\n expandHandler\n}: {\n expandHandler?: (e: MouseEvent<AcceptedMouseEventElement>) => void;\n}) => {\n const { end } = useDirection();\n\n const icon = <Icon name={`caret-${end}`} />;\n\n return expandHandler ? (\n <Button as='span' icon variant='simple' aria-hidden onClick={expandHandler}>\n {icon}\n </Button>\n ) : (\n icon\n );\n};\n\nconst AncestorPath = ({ ancestors = [] }: Pick<MenuItemProps, 'ancestors'>) => {\n const truncatedPath = ancestors.length > 2;\n const pathParts = truncatedPath ? [ancestors[0], ancestors[ancestors.length - 1]] : ancestors;\n\n const { end } = useDirection();\n\n return (\n <Flex\n container={{ gap: 0.5, alignItems: 'center' }}\n as={StyledAncestors}\n title={ancestors.map(a => (menuHelpers.isItem(a) ? a.primary : a.label)).join(' > ')}\n >\n {pathParts.map((ancestor, i, arr) => {\n const label = menuHelpers.isItem(ancestor) ? ancestor.primary : ancestor.label;\n return (\n <Fragment key={label}>\n <Text variant='secondary'>{label}</Text>\n {i < arr.length - 1 && (\n <>\n <Text variant='secondary'>\n <Icon name={`caret-${end}`} />\n </Text>\n {truncatedPath && (\n <>\n <Text variant='secondary'>…</Text>\n <Text variant='secondary'>\n <Icon name={`caret-${end}`} />\n </Text>\n </>\n )}\n </>\n )}\n </Fragment>\n );\n })}\n </Flex>\n );\n};\n\nconst MenuItem: FunctionComponent<MenuItemProps & ForwardProps> = ({\n testId,\n id,\n primary,\n secondary,\n ancestors,\n visual,\n count,\n items,\n selected,\n partial,\n href,\n tooltip,\n onClick,\n onExpand,\n disabled,\n role = 'menuitem',\n ...restProps\n}: MenuItemProps & ForwardProps) => {\n const t = useI18n();\n const {\n mode,\n onItemClick,\n itemLayout,\n accent,\n variant: menuVariant,\n setFocusDescendant,\n getScopedItemId,\n arrowNavigationUnsupported\n } = useContext(MenuContext);\n\n const testIds = useTestIds(testId, getMenuItemTestIds);\n\n const { announcePolite } = useLiveLog();\n\n const selectionMode = mode === 'single-select' || mode === 'multi-select';\n const selectableParent = items && typeof selected === 'boolean';\n const itemId = useMemo(() => getScopedItemId(id), [id, getScopedItemId]);\n\n const itemCountId = `${id}-count`;\n const secondaryId = `${id}-secondary`;\n\n const clickHandler = useCallback(\n (e: MouseEvent<AcceptedMouseEventElement>) => {\n const mouseClick = e.detail > 0;\n\n if (mouseClick) {\n const target = e.target as HTMLElement;\n const focusAtEl =\n target.getAttribute('role') === role ? target : target.closest(`li[role=\"${role}\"]`);\n\n if (focusAtEl) setFocusDescendant(focusAtEl as HTMLElement);\n }\n onClick?.(id, e);\n onItemClick?.(id, e);\n },\n [onClick, onItemClick, id]\n );\n\n const expandHandler = useCallback(\n (e: MouseEvent<AcceptedMouseEventElement>) => {\n onExpand?.(id, e);\n e.stopPropagation();\n },\n [onExpand, id]\n );\n\n let accentedPrimary;\n if (accent && !items) {\n const accentRegex = typeof accent === 'function' ? accent(primary) : accent;\n accentedPrimary = replaceMatchWithElement(primary, accentRegex, str => {\n return <Mark>{str}</Mark>;\n });\n }\n\n const secondaryContent = ancestors ? (\n <AncestorPath ancestors={ancestors} />\n ) : (\n secondary && <MetaList items={secondary} id={secondaryId} />\n );\n\n const [summaryItemRef, setSummaryItemRef] = useElement();\n\n const summaryItem = (\n <>\n <SummaryItem\n ref={setSummaryItemRef}\n primary={accentedPrimary || (!items ? <Text>{primary}</Text> : primary)}\n secondary={secondaryContent}\n layout={itemLayout}\n visual={visual}\n actions={\n items || count ? (\n <Flex container={{ gap: 1, alignItems: 'center', justify: 'center' }}>\n {count !== undefined && (\n <Count id={itemCountId} aria-label={t('menu_item_count', [count])}>\n {count}\n </Count>\n )}\n {items && <DrillDown expandHandler={selectableParent ? expandHandler : undefined} />}\n </Flex>\n ) : undefined\n }\n container={{\n colGap: 1\n }}\n />\n {tooltip && (\n <Tooltip target={summaryItemRef} hideDelay='none' showDelay='short'>\n {tooltip}\n </Tooltip>\n )}\n </>\n );\n\n const itemLabel = useMemo(() => {\n let label = '';\n let collapsedLabel = '';\n if (selectableParent && selectionMode) {\n const selectedParentItemLabel = selected\n ? t('selected_noun', [primary])\n : t('unselected_noun', [primary]);\n collapsedLabel = t('menu_collapsed', [selectedParentItemLabel]);\n } else {\n collapsedLabel = t('menu_collapsed', [primary]);\n }\n if (selectionMode && !items) {\n label = selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]);\n } else {\n label = primary;\n }\n if (items) {\n return arrowNavigationUnsupported\n ? t('menu_item_shift_space_expand_collapse', [collapsedLabel])\n : t('menu_item_expand_arrow', [collapsedLabel]);\n }\n return label;\n }, [selected, primary, items]);\n\n const ariaDescribedBy = useMemo(() => {\n const hasSecondary = !!secondary;\n let idString: string;\n\n if (hasSecondary) {\n idString = secondaryId;\n if (count !== undefined && count >= 0) {\n idString = `${idString} ${itemCountId}`;\n }\n } else if (count !== undefined && count >= 0) {\n idString = itemCountId;\n } else idString = '';\n\n return idString;\n }, [items, secondary, itemCountId, secondaryId]);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ alignItems: 'center', justify: 'between', gap: 1 }}\n id={itemId}\n as={StyledMenuItem}\n aria-label={itemLabel}\n aria-describedby={ariaDescribedBy}\n role={role}\n aria-disabled={disabled}\n data-expand={!!items}\n tabIndex={-1}\n disabled={disabled}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n e.preventDefault();\n }}\n onClick={(e: MouseEvent<AcceptedMouseEventElement>) => {\n if (disabled) {\n return;\n }\n /** Announce only on keyboard selection since mouse selection will automatically detect and act on the DOM aria attribute changes */\n if (e.detail === 0 && selected !== undefined) {\n announcePolite({\n /** selected is still not updated so putting the reverse logic. */\n message: !selected ? t('selected_noun', [primary]) : t('unselected_noun', [primary]),\n type: 'acknowledgement'\n });\n }\n return items && typeof selected !== 'boolean' ? expandHandler(e) : clickHandler(e);\n }}\n onMouseEnter={menuVariant === 'flyout' ? expandHandler : undefined}\n href={href}\n mode={mode}\n isParentItem={!!items}\n aria-selected={!!selected}\n selectableParent={selectableParent}\n >\n {selectionMode && (!items || selectableParent) && <StyledCheckMarkIcon name='check' />}\n\n {href && !selectionMode ? (\n <BareButton href={href} tabIndex='-1'>\n {summaryItem}\n </BareButton>\n ) : (\n summaryItem\n )}\n </Flex>\n );\n};\n\nexport default withTestIds(MenuItem, getMenuItemTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AAE9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD,OAAO,KAAK,EAEV,aAAa,EAGd,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AAE9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD,OAAO,KAAK,EAEV,aAAa,EAGd,MAAM,cAAc,CAAC;AAoCtB,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAqN7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -19,14 +19,14 @@ const setParentDisabled = (fieldset, bool) => {
|
|
|
19
19
|
legendButton.disabled = bool;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
const countVisibleItems = (menuItems) => {
|
|
22
|
+
const countVisibleItems = (menuItems, loading) => {
|
|
23
23
|
return menuItems.reduce((acc, item) => {
|
|
24
24
|
const isFlatGroup = !helpers.isItem(item);
|
|
25
25
|
if (isFlatGroup && item.items) {
|
|
26
26
|
return acc + item.items.length + 1;
|
|
27
27
|
}
|
|
28
28
|
return acc + 1;
|
|
29
|
-
}, 0);
|
|
29
|
+
}, loading ? 1 : 0);
|
|
30
30
|
};
|
|
31
31
|
const MenuList = forwardRef(function MenuListFunction({ items, parent, id, menuRole, ...restProps }, ref) {
|
|
32
32
|
const t = useI18n();
|
|
@@ -47,7 +47,7 @@ const MenuList = forwardRef(function MenuListFunction({ items, parent, id, menuR
|
|
|
47
47
|
if (!selfRef.current || expandedItem)
|
|
48
48
|
return;
|
|
49
49
|
menuListWrapperRef.current = selfRef.current.parentElement;
|
|
50
|
-
resizeRootEl(selfRef.current, menuListWrapperRef.current, countVisibleItems(items), scrollAt);
|
|
50
|
+
resizeRootEl(selfRef.current, menuListWrapperRef.current, countVisibleItems(items, loading), scrollAt);
|
|
51
51
|
});
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (parent)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,EACZ,MAAM,OAAO,CAAC;AAIf,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,UAAU,MAAM,eAAe,CAAC;AAQvC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,iBAAiB,GAAG,CAAC,QAA6B,EAAE,IAAa,EAAE,EAAE;IACzE,QAAQ,CAAC,QAAQ,GAAG,IAAI,C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AAY,CACV,MAAM,CAAC,EAAE,EACT,kBAAkB,CAAC,OAAO,EAC1B,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,EACtC,QAAQ,CACT,CAAC;qBACH;oBAED,IAAI,OAAO,CAAC,OAAO,EAAE;wBACnB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;qBACrC;gBACH,CAAC,EACD,YAAY,EAAE,GAAG,EAAE;oBACjB,IAAI,MAAM,EAAE;wBACV,YAAY,EAAE,KAAK,EAAE,CAAC;wBAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;wBAChD,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;wBAElC,IAAI,SAAS,EAAE;4BACb,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;yBAC5C;wBAED,cAAc,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBACjC,uBAAuB,EAAE,CAAC;qBAC3B;gBACH,CAAC,YAEA,IAAI,GACE,EAER,YAAY,IAAI,OAAO,CAAC,OAAO,IAAI,CAClC,KAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,MAAM,EAAE;oBACN,EAAE,EAAE,OAAO,CAAC,OAAO;oBACnB,IAAI,EAAE,YAAY;oBAClB,YAAY,EAAE,KAAK;oBACnB,eAAe;oBACf,cAAc;iBACf,EACD,QAAQ,EAAE,QAAQ,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n useMemo,\n Fragment,\n useCallback\n} from 'react';\nimport type { FunctionComponent, MutableRefObject, PropsWithoutRef, MouseEvent } from 'react';\n\nimport type { ForwardProps } from '../../types';\nimport Drawer from '../Drawer';\nimport {\n useAfterInitialEffect,\n useConsolidatedRef,\n useItemIntersection,\n useI18n,\n useDirection,\n useLiveLog\n} from '../../hooks';\nimport Progress from '../Progress';\nimport EmptyState from '../EmptyState';\n\nimport type {\n AcceptedMouseEventElement,\n MenuListProps,\n ParentMenuItemProps,\n MenuItemProps\n} from './Menu.types';\nimport MenuContext from './Menu.context';\nimport MenuListHeader from './MenuListHeader';\nimport MenuItem from './MenuItem';\nimport helpers from './helpers';\nimport {\n StyledLoadingItem,\n StyledMenuList,\n StyledMenuListContainer,\n StyledSeparator\n} from './Menu.styles';\nimport { resizeRootEl } from './NavItemsList';\nimport MenuGroup from './MenuGroup';\n\nconst setParentDisabled = (fieldset: HTMLFieldSetElement, bool: boolean) => {\n fieldset.disabled = bool;\n const legendButton = fieldset.querySelector<HTMLButtonElement>('legend button');\n if (legendButton) {\n legendButton.disabled = bool;\n }\n};\n\nconst countVisibleItems = (menuItems: MenuListProps['items']): number => {\n return menuItems.reduce<number>((acc, item) => {\n const isFlatGroup = !helpers.isItem(item);\n if (isFlatGroup && item.items) {\n return acc + item.items.length + 1;\n }\n\n return acc + 1;\n }, 0);\n};\n\nconst MenuList: FunctionComponent<MenuListProps & ForwardProps> = forwardRef(\n function MenuListFunction(\n { items, parent, id, menuRole, ...restProps }: PropsWithoutRef<MenuListProps>,\n ref: MenuListProps['ref']\n ) {\n const t = useI18n();\n const menuListWrapperRef: MutableRefObject<HTMLElement | null> = useRef(null);\n const selfRef = useConsolidatedRef(ref);\n const ulRef = useRef<HTMLUListElement>(null);\n const returnFocusRef: MutableRefObject<HTMLButtonElement | null> = useRef(null);\n const [open, setOpen] = useState(!parent);\n const [expandedItem, setExpandedItem] = useState<ParentMenuItemProps>();\n const {\n scrollAt,\n 'aria-label': label,\n loadMore,\n loading,\n emptyText,\n currentItemId,\n onItemExpand,\n focusControl,\n updateActiveDescendants,\n setFocusReturnEl,\n onItemCollapse\n } = useContext(MenuContext);\n const { end } = useDirection();\n const { announcePolite } = useLiveLog();\n\n useItemIntersection(\n ulRef,\n items.length - 1,\n () => {\n if (!loading) loadMore?.(parent?.item?.id);\n },\n ':scope > li'\n );\n\n useLayoutEffect(() => {\n if (!selfRef.current || expandedItem) return;\n menuListWrapperRef.current = selfRef.current.parentElement;\n resizeRootEl(\n selfRef.current,\n menuListWrapperRef.current as HTMLElement,\n countVisibleItems(items),\n scrollAt\n );\n });\n\n useEffect(() => {\n if (parent) setOpen(true);\n }, []);\n\n useAfterInitialEffect(() => {\n if (expandedItem) {\n setExpandedItem(items.find(item => item.id === expandedItem.id) as ParentMenuItemProps); // FIXME\n }\n }, [expandedItem, items]);\n\n useAfterInitialEffect(() => {\n if (currentItemId) {\n // if there is ancestor item of the controlled item, set it to expanded.\n const ancestor = items.find(\n item => item.items?.length && helpers.getItem(item.items, currentItemId) !== undefined\n );\n\n if (ancestor) {\n setExpandedItem(ancestor as ParentMenuItemProps);\n updateActiveDescendants({ preventScroll: true });\n }\n }\n }, [currentItemId, items, parent]);\n\n const onExpandCallback = useCallback(\n (itemId: MenuItemProps['id'], e: MouseEvent<AcceptedMouseEventElement>) => {\n const item = helpers.getItem(items, itemId);\n returnFocusRef.current = e.currentTarget as HTMLButtonElement;\n setExpandedItem(item as ParentMenuItemProps); // FIXME\n item?.onExpand?.(itemId, e);\n onItemExpand?.(itemId, e);\n updateActiveDescendants({ preventScroll: true });\n },\n [items]\n );\n\n useEffect(() => {\n if (items.length === 0 && !loading) {\n announcePolite({ message: emptyText ?? t('no_items') });\n }\n }, [items.length, loading]);\n\n const listContent = useMemo(() => {\n if (items.length) {\n return items.map((item, index) => {\n return helpers.isItem(item) ? (\n <MenuItem\n {...item}\n key={item.id}\n role={menuRole === 'listbox' ? 'option' : 'menuitem'}\n onExpand={item.items ? onExpandCallback : undefined}\n />\n ) : (\n <Fragment key={item.id}>\n <MenuGroup {...item} itemRole={menuRole === 'listbox' ? 'option' : 'menuitem'} />\n {items[index + 1] && helpers.isItem(items[index + 1]) && (\n <StyledSeparator role='separator' />\n )}\n </Fragment>\n );\n });\n }\n\n if (!loading) {\n return <EmptyState message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText]);\n\n const list = (\n <StyledMenuList id={expandedItem ? undefined : id} ref={ulRef} role={menuRole} {...restProps}>\n {parent && (\n <MenuListHeader\n text={parent.item.primary}\n onClick={() => {\n setOpen(false);\n }}\n />\n )}\n {listContent}\n {loading && !expandedItem && (\n <StyledLoadingItem>\n <Progress placement='local' liveConfig={{ contextualLabel: label ?? t('menu') }} />\n </StyledLoadingItem>\n )}\n </StyledMenuList>\n );\n\n return (\n <>\n <Drawer\n aria-hidden={!!expandedItem}\n as={StyledMenuListContainer}\n ref={selfRef}\n open={open}\n style={{ opacity: expandedItem ? 0 : 1 }}\n disabled={!!expandedItem}\n placement={end}\n onBeforeOpen={() => {\n if (parent) {\n parent.el.style.opacity = '0';\n }\n\n if (selfRef.current) {\n selfRef.current.style.opacity = '1';\n }\n }}\n onAfterOpen={() => {\n if (parent) {\n setParentDisabled(parent.el, true);\n }\n }}\n onBeforeClose={() => {\n if (parent && menuListWrapperRef.current) {\n setParentDisabled(parent.el, false);\n parent.el.style.opacity = '1';\n resizeRootEl(\n parent.el,\n menuListWrapperRef.current,\n countVisibleItems(parent.siblingItems),\n scrollAt\n );\n }\n\n if (selfRef.current) {\n selfRef.current.style.opacity = '0';\n }\n }}\n onAfterClose={() => {\n if (parent) {\n focusControl?.focus();\n\n const expandBtn = parent.returnFocusRef.current;\n parent.setExpandedItem(undefined);\n\n if (expandBtn) {\n setFocusReturnEl(expandBtn?.closest('li'));\n }\n\n onItemCollapse?.(parent.item.id);\n updateActiveDescendants();\n }\n }}\n >\n {list}\n </Drawer>\n\n {expandedItem && selfRef.current && (\n <MenuList\n id={id}\n items={expandedItem.items}\n parent={{\n el: selfRef.current,\n item: expandedItem,\n siblingItems: items,\n setExpandedItem,\n returnFocusRef\n }}\n menuRole={menuRole}\n />\n )}\n </>\n );\n }\n);\n\nexport default MenuList;\n"]}
|
|
1
|
+
{"version":3,"file":"MenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,EACZ,MAAM,OAAO,CAAC;AAIf,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,UAAU,MAAM,eAAe,CAAC;AAQvC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,iBAAiB,GAAG,CAAC,QAA6B,EAAE,IAAa,EAAE,EAAE;IACzE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAoB,eAAe,CAAC,CAAC;IAChF,IAAI,YAAY,EAAE;QAChB,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC;KAC9B;AACH,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiC,EAAE,OAAiB,EAAU,EAAE;IACzF,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACZ,MAAM,WAAW,GAAG,CAAC,OAA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AAE,GAAG,EAAE;oBACjB,IAAI,MAAM,EAAE;wBACV,YAAY,EAAE,KAAK,EAAE,CAAC;wBAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;wBAChD,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;wBAElC,IAAI,SAAS,EAAE;4BACb,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;yBAC5C;wBAED,cAAc,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBACjC,uBAAuB,EAAE,CAAC;qBAC3B;gBACH,CAAC,YAEA,IAAI,GACE,EAER,YAAY,IAAI,OAAO,CAAC,OAAO,IAAI,CAClC,KAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,MAAM,EAAE;oBACN,EAAE,EAAE,OAAO,CAAC,OAAO;oBACnB,IAAI,EAAE,YAAY;oBAClB,YAAY,EAAE,KAAK;oBACnB,eAAe;oBACf,cAAc;iBACf,EACD,QAAQ,EAAE,QAAQ,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n useMemo,\n Fragment,\n useCallback\n} from 'react';\nimport type { FunctionComponent, MutableRefObject, PropsWithoutRef, MouseEvent } from 'react';\n\nimport type { ForwardProps } from '../../types';\nimport Drawer from '../Drawer';\nimport {\n useAfterInitialEffect,\n useConsolidatedRef,\n useItemIntersection,\n useI18n,\n useDirection,\n useLiveLog\n} from '../../hooks';\nimport Progress from '../Progress';\nimport EmptyState from '../EmptyState';\n\nimport type {\n AcceptedMouseEventElement,\n MenuListProps,\n ParentMenuItemProps,\n MenuItemProps\n} from './Menu.types';\nimport MenuContext from './Menu.context';\nimport MenuListHeader from './MenuListHeader';\nimport MenuItem from './MenuItem';\nimport helpers from './helpers';\nimport {\n StyledLoadingItem,\n StyledMenuList,\n StyledMenuListContainer,\n StyledSeparator\n} from './Menu.styles';\nimport { resizeRootEl } from './NavItemsList';\nimport MenuGroup from './MenuGroup';\n\nconst setParentDisabled = (fieldset: HTMLFieldSetElement, bool: boolean) => {\n fieldset.disabled = bool;\n const legendButton = fieldset.querySelector<HTMLButtonElement>('legend button');\n if (legendButton) {\n legendButton.disabled = bool;\n }\n};\n\nconst countVisibleItems = (menuItems: MenuListProps['items'], loading?: boolean): number => {\n return menuItems.reduce<number>(\n (acc, item) => {\n const isFlatGroup = !helpers.isItem(item);\n if (isFlatGroup && item.items) {\n return acc + item.items.length + 1;\n }\n\n return acc + 1;\n },\n loading ? 1 : 0\n );\n};\n\nconst MenuList: FunctionComponent<MenuListProps & ForwardProps> = forwardRef(\n function MenuListFunction(\n { items, parent, id, menuRole, ...restProps }: PropsWithoutRef<MenuListProps>,\n ref: MenuListProps['ref']\n ) {\n const t = useI18n();\n const menuListWrapperRef: MutableRefObject<HTMLElement | null> = useRef(null);\n const selfRef = useConsolidatedRef(ref);\n const ulRef = useRef<HTMLUListElement>(null);\n const returnFocusRef: MutableRefObject<HTMLButtonElement | null> = useRef(null);\n const [open, setOpen] = useState(!parent);\n const [expandedItem, setExpandedItem] = useState<ParentMenuItemProps>();\n const {\n scrollAt,\n 'aria-label': label,\n loadMore,\n loading,\n emptyText,\n currentItemId,\n onItemExpand,\n focusControl,\n updateActiveDescendants,\n setFocusReturnEl,\n onItemCollapse\n } = useContext(MenuContext);\n const { end } = useDirection();\n const { announcePolite } = useLiveLog();\n\n useItemIntersection(\n ulRef,\n items.length - 1,\n () => {\n if (!loading) loadMore?.(parent?.item?.id);\n },\n ':scope > li'\n );\n\n useLayoutEffect(() => {\n if (!selfRef.current || expandedItem) return;\n menuListWrapperRef.current = selfRef.current.parentElement;\n resizeRootEl(\n selfRef.current,\n menuListWrapperRef.current as HTMLElement,\n countVisibleItems(items, loading),\n scrollAt\n );\n });\n\n useEffect(() => {\n if (parent) setOpen(true);\n }, []);\n\n useAfterInitialEffect(() => {\n if (expandedItem) {\n setExpandedItem(items.find(item => item.id === expandedItem.id) as ParentMenuItemProps); // FIXME\n }\n }, [expandedItem, items]);\n\n useAfterInitialEffect(() => {\n if (currentItemId) {\n // if there is ancestor item of the controlled item, set it to expanded.\n const ancestor = items.find(\n item => item.items?.length && helpers.getItem(item.items, currentItemId) !== undefined\n );\n\n if (ancestor) {\n setExpandedItem(ancestor as ParentMenuItemProps);\n updateActiveDescendants({ preventScroll: true });\n }\n }\n }, [currentItemId, items, parent]);\n\n const onExpandCallback = useCallback(\n (itemId: MenuItemProps['id'], e: MouseEvent<AcceptedMouseEventElement>) => {\n const item = helpers.getItem(items, itemId);\n returnFocusRef.current = e.currentTarget as HTMLButtonElement;\n setExpandedItem(item as ParentMenuItemProps); // FIXME\n item?.onExpand?.(itemId, e);\n onItemExpand?.(itemId, e);\n updateActiveDescendants({ preventScroll: true });\n },\n [items]\n );\n\n useEffect(() => {\n if (items.length === 0 && !loading) {\n announcePolite({ message: emptyText ?? t('no_items') });\n }\n }, [items.length, loading]);\n\n const listContent = useMemo(() => {\n if (items.length) {\n return items.map((item, index) => {\n return helpers.isItem(item) ? (\n <MenuItem\n {...item}\n key={item.id}\n role={menuRole === 'listbox' ? 'option' : 'menuitem'}\n onExpand={item.items ? onExpandCallback : undefined}\n />\n ) : (\n <Fragment key={item.id}>\n <MenuGroup {...item} itemRole={menuRole === 'listbox' ? 'option' : 'menuitem'} />\n {items[index + 1] && helpers.isItem(items[index + 1]) && (\n <StyledSeparator role='separator' />\n )}\n </Fragment>\n );\n });\n }\n\n if (!loading) {\n return <EmptyState message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText]);\n\n const list = (\n <StyledMenuList id={expandedItem ? undefined : id} ref={ulRef} role={menuRole} {...restProps}>\n {parent && (\n <MenuListHeader\n text={parent.item.primary}\n onClick={() => {\n setOpen(false);\n }}\n />\n )}\n {listContent}\n {loading && !expandedItem && (\n <StyledLoadingItem>\n <Progress placement='local' liveConfig={{ contextualLabel: label ?? t('menu') }} />\n </StyledLoadingItem>\n )}\n </StyledMenuList>\n );\n\n return (\n <>\n <Drawer\n aria-hidden={!!expandedItem}\n as={StyledMenuListContainer}\n ref={selfRef}\n open={open}\n style={{ opacity: expandedItem ? 0 : 1 }}\n disabled={!!expandedItem}\n placement={end}\n onBeforeOpen={() => {\n if (parent) {\n parent.el.style.opacity = '0';\n }\n\n if (selfRef.current) {\n selfRef.current.style.opacity = '1';\n }\n }}\n onAfterOpen={() => {\n if (parent) {\n setParentDisabled(parent.el, true);\n }\n }}\n onBeforeClose={() => {\n if (parent && menuListWrapperRef.current) {\n setParentDisabled(parent.el, false);\n parent.el.style.opacity = '1';\n resizeRootEl(\n parent.el,\n menuListWrapperRef.current,\n countVisibleItems(parent.siblingItems),\n scrollAt\n );\n }\n\n if (selfRef.current) {\n selfRef.current.style.opacity = '0';\n }\n }}\n onAfterClose={() => {\n if (parent) {\n focusControl?.focus();\n\n const expandBtn = parent.returnFocusRef.current;\n parent.setExpandedItem(undefined);\n\n if (expandBtn) {\n setFocusReturnEl(expandBtn?.closest('li'));\n }\n\n onItemCollapse?.(parent.item.id);\n updateActiveDescendants();\n }\n }}\n >\n {list}\n </Drawer>\n\n {expandedItem && selfRef.current && (\n <MenuList\n id={id}\n items={expandedItem.items}\n parent={{\n el: selfRef.current,\n item: expandedItem,\n siblingItems: items,\n setExpandedItem,\n returnFocusRef\n }}\n menuRole={menuRole}\n />\n )}\n </>\n );\n }\n);\n\nexport default MenuList;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavItemsList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/NavItemsList.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OACnB,mBAAmB,UACf,WAAW,aACR,MAAM,YACP,MAAM,
|
|
1
|
+
{"version":3,"file":"NavItemsList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/NavItemsList.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OACnB,mBAAmB,UACf,WAAW,aACR,MAAM,YACP,MAAM,SA2BjB,CAAC;;;;AAEF,wBAAgC"}
|
|
@@ -17,9 +17,7 @@ export const resizeRootEl = (el, rootEl, itemCount, scrollAt) => {
|
|
|
17
17
|
}
|
|
18
18
|
menuRootElHeight = btm - containerTop + ulScrollTop;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
rootEl.style.height = menuRootElHeight ? `${menuRootElHeight}px` : '';
|
|
22
|
-
});
|
|
20
|
+
rootEl.style.height = menuRootElHeight ? `${menuRootElHeight}px` : '';
|
|
23
21
|
};
|
|
24
22
|
export default { resizeRootEl };
|
|
25
23
|
//# sourceMappingURL=NavItemsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavItemsList.js","sourceRoot":"","sources":["../../../src/components/Menu/NavItemsList.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,EAAuB,EACvB,MAAmB,EACnB,SAAiB,EACjB,QAAgB,EAChB,EAAE;IACF,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG;QAChB,qEAAqE;QACrE,yDAAyD;QACzD,kEAAkE;KACnE,CAAC;IACF,MAAM,aAAa,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAC7D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CACrE,CAAC;IAEF,IAAI,gBAAoC,CAAC;IACzC,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,qBAAqB,EAAE,CAAC,GAAG,CAAC;QACpD,MAAM,iBAAiB,GAAG,aAAa,CAAC,qBAAqB,EAAE,CAAC;QAChE,MAAM,WAAW,GAAG,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC;QAEpE,IAAI,GAAG,GAAG,iBAAiB,CAAC,MAAM,CAAC;QACnC,IAAI,SAAS,GAAG,QAAQ,EAAE;YACxB,GAAG,GAAG,CAAC,iBAAiB,CAAC,GAAG,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC9D;QAED,gBAAgB,GAAG,GAAG,GAAG,YAAY,GAAG,WAAW,CAAC;KACrD;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACxE,CAAC,CAAC;AAEF,eAAe,EAAE,YAAY,EAAE,CAAC","sourcesContent":["export const resizeRootEl = (\n el: HTMLFieldSetElement,\n rootEl: HTMLElement,\n itemCount: number,\n scrollAt: number\n) => {\n const hasLegend = !!el.firstElementChild?.matches('legend');\n const selectors = [\n ':scope > ul > li:not([role=\"separator\"]):not([role=\"presentation\"])',\n ':scope > ul > li[role=\"presentation\"] > div:first-child',\n ':scope > ul > li > ul[role=\"group\"] > li:not([role=\"separator\"])'\n ];\n const lastVisibleLI = el.querySelectorAll(selectors.join(', '))[\n Math.max(Math.min(scrollAt - (hasLegend ? 2 : 1), itemCount - 1), 0)\n ];\n\n let menuRootElHeight: number | undefined;\n if (lastVisibleLI) {\n const containerTop = el.getBoundingClientRect().top;\n const lastVisibleLIRect = lastVisibleLI.getBoundingClientRect();\n const ulScrollTop = el.querySelector(':scope > ul')?.scrollTop ?? 0;\n\n let btm = lastVisibleLIRect.bottom;\n if (itemCount > scrollAt) {\n btm = (lastVisibleLIRect.top + lastVisibleLIRect.bottom) / 2;\n }\n\n menuRootElHeight = btm - containerTop + ulScrollTop;\n }\n\n rootEl.style.height = menuRootElHeight ? `${menuRootElHeight}px` : '';\n};\n\nexport default { resizeRootEl };\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default } from './Menu';
|
|
2
2
|
export { StyledMenuListWrapper, StyledMenuItem, StyledMenuListContainer } from './Menu.styles';
|
|
3
3
|
export type { MenuItemProps, MenuProps, MenuGroupProps } from './Menu.types';
|
|
4
|
+
export { default as isMenuGroupProps } from './Menu.utils';
|
|
4
5
|
export { default as menuHelpers } from './helpers';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC/F,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC/F,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default } from './Menu';
|
|
2
2
|
export { StyledMenuListWrapper, StyledMenuItem, StyledMenuListContainer } from './Menu.styles';
|
|
3
|
+
export { default as isMenuGroupProps } from './Menu.utils';
|
|
3
4
|
export { default as menuHelpers } from './helpers';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from './Menu';\nexport { StyledMenuListWrapper, StyledMenuItem, StyledMenuListContainer } from './Menu.styles';\nexport type { MenuItemProps, MenuProps, MenuGroupProps } from './Menu.types';\nexport { default as menuHelpers } from './helpers';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from './Menu';\nexport { StyledMenuListWrapper, StyledMenuItem, StyledMenuListContainer } from './Menu.styles';\nexport type { MenuItemProps, MenuProps, MenuGroupProps } from './Menu.types';\nexport { default as isMenuGroupProps } from './Menu.utils';\nexport { default as menuHelpers } from './helpers';\n"]}
|
|
@@ -30,9 +30,16 @@ export interface MenuButtonProps extends BaseProps, NoChildrenProp, TestIdProp {
|
|
|
30
30
|
ref?: ButtonProps['ref'];
|
|
31
31
|
/** The keydown handler for the MenuButton. */
|
|
32
32
|
onKeyDown?: KeyboardEventHandler;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to display an arrow when only the icon is displayed.
|
|
35
|
+
* Only applies when `iconOnly` is true.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
showArrow?: boolean;
|
|
33
39
|
}
|
|
40
|
+
export declare const StyledMenuButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
34
41
|
declare const _default: FunctionComponent<ForwardProps & MenuButtonProps> & {
|
|
35
|
-
getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
42
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
36
43
|
};
|
|
37
44
|
export default _default;
|
|
38
45
|
//# sourceMappingURL=MenuButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.d.ts","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAIjB,oBAAoB,EACrB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWnG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"MenuButton.d.ts","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAIjB,oBAAoB,EACrB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,a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
|
16
16
|
registerIcon(arrowMicroDownIcon);
|
|
17
|
-
const StyledMenuButton = styled.button(({ theme: { base: { spacing } } }) => {
|
|
17
|
+
export const StyledMenuButton = styled.button(({ theme: { base: { spacing } } }) => {
|
|
18
18
|
return css `
|
|
19
19
|
gap: ${spacing};
|
|
20
20
|
flex-shrink: 0;
|
|
@@ -27,10 +27,20 @@ const StyledMenuButton = styled.button(({ theme: { base: { spacing } } }) => {
|
|
|
27
27
|
`;
|
|
28
28
|
});
|
|
29
29
|
StyledMenuButton.defaultProps = defaultThemeProp;
|
|
30
|
-
const StyledMenuButtonChildren = styled.span(({ theme }) => {
|
|
30
|
+
const StyledMenuButtonChildren = styled.span(({ theme, padIcon }) => {
|
|
31
|
+
const { base: { 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger } }, components: { icon: { size: { s: iconSize } } } } = theme;
|
|
31
32
|
return css `
|
|
32
33
|
max-width: 100%;
|
|
33
34
|
|
|
35
|
+
${padIcon &&
|
|
36
|
+
css `
|
|
37
|
+
padding-inline-start: calc((${hitAreaMouse} - ${iconSize}) / 2);
|
|
38
|
+
|
|
39
|
+
@media (pointer: coarse) {
|
|
40
|
+
padding-inline-start: calc(${hitAreaFinger} - ${iconSize} * 2);
|
|
41
|
+
}
|
|
42
|
+
`}
|
|
43
|
+
|
|
34
44
|
${StyledText} {
|
|
35
45
|
text-overflow: ellipsis;
|
|
36
46
|
overflow: hidden;
|
|
@@ -47,7 +57,7 @@ const StyledMenuButtonPopover = styled(Popover) `
|
|
|
47
57
|
`;
|
|
48
58
|
const MenuButton = forwardRef(function MenuButton(props, ref) {
|
|
49
59
|
const uid = useUID();
|
|
50
|
-
const { testId, id = uid, text, menu, popover, onClick, icon, count, iconOnly = false, ...restProps } = props;
|
|
60
|
+
const { testId, id = uid, text, menu, popover, onClick, icon, count, iconOnly = false, showArrow = false, ...restProps } = props;
|
|
51
61
|
const testIds = useTestIds(testId, getMenuButtonTestIds);
|
|
52
62
|
const [isOpen, setIsOpen] = useState(false);
|
|
53
63
|
const buttonRef = useConsolidatedRef(ref);
|
|
@@ -65,16 +75,17 @@ const MenuButton = forwardRef(function MenuButton(props, ref) {
|
|
|
65
75
|
}
|
|
66
76
|
}, buttonRef);
|
|
67
77
|
const { rtl } = useDirection();
|
|
68
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { "data-testid": testIds.root, as: StyledMenuButton, "aria-label": text, ...restProps, id: id, ref: buttonRef, "aria-expanded": isOpen, "aria-haspopup": 'menu', "aria-controls": `${id}-popover
|
|
78
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { "data-testid": testIds.root, as: StyledMenuButton, "aria-label": text, ...restProps, id: id, ref: buttonRef, "aria-expanded": isOpen, "aria-haspopup": 'menu', "aria-controls": isOpen ? `${id}-popover` : undefined, label: iconOnly && !isOpen ? text : undefined, onClick: (e) => {
|
|
69
79
|
// e.detail is 0 when triggered by keyboard.
|
|
70
80
|
const mouseClick = e.detail > 0;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
81
|
+
if (isOpen) {
|
|
82
|
+
if (mouseClick) {
|
|
83
|
+
// Close the menu if it is open and it is a *mouse* click on the button.
|
|
84
|
+
setIsOpen(false);
|
|
85
|
+
}
|
|
76
86
|
}
|
|
77
87
|
else {
|
|
88
|
+
// Open the menu if it's closed, for mouse or keyboard click.
|
|
78
89
|
setIsOpen(true);
|
|
79
90
|
}
|
|
80
91
|
// If the menu is closed or the user mouse clicks.
|
|
@@ -82,14 +93,13 @@ const MenuButton = forwardRef(function MenuButton(props, ref) {
|
|
|
82
93
|
if (!isOpen || mouseClick) {
|
|
83
94
|
onClick?.(e);
|
|
84
95
|
}
|
|
85
|
-
}, icon: iconOnly, children: _jsxs(Flex, { as: StyledMenuButtonChildren, container: { alignItems: 'center', gap: 1 }, children: [icon && _jsx(Icon, { name: icon }), !iconOnly && (_jsxs(_Fragment, { children: [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.detail > 0) {
|
|
96
|
+
}, icon: iconOnly, children: _jsxs(Flex, { as: StyledMenuButtonChildren, container: { alignItems: 'center', gap: 1 }, padIcon: iconOnly && showArrow, children: [icon && _jsx(Icon, { name: icon }), !iconOnly && (_jsxs(_Fragment, { children: [_jsx(Text, { children: text }), typeof count === 'number' && _jsx(Count, { children: count })] })), (!iconOnly || showArrow) && _jsx(Icon, { name: 'arrow-micro-down' })] }) }), _jsx(StyledMenuButtonPopover, { placement: rtl ? 'bottom-end' : 'bottom-start', hideOnTargetHidden: true, ...popover, id: `${id}-popover`, show: !!menu && isOpen, target: buttonRef.current, ref: popoverRef, children: menu && (_jsx(Menu, { testId: testIds.root, ...menu, ref: menuRef, items: menu.items, onItemClick: (itemId, e) => {
|
|
97
|
+
// When clicking an item (by mouse or keyboard) and the menu is not multi-select, close the menu.
|
|
98
|
+
if (menu.mode !== 'multi-select') {
|
|
89
99
|
setIsOpen(false);
|
|
90
100
|
}
|
|
91
101
|
menu.onItemClick?.(itemId, e);
|
|
92
|
-
}, focusControlEl: buttonRef.current || undefined })) })] }));
|
|
102
|
+
}, focusControlEl: menu.focusControlEl || buttonRef.current || undefined })) })] }));
|
|
93
103
|
});
|
|
94
104
|
export default withTestIds(MenuButton, getMenuButtonTestIds);
|
|
95
105
|
//# sourceMappingURL=MenuButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACV,MAA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,OAAO,EACzB,GAAG,EAAE,UAAU,YAEd,IAAI,IAAI,CACP,KAAC,IAAI,IACH,MAAM,EAAE,OAAO,CAAC,IAAI,KAChB,IAAI,EACR,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACzB,IACE,IAAI,CAAC,IAAI,KAAK,cAAc;4BAC3B,CAAgF;iCAC9E,MAAM,GAAG,CAAC,EACb;4BACA,SAAS,CAAC,KAAK,CAAC,CAAC;yBAClB;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,SAAS,CAAC,OAAO,IAAI,SAAS,GAC9C,CACH,GACuB,IACzB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useCallback } from 'react';\nimport type {\n FunctionComponent,\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n KeyboardEventHandler\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, OmitStrict, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useConsolidatedRef,\n useUID,\n useFocusWithin,\n useDirection,\n useTestIds,\n useEscape\n} from '../../hooks';\nimport Button, { StyledButton } from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover, { StyledPopover } from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport Menu from '../Menu';\nimport type { AcceptedMouseEventElement, MenuProps } from '../Menu/Menu.types';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Text, { StyledText } from '../Text';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { CountProps } from '../Badges/Count';\nimport { withTestIds } from '../../utils';\n\nimport { getMenuButtonTestIds } from './MenuButton.test-ids';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n}\n\nconst StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonChildren = styled.span(({ theme }) => {\n return css`\n max-width: 100%;\n\n ${StyledText} {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n ${StyledIcon}:last-child:not(:first-child) {\n /* Offsets the flex gap to make the down arrow appear to trail the text. */\n margin-inline-start: -${theme.base.spacing};\n }\n `;\n});\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: FunctionComponent<ForwardProps & MenuButtonProps> = forwardRef(\n function MenuButton(props: PropsWithoutRef<MenuButtonProps>, ref: MenuButtonProps['ref']) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n text,\n menu,\n popover,\n onClick,\n icon,\n count,\n iconOnly = false,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getMenuButtonTestIds);\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback(isFocused => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n }\n }, buttonRef);\n\n const { rtl } = useDirection();\n\n return (\n <>\n <Button\n data-testid={testIds.root}\n as={StyledMenuButton}\n aria-label={text}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={`${id}-popover`}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // e.detail is 0 when triggered by keyboard.\n const mouseClick = e.detail > 0;\n\n // Close the menu if it is open and either:\n // It is a *mouse* click on the button.\n // Or, the menu mode is not multiselect.\n if (isOpen && (mouseClick || menu?.mode !== 'multi-select')) {\n setIsOpen(false);\n } else {\n setIsOpen(true);\n }\n\n // If the menu is closed or the user mouse clicks.\n // This avoids Enter key firing onClick when selecting a menu item.\n if (!isOpen || mouseClick) {\n onClick?.(e);\n }\n }}\n icon={iconOnly}\n >\n <Flex as={StyledMenuButtonChildren} container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n {text && <Text>{text}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n {text && <Icon name='arrow-micro-down' />}\n </>\n )}\n </Flex>\n </Button>\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n hideOnTargetHidden\n {...popover}\n id={`${id}-popover`}\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n >\n {menu && (\n <Menu\n testId={testIds.root}\n {...menu}\n ref={menuRef}\n items={menu.items}\n onItemClick={(itemId, e) => {\n if (\n menu.mode !== 'multi-select' &&\n (e as MouseEvent<AcceptedMouseEventElement> & UIEvent<AcceptedMouseEventElement>)\n .detail > 0\n ) {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n }\n);\n\nexport default withTestIds(MenuButton, getMenuButtonTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,WAA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IAAI,IAAI,CACP,KAAC,IAAI,IACH,MAAM,EAAE,OAAO,CAAC,IAAI,KAChB,IAAI,EACR,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACzB,iGAAiG;wBACjG,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE;4BAChC,SAAS,CAAC,KAAK,CAAC,CAAC;yBAClB;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,GACrE,CACH,GACuB,IACzB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useCallback } from 'react';\nimport type {\n FunctionComponent,\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n KeyboardEventHandler\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, OmitStrict, TestIdProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport {\n useConsolidatedRef,\n useUID,\n useFocusWithin,\n useDirection,\n useTestIds,\n useEscape\n} from '../../hooks';\nimport Button, { StyledButton } from '../Button';\nimport type { ButtonProps } from '../Button';\nimport Popover, { StyledPopover } from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport Menu from '../Menu';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport Icon, { registerIcon, StyledIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Text, { StyledText } from '../Text';\nimport Flex from '../Flex';\nimport { Count } from '../Badges';\nimport type { CountProps } from '../Badges/Count';\nimport { withTestIds } from '../../utils';\n\nimport { getMenuButtonTestIds } from './MenuButton.test-ids';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n /**\n * Whether to display an arrow when only the icon is displayed.\n * Only applies when `iconOnly` is true.\n * @default false\n */\n showArrow?: boolean;\n}\n\nexport const StyledMenuButton = styled.button(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n gap: ${spacing};\n flex-shrink: 0;\n white-space: nowrap;\n max-width: 100%;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n `;\n }\n);\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonChildren = styled.span<{ padIcon?: boolean }>(({ theme, padIcon }) => {\n const {\n base: {\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n },\n components: {\n icon: {\n size: { s: iconSize }\n }\n }\n } = theme;\n\n return css`\n max-width: 100%;\n\n ${padIcon &&\n css`\n padding-inline-start: calc((${hitAreaMouse} - ${iconSize}) / 2);\n\n @media (pointer: coarse) {\n padding-inline-start: calc(${hitAreaFinger} - ${iconSize} * 2);\n }\n `}\n\n ${StyledText} {\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n ${StyledIcon}:last-child:not(:first-child) {\n /* Offsets the flex gap to make the down arrow appear to trail the text. */\n margin-inline-start: -${theme.base.spacing};\n }\n `;\n});\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: FunctionComponent<ForwardProps & MenuButtonProps> = forwardRef(\n function MenuButton(props: PropsWithoutRef<MenuButtonProps>, ref: MenuButtonProps['ref']) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n text,\n menu,\n popover,\n onClick,\n icon,\n count,\n iconOnly = false,\n showArrow = false,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getMenuButtonTestIds);\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback(isFocused => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n useEscape(e => {\n if (isOpen) {\n setIsOpen(false);\n e.stopPropagation();\n }\n }, buttonRef);\n\n const { rtl } = useDirection();\n\n return (\n <>\n <Button\n data-testid={testIds.root}\n as={StyledMenuButton}\n aria-label={text}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={isOpen ? `${id}-popover` : undefined}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // e.detail is 0 when triggered by keyboard.\n const mouseClick = e.detail > 0;\n\n if (isOpen) {\n if (mouseClick) {\n // Close the menu if it is open and it is a *mouse* click on the button.\n setIsOpen(false);\n }\n } else {\n // Open the menu if it's closed, for mouse or keyboard click.\n setIsOpen(true);\n }\n\n // If the menu is closed or the user mouse clicks.\n // This avoids Enter key firing onClick when selecting a menu item.\n if (!isOpen || mouseClick) {\n onClick?.(e);\n }\n }}\n icon={iconOnly}\n >\n <Flex\n as={StyledMenuButtonChildren}\n container={{ alignItems: 'center', gap: 1 }}\n padIcon={iconOnly && showArrow}\n >\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <>\n <Text>{text}</Text>\n {typeof count === 'number' && <Count>{count}</Count>}\n </>\n )}\n {(!iconOnly || showArrow) && <Icon name='arrow-micro-down' />}\n </Flex>\n </Button>\n\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n hideOnTargetHidden\n {...popover}\n id={`${id}-popover`}\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n >\n {menu && (\n <Menu\n testId={testIds.root}\n {...menu}\n ref={menuRef}\n items={menu.items}\n onItemClick={(itemId, e) => {\n // When clicking an item (by mouse or keyboard) and the menu is not multi-select, close the menu.\n if (menu.mode !== 'multi-select') {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={menu.focusControlEl || buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n }\n);\n\nexport default withTestIds(MenuButton, getMenuButtonTestIds);\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getMenuButtonTestIds: (testIdProp?: string | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
1
|
+
export declare const getMenuButtonTestIds: (testIdProp?: string | null | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
2
2
|
//# sourceMappingURL=MenuButton.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"MenuButton.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,wFAA4C,CAAC"}
|
|
@@ -18,7 +18,7 @@ export declare const StyledMetaListItem: import("styled-components").StyledCompo
|
|
|
18
18
|
wrapItems: boolean;
|
|
19
19
|
}, never>;
|
|
20
20
|
declare const _default: FunctionComponent<MetaListProps & ForwardProps> & {
|
|
21
|
-
getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
21
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("../../types").TestIdsRecord<readonly []>;
|
|
22
22
|
};
|
|
23
23
|
export default _default;
|
|
24
24
|
//# sourceMappingURL=MetaList.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getMetaListTestIds: (testIdProp?: string | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
1
|
+
export declare const getMetaListTestIds: (testIdProp?: string | null | undefined) => import("../..").TestIdsRecord<readonly []>;
|
|
2
2
|
//# sourceMappingURL=MetaList.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaList.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/MetaList/MetaList.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MetaList.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/MetaList/MetaList.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,wFAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqBhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAWhD,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,GAAG,YAAY,CAiUtD,CAAC;AAEH,eAAe,KAAK,CAAC"}
|