@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
|
@@ -34,7 +34,6 @@ exports.TagContainer = void 0;
|
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
require("@itwin/itwinui-css/css/tag.css");
|
|
38
37
|
/**
|
|
39
38
|
* TagContainer for grouping tags.
|
|
40
39
|
* @example
|
|
@@ -34,7 +34,6 @@ exports.Textarea = 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/input.css");
|
|
38
37
|
/**
|
|
39
38
|
* Basic textarea component
|
|
40
39
|
* @example
|
|
@@ -3,5 +3,5 @@ import type { ThemeOptions, ThemeType } from './ThemeProvider.js';
|
|
|
3
3
|
export declare const ThemeContext: React.Context<{
|
|
4
4
|
theme?: ThemeType | undefined;
|
|
5
5
|
themeOptions?: ThemeOptions | undefined;
|
|
6
|
-
|
|
6
|
+
portalContainerRef?: React.RefObject<HTMLElement> | undefined;
|
|
7
7
|
} | undefined>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/global.css';
|
|
4
|
-
import '@itwin/itwinui-variables/index.css';
|
|
5
3
|
export declare type ThemeOptions = {
|
|
6
4
|
/**
|
|
7
5
|
* Whether to apply high-contrast versions of light and dark themes.
|
|
@@ -39,10 +37,9 @@ declare type RootProps = {
|
|
|
39
37
|
applyBackground?: boolean;
|
|
40
38
|
};
|
|
41
39
|
/**
|
|
42
|
-
*
|
|
43
|
-
* This will be used to determine if applyBackground will default to false.
|
|
40
|
+
* This will be used to determine if background will be applied.
|
|
44
41
|
*/
|
|
45
|
-
|
|
42
|
+
shouldApplyBackground?: boolean;
|
|
46
43
|
};
|
|
47
44
|
declare type ThemeProviderOwnProps = Pick<RootProps, 'theme'> & {
|
|
48
45
|
themeOptions?: RootProps['themeOptions'];
|
|
@@ -35,8 +35,6 @@ const React = __importStar(require("react"));
|
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
37
|
const ThemeContext_js_1 = require("./ThemeContext.js");
|
|
38
|
-
require("@itwin/itwinui-css/css/global.css");
|
|
39
|
-
require("@itwin/itwinui-variables/index.css");
|
|
40
38
|
/**
|
|
41
39
|
* This component provides global styles and applies theme to the entire tree
|
|
42
40
|
* that it is wrapping around. The `theme` prop is optional and defaults to the
|
|
@@ -64,28 +62,26 @@ require("@itwin/itwinui-variables/index.css");
|
|
|
64
62
|
* </ThemeProvider>
|
|
65
63
|
*/
|
|
66
64
|
exports.ThemeProvider = React.forwardRef((props, ref) => {
|
|
67
|
-
var _a;
|
|
68
65
|
const { theme: themeProp, children, themeOptions, ...rest } = props;
|
|
69
|
-
const
|
|
70
|
-
const mergedRefs = (0, index_js_1.useMergedRefs)(rootRef, ref);
|
|
66
|
+
const portalContainerRef = React.useRef(null);
|
|
71
67
|
const parentContext = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
72
|
-
const theme = themeProp === 'inherit' ?
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
const theme = themeProp === 'inherit' ? parentContext?.theme ?? 'light' : themeProp;
|
|
69
|
+
const shouldApplyBackground = themeOptions?.applyBackground ??
|
|
70
|
+
(themeProp === 'inherit' ? false : !parentContext);
|
|
71
|
+
const contextValue = React.useMemo(() => ({ theme, themeOptions, portalContainerRef }), [theme, themeOptions]);
|
|
72
|
+
return (React.createElement(ThemeContext_js_1.ThemeContext.Provider, { value: contextValue },
|
|
73
|
+
React.createElement(Root, { theme: theme, shouldApplyBackground: shouldApplyBackground, themeOptions: themeOptions, ref: ref, ...rest },
|
|
74
|
+
children,
|
|
75
|
+
React.createElement("div", { ref: portalContainerRef }))));
|
|
77
76
|
});
|
|
78
77
|
exports.default = exports.ThemeProvider;
|
|
79
78
|
const Root = React.forwardRef((props, forwardedRef) => {
|
|
80
|
-
|
|
81
|
-
const { theme, children, themeOptions, className, isInheritingTheme, ...rest } = props;
|
|
79
|
+
const { theme, children, themeOptions, shouldApplyBackground, className, ...rest } = props;
|
|
82
80
|
const ref = React.useRef(null);
|
|
83
81
|
const mergedRefs = (0, index_js_1.useMergedRefs)(ref, forwardedRef);
|
|
84
82
|
const prefersDark = (0, index_js_1.useMediaQuery)('(prefers-color-scheme: dark)');
|
|
85
83
|
const prefersHighContrast = (0, index_js_1.useMediaQuery)('(prefers-contrast: more)');
|
|
86
84
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
87
|
-
const shouldApplyHC =
|
|
88
|
-
const isThemeAlreadySet = (0, index_js_1.useIsThemeAlreadySet)((_b = ref.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
89
|
-
const shouldApplyBackground = (_c = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.applyBackground) !== null && _c !== void 0 ? _c : (isInheritingTheme ? false : !isThemeAlreadySet.current);
|
|
85
|
+
const shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
|
|
90
86
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-root', { 'iui-root-background': shouldApplyBackground }, className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: mergedRefs, ...rest }, children));
|
|
91
87
|
});
|
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/tile.css';
|
|
4
3
|
/**
|
|
5
4
|
* Polymorphic Tile action component. Recommended to be used in a "name" of `Tile`.
|
|
6
5
|
* Renders `a` element by default.
|
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -34,7 +34,6 @@ exports.Tile = exports.TileAction = void 0;
|
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
require("@itwin/itwinui-css/css/tile.css");
|
|
38
37
|
const index_js_2 = require("../DropdownMenu/index.js");
|
|
39
38
|
const index_js_3 = require("../Buttons/index.js");
|
|
40
39
|
const index_js_4 = require("../ProgressIndicators/index.js");
|
|
@@ -79,7 +78,7 @@ exports.Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
79
78
|
const showMenu = React.useCallback(() => setIsMenuVisible(true), []);
|
|
80
79
|
const hideMenu = React.useCallback(() => setIsMenuVisible(false), []);
|
|
81
80
|
const [localActionable, setLocalActionable] = React.useState(isActionableProp);
|
|
82
|
-
const isActionable = isActionableProp
|
|
81
|
+
const isActionable = isActionableProp ?? localActionable;
|
|
83
82
|
const tileName = (React.createElement(index_js_1.Box, { className: 'iui-tile-name' },
|
|
84
83
|
React.createElement(TitleIcon, { isLoading: isLoading, isSelected: isSelected, isNew: isNew, status: status }),
|
|
85
84
|
React.createElement(index_js_1.Box, { as: 'span', className: 'iui-tile-name-label' }, isActionable && onClick ? (React.createElement(index_js_1.LinkAction, { as: 'button', onClick: !isDisabled ? onClick : undefined, "aria-disabled": isDisabled }, name)) : (name))));
|
|
@@ -96,9 +95,7 @@ exports.Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
96
95
|
thumbnail && (React.createElement(index_js_1.Box, { className: 'iui-tile-thumbnail' },
|
|
97
96
|
typeof thumbnail === 'string' ? (React.createElement(index_js_1.Box, { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: `url(${thumbnail})` } })) : thumbnail && thumbnail.type === 'img' ? (React.cloneElement(thumbnail, {
|
|
98
97
|
className: 'iui-tile-thumbnail-picture',
|
|
99
|
-
})) : React.
|
|
100
|
-
className: (0, classnames_1.default)('iui-thumbnail-icon', thumbnail.props.className),
|
|
101
|
-
})) : (thumbnail),
|
|
98
|
+
})) : (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-thumbnail-icon' }, thumbnail)),
|
|
102
99
|
leftIcon &&
|
|
103
100
|
React.cloneElement(leftIcon, {
|
|
104
101
|
className: 'iui-tile-thumbnail-type-indicator',
|
|
@@ -116,9 +113,8 @@ exports.Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
116
113
|
metadata != undefined && (React.createElement(index_js_1.Box, { className: 'iui-tile-metadata' }, metadata)),
|
|
117
114
|
moreOptions && (React.createElement(index_js_2.DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: (close) => moreOptions.map((option) => React.cloneElement(option, {
|
|
118
115
|
onClick: (value) => {
|
|
119
|
-
var _a, _b;
|
|
120
116
|
close();
|
|
121
|
-
|
|
117
|
+
option.props.onClick?.(value);
|
|
122
118
|
},
|
|
123
119
|
})) },
|
|
124
120
|
React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-tile-more-options', {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
import '@itwin/itwinui-css/css/time-picker.css';
|
|
4
3
|
export declare type MeridiemType = 'AM' | 'PM';
|
|
5
4
|
export declare type Precision = 'hours' | 'minutes' | 'seconds';
|
|
6
5
|
export declare type TimePickerProps = {
|
|
@@ -34,7 +34,6 @@ exports.TimePicker = 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/time-picker.css");
|
|
38
37
|
const isSameHour = (date1, date2, meridiem) => {
|
|
39
38
|
const adjustedHours = meridiem
|
|
40
39
|
? formatHourFrom12(date1.getHours(), meridiem)
|
|
@@ -109,17 +108,17 @@ const defaultCombinedRenderer = (date, precision) => {
|
|
|
109
108
|
exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
110
109
|
const { date, onChange, use12Hours = false, precision = 'minutes', hourStep = 1, minuteStep = 1, secondStep = 1, setFocusHour = false, hourRenderer = (date) => date.getHours().toLocaleString(undefined, { minimumIntegerDigits: 2 }), minuteRenderer = (date) => date.getMinutes().toLocaleString(undefined, { minimumIntegerDigits: 2 }), secondRenderer = (date) => date.getSeconds().toLocaleString(undefined, { minimumIntegerDigits: 2 }), meridiemRenderer = (meridiem) => meridiem, useCombinedRenderer = false, combinedRenderer = defaultCombinedRenderer, className, ...rest } = props;
|
|
111
110
|
const [selectedTime, setSelectedTime] = React.useState(date);
|
|
112
|
-
const [focusedTime, setFocusedTime] = React.useState(selectedTime
|
|
113
|
-
const [meridiem, setMeridiem] = React.useState(use12Hours ? (
|
|
111
|
+
const [focusedTime, setFocusedTime] = React.useState(selectedTime ?? new Date());
|
|
112
|
+
const [meridiem, setMeridiem] = React.useState(use12Hours ? (focusedTime?.getHours() > 11 ? 'PM' : 'AM') : undefined);
|
|
114
113
|
React.useEffect(() => {
|
|
115
|
-
setFocusedTime(date
|
|
114
|
+
setFocusedTime(date ?? new Date());
|
|
116
115
|
setSelectedTime(date);
|
|
117
116
|
}, [date]);
|
|
118
117
|
const onHourClick = (date) => {
|
|
119
118
|
const adjustedHour = use12Hours
|
|
120
119
|
? formatHourFrom12(date.getHours(), meridiem)
|
|
121
120
|
: date.getHours();
|
|
122
|
-
const adjustedSelectedTime = setHours(adjustedHour, selectedTime
|
|
121
|
+
const adjustedSelectedTime = setHours(adjustedHour, selectedTime ?? new Date());
|
|
123
122
|
updateCurrentTime(adjustedSelectedTime);
|
|
124
123
|
};
|
|
125
124
|
const onTimeClick = (date) => {
|
|
@@ -130,7 +129,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
130
129
|
updateCurrentTime(adjustedSelectedTime);
|
|
131
130
|
};
|
|
132
131
|
const onMeridiemClick = (value) => {
|
|
133
|
-
let adjustedSelectedTime = selectedTime
|
|
132
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
134
133
|
const currentHours = adjustedSelectedTime.getHours();
|
|
135
134
|
setMeridiem(value);
|
|
136
135
|
if (value === 'AM' && currentHours > 11) {
|
|
@@ -152,7 +151,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
152
151
|
}
|
|
153
152
|
setFocusedTime(adjustedTime);
|
|
154
153
|
setSelectedTime(adjustedTime);
|
|
155
|
-
onChange
|
|
154
|
+
onChange?.(adjustedTime);
|
|
156
155
|
};
|
|
157
156
|
const onHourFocus = (date) => {
|
|
158
157
|
const adjustedHour = use12Hours
|
|
@@ -167,7 +166,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
167
166
|
setFocusedTime(setHours(adjustedHour, date));
|
|
168
167
|
};
|
|
169
168
|
const onMeridiemFocus = (value) => {
|
|
170
|
-
let adjustedSelectedTime = selectedTime
|
|
169
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
171
170
|
const currentHours = adjustedSelectedTime.getHours();
|
|
172
171
|
if (value === 'AM' && currentHours > 11) {
|
|
173
172
|
setMeridiem(value);
|
|
@@ -189,7 +188,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
189
188
|
return data;
|
|
190
189
|
};
|
|
191
190
|
const time = React.useMemo(() => {
|
|
192
|
-
const time = selectedTime
|
|
191
|
+
const time = selectedTime ?? new Date();
|
|
193
192
|
const data = [];
|
|
194
193
|
const hoursArray = Array.from(Array(use12Hours ? 12 : 24).keys())
|
|
195
194
|
.filter((i) => i % hourStep === 0)
|
|
@@ -216,15 +215,15 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
216
215
|
return data;
|
|
217
216
|
}, [hourStep, minuteStep, secondStep, selectedTime, use12Hours, precision]);
|
|
218
217
|
const hours = React.useMemo(() => {
|
|
219
|
-
const time = selectedTime
|
|
218
|
+
const time = selectedTime ?? new Date();
|
|
220
219
|
return generateDataList(use12Hours ? 12 : 24, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), use12Hours && i === 0 ? 12 : i, time.getMinutes(), time.getSeconds()), hourStep);
|
|
221
220
|
}, [hourStep, selectedTime, use12Hours]);
|
|
222
221
|
const minutes = React.useMemo(() => {
|
|
223
|
-
const time = selectedTime
|
|
222
|
+
const time = selectedTime ?? new Date();
|
|
224
223
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), i, time.getSeconds()), minuteStep);
|
|
225
224
|
}, [minuteStep, selectedTime]);
|
|
226
225
|
const seconds = React.useMemo(() => {
|
|
227
|
-
const time = selectedTime
|
|
226
|
+
const time = selectedTime ?? new Date();
|
|
228
227
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), time.getMinutes(), i), secondStep);
|
|
229
228
|
}, [secondStep, selectedTime]);
|
|
230
229
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-time-picker', className), ref: forwardedRef, ...rest },
|
|
@@ -245,7 +244,7 @@ const TimePickerColumn = (props) => {
|
|
|
245
244
|
}
|
|
246
245
|
});
|
|
247
246
|
const scrollIntoView = (ref, isSame) => {
|
|
248
|
-
isSame &&
|
|
247
|
+
isSame && ref?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
249
248
|
};
|
|
250
249
|
const handleTimeKeyDown = (event, maxValue, onFocus, onSelect, currentValue) => {
|
|
251
250
|
if (event.altKey) {
|
|
@@ -285,7 +284,7 @@ const TimePickerColumn = (props) => {
|
|
|
285
284
|
'iui-selected': isSameSelected(value),
|
|
286
285
|
}), key: index, tabIndex: isSameFocus ? 0 : undefined, ref: (ref) => {
|
|
287
286
|
scrollIntoView(ref, isSameFocus);
|
|
288
|
-
needFocus.current && isSameFocus &&
|
|
287
|
+
needFocus.current && isSameFocus && ref?.focus();
|
|
289
288
|
}, onClick: () => {
|
|
290
289
|
onSelectChange(value);
|
|
291
290
|
} }, valueRenderer(value, precision)));
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -35,9 +35,8 @@ const React = __importStar(require("react"));
|
|
|
35
35
|
const react_transition_group_1 = require("react-transition-group");
|
|
36
36
|
const classnames_1 = __importDefault(require("classnames"));
|
|
37
37
|
const index_js_1 = require("../utils/index.js");
|
|
38
|
-
require("@itwin/itwinui-css/css/toast.css");
|
|
39
38
|
const index_js_2 = require("../Buttons/index.js");
|
|
40
|
-
const isMotionOk = () =>
|
|
39
|
+
const isMotionOk = () => (0, index_js_1.getWindow)()?.matchMedia?.('(prefers-reduced-motion: no-preference)')?.matches;
|
|
41
40
|
/**
|
|
42
41
|
* Generic Toast Component
|
|
43
42
|
* @example
|
|
@@ -94,8 +93,7 @@ const Toast = (props) => {
|
|
|
94
93
|
}, timeout);
|
|
95
94
|
};
|
|
96
95
|
const clearCloseTimeout = () => {
|
|
97
|
-
|
|
98
|
-
(_a = (0, index_js_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.clearTimeout(closeTimeout.current);
|
|
96
|
+
(0, index_js_1.getWindow)()?.clearTimeout(closeTimeout.current);
|
|
99
97
|
};
|
|
100
98
|
const onRef = (ref) => {
|
|
101
99
|
if (ref) {
|
|
@@ -31,7 +31,6 @@ exports.ToastWrapper = void 0;
|
|
|
31
31
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
32
32
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
33
33
|
*--------------------------------------------------------------------------------------------*/
|
|
34
|
-
require("@itwin/itwinui-css/css/toast.css");
|
|
35
34
|
const React = __importStar(require("react"));
|
|
36
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
37
36
|
const Toast_js_1 = __importDefault(require("./Toast.js"));
|
|
@@ -45,11 +45,10 @@ class Toaster {
|
|
|
45
45
|
// Create container on demand.
|
|
46
46
|
// Cannot do it in constructor, because SSG/SSR apps would fail.
|
|
47
47
|
this.asyncInit = async () => {
|
|
48
|
-
var _a, _b;
|
|
49
48
|
if (this.isInitialized) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
|
-
const container = (
|
|
51
|
+
const container = (0, index_js_1.getContainer)(TOASTS_CONTAINER_ID) ?? (0, index_js_1.getDocument)()?.body;
|
|
53
52
|
if (!container) {
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
@@ -81,15 +80,13 @@ class Toaster {
|
|
|
81
80
|
* Settings will be applied to new toasts on the page.
|
|
82
81
|
*/
|
|
83
82
|
setSettings(newSettings) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(_b = newSettings.order) !== null && _b !== void 0 ? _b : (newSettings.order = ((_c = newSettings.placement) === null || _c === void 0 ? void 0 : _c.startsWith('bottom'))
|
|
83
|
+
newSettings.placement ?? (newSettings.placement = this.settings.placement);
|
|
84
|
+
newSettings.order ?? (newSettings.order = newSettings.placement?.startsWith('bottom')
|
|
87
85
|
? 'ascending'
|
|
88
86
|
: 'descending');
|
|
89
87
|
this.settings = newSettings;
|
|
90
88
|
this.asyncInit().then(() => {
|
|
91
|
-
|
|
92
|
-
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setPlacement((_b = this.settings.placement) !== null && _b !== void 0 ? _b : 'top');
|
|
89
|
+
this.toastsRef.current?.setPlacement(this.settings.placement ?? 'top');
|
|
93
90
|
});
|
|
94
91
|
}
|
|
95
92
|
positive(content, options) {
|
|
@@ -114,9 +111,8 @@ class Toaster {
|
|
|
114
111
|
content,
|
|
115
112
|
category,
|
|
116
113
|
onRemove: () => {
|
|
117
|
-
var _a;
|
|
118
114
|
this.removeToast(currentId);
|
|
119
|
-
|
|
115
|
+
options?.onRemove?.();
|
|
120
116
|
},
|
|
121
117
|
id: currentId,
|
|
122
118
|
isVisible: true,
|
|
@@ -132,8 +128,7 @@ class Toaster {
|
|
|
132
128
|
}
|
|
133
129
|
updateView() {
|
|
134
130
|
this.asyncInit().then(() => {
|
|
135
|
-
|
|
136
|
-
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setToasts(this.toasts);
|
|
131
|
+
this.toastsRef.current?.setToasts(this.toasts);
|
|
137
132
|
});
|
|
138
133
|
}
|
|
139
134
|
closeToast(toastId) {
|
|
@@ -34,7 +34,6 @@ exports.ToggleSwitch = void 0;
|
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
require("@itwin/itwinui-css/css/toggle-switch.css");
|
|
38
37
|
/**
|
|
39
38
|
* A switch for turning on and off.
|
|
40
39
|
* @example
|
|
@@ -63,13 +62,12 @@ exports.ToggleSwitch = React.forwardRef((props, ref) => {
|
|
|
63
62
|
const { disabled = false, labelPosition = 'right', label, setFocus = false, className, style, size = 'default', ...rest } = props;
|
|
64
63
|
const inputElementRef = React.useRef(null);
|
|
65
64
|
const refs = (0, index_js_1.useMergedRefs)(inputElementRef, ref);
|
|
66
|
-
const WrapperComponent = label ? 'label' : 'div';
|
|
67
65
|
React.useEffect(() => {
|
|
68
66
|
if (inputElementRef.current && setFocus) {
|
|
69
67
|
inputElementRef.current.focus();
|
|
70
68
|
}
|
|
71
69
|
}, [setFocus]);
|
|
72
|
-
return (React.createElement(
|
|
70
|
+
return (React.createElement(index_js_1.Box, { as: label ? 'label' : 'div', className: (0, classnames_1.default)('iui-toggle-switch-wrapper', {
|
|
73
71
|
'iui-disabled': disabled,
|
|
74
72
|
'iui-label-on-right': label && labelPosition === 'right',
|
|
75
73
|
'iui-label-on-left': label && labelPosition === 'left',
|
|
@@ -34,7 +34,6 @@ exports.Tooltip = void 0;
|
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
require("@itwin/itwinui-css/css/tooltip.css");
|
|
38
37
|
/**
|
|
39
38
|
* Basic tooltip component to display informative content when an element is hovered or focused.
|
|
40
39
|
* Uses the {@link Popover} component, which is a wrapper around [tippy.js](https://atomiks.github.io/tippyjs).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
+
import { ListItem } from '../List/index.js';
|
|
4
|
+
declare type TransferListListboxWrapperOwnProps = {};
|
|
5
|
+
declare type TransferListItemOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Callback fired when the the active state changes.
|
|
8
|
+
*/
|
|
9
|
+
onActiveChange?: (value: boolean) => void;
|
|
10
|
+
} & React.ComponentProps<typeof ListItem>;
|
|
11
|
+
declare type TransferListListboxLabelOwnProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Text label that is wrapped by `TransferList.ListboxLabel`
|
|
14
|
+
*/
|
|
15
|
+
children?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The TransferList component is used to display a list within a box
|
|
19
|
+
* @example
|
|
20
|
+
* <TransferList>
|
|
21
|
+
* <TransferList.ListboxWrapper>
|
|
22
|
+
* <TransferList.Listbox>
|
|
23
|
+
* <TransferList.Item>Item 1</TransferList.Item>
|
|
24
|
+
* <TransferList.Item>Item 2</TransferList.Item>
|
|
25
|
+
* <TransferList.Item>Item 3</TransferList.Item>
|
|
26
|
+
* <TransferList.Item>Item 4</TransferList.Item>
|
|
27
|
+
* <TransferList.Item>Item 5</TransferList.Item>
|
|
28
|
+
* <TransferList.Item>Item 6</TransferList.Item>
|
|
29
|
+
* </TransferList.Listbox>
|
|
30
|
+
* </TransferList.ListboxWrapper>
|
|
31
|
+
* </TransferList>
|
|
32
|
+
*/
|
|
33
|
+
export declare const TransferList: PolymorphicForwardRefComponent<keyof JSX.IntrinsicElements, {}> & {
|
|
34
|
+
/**
|
|
35
|
+
* TransferList listbox wrapper subcomponent
|
|
36
|
+
*/
|
|
37
|
+
ListboxWrapper: PolymorphicForwardRefComponent<"div", TransferListListboxWrapperOwnProps>;
|
|
38
|
+
/**
|
|
39
|
+
* TransferList listbox subcomponent
|
|
40
|
+
*/
|
|
41
|
+
Listbox: PolymorphicForwardRefComponent<"ul", Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "key" | keyof React.HTMLAttributes<HTMLUListElement>> & {
|
|
42
|
+
ref?: ((instance: HTMLUListElement | null) => void) | React.RefObject<HTMLUListElement> | null | undefined;
|
|
43
|
+
}, "as"> & {
|
|
44
|
+
as?: "ul" | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* TransferList item subcomponent
|
|
48
|
+
*/
|
|
49
|
+
Item: PolymorphicForwardRefComponent<"li", TransferListItemOwnProps>;
|
|
50
|
+
/**
|
|
51
|
+
* TransferList listbox label subcomponent
|
|
52
|
+
*/
|
|
53
|
+
ListboxLabel: PolymorphicForwardRefComponent<"div", TransferListListboxLabelOwnProps>;
|
|
54
|
+
/**
|
|
55
|
+
* TransferList toolbar subcomponent
|
|
56
|
+
*/
|
|
57
|
+
Toolbar: PolymorphicForwardRefComponent<keyof JSX.IntrinsicElements, {}>;
|
|
58
|
+
};
|
|
59
|
+
export declare const TransferListContext: React.Context<{
|
|
60
|
+
/**
|
|
61
|
+
* Id to set to label and set 'aria-labelledby' prop of the listbox
|
|
62
|
+
*/
|
|
63
|
+
labelId?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Callback that's fired when labelId is changed
|
|
66
|
+
*/
|
|
67
|
+
setLabelId: (labelId: string) => void;
|
|
68
|
+
} | undefined>;
|
|
69
|
+
export default TransferList;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransferListContext = exports.TransferList = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const index_js_1 = require("../utils/index.js");
|
|
14
|
+
const index_js_2 = require("../List/index.js");
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
// TransferListComponent
|
|
17
|
+
const TransferListComponent = (0, index_js_1.polymorphic)('iui-transfer-list-wrapper');
|
|
18
|
+
TransferListComponent.displayName = 'TransferList';
|
|
19
|
+
const TransferListListboxWrapper = react_1.default.forwardRef((props, ref) => {
|
|
20
|
+
const { className, children, ...rest } = props;
|
|
21
|
+
const uid = (0, index_js_1.useId)();
|
|
22
|
+
const [labelId, setLabelId] = react_1.default.useState(uid);
|
|
23
|
+
return (react_1.default.createElement(index_js_1.Box, { as: 'div', className: (0, classnames_1.default)('iui-transfer-list-listbox-wrapper', className), ref: ref, ...rest },
|
|
24
|
+
react_1.default.createElement(exports.TransferListContext.Provider, { value: { labelId, setLabelId } }, children)));
|
|
25
|
+
});
|
|
26
|
+
TransferListListboxWrapper.displayName = 'TransferList.ListboxWrapper';
|
|
27
|
+
const TransferListListbox = react_1.default.forwardRef((props, ref) => {
|
|
28
|
+
const { children, className, ...rest } = props;
|
|
29
|
+
const { labelId } = (0, index_js_1.useSafeContext)(exports.TransferListContext);
|
|
30
|
+
const [focusedIndex, setFocusedIndex] = react_1.default.useState();
|
|
31
|
+
const listRef = react_1.default.useRef(null);
|
|
32
|
+
const refs = (0, index_js_1.useMergedRefs)(listRef, ref);
|
|
33
|
+
const getFocusableNodes = react_1.default.useCallback(() => {
|
|
34
|
+
const focusableItems = (0, index_js_1.getFocusableElements)(listRef.current);
|
|
35
|
+
// Filter out focusable elements that are inside each list item, e.g. checkbox, anchor
|
|
36
|
+
return focusableItems.filter((i) => !focusableItems.some((p) => p.contains(i.parentElement)));
|
|
37
|
+
}, []);
|
|
38
|
+
react_1.default.useEffect(() => {
|
|
39
|
+
const items = getFocusableNodes();
|
|
40
|
+
if (focusedIndex != null) {
|
|
41
|
+
items?.[focusedIndex]?.focus();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}, [focusedIndex, getFocusableNodes]);
|
|
45
|
+
const onKeyDown = (event) => {
|
|
46
|
+
if (event.altKey) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const items = getFocusableNodes();
|
|
50
|
+
if (!items?.length) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const currentIndex = focusedIndex ?? 0;
|
|
54
|
+
switch (event.key) {
|
|
55
|
+
case 'ArrowDown': {
|
|
56
|
+
setFocusedIndex(Math.min(currentIndex + 1, items.length - 1));
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'ArrowUp': {
|
|
62
|
+
setFocusedIndex(Math.max(currentIndex - 1, 0));
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return (react_1.default.createElement(index_js_2.List, { className: (0, classnames_1.default)('iui-transfer-list-listbox', className), onKeyDown: onKeyDown, role: 'listbox', "aria-multiselectable": true, "aria-labelledby": labelId, tabIndex: 0, ref: refs, ...rest }, children));
|
|
72
|
+
});
|
|
73
|
+
TransferListListbox.displayName = 'TransferList.Listbox';
|
|
74
|
+
const TransferListItem = react_1.default.forwardRef((props, ref) => {
|
|
75
|
+
const { actionable = true, disabled, onActiveChange, children, active, ...rest } = props;
|
|
76
|
+
const onClickEvents = () => actionable && onActiveChange && onActiveChange(!active);
|
|
77
|
+
const onKeyDown = (event) => {
|
|
78
|
+
if (event.altKey) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (event.key === 'Enter' ||
|
|
82
|
+
event.key === ' ' ||
|
|
83
|
+
event.key === 'Spacebar') {
|
|
84
|
+
!disabled && onClickEvents();
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return (react_1.default.createElement(index_js_2.ListItem, { ref: ref, onClick: onClickEvents, onKeyDown: onKeyDown, active: active, actionable: actionable, tabIndex: -1, role: 'option', "aria-disabled": disabled ? 'true' : undefined, "aria-selected": active ? 'true' : undefined, disabled: disabled, ...rest }, children));
|
|
89
|
+
});
|
|
90
|
+
TransferListItem.displayName = 'TransferList.Item';
|
|
91
|
+
const TransferListListboxLabel = react_1.default.forwardRef((props, ref) => {
|
|
92
|
+
const { children, className, id, ...rest } = props;
|
|
93
|
+
const { labelId, setLabelId } = (0, index_js_1.useSafeContext)(exports.TransferListContext);
|
|
94
|
+
react_1.default.useEffect(() => {
|
|
95
|
+
if (id && id !== labelId) {
|
|
96
|
+
setLabelId(id);
|
|
97
|
+
}
|
|
98
|
+
}, [id, labelId, setLabelId]);
|
|
99
|
+
return (react_1.default.createElement(index_js_1.Box, { as: 'div', className: (0, classnames_1.default)('iui-transfer-list-listbox-label', className), id: labelId, ref: ref, ...rest }, children));
|
|
100
|
+
});
|
|
101
|
+
TransferListListboxLabel.displayName = 'TransferList.ListboxLabel';
|
|
102
|
+
// ----------------------------------------------------------------------------
|
|
103
|
+
// TransferList.Toolbar component
|
|
104
|
+
const TransferListToolbar = (0, index_js_1.polymorphic)('iui-transfer-list-toolbar', {
|
|
105
|
+
role: 'toolbar',
|
|
106
|
+
});
|
|
107
|
+
TransferListToolbar.displayName = 'TransferList.Toolbar';
|
|
108
|
+
/**
|
|
109
|
+
* The TransferList component is used to display a list within a box
|
|
110
|
+
* @example
|
|
111
|
+
* <TransferList>
|
|
112
|
+
* <TransferList.ListboxWrapper>
|
|
113
|
+
* <TransferList.Listbox>
|
|
114
|
+
* <TransferList.Item>Item 1</TransferList.Item>
|
|
115
|
+
* <TransferList.Item>Item 2</TransferList.Item>
|
|
116
|
+
* <TransferList.Item>Item 3</TransferList.Item>
|
|
117
|
+
* <TransferList.Item>Item 4</TransferList.Item>
|
|
118
|
+
* <TransferList.Item>Item 5</TransferList.Item>
|
|
119
|
+
* <TransferList.Item>Item 6</TransferList.Item>
|
|
120
|
+
* </TransferList.Listbox>
|
|
121
|
+
* </TransferList.ListboxWrapper>
|
|
122
|
+
* </TransferList>
|
|
123
|
+
*/
|
|
124
|
+
exports.TransferList = Object.assign(TransferListComponent, {
|
|
125
|
+
/**
|
|
126
|
+
* TransferList listbox wrapper subcomponent
|
|
127
|
+
*/
|
|
128
|
+
ListboxWrapper: TransferListListboxWrapper,
|
|
129
|
+
/**
|
|
130
|
+
* TransferList listbox subcomponent
|
|
131
|
+
*/
|
|
132
|
+
Listbox: TransferListListbox,
|
|
133
|
+
/**
|
|
134
|
+
* TransferList item subcomponent
|
|
135
|
+
*/
|
|
136
|
+
Item: TransferListItem,
|
|
137
|
+
/**
|
|
138
|
+
* TransferList listbox label subcomponent
|
|
139
|
+
*/
|
|
140
|
+
ListboxLabel: TransferListListboxLabel,
|
|
141
|
+
/**
|
|
142
|
+
* TransferList toolbar subcomponent
|
|
143
|
+
*/
|
|
144
|
+
Toolbar: TransferListToolbar,
|
|
145
|
+
});
|
|
146
|
+
exports.TransferListContext = react_1.default.createContext(undefined);
|
|
147
|
+
exports.default = exports.TransferList;
|