@krosoft/react 0.0.238 → 0.0.239

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 +2 -2
  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,61 +0,0 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { c as s } from "./tailwind.helper-B6yFEsav.js";
3
- import { Slot as c } from "@radix-ui/react-slot";
4
- import { cva as f } from "class-variance-authority";
5
- import * as a from "react";
6
- import * as o from "@radix-ui/react-tooltip";
7
- const u = f(
8
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-control text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
15
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
16
- ghost: "hover:bg-accent hover:text-accent-foreground",
17
- link: "text-primary underline-offset-4 hover:underline",
18
- styled: "bg-gradient-to-r from-slate-900 to-purple-700 hover:from-slate-800 hover:to-purple-600 text-white shadow-lg shadow-purple-500/25 px-6 h-12"
19
- },
20
- size: {
21
- default: "h-10 px-4 py-2",
22
- sm: "h-9 rounded-control px-3",
23
- lg: "h-11 rounded-control px-8",
24
- icon: "h-10 w-10"
25
- }
26
- },
27
- defaultVariants: {
28
- variant: "default",
29
- size: "default"
30
- }
31
- }
32
- ), p = a.forwardRef(({ className: e, variant: t, size: r, asChild: n = !1, ...d }, l) => /* @__PURE__ */ i(n ? c : "button", { className: s(u({ variant: t, size: r, className: e })), ref: l, ...d }));
33
- p.displayName = "Button";
34
- const g = "h-10 rounded-control border border-input bg-background px-3 py-2 text-sm ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", w = s(
35
- g,
36
- "flex items-center justify-between focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>span]:line-clamp-1"
37
- ), T = o.Provider, C = o.Root, k = o.Trigger, m = a.forwardRef(
38
- ({ className: e, sideOffset: t = 4, ...r }, n) => /* @__PURE__ */ i(
39
- o.Content,
40
- {
41
- ref: n,
42
- sideOffset: t,
43
- className: s(
44
- "z-50 overflow-hidden rounded-surface border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
45
- e
46
- ),
47
- ...r
48
- }
49
- )
50
- );
51
- m.displayName = o.Content.displayName;
52
- export {
53
- p as B,
54
- C as T,
55
- m as a,
56
- T as b,
57
- k as c,
58
- u as d,
59
- g as e,
60
- w as f
61
- };
@@ -1,11 +0,0 @@
1
- import { fr as o, enGB as t } from "date-fns/locale";
2
- import { useTranslation as a } from "react-i18next";
3
- import { K as r } from "./useKrosoftTranslation-BTp46G94.js";
4
- const L = { fr: o, en: t }, e = o, i = (s) => s === void 0 ? e : L[s.split("-")[0]] ?? e, l = () => {
5
- const { i18n: s, ready: n } = a(r, { useSuspense: !1 });
6
- return i(n ? s.resolvedLanguage ?? s.language : void 0);
7
- };
8
- export {
9
- i as d,
10
- l as u
11
- };
@@ -1,14 +0,0 @@
1
- import { useEffect as i } from "react";
2
- import { useTranslation as l } from "react-i18next";
3
- const $ = (e, t, o) => {
4
- const { t: n } = l();
5
- i(() => {
6
- const c = n(e), r = document.title, s = t ? `${c} - ${t}` : c, u = o ? `${s} | ${o}` : s;
7
- return document.title = u, () => {
8
- document.title = r;
9
- };
10
- }, [o, t, n, e]);
11
- };
12
- export {
13
- $ as u
14
- };
@@ -1,161 +0,0 @@
1
- import { useState as f, useRef as b, useMemo as W, useCallback as m, useLayoutEffect as ye } from "react";
2
- function Pe({
3
- data: s,
4
- columns: r,
5
- getRowId: S,
6
- defaultPageSize: g,
7
- actions: i,
8
- bulkActions: c,
9
- columnVisibility: l = !0,
10
- totalRows: a,
11
- currentPage: V,
12
- pageSize: u,
13
- onPageChange: O,
14
- onPageSizeChange: C,
15
- sortColumn: k,
16
- sortDirection: R,
17
- onSortChange: h
18
- }) {
19
- var ee;
20
- const [te, ne] = f(((ee = r.find((e) => e.sortable === !0)) == null ? void 0 : ee.key) ?? null), p = k !== void 0 ? k : te, [re, se] = f("asc"), v = R ?? re, [D, E] = f([]), [w, oe] = f(new Set(r.filter((e) => e.defaultVisible !== !1).map((e) => e.key))), [I, ie] = f(r.map((e) => e.key)), [T, ce] = f(r.reduce((e, t) => ({ ...e, [t.key]: t.minWidth ?? 100 }), {})), [le, U] = f(1), P = V ?? le, [ae, ue] = f(g), x = u ?? ae, de = b(null), X = b(null), G = b(0), H = b(0), y = b(null), J = b(null), N = i !== void 0 && i.length > 0, Q = c !== void 0 && c.length > 0, j = W(() => I.map((e) => r.find((t) => t.key === e)).filter((e) => e !== void 0), [I, r]), Y = W(() => j.filter((e) => w.has(e.key)), [j, w]), fe = Y.length + (Q ? 1 : 0) + (N || l ? 1 : 0), Z = a ?? s.length, q = Math.max(1, Math.ceil(Z / x)), _ = P > q ? q : P, M = Z === 0 ? 0 : (_ - 1) * x, B = a !== void 0 ? Math.min(M + s.length, a) : Math.min(M + x, s.length), z = m(
21
- (e) => {
22
- O ? O(e) : U(e);
23
- },
24
- [O]
25
- ), $ = m(
26
- (e) => {
27
- C ? C(e) : (ue(e), U(1));
28
- },
29
- [C]
30
- ), ge = m(
31
- (e) => {
32
- const t = typeof e == "function" ? e(P) : e;
33
- z(t);
34
- },
35
- [P, z]
36
- ), he = m(
37
- (e) => {
38
- const t = typeof e == "function" ? e(x) : e;
39
- $(t);
40
- },
41
- [x, $]
42
- ), pe = m(
43
- (e) => {
44
- const t = r.find((o) => o.key === e);
45
- if ((t == null ? void 0 : t.sortable) !== !0) return;
46
- let n = "asc";
47
- p === e && (n = v === "asc" ? "desc" : "asc"), h ? h(e, n) : (ne(e), se(n), z(1));
48
- },
49
- [r, p, v, h, z]
50
- ), L = m((e) => {
51
- const t = X.current;
52
- if (t === null) return;
53
- const n = e.clientX - G.current, o = Math.max(80, H.current + n);
54
- ce((d) => ({
55
- ...d,
56
- [t]: o
57
- }));
58
- }, []), K = m(
59
- function e() {
60
- X.current = null, document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", e);
61
- },
62
- [L]
63
- ), me = m(
64
- (e, t) => {
65
- e.preventDefault(), e.stopPropagation(), X.current = t, G.current = e.clientX, H.current = T[t], document.addEventListener("mousemove", L), document.addEventListener("mouseup", K);
66
- },
67
- [T, L, K]
68
- ), ve = (e, t) => {
69
- y.current = t, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/html", t);
70
- }, Se = (e, t) => {
71
- e.preventDefault(), e.dataTransfer.dropEffect = "move", J.current = t;
72
- }, Ce = (e, t) => {
73
- if (e.preventDefault(), y.current === null || y.current === t) return;
74
- const n = [...I], o = n.indexOf(y.current), d = n.indexOf(t);
75
- n.splice(o, 1), n.splice(d, 0, y.current), ie(n), y.current = null, J.current = null;
76
- }, F = W(() => h !== void 0 ? s : [...s].sort((e, t) => {
77
- if (p === null) return 0;
78
- const n = r.find((A) => A.key === p), o = (n == null ? void 0 : n.getSortValue) !== void 0 ? n.getSortValue(e) : e[p], d = (n == null ? void 0 : n.getSortValue) !== void 0 ? n.getSortValue(t) : t[p];
79
- if (typeof o == "string" && typeof d == "string") {
80
- const A = o.localeCompare(d);
81
- return v === "asc" ? A : -A;
82
- }
83
- return o === d ? 0 : o == null ? 1 : d == null ? -1 : o < d ? v === "asc" ? -1 : 1 : o > d ? v === "asc" ? 1 : -1 : 0;
84
- }), [s, p, v, r, h]), xe = W(() => a !== void 0 ? F : F.slice(M, B), [F, M, B, a]);
85
- return {
86
- sortColumn: p,
87
- sortDirection: v,
88
- selectedRows: D,
89
- setSelectedRows: E,
90
- visibleColumns: w,
91
- columnWidths: T,
92
- currentPage: P,
93
- setCurrentPage: ge,
94
- pageSize: x,
95
- setPageSize: he,
96
- totalPages: q,
97
- safeCurrentPage: _,
98
- startIndex: M,
99
- endIndex: B,
100
- tableRef: de,
101
- hasActions: N,
102
- hasBulkActions: Q,
103
- orderedColumns: j,
104
- visibleColumnsArray: Y,
105
- colSpanCount: fe,
106
- paginatedData: xe,
107
- handleSort: pe,
108
- handleMouseDown: me,
109
- handleDragStart: ve,
110
- handleDragOver: Se,
111
- handleDrop: Ce,
112
- toggleColumnVisibility: (e) => {
113
- const t = new Set(w);
114
- t.has(e) ? t.delete(e) : t.add(e), oe(t);
115
- },
116
- toggleRowSelection: (e) => {
117
- D.includes(e) ? E(D.filter((t) => t !== e)) : E([...D, e]);
118
- },
119
- toggleSelectAll: () => {
120
- D.length === s.length ? E([]) : E(s.map((e) => S(e)));
121
- }
122
- };
123
- }
124
- const be = (s, r) => {
125
- const S = Object.keys(s);
126
- return S.length !== Object.keys(r).length ? !1 : S.every((g) => {
127
- const i = s[g], c = r[g];
128
- return i.side === (c == null ? void 0 : c.side) && i.offset === c.offset && i.isEdge === c.isEdge;
129
- });
130
- };
131
- function Me(s) {
132
- const [r, S] = f({});
133
- return ye(() => {
134
- const g = s.current;
135
- if (!g) return;
136
- let i = [];
137
- const c = () => {
138
- i = Array.from(g.querySelectorAll("thead th[data-fixed-side]"));
139
- const a = {}, V = (u, O) => {
140
- let C = 0;
141
- u.forEach((k, R) => {
142
- const h = k.dataset.columnKey;
143
- h !== void 0 && (a[h] = { side: O, offset: C, isEdge: R === u.length - 1 }, C += k.getBoundingClientRect().width);
144
- });
145
- };
146
- V(
147
- i.filter((u) => u.dataset.fixedSide === "left"),
148
- "left"
149
- ), V(i.filter((u) => u.dataset.fixedSide === "right").reverse(), "right"), S((u) => be(u, a) ? u : a);
150
- };
151
- c();
152
- const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
153
- return l == null || l.observe(g), i.forEach((a) => l == null ? void 0 : l.observe(a)), () => {
154
- l == null || l.disconnect();
155
- };
156
- }), r;
157
- }
158
- export {
159
- Me as a,
160
- Pe as u
161
- };
@@ -1,47 +0,0 @@
1
- import { useTranslation as c } from "react-i18next";
2
- const l = { cancel: "Cancel", save: "Save", saving: "Saving...", edit: "Edit", delete: "Delete", clear: "Clear", apply: "Apply" }, u = { loading: "Loading...", error: "Something went wrong.", errorPrefix: "Error:", errorTitle: "Error", noResult: "No result", noResultDot: "No result.", noData: "No data available", underConstruction: "Section under development", comingSoon: "This feature will be available soon" }, d = { trigger: "Search", placeholder: "Search...", globalTitle: "Global search", globalDescription: "Search for a page or a record across the application.", commandTitle: "Command palette", commandDescription: "Search for a command to run.", loading: "Searching..." }, g = { trigger: "Notifications", title: "Notifications", empty: "No notifications.", markAllAsRead: "Mark all as read", remove: "Delete notification" }, p = { placeholder: "Select...", create: "Create “{{search}}”", section: "Select a section", theme: "Select a theme", language: "Select a language" }, m = { pickDate: "Select a date", pickPeriod: "Select a period", clearPeriod: "Clear the selected period" }, h = { advanced: "Advanced filters", more: "More filters", yes: "Yes", no: "No" }, f = { validationTitle: "Validation error", validationMessage: "Please check the form fields", submitError: "Something went wrong while saving" }, v = { empty: "No image", upload: "Click to upload", invalidType: "Only {{types}} files are accepted", tooLarge: "The file must not exceed {{size}}MB" }, S = { previousPage: "Previous page", nextPage: "Next page" }, b = { menu: "Navigation menu", description: "Main navigation of the application" }, T = { description: "Choose the interface language", current: "Current language: {{language}}", switchTo: "Switch to {{language}}" }, P = { updatedTitle: "Theme updated", updatedMessage: "The theme has been changed to {{theme}}." }, C = {
3
- actions: l,
4
- states: u,
5
- search: d,
6
- notifications: g,
7
- select: p,
8
- date: m,
9
- filters: h,
10
- form: f,
11
- image: v,
12
- table: S,
13
- sidebar: b,
14
- language: T,
15
- theme: P
16
- }, y = { cancel: "Annuler", save: "Enregistrer", saving: "Enregistrement...", edit: "Modifier", delete: "Supprimer", clear: "Effacer", apply: "Appliquer" }, A = { loading: "Chargement...", error: "Une erreur est survenue.", errorPrefix: "Erreur :", errorTitle: "Erreur", noResult: "Aucun résultat", noResultDot: "Aucun résultat.", noData: "Aucune donnée disponible", underConstruction: "Section en cours de développement", comingSoon: "Cette fonctionnalité sera bientôt disponible" }, E = { trigger: "Rechercher", placeholder: "Rechercher...", globalTitle: "Recherche globale", globalDescription: "Rechercher une page ou une donnée dans l'application.", commandTitle: "Palette de commandes", commandDescription: "Rechercher une commande à exécuter.", loading: "Recherche..." }, N = { trigger: "Notifications", title: "Notifications", empty: "Aucune notification.", markAllAsRead: "Tout marquer comme lu", remove: "Supprimer la notification" }, R = { placeholder: "Sélectionner...", create: "Créer « {{search}} »", section: "Sélectionner une section", theme: "Sélectionner un thème", language: "Sélectionner une langue" }, $ = { pickDate: "Sélectionner une date", pickPeriod: "Sélectionner une période", clearPeriod: "Effacer la période sélectionnée" }, D = { advanced: "Filtres avancés", more: "Plus de filtres", yes: "Oui", no: "Non" }, M = { validationTitle: "Erreur de validation", validationMessage: "Veuillez vérifier les champs du formulaire", submitError: "Une erreur est survenue lors de l'enregistrement" }, w = { empty: "Aucune image", upload: "Cliquer pour uploader", invalidType: "Seuls les fichiers {{types}} sont acceptés", tooLarge: "Le fichier ne doit pas dépasser {{size}}MB" }, k = { previousPage: "Page précédente", nextPage: "Page suivante" }, x = { menu: "Menu de navigation", description: "Navigation principale de l'application" }, L = { description: "Choisissez la langue de l'interface", current: "Langue actuelle : {{language}}", switchTo: "Passer en {{language}}" }, B = { updatedTitle: "Thème mis à jour", updatedMessage: "Le thème a été changé vers {{theme}}." }, s = {
17
- actions: y,
18
- states: A,
19
- search: E,
20
- notifications: N,
21
- select: R,
22
- date: $,
23
- filters: D,
24
- form: M,
25
- image: w,
26
- table: k,
27
- sidebar: x,
28
- language: L,
29
- theme: B
30
- }, r = "krosoft", O = { fr: s, en: C }, q = (e, { overwrite: t = !1 } = {}) => {
31
- typeof e.addResourceBundle == "function" && Object.entries(O).forEach(([a, n]) => {
32
- var o;
33
- (o = e.addResourceBundle) == null || o.call(e, a, r, n, !0, t);
34
- });
35
- }, z = (e) => {
36
- const t = e.split(".").reduce((a, n) => typeof a == "object" && a !== null ? a[n] : void 0, s);
37
- return typeof t == "string" ? t : void 0;
38
- }, K = (e, t) => t === void 0 ? e : e.replace(/\{\{(\w+)\}\}/g, (a, n) => n in t ? String(t[n]) : a), F = () => {
39
- const { t: e, i18n: t, ready: a } = c(r, { useSuspense: !1 });
40
- return { t: (o, i) => a && t.exists(o, { ns: r }) ? e(o, i ?? {}) : K(z(o) ?? o, i) };
41
- };
42
- export {
43
- r as K,
44
- O as k,
45
- q as r,
46
- F as u
47
- };
@@ -1,19 +0,0 @@
1
- import { useTranslation as v } from "react-i18next";
2
- function l(e) {
3
- const { i18n: t } = v(), a = t.language ?? "", d = a.split("-")[0], c = e.find((n) => n.value === a) ?? e.find((n) => n.value === d) ?? e[0], s = e.findIndex((n) => n.value === (c == null ? void 0 : c.value)), u = e.length > 0 ? e[(s + 1) % e.length] : void 0, o = (n) => {
4
- t.changeLanguage(n);
5
- };
6
- return {
7
- language: a,
8
- languageOptions: e,
9
- currentLanguageOption: c,
10
- nextLanguageOption: u,
11
- changeLanguage: o,
12
- cycleLanguage: () => {
13
- u && o(u.value);
14
- }
15
- };
16
- }
17
- export {
18
- l as u
19
- };
@@ -1,16 +0,0 @@
1
- import { useState as s, useEffect as r } from "react";
2
- const e = 768;
3
- function c() {
4
- const [o, n] = s(!1);
5
- return r(() => {
6
- const t = window.matchMedia(`(max-width: ${String(e - 1)}px)`), i = () => {
7
- n(window.innerWidth < e);
8
- };
9
- return t.addEventListener("change", i), n(window.innerWidth < e), () => {
10
- t.removeEventListener("change", i);
11
- };
12
- }, []), o;
13
- }
14
- export {
15
- c as u
16
- };
@@ -1,12 +0,0 @@
1
- import { t } from "./useToast-BFTk4lWz.js";
2
- const n = () => ({
3
- showSuccess: (s, o, r) => {
4
- t({ title: s, description: o, action: r });
5
- },
6
- showError: (s, o, r) => {
7
- console.error(o, r), t({ title: s, description: o, variant: "destructive" });
8
- }
9
- });
10
- export {
11
- n as u
12
- };
@@ -1,84 +0,0 @@
1
- import "date-fns/locale";
2
- import "react-i18next";
3
- import { u } from "./useKrosoftTranslation-BTp46G94.js";
4
- import { TrashIcon as l } from "lucide-react";
5
- import * as c from "react";
6
- import { useState as m, useContext as f } from "react";
7
- import { P as d } from "./sidebar.context-D5nywlmP.js";
8
- const g = (e) => {
9
- const [o, t] = m(null), r = (n, s) => {
10
- var a;
11
- (a = e == null ? void 0 : e.onReset) == null || a.call(e), t({ id: n, name: s });
12
- }, i = () => {
13
- t(null);
14
- };
15
- return {
16
- id: (o == null ? void 0 : o.id) ?? null,
17
- name: (o == null ? void 0 : o.name) ?? null,
18
- isOpen: !!o,
19
- openDialog: r,
20
- onClose: i
21
- };
22
- }, C = ({
23
- titleKey: e,
24
- descriptionKey: o,
25
- confirmKey: t = "Confirmer",
26
- onConfirm: r,
27
- onReset: i
28
- }) => {
29
- const n = g({ onReset: i }), s = async () => {
30
- if (n.id)
31
- try {
32
- await r(n.id), n.onClose();
33
- } catch (a) {
34
- console.error("Error confirming action:", a);
35
- }
36
- };
37
- return {
38
- isOpen: n.isOpen,
39
- itemName: n.name,
40
- title: e,
41
- description: o,
42
- confirmKey: t,
43
- openDialog: n.openDialog,
44
- onClose: n.onClose,
45
- onConfirm: s
46
- };
47
- }, w = ({ titleKey: e, descriptionKey: o, confirmKey: t, onConfirm: r, onReset: i }) => {
48
- const { t: n } = u();
49
- return {
50
- ...C({
51
- titleKey: e,
52
- descriptionKey: o,
53
- confirmKey: t ?? n("actions.delete"),
54
- onConfirm: r,
55
- onReset: i
56
- }),
57
- loadingKey: "Suppression...",
58
- icon: l,
59
- titleClassName: "flex items-center gap-2 text-destructive",
60
- headerClassName: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-surface shrink-0"
61
- };
62
- }, S = (e, o = 250) => {
63
- const [t, r] = c.useState(e);
64
- return c.useEffect(() => {
65
- const i = setTimeout(() => {
66
- r(e);
67
- }, o);
68
- return () => {
69
- clearTimeout(i);
70
- };
71
- }, [e, o]), t;
72
- }, T = () => {
73
- const e = f(d);
74
- if (e === void 0)
75
- throw new Error("usePage must be used within an PageProvider");
76
- return e;
77
- };
78
- export {
79
- C as a,
80
- S as b,
81
- g as c,
82
- T as d,
83
- w as u
84
- };
@@ -1,23 +0,0 @@
1
- import { useState as f, useLayoutEffect as u } from "react";
2
- const l = "1.5rem";
3
- function p(o) {
4
- const [n, d] = f({ start: !1, end: !1 });
5
- return u(() => {
6
- const e = o.current;
7
- if (!e) return;
8
- const r = () => {
9
- const i = e.scrollWidth - e.clientWidth, a = e.scrollLeft > 1, c = e.scrollLeft < i - 1;
10
- d((s) => s.start === a && s.end === c ? s : { start: a, end: c });
11
- };
12
- r(), e.addEventListener("scroll", r, { passive: !0 });
13
- const t = typeof ResizeObserver > "u" ? null : new ResizeObserver(r);
14
- return t == null || t.observe(e), () => {
15
- e.removeEventListener("scroll", r), t == null || t.disconnect();
16
- };
17
- }), !n.start && !n.end ? {} : {
18
- maskImage: `linear-gradient(to right, transparent 0, #000 ${n.start ? l : "0px"}, #000 calc(100% - ${n.end ? l : "0px"}), transparent 100%)`
19
- };
20
- }
21
- export {
22
- p as u
23
- };
@@ -1,38 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
1
- import { S as e } from "./sidebar.context-D5nywlmP.js";
2
- import { useContext as t } from "react";
3
- const s = () => {
4
- const r = t(e);
5
- if (r === void 0)
6
- throw new Error("useSidebar must be used within a SidebarProvider");
7
- return r;
8
- };
9
- export {
10
- s as u
11
- };
@@ -1,27 +0,0 @@
1
- import "date-fns/locale";
2
- import "react-i18next";
3
- import { u as f } from "./useKrosoftTranslation-BTp46G94.js";
4
- import { useTheme as T } from "next-themes";
5
- import { u as p } from "./useNotifications-zbUhCvF_.js";
6
- function k(s) {
7
- const { t: a } = f(), { showSuccess: u } = p(), { theme: t, setTheme: i } = T(), r = (e) => {
8
- i(e);
9
- const c = s.find((d) => d.value === e);
10
- u(a("theme.updatedTitle"), a("theme.updatedMessage", { theme: (c == null ? void 0 : c.label) ?? e }));
11
- }, n = s.filter((e) => !e.hideInMini), l = s.find((e) => e.value === t), m = n.findIndex((e) => e.value === t), o = n.length > 0 ? n[(m + 1) % n.length] : void 0, h = (t == null ? void 0 : t.startsWith("dark")) ?? !1;
12
- return {
13
- theme: t,
14
- setTheme: i,
15
- handleThemeChange: r,
16
- themeOptions: s,
17
- currentThemeOption: l,
18
- nextThemeOption: o,
19
- isDark: h,
20
- cycleTheme: () => {
21
- o && r(o.value);
22
- }
23
- };
24
- }
25
- export {
26
- k as u
27
- };
@@ -1,100 +0,0 @@
1
- import * as c from "react";
2
- const d = 1, p = 1e6;
3
- let u = 0;
4
- function A() {
5
- return u = (u + 1) % Number.MAX_SAFE_INTEGER, u.toString();
6
- }
7
- const a = /* @__PURE__ */ new Map(), S = (t) => {
8
- if (a.has(t))
9
- return;
10
- const s = setTimeout(() => {
11
- a.delete(t), n({
12
- type: "REMOVE_TOAST",
13
- toastId: t
14
- });
15
- }, p);
16
- a.set(t, s);
17
- }, f = (t, s) => {
18
- switch (s.type) {
19
- case "ADD_TOAST":
20
- return {
21
- ...t,
22
- toasts: [s.toast, ...t.toasts].slice(0, d)
23
- };
24
- case "UPDATE_TOAST":
25
- return {
26
- ...t,
27
- toasts: t.toasts.map((e) => e.id === s.toast.id ? { ...e, ...s.toast } : e)
28
- };
29
- case "DISMISS_TOAST": {
30
- const { toastId: e } = s;
31
- return e !== void 0 ? S(e) : t.toasts.forEach((o) => {
32
- S(o.id);
33
- }), {
34
- ...t,
35
- toasts: t.toasts.map(
36
- (o) => o.id === e || e === void 0 ? {
37
- ...o,
38
- open: !1
39
- } : o
40
- )
41
- };
42
- }
43
- case "REMOVE_TOAST":
44
- return s.toastId === void 0 ? {
45
- ...t,
46
- toasts: []
47
- } : {
48
- ...t,
49
- toasts: t.toasts.filter((e) => e.id !== s.toastId)
50
- };
51
- }
52
- }, r = [];
53
- let T = { toasts: [] };
54
- function n(t) {
55
- T = f(T, t), r.forEach((s) => {
56
- s(T);
57
- });
58
- }
59
- function O({ ...t }) {
60
- const s = A(), e = (i) => {
61
- n({
62
- type: "UPDATE_TOAST",
63
- toast: { ...i, id: s }
64
- });
65
- }, o = () => {
66
- n({ type: "DISMISS_TOAST", toastId: s });
67
- };
68
- return n({
69
- type: "ADD_TOAST",
70
- toast: {
71
- ...t,
72
- id: s,
73
- open: !0,
74
- onOpenChange: (i) => {
75
- i || o();
76
- }
77
- }
78
- }), {
79
- id: s,
80
- dismiss: o,
81
- update: e
82
- };
83
- }
84
- function E() {
85
- const [t, s] = c.useState(T);
86
- return c.useEffect(() => (r.push(s), () => {
87
- const e = r.indexOf(s);
88
- e > -1 && r.splice(e, 1);
89
- }), [t]), {
90
- ...t,
91
- toast: O,
92
- dismiss: (e) => {
93
- n({ type: "DISMISS_TOAST", toastId: e });
94
- }
95
- };
96
- }
97
- export {
98
- O as t,
99
- E as u
100
- };