@krosoft/react 0.0.115 → 0.0.116
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/dist/hooks/behavior/index.d.ts +5 -0
- package/dist/hooks/behavior/index.d.ts.map +1 -0
- package/dist/hooks/behavior/index.js +6 -0
- package/dist/hooks/index.d.ts +2 -13
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +17 -119
- package/dist/hooks/ui/index.d.ts +10 -0
- package/dist/hooks/ui/index.d.ts.map +1 -0
- package/dist/hooks/ui/index.js +15 -0
- package/dist/useConfirmDeleteDialog-BOb3XFpz.js +75 -0
- package/dist/useServerTable-UvTY6L1N.js +38 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/behavior/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export { useDataTable } from "./ui/useDataTable";
|
|
4
|
-
export { useDialog } from "./behavior/useDialog";
|
|
5
|
-
export type { DialogState } from "./behavior/useDialog";
|
|
6
|
-
export { useMobile } from "./ui/useMobile";
|
|
7
|
-
export { useNotifications } from "./ui/useNotifications";
|
|
8
|
-
export type { UseNotificationsResult } from "./ui/useNotifications";
|
|
9
|
-
export { useServerTable } from "./ui/useServerTable";
|
|
10
|
-
export type { UseServerTableResult } from "./ui/useServerTable";
|
|
11
|
-
export { useTheme } from "./ui/useTheme";
|
|
12
|
-
export type { ThemeOption } from "./ui/useTheme";
|
|
13
|
-
export { toast, useToast } from "./ui/useToast";
|
|
1
|
+
export * from "./behavior";
|
|
2
|
+
export * from "./ui";
|
|
14
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,121 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { t as
|
|
8
|
-
/**
|
|
9
|
-
* @license lucide-react v1.17.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
const z = [
|
|
15
|
-
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
16
|
-
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
17
|
-
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
18
|
-
], N = k("trash", z), v = (o) => {
|
|
19
|
-
const [t, e] = i(null), s = (n, l) => {
|
|
20
|
-
var c;
|
|
21
|
-
(c = o == null ? void 0 : o.onReset) == null || c.call(o), e({ id: n, name: l });
|
|
22
|
-
}, a = () => {
|
|
23
|
-
e(null);
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
id: (t == null ? void 0 : t.id) ?? null,
|
|
27
|
-
name: (t == null ? void 0 : t.name) ?? null,
|
|
28
|
-
isOpen: !!t,
|
|
29
|
-
openDialog: s,
|
|
30
|
-
onClose: a
|
|
31
|
-
};
|
|
32
|
-
}, F = ({
|
|
33
|
-
titleKey: o,
|
|
34
|
-
descriptionKey: t,
|
|
35
|
-
confirmKey: e = "Confirmer",
|
|
36
|
-
onConfirm: s,
|
|
37
|
-
onReset: a
|
|
38
|
-
}) => {
|
|
39
|
-
const n = v({ onReset: a }), l = async () => {
|
|
40
|
-
if (n.id)
|
|
41
|
-
try {
|
|
42
|
-
await s(n.id), n.onClose();
|
|
43
|
-
} catch (c) {
|
|
44
|
-
console.error("Error confirming action:", c);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
isOpen: n.isOpen,
|
|
49
|
-
itemName: n.name,
|
|
50
|
-
title: o,
|
|
51
|
-
description: t,
|
|
52
|
-
confirmKey: e,
|
|
53
|
-
openDialog: n.openDialog,
|
|
54
|
-
onClose: n.onClose,
|
|
55
|
-
onConfirm: l
|
|
56
|
-
};
|
|
57
|
-
}, w = ({
|
|
58
|
-
titleKey: o,
|
|
59
|
-
descriptionKey: t,
|
|
60
|
-
confirmKey: e = "Supprimer",
|
|
61
|
-
onConfirm: s,
|
|
62
|
-
onReset: a
|
|
63
|
-
}) => ({
|
|
64
|
-
...F({
|
|
65
|
-
titleKey: o,
|
|
66
|
-
descriptionKey: t,
|
|
67
|
-
confirmKey: e,
|
|
68
|
-
onConfirm: s,
|
|
69
|
-
onReset: a
|
|
70
|
-
}),
|
|
71
|
-
loadingKey: "Suppression...",
|
|
72
|
-
icon: N,
|
|
73
|
-
titleClassName: "flex items-center gap-2 text-destructive",
|
|
74
|
-
headerClassName: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-lg shrink-0"
|
|
75
|
-
});
|
|
76
|
-
function E(o, t = "nom", e = {}) {
|
|
77
|
-
const [s, a] = i(e.initialPage ?? 1), [n, l] = i(e.initialPageSize ?? 10), [c, h] = i(t), [m, d] = i(e.initialSortDirection ?? "asc"), [g, C] = i(e.initialSearchText ?? ""), [f, S] = i(e.initialSearchText ?? ""), [x, D] = i(o);
|
|
78
|
-
M(() => {
|
|
79
|
-
const r = setTimeout(() => {
|
|
80
|
-
S(g);
|
|
81
|
-
}, e.debounceMs ?? 300);
|
|
82
|
-
return () => {
|
|
83
|
-
clearTimeout(r);
|
|
84
|
-
};
|
|
85
|
-
}, [g, e.debounceMs]);
|
|
86
|
-
const T = u((r) => {
|
|
87
|
-
C(r), a(1);
|
|
88
|
-
}, []), b = u((r) => {
|
|
89
|
-
D(r), a(1);
|
|
90
|
-
}, []), p = u((r, y) => {
|
|
91
|
-
h(r), d(y);
|
|
92
|
-
}, []), P = u((r) => {
|
|
93
|
-
l(r), a(1);
|
|
94
|
-
}, []);
|
|
95
|
-
return {
|
|
96
|
-
currentPage: s,
|
|
97
|
-
onPageChange: a,
|
|
98
|
-
pageSize: n,
|
|
99
|
-
onPageSizeChange: P,
|
|
100
|
-
sortColumn: c,
|
|
101
|
-
sortDirection: m,
|
|
102
|
-
onSortChange: p,
|
|
103
|
-
searchText: g,
|
|
104
|
-
debouncedSearchText: f,
|
|
105
|
-
onSearchChange: T,
|
|
106
|
-
appliedFilters: x,
|
|
107
|
-
onFiltersChange: b
|
|
108
|
-
};
|
|
109
|
-
}
|
|
1
|
+
import { u as a, a as s, b as r } from "../useConfirmDeleteDialog-BOb3XFpz.js";
|
|
2
|
+
import { u } from "../useDataTable-CxcA5S-s.js";
|
|
3
|
+
import { u as i } from "../useMobile-DN1_OMDB.js";
|
|
4
|
+
import { u as l } from "../useNotifications-zbUhCvF_.js";
|
|
5
|
+
import { u as x } from "../useServerTable-UvTY6L1N.js";
|
|
6
|
+
import { u as b } from "../useTheme-B0Bxda3I.js";
|
|
7
|
+
import { t as T, u as g } from "../useToast-BFTk4lWz.js";
|
|
110
8
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
9
|
+
T as toast,
|
|
10
|
+
a as useConfirmDeleteDialog,
|
|
11
|
+
s as useConfirmationDialog,
|
|
12
|
+
u as useDataTable,
|
|
13
|
+
r as useDialog,
|
|
14
|
+
i as useMobile,
|
|
15
|
+
l as useNotifications,
|
|
16
|
+
x as useServerTable,
|
|
17
|
+
b as useTheme,
|
|
18
|
+
g as useToast
|
|
121
19
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useDataTable } from "./useDataTable";
|
|
2
|
+
export { useMobile } from "./useMobile";
|
|
3
|
+
export { useNotifications } from "./useNotifications";
|
|
4
|
+
export type { UseNotificationsResult } from "./useNotifications";
|
|
5
|
+
export { useServerTable } from "./useServerTable";
|
|
6
|
+
export type { UseServerTableResult } from "./useServerTable";
|
|
7
|
+
export { useTheme } from "./useTheme";
|
|
8
|
+
export type { ThemeOption } from "./useTheme";
|
|
9
|
+
export { toast, useToast } from "./useToast";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { u as s } from "../../useDataTable-CxcA5S-s.js";
|
|
2
|
+
import { u as r } from "../../useMobile-DN1_OMDB.js";
|
|
3
|
+
import { u } from "../../useNotifications-zbUhCvF_.js";
|
|
4
|
+
import { u as m } from "../../useServerTable-UvTY6L1N.js";
|
|
5
|
+
import { u as x } from "../../useTheme-B0Bxda3I.js";
|
|
6
|
+
import { t as T, u as b } from "../../useToast-BFTk4lWz.js";
|
|
7
|
+
export {
|
|
8
|
+
T as toast,
|
|
9
|
+
s as useDataTable,
|
|
10
|
+
r as useMobile,
|
|
11
|
+
u as useNotifications,
|
|
12
|
+
m as useServerTable,
|
|
13
|
+
x as useTheme,
|
|
14
|
+
b as useToast
|
|
15
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useState as l } from "react";
|
|
2
|
+
import { c } from "./createLucideIcon-MP_wDWjs.js";
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v1.17.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
const m = [
|
|
10
|
+
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
11
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
12
|
+
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
13
|
+
], u = c("trash", m), d = (o) => {
|
|
14
|
+
const [e, i] = l(null), t = (n, s) => {
|
|
15
|
+
var r;
|
|
16
|
+
(r = o == null ? void 0 : o.onReset) == null || r.call(o), i({ id: n, name: s });
|
|
17
|
+
}, a = () => {
|
|
18
|
+
i(null);
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
id: (e == null ? void 0 : e.id) ?? null,
|
|
22
|
+
name: (e == null ? void 0 : e.name) ?? null,
|
|
23
|
+
isOpen: !!e,
|
|
24
|
+
openDialog: t,
|
|
25
|
+
onClose: a
|
|
26
|
+
};
|
|
27
|
+
}, g = ({
|
|
28
|
+
titleKey: o,
|
|
29
|
+
descriptionKey: e,
|
|
30
|
+
confirmKey: i = "Confirmer",
|
|
31
|
+
onConfirm: t,
|
|
32
|
+
onReset: a
|
|
33
|
+
}) => {
|
|
34
|
+
const n = d({ onReset: a }), s = async () => {
|
|
35
|
+
if (n.id)
|
|
36
|
+
try {
|
|
37
|
+
await t(n.id), n.onClose();
|
|
38
|
+
} catch (r) {
|
|
39
|
+
console.error("Error confirming action:", r);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
isOpen: n.isOpen,
|
|
44
|
+
itemName: n.name,
|
|
45
|
+
title: o,
|
|
46
|
+
description: e,
|
|
47
|
+
confirmKey: i,
|
|
48
|
+
openDialog: n.openDialog,
|
|
49
|
+
onClose: n.onClose,
|
|
50
|
+
onConfirm: s
|
|
51
|
+
};
|
|
52
|
+
}, C = ({
|
|
53
|
+
titleKey: o,
|
|
54
|
+
descriptionKey: e,
|
|
55
|
+
confirmKey: i = "Supprimer",
|
|
56
|
+
onConfirm: t,
|
|
57
|
+
onReset: a
|
|
58
|
+
}) => ({
|
|
59
|
+
...g({
|
|
60
|
+
titleKey: o,
|
|
61
|
+
descriptionKey: e,
|
|
62
|
+
confirmKey: i,
|
|
63
|
+
onConfirm: t,
|
|
64
|
+
onReset: a
|
|
65
|
+
}),
|
|
66
|
+
loadingKey: "Suppression...",
|
|
67
|
+
icon: u,
|
|
68
|
+
titleClassName: "flex items-center gap-2 text-destructive",
|
|
69
|
+
headerClassName: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-lg shrink-0"
|
|
70
|
+
});
|
|
71
|
+
export {
|
|
72
|
+
g as a,
|
|
73
|
+
d as b,
|
|
74
|
+
C as u
|
|
75
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState as n, useEffect as M, useCallback as r } from "react";
|
|
2
|
+
function p(i, s = "nom", t = {}) {
|
|
3
|
+
const [o, a] = n(t.initialPage ?? 1), [h, l] = n(t.initialPageSize ?? 10), [S, g] = n(s), [u, C] = n(t.initialSortDirection ?? "asc"), [c, d] = n(t.initialSearchText ?? ""), [T, P] = n(t.initialSearchText ?? ""), [m, x] = n(i);
|
|
4
|
+
M(() => {
|
|
5
|
+
const e = setTimeout(() => {
|
|
6
|
+
P(c);
|
|
7
|
+
}, t.debounceMs ?? 300);
|
|
8
|
+
return () => {
|
|
9
|
+
clearTimeout(e);
|
|
10
|
+
};
|
|
11
|
+
}, [c, t.debounceMs]);
|
|
12
|
+
const b = r((e) => {
|
|
13
|
+
d(e), a(1);
|
|
14
|
+
}, []), z = r((e) => {
|
|
15
|
+
x(e), a(1);
|
|
16
|
+
}, []), f = r((e, F) => {
|
|
17
|
+
g(e), C(F);
|
|
18
|
+
}, []), D = r((e) => {
|
|
19
|
+
l(e), a(1);
|
|
20
|
+
}, []);
|
|
21
|
+
return {
|
|
22
|
+
currentPage: o,
|
|
23
|
+
onPageChange: a,
|
|
24
|
+
pageSize: h,
|
|
25
|
+
onPageSizeChange: D,
|
|
26
|
+
sortColumn: S,
|
|
27
|
+
sortDirection: u,
|
|
28
|
+
onSortChange: f,
|
|
29
|
+
searchText: c,
|
|
30
|
+
debouncedSearchText: T,
|
|
31
|
+
onSearchChange: b,
|
|
32
|
+
appliedFilters: m,
|
|
33
|
+
onFiltersChange: z
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
p as u
|
|
38
|
+
};
|