@pega/cosmos-react-core 4.0.0-dev.1.2 → 4.0.0-dev.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Actions/Actions.d.ts.map +1 -1
- package/lib/components/Actions/Actions.js +11 -5
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +2 -0
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.js +24 -15
- package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +4 -3
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.d.ts +2 -0
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +43 -33
- 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 +37 -13
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +4 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +45 -14
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +30 -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 +2 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +2 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts +1 -1
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js +6 -2
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +21 -19
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/AppShellSearch.styles.js +1 -1
- package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
- package/lib/components/AppShell/ContextSwitcher.d.ts +6 -0
- package/lib/components/AppShell/ContextSwitcher.d.ts.map +1 -0
- package/lib/components/AppShell/ContextSwitcher.js +18 -0
- package/lib/components/AppShell/ContextSwitcher.js.map +1 -0
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +8 -9
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.styles.js +7 -4
- package/lib/components/AppShell/Drawer.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +15 -12
- 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 +4 -2
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/AppShell/index.d.ts +2 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js +1 -0
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +22 -2
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Count.d.ts +2 -2
- package/lib/components/Badges/Count.d.ts.map +1 -1
- package/lib/components/Badges/Count.js +22 -25
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Badges/Selection.js +1 -1
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Tag.js +1 -1
- package/lib/components/Badges/Tag.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +28 -21
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +138 -96
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/index.d.ts +1 -1
- package/lib/components/Banner/index.d.ts.map +1 -1
- package/lib/components/Banner/index.js.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/Card/Card.d.ts +4 -7
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +2 -9
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.js +0 -3
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -3
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts +4 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +2 -0
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.d.ts +1 -1
- package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.d.ts +10 -7
- package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +19 -4
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +4 -2
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +71 -34
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +26 -5
- 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/DayOfWeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.d.ts +1 -1
- package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +8 -3
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +2 -2
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +13 -3
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +4 -2
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js +70 -27
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +7 -2
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.js +19 -27
- package/lib/components/DateTime/Input/usePickerButton.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 +6 -17
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +3 -1
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +2 -8
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts +3 -30
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +7 -147
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts +3 -0
- package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.styles.js +18 -0
- package/lib/components/Dialog/Dialog.styles.js.map +1 -0
- package/lib/components/Dialog/Dialog.types.d.ts +87 -0
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.types.js +3 -0
- package/lib/components/Dialog/Dialog.types.js.map +1 -0
- package/lib/components/Dialog/FormDialog.d.ts +7 -0
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -0
- package/lib/components/Dialog/FormDialog.js +58 -0
- package/lib/components/Dialog/FormDialog.js.map +1 -0
- package/lib/components/Dialog/InfoDialog.d.ts +6 -0
- package/lib/components/Dialog/InfoDialog.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialog.js +43 -0
- package/lib/components/Dialog/InfoDialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +3 -2
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +2 -2
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +1 -1
- package/lib/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.d.ts +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +2 -1
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +5 -36
- package/lib/components/FieldValueList/FieldValueList.js.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/utils.d.ts +1 -1
- package/lib/components/File/utils.d.ts.map +1 -1
- package/lib/components/Flex/Flex.d.ts +2 -2
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +4 -0
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js +3 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormControl/index.d.ts +1 -0
- package/lib/components/FormControl/index.d.ts.map +1 -1
- package/lib/components/FormControl/index.js.map +1 -1
- package/lib/components/Grid/Grid.types.d.ts +2 -2
- package/lib/components/Grid/Grid.types.d.ts.map +1 -1
- package/lib/components/HTML/HTML.d.ts.map +1 -1
- package/lib/components/HTML/HTML.js +1 -0
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +2 -2
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts +4 -0
- package/lib/components/Icon/icons/user-question-mark-solid.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/user-question-mark-solid.icon.js +6 -0
- package/lib/components/Icon/icons/user-question-mark-solid.icon.js.map +1 -0
- package/lib/components/Icon/icons/user-question-mark.icon.d.ts +4 -0
- package/lib/components/Icon/icons/user-question-mark.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/user-question-mark.icon.js +6 -0
- package/lib/components/Icon/icons/user-question-mark.icon.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.styles.js +2 -2
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js +13 -4
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
- package/lib/components/List/CommaSeparatedList.js +5 -37
- package/lib/components/List/CommaSeparatedList.js.map +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.js +11 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +106 -68
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +5 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +50 -5
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +5 -5
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/LiveLog/Context.d.ts +3 -0
- package/lib/components/LiveLog/Context.d.ts.map +1 -0
- package/lib/components/LiveLog/Context.js +9 -0
- package/lib/components/LiveLog/Context.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.d.ts +10 -0
- package/lib/components/LiveLog/LiveLog.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.js +99 -0
- package/lib/components/LiveLog/LiveLog.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.styles.d.ts +3 -0
- package/lib/components/LiveLog/LiveLog.styles.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.styles.js +9 -0
- package/lib/components/LiveLog/LiveLog.styles.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.types.d.ts +93 -0
- package/lib/components/LiveLog/LiveLog.types.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.types.js +2 -0
- package/lib/components/LiveLog/LiveLog.types.js.map +1 -0
- package/lib/components/LiveLog/index.d.ts +4 -0
- package/lib/components/LiveLog/index.d.ts.map +1 -0
- package/lib/components/LiveLog/index.js +3 -0
- package/lib/components/LiveLog/index.js.map +1 -0
- package/lib/components/Location/CurrentLocationButton.d.ts +1 -1
- package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.js +1 -2
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.d.ts.map +1 -1
- package/lib/components/Location/LocationView.js +4 -4
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/MapsContext.d.ts +1 -1
- package/lib/components/Location/MapsContext.d.ts.map +1 -1
- package/lib/components/Location/utils.d.ts +1 -1
- package/lib/components/Location/utils.d.ts.map +1 -1
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/Menu.js +3 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.js +1 -1
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +3 -5
- 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/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +4 -3
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +18 -4
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +6 -8
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.types.d.ts +2 -1
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +3 -1
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
- package/lib/components/Number/NumberRangeInput.js +71 -4
- package/lib/components/Number/NumberRangeInput.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +15 -4
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.js +5 -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 +16 -2
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +20 -3
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +2 -5
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +0 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +0 -6
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +0 -2
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +1 -32
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Bar.d.ts +0 -3
- package/lib/components/Progress/Bar.d.ts.map +1 -1
- package/lib/components/Progress/Bar.js +1 -54
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.d.ts +0 -1
- package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
- package/lib/components/Progress/Ellipsis.js +1 -72
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.d.ts.map +1 -1
- package/lib/components/Progress/Progress.js +99 -60
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts +12 -0
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -0
- package/lib/components/Progress/Progress.styles.js +217 -0
- package/lib/components/Progress/Progress.styles.js.map +1 -0
- package/lib/components/Progress/Progress.types.d.ts +19 -2
- package/lib/components/Progress/Progress.types.d.ts.map +1 -1
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/Progress/Ring.d.ts +0 -3
- package/lib/components/Progress/Ring.d.ts.map +1 -1
- package/lib/components/Progress/Ring.js +1 -58
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/Progress/index.d.ts +1 -3
- package/lib/components/Progress/index.d.ts.map +1 -1
- package/lib/components/Progress/index.js +1 -3
- package/lib/components/Progress/index.js.map +1 -1
- package/lib/components/QRCode/QRCode.d.ts +14 -0
- package/lib/components/QRCode/QRCode.d.ts.map +1 -0
- package/lib/components/QRCode/QRCode.js +39 -0
- package/lib/components/QRCode/QRCode.js.map +1 -0
- package/lib/components/QRCode/index.d.ts +3 -0
- package/lib/components/QRCode/index.d.ts.map +1 -0
- package/lib/components/QRCode/index.js +2 -0
- package/lib/components/QRCode/index.js.map +1 -0
- package/lib/components/RadioCheck/RadioCheck.js +1 -1
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +2 -2
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +28 -8
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
- package/lib/components/ShowMoreLess/ShowMoreLess.d.ts +9 -0
- package/lib/components/ShowMoreLess/ShowMoreLess.d.ts.map +1 -0
- package/lib/components/ShowMoreLess/ShowMoreLess.js +41 -0
- package/lib/components/ShowMoreLess/ShowMoreLess.js.map +1 -0
- package/lib/components/ShowMoreLess/index.d.ts +3 -0
- package/lib/components/ShowMoreLess/index.d.ts.map +1 -0
- package/lib/components/ShowMoreLess/index.js +2 -0
- package/lib/components/ShowMoreLess/index.js.map +1 -0
- package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -1
- package/lib/components/SkipLinks/SkipLinks.js +3 -26
- package/lib/components/SkipLinks/SkipLinks.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +1 -1
- package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +2 -2
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +8 -10
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/TextArea/TextArea.js +2 -2
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Context.d.ts +1 -0
- package/lib/components/Toaster/Context.d.ts.map +1 -1
- package/lib/components/Toaster/Context.js.map +1 -1
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +6 -2
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.js +70 -27
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/StandardTree.styles.d.ts +1 -0
- package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +32 -18
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/components/Tree/StandardTree.types.d.ts +28 -1
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.types.js.map +1 -1
- package/lib/components/Tree/Tree.d.ts +2 -2
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/helpers.d.ts +11 -9
- package/lib/components/Tree/helpers.d.ts.map +1 -1
- package/lib/components/Tree/helpers.js +25 -5
- package/lib/components/Tree/helpers.js.map +1 -1
- package/lib/components/Tree/index.d.ts +1 -1
- package/lib/components/Tree/index.d.ts.map +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts +2 -2
- package/lib/components/URL/URLDisplay.d.ts.map +1 -1
- package/lib/components/URL/URLDisplay.js +8 -1
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts +2 -2
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useArrows.d.ts.map +1 -1
- package/lib/hooks/useArrows.js +3 -3
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +3 -2
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useEvent.d.ts +2 -2
- package/lib/hooks/useEvent.d.ts.map +1 -1
- package/lib/hooks/useI18n.d.ts +88 -19
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useLiveLog.d.ts +8 -0
- package/lib/hooks/useLiveLog.d.ts.map +1 -0
- package/lib/hooks/useLiveLog.js +16 -0
- package/lib/hooks/useLiveLog.js.map +1 -0
- package/lib/hooks/useOverride.d.ts +1 -1
- package/lib/hooks/useOverride.d.ts.map +1 -1
- package/lib/hooks/useScrollStick.d.ts +1 -1
- package/lib/hooks/useScrollStick.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +88 -19
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +98 -27
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +90 -21
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/translate.d.ts +1 -1
- package/lib/i18n/translate.d.ts.map +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/lib/register-contexts.js +2 -0
- package/lib/register-contexts.js.map +1 -1
- package/lib/styles/gradients.d.ts +1 -1
- package/lib/styles/gradients.d.ts.map +1 -1
- package/lib/styles/utils.d.ts +1 -1
- package/lib/styles/utils.d.ts.map +1 -1
- package/lib/styles/utils.js +10 -10
- package/lib/styles/utils.js.map +1 -1
- package/lib/theme/ThemeMachine.d.ts +3 -3
- package/lib/theme/ThemeMachine.d.ts.map +1 -1
- package/lib/theme/ThemeMachine.js +30 -30
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/theme.d.ts +45 -75
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +14 -30
- package/lib/theme/themeOverrides.schema.json +1 -4
- package/lib/theme/themes/darkTheme.json +4 -1
- package/lib/theme/themes/legacyBuildTheme.json +2 -3
- package/lib/types/types.d.ts +19 -11
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/bindAll.d.ts +4 -0
- package/lib/utils/bindAll.d.ts.map +1 -0
- package/lib/utils/bindAll.js +9 -0
- package/lib/utils/bindAll.js.map +1 -0
- package/lib/utils/cap.d.ts +4 -0
- package/lib/utils/cap.d.ts.map +1 -0
- package/lib/utils/cap.js +6 -0
- package/lib/utils/cap.js.map +1 -0
- package/lib/utils/createStringMatcher.d.ts +10 -0
- package/lib/utils/createStringMatcher.d.ts.map +1 -0
- package/lib/utils/createStringMatcher.js +21 -0
- package/lib/utils/createStringMatcher.js.map +1 -0
- package/lib/utils/createUID.d.ts +4 -0
- package/lib/utils/createUID.d.ts.map +1 -0
- package/lib/utils/createUID.js +6 -0
- package/lib/utils/createUID.js.map +1 -0
- package/lib/utils/debounce.d.ts +4 -0
- package/lib/utils/debounce.d.ts.map +1 -0
- package/lib/utils/debounce.js +14 -0
- package/lib/utils/debounce.js.map +1 -0
- package/lib/utils/deepGet.d.ts +3 -0
- package/lib/utils/deepGet.d.ts.map +1 -0
- package/lib/utils/deepGet.js +15 -0
- package/lib/utils/deepGet.js.map +1 -0
- package/lib/utils/deepObjectComparison.d.ts +4 -0
- package/lib/utils/deepObjectComparison.d.ts.map +1 -0
- package/lib/utils/deepObjectComparison.js +35 -0
- package/lib/utils/deepObjectComparison.js.map +1 -0
- package/lib/utils/defineSmartGetter.d.ts +3 -0
- package/lib/utils/defineSmartGetter.d.ts.map +1 -0
- package/lib/utils/defineSmartGetter.js +14 -0
- package/lib/utils/defineSmartGetter.js.map +1 -0
- package/lib/utils/documentIsAvailable.d.ts +3 -0
- package/lib/utils/documentIsAvailable.d.ts.map +1 -0
- package/lib/utils/documentIsAvailable.js +3 -0
- package/lib/utils/documentIsAvailable.js.map +1 -0
- package/lib/utils/escapeRegExp.d.ts +8 -0
- package/lib/utils/escapeRegExp.d.ts.map +1 -0
- package/lib/utils/escapeRegExp.js +8 -0
- package/lib/utils/escapeRegExp.js.map +1 -0
- package/lib/utils/focusHeadingOrContainer.d.ts +8 -0
- package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -0
- package/lib/utils/focusHeadingOrContainer.js +29 -0
- package/lib/utils/focusHeadingOrContainer.js.map +1 -0
- package/lib/utils/formatListToLocaleString.d.ts +15 -0
- package/lib/utils/formatListToLocaleString.d.ts.map +1 -0
- package/lib/utils/formatListToLocaleString.js +17 -0
- package/lib/utils/formatListToLocaleString.js.map +1 -0
- package/lib/utils/getActiveElement.d.ts +8 -0
- package/lib/utils/getActiveElement.d.ts.map +1 -0
- package/lib/utils/getActiveElement.js +18 -0
- package/lib/utils/getActiveElement.js.map +1 -0
- package/lib/utils/getFocusables.d.ts +9 -0
- package/lib/utils/getFocusables.d.ts.map +1 -0
- package/lib/utils/getFocusables.js +15 -0
- package/lib/utils/getFocusables.js.map +1 -0
- package/lib/utils/getScrollbarWidth.d.ts +4 -0
- package/lib/utils/getScrollbarWidth.d.ts.map +1 -0
- package/lib/utils/getScrollbarWidth.js +17 -0
- package/lib/utils/getScrollbarWidth.js.map +1 -0
- package/lib/utils/hasProp.d.ts +4 -0
- package/lib/utils/hasProp.d.ts.map +1 -0
- package/lib/utils/hasProp.js +6 -0
- package/lib/utils/hasProp.js.map +1 -0
- package/lib/utils/index.d.ts +27 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +27 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/loadScript.d.ts +3 -0
- package/lib/utils/loadScript.d.ts.map +1 -0
- package/lib/utils/loadScript.js +9 -0
- package/lib/utils/loadScript.js.map +1 -0
- package/lib/utils/navigatorIsAvailable.d.ts +3 -0
- package/lib/utils/navigatorIsAvailable.d.ts.map +1 -0
- package/lib/utils/navigatorIsAvailable.js +3 -0
- package/lib/utils/navigatorIsAvailable.js.map +1 -0
- package/lib/utils/normalizeElements.d.ts +9 -0
- package/lib/utils/normalizeElements.d.ts.map +1 -0
- package/lib/utils/normalizeElements.js +14 -0
- package/lib/utils/normalizeElements.js.map +1 -0
- package/lib/utils/range.d.ts +4 -0
- package/lib/utils/range.d.ts.map +1 -0
- package/lib/utils/range.js +8 -0
- package/lib/utils/range.js.map +1 -0
- package/lib/utils/reflow.d.ts +4 -0
- package/lib/utils/reflow.d.ts.map +1 -0
- package/lib/utils/reflow.js +7 -0
- package/lib/utils/reflow.js.map +1 -0
- package/lib/utils/replaceMatchWithElement.d.ts +4 -0
- package/lib/utils/replaceMatchWithElement.d.ts.map +1 -0
- package/lib/utils/replaceMatchWithElement.js +32 -0
- package/lib/utils/replaceMatchWithElement.js.map +1 -0
- package/lib/utils/sameOrigin.d.ts +7 -0
- package/lib/utils/sameOrigin.d.ts.map +1 -0
- package/lib/utils/sameOrigin.js +25 -0
- package/lib/utils/sameOrigin.js.map +1 -0
- package/lib/utils/testElForOverflow.d.ts +4 -0
- package/lib/utils/testElForOverflow.d.ts.map +1 -0
- package/lib/utils/testElForOverflow.js +6 -0
- package/lib/utils/testElForOverflow.js.map +1 -0
- package/lib/utils/triple.d.ts +12 -0
- package/lib/utils/triple.d.ts.map +1 -0
- package/lib/utils/triple.js +13 -0
- package/lib/utils/triple.js.map +1 -0
- package/lib/utils/tryCatch.d.ts +5 -0
- package/lib/utils/tryCatch.d.ts.map +1 -0
- package/lib/utils/tryCatch.js +16 -0
- package/lib/utils/tryCatch.js.map +1 -0
- package/lib/utils/windowIsAvailable.d.ts +3 -0
- package/lib/utils/windowIsAvailable.d.ts.map +1 -0
- package/lib/utils/windowIsAvailable.js +3 -0
- package/lib/utils/windowIsAvailable.js.map +1 -0
- package/package.json +4 -2
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts +0 -12
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +0 -1
- package/lib/components/ListToolbar/QueryOptionPopover.js +0 -36
- package/lib/components/ListToolbar/QueryOptionPopover.js.map +0 -1
- package/lib/utils/utils.d.ts +0 -93
- package/lib/utils/utils.d.ts.map +0 -1
- package/lib/utils/utils.js +0 -287
-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yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAChE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;8BACkB,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,QAAQ,CAAC,GAAG;;GAE/D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { lighten } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { useDirection } from '../../hooks';\nimport { calculateFontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { DrawerProps } from '../Drawer';\nimport { StyledIcon } from '../Icon';\n\nimport { navOpenWidth } from './AppShell.styles';\n\nexport const StyledDrawerWrapper = styled.div<DrawerProps>(({ theme, open }) => {\n return css`\n background: ${theme.components['app-shell'].nav['background-color']};\n width: ${navOpenWidth};\n height: 100%;\n color: rgba(255, 255, 255, 0.7);\n opacity: ${open ? 1 : 0};\n `;\n});\n\nStyledDrawerWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerHeading = styled.header(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n line-height: 1;\n\n h2 {\n font-size: ${fontSize.s};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n margin: 0 auto;\n position: relative;\n left: -0.7rem;\n }\n\n svg {\n font-size: ${fontSize.xxl};\n cursor: pointer;\n color: rgba(255, 255, 255, 0.7);\n }\n `;\n});\n\nStyledDrawerHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerBackButton = styled.button(({ theme }) => {\n return css`\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n border-radius: calc(\n ${`${theme.base['border-radius']} * ${theme.components.button['border-radius']}`}\n );\n\n &:hover,\n &:focus {\n color: ${theme.base.colors.white};\n background-color: rgba(255, 255, 255, 0.05);\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerBackButton.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerList = styled.ul<{ displayPins: boolean }>(() => {\n return css``;\n});\n\nStyledDrawerList.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerMetaList = styled.ul`\n li {\n color: inherit;\n }\n`;\n\nexport const StyledDrawerPinButton = styled.button(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { ltr } = useDirection();\n\n return css`\n color: inherit;\n padding: calc(2 * ${theme.base.spacing});\n cursor: pointer;\n font-size: ${fontSize.xxl};\n\n ${StyledIcon} {\n display: block;\n ${ltr &&\n css`\n transform: scaleX(-1);\n `}\n }\n\n &:hover,\n &:focus {\n color: ${theme.base.colors.white};\n background-color: rgba(255, 255, 255, 0.05);\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerPinButton.defaultProps = defaultThemeProp;\n\nexport const EmptyDrawerVisual = styled.div(({ theme }) => {\n return css`\n width: calc(4 * ${theme.base.spacing});\n height: calc(4 * ${theme.base.spacing});\n `;\n});\n\nEmptyDrawerVisual.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListHeading = styled.h3(({ theme }) => {\n return css`\n position: sticky;\n top: 0;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n background-color: hsl(207 14% 13% / 1);\n z-index: 1;\n `;\n});\n\nStyledDrawerListHeading.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerViewAll = styled.a(({ theme }) => {\n return css`\n position: sticky;\n bottom: 0;\n padding: ${theme.base.spacing} 0;\n color: inherit;\n background-color: ${theme.components['app-shell'].nav['background-color']};\n text-align: center;\n margin-top: 0.0625rem;\n\n &:hover,\n &:focus {\n color: ${theme.base.colors.white};\n }\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledDrawerViewAll.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListSection = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n min-height: max(20%, 8rem);\n overflow-y: auto;\n `;\n});\n\nStyledDrawerListSection.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerListContainer = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n height: calc(100% - 4 * ${theme.base.spacing} - ${fontSize.xxl});\n overflow: auto;\n `;\n});\n\nStyledDrawerListContainer.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EASH,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EASH,MAAM,OAAO,CAAC;AA0Bf,OAAO,EACL,gBAAgB,EAEhB,YAAY,EAEb,MAAM,kBAAkB,CAAC;AA0F1B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,gBAAgB,CAqInD,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,YAAY,CA2DpC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -5,13 +5,18 @@ import { useTheme, useArrows, useConsolidatedRef, useDirection, useUID, useI18n,
|
|
|
5
5
|
import ExpandCollapse from '../ExpandCollapse';
|
|
6
6
|
import BareButton from '../Button/BareButton';
|
|
7
7
|
import Flex from '../Flex';
|
|
8
|
-
import Icon from '../Icon';
|
|
8
|
+
import Icon, { registerIcon } from '../Icon';
|
|
9
9
|
import Text from '../Text';
|
|
10
10
|
import Button from '../Button';
|
|
11
11
|
import Link from '../Link';
|
|
12
|
+
import * as timesIcon from '../Icon/icons/times.icon';
|
|
13
|
+
import * as checkIcon from '../Icon/icons/check.icon';
|
|
14
|
+
import * as caretLeftIcon from '../Icon/icons/caret-left.icon';
|
|
15
|
+
import * as caretRightIcon from '../Icon/icons/caret-right.icon';
|
|
12
16
|
import NavigationListItemWrapper from './NavigationListItemWrapper';
|
|
13
|
-
import { StyledNavList, StyledNestedNavList,
|
|
17
|
+
import { StyledNavList, StyledNestedNavList, StyledNavItemIconBox, StyledNavListItem, StyledNavListItemExpandCollapse, StyledCaseClose, StyledSingleSelectIconBox } from './AppShell.styles';
|
|
14
18
|
import AppShellContext from './AppShellContext';
|
|
19
|
+
registerIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);
|
|
15
20
|
const NavigationMenu = props => {
|
|
16
21
|
const { navOpen } = useContext(AppShellContext);
|
|
17
22
|
const { visual, primary, secondary, href, onClick, items, onDismiss, actions, forwardedRef, ...restProps } = props;
|
|
@@ -31,10 +36,10 @@ const NavigationMenu = props => {
|
|
|
31
36
|
}, menuRef);
|
|
32
37
|
const { end } = useDirection();
|
|
33
38
|
return (_createElement(StyledNavListItem, { ...restProps, key: primary, nestedListCollapsed: collapsed, ref: menuRef },
|
|
34
|
-
_jsxs(BareButton, { id: uid, ref: itemRef, "aria-expanded": !collapsed, "aria-controls": `${uid}-menu`, "aria-label": primary, onClick: toggleCollapsed, children: [visual, secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { children: primary })), navState === 'open' && _jsx(Icon, { name: `caret-${end}`, as:
|
|
39
|
+
_jsxs(BareButton, { id: uid, ref: itemRef, "aria-expanded": !collapsed, "aria-controls": `${uid}-menu`, "aria-label": primary, onClick: toggleCollapsed, children: [visual && _jsx(StyledNavItemIconBox, { children: visual }), secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { children: primary })), navState === 'open' && _jsx(Icon, { name: `caret-${end}`, as: StyledNavListItemExpandCollapse })] }),
|
|
35
40
|
_jsx(NavigationList, { id: `${uid}-menu`, nestedList: true, items: items, collapsed: !navOpen || collapsed })));
|
|
36
41
|
};
|
|
37
|
-
export const NavigationListItem = ({ visual, primary, secondary, href, onClick, items, collapseItems = false, dismissible = false, onDismiss, actions, forwardedRef, isMenuItem, ...restProps }) => {
|
|
42
|
+
export const NavigationListItem = ({ visual, primary, secondary, href, onClick, items, collapseItems = false, dismissible = false, onDismiss, actions, forwardedRef, isMenuItem, count, singleSelect, selected, ...restProps }) => {
|
|
38
43
|
const { navOpen, navState } = useContext(AppShellContext);
|
|
39
44
|
const t = useI18n();
|
|
40
45
|
const listItemRef = useConsolidatedRef(forwardedRef);
|
|
@@ -44,8 +49,7 @@ export const NavigationListItem = ({ visual, primary, secondary, href, onClick,
|
|
|
44
49
|
e.stopPropagation();
|
|
45
50
|
onClick?.(e);
|
|
46
51
|
},
|
|
47
|
-
href
|
|
48
|
-
'aria-label': primary
|
|
52
|
+
href
|
|
49
53
|
};
|
|
50
54
|
let caseItems;
|
|
51
55
|
if (onDismiss) {
|
|
@@ -78,16 +82,15 @@ export const NavigationListItem = ({ visual, primary, secondary, href, onClick,
|
|
|
78
82
|
listItemRef.current?.focus();
|
|
79
83
|
}, [navOpen]);
|
|
80
84
|
const { end } = useDirection();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
: {}), children: [visual, secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { children: primary })), (hasItems || actions) && navState === 'open' && (_jsx(Icon, { name: `caret-${end}`, as: StyledAppShellNavIcon }))] }) }),
|
|
85
|
+
const primaryId = useUID();
|
|
86
|
+
return (_createElement(StyledNavListItem, { ...restProps, key: primary, singleSelect: singleSelect, nestedListCollapsed: true },
|
|
87
|
+
_jsx(NavigationListItemWrapper, { tooltipLabel: secondary ? `${primary} ${secondary}` : primary, label: primary, childElementRef: listItemRef, items: actions || items || caseItems, children: _jsxs(Component, { ...compProps, ref: listItemRef, ...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {}), "aria-labelledby": `${primaryId} ${count ? `${primary}-count` : ''}`, children: [singleSelect && (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledSingleSelectIconBox, children: selected && _jsx(Icon, { name: 'check' }) })), visual && _jsx(StyledNavItemIconBox, { children: visual }), secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { id: primaryId, children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { id: primaryId, children: primary })), (hasItems || actions) && navState === 'open' && (_jsx(Icon, { name: `caret-${end}`, as: StyledNavListItemExpandCollapse }))] }) }),
|
|
85
88
|
dismissible && navOpen && (_jsx(Button, { icon: true, variant: 'simple', as: StyledCaseClose, onClick: onDismiss, "aria-label": t('dismiss_case'), children: _jsx(Icon, { name: 'times' }) })),
|
|
86
89
|
hasItems && (
|
|
87
90
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
88
91
|
_jsx(NavigationList, { nestedList: true, items: actions || items, collapsed: !navOpen || collapseItems }))));
|
|
89
92
|
};
|
|
90
|
-
const NavigationList = ({ items = [], nestedList, id, collapsed }) => {
|
|
93
|
+
const NavigationList = ({ items = [], nestedList, id, collapsed, singleSelect }) => {
|
|
91
94
|
let Component = StyledNavList;
|
|
92
95
|
let ItemComponent;
|
|
93
96
|
const { navOpen } = useContext(AppShellContext);
|
|
@@ -114,7 +117,7 @@ const NavigationList = ({ items = [], nestedList, id, collapsed }) => {
|
|
|
114
117
|
else {
|
|
115
118
|
ItemComponent = NavigationListItem;
|
|
116
119
|
}
|
|
117
|
-
return _jsx(ItemComponent, { isMenuItem: nestedList, ...item }, item.id || item.primary);
|
|
120
|
+
return (_jsx(ItemComponent, { isMenuItem: nestedList, singleSelect: singleSelect, ...item }, item.id || item.primary));
|
|
118
121
|
}) }));
|
|
119
122
|
};
|
|
120
123
|
export default NavigationList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAGL,cAAc,EAGd,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAOpE,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,cAAc,GAAqB,KAAK,CAAC,EAAE;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,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aACpC;YACD,OAAO,KAAC,aAAa,IAA+B,UAAU,EAAE,UAAU,KAAM,IAAI,IAAzD,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAAsC,CAAC;QAC3F,CAAC,CAAC,GACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ElementType,\n FC,\n isValidElement,\n MouseEvent,\n MouseEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { OmitStrict } from '../../types';\nimport { PopoverProps } from '../Popover';\nimport Link from '../Link';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledAppShellNavIcon,\n StyledNavListItem,\n StyledCaseClose\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual}\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n {navState === 'open' && <Icon name={`caret-${end}`} as={StyledAppShellNavIcon} />}\n </BareButton>\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n collapseItems = false,\n dismissible = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n ...restProps\n}) => {\n const { navOpen, navState } = useContext(AppShellContext);\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href,\n 'aria-label': primary\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed>\n {/* forwardedRef typed as 'any' due to ambiguity of Component element type */}\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem\n ? { tabIndex: -1, role: 'menuitem', 'aria-label': primary }\n : {})}\n >\n {visual}\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n {(hasItems || actions) && navState === 'open' && (\n <Icon name={`caret-${end}`} as={StyledAppShellNavIcon} />\n )}\n </Component>\n </NavigationListItemWrapper>\n {dismissible && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({ items = [], nestedList, id, collapsed }) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n return <ItemComponent key={item.id || item.primary} isMenuItem={nestedList} {...item} />;\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAGL,cAAc,EAGd,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,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State\n} from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { OmitStrict } from '../../types';\nimport { PopoverProps } from '../Popover';\nimport Link from '../Link';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledNavItemIconBox,\n StyledNavListItem,\n StyledNavListItemExpandCollapse,\n StyledCaseClose,\n StyledSingleSelectIconBox\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nregisterIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n\n {navState === 'open' && <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />}\n </BareButton>\n\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n collapseItems = false,\n dismissible = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n count,\n singleSelect,\n selected,\n ...restProps\n}) => {\n const { navOpen, navState } = useContext(AppShellContext);\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n const primaryId = useUID();\n\n return (\n <StyledNavListItem {...restProps} key={primary} singleSelect={singleSelect} nestedListCollapsed>\n {/* forwardedRef typed as 'any' due to ambiguity of Component element type */}\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {})}\n aria-labelledby={`${primaryId} ${count ? `${primary}-count` : ''}`}\n >\n {singleSelect && (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledSingleSelectIconBox}\n >\n {selected && <Icon name='check' />}\n </Flex>\n )}\n\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span id={primaryId}>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span id={primaryId}>{primary}</span>\n )}\n\n {(hasItems || actions) && navState === 'open' && (\n <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />\n )}\n </Component>\n </NavigationListItemWrapper>\n\n {dismissible && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({\n items = [],\n nestedList,\n id,\n collapsed,\n singleSelect\n}) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n\n return (\n <ItemComponent\n key={item.id || item.primary}\n isMenuItem={nestedList}\n singleSelect={singleSelect}\n {...item}\n />\n );\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItemWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA2C,MAAM,OAAO,CAAC;AAYpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAsC3D,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"NavigationListItemWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA2C,MAAM,OAAO,CAAC;AAYpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAsC3D,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,uBAAuB,CAkLhD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -80,8 +80,10 @@ const ListItemWrapper = props => {
|
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
const onClick = (e) => {
|
|
82
82
|
if (items.length || content) {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
if (!navOpen) {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
}
|
|
85
87
|
if (!navOpen && !popoverOpen)
|
|
86
88
|
setPopoverOpen(true);
|
|
87
89
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,MAAM,eAA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Ref, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useDirection, useEscape, useFocusWithin, useOuterEvent, usePrevious } from '../../hooks';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport Menu from '../Menu';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nimport { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\n\nconst StyledNavigationPopover = styled.div(({ theme }) => {\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n background-color: ${theme.components['app-shell'].nav['background-color']};\n &,\n ${StyledMenuListContainer} {\n background-color: ${theme.components['app-shell'].nav['background-color']};\n\n header {\n color: ${theme.base.palette.light};\n border-bottom: none;\n opacity: 0.7;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n }\n\n ${StyledMenuListContainer} li {\n color: rgba(255, 255, 255, 0.7);\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: #ffffff;\n background-color: rgba(255, 255, 255, 0.05);\n }\n }\n `;\n});\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items = [],\n content,\n onMenuToggle\n } = props;\n const { navOpen, collapsedHoverMenus } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const [popoverOpen, setPopoverOpen] = useState(false);\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n const focusWithin = useFocusWithin([popoverRef, childElementRef]);\n const prevFocusWithin = usePrevious(focusWithin);\n\n const closePopover = (focusChildEl: boolean = true) => {\n if (popoverOpen) {\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', [popoverRef], () => closePopover());\n\n useEffect(() => {\n const onClick = (e: Event) => {\n if (items.length || content) {\n e.stopPropagation();\n e.preventDefault();\n if (!navOpen && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(false);\n }, 0);\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n const tag = (e.relatedTarget as HTMLElement).tagName;\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (['A', 'BUTTON', 'FORM'].includes(tag)) {\n closePopover(false);\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover(false);\n }\n }, 1000);\n }\n };\n\n childElementRef.current?.addEventListener('click', onClick);\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', onClick);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n }\n return () => {\n childElementRef.current?.removeEventListener('click', onClick);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', onClick);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [items, content, navOpen, closePopover, collapsedHoverMenus]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEffect(() => {\n if (!focusWithin && prevFocusWithin) {\n setPopoverOpen(false);\n }\n }, [focusWithin, prevFocusWithin]);\n\n useEscape(() => closePopover(), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(), popoverRef, [popoverRef]);\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {popoverOpen && (items.length || content) && (\n <Popover\n target={childElementRef.current}\n placement={`${end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n >\n {content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n items={items.map(item => {\n return {\n id: (item.primary || item.text) as string,\n primary: (item.primary || item.text) as string,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={<Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n )}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClG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,IAAI;oCACf,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;wCAChB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;wCAClB,cAAc,CAAC,KAAK,CAAC,CAAC;oCACxB,CAAC;iCACF,CAAC;4BACJ,CAAC,CAAC,EACF,MAAM,EAAE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EACzC,YAAY,EAAE,mBAAmB,EACjC,YAAY,EAAE,mBAAmB,GACjC,CACH,GACO,CACX,IACA,CACJ,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FC, useContext, useEffect, useRef, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useDirection, useEscape, useFocusWithin, useOuterEvent, usePrevious } from '../../hooks';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport Menu from '../Menu';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nimport { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\n\nconst StyledNavigationPopover = styled.div(({ theme }) => {\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n background-color: ${theme.components['app-shell'].nav['background-color']};\n &,\n ${StyledMenuListContainer} {\n background-color: ${theme.components['app-shell'].nav['background-color']};\n\n header {\n color: ${theme.base.palette.light};\n border-bottom: none;\n opacity: 0.7;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n }\n\n ${StyledMenuListContainer} li {\n color: rgba(255, 255, 255, 0.7);\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: #ffffff;\n background-color: rgba(255, 255, 255, 0.05);\n }\n }\n `;\n});\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items = [],\n content,\n onMenuToggle\n } = props;\n const { navOpen, collapsedHoverMenus } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const [popoverOpen, setPopoverOpen] = useState(false);\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n const focusWithin = useFocusWithin([popoverRef, childElementRef]);\n const prevFocusWithin = usePrevious(focusWithin);\n\n const closePopover = (focusChildEl: boolean = true) => {\n if (popoverOpen) {\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', [popoverRef], () => closePopover());\n\n useEffect(() => {\n const onClick = (e: Event) => {\n if (items.length || content) {\n if (!navOpen) {\n e.stopPropagation();\n e.preventDefault();\n }\n if (!navOpen && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(false);\n }, 0);\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n const tag = (e.relatedTarget as HTMLElement).tagName;\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (['A', 'BUTTON', 'FORM'].includes(tag)) {\n closePopover(false);\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover(false);\n }\n }, 1000);\n }\n };\n\n childElementRef.current?.addEventListener('click', onClick);\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', onClick);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n }\n return () => {\n childElementRef.current?.removeEventListener('click', onClick);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', onClick);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [items, content, navOpen, closePopover, collapsedHoverMenus]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEffect(() => {\n if (!focusWithin && prevFocusWithin) {\n setPopoverOpen(false);\n }\n }, [focusWithin, prevFocusWithin]);\n\n useEscape(() => closePopover(), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(), popoverRef, [popoverRef]);\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {popoverOpen && (items.length || content) && (\n <Popover\n target={childElementRef.current}\n placement={`${end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n >\n {content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n items={items.map(item => {\n return {\n id: (item.primary || item.text) as string,\n primary: (item.primary || item.text) as string,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={<Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n )}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default } from './AppShell';
|
|
2
2
|
export { default as AppShellList, AppShellListProps } from './AppShellList';
|
|
3
|
-
export { AppHeaderProps, AppShellProps, DrawerItemProps, DrawerListProps } from './AppShell.types';
|
|
3
|
+
export { AppHeaderProps, AppShellProps, ContextSwitcherProps, DrawerItemProps, DrawerListProps } from './AppShell.types';
|
|
4
4
|
export { default as AppShellContext, AppShellDrawerContext } from './AppShellContext';
|
|
5
|
+
export { default as ContextSwitcher } from './ContextSwitcher';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default } from './AppShell';
|
|
2
2
|
export { default as AppShellList } from './AppShellList';
|
|
3
3
|
export { default as AppShellContext, AppShellDrawerContext } from './AppShellContext';
|
|
4
|
+
export { default as ContextSwitcher } from './ContextSwitcher';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAqB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAQ5E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './AppShell';\nexport { default as AppShellList, AppShellListProps } from './AppShellList';\nexport {\n AppHeaderProps,\n AppShellProps,\n ContextSwitcherProps,\n DrawerItemProps,\n DrawerListProps\n} from './AppShell.types';\nexport { default as AppShellContext, AppShellDrawerContext } from './AppShellContext';\nexport { default as ContextSwitcher } from './ContextSwitcher';\n"]}
|
|
@@ -28,7 +28,7 @@ export interface AvatarProps extends BaseProps, NoChildrenProp {
|
|
|
28
28
|
/** Ref for the wrapping element. */
|
|
29
29
|
ref?: Ref<HTMLDivElement | HTMLImageElement>;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
type AvatarPropsWithDefaults = PropsWithDefaults<AvatarProps, 'shape' | 'size'>;
|
|
32
32
|
export declare const StyledAvatarImage: import("styled-components").StyledComponent<FunctionComponent<import("../Image").ImageProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
33
33
|
export declare const StyledAvatar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, OmitStrict<AvatarPropsWithDefaults, "children" | "name"> & {
|
|
34
34
|
hasSrc?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,GAAG,EAEH,cAAc,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,cAAc;IAC5D,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IAC9B,yDAAyD;IACzD,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,kEAAkE;IAClE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,gBAAgB,CAAC,CAAC;CAC9C;AAED,
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/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@@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAKT,GAAG,EACH,UAAU,EAEX,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AACzE,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAKT,GAAG,EACH,UAAU,EAEX,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AACzE,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IACrD;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAClD;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAcD,eAAO,MAAM,cAAc;aAAqD,CAAC,GAAG,CAAC;SAqCnF,CAAC;AAMH,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAuF7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -4,6 +4,7 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import { defaultThemeProp } from '../../theme';
|
|
5
5
|
import { reflow } from '../../utils';
|
|
6
6
|
import Flex from '../Flex';
|
|
7
|
+
import { useConsolidatedRef } from '../../hooks';
|
|
7
8
|
const transitionSpeedToTheme = {
|
|
8
9
|
slow: 2,
|
|
9
10
|
medium: 1,
|
|
@@ -46,6 +47,7 @@ export const StyledBackdrop = styled.div(props => {
|
|
|
46
47
|
StyledBackdrop.defaultProps = defaultThemeProp;
|
|
47
48
|
const Backdrop = forwardRef((props, ref) => {
|
|
48
49
|
const { children, container, open = false, variant = 'dark', transitionSpeed = 'medium', alpha = 0.6, position = 'fixed', onBeforeTransitionIn, onAfterTransitionIn, onBeforeTransitionOut, onAfterTransitionOut, ...restProps } = props;
|
|
50
|
+
const cRef = useConsolidatedRef(ref);
|
|
49
51
|
const [state, setState] = useState('closed');
|
|
50
52
|
const onTransitionEnd = useCallback((e) => {
|
|
51
53
|
if (e.propertyName !== 'opacity' || e.target !== e.currentTarget)
|
|
@@ -73,8 +75,26 @@ const Backdrop = forwardRef((props, ref) => {
|
|
|
73
75
|
onBeforeTransitionOut?.();
|
|
74
76
|
setState('closing');
|
|
75
77
|
}
|
|
76
|
-
}, [open
|
|
77
|
-
|
|
78
|
+
}, [open]);
|
|
79
|
+
// Using a separate effect instead of combined logic above as it seems more intuitive to mentally manage.
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!cRef.current)
|
|
82
|
+
return;
|
|
83
|
+
const opacity = window.getComputedStyle(cRef.current).opacity;
|
|
84
|
+
// If the opacity is already at the destination value, sync the state value.
|
|
85
|
+
if (state === 'closing' && opacity === '0') {
|
|
86
|
+
// Since the transition never ran, we have to pretend it did and call the callback.
|
|
87
|
+
// TODO: This maybe can be fixed with the animation api
|
|
88
|
+
onAfterTransitionOut?.();
|
|
89
|
+
setState('closed');
|
|
90
|
+
}
|
|
91
|
+
if (state === 'opening' && opacity === '1') {
|
|
92
|
+
// ditto, see above...
|
|
93
|
+
onAfterTransitionIn?.();
|
|
94
|
+
setState('open');
|
|
95
|
+
}
|
|
96
|
+
}, [state]);
|
|
97
|
+
return !open && state === 'closed' ? null : (_jsx(Flex, { container: { justify: 'center', alignItems: 'center', ...container }, as: StyledBackdrop, transitionSpeed: transitionSpeed, opacity: state === 'opening' || state === 'open' ? 1 : 0, alpha: alpha, variant: variant, position: position, onTransitionEnd: onTransitionEnd, ref: cRef, ...restProps, children: children }));
|
|
78
98
|
});
|
|
79
99
|
export default Backdrop;
|
|
80
100
|
//# sourceMappingURL=Backdrop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EAIX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAmB,MAAM,SAAS,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"Backd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AAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,IAAI,KACL,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect,\n useState,\n useCallback,\n forwardRef,\n Ref,\n MouseEvent,\n PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { reflow } from '../../utils';\nimport { BaseProps, PropsWithDefaults, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { useConsolidatedRef } from '../../hooks';\n\nexport interface BackdropProps extends BaseProps {\n /**\n * Opacity of the Backdrop.\n * @default 0.4\n */\n alpha?: number;\n /**\n * Any React Node to be rendered on top of the Backdrop component.\n */\n children?: ReactNode;\n /** Props passed to Flex container. */\n container?: Exclude<FlexProps['container'], boolean>;\n /**\n * Toggles visibility of Backdrop.\n * @default false\n */\n open?: boolean;\n /**\n * Determines the color of the Backdrop.\n * @default \"dark\"\n */\n variant?: 'dark' | 'light';\n /**\n * Transition speed of Backdrop animation.\n * @default \"medium\"\n */\n transitionSpeed?: 'slow' | 'medium' | 'fast' | 'none';\n /**\n * The position of the Backdrop.\n * @default \"fixed\"\n */\n position?: 'absolute' | 'fixed';\n /**\n * Accepts a callback function for click event on Backdrop.\n */\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n /**\n * Accepts a callback that gets invoked before opening Backdrop.\n */\n onBeforeTransitionIn?: () => void;\n /**\n * Accepts a callback that gets invoked after opening Backdrop.\n */\n onAfterTransitionIn?: () => void;\n /**\n * Accepts a callback that gets invoked before closing Backdrop.\n */\n onBeforeTransitionOut?: () => void;\n /**\n * Accepts a callback that gets invoked after closing Backdrop\n */\n onAfterTransitionOut?: () => void;\n /** Ref for a Backdrop's root div element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype BackdropPropsWithDefaults = PropsWithDefaults<\n BackdropProps,\n 'open' | 'transitionSpeed' | 'alpha' | 'position'\n>;\n\nconst transitionSpeedToTheme = {\n slow: 2,\n medium: 1,\n fast: 0.5,\n none: 0\n} as const;\n\nexport const StyledBackdrop = styled.div<BackdropPropsWithDefaults & { opacity: 0 | 1 }>(props => {\n const {\n theme: { base }\n } = props;\n const { opacity, alpha, variant, position } = props;\n const transitionDuration = `max(calc(${transitionSpeedToTheme[props.transitionSpeed]} * ${\n base.animation.speed\n }), 1ms)`;\n\n return css`\n position: ${position};\n z-index: ${position === 'fixed' ? base['z-index'].backdrop : base['z-index'].popover + 1};\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n opacity: ${opacity};\n transition-property: opacity;\n transition-timing-function: ${props.theme.base.animation.timing.ease};\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n transition-duration: 1ms;\n transition-duration: ${transitionDuration};\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n\n ${variant === 'dark' &&\n css`\n background: rgba(0, 0, 0, ${alpha});\n `}\n\n ${variant === 'light' &&\n css`\n background: rgba(255, 255, 255, ${alpha});\n `}\n `;\n});\n\nStyledBackdrop.defaultProps = defaultThemeProp;\n\ntype State = 'closed' | 'opening' | 'open' | 'closing';\n\nconst Backdrop: FunctionComponent<BackdropProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<BackdropProps>, ref: BackdropProps['ref']) => {\n const {\n children,\n container,\n open = false,\n variant = 'dark',\n transitionSpeed = 'medium',\n alpha = 0.6,\n position = 'fixed',\n onBeforeTransitionIn,\n onAfterTransitionIn,\n onBeforeTransitionOut,\n onAfterTransitionOut,\n ...restProps\n } = props;\n\n const cRef = useConsolidatedRef(ref);\n\n const [state, setState] = useState<State>('closed');\n\n const onTransitionEnd = useCallback(\n (e: TransitionEvent) => {\n if (e.propertyName !== 'opacity' || e.target !== e.currentTarget) return;\n let nextState: State;\n\n if (state === 'closing') {\n nextState = 'closed';\n onAfterTransitionOut?.();\n } else {\n nextState = 'open';\n onAfterTransitionIn?.();\n }\n\n setState(nextState);\n },\n [state, onAfterTransitionOut, onAfterTransitionIn]\n );\n\n useEffect(() => {\n if (open) {\n if (state === 'closed' || state === 'closing') {\n onBeforeTransitionIn?.();\n reflow();\n setState('opening');\n }\n } else if (state === 'open' || state === 'opening') {\n onBeforeTransitionOut?.();\n setState('closing');\n }\n }, [open]);\n\n // Using a separate effect instead of combined logic above as it seems more intuitive to mentally manage.\n useEffect(() => {\n if (!cRef.current) return;\n const opacity = window.getComputedStyle(cRef.current).opacity;\n // If the opacity is already at the destination value, sync the state value.\n if (state === 'closing' && opacity === '0') {\n // Since the transition never ran, we have to pretend it did and call the callback.\n // TODO: This maybe can be fixed with the animation api\n onAfterTransitionOut?.();\n setState('closed');\n }\n if (state === 'opening' && opacity === '1') {\n // ditto, see above...\n onAfterTransitionIn?.();\n setState('open');\n }\n }, [state]);\n\n return !open && state === 'closed' ? null : (\n <Flex\n container={{ justify: 'center', alignItems: 'center', ...container }}\n as={StyledBackdrop}\n transitionSpeed={transitionSpeed}\n opacity={state === 'opening' || state === 'open' ? 1 : 0}\n alpha={alpha}\n variant={variant}\n position={position}\n onTransitionEnd={onTransitionEnd}\n ref={cRef}\n {...restProps}\n >\n {children}\n </Flex>\n );\n }\n);\n\nexport default Backdrop;\n"]}
|
|
@@ -4,11 +4,11 @@ export interface CountProps {
|
|
|
4
4
|
/** Determines the color to render the Badge as. This color is derived from the Theme.
|
|
5
5
|
* @default "default"
|
|
6
6
|
*/
|
|
7
|
-
variant?: 'default' | '
|
|
7
|
+
variant?: 'default' | 'urgent';
|
|
8
8
|
/** The count to be displayed within the Badge. */
|
|
9
9
|
children: number | null;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type CountPropsWithDefaults = PropsWithDefaults<CountProps, 'variant'>;
|
|
12
12
|
export declare const StyledCount: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, Pick<CountPropsWithDefaults, "variant"> & {
|
|
13
13
|
children: string;
|
|
14
14
|
}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Count.d.ts","sourceRoot":"","sources":["../../../src/components/Badges/Count.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,MAAM,OAAO,CAAC;AAM7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"Count.d.ts","sourceRoot":"","sources":["../../../src/components/Badges/Count.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,MAAM,OAAO,CAAC;AAM7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,KAAK,sBAAsB,GAAG,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAEvE,eAAO,MAAM,WAAW;cACgC,MAAM;SA2B5D,CAAC;AAwCH,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,YAAY,GAAG,UAAU,CASxC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import {
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
5
|
import { defaultThemeProp } from '../../theme';
|
|
6
|
-
import { tryCatch } from '../../utils
|
|
6
|
+
import { tryCatch } from '../../utils';
|
|
7
7
|
import { calculateFontSize } from '../../styles';
|
|
8
|
-
export const StyledCount = styled.span(
|
|
9
|
-
const { foreground, background } =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const invertedBackground = tryCatch(() => transparentize(0.5, mix(0.2, background, '#ffffff')));
|
|
13
|
-
const displayBackground = props.variant === 'inverted' ? invertedBackground : background;
|
|
14
|
-
const borderRadius = props.theme.base['border-radius'];
|
|
15
|
-
const { spacing } = props.theme.base;
|
|
16
|
-
const fontSize = calculateFontSize(props.theme.base['font-size'], props.theme.base['font-scale']);
|
|
8
|
+
export const StyledCount = styled.span(({ theme, variant, children }) => {
|
|
9
|
+
const { foreground, background } = theme.components.badges.count[variant];
|
|
10
|
+
const shadow = tryCatch(() => rgba(foreground, 0.1));
|
|
11
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
17
12
|
return css `
|
|
18
|
-
background: ${displayBackground};
|
|
19
|
-
border-radius: calc(1.125 * ${borderRadius});
|
|
20
|
-
color: ${foreground};
|
|
21
13
|
display: inline-block;
|
|
14
|
+
block-size: 1rem;
|
|
15
|
+
border-radius: calc(9999 * ${theme.base['border-radius']});
|
|
16
|
+
color: ${foreground};
|
|
17
|
+
background-color: ${background};
|
|
18
|
+
box-shadow: inset 0 0 0 0.0625rem ${shadow};
|
|
22
19
|
font-size: ${fontSize.xxs};
|
|
23
|
-
font-weight: bold;
|
|
24
|
-
line-height:
|
|
20
|
+
font-weight: ${theme.base['font-weight'].bold};
|
|
21
|
+
line-height: 1rem;
|
|
25
22
|
text-align: center;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
css `
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
|
|
24
|
+
${children.length === 1
|
|
25
|
+
? css `
|
|
26
|
+
aspect-ratio: 1 / 1;
|
|
27
|
+
`
|
|
28
|
+
: css `
|
|
29
|
+
padding-inline: ${theme.base.spacing};
|
|
30
|
+
`}
|
|
34
31
|
`;
|
|
35
32
|
});
|
|
36
33
|
StyledCount.defaultProps = defaultThemeProp;
|
|
37
|
-
// Replace this with Intl.
|
|
34
|
+
// Replace this with Intl.NumberFormat when roundingMode is supported.
|
|
38
35
|
/* eslint-disable yoda */
|
|
39
36
|
const getLabel = (val) => {
|
|
40
37
|
if (val < 1000)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Count.js","sourceRoot":"","sources":["../../../src/components/Badges/Count.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Count.js","sourceRoot":"","sources":["../../../src/components/Badges/Count.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAajD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAEpC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE1E,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IA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,KAAM,SAAS,EAAE,GAAG,EAAE,GAAG,YACnD,WAAW,CAAC,QAAkB,CAAC,GACpB,CACf,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { FC, PropsWithoutRef, Ref, forwardRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { ForwardProps, PropsWithDefaults } from '../../types';\nimport { calculateFontSize } from '../../styles';\n\nexport interface CountProps {\n /** Determines the color to render the Badge as. This color is derived from the Theme.\n * @default \"default\"\n */\n variant?: 'default' | 'urgent';\n /** The count to be displayed within the Badge. */\n children: number | null;\n}\n\ntype CountPropsWithDefaults = PropsWithDefaults<CountProps, 'variant'>;\n\nexport const StyledCount = styled.span<\n Pick<CountPropsWithDefaults, 'variant'> & { children: string }\n>(({ theme, variant, children }) => {\n const { foreground, background } = theme.components.badges.count[variant];\n\n const shadow = tryCatch(() => rgba(foreground, 0.1));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n block-size: 1rem;\n border-radius: calc(9999 * ${theme.base['border-radius']});\n color: ${foreground};\n background-color: ${background};\n box-shadow: inset 0 0 0 0.0625rem ${shadow};\n font-size: ${fontSize.xxs};\n font-weight: ${theme.base['font-weight'].bold};\n line-height: 1rem;\n text-align: center;\n\n ${children.length === 1\n ? css`\n aspect-ratio: 1 / 1;\n `\n : css`\n padding-inline: ${theme.base.spacing};\n `}\n `;\n});\n\nStyledCount.defaultProps = defaultThemeProp;\n\n// Replace this with Intl.NumberFormat when roundingMode is supported.\n/* eslint-disable yoda */\nconst getLabel = (val: number): string => {\n if (val < 1_000) return '';\n if (1_000 <= val && val < 1_000_000) return 'K';\n if (1_000_000 <= val && val < 1_000_000_000) return 'M';\n if (1_000_000_000 <= val && val < 1_000_000_000_000) return 'B';\n if (1_000_000_000_000 <= val && val < 1_000_000_000_000_000) return 'T';\n return '';\n};\n/* eslint-enable yoda */\n\nconst truncateValue = (val: number): string => {\n for (let magnitude = 3; magnitude < 15; magnitude += 3) {\n if (val < 10 ** (magnitude + 1)) {\n return `${`${val}`.slice(0, 1)}.${`${val}`.slice(1, 2)}${getLabel(val)}`;\n }\n if (val < 10 ** (magnitude + 2)) {\n return `${`${val}`.slice(0, 2)}${getLabel(val)}`;\n }\n if (val < 10 ** (magnitude + 3)) {\n return `${`${val}`.slice(0, 3)}${getLabel(val)}`;\n }\n }\n\n return '999T+';\n};\n\nconst formatValue = (val: number): string => {\n const absVal = Math.abs(val);\n\n if (absVal < 1_000) return `${val}`;\n\n return `${val < 0 ? '-' : ''}${truncateValue(absVal)}`;\n};\n\nconst Count: FC<ForwardProps & CountProps> = forwardRef(\n (props: PropsWithoutRef<CountProps>, ref: Ref<HTMLSpanElement>) => {\n const { variant = 'default', children, ...restProps } = props;\n return Number.isInteger(children) ? (\n <StyledCount variant={variant} {...restProps} ref={ref}>\n {formatValue(children as number)}\n </StyledCount>\n ) : null;\n }\n);\n\nexport default Count;\n"]}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { mix, transparentize } from 'polished';
|
|
5
|
-
import { tryCatch } from '../../utils
|
|
5
|
+
import { tryCatch } from '../../utils';
|
|
6
6
|
import BareButton, { StyledBareButton } from '../Button/BareButton';
|
|
7
7
|
import Icon, { registerIcon, StyledIcon } from '../Icon';
|
|
8
8
|
import * as timesIcon from '../Icon/icons/times.icon';
|