@pega/cosmos-react-core 4.0.0-dev.1.2 → 4.0.0-dev.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/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 +57 -20
- 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 +26 -5
- 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
- package/lib/utils/utils.js.map +0 -1
|
@@ -45,6 +45,14 @@ const helpers = {
|
|
|
45
45
|
return fn(newNode, index, array);
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
|
+
forEachNode(nodes, fn) {
|
|
49
|
+
nodes.forEach((node, index, array) => {
|
|
50
|
+
if (node.nodes) {
|
|
51
|
+
this.forEachNode(node.nodes, fn);
|
|
52
|
+
}
|
|
53
|
+
fn(node, index, array);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
48
56
|
mapNode(nodes, id, fn) {
|
|
49
57
|
return nodes.map((node, index, array) => {
|
|
50
58
|
let newNode = node;
|
|
@@ -72,6 +80,14 @@ const helpers = {
|
|
|
72
80
|
return [...flatNodes, ancestors ? { ...node, ancestors } : node];
|
|
73
81
|
}, []);
|
|
74
82
|
},
|
|
83
|
+
getAncestors(nodes, id, ancestors = []) {
|
|
84
|
+
const directParent = this.getParentNode(nodes, id);
|
|
85
|
+
if (directParent) {
|
|
86
|
+
ancestors.push(directParent);
|
|
87
|
+
this.getAncestors(nodes, directParent.id, ancestors);
|
|
88
|
+
}
|
|
89
|
+
return ancestors;
|
|
90
|
+
},
|
|
75
91
|
appendTo(nodes, id, newNodes) {
|
|
76
92
|
if (id) {
|
|
77
93
|
return this.mapNode(nodes, id, node => ({
|
|
@@ -81,7 +97,7 @@ const helpers = {
|
|
|
81
97
|
}
|
|
82
98
|
return [...nodes, ...newNodes];
|
|
83
99
|
},
|
|
84
|
-
expandTo(nodes, id) {
|
|
100
|
+
expandTo(nodes, id, collapseOthers = false) {
|
|
85
101
|
return nodes.map(node => {
|
|
86
102
|
// leaf node
|
|
87
103
|
if (node.id === id) {
|
|
@@ -91,14 +107,18 @@ const helpers = {
|
|
|
91
107
|
};
|
|
92
108
|
}
|
|
93
109
|
// parent node
|
|
94
|
-
if (node.nodes
|
|
110
|
+
if (node.nodes) {
|
|
111
|
+
let expanded = collapseOthers ? false : node.expanded;
|
|
112
|
+
if (this.getNode(node.nodes, id)) {
|
|
113
|
+
expanded = true;
|
|
114
|
+
}
|
|
95
115
|
return {
|
|
96
116
|
...node,
|
|
97
|
-
nodes: this.expandTo(node.nodes, id),
|
|
98
|
-
expanded
|
|
117
|
+
nodes: this.expandTo(node.nodes, id, collapseOthers),
|
|
118
|
+
expanded
|
|
99
119
|
};
|
|
100
120
|
}
|
|
101
|
-
return { ...node, expanded: false };
|
|
121
|
+
return { ...node, expanded: collapseOthers ? false : node.expanded };
|
|
102
122
|
});
|
|
103
123
|
},
|
|
104
124
|
getFirstChildNode(nodes, id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/Tree/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;IACd,OAAO,CAAgC,KAAU,EAAE,EAAW;QAC5D,IAAI,KAAK,CAAC;QACV,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;gBAClB,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO,IAAI,CAAC;aACb;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,CAAC,KAAK,CAAC;aAChB;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAgC,KAAU,EAAE,EAAW;QAClE,IAAI,KAAoB,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC1B,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;oBACvB,KAAK,GAAG,IAAI,CAAC;oBAC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,aAAa,CAAC,EAAE,CAAC,CAAC;aACzD;iBAAM;gBACL,QAAQ,GAAG,aAAa,CAAC;aAC1B;SACF;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,eAAe,CAAgC,KAAU,EAAE,EAAW;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,IAAI,YAAY,CAAC;QACjB,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAChC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrE,IAAI,YAAY,KAAK,CAAC,EAAE;gBACtB,YAAY,GAAG,MAAM,CAAC;aACvB;iBAAM;gBACL,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5E;SACF;aAAM;YACL,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrD,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;gBAAE,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n getParentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found: T | undefined;\n nodes.some(node => {\n const childNodes = node.nodes || [];\n childNodes.some(childNode => {\n if (childNode.id === id) {\n found = node;\n return true;\n }\n\n if (childNode.nodes) {\n found = this.getParentNode(childNodes, id) as T;\n return !!found;\n }\n\n return false;\n });\n\n return !!found;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n },\n\n expandTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T[] {\n return nodes.map(node => {\n // leaf node\n if (node.id === id) {\n return {\n ...node,\n expanded: true\n };\n }\n\n // parent node\n if (node.nodes && !!this.getNode(node.nodes, id)) {\n return {\n ...node,\n nodes: this.expandTo(node.nodes, id),\n expanded: true\n };\n }\n\n return { ...node, expanded: false };\n });\n },\n\n getFirstChildNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let firstChildNode;\n const node = this.getNode(nodes, id);\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n firstChildNode = childNodes[0];\n }\n return firstChildNode;\n },\n\n getAdjacentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const parent = this.getParentNode(nodes, id);\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes as T[];\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === childNodes.length - 1) {\n nextNode = this.getAdjacentNode(nodes, parent.id);\n } else {\n nextNode = childNodes[currentIndex + 1];\n }\n } else {\n const index = nodes.map(nodeEl => nodeEl.id).indexOf(id);\n nextNode = nodes[index + 1];\n }\n return nextNode;\n },\n\n getNextNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const firstChildNode = this.getFirstChildNode(nodes, id);\n if (firstChildNode) {\n nextNode = firstChildNode;\n } else {\n nextNode = this.getAdjacentNode(nodes, id);\n }\n return nextNode;\n },\n\n getDeepestNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const node = this.getNode(nodes, id);\n let lastNode = node;\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n const lastChildNode = childNodes[childNodes.length - 1];\n if (lastChildNode.expanded) {\n lastNode = this.getDeepestNode(nodes, lastChildNode.id);\n } else {\n lastNode = lastChildNode;\n }\n }\n return lastNode;\n },\n\n getPreviousNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const parent = this.getParentNode(nodes, id);\n let previousNode;\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes;\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === 0) {\n previousNode = parent;\n } else {\n previousNode = this.getDeepestNode(nodes, childNodes[currentIndex - 1].id);\n }\n } else {\n const index = nodes.map(node => node.id).indexOf(id);\n if (nodes[index - 1]) previousNode = this.getDeepestNode(nodes, nodes[index - 1].id);\n }\n return previousNode;\n }\n};\n\nexport default helpers;\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/Tree/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;IACd,OAAO,CAAgC,KAAU,EAAE,EAAW;QAC5D,IAAI,KAAK,CAAC;QACV,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;gBAClB,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO,IAAI,CAAC;aACb;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,CAAC,KAAK,CAAC;aAChB;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAgC,KAAU,EAAE,EAAW;QAClE,IAAI,KAAoB,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpC,UAAU,C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AAC;QAC7C,IAAI,YAAY,CAAC;QACjB,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAChC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrE,IAAI,YAAY,KAAK,CAAC,EAAE;gBACtB,YAAY,GAAG,MAAM,CAAC;aACvB;iBAAM;gBACL,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5E;SACF;aAAM;YACL,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrD,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;gBAAE,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n getParentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found: T | undefined;\n nodes.some(node => {\n const childNodes = node.nodes || [];\n childNodes.some(childNode => {\n if (childNode.id === id) {\n found = node;\n return true;\n }\n\n if (childNode.nodes) {\n found = this.getParentNode(childNodes, id) as T;\n return !!found;\n }\n\n return false;\n });\n\n return !!found;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n forEachNode<T extends TreeNode = TreeNode>(\n nodes: T[],\n fn: (node: T, index: number, nodes: T[]) => void\n ): void {\n nodes.forEach((node, index, array) => {\n if (node.nodes) {\n this.forEachNode(node.nodes as T[], fn);\n }\n\n fn(node, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n getAncestors<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], ancestors: T[] = []): T[] {\n const directParent = this.getParentNode(nodes, id);\n\n if (directParent) {\n ancestors.push(directParent);\n this.getAncestors(nodes, directParent.id, ancestors);\n }\n\n return ancestors;\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n },\n\n expandTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], collapseOthers = false): T[] {\n return nodes.map(node => {\n // leaf node\n if (node.id === id) {\n return {\n ...node,\n expanded: true\n };\n }\n\n // parent node\n if (node.nodes) {\n let expanded = collapseOthers ? false : node.expanded;\n\n if (this.getNode(node.nodes, id)) {\n expanded = true;\n }\n\n return {\n ...node,\n nodes: this.expandTo(node.nodes, id, collapseOthers),\n expanded\n };\n }\n\n return { ...node, expanded: collapseOthers ? false : node.expanded };\n });\n },\n\n getFirstChildNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let firstChildNode;\n const node = this.getNode(nodes, id);\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n firstChildNode = childNodes[0];\n }\n return firstChildNode;\n },\n\n getAdjacentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const parent = this.getParentNode(nodes, id);\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes as T[];\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === childNodes.length - 1) {\n nextNode = this.getAdjacentNode(nodes, parent.id);\n } else {\n nextNode = childNodes[currentIndex + 1];\n }\n } else {\n const index = nodes.map(nodeEl => nodeEl.id).indexOf(id);\n nextNode = nodes[index + 1];\n }\n return nextNode;\n },\n\n getNextNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const firstChildNode = this.getFirstChildNode(nodes, id);\n if (firstChildNode) {\n nextNode = firstChildNode;\n } else {\n nextNode = this.getAdjacentNode(nodes, id);\n }\n return nextNode;\n },\n\n getDeepestNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const node = this.getNode(nodes, id);\n let lastNode = node;\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n const lastChildNode = childNodes[childNodes.length - 1];\n if (lastChildNode.expanded) {\n lastNode = this.getDeepestNode(nodes, lastChildNode.id);\n } else {\n lastNode = lastChildNode;\n }\n }\n return lastNode;\n },\n\n getPreviousNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const parent = this.getParentNode(nodes, id);\n let previousNode;\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes;\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === 0) {\n previousNode = parent;\n } else {\n previousNode = this.getDeepestNode(nodes, childNodes[currentIndex - 1].id);\n }\n } else {\n const index = nodes.map(node => node.id).indexOf(id);\n if (nodes[index - 1]) previousNode = this.getDeepestNode(nodes, nodes[index - 1].id);\n }\n return previousNode;\n }\n};\n\nexport default helpers;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';
|
|
2
2
|
export { default as StandardTree } from './StandardTree';
|
|
3
|
-
export { StandardTreeProps } from './StandardTree.types';
|
|
3
|
+
export { StandardTreeProps, StandardTreeNode } from './StandardTree.types';
|
|
4
4
|
export { default as treeHelpers } from './helpers';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAY,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';\nexport { default as StandardTree } from './StandardTree';\nexport { StandardTreeProps } from './StandardTree.types';\nexport { default as treeHelpers } from './helpers';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAY,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';\nexport { default as StandardTree } from './StandardTree';\nexport { StandardTreeProps, StandardTreeNode } from './StandardTree.types';\nexport { default as treeHelpers } from './helpers';\n"]}
|
|
@@ -9,9 +9,9 @@ export interface URLDisplayProps extends BaseProps, NoChildrenProp {
|
|
|
9
9
|
* Controls styling of the field.
|
|
10
10
|
* @default "link"
|
|
11
11
|
*/
|
|
12
|
-
variant?: 'link' | 'text';
|
|
12
|
+
variant?: 'link' | 'text' | 'qrcode';
|
|
13
13
|
/** Ref for the wrapping element. */
|
|
14
|
-
ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;
|
|
14
|
+
ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;
|
|
15
15
|
}
|
|
16
16
|
declare const URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps>;
|
|
17
17
|
export default URLDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8B,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"URLDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8B,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGtE,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,cAAc;IAChE,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,eAAe,GAAG,gBAAgB,GAAG,cAAc,CAAC,CAAC;CACpF;AA4BD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAkCjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import Link from '../Link';
|
|
4
|
+
import QRCode from '../QRCode';
|
|
4
5
|
/**
|
|
5
6
|
* Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.
|
|
6
7
|
* It helps breaking a long url correctly to avoid parent container overflow issues
|
|
@@ -27,7 +28,13 @@ const generateUrlMarkup = (url) => {
|
|
|
27
28
|
};
|
|
28
29
|
const URLDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
|
|
29
30
|
const displayValue = value ? (displayText || generateUrlMarkup(value)) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }));
|
|
30
|
-
|
|
31
|
+
if (variant === 'text' || !value) {
|
|
32
|
+
return (_jsx("span", { ref: ref, ...restProps, children: displayValue }));
|
|
33
|
+
}
|
|
34
|
+
if (variant === 'qrcode') {
|
|
35
|
+
return (_jsx(QRCode, { ref: ref, ...restProps, value: value, label: displayText }));
|
|
36
|
+
}
|
|
37
|
+
return (_jsx(Link, { ref: ref, ...restProps, href: value, children: displayValue }));
|
|
31
38
|
});
|
|
32
39
|
export default URLDisplay;
|
|
33
40
|
//# sourceMappingURL=URLDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"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eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,GACR,CACR,CAAC;KACH;IACD,IAAI,OAAO,KAAK,QAAQ,EAAE;QACxB,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,GAA4B,KAC7B,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,GAClB,CACH,CAAC;KACH;IACD,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,KAAK,YACjE,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport QRCode from '../QRCode';\n\nexport interface URLDisplayProps extends BaseProps, NoChildrenProp {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default \"link\"\n */\n variant?: 'link' | 'text' | 'qrcode';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n /* Insert \\x1f (unit separator) char as a placeholder at correct position. */\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n /* Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping. */\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || generateUrlMarkup(value)\n ) : (\n <span aria-hidden='true'>––</span>\n );\n\n if (variant === 'text' || !value) {\n return (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n );\n }\n if (variant === 'qrcode') {\n return (\n <QRCode\n ref={ref as Ref<HTMLImageElement>}\n {...restProps}\n value={value}\n label={displayText}\n />\n );\n }\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as useFocusWithin } from './useFocusWithin';
|
|
|
15
15
|
export { default as useI18n } from './useI18n';
|
|
16
16
|
export { default as useInputFormatter } from './useInputFormatter';
|
|
17
17
|
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
|
+
export { default as useLiveLog } from './useLiveLog';
|
|
18
19
|
export { default as useLongPress } from './useLongPress';
|
|
19
20
|
export { default as useModalContext } from './useModalContext';
|
|
20
21
|
export { default as useModalManager } from './useModalManager';
|
package/lib/hooks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,S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AAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as useFocusWithin } from './useFocusWithin';
|
|
|
15
15
|
export { default as useI18n } from './useI18n';
|
|
16
16
|
export { default as useInputFormatter } from './useInputFormatter';
|
|
17
17
|
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
|
+
export { default as useLiveLog } from './useLiveLog';
|
|
18
19
|
export { default as useLongPress } from './useLongPress';
|
|
19
20
|
export { default as useModalContext } from './useModalContext';
|
|
20
21
|
export { default as useModalManager } from './useModalManager';
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAE9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,E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AAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as useOverride } from './useOverride';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAE9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as useOverride } from './useOverride';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
|
|
@@ -45,8 +45,8 @@ export interface UseActiveDescendantConfig {
|
|
|
45
45
|
*/
|
|
46
46
|
pauseDescendantEvaluation?: boolean;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
type CurrentDescendant = HTMLElement | undefined;
|
|
49
|
+
type Descendants = HTMLElement[] | null;
|
|
50
50
|
declare const useActiveDescendant: ({ focusEl, scope, scopeSelector, selector, orientation, focusDescendantEl, clearFocusDescendant, focusReturnEl, clearFocusReturn, currentDescendantId, onClick, preventInitialScroll, pauseDescendantEvaluation, clearPreventScroll }: UseActiveDescendantConfig, dependencyArray?: DependencyList) => {
|
|
51
51
|
activeDescendant: CurrentDescendant;
|
|
52
52
|
descendants: Descendants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveDescendant.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAuB,MAAM,OAAO,CAAC;AAMjF,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,wCAAwC;IACxC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACvC,qDAAqD;IACrD,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wDAAwD;IACxD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,
|
|
1
|
+
{"version":3,"file":"useActiveDescendant.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAuB,MAAM,OAAO,CAAC;AAMjF,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,wCAAwC;IACxC,KAAK,EAAE,WAAW,GAAG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ings":"AAAA,OAAO,EAA0B,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW1E;;;GAGG;AACH,QAAA,MAAM,SAAS,QACR,UAAU,WAAW,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"useArrows.d.ts","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW1E;;;GAGG;AACH,QAAA,MAAM,SAAS,QACR,UAAU,WAAW,CAAC;;;;;yCA0G5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/lib/hooks/useArrows.js
CHANGED
|
@@ -39,13 +39,13 @@ dependencies = []) => {
|
|
|
39
39
|
}, 0);
|
|
40
40
|
}, [selector, ...dependencies]);
|
|
41
41
|
const listener = useCallback((e) => {
|
|
42
|
+
const el = ref.current;
|
|
43
|
+
if (!el)
|
|
44
|
+
return;
|
|
42
45
|
if (['Home', 'End', NextKey, PrevKey].includes(e.key))
|
|
43
46
|
e.preventDefault();
|
|
44
47
|
if (!documentIsAvailable)
|
|
45
48
|
return;
|
|
46
|
-
const el = ref.current;
|
|
47
|
-
if (!el)
|
|
48
|
-
return;
|
|
49
49
|
const items = Array.from(el.querySelectorAll(selector)).filter((item) => item instanceof HTMLElement);
|
|
50
50
|
if (!items.length)
|
|
51
51
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA6B,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,SAAS,GAAG;;;;;CAKjB,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAChB,GAA2B,EAC3B;AACE,yKAAyK;AACzK,KAAK,GAAG,IAAI;AACZ,wPAAwP;AACxP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mB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useCallback, RefObject, DependencyList } from 'react';\n\nimport { documentIsAvailable } from '../utils';\n\nconst focusable = `\n a[href],\n button:enabled,\n input[type='checkbox']:enabled,\n input[type='radio']:enabled\n`;\n\n/**\n * @example useArrows(ref, { cycle, selector });\n * @param ref - A reference to the element that will be navigated through. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n */\nconst useArrows = (\n ref: RefObject<HTMLElement>,\n {\n /** If true, the down or up arrow key will navigate to the first or last element if the element currently focused is the last or first index of the selected elements. */\n cycle = true,\n /** A query selector that will determine which elements to cycle through with the arrow keys. The selector will be used in conjunction with [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#selectors). */\n selector = focusable,\n /** Which keys are used to navigate through the list */\n dir = 'up-down',\n allowTabFocus = true\n }: {\n cycle?: boolean;\n selector?: string;\n dir?: 'up-down' | 'left-right';\n allowTabFocus?: boolean;\n } = {},\n /** Pass this prop in the internal dependencies when list is dynamic */\n dependencies: DependencyList = []\n) => {\n const [NextKey, PrevKey] =\n dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];\n\n const setTabIndexes = useCallback(\n (el: HTMLElement) => {\n // don't set tabindex -1 for first element, or an element with a checked input inside of it to be able to focus it\n\n // 0 second timeout added because DOM needs to be up to date after list is updated before running query\n setTimeout(() => {\n const focusableElements = Array.from(el.querySelectorAll(selector));\n\n if (focusableElements.length > 0) {\n if (allowTabFocus) (focusableElements[0] as HTMLElement).tabIndex = 0;\n focusableElements.slice(1).forEach(item => {\n if (item instanceof HTMLElement) {\n const checked = (item as HTMLInputElement).checked;\n if (!checked) item.tabIndex = -1;\n }\n });\n }\n }, 0);\n },\n [selector, ...dependencies]\n );\n\n const listener = useCallback(\n (e: KeyboardEvent) => {\n const el = ref.current;\n if (!el) return;\n if (['Home', 'End', NextKey, PrevKey].includes(e.key)) e.preventDefault();\n\n if (!documentIsAvailable) return;\n\n const items = Array.from(el.querySelectorAll(selector)).filter(\n (item): item is HTMLElement => item instanceof HTMLElement\n );\n\n if (!items.length) return;\n\n const rootNode = el.getRootNode();\n\n if (!(rootNode instanceof Document) && !(rootNode instanceof ShadowRoot)) return;\n\n const focusIdx = items.indexOf(rootNode.activeElement as HTMLElement);\n const lastIdx = items.length - 1;\n let newFocusIdx;\n\n if (e.key === 'Home' || (e.key === NextKey && focusIdx === -1)) {\n newFocusIdx = 0;\n } else if (e.key === 'End' || (e.key === PrevKey && focusIdx === -1)) {\n newFocusIdx = lastIdx;\n } else if (e.key === 'Enter') {\n setTabIndexes(el);\n return;\n } else if (e.key === NextKey) {\n if (focusIdx === lastIdx) {\n if (!cycle) return;\n newFocusIdx = 0;\n } else {\n newFocusIdx = focusIdx + 1;\n }\n } else if (e.key === PrevKey) {\n if (focusIdx === 0) {\n if (!cycle) return;\n newFocusIdx = lastIdx;\n } else {\n newFocusIdx = focusIdx - 1;\n }\n } else {\n return;\n }\n\n items[newFocusIdx].focus();\n },\n [ref.current, cycle, selector, ...dependencies]\n );\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n setTabIndexes(el);\n el.addEventListener('keydown', listener);\n\n return () => {\n el.removeEventListener('keydown', listener);\n };\n }, [ref.current, selector, listener, ...dependencies]);\n};\n\nexport default useArrows;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;AAS1E;;;;;GAKG;AACH,QAAA,MAAM,aAAa,eACL,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;oBAM1B,UAAU,OAAO,CAAC,GAAG,SAAS;;;aAkEjD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useState, useLayoutEffect, useCallback } from 'react';
|
|
2
2
|
import { windowIsAvailable, debounce } from '../utils';
|
|
3
3
|
import useTheme from './useTheme';
|
|
4
|
+
// We should be able to safely capture once as the computed root font size is unlikely to change during normal runtime.
|
|
5
|
+
const rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
|
|
4
6
|
/**
|
|
5
7
|
* @example const breakpointActive = useBreakpoint(breakpoint);
|
|
6
8
|
* @param breakpoint The string indicator for the breakpoint that should be checked for validity.
|
|
@@ -21,8 +23,7 @@ const useBreakpoint = (breakpoint, { breakpointRef, defaultValue = false, themeP
|
|
|
21
23
|
const matchesBreakpoint = entries.some(({ target, contentRect }) => {
|
|
22
24
|
if (target !== breakpointRef.current)
|
|
23
25
|
return;
|
|
24
|
-
|
|
25
|
-
return contentRect.width >= parseFloat(breakpointVal) * parseFloat(fontSize);
|
|
26
|
+
return contentRect.width >= parseFloat(breakpointVal) * parseFloat(rootFontSize);
|
|
26
27
|
});
|
|
27
28
|
setMatches(matchesBreakpoint);
|
|
28
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,QAAQ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H,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useState, useLayoutEffect, useCallback, RefObject } from 'react';\n\nimport { windowIsAvailable, debounce } from '../utils';\n\nimport useTheme from './useTheme';\n\n// We should be able to safely capture once as the computed root font size is unlikely to change during normal runtime.\nconst rootFontSize = window.getComputedStyle(document.documentElement).fontSize;\n\n/**\n * @example const breakpointActive = useBreakpoint(breakpoint);\n * @param breakpoint The string indicator for the breakpoint that should be checked for validity.\n * @param options\n * @returns breakpointActive:: A boolean indicating if the given breakpoint is active or not. If false, the breakpoint is too big for the screen size.\n */\nconst useBreakpoint = (\n breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl',\n {\n breakpointRef,\n defaultValue = false,\n themeProp = 'breakpoints'\n }: {\n breakpointRef?: RefObject<Element> | undefined;\n defaultValue?: boolean;\n themeProp?: 'breakpoints' | 'content-width';\n } = {}\n) => {\n const {\n base: { breakpoints, 'content-width': contentWidth }\n } = useTheme();\n const breakpointVal =\n themeProp === 'content-width' ? contentWidth[breakpoint] : breakpoints[breakpoint];\n\n const [matches, setMatches] = useState(\n windowIsAvailable ? window.matchMedia(`(min-width: ${breakpointVal})`).matches : !!defaultValue\n );\n\n const onResize = useCallback((e: MediaQueryListEvent) => {\n setMatches(e.matches);\n }, []);\n\n useLayoutEffect(() => {\n // Breakpoint handling for contained elements\n if (breakpointRef && breakpointRef.current) {\n const observer = new ResizeObserver(entries => {\n const matchesBreakpoint = entries.some(({ target, contentRect }) => {\n if (target !== breakpointRef.current) return;\n\n return contentRect.width >= parseFloat(breakpointVal) * parseFloat(rootFontSize);\n });\n\n setMatches(matchesBreakpoint);\n });\n\n observer.observe(breakpointRef.current);\n\n return () => {\n observer.disconnect();\n };\n }\n // Breakpoint handling for viewport\n if (windowIsAvailable) {\n const mediaMatch = window.matchMedia(`(min-width: ${breakpointVal})`);\n const mediaMatchAvailable = 'addEventListener' in mediaMatch;\n const resizeHandler = debounce(() => {\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }, 100);\n\n // Need to check useMatchMedia in order to support unit testing\n if (mediaMatchAvailable) {\n mediaMatch.addEventListener('change', onResize);\n setMatches(mediaMatch.matches);\n } else {\n window.addEventListener('resize', resizeHandler);\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }\n\n return () => {\n // Need to check useMatchMedia in order to support unit testing\n if (mediaMatchAvailable) mediaMatch.removeEventListener('change', onResize);\n else {\n window.removeEventListener('resize', resizeHandler);\n }\n };\n }\n }, [breakpointRef?.current]);\n\n return matches;\n};\n\nexport default useBreakpoint;\n"]}
|
package/lib/hooks/useEvent.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DependencyList, RefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
type EventMapForTarget<Target extends EventTarget> = Target extends HTMLElement ? HTMLElementEventMap : Target extends SVGElement ? SVGElementEventMap : Target extends Document ? DocumentEventMap : Target extends Window ? WindowEventMap : {
|
|
3
3
|
[eventType: string]: Event;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type EventNamesForTarget<T extends EventTarget> = keyof EventMapForTarget<T> & string;
|
|
6
6
|
/**
|
|
7
7
|
* @example useEvent('keydown', (event) => { do something });
|
|
8
8
|
* @param cb The function that should be executed on keydown keyevent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAK7D,
|
|
1
|
+
{"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAa,MAAM,OAAO,CAA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