@pega/cosmos-react-core 2.0.0-dev.11.0 → 2.0.0-dev.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +1 -6
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +14 -32
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +3 -2
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +36 -24
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShellList.js +10 -13
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.js +3 -6
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.js +1 -3
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +2 -2
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/Avatar/Avatar.js +3 -4
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +6 -5
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Selection.js +7 -8
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Banner/Banner.js +2 -6
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +1 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -5
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/Button.d.ts +5 -0
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +16 -9
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +2 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js +4 -3
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.d.ts.map +1 -1
- package/lib/components/Card/CardFooter.js +3 -2
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.d.ts.map +1 -1
- package/lib/components/Card/CardHeader.js +5 -5
- package/lib/components/Card/CardHeader.js.map +1 -1
- package/lib/components/Card/CollapsibleCard.js +2 -6
- package/lib/components/Card/CollapsibleCard.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +6 -9
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +14 -20
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +11 -19
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +3 -3
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +8 -10
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +2 -2
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +18 -23
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
- 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 +27 -37
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js +6 -4
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.js +2 -2
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +3 -4
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.js +7 -10
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +9 -13
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +2 -3
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +16 -23
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +16 -20
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js +4 -7
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.js +4 -4
- package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +2 -0
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +38 -10
- 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 +24 -30
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +5 -10
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +5 -10
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +5 -6
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +7 -9
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +5 -5
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js +2 -3
- package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.d.ts +14 -0
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +6 -7
- package/lib/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/components/EmptyState/index.d.ts +4 -0
- package/lib/components/EmptyState/index.d.ts.map +1 -0
- package/lib/components/EmptyState/index.js +3 -0
- package/lib/components/EmptyState/index.js.map +1 -0
- package/lib/components/ErrorState/ErrorState.d.ts +2 -0
- package/lib/components/ErrorState/ErrorState.d.ts.map +1 -1
- package/lib/components/ErrorState/ErrorState.js +3 -3
- package/lib/components/ErrorState/ErrorState.js.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js +4 -4
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +2 -5
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +1 -2
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +2 -4
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.d.ts +4 -1
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +1 -1
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +7 -12
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileItem.js +2 -3
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileUploadItem.js +3 -3
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/File/FileVisual.js +2 -4
- package/lib/components/File/FileVisual.js.map +1 -1
- package/lib/components/File/utils.js +1 -2
- package/lib/components/File/utils.js.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/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.js +1 -3
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +5 -10
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.d.ts +1 -1
- package/lib/components/Grid/Grid.d.ts.map +1 -1
- package/lib/components/Grid/Grid.js +5 -8
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Icon/Icon.js +2 -4
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
- package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
- package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
- package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
- package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
- package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
- package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
- package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
- package/lib/components/Icon/icons/galaxy.icon.js +1 -3
- package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
- package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad.icon.js +1 -5
- package/lib/components/Icon/icons/grad.icon.js.map +1 -1
- package/lib/components/Icon/icons/list-number.icon.js +1 -6
- package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
- package/lib/components/Icon/icons/list.icon.js +1 -6
- package/lib/components/Icon/icons/list.icon.js.map +1 -1
- package/lib/components/Icon/icons/pin.icon.js +1 -2
- package/lib/components/Icon/icons/pin.icon.js.map +1 -1
- package/lib/components/Icon/icons/search-solid.icon.js +1 -2
- package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tracer.icon.js +1 -2
- package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
- package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox.icon.js +1 -3
- package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
- package/lib/components/Input/Input.js +2 -2
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.styles.js +2 -2
- package/lib/components/Input/Input.styles.js.map +1 -1
- package/lib/components/Link/Link.js +5 -8
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +4 -6
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/LocationDisplay.js +2 -3
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.js +8 -9
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.js +8 -13
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/utils.js +11 -15
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +11 -14
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.js +18 -20
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +10 -0
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +198 -3
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +17 -8
- 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/MenuGroup.d.ts +6 -0
- package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
- package/lib/components/Menu/MenuGroup.js +17 -0
- package/lib/components/Menu/MenuGroup.js.map +1 -0
- package/lib/components/Menu/MenuItem.d.ts +0 -3
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +35 -151
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +19 -23
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts +0 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +5 -55
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +2 -3
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +13 -12
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +40 -36
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/Menu/index.d.ts +2 -3
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -2
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +6 -10
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +10 -13
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts +1 -6
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +40 -137
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +9 -0
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
- package/lib/components/Modal/Modal.styles.js +133 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -0
- package/lib/components/Modal/Modal.types.d.ts +19 -4
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Modal/ModalManager.js +12 -21
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +3 -6
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
- package/lib/components/Number/NumberInput.js +13 -19
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/Number/utils.js +2 -3
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +6 -16
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +3 -8
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +2 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +22 -32
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Pagination/Pagination.js +2 -4
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +1 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +12 -10
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.js +2 -3
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Popover/Popover.js +4 -7
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Progress/Bar.js +1 -1
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.js +1 -3
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.js +2 -3
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Ring.js +2 -3
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +6 -7
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +7 -6
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.js +2 -6
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +10 -12
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Select.js +2 -2
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -2
- package/lib/components/Sentiment/Sentiment.js.map +1 -1
- package/lib/components/Slider/Slider.js +7 -13
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +1 -1
- package/lib/components/Slider/Slider.styles.js +1 -1
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/Slider/SliderTicks.js +1 -2
- package/lib/components/Slider/SliderTicks.js.map +1 -1
- package/lib/components/Slider/utils.d.ts +0 -10
- package/lib/components/Slider/utils.d.ts.map +1 -1
- package/lib/components/Slider/utils.js +3 -15
- package/lib/components/Slider/utils.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +1 -4
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts +8 -2
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +9 -10
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +7 -10
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +39 -30
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.js +3 -7
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/Tab.js +3 -6
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +10 -2
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +21 -8
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +7 -8
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.js +3 -3
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Toaster.js +6 -10
- 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 +10 -17
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/StandardTree.styles.d.ts +1 -1
- package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +16 -11
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/components/Tree/Tree.d.ts +6 -0
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/Tree.js +3 -3
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/helpers.js +4 -7
- package/lib/components/Tree/helpers.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.map +1 -1
- package/lib/hooks/useActiveDescendant.js +28 -32
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useBreakpoint.js +2 -4
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useFocusWithin.js +9 -9
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +57 -1
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useLongPress.d.ts +16 -0
- package/lib/hooks/useLongPress.d.ts.map +1 -0
- package/lib/hooks/useLongPress.js +57 -0
- package/lib/hooks/useLongPress.js.map +1 -0
- package/lib/hooks/useOuterEvent.js +1 -1
- package/lib/hooks/useOuterEvent.js.map +1 -1
- package/lib/hooks/useOverride.js +1 -1
- package/lib/hooks/useOverride.js.map +1 -1
- package/lib/hooks/useScrollStick.js +14 -3
- package/lib/hooks/useScrollStick.js.map +1 -1
- package/lib/i18n/default.json +59 -3
- package/lib/i18n/i18n.d.ts +114 -2
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/index.d.ts +1 -0
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +2 -26
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/ThemeMachine.js +7 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/theme/index.js +1 -0
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/theme.d.ts +75 -45
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +50 -30
- package/lib/theme/themeOverrides.schema.json +15 -3
- package/lib/theme/themes/buildTheme.json +2 -39
- package/lib/theme/themes/legacyBuildTheme.json +50 -0
- package/lib/types/types.d.ts +4 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/utils.d.ts +24 -0
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +36 -1
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -10
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
- package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
- package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
- package/lib/components/NoItems/NoItems.d.ts +0 -14
- package/lib/components/NoItems/NoItems.d.ts.map +0 -1
- package/lib/components/NoItems/NoItems.js.map +0 -1
- package/lib/components/NoItems/index.d.ts +0 -4
- package/lib/components/NoItems/index.d.ts.map +0 -1
- package/lib/components/NoItems/index.js +0 -3
- package/lib/components/NoItems/index.js.map +0 -1
|
@@ -4,13 +4,13 @@ import Progress from '../Progress';
|
|
|
4
4
|
import { useI18n } from '../../hooks';
|
|
5
5
|
import Flex from '../Flex';
|
|
6
6
|
import Actions from '../Actions';
|
|
7
|
-
import {
|
|
7
|
+
import { StyledStandardTreeParent, StyledToggleIcon, StyledStandardTreeItemSubTree, StyledStandardTreeLeaf, StyledStandardTree, StyledNodeInteraction, StyledStandardTreeNode, StyledNodeActions, StyledLabelContent, StyledNodeIcon, StyledNodeText } from './StandardTree.styles';
|
|
8
8
|
const StandardTreeContext = createContext({
|
|
9
9
|
currentNodeId: undefined,
|
|
10
10
|
lined: false,
|
|
11
11
|
onNodeClick: () => { }
|
|
12
12
|
});
|
|
13
|
-
const NodeRenderer = ({ id, label, icon, depth, nodes, expanded = false, loading = false, subTree, actions, onClick }) => {
|
|
13
|
+
const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expanded = false, loading = false, subTree, actions, onClick }) => {
|
|
14
14
|
const { currentNodeId, onNodeClick, lined } = useContext(StandardTreeContext);
|
|
15
15
|
const current = currentNodeId === id;
|
|
16
16
|
const t = useI18n();
|
|
@@ -21,9 +21,8 @@ const NodeRenderer = ({ id, label, icon, depth, nodes, expanded = false, loading
|
|
|
21
21
|
return {
|
|
22
22
|
...action,
|
|
23
23
|
onClick: (actionId, e) => {
|
|
24
|
-
var _a;
|
|
25
24
|
e.stopPropagation();
|
|
26
|
-
|
|
25
|
+
action?.onClick?.(actionId, e);
|
|
27
26
|
}
|
|
28
27
|
};
|
|
29
28
|
}), menuAt: 3 }, void 0) }, void 0)) : null;
|
|
@@ -31,22 +30,16 @@ const NodeRenderer = ({ id, label, icon, depth, nodes, expanded = false, loading
|
|
|
31
30
|
const labelContent = useMemo(() => {
|
|
32
31
|
const internal = (
|
|
33
32
|
// Wrapping in a div for handling of flex space-between when there are node actions.
|
|
34
|
-
_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 0.5 }, as: StyledLabelContent }, { children: [icon && _jsx(StyledNodeIcon, { name: icon }, void 0),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} }, { children: [internal,
|
|
40
|
-
actionsJSX] }), void 0)) : (internal);
|
|
33
|
+
_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 0.5 }, as: StyledLabelContent }, { children: [icon && _jsx(StyledNodeIcon, { name: icon }, void 0), _jsx(StyledNodeText, { children: label }, void 0)] }), void 0));
|
|
34
|
+
return !nodes && (onClick ?? onNodeClick) ? (_jsxs(Flex, Object.assign({ container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledNodeInteraction, role: 'treeitem', "aria-current": current ? 'true' : undefined, onClick: (e) => {
|
|
35
|
+
onClick?.(id, e);
|
|
36
|
+
onNodeClick?.(id, e);
|
|
37
|
+
} }, { children: [internal, actionsJSX] }), void 0)) : (internal);
|
|
41
38
|
}, [id, label, icon, nodes, actions, onClick, onNodeClick, current]);
|
|
42
39
|
const handleToggleClick = useCallback((e) => {
|
|
43
|
-
onNodeClick
|
|
40
|
+
onNodeClick?.(id, e);
|
|
44
41
|
}, [id, onNodeClick]);
|
|
45
|
-
return (_jsx(StyledStandardTreeNode, Object.assign({ id: id, style: { '--depth': depth }, "aria-busy": loading }, { children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', justify: 'between', gap: 2 }, as:
|
|
46
|
-
labelContent] }), void 0),
|
|
47
|
-
actionsJSX] }), void 0),
|
|
48
|
-
_jsxs(StyledStandardTreeItemSubTree, Object.assign({ lined: lined }, { children: [subTree,
|
|
49
|
-
loading && _jsx(Progress, { variant: 'ring', placement: 'inline' }, void 0)] }), void 0)] }, void 0)) : (_jsx(StyledStandardTreeLeaf, { children: labelContent }, void 0)) }), void 0));
|
|
42
|
+
return (_jsx(StyledStandardTreeNode, Object.assign({ id: id, style: { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) }, "aria-busy": loading }, { children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledStandardTreeParent, role: 'treeitem', "aria-current": current ? 'true' : undefined, variant: 'text', onClick: handleToggleClick, "aria-expanded": expanded ? 'true' : 'false', "aria-label": t(expanded ? 'collapse_noun' : 'expand_noun', label) }, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 1 }, as: 'span' }, { children: [_jsx(StyledToggleIcon, { name: 'caret-right' }, void 0), labelContent] }), void 0), actionsJSX] }), void 0), _jsxs(StyledStandardTreeItemSubTree, Object.assign({ lined: lined }, { children: [subTree, loading && _jsx(Progress, { variant: 'ring', placement: 'inline' }, void 0)] }), void 0)] }, void 0)) : (_jsx(StyledStandardTreeLeaf, { children: labelContent }, void 0)) }), void 0));
|
|
50
43
|
};
|
|
51
44
|
const StandardTree = forwardRef(({ nodes, currentNodeId, onNodeClick, lined = false, ...restProps }, ref) => {
|
|
52
45
|
return (_jsx(StandardTreeContext.Provider, Object.assign({ value: useMemo(() => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpF,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpF,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACf,MAAM,uBAAuB,CAAC;AAQ/B,MAAM,mBAAmB,GAAG,aAAa,CAEvC;IACA,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAgD,CAAC,EACjE,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,EACP,OAAO,EACP,OAAO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CAAC,OAAO,gBAC9B,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,CAAC,iBAEhE,MAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAC,MAAM,iBAC1D,KAAC,gBAAgB,IAAC,IAAI,EAAC,aAAa,WAAG,EACtC,YAAY,aACR,EACN,UAAU,aACN,EACP,MAAC,6BAA6B,kBAAC,KAAK,EAAE,KAAK,iBACxC,OAAO,EACP,OAAO,IAAI,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,WAAG,aAC5B,YAC/B,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,sBAAsB,cAAE,YAAY,WAA0B,CAChE,YACsB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EACE,KAAK,EACL,aAAa,EACb,WAAW,EACX,KAAK,GAAG,KAAK,EACb,GAAG,SAAS,EACuB,EACrC,GAA6B,EAC7B,EAAE;IACF,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,kBAC3B,KAAK,EAAE,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;YACL,aAAa;YACb,WAAW;YACX,KAAK;SACN,CAAC,EACF,CAAC,aAAa,EAAE,WAAW,EAAE,KAAK,CAAC,CACpC,gBAGD,KAAC,kBAAkB,oBAAK,SAAS,IAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,YAAI,YAC5D,CAChC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, createContext, useMemo, useContext, useCallback } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, CSSProperties, MouseEvent } from 'react';\n\nimport Progress from '../Progress';\nimport { useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\n StyledStandardTreeItemSubTree,\n StyledStandardTreeLeaf,\n StyledStandardTree,\n StyledNodeInteraction,\n StyledStandardTreeNode,\n StyledNodeActions,\n StyledLabelContent,\n StyledNodeIcon,\n StyledNodeText\n} from './StandardTree.styles';\nimport type { TreeProps } from './Tree';\nimport type {\n StandardTreeNode,\n StandardTreeProps,\n StandardTreePropsWithDefaults\n} from './StandardTree.types';\n\nconst StandardTreeContext = createContext<\n Pick<StandardTreePropsWithDefaults, 'currentNodeId' | 'onNodeClick' | 'lined'>\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {}\n});\n\nconst NodeRenderer: TreeProps<StandardTreeNode>['nodeRenderer'] = ({\n id,\n label,\n icon,\n depth,\n hasParentSibling,\n nodes,\n expanded = false,\n loading = false,\n subTree,\n actions,\n onClick\n}) => {\n const { currentNodeId, onNodeClick, lined } = useContext(StandardTreeContext);\n const current = currentNodeId === id;\n const t = useI18n();\n\n const actionsJSX = useMemo(() => {\n return actions ? (\n // Wrapping in a div since Actions may render a frag of buttons and we need a wrapper for flex space-between.\n <StyledNodeActions>\n <Actions\n items={actions.map(action => {\n return {\n ...action,\n onClick: (\n actionId: Action['id'],\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n e.stopPropagation();\n action?.onClick?.(actionId, e);\n }\n };\n })}\n menuAt={3}\n />\n </StyledNodeActions>\n ) : null;\n }, [actions]);\n\n const labelContent = useMemo(() => {\n const internal = (\n // Wrapping in a div for handling of flex space-between when there are node actions.\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledLabelContent}>\n {icon && <StyledNodeIcon name={icon} />}\n <StyledNodeText>{label}</StyledNodeText>\n </Flex>\n );\n\n return !nodes && (onClick ?? onNodeClick) ? (\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledNodeInteraction}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n }}\n >\n {internal}\n {actionsJSX}\n </Flex>\n ) : (\n internal\n );\n }, [id, label, icon, nodes, actions, onClick, onNodeClick, current]);\n\n const handleToggleClick = useCallback(\n (e: MouseEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n },\n [id, onNodeClick]\n );\n\n return (\n <StyledStandardTreeNode\n id={id}\n style={\n { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) } as CSSProperties\n }\n aria-busy={loading}\n >\n {nodes ? (\n <>\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledStandardTreeParent}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n variant='text'\n onClick={handleToggleClick}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-label={t(expanded ? 'collapse_noun' : 'expand_noun', label)}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }} as='span'>\n <StyledToggleIcon name='caret-right' />\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined}>\n {subTree}\n {loading && <Progress variant='ring' placement='inline' />}\n </StyledStandardTreeItemSubTree>\n </>\n ) : (\n <StyledStandardTreeLeaf>{labelContent}</StyledStandardTreeLeaf>\n )}\n </StyledStandardTreeNode>\n );\n};\n\nconst StandardTree: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (\n {\n nodes,\n currentNodeId,\n onNodeClick,\n lined = false,\n ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) => {\n return (\n <StandardTreeContext.Provider\n value={useMemo(\n () => ({\n currentNodeId,\n onNodeClick,\n lined\n }),\n [currentNodeId, onNodeClick, lined]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree {...restProps} ref={ref} nodes={nodes} nodeRenderer={NodeRenderer} />\n </StandardTreeContext.Provider>\n );\n }\n);\n\nexport default StandardTree;\n"]}
|
|
@@ -7,7 +7,7 @@ export declare const StyledNodeText: import("styled-components").StyledComponent
|
|
|
7
7
|
export declare const StyledStandardTreeItemSubTree: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<StandardTreePropsWithDefaults, "lined">, never>;
|
|
8
8
|
export declare const StyledNodeInteraction: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
9
|
export declare const StyledStandardTreeLeaf: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const StyledStandardTreeParent: any;
|
|
11
11
|
export declare const StyledStandardTreeNode: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
12
12
|
export declare const StyledStandardTree: import("styled-components").StyledComponent<(<T extends import("./Tree").TreeNode = import("./Tree").TreeNode>(props: import("./Tree").TreeProps<T> & import("../..").ForwardProps) => JSX.Element | null), import("styled-components").DefaultTheme, {}, never>;
|
|
13
13
|
//# sourceMappingURL=StandardTree.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,eAAO,MAAM,gBAAgB,iMAAiB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAE/C,eAAO,MAAM,cAAc,iMAAiB,CAAC;AAE7C,eAAO,MAAM,cAAc,0GAAgB,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mJAgCxC,CAAC;AAIH,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"StandardTree.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,eAAO,MAAM,gBAAgB,iMAAiB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAE/C,eAAO,MAAM,cAAc,iMAAiB,CAAC;AAE7C,eAAO,MAAM,cAAc,0GAAgB,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mJAgCxC,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGAiChC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAYjC,CAAC;AAKH,eAAO,MAAM,wBAAwB,EAAE,GA2BrC,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAWlC,CAAC;AAIF,eAAO,MAAM,kBAAkB,kQAI9B,CAAC"}
|
|
@@ -37,7 +37,7 @@ export const StyledStandardTreeItemSubTree = styled.div(({ theme, lined }) => {
|
|
|
37
37
|
${StyledProgressRing} {
|
|
38
38
|
margin: calc(${theme.base.spacing} * 1.25) 0;
|
|
39
39
|
margin-inline-start: calc(
|
|
40
|
-
(
|
|
40
|
+
var(--parent-caret-width) * (var(--depth) + 1) + var(--initial-padding)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
@@ -49,10 +49,8 @@ export const StyledNodeInteraction = styled.div(({ theme }) => {
|
|
|
49
49
|
* We should fix Flex/Grid pad arrays to map to logical props...
|
|
50
50
|
*/
|
|
51
51
|
min-height: 2.25rem;
|
|
52
|
-
padding-inline-start: calc(
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
padding-inline-end: calc(${theme.base.spacing} * 1.5);
|
|
52
|
+
padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));
|
|
53
|
+
padding-inline-end: var(--initial-padding);
|
|
56
54
|
cursor: pointer;
|
|
57
55
|
|
|
58
56
|
& > ${StyledNodeActions} {
|
|
@@ -80,18 +78,22 @@ export const StyledNodeInteraction = styled.div(({ theme }) => {
|
|
|
80
78
|
`;
|
|
81
79
|
});
|
|
82
80
|
StyledNodeInteraction.defaultProps = defaultThemeProp;
|
|
83
|
-
export const StyledStandardTreeLeaf = styled.div((
|
|
81
|
+
export const StyledStandardTreeLeaf = styled.div(() => {
|
|
84
82
|
return css `
|
|
85
83
|
${StyledNodeInteraction} {
|
|
84
|
+
/* 1 when not at root and no parent sibling, 0 otherwise. */
|
|
85
|
+
--include-parent-icon-width: min((1 - var(--has-parent-sibling)), var(--depth));
|
|
86
86
|
padding-inline-start: calc(
|
|
87
|
-
|
|
87
|
+
var(--initial-padding) +
|
|
88
|
+
(var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +
|
|
89
|
+
(var(--parent-icon-width) * var(--include-parent-icon-width))
|
|
88
90
|
);
|
|
89
91
|
}
|
|
90
92
|
`;
|
|
91
93
|
});
|
|
92
94
|
StyledStandardTreeLeaf.defaultProps = defaultThemeProp;
|
|
93
95
|
// FIXME: any is used since typeof StyledNodeInteraction not playing nicely.
|
|
94
|
-
export const
|
|
96
|
+
export const StyledStandardTreeParent = styled(StyledNodeInteraction)(({ theme }) => {
|
|
95
97
|
const { ltr } = useDirection();
|
|
96
98
|
return css `
|
|
97
99
|
&[aria-expanded='true'] ${StyledToggleIcon} {
|
|
@@ -113,14 +115,17 @@ export const StyledStandardTreeItemToggle = styled(StyledNodeInteraction)(({ the
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
${StyledToggleIcon} {
|
|
116
|
-
margin-inline-end: calc(${theme.base.spacing} / 2);
|
|
117
118
|
transition: transform calc(${theme.base.animation.speed} / 2)
|
|
118
119
|
${theme.base.animation.timing.ease};
|
|
119
120
|
}
|
|
120
121
|
`;
|
|
121
122
|
});
|
|
122
|
-
|
|
123
|
-
export const StyledStandardTreeNode = styled.div(() => css `
|
|
123
|
+
StyledStandardTreeParent.defaultProps = defaultThemeProp;
|
|
124
|
+
export const StyledStandardTreeNode = styled.div(({ theme }) => css `
|
|
125
|
+
--initial-padding: calc(${theme.base.spacing} * 1.5);
|
|
126
|
+
--parent-caret-width: calc(1em + ${theme.base.spacing});
|
|
127
|
+
--parent-icon-width: calc(1em + ${theme.base.spacing} / 2);
|
|
128
|
+
|
|
124
129
|
${StyledIcon} {
|
|
125
130
|
width: 1em;
|
|
126
131
|
height: 1em;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.styles.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,IAAI,EAAE,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE5C,MAAM,CAAC,MAAM,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BAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { StyledButton } from '../Button';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledProgressRing } from '../Progress';\nimport { defaultThemeProp } from '../../theme';\nimport { useDirection } from '../../hooks';\n\nimport Tree, { StyledTreeListItem } from './Tree';\nimport { StandardTreePropsWithDefaults } from './StandardTree.types';\n\nexport const StyledToggleIcon = styled(Icon)``;\n\nexport const StyledNodeActions = styled.div``;\n\nexport const StyledLabelContent = styled.div``;\n\nexport const StyledNodeIcon = styled(Icon)``;\n\nexport const StyledNodeText = styled.span``;\n\nexport const StyledStandardTreeItemSubTree = styled.div<\n Pick<StandardTreePropsWithDefaults, 'lined'>\n>(({ theme, lined }) => {\n return css`\n position: relative;\n\n ${lined &&\n css`\n ::before {\n content: '';\n display: block;\n position: absolute;\n background-color: currentColor;\n inset-block-start: -${theme.base.spacing};\n inset-block-end: 0;\n inset-inline-start: calc(\n 0.5em * (var(--depth) + 1) + (${theme.base.spacing} * var(--depth) + 0.5em * var(--depth)) +\n ${theme.base.spacing} * 1.5\n );\n width: 0.0625rem;\n opacity: 0.2;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n `}\n\n ${StyledProgressRing} {\n margin: calc(${theme.base.spacing} * 1.25) 0;\n margin-inline-start: calc(\n var(--parent-caret-width) * (var(--depth) + 1) + var(--initial-padding)\n );\n }\n `;\n});\n\nStyledStandardTreeItemSubTree.defaultProps = defaultThemeProp;\n\nexport const StyledNodeInteraction = styled.div(({ theme }) => {\n return css`\n /* Could put on Flex pad prop but, needing logical prop below, maybe makes sense to keep here.\n * We should fix Flex/Grid pad arrays to map to logical props...\n */\n min-height: 2.25rem;\n padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));\n padding-inline-end: var(--initial-padding);\n cursor: pointer;\n\n & > ${StyledNodeActions} {\n display: none;\n ${StyledButton} {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n }\n\n &:hover {\n background-color: ${transparentize(0.9, theme.base.palette['foreground-color'])};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &[aria-current='true'] {\n background-color: ${transparentize(0.95, theme.base.palette['foreground-color'])};\n\n & > ${StyledLabelContent}, & > :first-child > ${StyledLabelContent} {\n color: ${theme.base.palette.interactive};\n }\n }\n `;\n});\n\nStyledNodeInteraction.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeLeaf = styled.div(() => {\n return css`\n ${StyledNodeInteraction} {\n /* 1 when not at root and no parent sibling, 0 otherwise. */\n --include-parent-icon-width: min((1 - var(--has-parent-sibling)), var(--depth));\n padding-inline-start: calc(\n var(--initial-padding) +\n (var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +\n (var(--parent-icon-width) * var(--include-parent-icon-width))\n );\n }\n `;\n});\n\nStyledStandardTreeLeaf.defaultProps = defaultThemeProp;\n\n// FIXME: any is used since typeof StyledNodeInteraction not playing nicely.\nexport const StyledStandardTreeParent: any = styled(StyledNodeInteraction)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n &[aria-expanded='true'] ${StyledToggleIcon} {\n transform: rotate(90deg);\n }\n\n &[aria-expanded='false'] {\n ${StyledToggleIcon} {\n transform: rotate(${ltr ? '0' : '180'}deg);\n }\n\n + ${StyledStandardTreeItemSubTree} {\n display: none;\n }\n }\n\n &:hover + ${StyledStandardTreeItemSubTree}::before {\n opacity: 0.5;\n }\n\n ${StyledToggleIcon} {\n transition: transform calc(${theme.base.animation.speed} / 2)\n ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledStandardTreeParent.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeNode = styled.div(\n ({ theme }) => css`\n --initial-padding: calc(${theme.base.spacing} * 1.5);\n --parent-caret-width: calc(1em + ${theme.base.spacing});\n --parent-icon-width: calc(1em + ${theme.base.spacing} / 2);\n\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `\n);\n\nStyledStandardTreeNode.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTree = styled(Tree)`\n ${StyledTreeListItem} {\n display: block;\n }\n`;\n// FIXME: We need to determine why styled-component types are \"eating\" our types.\n(StyledStandardTree as typeof Tree & { defaultProps: object }).defaultProps = defaultThemeProp;\n"]}
|
|
@@ -25,12 +25,18 @@ export interface TreeProps<T extends TreeNode = TreeNode> extends BaseProps, NoC
|
|
|
25
25
|
nodeRenderer?: ComponentType<{
|
|
26
26
|
depth: number;
|
|
27
27
|
subTree?: ReactNode;
|
|
28
|
+
hasParentSibling: TreeItemProps['hasParentSibling'];
|
|
28
29
|
} & Exclude<T, 'listItemProps'>>;
|
|
29
30
|
/** Ref for the wrapping element. */
|
|
30
31
|
ref?: Ref<HTMLUListElement>;
|
|
31
32
|
}
|
|
32
33
|
export declare const StyledTreeListItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
|
|
33
34
|
export declare const StyledTreeList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
35
|
+
interface TreeItemProps extends TreeNode {
|
|
36
|
+
nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;
|
|
37
|
+
depth: number;
|
|
38
|
+
hasParentSibling: boolean;
|
|
39
|
+
}
|
|
34
40
|
declare const Tree: <T extends TreeNode = TreeNode>(props: TreeProps<T> & ForwardProps) => JSX.Element | null;
|
|
35
41
|
export default Tree;
|
|
36
42
|
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtE,oBAAY,WAAW,CAAC,CAAC,SAAS,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_Fragment, { children: [data,
|
|
19
|
-
subTree] }, void 0));
|
|
18
|
+
return (_jsxs(_Fragment, { children: [data, subTree] }, void 0));
|
|
20
19
|
};
|
|
21
20
|
let TreeList;
|
|
22
21
|
const TreeItem = ({ listItemProps, depth, nodes, nodeRenderer: NodeRenderer, ...restProps }) => {
|
|
23
22
|
return (_jsx(StyledTreeListItem, Object.assign({}, listItemProps, { children: _jsx(NodeRenderer, Object.assign({}, restProps, { depth: depth, nodes: nodes, subTree: nodes && _jsx(TreeList, { depth: depth + 1, nodes: nodes, nodeRenderer: NodeRenderer }, void 0) }), void 0) }), void 0));
|
|
24
23
|
};
|
|
25
24
|
TreeList = forwardRef(({ nodes, depth, nodeRenderer, ...restProps }, ref) => {
|
|
26
|
-
|
|
25
|
+
const hasParentSibling = nodes.some(node => !!node.nodes);
|
|
26
|
+
return nodes.length > 0 ? (_jsx(StyledTreeList, Object.assign({}, restProps, { ref: ref, role: depth === 0 ? 'tree' : 'group' }, { children: nodes.map(node => (_createElement(TreeItem, { ...node, key: node.id, depth: depth, nodeRenderer: nodeRenderer, hasParentSibling: hasParentSibling }))) }), void 0)) : null;
|
|
27
27
|
});
|
|
28
28
|
const Tree = forwardRef(({ nodeRenderer = DefaultNodeRenderer, ...restProps }, ref) => {
|
|
29
29
|
return _jsx(TreeList, Object.assign({}, restProps, { ref: ref, depth: 0, nodeRenderer: nodeRenderer }), void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,OAAO,CAAC;AACnF,OAAO,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/components/Tree/Tree.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,OAAO,CAAC;AACnF,OAAO,MAAM,MAAM,mBAAm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1E,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,eAAC,QAAQ,OACH,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC,YACa,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC;AAEF,MAAM,IAAI,GAAG,UAAU,CACrB,CACE,EAAE,YAAY,GAAG,mBAAmB,EAAE,GAAG,SAAS,EAA8B,EAChF,GAAqB,EACrB,EAAE;IACF,OAAO,KAAC,QAAQ,oBAAK,SAAS,IAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,YAAI,CAAC;AACrF,CAAC,CAC2F,CAAC;AAE/F,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ComponentType, ReactNode } from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, NoChildrenProp, ForwardProps } from '../../types';\n\nexport type OldTreeNode<T extends object = Record<string, unknown>> = {\n /** The id of the Node. Used as the key for the li element wrapping the Node. */\n id: string;\n /** Child nodes. */\n nodes?: OldTreeNode<T>[];\n /** Props to apply to the li. */\n listItemProps?: ForwardProps;\n\n [key: string]: unknown;\n} & T;\n\nexport type TreeNode = {\n /** The id of the Node. Used as the key for the li element wrapping the Node. */\n id: string;\n /** Child nodes. */\n nodes?: TreeNode[];\n /** Props to apply to the li. */\n listItemProps?: ForwardProps;\n\n [key: string]: unknown;\n};\n\nexport interface TreeProps<T extends TreeNode = TreeNode> extends BaseProps, NoChildrenProp {\n /** An array of ParentNodes and Nodes that compose the layout of the Tree. */\n nodes: T[];\n /** A function that allows custom styling and behavior for all Nodes. */\n nodeRenderer?: ComponentType<\n {\n depth: number;\n subTree?: ReactNode;\n hasParentSibling: TreeItemProps['hasParentSibling'];\n } & Exclude<T, 'listItemProps'>\n >;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledTreeListItem = styled.li``;\n\nexport const StyledTreeList = styled.ul`\n &,\n & & {\n list-style: none;\n position: relative;\n }\n\n ${StyledTreeListItem} {\n position: relative;\n }\n`;\n\nconst DefaultNodeRenderer: TreeProps['nodeRenderer'] = ({ data, subTree }) => {\n return (\n <>\n {data}\n {subTree}\n </>\n );\n};\n\ninterface TreeItemProps extends TreeNode {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n hasParentSibling: boolean;\n}\n\ninterface TreeListProps extends Pick<TreeProps, 'nodes' | 'ref'> {\n nodeRenderer: NonNullable<TreeProps['nodeRenderer']>;\n depth: number;\n}\n\nlet TreeList: ComponentType<TreeListProps>;\n\nconst TreeItem = ({\n listItemProps,\n depth,\n nodes,\n nodeRenderer: NodeRenderer,\n ...restProps\n}: TreeItemProps) => {\n return (\n <StyledTreeListItem {...listItemProps}>\n <NodeRenderer\n {...restProps}\n depth={depth}\n nodes={nodes}\n subTree={nodes && <TreeList depth={depth + 1} nodes={nodes} nodeRenderer={NodeRenderer} />}\n />\n </StyledTreeListItem>\n );\n};\n\nTreeList = forwardRef(\n (\n { nodes, depth, nodeRenderer, ...restProps }: PropsWithoutRef<TreeListProps>,\n ref?: TreeProps['ref']\n ) => {\n const hasParentSibling = nodes.some(node => !!node.nodes);\n return nodes.length > 0 ? (\n <StyledTreeList {...restProps} ref={ref} role={depth === 0 ? 'tree' : 'group'}>\n {nodes.map(node => (\n <TreeItem\n {...node}\n key={node.id}\n depth={depth}\n nodeRenderer={nodeRenderer}\n hasParentSibling={hasParentSibling}\n />\n ))}\n </StyledTreeList>\n ) : null;\n }\n);\n\nconst Tree = forwardRef(\n (\n { nodeRenderer = DefaultNodeRenderer, ...restProps }: PropsWithoutRef<TreeProps>,\n ref: TreeProps['ref']\n ) => {\n return <TreeList {...restProps} ref={ref} depth={0} nodeRenderer={nodeRenderer} />;\n }\n) as <T extends TreeNode = TreeNode>(props: TreeProps<T> & ForwardProps) => JSX.Element | null;\n\nexport default Tree;\n"]}
|
|
@@ -55,13 +55,10 @@ const helpers = {
|
|
|
55
55
|
},
|
|
56
56
|
appendTo(nodes, id, newNodes) {
|
|
57
57
|
if (id) {
|
|
58
|
-
return this.mapNode(nodes, id, node => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
nodes: [...((_a = node.nodes) !== null && _a !== void 0 ? _a : []), ...newNodes]
|
|
63
|
-
});
|
|
64
|
-
});
|
|
58
|
+
return this.mapNode(nodes, id, node => ({
|
|
59
|
+
...node,
|
|
60
|
+
nodes: [...(node.nodes ?? []), ...newNodes]
|
|
61
|
+
}));
|
|
65
62
|
}
|
|
66
63
|
return [...nodes, ...newNodes];
|
|
67
64
|
}
|
|
@@ -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,OAAO,CACL,KAAW,EACX,EAAgD;QAEhD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACtC,IA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AI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gBACtC,GAAG,IAAI;gBACP,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC;aAC5C,CAAC,CAAC,CAAC;SACL;QAED,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;IACjC,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 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\nexport default helpers;\n"]}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ export { default as useItemIntersection } from './useItemIntersection';
|
|
|
18
18
|
export { default as useUID } from './useUID';
|
|
19
19
|
export { default as useDirection } from './useDirection';
|
|
20
20
|
export { default as useActiveDescendant } from './useActiveDescendant';
|
|
21
|
+
export { default as useLongPress } from './useLongPress';
|
|
21
22
|
export { UseActiveDescendantConfig } from './useActiveDescendant';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
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,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,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,O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AAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,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,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,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -18,4 +18,5 @@ export { default as useItemIntersection } from './useItemIntersection';
|
|
|
18
18
|
export { default as useUID } from './useUID';
|
|
19
19
|
export { default as useDirection } from './useDirection';
|
|
20
20
|
export { default as useActiveDescendant } from './useActiveDescendant';
|
|
21
|
+
export { default as useLongPress } from './useLongPress';
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
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,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,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,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,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,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { 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 useElement } from './useElement';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\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 useTheme } from './useTheme';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useUID } from './useUID';\nexport { default as useDirection } from './useDirection';\nexport { default as useActiveDescendant } from './useActiveDescendant';\nexport { UseActiveDescendantConfig } from './useActiveDescendant';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,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,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,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,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,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { 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 useElement } from './useElement';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\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 useTheme } from './useTheme';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useUID } from './useUID';\nexport { default as useDirection } from './useDirection';\nexport { default as useActiveDescendant } from './useActiveDescendant';\nexport { default as useLongPress } from './useLongPress';\nexport { UseActiveDescendantConfig } from './useActiveDescendant';\n"]}
|
|
@@ -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;AAIjF,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,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;;;;;OAKG;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,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AC;CACrC;AAED,aAAK,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAAC;AACjD,aAAK,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;AAExC,QAAA,MAAM,mBAAmB,6NAepB,yBAAyB;sBAGV,iBAAiB;iBACtB,WAAW;CAsNzB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -7,7 +7,7 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
7
7
|
const [currentIndex, setCurrentIndex] = useState(null);
|
|
8
8
|
const [descendants, setDescendants] = useState();
|
|
9
9
|
const clearThenSetDescendants = useCallback((setVal) => {
|
|
10
|
-
descendants
|
|
10
|
+
descendants?.forEach(node => {
|
|
11
11
|
node.setAttribute('data-current', 'false');
|
|
12
12
|
});
|
|
13
13
|
setDescendants(setVal
|
|
@@ -51,22 +51,21 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
51
51
|
ownedIds.push(node.id);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
focusEl
|
|
54
|
+
focusEl?.setAttribute('aria-owns', ownedIds.join(' '));
|
|
55
55
|
return () => {
|
|
56
|
-
focusEl
|
|
56
|
+
focusEl?.removeAttribute('aria-owns');
|
|
57
57
|
};
|
|
58
58
|
}, [focusEl, descendants]);
|
|
59
59
|
// ## Bind focus el keyDown
|
|
60
60
|
useEffect(() => {
|
|
61
61
|
const onKeyDown = (e) => {
|
|
62
|
-
var _a;
|
|
63
62
|
if (descendants && descendants.length) {
|
|
64
63
|
switch (e.key) {
|
|
65
64
|
case 'ArrowDown':
|
|
66
65
|
e.preventDefault();
|
|
67
66
|
// Focus next or first
|
|
68
|
-
clearFocusReturn
|
|
69
|
-
clearPreventScroll
|
|
67
|
+
clearFocusReturn?.();
|
|
68
|
+
clearPreventScroll?.();
|
|
70
69
|
if (currentIndex !== null && currentIndex + 1 < descendants.length) {
|
|
71
70
|
setCurrentIndex(currentIndex + 1);
|
|
72
71
|
}
|
|
@@ -77,8 +76,8 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
77
76
|
case 'ArrowUp':
|
|
78
77
|
e.preventDefault();
|
|
79
78
|
// Focus previous or last
|
|
80
|
-
clearFocusReturn
|
|
81
|
-
clearPreventScroll
|
|
79
|
+
clearFocusReturn?.();
|
|
80
|
+
clearPreventScroll?.();
|
|
82
81
|
if (currentIndex !== null && currentIndex - 1 > -1) {
|
|
83
82
|
setCurrentIndex(currentIndex - 1);
|
|
84
83
|
}
|
|
@@ -88,19 +87,17 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
88
87
|
break;
|
|
89
88
|
case 'Enter':
|
|
90
89
|
// Click focused item
|
|
91
|
-
if (descendants && descendants.length) {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(_a = descendants[currentIndex].querySelector('button, a, input')) === null || _a === void 0 ? void 0 : _a.click();
|
|
103
|
-
}
|
|
90
|
+
if (descendants && descendants.length && currentIndex !== null) {
|
|
91
|
+
if (onClick) {
|
|
92
|
+
onClick(descendants[currentIndex]);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const nodeName = descendants[currentIndex].nodeName.toLowerCase();
|
|
96
|
+
if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {
|
|
97
|
+
descendants[currentIndex].click();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
descendants[currentIndex].querySelector('button, a, input')?.click();
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
break;
|
|
@@ -110,11 +107,11 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
109
|
// Do not rebind once / if `currentDescendantId` control is defined
|
|
113
|
-
if (focusEl &&
|
|
110
|
+
if (focusEl && descendants?.length && !currentDescendantId) {
|
|
114
111
|
focusEl.addEventListener('keydown', onKeyDown);
|
|
115
112
|
}
|
|
116
113
|
return () => {
|
|
117
|
-
focusEl
|
|
114
|
+
focusEl?.removeEventListener('keydown', onKeyDown);
|
|
118
115
|
};
|
|
119
116
|
}, [focusEl, currentIndex, descendants]);
|
|
120
117
|
// ## Handle independent control update
|
|
@@ -129,11 +126,10 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
129
126
|
}, [currentDescendantId, descendants]);
|
|
130
127
|
// ## Set and scroll to current descendant
|
|
131
128
|
useEffect(() => {
|
|
132
|
-
var _a;
|
|
133
129
|
const nextIndex = focusDescendantElIndex || currentIndex;
|
|
134
|
-
const focusReturnId = focusReturnEl
|
|
130
|
+
const focusReturnId = focusReturnEl?.id;
|
|
135
131
|
let focusReturnIndex;
|
|
136
|
-
const focusDescendantElId = focusDescendantEl
|
|
132
|
+
const focusDescendantElId = focusDescendantEl?.id;
|
|
137
133
|
let focusDescendantIndex;
|
|
138
134
|
let foundFocusDescendantEl = false;
|
|
139
135
|
if (descendants && descendants.length) {
|
|
@@ -152,7 +148,7 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
152
148
|
// early return for focusReturn / focusDescendantEl
|
|
153
149
|
if (focusReturnIndex && focusReturnIndex !== currentIndex) {
|
|
154
150
|
setCurrentIndex(focusReturnIndex);
|
|
155
|
-
clearFocusReturn
|
|
151
|
+
clearFocusReturn?.();
|
|
156
152
|
return;
|
|
157
153
|
}
|
|
158
154
|
if (foundFocusDescendantEl && focusDescendantIndex !== undefined) {
|
|
@@ -165,22 +161,22 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
165
161
|
if (nextIndex !== null && descendants[nextIndex]) {
|
|
166
162
|
const itemEl = descendants[nextIndex];
|
|
167
163
|
itemEl.setAttribute('data-current', 'true');
|
|
168
|
-
focusEl
|
|
164
|
+
focusEl?.setAttribute('aria-activedescendant', itemEl.id);
|
|
169
165
|
// scroll to element
|
|
170
166
|
if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {
|
|
171
|
-
const scrollTo =
|
|
172
|
-
scrollTo
|
|
167
|
+
const scrollTo = Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;
|
|
168
|
+
scrollTo?.call(itemEl, false);
|
|
173
169
|
}
|
|
174
170
|
// focusDescendantEl cleanup
|
|
175
171
|
if (focusDescendantElIndex !== null) {
|
|
176
172
|
setFocusDescendantElIndex(null);
|
|
177
|
-
clearFocusDescendant
|
|
173
|
+
clearFocusDescendant?.();
|
|
178
174
|
}
|
|
179
175
|
previousActiveId.current = itemEl.id;
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
178
|
return () => {
|
|
183
|
-
focusEl
|
|
179
|
+
focusEl?.removeAttribute('aria-activedescendant');
|
|
184
180
|
};
|
|
185
181
|
}, [descendants, currentIndex, focusDescendantEl, focusEl, resetId]);
|
|
186
182
|
return {
|