@krosoft/react 0.0.89 → 0.0.91

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 (117) hide show
  1. package/dist/{AppSubTitle-RKbtrPJr.js → AppSubTitle-CvJlatS9.js} +1 -1
  2. package/dist/{AppTitle-DCQpP2qE.js → AppTitle-LIQCjpo5.js} +26 -25
  3. package/dist/{AppVerticalTabs-pK3i9ZTD.js → AppVerticalTabs-BHrad7wu.js} +23 -23
  4. package/dist/ConfirmationDialog-BlRXnFH5.js +321 -0
  5. package/dist/ErrorAlert-BITMD2I5.js +33 -0
  6. package/dist/{LoadingState-DQjGcT2l.js → LoadingState-COf3KhOP.js} +6 -6
  7. package/dist/{MetricCard-DB1ME6tD.js → MetricCard-BGT2QRn0.js} +14 -13
  8. package/dist/{SearchInput-D_SLIZ2y.js → SearchInput-DpOuKSIf.js} +115 -126
  9. package/dist/{TableFilter-DXTOY-oa.js → TableFilter-DFtN_-Bg.js} +51 -51
  10. package/dist/{TableSettings-CBtuAPgM.js → TableSettings-m2q3s0wU.js} +68 -80
  11. package/dist/{ThemeSelector-CU8JmN2b.js → ThemeSelector-D9KTJAWz.js} +3 -3
  12. package/dist/{Topbar-BzZxu1Zi.js → Topbar-QKCJiWdO.js} +2 -2
  13. package/dist/{badge-DyRSpnOb.js → badge-C09fRxvd.js} +1 -1
  14. package/dist/card-Bn3Y7DHQ.js +48 -0
  15. package/dist/components/core/cards/index.js +1 -1
  16. package/dist/components/core/dialogs/ConfirmDeleteDialog.d.ts +10 -0
  17. package/dist/components/core/dialogs/ConfirmDeleteDialog.d.ts.map +1 -0
  18. package/dist/components/core/dialogs/ConfirmationDialog.d.ts +13 -0
  19. package/dist/components/core/dialogs/ConfirmationDialog.d.ts.map +1 -0
  20. package/dist/components/core/dialogs/index.d.ts +3 -0
  21. package/dist/components/core/dialogs/index.d.ts.map +1 -1
  22. package/dist/components/core/dialogs/index.js +15 -13
  23. package/dist/components/core/filters/index.js +1 -1
  24. package/dist/components/core/index.js +60 -56
  25. package/dist/components/core/inputs/index.js +1 -1
  26. package/dist/components/core/layouts/index.js +2 -2
  27. package/dist/components/core/navbar/index.js +1 -1
  28. package/dist/components/core/states/ErrorAlert.d.ts +7 -0
  29. package/dist/components/core/states/ErrorAlert.d.ts.map +1 -0
  30. package/dist/components/core/states/index.d.ts +1 -0
  31. package/dist/components/core/states/index.d.ts.map +1 -1
  32. package/dist/components/core/states/index.js +6 -4
  33. package/dist/components/core/table/index.js +1 -1
  34. package/dist/components/core/tabs/index.js +1 -1
  35. package/dist/components/core/theme/index.js +1 -1
  36. package/dist/components/index.js +280 -136
  37. package/dist/components/ui/accordion.d.ts +8 -0
  38. package/dist/components/ui/accordion.d.ts.map +1 -0
  39. package/dist/components/ui/alert-dialog.d.ts +21 -0
  40. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  41. package/dist/components/ui/aspect-ratio.d.ts +4 -0
  42. package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
  43. package/dist/components/ui/avatar.d.ts +7 -0
  44. package/dist/components/ui/avatar.d.ts.map +1 -0
  45. package/dist/components/ui/breadcrumb.d.ts +20 -0
  46. package/dist/components/ui/breadcrumb.d.ts.map +1 -0
  47. package/dist/components/ui/button.d.ts +1 -1
  48. package/dist/components/ui/carousel.d.ts +19 -0
  49. package/dist/components/ui/carousel.d.ts.map +1 -0
  50. package/dist/components/ui/chart.d.ts +50 -0
  51. package/dist/components/ui/chart.d.ts.map +1 -0
  52. package/dist/components/ui/collapsible.d.ts +6 -0
  53. package/dist/components/ui/collapsible.d.ts.map +1 -0
  54. package/dist/components/ui/command.d.ts +83 -0
  55. package/dist/components/ui/command.d.ts.map +1 -0
  56. package/dist/components/ui/context-menu.d.ts +28 -0
  57. package/dist/components/ui/context-menu.d.ts.map +1 -0
  58. package/dist/components/ui/drawer.d.ts +23 -0
  59. package/dist/components/ui/drawer.d.ts.map +1 -0
  60. package/dist/components/ui/form.d.ts +24 -0
  61. package/dist/components/ui/form.d.ts.map +1 -0
  62. package/dist/components/ui/hover-card.d.ts +7 -0
  63. package/dist/components/ui/hover-card.d.ts.map +1 -0
  64. package/dist/components/ui/index.d.ts +42 -16
  65. package/dist/components/ui/index.d.ts.map +1 -1
  66. package/dist/components/ui/index.js +231 -91
  67. package/dist/components/ui/input-otp.d.ts +35 -0
  68. package/dist/components/ui/input-otp.d.ts.map +1 -0
  69. package/dist/components/ui/menubar.d.ts +34 -0
  70. package/dist/components/ui/menubar.d.ts.map +1 -0
  71. package/dist/components/ui/navigation-menu.d.ts +13 -0
  72. package/dist/components/ui/navigation-menu.d.ts.map +1 -0
  73. package/dist/components/ui/pagination.d.ts +33 -0
  74. package/dist/components/ui/pagination.d.ts.map +1 -0
  75. package/dist/components/ui/radio-group.d.ts +6 -0
  76. package/dist/components/ui/radio-group.d.ts.map +1 -0
  77. package/dist/components/ui/resizable.d.ts +8 -0
  78. package/dist/components/ui/resizable.d.ts.map +1 -0
  79. package/dist/components/ui/sheet.d.ts +1 -1
  80. package/dist/components/ui/sidebar.d.ts +67 -0
  81. package/dist/components/ui/sidebar.d.ts.map +1 -0
  82. package/dist/components/ui/simple-table.d.ts +11 -0
  83. package/dist/components/ui/simple-table.d.ts.map +1 -0
  84. package/dist/components/ui/slider.d.ts +5 -0
  85. package/dist/components/ui/slider.d.ts.map +1 -0
  86. package/dist/components/ui/sonner.d.ts +5 -0
  87. package/dist/components/ui/sonner.d.ts.map +1 -0
  88. package/dist/components/ui/switch.d.ts +5 -0
  89. package/dist/components/ui/switch.d.ts.map +1 -0
  90. package/dist/components/ui/textarea.d.ts +6 -0
  91. package/dist/components/ui/textarea.d.ts.map +1 -0
  92. package/dist/components/ui/toaster.d.ts +2 -0
  93. package/dist/components/ui/toaster.d.ts.map +1 -0
  94. package/dist/components/ui/toggle-group.d.ts +13 -0
  95. package/dist/components/ui/toggle-group.d.ts.map +1 -0
  96. package/dist/components/ui/toggle.d.ts +13 -0
  97. package/dist/components/ui/toggle.d.ts.map +1 -0
  98. package/dist/{ellipsis-vertical-CqrunffH.js → ellipsis-vertical-BVxSFNOa.js} +1 -1
  99. package/dist/grip-vertical-CJ07_87Y.js +18 -0
  100. package/dist/hooks/index.js +6 -5
  101. package/dist/index-DSyPHOLE.js +147 -0
  102. package/dist/{loader-circle-BhJXKs31.js → loader-circle-GAYBtm3z.js} +1 -1
  103. package/dist/{select-B5wF6jxC.js → select-D6_XPD6x.js} +309 -308
  104. package/dist/toaster-D6ND7OTk.js +113 -0
  105. package/dist/toggle-group-VJoGbVQm.js +19987 -0
  106. package/dist/{tooltip-BzTGwm2E.js → tooltip-CAu4DEhc.js} +767 -796
  107. package/dist/types/ConfirmDialogConfig.d.ts +11 -0
  108. package/dist/types/ConfirmDialogConfig.d.ts.map +1 -0
  109. package/dist/useTheme-Bn8z_uxy.js +31 -0
  110. package/dist/useToast-BFTk4lWz.js +100 -0
  111. package/package.json +29 -7
  112. package/dist/FormDialog-CXLQG83d.js +0 -250
  113. package/dist/card-7XPLAra3.js +0 -23
  114. package/dist/createLucideIcon-CRdjzt2A.js +0 -116
  115. package/dist/skeleton-CJ1F2tD3.js +0 -8
  116. package/dist/tabs-BYqvMsA6.js +0 -6628
  117. package/dist/useTheme-CvNYmhjo.js +0 -128
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { useTranslation as l } from "react-i18next";
3
- import { A as m } from "./AppTitle-DCQpP2qE.js";
3
+ import { A as m } from "./AppTitle-LIQCjpo5.js";
4
4
  function f({ titleKey: s, actions: t, className: o }) {
5
5
  const { t: r } = l();
6
6
  return /* @__PURE__ */ i("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: [
@@ -1,19 +1,20 @@
1
- import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
- import { m as c, B as b, o as f, v as h, q as u } from "./tabs-BYqvMsA6.js";
3
- import { B as p } from "./tooltip-BzTGwm2E.js";
4
- import "./card-7XPLAra3.js";
1
+ import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
+ import { ar as c, aF as b, at as f, aA as h, av as u } from "./toggle-group-VJoGbVQm.js";
3
+ import "./card-Bn3Y7DHQ.js";
5
4
  import { c as d } from "./index-gWiv5-6R.js";
6
- import "./select-B5wF6jxC.js";
5
+ import { B as p } from "./tooltip-CAu4DEhc.js";
6
+ import "./select-D6_XPD6x.js";
7
+ import "react";
7
8
  import { u as v } from "./useMobile-DN1_OMDB.js";
8
9
  import { useTranslation as N } from "react-i18next";
9
- import { E as x } from "./ellipsis-vertical-CqrunffH.js";
10
- function j({ actions: m, className: o }) {
10
+ import { E as x } from "./ellipsis-vertical-BVxSFNOa.js";
11
+ function E({ actions: m, className: o }) {
11
12
  const { t: i } = N(), t = v();
12
- return !m || m.length === 0 ? null : t ? /* @__PURE__ */ a(c, { children: [
13
+ return !m || m.length === 0 ? null : t ? /* @__PURE__ */ n(c, { children: [
13
14
  /* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ l(p, { variant: "outline", size: "icon", children: /* @__PURE__ */ l(x, { className: "size-4" }) }) }),
14
- /* @__PURE__ */ l(f, { align: "end", className: "min-w-48", children: m.map((r, e) => r ? r.children && r.children.length > 0 ? /* @__PURE__ */ a("div", { children: [
15
+ /* @__PURE__ */ l(f, { align: "end", className: "min-w-48", children: m.map((r, e) => r ? r.children && r.children.length > 0 ? /* @__PURE__ */ n("div", { children: [
15
16
  e > 0 && /* @__PURE__ */ l(h, {}),
16
- r.children.map((s, n) => s ? /* @__PURE__ */ a(
17
+ r.children.map((s, a) => s ? /* @__PURE__ */ n(
17
18
  u,
18
19
  {
19
20
  onClick: () => void s.onClick(),
@@ -24,31 +25,31 @@ function j({ actions: m, className: o }) {
24
25
  s.labelKey && i(s.labelKey)
25
26
  ]
26
27
  },
27
- n
28
+ a
28
29
  ) : null)
29
- ] }, e) : /* @__PURE__ */ a(u, { onClick: () => void r.onClick(), disabled: r.disabled, className: d("gap-2", r.className), children: [
30
+ ] }, e) : /* @__PURE__ */ n(u, { onClick: () => void r.onClick(), disabled: r.disabled, className: d("gap-2", r.className), children: [
30
31
  r.icon && /* @__PURE__ */ l(r.icon, { className: "size-4" }),
31
32
  r.labelKey && i(r.labelKey)
32
33
  ] }, e) : null) })
33
- ] }) : ((r) => /* @__PURE__ */ l("div", { className: d("flex gap-2", o), children: r.map((e, s) => e ? e.children && e.children.length > 0 ? /* @__PURE__ */ a(c, { children: [
34
- /* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ a(p, { variant: e.variant, disabled: e.disabled, className: d("gap-2", e.className), children: [
34
+ ] }) : ((r) => /* @__PURE__ */ l("div", { className: d("flex gap-2", o), children: r.map((e, s) => e ? e.children && e.children.length > 0 ? /* @__PURE__ */ n(c, { children: [
35
+ /* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ n(p, { variant: e.variant, disabled: e.disabled, className: d("gap-2", e.className), children: [
35
36
  e.icon && /* @__PURE__ */ l(e.icon, { className: "size-4" }),
36
37
  e.labelKey && i(e.labelKey)
37
38
  ] }) }),
38
- /* @__PURE__ */ l(f, { align: "end", children: e.children.map((n, g) => n ? /* @__PURE__ */ a(
39
+ /* @__PURE__ */ l(f, { align: "end", children: e.children.map((a, g) => a ? /* @__PURE__ */ n(
39
40
  u,
40
41
  {
41
- onClick: () => void n.onClick(),
42
- disabled: n.disabled,
43
- className: d("gap-2", n.className),
42
+ onClick: () => void a.onClick(),
43
+ disabled: a.disabled,
44
+ className: d("gap-2", a.className),
44
45
  children: [
45
- n.icon && /* @__PURE__ */ l(n.icon, { className: "size-4" }),
46
- n.labelKey && i(n.labelKey)
46
+ a.icon && /* @__PURE__ */ l(a.icon, { className: "size-4" }),
47
+ a.labelKey && i(a.labelKey)
47
48
  ]
48
49
  },
49
50
  g
50
51
  ) : null) })
51
- ] }, s) : /* @__PURE__ */ a(
52
+ ] }, s) : /* @__PURE__ */ n(
52
53
  p,
53
54
  {
54
55
  variant: e.variant,
@@ -63,14 +64,14 @@ function j({ actions: m, className: o }) {
63
64
  s
64
65
  ) : null) }))(m);
65
66
  }
66
- function E({ titleKey: m, descriptionKey: o, isSubTitle: i }) {
67
+ function T({ titleKey: m, descriptionKey: o, isSubTitle: i }) {
67
68
  const { t } = N();
68
- return /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
69
+ return /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
69
70
  /* @__PURE__ */ l("h1", { className: i ? "text-xl md:text-2xl font-semibold" : "text-xl md:text-3xl font-bold", children: t(m) ?? "" }),
70
71
  o ? /* @__PURE__ */ l("p", { className: d("text-muted-foreground", i && "text-sm"), children: t(o) }) : null
71
72
  ] });
72
73
  }
73
74
  export {
74
- j as A,
75
- E as a
75
+ E as A,
76
+ T as a
76
77
  };
@@ -1,12 +1,12 @@
1
1
  import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { C as v, d as g, a as y } from "./card-7XPLAra3.js";
3
- import { a as N, A as w } from "./AppTitle-DCQpP2qE.js";
4
- import { X as S, Z as T, _ as C, Y as k, S as b } from "./tabs-BYqvMsA6.js";
2
+ import { C as v, f as g, c as y } from "./card-Bn3Y7DHQ.js";
3
+ import { a as N, A as w } from "./AppTitle-LIQCjpo5.js";
4
+ import { bR as T, bT as b, bU as S, bS as C, bu as k } from "./toggle-group-VJoGbVQm.js";
5
5
  import { useTranslation as x } from "react-i18next";
6
6
  import { useSearchParams as f } from "react-router-dom";
7
7
  import { c as A } from "./index-gWiv5-6R.js";
8
- import { S as P, h as j, i as z, a as M, c as L } from "./select-B5wF6jxC.js";
9
- import { c as V } from "./createLucideIcon-CRdjzt2A.js";
8
+ import { S as P, h as j, i as z, a as M, c as L } from "./select-D6_XPD6x.js";
9
+ import { c as V } from "./index-DSyPHOLE.js";
10
10
  /**
11
11
  * @license lucide-react v1.16.0 - ISC
12
12
  *
@@ -23,40 +23,40 @@ const K = [
23
23
  ["path", { d: "m14 6 7.7 7.7", key: "1s8pl2" }],
24
24
  ["path", { d: "m8 6 8 8", key: "hl96qh" }]
25
25
  ], p = V("construction", K);
26
- function _({ titleKey: s, descriptionKey: l, actions: t = [], className: c }) {
26
+ function R({ titleKey: s, descriptionKey: l, actions: c = [], className: t }) {
27
27
  return /* @__PURE__ */ n("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
28
28
  /* @__PURE__ */ a(N, { titleKey: s, descriptionKey: l, isSubTitle: !0 }),
29
- /* @__PURE__ */ a(w, { actions: t, className: c })
29
+ /* @__PURE__ */ a(w, { actions: c, className: t })
30
30
  ] });
31
31
  }
32
- function $({ titleKey: s, descriptionKey: l, actions: t = [], className: c, children: o, isSubTitle: i }) {
32
+ function F({ titleKey: s, descriptionKey: l, actions: c = [], className: t, children: o, isSubTitle: i }) {
33
33
  return /* @__PURE__ */ n(v, { children: [
34
- /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(_, { titleKey: s, descriptionKey: l, actions: t, className: c }) }),
34
+ /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(R, { titleKey: s, descriptionKey: l, actions: c, className: t }) }),
35
35
  /* @__PURE__ */ a(y, { className: "space-y-4", children: o })
36
36
  ] });
37
37
  }
38
- function B({ tabs: s, itemId: l, item: t, fit: c }) {
38
+ function G({ tabs: s, itemId: l, item: c, fit: t }) {
39
39
  var m;
40
40
  const { t: o } = x(), [i, d] = f(), h = i.get("tab") || ((m = s[0]) == null ? void 0 : m.value);
41
- return /* @__PURE__ */ n(S, { value: h, onValueChange: (e) => {
41
+ return /* @__PURE__ */ n(T, { value: h, onValueChange: (e) => {
42
42
  const r = new URLSearchParams();
43
43
  r.set("tab", e), d(r);
44
44
  }, children: [
45
- /* @__PURE__ */ a(T, { className: A("w-full justify-start", c && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ n(C, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
45
+ /* @__PURE__ */ a(b, { className: A("w-full justify-start", t && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ n(S, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
46
46
  e.icon ? /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: /* @__PURE__ */ a(e.icon, { className: "size-4" }) }) : null,
47
47
  /* @__PURE__ */ a("span", { className: "text-xs sm:text-sm", children: o(e.titleKey) ?? "" }),
48
48
  e.count ? /* @__PURE__ */ n("span", { className: "text-gray-500 text-xs", children: [
49
49
  "(",
50
- e.count(t),
50
+ e.count(c),
51
51
  ")"
52
52
  ] }) : null
53
53
  ] }, e.value)) }),
54
- s.map((e) => /* @__PURE__ */ a(k, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
54
+ s.map((e) => /* @__PURE__ */ a(C, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
55
55
  ] });
56
56
  }
57
- const E = ({ tabs: s, item: l }) => {
57
+ const J = ({ tabs: s, item: l }) => {
58
58
  var m;
59
- const { t } = x(), [c, o] = f(), i = c.get("tab") || ((m = s[0]) == null ? void 0 : m.value), d = (e) => {
59
+ const { t: c } = x(), [t, o] = f(), i = t.get("tab") || ((m = s[0]) == null ? void 0 : m.value), d = (e) => {
60
60
  const r = new URLSearchParams();
61
61
  r.set("tab", e), o(r);
62
62
  }, h = () => {
@@ -68,14 +68,14 @@ const E = ({ tabs: s, item: l }) => {
68
68
  /* @__PURE__ */ a("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
69
69
  ] }) }) });
70
70
  return /* @__PURE__ */ n("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
71
- /* @__PURE__ */ a("div", { className: "w-64 lg:w-80 flex-shrink-0 hidden md:block border-r border-gray-200 dark:border-gray-700 pr-4", children: /* @__PURE__ */ a(b, { className: "h-full", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: s.map((e, r) => /* @__PURE__ */ n(
71
+ /* @__PURE__ */ a("div", { className: "w-64 lg:w-80 flex-shrink-0 hidden md:block border-r border-gray-200 dark:border-gray-700 pr-4", children: /* @__PURE__ */ a(k, { className: "h-full", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: s.map((e, r) => /* @__PURE__ */ n(
72
72
  "div",
73
73
  {
74
74
  className: `px-2 py-2 rounded-2xl text-sm transition-colors flex items-center gap-2 ${e.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : i === e.value ? "crm-color-styled font-medium cursor-pointer" : "text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 cursor-pointer"}`,
75
75
  onClick: () => !e.disabled && d(e.value),
76
76
  children: [
77
77
  e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
78
- /* @__PURE__ */ a("span", { className: "flex-1", children: t(e.titleKey) }),
78
+ /* @__PURE__ */ a("span", { className: "flex-1", children: c(e.titleKey) }),
79
79
  e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
80
80
  "(",
81
81
  e.count(l),
@@ -90,7 +90,7 @@ const E = ({ tabs: s, item: l }) => {
90
90
  /* @__PURE__ */ a(j, { className: "w-full", children: /* @__PURE__ */ a(z, { placeholder: "Sélectionner une section" }) }),
91
91
  /* @__PURE__ */ a(M, { children: s.map((e, r) => /* @__PURE__ */ a(L, { value: e.value, disabled: e.disabled, children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
92
92
  e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
93
- /* @__PURE__ */ a("span", { children: t(e.titleKey) }),
93
+ /* @__PURE__ */ a("span", { children: c(e.titleKey) }),
94
94
  e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
95
95
  "(",
96
96
  e.count(l),
@@ -103,8 +103,8 @@ const E = ({ tabs: s, item: l }) => {
103
103
  ] });
104
104
  };
105
105
  export {
106
- $ as A,
107
- _ as a,
108
- B as b,
109
- E as c
106
+ F as A,
107
+ R as a,
108
+ G as b,
109
+ J as c
110
110
  };
@@ -0,0 +1,321 @@
1
+ import { jsx as e, jsxs as i, Fragment as U } from "react/jsx-runtime";
2
+ import { D as Y, b as Z, P as L, e as ee, h as re, c as le, c7 as $, aV as ie, aQ as ae, m as q, p as J, s as S, t as W, q as F, r as B, o as Q, u as ne, n as te } from "./toggle-group-VJoGbVQm.js";
3
+ import { A as se, a as oe } from "./card-Bn3Y7DHQ.js";
4
+ import { B as k } from "./tooltip-CAu4DEhc.js";
5
+ import "./select-D6_XPD6x.js";
6
+ import { useState as _, useEffect as ce } from "react";
7
+ import { useTranslation as X } from "react-i18next";
8
+ import { c as j } from "./index-DSyPHOLE.js";
9
+ import { E as de } from "./ErrorAlert-BITMD2I5.js";
10
+ /**
11
+ * @license lucide-react v1.16.0 - ISC
12
+ *
13
+ * This source code is licensed under the ISC license.
14
+ * See the LICENSE file in the root directory of this source tree.
15
+ */
16
+ const me = [
17
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
18
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
19
+ ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
20
+ ], he = j("circle-alert", me);
21
+ /**
22
+ * @license lucide-react v1.16.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */
27
+ const ue = [
28
+ [
29
+ "path",
30
+ {
31
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
32
+ key: "1a8usu"
33
+ }
34
+ ]
35
+ ], I = j("pen", ue);
36
+ /**
37
+ * @license lucide-react v1.16.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */
42
+ const ge = [
43
+ [
44
+ "path",
45
+ {
46
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
47
+ key: "1c8476"
48
+ }
49
+ ],
50
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
51
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
52
+ ], P = j("save", ge);
53
+ /**
54
+ * @license lucide-react v1.16.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */
59
+ const pe = [
60
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
61
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
62
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
63
+ ], fe = j("trash", pe);
64
+ function ve({ open: s, onOpenChange: h, config: l, isLoading: o, error: c, children: d }) {
65
+ const { t } = X(), { title: C, description: g, icon: v, maxWidth: D = "sm:max-w-xl", actions: u } = l;
66
+ return /* @__PURE__ */ e(Y, { open: s, onOpenChange: h, children: /* @__PURE__ */ i(Z, { className: `${D} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
67
+ o === !0 ? /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ e(L, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
68
+ /* @__PURE__ */ i(ee, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-lg shrink-0", children: [
69
+ /* @__PURE__ */ i(re, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
70
+ v !== void 0 ? /* @__PURE__ */ e("div", { className: "p-2 bg-white/20 rounded-lg", children: /* @__PURE__ */ e(v, { className: "size-4 text-white" }) }) : null,
71
+ t(C)
72
+ ] }),
73
+ g !== void 0 && g !== "" ? /* @__PURE__ */ e(le, { className: "text-indigo-100 text-base", children: t(g) }) : null
74
+ ] }),
75
+ c != null ? /* @__PURE__ */ e("div", { className: "px-6 ", children: /* @__PURE__ */ i(se, { variant: "destructive", className: "max-w-full", children: [
76
+ /* @__PURE__ */ e(he, { className: "size-4" }),
77
+ /* @__PURE__ */ e(oe, { className: "break-words overflow-wrap-anywhere max-w-full", children: c.message })
78
+ ] }) }) : null,
79
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-6 ", children: d }),
80
+ u !== void 0 && u.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-b-lg border-t border-gray-200 dark:border-gray-700 shrink-0 p-6 light:bg-gradient-to-r light:from-gray-50 light:to-gray-100 dark:bg-gray-950", children: /* @__PURE__ */ e("div", { className: "flex justify-end gap-3", children: u.map((m, z) => /* @__PURE__ */ i(k, { variant: m.variant ?? "default", onClick: m.onClick, disabled: m.disabled === !0 || o === !0, children: [
81
+ m.icon !== void 0 ? /* @__PURE__ */ e(m.icon, { className: "size-4" }) : null,
82
+ t(m.label)
83
+ ] }, z)) }) }) : null
84
+ ] }) });
85
+ }
86
+ function Ee({
87
+ open: s,
88
+ onOpenChange: h,
89
+ data: l,
90
+ title: o,
91
+ headerBadge: c,
92
+ sections: d,
93
+ onSave: t,
94
+ customFooter: C,
95
+ defaultEditing: g = !1,
96
+ footerActions: v = !0,
97
+ saveLabel: D = "Sauvegarder",
98
+ cancelLabel: u = "Annuler",
99
+ hideSaveIcon: m = !1,
100
+ maxWidth: z = "sm:max-w-4xl"
101
+ }) {
102
+ const [w, y] = _(g), [b, N] = _({}), [p, A] = _(!1);
103
+ if (ce(() => {
104
+ s && y(g);
105
+ }, [s, g]), l == null) return null;
106
+ const T = async () => {
107
+ if (w) {
108
+ if (t !== void 0) {
109
+ A(!0);
110
+ try {
111
+ await t(b), y(!1), N({});
112
+ } catch (r) {
113
+ console.error(r);
114
+ } finally {
115
+ A(!1);
116
+ }
117
+ }
118
+ } else
119
+ y(!0), N({});
120
+ }, M = () => {
121
+ y(!1), N({});
122
+ }, H = async () => {
123
+ if (t !== void 0) {
124
+ A(!0);
125
+ try {
126
+ await t(b), y(!1), N({});
127
+ } catch (r) {
128
+ console.error(r);
129
+ } finally {
130
+ A(!1);
131
+ }
132
+ }
133
+ }, O = (r, a) => {
134
+ N((f) => ({ ...f, [r]: a }));
135
+ }, G = (r) => {
136
+ if (w && t !== void 0) {
137
+ if (r.renderEdit !== void 0)
138
+ return r.renderEdit(l, b, (n) => {
139
+ O(r.key, n);
140
+ });
141
+ let x = "";
142
+ if (b[r.key] !== void 0)
143
+ x = b[r.key];
144
+ else if (r.getEditValue !== void 0)
145
+ x = r.getEditValue(l);
146
+ else {
147
+ const n = l[r.key];
148
+ x = n != null && String(n) !== "" ? String(n) : "";
149
+ }
150
+ return /* @__PURE__ */ e(
151
+ ae,
152
+ {
153
+ value: x,
154
+ onChange: (n) => {
155
+ O(r.key, n.target.value);
156
+ }
157
+ }
158
+ );
159
+ }
160
+ if (r.renderView !== void 0)
161
+ return r.renderView(l);
162
+ const a = l[r.key];
163
+ let f = "Non renseigné";
164
+ return Array.isArray(a) ? a.length > 0 && (f = a.map((n) => {
165
+ if (typeof n == "object" && n !== null) {
166
+ const V = n;
167
+ return typeof V.name == "string" ? V.name : typeof V.label == "string" ? V.label : JSON.stringify(n);
168
+ }
169
+ return String(n);
170
+ }).join(", ")) : typeof a == "object" && a !== null ? f = JSON.stringify(a) : (typeof a == "string" || typeof a == "number" || typeof a == "boolean") && (f = String(a)), /* @__PURE__ */ e("div", { className: "p-2 bg-gray-50 dark:bg-gray-900 rounded border border-transparent min-h-[36px] flex items-center", children: f });
171
+ }, K = (r) => /* @__PURE__ */ i("div", { className: `col-span-1 ${r.fullWidth === !0 ? "md:col-span-2" : ""}`, children: [
172
+ /* @__PURE__ */ e(ie, { className: "mb-1 block text-sm font-medium", children: r.label }),
173
+ G(r)
174
+ ] }, r.key), E = [];
175
+ t !== void 0 && (w ? (u !== "" && E.push({
176
+ label: u,
177
+ onClick: M,
178
+ variant: "outline",
179
+ disabled: p,
180
+ icon: $
181
+ }), E.push({
182
+ label: p ? "Enregistrement..." : D,
183
+ onClick: () => {
184
+ H();
185
+ },
186
+ variant: "default",
187
+ disabled: p,
188
+ icon: m ? void 0 : P
189
+ })) : E.push({
190
+ label: "Modifier",
191
+ onClick: () => {
192
+ T();
193
+ },
194
+ variant: "outline",
195
+ icon: I
196
+ }));
197
+ const R = {
198
+ title: o(l),
199
+ maxWidth: z,
200
+ actions: v ? E : []
201
+ };
202
+ return /* @__PURE__ */ e(
203
+ ve,
204
+ {
205
+ open: s,
206
+ onOpenChange: (r) => {
207
+ h(r), r || M();
208
+ },
209
+ config: R,
210
+ isLoading: p,
211
+ children: /* @__PURE__ */ i("div", { className: "py-4", children: [
212
+ c !== void 0 ? /* @__PURE__ */ e("div", { className: "mb-4", children: c(l) }) : null,
213
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6 items-start", children: d.map((r, a) => /* @__PURE__ */ i("div", { className: "space-y-4", children: [
214
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2 mb-4", children: [
215
+ r.icon,
216
+ /* @__PURE__ */ e("h3", { className: "text-lg font-semibold", children: r.title })
217
+ ] }),
218
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4", children: r.fields.map(K) })
219
+ ] }, a)) }),
220
+ C !== void 0 ? C(l) : null,
221
+ t !== void 0 && !v ? /* @__PURE__ */ e("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: w ? /* @__PURE__ */ i(U, { children: [
222
+ u !== "" ? /* @__PURE__ */ i(k, { onClick: M, variant: "outline", size: "sm", disabled: p, children: [
223
+ /* @__PURE__ */ e($, { className: "h-4 w-4 mr-2" }),
224
+ u
225
+ ] }) : null,
226
+ /* @__PURE__ */ i(
227
+ k,
228
+ {
229
+ onClick: () => {
230
+ H();
231
+ },
232
+ size: "sm",
233
+ disabled: p,
234
+ className: "text-white",
235
+ children: [
236
+ m ? null : /* @__PURE__ */ e(P, { className: "h-4 w-4 mr-2" }),
237
+ p ? "Enregistrement..." : D
238
+ ]
239
+ }
240
+ )
241
+ ] }) : /* @__PURE__ */ i(
242
+ k,
243
+ {
244
+ onClick: () => {
245
+ T();
246
+ },
247
+ variant: "outline",
248
+ size: "sm",
249
+ children: [
250
+ /* @__PURE__ */ e(I, { className: "h-4 w-4 mr-2" }),
251
+ "Modifier"
252
+ ]
253
+ }
254
+ ) }) : null
255
+ ] })
256
+ }
257
+ );
258
+ }
259
+ const Ve = ({ isLoading: s, error: h, config: l }) => {
260
+ const { t: o } = X(), c = (d) => {
261
+ !d && !s && l.onClose();
262
+ };
263
+ return /* @__PURE__ */ e(q, { open: l.isOpen, onOpenChange: c, children: /* @__PURE__ */ i(J, { children: [
264
+ /* @__PURE__ */ i(S, { children: [
265
+ /* @__PURE__ */ i(W, { className: "flex items-center gap-2 text-destructive", children: [
266
+ /* @__PURE__ */ e(fe, { className: "size-4" }),
267
+ o(l.title)
268
+ ] }),
269
+ /* @__PURE__ */ e(S, { className: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-lg shrink-0" }),
270
+ /* @__PURE__ */ e(F, { children: o(l.description) }),
271
+ /* @__PURE__ */ e(F, { children: l.itemName && /* @__PURE__ */ e("span", { className: "font-semibold block my-2", children: l.itemName }) })
272
+ ] }),
273
+ /* @__PURE__ */ e(de, { error: h instanceof Error ? null : h }),
274
+ /* @__PURE__ */ i(B, { children: [
275
+ /* @__PURE__ */ i(Q, { disabled: s, children: [
276
+ " ",
277
+ o("common.buttons.cancel")
278
+ ] }),
279
+ /* @__PURE__ */ e(
280
+ k,
281
+ {
282
+ onClick: (d) => {
283
+ d.preventDefault(), l.onConfirm();
284
+ },
285
+ disabled: s,
286
+ className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
287
+ children: s ? "Suppression..." : "Supprimer"
288
+ }
289
+ )
290
+ ] })
291
+ ] }) });
292
+ };
293
+ function je({
294
+ children: s,
295
+ title: h,
296
+ description: l,
297
+ confirmText: o = "Confirmer",
298
+ cancelText: c = "Annuler",
299
+ onConfirm: d,
300
+ destructive: t = !1
301
+ }) {
302
+ return /* @__PURE__ */ i(q, { children: [
303
+ /* @__PURE__ */ e(ne, { asChild: !0, children: s }),
304
+ /* @__PURE__ */ i(J, { children: [
305
+ /* @__PURE__ */ i(S, { children: [
306
+ /* @__PURE__ */ e(W, { children: h }),
307
+ /* @__PURE__ */ e(F, { children: l })
308
+ ] }),
309
+ /* @__PURE__ */ i(B, { children: [
310
+ /* @__PURE__ */ e(Q, { children: c }),
311
+ /* @__PURE__ */ e(te, { onClick: d, className: t ? "bg-red-600 hover:bg-red-700" : "", children: o })
312
+ ] })
313
+ ] })
314
+ ] });
315
+ }
316
+ export {
317
+ ve as A,
318
+ Ve as C,
319
+ Ee as F,
320
+ je as a
321
+ };
@@ -0,0 +1,33 @@
1
+ import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
+ import { A as i, a as l } from "./card-Bn3Y7DHQ.js";
3
+ import { c as n } from "./index-DSyPHOLE.js";
4
+ /**
5
+ * @license lucide-react v1.16.0 - ISC
6
+ *
7
+ * This source code is licensed under the ISC license.
8
+ * See the LICENSE file in the root directory of this source tree.
9
+ */
10
+ const c = [
11
+ [
12
+ "path",
13
+ {
14
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
15
+ key: "wmoenq"
16
+ }
17
+ ],
18
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
19
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
20
+ ], d = n("triangle-alert", c), h = ({ error: e }) => e ? /* @__PURE__ */ r(i, { variant: "destructive", children: [
21
+ /* @__PURE__ */ s(d, { className: "h-4 w-4" }),
22
+ /* @__PURE__ */ r(l, { children: [
23
+ /* @__PURE__ */ r("div", { className: "flex items-center space-x-2", children: [
24
+ /* @__PURE__ */ s("span", { className: "font-semibold", children: "Erreur :" }),
25
+ /* @__PURE__ */ s("span", { children: e.code }),
26
+ /* @__PURE__ */ s("span", { children: e.message })
27
+ ] }),
28
+ e.errors && e.errors.length > 0 && /* @__PURE__ */ s("ul", { className: "mt-2 list-disc list-inside", children: e.errors.map((a, t) => /* @__PURE__ */ s("li", { children: a }, t)) })
29
+ ] })
30
+ ] }) : null;
31
+ export {
32
+ h as E
33
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { C as d, d as s, a as n } from "./card-7XPLAra3.js";
3
- import { L as i } from "./loader-circle-BhJXKs31.js";
2
+ import { C as d, f as s, c as n } from "./card-Bn3Y7DHQ.js";
3
+ import { L as i } from "./loader-circle-GAYBtm3z.js";
4
4
  const l = () => /* @__PURE__ */ a(d, { className: "animate-pulse", children: [
5
5
  /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e("div", { className: "h-6 bg-muted rounded w-1/4" }) }),
6
6
  /* @__PURE__ */ e(n, { children: /* @__PURE__ */ a("div", { className: "space-y-2", children: [
@@ -14,16 +14,16 @@ const l = () => /* @__PURE__ */ a(d, { className: "animate-pulse", children: [
14
14
  style: { gridTemplateColumns: `repeat(${r}, minmax(0, 1fr))` },
15
15
  children: Array.from({ length: r }).map((m, t) => /* @__PURE__ */ e(l, {}, t))
16
16
  }
17
- ), h = ({ message: r }) => /* @__PURE__ */ a("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-md animate-fade-in", children: [
17
+ ), f = ({ message: r }) => /* @__PURE__ */ a("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-md animate-fade-in", children: [
18
18
  /* @__PURE__ */ e("p", { className: "font-semibold mb-2", children: "Une erreur est survenue." }),
19
19
  r !== void 0 && r !== "" ? /* @__PURE__ */ e("p", { className: "text-sm opacity-80", children: r }) : null
20
- ] }), f = ({ message: r }) => /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in", children: [
20
+ ] }), h = ({ message: r }) => /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in", children: [
21
21
  /* @__PURE__ */ e(i, { className: "size-8 animate-spin mb-4 text-primary" }),
22
22
  r !== void 0 && r !== "" ? /* @__PURE__ */ e("p", { className: "font-semibold text-sm", children: r }) : null
23
23
  ] });
24
24
  export {
25
25
  l as C,
26
- h as E,
27
- f as L,
26
+ f as E,
27
+ h as L,
28
28
  p as a
29
29
  };