@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.3
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 +25 -0
- package/cjs/core/Alert/Alert.d.ts +47 -28
- package/cjs/core/Alert/Alert.js +73 -21
- package/cjs/core/Avatar/Avatar.js +1 -1
- package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/cjs/core/Carousel/Carousel.d.ts +2 -2
- package/cjs/core/Carousel/Carousel.js +3 -5
- package/cjs/core/Carousel/CarouselDotsList.js +8 -10
- 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/ColorPicker/ColorBuilder.js +7 -10
- package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
- package/cjs/core/ColorPicker/ColorPalette.js +4 -6
- package/cjs/core/ColorPicker/ColorPicker.js +3 -3
- package/cjs/core/ComboBox/ComboBox.js +25 -32
- 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.js +32 -32
- package/cjs/core/Dialog/Dialog.js +11 -4
- package/cjs/core/Dialog/DialogBackdrop.js +1 -1
- package/cjs/core/Dialog/DialogContext.d.ts +11 -0
- package/cjs/core/Dialog/DialogMain.js +16 -22
- package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
- package/cjs/core/FileUpload/FileUpload.d.ts +3 -4
- package/cjs/core/FileUpload/FileUpload.js +5 -8
- package/cjs/core/FileUpload/FileUploadCard.js +9 -10
- package/cjs/core/FileUpload/FileUploadTemplate.d.ts +1 -0
- package/cjs/core/FileUpload/FileUploadTemplate.js +1 -0
- package/cjs/core/InformationPanel/InformationPanel.js +1 -4
- package/cjs/core/LabeledInput/LabeledInput.js +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/cjs/core/Menu/Menu.js +3 -4
- package/cjs/core/Menu/MenuItem.js +8 -11
- package/cjs/core/Modal/Modal.d.ts +8 -9
- package/cjs/core/Modal/Modal.js +7 -17
- package/cjs/core/SearchBox/SearchBox.js +12 -12
- package/cjs/core/Select/Select.js +12 -17
- package/cjs/core/SideNavigation/SideNavigation.js +2 -2
- package/cjs/core/Slider/Slider.js +16 -19
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/StatusMessage/StatusMessage.js +1 -1
- package/cjs/core/Stepper/Stepper.js +1 -1
- package/cjs/core/Stepper/StepperStep.js +1 -1
- package/cjs/core/Table/Table.js +15 -15
- package/cjs/core/Table/TablePaginator.js +2 -3
- package/cjs/core/Table/TableRowMemoized.js +38 -45
- 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 +1 -1
- package/cjs/core/Table/cells/EditableCell.js +6 -12
- 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/DateRangeFilter/DatePickerInput.js +2 -4
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
- 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/Tabs.js +13 -16
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +14 -13
- package/cjs/core/Tile/Tile.js +2 -3
- package/cjs/core/TimePicker/TimePicker.js +13 -13
- package/cjs/core/Toast/Toast.d.ts +5 -10
- package/cjs/core/Toast/Toast.js +17 -16
- package/cjs/core/Toast/Toaster.d.ts +24 -26
- package/cjs/core/Toast/Toaster.js +91 -121
- package/cjs/core/Toast/index.d.ts +1 -4
- package/cjs/core/Toast/index.js +3 -6
- package/cjs/core/TransferList/TransferList.js +3 -4
- package/cjs/core/Tree/Tree.js +9 -13
- package/cjs/core/Tree/TreeNode.js +9 -10
- package/cjs/core/index.d.ts +1 -2
- package/cjs/core/index.js +2 -5
- package/cjs/core/utils/color/ColorValue.js +9 -15
- package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/cjs/core/utils/components/FocusTrap.js +4 -4
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
- package/cjs/core/utils/components/Popover.d.ts +1 -1
- package/cjs/core/utils/components/Popover.js +5 -8
- package/cjs/core/utils/components/Resizer.js +7 -6
- package/cjs/core/utils/components/VirtualScroll.js +14 -21
- package/cjs/core/utils/functions/dom.d.ts +0 -8
- package/cjs/core/utils/functions/dom.js +3 -26
- package/cjs/core/utils/functions/polymorphic.d.ts +1 -1
- package/cjs/core/utils/functions/polymorphic.js +1 -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 -2
- package/cjs/core/utils/hooks/useGlobals.js +6 -4
- 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.js +1 -4
- package/esm/core/Alert/Alert.d.ts +47 -28
- package/esm/core/Alert/Alert.js +74 -22
- package/esm/core/Avatar/Avatar.js +1 -1
- package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/esm/core/Carousel/Carousel.d.ts +2 -2
- package/esm/core/Carousel/Carousel.js +3 -5
- package/esm/core/Carousel/CarouselDotsList.js +8 -10
- 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/ColorPicker/ColorBuilder.js +7 -10
- package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
- package/esm/core/ColorPicker/ColorPalette.js +4 -6
- package/esm/core/ColorPicker/ColorPicker.js +3 -3
- package/esm/core/ComboBox/ComboBox.js +25 -32
- 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.js +32 -32
- package/esm/core/Dialog/Dialog.js +12 -5
- package/esm/core/Dialog/DialogBackdrop.js +1 -1
- package/esm/core/Dialog/DialogContext.d.ts +11 -0
- package/esm/core/Dialog/DialogMain.js +16 -22
- package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
- package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/esm/core/FileUpload/FileEmptyCard.js +1 -1
- package/esm/core/FileUpload/FileUpload.d.ts +3 -4
- package/esm/core/FileUpload/FileUpload.js +5 -8
- package/esm/core/FileUpload/FileUploadCard.js +9 -10
- package/esm/core/FileUpload/FileUploadTemplate.d.ts +1 -0
- package/esm/core/FileUpload/FileUploadTemplate.js +1 -0
- package/esm/core/InformationPanel/InformationPanel.js +1 -4
- package/esm/core/LabeledInput/LabeledInput.js +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/esm/core/Menu/Menu.js +3 -4
- package/esm/core/Menu/MenuItem.js +8 -11
- package/esm/core/Modal/Modal.d.ts +8 -9
- package/esm/core/Modal/Modal.js +3 -10
- package/esm/core/SearchBox/SearchBox.js +12 -12
- package/esm/core/Select/Select.js +12 -17
- package/esm/core/SideNavigation/SideNavigation.js +2 -2
- package/esm/core/Slider/Slider.js +16 -19
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/StatusMessage/StatusMessage.js +1 -1
- package/esm/core/Stepper/Stepper.js +1 -1
- package/esm/core/Stepper/StepperStep.js +1 -1
- package/esm/core/Table/Table.js +15 -15
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/TableRowMemoized.js +38 -45
- 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 +1 -1
- package/esm/core/Table/cells/EditableCell.js +6 -12
- 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/DateRangeFilter/DatePickerInput.js +2 -4
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
- 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/Tabs.js +13 -16
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +15 -14
- package/esm/core/Tile/Tile.js +2 -3
- package/esm/core/TimePicker/TimePicker.js +13 -13
- package/esm/core/Toast/Toast.d.ts +5 -10
- package/esm/core/Toast/Toast.js +18 -17
- package/esm/core/Toast/Toaster.d.ts +24 -26
- package/esm/core/Toast/Toaster.js +85 -121
- package/esm/core/Toast/index.d.ts +1 -4
- package/esm/core/Toast/index.js +1 -3
- package/esm/core/TransferList/TransferList.js +3 -4
- package/esm/core/Tree/Tree.js +9 -13
- package/esm/core/Tree/TreeNode.js +9 -10
- package/esm/core/index.d.ts +1 -2
- package/esm/core/index.js +1 -1
- package/esm/core/utils/color/ColorValue.js +9 -15
- package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/esm/core/utils/components/FocusTrap.js +4 -4
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
- package/esm/core/utils/components/Popover.d.ts +1 -1
- package/esm/core/utils/components/Popover.js +5 -8
- package/esm/core/utils/components/Resizer.js +7 -6
- package/esm/core/utils/components/VirtualScroll.js +14 -21
- package/esm/core/utils/functions/dom.d.ts +0 -8
- package/esm/core/utils/functions/dom.js +2 -21
- package/esm/core/utils/functions/polymorphic.d.ts +1 -1
- package/esm/core/utils/functions/polymorphic.js +1 -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 -2
- package/esm/core/utils/hooks/useGlobals.js +6 -4
- 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.js +1 -4
- package/package.json +2 -2
- package/styles.css +19 -20
- package/cjs/core/Toast/ToastWrapper.d.ts +0 -10
- package/cjs/core/Toast/ToastWrapper.js +0 -49
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
- package/esm/core/Toast/ToastWrapper.d.ts +0 -10
- package/esm/core/Toast/ToastWrapper.js +0 -20
- package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
package/esm/core/Tabs/Tabs.js
CHANGED
|
@@ -86,22 +86,20 @@ export const Tabs = (props) => {
|
|
|
86
86
|
React.useEffect(() => {
|
|
87
87
|
if (tablistRef.current && focusedIndex !== undefined) {
|
|
88
88
|
const tab = tablistRef.current.querySelectorAll(`.${styles['iui-tab']}`)[focusedIndex];
|
|
89
|
-
tab
|
|
89
|
+
tab?.focus();
|
|
90
90
|
}
|
|
91
91
|
}, [focusedIndex]);
|
|
92
92
|
const [hasSublabel, setHasSublabel] = React.useState(false); // used for setting size
|
|
93
93
|
useIsomorphicLayoutEffect(() => {
|
|
94
|
-
var _a;
|
|
95
94
|
setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
|
|
96
|
-
!!
|
|
95
|
+
!!tablistRef.current?.querySelector(`.${styles['iui-tab-description']}`));
|
|
97
96
|
}, [type]);
|
|
98
97
|
const enableHorizontalScroll = React.useCallback((e) => {
|
|
99
|
-
var _a;
|
|
100
98
|
const ownerDoc = tablistRef.current;
|
|
101
99
|
if (ownerDoc === null) {
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
|
-
let scrollLeft =
|
|
102
|
+
let scrollLeft = ownerDoc?.scrollLeft ?? 0;
|
|
105
103
|
if (e.deltaY > 0 || e.deltaX > 0) {
|
|
106
104
|
scrollLeft += 25;
|
|
107
105
|
}
|
|
@@ -116,12 +114,12 @@ export const Tabs = (props) => {
|
|
|
116
114
|
if (ownerDoc === null) {
|
|
117
115
|
return;
|
|
118
116
|
}
|
|
119
|
-
if (!
|
|
117
|
+
if (!overflowOptions?.useOverflow || orientation === 'vertical') {
|
|
120
118
|
ownerDoc.removeEventListener('wheel', enableHorizontalScroll);
|
|
121
119
|
return;
|
|
122
120
|
}
|
|
123
121
|
ownerDoc.addEventListener('wheel', enableHorizontalScroll);
|
|
124
|
-
}, [overflowOptions
|
|
122
|
+
}, [overflowOptions?.useOverflow, orientation, enableHorizontalScroll]);
|
|
125
123
|
const isTabHidden = (activeTab, isVertical) => {
|
|
126
124
|
const ownerDoc = tablistRef.current;
|
|
127
125
|
if (ownerDoc === null) {
|
|
@@ -201,7 +199,7 @@ export const Tabs = (props) => {
|
|
|
201
199
|
setTimeout(() => {
|
|
202
200
|
const ownerDoc = tablistRef.current;
|
|
203
201
|
if (ownerDoc !== null &&
|
|
204
|
-
|
|
202
|
+
overflowOptions?.useOverflow &&
|
|
205
203
|
currentActiveIndex !== undefined) {
|
|
206
204
|
const activeTab = ownerDoc.querySelectorAll(`.${styles['iui-tab']}`)[currentActiveIndex];
|
|
207
205
|
const isVertical = orientation === 'vertical';
|
|
@@ -212,7 +210,7 @@ export const Tabs = (props) => {
|
|
|
212
210
|
}
|
|
213
211
|
}, 50);
|
|
214
212
|
}, [
|
|
215
|
-
overflowOptions
|
|
213
|
+
overflowOptions?.useOverflow,
|
|
216
214
|
currentActiveIndex,
|
|
217
215
|
focusedIndex,
|
|
218
216
|
orientation,
|
|
@@ -248,19 +246,19 @@ export const Tabs = (props) => {
|
|
|
248
246
|
}, [orientation, setScrollingPlacement]);
|
|
249
247
|
// apply correct mask when tabs list is resized
|
|
250
248
|
const [resizeRef] = useResizeObserver(determineScrollingPlacement);
|
|
251
|
-
resizeRef(tablistRef
|
|
249
|
+
resizeRef(tablistRef?.current);
|
|
252
250
|
// check if overflow tabs are scrolled to far edges
|
|
253
251
|
React.useEffect(() => {
|
|
254
252
|
const ownerDoc = tablistRef.current;
|
|
255
253
|
if (ownerDoc === null) {
|
|
256
254
|
return;
|
|
257
255
|
}
|
|
258
|
-
if (!
|
|
256
|
+
if (!overflowOptions?.useOverflow) {
|
|
259
257
|
ownerDoc.removeEventListener('scroll', determineScrollingPlacement);
|
|
260
258
|
return;
|
|
261
259
|
}
|
|
262
260
|
ownerDoc.addEventListener('scroll', determineScrollingPlacement);
|
|
263
|
-
}, [overflowOptions
|
|
261
|
+
}, [overflowOptions?.useOverflow, determineScrollingPlacement]);
|
|
264
262
|
const onTabClick = React.useCallback((index) => {
|
|
265
263
|
if (onTabSelected) {
|
|
266
264
|
onTabSelected(index);
|
|
@@ -276,7 +274,7 @@ export const Tabs = (props) => {
|
|
|
276
274
|
const tab = labels[index];
|
|
277
275
|
return React.isValidElement(tab) && tab.props.disabled;
|
|
278
276
|
};
|
|
279
|
-
let newIndex = focusedIndex
|
|
277
|
+
let newIndex = focusedIndex ?? currentActiveIndex;
|
|
280
278
|
/** focus next tab if delta is +1, previous tab if -1 */
|
|
281
279
|
const focusTab = (delta = +1) => {
|
|
282
280
|
do {
|
|
@@ -339,9 +337,8 @@ export const Tabs = (props) => {
|
|
|
339
337
|
'aria-selected': index === currentActiveIndex,
|
|
340
338
|
tabIndex: index === currentActiveIndex ? 0 : -1,
|
|
341
339
|
onClick: (args) => {
|
|
342
|
-
var _a, _b;
|
|
343
340
|
onClick();
|
|
344
|
-
|
|
341
|
+
label.props.onClick?.(args);
|
|
345
342
|
},
|
|
346
343
|
}))));
|
|
347
344
|
}, [currentActiveIndex, onTabClick]);
|
|
@@ -351,7 +348,7 @@ export const Tabs = (props) => {
|
|
|
351
348
|
'iui-animated': type !== 'default' && isClient,
|
|
352
349
|
'iui-not-animated': type !== 'default' && !isClient,
|
|
353
350
|
'iui-large': hasSublabel,
|
|
354
|
-
}, tabsClassName), "data-iui-overflow": overflowOptions
|
|
351
|
+
}, tabsClassName), "data-iui-overflow": overflowOptions?.useOverflow, "data-iui-scroll-placement": scrollingPlacement, role: 'tablist', ref: refs, onKeyDown: onKeyDown, ...rest }, labels.map((label, index) => createTab(label, index))),
|
|
355
352
|
actions && (React.createElement(Box, { className: 'iui-tabs-actions-wrapper' },
|
|
356
353
|
React.createElement(Box, { className: 'iui-tabs-actions' }, actions))),
|
|
357
354
|
children && (React.createElement(Box, { className: cx('iui-tabs-content', contentClassName), role: 'tabpanel' }, children))));
|
|
@@ -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>;
|
|
@@ -37,10 +37,9 @@ declare type RootProps = {
|
|
|
37
37
|
applyBackground?: boolean;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* This will be used to determine if applyBackground will default to false.
|
|
40
|
+
* This will be used to determine if background will be applied.
|
|
42
41
|
*/
|
|
43
|
-
|
|
42
|
+
shouldApplyBackground?: boolean;
|
|
44
43
|
};
|
|
45
44
|
declare type ThemeProviderOwnProps = Pick<RootProps, 'theme'> & {
|
|
46
45
|
themeOptions?: RootProps['themeOptions'];
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
|
-
import { useMediaQuery, useMergedRefs,
|
|
7
|
+
import { useMediaQuery, useMergedRefs, Box } from '../utils/index.js';
|
|
8
8
|
import { ThemeContext } from './ThemeContext.js';
|
|
9
|
+
import { ToastProvider, Toaster } from '../Toast/Toaster.js';
|
|
9
10
|
/**
|
|
10
11
|
* This component provides global styles and applies theme to the entire tree
|
|
11
12
|
* that it is wrapping around. The `theme` prop is optional and defaults to the
|
|
@@ -33,28 +34,28 @@ import { ThemeContext } from './ThemeContext.js';
|
|
|
33
34
|
* </ThemeProvider>
|
|
34
35
|
*/
|
|
35
36
|
export const ThemeProvider = React.forwardRef((props, ref) => {
|
|
36
|
-
var _a;
|
|
37
37
|
const { theme: themeProp, children, themeOptions, ...rest } = props;
|
|
38
|
-
const
|
|
39
|
-
const mergedRefs = useMergedRefs(rootRef, ref);
|
|
38
|
+
const portalContainerRef = React.useRef(null);
|
|
40
39
|
const parentContext = React.useContext(ThemeContext);
|
|
41
|
-
const theme = themeProp === 'inherit' ?
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const theme = themeProp === 'inherit' ? parentContext?.theme ?? 'light' : themeProp;
|
|
41
|
+
const shouldApplyBackground = themeOptions?.applyBackground ??
|
|
42
|
+
(themeProp === 'inherit' ? false : !parentContext);
|
|
43
|
+
const contextValue = React.useMemo(() => ({ theme, themeOptions, portalContainerRef }), [theme, themeOptions]);
|
|
44
|
+
return (React.createElement(ThemeContext.Provider, { value: contextValue },
|
|
45
|
+
React.createElement(Root, { theme: theme, shouldApplyBackground: shouldApplyBackground, themeOptions: themeOptions, ref: ref, ...rest },
|
|
46
|
+
React.createElement(ToastProvider, null,
|
|
47
|
+
children,
|
|
48
|
+
React.createElement("div", { ref: portalContainerRef },
|
|
49
|
+
React.createElement(Toaster, null))))));
|
|
46
50
|
});
|
|
47
51
|
export default ThemeProvider;
|
|
48
52
|
const Root = React.forwardRef((props, forwardedRef) => {
|
|
49
|
-
|
|
50
|
-
const { theme, children, themeOptions, className, isInheritingTheme, ...rest } = props;
|
|
53
|
+
const { theme, children, themeOptions, shouldApplyBackground, className, ...rest } = props;
|
|
51
54
|
const ref = React.useRef(null);
|
|
52
55
|
const mergedRefs = useMergedRefs(ref, forwardedRef);
|
|
53
56
|
const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
54
57
|
const prefersHighContrast = useMediaQuery('(prefers-contrast: more)');
|
|
55
58
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
56
|
-
const shouldApplyHC =
|
|
57
|
-
const isThemeAlreadySet = useIsThemeAlreadySet((_b = ref.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
58
|
-
const shouldApplyBackground = (_c = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.applyBackground) !== null && _c !== void 0 ? _c : (isInheritingTheme ? false : !isThemeAlreadySet.current);
|
|
59
|
+
const shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
|
|
59
60
|
return (React.createElement(Box, { className: cx('iui-root', { 'iui-root-background': shouldApplyBackground }, className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: mergedRefs, ...rest }, children));
|
|
60
61
|
});
|
package/esm/core/Tile/Tile.js
CHANGED
|
@@ -49,7 +49,7 @@ export const Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
49
49
|
const showMenu = React.useCallback(() => setIsMenuVisible(true), []);
|
|
50
50
|
const hideMenu = React.useCallback(() => setIsMenuVisible(false), []);
|
|
51
51
|
const [localActionable, setLocalActionable] = React.useState(isActionableProp);
|
|
52
|
-
const isActionable = isActionableProp
|
|
52
|
+
const isActionable = isActionableProp ?? localActionable;
|
|
53
53
|
const tileName = (React.createElement(Box, { className: 'iui-tile-name' },
|
|
54
54
|
React.createElement(TitleIcon, { isLoading: isLoading, isSelected: isSelected, isNew: isNew, status: status }),
|
|
55
55
|
React.createElement(Box, { as: 'span', className: 'iui-tile-name-label' }, isActionable && onClick ? (React.createElement(LinkAction, { as: 'button', onClick: !isDisabled ? onClick : undefined, "aria-disabled": isDisabled }, name)) : (name))));
|
|
@@ -84,9 +84,8 @@ export const Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
84
84
|
metadata != undefined && (React.createElement(Box, { className: 'iui-tile-metadata' }, metadata)),
|
|
85
85
|
moreOptions && (React.createElement(DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: (close) => moreOptions.map((option) => React.cloneElement(option, {
|
|
86
86
|
onClick: (value) => {
|
|
87
|
-
var _a, _b;
|
|
88
87
|
close();
|
|
89
|
-
|
|
88
|
+
option.props.onClick?.(value);
|
|
90
89
|
},
|
|
91
90
|
})) },
|
|
92
91
|
React.createElement(Box, { className: cx('iui-tile-more-options', {
|
|
@@ -79,17 +79,17 @@ const defaultCombinedRenderer = (date, precision) => {
|
|
|
79
79
|
export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
80
80
|
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;
|
|
81
81
|
const [selectedTime, setSelectedTime] = React.useState(date);
|
|
82
|
-
const [focusedTime, setFocusedTime] = React.useState(selectedTime
|
|
83
|
-
const [meridiem, setMeridiem] = React.useState(use12Hours ? (
|
|
82
|
+
const [focusedTime, setFocusedTime] = React.useState(selectedTime ?? new Date());
|
|
83
|
+
const [meridiem, setMeridiem] = React.useState(use12Hours ? (focusedTime?.getHours() > 11 ? 'PM' : 'AM') : undefined);
|
|
84
84
|
React.useEffect(() => {
|
|
85
|
-
setFocusedTime(date
|
|
85
|
+
setFocusedTime(date ?? new Date());
|
|
86
86
|
setSelectedTime(date);
|
|
87
87
|
}, [date]);
|
|
88
88
|
const onHourClick = (date) => {
|
|
89
89
|
const adjustedHour = use12Hours
|
|
90
90
|
? formatHourFrom12(date.getHours(), meridiem)
|
|
91
91
|
: date.getHours();
|
|
92
|
-
const adjustedSelectedTime = setHours(adjustedHour, selectedTime
|
|
92
|
+
const adjustedSelectedTime = setHours(adjustedHour, selectedTime ?? new Date());
|
|
93
93
|
updateCurrentTime(adjustedSelectedTime);
|
|
94
94
|
};
|
|
95
95
|
const onTimeClick = (date) => {
|
|
@@ -100,7 +100,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
100
100
|
updateCurrentTime(adjustedSelectedTime);
|
|
101
101
|
};
|
|
102
102
|
const onMeridiemClick = (value) => {
|
|
103
|
-
let adjustedSelectedTime = selectedTime
|
|
103
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
104
104
|
const currentHours = adjustedSelectedTime.getHours();
|
|
105
105
|
setMeridiem(value);
|
|
106
106
|
if (value === 'AM' && currentHours > 11) {
|
|
@@ -122,7 +122,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
122
122
|
}
|
|
123
123
|
setFocusedTime(adjustedTime);
|
|
124
124
|
setSelectedTime(adjustedTime);
|
|
125
|
-
onChange
|
|
125
|
+
onChange?.(adjustedTime);
|
|
126
126
|
};
|
|
127
127
|
const onHourFocus = (date) => {
|
|
128
128
|
const adjustedHour = use12Hours
|
|
@@ -137,7 +137,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
137
137
|
setFocusedTime(setHours(adjustedHour, date));
|
|
138
138
|
};
|
|
139
139
|
const onMeridiemFocus = (value) => {
|
|
140
|
-
let adjustedSelectedTime = selectedTime
|
|
140
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
141
141
|
const currentHours = adjustedSelectedTime.getHours();
|
|
142
142
|
if (value === 'AM' && currentHours > 11) {
|
|
143
143
|
setMeridiem(value);
|
|
@@ -159,7 +159,7 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
159
159
|
return data;
|
|
160
160
|
};
|
|
161
161
|
const time = React.useMemo(() => {
|
|
162
|
-
const time = selectedTime
|
|
162
|
+
const time = selectedTime ?? new Date();
|
|
163
163
|
const data = [];
|
|
164
164
|
const hoursArray = Array.from(Array(use12Hours ? 12 : 24).keys())
|
|
165
165
|
.filter((i) => i % hourStep === 0)
|
|
@@ -186,15 +186,15 @@ export const TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
186
186
|
return data;
|
|
187
187
|
}, [hourStep, minuteStep, secondStep, selectedTime, use12Hours, precision]);
|
|
188
188
|
const hours = React.useMemo(() => {
|
|
189
|
-
const time = selectedTime
|
|
189
|
+
const time = selectedTime ?? new Date();
|
|
190
190
|
return generateDataList(use12Hours ? 12 : 24, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), use12Hours && i === 0 ? 12 : i, time.getMinutes(), time.getSeconds()), hourStep);
|
|
191
191
|
}, [hourStep, selectedTime, use12Hours]);
|
|
192
192
|
const minutes = React.useMemo(() => {
|
|
193
|
-
const time = selectedTime
|
|
193
|
+
const time = selectedTime ?? new Date();
|
|
194
194
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), i, time.getSeconds()), minuteStep);
|
|
195
195
|
}, [minuteStep, selectedTime]);
|
|
196
196
|
const seconds = React.useMemo(() => {
|
|
197
|
-
const time = selectedTime
|
|
197
|
+
const time = selectedTime ?? new Date();
|
|
198
198
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), time.getMinutes(), i), secondStep);
|
|
199
199
|
}, [secondStep, selectedTime]);
|
|
200
200
|
return (React.createElement(Box, { className: cx('iui-time-picker', className), ref: forwardedRef, ...rest },
|
|
@@ -215,7 +215,7 @@ const TimePickerColumn = (props) => {
|
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
const scrollIntoView = (ref, isSame) => {
|
|
218
|
-
isSame &&
|
|
218
|
+
isSame && ref?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
219
219
|
};
|
|
220
220
|
const handleTimeKeyDown = (event, maxValue, onFocus, onSelect, currentValue) => {
|
|
221
221
|
if (event.altKey) {
|
|
@@ -255,7 +255,7 @@ const TimePickerColumn = (props) => {
|
|
|
255
255
|
'iui-selected': isSameSelected(value),
|
|
256
256
|
}), key: index, tabIndex: isSameFocus ? 0 : undefined, ref: (ref) => {
|
|
257
257
|
scrollIntoView(ref, isSameFocus);
|
|
258
|
-
needFocus.current && isSameFocus &&
|
|
258
|
+
needFocus.current && isSameFocus && ref?.focus();
|
|
259
259
|
}, onClick: () => {
|
|
260
260
|
onSelectChange(value);
|
|
261
261
|
} }, valueRenderer(value, precision)));
|
|
@@ -22,10 +22,9 @@ export declare type ToastProps = {
|
|
|
22
22
|
*/
|
|
23
23
|
type?: 'persisting' | 'temporary';
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* When false, will close the Toast and call onRemove when finished closing.
|
|
25
|
+
* Controlled boolean prop indicating whether the toast is visible.
|
|
27
26
|
*/
|
|
28
|
-
isVisible
|
|
27
|
+
isVisible?: boolean;
|
|
29
28
|
/**
|
|
30
29
|
* Duration of the toast in millisecond.
|
|
31
30
|
* @default 7000
|
|
@@ -37,12 +36,12 @@ export declare type ToastProps = {
|
|
|
37
36
|
*/
|
|
38
37
|
hasCloseButton?: boolean;
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
39
|
+
* Props for a button/link that can be used to perform an action
|
|
40
|
+
* (e.g. to show additional information).
|
|
41
41
|
*/
|
|
42
42
|
link?: {
|
|
43
|
-
onClick: () => void;
|
|
44
43
|
title: string;
|
|
45
|
-
}
|
|
44
|
+
} & Omit<React.ComponentPropsWithoutRef<'button'>, 'children'>;
|
|
46
45
|
/**
|
|
47
46
|
* Function called when the toast is all the way closed.
|
|
48
47
|
*/
|
|
@@ -51,10 +50,6 @@ export declare type ToastProps = {
|
|
|
51
50
|
* Element to which the toast will animate out to.
|
|
52
51
|
*/
|
|
53
52
|
animateOutTo?: HTMLElement | null;
|
|
54
|
-
/**
|
|
55
|
-
* Parent toaster placement position for smoother animation.
|
|
56
|
-
*/
|
|
57
|
-
placementPosition?: 'top' | 'bottom';
|
|
58
53
|
};
|
|
59
54
|
/**
|
|
60
55
|
* Generic Toast Component
|
package/esm/core/Toast/Toast.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Transition } from 'react-transition-group';
|
|
7
7
|
import cx from 'classnames';
|
|
8
|
-
import { getWindow, StatusIconMap, SvgCloseSmall, Box, } from '../utils/index.js';
|
|
8
|
+
import { getWindow, StatusIconMap, SvgCloseSmall, Box, useSafeContext, } from '../utils/index.js';
|
|
9
9
|
import { IconButton } from '../Buttons/index.js';
|
|
10
|
-
|
|
10
|
+
import { ToasterStateContext } from './Toaster.js';
|
|
11
|
+
const isMotionOk = () => getWindow()?.matchMedia?.('(prefers-reduced-motion: no-preference)')?.matches;
|
|
11
12
|
/**
|
|
12
13
|
* Generic Toast Component
|
|
13
14
|
* @example
|
|
@@ -17,9 +18,12 @@ const isMotionOk = () => { var _a, _b, _c; return (_c = (_b = (_a = getWindow())
|
|
|
17
18
|
* <Toast type='persisting' content='Job processing error.' category='negative' />
|
|
18
19
|
*/
|
|
19
20
|
export const Toast = (props) => {
|
|
20
|
-
const { content, category, type = 'temporary', isVisible, link, duration = 7000, hasCloseButton, onRemove, animateOutTo,
|
|
21
|
+
const { content, category, type = 'temporary', isVisible: isVisibleProp, link, duration = 7000, hasCloseButton, onRemove, animateOutTo, } = props;
|
|
21
22
|
const closeTimeout = React.useRef(0);
|
|
22
|
-
const
|
|
23
|
+
const { placement } = useSafeContext(ToasterStateContext).settings;
|
|
24
|
+
const placementPosition = placement.startsWith('top') ? 'top' : 'bottom';
|
|
25
|
+
const [visible, setVisible] = React.useState(isVisibleProp ?? true);
|
|
26
|
+
const isVisible = isVisibleProp ?? visible;
|
|
23
27
|
const [height, setHeight] = React.useState(0);
|
|
24
28
|
const thisElement = React.useRef(null);
|
|
25
29
|
const [margin, setMargin] = React.useState(0);
|
|
@@ -38,9 +42,6 @@ export const Toast = (props) => {
|
|
|
38
42
|
};
|
|
39
43
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
44
|
}, [duration, type]);
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
setVisible(isVisible);
|
|
43
|
-
}, [isVisible]);
|
|
44
45
|
React.useEffect(() => {
|
|
45
46
|
// if we don't have animateOutTo point and not isVisible, set negative margin to move other toasts up.
|
|
46
47
|
// Close all and close on toasts with no anchor.
|
|
@@ -64,8 +65,7 @@ export const Toast = (props) => {
|
|
|
64
65
|
}, timeout);
|
|
65
66
|
};
|
|
66
67
|
const clearCloseTimeout = () => {
|
|
67
|
-
|
|
68
|
-
(_a = getWindow()) === null || _a === void 0 ? void 0 : _a.clearTimeout(closeTimeout.current);
|
|
68
|
+
getWindow()?.clearTimeout(closeTimeout.current);
|
|
69
69
|
};
|
|
70
70
|
const onRef = (ref) => {
|
|
71
71
|
if (ref) {
|
|
@@ -85,7 +85,7 @@ export const Toast = (props) => {
|
|
|
85
85
|
}
|
|
86
86
|
return { translateX, translateY };
|
|
87
87
|
};
|
|
88
|
-
return (React.createElement(Transition, { timeout: { enter: 240, exit: animateOutTo ? 400 : 120 }, in:
|
|
88
|
+
return (React.createElement(Transition, { timeout: { enter: 240, exit: animateOutTo ? 400 : 120 }, in: isVisible, appear: true, unmountOnExit: true, onEnter: (node) => {
|
|
89
89
|
if (isMotionOk()) {
|
|
90
90
|
node.style.transform = 'translateY(15%)';
|
|
91
91
|
node.style.transitionTimingFunction = 'ease';
|
|
@@ -104,12 +104,13 @@ export const Toast = (props) => {
|
|
|
104
104
|
node.style.transitionDuration = animateOutTo ? '400ms' : '120ms';
|
|
105
105
|
node.style.transitionTimingFunction = 'cubic-bezier(0.4, 0, 1, 1)';
|
|
106
106
|
}
|
|
107
|
-
}, onExited: onRemove },
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
React.createElement(
|
|
107
|
+
}, onExited: onRemove },
|
|
108
|
+
React.createElement(Box, { ref: thisElement, className: 'iui-toast-all', style: {
|
|
109
|
+
height,
|
|
110
|
+
...marginStyle(),
|
|
111
|
+
} },
|
|
112
|
+
React.createElement("div", { ref: onRef },
|
|
113
|
+
React.createElement(ToastPresentation, { category: category, content: content, link: link, type: type, hasCloseButton: hasCloseButton, onClose: close })))));
|
|
113
114
|
};
|
|
114
115
|
/**
|
|
115
116
|
* The presentational part of a toast, without any animation or logic.
|
|
@@ -121,7 +122,7 @@ export const ToastPresentation = (props) => {
|
|
|
121
122
|
return (React.createElement(Box, { className: cx(`iui-toast iui-${category}`, className), ...rest },
|
|
122
123
|
React.createElement(Box, { className: 'iui-status-area' }, React.createElement(StatusIcon, { className: 'iui-icon' })),
|
|
123
124
|
React.createElement(Box, { className: 'iui-message' }, content),
|
|
124
|
-
link && (React.createElement(Box, { as: '
|
|
125
|
+
link && (React.createElement(Box, { as: 'button', className: 'iui-toast-anchor', ...link, title: undefined }, link.title)),
|
|
125
126
|
(type === 'persisting' || hasCloseButton) && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
126
127
|
React.createElement(SvgCloseSmall, null)))));
|
|
127
128
|
};
|
|
@@ -4,45 +4,43 @@ export declare type ToasterSettings = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Order of toasts.
|
|
6
6
|
* When set to 'descending', most recent toasts are on top. When set to 'ascending', most recent toasts are on bottom.
|
|
7
|
-
|
|
8
|
-
* When `placement` is set to a top value,
|
|
7
|
+
*
|
|
8
|
+
* When set to `auto`, it will behave like 'descending' when `placement` is set to a top value, otherwise 'ascending'.
|
|
9
|
+
*
|
|
10
|
+
* @default 'auto'
|
|
9
11
|
*/
|
|
10
|
-
order
|
|
12
|
+
order: 'descending' | 'ascending' | 'auto';
|
|
11
13
|
/**
|
|
12
14
|
* Placement of toasts.
|
|
13
15
|
* Changes placement of toasts. Start indicates left side of viewport. End - right side of viewport.
|
|
14
16
|
* @default 'top'
|
|
15
17
|
*/
|
|
16
|
-
placement
|
|
18
|
+
placement: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
17
19
|
};
|
|
18
20
|
export declare type ToastOptions = Omit<ToastProps, 'category' | 'isVisible' | 'id' | 'content'>;
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
private lastId;
|
|
22
|
-
private settings;
|
|
23
|
-
private toastsRef;
|
|
24
|
-
private isInitialized;
|
|
25
|
-
private asyncInit;
|
|
26
|
-
/**
|
|
27
|
-
* Set global Toaster settings for toasts order and placement.
|
|
28
|
-
* Settings will be applied to new toasts on the page.
|
|
29
|
-
*/
|
|
30
|
-
setSettings(newSettings: ToasterSettings): void;
|
|
31
|
-
positive(content: React.ReactNode, options?: ToastOptions): {
|
|
21
|
+
export declare const useToaster: () => {
|
|
22
|
+
positive: (content: React.ReactNode, options?: ToastOptions) => {
|
|
32
23
|
close: () => void;
|
|
33
24
|
};
|
|
34
|
-
informational(content: React.ReactNode, options?: ToastOptions)
|
|
25
|
+
informational: (content: React.ReactNode, options?: ToastOptions) => {
|
|
35
26
|
close: () => void;
|
|
36
27
|
};
|
|
37
|
-
negative(content: React.ReactNode, options?: ToastOptions)
|
|
28
|
+
negative: (content: React.ReactNode, options?: ToastOptions) => {
|
|
38
29
|
close: () => void;
|
|
39
30
|
};
|
|
40
|
-
warning(content: React.ReactNode, options?: ToastOptions)
|
|
31
|
+
warning: (content: React.ReactNode, options?: ToastOptions) => {
|
|
41
32
|
close: () => void;
|
|
42
33
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
closeAll: () => void;
|
|
35
|
+
setSettings: (settings: Partial<ToasterSettings>) => void;
|
|
36
|
+
};
|
|
37
|
+
export declare const Toaster: () => JSX.Element;
|
|
38
|
+
export declare const ToastProvider: ({ children }: {
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
}) => JSX.Element;
|
|
41
|
+
export declare const ToasterStateContext: React.Context<ToasterState | undefined>;
|
|
42
|
+
declare type ToasterState = {
|
|
43
|
+
toasts: ToastProps[];
|
|
44
|
+
settings: ToasterSettings;
|
|
45
|
+
};
|
|
46
|
+
export {};
|