@deepnoid/ui 0.1.221 → 0.1.223

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.
Files changed (123) hide show
  1. package/.turbo/turbo-build.log +225 -225
  2. package/dist/{chunk-3HANNN76.mjs → chunk-2URJGQFC.mjs} +2 -2
  3. package/dist/{chunk-6CTMLHLK.mjs → chunk-4IEHQI5B.mjs} +1 -1
  4. package/dist/{chunk-74MC7B4K.mjs → chunk-4S4AAZFC.mjs} +2 -2
  5. package/dist/{chunk-AXWICOKO.mjs → chunk-6AID2NLT.mjs} +1 -1
  6. package/dist/{chunk-4MTXDUV3.mjs → chunk-BBRO35V3.mjs} +4 -4
  7. package/dist/{chunk-JI3WAAZV.mjs → chunk-EJ4GDC6K.mjs} +1 -1
  8. package/dist/{chunk-I4LNWIIV.mjs → chunk-EVJ46M3U.mjs} +2 -2
  9. package/dist/{chunk-G4G6YXZH.mjs → chunk-GDHLN463.mjs} +1 -1
  10. package/dist/{chunk-QAXRJ3EH.mjs → chunk-HFOHFBZH.mjs} +1 -1
  11. package/dist/{chunk-APQE3TRN.mjs → chunk-KWHCUAFU.mjs} +2 -2
  12. package/dist/{chunk-US5NY7UP.mjs → chunk-MTT24BLX.mjs} +2 -2
  13. package/dist/{chunk-QECR6VMW.mjs → chunk-OC5C42CB.mjs} +2 -2
  14. package/dist/{chunk-AZYWRRZY.mjs → chunk-OXJX5G3O.mjs} +1 -1
  15. package/dist/{chunk-JYW3GEH6.mjs → chunk-P5L4YI54.mjs} +33 -0
  16. package/dist/{chunk-54FDYAUN.mjs → chunk-Q3KBMVJS.mjs} +1 -1
  17. package/dist/{chunk-Q5MFMWG7.mjs → chunk-R2XKPG4K.mjs} +1 -1
  18. package/dist/{chunk-QPEZ7SFU.mjs → chunk-RH3AHG52.mjs} +1 -1
  19. package/dist/chunk-RY5VVXQ4.mjs +163 -0
  20. package/dist/{chunk-PLR4DZBN.mjs → chunk-SKX5QPUD.mjs} +4 -4
  21. package/dist/{chunk-SNXIHIQG.mjs → chunk-SX3JDFTH.mjs} +10 -10
  22. package/dist/{chunk-VSVBYQF4.mjs → chunk-TE5JU3WA.mjs} +2 -2
  23. package/dist/{chunk-MYUAX3Z5.mjs → chunk-V2YH54JQ.mjs} +1 -1
  24. package/dist/components/avatar/avatar.js +33 -0
  25. package/dist/components/avatar/avatar.mjs +2 -2
  26. package/dist/components/avatar/index.js +33 -0
  27. package/dist/components/avatar/index.mjs +2 -2
  28. package/dist/components/breadcrumb/breadcrumb.js +33 -0
  29. package/dist/components/breadcrumb/breadcrumb.mjs +7 -7
  30. package/dist/components/breadcrumb/index.js +33 -0
  31. package/dist/components/breadcrumb/index.mjs +7 -7
  32. package/dist/components/button/button.js +33 -0
  33. package/dist/components/button/button.mjs +4 -4
  34. package/dist/components/button/icon-button.js +33 -0
  35. package/dist/components/button/icon-button.mjs +4 -4
  36. package/dist/components/button/index.js +33 -0
  37. package/dist/components/button/index.mjs +8 -8
  38. package/dist/components/charts/index.mjs +3 -3
  39. package/dist/components/chip/chip.js +33 -0
  40. package/dist/components/chip/chip.mjs +3 -3
  41. package/dist/components/chip/index.js +33 -0
  42. package/dist/components/chip/index.mjs +3 -3
  43. package/dist/components/fileUpload/fileUpload.js +33 -0
  44. package/dist/components/fileUpload/fileUpload.mjs +8 -8
  45. package/dist/components/fileUpload/index.js +33 -0
  46. package/dist/components/fileUpload/index.mjs +8 -8
  47. package/dist/components/icon/Icon.d.mts +4 -0
  48. package/dist/components/icon/Icon.d.ts +4 -0
  49. package/dist/components/icon/Icon.js +33 -0
  50. package/dist/components/icon/Icon.mjs +2 -2
  51. package/dist/components/icon/index.js +33 -0
  52. package/dist/components/icon/index.mjs +2 -2
  53. package/dist/components/icon/template.d.mts +1 -0
  54. package/dist/components/icon/template.d.ts +1 -0
  55. package/dist/components/icon/template.js +33 -0
  56. package/dist/components/icon/template.mjs +1 -1
  57. package/dist/components/input/index.js +33 -0
  58. package/dist/components/input/index.mjs +3 -3
  59. package/dist/components/input/input.js +33 -0
  60. package/dist/components/input/input.mjs +3 -3
  61. package/dist/components/list/index.js +33 -0
  62. package/dist/components/list/index.mjs +4 -4
  63. package/dist/components/list/listItem.js +33 -0
  64. package/dist/components/list/listItem.mjs +4 -4
  65. package/dist/components/modal/GlobalModalProvider.js +33 -0
  66. package/dist/components/modal/GlobalModalProvider.mjs +8 -8
  67. package/dist/components/modal/index.js +33 -0
  68. package/dist/components/modal/index.mjs +9 -9
  69. package/dist/components/modal/modal.js +33 -0
  70. package/dist/components/modal/modal.mjs +7 -7
  71. package/dist/components/modal/useGlobalModal.mjs +9 -9
  72. package/dist/components/pagination/index.js +33 -0
  73. package/dist/components/pagination/index.mjs +4 -4
  74. package/dist/components/pagination/pagination.js +33 -0
  75. package/dist/components/pagination/pagination.mjs +4 -4
  76. package/dist/components/picker/datePicker.js +33 -0
  77. package/dist/components/picker/datePicker.mjs +9 -9
  78. package/dist/components/picker/index.js +33 -0
  79. package/dist/components/picker/index.mjs +10 -10
  80. package/dist/components/picker/timePicker/Panel.mjs +6 -6
  81. package/dist/components/picker/timePicker/index.js +33 -0
  82. package/dist/components/picker/timePicker/index.mjs +8 -8
  83. package/dist/components/ripple/index.mjs +3 -3
  84. package/dist/components/select/index.js +33 -0
  85. package/dist/components/select/index.mjs +7 -7
  86. package/dist/components/select/select.js +33 -0
  87. package/dist/components/select/select.mjs +7 -7
  88. package/dist/components/starRating/index.js +33 -0
  89. package/dist/components/starRating/index.mjs +3 -3
  90. package/dist/components/starRating/starRating.js +33 -0
  91. package/dist/components/starRating/starRating.mjs +3 -3
  92. package/dist/components/table/index.js +33 -0
  93. package/dist/components/table/index.mjs +6 -6
  94. package/dist/components/table/table-body.js +33 -0
  95. package/dist/components/table/table-body.mjs +6 -6
  96. package/dist/components/table/table-head.js +33 -0
  97. package/dist/components/table/table-head.mjs +6 -6
  98. package/dist/components/table/table.js +33 -0
  99. package/dist/components/table/table.mjs +6 -6
  100. package/dist/components/timePicker/calendar.js +33 -0
  101. package/dist/components/timePicker/calendar.mjs +2 -2
  102. package/dist/components/toast/index.d.mts +1 -1
  103. package/dist/components/toast/index.d.ts +1 -1
  104. package/dist/components/toast/index.js +137 -12
  105. package/dist/components/toast/index.mjs +4 -4
  106. package/dist/components/toast/toast.d.mts +1 -0
  107. package/dist/components/toast/toast.d.ts +1 -0
  108. package/dist/components/toast/toast.js +34 -1
  109. package/dist/components/toast/toast.mjs +3 -3
  110. package/dist/components/toast/use-toast.d.mts +17 -3
  111. package/dist/components/toast/use-toast.d.ts +17 -3
  112. package/dist/components/toast/use-toast.js +137 -12
  113. package/dist/components/toast/use-toast.mjs +4 -4
  114. package/dist/components/tree/index.js +33 -0
  115. package/dist/components/tree/index.mjs +3 -3
  116. package/dist/components/tree/tree.js +33 -0
  117. package/dist/components/tree/tree.mjs +3 -3
  118. package/dist/index.d.mts +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.js +137 -12
  121. package/dist/index.mjs +64 -64
  122. package/package.json +2 -1
  123. package/dist/chunk-5UCNLY2A.mjs +0 -71
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  import {
3
3
  table_body_default
4
- } from "../../chunk-54FDYAUN.mjs";
4
+ } from "../../chunk-Q3KBMVJS.mjs";
5
5
  import "../../chunk-7B7LRG5J.mjs";
