@itwin/itwinui-react 2.0.0-dev.2 → 2.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/cjs/core/Alert/Alert.js +8 -30
- package/cjs/core/Avatar/Avatar.js +10 -33
- package/cjs/core/AvatarGroup/AvatarGroup.js +18 -43
- package/cjs/core/Backdrop/Backdrop.js +6 -28
- package/cjs/core/Badge/Badge.js +13 -31
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +14 -40
- package/cjs/core/ButtonGroup/ButtonGroup.js +10 -32
- package/cjs/core/Buttons/Button/Button.js +6 -28
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +14 -36
- package/cjs/core/Buttons/IconButton/IconButton.js +6 -28
- package/cjs/core/Buttons/IdeasButton/IdeasButton.js +6 -28
- package/cjs/core/Buttons/SplitButton/SplitButton.js +14 -36
- package/cjs/core/Carousel/Carousel.js +38 -63
- package/cjs/core/Carousel/CarouselContext.js +1 -1
- package/cjs/core/Carousel/CarouselDot.js +6 -28
- package/cjs/core/Carousel/CarouselDotsList.js +33 -60
- package/cjs/core/Carousel/CarouselNavigation.js +22 -44
- package/cjs/core/Carousel/CarouselSlide.js +12 -34
- package/cjs/core/Carousel/CarouselSlider.js +26 -51
- package/cjs/core/Checkbox/Checkbox.js +18 -42
- package/cjs/core/ColorPicker/ColorBuilder.js +51 -73
- package/cjs/core/ColorPicker/ColorInputPanel.js +64 -88
- package/cjs/core/ColorPicker/ColorPalette.js +26 -50
- package/cjs/core/ColorPicker/ColorPicker.js +25 -49
- package/cjs/core/ColorPicker/ColorPickerContext.js +3 -3
- package/cjs/core/ColorPicker/ColorSwatch.js +13 -34
- package/cjs/core/ComboBox/ComboBox.js +67 -93
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxDropdown.js +13 -36
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +12 -34
- package/cjs/core/ComboBox/ComboBoxInput.js +28 -50
- package/cjs/core/ComboBox/ComboBoxInputContainer.js +9 -31
- package/cjs/core/ComboBox/ComboBoxMenu.js +35 -60
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +11 -33
- package/cjs/core/ComboBox/helpers.js +11 -19
- package/cjs/core/DatePicker/DatePicker.js +87 -111
- package/cjs/core/Dialog/Dialog.js +28 -48
- package/cjs/core/Dialog/DialogBackdrop.js +16 -35
- package/cjs/core/Dialog/DialogButtonBar.js +6 -28
- package/cjs/core/Dialog/DialogContent.js +6 -28
- package/cjs/core/Dialog/DialogContext.js +2 -2
- package/cjs/core/Dialog/DialogDragContext.js +6 -15
- package/cjs/core/Dialog/DialogMain.js +52 -59
- package/cjs/core/Dialog/DialogTitleBar.js +14 -36
- package/cjs/core/Dialog/DialogTitleBarTitle.js +6 -28
- package/cjs/core/DropdownMenu/DropdownMenu.js +14 -36
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +12 -34
- package/cjs/core/Fieldset/Fieldset.js +9 -33
- package/cjs/core/FileUpload/FileUpload.js +13 -35
- package/cjs/core/FileUpload/FileUploadTemplate.js +4 -4
- package/cjs/core/Footer/Footer.js +21 -49
- package/cjs/core/Footer/FooterItem.js +6 -28
- package/cjs/core/Footer/FooterList.js +6 -28
- package/cjs/core/Footer/FooterSeparator.js +6 -28
- package/cjs/core/Header/Header.js +10 -32
- package/cjs/core/Header/HeaderBasicButton.js +6 -28
- package/cjs/core/Header/HeaderBreadcrumbs.js +9 -39
- package/cjs/core/Header/HeaderButton.js +22 -36
- package/cjs/core/Header/HeaderDropdownButton.js +14 -36
- package/cjs/core/Header/HeaderLogo.js +7 -29
- package/cjs/core/Header/HeaderSplitButton.js +13 -35
- package/cjs/core/InformationPanel/InformationPanel.js +15 -37
- package/cjs/core/InformationPanel/InformationPanelBody.js +6 -28
- package/cjs/core/InformationPanel/InformationPanelContent.js +6 -28
- package/cjs/core/InformationPanel/InformationPanelHeader.js +7 -29
- package/cjs/core/InformationPanel/InformationPanelWrapper.js +6 -28
- package/cjs/core/Input/Input.js +9 -31
- package/cjs/core/InputGroup/InputGroup.js +6 -28
- package/cjs/core/Label/Label.js +7 -29
- package/cjs/core/LabeledInput/LabeledInput.js +7 -29
- package/cjs/core/LabeledSelect/LabeledSelect.js +7 -29
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +7 -29
- package/cjs/core/Menu/Menu.js +18 -40
- package/cjs/core/Menu/MenuDivider.js +6 -28
- package/cjs/core/Menu/MenuExtraContent.js +6 -28
- package/cjs/core/Menu/MenuItem.js +17 -39
- package/cjs/core/Menu/MenuItemSkeleton.js +11 -30
- package/cjs/core/Modal/Modal.js +12 -30
- package/cjs/core/Modal/ModalButtonBar.js +1 -1
- package/cjs/core/Modal/ModalContent.js +1 -1
- package/cjs/core/{ErrorPage → NonIdealState}/ErrorPage.d.ts +5 -1
- package/cjs/core/NonIdealState/ErrorPage.js +144 -0
- package/cjs/core/NonIdealState/NonIdealState.d.ts +46 -0
- package/cjs/core/NonIdealState/NonIdealState.js +32 -0
- package/{esm/core/ErrorPage → cjs/core/NonIdealState}/index.d.ts +3 -1
- package/cjs/core/{ErrorPage → NonIdealState}/index.js +4 -2
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +11 -34
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +13 -37
- package/cjs/core/Radio/Radio.js +10 -33
- package/cjs/core/RadioTiles/RadioTile.js +9 -31
- package/cjs/core/RadioTiles/RadioTileGroup.js +6 -28
- package/cjs/core/Select/Select.js +59 -72
- package/cjs/core/Select/SelectTag.js +6 -28
- package/cjs/core/SideNavigation/SideNavigation.js +14 -40
- package/cjs/core/SideNavigation/SidenavButton.js +8 -30
- package/cjs/core/SideNavigation/SidenavSubmenu.js +6 -28
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.js +6 -28
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +6 -28
- package/cjs/core/Slider/Slider.js +68 -96
- package/cjs/core/Slider/Thumb.js +20 -39
- package/cjs/core/Slider/Track.js +24 -44
- package/cjs/core/StatusMessage/StatusMessage.js +6 -7
- package/cjs/core/Stepper/Stepper.js +10 -34
- package/cjs/core/Stepper/StepperStep.js +15 -34
- package/cjs/core/Stepper/Wizard.js +6 -28
- package/cjs/core/Stepper/WorkflowDiagram.js +6 -28
- package/cjs/core/Stepper/WorkflowDiagramStep.js +6 -28
- package/cjs/core/Surface/Surface.js +11 -30
- package/cjs/core/Table/SubRowExpander.js +6 -6
- package/cjs/core/Table/Table.d.ts +19 -24
- package/cjs/core/Table/Table.js +189 -195
- package/cjs/core/Table/TableCell.js +29 -30
- package/cjs/core/Table/TablePaginator.js +52 -83
- package/cjs/core/Table/TableRowMemoized.d.ts +6 -10
- package/cjs/core/Table/TableRowMemoized.js +36 -60
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -4
- package/cjs/core/Table/actionHandlers/resizeHandler.js +13 -15
- package/cjs/core/Table/actionHandlers/selectHandler.js +35 -40
- package/cjs/core/Table/cells/DefaultCell.js +5 -27
- package/cjs/core/Table/cells/EditableCell.js +16 -40
- package/cjs/core/Table/columns/actionColumn.js +44 -62
- package/cjs/core/Table/columns/expanderColumn.d.ts +2 -5
- package/cjs/core/Table/columns/expanderColumn.js +12 -27
- package/cjs/core/Table/columns/selectionColumn.d.ts +2 -5
- package/cjs/core/Table/columns/selectionColumn.js +16 -37
- package/cjs/core/Table/filters/BaseFilter.js +6 -6
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +19 -41
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +20 -31
- package/cjs/core/Table/filters/FilterButtonBar.js +8 -19
- package/cjs/core/Table/filters/FilterToggle.js +15 -37
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +16 -29
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +11 -11
- package/cjs/core/Table/filters/customFilterFunctions.js +11 -13
- package/cjs/core/Table/filters/defaultFilterFunctions.js +62 -64
- package/cjs/core/Table/filters/tableFilters.js +7 -18
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +41 -53
- package/cjs/core/Table/hooks/useExpanderCell.js +17 -33
- package/cjs/core/Table/hooks/useResizeColumns.js +197 -205
- package/cjs/core/Table/hooks/useScrollToRow.js +11 -12
- package/cjs/core/Table/hooks/useSelectionCell.js +7 -18
- package/cjs/core/Table/hooks/useStickyColumns.js +28 -33
- package/cjs/core/Table/hooks/useSubRowFiltering.js +37 -57
- package/cjs/core/Table/hooks/useSubRowSelection.js +10 -12
- package/cjs/core/Table/utils.js +15 -26
- package/cjs/core/Tabs/Tab.js +6 -28
- package/cjs/core/Tabs/Tabs.js +45 -67
- package/cjs/core/Tag/Tag.js +8 -30
- package/cjs/core/Tag/TagContainer.js +9 -32
- package/cjs/core/Textarea/Textarea.js +9 -31
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/cjs/core/ThemeProvider/ThemeProvider.js +16 -37
- package/cjs/core/Tile/Tile.js +29 -58
- package/cjs/core/TimePicker/TimePicker.js +59 -97
- package/cjs/core/Toast/Toast.js +45 -65
- package/cjs/core/Toast/ToastWrapper.js +13 -24
- package/cjs/core/Toast/Toaster.js +87 -137
- package/cjs/core/Toast/index.js +2 -2
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +10 -32
- package/cjs/core/Tooltip/Tooltip.js +6 -28
- package/cjs/core/Tree/Tree.js +58 -80
- package/cjs/core/Tree/TreeContext.js +3 -3
- package/cjs/core/Tree/TreeNode.js +21 -43
- package/cjs/core/Tree/TreeNodeExpander.js +7 -29
- package/cjs/core/Typography/Anchor/Anchor.js +5 -28
- package/cjs/core/Typography/Blockquote/Blockquote.js +6 -28
- package/cjs/core/Typography/Body/Body.js +7 -29
- package/cjs/core/Typography/Code/Code.js +6 -28
- package/cjs/core/Typography/Headline/Headline.js +6 -28
- package/cjs/core/Typography/Kbd/Kbd.js +6 -28
- package/cjs/core/Typography/Leading/Leading.js +6 -28
- package/cjs/core/Typography/Small/Small.js +6 -28
- package/cjs/core/Typography/Subheading/Subheading.js +6 -28
- package/cjs/core/Typography/Text/Text.js +11 -34
- package/cjs/core/Typography/Title/Title.js +6 -28
- package/cjs/core/index.d.ts +2 -2
- package/cjs/core/index.js +6 -5
- package/cjs/core/utils/color/ColorValue.js +146 -156
- package/cjs/core/utils/components/FocusTrap.js +14 -14
- package/cjs/core/utils/components/InputContainer.js +12 -36
- package/cjs/core/utils/components/MiddleTextTruncation.js +15 -31
- package/cjs/core/utils/components/Popover.d.ts +1 -1
- package/cjs/core/utils/components/Popover.js +57 -60
- package/cjs/core/utils/components/Resizer.js +51 -51
- package/cjs/core/utils/components/VirtualScroll.js +72 -89
- package/cjs/core/utils/components/VisuallyHidden.js +6 -28
- package/cjs/core/utils/components/WithCSSTransition.d.ts +2 -2
- package/cjs/core/utils/components/WithCSSTransition.js +18 -40
- package/cjs/core/utils/functions/colors.js +7 -7
- package/cjs/core/utils/functions/dom.js +7 -8
- package/cjs/core/utils/functions/focusable.js +11 -15
- package/cjs/core/utils/functions/numbers.js +5 -6
- package/cjs/core/utils/functions/styles.js +3 -3
- package/cjs/core/utils/hooks/useContainerWidth.js +9 -13
- package/cjs/core/utils/hooks/useDragAndDrop.js +32 -33
- package/cjs/core/utils/hooks/useEventListener.js +7 -7
- package/cjs/core/utils/hooks/useIntersection.js +9 -12
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/cjs/core/utils/hooks/useLatestRef.js +4 -4
- package/cjs/core/utils/hooks/useMediaQuery.js +9 -12
- package/cjs/core/utils/hooks/useMergedRefs.js +6 -23
- package/cjs/core/utils/hooks/useOverflow.js +26 -33
- package/cjs/core/utils/hooks/useResizeObserver.js +6 -9
- package/cjs/core/utils/hooks/useSafeContext.js +4 -4
- package/cjs/core/utils/hooks/useTheme.js +18 -20
- package/cjs/core/utils/icons/StatusIconMap.js +9 -20
- package/cjs/core/utils/icons/SvgCalendar.js +3 -14
- package/cjs/core/utils/icons/SvgCaretDownSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCaretRightSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCaretUpSmall.js +3 -14
- package/cjs/core/utils/icons/SvgCheckmark.js +3 -14
- package/cjs/core/utils/icons/SvgCheckmarkSmall.js +3 -14
- package/cjs/core/utils/icons/SvgChevronLeft.js +3 -14
- package/cjs/core/utils/icons/SvgChevronLeftDouble.js +3 -14
- package/cjs/core/utils/icons/SvgChevronRight.js +3 -14
- package/cjs/core/utils/icons/SvgChevronRightDouble.js +3 -14
- package/cjs/core/utils/icons/SvgClose.js +3 -14
- package/cjs/core/utils/icons/SvgCloseSmall.js +3 -14
- package/cjs/core/utils/icons/SvgColumnManager.js +3 -14
- package/cjs/core/utils/icons/SvgFilter.js +3 -14
- package/cjs/core/utils/icons/SvgFilterHollow.js +3 -14
- package/cjs/core/utils/icons/SvgImportantSmall.js +3 -14
- package/cjs/core/utils/icons/SvgInfoCircular.js +3 -14
- package/cjs/core/utils/icons/SvgMore.js +3 -14
- package/cjs/core/utils/icons/SvgMoreVertical.js +3 -14
- package/cjs/core/utils/icons/SvgNew.js +3 -14
- package/cjs/core/utils/icons/SvgSmileyHappy.js +3 -14
- package/cjs/core/utils/icons/SvgSortDown.js +3 -14
- package/cjs/core/utils/icons/SvgSortUp.js +3 -14
- package/cjs/core/utils/icons/SvgStatusError.js +3 -14
- package/cjs/core/utils/icons/SvgStatusSuccess.js +3 -14
- package/cjs/core/utils/icons/SvgStatusWarning.js +3 -14
- package/cjs/core/utils/icons/SvgSwap.js +3 -14
- package/cjs/core/utils/icons/SvgUpload.js +3 -14
- package/cjs/types/react-table-config.d.ts +1 -1
- package/esm/core/Alert/Alert.js +5 -27
- package/esm/core/Avatar/Avatar.js +9 -32
- package/esm/core/AvatarGroup/AvatarGroup.js +16 -41
- package/esm/core/Backdrop/Backdrop.js +3 -25
- package/esm/core/Badge/Badge.js +10 -28
- package/esm/core/Breadcrumbs/Breadcrumbs.js +11 -37
- package/esm/core/ButtonGroup/ButtonGroup.js +7 -29
- package/esm/core/Buttons/Button/Button.js +3 -25
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +9 -31
- package/esm/core/Buttons/IconButton/IconButton.js +3 -25
- package/esm/core/Buttons/IdeasButton/IdeasButton.js +3 -25
- package/esm/core/Buttons/SplitButton/SplitButton.js +8 -30
- package/esm/core/Carousel/Carousel.js +29 -54
- package/esm/core/Carousel/CarouselContext.js +1 -1
- package/esm/core/Carousel/CarouselDot.js +4 -26
- package/esm/core/Carousel/CarouselDotsList.js +28 -55
- package/esm/core/Carousel/CarouselNavigation.js +16 -38
- package/esm/core/Carousel/CarouselSlide.js +8 -30
- package/esm/core/Carousel/CarouselSlider.js +22 -47
- package/esm/core/Checkbox/Checkbox.js +14 -38
- package/esm/core/ColorPicker/ColorBuilder.js +46 -68
- package/esm/core/ColorPicker/ColorInputPanel.js +58 -82
- package/esm/core/ColorPicker/ColorPalette.js +20 -44
- package/esm/core/ColorPicker/ColorPicker.js +21 -45
- package/esm/core/ColorPicker/ColorPickerContext.js +3 -3
- package/esm/core/ColorPicker/ColorSwatch.js +9 -30
- package/esm/core/ComboBox/ComboBox.js +55 -81
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxDropdown.js +10 -33
- package/esm/core/ComboBox/ComboBoxEndIcon.js +8 -30
- package/esm/core/ComboBox/ComboBoxInput.js +24 -46
- package/esm/core/ComboBox/ComboBoxInputContainer.js +5 -27
- package/esm/core/ComboBox/ComboBoxMenu.js +29 -54
- package/esm/core/ComboBox/ComboBoxMenuItem.js +7 -29
- package/esm/core/ComboBox/helpers.js +13 -21
- package/esm/core/DatePicker/DatePicker.js +82 -106
- package/esm/core/Dialog/Dialog.js +19 -39
- package/esm/core/Dialog/DialogBackdrop.js +11 -30
- package/esm/core/Dialog/DialogButtonBar.js +3 -25
- package/esm/core/Dialog/DialogContent.js +3 -25
- package/esm/core/Dialog/DialogContext.js +2 -2
- package/esm/core/Dialog/DialogDragContext.js +6 -15
- package/esm/core/Dialog/DialogMain.js +45 -52
- package/esm/core/Dialog/DialogTitleBar.js +7 -29
- package/esm/core/Dialog/DialogTitleBarTitle.js +3 -25
- package/esm/core/DropdownMenu/DropdownMenu.js +11 -33
- package/esm/core/ExpandableBlock/ExpandableBlock.js +9 -31
- package/esm/core/Fieldset/Fieldset.js +6 -30
- package/esm/core/FileUpload/FileUpload.js +10 -32
- package/esm/core/FileUpload/FileUploadTemplate.js +2 -2
- package/esm/core/Footer/Footer.js +16 -44
- package/esm/core/Footer/FooterItem.js +3 -25
- package/esm/core/Footer/FooterList.js +3 -25
- package/esm/core/Footer/FooterSeparator.js +3 -25
- package/esm/core/Header/Header.js +5 -27
- package/esm/core/Header/HeaderBasicButton.js +3 -25
- package/esm/core/Header/HeaderBreadcrumbs.js +7 -37
- package/esm/core/Header/HeaderButton.js +16 -30
- package/esm/core/Header/HeaderDropdownButton.js +9 -31
- package/esm/core/Header/HeaderLogo.js +4 -26
- package/esm/core/Header/HeaderSplitButton.js +8 -30
- package/esm/core/InformationPanel/InformationPanel.js +12 -34
- package/esm/core/InformationPanel/InformationPanelBody.js +3 -25
- package/esm/core/InformationPanel/InformationPanelContent.js +3 -25
- package/esm/core/InformationPanel/InformationPanelHeader.js +3 -25
- package/esm/core/InformationPanel/InformationPanelWrapper.js +3 -25
- package/esm/core/Input/Input.js +6 -28
- package/esm/core/InputGroup/InputGroup.js +4 -26
- package/esm/core/Label/Label.js +4 -26
- package/esm/core/LabeledInput/LabeledInput.js +4 -26
- package/esm/core/LabeledSelect/LabeledSelect.js +4 -26
- package/esm/core/LabeledTextarea/LabeledTextarea.js +4 -26
- package/esm/core/Menu/Menu.js +15 -37
- package/esm/core/Menu/MenuDivider.js +3 -25
- package/esm/core/Menu/MenuExtraContent.js +3 -25
- package/esm/core/Menu/MenuItem.js +13 -35
- package/esm/core/Menu/MenuItemSkeleton.js +8 -27
- package/esm/core/Modal/Modal.js +8 -26
- package/esm/core/Modal/ModalButtonBar.js +1 -1
- package/esm/core/Modal/ModalContent.js +1 -1
- package/esm/core/{ErrorPage → NonIdealState}/ErrorPage.d.ts +5 -1
- package/esm/core/NonIdealState/ErrorPage.js +137 -0
- package/esm/core/NonIdealState/NonIdealState.d.ts +46 -0
- package/esm/core/NonIdealState/NonIdealState.js +25 -0
- package/{cjs/core/ErrorPage → esm/core/NonIdealState}/index.d.ts +3 -1
- package/esm/core/{ErrorPage → NonIdealState}/index.js +2 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +8 -31
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +10 -34
- package/esm/core/Radio/Radio.js +7 -30
- package/esm/core/RadioTiles/RadioTile.js +6 -28
- package/esm/core/RadioTiles/RadioTileGroup.js +3 -25
- package/esm/core/Select/Select.js +53 -66
- package/esm/core/Select/SelectTag.js +3 -25
- package/esm/core/SideNavigation/SideNavigation.js +9 -35
- package/esm/core/SideNavigation/SidenavButton.js +4 -26
- package/esm/core/SideNavigation/SidenavSubmenu.js +3 -25
- package/esm/core/SideNavigation/SidenavSubmenuHeader.js +3 -25
- package/esm/core/SkipToContentLink/SkipToContentLink.js +3 -25
- package/esm/core/Slider/Slider.js +63 -91
- package/esm/core/Slider/Thumb.js +17 -36
- package/esm/core/Slider/Track.js +23 -43
- package/esm/core/StatusMessage/StatusMessage.js +3 -4
- package/esm/core/Stepper/Stepper.js +7 -31
- package/esm/core/Stepper/StepperStep.js +12 -31
- package/esm/core/Stepper/Wizard.js +3 -25
- package/esm/core/Stepper/WorkflowDiagram.js +3 -25
- package/esm/core/Stepper/WorkflowDiagramStep.js +3 -25
- package/esm/core/Surface/Surface.js +8 -27
- package/esm/core/Table/SubRowExpander.js +3 -3
- package/esm/core/Table/Table.d.ts +19 -24
- package/esm/core/Table/Table.js +177 -183
- package/esm/core/Table/TableCell.js +23 -24
- package/esm/core/Table/TablePaginator.js +46 -77
- package/esm/core/Table/TableRowMemoized.d.ts +6 -10
- package/esm/core/Table/TableRowMemoized.js +32 -56
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -4
- package/esm/core/Table/actionHandlers/resizeHandler.js +13 -15
- package/esm/core/Table/actionHandlers/selectHandler.js +35 -40
- package/esm/core/Table/cells/DefaultCell.js +3 -25
- package/esm/core/Table/cells/EditableCell.js +14 -38
- package/esm/core/Table/columns/actionColumn.js +34 -52
- package/esm/core/Table/columns/expanderColumn.d.ts +2 -5
- package/esm/core/Table/columns/expanderColumn.js +9 -24
- package/esm/core/Table/columns/selectionColumn.d.ts +2 -5
- package/esm/core/Table/columns/selectionColumn.js +14 -35
- package/esm/core/Table/filters/BaseFilter.js +3 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +14 -36
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +15 -26
- package/esm/core/Table/filters/FilterButtonBar.js +4 -15
- package/esm/core/Table/filters/FilterToggle.js +11 -33
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +11 -24
- package/esm/core/Table/filters/TextFilter/TextFilter.js +6 -6
- package/esm/core/Table/filters/customFilterFunctions.js +12 -14
- package/esm/core/Table/filters/defaultFilterFunctions.js +63 -65
- package/esm/core/Table/filters/tableFilters.js +4 -15
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +40 -52
- package/esm/core/Table/hooks/useExpanderCell.js +15 -31
- package/esm/core/Table/hooks/useResizeColumns.js +196 -204
- package/esm/core/Table/hooks/useScrollToRow.js +10 -11
- package/esm/core/Table/hooks/useSelectionCell.js +6 -17
- package/esm/core/Table/hooks/useStickyColumns.js +27 -32
- package/esm/core/Table/hooks/useSubRowFiltering.js +35 -55
- package/esm/core/Table/hooks/useSubRowSelection.js +9 -11
- package/esm/core/Table/utils.js +15 -26
- package/esm/core/Tabs/Tab.js +3 -25
- package/esm/core/Tabs/Tabs.js +41 -63
- package/esm/core/Tag/Tag.js +4 -26
- package/esm/core/Tag/TagContainer.js +6 -29
- package/esm/core/Textarea/Textarea.js +6 -28
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/esm/core/ThemeProvider/ThemeProvider.js +15 -36
- package/esm/core/Tile/Tile.js +23 -52
- package/esm/core/TimePicker/TimePicker.js +56 -94
- package/esm/core/Toast/Toast.js +41 -61
- package/esm/core/Toast/ToastWrapper.js +10 -21
- package/esm/core/Toast/Toaster.js +83 -134
- package/esm/core/Toast/index.js +1 -1
- package/esm/core/ToggleSwitch/ToggleSwitch.js +7 -29
- package/esm/core/Tooltip/Tooltip.js +3 -25
- package/esm/core/Tree/Tree.js +54 -76
- package/esm/core/Tree/TreeContext.js +3 -3
- package/esm/core/Tree/TreeNode.js +16 -38
- package/esm/core/Tree/TreeNodeExpander.js +3 -25
- package/esm/core/Typography/Anchor/Anchor.js +2 -25
- package/esm/core/Typography/Blockquote/Blockquote.js +3 -25
- package/esm/core/Typography/Body/Body.js +4 -26
- package/esm/core/Typography/Code/Code.js +3 -25
- package/esm/core/Typography/Headline/Headline.js +3 -25
- package/esm/core/Typography/Kbd/Kbd.js +4 -26
- package/esm/core/Typography/Leading/Leading.js +3 -25
- package/esm/core/Typography/Small/Small.js +3 -25
- package/esm/core/Typography/Subheading/Subheading.js +3 -25
- package/esm/core/Typography/Text/Text.js +8 -31
- package/esm/core/Typography/Title/Title.js +3 -25
- package/esm/core/index.d.ts +2 -2
- package/esm/core/index.js +1 -1
- package/esm/core/utils/color/ColorValue.js +145 -156
- package/esm/core/utils/components/FocusTrap.js +11 -11
- package/esm/core/utils/components/InputContainer.js +10 -34
- package/esm/core/utils/components/MiddleTextTruncation.js +13 -29
- package/esm/core/utils/components/Popover.d.ts +1 -1
- package/esm/core/utils/components/Popover.js +54 -57
- package/esm/core/utils/components/Resizer.js +49 -49
- package/esm/core/utils/components/VirtualScroll.js +69 -86
- package/esm/core/utils/components/VisuallyHidden.js +3 -25
- package/esm/core/utils/components/WithCSSTransition.d.ts +2 -2
- package/esm/core/utils/components/WithCSSTransition.js +16 -38
- package/esm/core/utils/functions/colors.js +8 -8
- package/esm/core/utils/functions/dom.js +7 -8
- package/esm/core/utils/functions/focusable.js +11 -15
- package/esm/core/utils/functions/numbers.js +5 -6
- package/esm/core/utils/functions/styles.js +3 -3
- package/esm/core/utils/hooks/useContainerWidth.js +6 -10
- package/esm/core/utils/hooks/useDragAndDrop.js +28 -29
- package/esm/core/utils/hooks/useEventListener.js +6 -6
- package/esm/core/utils/hooks/useIntersection.js +7 -10
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/esm/core/utils/hooks/useLatestRef.js +3 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -9
- package/esm/core/utils/hooks/useMergedRefs.js +5 -22
- package/esm/core/utils/hooks/useOverflow.js +23 -30
- package/esm/core/utils/hooks/useResizeObserver.js +4 -7
- package/esm/core/utils/hooks/useSafeContext.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +14 -16
- package/esm/core/utils/icons/StatusIconMap.js +5 -16
- package/esm/core/utils/icons/SvgCalendar.js +2 -13
- package/esm/core/utils/icons/SvgCaretDownSmall.js +2 -13
- package/esm/core/utils/icons/SvgCaretRightSmall.js +2 -13
- package/esm/core/utils/icons/SvgCaretUpSmall.js +2 -13
- package/esm/core/utils/icons/SvgCheckmark.js +2 -13
- package/esm/core/utils/icons/SvgCheckmarkSmall.js +2 -13
- package/esm/core/utils/icons/SvgChevronLeft.js +2 -13
- package/esm/core/utils/icons/SvgChevronLeftDouble.js +2 -13
- package/esm/core/utils/icons/SvgChevronRight.js +2 -13
- package/esm/core/utils/icons/SvgChevronRightDouble.js +2 -13
- package/esm/core/utils/icons/SvgClose.js +2 -13
- package/esm/core/utils/icons/SvgCloseSmall.js +2 -13
- package/esm/core/utils/icons/SvgColumnManager.js +2 -13
- package/esm/core/utils/icons/SvgFilter.js +2 -13
- package/esm/core/utils/icons/SvgFilterHollow.js +2 -13
- package/esm/core/utils/icons/SvgImportantSmall.js +2 -13
- package/esm/core/utils/icons/SvgInfoCircular.js +2 -13
- package/esm/core/utils/icons/SvgMore.js +2 -13
- package/esm/core/utils/icons/SvgMoreVertical.js +2 -13
- package/esm/core/utils/icons/SvgNew.js +2 -13
- package/esm/core/utils/icons/SvgSmileyHappy.js +2 -13
- package/esm/core/utils/icons/SvgSortDown.js +2 -13
- package/esm/core/utils/icons/SvgSortUp.js +2 -13
- package/esm/core/utils/icons/SvgStatusError.js +2 -13
- package/esm/core/utils/icons/SvgStatusSuccess.js +2 -13
- package/esm/core/utils/icons/SvgStatusWarning.js +2 -13
- package/esm/core/utils/icons/SvgSwap.js +2 -13
- package/esm/core/utils/icons/SvgUpload.js +2 -13
- package/esm/types/react-table-config.d.ts +1 -1
- package/package.json +3 -3
- package/cjs/core/ErrorPage/ErrorPage.js +0 -168
- package/esm/core/ErrorPage/ErrorPage.js +0 -161
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -27,8 +5,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
5
|
import React from 'react';
|
|
28
6
|
import { mergeRefs } from '../hooks';
|
|
29
7
|
import { useResizeObserver } from '../hooks/useResizeObserver';
|
|
30
|
-
|
|
31
|
-
if (ownerDocument === void 0) { ownerDocument = document; }
|
|
8
|
+
const getScrollableParent = (element, ownerDocument = document) => {
|
|
32
9
|
if (!element || element === ownerDocument.body) {
|
|
33
10
|
return ownerDocument.body;
|
|
34
11
|
}
|
|
@@ -36,38 +13,38 @@ var getScrollableParent = function (element, ownerDocument) {
|
|
|
36
13
|
? element
|
|
37
14
|
: getScrollableParent(element.parentElement, ownerDocument);
|
|
38
15
|
};
|
|
39
|
-
|
|
16
|
+
const isElementScrollable = (element) => {
|
|
40
17
|
return /(auto|scroll|overlay)/.test(getElementStyle(element, 'overflow') +
|
|
41
18
|
getElementStyle(element, 'overflow-y'));
|
|
42
19
|
};
|
|
43
|
-
|
|
20
|
+
const getElementStyle = (element, prop) => {
|
|
44
21
|
return getComputedStyle(element, null).getPropertyValue(prop);
|
|
45
22
|
};
|
|
46
|
-
|
|
23
|
+
const getElementHeight = (element) => {
|
|
47
24
|
var _a;
|
|
48
25
|
return (_a = element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height) !== null && _a !== void 0 ? _a : 0;
|
|
49
26
|
};
|
|
50
|
-
|
|
27
|
+
const getElementHeightWithMargins = (element) => {
|
|
51
28
|
if (!element) {
|
|
52
29
|
return undefined;
|
|
53
30
|
}
|
|
54
|
-
|
|
31
|
+
const margin = parseFloat(getElementStyle(element, 'margin-top')) +
|
|
55
32
|
parseFloat(getElementStyle(element, 'margin-bottom'));
|
|
56
33
|
return getElementHeight(element) + (isNaN(margin) ? 0 : margin);
|
|
57
34
|
};
|
|
58
|
-
|
|
35
|
+
const getNumberOfNodesInHeight = (childHeight, totalHeight) => {
|
|
59
36
|
if (!childHeight) {
|
|
60
37
|
return 0;
|
|
61
38
|
}
|
|
62
39
|
return Math.floor(totalHeight / childHeight);
|
|
63
40
|
};
|
|
64
|
-
|
|
41
|
+
const getTranslateValue = (childHeight, startIndex) => {
|
|
65
42
|
if (startIndex > 0) {
|
|
66
43
|
return childHeight * startIndex;
|
|
67
44
|
}
|
|
68
45
|
return 0;
|
|
69
46
|
};
|
|
70
|
-
|
|
47
|
+
const getVisibleNodeCount = (childHeight, startIndex, childrenLength, scrollContainer) => {
|
|
71
48
|
return Math.min(childrenLength - startIndex, getNumberOfNodesInHeight(childHeight, getElementHeight(scrollContainer)));
|
|
72
49
|
};
|
|
73
50
|
/**
|
|
@@ -91,10 +68,10 @@ var getVisibleNodeCount = function (childHeight, startIndex, childrenLength, scr
|
|
|
91
68
|
* />
|
|
92
69
|
* @private
|
|
93
70
|
*/
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
return (React.createElement("div",
|
|
97
|
-
React.createElement("div",
|
|
71
|
+
export const VirtualScroll = React.forwardRef((props, ref) => {
|
|
72
|
+
const { innerProps, outerProps, visibleChildren } = useVirtualization(props);
|
|
73
|
+
return (React.createElement("div", { ...outerProps, ref: ref },
|
|
74
|
+
React.createElement("div", { ...innerProps }, visibleChildren)));
|
|
98
75
|
});
|
|
99
76
|
/**
|
|
100
77
|
* `useVirtualization` is used for efficiently rendering only the visible rows from a large list.
|
|
@@ -116,49 +93,48 @@ export var VirtualScroll = React.forwardRef(function (props, ref) {
|
|
|
116
93
|
* );
|
|
117
94
|
* @private
|
|
118
95
|
*/
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
96
|
+
export const useVirtualization = (props) => {
|
|
97
|
+
const { itemsLength, itemRenderer, bufferSize = 10, scrollToIndex, style, ...rest } = props;
|
|
98
|
+
const [startNode, setStartNode] = React.useState(0);
|
|
99
|
+
const [visibleNodeCount, setVisibleNodeCount] = React.useState(0);
|
|
100
|
+
const scrollContainer = React.useRef();
|
|
101
|
+
const parentRef = React.useRef(null);
|
|
102
|
+
const childHeight = React.useRef({ first: 0, middle: 0, last: 0 });
|
|
103
|
+
const onScrollRef = React.useRef();
|
|
127
104
|
// Used only to recalculate on resize
|
|
128
|
-
|
|
129
|
-
|
|
105
|
+
const [scrollContainerHeight, setScrollContainerHeight] = React.useState(0);
|
|
106
|
+
const visibleIndex = React.useRef({ start: 0, end: 0 });
|
|
130
107
|
// Used to mark when scroll container has height (updated by resize observer)
|
|
131
108
|
// because before that calculations are not right
|
|
132
|
-
|
|
133
|
-
|
|
109
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
110
|
+
const getScrollableContainer = () => {
|
|
134
111
|
var _a, _b;
|
|
135
112
|
return (_a = scrollContainer.current) !== null && _a !== void 0 ? _a : (_b = parentRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.scrollingElement;
|
|
136
113
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
for (
|
|
114
|
+
const visibleChildren = React.useMemo(() => {
|
|
115
|
+
const arr = [];
|
|
116
|
+
const endIndex = Math.min(itemsLength, startNode + visibleNodeCount + bufferSize * 2);
|
|
117
|
+
for (let i = startNode; i < endIndex; i++) {
|
|
141
118
|
arr.push(itemRenderer(i));
|
|
142
119
|
}
|
|
143
120
|
return arr;
|
|
144
121
|
}, [itemsLength, itemRenderer, bufferSize, startNode, visibleNodeCount]);
|
|
145
|
-
|
|
122
|
+
const updateChildHeight = React.useCallback(() => {
|
|
146
123
|
var _a, _b, _c, _d, _e, _f;
|
|
147
124
|
if (!parentRef.current || !visibleChildren.length) {
|
|
148
125
|
return;
|
|
149
126
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
127
|
+
const firstChild = parentRef.current.children.item(0);
|
|
128
|
+
const secondChild = parentRef.current.children.item(1);
|
|
129
|
+
const lastChild = parentRef.current.children.item(parentRef.current.children.length - 1);
|
|
130
|
+
const firstChildHeight = Number((_b = (_a = getElementHeightWithMargins(firstChild)) === null || _a === void 0 ? void 0 : _a.toFixed(2)) !== null && _b !== void 0 ? _b : 0);
|
|
154
131
|
childHeight.current = {
|
|
155
132
|
first: firstChildHeight,
|
|
156
133
|
middle: Number((_d = (_c = getElementHeightWithMargins(secondChild)) === null || _c === void 0 ? void 0 : _c.toFixed(2)) !== null && _d !== void 0 ? _d : firstChildHeight),
|
|
157
134
|
last: Number((_f = (_e = getElementHeightWithMargins(lastChild)) === null || _e === void 0 ? void 0 : _e.toFixed(2)) !== null && _f !== void 0 ? _f : firstChildHeight),
|
|
158
135
|
};
|
|
159
136
|
}, [visibleChildren.length]);
|
|
160
|
-
|
|
161
|
-
var height = _a.height;
|
|
137
|
+
const onResize = React.useCallback(({ height }) => {
|
|
162
138
|
// Initial value returned by resize observer is 0
|
|
163
139
|
// So wait for the next one
|
|
164
140
|
if (height > 0) {
|
|
@@ -167,44 +143,44 @@ export var useVirtualization = function (props) {
|
|
|
167
143
|
setScrollContainerHeight(height);
|
|
168
144
|
updateChildHeight();
|
|
169
145
|
}, [updateChildHeight]);
|
|
170
|
-
|
|
146
|
+
const [resizeRef, resizeObserver] = useResizeObserver(onResize);
|
|
171
147
|
// Find scrollable parent
|
|
172
148
|
// Needed only on init
|
|
173
|
-
React.useLayoutEffect(
|
|
149
|
+
React.useLayoutEffect(() => {
|
|
174
150
|
var _a;
|
|
175
|
-
|
|
151
|
+
const scrollableParent = getScrollableParent(parentRef.current, (_a = parentRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
176
152
|
scrollContainer.current = scrollableParent;
|
|
177
153
|
resizeRef(scrollableParent);
|
|
178
154
|
}, [resizeRef]);
|
|
179
155
|
// Stop watching resize, when virtual scroll is unmounted
|
|
180
|
-
React.useLayoutEffect(
|
|
181
|
-
return
|
|
156
|
+
React.useLayoutEffect(() => {
|
|
157
|
+
return () => resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
182
158
|
}, [resizeObserver]);
|
|
183
159
|
// Get child height when children available
|
|
184
|
-
React.useLayoutEffect(
|
|
185
|
-
|
|
186
|
-
|
|
160
|
+
React.useLayoutEffect(() => updateChildHeight(), [updateChildHeight]);
|
|
161
|
+
const updateVirtualScroll = React.useCallback(() => {
|
|
162
|
+
const scrollableContainer = getScrollableContainer();
|
|
187
163
|
if (!scrollableContainer) {
|
|
188
164
|
return;
|
|
189
165
|
}
|
|
190
|
-
|
|
191
|
-
|
|
166
|
+
const start = getNumberOfNodesInHeight(childHeight.current.middle, Math.round(scrollableContainer.scrollTop));
|
|
167
|
+
const visibleNodes = getVisibleNodeCount(childHeight.current.middle, start, itemsLength, scrollableContainer);
|
|
192
168
|
// If there are less items at the end than buffer size
|
|
193
169
|
// show more items at the start.
|
|
194
170
|
// Have boundaries for edge cases, e.g. 1 item length
|
|
195
|
-
|
|
171
|
+
const startIndex = Math.min(Math.max(0, start - bufferSize), Math.max(0, itemsLength - bufferSize * 2 - visibleNodes));
|
|
196
172
|
visibleIndex.current = { start: start, end: start + visibleNodes };
|
|
197
173
|
setStartNode(startIndex);
|
|
198
174
|
setVisibleNodeCount(visibleNodes);
|
|
199
175
|
if (!parentRef.current) {
|
|
200
176
|
return;
|
|
201
177
|
}
|
|
202
|
-
parentRef.current.style.transform =
|
|
178
|
+
parentRef.current.style.transform = `translateY(${getTranslateValue(childHeight.current.middle, startIndex)}px)`;
|
|
203
179
|
}, [bufferSize, itemsLength]);
|
|
204
|
-
|
|
180
|
+
const onScroll = React.useCallback(() => {
|
|
205
181
|
updateVirtualScroll();
|
|
206
182
|
}, [updateVirtualScroll]);
|
|
207
|
-
|
|
183
|
+
const removeScrollListener = React.useCallback(() => {
|
|
208
184
|
var _a, _b;
|
|
209
185
|
if (!onScrollRef.current) {
|
|
210
186
|
return;
|
|
@@ -215,7 +191,7 @@ export var useVirtualization = function (props) {
|
|
|
215
191
|
: scrollContainer.current.removeEventListener('scroll', onScrollRef.current);
|
|
216
192
|
}, []);
|
|
217
193
|
// Add event listener to the scrollable container.
|
|
218
|
-
React.useLayoutEffect(
|
|
194
|
+
React.useLayoutEffect(() => {
|
|
219
195
|
var _a, _b;
|
|
220
196
|
removeScrollListener();
|
|
221
197
|
onScrollRef.current = onScroll;
|
|
@@ -228,18 +204,18 @@ export var useVirtualization = function (props) {
|
|
|
228
204
|
}
|
|
229
205
|
return removeScrollListener;
|
|
230
206
|
}, [onScroll, removeScrollListener]);
|
|
231
|
-
React.useLayoutEffect(
|
|
207
|
+
React.useLayoutEffect(() => {
|
|
232
208
|
if (!isMounted) {
|
|
233
209
|
return;
|
|
234
210
|
}
|
|
235
|
-
|
|
211
|
+
const scrollableContainer = getScrollableContainer();
|
|
236
212
|
if (!scrollableContainer || scrollToIndex == null) {
|
|
237
213
|
return;
|
|
238
214
|
}
|
|
239
215
|
// if `scrollToIndex` is not visible, scroll to it
|
|
240
216
|
if (scrollToIndex > visibleIndex.current.end ||
|
|
241
217
|
scrollToIndex < visibleIndex.current.start) {
|
|
242
|
-
|
|
218
|
+
const indexDiff = scrollToIndex > visibleIndex.current.end
|
|
243
219
|
? scrollToIndex - visibleIndex.current.end
|
|
244
220
|
: scrollToIndex - visibleIndex.current.start;
|
|
245
221
|
if (scrollToIndex === 0) {
|
|
@@ -258,8 +234,8 @@ export var useVirtualization = function (props) {
|
|
|
258
234
|
// if `scrollToIndex` is the first visible node
|
|
259
235
|
// ensure it is fully visible
|
|
260
236
|
if (scrollToIndex === visibleIndex.current.start) {
|
|
261
|
-
|
|
262
|
-
|
|
237
|
+
const roundedScrollTop = Math.round(scrollableContainer.scrollTop);
|
|
238
|
+
const diff = roundedScrollTop % childHeight.current.middle;
|
|
263
239
|
diff > 0 &&
|
|
264
240
|
scrollableContainer.scrollTo({
|
|
265
241
|
top: roundedScrollTop - diff,
|
|
@@ -269,10 +245,10 @@ export var useVirtualization = function (props) {
|
|
|
269
245
|
// if `scrollToIndex` is the last visible node
|
|
270
246
|
// ensure it is fully visible
|
|
271
247
|
if (scrollToIndex === visibleIndex.current.end) {
|
|
272
|
-
|
|
248
|
+
const diff = (scrollableContainer.offsetHeight - childHeight.current.first) %
|
|
273
249
|
childHeight.current.middle;
|
|
274
|
-
|
|
275
|
-
|
|
250
|
+
const roundedScrollTop = Math.ceil(scrollableContainer.scrollTop);
|
|
251
|
+
const scrollTopMod = roundedScrollTop % childHeight.current.middle;
|
|
276
252
|
if (diff > 0 && scrollTopMod === 0) {
|
|
277
253
|
scrollableContainer.scrollTo({
|
|
278
254
|
top: roundedScrollTop + childHeight.current.middle - diff,
|
|
@@ -280,23 +256,30 @@ export var useVirtualization = function (props) {
|
|
|
280
256
|
}
|
|
281
257
|
}
|
|
282
258
|
}, [scrollToIndex, isMounted]);
|
|
283
|
-
React.useLayoutEffect(
|
|
259
|
+
React.useLayoutEffect(() => {
|
|
284
260
|
if (!scrollContainerHeight) {
|
|
285
261
|
return;
|
|
286
262
|
}
|
|
287
263
|
updateVirtualScroll();
|
|
288
264
|
}, [scrollContainerHeight, updateVirtualScroll]);
|
|
289
265
|
return {
|
|
290
|
-
outerProps:
|
|
266
|
+
outerProps: {
|
|
267
|
+
style: {
|
|
268
|
+
minHeight: itemsLength > 1
|
|
291
269
|
? Math.max(itemsLength - 2, 0) * childHeight.current.middle +
|
|
292
270
|
childHeight.current.first +
|
|
293
271
|
childHeight.current.last
|
|
294
|
-
: childHeight.current.middle,
|
|
272
|
+
: childHeight.current.middle,
|
|
273
|
+
minWidth: '100%',
|
|
274
|
+
...style,
|
|
275
|
+
},
|
|
276
|
+
...rest,
|
|
277
|
+
},
|
|
295
278
|
innerProps: {
|
|
296
279
|
style: { willChange: 'transform' },
|
|
297
280
|
ref: mergeRefs(parentRef), // convert object ref to callback ref for better types
|
|
298
281
|
},
|
|
299
|
-
visibleChildren
|
|
282
|
+
visibleChildren,
|
|
300
283
|
};
|
|
301
284
|
};
|
|
302
285
|
export default VirtualScroll;
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -31,9 +9,9 @@ import '@itwin/itwinui-css/css/utils.css';
|
|
|
31
9
|
/**
|
|
32
10
|
* Hides content visually but is still accessible to screen readers.
|
|
33
11
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
12
|
+
export const VisuallyHidden = React.forwardRef((props, ref) => {
|
|
13
|
+
const { className, ...rest } = props;
|
|
36
14
|
useTheme();
|
|
37
|
-
return (React.createElement("div",
|
|
15
|
+
return (React.createElement("div", { className: cx('iui-visually-hidden', className), ref: ref, ...rest }));
|
|
38
16
|
});
|
|
39
17
|
export default VisuallyHidden;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
-
export declare const WithCSSTransition: (props: Partial<CSSTransitionProps
|
|
3
|
+
export declare const WithCSSTransition: (props: Partial<CSSTransitionProps> & {
|
|
4
4
|
children: JSX.Element;
|
|
5
|
-
dimension?:
|
|
5
|
+
dimension?: 'height' | 'width';
|
|
6
6
|
}) => JSX.Element;
|
|
7
7
|
export default WithCSSTransition;
|
|
@@ -1,50 +1,28 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
/*---------------------------------------------------------------------------------------------
|
|
24
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
4
|
*--------------------------------------------------------------------------------------------*/
|
|
27
5
|
import React from 'react';
|
|
28
6
|
import { CSSTransition } from 'react-transition-group';
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (React.createElement(CSSTransition,
|
|
34
|
-
node.style[
|
|
7
|
+
export const WithCSSTransition = (props) => {
|
|
8
|
+
const { in: visible, dimension = 'height', children, ...rest } = props;
|
|
9
|
+
const expandedSize = React.useRef(0);
|
|
10
|
+
const dimensionCamelCase = dimension === 'height' ? 'Height' : 'Width';
|
|
11
|
+
return (React.createElement(CSSTransition, { in: visible, timeout: 200, unmountOnExit: true, onEnter: (node) => {
|
|
12
|
+
node.style[`min${dimensionCamelCase}`] = 'initial';
|
|
35
13
|
node.style[dimension] = '0px';
|
|
36
|
-
}, onEntering:
|
|
37
|
-
node.style[dimension] =
|
|
38
|
-
}, onEntered:
|
|
39
|
-
node.style[
|
|
14
|
+
}, onEntering: (node) => {
|
|
15
|
+
node.style[dimension] = `${expandedSize.current}px`;
|
|
16
|
+
}, onEntered: (node) => {
|
|
17
|
+
node.style[`min${dimensionCamelCase}`] = '';
|
|
40
18
|
node.style[dimension] = '';
|
|
41
|
-
}, onExit:
|
|
42
|
-
node.style[dimension] =
|
|
43
|
-
}, onExiting:
|
|
44
|
-
node.style[
|
|
19
|
+
}, onExit: (node) => {
|
|
20
|
+
node.style[dimension] = `${expandedSize.current}px`;
|
|
21
|
+
}, onExiting: (node) => {
|
|
22
|
+
node.style[`min${dimensionCamelCase}`] = 'initial';
|
|
45
23
|
node.style[dimension] = '0px';
|
|
46
|
-
}, classNames: 'iui'
|
|
47
|
-
ref:
|
|
24
|
+
}, classNames: 'iui', ...rest }, React.cloneElement(children, {
|
|
25
|
+
ref: (el) => {
|
|
48
26
|
if (el) {
|
|
49
27
|
expandedSize.current = el.getBoundingClientRect()[dimension];
|
|
50
28
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
export
|
|
5
|
+
export const SoftBackgrounds = {
|
|
6
6
|
skyblue: 'var(--iui-color-background-skyblue)',
|
|
7
7
|
celery: 'var(--iui-color-background-celery)',
|
|
8
8
|
froly: 'var(--iui-color-background-froly)',
|
|
@@ -16,10 +16,10 @@ export var SoftBackgrounds = {
|
|
|
16
16
|
oak: 'var(--iui-color-background-oak)',
|
|
17
17
|
};
|
|
18
18
|
/** Returns true if a string value is one of the SoftBackgrounds keys */
|
|
19
|
-
export
|
|
19
|
+
export const isSoftBackground = (value) => {
|
|
20
20
|
return Object.keys(SoftBackgrounds).includes(value);
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const USER_COLORS = [
|
|
23
23
|
'#6AB9EC',
|
|
24
24
|
'#B1C854',
|
|
25
25
|
'#F7706C',
|
|
@@ -36,11 +36,11 @@ var USER_COLORS = [
|
|
|
36
36
|
* Generate color from user name or email.
|
|
37
37
|
* Recommended to use for `backgroundColor` in `Avatar` component.
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (
|
|
43
|
-
|
|
39
|
+
export const getUserColor = (emailOrName) => {
|
|
40
|
+
const normalizedString = emailOrName.trim().toLowerCase();
|
|
41
|
+
let hash = 0;
|
|
42
|
+
for (let i = 0; i < normalizedString.length; i++) {
|
|
43
|
+
const charCode = normalizedString.charCodeAt(i);
|
|
44
44
|
hash = (hash + charCode) % USER_COLORS.length;
|
|
45
45
|
}
|
|
46
46
|
return USER_COLORS[hash];
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
* @param containerId id of the container to find or create
|
|
10
10
|
* @param ownerDocument Can be changed if the container should be in a different document (e.g. in popup).
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
13
|
-
var _a;
|
|
14
|
-
|
|
15
|
-
var container = (_a = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.getElementById(containerId)) !== null && _a !== void 0 ? _a : undefined;
|
|
12
|
+
export const getContainer = (containerId, ownerDocument = getDocument()) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
let container = (_a = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.getElementById(containerId)) !== null && _a !== void 0 ? _a : undefined;
|
|
16
15
|
if (container == null && !!ownerDocument) {
|
|
17
16
|
container = ownerDocument.createElement('div');
|
|
18
17
|
container.setAttribute('id', containerId);
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const root = (_b = ownerDocument.querySelector('.iui-root')) !== null && _b !== void 0 ? _b : ownerDocument.body;
|
|
19
|
+
root.appendChild(container);
|
|
21
20
|
}
|
|
22
21
|
return container;
|
|
23
22
|
};
|
|
@@ -25,13 +24,13 @@ export var getContainer = function (containerId, ownerDocument) {
|
|
|
25
24
|
* Get document if it is defined.
|
|
26
25
|
* Used to support SSR/SSG applications.
|
|
27
26
|
*/
|
|
28
|
-
export
|
|
27
|
+
export const getDocument = () => {
|
|
29
28
|
return typeof document === 'undefined' ? undefined : document;
|
|
30
29
|
};
|
|
31
30
|
/**
|
|
32
31
|
* Get window if it is defined.
|
|
33
32
|
* Used to support SSR/SSG applications.
|
|
34
33
|
*/
|
|
35
|
-
export
|
|
34
|
+
export const getWindow = () => {
|
|
36
35
|
return typeof window === 'undefined' ? undefined : window;
|
|
37
36
|
};
|
|
@@ -2,32 +2,28 @@
|
|
|
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
|
-
|
|
5
|
+
const tabbableElementsSelector = 'a[href], button, input, textarea, select, details, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';
|
|
6
6
|
/**
|
|
7
7
|
* Return array of tabbable elements in the container.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const getTabbableElements = (container) => {
|
|
10
10
|
if (!container) {
|
|
11
11
|
return [];
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return Array.from(elements).filter(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
el.getAttribute('aria-disabled') !== 'true';
|
|
18
|
-
});
|
|
13
|
+
const elements = container.querySelectorAll(tabbableElementsSelector);
|
|
14
|
+
return Array.from(elements).filter((el) => !el.hasAttribute('disabled') &&
|
|
15
|
+
!el.classList.contains('iui-disabled') &&
|
|
16
|
+
el.getAttribute('aria-disabled') !== 'true');
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
19
|
* Return array of focusable elements in the container.
|
|
22
20
|
*/
|
|
23
|
-
export
|
|
21
|
+
export const getFocusableElements = (container) => {
|
|
24
22
|
if (!container) {
|
|
25
23
|
return [];
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
return Array.from(elements).filter(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
el.getAttribute('aria-disabled') !== 'true';
|
|
32
|
-
});
|
|
25
|
+
const elements = container.querySelectorAll(`${tabbableElementsSelector}, [tabindex="-1"]`);
|
|
26
|
+
return Array.from(elements).filter((el) => !el.hasAttribute('disabled') &&
|
|
27
|
+
!el.classList.contains('iui-disabled') &&
|
|
28
|
+
el.getAttribute('aria-disabled') !== 'true');
|
|
33
29
|
};
|
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Return input value bounded by specified range.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export const getBoundedValue = (val, min, max) => {
|
|
9
9
|
return Math.min(max, Math.max(min, val));
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Returns a random value of a given length containing `A-Za-z0-9_-` symbols.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (var i = 0; i < length; i++) {
|
|
14
|
+
export const getRandomValue = (length = 21) => {
|
|
15
|
+
const alphabet = `_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`;
|
|
16
|
+
let id = '';
|
|
17
|
+
for (let i = 0; i < length; i++) {
|
|
19
18
|
id += alphabet[(Math.random() * 64) | 0];
|
|
20
19
|
}
|
|
21
20
|
return id;
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* @param element HTML element you want to get translate value of
|
|
8
8
|
* @returns Translate values in pixels in a array `[translateX, translateY]`
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export const getTranslateValues = (element) => {
|
|
11
11
|
if (!element) {
|
|
12
12
|
return [];
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const transformValue = getComputedStyle(element).getPropertyValue('transform');
|
|
15
|
+
const matrix = new DOMMatrix(transformValue);
|
|
16
16
|
return [matrix.m41, matrix.m42];
|
|
17
17
|
};
|
|
@@ -20,24 +20,20 @@ import { useResizeObserver } from './useResizeObserver';
|
|
|
20
20
|
* ... // do something with width
|
|
21
21
|
* return <div ref={ref}>...</div>;
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var ref = React.useCallback(function (element) {
|
|
23
|
+
export const useContainerWidth = (watchResizes = true) => {
|
|
24
|
+
const [contentWidth, setContentWidth] = React.useState(0);
|
|
25
|
+
const ref = React.useCallback((element) => {
|
|
27
26
|
if (!element) {
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
setContentWidth(element.getBoundingClientRect().width);
|
|
31
30
|
}, []);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return setContentWidth(width);
|
|
35
|
-
}, []);
|
|
36
|
-
var _b = useResizeObserver(updateWidth), resizeRef = _b[0], resizeObserver = _b[1];
|
|
31
|
+
const updateWidth = React.useCallback(({ width }) => setContentWidth(width), []);
|
|
32
|
+
const [resizeRef, resizeObserver] = useResizeObserver(updateWidth);
|
|
37
33
|
if (!watchResizes) {
|
|
38
34
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
39
35
|
}
|
|
40
|
-
|
|
36
|
+
const refs = useMergedRefs(ref, watchResizes ? resizeRef : undefined);
|
|
41
37
|
return [refs, contentWidth];
|
|
42
38
|
};
|
|
43
39
|
export default useContainerWidth;
|