@itwin/itwinui-react 3.0.0-dev.0 → 3.0.0-dev.2
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/CHANGELOG.md +38 -0
- package/README.md +28 -22
- package/cjs/core/Alert/Alert.d.ts +47 -29
- package/cjs/core/Alert/Alert.js +73 -22
- package/cjs/core/Avatar/Avatar.d.ts +0 -1
- package/cjs/core/Avatar/Avatar.js +1 -2
- package/cjs/core/AvatarGroup/AvatarGroup.d.ts +0 -1
- package/cjs/core/AvatarGroup/AvatarGroup.js +1 -2
- package/cjs/core/Backdrop/Backdrop.d.ts +0 -1
- package/cjs/core/Backdrop/Backdrop.js +0 -1
- package/cjs/core/Badge/Badge.d.ts +0 -1
- package/cjs/core/Badge/Badge.js +0 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +0 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -4
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -5
- package/cjs/core/Buttons/Button/Button.d.ts +0 -1
- package/cjs/core/Buttons/Button/Button.js +0 -1
- package/cjs/core/Buttons/DropdownButton/DropdownButton.d.ts +0 -1
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -6
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +0 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +0 -2
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +0 -1
- package/cjs/core/Buttons/SplitButton/SplitButton.js +0 -1
- package/cjs/core/Carousel/Carousel.d.ts +2 -3
- package/cjs/core/Carousel/Carousel.js +3 -6
- package/cjs/core/Carousel/CarouselDotsList.d.ts +0 -1
- package/cjs/core/Carousel/CarouselDotsList.js +8 -11
- package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/cjs/core/Carousel/CarouselNavigation.js +3 -5
- package/cjs/core/Carousel/CarouselSlider.js +10 -15
- package/cjs/core/Checkbox/Checkbox.d.ts +0 -1
- package/cjs/core/Checkbox/Checkbox.js +0 -1
- package/cjs/core/ColorPicker/ColorBuilder.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +7 -11
- package/cjs/core/ColorPicker/ColorInputPanel.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +12 -16
- package/cjs/core/ColorPicker/ColorPalette.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorPalette.js +4 -7
- package/cjs/core/ColorPicker/ColorPicker.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorPicker.js +3 -4
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +0 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +0 -1
- package/cjs/core/ComboBox/ComboBox.js +25 -33
- package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
- package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/cjs/core/ComboBox/helpers.js +4 -5
- package/cjs/core/DatePicker/DatePicker.d.ts +0 -1
- package/cjs/core/DatePicker/DatePicker.js +32 -33
- package/cjs/core/Dialog/Dialog.d.ts +0 -1
- package/cjs/core/Dialog/Dialog.js +12 -5
- package/cjs/core/Dialog/DialogBackdrop.js +1 -1
- package/cjs/core/Dialog/DialogButtonBar.d.ts +0 -1
- package/cjs/core/Dialog/DialogButtonBar.js +0 -1
- package/cjs/core/Dialog/DialogContent.d.ts +0 -1
- package/cjs/core/Dialog/DialogContent.js +0 -1
- package/cjs/core/Dialog/DialogContext.d.ts +15 -0
- package/cjs/core/Dialog/DialogMain.d.ts +0 -1
- package/cjs/core/Dialog/DialogMain.js +18 -25
- package/cjs/core/Dialog/DialogTitleBar.d.ts +0 -1
- package/cjs/core/Dialog/DialogTitleBar.js +0 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +0 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.js +0 -1
- package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +5 -1
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +8 -6
- package/cjs/core/Fieldset/Fieldset.d.ts +0 -1
- package/cjs/core/Fieldset/Fieldset.js +0 -1
- package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
- package/cjs/core/FileUpload/FileUpload.d.ts +0 -1
- package/cjs/core/FileUpload/FileUpload.js +3 -7
- package/cjs/core/FileUpload/FileUploadCard.d.ts +0 -1
- package/cjs/core/FileUpload/FileUploadCard.js +10 -12
- package/cjs/core/FileUpload/FileUploadTemplate.d.ts +0 -1
- package/cjs/core/FileUpload/FileUploadTemplate.js +0 -1
- package/cjs/core/Footer/Footer.d.ts +0 -1
- package/cjs/core/Footer/Footer.js +0 -1
- package/cjs/core/Footer/FooterItem.d.ts +0 -1
- package/cjs/core/Footer/FooterItem.js +0 -1
- package/cjs/core/Footer/FooterList.d.ts +0 -1
- package/cjs/core/Footer/FooterList.js +0 -1
- package/cjs/core/Footer/FooterSeparator.d.ts +0 -1
- package/cjs/core/Footer/FooterSeparator.js +0 -1
- package/cjs/core/Header/Header.d.ts +0 -1
- package/cjs/core/Header/Header.js +0 -1
- package/cjs/core/Header/HeaderBreadcrumbs.d.ts +0 -1
- package/cjs/core/Header/HeaderBreadcrumbs.js +0 -1
- package/cjs/core/Header/HeaderButton.d.ts +0 -1
- package/cjs/core/Header/HeaderButton.js +0 -1
- package/cjs/core/Header/HeaderLogo.d.ts +0 -1
- package/cjs/core/Header/HeaderLogo.js +0 -1
- package/cjs/core/InformationPanel/InformationPanel.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanel.js +1 -5
- package/cjs/core/InformationPanel/InformationPanelBody.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelBody.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelContent.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelContent.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelWrapper.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelWrapper.js +0 -1
- package/cjs/core/Input/Input.d.ts +0 -1
- package/cjs/core/Input/Input.js +0 -1
- package/cjs/core/InputGroup/InputGroup.d.ts +0 -1
- package/cjs/core/InputGroup/InputGroup.js +0 -1
- package/cjs/core/Label/Label.d.ts +0 -1
- package/cjs/core/Label/Label.js +0 -1
- package/cjs/core/LabeledInput/LabeledInput.d.ts +0 -1
- package/cjs/core/LabeledInput/LabeledInput.js +1 -2
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +0 -1
- package/cjs/core/LabeledSelect/LabeledSelect.js +0 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +0 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -2
- package/cjs/core/List/List.d.ts +0 -1
- package/cjs/core/List/List.js +0 -1
- package/cjs/core/List/ListItem.d.ts +0 -1
- package/cjs/core/List/ListItem.js +0 -1
- package/cjs/core/Menu/Menu.d.ts +0 -1
- package/cjs/core/Menu/Menu.js +3 -5
- package/cjs/core/Menu/MenuDivider.d.ts +0 -1
- package/cjs/core/Menu/MenuDivider.js +0 -1
- package/cjs/core/Menu/MenuExtraContent.d.ts +0 -1
- package/cjs/core/Menu/MenuExtraContent.js +0 -1
- package/cjs/core/Menu/MenuItem.d.ts +0 -1
- package/cjs/core/Menu/MenuItem.js +8 -12
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +0 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/Modal/Modal.d.ts +8 -10
- package/cjs/core/Modal/Modal.js +7 -18
- package/cjs/core/NonIdealState/NonIdealState.d.ts +0 -1
- package/cjs/core/NonIdealState/NonIdealState.js +0 -1
- package/cjs/core/NotificationMarker/NotificationMarker.d.ts +0 -1
- package/cjs/core/NotificationMarker/NotificationMarker.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.d.ts +0 -1
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +0 -1
- package/cjs/core/Radio/Radio.d.ts +0 -1
- package/cjs/core/Radio/Radio.js +0 -1
- package/cjs/core/RadioTiles/RadioTile.d.ts +0 -1
- package/cjs/core/RadioTiles/RadioTile.js +0 -1
- package/cjs/core/RadioTiles/RadioTileGroup.d.ts +0 -1
- package/cjs/core/RadioTiles/RadioTileGroup.js +0 -1
- package/cjs/core/SearchBox/SearchBox.d.ts +0 -1
- package/cjs/core/SearchBox/SearchBox.js +12 -13
- package/cjs/core/Select/Select.d.ts +0 -1
- package/cjs/core/Select/Select.js +12 -18
- package/cjs/core/Select/SelectTag.d.ts +0 -1
- package/cjs/core/Select/SelectTag.js +0 -1
- package/cjs/core/SideNavigation/SideNavigation.d.ts +0 -1
- package/cjs/core/SideNavigation/SideNavigation.js +2 -3
- package/cjs/core/SideNavigation/SidenavButton.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavButton.js +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenu.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenu.js +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.js +0 -1
- package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +0 -1
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +0 -1
- package/cjs/core/Slider/Slider.d.ts +0 -1
- package/cjs/core/Slider/Slider.js +16 -20
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/Slider/Track.js +2 -1
- package/cjs/core/StatusMessage/StatusMessage.js +1 -1
- package/cjs/core/Stepper/Stepper.d.ts +0 -1
- package/cjs/core/Stepper/Stepper.js +1 -2
- package/cjs/core/Stepper/StepperStep.js +1 -1
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +0 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +0 -1
- package/cjs/core/Surface/Surface.d.ts +0 -1
- package/cjs/core/Surface/Surface.js +0 -1
- package/cjs/core/Table/Table.d.ts +0 -1
- package/cjs/core/Table/Table.js +33 -34
- package/cjs/core/Table/TableCell.js +3 -2
- package/cjs/core/Table/TablePaginator.d.ts +0 -1
- package/cjs/core/Table/TablePaginator.js +10 -12
- package/cjs/core/Table/TableRowMemoized.js +40 -47
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
- package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
- package/cjs/core/Table/cells/DefaultCell.js +4 -3
- package/cjs/core/Table/cells/EditableCell.js +7 -13
- package/cjs/core/Table/columns/actionColumn.js +3 -6
- package/cjs/core/Table/columns/expanderColumn.js +3 -3
- package/cjs/core/Table/columns/selectionColumn.js +4 -4
- package/cjs/core/Table/filters/BaseFilter.d.ts +0 -1
- package/cjs/core/Table/filters/BaseFilter.js +1 -2
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +0 -1
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -4
- package/cjs/core/Table/filters/FilterButtonBar.d.ts +0 -1
- package/cjs/core/Table/filters/FilterButtonBar.js +1 -2
- package/cjs/core/Table/filters/FilterToggle.d.ts +0 -1
- package/cjs/core/Table/filters/FilterToggle.js +0 -1
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.d.ts +0 -1
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -4
- package/cjs/core/Table/filters/TextFilter/TextFilter.d.ts +0 -1
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -3
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +8 -4
- package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
- package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
- package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
- package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/cjs/core/Tabs/Tab.d.ts +0 -1
- package/cjs/core/Tabs/Tab.js +0 -1
- package/cjs/core/Tabs/Tabs.d.ts +0 -1
- package/cjs/core/Tabs/Tabs.js +16 -19
- package/cjs/core/Tag/Tag.d.ts +0 -1
- package/cjs/core/Tag/Tag.js +0 -1
- package/cjs/core/Tag/TagContainer.d.ts +0 -1
- package/cjs/core/Tag/TagContainer.js +0 -1
- package/cjs/core/Textarea/Textarea.d.ts +0 -1
- package/cjs/core/Textarea/Textarea.js +0 -1
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -5
- package/cjs/core/ThemeProvider/ThemeProvider.js +11 -15
- package/cjs/core/Tile/Tile.d.ts +0 -1
- package/cjs/core/Tile/Tile.js +3 -7
- package/cjs/core/TimePicker/TimePicker.d.ts +0 -1
- package/cjs/core/TimePicker/TimePicker.js +13 -14
- package/cjs/core/Toast/Toast.d.ts +0 -1
- package/cjs/core/Toast/Toast.js +2 -4
- package/cjs/core/Toast/ToastWrapper.d.ts +0 -1
- package/cjs/core/Toast/ToastWrapper.js +0 -1
- package/cjs/core/Toast/Toaster.js +6 -11
- package/cjs/core/ToggleSwitch/ToggleSwitch.d.ts +0 -1
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +1 -3
- package/cjs/core/Tooltip/Tooltip.d.ts +0 -1
- package/cjs/core/Tooltip/Tooltip.js +0 -1
- package/cjs/core/TransferList/TransferList.d.ts +69 -0
- package/cjs/core/TransferList/TransferList.js +147 -0
- package/cjs/core/TransferList/index.d.ts +3 -0
- package/cjs/core/TransferList/index.js +10 -0
- package/cjs/core/Tree/Tree.d.ts +0 -1
- package/cjs/core/Tree/Tree.js +9 -14
- package/cjs/core/Tree/TreeNode.d.ts +0 -1
- package/cjs/core/Tree/TreeNode.js +9 -11
- package/cjs/core/Tree/TreeNodeExpander.d.ts +0 -1
- package/cjs/core/Tree/TreeNodeExpander.js +0 -1
- package/cjs/core/Typography/Anchor/Anchor.d.ts +0 -1
- package/cjs/core/Typography/Anchor/Anchor.js +0 -1
- package/cjs/core/Typography/Blockquote/Blockquote.d.ts +0 -1
- package/cjs/core/Typography/Blockquote/Blockquote.js +0 -1
- package/cjs/core/Typography/Code/Code.d.ts +0 -1
- package/cjs/core/Typography/Code/Code.js +0 -1
- package/cjs/core/Typography/Kbd/Kbd.d.ts +0 -1
- package/cjs/core/Typography/Kbd/Kbd.js +0 -1
- package/cjs/core/Typography/Text/Text.d.ts +0 -1
- package/cjs/core/Typography/Text/Text.js +0 -1
- package/cjs/core/index.d.ts +1 -0
- package/cjs/core/index.js +118 -116
- package/cjs/core/utils/color/ColorValue.js +9 -15
- package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/cjs/core/utils/components/Divider.d.ts +0 -1
- package/cjs/core/utils/components/Divider.js +0 -1
- package/cjs/core/utils/components/Flex.d.ts +0 -1
- package/cjs/core/utils/components/Flex.js +0 -1
- package/cjs/core/utils/components/FocusTrap.js +4 -4
- package/cjs/core/utils/components/Icon.d.ts +0 -1
- package/cjs/core/utils/components/Icon.js +0 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +0 -1
- package/cjs/core/utils/components/InputFlexContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputFlexContainer.js +0 -1
- package/cjs/core/utils/components/LinkAction.d.ts +0 -1
- package/cjs/core/utils/components/LinkAction.js +0 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
- package/cjs/core/utils/components/Popover.d.ts +0 -1
- package/cjs/core/utils/components/Popover.js +5 -9
- package/cjs/core/utils/components/Resizer.js +7 -6
- package/cjs/core/utils/components/VirtualScroll.js +14 -21
- package/cjs/core/utils/components/VisuallyHidden.d.ts +0 -1
- package/cjs/core/utils/components/VisuallyHidden.js +0 -1
- package/cjs/core/utils/functions/dom.d.ts +6 -0
- package/cjs/core/utils/functions/dom.js +24 -6
- package/cjs/core/utils/functions/index.d.ts +0 -1
- package/cjs/core/utils/functions/index.js +0 -1
- package/cjs/core/utils/functions/polymorphic.js +9 -1
- package/cjs/core/utils/functions/supports.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +0 -1
- package/cjs/core/utils/hooks/index.js +0 -1
- package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
- package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
- package/cjs/core/utils/hooks/useEventListener.js +1 -1
- package/cjs/core/utils/hooks/useGlobals.d.ts +9 -4
- package/cjs/core/utils/hooks/useGlobals.js +6 -6
- package/cjs/core/utils/hooks/useId.js +1 -2
- package/cjs/core/utils/hooks/useIntersection.js +2 -3
- package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
- package/cjs/core/utils/hooks/useOverflow.js +1 -2
- package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
- package/cjs/styles.d.ts +5 -0
- package/cjs/styles.js +450 -0
- package/esm/core/Alert/Alert.d.ts +47 -29
- package/esm/core/Alert/Alert.js +74 -23
- package/esm/core/Avatar/Avatar.d.ts +0 -1
- package/esm/core/Avatar/Avatar.js +1 -2
- package/esm/core/AvatarGroup/AvatarGroup.d.ts +0 -1
- package/esm/core/AvatarGroup/AvatarGroup.js +1 -2
- package/esm/core/Backdrop/Backdrop.d.ts +0 -1
- package/esm/core/Backdrop/Backdrop.js +0 -1
- package/esm/core/Badge/Badge.d.ts +0 -1
- package/esm/core/Badge/Badge.js +0 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +0 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -4
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -5
- package/esm/core/Buttons/Button/Button.d.ts +0 -1
- package/esm/core/Buttons/Button/Button.js +0 -1
- package/esm/core/Buttons/DropdownButton/DropdownButton.d.ts +0 -1
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -6
- package/esm/core/Buttons/IconButton/IconButton.d.ts +0 -2
- package/esm/core/Buttons/IconButton/IconButton.js +0 -2
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +0 -1
- package/esm/core/Buttons/SplitButton/SplitButton.js +0 -1
- package/esm/core/Carousel/Carousel.d.ts +2 -3
- package/esm/core/Carousel/Carousel.js +3 -6
- package/esm/core/Carousel/CarouselDotsList.d.ts +0 -1
- package/esm/core/Carousel/CarouselDotsList.js +8 -11
- package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/esm/core/Carousel/CarouselNavigation.js +3 -5
- package/esm/core/Carousel/CarouselSlider.js +10 -15
- package/esm/core/Checkbox/Checkbox.d.ts +0 -1
- package/esm/core/Checkbox/Checkbox.js +0 -1
- package/esm/core/ColorPicker/ColorBuilder.d.ts +0 -1
- package/esm/core/ColorPicker/ColorBuilder.js +7 -11
- package/esm/core/ColorPicker/ColorInputPanel.d.ts +0 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +12 -16
- package/esm/core/ColorPicker/ColorPalette.d.ts +0 -1
- package/esm/core/ColorPicker/ColorPalette.js +4 -7
- package/esm/core/ColorPicker/ColorPicker.d.ts +0 -1
- package/esm/core/ColorPicker/ColorPicker.js +3 -4
- package/esm/core/ColorPicker/ColorSwatch.d.ts +0 -1
- package/esm/core/ColorPicker/ColorSwatch.js +0 -1
- package/esm/core/ComboBox/ComboBox.d.ts +0 -1
- package/esm/core/ComboBox/ComboBox.js +25 -33
- package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/esm/core/ComboBox/ComboBoxInput.js +21 -20
- package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
- package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/esm/core/ComboBox/helpers.js +4 -5
- package/esm/core/DatePicker/DatePicker.d.ts +0 -1
- package/esm/core/DatePicker/DatePicker.js +32 -33
- package/esm/core/Dialog/Dialog.d.ts +0 -1
- package/esm/core/Dialog/Dialog.js +13 -6
- package/esm/core/Dialog/DialogBackdrop.js +1 -1
- package/esm/core/Dialog/DialogButtonBar.d.ts +0 -1
- package/esm/core/Dialog/DialogButtonBar.js +0 -1
- package/esm/core/Dialog/DialogContent.d.ts +0 -1
- package/esm/core/Dialog/DialogContent.js +0 -1
- package/esm/core/Dialog/DialogContext.d.ts +15 -0
- package/esm/core/Dialog/DialogMain.d.ts +0 -1
- package/esm/core/Dialog/DialogMain.js +18 -25
- package/esm/core/Dialog/DialogTitleBar.d.ts +0 -1
- package/esm/core/Dialog/DialogTitleBar.js +0 -1
- package/esm/core/Dialog/DialogTitleBarTitle.d.ts +0 -1
- package/esm/core/Dialog/DialogTitleBarTitle.js +0 -1
- package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +5 -1
- package/esm/core/ExpandableBlock/ExpandableBlock.js +8 -6
- package/esm/core/Fieldset/Fieldset.d.ts +0 -1
- package/esm/core/Fieldset/Fieldset.js +0 -1
- package/esm/core/FileUpload/FileEmptyCard.js +1 -1
- package/esm/core/FileUpload/FileUpload.d.ts +0 -1
- package/esm/core/FileUpload/FileUpload.js +3 -7
- package/esm/core/FileUpload/FileUploadCard.d.ts +0 -1
- package/esm/core/FileUpload/FileUploadCard.js +10 -12
- package/esm/core/FileUpload/FileUploadTemplate.d.ts +0 -1
- package/esm/core/FileUpload/FileUploadTemplate.js +0 -1
- package/esm/core/Footer/Footer.d.ts +0 -1
- package/esm/core/Footer/Footer.js +0 -1
- package/esm/core/Footer/FooterItem.d.ts +0 -1
- package/esm/core/Footer/FooterItem.js +0 -1
- package/esm/core/Footer/FooterList.d.ts +0 -1
- package/esm/core/Footer/FooterList.js +0 -1
- package/esm/core/Footer/FooterSeparator.d.ts +0 -1
- package/esm/core/Footer/FooterSeparator.js +0 -1
- package/esm/core/Header/Header.d.ts +0 -1
- package/esm/core/Header/Header.js +0 -1
- package/esm/core/Header/HeaderBreadcrumbs.d.ts +0 -1
- package/esm/core/Header/HeaderBreadcrumbs.js +0 -1
- package/esm/core/Header/HeaderButton.d.ts +0 -1
- package/esm/core/Header/HeaderButton.js +0 -1
- package/esm/core/Header/HeaderLogo.d.ts +0 -1
- package/esm/core/Header/HeaderLogo.js +0 -1
- package/esm/core/InformationPanel/InformationPanel.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanel.js +1 -5
- package/esm/core/InformationPanel/InformationPanelBody.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelBody.js +0 -1
- package/esm/core/InformationPanel/InformationPanelContent.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelContent.js +0 -1
- package/esm/core/InformationPanel/InformationPanelHeader.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/esm/core/InformationPanel/InformationPanelWrapper.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelWrapper.js +0 -1
- package/esm/core/Input/Input.d.ts +0 -1
- package/esm/core/Input/Input.js +0 -1
- package/esm/core/InputGroup/InputGroup.d.ts +0 -1
- package/esm/core/InputGroup/InputGroup.js +0 -1
- package/esm/core/Label/Label.d.ts +0 -1
- package/esm/core/Label/Label.js +0 -1
- package/esm/core/LabeledInput/LabeledInput.d.ts +0 -1
- package/esm/core/LabeledInput/LabeledInput.js +1 -2
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +0 -1
- package/esm/core/LabeledSelect/LabeledSelect.js +0 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +0 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -2
- package/esm/core/List/List.d.ts +0 -1
- package/esm/core/List/List.js +0 -1
- package/esm/core/List/ListItem.d.ts +0 -1
- package/esm/core/List/ListItem.js +0 -1
- package/esm/core/Menu/Menu.d.ts +0 -1
- package/esm/core/Menu/Menu.js +3 -5
- package/esm/core/Menu/MenuDivider.d.ts +0 -1
- package/esm/core/Menu/MenuDivider.js +0 -1
- package/esm/core/Menu/MenuExtraContent.d.ts +0 -1
- package/esm/core/Menu/MenuExtraContent.js +0 -1
- package/esm/core/Menu/MenuItem.d.ts +0 -1
- package/esm/core/Menu/MenuItem.js +8 -12
- package/esm/core/Menu/MenuItemSkeleton.d.ts +0 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/Modal/Modal.d.ts +8 -10
- package/esm/core/Modal/Modal.js +3 -11
- package/esm/core/NonIdealState/NonIdealState.d.ts +0 -1
- package/esm/core/NonIdealState/NonIdealState.js +0 -1
- package/esm/core/NotificationMarker/NotificationMarker.d.ts +0 -1
- package/esm/core/NotificationMarker/NotificationMarker.js +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +0 -1
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.d.ts +0 -1
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +0 -1
- package/esm/core/Radio/Radio.d.ts +0 -1
- package/esm/core/Radio/Radio.js +0 -1
- package/esm/core/RadioTiles/RadioTile.d.ts +0 -1
- package/esm/core/RadioTiles/RadioTile.js +0 -1
- package/esm/core/RadioTiles/RadioTileGroup.d.ts +0 -1
- package/esm/core/RadioTiles/RadioTileGroup.js +0 -1
- package/esm/core/SearchBox/SearchBox.d.ts +0 -1
- package/esm/core/SearchBox/SearchBox.js +12 -13
- package/esm/core/Select/Select.d.ts +0 -1
- package/esm/core/Select/Select.js +12 -18
- package/esm/core/Select/SelectTag.d.ts +0 -1
- package/esm/core/Select/SelectTag.js +0 -1
- package/esm/core/SideNavigation/SideNavigation.d.ts +0 -1
- package/esm/core/SideNavigation/SideNavigation.js +2 -3
- package/esm/core/SideNavigation/SidenavButton.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavButton.js +0 -1
- package/esm/core/SideNavigation/SidenavSubmenu.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavSubmenu.js +0 -1
- package/esm/core/SideNavigation/SidenavSubmenuHeader.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavSubmenuHeader.js +0 -1
- package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +0 -1
- package/esm/core/SkipToContentLink/SkipToContentLink.js +0 -1
- package/esm/core/Slider/Slider.d.ts +0 -1
- package/esm/core/Slider/Slider.js +16 -20
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/Slider/Track.js +2 -1
- package/esm/core/StatusMessage/StatusMessage.js +1 -1
- package/esm/core/Stepper/Stepper.d.ts +0 -1
- package/esm/core/Stepper/Stepper.js +1 -2
- package/esm/core/Stepper/StepperStep.js +1 -1
- package/esm/core/Stepper/WorkflowDiagram.d.ts +0 -1
- package/esm/core/Stepper/WorkflowDiagram.js +0 -1
- package/esm/core/Surface/Surface.d.ts +0 -1
- package/esm/core/Surface/Surface.js +0 -1
- package/esm/core/Table/Table.d.ts +0 -1
- package/esm/core/Table/Table.js +34 -35
- package/esm/core/Table/TableCell.js +3 -2
- package/esm/core/Table/TablePaginator.d.ts +0 -1
- package/esm/core/Table/TablePaginator.js +11 -13
- package/esm/core/Table/TableRowMemoized.js +41 -48
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
- package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
- package/esm/core/Table/cells/DefaultCell.js +4 -3
- package/esm/core/Table/cells/EditableCell.js +8 -14
- package/esm/core/Table/columns/actionColumn.js +3 -6
- package/esm/core/Table/columns/expanderColumn.js +3 -3
- package/esm/core/Table/columns/selectionColumn.js +4 -4
- package/esm/core/Table/filters/BaseFilter.d.ts +0 -1
- package/esm/core/Table/filters/BaseFilter.js +2 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +0 -1
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -4
- package/esm/core/Table/filters/FilterButtonBar.d.ts +0 -1
- package/esm/core/Table/filters/FilterButtonBar.js +2 -3
- package/esm/core/Table/filters/FilterToggle.d.ts +0 -1
- package/esm/core/Table/filters/FilterToggle.js +0 -1
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.d.ts +0 -1
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -4
- package/esm/core/Table/filters/TextFilter/TextFilter.d.ts +0 -1
- package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -3
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +5 -4
- package/esm/core/Table/hooks/useResizeColumns.js +16 -22
- package/esm/core/Table/hooks/useScrollToRow.js +1 -2
- package/esm/core/Table/hooks/useStickyColumns.js +3 -5
- package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/esm/core/Tabs/Tab.d.ts +0 -1
- package/esm/core/Tabs/Tab.js +0 -1
- package/esm/core/Tabs/Tabs.d.ts +0 -1
- package/esm/core/Tabs/Tabs.js +16 -19
- package/esm/core/Tag/Tag.d.ts +0 -1
- package/esm/core/Tag/Tag.js +0 -1
- package/esm/core/Tag/TagContainer.d.ts +0 -1
- package/esm/core/Tag/TagContainer.js +0 -1
- package/esm/core/Textarea/Textarea.d.ts +0 -1
- package/esm/core/Textarea/Textarea.js +0 -1
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -5
- package/esm/core/ThemeProvider/ThemeProvider.js +12 -16
- package/esm/core/Tile/Tile.d.ts +0 -1
- package/esm/core/Tile/Tile.js +3 -7
- package/esm/core/TimePicker/TimePicker.d.ts +0 -1
- package/esm/core/TimePicker/TimePicker.js +13 -14
- package/esm/core/Toast/Toast.d.ts +0 -1
- package/esm/core/Toast/Toast.js +2 -4
- package/esm/core/Toast/ToastWrapper.d.ts +0 -1
- package/esm/core/Toast/ToastWrapper.js +0 -1
- package/esm/core/Toast/Toaster.js +6 -11
- package/esm/core/ToggleSwitch/ToggleSwitch.d.ts +0 -1
- package/esm/core/ToggleSwitch/ToggleSwitch.js +1 -3
- package/esm/core/Tooltip/Tooltip.d.ts +0 -1
- package/esm/core/Tooltip/Tooltip.js +0 -1
- package/esm/core/TransferList/TransferList.d.ts +69 -0
- package/esm/core/TransferList/TransferList.js +141 -0
- package/esm/core/TransferList/index.d.ts +3 -0
- package/esm/core/TransferList/index.js +6 -0
- package/esm/core/Tree/Tree.d.ts +0 -1
- package/esm/core/Tree/Tree.js +9 -14
- package/esm/core/Tree/TreeNode.d.ts +0 -1
- package/esm/core/Tree/TreeNode.js +9 -11
- package/esm/core/Tree/TreeNodeExpander.d.ts +0 -1
- package/esm/core/Tree/TreeNodeExpander.js +0 -1
- package/esm/core/Typography/Anchor/Anchor.d.ts +0 -1
- package/esm/core/Typography/Anchor/Anchor.js +0 -1
- package/esm/core/Typography/Blockquote/Blockquote.d.ts +0 -1
- package/esm/core/Typography/Blockquote/Blockquote.js +0 -1
- package/esm/core/Typography/Code/Code.d.ts +0 -1
- package/esm/core/Typography/Code/Code.js +0 -1
- package/esm/core/Typography/Kbd/Kbd.d.ts +0 -1
- package/esm/core/Typography/Kbd/Kbd.js +0 -1
- package/esm/core/Typography/Text/Text.d.ts +0 -1
- package/esm/core/Typography/Text/Text.js +0 -1
- package/esm/core/index.d.ts +1 -0
- package/esm/core/index.js +1 -0
- package/esm/core/utils/color/ColorValue.js +9 -15
- package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/esm/core/utils/components/Divider.d.ts +0 -1
- package/esm/core/utils/components/Divider.js +0 -1
- package/esm/core/utils/components/Flex.d.ts +0 -1
- package/esm/core/utils/components/Flex.js +0 -1
- package/esm/core/utils/components/FocusTrap.js +4 -4
- package/esm/core/utils/components/Icon.d.ts +0 -1
- package/esm/core/utils/components/Icon.js +0 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +0 -1
- package/esm/core/utils/components/InputFlexContainer.d.ts +0 -1
- package/esm/core/utils/components/InputFlexContainer.js +0 -1
- package/esm/core/utils/components/LinkAction.d.ts +0 -1
- package/esm/core/utils/components/LinkAction.js +0 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
- package/esm/core/utils/components/Popover.d.ts +0 -1
- package/esm/core/utils/components/Popover.js +5 -9
- package/esm/core/utils/components/Resizer.js +7 -6
- package/esm/core/utils/components/VirtualScroll.js +14 -21
- package/esm/core/utils/components/VisuallyHidden.d.ts +0 -1
- package/esm/core/utils/components/VisuallyHidden.js +0 -1
- package/esm/core/utils/functions/dom.d.ts +6 -0
- package/esm/core/utils/functions/dom.js +19 -5
- package/esm/core/utils/functions/index.d.ts +0 -1
- package/esm/core/utils/functions/index.js +0 -1
- package/esm/core/utils/functions/polymorphic.js +9 -1
- package/esm/core/utils/functions/supports.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +0 -1
- package/esm/core/utils/hooks/index.js +0 -1
- package/esm/core/utils/hooks/useContainerWidth.js +1 -1
- package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
- package/esm/core/utils/hooks/useEventListener.js +1 -1
- package/esm/core/utils/hooks/useGlobals.d.ts +9 -4
- package/esm/core/utils/hooks/useGlobals.js +6 -6
- package/esm/core/utils/hooks/useId.js +1 -2
- package/esm/core/utils/hooks/useIntersection.js +2 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -8
- package/esm/core/utils/hooks/useOverflow.js +1 -2
- package/esm/core/utils/hooks/useResizeObserver.js +3 -4
- package/esm/styles.d.ts +5 -0
- package/esm/styles.js +451 -0
- package/package.json +14 -11
- package/styles.css +1940 -0
- package/cjs/core/utils/functions/styles.d.ts +0 -6
- package/cjs/core/utils/functions/styles.js +0 -21
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
- package/esm/core/utils/functions/styles.d.ts +0 -6
- package/esm/core/utils/functions/styles.js +0 -17
- package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/time-picker.css';
|
|
9
8
|
const isSameHour = (date1, date2, meridiem) => {
|
|
10
9
|
const adjustedHours = meridiem
|
|
11
10
|
? formatHourFrom12(date1.getHours(), meridiem)
|
|
@@ -80,17 +79,17 @@ const defaultCombinedRenderer = (date, precision) => {
|
|
|
80
79
|
export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
81
80
|
const { date, onChange, use12Hours = false, precision = 'minutes', hourStep = 1, minuteStep = 1, secondStep = 1, setFocusHour = false, hourRenderer = (date) => date.getHours().toLocaleString(undefined, { minimumIntegerDigits: 2 }), minuteRenderer = (date) => date.getMinutes().toLocaleString(undefined, { minimumIntegerDigits: 2 }), secondRenderer = (date) => date.getSeconds().toLocaleString(undefined, { minimumIntegerDigits: 2 }), meridiemRenderer = (meridiem) => meridiem, useCombinedRenderer = false, combinedRenderer = defaultCombinedRenderer, className, ...rest } = props;
|
|
82
81
|
const [selectedTime, setSelectedTime] = React.useState(date);
|
|
83
|
-
const [focusedTime, setFocusedTime] = React.useState(selectedTime
|
|
84
|
-
const [meridiem, setMeridiem] = React.useState(use12Hours ? (
|
|
82
|
+
const [focusedTime, setFocusedTime] = React.useState(selectedTime ?? new Date());
|
|
83
|
+
const [meridiem, setMeridiem] = React.useState(use12Hours ? (focusedTime?.getHours() > 11 ? 'PM' : 'AM') : undefined);
|
|
85
84
|
React.useEffect(() => {
|
|
86
|
-
setFocusedTime(date
|
|
85
|
+
setFocusedTime(date ?? new Date());
|
|
87
86
|
setSelectedTime(date);
|
|
88
87
|
}, [date]);
|
|
89
88
|
const onHourClick = (date) => {
|
|
90
89
|
const adjustedHour = use12Hours
|
|
91
90
|
? formatHourFrom12(date.getHours(), meridiem)
|
|
92
91
|
: date.getHours();
|
|
93
|
-
const adjustedSelectedTime = setHours(adjustedHour, selectedTime
|
|
92
|
+
const adjustedSelectedTime = setHours(adjustedHour, selectedTime ?? new Date());
|
|
94
93
|
updateCurrentTime(adjustedSelectedTime);
|
|
95
94
|
};
|
|
96
95
|
const onTimeClick = (date) => {
|
|
@@ -101,7 +100,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
101
100
|
updateCurrentTime(adjustedSelectedTime);
|
|
102
101
|
};
|
|
103
102
|
const onMeridiemClick = (value) => {
|
|
104
|
-
let adjustedSelectedTime = selectedTime
|
|
103
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
105
104
|
const currentHours = adjustedSelectedTime.getHours();
|
|
106
105
|
setMeridiem(value);
|
|
107
106
|
if (value === 'AM' && currentHours > 11) {
|
|
@@ -123,7 +122,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
123
122
|
}
|
|
124
123
|
setFocusedTime(adjustedTime);
|
|
125
124
|
setSelectedTime(adjustedTime);
|
|
126
|
-
onChange
|
|
125
|
+
onChange?.(adjustedTime);
|
|
127
126
|
};
|
|
128
127
|
const onHourFocus = (date) => {
|
|
129
128
|
const adjustedHour = use12Hours
|
|
@@ -138,7 +137,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
138
137
|
setFocusedTime(setHours(adjustedHour, date));
|
|
139
138
|
};
|
|
140
139
|
const onMeridiemFocus = (value) => {
|
|
141
|
-
let adjustedSelectedTime = selectedTime
|
|
140
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
142
141
|
const currentHours = adjustedSelectedTime.getHours();
|
|
143
142
|
if (value === 'AM' && currentHours > 11) {
|
|
144
143
|
setMeridiem(value);
|
|
@@ -160,7 +159,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
160
159
|
return data;
|
|
161
160
|
};
|
|
162
161
|
const time = React.useMemo(() => {
|
|
163
|
-
const time = selectedTime
|
|
162
|
+
const time = selectedTime ?? new Date();
|
|
164
163
|
const data = [];
|
|
165
164
|
const hoursArray = Array.from(Array(use12Hours ? 12 : 24).keys())
|
|
166
165
|
.filter((i) => i % hourStep === 0)
|
|
@@ -187,15 +186,15 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
187
186
|
return data;
|
|
188
187
|
}, [hourStep, minuteStep, secondStep, selectedTime, use12Hours, precision]);
|
|
189
188
|
const hours = React.useMemo(() => {
|
|
190
|
-
const time = selectedTime
|
|
189
|
+
const time = selectedTime ?? new Date();
|
|
191
190
|
return generateDataList(use12Hours ? 12 : 24, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), use12Hours && i === 0 ? 12 : i, time.getMinutes(), time.getSeconds()), hourStep);
|
|
192
191
|
}, [hourStep, selectedTime, use12Hours]);
|
|
193
192
|
const minutes = React.useMemo(() => {
|
|
194
|
-
const time = selectedTime
|
|
193
|
+
const time = selectedTime ?? new Date();
|
|
195
194
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), i, time.getSeconds()), minuteStep);
|
|
196
195
|
}, [minuteStep, selectedTime]);
|
|
197
196
|
const seconds = React.useMemo(() => {
|
|
198
|
-
const time = selectedTime
|
|
197
|
+
const time = selectedTime ?? new Date();
|
|
199
198
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), time.getMinutes(), i), secondStep);
|
|
200
199
|
}, [secondStep, selectedTime]);
|
|
201
200
|
return (React.createElement(Box, { className: cx('iui-time-picker', className), ref: forwardedRef, ...rest },
|
|
@@ -216,7 +215,7 @@ const TimePickerColumn = (props) => {
|
|
|
216
215
|
}
|
|
217
216
|
});
|
|
218
217
|
const scrollIntoView = (ref, isSame) => {
|
|
219
|
-
isSame &&
|
|
218
|
+
isSame && ref?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
220
219
|
};
|
|
221
220
|
const handleTimeKeyDown = (event, maxValue, onFocus, onSelect, currentValue) => {
|
|
222
221
|
if (event.altKey) {
|
|
@@ -256,7 +255,7 @@ const TimePickerColumn = (props) => {
|
|
|
256
255
|
'iui-selected': isSameSelected(value),
|
|
257
256
|
}), key: index, tabIndex: isSameFocus ? 0 : undefined, ref: (ref) => {
|
|
258
257
|
scrollIntoView(ref, isSameFocus);
|
|
259
|
-
needFocus.current && isSameFocus &&
|
|
258
|
+
needFocus.current && isSameFocus && ref?.focus();
|
|
260
259
|
}, onClick: () => {
|
|
261
260
|
onSelectChange(value);
|
|
262
261
|
} }, valueRenderer(value, precision)));
|
package/esm/core/Toast/Toast.js
CHANGED
|
@@ -6,9 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
import { Transition } from 'react-transition-group';
|
|
7
7
|
import cx from 'classnames';
|
|
8
8
|
import { getWindow, StatusIconMap, SvgCloseSmall, Box, } from '../utils/index.js';
|
|
9
|
-
import '@itwin/itwinui-css/css/toast.css';
|
|
10
9
|
import { IconButton } from '../Buttons/index.js';
|
|
11
|
-
const isMotionOk = () =>
|
|
10
|
+
const isMotionOk = () => getWindow()?.matchMedia?.('(prefers-reduced-motion: no-preference)')?.matches;
|
|
12
11
|
/**
|
|
13
12
|
* Generic Toast Component
|
|
14
13
|
* @example
|
|
@@ -65,8 +64,7 @@ export const Toast = (props) => {
|
|
|
65
64
|
}, timeout);
|
|
66
65
|
};
|
|
67
66
|
const clearCloseTimeout = () => {
|
|
68
|
-
|
|
69
|
-
(_a = getWindow()) === null || _a === void 0 ? void 0 : _a.clearTimeout(closeTimeout.current);
|
|
67
|
+
getWindow()?.clearTimeout(closeTimeout.current);
|
|
70
68
|
};
|
|
71
69
|
const onRef = (ref) => {
|
|
72
70
|
if (ref) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import '@itwin/itwinui-css/css/toast.css';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import cx from 'classnames';
|
|
8
7
|
import Toast from './Toast.js';
|
|
@@ -20,11 +20,10 @@ export default class Toaster {
|
|
|
20
20
|
// Create container on demand.
|
|
21
21
|
// Cannot do it in constructor, because SSG/SSR apps would fail.
|
|
22
22
|
this.asyncInit = async () => {
|
|
23
|
-
var _a, _b;
|
|
24
23
|
if (this.isInitialized) {
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
|
-
const container =
|
|
26
|
+
const container = getContainer(TOASTS_CONTAINER_ID) ?? getDocument()?.body;
|
|
28
27
|
if (!container) {
|
|
29
28
|
return;
|
|
30
29
|
}
|
|
@@ -56,15 +55,13 @@ export default class Toaster {
|
|
|
56
55
|
* Settings will be applied to new toasts on the page.
|
|
57
56
|
*/
|
|
58
57
|
setSettings(newSettings) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(_b = newSettings.order) !== null && _b !== void 0 ? _b : (newSettings.order = ((_c = newSettings.placement) === null || _c === void 0 ? void 0 : _c.startsWith('bottom'))
|
|
58
|
+
newSettings.placement ?? (newSettings.placement = this.settings.placement);
|
|
59
|
+
newSettings.order ?? (newSettings.order = newSettings.placement?.startsWith('bottom')
|
|
62
60
|
? 'ascending'
|
|
63
61
|
: 'descending');
|
|
64
62
|
this.settings = newSettings;
|
|
65
63
|
this.asyncInit().then(() => {
|
|
66
|
-
|
|
67
|
-
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setPlacement((_b = this.settings.placement) !== null && _b !== void 0 ? _b : 'top');
|
|
64
|
+
this.toastsRef.current?.setPlacement(this.settings.placement ?? 'top');
|
|
68
65
|
});
|
|
69
66
|
}
|
|
70
67
|
positive(content, options) {
|
|
@@ -89,9 +86,8 @@ export default class Toaster {
|
|
|
89
86
|
content,
|
|
90
87
|
category,
|
|
91
88
|
onRemove: () => {
|
|
92
|
-
var _a;
|
|
93
89
|
this.removeToast(currentId);
|
|
94
|
-
|
|
90
|
+
options?.onRemove?.();
|
|
95
91
|
},
|
|
96
92
|
id: currentId,
|
|
97
93
|
isVisible: true,
|
|
@@ -107,8 +103,7 @@ export default class Toaster {
|
|
|
107
103
|
}
|
|
108
104
|
updateView() {
|
|
109
105
|
this.asyncInit().then(() => {
|
|
110
|
-
|
|
111
|
-
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setToasts(this.toasts);
|
|
106
|
+
this.toastsRef.current?.setToasts(this.toasts);
|
|
112
107
|
});
|
|
113
108
|
}
|
|
114
109
|
closeToast(toastId) {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useMergedRefs, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/toggle-switch.css';
|
|
9
8
|
/**
|
|
10
9
|
* A switch for turning on and off.
|
|
11
10
|
* @example
|
|
@@ -34,13 +33,12 @@ export const ToggleSwitch = React.forwardRef((props, ref) => {
|
|
|
34
33
|
const { disabled = false, labelPosition = 'right', label, setFocus = false, className, style, size = 'default', ...rest } = props;
|
|
35
34
|
const inputElementRef = React.useRef(null);
|
|
36
35
|
const refs = useMergedRefs(inputElementRef, ref);
|
|
37
|
-
const WrapperComponent = label ? 'label' : 'div';
|
|
38
36
|
React.useEffect(() => {
|
|
39
37
|
if (inputElementRef.current && setFocus) {
|
|
40
38
|
inputElementRef.current.focus();
|
|
41
39
|
}
|
|
42
40
|
}, [setFocus]);
|
|
43
|
-
return (React.createElement(
|
|
41
|
+
return (React.createElement(Box, { as: label ? 'label' : 'div', className: cx('iui-toggle-switch-wrapper', {
|
|
44
42
|
'iui-disabled': disabled,
|
|
45
43
|
'iui-label-on-right': label && labelPosition === 'right',
|
|
46
44
|
'iui-label-on-left': label && labelPosition === 'left',
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { Popover, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/tooltip.css';
|
|
9
8
|
/**
|
|
10
9
|
* Basic tooltip component to display informative content when an element is hovered or focused.
|
|
11
10
|
* Uses the {@link Popover} component, which is a wrapper around [tippy.js](https://atomiks.github.io/tippyjs).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
+
import { ListItem } from '../List/index.js';
|
|
4
|
+
declare type TransferListListboxWrapperOwnProps = {};
|
|
5
|
+
declare type TransferListItemOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Callback fired when the the active state changes.
|
|
8
|
+
*/
|
|
9
|
+
onActiveChange?: (value: boolean) => void;
|
|
10
|
+
} & React.ComponentProps<typeof ListItem>;
|
|
11
|
+
declare type TransferListListboxLabelOwnProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Text label that is wrapped by `TransferList.ListboxLabel`
|
|
14
|
+
*/
|
|
15
|
+
children?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The TransferList component is used to display a list within a box
|
|
19
|
+
* @example
|
|
20
|
+
* <TransferList>
|
|
21
|
+
* <TransferList.ListboxWrapper>
|
|
22
|
+
* <TransferList.Listbox>
|
|
23
|
+
* <TransferList.Item>Item 1</TransferList.Item>
|
|
24
|
+
* <TransferList.Item>Item 2</TransferList.Item>
|
|
25
|
+
* <TransferList.Item>Item 3</TransferList.Item>
|
|
26
|
+
* <TransferList.Item>Item 4</TransferList.Item>
|
|
27
|
+
* <TransferList.Item>Item 5</TransferList.Item>
|
|
28
|
+
* <TransferList.Item>Item 6</TransferList.Item>
|
|
29
|
+
* </TransferList.Listbox>
|
|
30
|
+
* </TransferList.ListboxWrapper>
|
|
31
|
+
* </TransferList>
|
|
32
|
+
*/
|
|
33
|
+
export declare const TransferList: PolymorphicForwardRefComponent<keyof JSX.IntrinsicElements, {}> & {
|
|
34
|
+
/**
|
|
35
|
+
* TransferList listbox wrapper subcomponent
|
|
36
|
+
*/
|
|
37
|
+
ListboxWrapper: PolymorphicForwardRefComponent<"div", TransferListListboxWrapperOwnProps>;
|
|
38
|
+
/**
|
|
39
|
+
* TransferList listbox subcomponent
|
|
40
|
+
*/
|
|
41
|
+
Listbox: PolymorphicForwardRefComponent<"ul", Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "key" | keyof React.HTMLAttributes<HTMLUListElement>> & {
|
|
42
|
+
ref?: ((instance: HTMLUListElement | null) => void) | React.RefObject<HTMLUListElement> | null | undefined;
|
|
43
|
+
}, "as"> & {
|
|
44
|
+
as?: "ul" | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* TransferList item subcomponent
|
|
48
|
+
*/
|
|
49
|
+
Item: PolymorphicForwardRefComponent<"li", TransferListItemOwnProps>;
|
|
50
|
+
/**
|
|
51
|
+
* TransferList listbox label subcomponent
|
|
52
|
+
*/
|
|
53
|
+
ListboxLabel: PolymorphicForwardRefComponent<"div", TransferListListboxLabelOwnProps>;
|
|
54
|
+
/**
|
|
55
|
+
* TransferList toolbar subcomponent
|
|
56
|
+
*/
|
|
57
|
+
Toolbar: PolymorphicForwardRefComponent<keyof JSX.IntrinsicElements, {}>;
|
|
58
|
+
};
|
|
59
|
+
export declare const TransferListContext: React.Context<{
|
|
60
|
+
/**
|
|
61
|
+
* Id to set to label and set 'aria-labelledby' prop of the listbox
|
|
62
|
+
*/
|
|
63
|
+
labelId?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Callback that's fired when labelId is changed
|
|
66
|
+
*/
|
|
67
|
+
setLabelId: (labelId: string) => void;
|
|
68
|
+
} | undefined>;
|
|
69
|
+
export default TransferList;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
import { getFocusableElements, useMergedRefs, useId, useSafeContext, Box, polymorphic, } from '../utils/index.js';
|
|
8
|
+
import { List, ListItem } from '../List/index.js';
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
// TransferListComponent
|
|
11
|
+
const TransferListComponent = polymorphic('iui-transfer-list-wrapper');
|
|
12
|
+
TransferListComponent.displayName = 'TransferList';
|
|
13
|
+
const TransferListListboxWrapper = React.forwardRef((props, ref) => {
|
|
14
|
+
const { className, children, ...rest } = props;
|
|
15
|
+
const uid = useId();
|
|
16
|
+
const [labelId, setLabelId] = React.useState(uid);
|
|
17
|
+
return (React.createElement(Box, { as: 'div', className: cx('iui-transfer-list-listbox-wrapper', className), ref: ref, ...rest },
|
|
18
|
+
React.createElement(TransferListContext.Provider, { value: { labelId, setLabelId } }, children)));
|
|
19
|
+
});
|
|
20
|
+
TransferListListboxWrapper.displayName = 'TransferList.ListboxWrapper';
|
|
21
|
+
const TransferListListbox = React.forwardRef((props, ref) => {
|
|
22
|
+
const { children, className, ...rest } = props;
|
|
23
|
+
const { labelId } = useSafeContext(TransferListContext);
|
|
24
|
+
const [focusedIndex, setFocusedIndex] = React.useState();
|
|
25
|
+
const listRef = React.useRef(null);
|
|
26
|
+
const refs = useMergedRefs(listRef, ref);
|
|
27
|
+
const getFocusableNodes = React.useCallback(() => {
|
|
28
|
+
const focusableItems = getFocusableElements(listRef.current);
|
|
29
|
+
// Filter out focusable elements that are inside each list item, e.g. checkbox, anchor
|
|
30
|
+
return focusableItems.filter((i) => !focusableItems.some((p) => p.contains(i.parentElement)));
|
|
31
|
+
}, []);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
const items = getFocusableNodes();
|
|
34
|
+
if (focusedIndex != null) {
|
|
35
|
+
items?.[focusedIndex]?.focus();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}, [focusedIndex, getFocusableNodes]);
|
|
39
|
+
const onKeyDown = (event) => {
|
|
40
|
+
if (event.altKey) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const items = getFocusableNodes();
|
|
44
|
+
if (!items?.length) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const currentIndex = focusedIndex ?? 0;
|
|
48
|
+
switch (event.key) {
|
|
49
|
+
case 'ArrowDown': {
|
|
50
|
+
setFocusedIndex(Math.min(currentIndex + 1, items.length - 1));
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case 'ArrowUp': {
|
|
56
|
+
setFocusedIndex(Math.max(currentIndex - 1, 0));
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return (React.createElement(List, { className: cx('iui-transfer-list-listbox', className), onKeyDown: onKeyDown, role: 'listbox', "aria-multiselectable": true, "aria-labelledby": labelId, tabIndex: 0, ref: refs, ...rest }, children));
|
|
66
|
+
});
|
|
67
|
+
TransferListListbox.displayName = 'TransferList.Listbox';
|
|
68
|
+
const TransferListItem = React.forwardRef((props, ref) => {
|
|
69
|
+
const { actionable = true, disabled, onActiveChange, children, active, ...rest } = props;
|
|
70
|
+
const onClickEvents = () => actionable && onActiveChange && onActiveChange(!active);
|
|
71
|
+
const onKeyDown = (event) => {
|
|
72
|
+
if (event.altKey) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (event.key === 'Enter' ||
|
|
76
|
+
event.key === ' ' ||
|
|
77
|
+
event.key === 'Spacebar') {
|
|
78
|
+
!disabled && onClickEvents();
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (React.createElement(ListItem, { ref: ref, onClick: onClickEvents, onKeyDown: onKeyDown, active: active, actionable: actionable, tabIndex: -1, role: 'option', "aria-disabled": disabled ? 'true' : undefined, "aria-selected": active ? 'true' : undefined, disabled: disabled, ...rest }, children));
|
|
83
|
+
});
|
|
84
|
+
TransferListItem.displayName = 'TransferList.Item';
|
|
85
|
+
const TransferListListboxLabel = React.forwardRef((props, ref) => {
|
|
86
|
+
const { children, className, id, ...rest } = props;
|
|
87
|
+
const { labelId, setLabelId } = useSafeContext(TransferListContext);
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (id && id !== labelId) {
|
|
90
|
+
setLabelId(id);
|
|
91
|
+
}
|
|
92
|
+
}, [id, labelId, setLabelId]);
|
|
93
|
+
return (React.createElement(Box, { as: 'div', className: cx('iui-transfer-list-listbox-label', className), id: labelId, ref: ref, ...rest }, children));
|
|
94
|
+
});
|
|
95
|
+
TransferListListboxLabel.displayName = 'TransferList.ListboxLabel';
|
|
96
|
+
// ----------------------------------------------------------------------------
|
|
97
|
+
// TransferList.Toolbar component
|
|
98
|
+
const TransferListToolbar = polymorphic('iui-transfer-list-toolbar', {
|
|
99
|
+
role: 'toolbar',
|
|
100
|
+
});
|
|
101
|
+
TransferListToolbar.displayName = 'TransferList.Toolbar';
|
|
102
|
+
/**
|
|
103
|
+
* The TransferList component is used to display a list within a box
|
|
104
|
+
* @example
|
|
105
|
+
* <TransferList>
|
|
106
|
+
* <TransferList.ListboxWrapper>
|
|
107
|
+
* <TransferList.Listbox>
|
|
108
|
+
* <TransferList.Item>Item 1</TransferList.Item>
|
|
109
|
+
* <TransferList.Item>Item 2</TransferList.Item>
|
|
110
|
+
* <TransferList.Item>Item 3</TransferList.Item>
|
|
111
|
+
* <TransferList.Item>Item 4</TransferList.Item>
|
|
112
|
+
* <TransferList.Item>Item 5</TransferList.Item>
|
|
113
|
+
* <TransferList.Item>Item 6</TransferList.Item>
|
|
114
|
+
* </TransferList.Listbox>
|
|
115
|
+
* </TransferList.ListboxWrapper>
|
|
116
|
+
* </TransferList>
|
|
117
|
+
*/
|
|
118
|
+
export const TransferList = Object.assign(TransferListComponent, {
|
|
119
|
+
/**
|
|
120
|
+
* TransferList listbox wrapper subcomponent
|
|
121
|
+
*/
|
|
122
|
+
ListboxWrapper: TransferListListboxWrapper,
|
|
123
|
+
/**
|
|
124
|
+
* TransferList listbox subcomponent
|
|
125
|
+
*/
|
|
126
|
+
Listbox: TransferListListbox,
|
|
127
|
+
/**
|
|
128
|
+
* TransferList item subcomponent
|
|
129
|
+
*/
|
|
130
|
+
Item: TransferListItem,
|
|
131
|
+
/**
|
|
132
|
+
* TransferList listbox label subcomponent
|
|
133
|
+
*/
|
|
134
|
+
ListboxLabel: TransferListListboxLabel,
|
|
135
|
+
/**
|
|
136
|
+
* TransferList toolbar subcomponent
|
|
137
|
+
*/
|
|
138
|
+
Toolbar: TransferListToolbar,
|
|
139
|
+
});
|
|
140
|
+
export const TransferListContext = React.createContext(undefined);
|
|
141
|
+
export default TransferList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export { TransferList } from './TransferList.js';
|
|
6
|
+
export default './TransferList';
|
package/esm/core/Tree/Tree.d.ts
CHANGED
package/esm/core/Tree/Tree.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { getFocusableElements, useVirtualization, mergeRefs, Box, polymorphic, } from '../utils/index.js';
|
|
7
|
-
import '@itwin/itwinui-css/css/tree.css';
|
|
8
7
|
import cx from 'classnames';
|
|
9
8
|
import { TreeContext } from './TreeContext.js';
|
|
10
9
|
/**
|
|
@@ -74,10 +73,10 @@ export const Tree = (props) => {
|
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
76
75
|
const items = getFocusableNodes();
|
|
77
|
-
if (!
|
|
76
|
+
if (!items?.length) {
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
|
-
const activeIndex = items.findIndex((el) =>
|
|
79
|
+
const activeIndex = items.findIndex((el) => el.contains(treeRef.current?.ownerDocument.activeElement));
|
|
81
80
|
const currentIndex = activeIndex > -1 ? activeIndex : 0;
|
|
82
81
|
switch (event.key) {
|
|
83
82
|
case 'ArrowUp': {
|
|
@@ -127,20 +126,18 @@ export const Tree = (props) => {
|
|
|
127
126
|
return [flatList, firstLevelNodes];
|
|
128
127
|
}, [data, getNode]);
|
|
129
128
|
const itemRenderer = React.useCallback((index) => {
|
|
130
|
-
var _a, _b, _c, _d;
|
|
131
129
|
const node = flatNodesList[index];
|
|
132
130
|
return (React.createElement(TreeContext.Provider, { key: node.nodeProps.nodeId, value: {
|
|
133
131
|
nodeDepth: node.depth,
|
|
134
132
|
subNodeIds: node.subNodeIds,
|
|
135
133
|
groupSize: node.depth === 0
|
|
136
134
|
? firstLevelNodesList.length
|
|
137
|
-
:
|
|
135
|
+
: node.parentNode?.subNodeIds?.length ?? 0,
|
|
138
136
|
indexInGroup: node.indexInGroup,
|
|
139
|
-
parentNodeId:
|
|
137
|
+
parentNodeId: node.parentNode?.nodeProps.nodeId,
|
|
140
138
|
scrollToParent: node.parentNode
|
|
141
139
|
? () => {
|
|
142
|
-
|
|
143
|
-
const parentNodeId = (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeProps.nodeId;
|
|
140
|
+
const parentNodeId = node.parentNode?.nodeProps.nodeId;
|
|
144
141
|
const parentNodeIndex = flatNodesList.findIndex((n) => n.nodeProps.nodeId === parentNodeId);
|
|
145
142
|
setScrollToIndex(parentNodeIndex);
|
|
146
143
|
}
|
|
@@ -154,11 +151,10 @@ export const Tree = (props) => {
|
|
|
154
151
|
}, [flatNodesList]);
|
|
155
152
|
React.useEffect(() => {
|
|
156
153
|
setTimeout(() => {
|
|
157
|
-
var _a;
|
|
158
154
|
if (scrollToIndex !== undefined) {
|
|
159
155
|
const nodeId = flatNodesListRef.current[scrollToIndex].nodeProps.nodeId;
|
|
160
|
-
const nodeElement =
|
|
161
|
-
nodeElement
|
|
156
|
+
const nodeElement = treeRef.current?.ownerDocument.querySelector(`#${nodeId}`);
|
|
157
|
+
nodeElement?.focus();
|
|
162
158
|
// Need to reset that if navigating with mouse and keyboard,
|
|
163
159
|
// e.g. pressing arrow left to go to parent node and then with mouse
|
|
164
160
|
// clicking some other child node and then pressing arrow left
|
|
@@ -167,13 +163,12 @@ export const Tree = (props) => {
|
|
|
167
163
|
});
|
|
168
164
|
}, [scrollToIndex]);
|
|
169
165
|
const handleFocus = (event) => {
|
|
170
|
-
|
|
171
|
-
if ((_a = treeRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) {
|
|
166
|
+
if (treeRef.current?.contains(event.relatedTarget)) {
|
|
172
167
|
return;
|
|
173
168
|
}
|
|
174
169
|
const items = getFocusableNodes();
|
|
175
170
|
if (items.length > 0) {
|
|
176
|
-
|
|
171
|
+
items[focusedIndex.current]?.focus();
|
|
177
172
|
}
|
|
178
173
|
};
|
|
179
174
|
return (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualizedTree, { flatNodesList: flatNodesList, itemRenderer: itemRenderer, scrollToIndex: scrollToIndex, onFocus: handleFocus, onKeyDown: handleKeyDown, ref: treeRef, className: className, style: style, ...rest })) : (React.createElement(TreeElement, { onKeyDown: handleKeyDown, onFocus: handleFocus, className: className, style: style, ref: treeRef, ...rest }, flatNodesList.map((_, i) => itemRenderer(i))))));
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { getFocusableElements, Box } from '../utils/index.js';
|
|
7
|
-
import '@itwin/itwinui-css/css/tree.css';
|
|
8
7
|
import cx from 'classnames';
|
|
9
8
|
import { TreeNodeExpander } from './TreeNodeExpander.js';
|
|
10
9
|
import { useTreeContext } from './TreeContext.js';
|
|
@@ -33,11 +32,10 @@ export const TreeNode = (props) => {
|
|
|
33
32
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
34
33
|
const nodeRef = React.useRef(null);
|
|
35
34
|
const onKeyDown = (event) => {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f;
|
|
37
35
|
if (event.altKey) {
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
|
-
const isNodeFocused = nodeRef.current ===
|
|
38
|
+
const isNodeFocused = nodeRef.current === nodeRef.current?.ownerDocument.activeElement;
|
|
41
39
|
switch (event.key) {
|
|
42
40
|
case 'ArrowLeft': {
|
|
43
41
|
event.preventDefault();
|
|
@@ -47,19 +45,19 @@ export const TreeNode = (props) => {
|
|
|
47
45
|
break;
|
|
48
46
|
}
|
|
49
47
|
if (parentNodeId) {
|
|
50
|
-
scrollToParent
|
|
48
|
+
scrollToParent?.();
|
|
51
49
|
break;
|
|
52
50
|
}
|
|
53
51
|
// If it is top level node (doesn't have parent node), then do nothing.
|
|
54
52
|
break;
|
|
55
53
|
}
|
|
56
54
|
const focusableElements = getFocusableElements(nodeRef.current);
|
|
57
|
-
const currentIndex = focusableElements.indexOf(
|
|
55
|
+
const currentIndex = focusableElements.indexOf(nodeRef.current?.ownerDocument.activeElement);
|
|
58
56
|
if (currentIndex === 0) {
|
|
59
|
-
|
|
57
|
+
nodeRef.current?.focus();
|
|
60
58
|
}
|
|
61
59
|
else {
|
|
62
|
-
|
|
60
|
+
focusableElements[currentIndex - 1]?.focus();
|
|
63
61
|
}
|
|
64
62
|
break;
|
|
65
63
|
}
|
|
@@ -71,10 +69,10 @@ export const TreeNode = (props) => {
|
|
|
71
69
|
onExpanded(nodeId, true);
|
|
72
70
|
break;
|
|
73
71
|
}
|
|
74
|
-
|
|
72
|
+
focusableElements[0]?.focus();
|
|
75
73
|
break;
|
|
76
74
|
}
|
|
77
|
-
const currentIndex = focusableElements.indexOf(
|
|
75
|
+
const currentIndex = focusableElements.indexOf(nodeRef.current?.ownerDocument.activeElement);
|
|
78
76
|
if (currentIndex < focusableElements.length - 1) {
|
|
79
77
|
focusableElements[currentIndex + 1].focus();
|
|
80
78
|
break;
|
|
@@ -90,7 +88,7 @@ export const TreeNode = (props) => {
|
|
|
90
88
|
}
|
|
91
89
|
event.preventDefault();
|
|
92
90
|
if (!isDisabled) {
|
|
93
|
-
onSelected
|
|
91
|
+
onSelected?.(nodeId, !isSelected);
|
|
94
92
|
}
|
|
95
93
|
break;
|
|
96
94
|
}
|
|
@@ -112,7 +110,7 @@ export const TreeNode = (props) => {
|
|
|
112
110
|
React.createElement(Box, { className: cx('iui-tree-node', {
|
|
113
111
|
'iui-active': isSelected,
|
|
114
112
|
'iui-disabled': isDisabled,
|
|
115
|
-
}), style: { '--level': nodeDepth }, onClick: () => !isDisabled &&
|
|
113
|
+
}), style: { '--level': nodeDepth }, onClick: () => !isDisabled && onSelected?.(nodeId, !isSelected) },
|
|
116
114
|
checkbox && (React.createElement(Box, { className: 'iui-tree-node-checkbox' }, React.isValidElement(checkbox)
|
|
117
115
|
? React.cloneElement(checkbox, {
|
|
118
116
|
tabIndex: isFocused ? 0 : -1,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
2
|
import type { IconButtonProps } from '../Buttons/IconButton/IconButton.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/tree.css';
|
|
4
3
|
declare type TreeNodeExpanderProps = {
|
|
5
4
|
isExpanded?: boolean;
|
|
6
5
|
} & IconButtonProps;
|