6
- import "../../chunk-VSVBYQF4.mjs";
6
+ import "../../chunk-TE5JU3WA.mjs";
7
7
  import "../../chunk-F3HENRVM.mjs";
8
- import "../../chunk-2GCSFWHD.mjs";
9
- import "../../chunk-JI3WAAZV.mjs";
10
8
  import "../../chunk-QZ3LVYJW.mjs";
11
9
  import "../../chunk-3DCUMRYP.mjs";
10
+ import "../../chunk-2GCSFWHD.mjs";
11
+ import "../../chunk-EJ4GDC6K.mjs";
12
12
  import "../../chunk-DQRAFUDA.mjs";
13
13
  import "../../chunk-EWS3FESG.mjs";
14
14
  import "../../chunk-ZYIIXWVY.mjs";
15
- import "../../chunk-AXWICOKO.mjs";
16
- import "../../chunk-JYW3GEH6.mjs";
15
+ import "../../chunk-6AID2NLT.mjs";
16
+ import "../../chunk-P5L4YI54.mjs";
17
17
  import "../../chunk-27Y6K5NK.mjs";
18
18
  import "../../chunk-E3G5QXSH.mjs";
19
19
  import "../../chunk-U4DJHAM5.mjs";
@@ -2504,6 +2504,39 @@ var template = {
2504
2504
  }
