@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
|
@@ -36,7 +36,6 @@ const index_js_1 = require("../Menu/index.js");
|
|
|
36
36
|
const SelectTag_js_1 = __importDefault(require("../Select/SelectTag.js"));
|
|
37
37
|
const index_js_2 = require("../Typography/index.js");
|
|
38
38
|
const index_js_3 = require("../utils/index.js");
|
|
39
|
-
require("tippy.js/animations/shift-away.css");
|
|
40
39
|
const helpers_js_1 = require("./helpers.js");
|
|
41
40
|
const ComboBoxDropdown_js_1 = require("./ComboBoxDropdown.js");
|
|
42
41
|
const ComboBoxEndIcon_js_1 = require("./ComboBoxEndIcon.js");
|
|
@@ -54,8 +53,7 @@ const isSingleOnChange = (onChange, multiple) => {
|
|
|
54
53
|
};
|
|
55
54
|
/** Returns either `option.id` or derives a stable id using `idPrefix` and `option.label` (without whitespace) */
|
|
56
55
|
const getOptionId = (option, idPrefix) => {
|
|
57
|
-
|
|
58
|
-
return (_a = option.id) !== null && _a !== void 0 ? _a : `${idPrefix}-option-${option.label.replace(/\s/g, '-')}`;
|
|
56
|
+
return option.id ?? `${idPrefix}-option-${option.label.replace(/\s/g, '-')}`;
|
|
59
57
|
};
|
|
60
58
|
/**
|
|
61
59
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
@@ -71,13 +69,11 @@ const getOptionId = (option, idPrefix) => {
|
|
|
71
69
|
* />
|
|
72
70
|
*/
|
|
73
71
|
const ComboBox = (props) => {
|
|
74
|
-
var _a, _b;
|
|
75
72
|
const { options, value: valueProp, onChange, filterFunction, inputProps, dropdownMenuProps, emptyStateMessage = 'No options found', itemRenderer, enableVirtualization = false, multiple = false, onShow, onHide, ...rest } = props;
|
|
76
73
|
// Generate a stateful random id if not specified
|
|
77
|
-
const [id] = React.useState(() =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
74
|
+
const [id] = React.useState(() => props.id ??
|
|
75
|
+
(inputProps?.id && `${inputProps.id}-cb`) ??
|
|
76
|
+
`iui-cb-${(0, index_js_3.getRandomValue)(10)}`);
|
|
81
77
|
// Refs get set in subcomponents
|
|
82
78
|
const inputRef = React.useRef(null);
|
|
83
79
|
const menuRef = React.useRef(null);
|
|
@@ -103,7 +99,7 @@ const ComboBox = (props) => {
|
|
|
103
99
|
const getSelectedIndexes = React.useCallback(() => {
|
|
104
100
|
if (isMultipleEnabled(valueProp, multiple)) {
|
|
105
101
|
const indexArray = [];
|
|
106
|
-
valueProp
|
|
102
|
+
valueProp?.forEach((value) => {
|
|
107
103
|
const indexToAdd = options.findIndex((option) => option.value === value);
|
|
108
104
|
if (indexToAdd > -1) {
|
|
109
105
|
indexArray.push(indexToAdd);
|
|
@@ -122,10 +118,9 @@ const ComboBox = (props) => {
|
|
|
122
118
|
focusedIndex: -1,
|
|
123
119
|
});
|
|
124
120
|
(0, index_js_3.useIsomorphicLayoutEffect)(() => {
|
|
125
|
-
var _a, _b;
|
|
126
121
|
// When the dropdown opens
|
|
127
122
|
if (isOpen) {
|
|
128
|
-
|
|
123
|
+
inputRef.current?.focus(); // Focus the input
|
|
129
124
|
// Reset the filtered list (does not reset when multiple enabled)
|
|
130
125
|
if (!multiple) {
|
|
131
126
|
setFilteredOptions(optionsRef.current);
|
|
@@ -139,7 +134,7 @@ const ComboBox = (props) => {
|
|
|
139
134
|
// Reset the input value if not multiple
|
|
140
135
|
if (!isMultipleEnabled(selected, multiple)) {
|
|
141
136
|
setInputValue(selected != undefined && selected >= 0
|
|
142
|
-
?
|
|
137
|
+
? optionsRef.current[selected]?.label
|
|
143
138
|
: '');
|
|
144
139
|
}
|
|
145
140
|
}
|
|
@@ -154,9 +149,9 @@ const ComboBox = (props) => {
|
|
|
154
149
|
// Update filtered options to the latest value options according to input value
|
|
155
150
|
const [filteredOptions, setFilteredOptions] = React.useState(options);
|
|
156
151
|
React.useEffect(() => {
|
|
157
|
-
var _a;
|
|
158
152
|
if (inputValue) {
|
|
159
|
-
setFilteredOptions(
|
|
153
|
+
setFilteredOptions(filterFunction?.(options, inputValue) ??
|
|
154
|
+
options.filter((option) => option.label.toLowerCase().includes(inputValue.toLowerCase())));
|
|
160
155
|
}
|
|
161
156
|
else {
|
|
162
157
|
setFilteredOptions(options);
|
|
@@ -166,18 +161,18 @@ const ComboBox = (props) => {
|
|
|
166
161
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
167
162
|
}, [options]);
|
|
168
163
|
// Filter options based on input value
|
|
169
|
-
const [inputValue, setInputValue] = React.useState(
|
|
164
|
+
const [inputValue, setInputValue] = React.useState(inputProps?.value?.toString() ?? '');
|
|
170
165
|
const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
|
|
171
166
|
const handleOnInput = React.useCallback((event) => {
|
|
172
|
-
var _a, _b;
|
|
173
167
|
const { value } = event.currentTarget;
|
|
174
168
|
setInputValue(value);
|
|
175
169
|
dispatch({ type: 'open' }); // reopen when typing
|
|
176
|
-
setFilteredOptions(
|
|
170
|
+
setFilteredOptions(filterFunction?.(optionsRef.current, value) ??
|
|
171
|
+
optionsRef.current.filter((option) => option.label.toLowerCase().includes(value.toLowerCase())));
|
|
177
172
|
if (focusedIndex != -1) {
|
|
178
173
|
dispatch({ type: 'focus', value: -1 });
|
|
179
174
|
}
|
|
180
|
-
|
|
175
|
+
inputProps?.onChange?.(event);
|
|
181
176
|
}, [filterFunction, focusedIndex, inputProps, optionsRef]);
|
|
182
177
|
// When the value prop changes, update the selected index/indices
|
|
183
178
|
React.useEffect(() => {
|
|
@@ -226,23 +221,21 @@ const ComboBox = (props) => {
|
|
|
226
221
|
}, [selected]);
|
|
227
222
|
// Calls user defined onChange
|
|
228
223
|
const onChangeHandler = React.useCallback((__originalIndex, actionType, newArray) => {
|
|
229
|
-
var _a, _b, _c, _d;
|
|
230
224
|
if (isSingleOnChange(onChangeProp.current, multiple)) {
|
|
231
|
-
|
|
225
|
+
onChangeProp.current?.(optionsRef.current[__originalIndex]?.value);
|
|
232
226
|
}
|
|
233
227
|
else {
|
|
234
228
|
actionType &&
|
|
235
229
|
newArray &&
|
|
236
|
-
|
|
237
|
-
value:
|
|
230
|
+
onChangeProp.current?.(newArray?.map((item) => optionsRef.current[item]?.value), {
|
|
231
|
+
value: optionsRef.current[__originalIndex]?.value,
|
|
238
232
|
type: actionType,
|
|
239
|
-
})
|
|
233
|
+
});
|
|
240
234
|
}
|
|
241
235
|
}, [multiple, onChangeProp, optionsRef]);
|
|
242
236
|
const onClickHandler = React.useCallback((__originalIndex) => {
|
|
243
|
-
|
|
244
|
-
(
|
|
245
|
-
if ((_b = optionsRef.current[__originalIndex]) === null || _b === void 0 ? void 0 : _b.disabled) {
|
|
237
|
+
inputRef.current?.focus({ preventScroll: true }); // return focus to input
|
|
238
|
+
if (optionsRef.current[__originalIndex]?.disabled) {
|
|
246
239
|
return;
|
|
247
240
|
}
|
|
248
241
|
if (isMultipleEnabled(selected, multiple)) {
|
|
@@ -254,7 +247,7 @@ const ComboBox = (props) => {
|
|
|
254
247
|
onChangeHandler(__originalIndex, actionType, newArray);
|
|
255
248
|
// update live region
|
|
256
249
|
setLiveRegionSelection(newArray
|
|
257
|
-
.map((item) =>
|
|
250
|
+
.map((item) => optionsRef.current[item]?.label)
|
|
258
251
|
.filter(Boolean)
|
|
259
252
|
.join(', '));
|
|
260
253
|
}
|
|
@@ -275,7 +268,7 @@ const ComboBox = (props) => {
|
|
|
275
268
|
const optionId = getOptionId(option, id);
|
|
276
269
|
const { __originalIndex } = optionsExtraInfoRef.current[optionId];
|
|
277
270
|
const { icon, startIcon: startIconProp, ...restOptions } = option;
|
|
278
|
-
const startIcon = startIconProp
|
|
271
|
+
const startIcon = startIconProp ?? icon;
|
|
279
272
|
const customItem = itemRenderer
|
|
280
273
|
? itemRenderer(option, {
|
|
281
274
|
isFocused: focusedIndex === __originalIndex,
|
|
@@ -286,9 +279,8 @@ const ComboBox = (props) => {
|
|
|
286
279
|
: null;
|
|
287
280
|
return customItem ? (React.cloneElement(customItem, {
|
|
288
281
|
onClick: (e) => {
|
|
289
|
-
var _a, _b;
|
|
290
282
|
onClickHandler(__originalIndex);
|
|
291
|
-
|
|
283
|
+
customItem.props.onClick?.(e);
|
|
292
284
|
},
|
|
293
285
|
// ComboBox.MenuItem handles scrollIntoView, data-iui-index and focused through context
|
|
294
286
|
// but we still need to pass them here for backwards compatibility with MenuItem
|
|
@@ -297,7 +289,7 @@ const ComboBox = (props) => {
|
|
|
297
289
|
'data-iui-filtered-index': filteredIndex,
|
|
298
290
|
ref: (0, index_js_3.mergeRefs)(customItem.props.ref, (el) => {
|
|
299
291
|
if (!enableVirtualization && focusedIndex === __originalIndex) {
|
|
300
|
-
el
|
|
292
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
301
293
|
}
|
|
302
294
|
}),
|
|
303
295
|
})) : (React.createElement(ComboBoxMenuItem_js_1.ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
|
|
@@ -327,7 +319,7 @@ const ComboBox = (props) => {
|
|
|
327
319
|
getMenuItem,
|
|
328
320
|
multiple,
|
|
329
321
|
} },
|
|
330
|
-
React.createElement(ComboBoxInputContainer_js_1.ComboBoxInputContainer, { disabled: inputProps
|
|
322
|
+
React.createElement(ComboBoxInputContainer_js_1.ComboBoxInputContainer, { disabled: inputProps?.disabled, ...rest },
|
|
331
323
|
React.createElement(React.Fragment, null,
|
|
332
324
|
React.createElement(ComboBoxInput_js_1.ComboBoxInput, { value: inputValue, ...inputProps, onChange: handleOnInput, selectTags: isMultipleEnabled(selected, multiple)
|
|
333
325
|
? selected.map((index) => {
|
|
@@ -335,7 +327,7 @@ const ComboBox = (props) => {
|
|
|
335
327
|
return (React.createElement(SelectTag_js_1.default, { key: item.label, label: item.label }));
|
|
336
328
|
})
|
|
337
329
|
: undefined })),
|
|
338
|
-
React.createElement(ComboBoxEndIcon_js_1.ComboBoxEndIcon, { disabled: inputProps
|
|
330
|
+
React.createElement(ComboBoxEndIcon_js_1.ComboBoxEndIcon, { disabled: inputProps?.disabled, isOpen: isOpen }),
|
|
339
331
|
multiple ? (React.createElement(index_js_3.AutoclearingHiddenLiveRegion, { text: liveRegionSelection })) : null),
|
|
340
332
|
React.createElement(ComboBoxDropdown_js_1.ComboBoxDropdown, { ...dropdownMenuProps, onShow: onShow, onHide: onHide },
|
|
341
333
|
React.createElement(ComboBoxMenu_js_1.ComboBoxMenu, null, filteredOptions.length > 0 && !enableVirtualization
|
|
@@ -43,8 +43,7 @@ exports.ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
43
43
|
}
|
|
44
44
|
}, [dispatch, props.visible]);
|
|
45
45
|
return (React.createElement(index_js_1.Popover, { placement: 'bottom-start', visible: isOpen, onClickOutside: React.useCallback((_, { target }) => {
|
|
46
|
-
|
|
47
|
-
if (!((_a = toggleButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
|
|
46
|
+
if (!toggleButtonRef.current?.contains(target)) {
|
|
48
47
|
dispatch({ type: 'close' });
|
|
49
48
|
}
|
|
50
49
|
}, [dispatch, toggleButtonRef]), animation: 'shift-away', duration: 200, reference: inputRef, ref: forwardedRef, content: children, ...rest }));
|
|
@@ -46,6 +46,6 @@ exports.ComboBoxEndIcon = React.forwardRef((props, forwardedRef) => {
|
|
|
46
46
|
'iui-open': isOpen,
|
|
47
47
|
}, className), onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, () => {
|
|
48
48
|
dispatch({ type: isOpen ? 'close' : 'open' });
|
|
49
|
-
}), ...rest }, children
|
|
49
|
+
}), ...rest }, children ?? React.createElement(index_js_1.SvgCaretDownSmall, { "aria-hidden": true })));
|
|
50
50
|
});
|
|
51
51
|
exports.ComboBoxEndIcon.displayName = 'ComboBoxEndIcon';
|
|
@@ -39,18 +39,16 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
39
39
|
const dispatch = (0, index_js_2.useSafeContext)(helpers_js_1.ComboBoxActionContext);
|
|
40
40
|
const { inputRef, menuRef, optionsExtraInfoRef } = (0, index_js_2.useSafeContext)(helpers_js_1.ComboBoxRefsContext);
|
|
41
41
|
const refs = (0, index_js_2.useMergedRefs)(inputRef, forwardedRef);
|
|
42
|
-
const focusedIndexRef = React.useRef(focusedIndex
|
|
42
|
+
const focusedIndexRef = React.useRef(focusedIndex ?? -1);
|
|
43
43
|
React.useEffect(() => {
|
|
44
|
-
focusedIndexRef.current = focusedIndex
|
|
44
|
+
focusedIndexRef.current = focusedIndex ?? -1;
|
|
45
45
|
}, [focusedIndex]);
|
|
46
46
|
const getIdFromIndex = (index) => {
|
|
47
|
-
|
|
48
|
-
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 : '');
|
|
47
|
+
return (menuRef.current?.querySelector(`[data-iui-index="${index}"]`)?.id ?? '');
|
|
49
48
|
};
|
|
50
49
|
const handleKeyDown = React.useCallback((event) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const length = (_a = Object.keys(optionsExtraInfoRef.current).length) !== null && _a !== void 0 ? _a : 0;
|
|
50
|
+
onKeyDownProp?.(event);
|
|
51
|
+
const length = Object.keys(optionsExtraInfoRef.current).length ?? 0;
|
|
54
52
|
if (event.altKey) {
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
@@ -64,22 +62,23 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
64
62
|
return;
|
|
65
63
|
}
|
|
66
64
|
if (focusedIndexRef.current === -1) {
|
|
67
|
-
const currentElement =
|
|
65
|
+
const currentElement = menuRef.current?.querySelector('[data-iui-index]');
|
|
68
66
|
return dispatch({
|
|
69
67
|
type: 'focus',
|
|
70
|
-
value: Number(
|
|
68
|
+
value: Number(currentElement?.getAttribute('data-iui-index') ?? 0),
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
// If virtualization is enabled, dont let round scrolling
|
|
74
72
|
if (enableVirtualization &&
|
|
75
|
-
!
|
|
73
|
+
!menuRef.current?.querySelector(`[data-iui-index="${focusedIndexRef.current}"]`)?.nextElementSibling) {
|
|
76
74
|
return;
|
|
77
75
|
}
|
|
78
76
|
let nextIndex = focusedIndexRef.current;
|
|
79
77
|
do {
|
|
80
|
-
const currentElement =
|
|
81
|
-
const nextElement =
|
|
82
|
-
|
|
78
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${nextIndex}"]`);
|
|
79
|
+
const nextElement = currentElement?.nextElementSibling ??
|
|
80
|
+
menuRef.current?.querySelector('[data-iui-index]');
|
|
81
|
+
nextIndex = Number(nextElement?.getAttribute('data-iui-index'));
|
|
83
82
|
if (nextElement) {
|
|
84
83
|
return dispatch({ type: 'focus', value: nextIndex });
|
|
85
84
|
}
|
|
@@ -96,20 +95,22 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
96
95
|
}
|
|
97
96
|
// If virtualization is enabled, dont let round scrolling
|
|
98
97
|
if (enableVirtualization &&
|
|
99
|
-
!
|
|
98
|
+
!menuRef.current?.querySelector(`[data-iui-index="${focusedIndexRef.current}"]`)?.previousElementSibling) {
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
101
|
if (focusedIndexRef.current === -1) {
|
|
103
102
|
return dispatch({
|
|
104
103
|
type: 'focus',
|
|
105
|
-
value:
|
|
104
|
+
value: Object.values(optionsExtraInfoRef.current)?.[length - 1]
|
|
105
|
+
.__originalIndex ?? -1,
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
let prevIndex = focusedIndexRef.current;
|
|
109
109
|
do {
|
|
110
|
-
const currentElement =
|
|
111
|
-
const prevElement =
|
|
112
|
-
|
|
110
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${prevIndex}"]`);
|
|
111
|
+
const prevElement = currentElement?.previousElementSibling ??
|
|
112
|
+
menuRef.current?.querySelector('[data-iui-index]:last-of-type');
|
|
113
|
+
prevIndex = Number(prevElement?.getAttribute('data-iui-index'));
|
|
113
114
|
if (prevElement) {
|
|
114
115
|
return dispatch({ type: 'focus', value: prevIndex });
|
|
115
116
|
}
|
|
@@ -120,7 +121,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
120
121
|
event.preventDefault();
|
|
121
122
|
if (isOpen) {
|
|
122
123
|
if (focusedIndexRef.current > -1) {
|
|
123
|
-
onClickHandler
|
|
124
|
+
onClickHandler?.(focusedIndexRef.current);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
else {
|
|
@@ -148,7 +149,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
148
149
|
]);
|
|
149
150
|
const handleFocus = React.useCallback((event) => {
|
|
150
151
|
dispatch({ type: 'open' });
|
|
151
|
-
onFocusProp
|
|
152
|
+
onFocusProp?.(event);
|
|
152
153
|
}, [dispatch, onFocusProp]);
|
|
153
154
|
const handleClick = React.useCallback(() => {
|
|
154
155
|
if (!isOpen) {
|
|
@@ -37,7 +37,7 @@ const index_js_1 = require("../Menu/index.js");
|
|
|
37
37
|
const index_js_2 = require("../Surface/index.js");
|
|
38
38
|
const index_js_3 = require("../utils/index.js");
|
|
39
39
|
const helpers_js_1 = require("./helpers.js");
|
|
40
|
-
const isOverflowOverlaySupported = () =>
|
|
40
|
+
const isOverflowOverlaySupported = () => (0, index_js_3.getWindow)()?.CSS?.supports?.('overflow: overlay');
|
|
41
41
|
const VirtualizedComboBoxMenu = React.forwardRef(({ children, className, style, ...rest }, forwardedRef) => {
|
|
42
42
|
const { minWidth, id, filteredOptions, getMenuItem, focusedIndex } = (0, index_js_3.useSafeContext)(helpers_js_1.ComboBoxStateContext);
|
|
43
43
|
const { menuRef } = (0, index_js_3.useSafeContext)(helpers_js_1.ComboBoxRefsContext);
|
|
@@ -46,12 +46,11 @@ const VirtualizedComboBoxMenu = React.forwardRef(({ children, className, style,
|
|
|
46
46
|
: children, // Here is expected empty state content
|
|
47
47
|
[filteredOptions, getMenuItem, children]);
|
|
48
48
|
const focusedVisibleIndex = React.useMemo(() => {
|
|
49
|
-
|
|
50
|
-
const currentElement = (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-iui-index="${focusedIndex}"]`);
|
|
49
|
+
const currentElement = menuRef.current?.querySelector(`[data-iui-index="${focusedIndex}"]`);
|
|
51
50
|
if (!currentElement) {
|
|
52
51
|
return focusedIndex;
|
|
53
52
|
}
|
|
54
|
-
return Number(
|
|
53
|
+
return Number(currentElement.getAttribute('data-iui-filtered-index') ?? focusedIndex);
|
|
55
54
|
}, [focusedIndex, menuRef]);
|
|
56
55
|
const { outerProps, innerProps, visibleChildren } = (0, index_js_3.useVirtualization)({
|
|
57
56
|
// 'Fool' VirtualScroll by passing length 1
|
|
@@ -37,11 +37,11 @@ exports.ComboBoxMenuItem = React.memo(React.forwardRef((props, forwardedRef) =>
|
|
|
37
37
|
const { focusedIndex, enableVirtualization } = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxStateContext);
|
|
38
38
|
const focusRef = (el) => {
|
|
39
39
|
if (!enableVirtualization && focusedIndex === index) {
|
|
40
|
-
el
|
|
40
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const refs = (0, index_js_1.useMergedRefs)(forwardedRef, focusRef);
|
|
44
|
-
return (React.createElement(ListItem_js_1.ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, focused: focusedIndex === index, ref: refs, onClick: () => onClick
|
|
44
|
+
return (React.createElement(ListItem_js_1.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 },
|
|
45
45
|
startIcon && (React.createElement(ListItem_js_1.ListItem.Icon, { as: 'span', "aria-hidden": true }, startIcon)),
|
|
46
46
|
React.createElement(ListItem_js_1.ListItem.Content, null,
|
|
47
47
|
children,
|
|
@@ -30,7 +30,6 @@ exports.ComboBoxActionContext = exports.ComboBoxStateContext = exports.ComboBoxR
|
|
|
30
30
|
*--------------------------------------------------------------------------------------------*/
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
32
|
const comboBoxReducer = (state, action) => {
|
|
33
|
-
var _a, _b, _c, _d, _e;
|
|
34
33
|
switch (action.type) {
|
|
35
34
|
case 'open': {
|
|
36
35
|
return { ...state, isOpen: true };
|
|
@@ -44,8 +43,8 @@ const comboBoxReducer = (state, action) => {
|
|
|
44
43
|
}
|
|
45
44
|
return {
|
|
46
45
|
...state,
|
|
47
|
-
selected:
|
|
48
|
-
focusedIndex:
|
|
46
|
+
selected: action.value ?? state.selected,
|
|
47
|
+
focusedIndex: action.value ?? state.focusedIndex,
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
50
|
case 'multiselect': {
|
|
@@ -58,12 +57,12 @@ const comboBoxReducer = (state, action) => {
|
|
|
58
57
|
if (Array.isArray(state.selected)) {
|
|
59
58
|
return {
|
|
60
59
|
...state,
|
|
61
|
-
focusedIndex:
|
|
60
|
+
focusedIndex: action.value ?? -1,
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
return {
|
|
65
64
|
...state,
|
|
66
|
-
focusedIndex:
|
|
65
|
+
focusedIndex: action.value ?? state.selected ?? -1,
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
default: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
|
-
import '@itwin/itwinui-css/css/date-picker.css';
|
|
3
2
|
import type { TimePickerProps } from '../TimePicker/TimePicker.js';
|
|
4
3
|
/**
|
|
5
4
|
* Generate localized months and days strings using `Intl.DateTimeFormat` for passed locale to use in DatePicker component.
|
|
@@ -34,7 +34,6 @@ exports.DatePicker = exports.generateLocalizedStrings = void 0;
|
|
|
34
34
|
const classnames_1 = __importDefault(require("classnames"));
|
|
35
35
|
const React = __importStar(require("react"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
require("@itwin/itwinui-css/css/date-picker.css");
|
|
38
37
|
const index_js_2 = require("../Buttons/IconButton/index.js");
|
|
39
38
|
const index_js_3 = require("../TimePicker/index.js");
|
|
40
39
|
const isSameDay = (a, b) => {
|
|
@@ -141,17 +140,20 @@ exports.generateLocalizedStrings = generateLocalizedStrings;
|
|
|
141
140
|
* <DatePicker date={new Date()} onChange={(e) => console.log('New date value: ' + e)} />
|
|
142
141
|
*/
|
|
143
142
|
exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
144
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
145
143
|
const { date, onChange, localizedNames, className, setFocus = false, showTime = false, use12Hours = false, precision, hourStep, minuteStep, secondStep, useCombinedRenderer, combinedRenderer, hourRenderer, minuteRenderer, secondRenderer, meridiemRenderer, showYearSelection = false, enableRangeSelect = false, startDate, endDate, isDateDisabled, ...rest } = props;
|
|
146
|
-
const monthNames =
|
|
147
|
-
const shortDays =
|
|
148
|
-
const longDays =
|
|
144
|
+
const monthNames = localizedNames?.months ?? defaultMonths;
|
|
145
|
+
const shortDays = localizedNames?.shortDays ?? defaultShortDays;
|
|
146
|
+
const longDays = localizedNames?.days ?? defaultLongDays;
|
|
149
147
|
const [selectedDay, setSelectedDay] = React.useState(date);
|
|
150
148
|
const [selectedStartDay, setSelectedStartDay] = React.useState(startDate);
|
|
151
149
|
const [selectedEndDay, setSelectedEndDay] = React.useState(endDate);
|
|
152
|
-
const [focusedDay, setFocusedDay] = React.useState(
|
|
153
|
-
const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(
|
|
154
|
-
|
|
150
|
+
const [focusedDay, setFocusedDay] = React.useState(selectedStartDay ?? selectedDay ?? new Date());
|
|
151
|
+
const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedStartDay?.getMonth() ??
|
|
152
|
+
selectedDay?.getMonth() ??
|
|
153
|
+
new Date().getMonth());
|
|
154
|
+
const [displayedYear, setDisplayedYear] = React.useState(selectedStartDay?.getFullYear() ??
|
|
155
|
+
selectedDay?.getFullYear() ??
|
|
156
|
+
new Date().getFullYear());
|
|
155
157
|
// boolean that toggles between the user picking the start date and end date for date range
|
|
156
158
|
const [isSelectingStartDate, setIsSelectingStartDate] = React.useState(true);
|
|
157
159
|
// Used to focus days only when days are changed
|
|
@@ -167,15 +169,16 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
167
169
|
setDisplayedYear(newYear);
|
|
168
170
|
}, []);
|
|
169
171
|
React.useEffect(() => {
|
|
170
|
-
var _a, _b, _c, _d;
|
|
171
172
|
const currentDate = new Date();
|
|
172
173
|
setSelectedDay(date);
|
|
173
174
|
setSelectedStartDay(startDate);
|
|
174
175
|
setSelectedEndDay(endDate);
|
|
175
176
|
if (!enableRangeSelect) {
|
|
176
|
-
setFocusedDay(date
|
|
177
|
+
setFocusedDay(date ?? currentDate);
|
|
177
178
|
}
|
|
178
|
-
setMonthAndYear(
|
|
179
|
+
setMonthAndYear(startDate?.getMonth() ?? date?.getMonth() ?? currentDate.getMonth(), startDate?.getFullYear() ??
|
|
180
|
+
date?.getFullYear() ??
|
|
181
|
+
currentDate.getFullYear());
|
|
179
182
|
}, [date, setMonthAndYear, startDate, endDate, enableRangeSelect]);
|
|
180
183
|
const days = React.useMemo(() => {
|
|
181
184
|
let offsetToFirst = new Date(displayedYear, displayedMonthIndex, 1).getDay();
|
|
@@ -200,8 +203,7 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
200
203
|
return weeksInMonth;
|
|
201
204
|
}, [days]);
|
|
202
205
|
const getNewFocusedDate = (newYear, newMonth) => {
|
|
203
|
-
|
|
204
|
-
const currentDate = (_a = selectedStartDay !== null && selectedStartDay !== void 0 ? selectedStartDay : selectedDay) !== null && _a !== void 0 ? _a : new Date();
|
|
206
|
+
const currentDate = selectedStartDay ?? selectedDay ?? new Date();
|
|
205
207
|
const newDate = new Date(newYear, newMonth, currentDate.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());
|
|
206
208
|
return newDate;
|
|
207
209
|
};
|
|
@@ -230,51 +232,51 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
230
232
|
const onDayClick = (day) => {
|
|
231
233
|
// single date selection
|
|
232
234
|
if (!enableRangeSelect) {
|
|
233
|
-
if (day.getMonth() !==
|
|
235
|
+
if (day.getMonth() !== selectedDay?.getMonth()) {
|
|
234
236
|
setMonthAndYear(day.getMonth(), day.getFullYear());
|
|
235
237
|
}
|
|
236
|
-
const currentDate = selectedDay
|
|
238
|
+
const currentDate = selectedDay ?? new Date();
|
|
237
239
|
const newDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());
|
|
238
240
|
setSelectedDay(newDate);
|
|
239
241
|
setFocusedDay(newDate);
|
|
240
|
-
isSingleOnChange(onChange, enableRangeSelect) &&
|
|
242
|
+
isSingleOnChange(onChange, enableRangeSelect) && onChange?.(newDate);
|
|
241
243
|
}
|
|
242
244
|
// start date selection (date range only)
|
|
243
245
|
else if (isSelectingStartDate) {
|
|
244
|
-
if (day.getMonth() !==
|
|
246
|
+
if (day.getMonth() !== selectedStartDay?.getMonth()) {
|
|
245
247
|
setMonthAndYear(day.getMonth(), day.getFullYear());
|
|
246
248
|
}
|
|
247
|
-
const currentStartDate = selectedStartDay
|
|
249
|
+
const currentStartDate = selectedStartDay ?? new Date();
|
|
248
250
|
const newStartDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentStartDate.getHours(), currentStartDate.getMinutes(), currentStartDate.getSeconds());
|
|
249
251
|
setSelectedStartDay(newStartDate);
|
|
250
252
|
setFocusedDay(newStartDate);
|
|
251
253
|
// if the start date is after the end date or the end date is undefined, reset the end date
|
|
252
254
|
if (!(0, index_js_1.isBefore)(newStartDate, selectedEndDay)) {
|
|
253
255
|
setSelectedEndDay(newStartDate);
|
|
254
|
-
onChange
|
|
256
|
+
onChange?.(newStartDate, newStartDate);
|
|
255
257
|
}
|
|
256
258
|
else {
|
|
257
|
-
selectedEndDay &&
|
|
259
|
+
selectedEndDay && onChange?.(newStartDate, selectedEndDay);
|
|
258
260
|
}
|
|
259
261
|
setIsSelectingStartDate(false);
|
|
260
262
|
}
|
|
261
263
|
// end date selection (date range only)
|
|
262
264
|
else {
|
|
263
|
-
if (day.getMonth() !==
|
|
265
|
+
if (day.getMonth() !== selectedEndDay?.getMonth()) {
|
|
264
266
|
setMonthAndYear(day.getMonth(), day.getFullYear());
|
|
265
267
|
}
|
|
266
|
-
const currentEndDate = selectedEndDay
|
|
268
|
+
const currentEndDate = selectedEndDay ?? new Date();
|
|
267
269
|
const newEndDate = new Date(day.getFullYear(), day.getMonth(), day.getDate(), currentEndDate.getHours(), currentEndDate.getMinutes(), currentEndDate.getSeconds());
|
|
268
270
|
setFocusedDay(newEndDate);
|
|
269
271
|
// if the end date is before the start date, move back the start date and still have user select end date
|
|
270
272
|
if (!(0, index_js_1.isBefore)(newEndDate, selectedStartDay)) {
|
|
271
273
|
setSelectedEndDay(newEndDate);
|
|
272
|
-
selectedStartDay &&
|
|
274
|
+
selectedStartDay && onChange?.(selectedStartDay, newEndDate);
|
|
273
275
|
setIsSelectingStartDate(true);
|
|
274
276
|
}
|
|
275
277
|
else {
|
|
276
278
|
setSelectedStartDay(newEndDate);
|
|
277
|
-
selectedEndDay &&
|
|
279
|
+
selectedEndDay && onChange?.(newEndDate, selectedEndDay);
|
|
278
280
|
}
|
|
279
281
|
}
|
|
280
282
|
};
|
|
@@ -326,7 +328,7 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
326
328
|
case 'Enter':
|
|
327
329
|
case ' ':
|
|
328
330
|
case 'Spacebar':
|
|
329
|
-
if (!
|
|
331
|
+
if (!isDateDisabled?.(focusedDay)) {
|
|
330
332
|
onDayClick(focusedDay);
|
|
331
333
|
}
|
|
332
334
|
event.preventDefault();
|
|
@@ -379,17 +381,14 @@ exports.DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
379
381
|
React.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox' }, weeks.map((weekDays, weekIndex) => {
|
|
380
382
|
return (React.createElement(index_js_1.Box, { key: `week-${displayedMonthIndex}-${weekIndex}`, className: 'iui-calendar-week' }, weekDays.map((weekDay, dayIndex) => {
|
|
381
383
|
const dateValue = weekDay.getDate();
|
|
382
|
-
const isDisabled = isDateDisabled
|
|
384
|
+
const isDisabled = isDateDisabled?.(weekDay);
|
|
383
385
|
return (React.createElement(index_js_1.Box, { key: `day-${displayedMonthIndex}-${dayIndex}`, className: getDayClass(weekDay), onClick: () => !isDisabled && onDayClick(weekDay), role: 'option', tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1, "aria-disabled": isDisabled ? 'true' : undefined, ref: (element) => isSameDay(weekDay, focusedDay) &&
|
|
384
386
|
needFocus.current &&
|
|
385
|
-
|
|
387
|
+
element?.focus() }, dateValue));
|
|
386
388
|
})));
|
|
387
389
|
}))),
|
|
388
|
-
showTime && (React.createElement(index_js_3.TimePicker, { date: selectedStartDay
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
? onChange === null || onChange === void 0 ? void 0 : onChange(date)
|
|
392
|
-
: onChange === null || onChange === void 0 ? void 0 : onChange(new Date((_a = selectedStartDay === null || selectedStartDay === void 0 ? void 0 : selectedStartDay.getFullYear()) !== null && _a !== void 0 ? _a : date.getFullYear(), (_b = selectedStartDay === null || selectedStartDay === void 0 ? void 0 : selectedStartDay.getMonth()) !== null && _b !== void 0 ? _b : date.getMonth(), (_c = selectedStartDay === null || selectedStartDay === void 0 ? void 0 : selectedStartDay.getDate()) !== null && _c !== void 0 ? _c : date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()), new Date((_d = selectedEndDay === null || selectedEndDay === void 0 ? void 0 : selectedEndDay.getFullYear()) !== null && _d !== void 0 ? _d : date.getFullYear(), (_e = selectedEndDay === null || selectedEndDay === void 0 ? void 0 : selectedEndDay.getMonth()) !== null && _e !== void 0 ? _e : date.getMonth(), (_f = selectedEndDay === null || selectedEndDay === void 0 ? void 0 : selectedEndDay.getDate()) !== null && _f !== void 0 ? _f : date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
|
|
393
|
-
} }))));
|
|
390
|
+
showTime && (React.createElement(index_js_3.TimePicker, { date: selectedStartDay ?? selectedDay, use12Hours: use12Hours, precision: precision, hourStep: hourStep, minuteStep: minuteStep, secondStep: secondStep, useCombinedRenderer: useCombinedRenderer, combinedRenderer: combinedRenderer, hourRenderer: hourRenderer, minuteRenderer: minuteRenderer, secondRenderer: secondRenderer, meridiemRenderer: meridiemRenderer, onChange: (date) => isSingleOnChange(onChange, enableRangeSelect)
|
|
391
|
+
? onChange?.(date)
|
|
392
|
+
: onChange?.(new Date(selectedStartDay?.getFullYear() ?? date.getFullYear(), selectedStartDay?.getMonth() ?? date.getMonth(), selectedStartDay?.getDate() ?? date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()), new Date(selectedEndDay?.getFullYear() ?? date.getFullYear(), selectedEndDay?.getMonth() ?? date.getMonth(), selectedEndDay?.getDate() ?? date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds())) }))));
|
|
394
393
|
});
|
|
395
394
|
exports.default = exports.DatePicker;
|
|
@@ -32,8 +32,8 @@ exports.Dialog = void 0;
|
|
|
32
32
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
33
33
|
*--------------------------------------------------------------------------------------------*/
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
|
+
const ReactDOM = __importStar(require("react-dom"));
|
|
35
36
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
|
-
require("@itwin/itwinui-css/css/dialog.css");
|
|
37
37
|
const DialogTitleBar_js_1 = require("./DialogTitleBar.js");
|
|
38
38
|
const DialogContent_js_1 = require("./DialogContent.js");
|
|
39
39
|
const DialogBackdrop_js_1 = require("./DialogBackdrop.js");
|
|
@@ -42,9 +42,16 @@ const DialogButtonBar_js_1 = require("./DialogButtonBar.js");
|
|
|
42
42
|
const DialogMain_js_1 = require("./DialogMain.js");
|
|
43
43
|
const index_js_1 = require("../utils/index.js");
|
|
44
44
|
const DialogComponent = React.forwardRef((props, ref) => {
|
|
45
|
-
const { trapFocus = false, setFocus = false, preventDocumentScroll = false, isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = false, onClose, isDraggable = false, isResizable = false, relativeTo = 'viewport', className, ...rest } = props;
|
|
45
|
+
const { trapFocus = false, setFocus = false, preventDocumentScroll = false, isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = false, onClose, isDraggable = false, isResizable = false, relativeTo = 'viewport', placement, className, portal = false, ...rest } = props;
|
|
46
46
|
const dialogRootRef = React.useRef(null);
|
|
47
|
-
const
|
|
47
|
+
const context = (0, index_js_1.useGlobals)();
|
|
48
|
+
const isClient = (0, index_js_1.useIsClient)();
|
|
49
|
+
const portalTo = typeof portal !== 'boolean'
|
|
50
|
+
? portal.to
|
|
51
|
+
: portal
|
|
52
|
+
? context?.portalContainerRef?.current ?? (0, index_js_1.getDocument)()?.body
|
|
53
|
+
: null;
|
|
54
|
+
const dialog = (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-dialog-wrapper', className), "data-iui-relative": relativeTo === 'container', ref: (0, index_js_1.useMergedRefs)(ref, dialogRootRef), ...rest }));
|
|
48
55
|
return (React.createElement(DialogContext_js_1.DialogContext.Provider, { value: {
|
|
49
56
|
isOpen,
|
|
50
57
|
onClose,
|
|
@@ -58,8 +65,8 @@ const DialogComponent = React.forwardRef((props, ref) => {
|
|
|
58
65
|
isResizable,
|
|
59
66
|
relativeTo,
|
|
60
67
|
dialogRootRef,
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
placement,
|
|
69
|
+
} }, portalTo && isClient ? ReactDOM.createPortal(dialog, portalTo) : dialog));
|
|
63
70
|
});
|
|
64
71
|
/**
|
|
65
72
|
* Dialog component.
|
|
@@ -56,7 +56,7 @@ exports.DialogBackdrop = React.forwardRef((props, ref) => {
|
|
|
56
56
|
if (isDismissible && closeOnExternalClick && onClose) {
|
|
57
57
|
onClose(event);
|
|
58
58
|
}
|
|
59
|
-
onMouseDown
|
|
59
|
+
onMouseDown?.(event);
|
|
60
60
|
};
|
|
61
61
|
return (React.createElement(index_js_1.Backdrop, { isVisible: isVisible, className: (0, classnames_1.default)({ 'iui-backdrop-fixed': relativeTo === 'viewport' }, className), ref: refs, onMouseDown: handleMouseDown, style: {
|
|
62
62
|
pointerEvents: 'auto',
|