@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/cjs/core/Tabs/Tabs.js
CHANGED
|
@@ -115,22 +115,20 @@ const Tabs = (props) => {
|
|
|
115
115
|
React.useEffect(() => {
|
|
116
116
|
if (tablistRef.current && focusedIndex !== undefined) {
|
|
117
117
|
const tab = tablistRef.current.querySelectorAll(`.${styles_js_1.default['iui-tab']}`)[focusedIndex];
|
|
118
|
-
tab
|
|
118
|
+
tab?.focus();
|
|
119
119
|
}
|
|
120
120
|
}, [focusedIndex]);
|
|
121
121
|
const [hasSublabel, setHasSublabel] = React.useState(false); // used for setting size
|
|
122
122
|
(0, index_js_1.useIsomorphicLayoutEffect)(() => {
|
|
123
|
-
var _a;
|
|
124
123
|
setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
|
|
125
|
-
!!
|
|
124
|
+
!!tablistRef.current?.querySelector(`.${styles_js_1.default['iui-tab-description']}`));
|
|
126
125
|
}, [type]);
|
|
127
126
|
const enableHorizontalScroll = React.useCallback((e) => {
|
|
128
|
-
var _a;
|
|
129
127
|
const ownerDoc = tablistRef.current;
|
|
130
128
|
if (ownerDoc === null) {
|
|
131
129
|
return;
|
|
132
130
|
}
|
|
133
|
-
let scrollLeft =
|
|
131
|
+
let scrollLeft = ownerDoc?.scrollLeft ?? 0;
|
|
134
132
|
if (e.deltaY > 0 || e.deltaX > 0) {
|
|
135
133
|
scrollLeft += 25;
|
|
136
134
|
}
|
|
@@ -145,12 +143,12 @@ const Tabs = (props) => {
|
|
|
145
143
|
if (ownerDoc === null) {
|
|
146
144
|
return;
|
|
147
145
|
}
|
|
148
|
-
if (!
|
|
146
|
+
if (!overflowOptions?.useOverflow || orientation === 'vertical') {
|
|
149
147
|
ownerDoc.removeEventListener('wheel', enableHorizontalScroll);
|
|
150
148
|
return;
|
|
151
149
|
}
|
|
152
150
|
ownerDoc.addEventListener('wheel', enableHorizontalScroll);
|
|
153
|
-
}, [overflowOptions
|
|
151
|
+
}, [overflowOptions?.useOverflow, orientation, enableHorizontalScroll]);
|
|
154
152
|
const isTabHidden = (activeTab, isVertical) => {
|
|
155
153
|
const ownerDoc = tablistRef.current;
|
|
156
154
|
if (ownerDoc === null) {
|
|
@@ -230,7 +228,7 @@ const Tabs = (props) => {
|
|
|
230
228
|
setTimeout(() => {
|
|
231
229
|
const ownerDoc = tablistRef.current;
|
|
232
230
|
if (ownerDoc !== null &&
|
|
233
|
-
|
|
231
|
+
overflowOptions?.useOverflow &&
|
|
234
232
|
currentActiveIndex !== undefined) {
|
|
235
233
|
const activeTab = ownerDoc.querySelectorAll(`.${styles_js_1.default['iui-tab']}`)[currentActiveIndex];
|
|
236
234
|
const isVertical = orientation === 'vertical';
|
|
@@ -241,7 +239,7 @@ const Tabs = (props) => {
|
|
|
241
239
|
}
|
|
242
240
|
}, 50);
|
|
243
241
|
}, [
|
|
244
|
-
overflowOptions
|
|
242
|
+
overflowOptions?.useOverflow,
|
|
245
243
|
currentActiveIndex,
|
|
246
244
|
focusedIndex,
|
|
247
245
|
orientation,
|
|
@@ -277,19 +275,19 @@ const Tabs = (props) => {
|
|
|
277
275
|
}, [orientation, setScrollingPlacement]);
|
|
278
276
|
// apply correct mask when tabs list is resized
|
|
279
277
|
const [resizeRef] = (0, index_js_1.useResizeObserver)(determineScrollingPlacement);
|
|
280
|
-
resizeRef(tablistRef
|
|
278
|
+
resizeRef(tablistRef?.current);
|
|
281
279
|
// check if overflow tabs are scrolled to far edges
|
|
282
280
|
React.useEffect(() => {
|
|
283
281
|
const ownerDoc = tablistRef.current;
|
|
284
282
|
if (ownerDoc === null) {
|
|
285
283
|
return;
|
|
286
284
|
}
|
|
287
|
-
if (!
|
|
285
|
+
if (!overflowOptions?.useOverflow) {
|
|
288
286
|
ownerDoc.removeEventListener('scroll', determineScrollingPlacement);
|
|
289
287
|
return;
|
|
290
288
|
}
|
|
291
289
|
ownerDoc.addEventListener('scroll', determineScrollingPlacement);
|
|
292
|
-
}, [overflowOptions
|
|
290
|
+
}, [overflowOptions?.useOverflow, determineScrollingPlacement]);
|
|
293
291
|
const onTabClick = React.useCallback((index) => {
|
|
294
292
|
if (onTabSelected) {
|
|
295
293
|
onTabSelected(index);
|
|
@@ -305,7 +303,7 @@ const Tabs = (props) => {
|
|
|
305
303
|
const tab = labels[index];
|
|
306
304
|
return React.isValidElement(tab) && tab.props.disabled;
|
|
307
305
|
};
|
|
308
|
-
let newIndex = focusedIndex
|
|
306
|
+
let newIndex = focusedIndex ?? currentActiveIndex;
|
|
309
307
|
/** focus next tab if delta is +1, previous tab if -1 */
|
|
310
308
|
const focusTab = (delta = +1) => {
|
|
311
309
|
do {
|
|
@@ -368,9 +366,8 @@ const Tabs = (props) => {
|
|
|
368
366
|
'aria-selected': index === currentActiveIndex,
|
|
369
367
|
tabIndex: index === currentActiveIndex ? 0 : -1,
|
|
370
368
|
onClick: (args) => {
|
|
371
|
-
var _a, _b;
|
|
372
369
|
onClick();
|
|
373
|
-
|
|
370
|
+
label.props.onClick?.(args);
|
|
374
371
|
},
|
|
375
372
|
}))));
|
|
376
373
|
}, [currentActiveIndex, onTabClick]);
|
|
@@ -380,7 +377,7 @@ const Tabs = (props) => {
|
|
|
380
377
|
'iui-animated': type !== 'default' && isClient,
|
|
381
378
|
'iui-not-animated': type !== 'default' && !isClient,
|
|
382
379
|
'iui-large': hasSublabel,
|
|
383
|
-
}, tabsClassName), "data-iui-overflow": overflowOptions
|
|
380
|
+
}, 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))),
|
|
384
381
|
actions && (React.createElement(index_js_1.Box, { className: 'iui-tabs-actions-wrapper' },
|
|
385
382
|
React.createElement(index_js_1.Box, { className: 'iui-tabs-actions' }, actions))),
|
|
386
383
|
children && (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('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'];
|
|
@@ -35,6 +35,7 @@ const React = __importStar(require("react"));
|
|
|
35
35
|
const classnames_1 = __importDefault(require("classnames"));
|
|
36
36
|
const index_js_1 = require("../utils/index.js");
|
|
37
37
|
const ThemeContext_js_1 = require("./ThemeContext.js");
|
|
38
|
+
const Toaster_js_1 = require("../Toast/Toaster.js");
|
|
38
39
|
/**
|
|
39
40
|
* This component provides global styles and applies theme to the entire tree
|
|
40
41
|
* that it is wrapping around. The `theme` prop is optional and defaults to the
|
|
@@ -62,28 +63,28 @@ const ThemeContext_js_1 = require("./ThemeContext.js");
|
|
|
62
63
|
* </ThemeProvider>
|
|
63
64
|
*/
|
|
64
65
|
exports.ThemeProvider = React.forwardRef((props, ref) => {
|
|
65
|
-
var _a;
|
|
66
66
|
const { theme: themeProp, children, themeOptions, ...rest } = props;
|
|
67
|
-
const
|
|
68
|
-
const mergedRefs = (0, index_js_1.useMergedRefs)(rootRef, ref);
|
|
67
|
+
const portalContainerRef = React.useRef(null);
|
|
69
68
|
const parentContext = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
70
|
-
const theme = themeProp === 'inherit' ?
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const theme = themeProp === 'inherit' ? parentContext?.theme ?? 'light' : themeProp;
|
|
70
|
+
const shouldApplyBackground = themeOptions?.applyBackground ??
|
|
71
|
+
(themeProp === 'inherit' ? false : !parentContext);
|
|
72
|
+
const contextValue = React.useMemo(() => ({ theme, themeOptions, portalContainerRef }), [theme, themeOptions]);
|
|
73
|
+
return (React.createElement(ThemeContext_js_1.ThemeContext.Provider, { value: contextValue },
|
|
74
|
+
React.createElement(Root, { theme: theme, shouldApplyBackground: shouldApplyBackground, themeOptions: themeOptions, ref: ref, ...rest },
|
|
75
|
+
React.createElement(Toaster_js_1.ToastProvider, null,
|
|
76
|
+
children,
|
|
77
|
+
React.createElement("div", { ref: portalContainerRef },
|
|
78
|
+
React.createElement(Toaster_js_1.Toaster, null))))));
|
|
75
79
|
});
|
|
76
80
|
exports.default = exports.ThemeProvider;
|
|
77
81
|
const Root = React.forwardRef((props, forwardedRef) => {
|
|
78
|
-
|
|
79
|
-
const { theme, children, themeOptions, className, isInheritingTheme, ...rest } = props;
|
|
82
|
+
const { theme, children, themeOptions, shouldApplyBackground, className, ...rest } = props;
|
|
80
83
|
const ref = React.useRef(null);
|
|
81
84
|
const mergedRefs = (0, index_js_1.useMergedRefs)(ref, forwardedRef);
|
|
82
85
|
const prefersDark = (0, index_js_1.useMediaQuery)('(prefers-color-scheme: dark)');
|
|
83
86
|
const prefersHighContrast = (0, index_js_1.useMediaQuery)('(prefers-contrast: more)');
|
|
84
87
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
85
|
-
const shouldApplyHC =
|
|
86
|
-
const isThemeAlreadySet = (0, index_js_1.useIsThemeAlreadySet)((_b = ref.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
87
|
-
const shouldApplyBackground = (_c = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.applyBackground) !== null && _c !== void 0 ? _c : (isInheritingTheme ? false : !isThemeAlreadySet.current);
|
|
88
|
+
const shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
|
|
88
89
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-root', { 'iui-root-background': shouldApplyBackground }, className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: mergedRefs, ...rest }, children));
|
|
89
90
|
});
|
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -78,7 +78,7 @@ exports.Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
78
78
|
const showMenu = React.useCallback(() => setIsMenuVisible(true), []);
|
|
79
79
|
const hideMenu = React.useCallback(() => setIsMenuVisible(false), []);
|
|
80
80
|
const [localActionable, setLocalActionable] = React.useState(isActionableProp);
|
|
81
|
-
const isActionable = isActionableProp
|
|
81
|
+
const isActionable = isActionableProp ?? localActionable;
|
|
82
82
|
const tileName = (React.createElement(index_js_1.Box, { className: 'iui-tile-name' },
|
|
83
83
|
React.createElement(TitleIcon, { isLoading: isLoading, isSelected: isSelected, isNew: isNew, status: status }),
|
|
84
84
|
React.createElement(index_js_1.Box, { as: 'span', className: 'iui-tile-name-label' }, isActionable && onClick ? (React.createElement(index_js_1.LinkAction, { as: 'button', onClick: !isDisabled ? onClick : undefined, "aria-disabled": isDisabled }, name)) : (name))));
|
|
@@ -113,9 +113,8 @@ exports.Tile = Object.assign(React.forwardRef((props, forwardedRef) => {
|
|
|
113
113
|
metadata != undefined && (React.createElement(index_js_1.Box, { className: 'iui-tile-metadata' }, metadata)),
|
|
114
114
|
moreOptions && (React.createElement(index_js_2.DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: (close) => moreOptions.map((option) => React.cloneElement(option, {
|
|
115
115
|
onClick: (value) => {
|
|
116
|
-
var _a, _b;
|
|
117
116
|
close();
|
|
118
|
-
|
|
117
|
+
option.props.onClick?.(value);
|
|
119
118
|
},
|
|
120
119
|
})) },
|
|
121
120
|
React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-tile-more-options', {
|
|
@@ -108,17 +108,17 @@ const defaultCombinedRenderer = (date, precision) => {
|
|
|
108
108
|
exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
109
109
|
const { date, onChange, use12Hours = false, precision = 'minutes', hourStep = 1, minuteStep = 1, secondStep = 1, setFocusHour = false, hourRenderer = (date) => date.getHours().toLocaleString(undefined, { minimumIntegerDigits: 2 }), minuteRenderer = (date) => date.getMinutes().toLocaleString(undefined, { minimumIntegerDigits: 2 }), secondRenderer = (date) => date.getSeconds().toLocaleString(undefined, { minimumIntegerDigits: 2 }), meridiemRenderer = (meridiem) => meridiem, useCombinedRenderer = false, combinedRenderer = defaultCombinedRenderer, className, ...rest } = props;
|
|
110
110
|
const [selectedTime, setSelectedTime] = React.useState(date);
|
|
111
|
-
const [focusedTime, setFocusedTime] = React.useState(selectedTime
|
|
112
|
-
const [meridiem, setMeridiem] = React.useState(use12Hours ? (
|
|
111
|
+
const [focusedTime, setFocusedTime] = React.useState(selectedTime ?? new Date());
|
|
112
|
+
const [meridiem, setMeridiem] = React.useState(use12Hours ? (focusedTime?.getHours() > 11 ? 'PM' : 'AM') : undefined);
|
|
113
113
|
React.useEffect(() => {
|
|
114
|
-
setFocusedTime(date
|
|
114
|
+
setFocusedTime(date ?? new Date());
|
|
115
115
|
setSelectedTime(date);
|
|
116
116
|
}, [date]);
|
|
117
117
|
const onHourClick = (date) => {
|
|
118
118
|
const adjustedHour = use12Hours
|
|
119
119
|
? formatHourFrom12(date.getHours(), meridiem)
|
|
120
120
|
: date.getHours();
|
|
121
|
-
const adjustedSelectedTime = setHours(adjustedHour, selectedTime
|
|
121
|
+
const adjustedSelectedTime = setHours(adjustedHour, selectedTime ?? new Date());
|
|
122
122
|
updateCurrentTime(adjustedSelectedTime);
|
|
123
123
|
};
|
|
124
124
|
const onTimeClick = (date) => {
|
|
@@ -129,7 +129,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
129
129
|
updateCurrentTime(adjustedSelectedTime);
|
|
130
130
|
};
|
|
131
131
|
const onMeridiemClick = (value) => {
|
|
132
|
-
let adjustedSelectedTime = selectedTime
|
|
132
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
133
133
|
const currentHours = adjustedSelectedTime.getHours();
|
|
134
134
|
setMeridiem(value);
|
|
135
135
|
if (value === 'AM' && currentHours > 11) {
|
|
@@ -151,7 +151,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
151
151
|
}
|
|
152
152
|
setFocusedTime(adjustedTime);
|
|
153
153
|
setSelectedTime(adjustedTime);
|
|
154
|
-
onChange
|
|
154
|
+
onChange?.(adjustedTime);
|
|
155
155
|
};
|
|
156
156
|
const onHourFocus = (date) => {
|
|
157
157
|
const adjustedHour = use12Hours
|
|
@@ -166,7 +166,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
166
166
|
setFocusedTime(setHours(adjustedHour, date));
|
|
167
167
|
};
|
|
168
168
|
const onMeridiemFocus = (value) => {
|
|
169
|
-
let adjustedSelectedTime = selectedTime
|
|
169
|
+
let adjustedSelectedTime = selectedTime ?? new Date();
|
|
170
170
|
const currentHours = adjustedSelectedTime.getHours();
|
|
171
171
|
if (value === 'AM' && currentHours > 11) {
|
|
172
172
|
setMeridiem(value);
|
|
@@ -188,7 +188,7 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
188
188
|
return data;
|
|
189
189
|
};
|
|
190
190
|
const time = React.useMemo(() => {
|
|
191
|
-
const time = selectedTime
|
|
191
|
+
const time = selectedTime ?? new Date();
|
|
192
192
|
const data = [];
|
|
193
193
|
const hoursArray = Array.from(Array(use12Hours ? 12 : 24).keys())
|
|
194
194
|
.filter((i) => i % hourStep === 0)
|
|
@@ -215,15 +215,15 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
215
215
|
return data;
|
|
216
216
|
}, [hourStep, minuteStep, secondStep, selectedTime, use12Hours, precision]);
|
|
217
217
|
const hours = React.useMemo(() => {
|
|
218
|
-
const time = selectedTime
|
|
218
|
+
const time = selectedTime ?? new Date();
|
|
219
219
|
return generateDataList(use12Hours ? 12 : 24, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), use12Hours && i === 0 ? 12 : i, time.getMinutes(), time.getSeconds()), hourStep);
|
|
220
220
|
}, [hourStep, selectedTime, use12Hours]);
|
|
221
221
|
const minutes = React.useMemo(() => {
|
|
222
|
-
const time = selectedTime
|
|
222
|
+
const time = selectedTime ?? new Date();
|
|
223
223
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), i, time.getSeconds()), minuteStep);
|
|
224
224
|
}, [minuteStep, selectedTime]);
|
|
225
225
|
const seconds = React.useMemo(() => {
|
|
226
|
-
const time = selectedTime
|
|
226
|
+
const time = selectedTime ?? new Date();
|
|
227
227
|
return generateDataList(60, (i) => new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), time.getMinutes(), i), secondStep);
|
|
228
228
|
}, [secondStep, selectedTime]);
|
|
229
229
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-time-picker', className), ref: forwardedRef, ...rest },
|
|
@@ -244,7 +244,7 @@ const TimePickerColumn = (props) => {
|
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
246
|
const scrollIntoView = (ref, isSame) => {
|
|
247
|
-
isSame &&
|
|
247
|
+
isSame && ref?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
248
248
|
};
|
|
249
249
|
const handleTimeKeyDown = (event, maxValue, onFocus, onSelect, currentValue) => {
|
|
250
250
|
if (event.altKey) {
|
|
@@ -284,7 +284,7 @@ const TimePickerColumn = (props) => {
|
|
|
284
284
|
'iui-selected': isSameSelected(value),
|
|
285
285
|
}), key: index, tabIndex: isSameFocus ? 0 : undefined, ref: (ref) => {
|
|
286
286
|
scrollIntoView(ref, isSameFocus);
|
|
287
|
-
needFocus.current && isSameFocus &&
|
|
287
|
+
needFocus.current && isSameFocus && ref?.focus();
|
|
288
288
|
}, onClick: () => {
|
|
289
289
|
onSelectChange(value);
|
|
290
290
|
} }, 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/cjs/core/Toast/Toast.js
CHANGED
|
@@ -36,7 +36,8 @@ const react_transition_group_1 = require("react-transition-group");
|
|
|
36
36
|
const classnames_1 = __importDefault(require("classnames"));
|
|
37
37
|
const index_js_1 = require("../utils/index.js");
|
|
38
38
|
const index_js_2 = require("../Buttons/index.js");
|
|
39
|
-
const
|
|
39
|
+
const Toaster_js_1 = require("./Toaster.js");
|
|
40
|
+
const isMotionOk = () => (0, index_js_1.getWindow)()?.matchMedia?.('(prefers-reduced-motion: no-preference)')?.matches;
|
|
40
41
|
/**
|
|
41
42
|
* Generic Toast Component
|
|
42
43
|
* @example
|
|
@@ -46,9 +47,12 @@ const isMotionOk = () => { var _a, _b, _c; return (_c = (_b = (_a = (0, index_js
|
|
|
46
47
|
* <Toast type='persisting' content='Job processing error.' category='negative' />
|
|
47
48
|
*/
|
|
48
49
|
const Toast = (props) => {
|
|
49
|
-
const { content, category, type = 'temporary', isVisible, link, duration = 7000, hasCloseButton, onRemove, animateOutTo,
|
|
50
|
+
const { content, category, type = 'temporary', isVisible: isVisibleProp, link, duration = 7000, hasCloseButton, onRemove, animateOutTo, } = props;
|
|
50
51
|
const closeTimeout = React.useRef(0);
|
|
51
|
-
const
|
|
52
|
+
const { placement } = (0, index_js_1.useSafeContext)(Toaster_js_1.ToasterStateContext).settings;
|
|
53
|
+
const placementPosition = placement.startsWith('top') ? 'top' : 'bottom';
|
|
54
|
+
const [visible, setVisible] = React.useState(isVisibleProp ?? true);
|
|
55
|
+
const isVisible = isVisibleProp ?? visible;
|
|
52
56
|
const [height, setHeight] = React.useState(0);
|
|
53
57
|
const thisElement = React.useRef(null);
|
|
54
58
|
const [margin, setMargin] = React.useState(0);
|
|
@@ -67,9 +71,6 @@ const Toast = (props) => {
|
|
|
67
71
|
};
|
|
68
72
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
73
|
}, [duration, type]);
|
|
70
|
-
React.useEffect(() => {
|
|
71
|
-
setVisible(isVisible);
|
|
72
|
-
}, [isVisible]);
|
|
73
74
|
React.useEffect(() => {
|
|
74
75
|
// if we don't have animateOutTo point and not isVisible, set negative margin to move other toasts up.
|
|
75
76
|
// Close all and close on toasts with no anchor.
|
|
@@ -93,8 +94,7 @@ const Toast = (props) => {
|
|
|
93
94
|
}, timeout);
|
|
94
95
|
};
|
|
95
96
|
const clearCloseTimeout = () => {
|
|
96
|
-
|
|
97
|
-
(_a = (0, index_js_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.clearTimeout(closeTimeout.current);
|
|
97
|
+
(0, index_js_1.getWindow)()?.clearTimeout(closeTimeout.current);
|
|
98
98
|
};
|
|
99
99
|
const onRef = (ref) => {
|
|
100
100
|
if (ref) {
|
|
@@ -114,7 +114,7 @@ const Toast = (props) => {
|
|
|
114
114
|
}
|
|
115
115
|
return { translateX, translateY };
|
|
116
116
|
};
|
|
117
|
-
return (React.createElement(react_transition_group_1.Transition, { timeout: { enter: 240, exit: animateOutTo ? 400 : 120 }, in:
|
|
117
|
+
return (React.createElement(react_transition_group_1.Transition, { timeout: { enter: 240, exit: animateOutTo ? 400 : 120 }, in: isVisible, appear: true, unmountOnExit: true, onEnter: (node) => {
|
|
118
118
|
if (isMotionOk()) {
|
|
119
119
|
node.style.transform = 'translateY(15%)';
|
|
120
120
|
node.style.transitionTimingFunction = 'ease';
|
|
@@ -133,12 +133,13 @@ const Toast = (props) => {
|
|
|
133
133
|
node.style.transitionDuration = animateOutTo ? '400ms' : '120ms';
|
|
134
134
|
node.style.transitionTimingFunction = 'cubic-bezier(0.4, 0, 1, 1)';
|
|
135
135
|
}
|
|
136
|
-
}, onExited: onRemove },
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
React.createElement(
|
|
136
|
+
}, onExited: onRemove },
|
|
137
|
+
React.createElement(index_js_1.Box, { ref: thisElement, className: 'iui-toast-all', style: {
|
|
138
|
+
height,
|
|
139
|
+
...marginStyle(),
|
|
140
|
+
} },
|
|
141
|
+
React.createElement("div", { ref: onRef },
|
|
142
|
+
React.createElement(exports.ToastPresentation, { category: category, content: content, link: link, type: type, hasCloseButton: hasCloseButton, onClose: close })))));
|
|
142
143
|
};
|
|
143
144
|
exports.Toast = Toast;
|
|
144
145
|
/**
|
|
@@ -151,7 +152,7 @@ const ToastPresentation = (props) => {
|
|
|
151
152
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)(`iui-toast iui-${category}`, className), ...rest },
|
|
152
153
|
React.createElement(index_js_1.Box, { className: 'iui-status-area' }, React.createElement(StatusIcon, { className: 'iui-icon' })),
|
|
153
154
|
React.createElement(index_js_1.Box, { className: 'iui-message' }, content),
|
|
154
|
-
link && (React.createElement(index_js_1.Box, { as: '
|
|
155
|
+
link && (React.createElement(index_js_1.Box, { as: 'button', className: 'iui-toast-anchor', ...link, title: undefined }, link.title)),
|
|
155
156
|
(type === 'persisting' || hasCloseButton) && (React.createElement(index_js_2.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
156
157
|
React.createElement(index_js_1.SvgCloseSmall, null)))));
|
|
157
158
|
};
|
|
@@ -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 {};
|