2505
2505
  );
2506
2506
  },
2507
+ "new-window": ({ className }) => {
2508
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2509
+ "svg",
2510
+ {
2511
+ width: "24",
2512
+ height: "24",
2513
+ viewBox: "0 0 24 24",
2514
+ fill: "none",
2515
+ xmlns: "http://www.w3.org/2000/svg",
2516
+ className,
2517
+ children: [
2518
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2519
+ "path",
2520
+ {
2521
+ d: "M18 14V18.75C18 19.3467 17.7629 19.919 17.341 20.341C16.919 20.763 16.3467 21 15.75 21H5.25C4.65326 21 4.08097 20.763 3.65901 20.341C3.23705 19.919 3 19.3467 3 18.75V8.25C3 7.65327 3.23705 7.08097 3.65901 6.65901C4.08097 6.23706 4.65326 6 5.25 6H10",
2522
+ stroke: "currentColor",
2523
+ strokeLinecap: "round",
2524
+ strokeLinejoin: "round"
2525
+ }
2526
+ ),
2527
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2528
+ "path",
2529
+ {
2530
+ d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
2531
+ stroke: "currentColor",
2532
+ strokeLinecap: "round",
2533
+ strokeLinejoin: "round"
2534
+ }
2535
+ )
2536
+ ]
2537
+ }
2538
+ );
2539
+ },
2507
2540
  // ----------------------------------- old ---------------------------------
2508
2541
  // ** Status **
2509
2542
  "plus-circle": ({ className, fill }) => {
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  import {
3
3
  table_head_default
4
- } from "../../chunk-54FDYAUN.mjs";
4
+ } from "../../chunk-Q3KBMVJS.mjs";
5
5
  import "../../chunk-7B7LRG5J.mjs";
6
- import "../../chunk-VSVBYQF4.mjs";
6
+ import "../../chunk-TE5JU3WA.mjs";
7
7
  import "../../chunk-F3HENRVM.mjs";
8
- import "../../chunk-2GCSFWHD.mjs";
9
- import "../../chunk-JI3WAAZV.mjs";
10
8
  import "../../chunk-QZ3LVYJW.mjs";
11
9
  import "../../chunk-3DCUMRYP.mjs";
10
+ import "../../chunk-2GCSFWHD.mjs";
11
+ import "../../chunk-EJ4GDC6K.mjs";
12
12
  import "../../chunk-DQRAFUDA.mjs";
13
13
  import "../../chunk-EWS3FESG.mjs";
14
14
  import "../../chunk-ZYIIXWVY.mjs";
15
- import "../../chunk-AXWICOKO.mjs";
16
- import "../../chunk-JYW3GEH6.mjs";
15
+ import "../../chunk-6AID2NLT.mjs";
16
+ import "../../chunk-P5L4YI54.mjs";
17
17
  import "../../chunk-27Y6K5NK.mjs";
18
18
  import "../../chunk-E3G5QXSH.mjs";
