@itwin/itwinui-react 3.0.0-dev.0 → 3.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +28 -22
- package/cjs/core/Alert/Alert.d.ts +47 -29
- package/cjs/core/Alert/Alert.js +73 -22
- package/cjs/core/Avatar/Avatar.d.ts +0 -1
- package/cjs/core/Avatar/Avatar.js +1 -2
- package/cjs/core/AvatarGroup/AvatarGroup.d.ts +0 -1
- package/cjs/core/AvatarGroup/AvatarGroup.js +1 -2
- package/cjs/core/Backdrop/Backdrop.d.ts +0 -1
- package/cjs/core/Backdrop/Backdrop.js +0 -1
- package/cjs/core/Badge/Badge.d.ts +0 -1
- package/cjs/core/Badge/Badge.js +0 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +0 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -4
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -5
- package/cjs/core/Buttons/Button/Button.d.ts +0 -1
- package/cjs/core/Buttons/Button/Button.js +0 -1
- package/cjs/core/Buttons/DropdownButton/DropdownButton.d.ts +0 -1
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -6
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +0 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +0 -2
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +0 -1
- package/cjs/core/Buttons/SplitButton/SplitButton.js +0 -1
- package/cjs/core/Carousel/Carousel.d.ts +2 -3
- package/cjs/core/Carousel/Carousel.js +3 -6
- package/cjs/core/Carousel/CarouselDotsList.d.ts +0 -1
- package/cjs/core/Carousel/CarouselDotsList.js +8 -11
- package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/cjs/core/Carousel/CarouselNavigation.js +3 -5
- package/cjs/core/Carousel/CarouselSlider.js +10 -15
- package/cjs/core/Checkbox/Checkbox.d.ts +0 -1
- package/cjs/core/Checkbox/Checkbox.js +0 -1
- package/cjs/core/ColorPicker/ColorBuilder.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +7 -11
- package/cjs/core/ColorPicker/ColorInputPanel.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +12 -16
- package/cjs/core/ColorPicker/ColorPalette.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorPalette.js +4 -7
- package/cjs/core/ColorPicker/ColorPicker.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorPicker.js +3 -4
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +0 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +0 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +0 -1
- package/cjs/core/ComboBox/ComboBox.js +25 -33
- package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
- package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/cjs/core/ComboBox/helpers.js +4 -5
- package/cjs/core/DatePicker/DatePicker.d.ts +0 -1
- package/cjs/core/DatePicker/DatePicker.js +32 -33
- package/cjs/core/Dialog/Dialog.d.ts +0 -1
- package/cjs/core/Dialog/Dialog.js +12 -5
- package/cjs/core/Dialog/DialogBackdrop.js +1 -1
- package/cjs/core/Dialog/DialogButtonBar.d.ts +0 -1
- package/cjs/core/Dialog/DialogButtonBar.js +0 -1
- package/cjs/core/Dialog/DialogContent.d.ts +0 -1
- package/cjs/core/Dialog/DialogContent.js +0 -1
- package/cjs/core/Dialog/DialogContext.d.ts +15 -0
- package/cjs/core/Dialog/DialogMain.d.ts +0 -1
- package/cjs/core/Dialog/DialogMain.js +18 -25
- package/cjs/core/Dialog/DialogTitleBar.d.ts +0 -1
- package/cjs/core/Dialog/DialogTitleBar.js +0 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +0 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.js +0 -1
- package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +5 -1
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +8 -6
- package/cjs/core/Fieldset/Fieldset.d.ts +0 -1
- package/cjs/core/Fieldset/Fieldset.js +0 -1
- package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
- package/cjs/core/FileUpload/FileUpload.d.ts +0 -1
- package/cjs/core/FileUpload/FileUpload.js +3 -7
- package/cjs/core/FileUpload/FileUploadCard.d.ts +0 -1
- package/cjs/core/FileUpload/FileUploadCard.js +10 -12
- package/cjs/core/FileUpload/FileUploadTemplate.d.ts +0 -1
- package/cjs/core/FileUpload/FileUploadTemplate.js +0 -1
- package/cjs/core/Footer/Footer.d.ts +0 -1
- package/cjs/core/Footer/Footer.js +0 -1
- package/cjs/core/Footer/FooterItem.d.ts +0 -1
- package/cjs/core/Footer/FooterItem.js +0 -1
- package/cjs/core/Footer/FooterList.d.ts +0 -1
- package/cjs/core/Footer/FooterList.js +0 -1
- package/cjs/core/Footer/FooterSeparator.d.ts +0 -1
- package/cjs/core/Footer/FooterSeparator.js +0 -1
- package/cjs/core/Header/Header.d.ts +0 -1
- package/cjs/core/Header/Header.js +0 -1
- package/cjs/core/Header/HeaderBreadcrumbs.d.ts +0 -1
- package/cjs/core/Header/HeaderBreadcrumbs.js +0 -1
- package/cjs/core/Header/HeaderButton.d.ts +0 -1
- package/cjs/core/Header/HeaderButton.js +0 -1
- package/cjs/core/Header/HeaderLogo.d.ts +0 -1
- package/cjs/core/Header/HeaderLogo.js +0 -1
- package/cjs/core/InformationPanel/InformationPanel.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanel.js +1 -5
- package/cjs/core/InformationPanel/InformationPanelBody.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelBody.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelContent.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelContent.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/cjs/core/InformationPanel/InformationPanelWrapper.d.ts +0 -1
- package/cjs/core/InformationPanel/InformationPanelWrapper.js +0 -1
- package/cjs/core/Input/Input.d.ts +0 -1
- package/cjs/core/Input/Input.js +0 -1
- package/cjs/core/InputGroup/InputGroup.d.ts +0 -1
- package/cjs/core/InputGroup/InputGroup.js +0 -1
- package/cjs/core/Label/Label.d.ts +0 -1
- package/cjs/core/Label/Label.js +0 -1
- package/cjs/core/LabeledInput/LabeledInput.d.ts +0 -1
- package/cjs/core/LabeledInput/LabeledInput.js +1 -2
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +0 -1
- package/cjs/core/LabeledSelect/LabeledSelect.js +0 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +0 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -2
- package/cjs/core/List/List.d.ts +0 -1
- package/cjs/core/List/List.js +0 -1
- package/cjs/core/List/ListItem.d.ts +0 -1
- package/cjs/core/List/ListItem.js +0 -1
- package/cjs/core/Menu/Menu.d.ts +0 -1
- package/cjs/core/Menu/Menu.js +3 -5
- package/cjs/core/Menu/MenuDivider.d.ts +0 -1
- package/cjs/core/Menu/MenuDivider.js +0 -1
- package/cjs/core/Menu/MenuExtraContent.d.ts +0 -1
- package/cjs/core/Menu/MenuExtraContent.js +0 -1
- package/cjs/core/Menu/MenuItem.d.ts +0 -1
- package/cjs/core/Menu/MenuItem.js +8 -12
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +0 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/Modal/Modal.d.ts +8 -10
- package/cjs/core/Modal/Modal.js +7 -18
- package/cjs/core/NonIdealState/NonIdealState.d.ts +0 -1
- package/cjs/core/NonIdealState/NonIdealState.js +0 -1
- package/cjs/core/NotificationMarker/NotificationMarker.d.ts +0 -1
- package/cjs/core/NotificationMarker/NotificationMarker.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.d.ts +0 -1
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +0 -1
- package/cjs/core/Radio/Radio.d.ts +0 -1
- package/cjs/core/Radio/Radio.js +0 -1
- package/cjs/core/RadioTiles/RadioTile.d.ts +0 -1
- package/cjs/core/RadioTiles/RadioTile.js +0 -1
- package/cjs/core/RadioTiles/RadioTileGroup.d.ts +0 -1
- package/cjs/core/RadioTiles/RadioTileGroup.js +0 -1
- package/cjs/core/SearchBox/SearchBox.d.ts +0 -1
- package/cjs/core/SearchBox/SearchBox.js +12 -13
- package/cjs/core/Select/Select.d.ts +0 -1
- package/cjs/core/Select/Select.js +12 -18
- package/cjs/core/Select/SelectTag.d.ts +0 -1
- package/cjs/core/Select/SelectTag.js +0 -1
- package/cjs/core/SideNavigation/SideNavigation.d.ts +0 -1
- package/cjs/core/SideNavigation/SideNavigation.js +2 -3
- package/cjs/core/SideNavigation/SidenavButton.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavButton.js +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenu.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenu.js +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.d.ts +0 -1
- package/cjs/core/SideNavigation/SidenavSubmenuHeader.js +0 -1
- package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +0 -1
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +0 -1
- package/cjs/core/Slider/Slider.d.ts +0 -1
- package/cjs/core/Slider/Slider.js +16 -20
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/Slider/Track.js +2 -1
- package/cjs/core/StatusMessage/StatusMessage.js +1 -1
- package/cjs/core/Stepper/Stepper.d.ts +0 -1
- package/cjs/core/Stepper/Stepper.js +1 -2
- package/cjs/core/Stepper/StepperStep.js +1 -1
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +0 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +0 -1
- package/cjs/core/Surface/Surface.d.ts +0 -1
- package/cjs/core/Surface/Surface.js +0 -1
- package/cjs/core/Table/Table.d.ts +0 -1
- package/cjs/core/Table/Table.js +33 -34
- package/cjs/core/Table/TableCell.js +3 -2
- package/cjs/core/Table/TablePaginator.d.ts +0 -1
- package/cjs/core/Table/TablePaginator.js +10 -12
- package/cjs/core/Table/TableRowMemoized.js +40 -47
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
- package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
- package/cjs/core/Table/cells/DefaultCell.js +4 -3
- package/cjs/core/Table/cells/EditableCell.js +7 -13
- package/cjs/core/Table/columns/actionColumn.js +3 -6
- package/cjs/core/Table/columns/expanderColumn.js +3 -3
- package/cjs/core/Table/columns/selectionColumn.js +4 -4
- package/cjs/core/Table/filters/BaseFilter.d.ts +0 -1
- package/cjs/core/Table/filters/BaseFilter.js +1 -2
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +0 -1
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -4
- package/cjs/core/Table/filters/FilterButtonBar.d.ts +0 -1
- package/cjs/core/Table/filters/FilterButtonBar.js +1 -2
- package/cjs/core/Table/filters/FilterToggle.d.ts +0 -1
- package/cjs/core/Table/filters/FilterToggle.js +0 -1
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.d.ts +0 -1
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -4
- package/cjs/core/Table/filters/TextFilter/TextFilter.d.ts +0 -1
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -3
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +8 -4
- package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
- package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
- package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
- package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/cjs/core/Tabs/Tab.d.ts +0 -1
- package/cjs/core/Tabs/Tab.js +0 -1
- package/cjs/core/Tabs/Tabs.d.ts +0 -1
- package/cjs/core/Tabs/Tabs.js +16 -19
- package/cjs/core/Tag/Tag.d.ts +0 -1
- package/cjs/core/Tag/Tag.js +0 -1
- package/cjs/core/Tag/TagContainer.d.ts +0 -1
- package/cjs/core/Tag/TagContainer.js +0 -1
- package/cjs/core/Textarea/Textarea.d.ts +0 -1
- package/cjs/core/Textarea/Textarea.js +0 -1
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -5
- package/cjs/core/ThemeProvider/ThemeProvider.js +11 -15
- package/cjs/core/Tile/Tile.d.ts +0 -1
- package/cjs/core/Tile/Tile.js +3 -7
- package/cjs/core/TimePicker/TimePicker.d.ts +0 -1
- package/cjs/core/TimePicker/TimePicker.js +13 -14
- package/cjs/core/Toast/Toast.d.ts +0 -1
- package/cjs/core/Toast/Toast.js +2 -4
- package/cjs/core/Toast/ToastWrapper.d.ts +0 -1
- package/cjs/core/Toast/ToastWrapper.js +0 -1
- package/cjs/core/Toast/Toaster.js +6 -11
- package/cjs/core/ToggleSwitch/ToggleSwitch.d.ts +0 -1
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +1 -3
- package/cjs/core/Tooltip/Tooltip.d.ts +0 -1
- package/cjs/core/Tooltip/Tooltip.js +0 -1
- package/cjs/core/TransferList/TransferList.d.ts +69 -0
- package/cjs/core/TransferList/TransferList.js +147 -0
- package/cjs/core/TransferList/index.d.ts +3 -0
- package/cjs/core/TransferList/index.js +10 -0
- package/cjs/core/Tree/Tree.d.ts +0 -1
- package/cjs/core/Tree/Tree.js +9 -14
- package/cjs/core/Tree/TreeNode.d.ts +0 -1
- package/cjs/core/Tree/TreeNode.js +9 -11
- package/cjs/core/Tree/TreeNodeExpander.d.ts +0 -1
- package/cjs/core/Tree/TreeNodeExpander.js +0 -1
- package/cjs/core/Typography/Anchor/Anchor.d.ts +0 -1
- package/cjs/core/Typography/Anchor/Anchor.js +0 -1
- package/cjs/core/Typography/Blockquote/Blockquote.d.ts +0 -1
- package/cjs/core/Typography/Blockquote/Blockquote.js +0 -1
- package/cjs/core/Typography/Code/Code.d.ts +0 -1
- package/cjs/core/Typography/Code/Code.js +0 -1
- package/cjs/core/Typography/Kbd/Kbd.d.ts +0 -1
- package/cjs/core/Typography/Kbd/Kbd.js +0 -1
- package/cjs/core/Typography/Text/Text.d.ts +0 -1
- package/cjs/core/Typography/Text/Text.js +0 -1
- package/cjs/core/index.d.ts +1 -0
- package/cjs/core/index.js +118 -116
- package/cjs/core/utils/color/ColorValue.js +9 -15
- package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/cjs/core/utils/components/Divider.d.ts +0 -1
- package/cjs/core/utils/components/Divider.js +0 -1
- package/cjs/core/utils/components/Flex.d.ts +0 -1
- package/cjs/core/utils/components/Flex.js +0 -1
- package/cjs/core/utils/components/FocusTrap.js +4 -4
- package/cjs/core/utils/components/Icon.d.ts +0 -1
- package/cjs/core/utils/components/Icon.js +0 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +0 -1
- package/cjs/core/utils/components/InputFlexContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputFlexContainer.js +0 -1
- package/cjs/core/utils/components/LinkAction.d.ts +0 -1
- package/cjs/core/utils/components/LinkAction.js +0 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
- package/cjs/core/utils/components/Popover.d.ts +0 -1
- package/cjs/core/utils/components/Popover.js +5 -9
- package/cjs/core/utils/components/Resizer.js +7 -6
- package/cjs/core/utils/components/VirtualScroll.js +14 -21
- package/cjs/core/utils/components/VisuallyHidden.d.ts +0 -1
- package/cjs/core/utils/components/VisuallyHidden.js +0 -1
- package/cjs/core/utils/functions/dom.d.ts +6 -0
- package/cjs/core/utils/functions/dom.js +24 -6
- package/cjs/core/utils/functions/index.d.ts +0 -1
- package/cjs/core/utils/functions/index.js +0 -1
- package/cjs/core/utils/functions/polymorphic.js +9 -1
- package/cjs/core/utils/functions/supports.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +0 -1
- package/cjs/core/utils/hooks/index.js +0 -1
- package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
- package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
- package/cjs/core/utils/hooks/useEventListener.js +1 -1
- package/cjs/core/utils/hooks/useGlobals.d.ts +9 -4
- package/cjs/core/utils/hooks/useGlobals.js +6 -6
- package/cjs/core/utils/hooks/useId.js +1 -2
- package/cjs/core/utils/hooks/useIntersection.js +2 -3
- package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
- package/cjs/core/utils/hooks/useOverflow.js +1 -2
- package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
- package/cjs/styles.d.ts +5 -0
- package/cjs/styles.js +450 -0
- package/esm/core/Alert/Alert.d.ts +47 -29
- package/esm/core/Alert/Alert.js +74 -23
- package/esm/core/Avatar/Avatar.d.ts +0 -1
- package/esm/core/Avatar/Avatar.js +1 -2
- package/esm/core/AvatarGroup/AvatarGroup.d.ts +0 -1
- package/esm/core/AvatarGroup/AvatarGroup.js +1 -2
- package/esm/core/Backdrop/Backdrop.d.ts +0 -1
- package/esm/core/Backdrop/Backdrop.js +0 -1
- package/esm/core/Badge/Badge.d.ts +0 -1
- package/esm/core/Badge/Badge.js +0 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +0 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -4
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -5
- package/esm/core/Buttons/Button/Button.d.ts +0 -1
- package/esm/core/Buttons/Button/Button.js +0 -1
- package/esm/core/Buttons/DropdownButton/DropdownButton.d.ts +0 -1
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -6
- package/esm/core/Buttons/IconButton/IconButton.d.ts +0 -2
- package/esm/core/Buttons/IconButton/IconButton.js +0 -2
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +0 -1
- package/esm/core/Buttons/SplitButton/SplitButton.js +0 -1
- package/esm/core/Carousel/Carousel.d.ts +2 -3
- package/esm/core/Carousel/Carousel.js +3 -6
- package/esm/core/Carousel/CarouselDotsList.d.ts +0 -1
- package/esm/core/Carousel/CarouselDotsList.js +8 -11
- package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/esm/core/Carousel/CarouselNavigation.js +3 -5
- package/esm/core/Carousel/CarouselSlider.js +10 -15
- package/esm/core/Checkbox/Checkbox.d.ts +0 -1
- package/esm/core/Checkbox/Checkbox.js +0 -1
- package/esm/core/ColorPicker/ColorBuilder.d.ts +0 -1
- package/esm/core/ColorPicker/ColorBuilder.js +7 -11
- package/esm/core/ColorPicker/ColorInputPanel.d.ts +0 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +12 -16
- package/esm/core/ColorPicker/ColorPalette.d.ts +0 -1
- package/esm/core/ColorPicker/ColorPalette.js +4 -7
- package/esm/core/ColorPicker/ColorPicker.d.ts +0 -1
- package/esm/core/ColorPicker/ColorPicker.js +3 -4
- package/esm/core/ColorPicker/ColorSwatch.d.ts +0 -1
- package/esm/core/ColorPicker/ColorSwatch.js +0 -1
- package/esm/core/ComboBox/ComboBox.d.ts +0 -1
- package/esm/core/ComboBox/ComboBox.js +25 -33
- package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/esm/core/ComboBox/ComboBoxInput.js +21 -20
- package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
- package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/esm/core/ComboBox/helpers.js +4 -5
- package/esm/core/DatePicker/DatePicker.d.ts +0 -1
- package/esm/core/DatePicker/DatePicker.js +32 -33
- package/esm/core/Dialog/Dialog.d.ts +0 -1
- package/esm/core/Dialog/Dialog.js +13 -6
- package/esm/core/Dialog/DialogBackdrop.js +1 -1
- package/esm/core/Dialog/DialogButtonBar.d.ts +0 -1
- package/esm/core/Dialog/DialogButtonBar.js +0 -1
- package/esm/core/Dialog/DialogContent.d.ts +0 -1
- package/esm/core/Dialog/DialogContent.js +0 -1
- package/esm/core/Dialog/DialogContext.d.ts +15 -0
- package/esm/core/Dialog/DialogMain.d.ts +0 -1
- package/esm/core/Dialog/DialogMain.js +18 -25
- package/esm/core/Dialog/DialogTitleBar.d.ts +0 -1
- package/esm/core/Dialog/DialogTitleBar.js +0 -1
- package/esm/core/Dialog/DialogTitleBarTitle.d.ts +0 -1
- package/esm/core/Dialog/DialogTitleBarTitle.js +0 -1
- package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +5 -1
- package/esm/core/ExpandableBlock/ExpandableBlock.js +8 -6
- package/esm/core/Fieldset/Fieldset.d.ts +0 -1
- package/esm/core/Fieldset/Fieldset.js +0 -1
- package/esm/core/FileUpload/FileEmptyCard.js +1 -1
- package/esm/core/FileUpload/FileUpload.d.ts +0 -1
- package/esm/core/FileUpload/FileUpload.js +3 -7
- package/esm/core/FileUpload/FileUploadCard.d.ts +0 -1
- package/esm/core/FileUpload/FileUploadCard.js +10 -12
- package/esm/core/FileUpload/FileUploadTemplate.d.ts +0 -1
- package/esm/core/FileUpload/FileUploadTemplate.js +0 -1
- package/esm/core/Footer/Footer.d.ts +0 -1
- package/esm/core/Footer/Footer.js +0 -1
- package/esm/core/Footer/FooterItem.d.ts +0 -1
- package/esm/core/Footer/FooterItem.js +0 -1
- package/esm/core/Footer/FooterList.d.ts +0 -1
- package/esm/core/Footer/FooterList.js +0 -1
- package/esm/core/Footer/FooterSeparator.d.ts +0 -1
- package/esm/core/Footer/FooterSeparator.js +0 -1
- package/esm/core/Header/Header.d.ts +0 -1
- package/esm/core/Header/Header.js +0 -1
- package/esm/core/Header/HeaderBreadcrumbs.d.ts +0 -1
- package/esm/core/Header/HeaderBreadcrumbs.js +0 -1
- package/esm/core/Header/HeaderButton.d.ts +0 -1
- package/esm/core/Header/HeaderButton.js +0 -1
- package/esm/core/Header/HeaderLogo.d.ts +0 -1
- package/esm/core/Header/HeaderLogo.js +0 -1
- package/esm/core/InformationPanel/InformationPanel.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanel.js +1 -5
- package/esm/core/InformationPanel/InformationPanelBody.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelBody.js +0 -1
- package/esm/core/InformationPanel/InformationPanelContent.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelContent.js +0 -1
- package/esm/core/InformationPanel/InformationPanelHeader.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/esm/core/InformationPanel/InformationPanelWrapper.d.ts +0 -1
- package/esm/core/InformationPanel/InformationPanelWrapper.js +0 -1
- package/esm/core/Input/Input.d.ts +0 -1
- package/esm/core/Input/Input.js +0 -1
- package/esm/core/InputGroup/InputGroup.d.ts +0 -1
- package/esm/core/InputGroup/InputGroup.js +0 -1
- package/esm/core/Label/Label.d.ts +0 -1
- package/esm/core/Label/Label.js +0 -1
- package/esm/core/LabeledInput/LabeledInput.d.ts +0 -1
- package/esm/core/LabeledInput/LabeledInput.js +1 -2
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +0 -1
- package/esm/core/LabeledSelect/LabeledSelect.js +0 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +0 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -2
- package/esm/core/List/List.d.ts +0 -1
- package/esm/core/List/List.js +0 -1
- package/esm/core/List/ListItem.d.ts +0 -1
- package/esm/core/List/ListItem.js +0 -1
- package/esm/core/Menu/Menu.d.ts +0 -1
- package/esm/core/Menu/Menu.js +3 -5
- package/esm/core/Menu/MenuDivider.d.ts +0 -1
- package/esm/core/Menu/MenuDivider.js +0 -1
- package/esm/core/Menu/MenuExtraContent.d.ts +0 -1
- package/esm/core/Menu/MenuExtraContent.js +0 -1
- package/esm/core/Menu/MenuItem.d.ts +0 -1
- package/esm/core/Menu/MenuItem.js +8 -12
- package/esm/core/Menu/MenuItemSkeleton.d.ts +0 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/Modal/Modal.d.ts +8 -10
- package/esm/core/Modal/Modal.js +3 -11
- package/esm/core/NonIdealState/NonIdealState.d.ts +0 -1
- package/esm/core/NonIdealState/NonIdealState.js +0 -1
- package/esm/core/NotificationMarker/NotificationMarker.d.ts +0 -1
- package/esm/core/NotificationMarker/NotificationMarker.js +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +0 -1
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.d.ts +0 -1
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +0 -1
- package/esm/core/Radio/Radio.d.ts +0 -1
- package/esm/core/Radio/Radio.js +0 -1
- package/esm/core/RadioTiles/RadioTile.d.ts +0 -1
- package/esm/core/RadioTiles/RadioTile.js +0 -1
- package/esm/core/RadioTiles/RadioTileGroup.d.ts +0 -1
- package/esm/core/RadioTiles/RadioTileGroup.js +0 -1
- package/esm/core/SearchBox/SearchBox.d.ts +0 -1
- package/esm/core/SearchBox/SearchBox.js +12 -13
- package/esm/core/Select/Select.d.ts +0 -1
- package/esm/core/Select/Select.js +12 -18
- package/esm/core/Select/SelectTag.d.ts +0 -1
- package/esm/core/Select/SelectTag.js +0 -1
- package/esm/core/SideNavigation/SideNavigation.d.ts +0 -1
- package/esm/core/SideNavigation/SideNavigation.js +2 -3
- package/esm/core/SideNavigation/SidenavButton.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavButton.js +0 -1
- package/esm/core/SideNavigation/SidenavSubmenu.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavSubmenu.js +0 -1
- package/esm/core/SideNavigation/SidenavSubmenuHeader.d.ts +0 -1
- package/esm/core/SideNavigation/SidenavSubmenuHeader.js +0 -1
- package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +0 -1
- package/esm/core/SkipToContentLink/SkipToContentLink.js +0 -1
- package/esm/core/Slider/Slider.d.ts +0 -1
- package/esm/core/Slider/Slider.js +16 -20
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/Slider/Track.js +2 -1
- package/esm/core/StatusMessage/StatusMessage.js +1 -1
- package/esm/core/Stepper/Stepper.d.ts +0 -1
- package/esm/core/Stepper/Stepper.js +1 -2
- package/esm/core/Stepper/StepperStep.js +1 -1
- package/esm/core/Stepper/WorkflowDiagram.d.ts +0 -1
- package/esm/core/Stepper/WorkflowDiagram.js +0 -1
- package/esm/core/Surface/Surface.d.ts +0 -1
- package/esm/core/Surface/Surface.js +0 -1
- package/esm/core/Table/Table.d.ts +0 -1
- package/esm/core/Table/Table.js +34 -35
- package/esm/core/Table/TableCell.js +3 -2
- package/esm/core/Table/TablePaginator.d.ts +0 -1
- package/esm/core/Table/TablePaginator.js +11 -13
- package/esm/core/Table/TableRowMemoized.js +41 -48
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
- package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
- package/esm/core/Table/cells/DefaultCell.js +4 -3
- package/esm/core/Table/cells/EditableCell.js +8 -14
- package/esm/core/Table/columns/actionColumn.js +3 -6
- package/esm/core/Table/columns/expanderColumn.js +3 -3
- package/esm/core/Table/columns/selectionColumn.js +4 -4
- package/esm/core/Table/filters/BaseFilter.d.ts +0 -1
- package/esm/core/Table/filters/BaseFilter.js +2 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +0 -1
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -4
- package/esm/core/Table/filters/FilterButtonBar.d.ts +0 -1
- package/esm/core/Table/filters/FilterButtonBar.js +2 -3
- package/esm/core/Table/filters/FilterToggle.d.ts +0 -1
- package/esm/core/Table/filters/FilterToggle.js +0 -1
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.d.ts +0 -1
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -4
- package/esm/core/Table/filters/TextFilter/TextFilter.d.ts +0 -1
- package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -3
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +5 -4
- package/esm/core/Table/hooks/useResizeColumns.js +16 -22
- package/esm/core/Table/hooks/useScrollToRow.js +1 -2
- package/esm/core/Table/hooks/useStickyColumns.js +3 -5
- package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/esm/core/Tabs/Tab.d.ts +0 -1
- package/esm/core/Tabs/Tab.js +0 -1
- package/esm/core/Tabs/Tabs.d.ts +0 -1
- package/esm/core/Tabs/Tabs.js +16 -19
- package/esm/core/Tag/Tag.d.ts +0 -1
- package/esm/core/Tag/Tag.js +0 -1
- package/esm/core/Tag/TagContainer.d.ts +0 -1
- package/esm/core/Tag/TagContainer.js +0 -1
- package/esm/core/Textarea/Textarea.d.ts +0 -1
- package/esm/core/Textarea/Textarea.js +0 -1
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -5
- package/esm/core/ThemeProvider/ThemeProvider.js +12 -16
- package/esm/core/Tile/Tile.d.ts +0 -1
- package/esm/core/Tile/Tile.js +3 -7
- package/esm/core/TimePicker/TimePicker.d.ts +0 -1
- package/esm/core/TimePicker/TimePicker.js +13 -14
- package/esm/core/Toast/Toast.d.ts +0 -1
- package/esm/core/Toast/Toast.js +2 -4
- package/esm/core/Toast/ToastWrapper.d.ts +0 -1
- package/esm/core/Toast/ToastWrapper.js +0 -1
- package/esm/core/Toast/Toaster.js +6 -11
- package/esm/core/ToggleSwitch/ToggleSwitch.d.ts +0 -1
- package/esm/core/ToggleSwitch/ToggleSwitch.js +1 -3
- package/esm/core/Tooltip/Tooltip.d.ts +0 -1
- package/esm/core/Tooltip/Tooltip.js +0 -1
- package/esm/core/TransferList/TransferList.d.ts +69 -0
- package/esm/core/TransferList/TransferList.js +141 -0
- package/esm/core/TransferList/index.d.ts +3 -0
- package/esm/core/TransferList/index.js +6 -0
- package/esm/core/Tree/Tree.d.ts +0 -1
- package/esm/core/Tree/Tree.js +9 -14
- package/esm/core/Tree/TreeNode.d.ts +0 -1
- package/esm/core/Tree/TreeNode.js +9 -11
- package/esm/core/Tree/TreeNodeExpander.d.ts +0 -1
- package/esm/core/Tree/TreeNodeExpander.js +0 -1
- package/esm/core/Typography/Anchor/Anchor.d.ts +0 -1
- package/esm/core/Typography/Anchor/Anchor.js +0 -1
- package/esm/core/Typography/Blockquote/Blockquote.d.ts +0 -1
- package/esm/core/Typography/Blockquote/Blockquote.js +0 -1
- package/esm/core/Typography/Code/Code.d.ts +0 -1
- package/esm/core/Typography/Code/Code.js +0 -1
- package/esm/core/Typography/Kbd/Kbd.d.ts +0 -1
- package/esm/core/Typography/Kbd/Kbd.js +0 -1
- package/esm/core/Typography/Text/Text.d.ts +0 -1
- package/esm/core/Typography/Text/Text.js +0 -1
- package/esm/core/index.d.ts +1 -0
- package/esm/core/index.js +1 -0
- package/esm/core/utils/color/ColorValue.js +9 -15
- package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/esm/core/utils/components/Divider.d.ts +0 -1
- package/esm/core/utils/components/Divider.js +0 -1
- package/esm/core/utils/components/Flex.d.ts +0 -1
- package/esm/core/utils/components/Flex.js +0 -1
- package/esm/core/utils/components/FocusTrap.js +4 -4
- package/esm/core/utils/components/Icon.d.ts +0 -1
- package/esm/core/utils/components/Icon.js +0 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +0 -1
- package/esm/core/utils/components/InputFlexContainer.d.ts +0 -1
- package/esm/core/utils/components/InputFlexContainer.js +0 -1
- package/esm/core/utils/components/LinkAction.d.ts +0 -1
- package/esm/core/utils/components/LinkAction.js +0 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
- package/esm/core/utils/components/Popover.d.ts +0 -1
- package/esm/core/utils/components/Popover.js +5 -9
- package/esm/core/utils/components/Resizer.js +7 -6
- package/esm/core/utils/components/VirtualScroll.js +14 -21
- package/esm/core/utils/components/VisuallyHidden.d.ts +0 -1
- package/esm/core/utils/components/VisuallyHidden.js +0 -1
- package/esm/core/utils/functions/dom.d.ts +6 -0
- package/esm/core/utils/functions/dom.js +19 -5
- package/esm/core/utils/functions/index.d.ts +0 -1
- package/esm/core/utils/functions/index.js +0 -1
- package/esm/core/utils/functions/polymorphic.js +9 -1
- package/esm/core/utils/functions/supports.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +0 -1
- package/esm/core/utils/hooks/index.js +0 -1
- package/esm/core/utils/hooks/useContainerWidth.js +1 -1
- package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
- package/esm/core/utils/hooks/useEventListener.js +1 -1
- package/esm/core/utils/hooks/useGlobals.d.ts +9 -4
- package/esm/core/utils/hooks/useGlobals.js +6 -6
- package/esm/core/utils/hooks/useId.js +1 -2
- package/esm/core/utils/hooks/useIntersection.js +2 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -8
- package/esm/core/utils/hooks/useOverflow.js +1 -2
- package/esm/core/utils/hooks/useResizeObserver.js +3 -4
- package/esm/styles.d.ts +5 -0
- package/esm/styles.js +451 -0
- package/package.json +14 -11
- package/styles.css +1940 -0
- package/cjs/core/utils/functions/styles.d.ts +0 -6
- package/cjs/core/utils/functions/styles.js +0 -21
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
- package/esm/core/utils/functions/styles.d.ts +0 -6
- package/esm/core/utils/functions/styles.js +0 -17
- package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/avatar.css';
|
|
4
3
|
export declare type AvatarStatus = 'online' | 'busy' | 'away' | 'offline';
|
|
5
4
|
declare type StatusTitles = {
|
|
6
5
|
[key in Exclude<AvatarStatus, ''>]: string;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/avatar.css';
|
|
9
8
|
export const defaultStatusTitles = {
|
|
10
9
|
away: 'Away',
|
|
11
10
|
busy: 'Busy',
|
|
@@ -31,7 +30,7 @@ export const Avatar = React.forwardRef((props, ref) => {
|
|
|
31
30
|
const { size = 'small', status, abbreviation, image, backgroundColor, title, translatedStatusTitles, className, style, ...rest } = props;
|
|
32
31
|
const statusTitles = { ...defaultStatusTitles, ...translatedStatusTitles };
|
|
33
32
|
return (React.createElement(Box, { as: 'span', className: cx('iui-avatar', { [`iui-${size}`]: size !== 'medium' }, className), title: title, style: { backgroundColor, ...style }, ref: ref, ...rest },
|
|
34
|
-
!image && (React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, abbreviation
|
|
33
|
+
!image && (React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, abbreviation?.substring(0, 2))),
|
|
35
34
|
image,
|
|
36
35
|
React.createElement(Box, { as: 'span', className: 'iui-stroke' }),
|
|
37
36
|
status && (React.createElement(Box, { as: 'span', title: statusTitles[status], className: cx('iui-status', {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/avatar.css';
|
|
9
8
|
/**
|
|
10
9
|
* Group Avatars together.
|
|
11
10
|
*
|
|
@@ -51,7 +50,7 @@ export const AvatarGroup = React.forwardRef((props, ref) => {
|
|
|
51
50
|
childrenArray.length <= maxIcons + 1 && getAvatarList(maxIcons + 1),
|
|
52
51
|
childrenArray.length > maxIcons + 1 && (React.createElement(React.Fragment, null,
|
|
53
52
|
getAvatarList(maxIcons),
|
|
54
|
-
React.createElement(Box, { ...countIconProps, className: cx('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps
|
|
53
|
+
React.createElement(Box, { ...countIconProps, className: cx('iui-avatar', { [`iui-${iconSize}`]: iconSize !== 'medium' }, 'iui-avatar-count', countIconProps?.className) },
|
|
55
54
|
React.createElement(Box, { as: 'abbr', className: 'iui-initials' }, childrenLength <= maxLength
|
|
56
55
|
? `${childrenLength - maxIcons}`
|
|
57
56
|
: `${maxLength}+`),
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/backdrop.css';
|
|
9
8
|
export const Backdrop = React.forwardRef((props, ref) => {
|
|
10
9
|
const { isVisible = true, className, ...rest } = props;
|
|
11
10
|
return (React.createElement(Box, { className: cx('iui-backdrop', { 'iui-backdrop-visible': isVisible }, className), ref: ref, ...rest }));
|
package/esm/core/Badge/Badge.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { isSoftBackground, SoftBackgrounds, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/badge.css';
|
|
9
8
|
/**
|
|
10
9
|
* Helper function that returns one of the preset badge color values.
|
|
11
10
|
*/
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useMergedRefs, useOverflow, SvgChevronRight, Box, } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/breadcrumbs.css';
|
|
9
8
|
/**
|
|
10
9
|
* A breadcrumb trail is used as a navigational aid to help users keep track
|
|
11
10
|
* of their place in the application. It is often placed before a page's main content.
|
|
@@ -54,12 +53,11 @@ export const Breadcrumbs = React.forwardRef((props, ref) => {
|
|
|
54
53
|
}))));
|
|
55
54
|
});
|
|
56
55
|
const ListItem = ({ item, isActive, }) => {
|
|
57
|
-
var _a;
|
|
58
56
|
return (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, React.isValidElement(item)
|
|
59
57
|
? React.cloneElement(item, {
|
|
60
|
-
'aria-current':
|
|
58
|
+
'aria-current': item.props['aria-current'] ?? isActive ? 'location' : undefined,
|
|
61
59
|
})
|
|
62
60
|
: item));
|
|
63
61
|
};
|
|
64
|
-
const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator
|
|
62
|
+
const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(SvgChevronRight, null)));
|
|
65
63
|
export default Breadcrumbs;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useOverflow, useMergedRefs, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
9
8
|
/**
|
|
10
9
|
* Group buttons together for common actions.
|
|
11
10
|
* Handles responsive overflow when the `overflowButton` prop is specified.
|
|
@@ -36,10 +35,7 @@ import '@itwin/itwinui-css/css/button.css';
|
|
|
36
35
|
*/
|
|
37
36
|
export const ButtonGroup = React.forwardRef((props, ref) => {
|
|
38
37
|
const { children, className, overflowButton, overflowPlacement = 'end', orientation = 'horizontal', ...rest } = props;
|
|
39
|
-
const items = React.useMemo(() =>
|
|
40
|
-
var _a, _b;
|
|
41
|
-
return (_b = (_a = React.Children.map(children, (child) => !!child ? React.createElement("div", null, child) : undefined)) === null || _a === void 0 ? void 0 : _a.filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
|
42
|
-
}, [children]);
|
|
38
|
+
const items = React.useMemo(() => React.Children.map(children, (child) => !!child ? React.createElement("div", null, child) : undefined)?.filter(Boolean) ?? [], [children]);
|
|
43
39
|
const [overflowRef, visibleCount] = useOverflow(items, !overflowButton, orientation);
|
|
44
40
|
const refs = useMergedRefs(overflowRef, ref);
|
|
45
41
|
return (React.createElement(Box, { className: cx({
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { ButtonProps } from '../Button/Button.js';
|
|
3
3
|
import type { DropdownMenuProps } from '../../DropdownMenu/index.js';
|
|
4
4
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
5
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
6
5
|
export declare type DropdownButtonProps = {
|
|
7
6
|
/**
|
|
8
7
|
* Items in the dropdown menu.
|
|
@@ -7,7 +7,6 @@ import cx from 'classnames';
|
|
|
7
7
|
import { Button } from '../Button/index.js';
|
|
8
8
|
import { DropdownMenu } from '../../DropdownMenu/index.js';
|
|
9
9
|
import { SvgCaretDownSmall, SvgCaretUpSmall, useMergedRefs, } from '../../utils/index.js';
|
|
10
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
11
10
|
/**
|
|
12
11
|
* Button that opens a DropdownMenu.
|
|
13
12
|
* @example
|
|
@@ -29,14 +28,12 @@ export const DropdownButton = React.forwardRef((props, ref) => {
|
|
|
29
28
|
}
|
|
30
29
|
}, [children, size, styleType]);
|
|
31
30
|
return (React.createElement(DropdownMenu, { menuItems: menuItems, ...dropdownMenuProps, onShow: (i) => {
|
|
32
|
-
var _a;
|
|
33
31
|
setIsMenuOpen(true);
|
|
34
|
-
|
|
32
|
+
dropdownMenuProps?.onShow?.(i);
|
|
35
33
|
}, onHide: (i) => {
|
|
36
|
-
var _a;
|
|
37
34
|
setIsMenuOpen(false);
|
|
38
|
-
|
|
39
|
-
}, style: { minWidth: menuWidth, ...dropdownMenuProps
|
|
35
|
+
dropdownMenuProps?.onHide?.(i);
|
|
36
|
+
}, style: { minWidth: menuWidth, ...dropdownMenuProps?.style } },
|
|
40
37
|
React.createElement(Button, { className: cx('iui-button-dropdown', className), size: size, styleType: styleType, endIcon: isMenuOpen ? (React.createElement(SvgCaretUpSmall, { "aria-hidden": true })) : (React.createElement(SvgCaretDownSmall, { "aria-hidden": true })), ref: refs, "aria-label": 'Dropdown', ...rest }, children)));
|
|
41
38
|
});
|
|
42
39
|
export default DropdownButton;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ButtonProps } from '../Button/Button.js';
|
|
3
3
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
4
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
5
|
-
import '@itwin/itwinui-css/css/tooltip.css';
|
|
6
4
|
export declare type IconButtonProps = {
|
|
7
5
|
/**
|
|
8
6
|
* Button gets active style.
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import type { ButtonProps } from '../Button/Button.js';
|
|
3
3
|
import type { Placement } from 'tippy.js';
|
|
4
4
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
5
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
6
5
|
export declare type SplitButtonProps = ButtonProps & {
|
|
7
6
|
/**
|
|
8
7
|
* Items in the dropdown menu.
|
|
@@ -8,7 +8,6 @@ import { Button } from '../Button/index.js';
|
|
|
8
8
|
import { IconButton } from '../IconButton/index.js';
|
|
9
9
|
import { DropdownMenu } from '../../DropdownMenu/index.js';
|
|
10
10
|
import { Box, SvgCaretDownSmall, SvgCaretUpSmall } from '../../utils/index.js';
|
|
11
|
-
import '@itwin/itwinui-css/css/button.css';
|
|
12
11
|
/**
|
|
13
12
|
* Split button component with a DropdownMenu.
|
|
14
13
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/carousel.css';
|
|
4
3
|
declare type CarouselProps = {
|
|
5
4
|
/**
|
|
6
5
|
* Index of the currently shown slide.
|
|
@@ -39,7 +38,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
39
38
|
Navigation: PolymorphicForwardRefComponent<"nav", {}> & {
|
|
40
39
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
41
40
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
42
|
-
}, "label" | "as" | "size" | "
|
|
41
|
+
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
43
42
|
isActive?: boolean | undefined;
|
|
44
43
|
label?: React.ReactNode;
|
|
45
44
|
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
|
|
@@ -47,7 +46,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
47
46
|
}>;
|
|
48
47
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
49
48
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
50
|
-
}, "label" | "as" | "size" | "
|
|
49
|
+
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
51
50
|
isActive?: boolean | undefined;
|
|
52
51
|
label?: React.ReactNode;
|
|
53
52
|
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { getRandomValue, useMergedRefs, Box } from '../utils/index.js';
|
|
8
|
-
import '@itwin/itwinui-css/css/carousel.css';
|
|
9
8
|
import { CarouselContext } from './CarouselContext.js';
|
|
10
9
|
import { CarouselSlider } from './CarouselSlider.js';
|
|
11
10
|
import { CarouselSlide } from './CarouselSlide.js';
|
|
@@ -15,7 +14,7 @@ import { CarouselNavigation } from './CarouselNavigation.js';
|
|
|
15
14
|
const CarouselComponent = React.forwardRef((props, ref) => {
|
|
16
15
|
const { activeSlideIndex: userActiveIndex = 0, onSlideChange, className, children, ...rest } = props;
|
|
17
16
|
// Generate a stateful random id if not specified
|
|
18
|
-
const [id] = React.useState(() =>
|
|
17
|
+
const [id] = React.useState(() => props.id ?? `iui-carousel-${getRandomValue(10)}`);
|
|
19
18
|
const isManuallyUpdating = React.useRef(false);
|
|
20
19
|
const carouselRef = React.useRef(null);
|
|
21
20
|
const refs = useMergedRefs(carouselRef, ref);
|
|
@@ -23,7 +22,6 @@ const CarouselComponent = React.forwardRef((props, ref) => {
|
|
|
23
22
|
const scrollToSlide = React.useRef(() => { }); // stub function populated in CarouselSlider
|
|
24
23
|
const justMounted = React.useRef(true);
|
|
25
24
|
React.useEffect(() => {
|
|
26
|
-
var _a;
|
|
27
25
|
setCurrentIndex(userActiveIndex);
|
|
28
26
|
scrollToSlide.current(userActiveIndex, {
|
|
29
27
|
instant: justMounted.current,
|
|
@@ -31,7 +29,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
|
|
|
31
29
|
// re-focus the carousel for keyboard nav, but not on first mount
|
|
32
30
|
// because it shows outline and might interfere with other components
|
|
33
31
|
if (!justMounted.current) {
|
|
34
|
-
|
|
32
|
+
carouselRef.current?.focus({ preventScroll: true });
|
|
35
33
|
}
|
|
36
34
|
justMounted.current = false;
|
|
37
35
|
}, [userActiveIndex]);
|
|
@@ -66,8 +64,7 @@ const CarouselComponent = React.forwardRef((props, ref) => {
|
|
|
66
64
|
};
|
|
67
65
|
const userOnSlideChange = React.useRef(onSlideChange);
|
|
68
66
|
React.useEffect(() => {
|
|
69
|
-
|
|
70
|
-
(_a = userOnSlideChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnSlideChange, currentIndex);
|
|
67
|
+
userOnSlideChange.current?.(currentIndex);
|
|
71
68
|
}, [currentIndex]);
|
|
72
69
|
return (React.createElement(Box, { as: 'section', "aria-roledescription": 'carousel', tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, ref: refs, className: cx('iui-carousel', className), ...rest, id: id },
|
|
73
70
|
React.createElement(CarouselContext.Provider, { value: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
|
-
import '@itwin/itwinui-css/css/carousel.css';
|
|
3
2
|
declare type CarouselDotsListProps = {
|
|
4
3
|
/** Number of total dots/slides in the carousel. Will be inferred from Carousel context or children. Otherwise, it is required to be passed. */
|
|
5
4
|
length?: number;
|
|
@@ -7,7 +7,6 @@ import cx from 'classnames';
|
|
|
7
7
|
import { CarouselContext } from './CarouselContext.js';
|
|
8
8
|
import { getBoundedValue, getWindow, useMergedRefs, useResizeObserver, Box, } from '../utils/index.js';
|
|
9
9
|
import { CarouselDot } from './CarouselDot.js';
|
|
10
|
-
import '@itwin/itwinui-css/css/carousel.css';
|
|
11
10
|
/**
|
|
12
11
|
* The `CarouselDotsList` component shows a list of `CarouselDot` components which can be used to
|
|
13
12
|
* choose a specific slide. If used as a descendant of `Carousel`, then this component does not need
|
|
@@ -31,18 +30,17 @@ import '@itwin/itwinui-css/css/carousel.css';
|
|
|
31
30
|
* />
|
|
32
31
|
*/
|
|
33
32
|
export const CarouselDotsList = React.forwardRef((props, ref) => {
|
|
34
|
-
var _a, _b, _c;
|
|
35
33
|
const { currentIndex: userCurrentIndex, length, className, onSlideChange, children, ...rest } = props;
|
|
36
34
|
const context = React.useContext(CarouselContext);
|
|
37
|
-
const slideCount =
|
|
38
|
-
const currentIndex =
|
|
39
|
-
const idPrefix =
|
|
35
|
+
const slideCount = length ?? context?.slideCount ?? React.Children.count(children);
|
|
36
|
+
const currentIndex = userCurrentIndex ?? context?.currentIndex ?? 0;
|
|
37
|
+
const idPrefix = props.id ?? context?.idPrefix;
|
|
40
38
|
const handleSlideChange = React.useCallback((index) => {
|
|
41
39
|
if (context) {
|
|
42
40
|
context.setCurrentIndex(index);
|
|
43
41
|
context.scrollToSlide.current(index);
|
|
44
42
|
}
|
|
45
|
-
onSlideChange
|
|
43
|
+
onSlideChange?.(index);
|
|
46
44
|
}, [context, onSlideChange]);
|
|
47
45
|
const justMounted = React.useRef(true);
|
|
48
46
|
const [visibleCount, setVisibleCount] = React.useState(slideCount);
|
|
@@ -56,7 +54,7 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
|
|
|
56
54
|
const dotWidth = listRef.current.children[0].offsetWidth;
|
|
57
55
|
setVisibleCount(Math.floor(width / dotWidth));
|
|
58
56
|
});
|
|
59
|
-
React.useEffect(() => resizeObserver
|
|
57
|
+
React.useEffect(() => resizeObserver?.disconnect(), [resizeObserver]);
|
|
60
58
|
const refs = useMergedRefs(ref, resizeRef, listRef);
|
|
61
59
|
const firstVisibleDotIndex = React.useMemo(() => getBoundedValue(currentIndex - Math.ceil(visibleCount / 2) + 1, 0, slideCount - visibleCount), [currentIndex, slideCount, visibleCount]);
|
|
62
60
|
const lastVisibleDotIndex = React.useMemo(() => getBoundedValue(currentIndex + Math.floor(visibleCount / 2), visibleCount - 1, slideCount - 1), [currentIndex, slideCount, visibleCount]);
|
|
@@ -80,12 +78,11 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
|
|
|
80
78
|
handleSlideChange,
|
|
81
79
|
]);
|
|
82
80
|
React.useEffect(() => {
|
|
83
|
-
|
|
84
|
-
const firstDot = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.children[firstVisibleDotIndex];
|
|
81
|
+
const firstDot = listRef.current?.children[firstVisibleDotIndex];
|
|
85
82
|
if (!listRef.current || !firstDot) {
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
88
|
-
const motionOk =
|
|
85
|
+
const motionOk = getWindow()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
|
|
89
86
|
listRef.current.scrollTo({
|
|
90
87
|
left: firstDot.offsetLeft - listRef.current.offsetLeft,
|
|
91
88
|
behavior: motionOk && !justMounted.current ? 'smooth' : 'auto',
|
|
@@ -95,5 +92,5 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
|
|
|
95
92
|
}
|
|
96
93
|
}, [currentIndex, firstVisibleDotIndex, slideCount, visibleCount, width]);
|
|
97
94
|
return (React.createElement(React.Fragment, null,
|
|
98
|
-
React.createElement(Box, { className: cx('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children
|
|
95
|
+
React.createElement(Box, { className: cx('iui-carousel-navigation-dots', className), role: 'tablist', "aria-label": 'Slides', ref: refs, ...rest }, children ?? dots)));
|
|
99
96
|
});
|
|
@@ -9,7 +9,7 @@ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
|
9
9
|
export declare const CarouselNavigation: PolymorphicForwardRefComponent<"nav", {}> & {
|
|
10
10
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
11
11
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
12
|
-
}, "label" | "as" | "size" | "
|
|
12
|
+
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
13
13
|
isActive?: boolean | undefined;
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
|
|
@@ -17,7 +17,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"nav", {
|
|
|
17
17
|
}>;
|
|
18
18
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
19
19
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
20
|
-
}, "label" | "as" | "size" | "
|
|
20
|
+
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
21
21
|
isActive?: boolean | undefined;
|
|
22
22
|
label?: React.ReactNode;
|
|
23
23
|
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon"> & {
|
|
@@ -10,7 +10,7 @@ import { CarouselDotsList } from './CarouselDotsList.js';
|
|
|
10
10
|
import { Box, SvgChevronLeft, SvgChevronRight } from '../utils/index.js';
|
|
11
11
|
const CarouselNavigationComponent = React.forwardRef((props, ref) => {
|
|
12
12
|
const { className, children, ...rest } = props;
|
|
13
|
-
return (React.createElement(Box, { as: 'nav', className: cx('iui-carousel-navigation', className), ref: ref, ...rest }, children
|
|
13
|
+
return (React.createElement(Box, { as: 'nav', className: cx('iui-carousel-navigation', className), ref: ref, ...rest }, children ?? (React.createElement(React.Fragment, null,
|
|
14
14
|
React.createElement(Box, { className: 'iui-carousel-navigation-left' },
|
|
15
15
|
React.createElement(PreviousButton, null)),
|
|
16
16
|
React.createElement(CarouselDotsList, null),
|
|
@@ -25,11 +25,10 @@ const PreviousButton = React.forwardRef((props, ref) => {
|
|
|
25
25
|
}
|
|
26
26
|
const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
|
|
27
27
|
return (React.createElement(IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowLeft'] || undefined, ref: ref, ...props, onClick: (e) => {
|
|
28
|
-
var _a;
|
|
29
28
|
const prevIndex = (slideCount + currentIndex - 1) % slideCount;
|
|
30
29
|
setCurrentIndex(prevIndex);
|
|
31
30
|
scrollToSlide.current(prevIndex, { instant: e.detail > 3 });
|
|
32
|
-
|
|
31
|
+
props?.onClick?.(e);
|
|
33
32
|
} },
|
|
34
33
|
React.createElement(SvgChevronLeft, null)));
|
|
35
34
|
});
|
|
@@ -41,11 +40,10 @@ const NextButton = React.forwardRef((props, ref) => {
|
|
|
41
40
|
}
|
|
42
41
|
const { slideCount, currentIndex, setCurrentIndex, keysPressed, scrollToSlide, } = context;
|
|
43
42
|
return (React.createElement(IconButton, { styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowRight'] || undefined, ref: ref, ...props, onClick: (e) => {
|
|
44
|
-
var _a;
|
|
45
43
|
const nextIndex = (slideCount + currentIndex + 1) % slideCount;
|
|
46
44
|
setCurrentIndex(nextIndex);
|
|
47
45
|
scrollToSlide.current(nextIndex, { instant: e.detail > 3 });
|
|
48
|
-
|
|
46
|
+
props?.onClick?.(e);
|
|
49
47
|
} },
|
|
50
48
|
React.createElement(SvgChevronRight, null)));
|
|
51
49
|
});
|
|
@@ -16,28 +16,24 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
|
|
|
16
16
|
throw new Error('CarouselSlider must be used within Carousel');
|
|
17
17
|
}
|
|
18
18
|
const { setSlideCount, idPrefix, scrollToSlide, isManuallyUpdating } = context;
|
|
19
|
-
const items = React.useMemo(() =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
: child)) !== null && _a !== void 0 ? _a : [];
|
|
27
|
-
}, [children, idPrefix]);
|
|
19
|
+
const items = React.useMemo(() => React.Children.map(children, (child, index) => React.isValidElement(child)
|
|
20
|
+
? React.cloneElement(child, {
|
|
21
|
+
id: `${idPrefix}--slide-${index}`,
|
|
22
|
+
index,
|
|
23
|
+
})
|
|
24
|
+
: child) ?? [], [children, idPrefix]);
|
|
28
25
|
useIsomorphicLayoutEffect(() => {
|
|
29
26
|
setSlideCount(items.length);
|
|
30
27
|
}, [items.length, setSlideCount]);
|
|
31
28
|
const sliderRef = React.useRef(null);
|
|
32
29
|
const refs = useMergedRefs(sliderRef, ref);
|
|
33
30
|
scrollToSlide.current = (slideIndex, { instant } = {}) => {
|
|
34
|
-
var _a, _b, _c;
|
|
35
31
|
isManuallyUpdating.current = true; // start manual update
|
|
36
|
-
const slideToShow =
|
|
32
|
+
const slideToShow = sliderRef.current?.children.item(slideIndex);
|
|
37
33
|
if (!sliderRef.current || !slideToShow) {
|
|
38
34
|
return;
|
|
39
35
|
}
|
|
40
|
-
const motionOk =
|
|
36
|
+
const motionOk = getWindow()?.matchMedia('(prefers-reduced-motion: no-preference)')?.matches;
|
|
41
37
|
sliderRef.current.scrollTo({
|
|
42
38
|
left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
|
|
43
39
|
behavior: (instant || !motionOk ? 'instant' : 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
|
|
@@ -46,11 +42,10 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
|
|
|
46
42
|
const scrollTimeout = React.useRef();
|
|
47
43
|
// reset isManuallyUpdating.current to false after the last scroll event
|
|
48
44
|
const handleOnScroll = React.useCallback(() => {
|
|
49
|
-
var _a, _b;
|
|
50
45
|
if (scrollTimeout.current) {
|
|
51
|
-
|
|
46
|
+
getWindow()?.clearTimeout(scrollTimeout.current);
|
|
52
47
|
}
|
|
53
|
-
scrollTimeout.current =
|
|
48
|
+
scrollTimeout.current = getWindow()?.setTimeout(() => {
|
|
54
49
|
isManuallyUpdating.current = false;
|
|
55
50
|
}, 100);
|
|
56
51
|
}, [isManuallyUpdating]);
|
|
@@ -6,7 +6,6 @@ import cx from 'classnames';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { ProgressRadial } from '../ProgressIndicators/index.js';
|
|
8
8
|
import { useMergedRefs, Box } from '../utils/index.js';
|
|
9
|
-
import '@itwin/itwinui-css/css/checkbox.css';
|
|
10
9
|
/**
|
|
11
10
|
* Simple input checkbox
|
|
12
11
|
* @example
|
|
@@ -6,7 +6,6 @@ import * as React from 'react';
|
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { ColorValue, getBoundedValue, useEventListener, useMergedRefs, Box, } from '../utils/index.js';
|
|
8
8
|
import { Slider } from '../Slider/index.js';
|
|
9
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
10
9
|
import { useColorPickerContext } from './ColorPickerContext.js';
|
|
11
10
|
const getVerticalPercentageOfRectangle = (rect, pointer) => {
|
|
12
11
|
const position = getBoundedValue(pointer, rect.top, rect.bottom);
|
|
@@ -22,7 +21,6 @@ const getHorizontalPercentageOfRectangle = (rect, pointer) => {
|
|
|
22
21
|
* and a set of sliders to adjust hue and alpha values.
|
|
23
22
|
*/
|
|
24
23
|
export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
25
|
-
var _a, _b, _c;
|
|
26
24
|
const { className, ...rest } = props;
|
|
27
25
|
const builderRef = React.useRef();
|
|
28
26
|
const refs = useMergedRefs(builderRef, ref);
|
|
@@ -30,7 +28,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
30
28
|
// Set values for slider
|
|
31
29
|
const hueSliderColor = React.useMemo(() => ColorValue.create({ h: hsvColor.h, s: 100, v: 100 }), [hsvColor.h]);
|
|
32
30
|
const sliderValue = React.useMemo(() => hsvColor.h, [hsvColor]);
|
|
33
|
-
const alphaValue = React.useMemo(() =>
|
|
31
|
+
const alphaValue = React.useMemo(() => (showAlpha ? hsvColor.a ?? 1 : 1), [hsvColor.a, showAlpha]);
|
|
34
32
|
// Set values for color square and color dot
|
|
35
33
|
const dotColorString = React.useMemo(() => activeColor.toHexString(), [activeColor]);
|
|
36
34
|
const [colorDotActive, setColorDotActive] = React.useState(false);
|
|
@@ -93,7 +91,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
93
91
|
event.preventDefault();
|
|
94
92
|
event.stopPropagation();
|
|
95
93
|
}, [colorDotActive, updateSquareValue]);
|
|
96
|
-
useEventListener('pointerup', handleSquarePointerUp,
|
|
94
|
+
useEventListener('pointerup', handleSquarePointerUp, builderRef.current?.ownerDocument);
|
|
97
95
|
const handleSquarePointerMove = React.useCallback((event) => {
|
|
98
96
|
if (!colorDotActive) {
|
|
99
97
|
return;
|
|
@@ -102,7 +100,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
102
100
|
event.stopPropagation();
|
|
103
101
|
updateSquareValue(event, 'onUpdate');
|
|
104
102
|
}, [colorDotActive, updateSquareValue]);
|
|
105
|
-
useEventListener('pointermove', handleSquarePointerMove,
|
|
103
|
+
useEventListener('pointermove', handleSquarePointerMove, builderRef.current?.ownerDocument);
|
|
106
104
|
const handleSquarePointerLeave = React.useCallback((event) => {
|
|
107
105
|
if (!colorDotActive) {
|
|
108
106
|
return;
|
|
@@ -110,7 +108,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
110
108
|
updateSquareValue(event, 'onChange');
|
|
111
109
|
setColorDotActive(false);
|
|
112
110
|
}, [colorDotActive, updateSquareValue]);
|
|
113
|
-
useEventListener('pointerleave', handleSquarePointerLeave,
|
|
111
|
+
useEventListener('pointerleave', handleSquarePointerLeave, builderRef.current?.ownerDocument);
|
|
114
112
|
const keysPressed = React.useRef({}); // keep track of which keys are currently pressed
|
|
115
113
|
// Arrow key navigation for color dot
|
|
116
114
|
const handleColorDotKeyDown = (event) => {
|
|
@@ -154,7 +152,7 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
154
152
|
keysPressed.current['ArrowRight']) {
|
|
155
153
|
return;
|
|
156
154
|
}
|
|
157
|
-
onChangeComplete
|
|
155
|
+
onChangeComplete?.(ColorValue.create(hsvColor));
|
|
158
156
|
break;
|
|
159
157
|
}
|
|
160
158
|
};
|
|
@@ -163,18 +161,16 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
|
|
|
163
161
|
'--iui-color-field-hue': hueColorString,
|
|
164
162
|
'--iui-color-picker-selected-color': dotColorString,
|
|
165
163
|
}, ref: squareRef, onPointerDown: (event) => {
|
|
166
|
-
var _a;
|
|
167
164
|
event.preventDefault();
|
|
168
165
|
updateSquareValue(event, 'onClick');
|
|
169
166
|
setColorDotActive(true);
|
|
170
|
-
|
|
167
|
+
colorDotRef.current?.focus();
|
|
171
168
|
} },
|
|
172
169
|
React.createElement(Box, { className: 'iui-color-dot', style: {
|
|
173
170
|
'--iui-color-dot-inset': `${squareTop.toString()}% auto auto ${squareLeft.toString()}%`,
|
|
174
171
|
}, onPointerDown: () => {
|
|
175
|
-
var _a;
|
|
176
172
|
setColorDotActive(true);
|
|
177
|
-
|
|
173
|
+
colorDotRef.current?.focus();
|
|
178
174
|
}, onKeyDown: handleColorDotKeyDown, onKeyUp: handleColorDotKeyUp, tabIndex: 0, ref: colorDotRef })),
|
|
179
175
|
React.createElement(Slider, { minLabel: '', maxLabel: '', values: [sliderValue], className: 'iui-hue-slider', trackDisplayMode: 'none', tooltipProps: () => ({ visible: false }), onChange: (values) => {
|
|
180
176
|
updateHueSlider(values[0], true);
|