@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 { getBoundedValue, useEventListener, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/slider.css';
|
|
9
8
|
import { Track } from './Track.js';
|
|
10
9
|
import { Thumb } from './Thumb.js';
|
|
11
10
|
const getPercentageOfRectangle = (rect, pointerX, pointerY, orientation) => {
|
|
@@ -43,10 +42,9 @@ const formatNumberValue = (value, step, numDecimals) => {
|
|
|
43
42
|
* Focus specified thumb on Slider control
|
|
44
43
|
*/
|
|
45
44
|
const focusThumb = (sliderContainer, activeIndex) => {
|
|
46
|
-
var _a;
|
|
47
45
|
const doc = sliderContainer.ownerDocument;
|
|
48
46
|
if (!sliderContainer.contains(doc.activeElement) ||
|
|
49
|
-
Number(
|
|
47
|
+
Number(doc.activeElement?.getAttribute('data-index')) !== activeIndex) {
|
|
50
48
|
const thumbToFocus = sliderContainer.querySelector(`[data-index="${activeIndex}"]`);
|
|
51
49
|
thumbToFocus && thumbToFocus.focus();
|
|
52
50
|
}
|
|
@@ -60,19 +58,18 @@ const focusThumb = (sliderContainer, activeIndex) => {
|
|
|
60
58
|
* thumbMode='allow-crossing' />
|
|
61
59
|
*/
|
|
62
60
|
export const Slider = React.forwardRef((props, ref) => {
|
|
63
|
-
var _a, _b;
|
|
64
61
|
const { min = 0, max = 100, values, step = 1, setFocus = false, tooltipProps, disabled = false, tickLabels, minLabel, maxLabel, trackDisplayMode = 'auto', thumbMode = 'inhibit-crossing', onChange, onUpdate, thumbProps, className, railContainerProps, orientation = 'horizontal', ...rest } = props;
|
|
65
62
|
const [currentValues, setCurrentValues] = React.useState(values);
|
|
66
63
|
React.useEffect(() => {
|
|
67
64
|
setCurrentValues(values);
|
|
68
65
|
}, [values]);
|
|
69
|
-
const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel
|
|
66
|
+
const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel ?? min.toString());
|
|
70
67
|
React.useEffect(() => {
|
|
71
|
-
setMinValueLabel(minLabel
|
|
68
|
+
setMinValueLabel(minLabel ?? min.toString());
|
|
72
69
|
}, [minLabel, min]);
|
|
73
|
-
const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel
|
|
70
|
+
const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel ?? max.toString());
|
|
74
71
|
React.useEffect(() => {
|
|
75
|
-
setMaxValueLabel(maxLabel
|
|
72
|
+
setMaxValueLabel(maxLabel ?? max.toString());
|
|
76
73
|
}, [maxLabel, max]);
|
|
77
74
|
const [trackDisplay, setTrackDisplay] = React.useState(() => getDefaultTrackDisplay(trackDisplayMode, currentValues));
|
|
78
75
|
React.useEffect(() => {
|
|
@@ -112,11 +109,11 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
112
109
|
newValues[activeThumbIndex] = pointerValue;
|
|
113
110
|
setCurrentValues(newValues);
|
|
114
111
|
'onChange' === callbackType
|
|
115
|
-
? onChange
|
|
116
|
-
: onUpdate
|
|
112
|
+
? onChange?.(newValues)
|
|
113
|
+
: onUpdate?.(newValues);
|
|
117
114
|
}
|
|
118
115
|
else if ('onChange' === callbackType) {
|
|
119
|
-
onChange
|
|
116
|
+
onChange?.(currentValues);
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
}, [
|
|
@@ -144,12 +141,12 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
144
141
|
return;
|
|
145
142
|
}
|
|
146
143
|
if (keyboardReleased) {
|
|
147
|
-
onChange
|
|
144
|
+
onChange?.(currentValues); // currentValues since key up should not change value but only stop continuous value selection
|
|
148
145
|
}
|
|
149
146
|
else {
|
|
150
147
|
const newValues = [...currentValues]; // newValues since key down should change value
|
|
151
148
|
newValues[index] = value;
|
|
152
|
-
onUpdate
|
|
149
|
+
onUpdate?.(newValues);
|
|
153
150
|
setCurrentValues(newValues);
|
|
154
151
|
}
|
|
155
152
|
}, [currentValues, onUpdate, onChange]);
|
|
@@ -179,8 +176,8 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
179
176
|
const newValues = [...currentValues];
|
|
180
177
|
newValues[closestValueIndex] = pointerValue;
|
|
181
178
|
setCurrentValues(newValues);
|
|
182
|
-
onChange
|
|
183
|
-
onUpdate
|
|
179
|
+
onChange?.(newValues);
|
|
180
|
+
onUpdate?.(newValues);
|
|
184
181
|
focusThumb(containerRef.current, closestValueIndex);
|
|
185
182
|
event.preventDefault();
|
|
186
183
|
event.stopPropagation();
|
|
@@ -195,8 +192,8 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
195
192
|
onUpdate,
|
|
196
193
|
orientation,
|
|
197
194
|
]);
|
|
198
|
-
useEventListener('pointermove', handlePointerMove,
|
|
199
|
-
useEventListener('pointerup', handlePointerUp,
|
|
195
|
+
useEventListener('pointermove', handlePointerMove, containerRef.current?.ownerDocument);
|
|
196
|
+
useEventListener('pointerup', handlePointerUp, containerRef.current?.ownerDocument);
|
|
200
197
|
const tickMarkArea = React.useMemo(() => {
|
|
201
198
|
if (!tickLabels) {
|
|
202
199
|
return null;
|
|
@@ -224,10 +221,9 @@ export const Slider = React.forwardRef((props, ref) => {
|
|
|
224
221
|
}), onPointerDown: handlePointerDownOnSlider, ...railContainerProps },
|
|
225
222
|
React.createElement(Box, { className: 'iui-slider-rail' }),
|
|
226
223
|
currentValues.map((thumbValue, index) => {
|
|
227
|
-
var _a;
|
|
228
224
|
const [minVal, maxVal] = getAllowableThumbRange(index);
|
|
229
|
-
const thisThumbProps = thumbProps
|
|
230
|
-
return (React.createElement(Thumb, { key:
|
|
225
|
+
const thisThumbProps = thumbProps?.(index);
|
|
226
|
+
return (React.createElement(Thumb, { key: thisThumbProps?.id ?? index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max, orientation: orientation }));
|
|
231
227
|
}),
|
|
232
228
|
React.createElement(Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues, orientation: orientation }),
|
|
233
229
|
tickMarkArea),
|
package/esm/core/Slider/Thumb.js
CHANGED
|
@@ -57,7 +57,7 @@ export const Thumb = (props) => {
|
|
|
57
57
|
return (100.0 * (adjustedValue - sliderMin)) / (sliderMax - sliderMin);
|
|
58
58
|
}, [adjustedValue, sliderMax, sliderMin]);
|
|
59
59
|
const { style, className, ...rest } = thumbProps || {};
|
|
60
|
-
return (React.createElement(Tooltip, { placement: 'top', trigger:
|
|
60
|
+
return (React.createElement(Tooltip, { placement: 'top', trigger: tooltipProps?.visible == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
|
|
61
61
|
React.createElement(Box, { ...rest, "data-index": index, ref: thumbRef, style: {
|
|
62
62
|
...style,
|
|
63
63
|
...(orientation === 'horizontal'
|
package/esm/core/Slider/Track.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import { Box } from '../utils/index.js';
|
|
6
7
|
function shouldDisplaySegment(segmentIndex, mode) {
|
|
7
8
|
if ('odd-segments' === mode && 0 === (segmentIndex + 1) % 2) {
|
|
8
9
|
return true;
|
|
@@ -49,7 +50,7 @@ export const Track = (props) => {
|
|
|
49
50
|
? 100.0 -
|
|
50
51
|
(100.0 * (segment.right - sliderMin)) / (sliderMax - sliderMin)
|
|
51
52
|
: 100;
|
|
52
|
-
return (React.createElement(React.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (React.createElement(
|
|
53
|
+
return (React.createElement(React.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (React.createElement(Box, { className: 'iui-slider-track', style: {
|
|
53
54
|
...(orientation === 'horizontal'
|
|
54
55
|
? {
|
|
55
56
|
left: `${lowPercent}%`,
|
|
@@ -11,7 +11,7 @@ import { Box, StatusIconMap } from '../utils/index.js';
|
|
|
11
11
|
* <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
|
|
12
12
|
*/
|
|
13
13
|
export const StatusMessage = ({ startIcon: userStartIcon, children, status, }) => {
|
|
14
|
-
const icon = userStartIcon
|
|
14
|
+
const icon = userStartIcon ?? (status && StatusIconMap[status]());
|
|
15
15
|
return (React.createElement(React.Fragment, null,
|
|
16
16
|
!!icon ? (React.createElement(Box, { as: 'span', className: 'iui-input-icon', "aria-hidden": true }, icon)) : null,
|
|
17
17
|
React.createElement(Box, { className: 'iui-message' }, children)));
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Box } from '../utils/index.js';
|
|
7
|
-
import '@itwin/itwinui-css/css/stepper.css';
|
|
8
7
|
import { StepperStep } from './StepperStep.js';
|
|
9
8
|
const defaultStepperLocalization = {
|
|
10
9
|
stepsCountLabel: (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}:`,
|
|
11
10
|
};
|
|
12
11
|
export const Stepper = React.forwardRef((props, ref) => {
|
|
13
12
|
const { currentStep, steps, type = 'default', localization = defaultStepperLocalization, onStepClick, ...rest } = props;
|
|
14
|
-
const boundedCurrentStep = Math.min(Math.max(0, currentStep
|
|
13
|
+
const boundedCurrentStep = Math.min(Math.max(0, currentStep ?? 0), steps.length - 1);
|
|
15
14
|
return (React.createElement(Box, { className: 'iui-stepper', ref: ref, ...rest },
|
|
16
15
|
React.createElement("ol", null, steps.map((s, index) => (React.createElement(StepperStep, { key: index, index: index, title: type === 'long' ? '' : s.name, currentStepNumber: boundedCurrentStep, totalSteps: steps.length, type: type, onClick: onStepClick, description: s.description })))),
|
|
17
16
|
type === 'long' && (React.createElement(Box, { className: 'iui-stepper-steps-label' },
|
|
@@ -13,7 +13,7 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
|
|
|
13
13
|
const isClickable = isPast && !!onClick;
|
|
14
14
|
const onCompletedClick = () => {
|
|
15
15
|
if (isClickable) {
|
|
16
|
-
onClick
|
|
16
|
+
onClick?.(index);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const onKeyDown = (e) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
|
-
import '@itwin/itwinui-css/css/workflow-diagram.css';
|
|
3
2
|
import type { StepperProps } from './Stepper.js';
|
|
4
3
|
declare type WorkflowDiagramProps = Pick<StepperProps, 'steps'>;
|
|
5
4
|
export declare const WorkflowDiagram: PolymorphicForwardRefComponent<"ol", WorkflowDiagramProps>;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Box } from '../utils/index.js';
|
|
7
|
-
import '@itwin/itwinui-css/css/workflow-diagram.css';
|
|
8
7
|
import { WorkflowDiagramStep } from './WorkflowDiagramStep.js';
|
|
9
8
|
export const WorkflowDiagram = React.forwardRef(
|
|
10
9
|
// TODO: Remove this ref cast. ref and rest props should be applied on the same element
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useSafeContext, supportsHas, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/surface.css';
|
|
9
8
|
/**
|
|
10
9
|
* Helper function that returns one of the preset surface elevation values.
|
|
11
10
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { CellProps, TableOptions, Row, TableState } from 'react-table';
|
|
3
3
|
import type { CommonProps } from '../utils/index.js';
|
|
4
|
-
import '@itwin/itwinui-css/css/table.css';
|
|
5
4
|
import type { TableFilterValue } from './filters/index.js';
|
|
6
5
|
export declare const tableResizeStartAction = "tableResizeStart";
|
|
7
6
|
export declare type TablePaginatorRendererProps = {
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -6,8 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { actions as TableActions, useFlexLayout, useFilters, useRowSelect, useSortBy, useTable, useExpanded, usePagination, useColumnOrder, useGlobalFilter, } from 'react-table';
|
|
8
8
|
import { ProgressRadial } from '../ProgressIndicators/index.js';
|
|
9
|
-
import { useGlobals, useResizeObserver, SvgSortDown, SvgSortUp, useIsomorphicLayoutEffect, } from '../utils/index.js';
|
|
10
|
-
import '@itwin/itwinui-css/css/table.css';
|
|
9
|
+
import { useGlobals, useResizeObserver, SvgSortDown, SvgSortUp, useIsomorphicLayoutEffect, Box, } from '../utils/index.js';
|
|
11
10
|
import { getCellStyle, getStickyStyle } from './utils.js';
|
|
12
11
|
import { TableRowMemoized } from './TableRowMemoized.js';
|
|
13
12
|
import { FilterToggle } from './filters/index.js';
|
|
@@ -26,7 +25,7 @@ let isDev = false;
|
|
|
26
25
|
try {
|
|
27
26
|
isDev = process.env.NODE_ENV !== 'production';
|
|
28
27
|
}
|
|
29
|
-
catch
|
|
28
|
+
catch { }
|
|
30
29
|
const flattenColumns = (columns) => {
|
|
31
30
|
const flatColumns = [];
|
|
32
31
|
columns.forEach((column) => {
|
|
@@ -111,11 +110,11 @@ export const Table = (props) => {
|
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
112
|
const ownerDoc = ownerDocument.current;
|
|
114
|
-
ownerDoc
|
|
115
|
-
ownerDoc
|
|
113
|
+
ownerDoc?.addEventListener('keydown', disableUserSelect);
|
|
114
|
+
ownerDoc?.addEventListener('keyup', enableUserSelect);
|
|
116
115
|
return () => {
|
|
117
|
-
ownerDoc
|
|
118
|
-
ownerDoc
|
|
116
|
+
ownerDoc?.removeEventListener('keydown', disableUserSelect);
|
|
117
|
+
ownerDoc?.removeEventListener('keyup', enableUserSelect);
|
|
119
118
|
};
|
|
120
119
|
}, [
|
|
121
120
|
isSelectable,
|
|
@@ -129,7 +128,7 @@ export const Table = (props) => {
|
|
|
129
128
|
const tableStateReducer = React.useCallback((newState, action, previousState, instance) => {
|
|
130
129
|
switch (action.type) {
|
|
131
130
|
case TableActions.toggleSortBy:
|
|
132
|
-
onSort
|
|
131
|
+
onSort?.(newState);
|
|
133
132
|
break;
|
|
134
133
|
case TableActions.setFilter:
|
|
135
134
|
currentFilter.current = onFilterHandler(newState, action, previousState, currentFilter.current, instance);
|
|
@@ -215,13 +214,13 @@ export const Table = (props) => {
|
|
|
215
214
|
return result;
|
|
216
215
|
}, {});
|
|
217
216
|
const areFiltersSet = allColumns.some((column) => column.filterValue != null && column.filterValue !== '') || !!globalFilterValue;
|
|
218
|
-
const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter;
|
|
217
|
+
const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter && !!column.Filter;
|
|
219
218
|
const showSortButton = (column) => data.length !== 0 && column.canSort;
|
|
220
219
|
const onRowClickHandler = React.useCallback((event, row) => {
|
|
221
|
-
const isDisabled = isRowDisabled
|
|
220
|
+
const isDisabled = isRowDisabled?.(row.original);
|
|
222
221
|
const ctrlPressed = event.ctrlKey || event.metaKey;
|
|
223
222
|
if (!isDisabled) {
|
|
224
|
-
onRowClick
|
|
223
|
+
onRowClick?.(event, row);
|
|
225
224
|
}
|
|
226
225
|
if (isSelectable &&
|
|
227
226
|
!isDisabled &&
|
|
@@ -262,7 +261,7 @@ export const Table = (props) => {
|
|
|
262
261
|
React.useEffect(() => {
|
|
263
262
|
if (previousFilter.current !== currentFilter.current) {
|
|
264
263
|
previousFilter.current = currentFilter.current;
|
|
265
|
-
onFilter
|
|
264
|
+
onFilter?.(currentFilter.current, state, instance.filteredRows);
|
|
266
265
|
}
|
|
267
266
|
}, [state, instance.filteredRows, onFilter]);
|
|
268
267
|
const lastPassedColumns = React.useRef([]);
|
|
@@ -336,7 +335,7 @@ export const Table = (props) => {
|
|
|
336
335
|
const getPreparedRow = React.useCallback((index) => {
|
|
337
336
|
const row = page[index];
|
|
338
337
|
prepareRow(row);
|
|
339
|
-
return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!
|
|
338
|
+
return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!isRowDisabled?.(row.original), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell, bodyRef: bodyRef.current, tableRowRef: enableVirtualization ? undefined : tableRowRef(row), density: density }));
|
|
340
339
|
}, [
|
|
341
340
|
page,
|
|
342
341
|
prepareRow,
|
|
@@ -380,8 +379,8 @@ export const Table = (props) => {
|
|
|
380
379
|
}, []);
|
|
381
380
|
const isHeaderDirectClick = React.useRef(false);
|
|
382
381
|
return (React.createElement(React.Fragment, null,
|
|
383
|
-
React.createElement(
|
|
384
|
-
ownerDocument.current = element
|
|
382
|
+
React.createElement(Box, { ref: (element) => {
|
|
383
|
+
ownerDocument.current = element?.ownerDocument;
|
|
385
384
|
if (isResizable) {
|
|
386
385
|
resizeRef(element);
|
|
387
386
|
}
|
|
@@ -399,14 +398,14 @@ export const Table = (props) => {
|
|
|
399
398
|
const headerGroupProps = headerGroup.getHeaderGroupProps({
|
|
400
399
|
className: 'iui-table-row',
|
|
401
400
|
});
|
|
402
|
-
return (React.createElement(
|
|
401
|
+
return (React.createElement(Box, { className: 'iui-table-header-wrapper', ref: headerRef, onScroll: () => {
|
|
403
402
|
if (headerRef.current && bodyRef.current) {
|
|
404
403
|
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
405
404
|
updateStickyState();
|
|
406
405
|
}
|
|
407
406
|
}, key: headerGroupProps.key },
|
|
408
|
-
React.createElement(
|
|
409
|
-
React.createElement(
|
|
407
|
+
React.createElement(Box, { className: 'iui-table-header' },
|
|
408
|
+
React.createElement(Box, { ...headerGroupProps }, headerGroup.headers.map((column, index) => {
|
|
410
409
|
const { onClick, ...restSortProps } = column.getSortByToggleProps();
|
|
411
410
|
const columnProps = column.getHeaderProps({
|
|
412
411
|
...restSortProps,
|
|
@@ -421,7 +420,7 @@ export const Table = (props) => {
|
|
|
421
420
|
flexWrap: 'unset',
|
|
422
421
|
},
|
|
423
422
|
});
|
|
424
|
-
return (React.createElement(
|
|
423
|
+
return (React.createElement(Box, { ...columnProps, ...column.getDragAndDropProps(), key: columnProps.key, title: undefined, ref: (el) => {
|
|
425
424
|
if (el) {
|
|
426
425
|
columnRefs.current[column.id] = el;
|
|
427
426
|
column.resizeWidth =
|
|
@@ -432,7 +431,7 @@ export const Table = (props) => {
|
|
|
432
431
|
}, onClick: (e) => {
|
|
433
432
|
// Prevents from triggering sort when resizing and mouse is released in the middle of header
|
|
434
433
|
if (isHeaderDirectClick.current) {
|
|
435
|
-
onClick
|
|
434
|
+
onClick?.(e);
|
|
436
435
|
isHeaderDirectClick.current = false;
|
|
437
436
|
}
|
|
438
437
|
}, tabIndex: showSortButton(column) ? 0 : undefined, onKeyDown: (e) => {
|
|
@@ -442,24 +441,24 @@ export const Table = (props) => {
|
|
|
442
441
|
} },
|
|
443
442
|
column.render('Header'),
|
|
444
443
|
(showFilterButton(column) ||
|
|
445
|
-
showSortButton(column)) && (React.createElement(
|
|
444
|
+
showSortButton(column)) && (React.createElement(Box, { className: 'iui-table-header-actions-container' },
|
|
446
445
|
showFilterButton(column) && (React.createElement(FilterToggle, { column: column })),
|
|
447
|
-
showSortButton(column) && (React.createElement(
|
|
446
|
+
showSortButton(column) && (React.createElement(Box, { className: 'iui-table-cell-end-icon' }, column.isSortedDesc ||
|
|
448
447
|
(!column.isSorted && column.sortDescFirst) ? (React.createElement(SvgSortDown, { className: 'iui-table-sort', "aria-hidden": true })) : (React.createElement(SvgSortUp, { className: 'iui-table-sort', "aria-hidden": true })))))),
|
|
449
448
|
isResizable &&
|
|
450
449
|
column.isResizerVisible &&
|
|
451
450
|
(index !== headerGroup.headers.length - 1 ||
|
|
452
|
-
columnResizeMode === 'expand') && (React.createElement(
|
|
453
|
-
React.createElement(
|
|
451
|
+
columnResizeMode === 'expand') && (React.createElement(Box, { ...column.getResizerProps(), className: 'iui-table-resizer' },
|
|
452
|
+
React.createElement(Box, { className: 'iui-table-resizer-bar' }))),
|
|
454
453
|
enableColumnReordering &&
|
|
455
|
-
!column.disableReordering && (React.createElement(
|
|
454
|
+
!column.disableReordering && (React.createElement(Box, { className: 'iui-table-reorder-bar' })),
|
|
456
455
|
column.sticky === 'left' &&
|
|
457
|
-
state.sticky.isScrolledToRight && (React.createElement(
|
|
456
|
+
state.sticky.isScrolledToRight && (React.createElement(Box, { className: 'iui-table-cell-shadow-right' })),
|
|
458
457
|
column.sticky === 'right' &&
|
|
459
|
-
state.sticky.isScrolledToLeft && (React.createElement(
|
|
458
|
+
state.sticky.isScrolledToLeft && (React.createElement(Box, { className: 'iui-table-cell-shadow-left' }))));
|
|
460
459
|
})))));
|
|
461
460
|
}),
|
|
462
|
-
React.createElement(
|
|
461
|
+
React.createElement(Box, { ...getTableBodyProps({
|
|
463
462
|
className: cx('iui-table-body', {
|
|
464
463
|
'iui-zebra-striping': styleType === 'zebra-rows',
|
|
465
464
|
}),
|
|
@@ -471,17 +470,17 @@ export const Table = (props) => {
|
|
|
471
470
|
}
|
|
472
471
|
}, tabIndex: -1, "aria-multiselectable": (isSelectable && selectionMode === 'multi') || undefined },
|
|
473
472
|
data.length !== 0 && (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualScroll, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer, scrollToIndex: scrollToIndex })) : (page.map((_, index) => getPreparedRow(index))))),
|
|
474
|
-
isLoading && data.length === 0 && (React.createElement(
|
|
473
|
+
isLoading && data.length === 0 && (React.createElement(Box, { className: 'iui-table-empty' },
|
|
475
474
|
React.createElement(ProgressRadial, { indeterminate: true }))),
|
|
476
|
-
isLoading && data.length !== 0 && (React.createElement(
|
|
477
|
-
React.createElement(
|
|
475
|
+
isLoading && data.length !== 0 && (React.createElement(Box, { className: 'iui-table-row' },
|
|
476
|
+
React.createElement(Box, { className: 'iui-table-cell', style: { justifyContent: 'center' } },
|
|
478
477
|
React.createElement(ProgressRadial, { indeterminate: true, size: 'small', style: { float: 'none', marginLeft: 0 } })))),
|
|
479
|
-
!isLoading && data.length === 0 && !areFiltersSet && (React.createElement(
|
|
478
|
+
!isLoading && data.length === 0 && !areFiltersSet && (React.createElement(Box, { className: 'iui-table-empty' },
|
|
480
479
|
React.createElement("div", null, emptyTableContent))),
|
|
481
480
|
!isLoading &&
|
|
482
481
|
(data.length === 0 || rows.length === 0) &&
|
|
483
|
-
areFiltersSet && (React.createElement(
|
|
484
|
-
React.createElement("div", null, emptyFilteredTableContent)))),
|
|
485
|
-
paginatorRenderer(paginatorRendererProps))));
|
|
482
|
+
areFiltersSet && (React.createElement(Box, { className: 'iui-table-empty' },
|
|
483
|
+
React.createElement("div", null, emptyFilteredTableContent)))),
|
|
484
|
+
paginatorRenderer?.(paginatorRendererProps))));
|
|
486
485
|
};
|
|
487
486
|
export default Table;
|
|
@@ -8,6 +8,7 @@ import { getCellStyle, getStickyStyle } from './utils.js';
|
|
|
8
8
|
import { SubRowExpander } from './SubRowExpander.js';
|
|
9
9
|
import { SELECTION_CELL_ID } from './columns/index.js';
|
|
10
10
|
import { DefaultCell } from './cells/index.js';
|
|
11
|
+
import { Box } from '../utils/index.js';
|
|
11
12
|
export const TableCell = (props) => {
|
|
12
13
|
const { cell, cellIndex, isDisabled, tableHasSubRows, tableInstance, expanderCell, density, } = props;
|
|
13
14
|
const hasSubRowExpander = cellIndex ===
|
|
@@ -56,9 +57,9 @@ export const TableCell = (props) => {
|
|
|
56
57
|
children: (React.createElement(React.Fragment, null,
|
|
57
58
|
cellContent,
|
|
58
59
|
cell.column.sticky === 'left' &&
|
|
59
|
-
tableInstance.state.sticky.isScrolledToRight && (React.createElement(
|
|
60
|
+
tableInstance.state.sticky.isScrolledToRight && (React.createElement(Box, { className: 'iui-table-cell-shadow-right' })),
|
|
60
61
|
cell.column.sticky === 'right' &&
|
|
61
|
-
tableInstance.state.sticky.isScrolledToLeft && (React.createElement(
|
|
62
|
+
tableInstance.state.sticky.isScrolledToLeft && (React.createElement(Box, { className: 'iui-table-cell-shadow-left' })))),
|
|
62
63
|
};
|
|
63
64
|
return (React.createElement(React.Fragment, null, cell.column.cellRenderer ? (cell.column.cellRenderer({
|
|
64
65
|
...cellRendererProps,
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
|
-
import '@itwin/itwinui-css/css/table.css';
|
|
8
7
|
import { IconButton, Button, DropdownButton } from '../Buttons/index.js';
|
|
9
8
|
import { ProgressRadial } from '../ProgressIndicators/index.js';
|
|
10
9
|
import { MenuItem } from '../Menu/index.js';
|
|
11
|
-
import { getBoundedValue, useGlobals, useOverflow, useContainerWidth, SvgChevronLeft, SvgChevronRight, } from '../utils/index.js';
|
|
10
|
+
import { getBoundedValue, useGlobals, useOverflow, useContainerWidth, SvgChevronLeft, SvgChevronRight, Box, } from '../utils/index.js';
|
|
12
11
|
const defaultLocalization = {
|
|
13
12
|
pageSizeLabel: (size) => `${size} per page`,
|
|
14
13
|
rangeLabel: (startIndex, endIndex, totalRows, isLoading) => isLoading
|
|
@@ -41,18 +40,17 @@ export const TablePaginator = (props) => {
|
|
|
41
40
|
const needFocus = React.useRef(false);
|
|
42
41
|
const isMounted = React.useRef(false);
|
|
43
42
|
React.useEffect(() => {
|
|
44
|
-
var _a, _b;
|
|
45
43
|
// Checking `isMounted.current` prevents from focusing on initial load.
|
|
46
44
|
// Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
|
|
47
45
|
if (isMounted.current && needFocus.current) {
|
|
48
|
-
const buttonToFocus = Array.from(
|
|
49
|
-
buttonToFocus
|
|
46
|
+
const buttonToFocus = Array.from(pageListRef.current?.querySelectorAll('.iui-table-paginator-page-button') ?? []).find((el) => el.textContent?.trim() === (focusedIndex + 1).toString());
|
|
47
|
+
buttonToFocus?.focus();
|
|
50
48
|
needFocus.current = false;
|
|
51
49
|
}
|
|
52
50
|
isMounted.current = true;
|
|
53
51
|
}, [focusedIndex]);
|
|
54
52
|
const buttonSize = size != 'default' ? 'small' : undefined;
|
|
55
|
-
const pageButton = React.useCallback((index, tabIndex = index === focusedIndex ? 0 : -1) => (React.createElement(
|
|
53
|
+
const pageButton = React.useCallback((index, tabIndex = index === focusedIndex ? 0 : -1) => (React.createElement(Box, { as: 'button', key: index, type: 'button', className: cx('iui-table-paginator-page-button', {
|
|
56
54
|
'iui-table-paginator-page-button-small': buttonSize === 'small',
|
|
57
55
|
}), "data-iui-active": index === currentPage, onClick: () => onPageChange(index), "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)), [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
58
56
|
const totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
@@ -113,19 +111,19 @@ export const TablePaginator = (props) => {
|
|
|
113
111
|
const hasNoRows = totalPagesCount === 0;
|
|
114
112
|
const showPagesList = totalPagesCount > 1 || isLoading;
|
|
115
113
|
const showPageSizeList = pageSizeList && !!onPageSizeChange && !!totalRowsCount;
|
|
116
|
-
const ellipsis = (React.createElement(
|
|
114
|
+
const ellipsis = (React.createElement(Box, { as: 'span', className: cx('iui-table-paginator-ellipsis', {
|
|
117
115
|
'iui-table-paginator-ellipsis-small': size === 'small',
|
|
118
116
|
}) }, "\u2026"));
|
|
119
117
|
const noRowsContent = (React.createElement(React.Fragment, null, isLoading ? (React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })) : (React.createElement(Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
|
|
120
118
|
if (!showPagesList && !showPageSizeList) {
|
|
121
119
|
return null;
|
|
122
120
|
}
|
|
123
|
-
return (React.createElement(
|
|
124
|
-
React.createElement(
|
|
125
|
-
showPagesList && (React.createElement(
|
|
121
|
+
return (React.createElement(Box, { className: cx('iui-table-paginator', className), ref: paginatorResizeRef, ...rest },
|
|
122
|
+
React.createElement(Box, { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null, localization.rowsSelectedLabel(totalSelectedRowsCount)))),
|
|
123
|
+
showPagesList && (React.createElement(Box, { className: 'iui-center', ref: overflowRef },
|
|
126
124
|
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: () => onPageChange(currentPage - 1), size: buttonSize, "aria-label": localization.previousPage },
|
|
127
125
|
React.createElement(SvgChevronLeft, null)),
|
|
128
|
-
React.createElement(
|
|
126
|
+
React.createElement(Box, { as: 'span', className: 'iui-table-paginator-pages-group', onKeyDown: onKeyDown, ref: pageListRef }, (() => {
|
|
129
127
|
if (hasNoRows) {
|
|
130
128
|
return noRowsContent;
|
|
131
129
|
}
|
|
@@ -146,9 +144,9 @@ export const TablePaginator = (props) => {
|
|
|
146
144
|
})()),
|
|
147
145
|
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === totalPagesCount - 1 || hasNoRows, onClick: () => onPageChange(currentPage + 1), size: buttonSize, "aria-label": localization.nextPage },
|
|
148
146
|
React.createElement(SvgChevronRight, null)))),
|
|
149
|
-
React.createElement(
|
|
147
|
+
React.createElement(Box, { className: 'iui-right' }, showPageSizeList && (React.createElement(React.Fragment, null,
|
|
150
148
|
localization.rowsPerPageLabel !== null &&
|
|
151
|
-
paginatorWidth >= 1024 && (React.createElement(
|
|
149
|
+
paginatorWidth >= 1024 && (React.createElement(Box, { as: 'span', className: 'iui-table-paginator-page-size-label' }, localization.rowsPerPageLabel)),
|
|
152
150
|
React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: (close) => pageSizeList.map((size) => (React.createElement(MenuItem, { key: size, isSelected: size === pageSize, onClick: () => {
|
|
153
151
|
close();
|
|
154
152
|
onPageSizeChange(size);
|