@deepnoid/ui 0.1.222 → 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 +154 -154
- package/dist/{chunk-YMXYJUOP.mjs → chunk-2URJGQFC.mjs} +1 -1
- package/dist/chunk-RY5VVXQ4.mjs +163 -0
- package/dist/components/table/index.mjs +2 -2
- package/dist/components/table/table-body.mjs +2 -2
- package/dist/components/table/table-head.mjs +2 -2
- package/dist/components/table/table.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 +104 -12
- package/dist/components/toast/index.mjs +2 -2
- package/dist/components/toast/toast.d.mts +1 -0
- package/dist/components/toast/toast.d.ts +1 -0
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast/toast.mjs +1 -1
- 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 +104 -12
- package/dist/components/toast/use-toast.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +104 -12
- package/dist/index.mjs +12 -12
- package/package.json +2 -1
- package/dist/chunk-6S6PH233.mjs +0 -71
- package/dist/{chunk-DQHNPDVN.mjs → chunk-Q3KBMVJS.mjs} +3 -3
|
@@ -5368,7 +5368,7 @@ var Toast = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5368
5368
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
5369
5369
|
children: [
|
|
5370
5370
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
5371
|
-
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]" })),
|
|
5372
5372
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
5373
5373
|
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
|
|
5374
5374
|
] }),
|
|
@@ -5493,27 +5493,119 @@ var ToastProvider = ({
|
|
|
5493
5493
|
const [toasts, setToasts] = (0, import_react2.useState)([]);
|
|
5494
5494
|
const [containerStyle, setContainerStyle] = (0, import_react2.useState)({});
|
|
5495
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
|
+
}, []);
|
|
5496
5524
|
const addToast = (0, import_react2.useCallback)(
|
|
5497
5525
|
(title, options = {}) => {
|
|
5526
|
+
var _a, _b;
|
|
5498
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;
|
|
5499
5529
|
const newToast = {
|
|
5530
|
+
...globalOptions,
|
|
5531
|
+
...options,
|
|
5500
5532
|
id,
|
|
5501
5533
|
title,
|
|
5502
|
-
duration
|
|
5503
|
-
...globalOptions,
|
|
5504
|
-
...options
|
|
5534
|
+
duration
|
|
5505
5535
|
};
|
|
5506
5536
|
setToasts((prev) => [...prev, newToast]);
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
}, newToast.duration || 3e3);
|
|
5537
|
+
startTimer(id, duration);
|
|
5538
|
+
return id;
|
|
5510
5539
|
},
|
|
5511
|
-
[globalOptions]
|
|
5540
|
+
[globalOptions, startTimer]
|
|
5512
5541
|
);
|
|
5513
|
-
const removeToast = (0, import_react2.useCallback)(
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
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]);
|
|
5517
5609
|
(0, import_react2.useEffect)(() => {
|
|
5518
5610
|
var _a;
|
|
5519
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,9 +2,9 @@
|
|
|
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
9
|
import "../../chunk-6AID2NLT.mjs";
|
|
10
10
|
import "../../chunk-P5L4YI54.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
|
@@ -11273,7 +11273,7 @@ var Toast = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11273
11273
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
11274
11274
|
children: [
|
|
11275
11275
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
11276
|
-
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]" })),
|
|
11277
11277
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
11278
11278
|
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
|
|
11279
11279
|
] }),
|
|
@@ -11437,27 +11437,119 @@ var ToastProvider = ({
|
|
|
11437
11437
|
const [toasts, setToasts] = (0, import_react34.useState)([]);
|
|
11438
11438
|
const [containerStyle, setContainerStyle] = (0, import_react34.useState)({});
|
|
11439
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
|
+
}, []);
|
|
11440
11468
|
const addToast = (0, import_react34.useCallback)(
|
|
11441
11469
|
(title, options = {}) => {
|
|
11470
|
+
var _a, _b;
|
|
11442
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;
|
|
11443
11473
|
const newToast = {
|
|
11474
|
+
...globalOptions,
|
|
11475
|
+
...options,
|
|
11444
11476
|
id,
|
|
11445
11477
|
title,
|
|
11446
|
-
duration
|
|
11447
|
-
...globalOptions,
|
|
11448
|
-
...options
|
|
11478
|
+
duration
|
|
11449
11479
|
};
|
|
11450
11480
|
setToasts((prev) => [...prev, newToast]);
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
}, newToast.duration || 3e3);
|
|
11481
|
+
startTimer(id, duration);
|
|
11482
|
+
return id;
|
|
11454
11483
|
},
|
|
11455
|
-
[globalOptions]
|
|
11484
|
+
[globalOptions, startTimer]
|
|
11456
11485
|
);
|
|
11457
|
-
const removeToast = (0, import_react34.useCallback)(
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
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]);
|
|
11461
11553
|
(0, import_react34.useEffect)(() => {
|
|
11462
11554
|
var _a;
|
|
11463
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;
|
package/dist/index.mjs
CHANGED
|
@@ -21,11 +21,11 @@ import "./chunk-LUWGOKLG.mjs";
|
|
|
21
21
|
import {
|
|
22
22
|
ToastProvider,
|
|
23
23
|
useToast
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RY5VVXQ4.mjs";
|
|
25
25
|
import "./chunk-ZOTHPHXA.mjs";
|
|
26
26
|
import {
|
|
27
27
|
toast_default
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-2URJGQFC.mjs";
|
|
29
29
|
import "./chunk-LVFI2NOH.mjs";
|
|
30
30
|
import {
|
|
31
31
|
switch_default
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-BH3I4LIZ.mjs";
|
|
37
37
|
import {
|
|
38
38
|
table_default
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-Q3KBMVJS.mjs";
|
|
40
40
|
import "./chunk-QCEKPS7U.mjs";
|
|
41
41
|
import {
|
|
42
42
|
select_default
|
|
@@ -88,11 +88,15 @@ import {
|
|
|
88
88
|
import {
|
|
89
89
|
modal_default
|
|
90
90
|
} from "./chunk-EVJ46M3U.mjs";
|
|
91
|
-
import "./chunk-QZ3LVYJW.mjs";
|
|
92
91
|
import "./chunk-MGEWSREV.mjs";
|
|
92
|
+
import "./chunk-QZ3LVYJW.mjs";
|
|
93
93
|
import {
|
|
94
|
-
|
|
95
|
-
} from "./chunk-
|
|
94
|
+
checkbox_default
|
|
95
|
+
} from "./chunk-3DCUMRYP.mjs";
|
|
96
|
+
import "./chunk-32GA3YW4.mjs";
|
|
97
|
+
import {
|
|
98
|
+
drawer_default
|
|
99
|
+
} from "./chunk-ZFC5O2V3.mjs";
|
|
96
100
|
import "./chunk-RLXOHILK.mjs";
|
|
97
101
|
import {
|
|
98
102
|
fileUpload_default
|
|
@@ -105,10 +109,6 @@ import "./chunk-2GCSFWHD.mjs";
|
|
|
105
109
|
import {
|
|
106
110
|
input_default
|
|
107
111
|
} from "./chunk-EJ4GDC6K.mjs";
|
|
108
|
-
import "./chunk-32GA3YW4.mjs";
|
|
109
|
-
import {
|
|
110
|
-
drawer_default
|
|
111
|
-
} from "./chunk-ZFC5O2V3.mjs";
|
|
112
112
|
import "./chunk-3OCNT22V.mjs";
|
|
113
113
|
import {
|
|
114
114
|
areaChart_default
|
|
@@ -131,8 +131,8 @@ import {
|
|
|
131
131
|
simpleBarChart_default
|
|
132
132
|
} from "./chunk-6WD32ERF.mjs";
|
|
133
133
|
import {
|
|
134
|
-
|
|
135
|
-
} from "./chunk-
|
|
134
|
+
chip_default
|
|
135
|
+
} from "./chunk-V2YH54JQ.mjs";
|
|
136
136
|
import "./chunk-SE5TU755.mjs";
|
|
137
137
|
import {
|
|
138
138
|
backdrop_default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepnoid/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.223",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"copy:font": "copyfiles -u 2 src/fonts/**/* dist/fonts",
|
|
23
23
|
"deploy:npm": "npm publish --access=public",
|
|
24
24
|
"lint": "TIMING=1 eslint \"**/*.{ts,tsx,js,jsx}\" --fix",
|
|
25
|
+
"check-types": "tsc --noEmit",
|
|
25
26
|
"publish:npm": "npm version patch --no-git-tag-version && npm publish --access=public"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
package/dist/chunk-6S6PH233.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
getToastPosition
|
|
4
|
-
} from "./chunk-ZOTHPHXA.mjs";
|
|
5
|
-
import {
|
|
6
|
-
toast_default
|
|
7
|
-
} from "./chunk-YMXYJUOP.mjs";
|
|
8
|
-
|
|
9
|
-
// src/components/toast/use-toast.tsx
|
|
10
|
-
import { createContext, useContext, useState, useCallback, useEffect, useRef } from "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
var ToastContext = createContext(null);
|
|
13
|
-
var useToast = () => {
|
|
14
|
-
const context = useContext(ToastContext);
|
|
15
|
-
if (!context) {
|
|
16
|
-
throw new Error("useToast must be used within a ToastProvider");
|
|
17
|
-
}
|
|
18
|
-
return context;
|
|
19
|
-
};
|
|
20
|
-
var ToastProvider = ({
|
|
21
|
-
globalOptions,
|
|
22
|
-
children
|
|
23
|
-
}) => {
|
|
24
|
-
const [toasts, setToasts] = useState([]);
|
|
25
|
-
const [containerStyle, setContainerStyle] = useState({});
|
|
26
|
-
const toastRef = useRef(null);
|
|
27
|
-
const addToast = useCallback(
|
|
28
|
-
(title, options = {}) => {
|
|
29
|
-
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
30
|
-
const newToast = {
|
|
31
|
-
id,
|
|
32
|
-
title,
|
|
33
|
-
duration: 3e3,
|
|
34
|
-
...globalOptions,
|
|
35
|
-
...options
|
|
36
|
-
};
|
|
37
|
-
setToasts((prev) => [...prev, newToast]);
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
|
|
40
|
-
}, newToast.duration || 3e3);
|
|
41
|
-
},
|
|
42
|
-
[globalOptions]
|
|
43
|
-
);
|
|
44
|
-
const removeToast = useCallback((id) => {
|
|
45
|
-
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
|
|
46
|
-
}, []);
|
|
47
|
-
const contextValue = addToast;
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
var _a;
|
|
50
|
-
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
51
|
-
const offset = 20;
|
|
52
|
-
const placement = (globalOptions == null ? void 0 : globalOptions.placement) || "bottom-right";
|
|
53
|
-
const { top, left, bottom, right } = getToastPosition(placement, width, offset);
|
|
54
|
-
setContainerStyle({
|
|
55
|
-
position: "fixed",
|
|
56
|
-
top: top !== void 0 ? `${top}px` : void 0,
|
|
57
|
-
left: left !== void 0 ? `${left}px` : void 0,
|
|
58
|
-
bottom: bottom !== void 0 ? `${bottom}px` : void 0,
|
|
59
|
-
right: right !== void 0 ? `${right}px` : void 0
|
|
60
|
-
});
|
|
61
|
-
}, [globalOptions == null ? void 0 : globalOptions.placement, globalOptions == null ? void 0 : globalOptions.width]);
|
|
62
|
-
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: contextValue, children: [
|
|
63
|
-
children,
|
|
64
|
-
/* @__PURE__ */ jsx("div", { id: "deepnoid-toast-container", className: "flex flex-col gap-[10px]", style: containerStyle, children: toasts.map((toast) => /* @__PURE__ */ jsx(toast_default, { ref: toastRef, onClose: () => removeToast(toast.id), ...toast }, toast.id)) })
|
|
65
|
-
] });
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
useToast,
|
|
70
|
-
ToastProvider
|
|
71
|
-
};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
pagination_default
|
|
4
4
|
} from "./chunk-TE5JU3WA.mjs";
|
|
5
|
-
import {
|
|
6
|
-
scrollArea_default
|
|
7
|
-
} from "./chunk-EWS3FESG.mjs";
|
|
8
5
|
import {
|
|
9
6
|
checkbox_default
|
|
10
7
|
} from "./chunk-3DCUMRYP.mjs";
|
|
8
|
+
import {
|
|
9
|
+
scrollArea_default
|
|
10
|
+
} from "./chunk-EWS3FESG.mjs";
|
|
11
11
|
import {
|
|
12
12
|
clsx
|
|
13
13
|
} from "./chunk-27Y6K5NK.mjs";
|