@krosoft/react 0.0.238 → 0.0.240

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 (109) hide show
  1. package/dist/AppActions-C_0YI75w.js +60 -0
  2. package/dist/AppSubTitle-tqqV9nuT.js +19 -0
  3. package/dist/AppTitle-BR4JFZfp.js +19 -0
  4. package/dist/ErrorAlert-BDqDHUUc.js +27 -0
  5. package/dist/GenericForm-CWXT5wiv.js +310 -0
  6. package/dist/ImageInput-CN2ozjpc.js +80 -0
  7. package/dist/MultiSelect-BF0zL0B0.js +134 -0
  8. package/dist/SearchInput-BJPT0SbB.js +255 -0
  9. package/dist/alert-REQGK9bR.js +32 -0
  10. package/dist/behavior-BR_V9Rpe.js +76 -0
  11. package/dist/cards-Cta6x49J.js +126 -0
  12. package/dist/chart-Dq3AIrue.js +166 -0
  13. package/dist/charts-CXhVUqLH.js +328 -0
  14. package/dist/components/core/cards/index.js +2 -10
  15. package/dist/components/core/charts/index.js +2 -11
  16. package/dist/components/core/dialogs/index.js +4 -19
  17. package/dist/components/core/filters/index.js +426 -7
  18. package/dist/components/core/forms/index.js +2 -4
  19. package/dist/components/core/index.js +24 -97
  20. package/dist/components/core/inputs/index.js +4 -11
  21. package/dist/components/core/language/index.js +2 -4
  22. package/dist/components/core/layouts/index.js +50 -11
  23. package/dist/components/core/navbar/index.js +2 -9
  24. package/dist/components/core/states/index.js +3 -8
  25. package/dist/components/core/table/index.js +2 -15
  26. package/dist/components/core/tabs/index.js +188 -6
  27. package/dist/components/core/theme/index.js +2 -4
  28. package/dist/components/index.js +28 -322
  29. package/dist/components/ui/index.js +8 -240
  30. package/dist/contexts/index.js +2 -5
  31. package/dist/dialogs-BGHSClsq.js +208 -0
  32. package/dist/helpers/index.js +39 -46
  33. package/dist/hooks/behavior/index.js +2 -10
  34. package/dist/hooks/index.js +11 -30
  35. package/dist/hooks/ui/index.js +10 -22
  36. package/dist/i18n/index.js +2 -10
  37. package/dist/i18n-Dw99bRmg.js +190 -0
  38. package/dist/language-DxHhlpgN.js +58 -0
  39. package/dist/navbar-Bc5OQWRI.js +385 -0
  40. package/dist/providers/index.js +42 -49
  41. package/dist/pwa/index.js +32 -34
  42. package/dist/select-ULiTPOr5.js +81 -0
  43. package/dist/sheet-CRrYTZrl.js +226 -0
  44. package/dist/sidebar.context-BahtU6hE.js +5 -0
  45. package/dist/skeleton-D6Ga4BLw.js +11 -0
  46. package/dist/states-N8-LjFng.js +26 -0
  47. package/dist/table-muUyiaK6.js +571 -0
  48. package/dist/tailwind/index.js +126 -156
  49. package/dist/tailwind.helper-CJaRYBmL.js +8 -0
  50. package/dist/theme-B_n0F6R4.js +57 -0
  51. package/dist/tokens/index.js +37 -46
  52. package/dist/tooltip-B2dzyfs9.js +50 -0
  53. package/dist/types/forms/index.js +0 -1
  54. package/dist/types/index.js +1 -1
  55. package/dist/ui-CiX0E_bn.js +1165 -0
  56. package/dist/ui-DSVBO3iM.js +46 -0
  57. package/dist/useDocumentTitle-D7MywIeB.js +19 -0
  58. package/dist/useFixedColumns-DfAX30tT.js +147 -0
  59. package/dist/useLanguage-DN3CuBv5.js +19 -0
  60. package/dist/useMobile-pTQ8lWvt.js +16 -0
  61. package/dist/useNotifications-CyhTruIG.js +20 -0
  62. package/dist/useScrollFade-D9kqJBDh.js +27 -0
  63. package/dist/useTheme-DVfcJ-Qd.js +25 -0
  64. package/dist/useToast-UeDRLovh.js +103 -0
  65. package/package.json +3 -3
  66. package/dist/AppActions-BFwztl-1.js +0 -76
  67. package/dist/AppSubTitle-BTN0YAc7.js +0 -13
  68. package/dist/AppTitle-D15YXeMx.js +0 -13
  69. package/dist/AppVerticalTabs-B7XXtAVj.js +0 -103
  70. package/dist/ConfirmationDialog-Dj4WdnHg.js +0 -188
  71. package/dist/DataTable-CjrR27Di.js +0 -638
  72. package/dist/ErrorAlert-B99Xb_Hg.js +0 -23
  73. package/dist/ErrorState-CkeS_IBT.js +0 -14
  74. package/dist/GenericForm-CydibLHU.js +0 -343
  75. package/dist/ImageInput-DoOOvvth.js +0 -70
  76. package/dist/KpiCardsLayout-Bq4xQ3i8.js +0 -43
  77. package/dist/LanguageSelector-C7E51rCQ.js +0 -47
  78. package/dist/LoadingState-BN0YaPSs.js +0 -9
  79. package/dist/MetricCard-B0xnFyim.js +0 -53
  80. package/dist/MultiSelect-DbH7LrsD.js +0 -149
  81. package/dist/PieChart-uozNJtEx.js +0 -295
  82. package/dist/SearchInput-DIZ5Yt6L.js +0 -246
  83. package/dist/SkeletonCards-B9C4cNMr.js +0 -75
  84. package/dist/TableFilter-CmEVF5Bo.js +0 -422
  85. package/dist/ThemeSelector-CLi4_epH.js +0 -52
  86. package/dist/Topbar-Clby5_uj.js +0 -431
  87. package/dist/alert-B9F1N9Qk.js +0 -30
  88. package/dist/chart-DntJZGxB.js +0 -181
  89. package/dist/select-BpjFWqAY.js +0 -96
  90. package/dist/sheet-XYI-ezvY.js +0 -292
  91. package/dist/sidebar.context-D5nywlmP.js +0 -6
  92. package/dist/skeleton-BX4RcsiK.js +0 -8
  93. package/dist/tailwind.helper-B6yFEsav.js +0 -8
  94. package/dist/toaster-CyzB1m5z.js +0 -75
  95. package/dist/toggle-group-iZqnrTj7.js +0 -1276
  96. package/dist/tooltip-DVeqVwqV.js +0 -61
  97. package/dist/useDateFnsLocale-D6VExZ8U.js +0 -11
  98. package/dist/useDocumentTitle-WNwdPz-I.js +0 -14
  99. package/dist/useFixedColumns-CKZyu4PD.js +0 -161
  100. package/dist/useKrosoftTranslation-BTp46G94.js +0 -47
  101. package/dist/useLanguage-C9jI2nwn.js +0 -19
  102. package/dist/useMobile-DN1_OMDB.js +0 -16
  103. package/dist/useNotifications-zbUhCvF_.js +0 -12
  104. package/dist/usePage-BQm6tdJD.js +0 -84
  105. package/dist/useScrollFade-BA4KqJYp.js +0 -23
  106. package/dist/useServerTable-UvTY6L1N.js +0 -38
  107. package/dist/useSidebar-BJuALHqQ.js +0 -11
  108. package/dist/useTheme-DS6ZjdzM.js +0 -27
  109. package/dist/useToast-BFTk4lWz.js +0 -100