19
19
  import "../../chunk-U4DJHAM5.mjs";
@@ -2583,6 +2583,39 @@ var template = {
2583
2583
  }
2584
2584
  );
2585
2585
  },
2586
+ "new-window": ({ className }) => {
2587
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2588
+ "svg",
2589
+ {
2590
+ width: "24",
2591
+ height: "24",
2592
+ viewBox: "0 0 24 24",
2593
+ fill: "none",
2594
+ xmlns: "http://www.w3.org/2000/svg",
2595
+ className,
2596
+ children: [
2597
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2598
+ "path",
2599
+ {
2600
+ d: "M18 14V18.75C18 19.3467 17.7629 19.919 17.341 20.341C16.919 20.763 16.3467 21 15.75 21H5.25C4.65326 21 4.08097 20.763 3.65901 20.341C3.23705 19.919 3 19.3467 3 18.75V8.25C3 7.65327 3.23705 7.08097 3.65901 6.65901C4.08097 6.23706 4.65326 6 5.25 6H10",
2601
+ stroke: "currentColor",
2602
+ strokeLinecap: "round",
2603
+ strokeLinejoin: "round"
2604
+ }
2605
+ ),
2606
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2607
+ "path",
2608
+ {
2609
+ d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
2610
+ stroke: "currentColor",
2611
+ strokeLinecap: "round",
2612
+ strokeLinejoin: "round"
2613
+ }
2614
+ )
2615
+ ]
2616
+ }
2617
+ );
2618
+ },
2586
2619
  // ----------------------------------- old ---------------------------------
2587
2620
  // ** Status **
2588
2621
  "plus-circle": ({ className, fill }) => {
@@ -2,19 +2,19 @@
2
2
  import {
3
3
  getCellStyle,
4
4
  table_default
5
- } from "../../chunk-54FDYAUN.mjs";
5
+ } from "../../chunk-Q3KBMVJS.mjs";
6
6
  import "../../chunk-7B7LRG5J.mjs";
7
- import "../../chunk-VSVBYQF4.mjs";
7
+ import "../../chunk-TE5JU3WA.mjs";
8
8
  import "../../chunk-F3HENRVM.mjs";
9
- import "../../chunk-2GCSFWHD.mjs";
10
- import "../../chunk-JI3WAAZV.mjs";
11
9
  import "../../chunk-QZ3LVYJW.mjs";
12
10
  import "../../chunk-3DCUMRYP.mjs";
11
+ import "../../chunk-2GCSFWHD.mjs";
12
+ import "../../chunk-EJ4GDC6K.mjs";
13
13
  import "../../chunk-DQRAFUDA.mjs";
14
14
  import "../../chunk-EWS3FESG.mjs";
15
15
  import "../../chunk-ZYIIXWVY.mjs";
16
- import "../../chunk-AXWICOKO.mjs";
17
- import "../../chunk-JYW3GEH6.mjs";
16
+ import "../../chunk-6AID2NLT.mjs";
17
+ import "../../chunk-P5L4YI54.mjs";
18
18
  import "../../chunk-27Y6K5NK.mjs";
19
19
  import "../../chunk-E3G5QXSH.mjs";
20
20
  import "../../chunk-U4DJHAM5.mjs";
@@ -2112,6 +2112,39 @@ var template = {
2112
2112
  }
2113
2113
  );
2114
2114
  },
2115
+ "new-window": ({ className }) => {
2116
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2117
+ "svg",
2118
+ {
2119
+ width: "24",
2120
+ height: "24",
2121
+ viewBox: "0 0 24 24",
2122
+ fill: "none",
2123
+ xmlns: "http://www.w3.org/2000/svg",
2124
+ className,
2125
+ children: [
2126
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2127
+ "path",
2128
+ {
2129
+ d: "M18 14V18.75C18 19.3467 17.7629 19.919 17.341 20.341C16.919 20.763 16.3467 21 15.75 21H5.25C4.65326 21 4.08097 20.763 3.65901 20.341C3.23705 19.919 3 19.3467 3 18.75V8.25C3 7.65327 3.23705 7.08097 3.65901 6.65901C4.08097 6.23706 4.65326 6 5.25 6H10",
2130
+ stroke: "currentColor",
2131
+ strokeLinecap: "round",
2132
+ strokeLinejoin: "round"
2133
+ }
2134
+ ),
2135
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2136
+ "path",
2137
+ {
2138
+ d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
2139
+ stroke: "currentColor",
2140
+ strokeLinecap: "round",
2141
+ strokeLinejoin: "round"
2142
+ }
2143
+ )
2144
+ ]
2145
+ }
2146
+ );
2147
+ },
2115
2148
  // ----------------------------------- old ---------------------------------
