@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.
Files changed (45) hide show
  1. package/dist/DateRangePicker-BAn4LMHi.js +1237 -0
  2. package/dist/KpiCards-Bp6EAsf7.js +40 -0
  3. package/dist/ThemeSelector-DQmkKmzE.js +49 -0
  4. package/dist/Topbar-CFALRIJn.js +168 -0
  5. package/dist/{badge-Cj2EQgcL.js → badge-C4pCH7IL.js} +1 -1
  6. package/dist/calendar-cHag6u-j.js +3942 -0
  7. package/dist/components/core/cards/KpiCards.d.ts.map +1 -1
  8. package/dist/components/core/cards/index.js +1 -1
  9. package/dist/components/core/index.d.ts +1 -0
  10. package/dist/components/core/index.d.ts.map +1 -1
  11. package/dist/components/core/index.js +13 -10
  12. package/dist/components/core/inputs/DateRangePicker.d.ts +10 -0
  13. package/dist/components/core/inputs/DateRangePicker.d.ts.map +1 -0
  14. package/dist/components/core/inputs/index.d.ts +2 -0
  15. package/dist/components/core/inputs/index.d.ts.map +1 -1
  16. package/dist/components/core/inputs/index.js +3 -2
  17. package/dist/components/core/navbar/index.js +1 -1
  18. package/dist/components/core/theme/ThemeSelector.d.ts +8 -0
  19. package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -0
  20. package/dist/components/core/theme/index.d.ts +3 -0
  21. package/dist/components/core/theme/index.d.ts.map +1 -0
  22. package/dist/components/core/theme/index.js +4 -0
  23. package/dist/components/index.js +47 -34
  24. package/dist/components/ui/calendar.d.ts +9 -0
  25. package/dist/components/ui/calendar.d.ts.map +1 -0
  26. package/dist/components/ui/index.d.ts +3 -0
  27. package/dist/components/ui/index.d.ts.map +1 -1
  28. package/dist/components/ui/index.js +29 -19
  29. package/dist/components/ui/select.d.ts +14 -0
  30. package/dist/components/ui/select.d.ts.map +1 -0
  31. package/dist/hooks/index.d.ts +2 -0
  32. package/dist/hooks/index.d.ts.map +1 -1
  33. package/dist/hooks/index.js +16 -112
  34. package/dist/hooks/ui/useTheme.d.ts +20 -0
  35. package/dist/hooks/ui/useTheme.d.ts.map +1 -0
  36. package/dist/index-BQOmHRsD.js +1662 -0
  37. package/dist/select-Dv9bdUCB.js +2023 -0
  38. package/dist/tooltip-Dep8OR3c.js +779 -0
  39. package/dist/useTheme-D__o7mLN.js +122 -0
  40. package/package.json +12 -2
  41. package/dist/KpiCards-D4Cy8CLT.js +0 -38
  42. package/dist/SearchInput-LIey3bo9.js +0 -46
  43. package/dist/Topbar-CtXJ337W.js +0 -2314
  44. package/dist/index-BNCR478R.js +0 -272
  45. package/dist/toast-B6CC_ory.js +0 -856
