@etic-insa/ui 0.2.0 → 0.3.0
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 +438 -37
- package/dist/components/etic/action.d.ts +16 -7
- package/dist/components/etic/action.js +25 -25
- package/dist/components/etic/action.js.map +1 -1
- package/dist/components/etic/app-shell.d.ts +16 -7
- package/dist/components/etic/app-shell.js +92 -85
- package/dist/components/etic/app-shell.js.map +1 -1
- package/dist/components/etic/auth-image.d.ts +29 -6
- package/dist/components/etic/auth-image.js +41 -18
- package/dist/components/etic/auth-image.js.map +1 -1
- package/dist/components/etic/button-link.d.ts +19 -0
- package/dist/components/etic/button-link.js +19 -0
- package/dist/components/etic/button-link.js.map +1 -0
- package/dist/components/etic/centered-screen.d.ts +13 -0
- package/dist/components/etic/centered-screen.js +13 -0
- package/dist/components/etic/centered-screen.js.map +1 -0
- package/dist/components/etic/confirm-dialog.d.ts +33 -3
- package/dist/components/etic/confirm-dialog.js +92 -67
- package/dist/components/etic/confirm-dialog.js.map +1 -1
- package/dist/components/etic/copy-button.d.ts +3 -2
- package/dist/components/etic/copy-button.js +3 -3
- package/dist/components/etic/copy-button.js.map +1 -1
- package/dist/components/etic/data-table-bulk-actions.d.ts +28 -4
- package/dist/components/etic/data-table-bulk-actions.js +48 -41
- package/dist/components/etic/data-table-bulk-actions.js.map +1 -1
- package/dist/components/etic/data-table-focus.d.ts +17 -0
- package/dist/components/etic/data-table-focus.js +29 -0
- package/dist/components/etic/data-table-focus.js.map +1 -0
- package/dist/components/etic/data-table-format.d.ts +3 -10
- package/dist/components/etic/data-table-format.js +4 -3
- package/dist/components/etic/data-table-format.js.map +1 -1
- package/dist/components/etic/data-table-pagination.d.ts +20 -6
- package/dist/components/etic/data-table-pagination.js +73 -43
- package/dist/components/etic/data-table-pagination.js.map +1 -1
- package/dist/components/etic/data-table-toolbar.d.ts +34 -13
- package/dist/components/etic/data-table-toolbar.js +66 -62
- package/dist/components/etic/data-table-toolbar.js.map +1 -1
- package/dist/components/etic/data-table-view-options.d.ts +44 -4
- package/dist/components/etic/data-table-view-options.js +145 -98
- package/dist/components/etic/data-table-view-options.js.map +1 -1
- package/dist/components/etic/data-table.d.ts +173 -15
- package/dist/components/etic/data-table.js +381 -202
- package/dist/components/etic/data-table.js.map +1 -1
- package/dist/components/etic/date-picker.d.ts +5 -1
- package/dist/components/etic/date-picker.js +97 -84
- package/dist/components/etic/date-picker.js.map +1 -1
- package/dist/components/etic/delete-button.d.ts +12 -4
- package/dist/components/etic/delete-button.js +21 -22
- package/dist/components/etic/delete-button.js.map +1 -1
- package/dist/components/etic/detail-list.d.ts +16 -4
- package/dist/components/etic/detail-list.js +30 -20
- package/dist/components/etic/detail-list.js.map +1 -1
- package/dist/components/etic/disclosure.d.ts +52 -0
- package/dist/components/etic/disclosure.js +70 -0
- package/dist/components/etic/disclosure.js.map +1 -0
- package/dist/components/etic/draft-resume-dialog.d.ts +42 -0
- package/dist/components/etic/draft-resume-dialog.js +60 -0
- package/dist/components/etic/draft-resume-dialog.js.map +1 -0
- package/dist/components/etic/error-banner.js +34 -38
- package/dist/components/etic/error-banner.js.map +1 -1
- package/dist/components/etic/error-boundary.js +4 -3
- package/dist/components/etic/error-boundary.js.map +1 -1
- package/dist/components/etic/explained-badge.d.ts +26 -0
- package/dist/components/etic/explained-badge.js +17 -0
- package/dist/components/etic/explained-badge.js.map +1 -0
- package/dist/components/etic/file-upload.js +66 -71
- package/dist/components/etic/file-upload.js.map +1 -1
- package/dist/components/etic/form-dialog.d.ts +25 -2
- package/dist/components/etic/form-dialog.js +95 -77
- package/dist/components/etic/form-dialog.js.map +1 -1
- package/dist/components/etic/icon-toggle.d.ts +27 -9
- package/dist/components/etic/icon-toggle.js +31 -19
- package/dist/components/etic/icon-toggle.js.map +1 -1
- package/dist/components/etic/lien.d.ts +34 -0
- package/dist/components/etic/lien.js +17 -0
- package/dist/components/etic/lien.js.map +1 -0
- package/dist/components/etic/loading.d.ts +0 -8
- package/dist/components/etic/loading.js +17 -25
- package/dist/components/etic/loading.js.map +1 -1
- package/dist/components/etic/page-container.d.ts +10 -0
- package/dist/components/etic/page-container.js +9 -5
- package/dist/components/etic/page-container.js.map +1 -1
- package/dist/components/etic/page-header.d.ts +10 -4
- package/dist/components/etic/page-header.js +48 -43
- package/dist/components/etic/page-header.js.map +1 -1
- package/dist/components/etic/phone-input.d.ts +16 -0
- package/dist/components/etic/phone-input.js +71 -65
- package/dist/components/etic/phone-input.js.map +1 -1
- package/dist/components/etic/query-boundary.d.ts +25 -2
- package/dist/components/etic/query-boundary.js +24 -12
- package/dist/components/etic/query-boundary.js.map +1 -1
- package/dist/components/etic/removable-badge.d.ts +30 -0
- package/dist/components/etic/removable-badge.js +31 -0
- package/dist/components/etic/removable-badge.js.map +1 -0
- package/dist/components/etic/save-bar.d.ts +31 -0
- package/dist/components/etic/save-bar.js +45 -0
- package/dist/components/etic/save-bar.js.map +1 -0
- package/dist/components/etic/search-select.js +1 -1
- package/dist/components/etic/search-select.js.map +1 -1
- package/dist/components/etic/segmented-control.d.ts +6 -2
- package/dist/components/etic/segmented-control.js +28 -27
- package/dist/components/etic/segmented-control.js.map +1 -1
- package/dist/components/etic/stat-grid.d.ts +15 -0
- package/dist/components/etic/stat-grid.js +17 -0
- package/dist/components/etic/stat-grid.js.map +1 -0
- package/dist/components/etic/stat-tile.d.ts +1 -1
- package/dist/components/etic/stat-tile.js +12 -18
- package/dist/components/etic/stat-tile.js.map +1 -1
- package/dist/components/etic/status-badge.d.ts +2 -4
- package/dist/components/etic/status-badge.js +13 -23
- package/dist/components/etic/status-badge.js.map +1 -1
- package/dist/components/etic/tailles-dialogue.d.ts +8 -0
- package/dist/components/etic/tailles-dialogue.js +10 -0
- package/dist/components/etic/tailles-dialogue.js.map +1 -0
- package/dist/components/etic/theme-menu.d.ts +1 -2
- package/dist/components/etic/theme-menu.js +45 -41
- package/dist/components/etic/theme-menu.js.map +1 -1
- package/dist/components/etic/toggletip.d.ts +36 -0
- package/dist/components/etic/toggletip.js +59 -0
- package/dist/components/etic/toggletip.js.map +1 -0
- package/dist/components/etic/tooltip-button.d.ts +13 -3
- package/dist/components/etic/tooltip-button.js +19 -19
- package/dist/components/etic/tooltip-button.js.map +1 -1
- package/dist/components/etic/unsaved-changes.d.ts +41 -0
- package/dist/components/etic/unsaved-changes.js +17 -0
- package/dist/components/etic/unsaved-changes.js.map +1 -0
- package/dist/components/etic/use-draft-autosave.d.ts +3 -1
- package/dist/components/etic/use-draft-autosave.js +74 -78
- package/dist/components/etic/use-draft-autosave.js.map +1 -1
- package/dist/components/etic/use-unsaved-changes-warning.d.ts +10 -0
- package/dist/components/etic/use-unsaved-changes-warning.js +20 -0
- package/dist/components/etic/use-unsaved-changes-warning.js.map +1 -0
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +5 -1
- package/dist/components/ui/avatar.js +20 -11
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -2
- package/dist/components/ui/badge.js +27 -14
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.js +13 -13
- package/dist/components/ui/button.d.ts +15 -2
- package/dist/components/ui/button.js +27 -15
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.d.ts +2 -2
- package/dist/components/ui/combobox.js +45 -32
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +10 -1
- package/dist/components/ui/dialog.js +12 -5
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.js +3 -2
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +16 -2
- package/dist/components/ui/progress.js +34 -26
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/select.d.ts +10 -2
- package/dist/components/ui/select.js +70 -50
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +6 -1
- package/dist/components/ui/sidebar.js +92 -92
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +7 -1
- package/dist/components/ui/spinner.js +9 -1
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +7 -2
- package/dist/components/ui/tooltip.js +27 -19
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/hooks/use-column-prefs.d.ts +84 -0
- package/dist/hooks/use-column-prefs.js +71 -0
- package/dist/hooks/use-column-prefs.js.map +1 -0
- package/dist/hooks/use-debounced-value.d.ts +13 -0
- package/dist/hooks/use-debounced-value.js +12 -0
- package/dist/hooks/use-debounced-value.js.map +1 -0
- package/dist/hooks/use-document-title.d.ts +5 -0
- package/dist/hooks/use-document-title.js +13 -0
- package/dist/hooks/use-document-title.js.map +1 -0
- package/dist/hooks/use-persisted-state.d.ts +43 -0
- package/dist/hooks/use-persisted-state.js +40 -0
- package/dist/hooks/use-persisted-state.js.map +1 -0
- package/dist/index.d.ts +40 -16
- package/dist/index.js +99 -76
- package/dist/lib/autofill.d.ts +18 -0
- package/dist/lib/autofill.js +10 -0
- package/dist/lib/autofill.js.map +1 -0
- package/dist/lib/dates.d.ts +20 -0
- package/dist/lib/dates.js +16 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/focus-rendu.d.ts +24 -0
- package/dist/lib/focus-rendu.js +14 -0
- package/dist/lib/focus-rendu.js.map +1 -0
- package/dist/lib/format.d.ts +54 -0
- package/dist/lib/format.js +80 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/normalize.d.ts +28 -0
- package/dist/lib/normalize.js +21 -0
- package/dist/lib/normalize.js.map +1 -0
- package/dist/lib/ordre-colonnes.d.ts +15 -0
- package/dist/lib/ordre-colonnes.js +14 -0
- package/dist/lib/ordre-colonnes.js.map +1 -0
- package/dist/lib/ton.d.ts +23 -0
- package/dist/lib/ton.js +51 -0
- package/dist/lib/ton.js.map +1 -0
- package/dist/styles.css +110 -63
- package/dist/theme.d.ts +34 -0
- package/dist/theme.js +45 -0
- package/dist/theme.js.map +1 -0
- package/package.json +4 -2
- package/src/theme-boot.js +22 -0
|
@@ -1,145 +1,158 @@
|
|
|
1
1
|
import { Calendar as e } from "../ui/calendar.js";
|
|
2
2
|
import { InputGroup as t, InputGroupAddon as n, InputGroupButton as r, InputGroupInput as ee } from "../ui/input-group.js";
|
|
3
|
-
import { Popover as te, PopoverContent as ne, PopoverTrigger as
|
|
4
|
-
import { Tooltip as
|
|
5
|
-
import { attributsDuChamp as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { Popover as te, PopoverContent as ne, PopoverTrigger as re } from "../ui/popover.js";
|
|
4
|
+
import { Tooltip as i, TooltipContent as a, TooltipTrigger as o } from "../ui/tooltip.js";
|
|
5
|
+
import { attributsDuChamp as s, useFormField as c } from "./form-field-context.js";
|
|
6
|
+
import { NO_AUTOFILL as l } from "../../lib/autofill.js";
|
|
7
|
+
import { useEffect as u, useId as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { CalendarIcon as ie, XIcon as _ } from "lucide-react";
|
|
10
|
+
import { format as v } from "date-fns/format";
|
|
11
|
+
import { isValid as y } from "date-fns/isValid";
|
|
12
|
+
import { parse as b } from "date-fns/parse";
|
|
13
|
+
import { startOfDay as x } from "date-fns/startOfDay";
|
|
10
14
|
// src/components/etic/date-picker.tsx
|
|
11
|
-
var
|
|
15
|
+
var S = "dd/MM/yyyy", C = [
|
|
12
16
|
"dd/MM/yyyy",
|
|
13
17
|
"d/M/yyyy",
|
|
14
18
|
"d/M/yy"
|
|
15
19
|
];
|
|
16
|
-
function
|
|
17
|
-
let t = e.trim(), n = /^\d{8}$/.test(t) ? ["ddMMyyyy"] : /^\d{6}$/.test(t) ? ["ddMMyy"] :
|
|
20
|
+
function ae(e) {
|
|
21
|
+
let t = e.trim(), n = /^\d{8}$/.test(t) ? ["ddMMyyyy"] : /^\d{6}$/.test(t) ? ["ddMMyy"] : C, r = t.replace(/[-.\s]+/g, "/");
|
|
18
22
|
for (let e of n) {
|
|
19
|
-
let t =
|
|
20
|
-
if (
|
|
23
|
+
let t = b(r, e, /* @__PURE__ */ new Date());
|
|
24
|
+
if (y(t) && t.getFullYear() >= 1e3) return t;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
return e && t ? `Date hors limites\u00a0: entre le ${
|
|
27
|
+
var w = (e) => e ? v(e, S) : "";
|
|
28
|
+
function oe(e, t) {
|
|
29
|
+
return e && t ? `Date hors limites\u00a0: entre le ${w(e)} et le ${w(t)}.` : e ? `Date hors limites\u00a0: à partir du ${w(e)}.` : `Date hors limites\u00a0: jusqu'au ${w(t)}.`;
|
|
26
30
|
}
|
|
27
|
-
|
|
31
|
+
var T = (e) => e ? e.getFullYear() * 12 + e.getMonth() : void 0;
|
|
32
|
+
function se(...e) {
|
|
28
33
|
return (t) => {
|
|
29
34
|
for (let n of e) typeof n == "function" ? n(t) : n && (n.current = t);
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
id:
|
|
35
|
-
required:
|
|
36
|
-
"aria-describedby":
|
|
37
|
-
"aria-invalid":
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
function E({ valeur: y, onValeurChange: b, dateMin: S, dateMax: C, listesMoisAnnee: E = !1, moisInitial: le, effacable: ue = !0, placeholder: de = "jj/mm/aaaa", disabled: D, className: O, onBlur: fe, onKeyDown: pe, id: k, name: A, form: j, required: M, ref: N, "aria-describedby": P, "aria-invalid": F, ...I }) {
|
|
38
|
+
let L = s(c(), {
|
|
39
|
+
id: k,
|
|
40
|
+
required: M,
|
|
41
|
+
"aria-describedby": P,
|
|
42
|
+
"aria-invalid": F
|
|
43
|
+
}), R = d(), z = `${R}-format`, B = `${R}-message`, V = p(null), me = f(() => se(N, V), [N]), [he, H] = m(!1), U = p(null), [W, G] = m(() => w(y)), [K, q] = m(null), J = le, [ge, Y] = m(y ?? J), [_e, ve] = m(T(J));
|
|
44
|
+
T(J) !== _e && (ve(T(J)), y === void 0 && J && Y(J));
|
|
45
|
+
let [ye, X] = m(y);
|
|
46
|
+
y?.getTime() !== ye?.getTime() && (X(y), K && y === void 0 || (G(w(y)), q(null), (y ?? J) && Y(y ?? J))), u(() => {
|
|
47
|
+
V.current?.setCustomValidity(K ?? "");
|
|
48
|
+
}, [K]);
|
|
49
|
+
let be = (e) => S !== void 0 && e < x(S) || C !== void 0 && e > x(C);
|
|
43
50
|
function Z(e) {
|
|
44
|
-
|
|
51
|
+
G(w(e)), q(null), X(e), (e ?? J) && Y(e ?? J), (e?.getTime() !== y?.getTime() || K) && b(e, { invalide: !1 });
|
|
45
52
|
}
|
|
46
53
|
function Q(e) {
|
|
47
|
-
|
|
54
|
+
q(e), y === void 0 && K || b(void 0, { invalide: !0 });
|
|
48
55
|
}
|
|
49
56
|
function $() {
|
|
50
|
-
if (!
|
|
51
|
-
let e =
|
|
57
|
+
if (!W.trim()) return Z(void 0);
|
|
58
|
+
let e = ae(W);
|
|
52
59
|
if (!e) return Q("Date illisible\xA0: saisissez jj/mm/aaaa.");
|
|
53
|
-
if (
|
|
60
|
+
if (be(e)) return Q(oe(S, C));
|
|
54
61
|
Z(e);
|
|
55
62
|
}
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
let xe = [
|
|
64
|
+
L["aria-describedby"],
|
|
65
|
+
K ? B : null,
|
|
66
|
+
z
|
|
60
67
|
].filter(Boolean).join(" ");
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
open:
|
|
63
|
-
onOpenChange:
|
|
68
|
+
return /* @__PURE__ */ g(te, {
|
|
69
|
+
open: he,
|
|
70
|
+
onOpenChange: (e, t) => {
|
|
71
|
+
U.current = e ? null : t.reason, H(e);
|
|
72
|
+
},
|
|
64
73
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
className:
|
|
67
|
-
children: [/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ g(t, {
|
|
75
|
+
className: O,
|
|
76
|
+
children: [/* @__PURE__ */ h(ee, {
|
|
77
|
+
...I,
|
|
68
78
|
...L,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
form: M,
|
|
79
|
+
ref: me,
|
|
80
|
+
form: j,
|
|
72
81
|
"aria-required": void 0,
|
|
73
|
-
"aria-describedby":
|
|
82
|
+
"aria-describedby": xe,
|
|
74
83
|
"aria-keyshortcuts": "Alt+ArrowDown",
|
|
75
|
-
value:
|
|
76
|
-
placeholder:
|
|
84
|
+
value: W,
|
|
85
|
+
placeholder: de,
|
|
77
86
|
disabled: D,
|
|
78
87
|
inputMode: "numeric",
|
|
79
|
-
|
|
80
|
-
"aria-invalid": !!
|
|
88
|
+
...l,
|
|
89
|
+
"aria-invalid": !!K || L["aria-invalid"] || void 0,
|
|
81
90
|
onChange: (e) => {
|
|
82
|
-
|
|
91
|
+
G(e.target.value), q(null);
|
|
83
92
|
},
|
|
84
93
|
onBlur: (e) => {
|
|
85
|
-
$(),
|
|
94
|
+
$(), fe?.(e);
|
|
86
95
|
},
|
|
87
96
|
onKeyDown: (e) => {
|
|
88
|
-
e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "ArrowDown" && e.altKey && (e.preventDefault(),
|
|
97
|
+
e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "ArrowDown" && e.altKey && (e.preventDefault(), H(!0)), pe?.(e);
|
|
89
98
|
}
|
|
90
|
-
}), /* @__PURE__ */
|
|
99
|
+
}), /* @__PURE__ */ g(n, {
|
|
91
100
|
align: "inline-end",
|
|
92
|
-
children: [
|
|
101
|
+
children: [ue && y && !D ? /* @__PURE__ */ h(ce, {
|
|
93
102
|
libelle: "Effacer la date",
|
|
94
103
|
onClick: () => {
|
|
95
|
-
Z(void 0),
|
|
104
|
+
Z(void 0), V.current?.focus();
|
|
96
105
|
},
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
}) : null, /* @__PURE__ */
|
|
99
|
-
render: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ h(_, {})
|
|
107
|
+
}) : null, /* @__PURE__ */ g(i, { children: [/* @__PURE__ */ h(o, {
|
|
108
|
+
render: /* @__PURE__ */ h(re, { render: /* @__PURE__ */ h(r, {
|
|
100
109
|
size: "icon-xs",
|
|
101
110
|
"aria-label": "Choisir dans le calendrier",
|
|
102
111
|
disabled: D
|
|
103
112
|
}) }),
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
}), /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ h(ie, {})
|
|
114
|
+
}), /* @__PURE__ */ h(a, { children: "Choisir dans le calendrier" })] })]
|
|
106
115
|
})]
|
|
107
116
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
id:
|
|
117
|
+
/* @__PURE__ */ h("span", {
|
|
118
|
+
id: z,
|
|
110
119
|
hidden: !0,
|
|
111
120
|
children: "Format\xA0: jj/mm/aaaa."
|
|
112
121
|
}),
|
|
113
|
-
|
|
114
|
-
id:
|
|
122
|
+
K ? /* @__PURE__ */ h("p", {
|
|
123
|
+
id: B,
|
|
115
124
|
"data-slot": "date-picker-message",
|
|
116
125
|
className: "text-sm text-destructive",
|
|
117
|
-
children:
|
|
126
|
+
children: K
|
|
118
127
|
}) : null,
|
|
119
|
-
|
|
128
|
+
A ? /* @__PURE__ */ h("input", {
|
|
120
129
|
type: "hidden",
|
|
121
|
-
name:
|
|
122
|
-
form:
|
|
130
|
+
name: A,
|
|
131
|
+
form: j,
|
|
123
132
|
disabled: D,
|
|
124
|
-
value:
|
|
133
|
+
value: y ? v(y, "yyyy-MM-dd") : ""
|
|
125
134
|
}) : null,
|
|
126
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ h(ne, {
|
|
127
136
|
className: "w-auto overflow-hidden p-0",
|
|
128
137
|
align: "end",
|
|
129
138
|
alignOffset: -8,
|
|
130
139
|
sideOffset: 10,
|
|
131
|
-
|
|
140
|
+
finalFocus: () => {
|
|
141
|
+
let e = U.current;
|
|
142
|
+
return U.current = null, e === "outside-press" || e === "focus-out" ? !1 : V.current;
|
|
143
|
+
},
|
|
144
|
+
children: /* @__PURE__ */ h(e, {
|
|
132
145
|
mode: "single",
|
|
133
146
|
required: !0,
|
|
134
|
-
selected:
|
|
135
|
-
month:
|
|
147
|
+
selected: y,
|
|
148
|
+
month: ge,
|
|
136
149
|
onMonthChange: Y,
|
|
137
|
-
captionLayout:
|
|
138
|
-
startMonth:
|
|
139
|
-
endMonth:
|
|
140
|
-
disabled: [...
|
|
150
|
+
captionLayout: E ? "dropdown" : "label",
|
|
151
|
+
startMonth: S,
|
|
152
|
+
endMonth: C,
|
|
153
|
+
disabled: [...S ? [{ before: S }] : [], ...C ? [{ after: C }] : []],
|
|
141
154
|
onSelect: (e) => {
|
|
142
|
-
Z(e),
|
|
155
|
+
Z(e), H(!1);
|
|
143
156
|
},
|
|
144
157
|
autoFocus: !0
|
|
145
158
|
})
|
|
@@ -147,16 +160,16 @@ function T({ valeur: g, onValeurChange: _, dateMin: y, dateMax: b, listesMoisAnn
|
|
|
147
160
|
]
|
|
148
161
|
});
|
|
149
162
|
}
|
|
150
|
-
function
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
render: /* @__PURE__ */
|
|
163
|
+
function ce({ libelle: e, children: t, onClick: n }) {
|
|
164
|
+
return /* @__PURE__ */ g(i, { children: [/* @__PURE__ */ h(o, {
|
|
165
|
+
render: /* @__PURE__ */ h(r, {
|
|
153
166
|
size: "icon-xs",
|
|
154
167
|
"aria-label": e,
|
|
155
168
|
onClick: n
|
|
156
169
|
}),
|
|
157
170
|
children: t
|
|
158
|
-
}), /* @__PURE__ */
|
|
171
|
+
}), /* @__PURE__ */ h(a, { children: e })] });
|
|
159
172
|
}
|
|
160
|
-
export {
|
|
173
|
+
export { E as DatePicker };
|
|
161
174
|
|
|
162
175
|
//# sourceMappingURL=date-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","names":["FORMAT","FORMATS_SAISIE","lireDate","brut","texte","motifs","normalise","motif","date","parse","isValid","afficher","format","messageBornes","dateMin","dateMax","fusionner","refs","ref","element","DatePicker","ariaDescribedby","ariaInvalid","props","champ","attributsDuChamp","useFormField","idInterne","useId","idFormat","idMessage","champRef","useRef","refChamp","useMemo","ouvert","setOuvert","useState","setTexte","valeur","refus","setRefus","mois","setMois","valeurVue","setValeurVue","useEffect","horsBornes","startOfDay","choisir","onValeurChange","refuser","raison","validerSaisie","decrit","Popover","InputGroup","InputGroupInput","event","onBlur","onKeyDown","InputGroupAddon","effacable","disabled","BoutonIcone","XIcon","Tooltip","TooltipTrigger","PopoverTrigger","InputGroupButton","CalendarIcon","TooltipContent","name","PopoverContent","Calendar","listesMoisAnnee","libelle"],"sources":["../../../src/components/etic/date-picker.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport { format, isValid, parse, startOfDay } from \"date-fns\"\nimport { CalendarIcon, XIcon } from \"lucide-react\"\n\nimport { Calendar } from \"@etic-ui/components/ui/calendar\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@etic-ui/components/ui/input-group\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@etic-ui/components/ui/tooltip\"\nimport {\n attributsDuChamp,\n useFormField,\n} from \"@etic-ui/components/etic/form-field-context\"\n\nconst FORMAT = \"dd/MM/yyyy\"\n// Formats acceptés à la saisie, du plus au moins précis : « 05/03/2026 »,\n// « 5/3/2026 », « 05-03-2026 », « 05.03.2026 », « 5/3/26 ». Les chiffres\n// seuls (« 05032026 », « 050326 ») servent le pavé numérique de l'iPhone,\n// qui n'a pas de séparateur.\nconst FORMATS_SAISIE = [\"dd/MM/yyyy\", \"d/M/yyyy\", \"d/M/yy\"]\n\nfunction lireDate(texte: string): Date | undefined {\n const brut = texte.trim()\n const motifs = /^\\d{8}$/.test(brut)\n ? [\"ddMMyyyy\"]\n : /^\\d{6}$/.test(brut)\n ? [\"ddMMyy\"]\n : FORMATS_SAISIE\n const normalise = brut.replace(/[-.\\s]+/g, \"/\")\n for (const motif of motifs) {\n // Motifs numériques : aucune locale nécessaire.\n const date = parse(normalise, motif, new Date())\n if (isValid(date) && date.getFullYear() >= 1000) return date\n }\n return undefined\n}\n\nconst afficher = (date: Date | undefined) => (date ? format(date, FORMAT) : \"\")\n\nfunction messageBornes(dateMin: Date | undefined, dateMax: Date | undefined) {\n if (dateMin && dateMax)\n return `Date hors limites\\u00a0: entre le ${afficher(dateMin)} et le ${afficher(dateMax)}.`\n if (dateMin)\n return `Date hors limites\\u00a0: à partir du ${afficher(dateMin)}.`\n return `Date hors limites\\u00a0: jusqu'au ${afficher(dateMax)}.`\n}\n\n/** Une seule ref pour celle de l'application et celle du composant. */\nfunction fusionner<T>(...refs: (Ref<T> | undefined)[]) {\n return (element: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(element)\n else if (ref) ref.current = element\n }\n }\n}\n\nexport interface DatePickerDetails {\n /** La saisie ne se lit pas comme une date permise (illisible, ou hors des\n * bornes) : la date reçue vaut alors `undefined`, et le champ dit\n * pourquoi. À bloquer avant l'envoi du formulaire. */\n invalide: boolean\n}\n\nexport interface DatePickerProps extends Omit<\n ComponentProps<\"input\">,\n \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"min\" | \"max\"\n> {\n /** Date choisie (l'heure est ignorée). */\n valeur: Date | undefined\n onValeurChange: (date: Date | undefined, details: DatePickerDetails) => void\n /** Premier et dernier jour permis. */\n dateMin?: Date\n dateMax?: Date\n /** Listes déroulantes du mois et de l'année dans le calendrier, pour les\n * dates lointaines (naissance…). */\n listesMoisAnnee?: boolean\n /** Bouton d'effacement quand une date est choisie. */\n effacable?: boolean\n}\n\n/**\n * Le « Date Picker » de shadcn, version avec saisie : la date se tape au\n * clavier (jj/mm/aaaa, ou les chiffres seuls) ou se choisit dans le\n * calendrier (Popover + Calendar, en français, semaine au lundi). La saisie\n * est lue en quittant le champ ou sur Entrée. Une saisie illisible ou hors\n * des bornes rend le champ invalide, dit pourquoi sous le champ, et\n * `onValeurChange` reçoit `undefined` avec `{ invalide: true }`.\n *\n * `className` va à l'enveloppe (`InputGroup`), le reste au champ de saisie ;\n * avec `name`, un champ caché soumet la date au format ISO (`2026-03-05`).\n */\nexport function DatePicker({\n valeur,\n onValeurChange,\n dateMin,\n dateMax,\n listesMoisAnnee = false,\n effacable = true,\n placeholder = \"jj/mm/aaaa\",\n disabled,\n className,\n onBlur,\n onKeyDown,\n id,\n name,\n form,\n required,\n ref,\n \"aria-describedby\": ariaDescribedby,\n \"aria-invalid\": ariaInvalid,\n ...props\n}: DatePickerProps) {\n const champ = attributsDuChamp(useFormField(), {\n id,\n required,\n \"aria-describedby\": ariaDescribedby,\n \"aria-invalid\": ariaInvalid,\n })\n const idInterne = useId()\n const idFormat = `${idInterne}-format`\n const idMessage = `${idInterne}-message`\n const champRef = useRef<HTMLInputElement>(null)\n const refChamp = useMemo(() => fusionner(ref, champRef), [ref])\n const [ouvert, setOuvert] = useState(false)\n const [texte, setTexte] = useState(() => afficher(valeur))\n // Pourquoi la saisie est refusée, ou `null`.\n const [refus, setRefus] = useState<string | null>(null)\n const [mois, setMois] = useState<Date | undefined>(valeur)\n // Dernière valeur vue (reçue ou émise) : une autre valeur, venue de\n // l'application (réinitialisation du formulaire…), remplace la saisie.\n // Après un refus, l'application peut enregistrer le `undefined` émis ou\n // garder sa valeur : dans les deux cas, la saisie refusée et son message\n // restent jusqu'à la prochaine frappe.\n const [valeurVue, setValeurVue] = useState(valeur)\n if (valeur?.getTime() !== valeurVue?.getTime()) {\n setValeurVue(valeur)\n if (!(refus && valeur === undefined)) {\n setTexte(afficher(valeur))\n setRefus(null)\n if (valeur) setMois(valeur)\n }\n }\n\n // Un formulaire natif refuse aussi l'envoi, avec le même message.\n useEffect(() => {\n champRef.current?.setCustomValidity(refus ?? \"\")\n }, [refus])\n\n const horsBornes = (date: Date) =>\n (dateMin !== undefined && date < startOfDay(dateMin)) ||\n (dateMax !== undefined && date > startOfDay(dateMax))\n\n function choisir(date: Date | undefined) {\n setTexte(afficher(date))\n setRefus(null)\n setValeurVue(date)\n if (date) setMois(date)\n if (date?.getTime() !== valeur?.getTime() || refus)\n onValeurChange(date, { invalide: false })\n }\n\n function refuser(raison: string) {\n setRefus(raison)\n if (valeur !== undefined || !refus)\n onValeurChange(undefined, { invalide: true })\n }\n\n function validerSaisie() {\n if (!texte.trim()) return choisir(undefined)\n const date = lireDate(texte)\n if (!date) return refuser(\"Date illisible\\u00a0: saisissez jj/mm/aaaa.\")\n if (horsBornes(date)) return refuser(messageBornes(dateMin, dateMax))\n choisir(date)\n }\n\n const decrit = [champ[\"aria-describedby\"], refus ? idMessage : null, idFormat]\n .filter(Boolean)\n .join(\" \")\n\n return (\n <Popover open={ouvert} onOpenChange={setOuvert}>\n <InputGroup className={className}>\n <InputGroupInput\n {...props}\n {...champ}\n ref={refChamp}\n form={form}\n // Le `aria-required` posé par FormField cède au vrai `required`.\n aria-required={undefined}\n aria-describedby={decrit}\n aria-keyshortcuts=\"Alt+ArrowDown\"\n value={texte}\n placeholder={placeholder}\n disabled={disabled}\n inputMode=\"numeric\"\n autoComplete=\"off\"\n aria-invalid={Boolean(refus) || champ[\"aria-invalid\"] || undefined}\n onChange={(event) => {\n setTexte(event.target.value)\n setRefus(null)\n }}\n onBlur={(event) => {\n validerSaisie()\n onBlur?.(event)\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n // Entrée lit la date sans soumettre le formulaire.\n event.preventDefault()\n validerSaisie()\n } else if (event.key === \"ArrowDown\" && event.altKey) {\n event.preventDefault()\n setOuvert(true)\n }\n onKeyDown?.(event)\n }}\n />\n <InputGroupAddon align=\"inline-end\">\n {effacable && valeur && !disabled ? (\n <BoutonIcone\n libelle=\"Effacer la date\"\n onClick={() => {\n choisir(undefined)\n // Le bouton disparaît : le focus revient au champ.\n champRef.current?.focus()\n }}\n >\n <XIcon />\n </BoutonIcone>\n ) : null}\n <Tooltip>\n <TooltipTrigger\n render={\n <PopoverTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label=\"Choisir dans le calendrier\"\n disabled={disabled}\n />\n }\n />\n }\n >\n <CalendarIcon />\n </TooltipTrigger>\n <TooltipContent>Choisir dans le calendrier</TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n </InputGroup>\n <span id={idFormat} hidden>\n {\"Format\\u00a0: jj/mm/aaaa.\"}\n </span>\n {refus ? (\n <p\n id={idMessage}\n data-slot=\"date-picker-message\"\n className=\"text-sm text-destructive\"\n >\n {refus}\n </p>\n ) : null}\n {name ? (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n disabled={disabled}\n value={valeur ? format(valeur, \"yyyy-MM-dd\") : \"\"}\n />\n ) : null}\n <PopoverContent\n className=\"w-auto overflow-hidden p-0\"\n align=\"end\"\n alignOffset={-8}\n sideOffset={10}\n >\n <Calendar\n mode=\"single\"\n // Recliquer le jour choisi le garde : on efface par le bouton.\n required\n selected={valeur}\n month={mois}\n onMonthChange={setMois}\n captionLayout={listesMoisAnnee ? \"dropdown\" : \"label\"}\n startMonth={dateMin}\n endMonth={dateMax}\n disabled={[\n ...(dateMin ? [{ before: dateMin }] : []),\n ...(dateMax ? [{ after: dateMax }] : []),\n ]}\n onSelect={(date) => {\n choisir(date)\n setOuvert(false)\n }}\n autoFocus\n />\n </PopoverContent>\n </Popover>\n )\n}\n\nfunction BoutonIcone({\n libelle,\n children,\n onClick,\n}: {\n libelle: string\n children: ReactNode\n onClick: () => void\n}) {\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label={libelle}\n onClick={onClick}\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipContent>{libelle}</TooltipContent>\n </Tooltip>\n )\n}\n"],"mappings":";;;;;;;;;;AAmCA,IAAMA,IAAS,cAKTC,IAAiB;CAAC;CAAc;CAAY;AAAQ;AAE1D,SAASC,EAAS,GAAiC;CACjD,IAAMC,IAAOC,EAAM,KAAK,GAClBC,IAAS,UAAU,KAAKF,CAAI,IAC9B,CAAC,UAAU,IACX,UAAU,KAAKA,CAAI,IACjB,CAAC,QAAQ,IACTF,GACAK,IAAYH,EAAK,QAAQ,YAAY,GAAG;CAC9C,KAAK,IAAMI,KAASF,GAAQ;EAE1B,IAAMG,IAAOC,EAAMH,GAAWC,mBAAO,IAAI,KAAK,CAAC;EAC/C,IAAIG,EAAQF,CAAI,KAAKA,EAAK,YAAY,KAAK,KAAM,OAAOA;CAC1D;AAEF;AAEA,IAAMG,KAAY,MAA4BH,IAAOI,EAAOJ,GAAMR,CAAM,IAAI;AAE5E,SAASa,EAAc,GAA2B,GAA2B;CAK3E,OAJIC,KAAWC,IACN,qCAAqCJ,EAASG,CAAO,EAAE,SAASH,EAASI,CAAO,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C;KACV,UAAU,CACR,GAAID,IAAU,CAAC,EAAE,QAAQA,EAAQ,CAAC,IAAI,CAAC,GACvC,GAAIC,IAAU,CAAC,EAAE,OAAOA,EAAQ,CAAC,IAAI,CAAC,CACxC;KACA,WAAW,MAAS;MAElB,AADAkC,EAAQzC,CAAI,GACZ4B,EAAU,EAAK;KACjB;KACA,WAAA;IACD,CAAA;GACa,CAAA;EACT;;AAEb;AAEA,SAAS4B,EAAY,EACnB,YACA,aACA,cAKC;CACD,OACE,kBAACE,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;EACE,QACE,kBAACE,GAAD;GACE,MAAK;GACL,cAAYO;GACH;EACV,CAAA;EAGF;CACa,CAAA,GAChB,kBAACL,GAAD,EAAA,UAAiBK,EAAwB,CAAA,CAClC,EAAA,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":["FORMAT","FORMATS_SAISIE","lireDate","brut","texte","motifs","normalise","motif","date","parse","isValid","afficher","format","messageBornes","dateMin","dateMax","cleMois","fusionner","refs","ref","element","DatePicker","ariaDescribedby","ariaInvalid","props","champ","attributsDuChamp","useFormField","idInterne","useId","idFormat","idMessage","champRef","useRef","refChamp","useMemo","ouvert","setOuvert","useState","raisonFermeture","setTexte","valeur","refus","setRefus","moisPropose","moisInitial","mois","setMois","moisProposeVu","setMoisProposeVu","valeurVue","setValeurVue","useEffect","horsBornes","startOfDay","choisir","onValeurChange","refuser","raison","validerSaisie","decrit","Popover","suivant","details","InputGroup","InputGroupInput","NO_AUTOFILL","event","onBlur","onKeyDown","InputGroupAddon","effacable","disabled","BoutonIcone","XIcon","Tooltip","TooltipTrigger","PopoverTrigger","InputGroupButton","CalendarIcon","TooltipContent","name","PopoverContent","Calendar","listesMoisAnnee","libelle"],"sources":["../../../src/components/etic/date-picker.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\"\n// Par sous-chemin : la racine de date-fns fait charger ses ~250 fonctions.\nimport { format } from \"date-fns/format\"\nimport { isValid } from \"date-fns/isValid\"\nimport { parse } from \"date-fns/parse\"\nimport { startOfDay } from \"date-fns/startOfDay\"\nimport { CalendarIcon, XIcon } from \"lucide-react\"\n\nimport { Calendar } from \"@etic-ui/components/ui/calendar\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@etic-ui/components/ui/input-group\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@etic-ui/components/ui/popover\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@etic-ui/components/ui/tooltip\"\nimport {\n attributsDuChamp,\n useFormField,\n} from \"@etic-ui/components/etic/form-field-context\"\nimport { NO_AUTOFILL } from \"@etic-ui/lib/autofill\"\n\nconst FORMAT = \"dd/MM/yyyy\"\n// Formats acceptés à la saisie, du plus au moins précis : « 05/03/2026 »,\n// « 5/3/2026 », « 05-03-2026 », « 05.03.2026 », « 5/3/26 ». Les chiffres\n// seuls (« 05032026 », « 050326 ») servent le pavé numérique de l'iPhone,\n// qui n'a pas de séparateur.\nconst FORMATS_SAISIE = [\"dd/MM/yyyy\", \"d/M/yyyy\", \"d/M/yy\"]\n\nfunction lireDate(texte: string): Date | undefined {\n const brut = texte.trim()\n const motifs = /^\\d{8}$/.test(brut)\n ? [\"ddMMyyyy\"]\n : /^\\d{6}$/.test(brut)\n ? [\"ddMMyy\"]\n : FORMATS_SAISIE\n const normalise = brut.replace(/[-.\\s]+/g, \"/\")\n for (const motif of motifs) {\n // Motifs numériques : aucune locale nécessaire.\n const date = parse(normalise, motif, new Date())\n if (isValid(date) && date.getFullYear() >= 1000) return date\n }\n return undefined\n}\n\nconst afficher = (date: Date | undefined) => (date ? format(date, FORMAT) : \"\")\n\nfunction messageBornes(dateMin: Date | undefined, dateMax: Date | undefined) {\n if (dateMin && dateMax)\n return `Date hors limites\\u00a0: entre le ${afficher(dateMin)} et le ${afficher(dateMax)}.`\n if (dateMin)\n return `Date hors limites\\u00a0: à partir du ${afficher(dateMin)}.`\n return `Date hors limites\\u00a0: jusqu'au ${afficher(dateMax)}.`\n}\n\n/** Clé d'un mois (année et mois), ou `undefined`. */\nconst cleMois = (date: Date | undefined) =>\n date ? date.getFullYear() * 12 + date.getMonth() : undefined\n\n/** Une seule ref pour celle de l'application et celle du composant. */\nfunction fusionner<T>(...refs: (Ref<T> | undefined)[]) {\n return (element: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(element)\n else if (ref) ref.current = element\n }\n }\n}\n\nexport interface DatePickerDetails {\n /** La saisie ne se lit pas comme une date permise (illisible, ou hors des\n * bornes) : la date reçue vaut alors `undefined`, et le champ dit\n * pourquoi. À bloquer avant l'envoi du formulaire. */\n invalide: boolean\n}\n\nexport interface DatePickerProps extends Omit<\n ComponentProps<\"input\">,\n \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"min\" | \"max\"\n> {\n /** Date choisie (l'heure est ignorée). */\n valeur: Date | undefined\n onValeurChange: (date: Date | undefined, details: DatePickerDetails) => void\n /** Premier et dernier jour permis. */\n dateMin?: Date\n dateMax?: Date\n /** Listes déroulantes du mois et de l'année dans le calendrier, pour les\n * dates lointaines (naissance…). */\n listesMoisAnnee?: boolean\n /** Mois montré à l'ouverture du calendrier tant qu'aucune date n'est\n * choisie (le mois courant par défaut) : vingt ans plus tôt pour une date\n * de naissance, par exemple. */\n moisInitial?: Date\n /** Bouton d'effacement quand une date est choisie. */\n effacable?: boolean\n}\n\n/**\n * Le « Date Picker » de shadcn, version avec saisie : la date se tape au\n * clavier (jj/mm/aaaa, ou les chiffres seuls) ou se choisit dans le\n * calendrier (Popover + Calendar, en français, semaine au lundi). La saisie\n * est lue en quittant le champ ou sur Entrée. Une saisie illisible ou hors\n * des bornes rend le champ invalide, dit pourquoi sous le champ, et\n * `onValeurChange` reçoit `undefined` avec `{ invalide: true }`.\n *\n * `className` va à l'enveloppe (`InputGroup`), le reste au champ de saisie ;\n * avec `name`, un champ caché soumet la date au format ISO (`2026-03-05`).\n */\nexport function DatePicker({\n valeur,\n onValeurChange,\n dateMin,\n dateMax,\n listesMoisAnnee = false,\n moisInitial,\n effacable = true,\n placeholder = \"jj/mm/aaaa\",\n disabled,\n className,\n onBlur,\n onKeyDown,\n id,\n name,\n form,\n required,\n ref,\n \"aria-describedby\": ariaDescribedby,\n \"aria-invalid\": ariaInvalid,\n ...props\n}: DatePickerProps) {\n const champ = attributsDuChamp(useFormField(), {\n id,\n required,\n \"aria-describedby\": ariaDescribedby,\n \"aria-invalid\": ariaInvalid,\n })\n const idInterne = useId()\n const idFormat = `${idInterne}-format`\n const idMessage = `${idInterne}-message`\n const champRef = useRef<HTMLInputElement>(null)\n const refChamp = useMemo(() => fusionner(ref, champRef), [ref])\n const [ouvert, setOuvert] = useState(false)\n // Raison de la dernière fermeture du calendrier par Base UI (clic\n // ailleurs, Échap…) ; `null` quand le composant le ferme lui-même (jour\n // choisi). Lue une fois par `finalFocus`.\n const raisonFermeture = useRef<string | null>(null)\n const [texte, setTexte] = useState(() => afficher(valeur))\n // Pourquoi la saisie est refusée, ou `null`.\n const [refus, setRefus] = useState<string | null>(null)\n // Mois proposé sans date. Le calendrier le ramène lui-même entre les\n // bornes (`startMonth` / `endMonth` de react-day-picker).\n const moisPropose = moisInitial\n const [mois, setMois] = useState<Date | undefined>(valeur ?? moisPropose)\n // Tant qu'il n'y a pas de date, le calendrier suit un `moisInitial` qui\n // change. Comparé au mois près : un `moisInitial` écrit en ligne est un\n // nouvel objet à chaque rendu, sans changer de mois.\n const [moisProposeVu, setMoisProposeVu] = useState(cleMois(moisPropose))\n if (cleMois(moisPropose) !== moisProposeVu) {\n setMoisProposeVu(cleMois(moisPropose))\n if (valeur === undefined && moisPropose) setMois(moisPropose)\n }\n // Dernière valeur vue (reçue ou émise) : une autre valeur, venue de\n // l'application (réinitialisation du formulaire…), remplace la saisie.\n // Après un refus, l'application peut enregistrer le `undefined` émis ou\n // garder sa valeur : dans les deux cas, la saisie refusée et son message\n // restent jusqu'à la prochaine frappe.\n const [valeurVue, setValeurVue] = useState(valeur)\n if (valeur?.getTime() !== valeurVue?.getTime()) {\n setValeurVue(valeur)\n if (!(refus && valeur === undefined)) {\n setTexte(afficher(valeur))\n setRefus(null)\n // Sans date, le calendrier revient au mois proposé.\n if (valeur ?? moisPropose) setMois(valeur ?? moisPropose)\n }\n }\n\n // Un formulaire natif refuse aussi l'envoi, avec le même message.\n useEffect(() => {\n champRef.current?.setCustomValidity(refus ?? \"\")\n }, [refus])\n\n const horsBornes = (date: Date) =>\n (dateMin !== undefined && date < startOfDay(dateMin)) ||\n (dateMax !== undefined && date > startOfDay(dateMax))\n\n function choisir(date: Date | undefined) {\n setTexte(afficher(date))\n setRefus(null)\n setValeurVue(date)\n if (date ?? moisPropose) setMois(date ?? moisPropose)\n if (date?.getTime() !== valeur?.getTime() || refus)\n onValeurChange(date, { invalide: false })\n }\n\n function refuser(raison: string) {\n setRefus(raison)\n if (valeur !== undefined || !refus)\n onValeurChange(undefined, { invalide: true })\n }\n\n function validerSaisie() {\n if (!texte.trim()) return choisir(undefined)\n const date = lireDate(texte)\n if (!date) return refuser(\"Date illisible\\u00a0: saisissez jj/mm/aaaa.\")\n if (horsBornes(date)) return refuser(messageBornes(dateMin, dateMax))\n choisir(date)\n }\n\n const decrit = [champ[\"aria-describedby\"], refus ? idMessage : null, idFormat]\n .filter(Boolean)\n .join(\" \")\n\n return (\n <Popover\n open={ouvert}\n onOpenChange={(suivant, details) => {\n raisonFermeture.current = suivant ? null : details.reason\n setOuvert(suivant)\n }}\n >\n <InputGroup className={className}>\n <InputGroupInput\n {...props}\n {...champ}\n ref={refChamp}\n form={form}\n // Le `aria-required` posé par FormField cède au vrai `required`.\n aria-required={undefined}\n aria-describedby={decrit}\n aria-keyshortcuts=\"Alt+ArrowDown\"\n value={texte}\n placeholder={placeholder}\n disabled={disabled}\n inputMode=\"numeric\"\n // `autoComplete=\"off\"` seul n'arrête pas les gestionnaires de mots\n // de passe : ils proposaient un identifiant dans une date.\n {...NO_AUTOFILL}\n aria-invalid={Boolean(refus) || champ[\"aria-invalid\"] || undefined}\n onChange={(event) => {\n setTexte(event.target.value)\n setRefus(null)\n }}\n onBlur={(event) => {\n validerSaisie()\n onBlur?.(event)\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n // Entrée lit la date sans soumettre le formulaire.\n event.preventDefault()\n validerSaisie()\n } else if (event.key === \"ArrowDown\" && event.altKey) {\n event.preventDefault()\n setOuvert(true)\n }\n onKeyDown?.(event)\n }}\n />\n <InputGroupAddon align=\"inline-end\">\n {effacable && valeur && !disabled ? (\n <BoutonIcone\n libelle=\"Effacer la date\"\n onClick={() => {\n choisir(undefined)\n // Le bouton disparaît : le focus revient au champ.\n champRef.current?.focus()\n }}\n >\n <XIcon />\n </BoutonIcone>\n ) : null}\n <Tooltip>\n <TooltipTrigger\n render={\n <PopoverTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label=\"Choisir dans le calendrier\"\n disabled={disabled}\n />\n }\n />\n }\n >\n <CalendarIcon />\n </TooltipTrigger>\n <TooltipContent>Choisir dans le calendrier</TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n </InputGroup>\n <span id={idFormat} hidden>\n {\"Format\\u00a0: jj/mm/aaaa.\"}\n </span>\n {refus ? (\n <p\n id={idMessage}\n data-slot=\"date-picker-message\"\n className=\"text-sm text-destructive\"\n >\n {refus}\n </p>\n ) : null}\n {name ? (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n disabled={disabled}\n value={valeur ? format(valeur, \"yyyy-MM-dd\") : \"\"}\n />\n ) : null}\n <PopoverContent\n className=\"w-auto overflow-hidden p-0\"\n align=\"end\"\n alignOffset={-8}\n sideOffset={10}\n // Fermé au clavier ou par un jour choisi, le calendrier rend le\n // focus au champ et non au bouton : son infobulle, rouverte par ce\n // focus, aurait absorbé l'Échap suivant (celui qui ferme le dialogue\n // englobant). Après un clic ailleurs ou un focus parti ailleurs, il\n // reste où il est : une ref seule le ramènerait de force au champ.\n // Base UI ne donne ici que le type de pointeur, d'où la raison\n // retenue par `onOpenChange`.\n finalFocus={() => {\n const raison = raisonFermeture.current\n raisonFermeture.current = null\n return raison === \"outside-press\" || raison === \"focus-out\"\n ? false\n : champRef.current\n }}\n >\n <Calendar\n mode=\"single\"\n // Recliquer le jour choisi le garde : on efface par le bouton.\n required\n selected={valeur}\n month={mois}\n onMonthChange={setMois}\n captionLayout={listesMoisAnnee ? \"dropdown\" : \"label\"}\n startMonth={dateMin}\n endMonth={dateMax}\n disabled={[\n ...(dateMin ? [{ before: dateMin }] : []),\n ...(dateMax ? [{ after: dateMax }] : []),\n ]}\n onSelect={(date) => {\n choisir(date)\n setOuvert(false)\n }}\n autoFocus\n />\n </PopoverContent>\n </Popover>\n )\n}\n\nfunction BoutonIcone({\n libelle,\n children,\n onClick,\n}: {\n libelle: string\n children: ReactNode\n onClick: () => void\n}) {\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <InputGroupButton\n size=\"icon-xs\"\n aria-label={libelle}\n onClick={onClick}\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipContent>{libelle}</TooltipContent>\n </Tooltip>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,IAAMA,IAAS,cAKTC,IAAiB;CAAC;CAAc;CAAY;AAAQ;AAE1D,SAASC,GAAS,GAAiC;CACjD,IAAMC,IAAOC,EAAM,KAAK,GAClBC,IAAS,UAAU,KAAKF,CAAI,IAC9B,CAAC,UAAU,IACX,UAAU,KAAKA,CAAI,IACjB,CAAC,QAAQ,IACTF,GACAK,IAAYH,EAAK,QAAQ,YAAY,GAAG;CAC9C,KAAK,IAAMI,KAASF,GAAQ;EAE1B,IAAMG,IAAOC,EAAMH,GAAWC,mBAAO,IAAI,KAAK,CAAC;EAC/C,IAAIG,EAAQF,CAAI,KAAKA,EAAK,YAAY,KAAK,KAAM,OAAOA;CAC1D;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wB,CAAA,CAClC,EAAA,CAAA;AAEb"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ActionDialogue } from './action';
|
|
3
3
|
import { ConfirmDialogSaisie, DialogFinalFocus } from './confirm-dialog';
|
|
4
|
+
import { TooltipButtonProps } from './tooltip-button';
|
|
4
5
|
export interface DeleteButtonProps {
|
|
5
6
|
/**
|
|
6
7
|
* Ce qui est supprimé, avec son déterminant : « ce groupe ». Donne le nom
|
|
@@ -36,15 +37,22 @@ export interface DeleteButtonProps {
|
|
|
36
37
|
* écrit en toutes lettres.
|
|
37
38
|
*/
|
|
38
39
|
avecTexte?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Taille du bouton, celle de `Button` : `icon-sm` par défaut pour la
|
|
42
|
+
* corbeille, `default` avec `avecTexte`. Dans un `DetailHeader`
|
|
43
|
+
* `tailleActions="lg"`, `icon-lg` (ou `lg` avec `avecTexte`).
|
|
44
|
+
*/
|
|
45
|
+
size?: TooltipButtonProps["size"];
|
|
39
46
|
/** Ouverture de la confirmation suivie par l'application (le bouton reste
|
|
40
47
|
* son déclencheur) : pour oublier un état « en deux temps » à la
|
|
41
48
|
* fermeture, par exemple. */
|
|
42
49
|
ouvert?: boolean;
|
|
43
50
|
onOuvertChange?: (ouvert: boolean) => void;
|
|
44
51
|
/**
|
|
45
|
-
* Où mettre le focus quand la confirmation se ferme.
|
|
46
|
-
*
|
|
47
|
-
* le
|
|
52
|
+
* Où mettre le focus quand la confirmation se ferme. Par défaut, le
|
|
53
|
+
* bouton. Dans une ligne de `DataTable` qui disparaît avec la suppression,
|
|
54
|
+
* le tableau rend lui-même le focus à la ligne voisine ; ailleurs (fiche
|
|
55
|
+
* supprimée, tableau rendu à la main), à fournir : le titre de la liste…
|
|
48
56
|
*/
|
|
49
57
|
finalFocus?: DialogFinalFocus;
|
|
50
58
|
className?: string;
|
|
@@ -54,4 +62,4 @@ export interface DeleteButtonProps {
|
|
|
54
62
|
* une colonne de corbeilles rouges ferait une colonne d'alarmes), qui ouvre
|
|
55
63
|
* une confirmation nommant ce qui va être détruit.
|
|
56
64
|
*/
|
|
57
|
-
export declare function DeleteButton({ libelle, onSupprimer, confirmation, verrou, avecTexte, ouvert, onOuvertChange, finalFocus, className, }: DeleteButtonProps): import("react").JSX.Element;
|
|
65
|
+
export declare function DeleteButton({ libelle, onSupprimer, confirmation, verrou, avecTexte, size, ouvert, onOuvertChange, finalFocus, className, }: DeleteButtonProps): import("react").JSX.Element;
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import { ConfirmDialog as e } from "./confirm-dialog.js";
|
|
2
2
|
import { TooltipButton as t } from "./tooltip-button.js";
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
4
|
import { Trash2Icon as a } from "lucide-react";
|
|
6
5
|
// src/components/etic/delete-button.tsx
|
|
7
|
-
function o({ libelle: o, onSupprimer: s, confirmation: c, verrou: l, avecTexte: u = !1,
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
"aria-label": h,
|
|
6
|
+
function o({ libelle: o, onSupprimer: s, confirmation: c, verrou: l, avecTexte: u = !1, size: d, ouvert: f, onOuvertChange: p, finalFocus: m, className: h }) {
|
|
7
|
+
let g = `Supprimer ${o}`, _ = /* @__PURE__ */ r(t, {
|
|
8
|
+
"aria-label": g,
|
|
11
9
|
verrou: l,
|
|
12
|
-
className:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
className: h,
|
|
11
|
+
...u ? {
|
|
12
|
+
variant: "destructive",
|
|
13
|
+
size: d
|
|
14
|
+
} : {
|
|
15
|
+
variant: "ghost",
|
|
16
|
+
size: d ?? "icon-sm",
|
|
17
|
+
infobulle: g,
|
|
18
|
+
destructif: !0
|
|
19
|
+
},
|
|
20
|
+
children: u ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(a, { "data-icon": "inline-start" }), "Supprimer"] }) : /* @__PURE__ */ r(a, {})
|
|
22
21
|
});
|
|
23
|
-
return l ?
|
|
24
|
-
titre: c.titre ??
|
|
22
|
+
return l ? _ : /* @__PURE__ */ r(e, {
|
|
23
|
+
titre: c.titre ?? g,
|
|
25
24
|
description: c.description,
|
|
26
25
|
libelleConfirmer: c.libelleConfirmer ?? "Supprimer",
|
|
27
26
|
saisie: c.saisie,
|
|
28
27
|
onConfirmer: s,
|
|
29
|
-
declencheur:
|
|
30
|
-
ouvert:
|
|
31
|
-
onOuvertChange:
|
|
32
|
-
finalFocus:
|
|
28
|
+
declencheur: _,
|
|
29
|
+
ouvert: f,
|
|
30
|
+
onOuvertChange: p,
|
|
31
|
+
finalFocus: m,
|
|
33
32
|
children: c.details
|
|
34
33
|
});
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-button.js","names":["DeleteButton","nom","libelle","bouton","
|
|
1
|
+
{"version":3,"file":"delete-button.js","names":["_Fragment","DeleteButton","nom","libelle","bouton","TooltipButton","avecTexte","size","Fragment","Trash2Icon","verrou","ConfirmDialog","confirmation","onSupprimer"],"sources":["../../../src/components/etic/delete-button.tsx"],"sourcesContent":["import type { ReactNode } from \"react\"\nimport { Trash2Icon } from \"lucide-react\"\n\nimport type { ActionDialogue } from \"@etic-ui/components/etic/action\"\nimport {\n ConfirmDialog,\n type ConfirmDialogSaisie,\n type DialogFinalFocus,\n} from \"@etic-ui/components/etic/confirm-dialog\"\nimport {\n TooltipButton,\n type TooltipButtonProps,\n} from \"@etic-ui/components/etic/tooltip-button\"\n\nexport interface DeleteButtonProps {\n /**\n * Ce qui est supprimé, avec son déterminant : « ce groupe ». Donne le nom\n * accessible et l'infobulle (« Supprimer ce groupe »), et le titre de la\n * confirmation par défaut.\n */\n libelle: string\n /**\n * La suppression, lancée après confirmation (voir `ConfirmDialog`) :\n * promesse attendue, erreur affichée dans le dialogue, `false` pour le\n * garder ouvert sans erreur (suppression en deux temps).\n */\n onSupprimer: ActionDialogue\n /** Ce que dit la confirmation. */\n confirmation: {\n /** « Supprimer {libelle} » par défaut. */\n titre?: string\n /** La phrase qui nomme ce qui sera détruit : « Le groupe Bureau et ses\n * 14 rattachements seront supprimés définitivement. » */\n description: ReactNode\n /** Sous la description : la liste des éléments touchés… */\n details?: ReactNode\n /** « Supprimer » par défaut. */\n libelleConfirmer?: string\n saisie?: ConfirmDialogSaisie\n }\n /** Suppression impossible : le bouton est désactivé et son infobulle dit\n * pourquoi, au lieu de promettre une action qu'il refusera. */\n verrou?: string\n /**\n * Le mot « Supprimer » au lieu de la corbeille : pour un en-tête de page,\n * parmi d'autres boutons texte, où détruire toute la fiche mérite d'être\n * écrit en toutes lettres.\n */\n avecTexte?: boolean\n /**\n * Taille du bouton, celle de `Button` : `icon-sm` par défaut pour la\n * corbeille, `default` avec `avecTexte`. Dans un `DetailHeader`\n * `tailleActions=\"lg\"`, `icon-lg` (ou `lg` avec `avecTexte`).\n */\n size?: TooltipButtonProps[\"size\"]\n /** Ouverture de la confirmation suivie par l'application (le bouton reste\n * son déclencheur) : pour oublier un état « en deux temps » à la\n * fermeture, par exemple. */\n ouvert?: boolean\n onOuvertChange?: (ouvert: boolean) => void\n /**\n * Où mettre le focus quand la confirmation se ferme. Par défaut, le\n * bouton. Dans une ligne de `DataTable` qui disparaît avec la suppression,\n * le tableau rend lui-même le focus à la ligne voisine ; ailleurs (fiche\n * supprimée, tableau rendu à la main), à fournir : le titre de la liste…\n */\n finalFocus?: DialogFinalFocus\n className?: string\n}\n\n/**\n * Bouton de suppression : une corbeille discrète (rouge au survol seulement :\n * une colonne de corbeilles rouges ferait une colonne d'alarmes), qui ouvre\n * une confirmation nommant ce qui va être détruit.\n */\nexport function DeleteButton({\n libelle,\n onSupprimer,\n confirmation,\n verrou,\n avecTexte = false,\n size,\n ouvert,\n onOuvertChange,\n finalFocus,\n className,\n}: DeleteButtonProps) {\n const nom = `Supprimer ${libelle}`\n const bouton = (\n <TooltipButton\n aria-label={nom}\n verrou={verrou}\n className={className}\n {...(avecTexte\n ? { variant: \"destructive\", size }\n : {\n variant: \"ghost\",\n size: size ?? \"icon-sm\",\n infobulle: nom,\n destructif: true,\n })}\n >\n {avecTexte ? (\n <>\n <Trash2Icon data-icon=\"inline-start\" />\n Supprimer\n </>\n ) : (\n <Trash2Icon />\n )}\n </TooltipButton>\n )\n\n if (verrou) return bouton\n\n return (\n <ConfirmDialog\n titre={confirmation.titre ?? nom}\n description={confirmation.description}\n libelleConfirmer={confirmation.libelleConfirmer ?? \"Supprimer\"}\n saisie={confirmation.saisie}\n onConfirmer={onSupprimer}\n declencheur={bouton}\n ouvert={ouvert}\n onOuvertChange={onOuvertChange}\n finalFocus={finalFocus}\n >\n {confirmation.details}\n </ConfirmDialog>\n )\n}\n"],"mappings":";;;;;AA2EA,SAAgBC,EAAa,EAC3B,YACA,gBACA,iBACA,WACA,eAAY,IACZ,SACA,WACA,mBACA,eACA,gBACoB;CACpB,IAAMC,IAAM,aAAaC,KACnBC,IACJ,kBAACC,GAAD;EACE,cAAYH;EACJ;EACG;EACX,GAAKI,IACD;GAAE,SAAS;GAAe;EAAK,IAC/B;GACE,SAAS;GACT,MAAMC,KAAQ;GACd,WAAWL;GACX,YAAY;EACd;EAEH,UAAAI,IACC,kBAAAN,GAAA,EAAA,UAAA,CACE,kBAACS,GAAD,EAAY,aAAU,eAAgB,CAAA,GAAC,WAEvC,EAAA,CAAA,IAEF,kBAACA,GAAD,CAAa,CAAA;CAEF,CAAA;CAKjB,OAFIC,IAAeN,IAGjB,kBAACO,GAAD;EACE,OAAOC,EAAa,SAASV;EAC7B,aAAaU,EAAa;EAC1B,kBAAkBA,EAAa,oBAAoB;EACnD,QAAQA,EAAa;EACrB,aAAaC;EACb,aAAaT;EACL;EACQ;EACJ;EAEX,UAAAQ,EAAa;CACD,CAAA;AAEnB"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
2
|
+
/** Mise en page des paires d'une `DetailList` :
|
|
3
|
+
* - `grille` : libellé au-dessus de la valeur, une colonne sur téléphone,
|
|
4
|
+
* autant que la largeur en permet au-delà ;
|
|
5
|
+
* - `pile` : libellé au-dessus de la valeur, une seule colonne sur toute la
|
|
6
|
+
* largeur quelle que soit la place (carte étroite, dialogue, valeurs
|
|
7
|
+
* longues) ;
|
|
8
|
+
* - `ligne` : métadonnées secondaires (identifiants, User-Agent…), « libellé :
|
|
9
|
+
* valeur » en petit et en discret, l'une après l'autre sur toute la largeur,
|
|
10
|
+
* avec passage à la ligne au besoin. */
|
|
11
|
+
export type DetailListDisposition = "grille" | "pile" | "ligne";
|
|
12
|
+
export interface DetailListProps extends ComponentProps<"dl"> {
|
|
13
|
+
/** `grille` par défaut ; voir `DetailListDisposition`. */
|
|
14
|
+
disposition?: DetailListDisposition;
|
|
15
|
+
}
|
|
16
|
+
/** Liste de paires libellé / valeur (`<dl>`), disposée selon `disposition`. */
|
|
17
|
+
export declare function DetailList({ disposition, className, ...props }: DetailListProps): import("react").JSX.Element;
|
|
6
18
|
export interface DetailItemProps {
|
|
7
19
|
libelle: ReactNode;
|
|
8
20
|
/** La valeur ; absente (`null`, `undefined`, `false`, chaîne vide), elle
|
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
import { cn as e } from "cn";
|
|
2
|
-
import {
|
|
2
|
+
import { createContext as t, useContext as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
4
|
// src/components/etic/detail-list.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var a = t("grille"), o = {
|
|
6
|
+
grille: "grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-[repeat(auto-fill,minmax(14rem,1fr))]",
|
|
7
|
+
pile: "grid grid-cols-1 gap-y-4",
|
|
8
|
+
ligne: "flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-foreground"
|
|
9
|
+
};
|
|
10
|
+
function s({ disposition: t = "grille", className: n, ...i }) {
|
|
11
|
+
return /* @__PURE__ */ r(a.Provider, {
|
|
12
|
+
value: t,
|
|
13
|
+
children: /* @__PURE__ */ r("dl", {
|
|
14
|
+
"data-slot": "detail-list",
|
|
15
|
+
"data-disposition": t,
|
|
16
|
+
className: e(o[t], n),
|
|
17
|
+
...i
|
|
18
|
+
})
|
|
9
19
|
});
|
|
10
20
|
}
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
21
|
+
function c({ libelle: t, children: o, className: s }) {
|
|
22
|
+
let c = n(a) === "ligne", l = o == null || o === !1 || o === "";
|
|
23
|
+
return /* @__PURE__ */ i("div", {
|
|
14
24
|
"data-slot": "detail-item",
|
|
15
|
-
className: e("flex min-w-0 flex-col gap-0.5",
|
|
16
|
-
children: [/* @__PURE__ */
|
|
17
|
-
className: "text-xs text-muted-foreground",
|
|
18
|
-
children:
|
|
19
|
-
}), /* @__PURE__ */
|
|
20
|
-
className: "
|
|
21
|
-
children:
|
|
25
|
+
className: e(c ? "min-w-0" : "flex min-w-0 flex-col gap-0.5", s),
|
|
26
|
+
children: [/* @__PURE__ */ i("dt", {
|
|
27
|
+
className: c ? "inline" : "text-xs text-muted-foreground",
|
|
28
|
+
children: [t, c ? " : " : null]
|
|
29
|
+
}), /* @__PURE__ */ r("dd", {
|
|
30
|
+
className: e("break-words", c ? "inline" : "text-sm"),
|
|
31
|
+
children: l ? /* @__PURE__ */ i("span", {
|
|
22
32
|
className: "text-muted-foreground",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
33
|
+
children: [/* @__PURE__ */ r("span", {
|
|
24
34
|
"aria-hidden": !0,
|
|
25
35
|
children: "—"
|
|
26
|
-
}), /* @__PURE__ */
|
|
36
|
+
}), /* @__PURE__ */ r("span", {
|
|
27
37
|
className: "sr-only",
|
|
28
38
|
children: "Non renseigné"
|
|
29
39
|
})]
|
|
30
|
-
}) :
|
|
40
|
+
}) : o
|
|
31
41
|
})]
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
|
-
export {
|
|
44
|
+
export { c as DetailItem, s as DetailList };
|
|
35
45
|
|
|
36
46
|
//# sourceMappingURL=detail-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detail-list.js","names":["DetailList","props","cn","className","DetailItem","vide","children","libelle"],"sources":["../../../src/components/etic/detail-list.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"detail-list.js","names":["DispositionContext","createContext","CLASSES_LISTE","DetailList","props","disposition","cn","className","DetailItem","enLigne","useContext","vide","children","libelle"],"sources":["../../../src/components/etic/detail-list.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ReactNode,\n} from \"react\"\nimport { cn } from \"cn\"\n\n/** Mise en page des paires d'une `DetailList` :\n * - `grille` : libellé au-dessus de la valeur, une colonne sur téléphone,\n * autant que la largeur en permet au-delà ;\n * - `pile` : libellé au-dessus de la valeur, une seule colonne sur toute la\n * largeur quelle que soit la place (carte étroite, dialogue, valeurs\n * longues) ;\n * - `ligne` : métadonnées secondaires (identifiants, User-Agent…), « libellé :\n * valeur » en petit et en discret, l'une après l'autre sur toute la largeur,\n * avec passage à la ligne au besoin. */\nexport type DetailListDisposition = \"grille\" | \"pile\" | \"ligne\"\n\nconst DispositionContext = createContext<DetailListDisposition>(\"grille\")\n\nconst CLASSES_LISTE: Record<DetailListDisposition, string> = {\n grille:\n \"grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-[repeat(auto-fill,minmax(14rem,1fr))]\",\n pile: \"grid grid-cols-1 gap-y-4\",\n ligne: \"flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-foreground\",\n}\n\nexport interface DetailListProps extends ComponentProps<\"dl\"> {\n /** `grille` par défaut ; voir `DetailListDisposition`. */\n disposition?: DetailListDisposition\n}\n\n/** Liste de paires libellé / valeur (`<dl>`), disposée selon `disposition`. */\nexport function DetailList({\n disposition = \"grille\",\n className,\n ...props\n}: DetailListProps) {\n return (\n <DispositionContext.Provider value={disposition}>\n <dl\n data-slot=\"detail-list\"\n data-disposition={disposition}\n className={cn(CLASSES_LISTE[disposition], className)}\n {...props}\n />\n </DispositionContext.Provider>\n )\n}\n\nexport interface DetailItemProps {\n libelle: ReactNode\n /** La valeur ; absente (`null`, `undefined`, `false`, chaîne vide), elle\n * s'affiche « — », en discret. `false` couvre le motif `{cond && x}`. */\n children?: ReactNode\n className?: string\n}\n\n/** Une paire libellé / valeur, dans une `DetailList`. */\nexport function DetailItem({ libelle, children, className }: DetailItemProps) {\n const enLigne = useContext(DispositionContext) === \"ligne\"\n const vide =\n children === null ||\n children === undefined ||\n children === false ||\n children === \"\"\n return (\n <div\n data-slot=\"detail-item\"\n className={cn(\n enLigne ? \"min-w-0\" : \"flex min-w-0 flex-col gap-0.5\",\n className\n )}\n >\n <dt className={enLigne ? \"inline\" : \"text-xs text-muted-foreground\"}>\n {libelle}\n {enLigne ? \" : \" : null}\n </dt>\n <dd className={cn(\"break-words\", enLigne ? \"inline\" : \"text-sm\")}>\n {vide ? (\n <span className=\"text-muted-foreground\">\n <span aria-hidden>—</span>\n <span className=\"sr-only\">Non renseigné</span>\n </span>\n ) : (\n children\n )}\n </dd>\n </div>\n )\n}\n"],"mappings":";;;;AAmBA,IAAMA,IAAqBC,EAAqC,QAAQ,GAElEC,IAAuD;CAC3D,QACE;CACF,MAAM;CACN,OAAO;AACT;AAQA,SAAgBC,EAAW,EACzB,iBAAc,UACd,cACA,GAAGC,KACe;CAClB,OACE,kBAACJ,EAAmB,UAApB;EAA6B,OAAOK;EAClC,UAAA,kBAAC,MAAD;GACE,aAAU;GACV,oBAAkBA;GAClB,WAAWC,EAAGJ,EAAcG,IAAcE,CAAS;GACnD,GAAIH;EACL,CAAA;CAC0B,CAAA;AAEjC;AAWA,SAAgBI,EAAW,EAAE,YAAS,aAAU,gBAA8B;CAC5E,IAAMC,IAAUC,EAAWV,CAAkB,MAAM,SAC7CW,IACJC,KAAa,QAEbA,MAAa,MACbA,MAAa;CACf,OACE,kBAAC,OAAD;EACE,aAAU;EACV,WAAWN,EACTG,IAAU,YAAY,iCACtBF,CACF;EALF,UAAA,CAOE,kBAAC,MAAD;GAAI,WAAWE,IAAU,WAAW;GAApC,UAAA,CACGI,GACAJ,IAAU,QAAQ,IACjB;EACJ,CAAA,GAAA,kBAAC,MAAD;GAAI,WAAWH,EAAG,eAAeG,IAAU,WAAW,SAAS;GAC5D,UAAAE,IACC,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAAC,QAAD;KAAM,eAAA;KAAY,UAAA;IAAO,CAAA,GACzB,kBAAC,QAAD;KAAM,WAAU;KAAU,UAAA;IAAmB,CAAA,CACzC;GAEN,CAAA,IAAAC;EAEA,CAAA,CACD;;AAET"}
|