@itwin/itwinui-react 2.0.0-dev.2 → 2.0.0-dev.4
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 +6 -2
- 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 +6 -2
- package/package.json +4 -4
- package/cjs/core/ErrorPage/ErrorPage.js +0 -168
- package/esm/core/ErrorPage/ErrorPage.js +0 -161
|
@@ -8,9 +8,9 @@ exports.useContainerWidth = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const useMergedRefs_1 = require("./useMergedRefs");
|
|
13
|
+
const useResizeObserver_1 = require("./useResizeObserver");
|
|
14
14
|
/**
|
|
15
15
|
* Hook that returns the width of an element in three stages:
|
|
16
16
|
* - initialized with 0
|
|
@@ -26,24 +26,20 @@ var useResizeObserver_1 = require("./useResizeObserver");
|
|
|
26
26
|
* ... // do something with width
|
|
27
27
|
* return <div ref={ref}>...</div>;
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var ref = react_1.default.useCallback(function (element) {
|
|
29
|
+
const useContainerWidth = (watchResizes = true) => {
|
|
30
|
+
const [contentWidth, setContentWidth] = react_1.default.useState(0);
|
|
31
|
+
const ref = react_1.default.useCallback((element) => {
|
|
33
32
|
if (!element) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
35
|
setContentWidth(element.getBoundingClientRect().width);
|
|
37
36
|
}, []);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return setContentWidth(width);
|
|
41
|
-
}, []);
|
|
42
|
-
var _b = (0, useResizeObserver_1.useResizeObserver)(updateWidth), resizeRef = _b[0], resizeObserver = _b[1];
|
|
37
|
+
const updateWidth = react_1.default.useCallback(({ width }) => setContentWidth(width), []);
|
|
38
|
+
const [resizeRef, resizeObserver] = (0, useResizeObserver_1.useResizeObserver)(updateWidth);
|
|
43
39
|
if (!watchResizes) {
|
|
44
40
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
45
41
|
}
|
|
46
|
-
|
|
42
|
+
const refs = (0, useMergedRefs_1.useMergedRefs)(ref, watchResizes ? resizeRef : undefined);
|
|
47
43
|
return [refs, contentWidth];
|
|
48
44
|
};
|
|
49
45
|
exports.useContainerWidth = useContainerWidth;
|
|
@@ -8,13 +8,13 @@ exports.useDragAndDrop = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const functions_1 = require("../functions");
|
|
13
|
+
const useEventListener_1 = require("./useEventListener");
|
|
14
|
+
const useResizeObserver_1 = require("./useResizeObserver");
|
|
15
|
+
const getContainerRect = (containerRef) => {
|
|
16
16
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
17
|
-
|
|
17
|
+
const containerRect = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
18
18
|
return {
|
|
19
19
|
top: (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.top) !== null && _b !== void 0 ? _b : 0,
|
|
20
20
|
right: (_e = (_c = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _c !== void 0 ? _c : (_d = (0, functions_1.getWindow)()) === null || _d === void 0 ? void 0 : _d.innerWidth) !== null && _e !== void 0 ? _e : 0,
|
|
@@ -30,20 +30,19 @@ var getContainerRect = function (containerRef) {
|
|
|
30
30
|
* `onPointerDown` - handler that is called when pointer is down and handles all the dragging logic.
|
|
31
31
|
* `transform` - current transform of the element, it is used to preserve drag position when element visibility is being toggled.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var adjustTransform = react_1.default.useCallback(function () {
|
|
33
|
+
const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
34
|
+
const grabOffsetX = react_1.default.useRef(0);
|
|
35
|
+
const grabOffsetY = react_1.default.useRef(0);
|
|
36
|
+
const translateX = react_1.default.useRef();
|
|
37
|
+
const translateY = react_1.default.useRef();
|
|
38
|
+
const containerRectRef = react_1.default.useRef(getContainerRect(containerRef));
|
|
39
|
+
const adjustTransform = react_1.default.useCallback(() => {
|
|
41
40
|
var _a;
|
|
42
41
|
if (!elementRef.current || !enabled) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const { top, right, bottom, left, } = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
45
|
+
let [newTranslateX, newTranslateY] = (0, functions_1.getTranslateValues)(elementRef.current);
|
|
47
46
|
containerRectRef.current = getContainerRect(containerRef);
|
|
48
47
|
if (bottom > containerRectRef.current.bottom) {
|
|
49
48
|
newTranslateY -= bottom - containerRectRef.current.bottom;
|
|
@@ -59,52 +58,52 @@ var useDragAndDrop = function (elementRef, containerRef, enabled) {
|
|
|
59
58
|
}
|
|
60
59
|
translateX.current = newTranslateX;
|
|
61
60
|
translateY.current = newTranslateY;
|
|
62
|
-
elementRef.current.style.transform =
|
|
61
|
+
elementRef.current.style.transform = `translate(${newTranslateX}px, ${newTranslateY}px)`;
|
|
63
62
|
}, [containerRef, elementRef, enabled]);
|
|
64
|
-
|
|
63
|
+
const [resizeRef, resizeObserver] = (0, useResizeObserver_1.useResizeObserver)(adjustTransform);
|
|
65
64
|
resizeRef(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current);
|
|
66
|
-
react_1.default.useEffect(
|
|
67
|
-
return
|
|
65
|
+
react_1.default.useEffect(() => {
|
|
66
|
+
return () => {
|
|
68
67
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
69
68
|
};
|
|
70
69
|
}, [resizeObserver]);
|
|
71
|
-
(0, useEventListener_1.useEventListener)('resize',
|
|
70
|
+
(0, useEventListener_1.useEventListener)('resize', () => {
|
|
72
71
|
adjustTransform();
|
|
73
72
|
if (translateX.current != null && translateY.current != null) {
|
|
74
|
-
setTransform(
|
|
73
|
+
setTransform(`translate(${translateX.current}px, ${translateY.current}px)`);
|
|
75
74
|
}
|
|
76
75
|
}, (0, functions_1.getWindow)());
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const [transform, setTransform] = react_1.default.useState('');
|
|
77
|
+
const onPointerMove = react_1.default.useRef((event) => {
|
|
79
78
|
if (!elementRef.current) {
|
|
80
79
|
return;
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
elementRef.current.style.transform =
|
|
81
|
+
const newTranslateX = event.clientX - grabOffsetX.current;
|
|
82
|
+
const newTranslateY = event.clientY - grabOffsetY.current;
|
|
83
|
+
elementRef.current.style.transform = `translate(${newTranslateX}px, ${newTranslateY}px)`;
|
|
85
84
|
adjustTransform();
|
|
86
85
|
});
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
const originalUserSelect = react_1.default.useRef('');
|
|
87
|
+
const onPointerDown = react_1.default.useCallback((e) => {
|
|
89
88
|
if (!elementRef.current || e.button !== 0 || !enabled) {
|
|
90
89
|
return;
|
|
91
90
|
}
|
|
92
|
-
|
|
91
|
+
const [x, y] = (0, functions_1.getTranslateValues)(elementRef.current);
|
|
93
92
|
grabOffsetX.current = e.clientX - x;
|
|
94
93
|
grabOffsetY.current = e.clientY - y;
|
|
95
94
|
originalUserSelect.current = elementRef.current.style.userSelect;
|
|
96
95
|
// Prevents from selecting inner content when dragging.
|
|
97
96
|
elementRef.current.style.userSelect = 'none';
|
|
98
97
|
elementRef.current.ownerDocument.addEventListener('pointermove', onPointerMove.current);
|
|
99
|
-
elementRef.current.ownerDocument.addEventListener('pointerup',
|
|
100
|
-
setTransform(
|
|
98
|
+
elementRef.current.ownerDocument.addEventListener('pointerup', () => {
|
|
99
|
+
setTransform(`translate(${translateX.current}px, ${translateY.current}px)`);
|
|
101
100
|
document.removeEventListener('pointermove', onPointerMove.current);
|
|
102
101
|
if (elementRef.current) {
|
|
103
102
|
elementRef.current.style.userSelect = originalUserSelect.current;
|
|
104
103
|
}
|
|
105
104
|
}, { once: true });
|
|
106
105
|
}, [elementRef, enabled]);
|
|
107
|
-
return { onPointerDown
|
|
106
|
+
return { onPointerDown, transform };
|
|
108
107
|
};
|
|
109
108
|
exports.useDragAndDrop = useDragAndDrop;
|
|
110
109
|
exports.default = exports.useDragAndDrop;
|
|
@@ -8,7 +8,7 @@ exports.useEventListener = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
12
|
/**
|
|
13
13
|
* Hook that adds and removes Event listeners.
|
|
14
14
|
* @example
|
|
@@ -18,22 +18,22 @@ var react_1 = __importDefault(require("react"));
|
|
|
18
18
|
* containerRef.current?.ownerDocument,
|
|
19
19
|
* );
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const useEventListener = (eventName, handler, element) => {
|
|
22
22
|
// Based on published hook https://usehooks.com/useEventListener/.
|
|
23
|
-
|
|
23
|
+
const savedHandler = react_1.default.useRef();
|
|
24
24
|
// Update reference if handler changes. This allows our effect below to
|
|
25
25
|
// always use latest handler without us needing to pass it in effect deps array
|
|
26
26
|
// and potentially cause effect to re-run every render.
|
|
27
|
-
react_1.default.useEffect(
|
|
27
|
+
react_1.default.useEffect(() => {
|
|
28
28
|
savedHandler.current = handler;
|
|
29
29
|
}, [handler]);
|
|
30
|
-
react_1.default.useEffect(
|
|
30
|
+
react_1.default.useEffect(() => {
|
|
31
31
|
if (!element) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
const eventListener = (event) => { var _a; return (_a = savedHandler.current) === null || _a === void 0 ? void 0 : _a.call(savedHandler, event); };
|
|
35
35
|
element.addEventListener(eventName, eventListener);
|
|
36
|
-
return
|
|
36
|
+
return () => {
|
|
37
37
|
element.removeEventListener(eventName, eventListener);
|
|
38
38
|
};
|
|
39
39
|
}, [eventName, element]);
|
|
@@ -8,8 +8,8 @@ exports.useIntersection = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const dom_1 = require("../functions/dom");
|
|
13
13
|
/**
|
|
14
14
|
* Hook that uses `IntersectionObserver` to trigger `onIntersect` callback when element is in viewport.
|
|
15
15
|
* Callback is called only once by default (can be changed using the `once` parameter).
|
|
@@ -22,12 +22,10 @@ var dom_1 = require("../functions/dom");
|
|
|
22
22
|
* const ref = useIntersection(onIntersection);
|
|
23
23
|
* return (<div ref={ref}>One of many elements</div>);
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var observer = react_1.default.useRef();
|
|
30
|
-
var setRef = react_1.default.useCallback(function (node) {
|
|
25
|
+
const useIntersection = (onIntersect, options = {}, once = true) => {
|
|
26
|
+
const { root, rootMargin, threshold } = options;
|
|
27
|
+
const observer = react_1.default.useRef();
|
|
28
|
+
const setRef = react_1.default.useCallback((node) => {
|
|
31
29
|
var _a;
|
|
32
30
|
if (!((_a = (0, dom_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.IntersectionObserver)) {
|
|
33
31
|
return;
|
|
@@ -38,18 +36,17 @@ var useIntersection = function (onIntersect, options, once) {
|
|
|
38
36
|
if (!node) {
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
observer.current = new IntersectionObserver(
|
|
42
|
-
var entry = _a[0];
|
|
39
|
+
observer.current = new IntersectionObserver(([entry], obs) => {
|
|
43
40
|
if (entry.isIntersecting) {
|
|
44
41
|
if (once) {
|
|
45
42
|
obs.disconnect();
|
|
46
43
|
}
|
|
47
44
|
onIntersect();
|
|
48
45
|
}
|
|
49
|
-
}, { root
|
|
46
|
+
}, { root, rootMargin, threshold });
|
|
50
47
|
observer.current.observe(node);
|
|
51
48
|
}, [onIntersect, once, root, rootMargin, threshold]);
|
|
52
|
-
react_1.default.useEffect(
|
|
49
|
+
react_1.default.useEffect(() => () => { var _a; return (_a = observer.current) === null || _a === void 0 ? void 0 : _a.disconnect(); }, []);
|
|
53
50
|
return setRef;
|
|
54
51
|
};
|
|
55
52
|
exports.useIntersection = useIntersection;
|
|
@@ -8,7 +8,7 @@ exports.useIsomorphicLayoutEffect = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
12
|
/**
|
|
13
13
|
* SSR-safe version of `useLayoutEffect` that replaces it with `useEffect` on the server.
|
|
14
14
|
*
|
|
@@ -8,7 +8,7 @@ exports.useLatestRef = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
12
|
/**
|
|
13
13
|
* Hook that keeps track of the latest value in a ref.
|
|
14
14
|
* @private
|
|
@@ -16,9 +16,9 @@ var react_1 = __importDefault(require("react"));
|
|
|
16
16
|
* const { value } = props;
|
|
17
17
|
* const valueRef = useLatestRef(value);
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
react_1.default.useEffect(
|
|
19
|
+
const useLatestRef = (value) => {
|
|
20
|
+
const valueRef = react_1.default.useRef(value);
|
|
21
|
+
react_1.default.useEffect(() => {
|
|
22
22
|
valueRef.current = value;
|
|
23
23
|
}, [value]);
|
|
24
24
|
return valueRef;
|
|
@@ -8,18 +8,15 @@ exports.useMediaQuery = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const functions_1 = require("../functions");
|
|
13
|
+
const useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
|
|
14
|
+
const useMediaQuery = (queryString) => {
|
|
15
|
+
const [matches, setMatches] = react_1.default.useState();
|
|
16
|
+
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(() => {
|
|
17
17
|
var _a, _b, _c;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var matches = _a.matches;
|
|
21
|
-
return setMatches(matches);
|
|
22
|
-
};
|
|
18
|
+
const mediaQueryList = (_b = (_a = (0, functions_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, queryString);
|
|
19
|
+
const handleChange = ({ matches }) => setMatches(matches);
|
|
23
20
|
if (mediaQueryList != undefined) {
|
|
24
21
|
setMatches(mediaQueryList.matches);
|
|
25
22
|
try {
|
|
@@ -30,7 +27,7 @@ var useMediaQuery = function (queryString) {
|
|
|
30
27
|
(_c = mediaQueryList.addListener) === null || _c === void 0 ? void 0 : _c.call(mediaQueryList, handleChange);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
return
|
|
30
|
+
return () => {
|
|
34
31
|
var _a;
|
|
35
32
|
try {
|
|
36
33
|
mediaQueryList === null || mediaQueryList === void 0 ? void 0 : mediaQueryList.removeEventListener('change', handleChange);
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -17,17 +8,13 @@ exports.useMergedRefs = exports.mergeRefs = void 0;
|
|
|
17
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
18
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
19
10
|
*--------------------------------------------------------------------------------------------*/
|
|
20
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
21
12
|
/**
|
|
22
13
|
* Function that merges the provided refs into one.
|
|
23
14
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
refs[_i] = arguments[_i];
|
|
28
|
-
}
|
|
29
|
-
return function (instance) {
|
|
30
|
-
refs.forEach(function (ref) {
|
|
15
|
+
const mergeRefs = (...refs) => {
|
|
16
|
+
return (instance) => {
|
|
17
|
+
refs.forEach((ref) => {
|
|
31
18
|
if (typeof ref === 'function') {
|
|
32
19
|
ref(instance);
|
|
33
20
|
}
|
|
@@ -41,12 +28,8 @@ exports.mergeRefs = mergeRefs;
|
|
|
41
28
|
/**
|
|
42
29
|
* Returns a ref callback that merges the provided refs using `mergeRefs`.
|
|
43
30
|
*/
|
|
44
|
-
|
|
45
|
-
var refs = [];
|
|
46
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
47
|
-
refs[_i] = arguments[_i];
|
|
48
|
-
}
|
|
31
|
+
const useMergedRefs = (...refs) => {
|
|
49
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
-
return react_1.default.useCallback(exports.mergeRefs
|
|
33
|
+
return react_1.default.useCallback((0, exports.mergeRefs)(...refs), [...refs]);
|
|
51
34
|
};
|
|
52
35
|
exports.useMergedRefs = useMergedRefs;
|
|
@@ -8,10 +8,10 @@ exports.useOverflow = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const useMergedRefs_1 = require("./useMergedRefs");
|
|
13
|
+
const useResizeObserver_1 = require("./useResizeObserver");
|
|
14
|
+
const STARTING_MAX_ITEMS_COUNT = 20;
|
|
15
15
|
/**
|
|
16
16
|
* Hook that observes the size of an element and returns the number of items
|
|
17
17
|
* that should be visible based on the size of the container element.
|
|
@@ -34,23 +34,16 @@ var STARTING_MAX_ITEMS_COUNT = 20;
|
|
|
34
34
|
* </div>
|
|
35
35
|
* );
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var updateContainerSize = react_1.default.useCallback(function (_a) {
|
|
48
|
-
var width = _a.width, height = _a.height;
|
|
49
|
-
return setContainerSize(orientation === 'horizontal' ? width : height);
|
|
50
|
-
}, [orientation]);
|
|
51
|
-
var _c = (0, useResizeObserver_1.useResizeObserver)(updateContainerSize), resizeRef = _c[0], observer = _c[1];
|
|
52
|
-
var resizeObserverRef = react_1.default.useRef(observer);
|
|
53
|
-
react_1.default.useLayoutEffect(function () {
|
|
37
|
+
const useOverflow = (items, disabled = false, orientation = 'horizontal') => {
|
|
38
|
+
const containerRef = react_1.default.useRef(null);
|
|
39
|
+
const [visibleCount, setVisibleCount] = react_1.default.useState(() => disabled ? items.length : Math.min(items.length, STARTING_MAX_ITEMS_COUNT));
|
|
40
|
+
const needsFullRerender = react_1.default.useRef(true);
|
|
41
|
+
const [containerSize, setContainerSize] = react_1.default.useState(0);
|
|
42
|
+
const previousContainerSize = react_1.default.useRef(0);
|
|
43
|
+
const updateContainerSize = react_1.default.useCallback(({ width, height }) => setContainerSize(orientation === 'horizontal' ? width : height), [orientation]);
|
|
44
|
+
const [resizeRef, observer] = (0, useResizeObserver_1.useResizeObserver)(updateContainerSize);
|
|
45
|
+
const resizeObserverRef = react_1.default.useRef(observer);
|
|
46
|
+
react_1.default.useLayoutEffect(() => {
|
|
54
47
|
if (disabled) {
|
|
55
48
|
setVisibleCount(items.length);
|
|
56
49
|
}
|
|
@@ -59,28 +52,28 @@ var useOverflow = function (items, disabled, orientation) {
|
|
|
59
52
|
needsFullRerender.current = true;
|
|
60
53
|
}
|
|
61
54
|
}, [containerSize, disabled, items]);
|
|
62
|
-
|
|
63
|
-
react_1.default.useLayoutEffect(
|
|
55
|
+
const mergedRefs = (0, useMergedRefs_1.useMergedRefs)(containerRef, resizeRef);
|
|
56
|
+
react_1.default.useLayoutEffect(() => {
|
|
64
57
|
var _a;
|
|
65
58
|
if (!containerRef.current || disabled) {
|
|
66
59
|
(_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
67
60
|
return;
|
|
68
61
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
const dimension = orientation === 'horizontal' ? 'Width' : 'Height';
|
|
63
|
+
const availableSize = containerRef.current[`offset${dimension}`];
|
|
64
|
+
const requiredSize = containerRef.current[`scroll${dimension}`];
|
|
72
65
|
if (availableSize < requiredSize) {
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
const avgItemSize = requiredSize / visibleCount;
|
|
67
|
+
const visibleItems = Math.floor(availableSize / avgItemSize);
|
|
75
68
|
setVisibleCount(visibleItems);
|
|
76
69
|
}
|
|
77
70
|
else if (needsFullRerender.current) {
|
|
78
|
-
|
|
71
|
+
const childrenSize = Array.from(containerRef.current.children).reduce((sum, child) => sum + child[`offset${dimension}`], 0);
|
|
79
72
|
// Previous `useEffect` might have updated visible count, but we still have old one
|
|
80
73
|
// If it is 0, lets try to update it with items length.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
const currentVisibleCount = visibleCount || Math.min(items.length, STARTING_MAX_ITEMS_COUNT);
|
|
75
|
+
const avgItemSize = childrenSize / currentVisibleCount;
|
|
76
|
+
const visibleItems = Math.floor(availableSize / avgItemSize);
|
|
84
77
|
if (!isNaN(visibleItems)) {
|
|
85
78
|
// Doubling the visible items to overflow the container. Just to be safe.
|
|
86
79
|
setVisibleCount(Math.min(items.length, visibleItems * 2));
|
|
@@ -88,7 +81,7 @@ var useOverflow = function (items, disabled, orientation) {
|
|
|
88
81
|
}
|
|
89
82
|
needsFullRerender.current = false;
|
|
90
83
|
}, [containerSize, visibleCount, disabled, items.length, orientation]);
|
|
91
|
-
react_1.default.useLayoutEffect(
|
|
84
|
+
react_1.default.useLayoutEffect(() => {
|
|
92
85
|
previousContainerSize.current = containerSize;
|
|
93
86
|
}, [containerSize]);
|
|
94
87
|
return [mergedRefs, visibleCount];
|
|
@@ -8,8 +8,8 @@ exports.useResizeObserver = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const dom_1 = require("../functions/dom");
|
|
13
13
|
/**
|
|
14
14
|
* Hook that uses `ResizeObserver` to access an element's size every time it updates.
|
|
15
15
|
* @private
|
|
@@ -22,19 +22,16 @@ var dom_1 = require("../functions/dom");
|
|
|
22
22
|
* ...
|
|
23
23
|
* return <div ref={ref}>...</div>;
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const useResizeObserver = (onResize) => {
|
|
26
|
+
const resizeObserver = react_1.default.useRef();
|
|
27
|
+
const elementRef = react_1.default.useCallback((element) => {
|
|
28
28
|
var _a, _b, _c;
|
|
29
29
|
if (!((_a = (0, dom_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
(_b = resizeObserver.current) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
33
33
|
if (element) {
|
|
34
|
-
resizeObserver.current = new ResizeObserver(
|
|
35
|
-
var contentRect = _a[0].contentRect;
|
|
36
|
-
return onResize(contentRect);
|
|
37
|
-
});
|
|
34
|
+
resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
|
|
38
35
|
(_c = resizeObserver.current) === null || _c === void 0 ? void 0 : _c.observe(element);
|
|
39
36
|
}
|
|
40
37
|
}, [onResize]);
|
|
@@ -8,15 +8,15 @@ exports.useSafeContext = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
12
|
/**
|
|
13
13
|
* Wrapper hook around `useContext` that throws an error if the context is not provided.
|
|
14
14
|
* @param context Context to use. Must have a `displayName` for useful errors.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const useSafeContext = (context) => {
|
|
17
|
+
const value = react_1.default.useContext(context);
|
|
18
18
|
if (!value) {
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error(`${context.displayName} is undefined`);
|
|
20
20
|
}
|
|
21
21
|
return value; // eslint-disable-line @typescript-eslint/no-non-null-assertion -- we already checked for undefined
|
|
22
22
|
};
|
|
@@ -8,10 +8,10 @@ exports.useTheme = void 0;
|
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
10
|
*--------------------------------------------------------------------------------------------*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const ThemeProvider_1 = require("../../ThemeProvider/ThemeProvider");
|
|
13
|
+
const functions_1 = require("../functions");
|
|
14
|
+
const useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
|
|
15
15
|
require("@itwin/itwinui-css/css/global.css");
|
|
16
16
|
require("@itwin/itwinui-variables/index.css");
|
|
17
17
|
/**
|
|
@@ -23,11 +23,11 @@ require("@itwin/itwinui-variables/index.css");
|
|
|
23
23
|
* @param theme Light, dark, or based on OS setting.
|
|
24
24
|
* @param themeOptions Options that override default theming behavior.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
const useTheme = (theme, themeOptions) => {
|
|
27
27
|
var _a;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(
|
|
28
|
+
const themeContext = react_1.default.useContext(ThemeProvider_1.ThemeContext);
|
|
29
|
+
const ownerDocument = (_a = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.ownerDocument) !== null && _a !== void 0 ? _a : (0, functions_1.getDocument)();
|
|
30
|
+
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(() => {
|
|
31
31
|
// exit early if theme was already set by provider
|
|
32
32
|
if (themeContext || !ownerDocument) {
|
|
33
33
|
return;
|
|
@@ -54,21 +54,19 @@ exports.useTheme = useTheme;
|
|
|
54
54
|
* Helper function to apply the specified theme, or detect the OS theme.
|
|
55
55
|
* Returns a cleanup function to remove the change handlers.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
const handleTheme = (theme, ownerDocument, highContrast) => {
|
|
58
58
|
var _a, _b, _c, _d, _e;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (isDark === void 0) { isDark = false; }
|
|
63
|
-
if (isHC === void 0) { isHC = false; }
|
|
59
|
+
const root = ownerDocument.documentElement;
|
|
60
|
+
const _window = (_a = ownerDocument.defaultView) !== null && _a !== void 0 ? _a : (0, functions_1.getWindow)();
|
|
61
|
+
const applyThemeAttributes = (isDark = false, isHC = false) => {
|
|
64
62
|
root.dataset.iuiTheme = isDark ? 'dark' : 'light';
|
|
65
63
|
root.dataset.iuiContrast = isHC ? 'high' : 'default';
|
|
66
64
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
const prefersDarkQuery = (_b = _window === null || _window === void 0 ? void 0 : _window.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_window, '(prefers-color-scheme: dark)');
|
|
66
|
+
const prefersHCQuery = (_c = _window === null || _window === void 0 ? void 0 : _window.matchMedia) === null || _c === void 0 ? void 0 : _c.call(_window, '(prefers-contrast: more)');
|
|
67
|
+
const changeHandler = () => {
|
|
68
|
+
const isDark = theme === 'dark' || (theme === 'os' && (prefersDarkQuery === null || prefersDarkQuery === void 0 ? void 0 : prefersDarkQuery.matches));
|
|
69
|
+
const isHC = highContrast !== null && highContrast !== void 0 ? highContrast : prefersHCQuery === null || prefersHCQuery === void 0 ? void 0 : prefersHCQuery.matches;
|
|
72
70
|
applyThemeAttributes(isDark, isHC);
|
|
73
71
|
};
|
|
74
72
|
// call handler once to set initial theme
|
|
@@ -77,7 +75,7 @@ var handleTheme = function (theme, ownerDocument, highContrast) {
|
|
|
77
75
|
(_d = prefersDarkQuery === null || prefersDarkQuery === void 0 ? void 0 : prefersDarkQuery.addEventListener) === null || _d === void 0 ? void 0 : _d.call(prefersDarkQuery, 'change', changeHandler);
|
|
78
76
|
(_e = prefersHCQuery === null || prefersHCQuery === void 0 ? void 0 : prefersHCQuery.addEventListener) === null || _e === void 0 ? void 0 : _e.call(prefersHCQuery, 'change', changeHandler);
|
|
79
77
|
// return cleanup function to remove event listeners (should be returned from useEffect)
|
|
80
|
-
return
|
|
78
|
+
return () => {
|
|
81
79
|
var _a, _b;
|
|
82
80
|
(_a = prefersDarkQuery === null || prefersDarkQuery === void 0 ? void 0 : prefersDarkQuery.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(prefersDarkQuery, 'change', changeHandler);
|
|
83
81
|
(_b = prefersHCQuery === null || prefersHCQuery === void 0 ? void 0 : prefersHCQuery.removeEventListener) === null || _b === void 0 ? void 0 : _b.call(prefersHCQuery, 'change', changeHandler);
|