2116
2149
  // ** Status **
2117
2150
  "plus-circle": ({ className, fill }) => {
@@ -6,8 +6,8 @@ import {
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import {
8
8
  Icon_default
9
- } from "../../chunk-AXWICOKO.mjs";
10
- import "../../chunk-JYW3GEH6.mjs";
9
+ } from "../../chunk-6AID2NLT.mjs";
10
+ import "../../chunk-P5L4YI54.mjs";
11
11
  import {
12
12
  mapPropsVariants
13
13
  } from "../../chunk-E3G5QXSH.mjs";
@@ -1,5 +1,5 @@
1
1
  export { default as Toast, ToastProps } from './toast.mjs';
2
- export { ToastProvider, useToast } from './use-toast.mjs';
2
+ export { CreateToastOptions, ToastFunction, ToastId, ToastPromiseMessages, ToastProvider, useToast } from './use-toast.mjs';
3
3
  import 'tailwind-variants';
4
4
  import 'react';
5
5
  import './toast-utils.mjs';
@@ -1,5 +1,5 @@
1
1
  export { default as Toast, ToastProps } from './toast.js';
2
- export { ToastProvider, useToast } from './use-toast.js';
2
+ export { CreateToastOptions, ToastFunction, ToastId, ToastPromiseMessages, ToastProvider, useToast } from './use-toast.js';
3
3
  import 'tailwind-variants';
4
4
  import 'react';
5
5
  import './toast-utils.js';
@@ -2115,6 +2115,39 @@ var template = {
2115
2115
  }
2116
2116
  );
2117
2117
  },
2118
+ "new-window": ({ className }) => {
2119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2120
+ "svg",
2121
+ {
2122
+ width: "24",
2123
+ height: "24",
2124
+ viewBox: "0 0 24 24",
2125
+ fill: "none",
2126
+ xmlns: "http://www.w3.org/2000/svg",
2127
+ className,
2128
+ children: [
2129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2130
+ "path",
2131
+ {
2132
+ d: "M18 14V18.75C18 19.3467 17.7629 19.919 17.341 20.341C16.919 20.763 16.3467 21 15.75 21H5.25C4.65326 21 4.08097 20.763 3.65901 20.341C3.23705 19.919 3 19.3467 3 18.75V8.25C3 7.65327 3.23705 7.08097 3.65901 6.65901C4.08097 6.23706 4.65326 6 5.25 6H10",
2133
+ stroke: "currentColor",
2134
+ strokeLinecap: "round",
2135
+ strokeLinejoin: "round"
2136
+ }
2137
+ ),
2138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2139
+ "path",
2140
+ {
2141
+ d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
2142
+ stroke: "currentColor",
2143
+ strokeLinecap: "round",
2144
+ strokeLinejoin: "round"
2145
+ }
2146
+ )
2147
+ ]
2148
+ }
2149
+ );
2150
+ },
2118
2151
  // ----------------------------------- old ---------------------------------
2119
2152
  // ** Status **
2120
2153
  "plus-circle": ({ className, fill }) => {
@@ -5299,7 +5332,7 @@ var Toast = (0, import_react.forwardRef)((originalProps, ref) => {
5299
5332
  style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
5300
5333
  children: [
5301
5334
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5302
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
5335
+ showIcon && (originalProps.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "loading", className: "mt-[2px] animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" })),
5303
5336
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
5304
5337
  showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
5305
5338
  ] }),
