@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.
@@ -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
 
@@ -163,13 +163,22 @@ var init_Icon2 = __esm({
163
163
  init_IconProvider();
164
164
  }
165
165
  });
166
- var ToastContainer, IconWrapper, ContentWrapper, Message, Description, ActionGroup, SuccessIcon, InfoIcon, ErrorIcon, WarnIcon, CloseIconSvg, Toast;
166
+
167
+ // src/Toast/loading.gif
168
+ var loading_default;
169
+ var init_loading = __esm({
170
+ "src/Toast/loading.gif"() {
171
+ loading_default = "./loading-ASMP54FR.gif";
172
+ }
173
+ });
174
+ var ToastContainer, IconWrapper, ContentWrapper, Message, Description, ActionGroup, SuccessIcon, InfoIcon, ErrorIcon, WarnIcon, CloseIconSvg, LoadingIcon, Toast;
167
175
  var init_Toast = __esm({
168
176
  "src/Toast/Toast.tsx"() {
169
177
  init_styled();
170
178
  init_Icon2();
171
179
  init_Button2();
172
180
  init_context();
181
+ init_loading();
173
182
  ToastContainer = styled.div`
174
183
  display: inline-flex;
175
184
  align-items: center;
@@ -231,11 +240,21 @@ var init_Toast = __esm({
231
240
  gap: 2px;
232
241
  align-items: center;
233
242
  `;
234
- SuccessIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React3.createElement("path", { d: "M6 10L9 13L14 7", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }));
243
+ SuccessIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React3.createElement(
244
+ "path",
245
+ {
246
+ d: "M6 10L9 13L14 7",
247
+ stroke: "white",
248
+ strokeWidth: "2",
249
+ strokeLinecap: "round",
250
+ strokeLinejoin: "round"
251
+ }
252
+ ));
235
253
  InfoIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#5ba0e7" }), /* @__PURE__ */ React3.createElement("path", { d: "M10 9V14M10 6H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
236
254
  ErrorIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#e95555" }), /* @__PURE__ */ React3.createElement("path", { d: "M7 7L13 13M13 7L7 13", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
237
255
  WarnIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#ebe361" }), /* @__PURE__ */ React3.createElement("path", { d: "M10 6V11M10 14H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
238
256
  CloseIconSvg = () => /* @__PURE__ */ React3.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M9 3L3 9M3 3L9 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }));
257
+ LoadingIcon = () => /* @__PURE__ */ React3.createElement("img", { src: loading_default, alt: "Loading", width: "20", height: "20" });
239
258
  Toast = ({
240
259
  variant = "info",
241
260
  message,
@@ -282,7 +301,8 @@ var init_Toast = __esm({
282
301
  success: /* @__PURE__ */ React3.createElement(SuccessIcon, null),
283
302
  info: /* @__PURE__ */ React3.createElement(InfoIcon, null),
284
303
  error: /* @__PURE__ */ React3.createElement(ErrorIcon, null),
285
- warn: /* @__PURE__ */ React3.createElement(WarnIcon, null)
304
+ warn: /* @__PURE__ */ React3.createElement(WarnIcon, null),
305
+ loading: /* @__PURE__ */ React3.createElement(LoadingIcon, null)
286
306
  };
287
307
  return defaultIcons[variant];
288
308
  };
@@ -300,16 +320,7 @@ var init_Toast = __esm({
300
320
  },
301
321
  showIcon && /* @__PURE__ */ React3.createElement(IconWrapper, { $variant: variant, $hasDescription: hasDescription }, iconElement),
302
322
  /* @__PURE__ */ React3.createElement(ContentWrapper, { $hasDescription: hasDescription }, /* @__PURE__ */ React3.createElement(Message, null, message), description && /* @__PURE__ */ React3.createElement(Description, null, description)),
303
- hasActions && /* @__PURE__ */ React3.createElement(ActionGroup, null, mainButtonText && onMainButtonClick && /* @__PURE__ */ React3.createElement(
304
- Button,
305
- {
306
- variant: "text",
307
- colorType: "guidance",
308
- size: "small",
309
- onClick: onMainButtonClick
310
- },
311
- mainButtonText
312
- ), secondaryButtonText && onSecondaryButtonClick && /* @__PURE__ */ React3.createElement(
323
+ hasActions && /* @__PURE__ */ React3.createElement(ActionGroup, null, mainButtonText && onMainButtonClick && /* @__PURE__ */ React3.createElement(Button, { variant: "text", colorType: "guidance", size: "small", onClick: onMainButtonClick }, mainButtonText), secondaryButtonText && onSecondaryButtonClick && /* @__PURE__ */ React3.createElement(
313
324
  Button,
314
325
  {
315
326
  variant: "text",
@@ -510,6 +521,12 @@ var init_toastManager = __esm({
510
521
  warn(message, options) {
511
522
  return this.show({ ...options, variant: "warn", message });
512
523
  }
524
+ /**
525
+ * Show loading toast
526
+ */
527
+ loading(message, options) {
528
+ return this.show({ ...options, variant: "loading", message });
529
+ }
513
530
  /**
514
531
  * Destroy the toast container
515
532
  */
@@ -549,6 +566,7 @@ var init_toastManager = __esm({
549
566
  info: (message, options) => toastManager.info(message, options),
550
567
  error: (message, options) => toastManager.error(message, options),
551
568
  warn: (message, options) => toastManager.warn(message, options),
569
+ loading: (message, options) => toastManager.loading(message, options),
552
570
  destroy: () => toastManager.destroy()
553
571
  };
554
572
  }
@@ -2561,13 +2579,17 @@ var ToastContainer2 = ({
2561
2579
  const warn = useCallback((message, options) => {
2562
2580
  return showToast({ ...options, variant: "warn", message });
2563
2581
  }, [showToast]);
2582
+ const loading = useCallback((message, options) => {
2583
+ return showToast({ ...options, variant: "loading", message });
2584
+ }, [showToast]);
2564
2585
  const contextValue = {
2565
2586
  showToast,
2566
2587
  hideToast,
2567
2588
  success,
2568
2589
  info,
2569
2590
  error,
2570
- warn
2591
+ warn,
2592
+ loading
2571
2593
  };
2572
2594
  return /* @__PURE__ */ React3.createElement(ToastContext.Provider, { value: contextValue }, children, /* @__PURE__ */ React3.createElement(ToastWrapper2, { $placement: placement }, toasts.map((toast2) => /* @__PURE__ */ React3.createElement(
2573
2595
  Toast,