@krosoft/react 0.0.218 → 0.0.219
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.
- package/README.md +31 -0
- package/dist/{AppActions-BCXERyyB.js → AppActions-BFmagl91.js} +1 -1
- package/dist/{AppSubTitle-H8ElNObI.js → AppSubTitle-BMQMoehZ.js} +1 -1
- package/dist/AppVerticalTabs-0DrrDO3S.js +101 -0
- package/dist/{ConfirmationDialog-BmxaMEYz.js → ConfirmationDialog-CFsh-Eui.js} +62 -61
- package/dist/DataTable-Cpbp6yse.js +551 -0
- package/dist/ErrorAlert-D_203tKa.js +21 -0
- package/dist/ErrorState-DfJ009uc.js +12 -0
- package/dist/GenericForm-q9dvYl_h.js +342 -0
- package/dist/ImageInput-BYXz8wM1.js +68 -0
- package/dist/{KpiCardsLayout-XZTxB8FV.js → KpiCardsLayout-B-lMaUMA.js} +4 -4
- package/dist/{MultiSelect-Cj8vgAXJ.js → MultiSelect-Dkz1dgXo.js} +52 -51
- package/dist/{PieChart-D6y5EQnh.js → PieChart-bDy_V9Xt.js} +82 -81
- package/dist/SearchInput-CJ2YZpmB.js +244 -0
- package/dist/{SkeletonCards-CYo_lvKx.js → SkeletonCards-Bg2ygjwy.js} +1 -1
- package/dist/{TableFilter-DbnGaGKL.js → TableFilter-u6F06nMx.js} +133 -130
- package/dist/ThemeSelector-BRpEgvX8.js +49 -0
- package/dist/Topbar-bIyAunNd.js +318 -0
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/ChartCard.d.ts.map +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/ActiveFilters.d.ts.map +1 -1
- package/dist/components/core/filters/AdvancedFilters.d.ts.map +1 -1
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/GenericForm.d.ts.map +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +18 -18
- package/dist/components/core/inputs/DateRangePicker.d.ts.map +1 -1
- package/dist/components/core/inputs/ImageInput.d.ts.map +1 -1
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +3 -3
- package/dist/components/core/navbar/GlobalSearch.d.ts.map +1 -1
- package/dist/components/core/navbar/Sidebar.d.ts.map +1 -1
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/ErrorAlert.d.ts.map +1 -1
- package/dist/components/core/states/ErrorState.d.ts.map +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/DataTable.d.ts.map +1 -1
- package/dist/components/core/table/TableBody.d.ts +1 -1
- package/dist/components/core/table/TableBody.d.ts.map +1 -1
- package/dist/components/core/table/TablePagination.d.ts.map +1 -1
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/AppVerticalTabs.d.ts.map +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -1
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +18 -18
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -1
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/ui/index.js +1 -1
- package/dist/hooks/ui/useTheme.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/krosoftLocales.d.ts +175 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -0
- package/dist/i18n/useKrosoftTranslation.d.ts +15 -0
- package/dist/i18n/useKrosoftTranslation.d.ts.map +1 -0
- package/dist/providers/index.js +1 -1
- package/dist/{sheet-BQmtrGf2.js → sheet-CDqLa-FP.js} +105 -108
- package/dist/useKrosoftTranslation-DdcylBY2.js +43 -0
- package/dist/usePage-Bhb81ffo.js +82 -0
- package/dist/useTheme-Cmw14Zxi.js +25 -0
- package/package.json +1 -1
- package/dist/AppVerticalTabs-aJmAVu6F.js +0 -100
- package/dist/DataTable-0-lae9KY.js +0 -550
- package/dist/ErrorAlert-SrIcU1mM.js +0 -17
- package/dist/ErrorState-CmaxuJyW.js +0 -8
- package/dist/GenericForm-DJR7PD-i.js +0 -341
- package/dist/ImageInput-DYe2XPNZ.js +0 -67
- package/dist/SearchInput-oeq0NBIc.js +0 -251
- package/dist/ThemeSelector-BFC37dSl.js +0 -48
- package/dist/Topbar-DUq-UeR0.js +0 -306
- package/dist/usePage-BFE9lxI1.js +0 -84
- package/dist/useTheme-CSr_h5xJ.js +0 -24
package/README.md
CHANGED
|
@@ -6,6 +6,37 @@ Krosoft shared React package.
|
|
|
6
6
|
|
|
7
7
|
Storybook : **https://design.krosoft.fr**
|
|
8
8
|
|
|
9
|
+
## Libellés du package
|
|
10
|
+
|
|
11
|
+
Les composants portent leurs propres libellés — « Annuler », « Aucun résultat », placeholders de recherche, messages d'erreur de formulaire. Ils vivent dans `src/locales/{fr,en}.json`, sous le namespace i18next `krosoft`, séparé de celui de l'application pour qu'aucune clé ne se marche dessus.
|
|
12
|
+
|
|
13
|
+
Une application qui utilise i18next enregistre ces traductions une fois, après son `init` :
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import i18n from "i18next";
|
|
17
|
+
import { registerKrosoftLocales } from "@krosoft/react/i18n";
|
|
18
|
+
|
|
19
|
+
registerKrosoftLocales(i18n);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Les libellés suivent alors la langue de l'application, changement à chaud compris.
|
|
23
|
+
|
|
24
|
+
**Rien à faire pour les applications existantes.** Sans cet appel — ou sans i18next du tout — les composants retombent sur le français embarqué : le rendu est exactement celui d'avant.
|
|
25
|
+
|
|
26
|
+
### Surcharger un libellé
|
|
27
|
+
|
|
28
|
+
`registerKrosoftLocales` n'écrase pas ce qui existe déjà. Une application peut donc imposer sa propre formulation, avant ou après l'enregistrement :
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { KROSOFT_NAMESPACE } from "@krosoft/react/i18n";
|
|
32
|
+
|
|
33
|
+
i18n.addResourceBundle("fr", KROSOFT_NAMESPACE, { states: { noData: "Rien à afficher" } }, true, true);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Passer `{ overwrite: true }` fait l'inverse : les valeurs du package reprennent la main.
|
|
37
|
+
|
|
38
|
+
Les props de libellé restent prioritaires sur tout le reste : `<ChartCard emptyLabel="…" />` l'emporte sur la traduction, comme avant.
|
|
39
|
+
|
|
9
40
|
## Preset Tailwind
|
|
10
41
|
|
|
11
42
|
Le preset partagé apporte le `darkMode`, le `container`, les couleurs shadcn (`--primary`, `--background`, `--border`, `--sidebar-*`…), les couleurs krosoft (`--k-success`, `--k-topbar-*`…), les radius, les keyframes accordéon et le plugin `tailwindcss-animate`. Un projet consommateur qui déclarait tout ça dans son propre `tailwind.config` peut supprimer ces lignes et ne garder que ce qui lui est propre.
|
|
@@ -5,7 +5,7 @@ import "@radix-ui/react-aspect-ratio";
|
|
|
5
5
|
import { B as p } from "./tooltip-DVeqVwqV.js";
|
|
6
6
|
import "./chart-DntJZGxB.js";
|
|
7
7
|
import "@radix-ui/react-collapsible";
|
|
8
|
-
import "./sheet-
|
|
8
|
+
import "./sheet-CDqLa-FP.js";
|
|
9
9
|
import { MoreVerticalIcon as h } from "lucide-react";
|
|
10
10
|
import "react-resizable-panels";
|
|
11
11
|
import { c as i } from "./tailwind.helper-B6yFEsav.js";
|
|
@@ -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 "./AppActions-
|
|
3
|
+
import { A as m } from "./AppActions-BFmagl91.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: [
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { C as w, d as S, a as T } from "./chart-DntJZGxB.js";
|
|
3
|
+
import { A as b } from "./AppActions-BFmagl91.js";
|
|
4
|
+
import { A as C } from "./AppTitle-D15YXeMx.js";
|
|
5
|
+
import { bi as A, bk as P, bl as k, bj as j, b5 as z } from "./toggle-group-DLLrEwv2.js";
|
|
6
|
+
import { useRef as K, useEffect as V } from "react";
|
|
7
|
+
import { useTranslation as g } from "react-i18next";
|
|
8
|
+
import { useSearchParams as y } from "react-router-dom";
|
|
9
|
+
import { c as R } from "./tailwind.helper-B6yFEsav.js";
|
|
10
|
+
import { S as q, h as I, i as L, a as H, c as U } from "./select-BpjFWqAY.js";
|
|
11
|
+
import { ConstructionIcon as v } from "lucide-react";
|
|
12
|
+
import { u as D } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
13
|
+
function E({ titleKey: s, descriptionKey: t, actions: c = [], className: l }) {
|
|
14
|
+
return /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
15
|
+
/* @__PURE__ */ a(C, { titleKey: s, descriptionKey: t, isSubTitle: !0 }),
|
|
16
|
+
/* @__PURE__ */ a(b, { actions: c, className: l })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
function _({ titleKey: s, descriptionKey: t, actions: c = [], className: l, children: o, isSubTitle: p }) {
|
|
20
|
+
return /* @__PURE__ */ r(w, { children: [
|
|
21
|
+
/* @__PURE__ */ a(S, { children: /* @__PURE__ */ a(E, { titleKey: s, descriptionKey: t, actions: c, className: l }) }),
|
|
22
|
+
/* @__PURE__ */ a(T, { className: "space-y-4", children: o })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
function ee({ tabs: s, itemId: t, item: c, fit: l }) {
|
|
26
|
+
var d, u;
|
|
27
|
+
const { t: o } = g(), [p, f] = y(), i = p.get("tab"), m = ((d = s.find((e) => e.value === i)) == null ? void 0 : d.value) ?? ((u = s[0]) == null ? void 0 : u.value), x = (e) => {
|
|
28
|
+
const n = new URLSearchParams();
|
|
29
|
+
n.set("tab", e), f(n);
|
|
30
|
+
}, h = K(null);
|
|
31
|
+
return V(() => {
|
|
32
|
+
var n, N;
|
|
33
|
+
const e = (n = h.current) == null ? void 0 : n.querySelector('[data-state="active"]');
|
|
34
|
+
(N = e == null ? void 0 : e.scrollIntoView) == null || N.call(e, { behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
35
|
+
}, [m]), /* @__PURE__ */ r(A, { value: m, onValueChange: x, children: [
|
|
36
|
+
/* @__PURE__ */ a(P, { ref: h, className: R("w-full justify-start", l && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ r(k, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
|
|
37
|
+
e.icon ? /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: /* @__PURE__ */ a(e.icon, { className: "size-4" }) }) : null,
|
|
38
|
+
/* @__PURE__ */ a("span", { className: "text-xs sm:text-sm", children: o(e.titleKey) ?? "" }),
|
|
39
|
+
e.count ? /* @__PURE__ */ r("span", { className: "text-gray-500 text-xs", children: [
|
|
40
|
+
"(",
|
|
41
|
+
e.count(c),
|
|
42
|
+
")"
|
|
43
|
+
] }) : null
|
|
44
|
+
] }, e.value)) }),
|
|
45
|
+
s.map((e) => /* @__PURE__ */ a(j, { value: e.value, className: "mt-4", children: e.component ? e.component(t) : null }, e.value))
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
const ae = ({ tabs: s, item: t }) => {
|
|
49
|
+
var d, u;
|
|
50
|
+
const { t: c } = g(), { t: l } = D(), [o, p] = y(), f = o.get("tab"), i = ((d = s.find((e) => e.value === f)) == null ? void 0 : d.value) ?? ((u = s[0]) == null ? void 0 : u.value), m = (e) => {
|
|
51
|
+
const n = new URLSearchParams();
|
|
52
|
+
n.set("tab", e), p(n);
|
|
53
|
+
}, x = () => {
|
|
54
|
+
const e = s.find((n) => n.value === i);
|
|
55
|
+
return e ? e.component ? e.component() : h() : null;
|
|
56
|
+
}, h = () => /* @__PURE__ */ a("div", { className: "p-4 lg:p-6", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-64 text-gray-500", children: /* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
57
|
+
/* @__PURE__ */ a(v, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
|
|
58
|
+
/* @__PURE__ */ a("p", { className: "text-lg font-medium", children: l("states.underConstruction") }),
|
|
59
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-gray-400", children: l("states.comingSoon") })
|
|
60
|
+
] }) }) });
|
|
61
|
+
return /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
|
|
62
|
+
/* @__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(z, { className: "h-full", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: s.map((e, n) => /* @__PURE__ */ r(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: `px-2 py-2 rounded-control 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"}`,
|
|
66
|
+
onClick: () => !e.disabled && m(e.value),
|
|
67
|
+
children: [
|
|
68
|
+
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
69
|
+
/* @__PURE__ */ a("span", { className: "flex-1", children: c(e.titleKey) }),
|
|
70
|
+
e.count && /* @__PURE__ */ r("span", { className: "text-xs text-gray-500", children: [
|
|
71
|
+
"(",
|
|
72
|
+
e.count(t),
|
|
73
|
+
")"
|
|
74
|
+
] }),
|
|
75
|
+
!e.component && /* @__PURE__ */ a(v, { className: "size-4 text-amber-500" })
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
n
|
|
79
|
+
)) }) }) }),
|
|
80
|
+
/* @__PURE__ */ a("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ r(q, { value: i, onValueChange: m, children: [
|
|
81
|
+
/* @__PURE__ */ a(I, { className: "w-full", children: /* @__PURE__ */ a(L, { placeholder: l("select.section") }) }),
|
|
82
|
+
/* @__PURE__ */ a(H, { children: s.map((e, n) => /* @__PURE__ */ a(U, { value: e.value, disabled: e.disabled, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
83
|
+
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
84
|
+
/* @__PURE__ */ a("span", { children: c(e.titleKey) }),
|
|
85
|
+
e.count && /* @__PURE__ */ r("span", { className: "text-xs text-gray-500", children: [
|
|
86
|
+
"(",
|
|
87
|
+
e.count(t),
|
|
88
|
+
")"
|
|
89
|
+
] }),
|
|
90
|
+
!e.component && /* @__PURE__ */ a(v, { className: "size-4 text-amber-500" })
|
|
91
|
+
] }) }, n)) })
|
|
92
|
+
] }) }),
|
|
93
|
+
/* @__PURE__ */ a("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: x() })
|
|
94
|
+
] });
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
_ as A,
|
|
98
|
+
E as a,
|
|
99
|
+
ee as b,
|
|
100
|
+
ae as c
|
|
101
|
+
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as M } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { u as R } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
3
|
+
import { P as W, d as X, g as $, j, k as q, h as T, i as J, f as Q } from "./toggle-group-DLLrEwv2.js";
|
|
4
|
+
import { A as U, a as V } from "./alert-B9F1N9Qk.js";
|
|
4
5
|
import "@radix-ui/react-aspect-ratio";
|
|
5
6
|
import { B as v } from "./tooltip-DVeqVwqV.js";
|
|
6
7
|
import "./chart-DntJZGxB.js";
|
|
7
8
|
import "@radix-ui/react-collapsible";
|
|
8
|
-
import { D as
|
|
9
|
-
import { AlertCircleIcon as
|
|
9
|
+
import { D as Y, b as Z, e as _, h as L, c as ee } from "./sheet-CDqLa-FP.js";
|
|
10
|
+
import { AlertCircleIcon as le, X as S, Save as I, Pen as K } from "lucide-react";
|
|
10
11
|
import "react-resizable-panels";
|
|
11
12
|
import "clsx";
|
|
12
13
|
import "tailwind-merge";
|
|
13
14
|
import "./select-BpjFWqAY.js";
|
|
14
15
|
import "next-themes";
|
|
15
16
|
import "sonner";
|
|
16
|
-
import { useState as
|
|
17
|
+
import { useState as A, useEffect as ie } from "react";
|
|
17
18
|
import { useTranslation as O } from "react-i18next";
|
|
18
|
-
import { G as
|
|
19
|
-
import { E as
|
|
20
|
-
function
|
|
21
|
-
const { t: i } = O(), { title: b, description:
|
|
22
|
-
return /* @__PURE__ */ e(
|
|
23
|
-
u === !0 ? /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ e(
|
|
24
|
-
/* @__PURE__ */ r(
|
|
25
|
-
/* @__PURE__ */ r(
|
|
19
|
+
import { G as re } from "./GenericForm-q9dvYl_h.js";
|
|
20
|
+
import { E as se } from "./ErrorAlert-D_203tKa.js";
|
|
21
|
+
function te({ open: t, onOpenChange: d, config: l, isLoading: u, error: s, children: p }) {
|
|
22
|
+
const { t: i } = O(), { title: b, description: c, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
|
|
23
|
+
return /* @__PURE__ */ e(Y, { open: t, onOpenChange: d, children: /* @__PURE__ */ r(Z, { className: `${g} max-h-[100dvh] sm:max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
|
|
24
|
+
u === !0 ? /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ e(W, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
|
|
25
|
+
/* @__PURE__ */ r(_, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-4 sm:p-6 sm:rounded-t-surface shrink-0", children: [
|
|
26
|
+
/* @__PURE__ */ r(L, { className: "text-xl sm:text-2xl font-bold flex items-center gap-2 text-white", children: [
|
|
26
27
|
f !== void 0 ? /* @__PURE__ */ e("div", { className: "p-2 bg-white/20 rounded-control", children: /* @__PURE__ */ e(f, { className: "size-4 text-white" }) }) : null,
|
|
27
28
|
i(b)
|
|
28
29
|
] }),
|
|
29
|
-
|
|
30
|
+
c !== void 0 && c !== "" ? /* @__PURE__ */ e(ee, { className: "text-indigo-100 text-base", children: i(c) }) : null
|
|
30
31
|
] }),
|
|
31
|
-
s != null ? /* @__PURE__ */ e("div", { className: "px-6 ", children: /* @__PURE__ */ r(
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
/* @__PURE__ */ e(
|
|
32
|
+
s != null ? /* @__PURE__ */ e("div", { className: "px-6 ", children: /* @__PURE__ */ r(U, { variant: "destructive", className: "max-w-full", children: [
|
|
33
|
+
/* @__PURE__ */ e(le, { className: "size-4" }),
|
|
34
|
+
/* @__PURE__ */ e(V, { className: "break-words overflow-wrap-anywhere max-w-full", children: s.message })
|
|
34
35
|
] }) }) : null,
|
|
35
36
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 sm:px-6 py-4", children: p }),
|
|
36
37
|
n !== void 0 && n.length > 0 ? /* @__PURE__ */ e("div", { className: "sm:rounded-b-surface border-t border-gray-200 dark:border-gray-700 shrink-0 p-4 sm: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: n.map((a, k) => /* @__PURE__ */ r(v, { variant: a.variant ?? "default", onClick: a.onClick, disabled: a.disabled === !0 || u === !0, children: [
|
|
@@ -39,62 +40,62 @@ function re({ open: t, onOpenChange: c, config: l, isLoading: u, error: s, child
|
|
|
39
40
|
] }, k)) }) }) : null
|
|
40
41
|
] }) });
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function Ae({
|
|
43
44
|
open: t,
|
|
44
|
-
onOpenChange:
|
|
45
|
+
onOpenChange: d,
|
|
45
46
|
data: l,
|
|
46
47
|
title: u,
|
|
47
48
|
headerBadge: s,
|
|
48
49
|
schema: p,
|
|
49
50
|
onSave: i,
|
|
50
51
|
customFooter: b,
|
|
51
|
-
defaultEditing:
|
|
52
|
+
defaultEditing: c = !1,
|
|
52
53
|
footerActions: f = !0,
|
|
53
54
|
saveLabel: g = "Sauvegarder",
|
|
54
|
-
cancelLabel: n
|
|
55
|
+
cancelLabel: n,
|
|
55
56
|
hideSaveIcon: a = !1,
|
|
56
57
|
maxWidth: k = "sm:max-w-4xl",
|
|
57
58
|
isLoading: h = !1
|
|
58
59
|
}) {
|
|
59
|
-
const [x, N] =
|
|
60
|
-
if (
|
|
61
|
-
t && N(
|
|
62
|
-
}, [t,
|
|
63
|
-
const
|
|
60
|
+
const { t: w } = R(), [x, N] = A(c), [o, z] = A(!1), [C, P] = A(null);
|
|
61
|
+
if (ie(() => {
|
|
62
|
+
t && N(c);
|
|
63
|
+
}, [t, c]), l == null) return null;
|
|
64
|
+
const E = () => {
|
|
64
65
|
x ? i !== void 0 && C && C() : N(!0);
|
|
65
|
-
},
|
|
66
|
+
}, y = () => {
|
|
66
67
|
N(!1);
|
|
67
|
-
},
|
|
68
|
+
}, F = () => {
|
|
68
69
|
i !== void 0 && C && C();
|
|
69
70
|
}, G = async (m) => {
|
|
70
71
|
if (i) {
|
|
71
|
-
|
|
72
|
+
z(!0);
|
|
72
73
|
try {
|
|
73
74
|
await i(m), N(!1);
|
|
74
|
-
} catch (
|
|
75
|
-
console.error(
|
|
75
|
+
} catch (B) {
|
|
76
|
+
console.error(B);
|
|
76
77
|
} finally {
|
|
77
|
-
|
|
78
|
+
z(!1);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}, D = [];
|
|
81
82
|
i !== void 0 && (x ? (n !== "" && D.push({
|
|
82
|
-
label: n,
|
|
83
|
-
onClick:
|
|
83
|
+
label: n ?? w("actions.cancel"),
|
|
84
|
+
onClick: y,
|
|
84
85
|
variant: "outline",
|
|
85
86
|
disabled: o || h,
|
|
86
87
|
icon: S
|
|
87
88
|
}), D.push({
|
|
88
89
|
label: o ? "Enregistrement..." : g,
|
|
89
|
-
onClick:
|
|
90
|
+
onClick: F,
|
|
90
91
|
variant: "default",
|
|
91
92
|
disabled: o || h,
|
|
92
|
-
icon: a ? void 0 :
|
|
93
|
+
icon: a ? void 0 : I
|
|
93
94
|
})) : D.push({
|
|
94
|
-
label: "
|
|
95
|
-
onClick:
|
|
95
|
+
label: w("actions.edit"),
|
|
96
|
+
onClick: E,
|
|
96
97
|
variant: "outline",
|
|
97
|
-
icon:
|
|
98
|
+
icon: K
|
|
98
99
|
}));
|
|
99
100
|
const H = {
|
|
100
101
|
title: u(l),
|
|
@@ -102,18 +103,18 @@ function ke({
|
|
|
102
103
|
actions: f ? D : []
|
|
103
104
|
};
|
|
104
105
|
return /* @__PURE__ */ e(
|
|
105
|
-
|
|
106
|
+
te,
|
|
106
107
|
{
|
|
107
108
|
open: t,
|
|
108
109
|
onOpenChange: (m) => {
|
|
109
|
-
|
|
110
|
+
d(m), m || y();
|
|
110
111
|
},
|
|
111
112
|
config: H,
|
|
112
113
|
isLoading: o || h,
|
|
113
114
|
children: /* @__PURE__ */ r("div", { children: [
|
|
114
115
|
s !== void 0 ? /* @__PURE__ */ e("div", { className: "mb-4", children: s(l) }) : null,
|
|
115
116
|
/* @__PURE__ */ e(
|
|
116
|
-
|
|
117
|
+
re,
|
|
117
118
|
{
|
|
118
119
|
schema: p,
|
|
119
120
|
initialData: l,
|
|
@@ -130,41 +131,41 @@ function ke({
|
|
|
130
131
|
),
|
|
131
132
|
b !== void 0 ? b(l) : null,
|
|
132
133
|
i !== void 0 && !f ? /* @__PURE__ */ e("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: x ? /* @__PURE__ */ r(M, { children: [
|
|
133
|
-
n !== "" ? /* @__PURE__ */ r(v, { onClick:
|
|
134
|
+
n !== "" ? /* @__PURE__ */ r(v, { onClick: y, variant: "outline", size: "sm", disabled: o || h, children: [
|
|
134
135
|
/* @__PURE__ */ e(S, { className: "size-4 mr-2" }),
|
|
135
|
-
n
|
|
136
|
+
n ?? w("actions.cancel")
|
|
136
137
|
] }) : null,
|
|
137
|
-
/* @__PURE__ */ r(v, { onClick:
|
|
138
|
-
a ? null : /* @__PURE__ */ e(
|
|
138
|
+
/* @__PURE__ */ r(v, { onClick: F, size: "sm", disabled: o || h, className: "text-white", children: [
|
|
139
|
+
a ? null : /* @__PURE__ */ e(I, { className: "size-4 mr-2" }),
|
|
139
140
|
o ? "Enregistrement..." : g
|
|
140
141
|
] })
|
|
141
|
-
] }) : /* @__PURE__ */ r(v, { onClick:
|
|
142
|
-
/* @__PURE__ */ e(
|
|
142
|
+
] }) : /* @__PURE__ */ r(v, { onClick: E, variant: "outline", size: "sm", children: [
|
|
143
|
+
/* @__PURE__ */ e(K, { className: "size-4 mr-2" }),
|
|
143
144
|
"Modifier"
|
|
144
145
|
] }) }) : null
|
|
145
146
|
] })
|
|
146
147
|
}
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
|
-
function
|
|
150
|
+
function ze({ isLoading: t, error: d, config: l, destructive: u = !1 }) {
|
|
150
151
|
const { t: s } = O();
|
|
151
152
|
if (!l) return null;
|
|
152
153
|
const p = (i) => {
|
|
153
154
|
!i && !t && l.onClose();
|
|
154
155
|
};
|
|
155
|
-
return /* @__PURE__ */ e(
|
|
156
|
-
/* @__PURE__ */ r(
|
|
157
|
-
/* @__PURE__ */ r(
|
|
156
|
+
return /* @__PURE__ */ e(X, { open: l.isOpen, onOpenChange: p, children: /* @__PURE__ */ r($, { children: [
|
|
157
|
+
/* @__PURE__ */ r(j, { children: [
|
|
158
|
+
/* @__PURE__ */ r(q, { className: l.titleClassName, children: [
|
|
158
159
|
l.icon && /* @__PURE__ */ e(l.icon, { className: "size-4" }),
|
|
159
160
|
s(l.title)
|
|
160
161
|
] }),
|
|
161
|
-
l.headerClassName && /* @__PURE__ */ e(
|
|
162
|
-
/* @__PURE__ */ e(
|
|
163
|
-
l.itemName && /* @__PURE__ */ e(
|
|
162
|
+
l.headerClassName && /* @__PURE__ */ e(j, { className: l.headerClassName }),
|
|
163
|
+
/* @__PURE__ */ e(T, { children: s(l.description) }),
|
|
164
|
+
l.itemName && /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e("span", { className: "font-semibold block my-2", children: l.itemName }) })
|
|
164
165
|
] }),
|
|
165
|
-
/* @__PURE__ */ e(
|
|
166
|
-
/* @__PURE__ */ r(
|
|
167
|
-
/* @__PURE__ */ e(
|
|
166
|
+
/* @__PURE__ */ e(se, { error: d instanceof Error ? null : d }),
|
|
167
|
+
/* @__PURE__ */ r(J, { children: [
|
|
168
|
+
/* @__PURE__ */ e(Q, { disabled: t, children: s("common.buttons.cancel") }),
|
|
168
169
|
/* @__PURE__ */ e(
|
|
169
170
|
v,
|
|
170
171
|
{
|
|
@@ -180,7 +181,7 @@ function we({ isLoading: t, error: c, config: l, destructive: u = !1 }) {
|
|
|
180
181
|
] }) });
|
|
181
182
|
}
|
|
182
183
|
export {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
te as A,
|
|
185
|
+
ze as C,
|
|
186
|
+
Ae as F
|
|
186
187
|
};
|