@officesdk/design 0.1.18 → 0.1.20

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.
@@ -673,11 +673,11 @@ declare const IconProvider: React.FC<IconProviderProps>;
673
673
  */
674
674
  declare const useIconRegistry: () => IconRegistry | null;
675
675
 
676
- interface ToastProps {
676
+ interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'children' | 'onClick'> {
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,
@@ -250,7 +269,8 @@ var init_Toast = __esm({
250
269
  icon,
251
270
  showIcon = true,
252
271
  className,
253
- style
272
+ style,
273
+ ...restProps
254
274
  }) => {
255
275
  const [visible, setVisible] = useState(true);
256
276
  useEffect(() => {
@@ -282,7 +302,8 @@ var init_Toast = __esm({
282
302
  success: /* @__PURE__ */ React3.createElement(SuccessIcon, null),
283
303
  info: /* @__PURE__ */ React3.createElement(InfoIcon, null),
284
304
  error: /* @__PURE__ */ React3.createElement(ErrorIcon, null),
285
- warn: /* @__PURE__ */ React3.createElement(WarnIcon, null)
305
+ warn: /* @__PURE__ */ React3.createElement(WarnIcon, null),
306
+ loading: /* @__PURE__ */ React3.createElement(LoadingIcon, null)
286
307
  };
287
308
  return defaultIcons[variant];
288
309
  };
@@ -296,20 +317,12 @@ var init_Toast = __esm({
296
317
  className,
297
318
  style,
298
319
  role: "alert",
299
- "aria-live": "polite"
320
+ "aria-live": "polite",
321
+ ...restProps
300
322
  },
301
323
  showIcon && /* @__PURE__ */ React3.createElement(IconWrapper, { $variant: variant, $hasDescription: hasDescription }, iconElement),
302
324
  /* @__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(
325
+ 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
326
  Button,
314
327
  {
315
328
  variant: "text",
@@ -510,6 +523,12 @@ var init_toastManager = __esm({
510
523
  warn(message, options) {
511
524
  return this.show({ ...options, variant: "warn", message });
512
525
  }
526
+ /**
527
+ * Show loading toast
528
+ */
529
+ loading(message, options) {
530
+ return this.show({ ...options, variant: "loading", message });
531
+ }
513
532
  /**
514
533
  * Destroy the toast container
515
534
  */
@@ -549,6 +568,7 @@ var init_toastManager = __esm({
549
568
  info: (message, options) => toastManager.info(message, options),
550
569
  error: (message, options) => toastManager.error(message, options),
551
570
  warn: (message, options) => toastManager.warn(message, options),
571
+ loading: (message, options) => toastManager.loading(message, options),
552
572
  destroy: () => toastManager.destroy()
553
573
  };
554
574
  }
@@ -2561,13 +2581,17 @@ var ToastContainer2 = ({
2561
2581
  const warn = useCallback((message, options) => {
2562
2582
  return showToast({ ...options, variant: "warn", message });
2563
2583
  }, [showToast]);
2584
+ const loading = useCallback((message, options) => {
2585
+ return showToast({ ...options, variant: "loading", message });
2586
+ }, [showToast]);
2564
2587
  const contextValue = {
2565
2588
  showToast,
2566
2589
  hideToast,
2567
2590
  success,
2568
2591
  info,
2569
2592
  error,
2570
- warn
2593
+ warn,
2594
+ loading
2571
2595
  };
2572
2596
  return /* @__PURE__ */ React3.createElement(ToastContext.Provider, { value: contextValue }, children, /* @__PURE__ */ React3.createElement(ToastWrapper2, { $placement: placement }, toasts.map((toast2) => /* @__PURE__ */ React3.createElement(
2573
2597
  Toast,