@@ -5463,27 +5496,119 @@ var ToastProvider = ({
5463
5496
  const [toasts, setToasts] = (0, import_react2.useState)([]);
5464
5497
  const [containerStyle, setContainerStyle] = (0, import_react2.useState)({});
5465
5498
  const toastRef = (0, import_react2.useRef)(null);
5499
+ const timersRef = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
5500
+ const startTimer = (0, import_react2.useCallback)((id, duration) => {
5501
+ const existing = timersRef.current.get(id);
5502
+ if (existing) clearTimeout(existing);
5503
+ if (!isFinite(duration) || duration <= 0) {
5504
+ timersRef.current.delete(id);
5505
+ return;
5506
+ }
5507
+ const timer = setTimeout(() => {
5508
+ setToasts((prev) => prev.filter((t) => t.id !== id));
5509
+ timersRef.current.delete(id);
5510
+ }, duration);
5511
+ timersRef.current.set(id, timer);
5512
+ }, []);
5513
+ const clearTimer = (0, import_react2.useCallback)((id) => {
5514
+ const timer = timersRef.current.get(id);
5515
+ if (timer) {
5516
+ clearTimeout(timer);
5517
+ timersRef.current.delete(id);
5518
+ }
5519
+ }, []);
5520
+ (0, import_react2.useEffect)(() => {
5521
+ const timers = timersRef.current;
5522
+ return () => {
5523
+ timers.forEach((timer) => clearTimeout(timer));
5524
+ timers.clear();
5525
+ };
5526
+ }, []);
5466
5527
  const addToast = (0, import_react2.useCallback)(
5467
5528
  (title, options = {}) => {
5529
+ var _a, _b;
5468
5530
  const id = Date.now() + Math.floor(Math.random() * 1e5);
5531
+ const duration = options.isLoading ? Infinity : (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
5469
5532
  const newToast = {
5533
+ ...globalOptions,
5534
+ ...options,
5470
5535
  id,
5471
5536
  title,
5472
- duration: 3e3,
5473
- ...globalOptions,
5474
- ...options
5537
+ duration
5475
5538
  };
5476
5539
  setToasts((prev) => [...prev, newToast]);
5477
- setTimeout(() => {
5478
- setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
5479
- }, newToast.duration || 3e3);
5540
+ startTimer(id, duration);
5541
+ return id;
5480
5542
  },
5481
- [globalOptions]
5543
+ [globalOptions, startTimer]
5482
5544
  );
5483
- const removeToast = (0, import_react2.useCallback)((id) => {
5484
- setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
5485
- }, []);
5486
- const contextValue = addToast;
5545
+ const removeToast = (0, import_react2.useCallback)(
5546
+ (id) => {
5547
+ clearTimer(id);
5548
+ setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
5549
+ },
5550
+ [clearTimer]
5551
+ );
5552
+ const updateToast = (0, import_react2.useCallback)(
5553
+ (id, options) => {
5554
+ setToasts(
5555
+ (prev) => prev.map((t) => {
5556
+ var _a, _b;
5557
+ if (t.id !== id) return t;
5558
+ const updated = { ...t, ...options };
5559
+ if (t.isLoading && options.isLoading === false) {
5560
+ const duration = (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
5561
+ updated.duration = duration;
5562
+ startTimer(id, duration);
5563
+ }
5564
+ return updated;
5565
+ })
5566
+ );
5567
+ },
5568
+ [globalOptions == null ? void 0 : globalOptions.duration, startTimer]
5569
+ );
5570
+ const dismissToast = (0, import_react2.useCallback)(
5571
+ (id) => {
5572
+ if (id !== void 0) {
5573
+ removeToast(id);
5574
+ } else {
5575
+ timersRef.current.forEach((timer) => clearTimeout(timer));
5576
+ timersRef.current.clear();
5577
+ setToasts([]);
5578
+ }
5579
+ },
5580
+ [removeToast]
5581
+ );
5582
+ const loadingToast = (0, import_react2.useCallback)(
5583
+ (title, options = {}) => {
5584
+ return addToast(title, { ...options, isLoading: true });
5585
+ },
5586
+ [addToast]
5587
+ );
5588
+ const contextValue = (0, import_react2.useMemo)(() => {
5589
+ const fn = (title, options) => {
5590
+ return addToast(title, options);
5591
+ };
5592
+ fn.loading = loadingToast;
5593
+ fn.update = updateToast;
5594
+ fn.dismiss = dismissToast;
5595
+ fn.promise = (promise, messages, options = {}) => {
5596
+ const id = loadingToast(messages.loading, options);
5597
+ return promise.then(
5598
+ (data) => {
5599
+ const title = typeof messages.success === "function" ? messages.success(data) : messages.success;
5600
+ updateToast(id, { title, color: "success", isLoading: false });
5601
+ return data;
5602
+ },
5603
+ (err) => {
5604
+ const title = typeof messages.error === "function" ? messages.error(err) : messages.error;
5605
+ updateToast(id, { title, color: "danger", isLoading: false });
5606
+ throw err;
5607
+ }
5608
+ );
5609
+ };
5610
+ return fn;
5611
+ }, [addToast, loadingToast, updateToast, dismissToast]);
5487
5612
  (0, import_react2.useEffect)(() => {
5488
5613
  var _a;
5489
5614
  const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
@@ -3,14 +3,14 @@ import "../../chunk-LUWGOKLG.mjs";
3
3
  import {
4
4
  ToastProvider,
5
5
  useToast
6
- } from "../../chunk-5UCNLY2A.mjs";
6
+ } from "../../chunk-RY5VVXQ4.mjs";
7
7
  import "../../chunk-ZOTHPHXA.mjs";
8
8
  import {
9
9
  toast_default
10
- } from "../../chunk-3HANNN76.mjs";
10
+ } from "../../chunk-2URJGQFC.mjs";
11
11
  import "../../chunk-ZYIIXWVY.mjs";
12
- import "../../chunk-AXWICOKO.mjs";
13
- import "../../chunk-JYW3GEH6.mjs";
12
+ import "../../chunk-6AID2NLT.mjs";
13
+ import "../../chunk-P5L4YI54.mjs";
14
14
  import "../../chunk-27Y6K5NK.mjs";
15
15
  import "../../chunk-E3G5QXSH.mjs";
16
16
  import "../../chunk-U4DJHAM5.mjs";
@@ -17,6 +17,7 @@ interface Props {
17
17
  classNames?: Record<string, string>;
18
18
  showIcon?: boolean;
19
19
  showCloseButton?: boolean;
20
+ isLoading?: boolean;
20
21
  onClose?: () => void;
21
22
  hasShadow?: boolean;
22
23
  disableAnimation?: boolean;
@@ -17,6 +17,7 @@ interface Props {
17
17
  classNames?: Record<string, string>;
18
18
  showIcon?: boolean;
19
19
  showCloseButton?: boolean;
20
+ isLoading?: boolean;
20
21
  onClose?: () => void;
21
22
  hasShadow?: boolean;
22
23
  disableAnimation?: boolean;
@@ -2111,6 +2111,39 @@ var template = {
2111
2111
  }
2112
2112
  );
2113
2113
  },
2114
+ "new-window": ({ className }) => {
2115
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2116
+ "svg",
2117
+ {
2118
+ width: "24",
2119
+ height: "24",
2120
+ viewBox: "0 0 24 24",
2121
+ fill: "none",
2122
+ xmlns: "http://www.w3.org/2000/svg",
2123
+ className,
2124
+ children: [
2125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2126
+ "path",
2127
+ {
2128
+ d: "M18 14V18.75C18 19.3467 17.7629 19.919 17.341 20.341C16.919 20.763 16.3467 21 15.75 21H5.25C4.65326 21 4.08097 20.763 3.65901 20.341C3.23705 19.919 3 19.3467 3 18.75V8.25C3 7.65327 3.23705 7.08097 3.65901 6.65901C4.08097 6.23706 4.65326 6 5.25 6H10",
2129
+ stroke: "currentColor",
2130
+ strokeLinecap: "round",
2131
+ strokeLinejoin: "round"
2132
+ }
2133
+ ),
2134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2135
+ "path",
2136
+ {
2137
+ d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
2138
+ stroke: "currentColor",
2139
+ strokeLinecap: "round",
2140
+ strokeLinejoin: "round"
2141
+ }
2142
+ )
2143
+ ]
2144
+ }
2145
+ );
2146
+ },
2114
2147
  // ----------------------------------- old ---------------------------------
2115
2148
  // ** Status **
2116
2149
  "plus-circle": ({ className, fill }) => {
@@ -5295,7 +5328,7 @@ var Toast = (0, import_react.forwardRef)((originalProps, ref) => {
5295
5328
  style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
5296
5329
  children: [
5297
5330
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
5298
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
5331
+ showIcon && (originalProps.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "loading", className: "mt-[2px] animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" })),
5299
5332
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
5300
5333
  showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
5301
5334
  ] }),
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  toast_default
4
- } from "../../chunk-3HANNN76.mjs";
4
+ } from "../../chunk-2URJGQFC.mjs";
5
5
  import "../../chunk-ZYIIXWVY.mjs";
