@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.
- package/.turbo/turbo-build.log +225 -225
- package/dist/{chunk-3HANNN76.mjs → chunk-2URJGQFC.mjs} +2 -2
- package/dist/{chunk-6CTMLHLK.mjs → chunk-4IEHQI5B.mjs} +1 -1
- package/dist/{chunk-74MC7B4K.mjs → chunk-4S4AAZFC.mjs} +2 -2
- package/dist/{chunk-AXWICOKO.mjs → chunk-6AID2NLT.mjs} +1 -1
- package/dist/{chunk-4MTXDUV3.mjs → chunk-BBRO35V3.mjs} +4 -4
- package/dist/{chunk-JI3WAAZV.mjs → chunk-EJ4GDC6K.mjs} +1 -1
- package/dist/{chunk-I4LNWIIV.mjs → chunk-EVJ46M3U.mjs} +2 -2
- package/dist/{chunk-G4G6YXZH.mjs → chunk-GDHLN463.mjs} +1 -1
- package/dist/{chunk-QAXRJ3EH.mjs → chunk-HFOHFBZH.mjs} +1 -1
- package/dist/{chunk-APQE3TRN.mjs → chunk-KWHCUAFU.mjs} +2 -2
- package/dist/{chunk-US5NY7UP.mjs → chunk-MTT24BLX.mjs} +2 -2
- package/dist/{chunk-QECR6VMW.mjs → chunk-OC5C42CB.mjs} +2 -2
- package/dist/{chunk-AZYWRRZY.mjs → chunk-OXJX5G3O.mjs} +1 -1
- package/dist/{chunk-JYW3GEH6.mjs → chunk-P5L4YI54.mjs} +33 -0
- package/dist/{chunk-54FDYAUN.mjs → chunk-Q3KBMVJS.mjs} +1 -1
- package/dist/{chunk-Q5MFMWG7.mjs → chunk-R2XKPG4K.mjs} +1 -1
- package/dist/{chunk-QPEZ7SFU.mjs → chunk-RH3AHG52.mjs} +1 -1
- package/dist/chunk-RY5VVXQ4.mjs +163 -0
- package/dist/{chunk-PLR4DZBN.mjs → chunk-SKX5QPUD.mjs} +4 -4
- package/dist/{chunk-SNXIHIQG.mjs → chunk-SX3JDFTH.mjs} +10 -10
- package/dist/{chunk-VSVBYQF4.mjs → chunk-TE5JU3WA.mjs} +2 -2
- package/dist/{chunk-MYUAX3Z5.mjs → chunk-V2YH54JQ.mjs} +1 -1
- package/dist/components/avatar/avatar.js +33 -0
- package/dist/components/avatar/avatar.mjs +2 -2
- package/dist/components/avatar/index.js +33 -0
- package/dist/components/avatar/index.mjs +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +33 -0
- package/dist/components/breadcrumb/breadcrumb.mjs +7 -7
- package/dist/components/breadcrumb/index.js +33 -0
- package/dist/components/breadcrumb/index.mjs +7 -7
- package/dist/components/button/button.js +33 -0
- package/dist/components/button/button.mjs +4 -4
- package/dist/components/button/icon-button.js +33 -0
- package/dist/components/button/icon-button.mjs +4 -4
- package/dist/components/button/index.js +33 -0
- package/dist/components/button/index.mjs +8 -8
- package/dist/components/charts/index.mjs +3 -3
- package/dist/components/chip/chip.js +33 -0
- package/dist/components/chip/chip.mjs +3 -3
- package/dist/components/chip/index.js +33 -0
- package/dist/components/chip/index.mjs +3 -3
- package/dist/components/fileUpload/fileUpload.js +33 -0
- package/dist/components/fileUpload/fileUpload.mjs +8 -8
- package/dist/components/fileUpload/index.js +33 -0
- package/dist/components/fileUpload/index.mjs +8 -8
- package/dist/components/icon/Icon.d.mts +4 -0
- package/dist/components/icon/Icon.d.ts +4 -0
- package/dist/components/icon/Icon.js +33 -0
- package/dist/components/icon/Icon.mjs +2 -2
- package/dist/components/icon/index.js +33 -0
- package/dist/components/icon/index.mjs +2 -2
- package/dist/components/icon/template.d.mts +1 -0
- package/dist/components/icon/template.d.ts +1 -0
- package/dist/components/icon/template.js +33 -0
- package/dist/components/icon/template.mjs +1 -1
- package/dist/components/input/index.js +33 -0
- package/dist/components/input/index.mjs +3 -3
- package/dist/components/input/input.js +33 -0
- package/dist/components/input/input.mjs +3 -3
- package/dist/components/list/index.js +33 -0
- package/dist/components/list/index.mjs +4 -4
- package/dist/components/list/listItem.js +33 -0
- package/dist/components/list/listItem.mjs +4 -4
- package/dist/components/modal/GlobalModalProvider.js +33 -0
- package/dist/components/modal/GlobalModalProvider.mjs +8 -8
- package/dist/components/modal/index.js +33 -0
- package/dist/components/modal/index.mjs +9 -9
- package/dist/components/modal/modal.js +33 -0
- package/dist/components/modal/modal.mjs +7 -7
- package/dist/components/modal/useGlobalModal.mjs +9 -9
- package/dist/components/pagination/index.js +33 -0
- package/dist/components/pagination/index.mjs +4 -4
- package/dist/components/pagination/pagination.js +33 -0
- package/dist/components/pagination/pagination.mjs +4 -4
- package/dist/components/picker/datePicker.js +33 -0
- package/dist/components/picker/datePicker.mjs +9 -9
- package/dist/components/picker/index.js +33 -0
- package/dist/components/picker/index.mjs +10 -10
- package/dist/components/picker/timePicker/Panel.mjs +6 -6
- package/dist/components/picker/timePicker/index.js +33 -0
- package/dist/components/picker/timePicker/index.mjs +8 -8
- package/dist/components/ripple/index.mjs +3 -3
- package/dist/components/select/index.js +33 -0
- package/dist/components/select/index.mjs +7 -7
- package/dist/components/select/select.js +33 -0
- package/dist/components/select/select.mjs +7 -7
- package/dist/components/starRating/index.js +33 -0
- package/dist/components/starRating/index.mjs +3 -3
- package/dist/components/starRating/starRating.js +33 -0
- package/dist/components/starRating/starRating.mjs +3 -3
- package/dist/components/table/index.js +33 -0
- package/dist/components/table/index.mjs +6 -6
- package/dist/components/table/table-body.js +33 -0
- package/dist/components/table/table-body.mjs +6 -6
- package/dist/components/table/table-head.js +33 -0
- package/dist/components/table/table-head.mjs +6 -6
- package/dist/components/table/table.js +33 -0
- package/dist/components/table/table.mjs +6 -6
- package/dist/components/timePicker/calendar.js +33 -0
- package/dist/components/timePicker/calendar.mjs +2 -2
- package/dist/components/toast/index.d.mts +1 -1
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/index.js +137 -12
- package/dist/components/toast/index.mjs +4 -4
- package/dist/components/toast/toast.d.mts +1 -0
- package/dist/components/toast/toast.d.ts +1 -0
- package/dist/components/toast/toast.js +34 -1
- package/dist/components/toast/toast.mjs +3 -3
- package/dist/components/toast/use-toast.d.mts +17 -3
- package/dist/components/toast/use-toast.d.ts +17 -3
- package/dist/components/toast/use-toast.js +137 -12
- package/dist/components/toast/use-toast.mjs +4 -4
- package/dist/components/tree/index.js +33 -0
- package/dist/components/tree/index.mjs +3 -3
- package/dist/components/tree/tree.js +33 -0
- package/dist/components/tree/tree.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +137 -12
- package/dist/index.mjs +64 -64
- package/package.json +2 -1
- package/dist/chunk-5UCNLY2A.mjs +0 -71
|
@@ -2151,6 +2151,39 @@ var template = {
|
|
|
2151
2151
|
}
|
|
2152
2152
|
);
|
|
2153
2153
|
},
|
|
2154
|
+
"new-window": ({ className }) => {
|
|
2155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2156
|
+
"svg",
|
|
2157
|
+
{
|
|
2158
|
+
width: "24",
|
|
2159
|
+
height: "24",
|
|
2160
|
+
viewBox: "0 0 24 24",
|
|
2161
|
+
fill: "none",
|
|
2162
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2163
|
+
className,
|
|
2164
|
+
children: [
|
|
2165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2166
|
+
"path",
|
|
2167
|
+
{
|
|
2168
|
+
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",
|
|
2169
|
+
stroke: "currentColor",
|
|
2170
|
+
strokeLinecap: "round",
|
|
2171
|
+
strokeLinejoin: "round"
|
|
2172
|
+
}
|
|
2173
|
+
),
|
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2175
|
+
"path",
|
|
2176
|
+
{
|
|
2177
|
+
d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
|
|
2178
|
+
stroke: "currentColor",
|
|
2179
|
+
strokeLinecap: "round",
|
|
2180
|
+
strokeLinejoin: "round"
|
|
2181
|
+
}
|
|
2182
|
+
)
|
|
2183
|
+
]
|
|
2184
|
+
}
|
|
2185
|
+
);
|
|
2186
|
+
},
|
|
2154
2187
|
// ----------------------------------- old ---------------------------------
|
|
2155
2188
|
// ** Status **
|
|
2156
2189
|
"plus-circle": ({ className, fill }) => {
|
|
@@ -5335,7 +5368,7 @@ var Toast = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5335
5368
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
5336
5369
|
children: [
|
|
5337
5370
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
5338
|
-
showIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
|
|
5371
|
+
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]" })),
|
|
5339
5372
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
5340
5373
|
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
|
|
5341
5374
|
] }),
|
|
@@ -5460,27 +5493,119 @@ var ToastProvider = ({
|
|
|
5460
5493
|
const [toasts, setToasts] = (0, import_react2.useState)([]);
|
|
5461
5494
|
const [containerStyle, setContainerStyle] = (0, import_react2.useState)({});
|
|
5462
5495
|
const toastRef = (0, import_react2.useRef)(null);
|
|
5496
|
+
const timersRef = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
|
|
5497
|
+
const startTimer = (0, import_react2.useCallback)((id, duration) => {
|
|
5498
|
+
const existing = timersRef.current.get(id);
|
|
5499
|
+
if (existing) clearTimeout(existing);
|
|
5500
|
+
if (!isFinite(duration) || duration <= 0) {
|
|
5501
|
+
timersRef.current.delete(id);
|
|
5502
|
+
return;
|
|
5503
|
+
}
|
|
5504
|
+
const timer = setTimeout(() => {
|
|
5505
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
5506
|
+
timersRef.current.delete(id);
|
|
5507
|
+
}, duration);
|
|
5508
|
+
timersRef.current.set(id, timer);
|
|
5509
|
+
}, []);
|
|
5510
|
+
const clearTimer = (0, import_react2.useCallback)((id) => {
|
|
5511
|
+
const timer = timersRef.current.get(id);
|
|
5512
|
+
if (timer) {
|
|
5513
|
+
clearTimeout(timer);
|
|
5514
|
+
timersRef.current.delete(id);
|
|
5515
|
+
}
|
|
5516
|
+
}, []);
|
|
5517
|
+
(0, import_react2.useEffect)(() => {
|
|
5518
|
+
const timers = timersRef.current;
|
|
5519
|
+
return () => {
|
|
5520
|
+
timers.forEach((timer) => clearTimeout(timer));
|
|
5521
|
+
timers.clear();
|
|
5522
|
+
};
|
|
5523
|
+
}, []);
|
|
5463
5524
|
const addToast = (0, import_react2.useCallback)(
|
|
5464
5525
|
(title, options = {}) => {
|
|
5526
|
+
var _a, _b;
|
|
5465
5527
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
5528
|
+
const duration = options.isLoading ? Infinity : (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
|
|
5466
5529
|
const newToast = {
|
|
5530
|
+
...globalOptions,
|
|
5531
|
+
...options,
|
|
5467
5532
|
id,
|
|
5468
5533
|
title,
|
|
5469
|
-
duration
|
|
5470
|
-
...globalOptions,
|
|
5471
|
-
...options
|
|
5534
|
+
duration
|
|
5472
5535
|
};
|
|
5473
5536
|
setToasts((prev) => [...prev, newToast]);
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
}, newToast.duration || 3e3);
|
|
5537
|
+
startTimer(id, duration);
|
|
5538
|
+
return id;
|
|
5477
5539
|
},
|
|
5478
|
-
[globalOptions]
|
|
5540
|
+
[globalOptions, startTimer]
|
|
5479
5541
|
);
|
|
5480
|
-
const removeToast = (0, import_react2.useCallback)(
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5542
|
+
const removeToast = (0, import_react2.useCallback)(
|
|
5543
|
+
(id) => {
|
|
5544
|
+
clearTimer(id);
|
|
5545
|
+
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
5546
|
+
},
|
|
5547
|
+
[clearTimer]
|
|
5548
|
+
);
|
|
5549
|
+
const updateToast = (0, import_react2.useCallback)(
|
|
5550
|
+
(id, options) => {
|
|
5551
|
+
setToasts(
|
|
5552
|
+
(prev) => prev.map((t) => {
|
|
5553
|
+
var _a, _b;
|
|
5554
|
+
if (t.id !== id) return t;
|
|
5555
|
+
const updated = { ...t, ...options };
|
|
5556
|
+
if (t.isLoading && options.isLoading === false) {
|
|
5557
|
+
const duration = (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
|
|
5558
|
+
updated.duration = duration;
|
|
5559
|
+
startTimer(id, duration);
|
|
5560
|
+
}
|
|
5561
|
+
return updated;
|
|
5562
|
+
})
|
|
5563
|
+
);
|
|
5564
|
+
},
|
|
5565
|
+
[globalOptions == null ? void 0 : globalOptions.duration, startTimer]
|
|
5566
|
+
);
|
|
5567
|
+
const dismissToast = (0, import_react2.useCallback)(
|
|
5568
|
+
(id) => {
|
|
5569
|
+
if (id !== void 0) {
|
|
5570
|
+
removeToast(id);
|
|
5571
|
+
} else {
|
|
5572
|
+
timersRef.current.forEach((timer) => clearTimeout(timer));
|
|
5573
|
+
timersRef.current.clear();
|
|
5574
|
+
setToasts([]);
|
|
5575
|
+
}
|
|
5576
|
+
},
|
|
5577
|
+
[removeToast]
|
|
5578
|
+
);
|
|
5579
|
+
const loadingToast = (0, import_react2.useCallback)(
|
|
5580
|
+
(title, options = {}) => {
|
|
5581
|
+
return addToast(title, { ...options, isLoading: true });
|
|
5582
|
+
},
|
|
5583
|
+
[addToast]
|
|
5584
|
+
);
|
|
5585
|
+
const contextValue = (0, import_react2.useMemo)(() => {
|
|
5586
|
+
const fn = (title, options) => {
|
|
5587
|
+
return addToast(title, options);
|
|
5588
|
+
};
|
|
5589
|
+
fn.loading = loadingToast;
|
|
5590
|
+
fn.update = updateToast;
|
|
5591
|
+
fn.dismiss = dismissToast;
|
|
5592
|
+
fn.promise = (promise, messages, options = {}) => {
|
|
5593
|
+
const id = loadingToast(messages.loading, options);
|
|
5594
|
+
return promise.then(
|
|
5595
|
+
(data) => {
|
|
5596
|
+
const title = typeof messages.success === "function" ? messages.success(data) : messages.success;
|
|
5597
|
+
updateToast(id, { title, color: "success", isLoading: false });
|
|
5598
|
+
return data;
|
|
5599
|
+
},
|
|
5600
|
+
(err) => {
|
|
5601
|
+
const title = typeof messages.error === "function" ? messages.error(err) : messages.error;
|
|
5602
|
+
updateToast(id, { title, color: "danger", isLoading: false });
|
|
5603
|
+
throw err;
|
|
5604
|
+
}
|
|
5605
|
+
);
|
|
5606
|
+
};
|
|
5607
|
+
return fn;
|
|
5608
|
+
}, [addToast, loadingToast, updateToast, dismissToast]);
|
|
5484
5609
|
(0, import_react2.useEffect)(() => {
|
|
5485
5610
|
var _a;
|
|
5486
5611
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ToastProvider,
|
|
4
4
|
useToast
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-RY5VVXQ4.mjs";
|
|
6
6
|
import "../../chunk-ZOTHPHXA.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-2URJGQFC.mjs";
|
|
8
8
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-6AID2NLT.mjs";
|
|
10
|
+
import "../../chunk-P5L4YI54.mjs";
|
|
11
11
|
import "../../chunk-27Y6K5NK.mjs";
|
|
12
12
|
import "../../chunk-E3G5QXSH.mjs";
|
|
13
13
|
import "../../chunk-U4DJHAM5.mjs";
|
|
@@ -2093,6 +2093,39 @@ var template = {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
);
|
|
2095
2095
|
},
|
|
2096
|
+
"new-window": ({ className }) => {
|
|
2097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2098
|
+
"svg",
|
|
2099
|
+
{
|
|
2100
|
+
width: "24",
|
|
2101
|
+
height: "24",
|
|
2102
|
+
viewBox: "0 0 24 24",
|
|
2103
|
+
fill: "none",
|
|
2104
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2105
|
+
className,
|
|
2106
|
+
children: [
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2108
|
+
"path",
|
|
2109
|
+
{
|
|
2110
|
+
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",
|
|
2111
|
+
stroke: "currentColor",
|
|
2112
|
+
strokeLinecap: "round",
|
|
2113
|
+
strokeLinejoin: "round"
|
|
2114
|
+
}
|
|
2115
|
+
),
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2117
|
+
"path",
|
|
2118
|
+
{
|
|
2119
|
+
d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
|
|
2120
|
+
stroke: "currentColor",
|
|
2121
|
+
strokeLinecap: "round",
|
|
2122
|
+
strokeLinejoin: "round"
|
|
2123
|
+
}
|
|
2124
|
+
)
|
|
2125
|
+
]
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
},
|
|
2096
2129
|
// ----------------------------------- old ---------------------------------
|
|
2097
2130
|
// ** Status **
|
|
2098
2131
|
"plus-circle": ({ className, fill }) => {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "../../chunk-MBLZYQCN.mjs";
|
|
3
3
|
import {
|
|
4
4
|
tree_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-GDHLN463.mjs";
|
|
6
6
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-6AID2NLT.mjs";
|
|
8
|
+
import "../../chunk-P5L4YI54.mjs";
|
|
9
9
|
import "../../chunk-27Y6K5NK.mjs";
|
|
10
10
|
import "../../chunk-U4DJHAM5.mjs";
|
|
11
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
@@ -2093,6 +2093,39 @@ var template = {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
);
|
|
2095
2095
|
},
|
|
2096
|
+
"new-window": ({ className }) => {
|
|
2097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2098
|
+
"svg",
|
|
2099
|
+
{
|
|
2100
|
+
width: "24",
|
|
2101
|
+
height: "24",
|
|
2102
|
+
viewBox: "0 0 24 24",
|
|
2103
|
+
fill: "none",
|
|
2104
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2105
|
+
className,
|
|
2106
|
+
children: [
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2108
|
+
"path",
|
|
2109
|
+
{
|
|
2110
|
+
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",
|
|
2111
|
+
stroke: "currentColor",
|
|
2112
|
+
strokeLinecap: "round",
|
|
2113
|
+
strokeLinejoin: "round"
|
|
2114
|
+
}
|
|
2115
|
+
),
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2117
|
+
"path",
|
|
2118
|
+
{
|
|
2119
|
+
d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
|
|
2120
|
+
stroke: "currentColor",
|
|
2121
|
+
strokeLinecap: "round",
|
|
2122
|
+
strokeLinejoin: "round"
|
|
2123
|
+
}
|
|
2124
|
+
)
|
|
2125
|
+
]
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
},
|
|
2096
2129
|
// ----------------------------------- old ---------------------------------
|
|
2097
2130
|
// ** Status **
|
|
2098
2131
|
"plus-circle": ({ className, fill }) => {
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
Tree,
|
|
4
4
|
TreeNodeItem,
|
|
5
5
|
tree_default
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-GDHLN463.mjs";
|
|
7
7
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-6AID2NLT.mjs";
|
|
9
|
+
import "../../chunk-P5L4YI54.mjs";
|
|
10
10
|
import "../../chunk-27Y6K5NK.mjs";
|
|
11
11
|
import "../../chunk-U4DJHAM5.mjs";
|
|
12
12
|
import "../../chunk-AC6TWLRT.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ export { default as Drawer } from './components/drawer/drawer.mjs';
|
|
|
27
27
|
export { default as List } from './components/list/list.mjs';
|
|
28
28
|
export { default as ListItem, ListItemProps } from './components/list/listItem.mjs';
|
|
29
29
|
export { default as Toast } from './components/toast/toast.mjs';
|
|
30
|
-
export { ToastProvider, useToast } from './components/toast/use-toast.mjs';
|
|
30
|
+
export { CreateToastOptions, ToastFunction, ToastId, ToastPromiseMessages, ToastProvider, useToast } from './components/toast/use-toast.mjs';
|
|
31
31
|
export { default as Day } from './components/picker/day.mjs';
|
|
32
32
|
export { default as DatePicker, DatePickerProps, DateRangeValue, DateValue } from './components/picker/datePicker.mjs';
|
|
33
33
|
export { default as TimePicker, TimePickerProps } from './components/picker/timePicker/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export { default as Drawer } from './components/drawer/drawer.js';
|
|
|
27
27
|
export { default as List } from './components/list/list.js';
|
|
28
28
|
export { default as ListItem, ListItemProps } from './components/list/listItem.js';
|
|
29
29
|
export { default as Toast } from './components/toast/toast.js';
|
|
30
|
-
export { ToastProvider, useToast } from './components/toast/use-toast.js';
|
|
30
|
+
export { CreateToastOptions, ToastFunction, ToastId, ToastPromiseMessages, ToastProvider, useToast } from './components/toast/use-toast.js';
|
|
31
31
|
export { default as Day } from './components/picker/day.js';
|
|
32
32
|
export { default as DatePicker, DatePickerProps, DateRangeValue, DateValue } from './components/picker/datePicker.js';
|
|
33
33
|
export { default as TimePicker, TimePickerProps } from './components/picker/timePicker/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2796,6 +2796,39 @@ var template = {
|
|
|
2796
2796
|
}
|
|
2797
2797
|
);
|
|
2798
2798
|
},
|
|
2799
|
+
"new-window": ({ className }) => {
|
|
2800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2801
|
+
"svg",
|
|
2802
|
+
{
|
|
2803
|
+
width: "24",
|
|
2804
|
+
height: "24",
|
|
2805
|
+
viewBox: "0 0 24 24",
|
|
2806
|
+
fill: "none",
|
|
2807
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2808
|
+
className,
|
|
2809
|
+
children: [
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2811
|
+
"path",
|
|
2812
|
+
{
|
|
2813
|
+
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",
|
|
2814
|
+
stroke: "currentColor",
|
|
2815
|
+
strokeLinecap: "round",
|
|
2816
|
+
strokeLinejoin: "round"
|
|
2817
|
+
}
|
|
2818
|
+
),
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2820
|
+
"path",
|
|
2821
|
+
{
|
|
2822
|
+
d: "M13.5 4.5H19.5V10.5M19.5 4.5L9.75 14.25",
|
|
2823
|
+
stroke: "currentColor",
|
|
2824
|
+
strokeLinecap: "round",
|
|
2825
|
+
strokeLinejoin: "round"
|
|
2826
|
+
}
|
|
2827
|
+
)
|
|
2828
|
+
]
|
|
2829
|
+
}
|
|
2830
|
+
);
|
|
2831
|
+
},
|
|
2799
2832
|
// ----------------------------------- old ---------------------------------
|
|
2800
2833
|
// ** Status **
|
|
2801
2834
|
"plus-circle": ({ className, fill }) => {
|
|
@@ -11240,7 +11273,7 @@ var Toast = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11240
11273
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
11241
11274
|
children: [
|
|
11242
11275
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
11243
|
-
showIcon && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
|
|
11276
|
+
showIcon && (originalProps.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { name: "loading", className: "mt-[2px] animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" })),
|
|
11244
11277
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
11245
11278
|
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
|
|
11246
11279
|
] }),
|
|
@@ -11404,27 +11437,119 @@ var ToastProvider = ({
|
|
|
11404
11437
|
const [toasts, setToasts] = (0, import_react34.useState)([]);
|
|
11405
11438
|
const [containerStyle, setContainerStyle] = (0, import_react34.useState)({});
|
|
11406
11439
|
const toastRef = (0, import_react34.useRef)(null);
|
|
11440
|
+
const timersRef = (0, import_react34.useRef)(/* @__PURE__ */ new Map());
|
|
11441
|
+
const startTimer = (0, import_react34.useCallback)((id, duration) => {
|
|
11442
|
+
const existing = timersRef.current.get(id);
|
|
11443
|
+
if (existing) clearTimeout(existing);
|
|
11444
|
+
if (!isFinite(duration) || duration <= 0) {
|
|
11445
|
+
timersRef.current.delete(id);
|
|
11446
|
+
return;
|
|
11447
|
+
}
|
|
11448
|
+
const timer = setTimeout(() => {
|
|
11449
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
11450
|
+
timersRef.current.delete(id);
|
|
11451
|
+
}, duration);
|
|
11452
|
+
timersRef.current.set(id, timer);
|
|
11453
|
+
}, []);
|
|
11454
|
+
const clearTimer = (0, import_react34.useCallback)((id) => {
|
|
11455
|
+
const timer = timersRef.current.get(id);
|
|
11456
|
+
if (timer) {
|
|
11457
|
+
clearTimeout(timer);
|
|
11458
|
+
timersRef.current.delete(id);
|
|
11459
|
+
}
|
|
11460
|
+
}, []);
|
|
11461
|
+
(0, import_react34.useEffect)(() => {
|
|
11462
|
+
const timers = timersRef.current;
|
|
11463
|
+
return () => {
|
|
11464
|
+
timers.forEach((timer) => clearTimeout(timer));
|
|
11465
|
+
timers.clear();
|
|
11466
|
+
};
|
|
11467
|
+
}, []);
|
|
11407
11468
|
const addToast = (0, import_react34.useCallback)(
|
|
11408
11469
|
(title, options = {}) => {
|
|
11470
|
+
var _a, _b;
|
|
11409
11471
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
11472
|
+
const duration = options.isLoading ? Infinity : (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
|
|
11410
11473
|
const newToast = {
|
|
11474
|
+
...globalOptions,
|
|
11475
|
+
...options,
|
|
11411
11476
|
id,
|
|
11412
11477
|
title,
|
|
11413
|
-
duration
|
|
11414
|
-
...globalOptions,
|
|
11415
|
-
...options
|
|
11478
|
+
duration
|
|
11416
11479
|
};
|
|
11417
11480
|
setToasts((prev) => [...prev, newToast]);
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
}, newToast.duration || 3e3);
|
|
11481
|
+
startTimer(id, duration);
|
|
11482
|
+
return id;
|
|
11421
11483
|
},
|
|
11422
|
-
[globalOptions]
|
|
11484
|
+
[globalOptions, startTimer]
|
|
11423
11485
|
);
|
|
11424
|
-
const removeToast = (0, import_react34.useCallback)(
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11486
|
+
const removeToast = (0, import_react34.useCallback)(
|
|
11487
|
+
(id) => {
|
|
11488
|
+
clearTimer(id);
|
|
11489
|
+
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
11490
|
+
},
|
|
11491
|
+
[clearTimer]
|
|
11492
|
+
);
|
|
11493
|
+
const updateToast = (0, import_react34.useCallback)(
|
|
11494
|
+
(id, options) => {
|
|
11495
|
+
setToasts(
|
|
11496
|
+
(prev) => prev.map((t) => {
|
|
11497
|
+
var _a, _b;
|
|
11498
|
+
if (t.id !== id) return t;
|
|
11499
|
+
const updated = { ...t, ...options };
|
|
11500
|
+
if (t.isLoading && options.isLoading === false) {
|
|
11501
|
+
const duration = (_b = (_a = options.duration) != null ? _a : globalOptions == null ? void 0 : globalOptions.duration) != null ? _b : 3e3;
|
|
11502
|
+
updated.duration = duration;
|
|
11503
|
+
startTimer(id, duration);
|
|
11504
|
+
}
|
|
11505
|
+
return updated;
|
|
11506
|
+
})
|
|
11507
|
+
);
|
|
11508
|
+
},
|
|
11509
|
+
[globalOptions == null ? void 0 : globalOptions.duration, startTimer]
|
|
11510
|
+
);
|
|
11511
|
+
const dismissToast = (0, import_react34.useCallback)(
|
|
11512
|
+
(id) => {
|
|
11513
|
+
if (id !== void 0) {
|
|
11514
|
+
removeToast(id);
|
|
11515
|
+
} else {
|
|
11516
|
+
timersRef.current.forEach((timer) => clearTimeout(timer));
|
|
11517
|
+
timersRef.current.clear();
|
|
11518
|
+
setToasts([]);
|
|
11519
|
+
}
|
|
11520
|
+
},
|
|
11521
|
+
[removeToast]
|
|
11522
|
+
);
|
|
11523
|
+
const loadingToast = (0, import_react34.useCallback)(
|
|
11524
|
+
(title, options = {}) => {
|
|
11525
|
+
return addToast(title, { ...options, isLoading: true });
|
|
11526
|
+
},
|
|
11527
|
+
[addToast]
|
|
11528
|
+
);
|
|
11529
|
+
const contextValue = (0, import_react34.useMemo)(() => {
|
|
11530
|
+
const fn = (title, options) => {
|
|
11531
|
+
return addToast(title, options);
|
|
11532
|
+
};
|
|
11533
|
+
fn.loading = loadingToast;
|
|
11534
|
+
fn.update = updateToast;
|
|
11535
|
+
fn.dismiss = dismissToast;
|
|
11536
|
+
fn.promise = (promise, messages, options = {}) => {
|
|
11537
|
+
const id = loadingToast(messages.loading, options);
|
|
11538
|
+
return promise.then(
|
|
11539
|
+
(data) => {
|
|
11540
|
+
const title = typeof messages.success === "function" ? messages.success(data) : messages.success;
|
|
11541
|
+
updateToast(id, { title, color: "success", isLoading: false });
|
|
11542
|
+
return data;
|
|
11543
|
+
},
|
|
11544
|
+
(err) => {
|
|
11545
|
+
const title = typeof messages.error === "function" ? messages.error(err) : messages.error;
|
|
11546
|
+
updateToast(id, { title, color: "danger", isLoading: false });
|
|
11547
|
+
throw err;
|
|
11548
|
+
}
|
|
11549
|
+
);
|
|
11550
|
+
};
|
|
11551
|
+
return fn;
|
|
11552
|
+
}, [addToast, loadingToast, updateToast, dismissToast]);
|
|
11428
11553
|
(0, import_react34.useEffect)(() => {
|
|
11429
11554
|
var _a;
|
|
11430
11555
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|