@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
 
@@ -175,13 +175,22 @@ var init_Icon2 = __esm({
175
175
  init_IconProvider();
176
176
  }
177
177
  });
178
- var ToastContainer, IconWrapper, ContentWrapper, Message, Description, ActionGroup, SuccessIcon, InfoIcon, ErrorIcon, WarnIcon, CloseIconSvg; exports.Toast = void 0;
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("path", { d: "M6 10L9 13L14 7", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }));
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,
@@ -262,7 +281,8 @@ var init_Toast = __esm({
262
281
  icon,
263
282
  showIcon = true,
264
283
  className,
265
- style
284
+ style,
285
+ ...restProps
266
286
  }) => {
267
287
  const [visible, setVisible] = React3.useState(true);
268
288
  React3.useEffect(() => {
@@ -294,7 +314,8 @@ var init_Toast = __esm({
294
314
  success: /* @__PURE__ */ React3__default.default.createElement(SuccessIcon, null),
295
315
  info: /* @__PURE__ */ React3__default.default.createElement(InfoIcon, null),
296
316
  error: /* @__PURE__ */ React3__default.default.createElement(ErrorIcon, null),
297
- warn: /* @__PURE__ */ React3__default.default.createElement(WarnIcon, null)
317
+ warn: /* @__PURE__ */ React3__default.default.createElement(WarnIcon, null),
318
+ loading: /* @__PURE__ */ React3__default.default.createElement(LoadingIcon, null)
298
319
  };
299
320
  return defaultIcons[variant];
300
321
  };
@@ -308,20 +329,12 @@ var init_Toast = __esm({
308
329
  className,
309
330
  style,
310
331
  role: "alert",
311
- "aria-live": "polite"
332
+ "aria-live": "polite",
333
+ ...restProps
312
334
  },
313
335
  showIcon && /* @__PURE__ */ React3__default.default.createElement(IconWrapper, { $variant: variant, $hasDescription: hasDescription }, iconElement),
314
336
  /* @__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(
337
+ 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
338
  exports.Button,
326
339
  {
327
340
  variant: "text",
@@ -522,6 +535,12 @@ var init_toastManager = __esm({
522
535
  warn(message, options) {
523
536
  return this.show({ ...options, variant: "warn", message });
524
537
  }
538
+ /**
539
+ * Show loading toast
540
+ */
541
+ loading(message, options) {
542
+ return this.show({ ...options, variant: "loading", message });
543
+ }
525
544
  /**
526
545
  * Destroy the toast container
527
546
  */
@@ -561,6 +580,7 @@ var init_toastManager = __esm({
561
580
  info: (message, options) => toastManager.info(message, options),
562
581
  error: (message, options) => toastManager.error(message, options),
563
582
  warn: (message, options) => toastManager.warn(message, options),
583
+ loading: (message, options) => toastManager.loading(message, options),
564
584
  destroy: () => toastManager.destroy()
565
585
  };
566
586
  }
@@ -2573,13 +2593,17 @@ var ToastContainer2 = ({
2573
2593
  const warn = React3.useCallback((message, options) => {
2574
2594
  return showToast({ ...options, variant: "warn", message });
2575
2595
  }, [showToast]);
2596
+ const loading = React3.useCallback((message, options) => {
2597
+ return showToast({ ...options, variant: "loading", message });
2598
+ }, [showToast]);
2576
2599
  const contextValue = {
2577
2600
  showToast,
2578
2601
  hideToast,
2579
2602
  success,
2580
2603
  info,
2581
2604
  error,
2582
- warn
2605
+ warn,
2606
+ loading
2583
2607
  };
2584
2608
  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
2609
  exports.Toast,