6
- import "../../chunk-AXWICOKO.mjs";
7
- import "../../chunk-JYW3GEH6.mjs";
6
+ import "../../chunk-6AID2NLT.mjs";
7
+ import "../../chunk-P5L4YI54.mjs";
8
8
  import "../../chunk-27Y6K5NK.mjs";
9
9
  import "../../chunk-E3G5QXSH.mjs";
10
10
  import "../../chunk-U4DJHAM5.mjs";
@@ -5,8 +5,9 @@ import { IconName } from '../icon/Icon.mjs';
5
5
  import '../icon/template.mjs';
6
6
  import '../../utils/types.mjs';
7
7
 
8
+ type ToastId = string | number;
8
9
  interface ToastOptions {
9
- id: number;
10
+ id: ToastId;
10
11
  title: string;
11
12
  width?: number;
12
13
  duration?: number;
@@ -15,9 +16,22 @@ interface ToastOptions {
15
16
  icon?: IconName;
16
17
  showIcon?: boolean;
17
18
  showCloseButton?: boolean;
19
+ isLoading?: boolean;
20
+ content?: ReactNode;
21
+ }
22
+ type CreateToastOptions = Omit<ToastOptions, "id" | "placement" | "width" | "title">;
23
+ type UpdateToastOptions = Partial<Omit<ToastOptions, "id" | "placement" | "width">>;
24
+ interface ToastPromiseMessages<T> {
25
+ loading: string;
26
+ success: string | ((data: T) => string);
27
+ error: string | ((err: unknown) => string);
18
28
  }
19
29
  interface ToastFunction {
20
- (title: string, options?: Omit<ToastOptions, "id" | "placement" | "width" | "title">): void;
30
+ (title: string, options?: CreateToastOptions): ToastId;
31
+ loading: (title: string, options?: Omit<CreateToastOptions, "isLoading">) => ToastId;
32
+ update: (id: ToastId, options: UpdateToastOptions) => void;
33
+ dismiss: (id?: ToastId) => void;
34
+ promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>, options?: Omit<CreateToastOptions, "isLoading">) => Promise<T>;
21
35
  }
