@itwin/itwinui-react 2.3.0 → 2.3.1-dev.0
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.
|
@@ -27,22 +27,22 @@ export default class Toaster {
|
|
|
27
27
|
* Set global Toaster settings for toasts order and placement.
|
|
28
28
|
* Settings will be applied to new toasts on the page.
|
|
29
29
|
*/
|
|
30
|
-
setSettings(newSettings: ToasterSettings): void
|
|
30
|
+
setSettings(newSettings: ToasterSettings): Promise<void>;
|
|
31
31
|
positive(content: React.ReactNode, options?: ToastOptions): {
|
|
32
|
-
close: () => void
|
|
32
|
+
close: () => Promise<void>;
|
|
33
33
|
};
|
|
34
34
|
informational(content: React.ReactNode, options?: ToastOptions): {
|
|
35
|
-
close: () => void
|
|
35
|
+
close: () => Promise<void>;
|
|
36
36
|
};
|
|
37
37
|
negative(content: React.ReactNode, options?: ToastOptions): {
|
|
38
|
-
close: () => void
|
|
38
|
+
close: () => Promise<void>;
|
|
39
39
|
};
|
|
40
40
|
warning(content: React.ReactNode, options?: ToastOptions): {
|
|
41
|
-
close: () => void
|
|
41
|
+
close: () => Promise<void>;
|
|
42
42
|
};
|
|
43
43
|
private createToast;
|
|
44
44
|
private removeToast;
|
|
45
45
|
private updateView;
|
|
46
46
|
private closeToast;
|
|
47
|
-
closeAll(): void
|
|
47
|
+
closeAll(): Promise<void>;
|
|
48
48
|
}
|
|
@@ -83,14 +83,14 @@ class Toaster {
|
|
|
83
83
|
* Set global Toaster settings for toasts order and placement.
|
|
84
84
|
* Settings will be applied to new toasts on the page.
|
|
85
85
|
*/
|
|
86
|
-
setSettings(newSettings) {
|
|
86
|
+
async setSettings(newSettings) {
|
|
87
87
|
var _a, _b, _c;
|
|
88
88
|
(_a = newSettings.placement) !== null && _a !== void 0 ? _a : (newSettings.placement = this.settings.placement);
|
|
89
89
|
(_b = newSettings.order) !== null && _b !== void 0 ? _b : (newSettings.order = ((_c = newSettings.placement) === null || _c === void 0 ? void 0 : _c.startsWith('bottom'))
|
|
90
90
|
? 'ascending'
|
|
91
91
|
: 'descending');
|
|
92
92
|
this.settings = newSettings;
|
|
93
|
-
this.asyncInit().then(() => {
|
|
93
|
+
await this.asyncInit().then(() => {
|
|
94
94
|
var _a, _b;
|
|
95
95
|
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setPlacement((_b = this.settings.placement) !== null && _b !== void 0 ? _b : 'top');
|
|
96
96
|
});
|
|
@@ -126,36 +126,37 @@ class Toaster {
|
|
|
126
126
|
},
|
|
127
127
|
...(this.settings.order === 'descending' ? this.toasts : []),
|
|
128
128
|
];
|
|
129
|
+
// cannot `await` this, for backwards compat with the return value
|
|
129
130
|
this.updateView();
|
|
130
131
|
return { close: () => this.closeToast(currentId) };
|
|
131
132
|
}
|
|
132
|
-
removeToast(id) {
|
|
133
|
+
async removeToast(id) {
|
|
133
134
|
this.toasts = this.toasts.filter((toast) => toast.id !== id);
|
|
134
135
|
this.updateView();
|
|
135
136
|
}
|
|
136
|
-
updateView() {
|
|
137
|
-
this.asyncInit().then(() => {
|
|
137
|
+
async updateView() {
|
|
138
|
+
await this.asyncInit().then(() => {
|
|
138
139
|
var _a;
|
|
139
140
|
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setToasts(this.toasts);
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
|
-
closeToast(toastId) {
|
|
143
|
+
async closeToast(toastId) {
|
|
143
144
|
this.toasts = this.toasts.map((toast) => {
|
|
144
145
|
return {
|
|
145
146
|
...toast,
|
|
146
147
|
isVisible: toast.id !== toastId,
|
|
147
148
|
};
|
|
148
149
|
});
|
|
149
|
-
this.updateView();
|
|
150
|
+
await this.updateView();
|
|
150
151
|
}
|
|
151
|
-
closeAll() {
|
|
152
|
+
async closeAll() {
|
|
152
153
|
this.toasts = this.toasts.map((toast) => {
|
|
153
154
|
return {
|
|
154
155
|
...toast,
|
|
155
156
|
isVisible: false,
|
|
156
157
|
};
|
|
157
158
|
});
|
|
158
|
-
this.updateView();
|
|
159
|
+
await this.updateView();
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
exports.default = Toaster;
|
|
@@ -27,22 +27,22 @@ export default class Toaster {
|
|
|
27
27
|
* Set global Toaster settings for toasts order and placement.
|
|
28
28
|
* Settings will be applied to new toasts on the page.
|
|
29
29
|
*/
|
|
30
|
-
setSettings(newSettings: ToasterSettings): void
|
|
30
|
+
setSettings(newSettings: ToasterSettings): Promise<void>;
|
|
31
31
|
positive(content: React.ReactNode, options?: ToastOptions): {
|
|
32
|
-
close: () => void
|
|
32
|
+
close: () => Promise<void>;
|
|
33
33
|
};
|
|
34
34
|
informational(content: React.ReactNode, options?: ToastOptions): {
|
|
35
|
-
close: () => void
|
|
35
|
+
close: () => Promise<void>;
|
|
36
36
|
};
|
|
37
37
|
negative(content: React.ReactNode, options?: ToastOptions): {
|
|
38
|
-
close: () => void
|
|
38
|
+
close: () => Promise<void>;
|
|
39
39
|
};
|
|
40
40
|
warning(content: React.ReactNode, options?: ToastOptions): {
|
|
41
|
-
close: () => void
|
|
41
|
+
close: () => Promise<void>;
|
|
42
42
|
};
|
|
43
43
|
private createToast;
|
|
44
44
|
private removeToast;
|
|
45
45
|
private updateView;
|
|
46
46
|
private closeToast;
|
|
47
|
-
closeAll(): void
|
|
47
|
+
closeAll(): Promise<void>;
|
|
48
48
|
}
|
|
@@ -55,14 +55,14 @@ export default class Toaster {
|
|
|
55
55
|
* Set global Toaster settings for toasts order and placement.
|
|
56
56
|
* Settings will be applied to new toasts on the page.
|
|
57
57
|
*/
|
|
58
|
-
setSettings(newSettings) {
|
|
58
|
+
async setSettings(newSettings) {
|
|
59
59
|
var _a, _b, _c;
|
|
60
60
|
(_a = newSettings.placement) !== null && _a !== void 0 ? _a : (newSettings.placement = this.settings.placement);
|
|
61
61
|
(_b = newSettings.order) !== null && _b !== void 0 ? _b : (newSettings.order = ((_c = newSettings.placement) === null || _c === void 0 ? void 0 : _c.startsWith('bottom'))
|
|
62
62
|
? 'ascending'
|
|
63
63
|
: 'descending');
|
|
64
64
|
this.settings = newSettings;
|
|
65
|
-
this.asyncInit().then(() => {
|
|
65
|
+
await this.asyncInit().then(() => {
|
|
66
66
|
var _a, _b;
|
|
67
67
|
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setPlacement((_b = this.settings.placement) !== null && _b !== void 0 ? _b : 'top');
|
|
68
68
|
});
|
|
@@ -98,35 +98,36 @@ export default class Toaster {
|
|
|
98
98
|
},
|
|
99
99
|
...(this.settings.order === 'descending' ? this.toasts : []),
|
|
100
100
|
];
|
|
101
|
+
// cannot `await` this, for backwards compat with the return value
|
|
101
102
|
this.updateView();
|
|
102
103
|
return { close: () => this.closeToast(currentId) };
|
|
103
104
|
}
|
|
104
|
-
removeToast(id) {
|
|
105
|
+
async removeToast(id) {
|
|
105
106
|
this.toasts = this.toasts.filter((toast) => toast.id !== id);
|
|
106
107
|
this.updateView();
|
|
107
108
|
}
|
|
108
|
-
updateView() {
|
|
109
|
-
this.asyncInit().then(() => {
|
|
109
|
+
async updateView() {
|
|
110
|
+
await this.asyncInit().then(() => {
|
|
110
111
|
var _a;
|
|
111
112
|
(_a = this.toastsRef.current) === null || _a === void 0 ? void 0 : _a.setToasts(this.toasts);
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
closeToast(toastId) {
|
|
115
|
+
async closeToast(toastId) {
|
|
115
116
|
this.toasts = this.toasts.map((toast) => {
|
|
116
117
|
return {
|
|
117
118
|
...toast,
|
|
118
119
|
isVisible: toast.id !== toastId,
|
|
119
120
|
};
|
|
120
121
|
});
|
|
121
|
-
this.updateView();
|
|
122
|
+
await this.updateView();
|
|
122
123
|
}
|
|
123
|
-
closeAll() {
|
|
124
|
+
async closeAll() {
|
|
124
125
|
this.toasts = this.toasts.map((toast) => {
|
|
125
126
|
return {
|
|
126
127
|
...toast,
|
|
127
128
|
isVisible: false,
|
|
128
129
|
};
|
|
129
130
|
});
|
|
130
|
-
this.updateView();
|
|
131
|
+
await this.updateView();
|
|
131
132
|
}
|
|
132
133
|
}
|