@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
@@ -0,0 +1,11 @@
1
+ export interface ConfirmDialogConfig {
2
+ isOpen: boolean;
3
+ itemName: string | null;
4
+ title: string;
5
+ description: string;
6
+ confirmKey: string;
7
+ openDialog: (id: string, name: string) => void;
8
+ onClose: () => void;
9
+ onConfirm: () => Promise<void>;
10
+ }
11
+ //# sourceMappingURL=ConfirmDialogConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDialogConfig.d.ts","sourceRoot":"","sources":["../../src/types/ConfirmDialogConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC"}
@@ -0,0 +1,31 @@
1
+ import { useTheme as m } from "next-themes";
2
+ import { t as u } from "./useToast-BFTk4lWz.js";
3
+ const T = () => ({
4
+ showSuccess: (s, c, o) => {
5
+ u({ title: s, description: c, action: o });
6
+ },
7
+ showError: (s, c, o) => {
8
+ console.error(c, o), u({ title: s, description: c, variant: "destructive" });
9
+ }
10
+ });
11
+ function g(e) {
12
+ const { showSuccess: n } = T(), { theme: s, setTheme: c } = m(), o = (r) => {
13
+ c(r);
14
+ const t = e.find((i) => i.value === r);
15
+ n("Thème mis à jour", `Le thème a été changé vers ${(t == null ? void 0 : t.label) ?? r}.`);
16
+ }, h = e.find((r) => r.value === s), l = e.findIndex((r) => r.value === s), a = e[(l + 1) % e.length], f = (s == null ? void 0 : s.startsWith("dark")) ?? !1;
17
+ return {
18
+ theme: s,
19
+ setTheme: c,
20
+ handleThemeChange: o,
21
+ themeOptions: e,
22
+ currentThemeOption: h,
23
+ nextThemeOption: a,
24
+ isDark: f,
25
+ cycleTheme: () => o(a.value)
26
+ };
27
+ }
28
+ export {
29
+ g as a,
30
+ T as u
31
+ };
@@ -0,0 +1,100 @@
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -32,9 +32,9 @@
32
32
  "peerDependencies": {
33
33
  "@krosoft/core": ">=0.0.1",
34
34
  "next-themes": ">=0.4.6",
35
- "react": ">=19.0.0",
35
+ "react": ">=19.2.6",
36
36
  "react-i18next": ">=17.0.8",
37
- "react-router-dom": ">=6.30.3"
37
+ "react-router-dom": ">=7.15.1"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "next-themes": {
@@ -45,25 +45,46 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
+ "@radix-ui/react-accordion": "^1.1.2",
49
+ "@radix-ui/react-alert-dialog": "^1.1.2",
50
+ "@radix-ui/react-aspect-ratio": "^1.1.1",
51
+ "@radix-ui/react-avatar": "^1.1.2",
48
52
  "@radix-ui/react-checkbox": "^1.3.3",
53
+ "@radix-ui/react-collapsible": "^1.1.2",
54
+ "@radix-ui/react-context-menu": "^2.2.2",
49
55
  "@radix-ui/react-dialog": "^1.1.15",
56
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
57
+ "@radix-ui/react-hover-card": "^1.1.2",
50
58
  "@radix-ui/react-label": "^2.1.8",
59
+ "@radix-ui/react-menubar": "^1.1.2",
60
+ "@radix-ui/react-navigation-menu": "^1.2.2",
51
61
  "@radix-ui/react-popover": "^1.1.15",
52
62
  "@radix-ui/react-progress": "^1.1.8",
53
- "@radix-ui/react-dropdown-menu": "^2.1.16",
63
+ "@radix-ui/react-radio-group": "^1.2.2",
54
64
  "@radix-ui/react-scroll-area": "^1.2.10",
55
65
  "@radix-ui/react-select": "^2.2.6",
56
66
  "@radix-ui/react-separator": "^1.1.8",
67
+ "@radix-ui/react-slider": "^1.2.1",
57
68
  "@radix-ui/react-slot": "^1.2.4",
69
+ "@radix-ui/react-switch": "^1.1.2",
58
70
  "@radix-ui/react-tabs": "^1.1.13",
59
71
  "@radix-ui/react-toast": "^1.2.15",
72
+ "@radix-ui/react-toggle": "^1.1.1",
73
+ "@radix-ui/react-toggle-group": "^1.1.1",
60
74
  "@radix-ui/react-tooltip": "^1.2.8",
61
75
  "class-variance-authority": "^0.7.1",
62
76
  "clsx": "^2.1.1",
77
+ "cmdk": "^1.0.0",
63
78
  "date-fns": "^4.3.0",
79
+ "embla-carousel-react": "^8.4.1",
80
+ "input-otp": "^1.2.4",
64
81
  "lucide-react": "^1.16.0",
65
82
  "react-day-picker": "^10.0.1",
66
- "tailwind-merge": "^2.6.1"
83
+ "react-hook-form": "^7.53.0",
84
+ "recharts": "^2.12.7",
85
+ "sonner": "^1.7.4",
86
+ "tailwind-merge": "^2.6.1",
87
+ "vaul": "^1.1.1"
67
88
  },
68
89
  "devDependencies": {
69
90
  "@krosoft/core": "^0.0.37",
@@ -81,9 +102,10 @@
81
102
  "jsdom": "^26.1.0",
82
103
  "next-themes": "^0.4.6",
83
104
  "prettier": "^3.8.3",
84
- "react": "^19.2.0",
85
- "react-dom": "^19.2.0",
105
+ "react": "^19.2.6",
106
+ "react-dom": "^19.2.6",
86
107
  "react-i18next": "^17.0.8",
108
+ "react-resizable-panels": "^4.11.2",
87
109
  "react-router-dom": "^7.15.1",
88
110
  "storybook": "^8.6.18",
89
111
  "tailwindcss": "^3.4.19",
@@ -1,250 +0,0 @@
1
- import { jsx as i, jsxs as a, Fragment as W } from "react/jsx-runtime";
2
- import { D as q, b as B, P as X, e as G, h as K, c as L, A as Q, j as R, a6 as $, L as U, I as Y } from "./tabs-BYqvMsA6.js";
3
- import { B as A } from "./tooltip-BzTGwm2E.js";
4
- import "./card-7XPLAra3.js";
5
- import "./select-B5wF6jxC.js";
6
- import { useTranslation as Z } from "react-i18next";
7
- import { c as _ } from "./createLucideIcon-CRdjzt2A.js";
8
- import { useState as M, useEffect as ee } from "react";
9
- /**
10
- * @license lucide-react v1.16.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- const ie = [
16
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
17
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
18
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
19
- ], le = _("circle-alert", ie);
20
- /**
21
- * @license lucide-react v1.16.0 - ISC
22
- *
23
- * This source code is licensed under the ISC license.
24
- * See the LICENSE file in the root directory of this source tree.
25
- */
26
- const re = [
27
- [
28
- "path",
29
- {
30
- 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",
31
- key: "1a8usu"
32
- }
33
- ]
34
- ], H = _("pen", re);
35
- /**
36
- * @license lucide-react v1.16.0 - ISC
37
- *
38
- * This source code is licensed under the ISC license.
39
- * See the LICENSE file in the root directory of this source tree.
40
- */
41
- const ae = [
42
- [
43
- "path",
44
- {
45
- 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",
46
- key: "1c8476"
47
- }
48
- ],
49
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
50
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
51
- ], P = _("save", ae);
52
- function ne({ open: g, onOpenChange: j, config: n, isLoading: b, error: m, children: z }) {
53
- const { t: s } = Z(), { title: x, description: d, icon: h, maxWidth: N = "sm:max-w-xl", actions: o } = n;
54
- return /* @__PURE__ */ i(q, { open: g, onOpenChange: j, children: /* @__PURE__ */ a(B, { className: `${N} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
55
- b === !0 ? /* @__PURE__ */ i("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ i(X, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
56
- /* @__PURE__ */ a(G, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-lg shrink-0", children: [
57
- /* @__PURE__ */ a(K, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
58
- h !== void 0 ? /* @__PURE__ */ i("div", { className: "p-2 bg-white/20 rounded-lg", children: /* @__PURE__ */ i(h, { className: "size-4 text-white" }) }) : null,
59
- s(x)
60
- ] }),
61
- d !== void 0 && d !== "" ? /* @__PURE__ */ i(L, { className: "text-indigo-100 text-base", children: s(d) }) : null
62
- ] }),
63
- m != null ? /* @__PURE__ */ i("div", { className: "px-6 ", children: /* @__PURE__ */ a(Q, { variant: "destructive", className: "max-w-full", children: [
64
- /* @__PURE__ */ i(le, { className: "size-4" }),
65
- /* @__PURE__ */ i(R, { className: "break-words overflow-wrap-anywhere max-w-full", children: m.message })
66
- ] }) }) : null,
67
- /* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto px-6 ", children: z }),
68
- o !== void 0 && o.length > 0 ? /* @__PURE__ */ i("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__ */ i("div", { className: "flex justify-end gap-3", children: o.map((t, E) => /* @__PURE__ */ a(A, { variant: t.variant ?? "default", onClick: t.onClick, disabled: t.disabled === !0 || b === !0, children: [
69
- t.icon !== void 0 ? /* @__PURE__ */ i(t.icon, { className: "size-4" }) : null,
70
- s(t.label)
71
- ] }, E)) }) }) : null
72
- ] }) });
73
- }
74
- function he({
75
- open: g,
76
- onOpenChange: j,
77
- data: n,
78
- title: b,
79
- headerBadge: m,
80
- sections: z,
81
- onSave: s,
82
- customFooter: x,
83
- defaultEditing: d = !1,
84
- footerActions: h = !0,
85
- saveLabel: N = "Sauvegarder",
86
- cancelLabel: o = "Annuler",
87
- hideSaveIcon: t = !1,
88
- maxWidth: E = "sm:max-w-4xl"
89
- }) {
90
- const [k, f] = M(d), [p, v] = M({}), [c, w] = M(!1);
91
- if (ee(() => {
92
- g && f(d);
93
- }, [g, d]), n == null) return null;
94
- const F = async () => {
95
- if (k) {
96
- if (s !== void 0) {
97
- w(!0);
98
- try {
99
- await s(p), f(!1), v({});
100
- } catch (e) {
101
- console.error(e);
102
- } finally {
103
- w(!1);
104
- }
105
- }
106
- } else
107
- f(!0), v({});
108
- }, V = () => {
109
- f(!1), v({});
110
- }, I = async () => {
111
- if (s !== void 0) {
112
- w(!0);
113
- try {
114
- await s(p), f(!1), v({});
115
- } catch (e) {
116
- console.error(e);
117
- } finally {
118
- w(!1);
119
- }
120
- }
121
- }, S = (e, l) => {
122
- v((u) => ({ ...u, [e]: l }));
123
- }, T = (e) => {
124
- if (k && s !== void 0) {
125
- if (e.renderEdit !== void 0)
126
- return e.renderEdit(n, p, (r) => {
127
- S(e.key, r);
128
- });
129
- let y = "";
130
- if (p[e.key] !== void 0)
131
- y = p[e.key];
132
- else if (e.getEditValue !== void 0)
133
- y = e.getEditValue(n);
134
- else {
135
- const r = n[e.key];
136
- y = r != null && String(r) !== "" ? String(r) : "";
137
- }
138
- return /* @__PURE__ */ i(
139
- Y,
140
- {
141
- value: y,
142
- onChange: (r) => {
143
- S(e.key, r.target.value);
144
- }
145
- }
146
- );
147
- }
148
- if (e.renderView !== void 0)
149
- return e.renderView(n);
150
- const l = n[e.key];
151
- let u = "Non renseigné";
152
- return Array.isArray(l) ? l.length > 0 && (u = l.map((r) => {
153
- if (typeof r == "object" && r !== null) {
154
- const D = r;
155
- return typeof D.name == "string" ? D.name : typeof D.label == "string" ? D.label : JSON.stringify(r);
156
- }
157
- return String(r);
158
- }).join(", ")) : typeof l == "object" && l !== null ? u = JSON.stringify(l) : (typeof l == "string" || typeof l == "number" || typeof l == "boolean") && (u = String(l)), /* @__PURE__ */ i("div", { className: "p-2 bg-gray-50 dark:bg-gray-900 rounded border border-transparent min-h-[36px] flex items-center", children: u });
159
- }, J = (e) => /* @__PURE__ */ a("div", { className: `col-span-1 ${e.fullWidth === !0 ? "md:col-span-2" : ""}`, children: [
160
- /* @__PURE__ */ i(U, { className: "mb-1 block text-sm font-medium", children: e.label }),
161
- T(e)
162
- ] }, e.key), C = [];
163
- s !== void 0 && (k ? (o !== "" && C.push({
164
- label: o,
165
- onClick: V,
166
- variant: "outline",
167
- disabled: c,
168
- icon: $
169
- }), C.push({
170
- label: c ? "Enregistrement..." : N,
171
- onClick: () => {
172
- I();
173
- },
174
- variant: "default",
175
- disabled: c,
176
- icon: t ? void 0 : P
177
- })) : C.push({
178
- label: "Modifier",
179
- onClick: () => {
180
- F();
181
- },
182
- variant: "outline",
183
- icon: H
184
- }));
185
- const O = {
186
- title: b(n),
187
- maxWidth: E,
188
- actions: h ? C : []
189
- };
190
- return /* @__PURE__ */ i(
191
- ne,
192
- {
193
- open: g,
194
- onOpenChange: (e) => {
195
- j(e), e || V();
196
- },
197
- config: O,
198
- isLoading: c,
199
- children: /* @__PURE__ */ a("div", { className: "py-4", children: [
200
- m !== void 0 ? /* @__PURE__ */ i("div", { className: "mb-4", children: m(n) }) : null,
201
- /* @__PURE__ */ i("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6 items-start", children: z.map((e, l) => /* @__PURE__ */ a("div", { className: "space-y-4", children: [
202
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2 mb-4", children: [
203
- e.icon,
204
- /* @__PURE__ */ i("h3", { className: "text-lg font-semibold", children: e.title })
205
- ] }),
206
- /* @__PURE__ */ i("div", { className: "grid grid-cols-1 gap-4", children: e.fields.map(J) })
207
- ] }, l)) }),
208
- x !== void 0 ? x(n) : null,
209
- s !== void 0 && !h ? /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: k ? /* @__PURE__ */ a(W, { children: [
210
- o !== "" ? /* @__PURE__ */ a(A, { onClick: V, variant: "outline", size: "sm", disabled: c, children: [
211
- /* @__PURE__ */ i($, { className: "h-4 w-4 mr-2" }),
212
- o
213
- ] }) : null,
214
- /* @__PURE__ */ a(
215
- A,
216
- {
217
- onClick: () => {
218
- I();
219
- },
220
- size: "sm",
221
- disabled: c,
222
- className: "text-white",
223
- children: [
224
- t ? null : /* @__PURE__ */ i(P, { className: "h-4 w-4 mr-2" }),
225
- c ? "Enregistrement..." : N
226
- ]
227
- }
228
- )
229
- ] }) : /* @__PURE__ */ a(
230
- A,
231
- {
232
- onClick: () => {
233
- F();
234
- },
235
- variant: "outline",
236
- size: "sm",
237
- children: [
238
- /* @__PURE__ */ i(H, { className: "h-4 w-4 mr-2" }),
239
- "Modifier"
240
- ]
241
- }
242
- ) }) : null
243
- ] })
244
- }
245
- );
246
- }
247
- export {
248
- ne as A,
249
- he as F
250
- };
@@ -1,23 +0,0 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { c as o } from "./index-gWiv5-6R.js";
4
- const t = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: o("rounded-lg border bg-card text-card-foreground shadow-sm", a), ...e }));
5
- t.displayName = "Card";
6
- const c = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: o("flex flex-col space-y-1.5 p-6", a), ...e }));
7
- c.displayName = "CardHeader";
8
- const i = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("h3", { ref: r, className: o("text-2xl font-semibold leading-none tracking-tight", a), ...e }));
9
- i.displayName = "CardTitle";
10
- const m = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("p", { ref: r, className: o("text-sm text-muted-foreground", a), ...e }));
11
- m.displayName = "CardDescription";
12
- const l = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: o("p-6 pt-0", a), ...e }));
13
- l.displayName = "CardContent";
14
- const n = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: o("flex items-center p-6 pt-0", a), ...e }));
15
- n.displayName = "CardFooter";
16
- export {
17
- t as C,
18
- l as a,
19
- m as b,
20
- n as c,
21
- c as d,
22
- i as e
23
- };
@@ -1,116 +0,0 @@
1
- import { useContext as b, createContext as L, forwardRef as C, createElement as i } from "react";
2
- /**
3
- * @license lucide-react v1.16.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const h = (...e) => e.filter((t, o, r) => !!t && t.trim() !== "" && r.indexOf(t) === o).join(" ").trim();
9
- /**
10
- * @license lucide-react v1.16.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- const W = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
16
- /**
17
- * @license lucide-react v1.16.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */
22
- const S = (e) => e.replace(
23
- /^([A-Z])|[\s-_]+(\w)/g,
24
- (t, o, r) => r ? r.toUpperCase() : o.toLowerCase()
25
- );
26
- /**
27
- * @license lucide-react v1.16.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */
32
- const d = (e) => {
33
- const t = S(e);
34
- return t.charAt(0).toUpperCase() + t.slice(1);
35
- };
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
- var c = {
43
- xmlns: "http://www.w3.org/2000/svg",
44
- width: 24,
45
- height: 24,
46
- viewBox: "0 0 24 24",
47
- fill: "none",
48
- stroke: "currentColor",
49
- strokeWidth: 2,
50
- strokeLinecap: "round",
51
- strokeLinejoin: "round"
52
- };
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 v = (e) => {
60
- for (const t in e)
61
- if (t.startsWith("aria-") || t === "role" || t === "title")
62
- return !0;
63
- return !1;
64
- }, y = L({}), $ = () => b(y), j = C(
65
- ({ color: e, size: t, strokeWidth: o, absoluteStrokeWidth: r, className: a = "", children: s, iconNode: p, ...l }, m) => {
66
- const {
67
- size: n = 24,
68
- strokeWidth: u = 2,
69
- absoluteStrokeWidth: x = !1,
70
- color: w = "currentColor",
71
- className: f = ""
72
- } = $() ?? {}, k = r ?? x ? Number(o ?? u) * 24 / Number(t ?? n) : o ?? u;
73
- return i(
74
- "svg",
75
- {
76
- ref: m,
77
- ...c,
78
- width: t ?? n ?? c.width,
79
- height: t ?? n ?? c.height,
80
- stroke: e ?? w,
81
- strokeWidth: k,
82
- className: h("lucide", f, a),
83
- ...!s && !v(l) && { "aria-hidden": "true" },
84
- ...l
85
- },
86
- [
87
- ...p.map(([g, A]) => i(g, A)),
88
- ...Array.isArray(s) ? s : [s]
89
- ]
90
- );
91
- }
92
- );
93
- /**
94
- * @license lucide-react v1.16.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- */
99
- const I = (e, t) => {
100
- const o = C(
101
- ({ className: r, ...a }, s) => i(j, {
102
- ref: s,
103
- iconNode: t,
104
- className: h(
105
- `lucide-${W(d(e))}`,
106
- `lucide-${e}`,
107
- r
108
- ),
109
- ...a
110
- })
111
- );
112
- return o.displayName = d(e), o;
113
- };
114
- export {
115
- I as c
116
- };
@@ -1,8 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { c as r } from "./index-gWiv5-6R.js";
3
- function a({ className: e, ...m }) {
4
- return /* @__PURE__ */ o("div", { className: r("animate-pulse rounded-md bg-muted", e), ...m });
5
- }
6
- export {
7
- a as S
8
- };