@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
|
@@ -44,11 +44,31 @@ type RootProps = {
|
|
|
44
44
|
type ThemeProviderOwnProps = Pick<RootProps, 'theme'> & {
|
|
45
45
|
themeOptions?: RootProps['themeOptions'];
|
|
46
46
|
children: Required<React.ReactNode>;
|
|
47
|
+
/**
|
|
48
|
+
* The element used as the portal for floating elements (Tooltip, Toast, DropdownMenu, Dialog, etc).
|
|
49
|
+
*
|
|
50
|
+
* Defaults to a `<div>` rendered at the end of the ThemeProvider.
|
|
51
|
+
*
|
|
52
|
+
* When passing an element, it is recommended to use state.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const [myPortal, setMyPortal] = React.useState(null);
|
|
56
|
+
*
|
|
57
|
+
* <div ref={setMyPortal} />
|
|
58
|
+
* <ThemeProvider
|
|
59
|
+
* portalContainer={myPortal}
|
|
60
|
+
* >
|
|
61
|
+
* ...
|
|
62
|
+
* </ThemeProvider>
|
|
63
|
+
*/
|
|
64
|
+
portalContainer?: HTMLElement;
|
|
47
65
|
};
|
|
48
66
|
/**
|
|
49
|
-
* This component provides global
|
|
50
|
-
* that it is wrapping around.
|
|
51
|
-
*
|
|
67
|
+
* This component provides global state and applies theme to the entire tree
|
|
68
|
+
* that it is wrapping around.
|
|
69
|
+
*
|
|
70
|
+
* The `theme` prop defaults to "inherit", which looks upwards for closest ThemeProvider
|
|
71
|
+
* and falls back to "light" theme if one is not found.
|
|
52
72
|
*
|
|
53
73
|
* If you want to theme the entire app, you should use this component at the root. You can also
|
|
54
74
|
* use this component to apply a different theme to only a part of the tree.
|
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import * as ReactDOM from 'react-dom';
|
|
6
7
|
import cx from 'classnames';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
useMediaQuery,
|
|
10
|
+
useMergedRefs,
|
|
11
|
+
Box,
|
|
12
|
+
useIsomorphicLayoutEffect,
|
|
13
|
+
useControlledState,
|
|
14
|
+
} from '../utils/index.js';
|
|
8
15
|
import { ThemeContext } from './ThemeContext.js';
|
|
9
16
|
import { ToastProvider, Toaster } from '../Toast/Toaster.js';
|
|
10
17
|
/**
|
|
11
|
-
* This component provides global
|
|
12
|
-
* that it is wrapping around.
|
|
13
|
-
*
|
|
18
|
+
* This component provides global state and applies theme to the entire tree
|
|
19
|
+
* that it is wrapping around.
|
|
20
|
+
*
|
|
21
|
+
* The `theme` prop defaults to "inherit", which looks upwards for closest ThemeProvider
|
|
22
|
+
* and falls back to "light" theme if one is not found.
|
|
14
23
|
*
|
|
15
24
|
* If you want to theme the entire app, you should use this component at the root. You can also
|
|
16
25
|
* use this component to apply a different theme to only a part of the tree.
|
|
@@ -33,18 +42,24 @@ import { ToastProvider, Toaster } from '../Toast/Toaster.js';
|
|
|
33
42
|
* <App />
|
|
34
43
|
* </ThemeProvider>
|
|
35
44
|
*/
|
|
36
|
-
export const ThemeProvider = React.forwardRef((props,
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
export const ThemeProvider = React.forwardRef((props, forwardedRef) => {
|
|
46
|
+
const {
|
|
47
|
+
theme: themeProp = 'inherit',
|
|
48
|
+
children,
|
|
49
|
+
themeOptions,
|
|
50
|
+
portalContainer: portalContainerProp,
|
|
51
|
+
...rest
|
|
52
|
+
} = props;
|
|
53
|
+
const [portalContainer, setPortalContainer] = useControlledState(
|
|
54
|
+
null,
|
|
55
|
+
portalContainerProp,
|
|
56
|
+
);
|
|
57
|
+
const [parentTheme, rootRef] = useParentTheme();
|
|
58
|
+
const theme = themeProp === 'inherit' ? parentTheme || 'light' : themeProp;
|
|
59
|
+
const shouldApplyBackground = themeOptions?.applyBackground ?? !parentTheme;
|
|
45
60
|
const contextValue = React.useMemo(
|
|
46
|
-
() => ({ theme, themeOptions,
|
|
47
|
-
[theme, themeOptions],
|
|
61
|
+
() => ({ theme, themeOptions, portalContainer }),
|
|
62
|
+
[theme, themeOptions, portalContainer],
|
|
48
63
|
);
|
|
49
64
|
return React.createElement(
|
|
50
65
|
ThemeContext.Provider,
|
|
@@ -55,23 +70,29 @@ export const ThemeProvider = React.forwardRef((props, ref) => {
|
|
|
55
70
|
theme: theme,
|
|
56
71
|
shouldApplyBackground: shouldApplyBackground,
|
|
57
72
|
themeOptions: themeOptions,
|
|
58
|
-
ref:
|
|
73
|
+
ref: useMergedRefs(forwardedRef, rootRef),
|
|
59
74
|
...rest,
|
|
60
75
|
},
|
|
61
76
|
React.createElement(
|
|
62
77
|
ToastProvider,
|
|
63
78
|
null,
|
|
64
79
|
children,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
portalContainerProp
|
|
81
|
+
? ReactDOM.createPortal(
|
|
82
|
+
React.createElement(Toaster, null),
|
|
83
|
+
portalContainerProp,
|
|
84
|
+
)
|
|
85
|
+
: React.createElement(
|
|
86
|
+
'div',
|
|
87
|
+
{ ref: setPortalContainer },
|
|
88
|
+
React.createElement(Toaster, null),
|
|
89
|
+
),
|
|
70
90
|
),
|
|
71
91
|
),
|
|
72
92
|
);
|
|
73
93
|
});
|
|
74
94
|
export default ThemeProvider;
|
|
95
|
+
// ----------------------------------------------------------------------------
|
|
75
96
|
const Root = React.forwardRef((props, forwardedRef) => {
|
|
76
97
|
const {
|
|
77
98
|
theme,
|
|
@@ -81,8 +102,6 @@ const Root = React.forwardRef((props, forwardedRef) => {
|
|
|
81
102
|
className,
|
|
82
103
|
...rest
|
|
83
104
|
} = props;
|
|
84
|
-
const ref = React.useRef(null);
|
|
85
|
-
const mergedRefs = useMergedRefs(ref, forwardedRef);
|
|
86
105
|
const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
87
106
|
const prefersHighContrast = useMediaQuery('(prefers-contrast: more)');
|
|
88
107
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
@@ -97,9 +116,31 @@ const Root = React.forwardRef((props, forwardedRef) => {
|
|
|
97
116
|
),
|
|
98
117
|
'data-iui-theme': shouldApplyDark ? 'dark' : 'light',
|
|
99
118
|
'data-iui-contrast': shouldApplyHC ? 'high' : 'default',
|
|
100
|
-
ref:
|
|
119
|
+
ref: forwardedRef,
|
|
101
120
|
...rest,
|
|
102
121
|
},
|
|
103
122
|
children,
|
|
104
123
|
);
|
|
105
124
|
});
|
|
125
|
+
// ----------------------------------------------------------------------------
|
|
126
|
+
/**
|
|
127
|
+
* Returns theme from either parent context or by reading the closest
|
|
128
|
+
* data-iui-theme attribute if context is not found.
|
|
129
|
+
*/
|
|
130
|
+
const useParentTheme = () => {
|
|
131
|
+
const parentContext = React.useContext(ThemeContext);
|
|
132
|
+
const rootRef = React.useRef(null);
|
|
133
|
+
const [parentThemeState, setParentTheme] = React.useState(
|
|
134
|
+
parentContext?.theme,
|
|
135
|
+
);
|
|
136
|
+
useIsomorphicLayoutEffect(() => {
|
|
137
|
+
setParentTheme(
|
|
138
|
+
(old) =>
|
|
139
|
+
old ||
|
|
140
|
+
rootRef.current?.parentElement
|
|
141
|
+
?.closest('[data-iui-theme]')
|
|
142
|
+
?.getAttribute('data-iui-theme'),
|
|
143
|
+
);
|
|
144
|
+
}, []);
|
|
145
|
+
return [parentContext?.theme ?? parentThemeState, rootRef];
|
|
146
|
+
};
|
package/esm/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/esm/core/Tile/Tile.js
CHANGED
|
@@ -20,7 +20,7 @@ import { IconButton } from '../Buttons/index.js';
|
|
|
20
20
|
import { ProgressRadial } from '../ProgressIndicators/index.js';
|
|
21
21
|
const TileContext = React.createContext(undefined);
|
|
22
22
|
TileContext.displayName = 'TileContext';
|
|
23
|
-
const
|
|
23
|
+
const TileWrapper = React.forwardRef((props, forwardedRef) => {
|
|
24
24
|
const {
|
|
25
25
|
className,
|
|
26
26
|
status,
|
|
@@ -66,7 +66,7 @@ const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
|
66
66
|
}),
|
|
67
67
|
);
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
TileWrapper.displayName = 'Tile.Wrapper';
|
|
70
70
|
// ----------------------------------------------------------------------------
|
|
71
71
|
// Tile.Action component
|
|
72
72
|
const TileAction = React.forwardRef((props, forwardedRef) => {
|
|
@@ -257,10 +257,84 @@ TileMoreOptions.displayName = 'Tile.MoreOptions';
|
|
|
257
257
|
// Tile.Buttons component
|
|
258
258
|
const TileButtons = polymorphic('iui-tile-buttons');
|
|
259
259
|
TileButtons.displayName = 'Tile.Buttons';
|
|
260
|
+
const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
261
|
+
const {
|
|
262
|
+
name,
|
|
263
|
+
description,
|
|
264
|
+
status,
|
|
265
|
+
isNew,
|
|
266
|
+
isLoading,
|
|
267
|
+
isSelected,
|
|
268
|
+
thumbnail,
|
|
269
|
+
badge,
|
|
270
|
+
leftIcon,
|
|
271
|
+
rightIcon,
|
|
272
|
+
buttons,
|
|
273
|
+
metadata,
|
|
274
|
+
moreOptions,
|
|
275
|
+
children,
|
|
276
|
+
isActionable,
|
|
277
|
+
isDisabled,
|
|
278
|
+
onClick,
|
|
279
|
+
...rest
|
|
280
|
+
} = props;
|
|
281
|
+
return React.createElement(
|
|
282
|
+
TileWrapper,
|
|
283
|
+
{
|
|
284
|
+
ref: forwardedRef,
|
|
285
|
+
isNew: isNew,
|
|
286
|
+
isSelected: isSelected,
|
|
287
|
+
isLoading: isLoading,
|
|
288
|
+
status: status,
|
|
289
|
+
isDisabled: isDisabled,
|
|
290
|
+
...rest,
|
|
291
|
+
},
|
|
292
|
+
React.createElement(
|
|
293
|
+
TileName,
|
|
294
|
+
null,
|
|
295
|
+
(status || isNew || isLoading || isSelected) &&
|
|
296
|
+
React.createElement(TileNameIcon, null),
|
|
297
|
+
React.createElement(
|
|
298
|
+
TileNameLabel,
|
|
299
|
+
null,
|
|
300
|
+
isActionable
|
|
301
|
+
? React.createElement(
|
|
302
|
+
TileAction,
|
|
303
|
+
{
|
|
304
|
+
onClick: !isDisabled ? onClick : undefined,
|
|
305
|
+
'aria-disabled': isDisabled,
|
|
306
|
+
},
|
|
307
|
+
name,
|
|
308
|
+
)
|
|
309
|
+
: name,
|
|
310
|
+
),
|
|
311
|
+
),
|
|
312
|
+
React.createElement(
|
|
313
|
+
TileThumbnailArea,
|
|
314
|
+
null,
|
|
315
|
+
typeof thumbnail !== 'string'
|
|
316
|
+
? React.createElement(TileThumbnailPicture, null, thumbnail)
|
|
317
|
+
: React.createElement(TileThumbnailPicture, { url: thumbnail }),
|
|
318
|
+
badge && React.createElement(TileBadgeContainer, null, badge),
|
|
319
|
+
leftIcon && React.createElement(TileTypeIndicator, null, leftIcon),
|
|
320
|
+
rightIcon && React.createElement(TileQuickAction, null, rightIcon),
|
|
321
|
+
),
|
|
322
|
+
React.createElement(
|
|
323
|
+
TileContentArea,
|
|
324
|
+
null,
|
|
325
|
+
description && React.createElement(TileDescription, null, description),
|
|
326
|
+
moreOptions && React.createElement(TileMoreOptions, null, moreOptions),
|
|
327
|
+
metadata && React.createElement(TileMetadata, null, metadata),
|
|
328
|
+
children,
|
|
329
|
+
),
|
|
330
|
+
buttons && React.createElement(TileButtons, null, buttons),
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
TileComponent.displayName = 'Tile';
|
|
260
334
|
/**
|
|
261
335
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
262
336
|
* @example
|
|
263
|
-
* <Tile>
|
|
337
|
+
* <Tile.Wrapper>
|
|
264
338
|
* <Tile.ThumbnailArea>
|
|
265
339
|
* <Tile.ThumbnailPicture/>
|
|
266
340
|
* <Tile.Badge/>
|
|
@@ -270,23 +344,40 @@ TileButtons.displayName = 'Tile.Buttons';
|
|
|
270
344
|
* <Tile.Name>
|
|
271
345
|
* <Tile.NameIcon/>
|
|
272
346
|
* <Tile.NameLabel/>
|
|
273
|
-
*
|
|
347
|
+
* </Tile.Name>
|
|
274
348
|
* <Tile.ContentArea>
|
|
275
349
|
* <Tile.Description />
|
|
276
350
|
* <Tile.Metadata/>
|
|
277
351
|
* <Tile.MoreOptions/>
|
|
278
352
|
* </Tile.ContentArea>
|
|
279
353
|
* <Tile.Buttons/>
|
|
280
|
-
* </Tile>
|
|
354
|
+
* </Tile.Wrapper>
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* <Tile
|
|
358
|
+
* name='Tile name'
|
|
359
|
+
* description='Tile description that takes upto 3 lines'
|
|
360
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
361
|
+
* thumbnail='/url/to/image.jpg'
|
|
362
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
363
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
364
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
365
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
366
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
367
|
+
* isSelected={true}
|
|
368
|
+
* isNew={false}
|
|
369
|
+
* />
|
|
281
370
|
*/
|
|
282
371
|
export const Tile = Object.assign(TileComponent, {
|
|
372
|
+
/**
|
|
373
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
374
|
+
*/
|
|
375
|
+
Wrapper: TileWrapper,
|
|
283
376
|
/**
|
|
284
377
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
285
378
|
* @example
|
|
286
379
|
* <Tile.ThumbnailArea>
|
|
287
380
|
* <Tile.ThumbnailPicture/>
|
|
288
|
-
* // or
|
|
289
|
-
* <Tile.ThumbnailAvatar/>
|
|
290
381
|
* <Tile.QuickAction/>
|
|
291
382
|
* <Tile.TypeIndicator/>
|
|
292
383
|
* <Tile.BadgeContainer/>
|
|
@@ -296,14 +387,14 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
296
387
|
/**
|
|
297
388
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
298
389
|
* @example
|
|
299
|
-
* <Tile>
|
|
390
|
+
* <Tile.Wrapper>
|
|
300
391
|
* // ...
|
|
301
392
|
* <Tile.ThumbnailArea>
|
|
302
393
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
303
394
|
* </Tile.ThumbnailArea>
|
|
304
|
-
* </Tile>
|
|
395
|
+
* </Tile.Wrapper>
|
|
305
396
|
* or
|
|
306
|
-
* <Tile>
|
|
397
|
+
* <Tile.Wrapper>
|
|
307
398
|
* // ...
|
|
308
399
|
* <Tile.ThumbnailArea>
|
|
309
400
|
* <Tile.ThumbnailPicture>
|
|
@@ -340,21 +431,21 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
340
431
|
/**
|
|
341
432
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
342
433
|
* @example
|
|
343
|
-
* <Tile>
|
|
434
|
+
* <Tile.Wrapper>
|
|
344
435
|
* <Tile.Name>
|
|
345
436
|
* <Tile.NameIcon/>
|
|
346
437
|
* </Tile.Name>
|
|
347
|
-
*
|
|
438
|
+
* </Tile.Wrapper>
|
|
348
439
|
*/
|
|
349
440
|
NameIcon: TileNameIcon,
|
|
350
441
|
/*
|
|
351
442
|
* `NameLabel` of the tile
|
|
352
443
|
* @example
|
|
353
|
-
* <Tile>
|
|
444
|
+
* <Tile.Wrapper>
|
|
354
445
|
* <Tile.Name>
|
|
355
446
|
* <Tile.NameLabel> Tile Name <Tile.NameLabel/>
|
|
356
447
|
* </Tile.Name/>
|
|
357
|
-
*
|
|
448
|
+
* </Tile.Wrapper>
|
|
358
449
|
*/
|
|
359
450
|
NameLabel: TileNameLabel,
|
|
360
451
|
/**
|
|
@@ -371,13 +462,13 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
371
462
|
/**
|
|
372
463
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
373
464
|
* @example
|
|
374
|
-
* <Tile>
|
|
465
|
+
* <Tile.Wrapper>
|
|
375
466
|
* <Tile.ContentArea>
|
|
376
467
|
* <Tile.Description/>
|
|
377
468
|
* <Tile.Metadata/>
|
|
378
469
|
* <Tile.MoreOptions/>
|
|
379
470
|
* </Tile.ContentArea>
|
|
380
|
-
* </Tile>
|
|
471
|
+
* </Tile.Wrapper>
|
|
381
472
|
*/
|
|
382
473
|
ContentArea: TileContentArea,
|
|
383
474
|
/**
|
|
@@ -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;
|