@itwin/itwinui-react 3.0.0-dev.6 → 3.0.0-dev.8
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 +101 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/Avatar/Avatar.d.ts +3 -2
- package/cjs/core/Avatar/Avatar.js +21 -19
- package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/Button/Button.d.ts +15 -2
- package/cjs/core/Buttons/Button/Button.js +23 -9
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
- package/cjs/core/Carousel/Carousel.d.ts +6 -4
- package/cjs/core/Carousel/Carousel.js +2 -2
- package/cjs/core/Carousel/CarouselDot.js +1 -3
- package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.js +3 -3
- package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +1 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +47 -6
- package/cjs/core/Dialog/Dialog.js +10 -17
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/Dialog/DialogMain.js +5 -5
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
- package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
- package/cjs/core/FileUpload/FileUpload.js +24 -3
- package/cjs/core/Header/HeaderBasicButton.js +3 -16
- package/cjs/core/Header/HeaderDropdownButton.js +1 -1
- package/cjs/core/Header/HeaderSplitButton.js +3 -4
- package/cjs/core/Input/Input.d.ts +4 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
- package/cjs/core/InputGrid/InputGrid.js +39 -0
- package/cjs/core/InputGrid/index.d.ts +3 -0
- package/cjs/core/InputGrid/index.js +15 -0
- package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
- package/cjs/core/InputGroup/InputGroup.js +35 -9
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
- package/cjs/core/InputWithDecorations/index.d.ts +3 -0
- package/cjs/core/InputWithDecorations/index.js +15 -0
- package/cjs/core/Label/Label.d.ts +5 -0
- package/cjs/core/Label/Label.js +2 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/cjs/core/LabeledInput/LabeledInput.js +52 -29
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
- package/cjs/core/Menu/Menu.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +1 -1
- package/cjs/core/Menu/MenuDivider.d.ts +2 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.js +1 -0
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +12 -11
- package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/cjs/core/SideNavigation/SideNavigation.js +42 -9
- package/cjs/core/Slider/Slider.d.ts +24 -0
- package/cjs/core/Slider/Slider.js +58 -10
- package/cjs/core/Slider/Thumb.js +3 -2
- package/cjs/core/Slider/Track.d.ts +1 -1
- package/cjs/core/Slider/Track.js +17 -6
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Stepper/Stepper.d.ts +26 -1
- package/cjs/core/Stepper/Stepper.js +35 -6
- package/cjs/core/Stepper/StepperStep.d.ts +17 -0
- package/cjs/core/Stepper/StepperStep.js +33 -8
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
- package/cjs/core/Table/SubRowExpander.js +3 -1
- package/cjs/core/Table/Table.js +0 -1
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.js +1 -3
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Tabs/Tab.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
- package/cjs/core/Tile/Tile.d.ts +142 -17
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +24 -13
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -118
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/Tree/TreeNode.js +1 -1
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
- package/cjs/core/utils/components/ButtonBase.js +46 -0
- package/cjs/core/utils/components/Icon.d.ts +5 -0
- package/cjs/core/utils/components/Icon.js +8 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +14 -34
- package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputFlexContainer.js +3 -1
- package/cjs/core/utils/components/Popover.js +5 -3
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/VirtualScroll.js +4 -4
- package/cjs/core/utils/components/index.d.ts +2 -0
- package/cjs/core/utils/components/index.js +2 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -13
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/react.d.ts +8 -0
- package/cjs/core/utils/functions/react.js +40 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
- package/cjs/styles.js +11 -35
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/Avatar/Avatar.d.ts +3 -2
- package/esm/core/Avatar/Avatar.js +21 -17
- package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/Button/Button.d.ts +15 -2
- package/esm/core/Buttons/Button/Button.js +18 -10
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/esm/core/Buttons/IconButton/IconButton.js +25 -37
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
- package/esm/core/Carousel/Carousel.d.ts +6 -4
- package/esm/core/Carousel/Carousel.js +8 -3
- package/esm/core/Carousel/CarouselDot.js +2 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/esm/core/ColorPicker/ColorBuilder.js +2 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.js +3 -3
- package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxInput.js +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +1 -2
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +33 -6
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/Dialog/DialogMain.js +5 -5
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
- package/esm/core/FileUpload/FileUpload.d.ts +4 -0
- package/esm/core/FileUpload/FileUpload.js +26 -3
- package/esm/core/Header/HeaderBasicButton.js +4 -17
- package/esm/core/Header/HeaderDropdownButton.js +1 -1
- package/esm/core/Header/HeaderSplitButton.js +9 -5
- package/esm/core/Input/Input.d.ts +4 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/InputGrid/InputGrid.d.ts +25 -0
- package/esm/core/InputGrid/InputGrid.js +35 -0
- package/esm/core/InputGrid/index.d.ts +3 -0
- package/esm/core/InputGrid/index.js +6 -0
- package/esm/core/InputGroup/InputGroup.d.ts +13 -0
- package/esm/core/InputGroup/InputGroup.js +34 -10
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
- package/esm/core/InputWithDecorations/index.d.ts +3 -0
- package/esm/core/InputWithDecorations/index.js +6 -0
- package/esm/core/Label/Label.d.ts +5 -0
- package/esm/core/Label/Label.js +2 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/esm/core/LabeledInput/LabeledInput.js +53 -29
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
- package/esm/core/Menu/Menu.d.ts +1 -1
- package/esm/core/Menu/Menu.js +1 -1
- package/esm/core/Menu/MenuDivider.d.ts +2 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Menu/MenuItem.js +1 -0
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +12 -11
- package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/esm/core/SideNavigation/SideNavigation.js +33 -9
- package/esm/core/Slider/Slider.d.ts +24 -0
- package/esm/core/Slider/Slider.js +43 -10
- package/esm/core/Slider/Thumb.js +3 -2
- package/esm/core/Slider/Track.d.ts +1 -1
- package/esm/core/Slider/Track.js +14 -6
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Stepper/Stepper.d.ts +26 -1
- package/esm/core/Stepper/Stepper.js +32 -6
- package/esm/core/Stepper/StepperStep.d.ts +17 -0
- package/esm/core/Stepper/StepperStep.js +27 -8
- package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/esm/core/Stepper/WorkflowDiagram.js +10 -7
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
- package/esm/core/Table/SubRowExpander.js +3 -1
- package/esm/core/Table/Table.js +0 -1
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Tabs/Tab.js +2 -3
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
- package/esm/core/Tile/Tile.d.ts +142 -17
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +26 -13
- package/esm/core/Tooltip/Tooltip.d.ts +35 -28
- package/esm/core/Tooltip/Tooltip.js +119 -116
- package/esm/core/TransferList/TransferList.js +4 -9
- package/esm/core/Tree/TreeNode.js +1 -1
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/ButtonBase.d.ts +14 -0
- package/esm/core/utils/components/ButtonBase.js +42 -0
- package/esm/core/utils/components/Icon.d.ts +5 -0
- package/esm/core/utils/components/Icon.js +8 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +14 -30
- package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/esm/core/utils/components/InputFlexContainer.js +3 -1
- package/esm/core/utils/components/Popover.js +5 -3
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/VirtualScroll.js +4 -4
- package/esm/core/utils/components/index.d.ts +2 -0
- package/esm/core/utils/components/index.js +2 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -13
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/react.d.ts +8 -0
- package/esm/core/utils/functions/react.js +35 -0
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
- package/esm/styles.js +11 -35
- package/package.json +3 -3
- package/styles.css +49 -46
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
3
|
import { IconButton } from '../Buttons/index.js';
|
|
4
|
-
type
|
|
4
|
+
type TileWrapperOwnProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Status of the tile.
|
|
7
7
|
*/
|
|
@@ -46,12 +46,119 @@ type TileNameOwnProps = {
|
|
|
46
46
|
};
|
|
47
47
|
type TileMoreOptionsOwnProps = {
|
|
48
48
|
buttonProps?: React.ComponentPropsWithoutRef<typeof IconButton>;
|
|
49
|
-
children?: React.
|
|
49
|
+
children?: React.ReactNode[];
|
|
50
|
+
};
|
|
51
|
+
type TileLegacyProps = {
|
|
52
|
+
/**
|
|
53
|
+
* Name or title of the tile.
|
|
54
|
+
*/
|
|
55
|
+
name: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Description text of the tile.
|
|
58
|
+
* Gets truncated if it can't fit in the tile.
|
|
59
|
+
*/
|
|
60
|
+
description?: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Metadata section located below description.
|
|
63
|
+
* @example
|
|
64
|
+
* <Tile
|
|
65
|
+
* // ...
|
|
66
|
+
* metadata='basic metadata'
|
|
67
|
+
* // or
|
|
68
|
+
* metadata={<span><SvgClock /> 2021-01-01, 04:30 AM</span>}
|
|
69
|
+
* // or
|
|
70
|
+
* metadata={<>
|
|
71
|
+
* <SvgTag2 />
|
|
72
|
+
* <TagContainer><Tag variant='basic'>Tag 1</Tag><Tag variant='basic'>Tag 2</Tag></TagContainer>
|
|
73
|
+
* </>}
|
|
74
|
+
* />
|
|
75
|
+
*/
|
|
76
|
+
metadata?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Thumbnail image url, a custom component or an svg.
|
|
79
|
+
* @example
|
|
80
|
+
* <Tile
|
|
81
|
+
* // ...
|
|
82
|
+
* thumbnail='/url/to/image.jpg'
|
|
83
|
+
* // or
|
|
84
|
+
* thumbnail={<Avatar image={<img src='icon.png' />} />}
|
|
85
|
+
* // or
|
|
86
|
+
* thumbnail={<SvgImodelHollow />}
|
|
87
|
+
* />
|
|
88
|
+
*/
|
|
89
|
+
thumbnail?: string | React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* `Badge` shown on the bottom right of thumbnail.
|
|
92
|
+
*/
|
|
93
|
+
badge?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Icon shown on top left of the tile. Also known as "type indicator".
|
|
96
|
+
* Recommended to use an invisible `IconButton`.
|
|
97
|
+
*/
|
|
98
|
+
leftIcon?: React.ReactNode;
|
|
99
|
+
/**
|
|
100
|
+
* Icon shown on top right of the tile. Also known as "quick action".
|
|
101
|
+
* Recommended to use an invisible `IconButton`.
|
|
102
|
+
*/
|
|
103
|
+
rightIcon?: React.ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* Upto two buttons shown at the bottom of the tile.
|
|
106
|
+
*/
|
|
107
|
+
buttons?: [React.ReactNode?, React.ReactNode?];
|
|
108
|
+
/**
|
|
109
|
+
* Dropdown menu containing `MenuItem`s.
|
|
110
|
+
*/
|
|
111
|
+
moreOptions?: React.ReactNode[];
|
|
112
|
+
/**
|
|
113
|
+
* Status of the tile.
|
|
114
|
+
*/
|
|
115
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
116
|
+
/**
|
|
117
|
+
* Whether the tile is selected or in "active" state.
|
|
118
|
+
* Gets highlighted and shows a checkmark icon near tile name.
|
|
119
|
+
*/
|
|
120
|
+
isSelected?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the tile is "new". Tile name becomes bold and gets a new status icon.
|
|
123
|
+
*/
|
|
124
|
+
isNew?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Default tile variant or the folder layout.
|
|
127
|
+
* @default 'default'
|
|
128
|
+
*/
|
|
129
|
+
variant?: 'default' | 'folder';
|
|
130
|
+
/**
|
|
131
|
+
* Any custom nodes that will be appended to the tile's main content.
|
|
132
|
+
*/
|
|
133
|
+
children?: React.ReactNode;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the tile is expected to be interactable (i.e. `onClick`).
|
|
136
|
+
* It becomes focusable and gets on hover styling.
|
|
137
|
+
*/
|
|
138
|
+
isActionable?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Display a loading state.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
isLoading?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Flag whether the tile is disabled.
|
|
146
|
+
*
|
|
147
|
+
* Note: This only affects the tile. You need to manually disable
|
|
148
|
+
* the buttons and other interactive elements inside the tile.
|
|
149
|
+
*
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
isDisabled?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Adds onClick to the TileAction component.
|
|
155
|
+
*/
|
|
156
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
50
157
|
};
|
|
51
158
|
/**
|
|
52
159
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
53
160
|
* @example
|
|
54
|
-
* <Tile>
|
|
161
|
+
* <Tile.Wrapper>
|
|
55
162
|
* <Tile.ThumbnailArea>
|
|
56
163
|
* <Tile.ThumbnailPicture/>
|
|
57
164
|
* <Tile.Badge/>
|
|
@@ -61,23 +168,40 @@ type TileMoreOptionsOwnProps = {
|
|
|
61
168
|
* <Tile.Name>
|
|
62
169
|
* <Tile.NameIcon/>
|
|
63
170
|
* <Tile.NameLabel/>
|
|
64
|
-
*
|
|
171
|
+
* </Tile.Name>
|
|
65
172
|
* <Tile.ContentArea>
|
|
66
173
|
* <Tile.Description />
|
|
67
174
|
* <Tile.Metadata/>
|
|
68
175
|
* <Tile.MoreOptions/>
|
|
69
176
|
* </Tile.ContentArea>
|
|
70
177
|
* <Tile.Buttons/>
|
|
71
|
-
* </Tile>
|
|
178
|
+
* </Tile.Wrapper>
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* <Tile
|
|
182
|
+
* name='Tile name'
|
|
183
|
+
* description='Tile description that takes upto 3 lines'
|
|
184
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
185
|
+
* thumbnail='/url/to/image.jpg'
|
|
186
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
187
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
188
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
189
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
190
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
191
|
+
* isSelected={true}
|
|
192
|
+
* isNew={false}
|
|
193
|
+
* />
|
|
72
194
|
*/
|
|
73
|
-
export declare const Tile: PolymorphicForwardRefComponent<"div",
|
|
195
|
+
export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps> & {
|
|
196
|
+
/**
|
|
197
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
198
|
+
*/
|
|
199
|
+
Wrapper: PolymorphicForwardRefComponent<"div", TileWrapperOwnProps>;
|
|
74
200
|
/**
|
|
75
201
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
76
202
|
* @example
|
|
77
203
|
* <Tile.ThumbnailArea>
|
|
78
204
|
* <Tile.ThumbnailPicture/>
|
|
79
|
-
* // or
|
|
80
|
-
* <Tile.ThumbnailAvatar/>
|
|
81
205
|
* <Tile.QuickAction/>
|
|
82
206
|
* <Tile.TypeIndicator/>
|
|
83
207
|
* <Tile.BadgeContainer/>
|
|
@@ -87,14 +211,14 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
87
211
|
/**
|
|
88
212
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
89
213
|
* @example
|
|
90
|
-
* <Tile>
|
|
214
|
+
* <Tile.Wrapper>
|
|
91
215
|
* // ...
|
|
92
216
|
* <Tile.ThumbnailArea>
|
|
93
217
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
94
218
|
* </Tile.ThumbnailArea>
|
|
95
|
-
* </Tile>
|
|
219
|
+
* </Tile.Wrapper>
|
|
96
220
|
* or
|
|
97
|
-
* <Tile>
|
|
221
|
+
* <Tile.Wrapper>
|
|
98
222
|
* // ...
|
|
99
223
|
* <Tile.ThumbnailArea>
|
|
100
224
|
* <Tile.ThumbnailPicture>
|
|
@@ -125,10 +249,11 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
125
249
|
*/
|
|
126
250
|
IconButton: PolymorphicForwardRefComponent<"button", Omit<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
127
251
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
128
|
-
}, "label" | "as" | "size" | "styleType" | "isActive"> & {
|
|
252
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
|
|
129
253
|
isActive?: boolean | undefined;
|
|
130
254
|
label?: React.ReactNode;
|
|
131
|
-
|
|
255
|
+
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
256
|
+
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
132
257
|
as?: "button" | undefined;
|
|
133
258
|
}, "ref">>;
|
|
134
259
|
/**
|
|
@@ -138,11 +263,11 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
138
263
|
/**
|
|
139
264
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
140
265
|
* @example
|
|
141
|
-
* <Tile>
|
|
266
|
+
* <Tile.Wrapper>
|
|
142
267
|
* <Tile.Name>
|
|
143
268
|
* <Tile.NameIcon/>
|
|
144
269
|
* </Tile.Name>
|
|
145
|
-
*
|
|
270
|
+
* </Tile.Wrapper>
|
|
146
271
|
*/
|
|
147
272
|
NameIcon: PolymorphicForwardRefComponent<"div", {}>;
|
|
148
273
|
NameLabel: PolymorphicForwardRefComponent<"span", {}>;
|
|
@@ -160,13 +285,13 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
160
285
|
/**
|
|
161
286
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
162
287
|
* @example
|
|
163
|
-
* <Tile>
|
|
288
|
+
* <Tile.Wrapper>
|
|
164
289
|
* <Tile.ContentArea>
|
|
165
290
|
* <Tile.Description/>
|
|
166
291
|
* <Tile.Metadata/>
|
|
167
292
|
* <Tile.MoreOptions/>
|
|
168
293
|
* </Tile.ContentArea>
|
|
169
|
-
* </Tile>
|
|
294
|
+
* </Tile.Wrapper>
|
|
170
295
|
*/
|
|
171
296
|
ContentArea: PolymorphicForwardRefComponent<NonNullable<keyof JSX.IntrinsicElements>, {}>;
|
|
172
297
|
/**
|
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -14,7 +14,7 @@ const index_js_3 = require('../Buttons/index.js');
|
|
|
14
14
|
const index_js_4 = require('../ProgressIndicators/index.js');
|
|
15
15
|
const TileContext = React.createContext(undefined);
|
|
16
16
|
TileContext.displayName = 'TileContext';
|
|
17
|
-
const
|
|
17
|
+
const TileWrapper = React.forwardRef((props, forwardedRef) => {
|
|
18
18
|
const {
|
|
19
19
|
className,
|
|
20
20
|
status,
|
|
@@ -60,7 +60,7 @@ const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
|
60
60
|
}),
|
|
61
61
|
);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
TileWrapper.displayName = 'Tile.Wrapper';
|
|
64
64
|
// ----------------------------------------------------------------------------
|
|
65
65
|
// Tile.Action component
|
|
66
66
|
const TileAction = React.forwardRef((props, forwardedRef) => {
|
|
@@ -272,10 +272,84 @@ TileMoreOptions.displayName = 'Tile.MoreOptions';
|
|
|
272
272
|
// Tile.Buttons component
|
|
273
273
|
const TileButtons = (0, index_js_1.polymorphic)('iui-tile-buttons');
|
|
274
274
|
TileButtons.displayName = 'Tile.Buttons';
|
|
275
|
+
const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
276
|
+
const {
|
|
277
|
+
name,
|
|
278
|
+
description,
|
|
279
|
+
status,
|
|
280
|
+
isNew,
|
|
281
|
+
isLoading,
|
|
282
|
+
isSelected,
|
|
283
|
+
thumbnail,
|
|
284
|
+
badge,
|
|
285
|
+
leftIcon,
|
|
286
|
+
rightIcon,
|
|
287
|
+
buttons,
|
|
288
|
+
metadata,
|
|
289
|
+
moreOptions,
|
|
290
|
+
children,
|
|
291
|
+
isActionable,
|
|
292
|
+
isDisabled,
|
|
293
|
+
onClick,
|
|
294
|
+
...rest
|
|
295
|
+
} = props;
|
|
296
|
+
return React.createElement(
|
|
297
|
+
TileWrapper,
|
|
298
|
+
{
|
|
299
|
+
ref: forwardedRef,
|
|
300
|
+
isNew: isNew,
|
|
301
|
+
isSelected: isSelected,
|
|
302
|
+
isLoading: isLoading,
|
|
303
|
+
status: status,
|
|
304
|
+
isDisabled: isDisabled,
|
|
305
|
+
...rest,
|
|
306
|
+
},
|
|
307
|
+
React.createElement(
|
|
308
|
+
TileName,
|
|
309
|
+
null,
|
|
310
|
+
(status || isNew || isLoading || isSelected) &&
|
|
311
|
+
React.createElement(TileNameIcon, null),
|
|
312
|
+
React.createElement(
|
|
313
|
+
TileNameLabel,
|
|
314
|
+
null,
|
|
315
|
+
isActionable
|
|
316
|
+
? React.createElement(
|
|
317
|
+
TileAction,
|
|
318
|
+
{
|
|
319
|
+
onClick: !isDisabled ? onClick : undefined,
|
|
320
|
+
'aria-disabled': isDisabled,
|
|
321
|
+
},
|
|
322
|
+
name,
|
|
323
|
+
)
|
|
324
|
+
: name,
|
|
325
|
+
),
|
|
326
|
+
),
|
|
327
|
+
React.createElement(
|
|
328
|
+
TileThumbnailArea,
|
|
329
|
+
null,
|
|
330
|
+
typeof thumbnail !== 'string'
|
|
331
|
+
? React.createElement(TileThumbnailPicture, null, thumbnail)
|
|
332
|
+
: React.createElement(TileThumbnailPicture, { url: thumbnail }),
|
|
333
|
+
badge && React.createElement(TileBadgeContainer, null, badge),
|
|
334
|
+
leftIcon && React.createElement(TileTypeIndicator, null, leftIcon),
|
|
335
|
+
rightIcon && React.createElement(TileQuickAction, null, rightIcon),
|
|
336
|
+
),
|
|
337
|
+
React.createElement(
|
|
338
|
+
TileContentArea,
|
|
339
|
+
null,
|
|
340
|
+
description && React.createElement(TileDescription, null, description),
|
|
341
|
+
moreOptions && React.createElement(TileMoreOptions, null, moreOptions),
|
|
342
|
+
metadata && React.createElement(TileMetadata, null, metadata),
|
|
343
|
+
children,
|
|
344
|
+
),
|
|
345
|
+
buttons && React.createElement(TileButtons, null, buttons),
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
TileComponent.displayName = 'Tile';
|
|
275
349
|
/**
|
|
276
350
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
277
351
|
* @example
|
|
278
|
-
* <Tile>
|
|
352
|
+
* <Tile.Wrapper>
|
|
279
353
|
* <Tile.ThumbnailArea>
|
|
280
354
|
* <Tile.ThumbnailPicture/>
|
|
281
355
|
* <Tile.Badge/>
|
|
@@ -285,23 +359,40 @@ TileButtons.displayName = 'Tile.Buttons';
|
|
|
285
359
|
* <Tile.Name>
|
|
286
360
|
* <Tile.NameIcon/>
|
|
287
361
|
* <Tile.NameLabel/>
|
|
288
|
-
*
|
|
362
|
+
* </Tile.Name>
|
|
289
363
|
* <Tile.ContentArea>
|
|
290
364
|
* <Tile.Description />
|
|
291
365
|
* <Tile.Metadata/>
|
|
292
366
|
* <Tile.MoreOptions/>
|
|
293
367
|
* </Tile.ContentArea>
|
|
294
368
|
* <Tile.Buttons/>
|
|
295
|
-
* </Tile>
|
|
369
|
+
* </Tile.Wrapper>
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* <Tile
|
|
373
|
+
* name='Tile name'
|
|
374
|
+
* description='Tile description that takes upto 3 lines'
|
|
375
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
376
|
+
* thumbnail='/url/to/image.jpg'
|
|
377
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
378
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
379
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
380
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
381
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
382
|
+
* isSelected={true}
|
|
383
|
+
* isNew={false}
|
|
384
|
+
* />
|
|
296
385
|
*/
|
|
297
386
|
exports.Tile = Object.assign(TileComponent, {
|
|
387
|
+
/**
|
|
388
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
389
|
+
*/
|
|
390
|
+
Wrapper: TileWrapper,
|
|
298
391
|
/**
|
|
299
392
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
300
393
|
* @example
|
|
301
394
|
* <Tile.ThumbnailArea>
|
|
302
395
|
* <Tile.ThumbnailPicture/>
|
|
303
|
-
* // or
|
|
304
|
-
* <Tile.ThumbnailAvatar/>
|
|
305
396
|
* <Tile.QuickAction/>
|
|
306
397
|
* <Tile.TypeIndicator/>
|
|
307
398
|
* <Tile.BadgeContainer/>
|
|
@@ -311,14 +402,14 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
311
402
|
/**
|
|
312
403
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
313
404
|
* @example
|
|
314
|
-
* <Tile>
|
|
405
|
+
* <Tile.Wrapper>
|
|
315
406
|
* // ...
|
|
316
407
|
* <Tile.ThumbnailArea>
|
|
317
408
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
318
409
|
* </Tile.ThumbnailArea>
|
|
319
|
-
* </Tile>
|
|
410
|
+
* </Tile.Wrapper>
|
|
320
411
|
* or
|
|
321
|
-
* <Tile>
|
|
412
|
+
* <Tile.Wrapper>
|
|
322
413
|
* // ...
|
|
323
414
|
* <Tile.ThumbnailArea>
|
|
324
415
|
* <Tile.ThumbnailPicture>
|
|
@@ -355,21 +446,21 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
355
446
|
/**
|
|
356
447
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
357
448
|
* @example
|
|
358
|
-
* <Tile>
|
|
449
|
+
* <Tile.Wrapper>
|
|
359
450
|
* <Tile.Name>
|
|
360
451
|
* <Tile.NameIcon/>
|
|
361
452
|
* </Tile.Name>
|
|
362
|
-
*
|
|
453
|
+
* </Tile.Wrapper>
|
|
363
454
|
*/
|
|
364
455
|
NameIcon: TileNameIcon,
|
|
365
456
|
/*
|
|
366
457
|
* `NameLabel` of the tile
|
|
367
458
|
* @example
|
|
368
|
-
* <Tile>
|
|
459
|
+
* <Tile.Wrapper>
|
|
369
460
|
* <Tile.Name>
|
|
370
461
|
* <Tile.NameLabel> Tile Name <Tile.NameLabel/>
|
|
371
462
|
* </Tile.Name/>
|
|
372
|
-
*
|
|
463
|
+
* </Tile.Wrapper>
|
|
373
464
|
*/
|
|
374
465
|
NameLabel: TileNameLabel,
|
|
375
466
|
/**
|
|
@@ -386,13 +477,13 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
386
477
|
/**
|
|
387
478
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
388
479
|
* @example
|
|
389
|
-
* <Tile>
|
|
480
|
+
* <Tile.Wrapper>
|
|
390
481
|
* <Tile.ContentArea>
|
|
391
482
|
* <Tile.Description/>
|
|
392
483
|
* <Tile.Metadata/>
|
|
393
484
|
* <Tile.MoreOptions/>
|
|
394
485
|
* </Tile.ContentArea>
|
|
395
|
-
* </Tile>
|
|
486
|
+
* </Tile.Wrapper>
|
|
396
487
|
*/
|
|
397
488
|
ContentArea: TileContentArea,
|
|
398
489
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
3
|
export type ToastCategory = 'informational' | 'negative' | 'positive' | 'warning';
|
|
4
4
|
export type ToastProps = {
|
|
5
5
|
/**
|
|
@@ -10,6 +10,13 @@ export type ToastProps = {
|
|
|
10
10
|
* Content of the Toast message
|
|
11
11
|
*/
|
|
12
12
|
content: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Passes props to toast and content
|
|
15
|
+
*/
|
|
16
|
+
domProps?: {
|
|
17
|
+
toastProps?: React.ComponentProps<'div'>;
|
|
18
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
19
|
+
};
|
|
13
20
|
/**
|
|
14
21
|
* Category of the Toast, which controls the border color, as well as the category icon.
|
|
15
22
|
*/
|
|
@@ -60,12 +67,13 @@ export type ToastProps = {
|
|
|
60
67
|
* <Toast type='persisting' content='Job processing error.' category='negative' />
|
|
61
68
|
*/
|
|
62
69
|
export declare const Toast: (props: ToastProps) => React.JSX.Element;
|
|
63
|
-
export type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id' | 'isVisible' | 'onRemove'> & {
|
|
70
|
+
export type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id' | 'isVisible' | 'onRemove' | 'domProps'> & {
|
|
64
71
|
onClose?: () => void;
|
|
65
|
-
|
|
72
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
73
|
+
};
|
|
66
74
|
/**
|
|
67
75
|
* The presentational part of a toast, without any animation or logic.
|
|
68
76
|
* @private
|
|
69
77
|
*/
|
|
70
|
-
export declare const ToastPresentation:
|
|
78
|
+
export declare const ToastPresentation: PolymorphicForwardRefComponent<"div", ToastPresentationProps>;
|
|
71
79
|
export default Toast;
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -35,6 +35,7 @@ const Toast = (props) => {
|
|
|
35
35
|
hasCloseButton,
|
|
36
36
|
onRemove,
|
|
37
37
|
animateOutTo,
|
|
38
|
+
domProps,
|
|
38
39
|
} = props;
|
|
39
40
|
const closeTimeout = React.useRef(0);
|
|
40
41
|
const { placement } = (0, index_js_1.useSafeContext)(
|
|
@@ -48,9 +49,9 @@ const Toast = (props) => {
|
|
|
48
49
|
const [margin, setMargin] = React.useState(0);
|
|
49
50
|
const marginStyle = () => {
|
|
50
51
|
if (placementPosition === 'top') {
|
|
51
|
-
return {
|
|
52
|
+
return { marginBlockEnd: margin };
|
|
52
53
|
}
|
|
53
|
-
return {
|
|
54
|
+
return { marginBlockStart: margin };
|
|
54
55
|
};
|
|
55
56
|
React.useEffect(() => {
|
|
56
57
|
if (type === 'temporary') {
|
|
@@ -149,12 +150,15 @@ const Toast = (props) => {
|
|
|
149
150
|
'div',
|
|
150
151
|
{ ref: onRef },
|
|
151
152
|
React.createElement(exports.ToastPresentation, {
|
|
153
|
+
as: 'div',
|
|
152
154
|
category: category,
|
|
153
155
|
content: content,
|
|
154
156
|
link: link,
|
|
155
157
|
type: type,
|
|
156
158
|
hasCloseButton: hasCloseButton,
|
|
157
159
|
onClose: close,
|
|
160
|
+
...domProps?.toastProps,
|
|
161
|
+
contentProps: domProps?.contentProps,
|
|
158
162
|
}),
|
|
159
163
|
),
|
|
160
164
|
),
|
|
@@ -165,7 +169,7 @@ exports.Toast = Toast;
|
|
|
165
169
|
* The presentational part of a toast, without any animation or logic.
|
|
166
170
|
* @private
|
|
167
171
|
*/
|
|
168
|
-
|
|
172
|
+
exports.ToastPresentation = React.forwardRef((props, forwardedRef) => {
|
|
169
173
|
const {
|
|
170
174
|
content,
|
|
171
175
|
category,
|
|
@@ -174,6 +178,7 @@ const ToastPresentation = (props) => {
|
|
|
174
178
|
hasCloseButton,
|
|
175
179
|
onClose,
|
|
176
180
|
className,
|
|
181
|
+
contentProps,
|
|
177
182
|
...rest
|
|
178
183
|
} = props;
|
|
179
184
|
const StatusIcon = index_js_1.StatusIconMap[category];
|
|
@@ -184,6 +189,7 @@ const ToastPresentation = (props) => {
|
|
|
184
189
|
`iui-toast iui-${category}`,
|
|
185
190
|
className,
|
|
186
191
|
),
|
|
192
|
+
ref: forwardedRef,
|
|
187
193
|
...rest,
|
|
188
194
|
},
|
|
189
195
|
React.createElement(
|
|
@@ -191,16 +197,22 @@ const ToastPresentation = (props) => {
|
|
|
191
197
|
{ className: 'iui-status-area' },
|
|
192
198
|
React.createElement(StatusIcon, { className: 'iui-icon' }),
|
|
193
199
|
),
|
|
194
|
-
React.createElement(
|
|
200
|
+
React.createElement(
|
|
201
|
+
index_js_1.Box,
|
|
202
|
+
{
|
|
203
|
+
as: 'div',
|
|
204
|
+
...contentProps,
|
|
205
|
+
className: (0, classnames_1.default)(
|
|
206
|
+
'iui-message',
|
|
207
|
+
contentProps?.className,
|
|
208
|
+
),
|
|
209
|
+
},
|
|
210
|
+
content,
|
|
211
|
+
),
|
|
195
212
|
link &&
|
|
196
213
|
React.createElement(
|
|
197
|
-
index_js_1.
|
|
198
|
-
{
|
|
199
|
-
as: 'button',
|
|
200
|
-
className: 'iui-toast-anchor',
|
|
201
|
-
...link,
|
|
202
|
-
title: undefined,
|
|
203
|
-
},
|
|
214
|
+
index_js_1.ButtonBase,
|
|
215
|
+
{ className: 'iui-toast-anchor', ...link, title: undefined },
|
|
204
216
|
link.title,
|
|
205
217
|
),
|
|
206
218
|
(type === 'persisting' || hasCloseButton) &&
|
|
@@ -215,6 +227,5 @@ const ToastPresentation = (props) => {
|
|
|
215
227
|
React.createElement(index_js_1.SvgCloseSmall, null),
|
|
216
228
|
),
|
|
217
229
|
);
|
|
218
|
-
};
|
|
219
|
-
exports.ToastPresentation = ToastPresentation;
|
|
230
|
+
});
|
|
220
231
|
exports.default = exports.Toast;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Placement } from '@floating-ui/react';
|
|
3
|
-
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
+
import type { PolymorphicForwardRefComponent, PortalProps } from '../utils/index.js';
|
|
4
4
|
type TooltipOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Placement of the Tooltip
|
|
@@ -11,6 +11,11 @@ type TooltipOptions = {
|
|
|
11
11
|
* Property for manual visibility control
|
|
12
12
|
*/
|
|
13
13
|
visible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback invoked every time the tooltip visibility changes as a result
|
|
16
|
+
* of internal logic. Should be used alongside `visible` prop.
|
|
17
|
+
*/
|
|
18
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
14
19
|
/**
|
|
15
20
|
* autoUpdate options that recalculates position
|
|
16
21
|
* to ensure the floating element remains anchored
|
|
@@ -42,34 +47,26 @@ type TooltipOptions = {
|
|
|
42
47
|
hide?: boolean;
|
|
43
48
|
inline?: boolean;
|
|
44
49
|
};
|
|
45
|
-
};
|
|
46
|
-
type TooltipOwnProps = {
|
|
47
|
-
/**
|
|
48
|
-
* Content of the tooltip.
|
|
49
|
-
*/
|
|
50
|
-
content: React.ReactNode;
|
|
51
|
-
/**
|
|
52
|
-
* Element to have tooltip on. Has to be a valid JSX element and needs to forward its ref.
|
|
53
|
-
* If not specified, the `reference` prop should be used instead.
|
|
54
|
-
*/
|
|
55
|
-
children?: React.ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* Element to portal tooltip to.
|
|
58
|
-
* Portals to ThemeProvider portalContainerRef by default.
|
|
59
|
-
* @default true;
|
|
60
|
-
*/
|
|
61
|
-
portal?: boolean | {
|
|
62
|
-
to: HTMLElement;
|
|
63
|
-
};
|
|
64
50
|
/**
|
|
65
51
|
* Sets reference point to user provided element.
|
|
66
52
|
* @example
|
|
67
|
-
* const
|
|
53
|
+
* const [trigger, setTrigger] = React.useState(null);
|
|
68
54
|
* ...
|
|
69
|
-
* <Button ref={
|
|
70
|
-
* <Tooltip content='tooltip text' reference={
|
|
55
|
+
* <Button ref={setTrigger} />
|
|
56
|
+
* <Tooltip content='tooltip text' reference={trigger} />
|
|
71
57
|
*/
|
|
72
|
-
reference?:
|
|
58
|
+
reference?: HTMLElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* By default, the tooltip will be associated with the reference element
|
|
61
|
+
* using `aria-describedby`.
|
|
62
|
+
*
|
|
63
|
+
* Pass "label" if you want to use `aria-labelledby` instead, or pass "none"
|
|
64
|
+
* if you don't want any association.
|
|
65
|
+
*
|
|
66
|
+
* @default 'description'
|
|
67
|
+
*/
|
|
68
|
+
ariaStrategy?: 'description' | 'label' | 'none';
|
|
69
|
+
id?: string;
|
|
73
70
|
};
|
|
74
71
|
/**
|
|
75
72
|
* Basic tooltip component to display informative content when an element is hovered or focused.
|
|
@@ -77,10 +74,20 @@ type TooltipOwnProps = {
|
|
|
77
74
|
* @example
|
|
78
75
|
* <Tooltip content='tooltip text' placement='top'>Hover here</Tooltip>
|
|
79
76
|
* @example
|
|
80
|
-
* const
|
|
77
|
+
* const [trigger, setTrigger] = React.useState(null);
|
|
81
78
|
* ...
|
|
82
|
-
* <Button ref={
|
|
83
|
-
* <Tooltip content='tooltip text' reference={
|
|
79
|
+
* <Button ref={setTrigger} />
|
|
80
|
+
* <Tooltip content='tooltip text' reference={trigger} />
|
|
84
81
|
*/
|
|
85
|
-
export declare const Tooltip: PolymorphicForwardRefComponent<"div",
|
|
82
|
+
export declare const Tooltip: PolymorphicForwardRefComponent<"div", {
|
|
83
|
+
/**
|
|
84
|
+
* Content of the tooltip.
|
|
85
|
+
*/
|
|
86
|
+
content: React.ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Element to have tooltip on. Has to be a valid JSX element and needs to forward its ref.
|
|
89
|
+
* If not specified, the `reference` prop should be used instead.
|
|
90
|
+
*/
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
} & PortalProps & TooltipOptions>;
|
|
86
93
|
export default Tooltip;
|