@@ -0,0 +1,40 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { c as p, g as f, h as u, d as C } from "./calendar-cHag6u-j.js";
3
+ import "./index-BQOmHRsD.js";
4
+ import { c as a } from "./index-gWiv5-6R.js";
5
+ import "./select-Dv9bdUCB.js";
6
+ import N from "react";
7
+ import { formatNumber as x } from "@krosoft/core/helpers";
8
+ import { useTranslation as h } from "react-i18next";
9
+ const g = ({ titleKey: i, value: e, valueClassName: l, icon: m, iconClassName: c, description: t, descriptionClassName: n, onClick: o }) => {
10
+ const { t: d } = h();
11
+ return /* @__PURE__ */ s(p, { className: a(o ? "hover:border-primary cursor-pointer" : ""), onClick: o, children: [
12
+ /* @__PURE__ */ s(f, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
13
+ /* @__PURE__ */ r(u, { className: "text-sm font-medium", children: d(i) }),
14
+ N.createElement(m, {
15
+ className: a("size-6 text-muted-foreground", c)
16
+ })
17
+ ] }),
18
+ /* @__PURE__ */ s(C, { children: [
19
+ /* @__PURE__ */ r("div", { className: a("text-2xl font-bold", l), children: x(e) }),
20
+ /* @__PURE__ */ r("p", { className: a("text-xs text-muted-foreground", n), children: t })
21
+ ] })
22
+ ] });
23
+ }, k = ({ stats: i }) => /* @__PURE__ */ r("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: i.map((e) => /* @__PURE__ */ r(
24
+ g,
25
+ {
26
+ titleKey: e.titleKey,
27
+ value: e.value,
28
+ valueClassName: e.valueClassName,
29
+ icon: e.icon,
30
+ iconClassName: e.iconClassName,
31
+ description: e.description,
32
+ descriptionClassName: e.descriptionClassName,
33
+ onClick: e.onClick
34
+ },
35
+ e.titleKey
36
+ )) });
37
+ export {
38
+ g as K,
39
+ k as a
40
+ };
@@ -0,0 +1,49 @@
1
+ import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
+ import { B as m } from "./index-BQOmHRsD.js";
3
+ import { S as h, f as u, g, a as f, c as v } from "./select-Dv9bdUCB.js";
4
+ import { T as b, a as N, b as S, c as x } from "./tooltip-Dep8OR3c.js";
5
+ import { u as C } from "./useTheme-D__o7mLN.js";
6
+ function j({ themeOptions: c, variant: t = "select" }) {
7
+ const { theme: n, handleThemeChange: o, currentThemeOption: e, nextThemeOption: r, cycleTheme: i } = C(c);
8
+ if (t === "mini") {
9
+ const l = e == null ? void 0 : e.icon;
10
+ return /* @__PURE__ */ a(b, { children: /* @__PURE__ */ s(N, { children: [
11
+ /* @__PURE__ */ a(S, { asChild: !0, children: /* @__PURE__ */ s(
12
+ m,
13
+ {
14
+ variant: "ghost",
15
+ size: "icon",
16
+ onClick: i,
17
+ className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
18
+ children: [
19
+ l && /* @__PURE__ */ a(l, { className: "h-4 w-4" }),
20
+ /* @__PURE__ */ s("span", { className: "sr-only", children: [
21
+ "Thème actuel : ",
22
+ e == null ? void 0 : e.label
23
+ ] })
24
+ ]
25
+ }
26
+ ) }),
27
+ /* @__PURE__ */ s(x, { side: "bottom", align: "center", children: [
28
+ "Passer en ",
29
+ r == null ? void 0 : r.label
30
+ ] })
31
+ ] }) });
32
+ }
33
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
34
+ /* @__PURE__ */ s(h, { value: n, onValueChange: o, children: [
35
+ /* @__PURE__ */ a(u, { className: "w-full", children: /* @__PURE__ */ a(g, { placeholder: "Sélectionner un thème" }) }),
36
+ /* @__PURE__ */ a(f, { children: c.map((l) => {
37
+ const d = l.icon;
38
+ return /* @__PURE__ */ a(v, { value: l.value, children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
39
+ /* @__PURE__ */ a(d, { className: "h-4 w-4" }),
40
+ l.label
41
+ ] }) }, l.value);
42
+ }) })
43
+ ] }),
44
+ (e == null ? void 0 : e.message) && /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: e.message })
45
+ ] });
46
+ }
47
+ export {
48
+ j as T
49
+ };
@@ -0,0 +1,168 @@
1
+ import { jsxs as i, jsx as e, Fragment as y } from "react/jsx-runtime";
2
+ import { a as k, b as C, c as j, T } from "./tooltip-Dep8OR3c.js";
3
+ import { c as l } from "./index-gWiv5-6R.js";
4
+ import * as z from "react";
5
+ import { C as S, B as D } from "./index-BQOmHRsD.js";
6
+ import { c as W } from "./createLucideIcon-CRdjzt2A.js";
7
+ /**
8
+ * @license lucide-react v1.16.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+ const $ = [
14
+ ["path", { d: "M4 5h16", key: "1tepv9" }],
15
+ ["path", { d: "M4 12h16", key: "1lakjw" }],
16
+ ["path", { d: "M4 19h16", key: "1djgab" }]
17
+ ], A = W("menu", $), O = ({
18
+ path: t,
19
+ // eslint-disable-next-line @typescript-eslint/naming-convention
20
+ icon: n,
21
+ label: h,
22
+ badge: d,
23
+ subItems: a,
24
+ currentPath: s,
25
+ collapsed: o,
26
+ onItemClick: m
27
+ }) => {
28
+ const [f, x] = z.useState((a == null ? void 0 : a.some((r) => s === r.path || s.startsWith(`${r.path}/`))) || !1), p = t ? s === t || t !== "/" && s.startsWith(`${t}/`) : !1, b = a == null ? void 0 : a.some((r) => s === r.path || s.startsWith(`${r.path}/`)), g = /* @__PURE__ */ i(
29
+ "a",
30
+ {
31
+ href: t || "#",
32
+ onClick: (r) => {
33
+ r.preventDefault(), a && a.length > 0 ? o || x(!f) : t && m(t);
34
+ },
35
+ className: l(
36
+ "flex items-center gap-3 rounded-2xl cursor-pointer mb-2 transition-all duration-200 group",
37
+ o ? "justify-center p-3 h-12 w-12 mx-auto" : "px-4 py-3 h-12",
38
+ p || !o && b ? "bg-sidebar-primary text-sidebar-primary-foreground shadow-lg" : "hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"
39
+ ),
40
+ children: [
41
+ /* @__PURE__ */ e("div", { className: l("flex-shrink-0 transition-transform group-hover:scale-110", o ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(n, { className: "size-4" }) }),
42
+ !o && /* @__PURE__ */ i(y, { children: [
43
+ /* @__PURE__ */ e("span", { className: "flex-grow transition-opacity duration-150 font-medium", children: h }),
44
+ d !== void 0 && /* @__PURE__ */ e("span", { className: "bg-red-500 text-white text-xs rounded-full py-1 min-w-[20px] text-center px-2 font-semibold", children: d }),
45
+ a && a.length > 0 && /* @__PURE__ */ e(S, { className: l("size-4 transition-transform duration-200", f ? "rotate-180" : "") })
46
+ ] })
47
+ ]
48
+ }
49
+ );
50
+ return /* @__PURE__ */ i(y, { children: [
51
+ o ? /* @__PURE__ */ i(k, { children: [
52
+ /* @__PURE__ */ e(C, { asChild: !0, children: g }),
53
+ /* @__PURE__ */ e(
54
+ j,
55
+ {
56
+ side: "right",
57
+ sideOffset: 6,
58
+ className: "rounded-xl z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
59
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
60
+ /* @__PURE__ */ e("p", { className: "font-semibold", children: h }),
61
+ d !== void 0 && /* @__PURE__ */ i("span", { className: "ml-1 text-xs", children: [
62
+ "(",
63
+ d,
64
+ ")"
65
+ ] })
66
+ ] }) })
67
+ }
68
+ )
69
+ ] }) : g,
70
+ !o && a && a.length > 0 && f && /* @__PURE__ */ e("div", { className: "flex flex-col gap-1 mb-2 ml-4 pl-4 border-l-2 border-sidebar-border/50 animate-in slide-in-from-top-2 fade-in duration-200", children: a.map((r, v) => {
71
+ const u = s === r.path || r.path !== "/" && s.startsWith(`${r.path}/`);
72
+ return /* @__PURE__ */ i(
73
+ "a",
74
+ {
75
+ href: r.path,
76
+ onClick: (w) => {
77
+ w.preventDefault(), m(r.path);
78
+ },
79
+ className: l(
80
+ "flex items-center justify-between px-4 py-2 rounded-xl text-sm transition-all duration-200",
81
+ u ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
82
+ ),
83
+ children: [
84
+ /* @__PURE__ */ e("span", { children: r.label }),
85
+ r.badge !== void 0 && /* @__PURE__ */ e("span", { className: "bg-sidebar-primary/20 text-sidebar-primary text-[10px] rounded-full py-0.5 px-2 font-semibold", children: r.badge })
86
+ ]
87
+ },
88
+ v
89
+ );
90
+ }) })
91
+ ] });
92
+ }, R = ({
93
+ groups: t,
94
+ collapsed: n,
95
+ mobileOpen: h,
96
+ isMobile: d,
97
+ onMobileClose: a,
98
+ onItemClick: s,
99
+ currentPath: o,
100
+ appName: m = "appname",
101
+ appSubName: f = "appsubname",
102
+ appIcon: x,
103
+ headerNode: p,
104
+ footerNode: b
105
+ }) => {
106
+ const N = (c) => {
107
+ s(c), d && a();
108
+ };
109
+ return /* @__PURE__ */ e(T, { delayDuration: 0, children: /* @__PURE__ */ i(
110
+ "aside",
111
+ {
112
+ className: l(
113
+ "flex flex-col bg-sidebar h-screen transition-all duration-300",
114
+ n ? "w-[--navbar-width-icon]" : "w-[--navbar-width]",
115
+ d && !h ? "hidden" : "flex"
116
+ ),
117
+ style: {
118
+ "--navbar-width": "16rem",
119
+ "--navbar-width-icon": "5rem"
120
+ },
121
+ children: [
122
+ p || /* @__PURE__ */ i("div", { className: l("flex items-center h-16 md:h-20 flex-shrink-0 gap-3 px-4", n ? "justify-center" : ""), children: [
123
+ x !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(x, { className: "size-6" }) }),
124
+ !n && /* @__PURE__ */ i("div", { className: "flex flex-col", children: [
125
+ /* @__PURE__ */ e("h1", { className: "font-bold text-lg text-sidebar-foreground leading-tight", children: m }),
126
+ /* @__PURE__ */ e("span", { className: "text-xs text-sidebar-muted font-medium", children: f })
127
+ ] })
128
+ ] }),
129
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto py-4 px-2 scrollbar-modern", children: t.map((c, g) => /* @__PURE__ */ i("div", { className: "mb-6", children: [
130
+ !n && c.title !== void 0 && c.title !== "" && /* @__PURE__ */ e("h3", { className: "px-4 mb-2 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", children: c.title }),
131
+ /* @__PURE__ */ e("nav", { className: "flex flex-col gap-1", children: c.items.map((r, v) => /* @__PURE__ */ e(O, { ...r, currentPath: o, collapsed: n, onItemClick: N }, v)) })
132
+ ] }, g)) }),
133
+ b && /* @__PURE__ */ e("div", { className: l("p-4 border-t border-sidebar-border", n ? "flex justify-center" : ""), children: b })
134
+ ]
135
+ }
136
+ ) });
137
+ }, q = ({ collapsed: t, isMobile: n, onToggleSidebar: h, actionsNode: d, userMenuNode: a }) => /* @__PURE__ */ i(
138
+ "header",
139
+ {
140
+ className: l(
141
+ "fixed top-0 right-0 z-[60] h-16 md:h-20 bg-topbar text-topbar-foreground flex items-center justify-between px-4 transition-all duration-300",
142
+ n && "left-0",
143
+ !n && t && "left-[5rem]",
144
+ !n && !t && "left-[16rem]"
145
+ ),
146
+ tabIndex: -1,
147
+ children: [
148
+ /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
149
+ D,
150
+ {
151
+ variant: "ghost",
152
+ size: "icon",
153
+ onClick: h,
154
+ className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
155
+ children: /* @__PURE__ */ e(A, { className: "size-4" })
156
+ }
157
+ ) }),
158
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
159
+ d,
160
+ a
161
+ ] })
162
+ ]
163
+ }
164
+ );
165
+ export {
166
+ R as S,
167
+ q as T
168
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { c as n } from "./index-BNCR478R.js";
2
+ import { c as n } from "./index-BQOmHRsD.js";
3
3
  import { c as a } from "./index-gWiv5-6R.js";
4
4
  const s = n(
5
5
  "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",