@officesdk/design 0.1.18 → 0.1.19
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/dist/components/cjs/index.d.ts +3 -1
- package/dist/components/cjs/index.js +36 -14
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/cjs/loading-ASMP54FR.gif +0 -0
- package/dist/components/esm/index.d.ts +3 -1
- package/dist/components/esm/index.js +36 -14
- package/dist/components/esm/index.js.map +1 -1
- package/dist/components/esm/loading-ASMP54FR.gif +0 -0
- package/dist/theme/cjs/index.js +8 -0
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +8 -0
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -677,7 +677,7 @@ interface ToastProps {
|
|
|
677
677
|
/**
|
|
678
678
|
* Toast variant type
|
|
679
679
|
*/
|
|
680
|
-
variant?: 'success' | 'info' | 'error' | 'warn';
|
|
680
|
+
variant?: 'success' | 'info' | 'error' | 'warn' | 'loading';
|
|
681
681
|
/**
|
|
682
682
|
* Toast message content (main text)
|
|
683
683
|
*/
|
|
@@ -771,6 +771,7 @@ interface ToastContextValue {
|
|
|
771
771
|
info: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
772
772
|
error: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
773
773
|
warn: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
774
|
+
loading: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
774
775
|
}
|
|
775
776
|
interface ToastContainerProps {
|
|
776
777
|
placement?: 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
@@ -847,6 +848,7 @@ declare const toast: {
|
|
|
847
848
|
info: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
848
849
|
error: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
849
850
|
warn: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
851
|
+
loading: (message: React.ReactNode, options?: Partial<ToastProps>) => string;
|
|
850
852
|
destroy: () => void;
|
|
851
853
|
};
|
|
852
854
|
|
|
@@ -175,13 +175,22 @@ var init_Icon2 = __esm({
|
|
|
175
175
|
init_IconProvider();
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
|
|
178
|
+
|
|
179
|
+
// src/Toast/loading.gif
|
|
180
|
+
var loading_default;
|
|
181
|
+
var init_loading = __esm({
|
|
182
|
+
"src/Toast/loading.gif"() {
|
|
183
|
+
loading_default = "./loading-ASMP54FR.gif";
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
var ToastContainer, IconWrapper, ContentWrapper, Message, Description, ActionGroup, SuccessIcon, InfoIcon, ErrorIcon, WarnIcon, CloseIconSvg, LoadingIcon; exports.Toast = void 0;
|
|
179
187
|
var init_Toast = __esm({
|
|
180
188
|
"src/Toast/Toast.tsx"() {
|
|
181
189
|
init_styled();
|
|
182
190
|
init_Icon2();
|
|
183
191
|
init_Button2();
|
|
184
192
|
init_context();
|
|
193
|
+
init_loading();
|
|
185
194
|
ToastContainer = exports.styled.div`
|
|
186
195
|
display: inline-flex;
|
|
187
196
|
align-items: center;
|
|
@@ -243,11 +252,21 @@ var init_Toast = __esm({
|
|
|
243
252
|
gap: 2px;
|
|
244
253
|
align-items: center;
|
|
245
254
|
`;
|
|
246
|
-
SuccessIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React3__default.default.createElement(
|
|
255
|
+
SuccessIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React3__default.default.createElement(
|
|
256
|
+
"path",
|
|
257
|
+
{
|
|
258
|
+
d: "M6 10L9 13L14 7",
|
|
259
|
+
stroke: "white",
|
|
260
|
+
strokeWidth: "2",
|
|
261
|
+
strokeLinecap: "round",
|
|
262
|
+
strokeLinejoin: "round"
|
|
263
|
+
}
|
|
264
|
+
));
|
|
247
265
|
InfoIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#5ba0e7" }), /* @__PURE__ */ React3__default.default.createElement("path", { d: "M10 9V14M10 6H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
248
266
|
ErrorIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#e95555" }), /* @__PURE__ */ React3__default.default.createElement("path", { d: "M7 7L13 13M13 7L7 13", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
249
267
|
WarnIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#ebe361" }), /* @__PURE__ */ React3__default.default.createElement("path", { d: "M10 6V11M10 14H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
250
268
|
CloseIconSvg = () => /* @__PURE__ */ React3__default.default.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3__default.default.createElement("path", { d: "M9 3L3 9M3 3L9 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }));
|
|
269
|
+
LoadingIcon = () => /* @__PURE__ */ React3__default.default.createElement("img", { src: loading_default, alt: "Loading", width: "20", height: "20" });
|
|
251
270
|
exports.Toast = ({
|
|
252
271
|
variant = "info",
|
|
253
272
|
message,
|
|
@@ -294,7 +313,8 @@ var init_Toast = __esm({
|
|
|
294
313
|
success: /* @__PURE__ */ React3__default.default.createElement(SuccessIcon, null),
|
|
295
314
|
info: /* @__PURE__ */ React3__default.default.createElement(InfoIcon, null),
|
|
296
315
|
error: /* @__PURE__ */ React3__default.default.createElement(ErrorIcon, null),
|
|
297
|
-
warn: /* @__PURE__ */ React3__default.default.createElement(WarnIcon, null)
|
|
316
|
+
warn: /* @__PURE__ */ React3__default.default.createElement(WarnIcon, null),
|
|
317
|
+
loading: /* @__PURE__ */ React3__default.default.createElement(LoadingIcon, null)
|
|
298
318
|
};
|
|
299
319
|
return defaultIcons[variant];
|
|
300
320
|
};
|
|
@@ -312,16 +332,7 @@ var init_Toast = __esm({
|
|
|
312
332
|
},
|
|
313
333
|
showIcon && /* @__PURE__ */ React3__default.default.createElement(IconWrapper, { $variant: variant, $hasDescription: hasDescription }, iconElement),
|
|
314
334
|
/* @__PURE__ */ React3__default.default.createElement(ContentWrapper, { $hasDescription: hasDescription }, /* @__PURE__ */ React3__default.default.createElement(Message, null, message), description && /* @__PURE__ */ React3__default.default.createElement(Description, null, description)),
|
|
315
|
-
hasActions && /* @__PURE__ */ React3__default.default.createElement(ActionGroup, null, mainButtonText && onMainButtonClick && /* @__PURE__ */ React3__default.default.createElement(
|
|
316
|
-
exports.Button,
|
|
317
|
-
{
|
|
318
|
-
variant: "text",
|
|
319
|
-
colorType: "guidance",
|
|
320
|
-
size: "small",
|
|
321
|
-
onClick: onMainButtonClick
|
|
322
|
-
},
|
|
323
|
-
mainButtonText
|
|
324
|
-
), secondaryButtonText && onSecondaryButtonClick && /* @__PURE__ */ React3__default.default.createElement(
|
|
335
|
+
hasActions && /* @__PURE__ */ React3__default.default.createElement(ActionGroup, null, mainButtonText && onMainButtonClick && /* @__PURE__ */ React3__default.default.createElement(exports.Button, { variant: "text", colorType: "guidance", size: "small", onClick: onMainButtonClick }, mainButtonText), secondaryButtonText && onSecondaryButtonClick && /* @__PURE__ */ React3__default.default.createElement(
|
|
325
336
|
exports.Button,
|
|
326
337
|
{
|
|
327
338
|
variant: "text",
|
|
@@ -522,6 +533,12 @@ var init_toastManager = __esm({
|
|
|
522
533
|
warn(message, options) {
|
|
523
534
|
return this.show({ ...options, variant: "warn", message });
|
|
524
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* Show loading toast
|
|
538
|
+
*/
|
|
539
|
+
loading(message, options) {
|
|
540
|
+
return this.show({ ...options, variant: "loading", message });
|
|
541
|
+
}
|
|
525
542
|
/**
|
|
526
543
|
* Destroy the toast container
|
|
527
544
|
*/
|
|
@@ -561,6 +578,7 @@ var init_toastManager = __esm({
|
|
|
561
578
|
info: (message, options) => toastManager.info(message, options),
|
|
562
579
|
error: (message, options) => toastManager.error(message, options),
|
|
563
580
|
warn: (message, options) => toastManager.warn(message, options),
|
|
581
|
+
loading: (message, options) => toastManager.loading(message, options),
|
|
564
582
|
destroy: () => toastManager.destroy()
|
|
565
583
|
};
|
|
566
584
|
}
|
|
@@ -2573,13 +2591,17 @@ var ToastContainer2 = ({
|
|
|
2573
2591
|
const warn = React3.useCallback((message, options) => {
|
|
2574
2592
|
return showToast({ ...options, variant: "warn", message });
|
|
2575
2593
|
}, [showToast]);
|
|
2594
|
+
const loading = React3.useCallback((message, options) => {
|
|
2595
|
+
return showToast({ ...options, variant: "loading", message });
|
|
2596
|
+
}, [showToast]);
|
|
2576
2597
|
const contextValue = {
|
|
2577
2598
|
showToast,
|
|
2578
2599
|
hideToast,
|
|
2579
2600
|
success,
|
|
2580
2601
|
info,
|
|
2581
2602
|
error,
|
|
2582
|
-
warn
|
|
2603
|
+
warn,
|
|
2604
|
+
loading
|
|
2583
2605
|
};
|
|
2584
2606
|
return /* @__PURE__ */ React3__default.default.createElement(ToastContext.Provider, { value: contextValue }, children, /* @__PURE__ */ React3__default.default.createElement(ToastWrapper2, { $placement: placement }, toasts.map((toast2) => /* @__PURE__ */ React3__default.default.createElement(
|
|
2585
2607
|
exports.Toast,
|