22
36
  declare const useToast: () => ToastFunction;
23
37
  declare const ToastProvider: ({ globalOptions, children, }: {
@@ -25,4 +39,4 @@ declare const ToastProvider: ({ globalOptions, children, }: {
25
39
  children: ReactNode;
26
40
  }) => react_jsx_runtime.JSX.Element;
27
41
 
28
- export { ToastProvider, useToast };
42
+ export { type CreateToastOptions, type ToastFunction, type ToastId, type ToastOptions, type ToastPromiseMessages, ToastProvider, type UpdateToastOptions, useToast };
@@ -5,8 +5,9 @@ import { IconName } from '../icon/Icon.js';
5
5
  import '../icon/template.js';
6
6
  import '../../utils/types.js';
7
7
 
8
+ type ToastId = string | number;
8
9
  interface ToastOptions {
9
- id: number;
10
+ id: ToastId;
10
11
  title: string;
11
12
  width?: number;
12
13
  duration?: number;
@@ -15,9 +16,22 @@ interface ToastOptions {
15
16
  icon?: IconName;
16
17
  showIcon?: boolean;
17
18
  showCloseButton?: boolean;
19
+ isLoading?: boolean;
20
+ content?: ReactNode;
21
+ }
22
+ type CreateToastOptions = Omit<ToastOptions, "id" | "placement" | "width" | "title">;
23
+ type UpdateToastOptions = Partial<Omit<ToastOptions, "id" | "placement" | "width">>;
24
+ interface ToastPromiseMessages<T> {
25
+ loading: string;
26
+ success: string | ((data: T) => string);
27
+ error: string | ((err: unknown) => string);
18
28
  }
19
29
  interface ToastFunction {
20
- (title: string, options?: Omit<ToastOptions, "id" | "placement" | "width" | "title">): void;
30
+ (title: string, options?: CreateToastOptions): ToastId;
31
+ loading: (title: string, options?: Omit<CreateToastOptions, "isLoading">) => ToastId;
32
+ update: (id: ToastId, options: UpdateToastOptions) => void;
33
+ dismiss: (id?: ToastId) => void;
34
+ promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>, options?: Omit<CreateToastOptions, "isLoading">) => Promise<T>;
21
35
  }
22
36
  declare const useToast: () => ToastFunction;
23
37
  declare const ToastProvider: ({ globalOptions, children, }: {
@@ -25,4 +39,4 @@ declare const ToastProvider: ({ globalOptions, children, }: {
25
39
  children: ReactNode;
26
40
  }) => react_jsx_runtime.JSX.Element;
27
41
 
28
- export { ToastProvider, useToast };
42
+ export { type CreateToastOptions, type ToastFunction, type ToastId, type ToastOptions, type ToastPromiseMessages, ToastProvider, type UpdateToastOptions, useToast };