@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
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
@@ -30,12 +8,12 @@ exports.ColorInputPanel = void 0;
|
|
|
30
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
10
|
*--------------------------------------------------------------------------------------------*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const Buttons_1 = require("../Buttons");
|
|
14
|
+
const Input_1 = require("../Input");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
const ColorPickerContext_1 = require("./ColorPickerContext");
|
|
39
17
|
require("@itwin/itwinui-css/css/color-picker.css");
|
|
40
18
|
/**
|
|
41
19
|
* `ColorInputPanel` shows input fields to enter precise color values in the specified format.
|
|
@@ -46,22 +24,22 @@ require("@itwin/itwinui-css/css/color-picker.css");
|
|
|
46
24
|
* <ColorInputPanel defaultColorFormat='hsl' />
|
|
47
25
|
* </ColorPicker>
|
|
48
26
|
*/
|
|
49
|
-
exports.ColorInputPanel = react_1.default.forwardRef(
|
|
27
|
+
exports.ColorInputPanel = react_1.default.forwardRef((props, ref) => {
|
|
50
28
|
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
51
|
-
|
|
29
|
+
const { defaultColorFormat, allowedColorFormats = ['hsl', 'rgb', 'hex'], className, ...rest } = props;
|
|
52
30
|
(0, utils_1.useTheme)();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
react_1.default.useEffect(
|
|
31
|
+
const inputsContainerRef = react_1.default.useRef(null);
|
|
32
|
+
const { activeColor, applyHsvColorChange, hsvColor, showAlpha } = (0, ColorPickerContext_1.useColorPickerContext)();
|
|
33
|
+
const [currentFormat, setCurrentFormat] = react_1.default.useState(defaultColorFormat);
|
|
34
|
+
react_1.default.useEffect(() => {
|
|
57
35
|
setCurrentFormat(defaultColorFormat);
|
|
58
36
|
}, [defaultColorFormat]);
|
|
59
37
|
// need to use state since input may have parsing error
|
|
60
|
-
|
|
61
|
-
react_1.default.useEffect(
|
|
38
|
+
const [input, setInput] = react_1.default.useState(['', '', '', '']);
|
|
39
|
+
react_1.default.useEffect(() => {
|
|
62
40
|
var _a, _b;
|
|
63
41
|
if (currentFormat === 'hsl') {
|
|
64
|
-
|
|
42
|
+
const hsl = activeColor.toHslColor();
|
|
65
43
|
setInput([
|
|
66
44
|
utils_1.ColorValue.getFormattedColorNumber(hsvColor.h),
|
|
67
45
|
utils_1.ColorValue.getFormattedColorNumber(hsl.s),
|
|
@@ -70,7 +48,7 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
70
48
|
]);
|
|
71
49
|
}
|
|
72
50
|
else if (currentFormat === 'rgb') {
|
|
73
|
-
|
|
51
|
+
const rgb = activeColor.toRgbColor();
|
|
74
52
|
setInput([
|
|
75
53
|
rgb.r.toString(),
|
|
76
54
|
rgb.g.toString(),
|
|
@@ -83,23 +61,21 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
83
61
|
setValidHexInput(true);
|
|
84
62
|
}
|
|
85
63
|
}, [activeColor, hsvColor.h, currentFormat, showAlpha]);
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
const [validHexInput, setValidHexInput] = react_1.default.useState(true);
|
|
65
|
+
const swapColorFormat = react_1.default.useCallback(() => {
|
|
88
66
|
var _a;
|
|
89
|
-
|
|
67
|
+
const newFormat = (_a = allowedColorFormats[(allowedColorFormats.indexOf(currentFormat) + 1) %
|
|
90
68
|
allowedColorFormats.length]) !== null && _a !== void 0 ? _a : allowedColorFormats[0];
|
|
91
69
|
setCurrentFormat(newFormat);
|
|
92
70
|
}, [currentFormat, allowedColorFormats]);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var handleColorInputChange = function () {
|
|
99
|
-
var color;
|
|
71
|
+
const isFocusInside = (focused) => !!(focused &&
|
|
72
|
+
inputsContainerRef.current &&
|
|
73
|
+
inputsContainerRef.current.contains(focused));
|
|
74
|
+
const handleColorInputChange = () => {
|
|
75
|
+
let color;
|
|
100
76
|
if (currentFormat === 'hex') {
|
|
101
77
|
try {
|
|
102
|
-
|
|
78
|
+
const value = input[0].replace(/ /g, '').toLowerCase(); // remove white space from input
|
|
103
79
|
color = utils_1.ColorValue.create(value);
|
|
104
80
|
setValidHexInput(true);
|
|
105
81
|
if (activeColor.toHexString(showAlpha).toLowerCase() === value) {
|
|
@@ -112,7 +88,7 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
112
88
|
}
|
|
113
89
|
}
|
|
114
90
|
if (currentFormat === 'hsl') {
|
|
115
|
-
|
|
91
|
+
const [h, s, l, a] = input.map(Number);
|
|
116
92
|
if (h < 0 ||
|
|
117
93
|
h > 360 ||
|
|
118
94
|
s < 0 ||
|
|
@@ -123,14 +99,14 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
123
99
|
a > 1) {
|
|
124
100
|
return;
|
|
125
101
|
}
|
|
126
|
-
|
|
102
|
+
const hsl = activeColor.toHslColor();
|
|
127
103
|
if (hsl.h === h && hsl.s === s && hsl.l === l && hsl.a === a) {
|
|
128
104
|
return;
|
|
129
105
|
}
|
|
130
|
-
color = utils_1.ColorValue.create({ h
|
|
106
|
+
color = utils_1.ColorValue.create({ h, s, l, a });
|
|
131
107
|
}
|
|
132
108
|
if (currentFormat === 'rgb') {
|
|
133
|
-
|
|
109
|
+
const [r, g, b, a] = input.map(Number);
|
|
134
110
|
if (r < 0 ||
|
|
135
111
|
r > 255 ||
|
|
136
112
|
g < 0 ||
|
|
@@ -141,43 +117,43 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
141
117
|
a > 1) {
|
|
142
118
|
return;
|
|
143
119
|
}
|
|
144
|
-
|
|
120
|
+
const rgb = activeColor.toRgbColor();
|
|
145
121
|
if (rgb.r === r && rgb.g === g && rgb.b === b && rgb.a === a) {
|
|
146
122
|
return;
|
|
147
123
|
}
|
|
148
|
-
color = utils_1.ColorValue.create({ r
|
|
124
|
+
color = utils_1.ColorValue.create({ r, g, b, a });
|
|
149
125
|
}
|
|
150
126
|
if (color) {
|
|
151
127
|
applyHsvColorChange(color.toHsvColor(), true, color);
|
|
152
128
|
}
|
|
153
129
|
};
|
|
154
|
-
|
|
155
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', maxLength: showAlpha ? 9 : 7, minLength: 1, placeholder: 'HEX', value: input[0], onChange:
|
|
156
|
-
|
|
130
|
+
const hexInputField = (react_1.default.createElement(utils_1.InputContainer, { status: validHexInput ? undefined : 'negative' },
|
|
131
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', maxLength: showAlpha ? 9 : 7, minLength: 1, placeholder: 'HEX', value: input[0], onChange: (event) => {
|
|
132
|
+
const value = event.target.value.startsWith('#')
|
|
157
133
|
? event.target.value
|
|
158
|
-
:
|
|
134
|
+
: `#${event.target.value}`;
|
|
159
135
|
setInput([value]);
|
|
160
|
-
}, onKeyDown:
|
|
136
|
+
}, onKeyDown: (event) => {
|
|
161
137
|
if (event.key === 'Enter') {
|
|
162
138
|
event.preventDefault();
|
|
163
139
|
handleColorInputChange();
|
|
164
140
|
}
|
|
165
|
-
}, onBlur:
|
|
141
|
+
}, onBlur: (event) => {
|
|
166
142
|
event.preventDefault();
|
|
167
143
|
handleColorInputChange();
|
|
168
144
|
} })));
|
|
169
|
-
|
|
145
|
+
const hslInputs = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
170
146
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 360
|
|
171
147
|
? 'negative'
|
|
172
148
|
: undefined },
|
|
173
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: (_a = input[0]) !== null && _a !== void 0 ? _a : '', onChange:
|
|
149
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: (_a = input[0]) !== null && _a !== void 0 ? _a : '', onChange: (event) => {
|
|
174
150
|
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
175
|
-
}, onKeyDown:
|
|
151
|
+
}, onKeyDown: (event) => {
|
|
176
152
|
if (event.key === 'Enter') {
|
|
177
153
|
event.preventDefault();
|
|
178
154
|
handleColorInputChange();
|
|
179
155
|
}
|
|
180
|
-
}, onBlur:
|
|
156
|
+
}, onBlur: (event) => {
|
|
181
157
|
event.preventDefault();
|
|
182
158
|
if (!isFocusInside(event.relatedTarget)) {
|
|
183
159
|
handleColorInputChange();
|
|
@@ -186,14 +162,14 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
186
162
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 100
|
|
187
163
|
? 'negative'
|
|
188
164
|
: undefined },
|
|
189
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: (_b = input[1]) !== null && _b !== void 0 ? _b : '', onChange:
|
|
165
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: (_b = input[1]) !== null && _b !== void 0 ? _b : '', onChange: (event) => {
|
|
190
166
|
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
191
|
-
}, onKeyDown:
|
|
167
|
+
}, onKeyDown: (event) => {
|
|
192
168
|
if (event.key === 'Enter') {
|
|
193
169
|
event.preventDefault();
|
|
194
170
|
handleColorInputChange();
|
|
195
171
|
}
|
|
196
|
-
}, onBlur:
|
|
172
|
+
}, onBlur: (event) => {
|
|
197
173
|
event.preventDefault();
|
|
198
174
|
if (!isFocusInside(event.relatedTarget)) {
|
|
199
175
|
handleColorInputChange();
|
|
@@ -202,14 +178,14 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
202
178
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 100
|
|
203
179
|
? 'negative'
|
|
204
180
|
: undefined },
|
|
205
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: (_c = input[2]) !== null && _c !== void 0 ? _c : '', onChange:
|
|
181
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: (_c = input[2]) !== null && _c !== void 0 ? _c : '', onChange: (event) => {
|
|
206
182
|
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
207
|
-
}, onKeyDown:
|
|
183
|
+
}, onKeyDown: (event) => {
|
|
208
184
|
if (event.key === 'Enter') {
|
|
209
185
|
event.preventDefault();
|
|
210
186
|
handleColorInputChange();
|
|
211
187
|
}
|
|
212
|
-
}, onBlur:
|
|
188
|
+
}, onBlur: (event) => {
|
|
213
189
|
event.preventDefault();
|
|
214
190
|
if (!isFocusInside(event.relatedTarget)) {
|
|
215
191
|
handleColorInputChange();
|
|
@@ -218,31 +194,31 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
218
194
|
showAlpha && (react_1.default.createElement(utils_1.InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
219
195
|
? 'negative'
|
|
220
196
|
: undefined },
|
|
221
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_d = input[3]) !== null && _d !== void 0 ? _d : '', onChange:
|
|
197
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_d = input[3]) !== null && _d !== void 0 ? _d : '', onChange: (event) => {
|
|
222
198
|
setInput([input[0], input[1], input[2], event.target.value]);
|
|
223
|
-
}, onKeyDown:
|
|
199
|
+
}, onKeyDown: (event) => {
|
|
224
200
|
if (event.key === 'Enter') {
|
|
225
201
|
event.preventDefault();
|
|
226
202
|
handleColorInputChange();
|
|
227
203
|
}
|
|
228
|
-
}, onBlur:
|
|
204
|
+
}, onBlur: (event) => {
|
|
229
205
|
event.preventDefault();
|
|
230
206
|
if (!isFocusInside(event.relatedTarget)) {
|
|
231
207
|
handleColorInputChange();
|
|
232
208
|
}
|
|
233
209
|
} })))));
|
|
234
|
-
|
|
210
|
+
const rgbInputs = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
235
211
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 255
|
|
236
212
|
? 'negative'
|
|
237
213
|
: undefined },
|
|
238
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value: (_f = input[0]) !== null && _f !== void 0 ? _f : '', onChange:
|
|
214
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value: (_f = input[0]) !== null && _f !== void 0 ? _f : '', onChange: (event) => {
|
|
239
215
|
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
240
|
-
}, onKeyDown:
|
|
216
|
+
}, onKeyDown: (event) => {
|
|
241
217
|
if (event.key === 'Enter') {
|
|
242
218
|
event.preventDefault();
|
|
243
219
|
handleColorInputChange();
|
|
244
220
|
}
|
|
245
|
-
}, onBlur:
|
|
221
|
+
}, onBlur: (event) => {
|
|
246
222
|
event.preventDefault();
|
|
247
223
|
if (!isFocusInside(event.relatedTarget)) {
|
|
248
224
|
handleColorInputChange();
|
|
@@ -251,14 +227,14 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
251
227
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 255
|
|
252
228
|
? 'negative'
|
|
253
229
|
: undefined },
|
|
254
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value: (_g = input[1]) !== null && _g !== void 0 ? _g : '', onChange:
|
|
230
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value: (_g = input[1]) !== null && _g !== void 0 ? _g : '', onChange: (event) => {
|
|
255
231
|
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
256
|
-
}, onKeyDown:
|
|
232
|
+
}, onKeyDown: (event) => {
|
|
257
233
|
if (event.key === 'Enter') {
|
|
258
234
|
event.preventDefault();
|
|
259
235
|
handleColorInputChange();
|
|
260
236
|
}
|
|
261
|
-
}, onBlur:
|
|
237
|
+
}, onBlur: (event) => {
|
|
262
238
|
event.preventDefault();
|
|
263
239
|
if (!isFocusInside(event.relatedTarget)) {
|
|
264
240
|
handleColorInputChange();
|
|
@@ -267,14 +243,14 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
267
243
|
react_1.default.createElement(utils_1.InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 255
|
|
268
244
|
? 'negative'
|
|
269
245
|
: undefined },
|
|
270
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value: (_h = input[2]) !== null && _h !== void 0 ? _h : '', onChange:
|
|
246
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value: (_h = input[2]) !== null && _h !== void 0 ? _h : '', onChange: (event) => {
|
|
271
247
|
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
272
|
-
}, onKeyDown:
|
|
248
|
+
}, onKeyDown: (event) => {
|
|
273
249
|
if (event.key === 'Enter') {
|
|
274
250
|
event.preventDefault();
|
|
275
251
|
handleColorInputChange();
|
|
276
252
|
}
|
|
277
|
-
}, onBlur:
|
|
253
|
+
}, onBlur: (event) => {
|
|
278
254
|
event.preventDefault();
|
|
279
255
|
if (!isFocusInside(event.relatedTarget)) {
|
|
280
256
|
handleColorInputChange();
|
|
@@ -283,20 +259,20 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
283
259
|
showAlpha && (react_1.default.createElement(utils_1.InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
284
260
|
? 'negative'
|
|
285
261
|
: undefined },
|
|
286
|
-
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_j = input[3]) !== null && _j !== void 0 ? _j : '', onChange:
|
|
262
|
+
react_1.default.createElement(Input_1.Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: (_j = input[3]) !== null && _j !== void 0 ? _j : '', onChange: (event) => {
|
|
287
263
|
setInput([input[0], input[1], input[2], event.target.value]);
|
|
288
|
-
}, onKeyDown:
|
|
264
|
+
}, onKeyDown: (event) => {
|
|
289
265
|
if (event.key === 'Enter') {
|
|
290
266
|
event.preventDefault();
|
|
291
267
|
handleColorInputChange();
|
|
292
268
|
}
|
|
293
|
-
}, onBlur:
|
|
269
|
+
}, onBlur: (event) => {
|
|
294
270
|
event.preventDefault();
|
|
295
271
|
if (!isFocusInside(event.relatedTarget)) {
|
|
296
272
|
handleColorInputChange();
|
|
297
273
|
}
|
|
298
274
|
} })))));
|
|
299
|
-
return (react_1.default.createElement("div",
|
|
275
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-color-input-wrapper', className), ref: ref, ...rest },
|
|
300
276
|
react_1.default.createElement("div", { className: 'iui-color-picker-section-label' }, showAlpha && currentFormat != 'hex'
|
|
301
277
|
? currentFormat.toUpperCase() + 'A'
|
|
302
278
|
: currentFormat.toUpperCase()),
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
@@ -30,12 +8,12 @@ exports.ColorPalette = void 0;
|
|
|
30
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
10
|
*--------------------------------------------------------------------------------------------*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const ColorPicker_1 = require("./ColorPicker");
|
|
15
|
+
const ColorSwatch_1 = require("./ColorSwatch");
|
|
16
|
+
const ColorPickerContext_1 = require("./ColorPickerContext");
|
|
39
17
|
require("@itwin/itwinui-css/css/color-picker.css");
|
|
40
18
|
/**
|
|
41
19
|
* `ColorPalette` is used to show a group of `ColorSwatch` components.
|
|
@@ -48,43 +26,41 @@ require("@itwin/itwinui-css/css/color-picker.css");
|
|
|
48
26
|
* // ...
|
|
49
27
|
* </ColorPalette>
|
|
50
28
|
*/
|
|
51
|
-
exports.ColorPalette = react_1.default.forwardRef(
|
|
52
|
-
|
|
29
|
+
exports.ColorPalette = react_1.default.forwardRef((props, ref) => {
|
|
30
|
+
const { colors, label, className, children, ...rest } = props;
|
|
53
31
|
(0, utils_1.useTheme)();
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
const { activeColor, setActiveColor, onChangeComplete, } = (0, ColorPickerContext_1.useColorPickerContext)();
|
|
33
|
+
const [focusedIndex, setFocusedIndex] = react_1.default.useState();
|
|
56
34
|
// callback ref to set tabindex=0 on first child if none of the swatches are tabbable
|
|
57
|
-
|
|
35
|
+
const setDefaultTabIndex = (el) => {
|
|
58
36
|
var _a;
|
|
59
37
|
if (el && !el.querySelector('[tabindex="0"]')) {
|
|
60
38
|
(_a = el.firstElementChild) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
|
|
61
39
|
}
|
|
62
40
|
};
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
const paletteRef = react_1.default.useRef(null);
|
|
42
|
+
const paletteRefs = (0, utils_1.useMergedRefs)(paletteRef, setDefaultTabIndex);
|
|
65
43
|
// Color palette arrow key navigation
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
const handleKeyDown = (event) => {
|
|
45
|
+
const swatches = (0, utils_1.getFocusableElements)(paletteRef.current);
|
|
68
46
|
if (!swatches.length) {
|
|
69
47
|
return;
|
|
70
48
|
}
|
|
71
|
-
|
|
49
|
+
const currentIndex = swatches.findIndex((swatch) => { var _a; return swatch === ((_a = paletteRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.activeElement); });
|
|
72
50
|
if (currentIndex < 0) {
|
|
73
51
|
return;
|
|
74
52
|
}
|
|
75
|
-
|
|
53
|
+
let newIndex = -1;
|
|
76
54
|
switch (event.key) {
|
|
77
55
|
case 'ArrowDown': {
|
|
78
56
|
// Look for next ColorSwatch with same offsetLeft value
|
|
79
|
-
newIndex = swatches.findIndex(
|
|
80
|
-
|
|
81
|
-
swatch.offsetLeft === swatches[currentIndex].offsetLeft;
|
|
82
|
-
});
|
|
57
|
+
newIndex = swatches.findIndex((swatch, index) => index > currentIndex &&
|
|
58
|
+
swatch.offsetLeft === swatches[currentIndex].offsetLeft);
|
|
83
59
|
break;
|
|
84
60
|
}
|
|
85
61
|
case 'ArrowUp': {
|
|
86
62
|
// Look backwards for next ColorSwatch with same offsetLeft value
|
|
87
|
-
for (
|
|
63
|
+
for (let i = currentIndex - 1; i >= 0; i--) {
|
|
88
64
|
if (swatches[i].offsetLeft === swatches[currentIndex].offsetLeft) {
|
|
89
65
|
newIndex = i;
|
|
90
66
|
break;
|
|
@@ -111,21 +87,21 @@ exports.ColorPalette = react_1.default.forwardRef(function (props, ref) {
|
|
|
111
87
|
}
|
|
112
88
|
};
|
|
113
89
|
// call focus() when focusedIndex changes
|
|
114
|
-
react_1.default.useEffect(
|
|
90
|
+
react_1.default.useEffect(() => {
|
|
115
91
|
var _a;
|
|
116
92
|
if (focusedIndex != null) {
|
|
117
|
-
|
|
93
|
+
const swatches = (0, utils_1.getFocusableElements)(paletteRef.current);
|
|
118
94
|
(_a = swatches[focusedIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
119
95
|
}
|
|
120
96
|
}, [focusedIndex]);
|
|
121
|
-
return (react_1.default.createElement("div",
|
|
97
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-color-palette-wrapper', className), ref: ref, ...rest },
|
|
122
98
|
label && react_1.default.createElement("div", { className: 'iui-color-picker-section-label' }, label),
|
|
123
99
|
react_1.default.createElement("div", { className: 'iui-color-palette', onKeyDown: handleKeyDown, ref: paletteRefs },
|
|
124
100
|
children,
|
|
125
101
|
colors &&
|
|
126
|
-
colors.map(
|
|
127
|
-
|
|
128
|
-
return (react_1.default.createElement(ColorSwatch_1.ColorSwatch, { key: index, color: color, onClick:
|
|
102
|
+
colors.map((_color, index) => {
|
|
103
|
+
const color = (0, ColorPicker_1.getColorValue)(_color);
|
|
104
|
+
return (react_1.default.createElement(ColorSwatch_1.ColorSwatch, { key: index, color: color, onClick: (event) => {
|
|
129
105
|
event.preventDefault();
|
|
130
106
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(color);
|
|
131
107
|
setActiveColor(color);
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
@@ -30,12 +8,12 @@ exports.ColorPicker = exports.getColorValue = void 0;
|
|
|
30
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
10
|
*--------------------------------------------------------------------------------------------*/
|
|
33
|
-
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
34
12
|
require("@itwin/itwinui-css/css/color-picker.css");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
15
|
+
const ColorPickerContext_1 = require("./ColorPickerContext");
|
|
16
|
+
const getColorValue = (color) => {
|
|
39
17
|
if (color instanceof utils_1.ColorValue) {
|
|
40
18
|
return color;
|
|
41
19
|
}
|
|
@@ -55,41 +33,39 @@ exports.getColorValue = getColorValue;
|
|
|
55
33
|
* <ColorPalette label='Saved colors' colors={['#FFFFFF', '#5A6973']} />
|
|
56
34
|
* </ColorPicker>
|
|
57
35
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
const ColorPicker = (props) => {
|
|
37
|
+
const { children, className, selectedColor, onChange, onChangeComplete, setFocus = false, showAlpha = false, ...rest } = props;
|
|
60
38
|
(0, utils_1.useTheme)();
|
|
61
|
-
|
|
39
|
+
const ref = react_1.default.useRef(null);
|
|
62
40
|
// set focus on the first tabbable element
|
|
63
|
-
react_1.default.useEffect(
|
|
41
|
+
react_1.default.useEffect(() => {
|
|
64
42
|
if (ref.current && setFocus) {
|
|
65
|
-
|
|
43
|
+
const tabbableElements = (0, utils_1.getTabbableElements)(ref.current);
|
|
66
44
|
tabbableElements[0].focus();
|
|
67
45
|
}
|
|
68
46
|
}, [setFocus]);
|
|
69
|
-
|
|
47
|
+
const inColor = react_1.default.useMemo(() => (0, exports.getColorValue)(selectedColor), [
|
|
70
48
|
selectedColor,
|
|
71
49
|
]);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
react_1.default.useEffect(
|
|
50
|
+
const activeColorTbgr = react_1.default.useRef(inColor.toTbgr());
|
|
51
|
+
const [activeColor, setActiveColor] = react_1.default.useState(inColor); // Color of colorDot or active ColorSwatch
|
|
52
|
+
react_1.default.useEffect(() => {
|
|
75
53
|
setActiveColor(inColor);
|
|
76
54
|
}, [inColor]);
|
|
77
|
-
|
|
78
|
-
return activeColor.toHsvColor();
|
|
79
|
-
}), hsvColor = _d[0], setHsvColor = _d[1];
|
|
55
|
+
const [hsvColor, setHsvColor] = react_1.default.useState(() => activeColor.toHsvColor());
|
|
80
56
|
// The following code is used to preserve the Hue after initial mount. If the current HSV value produces the same rgb value
|
|
81
57
|
// as the selectedColor prop then leave the HSV color unchanged. This prevents the jumping of HUE as the s/v values are changed
|
|
82
58
|
// by user moving the pointer.
|
|
83
|
-
react_1.default.useEffect(
|
|
59
|
+
react_1.default.useEffect(() => {
|
|
84
60
|
if (inColor.toTbgr() !== activeColorTbgr.current) {
|
|
85
61
|
activeColorTbgr.current = inColor.toTbgr();
|
|
86
62
|
setHsvColor(inColor.toHsvColor());
|
|
87
63
|
}
|
|
88
64
|
}, [inColor]);
|
|
89
|
-
|
|
65
|
+
const applyHsvColorChange = react_1.default.useCallback((newColor, selectionChanged, newColorValue) => {
|
|
90
66
|
// save the HSV values
|
|
91
67
|
setHsvColor(newColor);
|
|
92
|
-
|
|
68
|
+
const newActiveColor = newColorValue !== null && newColorValue !== void 0 ? newColorValue : utils_1.ColorValue.create(newColor);
|
|
93
69
|
// Only update selected color when dragging is done
|
|
94
70
|
if (selectionChanged) {
|
|
95
71
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newActiveColor);
|
|
@@ -101,14 +77,14 @@ var ColorPicker = function (props) {
|
|
|
101
77
|
// this converts it to store in tbgr
|
|
102
78
|
setActiveColor(newActiveColor);
|
|
103
79
|
}, [onChange, onChangeComplete]);
|
|
104
|
-
return (react_1.default.createElement("div",
|
|
80
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-color-picker', className), ref: ref, ...rest },
|
|
105
81
|
react_1.default.createElement(ColorPickerContext_1.ColorPickerContext.Provider, { value: {
|
|
106
|
-
activeColor
|
|
107
|
-
setActiveColor
|
|
108
|
-
hsvColor
|
|
109
|
-
applyHsvColorChange
|
|
110
|
-
onChangeComplete
|
|
111
|
-
showAlpha
|
|
82
|
+
activeColor,
|
|
83
|
+
setActiveColor,
|
|
84
|
+
hsvColor,
|
|
85
|
+
applyHsvColorChange,
|
|
86
|
+
onChangeComplete,
|
|
87
|
+
showAlpha,
|
|
112
88
|
} }, children)));
|
|
113
89
|
};
|
|
114
90
|
exports.ColorPicker = ColorPicker;
|
|
@@ -8,10 +8,10 @@ exports.useColorPickerContext = exports.ColorPickerContext = 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
|
exports.ColorPickerContext = react_1.default.createContext(undefined);
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const useColorPickerContext = () => {
|
|
14
|
+
const context = react_1.default.useContext(exports.ColorPickerContext);
|
|
15
15
|
if (context == undefined) {
|
|
16
16
|
throw new Error('useColorPickerContext must be used within a ColorPickerContext.Provider');
|
|
17
17
|
}
|