@krosoft/react 0.0.72 → 0.0.74
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/DateRangePicker-BAn4LMHi.js +1237 -0
- package/dist/KpiCards-Bp6EAsf7.js +40 -0
- package/dist/ThemeSelector-DQmkKmzE.js +49 -0
- package/dist/Topbar-CFALRIJn.js +168 -0
- package/dist/{badge-Cj2EQgcL.js → badge-C4pCH7IL.js} +1 -1
- package/dist/calendar-cHag6u-j.js +3942 -0
- package/dist/components/core/cards/KpiCards.d.ts.map +1 -1
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.d.ts.map +1 -1
- package/dist/components/core/index.js +13 -10
- package/dist/components/core/inputs/DateRangePicker.d.ts +10 -0
- package/dist/components/core/inputs/DateRangePicker.d.ts.map +1 -0
- package/dist/components/core/inputs/index.d.ts +2 -0
- package/dist/components/core/inputs/index.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +3 -2
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/theme/ThemeSelector.d.ts +8 -0
- package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -0
- package/dist/components/core/theme/index.d.ts +3 -0
- package/dist/components/core/theme/index.d.ts.map +1 -0
- package/dist/components/core/theme/index.js +4 -0
- package/dist/components/index.js +47 -34
- package/dist/components/ui/calendar.d.ts +9 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +29 -19
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +16 -112
- package/dist/hooks/ui/useTheme.d.ts +20 -0
- package/dist/hooks/ui/useTheme.d.ts.map +1 -0
- package/dist/index-BQOmHRsD.js +1662 -0
- package/dist/select-Dv9bdUCB.js +2023 -0
- package/dist/tooltip-Dep8OR3c.js +779 -0
- package/dist/useTheme-D__o7mLN.js +122 -0
- package/package.json +12 -2
- package/dist/KpiCards-D4Cy8CLT.js +0 -38
- package/dist/SearchInput-LIey3bo9.js +0 -46
- package/dist/Topbar-CtXJ337W.js +0 -2314
- package/dist/index-BNCR478R.js +0 -272
- package/dist/toast-B6CC_ory.js +0 -856
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { useTheme as _ } from "next-themes";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
const I = 1, O = 1e6;
|
|
4
|
+
let i = 0;
|
|
5
|
+
function D() {
|
|
6
|
+
return i = (i + 1) % Number.MAX_SAFE_INTEGER, i.toString();
|
|
7
|
+
}
|
|
8
|
+
const S = /* @__PURE__ */ new Map(), h = (s) => {
|
|
9
|
+
if (S.has(s))
|
|
10
|
+
return;
|
|
11
|
+
const e = setTimeout(() => {
|
|
12
|
+
S.delete(s), c({
|
|
13
|
+
type: "REMOVE_TOAST",
|
|
14
|
+
toastId: s
|
|
15
|
+
});
|
|
16
|
+
}, O);
|
|
17
|
+
S.set(s, e);
|
|
18
|
+
}, v = (s, e) => {
|
|
19
|
+
switch (e.type) {
|
|
20
|
+
case "ADD_TOAST":
|
|
21
|
+
return {
|
|
22
|
+
...s,
|
|
23
|
+
toasts: [e.toast, ...s.toasts].slice(0, I)
|
|
24
|
+
};
|
|
25
|
+
case "UPDATE_TOAST":
|
|
26
|
+
return {
|
|
27
|
+
...s,
|
|
28
|
+
toasts: s.toasts.map((t) => t.id === e.toast.id ? { ...t, ...e.toast } : t)
|
|
29
|
+
};
|
|
30
|
+
case "DISMISS_TOAST": {
|
|
31
|
+
const { toastId: t } = e;
|
|
32
|
+
return t ? h(t) : s.toasts.forEach((o) => {
|
|
33
|
+
h(o.id);
|
|
34
|
+
}), {
|
|
35
|
+
...s,
|
|
36
|
+
toasts: s.toasts.map(
|
|
37
|
+
(o) => o.id === t || t === void 0 ? {
|
|
38
|
+
...o,
|
|
39
|
+
open: !1
|
|
40
|
+
} : o
|
|
41
|
+
)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
case "REMOVE_TOAST":
|
|
45
|
+
return e.toastId === void 0 ? {
|
|
46
|
+
...s,
|
|
47
|
+
toasts: []
|
|
48
|
+
} : {
|
|
49
|
+
...s,
|
|
50
|
+
toasts: s.toasts.filter((t) => t.id !== e.toastId)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, a = [];
|
|
54
|
+
let u = { toasts: [] };
|
|
55
|
+
function c(s) {
|
|
56
|
+
u = v(u, s), a.forEach((e) => {
|
|
57
|
+
e(u);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function d({ ...s }) {
|
|
61
|
+
const e = D(), t = (n) => c({
|
|
62
|
+
type: "UPDATE_TOAST",
|
|
63
|
+
toast: { ...n, id: e }
|
|
64
|
+
}), o = () => c({ type: "DISMISS_TOAST", toastId: e });
|
|
65
|
+
return c({
|
|
66
|
+
type: "ADD_TOAST",
|
|
67
|
+
toast: {
|
|
68
|
+
...s,
|
|
69
|
+
id: e,
|
|
70
|
+
open: !0,
|
|
71
|
+
onOpenChange: (n) => {
|
|
72
|
+
n || o();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}), {
|
|
76
|
+
id: e,
|
|
77
|
+
dismiss: o,
|
|
78
|
+
update: t
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function x() {
|
|
82
|
+
const [s, e] = l.useState(u);
|
|
83
|
+
return l.useEffect(() => (a.push(e), () => {
|
|
84
|
+
const t = a.indexOf(e);
|
|
85
|
+
t > -1 && a.splice(t, 1);
|
|
86
|
+
}), [s]), {
|
|
87
|
+
...s,
|
|
88
|
+
toast: d,
|
|
89
|
+
dismiss: (t) => c({ type: "DISMISS_TOAST", toastId: t })
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const y = () => ({
|
|
93
|
+
showSuccess: (t, o, n) => {
|
|
94
|
+
d({ title: t, description: o, action: n });
|
|
95
|
+
},
|
|
96
|
+
showError: (t, o, n) => {
|
|
97
|
+
console.error(o, n), d({ title: t, description: o, variant: "destructive" });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
function R(s) {
|
|
101
|
+
const { showSuccess: e } = y(), { theme: t, setTheme: o } = _(), n = (r) => {
|
|
102
|
+
o(r);
|
|
103
|
+
const T = s.find((p) => p.value === r);
|
|
104
|
+
e("Thème mis à jour", `Le thème a été changé vers ${(T == null ? void 0 : T.label) ?? r}.`);
|
|
105
|
+
}, m = s.find((r) => r.value === t), A = s.findIndex((r) => r.value === t), f = s[(A + 1) % s.length], E = (t == null ? void 0 : t.startsWith("dark")) ?? !1;
|
|
106
|
+
return {
|
|
107
|
+
theme: t,
|
|
108
|
+
setTheme: o,
|
|
109
|
+
handleThemeChange: n,
|
|
110
|
+
themeOptions: s,
|
|
111
|
+
currentThemeOption: m,
|
|
112
|
+
nextThemeOption: f,
|
|
113
|
+
isDark: E,
|
|
114
|
+
cycleTheme: () => n(f.value)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
y as a,
|
|
119
|
+
x as b,
|
|
120
|
+
d as t,
|
|
121
|
+
R as u
|
|
122
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krosoft/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"description": "Krosoft shared React package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -31,18 +31,27 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@krosoft/core": ">=0.0.1",
|
|
34
|
+
"next-themes": ">=0.4.0",
|
|
34
35
|
"react": ">=18.3.1",
|
|
35
36
|
"react-i18next": ">=17.0.8"
|
|
36
37
|
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"next-themes": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
37
43
|
"dependencies": {
|
|
38
44
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
39
|
-
"@radix-ui/react-separator": "^1.1.8",
|
|
40
45
|
"@radix-ui/react-popover": "^1.1.15",
|
|
46
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
47
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
41
48
|
"@radix-ui/react-toast": "^1.2.15",
|
|
42
49
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
43
50
|
"class-variance-authority": "^0.7.1",
|
|
44
51
|
"clsx": "^2.1.1",
|
|
52
|
+
"date-fns": "^4.2.1",
|
|
45
53
|
"lucide-react": "^1.16.0",
|
|
54
|
+
"react-day-picker": "^10.0.1",
|
|
46
55
|
"tailwind-merge": "^2.6.1"
|
|
47
56
|
},
|
|
48
57
|
"devDependencies": {
|
|
@@ -57,6 +66,7 @@
|
|
|
57
66
|
"@types/react": "^18.3.29",
|
|
58
67
|
"autoprefixer": "^10.5.0",
|
|
59
68
|
"jsdom": "^26.1.0",
|
|
69
|
+
"next-themes": "^0.4.6",
|
|
60
70
|
"prettier": "^3.8.3",
|
|
61
71
|
"react": "^18.3.1",
|
|
62
72
|
"react-dom": "^18.3.1",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { C as p, f, g as u, c as N } from "./toast-B6CC_ory.js";
|
|
3
|
-
import "./index-BNCR478R.js";
|
|
4
|
-
import { c as a } from "./index-gWiv5-6R.js";
|
|
5
|
-
import C from "react";
|
|
6
|
-
import { formatNumber as x } from "@krosoft/core/helpers";
|
|
7
|
-
import { useTranslation as g } from "react-i18next";
|
|
8
|
-
const h = ({ titleKey: s, value: e, valueClassName: m, icon: l, iconClassName: t, description: c, descriptionClassName: d, onClick: o }) => {
|
|
9
|
-
const { t: n } = g();
|
|
10
|
-
return /* @__PURE__ */ i(p, { className: a(o ? "hover:border-primary cursor-pointer" : ""), onClick: o, children: [
|
|
11
|
-
/* @__PURE__ */ i(f, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
12
|
-
/* @__PURE__ */ r(u, { className: "text-sm font-medium", children: n(s) }),
|
|
13
|
-
C.createElement(l, {
|
|
14
|
-
className: a("size-6 text-muted-foreground", t)
|
|
15
|
-
})
|
|
16
|
-
] }),
|
|
17
|
-
/* @__PURE__ */ i(N, { children: [
|
|
18
|
-
/* @__PURE__ */ r("div", { className: a("text-2xl font-bold", m), children: x(e) }),
|
|
19
|
-
/* @__PURE__ */ r("p", { className: a("text-xs text-muted-foreground", d), children: c })
|
|
20
|
-
] })
|
|
21
|
-
] });
|
|
22
|
-
}, _ = ({ stats: s }) => /* @__PURE__ */ r("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: s.map((e) => /* @__PURE__ */ r(
|
|
23
|
-
h,
|
|
24
|
-
{
|
|
25
|
-
titleKey: e.titleKey,
|
|
26
|
-
value: e.value,
|
|
27
|
-
valueClassName: e.valueClassName,
|
|
28
|
-
icon: e.icon,
|
|
29
|
-
iconClassName: e.iconClassName,
|
|
30
|
-
description: e.description,
|
|
31
|
-
descriptionClassName: e.descriptionClassName
|
|
32
|
-
},
|
|
33
|
-
e.titleKey
|
|
34
|
-
)) });
|
|
35
|
-
export {
|
|
36
|
-
h as K,
|
|
37
|
-
_ as a
|
|
38
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { I as p, X as h } from "./toast-B6CC_ory.js";
|
|
3
|
-
import "./index-BNCR478R.js";
|
|
4
|
-
import { c as f } from "./index-gWiv5-6R.js";
|
|
5
|
-
import { c as d } from "./createLucideIcon-CRdjzt2A.js";
|
|
6
|
-
/**
|
|
7
|
-
* @license lucide-react v1.16.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
const y = [
|
|
13
|
-
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
14
|
-
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
15
|
-
], x = d("search", y), w = ({
|
|
16
|
-
searchQuery: s,
|
|
17
|
-
search: n,
|
|
18
|
-
placeholder: l = "Rechercher...",
|
|
19
|
-
onSearch: r,
|
|
20
|
-
onSubmit: a,
|
|
21
|
-
onClear: c,
|
|
22
|
-
className: i
|
|
23
|
-
}) => {
|
|
24
|
-
const o = s || n || "", m = () => {
|
|
25
|
-
r(""), c && c();
|
|
26
|
-
};
|
|
27
|
-
return /* @__PURE__ */ u("div", { className: f("relative h-fit w-full md:w-64", i), children: [
|
|
28
|
-
/* @__PURE__ */ t(x, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
|
|
29
|
-
/* @__PURE__ */ t(
|
|
30
|
-
p,
|
|
31
|
-
{
|
|
32
|
-
placeholder: l,
|
|
33
|
-
value: o,
|
|
34
|
-
onChange: (e) => r(e.target.value),
|
|
35
|
-
className: "pl-8",
|
|
36
|
-
onKeyDown: (e) => {
|
|
37
|
-
e.key === "Enter" && a && (e.preventDefault(), a());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
o && /* @__PURE__ */ t("button", { onClick: m, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ t(h, { className: "size-4" }) })
|
|
42
|
-
] });
|
|
43
|
-
};
|
|
44
|
-
export {
|
|
45
|
-
w as S
|
|
46
|
-
};
|