@@ -1,149 +0,0 @@
1
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import "date-fns/locale";
3
- import "react-i18next";
4
- import { u as O } from "./useKrosoftTranslation-BTp46G94.js";
5
- import { useState as L, useRef as T, useMemo as x, useEffect as z } from "react";
6
- import { E as I } from "./toggle-group-iZqnrTj7.js";
7
- import "./alert-B9F1N9Qk.js";
8
- import "@radix-ui/react-aspect-ratio";
9
- import { f as P } from "./tooltip-DVeqVwqV.js";
10
- import "./chart-DntJZGxB.js";
11
- import "@radix-ui/react-collapsible";
12
- import "./sheet-XYI-ezvY.js";
13
- import { XIcon as q, ChevronDownIcon as S, SearchIcon as F } from "lucide-react";
14
- import "react-resizable-panels";
15
- import { c as R } from "./tailwind.helper-B6yFEsav.js";
16
- import "./select-BpjFWqAY.js";
17
- import "next-themes";
18
- import "sonner";
19
- const ne = ({
20
- options: a,
21
- selected: t,
22
- onToggle: N,
23
- onClear: d,
24
- onSelectAll: u,
25
- placeholder: j,
26
- searchable: m = !1,
27
- searchPlaceholder: D,
28
- disabled: f = !1,
29
- maxCount: p
30
- }) => {
31
- const { t: h } = O(), [c, g] = L(""), [s, k] = L(!1), b = T(null), w = T(null), n = x(() => c === "" ? a : a.filter((e) => e.label.toLowerCase().includes(c.toLowerCase())), [a, c]), y = x(() => n.length === 0 ? !1 : n.every((e) => t.includes(e.value)), [n, t]), v = x(() => t.map((e) => {
32
- var o;
33
- return ((o = a.find((i) => i.value === e)) == null ? void 0 : o.label) ?? e;
34
- }), [a, t]), C = p !== void 0 && p > 0 ? v.slice(0, p) : v, E = v.length - C.length;
35
- z(() => {
36
- s && m && requestAnimationFrame(() => {
37
- var e;
38
- (e = w.current) == null || e.focus();
39
- });
40
- }, [s, m]), z(() => {
41
- if (!s) return;
42
- const e = (o) => {
43
- b.current !== null && !b.current.contains(o.target) && (k(!1), g(""));
44
- };
45
- return document.addEventListener("mousedown", e), () => {
46
- document.removeEventListener("mousedown", e);
47
- };
48
- }, [s]);
49
- const M = () => {
50
- if (y) {
51
- const e = n.map((i) => i.value), o = t.filter((i) => !e.includes(i));
52
- u !== void 0 ? u(o) : d();
53
- } else {
54
- const e = [...t];
55
- n.forEach((o) => {
56
- e.includes(o.value) || e.push(o.value);
57
- }), u !== void 0 ? u(e) : n.forEach((o) => {
58
- t.includes(o.value) || N(o.value);
59
- });
60
- }
61
- };
62
- return /* @__PURE__ */ l("div", { ref: b, className: "relative w-full", children: [
63
- /* @__PURE__ */ l(
64
- "button",
65
- {
66
- type: "button",
67
- disabled: f,
68
- onClick: () => {
69
- f || k((e) => (e && g(""), !e));
70
- },
71
- className: R(P, "w-full", s && "ring-2 ring-ring ring-offset-2", t.length === 0 && "text-muted-foreground"),
72
- children: [
73
- /* @__PURE__ */ r("span", { className: "truncate", children: t.length === 0 ? j ?? h("select.placeholder") : C.join(", ") }),
74
- /* @__PURE__ */ l("div", { className: "flex shrink-0 items-center gap-1", children: [
75
- E > 0 && /* @__PURE__ */ l("span", { className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground", children: [
76
- "+",
77
- E
78
- ] }),
79
- t.length > 0 && !f && /* @__PURE__ */ r(
80
- "span",
81
- {
82
- role: "button",
83
- tabIndex: -1,
84
- onClick: (e) => {
85
- e.stopPropagation();
86
- },
87
- onPointerDown: (e) => {
88
- e.preventDefault(), e.stopPropagation(), d();
89
- },
90
- className: "text-muted-foreground hover:text-foreground",
91
- children: /* @__PURE__ */ r(q, { className: "size-4" })
92
- }
93
- ),
94
- /* @__PURE__ */ r(S, { className: R("size-4 opacity-50 shrink-0 transition-transform", s && "rotate-180") })
95
- ] })
96
- ]
97
- }
98
- ),
99
- s ? /* @__PURE__ */ l("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
100
- m ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ l("div", { className: "relative", children: [
101
- /* @__PURE__ */ r(F, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
102
- /* @__PURE__ */ r(
103
- "input",
104
- {
105
- ref: w,
106
- className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
107
- placeholder: D ?? h("search.placeholder"),
108
- value: c,
109
- onChange: (e) => {
110
- g(e.target.value);
111
- }
112
- }
113
- )
114
- ] }) }) : null,
115
- /* @__PURE__ */ l("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", children: [
116
- n.length > 0 && /* @__PURE__ */ l("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
117
- /* @__PURE__ */ r(I, { checked: y, onCheckedChange: M }),
118
- "Tout sélectionner"
119
- ] }),
120
- n.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: h("states.noResult") }),
121
- n.map((e) => /* @__PURE__ */ l("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
122
- /* @__PURE__ */ r(
123
- I,
124
- {
125
- checked: t.includes(e.value),
126
- onCheckedChange: () => {
127
- N(e.value);
128
- }
129
- }
130
- ),
131
- e.color && /* @__PURE__ */ r("span", { className: "size-2.5 shrink-0 rounded-full", style: { backgroundColor: e.color } }),
132
- e.label
133
- ] }, e.value))
134
- ] }),
135
- t.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
136
- "button",
137
- {
138
- type: "button",
139
- onClick: d,
140
- className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
141
- children: "Tout désélectionner"
142
- }
143
- ) })
144
- ] }) : null
145
- ] });
146
- };
147
- export {
148
- ne as M
149
- };
@@ -1,295 +0,0 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { f as N, j as x, k as y, C as R, d as A, e as V, b as P, a as S, g as B, h as H } from "./chart-DntJZGxB.js";
3
- import { c as C } from "./tailwind.helper-B6yFEsav.js";
4
- import * as v from "react";
5
- import { BarChart as b, CartesianGrid as M, XAxis as w, YAxis as D, Bar as j, LineChart as O, Line as _, PieChart as $, Pie as E } from "recharts";
6
- import "date-fns/locale";
7
- import "react-i18next";
8
- import { u as I } from "./useKrosoftTranslation-BTp46G94.js";
9
- import { S as G } from "./skeleton-BX4RcsiK.js";
10
- import { u as z } from "./useMobile-DN1_OMDB.js";
11
- const L = (t, r) => t ? (n, s) => /* @__PURE__ */ d("div", { className: "flex flex-1 justify-between gap-4", children: [
12
- /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: r ?? String(s) }),
13
- /* @__PURE__ */ e("span", { className: "font-mono font-medium tabular-nums text-foreground", children: t(Number(n)) })
14
- ] }) : void 0, U = (t, r) => r > 0 && t.length > r ? `${t.slice(0, r)}…` : t, ae = ({
15
- data: t,
16
- label: r = "Valeur",
17
- color: a = "hsl(var(--primary))",
18
- categoryWidth: n = 140,
19
- maxLabelLength: s = 22,
20
- valueFormatter: o,
21
- onSelect: c,
22
- className: h
23
- }) => {
24
- const u = v.useMemo(() => ({ value: { label: r, color: a } }), [r, a]), f = v.useMemo(() => L(o, r), [o, r]), i = v.useMemo(
25
- () => t.some((l) => l.color !== void 0) ? t.map((l) => ({ ...l, fill: l.color ?? a })) : t,
26
- [t, a]
27
- );
28
- return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ d(b, { data: i, layout: "vertical", margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
29
- /* @__PURE__ */ e(M, { strokeDasharray: "3 3", horizontal: !1 }),
30
- /* @__PURE__ */ e(
31
- w,
32
- {
33
- type: "number",
34
- dataKey: "value",
35
- allowDecimals: !1,
36
- tickLine: !1,
37
- axisLine: !1,
38
- tickMargin: 8,
39
- tickFormatter: o ? (l) => o(Number(l)) : void 0
40
- }
41
- ),
42
- /* @__PURE__ */ e(
43
- D,
44
- {
45
- type: "category",
46
- dataKey: "name",
47
- width: n,
48
- tickLine: !1,
49
- axisLine: !1,
50
- tickFormatter: (l) => U(String(l), s)
51
- }
52
- ),
53
- /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { formatter: f }) }),
54
- /* @__PURE__ */ e(
55
- j,
56
- {
57
- dataKey: "value",
58
- fill: "var(--color-value)",
59
- radius: [0, 4, 4, 0],
60
- className: c ? "cursor-pointer" : void 0,
61
- onClick: c ? (l, m) => {
62
- c(t[m], m);
63
- } : void 0
64
- }
65
- )
66
- ] }) });
67
- }, se = ({
68
- data: t,
69
- label: r = "Valeur",
70
- color: a = "hsl(var(--primary))",
71
- labelAngle: n,
72
- valueFormatter: s,
73
- allowDecimals: o = !1,
74
- onSelect: c,
75
- className: h
76
- }) => {
77
- const u = v.useMemo(() => ({ value: { label: r, color: a } }), [r, a]), f = v.useMemo(() => L(s, r), [s, r]), i = n !== void 0 && n !== 0, l = v.useMemo(
78
- () => t.some((m) => m.color !== void 0) ? t.map((m) => ({ ...m, fill: m.color ?? a })) : t,
79
- [t, a]
80
- );
81
- return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ d(b, { data: l, margin: { top: 10, right: 10, left: 0, bottom: i ? 20 : 10 }, children: [
82
- /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
83
- /* @__PURE__ */ e(
84
- w,
85
- {
86
- dataKey: "name",
87
- angle: n,
88
- textAnchor: i ? "end" : "middle",
89
- height: i ? 50 : void 0,
90
- tickLine: !1,
91
- axisLine: !1,
92
- tickMargin: 8
93
- }
94
- ),
95
- /* @__PURE__ */ e(
96
- D,
97
- {
98
- allowDecimals: o,
99
- tickLine: !1,
100
- axisLine: !1,
101
- width: s ? 48 : 32,
102
- tickFormatter: s ? (m) => s(Number(m)) : void 0
103
- }
104
- ),
105
- /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { formatter: f }) }),
106
- /* @__PURE__ */ e(
107
- j,
108
- {
109
- dataKey: "value",
110
- fill: "var(--color-value)",
111
- radius: [4, 4, 0, 0],
112
- className: c ? "cursor-pointer" : void 0,
113
- onClick: c ? (m, g) => {
114
- c(t[g], g);
115
- } : void 0
116
- }
117
- )
118
- ] }) });
119
- }, K = [
120
- "hsl(var(--k-chart-1))",
121
- "hsl(var(--k-chart-2))",
122
- "hsl(var(--k-chart-3))",
123
- "hsl(var(--k-chart-4))",
124
- "hsl(var(--k-chart-5))"
125
- ], T = (t) => K[t % K.length], ie = ({
126
- title: t,
127
- description: r,
128
- icon: a,
129
- actions: n,
130
- footer: s,
131
- isLoading: o = !1,
132
- isEmpty: c = !1,
133
- emptyLabel: h,
134
- height: u = 300,
135
- className: f,
136
- contentClassName: i,
137
- children: l
138
- }) => {
139
- const { t: m } = I(), g = a, p = () => o ? /* @__PURE__ */ e(G, { className: "size-full rounded-surface" }) : c ? /* @__PURE__ */ e("div", { className: "flex size-full items-center justify-center", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: h ?? m("states.noData") }) }) : l;
140
- return /* @__PURE__ */ d(R, { className: f, children: [
141
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ d("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
142
- /* @__PURE__ */ d("div", { className: "min-w-0", children: [
143
- /* @__PURE__ */ d(V, { className: "flex items-center gap-2", children: [
144
- g && /* @__PURE__ */ e(g, { className: "size-5 shrink-0" }),
145
- /* @__PURE__ */ e("span", { className: "truncate", children: t })
146
- ] }),
147
- r !== void 0 && r !== "" ? /* @__PURE__ */ e(P, { children: r }) : null
148
- ] }),
149
- n != null ? /* @__PURE__ */ e("div", { className: "shrink-0", children: n }) : null
150
- ] }) }),
151
- /* @__PURE__ */ d(S, { children: [
152
- /* @__PURE__ */ e("div", { className: C("w-full", i), style: u === null ? void 0 : { height: u }, children: p() }),
153
- !o && !c && s !== void 0 && s !== null ? /* @__PURE__ */ e("div", { className: "mt-4", children: s }) : null
154
- ] })
155
- ] });
156
- }, W = { warning: 50, danger: 80 }, X = (t, r) => t >= r.danger ? "hsl(var(--destructive))" : t >= r.warning ? "hsl(var(--k-warning))" : "hsl(var(--k-success))", ne = ({
157
- value: t,
158
- max: r = 100,
159
- size: a = 120,
160
- strokeWidth: n = 8,
161
- label: s,
162
- unit: o = "%",
163
- color: c,
164
- thresholds: h = W,
165
- valueFormatter: u = (i) => i.toFixed(1),
166
- className: f
167
- }) => {
168
- const i = (a - n) / 2, l = i * 2 * Math.PI, m = r > 0 ? Math.min(100, Math.max(0, t / r * 100)) : 0, g = c ?? X(m, h);
169
- return /* @__PURE__ */ d("div", { className: C("flex flex-col items-center gap-2", f), children: [
170
- /* @__PURE__ */ d("div", { className: "relative", style: { width: a, height: a }, children: [
171
- /* @__PURE__ */ d("svg", { width: a, height: a, className: "-rotate-90", children: [
172
- /* @__PURE__ */ e("circle", { cx: a / 2, cy: a / 2, r: i, className: "stroke-muted", strokeWidth: n, fill: "transparent" }),
173
- /* @__PURE__ */ e(
174
- "circle",
175
- {
176
- cx: a / 2,
177
- cy: a / 2,
178
- r: i,
179
- stroke: g,
180
- strokeWidth: n,
181
- fill: "transparent",
182
- strokeDasharray: l,
183
- strokeDashoffset: l - m / 100 * l,
184
- strokeLinecap: "round",
185
- className: "transition-all duration-500 ease-out"
186
- }
187
- )
188
- ] }),
189
- /* @__PURE__ */ d("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
190
- /* @__PURE__ */ e("span", { className: "text-2xl font-bold text-card-foreground", children: u(t) }),
191
- o !== "" && /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: o })
192
- ] })
193
- ] }),
194
- s !== void 0 && s !== "" ? /* @__PURE__ */ e("span", { className: "text-sm font-medium text-muted-foreground", children: s }) : null
195
- ] });
196
- }, oe = ({
197
- data: t,
198
- label: r = "Valeur",
199
- color: a = "hsl(var(--primary))",
200
- yAxisDomain: n,
201
- valueFormatter: s,
202
- labelFormatter: o,
203
- showDots: c = !0,
204
- className: h
205
- }) => {
206
- const u = v.useMemo(() => ({ value: { label: r, color: a } }), [r, a]), f = v.useMemo(() => L(s, r), [s, r]);
207
- return /* @__PURE__ */ e(N, { config: u, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ d(O, { data: t, margin: { top: 10, right: 20, left: 0, bottom: 10 }, children: [
208
- /* @__PURE__ */ e(M, { strokeDasharray: "3 3", vertical: !1 }),
209
- /* @__PURE__ */ e(
210
- w,
211
- {
212
- dataKey: "name",
213
- tickLine: !1,
214
- axisLine: !1,
215
- tickMargin: 8,
216
- interval: "preserveStartEnd",
217
- tickFormatter: o ? (i) => o(String(i)) : void 0
218
- }
219
- ),
220
- /* @__PURE__ */ e(
221
- D,
222
- {
223
- domain: n,
224
- tickLine: !1,
225
- axisLine: !1,
226
- width: s ? 48 : 32,
227
- tickFormatter: s ? (i) => s(Number(i)) : void 0
228
- }
229
- ),
230
- /* @__PURE__ */ e(
231
- x,
232
- {
233
- content: /* @__PURE__ */ e(y, { formatter: f, labelFormatter: o ? (i) => o(String(i)) : void 0 })
234
- }
235
- ),
236
- /* @__PURE__ */ e(
237
- _,
238
- {
239
- type: "monotone",
240
- dataKey: "value",
241
- stroke: "var(--color-value)",
242
- strokeWidth: 2,
243
- dot: c ? { fill: "var(--color-value)", strokeWidth: 0, r: 3 } : !1,
244
- activeDot: { r: 5, strokeWidth: 2, className: "stroke-background" }
245
- }
246
- )
247
- ] }) });
248
- }, le = ({
249
- data: t,
250
- innerRadius: r,
251
- outerRadius: a,
252
- showLegend: n = !0,
253
- showLabels: s = !1,
254
- valueFormatter: o,
255
- onSelect: c,
256
- className: h
257
- }) => {
258
- const u = z(), f = v.useMemo(() => t.map((p, k) => ({ ...p, fill: p.color ?? T(k) })), [t]), i = v.useMemo(
259
- () => Object.fromEntries(t.map((p, k) => [p.name, { label: p.name, color: p.color ?? T(k) }])),
260
- [t]
261
- ), l = v.useMemo(() => L(o), [o]), m = r ?? (u ? 45 : 60), g = a ?? (u ? 80 : 100);
262
- return /* @__PURE__ */ e(N, { config: i, className: C("aspect-auto size-full", h), children: /* @__PURE__ */ d($, { children: [
263
- /* @__PURE__ */ e(x, { content: /* @__PURE__ */ e(y, { nameKey: "name", hideLabel: !0, formatter: l }) }),
264
- /* @__PURE__ */ e(
265
- E,
266
- {
267
- data: f,
268
- dataKey: "value",
269
- nameKey: "name",
270
- cx: "50%",
271
- cy: n ? "45%" : "50%",
272
- innerRadius: m,
273
- outerRadius: g,
274
- paddingAngle: m > 0 ? 2 : 0,
275
- label: s ? ({ name: p, value: k }) => `${String(p)} (${String(k)})` : void 0,
276
- isAnimationActive: !1,
277
- className: C("stroke-background", c && "cursor-pointer"),
278
- onClick: c ? (p, k) => {
279
- c(t[k], k);
280
- } : void 0
281
- }
282
- ),
283
- n && /* @__PURE__ */ e(B, { content: /* @__PURE__ */ e(H, { nameKey: "name", className: "flex-wrap text-muted-foreground" }) })
284
- ] }) });
285
- };
286
- export {
287
- ae as B,
288
- K as C,
289
- oe as L,
290
- le as P,
291
- se as a,
292
- ie as b,
293
- ne as c,
294
- T as g
295
- };
@@ -1,246 +0,0 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import * as M from "react";
3
- import { useState as S, useRef as G, useEffect as X, useMemo as q } from "react";
4
- import { C as j } from "./toggle-group-iZqnrTj7.js";
5
- import "./alert-B9F1N9Qk.js";
6
- import "@radix-ui/react-aspect-ratio";
7
- import { B as v, f as H } from "./tooltip-DVeqVwqV.js";
8
- import "./chart-DntJZGxB.js";
9
- import "@radix-ui/react-collapsible";
10
- import { P as E, s as R, r as _, C as J, m as Q, o as U, k as W, l as Y, n as T, I as Z } from "./sheet-XYI-ezvY.js";
11
- import { CalendarIcon as O, XIcon as I, ChevronDownIcon as ee, CheckIcon as te, PlusIcon as re, SearchIcon as oe } from "lucide-react";
12
- import "react-resizable-panels";
13
- import { c as g } from "./tailwind.helper-B6yFEsav.js";
14
- import "./select-BpjFWqAY.js";
15
- import "next-themes";
16
- import "sonner";
17
- import { format as x } from "date-fns";
18
- import { u as V } from "./useDateFnsLocale-D6VExZ8U.js";
19
- import "react-i18next";
20
- import { u as P } from "./useKrosoftTranslation-BTp46G94.js";
21
- import "date-fns/locale";
22
- const ze = ({ date: r, onDateChange: l, placeholder: p }) => {
23
- const f = V(), [a, c] = S(!1), d = G(null);
24
- X(() => {
25
- if (!a) return;
26
- const s = (h) => {
27
- d.current !== null && !d.current.contains(h.target) && c(!1);
28
- };
29
- return document.addEventListener("mousedown", s), () => {
30
- document.removeEventListener("mousedown", s);
31
- };
32
- }, [a]);
33
- const u = () => {
34
- c((s) => !s);
35
- }, i = (s) => {
36
- l(s), c(!1);
37
- };
38
- return /* @__PURE__ */ o("div", { ref: d, className: "relative w-full", children: [
39
- /* @__PURE__ */ o(
40
- v,
41
- {
42
- variant: "outline",
43
- type: "button",
44
- onClick: u,
45
- className: g(
46
- "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
47
- a && "ring-2 ring-ring ring-offset-2",
48
- r === void 0 && "text-muted-foreground"
49
- ),
50
- children: [
51
- /* @__PURE__ */ e(O, { className: "mr-2 size-4 shrink-0" }),
52
- r !== void 0 ? x(r, "dd/MM/yyyy", { locale: f }) : /* @__PURE__ */ e("span", { children: p })
53
- ]
54
- }
55
- ),
56
- a ? /* @__PURE__ */ e("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ e(j, { mode: "single", locale: f, defaultMonth: r, selected: r, onSelect: i }) }) : null
57
- ] });
58
- }, Me = ({ value: r, onChange: l, placeholder: p, className: f }) => {
59
- const { t: a } = P(), c = V(), [d, u] = M.useState(!1), [i, s] = M.useState(r);
60
- M.useEffect(() => {
61
- d && s(r);
62
- }, [d, r]);
63
- const h = (n) => {
64
- n.stopPropagation(), l(void 0), u(!1);
65
- }, k = () => {
66
- l(i), u(!1);
67
- }, y = () => {
68
- s(r), u(!1);
69
- }, N = () => {
70
- s(void 0);
71
- }, w = (n) => n != null && n.from ? !n.to || n.from.getTime() === n.to.getTime() ? x(n.from, "dd MMM yyyy", { locale: c }) : `${x(n.from, "dd MMM yyyy", { locale: c })} - ${x(n.to, "dd MMM yyyy", { locale: c })}` : p ?? a("date.pickPeriod");
72
- return /* @__PURE__ */ e("div", { className: g("grid gap-2", f), children: /* @__PURE__ */ o(E, { open: d, onOpenChange: u, children: [
73
- /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ o(v, { id: "date", variant: "outline", className: g("w-[300px] justify-start text-left font-normal", !(r != null && r.from) && "text-muted-foreground"), children: [
74
- /* @__PURE__ */ e(O, { className: "mr-2 size-4" }),
75
- w(r),
76
- (r == null ? void 0 : r.from) && /* @__PURE__ */ e(
77
- v,
78
- {
79
- type: "button",
80
- variant: "ghost",
81
- size: "icon",
82
- "aria-label": a("date.clearPeriod"),
83
- className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
84
- onClick: h,
85
- children: /* @__PURE__ */ e(I, { className: "size-4" })
86
- }
87
- )
88
- ] }) }),
89
- /* @__PURE__ */ o(_, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
90
- /* @__PURE__ */ e(
91
- j,
92
- {
93
- mode: "range",
94
- defaultMonth: i == null ? void 0 : i.from,
95
- selected: i,
96
- onSelect: s,
97
- numberOfMonths: 2,
98
- locale: c,
99
- className: "pointer-events-auto p-3"
100
- }
101
- ),
102
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
103
- /* @__PURE__ */ e(v, { variant: "ghost", size: "sm", onClick: N, children: a("actions.clear") }),
104
- /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
105
- /* @__PURE__ */ e(v, { variant: "ghost", size: "sm", onClick: y, children: a("actions.cancel") }),
106
- /* @__PURE__ */ e(v, { size: "sm", onClick: k, children: a("actions.apply") })
107
- ] })
108
- ] })
109
- ] })
110
- ] }) });
111
- }, Se = ({
112
- options: r = [],
113
- value: l,
114
- onChange: p,
115
- onClear: f,
116
- onCreate: a,
117
- placeholder: c,
118
- searchPlaceholder: d,
119
- emptyLabel: u,
120
- createLabel: i,
121
- disabled: s = !1,
122
- modal: h = !0,
123
- className: k
124
- }) => {
125
- const { t: y } = P(), [N, w] = S(!1), [n, D] = S(""), C = l !== void 0 && l !== "", m = q(() => C ? r.find((t) => t.value === l) : void 0, [C, r, l]), B = C ? (m == null ? void 0 : m.label) ?? l : void 0, b = n.trim(), L = a !== void 0 && b !== "" && !r.some((t) => t.label.toLowerCase() === b.toLowerCase()), z = (t) => {
126
- w(t), t || D("");
127
- }, K = (t) => {
128
- p(t), z(!1);
129
- }, $ = () => {
130
- a == null || a(b), z(!1);
131
- };
132
- return /* @__PURE__ */ o(E, { open: N, onOpenChange: z, modal: h, children: [
133
- /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ o(
134
- "button",
135
- {
136
- type: "button",
137
- role: "combobox",
138
- "aria-expanded": N,
139
- disabled: s,
140
- className: g(
141
- H,
142
- "w-full",
143
- "data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2",
144
- !C && "text-muted-foreground",
145
- k
146
- ),
147
- children: [
148
- /* @__PURE__ */ o("span", { className: "flex items-center truncate", children: [
149
- (m == null ? void 0 : m.color) && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: m.color } }),
150
- /* @__PURE__ */ e("span", { className: "truncate", children: B ?? c ?? y("select.placeholder") }),
151
- (m == null ? void 0 : m.description) !== void 0 && /* @__PURE__ */ o("span", { className: "ml-1 truncate text-muted-foreground", children: [
152
- "(",
153
- m.description,
154
- ")"
155
- ] })
156
- ] }),
157
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
158
- f && C && !s && /* @__PURE__ */ e(
159
- "span",
160
- {
161
- role: "button",
162
- tabIndex: -1,
163
- onClick: (t) => {
164
- t.stopPropagation();
165
- },
166
- onPointerDown: (t) => {
167
- t.preventDefault(), t.stopPropagation(), f();
168
- },
169
- className: "text-muted-foreground hover:text-foreground",
170
- children: /* @__PURE__ */ e(I, { className: "size-4" })
171
- }
172
- ),
173
- /* @__PURE__ */ e(ee, { className: g("size-4 shrink-0 opacity-50 transition-transform", N && "rotate-180") })
174
- ] })
175
- ]
176
- }
177
- ) }),
178
- /* @__PURE__ */ e(_, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ o(
179
- J,
180
- {
181
- filter: (t, A, F) => (F ?? []).join(" ").toLowerCase().includes(A.trim().toLowerCase()) ? 1 : 0,
182
- children: [
183
- /* @__PURE__ */ e(Q, { placeholder: d ?? y("search.placeholder"), value: n, onValueChange: D }),
184
- /* @__PURE__ */ o(U, { children: [
185
- !L && /* @__PURE__ */ e(W, { children: u ?? y("states.noResult") }),
186
- /* @__PURE__ */ o(Y, { children: [
187
- r.map((t) => /* @__PURE__ */ o(
188
- T,
189
- {
190
- value: t.value,
191
- keywords: [t.label, t.description ?? ""],
192
- onSelect: () => {
193
- K(t.value);
194
- },
195
- children: [
196
- /* @__PURE__ */ e(te, { className: g("mr-2 size-4 shrink-0", l === t.value ? "opacity-100" : "opacity-0") }),
197
- t.color !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: t.color } }),
198
- /* @__PURE__ */ e("span", { className: "truncate", children: t.label }),
199
- t.description !== void 0 && /* @__PURE__ */ o("span", { className: "ml-1 truncate text-muted-foreground", children: [
200
- "(",
201
- t.description,
202
- ")"
203
- ] })
204
- ]
205
- },
206
- t.value
207
- )),
208
- L && /* @__PURE__ */ o(T, { forceMount: !0, value: "__create__", onSelect: $, children: [
209
- /* @__PURE__ */ e(re, { className: "mr-2 size-4 shrink-0" }),
210
- /* @__PURE__ */ e("span", { className: "truncate", children: i ? i(b) : y("select.create", { search: b }) })
211
- ] })
212
- ] })
213
- ] })
214
- ]
215
- }
216
- ) })
217
- ] });
218
- }, Ie = ({ searchQuery: r, search: l, placeholder: p, onSearch: f, onSubmit: a, onClear: c, className: d }) => {
219
- const { t: u } = P(), i = r ?? l ?? "", s = () => {
220
- f(""), c !== void 0 && c();
221
- };
222
- return /* @__PURE__ */ o("div", { className: g("relative h-fit w-full md:w-64", d), children: [
223
- /* @__PURE__ */ e(oe, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
224
- /* @__PURE__ */ e(
225
- Z,
226
- {
227
- placeholder: p ?? u("search.placeholder"),
228
- value: i,
229
- onChange: (h) => {
230
- f(h.target.value);
231
- },
232
- className: "pl-8",
233
- onKeyDown: (h) => {
234
- h.key === "Enter" && a !== void 0 && (h.preventDefault(), a());
235
- }
236
- }
237
- ),
238
- i !== "" ? /* @__PURE__ */ e("button", { onClick: s, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ e(I, { className: "size-4" }) }) : null
239
- ] });
240
- };
241
- export {
242
- ze as D,
243
- Ie as S,
244
- Me as a,
245
- Se as b
246
- };