@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
|
@@ -8,7 +8,6 @@ import { IconButton } from '../Buttons/index.js';
|
|
|
8
8
|
import { Input } from '../Input/index.js';
|
|
9
9
|
import { ColorValue, InputContainer, SvgSwap, Box } from '../utils/index.js';
|
|
10
10
|
import { useColorPickerContext } from './ColorPickerContext.js';
|
|
11
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
12
11
|
/**
|
|
13
12
|
* `ColorInputPanel` shows input fields to enter precise color values in the specified format.
|
|
14
13
|
* It also allows switching between the specified formats using a swap button.
|
|
@@ -19,7 +18,6 @@ import '@itwin/itwinui-css/css/color-picker.css';
|
|
|
19
18
|
* </ColorPicker>
|
|
20
19
|
*/
|
|
21
20
|
export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
22
|
-
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
23
21
|
const { defaultColorFormat, allowedColorFormats = ['hsl', 'rgb', 'hex'], className, ...rest } = props;
|
|
24
22
|
const inputsContainerRef = React.useRef(null);
|
|
25
23
|
const { activeColor, applyHsvColorChange, hsvColor, showAlpha } = useColorPickerContext();
|
|
@@ -30,14 +28,13 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
30
28
|
// need to use state since input may have parsing error
|
|
31
29
|
const [input, setInput] = React.useState(['', '', '', '']);
|
|
32
30
|
React.useEffect(() => {
|
|
33
|
-
var _a, _b;
|
|
34
31
|
if (currentFormat === 'hsl') {
|
|
35
32
|
const hsl = activeColor.toHslColor();
|
|
36
33
|
setInput([
|
|
37
34
|
ColorValue.getFormattedColorNumber(hsvColor.h),
|
|
38
35
|
ColorValue.getFormattedColorNumber(hsl.s),
|
|
39
36
|
ColorValue.getFormattedColorNumber(hsl.l),
|
|
40
|
-
ColorValue.getFormattedColorNumber(
|
|
37
|
+
ColorValue.getFormattedColorNumber(hsl.a ?? activeColor.getAlpha() / 255, 2),
|
|
41
38
|
]);
|
|
42
39
|
}
|
|
43
40
|
else if (currentFormat === 'rgb') {
|
|
@@ -46,7 +43,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
46
43
|
rgb.r.toString(),
|
|
47
44
|
rgb.g.toString(),
|
|
48
45
|
rgb.b.toString(),
|
|
49
|
-
ColorValue.getFormattedColorNumber(
|
|
46
|
+
ColorValue.getFormattedColorNumber(rgb.a ?? activeColor.getAlpha() / 255, 2),
|
|
50
47
|
]);
|
|
51
48
|
}
|
|
52
49
|
else {
|
|
@@ -56,9 +53,8 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
56
53
|
}, [activeColor, hsvColor.h, currentFormat, showAlpha]);
|
|
57
54
|
const [validHexInput, setValidHexInput] = React.useState(true);
|
|
58
55
|
const swapColorFormat = React.useCallback(() => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
allowedColorFormats.length]) !== null && _a !== void 0 ? _a : allowedColorFormats[0];
|
|
56
|
+
const newFormat = allowedColorFormats[(allowedColorFormats.indexOf(currentFormat) + 1) %
|
|
57
|
+
allowedColorFormats.length] ?? allowedColorFormats[0];
|
|
62
58
|
setCurrentFormat(newFormat);
|
|
63
59
|
}, [currentFormat, allowedColorFormats]);
|
|
64
60
|
const isFocusInside = (focused) => !!(focused &&
|
|
@@ -139,7 +135,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
139
135
|
React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 360
|
|
140
136
|
? 'negative'
|
|
141
137
|
: undefined },
|
|
142
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value:
|
|
138
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: input[0] ?? '', onChange: (event) => {
|
|
143
139
|
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
144
140
|
}, onKeyDown: (event) => {
|
|
145
141
|
if (event.key === 'Enter') {
|
|
@@ -155,7 +151,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
155
151
|
React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 100
|
|
156
152
|
? 'negative'
|
|
157
153
|
: undefined },
|
|
158
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value:
|
|
154
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: input[1] ?? '', onChange: (event) => {
|
|
159
155
|
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
160
156
|
}, onKeyDown: (event) => {
|
|
161
157
|
if (event.key === 'Enter') {
|
|
@@ -171,7 +167,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
171
167
|
React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 100
|
|
172
168
|
? 'negative'
|
|
173
169
|
: undefined },
|
|
174
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value:
|
|
170
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: input[2] ?? '', onChange: (event) => {
|
|
175
171
|
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
176
172
|
}, onKeyDown: (event) => {
|
|
177
173
|
if (event.key === 'Enter') {
|
|
@@ -187,7 +183,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
187
183
|
showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
188
184
|
? 'negative'
|
|
189
185
|
: undefined },
|
|
190
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value:
|
|
186
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: input[3] ?? '', onChange: (event) => {
|
|
191
187
|
setInput([input[0], input[1], input[2], event.target.value]);
|
|
192
188
|
}, onKeyDown: (event) => {
|
|
193
189
|
if (event.key === 'Enter') {
|
|
@@ -204,7 +200,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
204
200
|
React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 255
|
|
205
201
|
? 'negative'
|
|
206
202
|
: undefined },
|
|
207
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value:
|
|
203
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'R', value: input[0] ?? '', onChange: (event) => {
|
|
208
204
|
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
209
205
|
}, onKeyDown: (event) => {
|
|
210
206
|
if (event.key === 'Enter') {
|
|
@@ -220,7 +216,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
220
216
|
React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 255
|
|
221
217
|
? 'negative'
|
|
222
218
|
: undefined },
|
|
223
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value:
|
|
219
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'G', value: input[1] ?? '', onChange: (event) => {
|
|
224
220
|
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
225
221
|
}, onKeyDown: (event) => {
|
|
226
222
|
if (event.key === 'Enter') {
|
|
@@ -236,7 +232,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
236
232
|
React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 255
|
|
237
233
|
? 'negative'
|
|
238
234
|
: undefined },
|
|
239
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value:
|
|
235
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '255', placeholder: 'B', value: input[2] ?? '', onChange: (event) => {
|
|
240
236
|
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
241
237
|
}, onKeyDown: (event) => {
|
|
242
238
|
if (event.key === 'Enter') {
|
|
@@ -252,7 +248,7 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
252
248
|
showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
253
249
|
? 'negative'
|
|
254
250
|
: undefined },
|
|
255
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value:
|
|
251
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '1', step: '.01', placeholder: 'A', value: input[3] ?? '', onChange: (event) => {
|
|
256
252
|
setInput([input[0], input[1], input[2], event.target.value]);
|
|
257
253
|
}, onKeyDown: (event) => {
|
|
258
254
|
if (event.key === 'Enter') {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ColorValue } from '../utils/index.js';
|
|
3
3
|
import type { ColorType, PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
4
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
5
4
|
export declare type ColorPaletteProps = {
|
|
6
5
|
/**
|
|
7
6
|
* Label shown above the palette.
|
|
@@ -8,7 +8,6 @@ import { ColorValue, getFocusableElements, useMergedRefs, Box, } from '../utils/
|
|
|
8
8
|
import { getColorValue } from './ColorPicker.js';
|
|
9
9
|
import { ColorSwatch } from './ColorSwatch.js';
|
|
10
10
|
import { useColorPickerContext } from './ColorPickerContext.js';
|
|
11
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
12
11
|
/**
|
|
13
12
|
* `ColorPalette` is used to show a group of `ColorSwatch` components.
|
|
14
13
|
* @example
|
|
@@ -26,9 +25,8 @@ export const ColorPalette = React.forwardRef((props, ref) => {
|
|
|
26
25
|
const [focusedIndex, setFocusedIndex] = React.useState();
|
|
27
26
|
// callback ref to set tabindex=0 on first child if none of the swatches are tabbable
|
|
28
27
|
const setDefaultTabIndex = (el) => {
|
|
29
|
-
var _a;
|
|
30
28
|
if (el && !el.querySelector('[tabindex="0"]')) {
|
|
31
|
-
|
|
29
|
+
el.firstElementChild?.setAttribute('tabindex', '0');
|
|
32
30
|
}
|
|
33
31
|
};
|
|
34
32
|
const paletteRef = React.useRef(null);
|
|
@@ -42,7 +40,7 @@ export const ColorPalette = React.forwardRef((props, ref) => {
|
|
|
42
40
|
if (!swatches.length) {
|
|
43
41
|
return;
|
|
44
42
|
}
|
|
45
|
-
const currentIndex = swatches.findIndex((swatch) =>
|
|
43
|
+
const currentIndex = swatches.findIndex((swatch) => swatch === paletteRef.current?.ownerDocument.activeElement);
|
|
46
44
|
if (currentIndex < 0) {
|
|
47
45
|
return;
|
|
48
46
|
}
|
|
@@ -84,10 +82,9 @@ export const ColorPalette = React.forwardRef((props, ref) => {
|
|
|
84
82
|
};
|
|
85
83
|
// call focus() when focusedIndex changes
|
|
86
84
|
React.useEffect(() => {
|
|
87
|
-
var _a;
|
|
88
85
|
if (focusedIndex != null) {
|
|
89
86
|
const swatches = getFocusableElements(paletteRef.current);
|
|
90
|
-
|
|
87
|
+
swatches[focusedIndex]?.focus();
|
|
91
88
|
}
|
|
92
89
|
}, [focusedIndex]);
|
|
93
90
|
return (React.createElement(Box, { className: cx('iui-color-palette-wrapper', className), ref: ref, ...rest },
|
|
@@ -99,7 +96,7 @@ export const ColorPalette = React.forwardRef((props, ref) => {
|
|
|
99
96
|
const color = getColorValue(_color);
|
|
100
97
|
return (React.createElement(ColorSwatch, { key: index, color: color, onClick: (event) => {
|
|
101
98
|
event.preventDefault();
|
|
102
|
-
onChangeComplete
|
|
99
|
+
onChangeComplete?.(color);
|
|
103
100
|
setActiveColor(color);
|
|
104
101
|
}, isActive: color.equals(activeColor) }));
|
|
105
102
|
}))));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
3
2
|
import { ColorValue } from '../utils/index.js';
|
|
4
3
|
import type { ColorType, PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
5
4
|
export declare const getColorValue: (color: ColorType | ColorValue | undefined) => ColorValue;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
7
6
|
import { ColorValue, getTabbableElements, useMergedRefs, Box, } from '../utils/index.js';
|
|
8
7
|
import cx from 'classnames';
|
|
9
8
|
import { ColorPickerContext } from './ColorPickerContext.js';
|
|
@@ -55,13 +54,13 @@ export const ColorPicker = React.forwardRef((props, forwardedRef) => {
|
|
|
55
54
|
const applyHsvColorChange = React.useCallback((newColor, selectionChanged, newColorValue) => {
|
|
56
55
|
// save the HSV values
|
|
57
56
|
setHsvColor(newColor);
|
|
58
|
-
const newActiveColor = newColorValue
|
|
57
|
+
const newActiveColor = newColorValue ?? ColorValue.create(newColor);
|
|
59
58
|
// Only update selected color when dragging is done
|
|
60
59
|
if (selectionChanged) {
|
|
61
|
-
onChangeComplete
|
|
60
|
+
onChangeComplete?.(newActiveColor);
|
|
62
61
|
}
|
|
63
62
|
else {
|
|
64
|
-
onChange
|
|
63
|
+
onChange?.(newActiveColor);
|
|
65
64
|
}
|
|
66
65
|
activeColorTbgr.current = newActiveColor.toTbgr();
|
|
67
66
|
// this converts it to store in tbgr
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
|
-
import '@itwin/itwinui-css/css/color-picker.css';
|
|
8
7
|
import { ColorValue, Box } from '../utils/index.js';
|
|
9
8
|
import { getColorValue } from './ColorPicker.js';
|
|
10
9
|
/**
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import type { SelectOption } from '../Select/index.js';
|
|
3
3
|
import type { Input } from '../Input/Input.js';
|
|
4
4
|
import type { PopoverProps, InputContainerProps, CommonProps } from '../utils/index.js';
|
|
5
|
-
import 'tippy.js/animations/shift-away.css';
|
|
6
5
|
declare type ActionType = 'added' | 'removed';
|
|
7
6
|
declare type MultipleOnChangeProps<T> = {
|
|
8
7
|
value: T;
|
|
@@ -7,7 +7,6 @@ import { MenuExtraContent } from '../Menu/index.js';
|
|
|
7
7
|
import SelectTag from '../Select/SelectTag.js';
|
|
8
8
|
import { Text } from '../Typography/index.js';
|
|
9
9
|
import { getRandomValue, mergeRefs, useLatestRef, useIsomorphicLayoutEffect, AutoclearingHiddenLiveRegion, } from '../utils/index.js';
|
|
10
|
-
import 'tippy.js/animations/shift-away.css';
|
|
11
10
|
import { ComboBoxActionContext, comboBoxReducer, ComboBoxRefsContext, ComboBoxStateContext, } from './helpers.js';
|
|
12
11
|
import { ComboBoxDropdown } from './ComboBoxDropdown.js';
|
|
13
12
|
import { ComboBoxEndIcon } from './ComboBoxEndIcon.js';
|
|
@@ -25,8 +24,7 @@ const isSingleOnChange = (onChange, multiple) => {
|
|
|
25
24
|
};
|
|
26
25
|
/** Returns either `option.id` or derives a stable id using `idPrefix` and `option.label` (without whitespace) */
|
|
27
26
|
const getOptionId = (option, idPrefix) => {
|
|
28
|
-
|
|
29
|
-
return (_a = option.id) !== null && _a !== void 0 ? _a : `${idPrefix}-option-${option.label.replace(/\s/g, '-')}`;
|
|
27
|
+
return option.id ?? `${idPrefix}-option-${option.label.replace(/\s/g, '-')}`;
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
32
30
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
@@ -42,13 +40,11 @@ const getOptionId = (option, idPrefix) => {
|
|
|
42
40
|
* />
|
|
43
41
|
*/
|
|
44
42
|
export const ComboBox = (props) => {
|
|
45
|
-
var _a, _b;
|
|
46
43
|
const { options, value: valueProp, onChange, filterFunction, inputProps, dropdownMenuProps, emptyStateMessage = 'No options found', itemRenderer, enableVirtualization = false, multiple = false, onShow, onHide, ...rest } = props;
|
|
47
44
|
// Generate a stateful random id if not specified
|
|
48
|
-
const [id] = React.useState(() =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
45
|
+
const [id] = React.useState(() => props.id ??
|
|
46
|
+
(inputProps?.id && `${inputProps.id}-cb`) ??
|
|
47
|
+
`iui-cb-${getRandomValue(10)}`);
|
|
52
48
|
// Refs get set in subcomponents
|
|
53
49
|
const inputRef = React.useRef(null);
|
|
54
50
|
const menuRef = React.useRef(null);
|
|
@@ -74,7 +70,7 @@ export const ComboBox = (props) => {
|
|
|
74
70
|
const getSelectedIndexes = React.useCallback(() => {
|
|
75
71
|
if (isMultipleEnabled(valueProp, multiple)) {
|
|
76
72
|
const indexArray = [];
|
|
77
|
-
valueProp
|
|
73
|
+
valueProp?.forEach((value) => {
|
|
78
74
|
const indexToAdd = options.findIndex((option) => option.value === value);
|
|
79
75
|
if (indexToAdd > -1) {
|
|
80
76
|
indexArray.push(indexToAdd);
|
|
@@ -93,10 +89,9 @@ export const ComboBox = (props) => {
|
|
|
93
89
|
focusedIndex: -1,
|
|
94
90
|
});
|
|
95
91
|
useIsomorphicLayoutEffect(() => {
|
|
96
|
-
var _a, _b;
|
|
97
92
|
// When the dropdown opens
|
|
98
93
|
if (isOpen) {
|
|
99
|
-
|
|
94
|
+
inputRef.current?.focus(); // Focus the input
|
|
100
95
|
// Reset the filtered list (does not reset when multiple enabled)
|
|
101
96
|
if (!multiple) {
|
|
102
97
|
setFilteredOptions(optionsRef.current);
|
|
@@ -110,7 +105,7 @@ export const ComboBox = (props) => {
|
|
|
110
105
|
// Reset the input value if not multiple
|
|
111
106
|
if (!isMultipleEnabled(selected, multiple)) {
|
|
112
107
|
setInputValue(selected != undefined && selected >= 0
|
|
113
|
-
?
|
|
108
|
+
? optionsRef.current[selected]?.label
|
|
114
109
|
: '');
|
|
115
110
|
}
|
|
116
111
|
}
|
|
@@ -125,9 +120,9 @@ export const ComboBox = (props) => {
|
|
|
125
120
|
// Update filtered options to the latest value options according to input value
|
|
126
121
|
const [filteredOptions, setFilteredOptions] = React.useState(options);
|
|
127
122
|
React.useEffect(() => {
|
|
128
|
-
var _a;
|
|
129
123
|
if (inputValue) {
|
|
130
|
-
setFilteredOptions(
|
|
124
|
+
setFilteredOptions(filterFunction?.(options, inputValue) ??
|
|
125
|
+
options.filter((option) => option.label.toLowerCase().includes(inputValue.toLowerCase())));
|
|
131
126
|
}
|
|
132
127
|
else {
|
|
133
128
|
setFilteredOptions(options);
|
|
@@ -137,18 +132,18 @@ export const ComboBox = (props) => {
|
|
|
137
132
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
133
|
}, [options]);
|
|
139
134
|
// Filter options based on input value
|
|
140
|
-
const [inputValue, setInputValue] = React.useState(
|
|
135
|
+
const [inputValue, setInputValue] = React.useState(inputProps?.value?.toString() ?? '');
|
|
141
136
|
const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
|
|
142
137
|
const handleOnInput = React.useCallback((event) => {
|
|
143
|
-
var _a, _b;
|
|
144
138
|
const { value } = event.currentTarget;
|
|
145
139
|
setInputValue(value);
|
|
146
140
|
dispatch({ type: 'open' }); // reopen when typing
|
|
147
|
-
setFilteredOptions(
|
|
141
|
+
setFilteredOptions(filterFunction?.(optionsRef.current, value) ??
|
|
142
|
+
optionsRef.current.filter((option) => option.label.toLowerCase().includes(value.toLowerCase())));
|
|
148
143
|
if (focusedIndex != -1) {
|
|
149
144
|
dispatch({ type: 'focus', value: -1 });
|
|
150
145
|
}
|
|
151
|
-
|
|
146
|
+
inputProps?.onChange?.(event);
|
|
152
147
|
}, [filterFunction, focusedIndex, inputProps, optionsRef]);
|
|
153
148
|
// When the value prop changes, update the selected index/indices
|
|
154
149
|
React.useEffect(() => {
|
|
@@ -197,23 +192,21 @@ export const ComboBox = (props) => {
|
|
|
197
192
|
}, [selected]);
|
|
198
193
|
// Calls user defined onChange
|
|
199
194
|
const onChangeHandler = React.useCallback((__originalIndex, actionType, newArray) => {
|
|
200
|
-
var _a, _b, _c, _d;
|
|
201
195
|
if (isSingleOnChange(onChangeProp.current, multiple)) {
|
|
202
|
-
|
|
196
|
+
onChangeProp.current?.(optionsRef.current[__originalIndex]?.value);
|
|
203
197
|
}
|
|
204
198
|
else {
|
|
205
199
|
actionType &&
|
|
206
200
|
newArray &&
|
|
207
|
-
|
|
208
|
-
value:
|
|
201
|
+
onChangeProp.current?.(newArray?.map((item) => optionsRef.current[item]?.value), {
|
|
202
|
+
value: optionsRef.current[__originalIndex]?.value,
|
|
209
203
|
type: actionType,
|
|
210
|
-
})
|
|
204
|
+
});
|
|
211
205
|
}
|
|
212
206
|
}, [multiple, onChangeProp, optionsRef]);
|
|
213
207
|
const onClickHandler = React.useCallback((__originalIndex) => {
|
|
214
|
-
|
|
215
|
-
(
|
|
216
|
-
if ((_b = optionsRef.current[__originalIndex]) === null || _b === void 0 ? void 0 : _b.disabled) {
|
|
208
|
+
inputRef.current?.focus({ preventScroll: true }); // return focus to input
|
|
209
|
+
if (optionsRef.current[__originalIndex]?.disabled) {
|
|
217
210
|
return;
|
|
218
211
|
}
|
|
219
212
|
if (isMultipleEnabled(selected, multiple)) {
|
|
@@ -225,7 +218,7 @@ export const ComboBox = (props) => {
|
|
|
225
218
|
onChangeHandler(__originalIndex, actionType, newArray);
|
|
226
219
|
// update live region
|
|
227
220
|
setLiveRegionSelection(newArray
|
|
228
|
-
.map((item) =>
|
|
221
|
+
.map((item) => optionsRef.current[item]?.label)
|
|
229
222
|
.filter(Boolean)
|
|
230
223
|
.join(', '));
|
|
231
224
|
}
|
|
@@ -246,7 +239,7 @@ export const ComboBox = (props) => {
|
|
|
246
239
|
const optionId = getOptionId(option, id);
|
|
247
240
|
const { __originalIndex } = optionsExtraInfoRef.current[optionId];
|
|
248
241
|
const { icon, startIcon: startIconProp, ...restOptions } = option;
|
|
249
|
-
const startIcon = startIconProp
|
|
242
|
+
const startIcon = startIconProp ?? icon;
|
|
250
243
|
const customItem = itemRenderer
|
|
251
244
|
? itemRenderer(option, {
|
|
252
245
|
isFocused: focusedIndex === __originalIndex,
|
|
@@ -257,9 +250,8 @@ export const ComboBox = (props) => {
|
|
|
257
250
|
: null;
|
|
258
251
|
return customItem ? (React.cloneElement(customItem, {
|
|
259
252
|
onClick: (e) => {
|
|
260
|
-
var _a, _b;
|
|
261
253
|
onClickHandler(__originalIndex);
|
|
262
|
-
|
|
254
|
+
customItem.props.onClick?.(e);
|
|
263
255
|
},
|
|
264
256
|
// ComboBox.MenuItem handles scrollIntoView, data-iui-index and focused through context
|
|
265
257
|
// but we still need to pass them here for backwards compatibility with MenuItem
|
|
@@ -268,7 +260,7 @@ export const ComboBox = (props) => {
|
|
|
268
260
|
'data-iui-filtered-index': filteredIndex,
|
|
269
261
|
ref: mergeRefs(customItem.props.ref, (el) => {
|
|
270
262
|
if (!enableVirtualization && focusedIndex === __originalIndex) {
|
|
271
|
-
el
|
|
263
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
272
264
|
}
|
|
273
265
|
}),
|
|
274
266
|
})) : (React.createElement(ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
|
|
@@ -298,7 +290,7 @@ export const ComboBox = (props) => {
|
|
|
298
290
|
getMenuItem,
|
|
299
291
|
multiple,
|
|
300
292
|
} },
|
|
301
|
-
React.createElement(ComboBoxInputContainer, { disabled: inputProps
|
|
293
|
+
React.createElement(ComboBoxInputContainer, { disabled: inputProps?.disabled, ...rest },
|
|
302
294
|
React.createElement(React.Fragment, null,
|
|
303
295
|
React.createElement(ComboBoxInput, { value: inputValue, ...inputProps, onChange: handleOnInput, selectTags: isMultipleEnabled(selected, multiple)
|
|
304
296
|
? selected.map((index) => {
|
|
@@ -306,7 +298,7 @@ export const ComboBox = (props) => {
|
|
|
306
298
|
return (React.createElement(SelectTag, { key: item.label, label: item.label }));
|
|
307
299
|
})
|
|
308
300
|
: undefined })),
|
|
309
|
-
React.createElement(ComboBoxEndIcon, { disabled: inputProps
|
|
301
|
+
React.createElement(ComboBoxEndIcon, { disabled: inputProps?.disabled, isOpen: isOpen }),
|
|
310
302
|
multiple ? (React.createElement(AutoclearingHiddenLiveRegion, { text: liveRegionSelection })) : null),
|
|
311
303
|
React.createElement(ComboBoxDropdown, { ...dropdownMenuProps, onShow: onShow, onHide: onHide },
|
|
312
304
|
React.createElement(ComboBoxMenu, null, filteredOptions.length > 0 && !enableVirtualization
|
|
@@ -17,8 +17,7 @@ export const ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
17
17
|
}
|
|
18
18
|
}, [dispatch, props.visible]);
|
|
19
19
|
return (React.createElement(Popover, { placement: 'bottom-start', visible: isOpen, onClickOutside: React.useCallback((_, { target }) => {
|
|
20
|
-
|
|
21
|
-
if (!((_a = toggleButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
|
|
20
|
+
if (!toggleButtonRef.current?.contains(target)) {
|
|
22
21
|
dispatch({ type: 'close' });
|
|
23
22
|
}
|
|
24
23
|
}, [dispatch, toggleButtonRef]), animation: 'shift-away', duration: 200, reference: inputRef, ref: forwardedRef, content: children, ...rest }));
|
|
@@ -17,6 +17,6 @@ export const ComboBoxEndIcon = React.forwardRef((props, forwardedRef) => {
|
|
|
17
17
|
'iui-open': isOpen,
|
|
18
18
|
}, className), onClick: mergeEventHandlers(onClickProp, () => {
|
|
19
19
|
dispatch({ type: isOpen ? 'close' : 'open' });
|
|
20
|
-
}), ...rest }, children
|
|
20
|
+
}), ...rest }, children ?? React.createElement(SvgCaretDownSmall, { "aria-hidden": true })));
|
|
21
21
|
});
|
|
22
22
|
ComboBoxEndIcon.displayName = 'ComboBoxEndIcon';
|
|
@@ -13,18 +13,16 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
13
13
|
const dispatch = useSafeContext(ComboBoxActionContext);
|
|
14
14
|
const { inputRef, menuRef, optionsExtraInfoRef } = useSafeContext(ComboBoxRefsContext);
|
|
15
15
|
const refs = useMergedRefs(inputRef, forwardedRef);
|
|
16
|
-
const focusedIndexRef = React.useRef(focusedIndex
|
|
16
|
+
const focusedIndexRef = React.useRef(focusedIndex ?? -1);
|
|
17
17
|
React.useEffect(() => {
|
|
18
|
-
focusedIndexRef.current = focusedIndex
|
|
18
|
+
focusedIndexRef.current = focusedIndex ?? -1;
|
|
19
19
|
}, [focusedIndex]);
|
|
20
20
|
const getIdFromIndex = (index) => {
|
|
21
|
-
|
|
22
|
-
return ((_c = (_b = (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-iui-index="${index}"]`)) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : '');
|
|
21
|
+
return (menuRef.current?.querySelector(`[data-iui-index="${index}"]`)?.id ?? '');
|
|
23
22
|
};
|
|
24
23
|
const handleKeyDown = React.useCallback((event) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const length = (_a = Object.keys(optionsExtraInfoRef.current).length) !== null && _a !== void 0 ? _a : 0;
|
|
24
|
+
onKeyDownProp?.(event);
|
|
25
|
+
const length = Object.keys(optionsExtraInfoRef.current).length ?? 0;
|
|
28
26
|
if (event.altKey) {
|
|
29
27
|
return;
|
|
30
28
|
}
|
|
@@ -38,22 +36,23 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
38
|
if (focusedIndexRef.current === -1) {
|
|
41
|
-
const currentElement =
|
|
39
|
+
const currentElement = menuRef.current?.querySelector('[data-iui-index]');
|
|
42
40
|
return dispatch({
|
|
43
41
|
type: 'focus',
|
|
44
|
-
value: Number(
|
|
42
|
+
value: Number(currentElement?.getAttribute('data-iui-index') ?? 0),
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
45
|
// If virtualization is enabled, dont let round scrolling
|
|
48
46
|
if (enableVirtualization &&
|
|
49
|
-
!
|
|
47
|
+
!menuRef.current?.querySelector(`[data-iui-index="${focusedIndexRef.current}"]`)?.nextElementSibling) {
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
52
50
|
let nextIndex = focusedIndexRef.current;
|
|
53
51
|
do {
|
|
54
|
-
const currentElement =
|
|
55
|
-
const nextElement =
|
|
56
|
-
|
|
52
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${nextIndex}"]`);
|
|
53
|
+
const nextElement = currentElement?.nextElementSibling ??
|
|
54
|
+
menuRef.current?.querySelector('[data-iui-index]');
|
|
55
|
+
nextIndex = Number(nextElement?.getAttribute('data-iui-index'));
|
|
57
56
|
if (nextElement) {
|
|
58
57
|
return dispatch({ type: 'focus', value: nextIndex });
|
|
59
58
|
}
|
|
@@ -70,20 +69,22 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
70
69
|
}
|
|
71
70
|
// If virtualization is enabled, dont let round scrolling
|
|
72
71
|
if (enableVirtualization &&
|
|
73
|
-
!
|
|
72
|
+
!menuRef.current?.querySelector(`[data-iui-index="${focusedIndexRef.current}"]`)?.previousElementSibling) {
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
76
75
|
if (focusedIndexRef.current === -1) {
|
|
77
76
|
return dispatch({
|
|
78
77
|
type: 'focus',
|
|
79
|
-
value:
|
|
78
|
+
value: Object.values(optionsExtraInfoRef.current)?.[length - 1]
|
|
79
|
+
.__originalIndex ?? -1,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
let prevIndex = focusedIndexRef.current;
|
|
83
83
|
do {
|
|
84
|
-
const currentElement =
|
|
85
|
-
const prevElement =
|
|
86
|
-
|
|
84
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${prevIndex}"]`);
|
|
85
|
+
const prevElement = currentElement?.previousElementSibling ??
|
|
86
|
+
menuRef.current?.querySelector('[data-iui-index]:last-of-type');
|
|
87
|
+
prevIndex = Number(prevElement?.getAttribute('data-iui-index'));
|
|
87
88
|
if (prevElement) {
|
|
88
89
|
return dispatch({ type: 'focus', value: prevIndex });
|
|
89
90
|
}
|
|
@@ -94,7 +95,7 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
94
95
|
event.preventDefault();
|
|
95
96
|
if (isOpen) {
|
|
96
97
|
if (focusedIndexRef.current > -1) {
|
|
97
|
-
onClickHandler
|
|
98
|
+
onClickHandler?.(focusedIndexRef.current);
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
else {
|
|
@@ -122,7 +123,7 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
122
123
|
]);
|
|
123
124
|
const handleFocus = React.useCallback((event) => {
|
|
124
125
|
dispatch({ type: 'open' });
|
|
125
|
-
onFocusProp
|
|
126
|
+
onFocusProp?.(event);
|
|
126
127
|
}, [dispatch, onFocusProp]);
|
|
127
128
|
const handleClick = React.useCallback(() => {
|
|
128
129
|
if (!isOpen) {
|
|
@@ -8,7 +8,7 @@ import { Menu } from '../Menu/index.js';
|
|
|
8
8
|
import { Surface } from '../Surface/index.js';
|
|
9
9
|
import { useSafeContext, useMergedRefs, useVirtualization, mergeRefs, getWindow, } from '../utils/index.js';
|
|
10
10
|
import { ComboBoxStateContext, ComboBoxRefsContext } from './helpers.js';
|
|
11
|
-
const isOverflowOverlaySupported = () =>
|
|
11
|
+
const isOverflowOverlaySupported = () => getWindow()?.CSS?.supports?.('overflow: overlay');
|
|
12
12
|
const VirtualizedComboBoxMenu = React.forwardRef(({ children, className, style, ...rest }, forwardedRef) => {
|
|
13
13
|
const { minWidth, id, filteredOptions, getMenuItem, focusedIndex } = useSafeContext(ComboBoxStateContext);
|
|
14
14
|
const { menuRef } = useSafeContext(ComboBoxRefsContext);
|
|
@@ -17,12 +17,11 @@ const VirtualizedComboBoxMenu = React.forwardRef(({ children, className, style,
|
|
|
17
17
|
: children, // Here is expected empty state content
|
|
18
18
|
[filteredOptions, getMenuItem, children]);
|
|
19
19
|
const focusedVisibleIndex = React.useMemo(() => {
|
|
20
|
-
|
|
21
|
-
const currentElement = (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-iui-index="${focusedIndex}"]`);
|
|
20
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${focusedIndex}"]`);
|
|
22
21
|
if (!currentElement) {
|
|
23
22
|
return focusedIndex;
|
|
24
23
|
}
|
|
25
|
-
return Number(
|
|
24
|
+
return Number(currentElement.getAttribute('data-iui-filtered-index') ?? focusedIndex);
|
|
26
25
|
}, [focusedIndex, menuRef]);
|
|
27
26
|
const { outerProps, innerProps, visibleChildren } = useVirtualization({
|
|
28
27
|
// 'Fool' VirtualScroll by passing length 1
|
|
@@ -11,11 +11,11 @@ export const ComboBoxMenuItem = React.memo(React.forwardRef((props, forwardedRef
|
|
|
11
11
|
const { focusedIndex, enableVirtualization } = useSafeContext(ComboBoxStateContext);
|
|
12
12
|
const focusRef = (el) => {
|
|
13
13
|
if (!enableVirtualization && focusedIndex === index) {
|
|
14
|
-
el
|
|
14
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
const refs = useMergedRefs(forwardedRef, focusRef);
|
|
18
|
-
return (React.createElement(ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, focused: focusedIndex === index, ref: refs, onClick: () => onClick
|
|
18
|
+
return (React.createElement(ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, focused: focusedIndex === index, ref: refs, onClick: () => onClick?.(value), role: role, tabIndex: role === 'presentation' ? undefined : -1, "aria-selected": isSelected, "aria-disabled": disabled, "data-iui-index": index, ...rest },
|
|
19
19
|
startIcon && (React.createElement(ListItem.Icon, { as: 'span', "aria-hidden": true }, startIcon)),
|
|
20
20
|
React.createElement(ListItem.Content, null,
|
|
21
21
|
children,
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
export const comboBoxReducer = (state, action) => {
|
|
7
|
-
var _a, _b, _c, _d, _e;
|
|
8
7
|
switch (action.type) {
|
|
9
8
|
case 'open': {
|
|
10
9
|
return { ...state, isOpen: true };
|
|
@@ -18,8 +17,8 @@ export const comboBoxReducer = (state, action) => {
|
|
|
18
17
|
}
|
|
19
18
|
return {
|
|
20
19
|
...state,
|
|
21
|
-
selected:
|
|
22
|
-
focusedIndex:
|
|
20
|
+
selected: action.value ?? state.selected,
|
|
21
|
+
focusedIndex: action.value ?? state.focusedIndex,
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
case 'multiselect': {
|
|
@@ -32,12 +31,12 @@ export const comboBoxReducer = (state, action) => {
|
|
|
32
31
|
if (Array.isArray(state.selected)) {
|
|
33
32
|
return {
|
|
34
33
|
...state,
|
|
35
|
-
focusedIndex:
|
|
34
|
+
focusedIndex: action.value ?? -1,
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
return {
|
|
39
38
|
...state,
|
|
40
|
-
focusedIndex:
|
|
39
|
+
focusedIndex: action.value ?? state.selected ?? -1,
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
42
|
default: {
|