@etic-insa/ui 0.5.0 → 0.7.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.
Files changed (100) hide show
  1. package/README.md +323 -62
  2. package/dist/charts/index.d.ts +1 -0
  3. package/dist/charts/index.js +1 -0
  4. package/dist/components/etic/app-shell.d.ts +10 -0
  5. package/dist/components/etic/app-shell.js +144 -117
  6. package/dist/components/etic/app-shell.js.map +1 -1
  7. package/dist/components/etic/code-block.d.ts +15 -0
  8. package/dist/components/etic/code-block.js +21 -0
  9. package/dist/components/etic/code-block.js.map +1 -0
  10. package/dist/components/etic/data-table-toolbar.d.ts +12 -1
  11. package/dist/components/etic/data-table-toolbar.js +50 -39
  12. package/dist/components/etic/data-table-toolbar.js.map +1 -1
  13. package/dist/components/etic/data-table-view-options.d.ts +2 -1
  14. package/dist/components/etic/data-table-view-options.js +1 -1
  15. package/dist/components/etic/data-table-view-options.js.map +1 -1
  16. package/dist/components/etic/detail-meta.d.ts +28 -0
  17. package/dist/components/etic/detail-meta.js +51 -0
  18. package/dist/components/etic/detail-meta.js.map +1 -0
  19. package/dist/components/etic/detail-sheet.d.ts +36 -0
  20. package/dist/components/etic/detail-sheet.js +37 -0
  21. package/dist/components/etic/detail-sheet.js.map +1 -0
  22. package/dist/components/etic/empty-state.d.ts +15 -0
  23. package/dist/components/etic/empty-state.js +24 -12
  24. package/dist/components/etic/empty-state.js.map +1 -1
  25. package/dist/components/etic/error-banner.js +8 -5
  26. package/dist/components/etic/error-banner.js.map +1 -1
  27. package/dist/components/etic/external-link.d.ts +40 -0
  28. package/dist/components/etic/external-link.js +47 -0
  29. package/dist/components/etic/external-link.js.map +1 -0
  30. package/dist/components/etic/file-upload.d.ts +19 -0
  31. package/dist/components/etic/file-upload.js +24 -1
  32. package/dist/components/etic/file-upload.js.map +1 -1
  33. package/dist/components/etic/form-field.d.ts +10 -1
  34. package/dist/components/etic/form-field.js +32 -28
  35. package/dist/components/etic/form-field.js.map +1 -1
  36. package/dist/components/etic/nav-tabs.d.ts +27 -0
  37. package/dist/components/etic/nav-tabs.js +22 -0
  38. package/dist/components/etic/nav-tabs.js.map +1 -0
  39. package/dist/components/etic/phone-input.d.ts +4 -3
  40. package/dist/components/etic/phone-input.js +51 -37
  41. package/dist/components/etic/phone-input.js.map +1 -1
  42. package/dist/components/etic/progress-ring.d.ts +23 -0
  43. package/dist/components/etic/progress-ring.js +46 -0
  44. package/dist/components/etic/progress-ring.js.map +1 -0
  45. package/dist/components/etic/reset-button.d.ts +37 -0
  46. package/dist/components/etic/reset-button.js +41 -0
  47. package/dist/components/etic/reset-button.js.map +1 -0
  48. package/dist/components/etic/save-bar.d.ts +20 -4
  49. package/dist/components/etic/save-bar.js +39 -24
  50. package/dist/components/etic/save-bar.js.map +1 -1
  51. package/dist/components/etic/select-field.d.ts +38 -0
  52. package/dist/components/etic/select-field.js +42 -0
  53. package/dist/components/etic/select-field.js.map +1 -0
  54. package/dist/components/etic/sub-section.d.ts +15 -0
  55. package/dist/components/etic/sub-section.js +23 -0
  56. package/dist/components/etic/sub-section.js.map +1 -0
  57. package/dist/components/etic/use-detail-sheet.d.ts +58 -0
  58. package/dist/components/etic/use-detail-sheet.js +35 -0
  59. package/dist/components/etic/use-detail-sheet.js.map +1 -0
  60. package/dist/components/etic/use-server-pagination.d.ts +55 -0
  61. package/dist/components/etic/use-server-pagination.js +31 -0
  62. package/dist/components/etic/use-server-pagination.js.map +1 -0
  63. package/dist/components/etic/use-server-sorting.d.ts +29 -0
  64. package/dist/components/etic/use-server-sorting.js +19 -0
  65. package/dist/components/etic/use-server-sorting.js.map +1 -0
  66. package/dist/components/etic/verdict-panel.d.ts +25 -0
  67. package/dist/components/etic/verdict-panel.js +42 -0
  68. package/dist/components/etic/verdict-panel.js.map +1 -0
  69. package/dist/components/ui/chart.d.ts +44 -0
  70. package/dist/components/ui/chart.js +131 -0
  71. package/dist/components/ui/chart.js.map +1 -0
  72. package/dist/components/ui/sheet.d.ts +20 -2
  73. package/dist/components/ui/sheet.js +21 -8
  74. package/dist/components/ui/sheet.js.map +1 -1
  75. package/dist/hooks/use-column-prefs.d.ts +25 -7
  76. package/dist/hooks/use-column-prefs.js +44 -35
  77. package/dist/hooks/use-column-prefs.js.map +1 -1
  78. package/dist/hooks/use-debounced-search.d.ts +29 -0
  79. package/dist/hooks/use-debounced-search.js +29 -0
  80. package/dist/hooks/use-debounced-search.js.map +1 -0
  81. package/dist/hooks/use-fresh-dialog.d.ts +33 -0
  82. package/dist/hooks/use-fresh-dialog.js +17 -0
  83. package/dist/hooks/use-fresh-dialog.js.map +1 -0
  84. package/dist/hooks/use-load-on-open.d.ts +23 -0
  85. package/dist/hooks/use-load-on-open.js +21 -0
  86. package/dist/hooks/use-load-on-open.js.map +1 -0
  87. package/dist/hooks/use-save-by-key.d.ts +45 -0
  88. package/dist/hooks/use-save-by-key.js +49 -0
  89. package/dist/hooks/use-save-by-key.js.map +1 -0
  90. package/dist/index.d.ts +21 -4
  91. package/dist/index.js +117 -100
  92. package/dist/lib/format.d.ts +31 -0
  93. package/dist/lib/format.js +53 -18
  94. package/dist/lib/format.js.map +1 -1
  95. package/dist/lib/ton.d.ts +7 -0
  96. package/dist/lib/ton.js +15 -0
  97. package/dist/lib/ton.js.map +1 -1
  98. package/package.json +10 -1
  99. package/vite-plugin.d.ts +3 -3
  100. package/vite-plugin.js +8 -2
@@ -0,0 +1 @@
1
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, type ChartConfig, } from '../components/ui/chart';
@@ -0,0 +1 @@
1
+ export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "../components/ui/chart.js";
@@ -11,6 +11,16 @@ export interface AppShellLien {
11
11
  /** Page à l'écran. Calculé par l'application, seule à savoir qu'une fiche
12
12
  * appartient à telle rubrique. */
13
13
  actif?: boolean;
14
+ /**
15
+ * Pastille à droite de l'entrée : un compteur (éléments à traiter…). Rien
16
+ * pour `0`, `""` ou sans valeur. Barre repliée : un point sur l'icône, le
17
+ * compte dans l'infobulle.
18
+ */
19
+ badge?: number | string | null;
20
+ /** Ce que lisent les lecteurs d'écran après le libellé, et ce que dit
21
+ * l'infobulle de la barre repliée : « 3 à traiter ». Le badge seul par
22
+ * défaut. */
23
+ libelleBadge?: string;
14
24
  }
15
25
  export interface AppShellSection {
16
26
  titre?: string;
@@ -1,20 +1,21 @@
1
1
  import { AlertDialog as e, AlertDialogAction as t, AlertDialogCancel as n, AlertDialogContent as r, AlertDialogDescription as i, AlertDialogFooter as a, AlertDialogHeader as o, AlertDialogTitle as s } from "../ui/alert-dialog.js";
2
- import { Avatar as c, AvatarFallback as ee, AvatarImage as l } from "../ui/avatar.js";
3
- import { DropdownMenu as u, DropdownMenuContent as te, DropdownMenuGroup as d, DropdownMenuItem as f, DropdownMenuLabel as p, DropdownMenuSeparator as m, DropdownMenuSub as h, DropdownMenuSubContent as g, DropdownMenuSubTrigger as _, DropdownMenuTrigger as v } from "../ui/dropdown-menu.js";
4
- import { Sidebar as y, SidebarContent as b, SidebarFooter as x, SidebarGroup as S, SidebarGroupContent as C, SidebarGroupLabel as w, SidebarHeader as T, SidebarInset as E, SidebarMenu as D, SidebarMenuButton as O, SidebarMenuItem as k, SidebarProvider as ne, SidebarRail as A, SidebarTrigger as j, useSidebar as M } from "../ui/sidebar.js";
5
- import { TooltipProvider as N } from "../ui/tooltip.js";
6
- import { GOUTTIERES_PAGE as P } from "./page-container.js";
7
- import { EchecTheme as F, ThemeMenu as I, ThemeRadioGroup as L, themeActuel as R, useChoixTheme as z } from "./theme-menu.js";
8
- import { TooltipButton as B } from "./tooltip-button.js";
9
- import { useLien as V } from "./lien.js";
10
- import { cn as H } from "cn";
11
- import { useId as U, useState as W } from "react";
12
- import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
13
- import { ChevronsUpDownIcon as J, LogOutIcon as Y, PanelLeftIcon as X } from "lucide-react";
2
+ import { Avatar as c, AvatarFallback as l, AvatarImage as ee } from "../ui/avatar.js";
3
+ import { DropdownMenu as u, DropdownMenuContent as d, DropdownMenuGroup as f, DropdownMenuItem as p, DropdownMenuLabel as m, DropdownMenuSeparator as h, DropdownMenuSub as g, DropdownMenuSubContent as _, DropdownMenuSubTrigger as v, DropdownMenuTrigger as te } from "../ui/dropdown-menu.js";
4
+ import { Sidebar as y, SidebarContent as b, SidebarFooter as x, SidebarGroup as S, SidebarGroupContent as C, SidebarGroupLabel as ne, SidebarHeader as w, SidebarInset as T, SidebarMenu as E, SidebarMenuBadge as D, SidebarMenuButton as O, SidebarMenuItem as k, SidebarProvider as A, SidebarRail as j, SidebarTrigger as M, useSidebar as N } from "../ui/sidebar.js";
5
+ import { TooltipProvider as P } from "../ui/tooltip.js";
6
+ import { GOUTTIERES_PAGE as F } from "./page-container.js";
7
+ import { EchecTheme as I, ThemeMenu as L, ThemeRadioGroup as R, themeActuel as z, useChoixTheme as B } from "./theme-menu.js";
8
+ import { TooltipButton as V } from "./tooltip-button.js";
9
+ import { useLien as H } from "./lien.js";
10
+ import { nombreFr as U } from "../../lib/format.js";
11
+ import { cn as W } from "cn";
12
+ import { useId as G, useState as K } from "react";
13
+ import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
14
+ import { ChevronsUpDownIcon as X, LogOutIcon as Z, PanelLeftIcon as re } from "lucide-react";
14
15
  // src/components/etic/app-shell.tsx
15
- function re({ application: e, sections: t, compte: n, theme: r, lien: i, bandeau: a, children: o }) {
16
- let s = V(i), c = U();
17
- return /* @__PURE__ */ q(N, { children: [/* @__PURE__ */ K("a", {
16
+ function ie({ application: e, sections: t, compte: n, theme: r, lien: i, bandeau: a, children: o }) {
17
+ let s = H(i), c = G();
18
+ return /* @__PURE__ */ Y(P, { children: [/* @__PURE__ */ J("a", {
18
19
  href: `#${c}`,
19
20
  "data-slot": "app-shell-skip-link",
20
21
  onClick: (e) => {
@@ -22,44 +23,44 @@ function re({ application: e, sections: t, compte: n, theme: r, lien: i, bandeau
22
23
  },
23
24
  className: "sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-3 ring-ring/50 outline-none focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50",
24
25
  children: "Aller au contenu"
25
- }), /* @__PURE__ */ q(ne, {
26
- defaultOpen: !ie(),
27
- children: [/* @__PURE__ */ q(oe, { children: [
28
- /* @__PURE__ */ q(T, {
26
+ }), /* @__PURE__ */ Y(A, {
27
+ defaultOpen: !ae(),
28
+ children: [/* @__PURE__ */ Y(se, { children: [
29
+ /* @__PURE__ */ Y(w, {
29
30
  className: "flex-row items-center group-data-[collapsible=icon]:flex-col",
30
- children: [/* @__PURE__ */ K(se, {
31
+ children: [/* @__PURE__ */ J(ce, {
31
32
  application: e,
32
33
  Lien: s
33
- }), /* @__PURE__ */ K(ae, {})]
34
+ }), /* @__PURE__ */ J(oe, {})]
34
35
  }),
35
- /* @__PURE__ */ K(b, { children: /* @__PURE__ */ K(ce, {
36
+ /* @__PURE__ */ J(b, { children: /* @__PURE__ */ J(le, {
36
37
  sections: t,
37
38
  Lien: s
38
39
  }) }),
39
- n || r ? /* @__PURE__ */ K(x, {
40
+ n || r ? /* @__PURE__ */ J(x, {
40
41
  className: "flex-row items-center gap-2 group-data-[collapsible=icon]:flex-col",
41
- children: n ? /* @__PURE__ */ K($, {
42
+ children: n ? /* @__PURE__ */ J(fe, {
42
43
  compte: n,
43
44
  theme: r,
44
45
  Lien: s
45
- }) : r ? /* @__PURE__ */ K(I, {
46
+ }) : r ? /* @__PURE__ */ J(L, {
46
47
  ...r,
47
48
  side: "top",
48
49
  className: "size-12 shrink-0 bg-sidebar group-data-[collapsible=icon]:size-8 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-expanded:bg-sidebar-accent aria-expanded:text-sidebar-accent-foreground dark:bg-sidebar dark:hover:bg-sidebar-accent"
49
50
  }) : null
50
51
  }) : null
51
- ] }), /* @__PURE__ */ q(E, {
52
+ ] }), /* @__PURE__ */ Y(T, {
52
53
  id: c,
53
54
  tabIndex: -1,
54
55
  className: "min-w-0 bg-page outline-none",
55
56
  children: [
56
- /* @__PURE__ */ K(ue, {
57
+ /* @__PURE__ */ J(pe, {
57
58
  application: e,
58
59
  Lien: s
59
60
  }),
60
- /* @__PURE__ */ K("div", {
61
+ /* @__PURE__ */ J("div", {
61
62
  "data-slot": "app-shell-bandeau",
62
- className: H("empty:hidden", P.laterales, P.haute),
63
+ className: W("empty:hidden", F.laterales, F.haute),
63
64
  children: a
64
65
  }),
65
66
  o
@@ -67,15 +68,15 @@ function re({ application: e, sections: t, compte: n, theme: r, lien: i, bandeau
67
68
  })]
68
69
  })] });
69
70
  }
70
- function ie() {
71
+ function ae() {
71
72
  return typeof document < "u" && /(?:^|;\s*)sidebar_state=false(?:;|$)/.test(document.cookie);
72
73
  }
73
- var Z = "data-ferme-tiroir";
74
- function ae() {
75
- let { isMobile: e, open: t, toggleSidebar: n } = M();
74
+ var Q = "data-ferme-tiroir";
75
+ function oe() {
76
+ let { isMobile: e, open: t, toggleSidebar: n } = N();
76
77
  if (e) return null;
77
78
  let r = t ? "Replier le menu" : "Déplier le menu";
78
- return /* @__PURE__ */ K(B, {
79
+ return /* @__PURE__ */ J(V, {
79
80
  variant: "ghost",
80
81
  size: "icon-sm",
81
82
  "aria-label": r,
@@ -84,43 +85,43 @@ function ae() {
84
85
  "data-slot": "app-shell-collapse",
85
86
  className: "shrink-0",
86
87
  onClick: n,
87
- children: /* @__PURE__ */ K(X, {})
88
+ children: /* @__PURE__ */ J(re, {})
88
89
  });
89
90
  }
90
- function oe({ children: e }) {
91
- let { isMobile: t, setOpenMobile: n } = M();
92
- return /* @__PURE__ */ q(y, {
91
+ function se({ children: e }) {
92
+ let { isMobile: t, setOpenMobile: n } = N();
93
+ return /* @__PURE__ */ Y(y, {
93
94
  collapsible: "icon",
94
- children: [/* @__PURE__ */ K("div", {
95
+ children: [/* @__PURE__ */ J("div", {
95
96
  className: "contents",
96
97
  onClick: (e) => {
97
- !t || e.ctrlKey || e.metaKey || e.shiftKey || e.target.closest(`a[href], [${Z}]`) && n(!1);
98
+ !t || e.ctrlKey || e.metaKey || e.shiftKey || e.target.closest(`a[href], [${Q}]`) && n(!1);
98
99
  },
99
100
  children: e
100
- }), /* @__PURE__ */ K(A, {})]
101
+ }), /* @__PURE__ */ J(j, {})]
101
102
  });
102
103
  }
103
- function Q({ application: e, className: t }) {
104
- return e.logo ? /* @__PURE__ */ K("span", {
105
- className: H("flex shrink-0 items-center justify-center [&_img]:size-full [&_svg]:size-full", t),
104
+ function $({ application: e, className: t }) {
105
+ return e.logo ? /* @__PURE__ */ J("span", {
106
+ className: W("flex shrink-0 items-center justify-center [&_img]:size-full [&_svg]:size-full", t),
106
107
  children: e.logo
107
108
  }) : null;
108
109
  }
109
- function se({ application: e, Lien: t }) {
110
- return /* @__PURE__ */ K(D, {
110
+ function ce({ application: e, Lien: t }) {
111
+ return /* @__PURE__ */ J(E, {
111
112
  className: "min-w-0 flex-1",
112
- children: /* @__PURE__ */ K(k, { children: /* @__PURE__ */ q(O, {
113
+ children: /* @__PURE__ */ J(k, { children: /* @__PURE__ */ Y(O, {
113
114
  size: "lg",
114
- render: /* @__PURE__ */ K(t, { href: e.href ?? "/" }),
115
- children: [/* @__PURE__ */ K(Q, {
115
+ render: /* @__PURE__ */ J(t, { href: e.href ?? "/" }),
116
+ children: [/* @__PURE__ */ J($, {
116
117
  application: e,
117
- className: "size-8"
118
- }), /* @__PURE__ */ q("span", {
118
+ className: "size-8 group-data-[collapsible=icon]:mx-1 group-data-[collapsible=icon]:size-6"
119
+ }), /* @__PURE__ */ Y("span", {
119
120
  className: "grid flex-1 text-left leading-tight",
120
- children: [/* @__PURE__ */ K("span", {
121
+ children: [/* @__PURE__ */ J("span", {
121
122
  className: "truncate font-semibold",
122
123
  children: e.nom
123
- }), e.sousTitre ? /* @__PURE__ */ K("span", {
124
+ }), e.sousTitre ? /* @__PURE__ */ J("span", {
124
125
  className: "truncate text-xs text-muted-foreground",
125
126
  children: e.sousTitre
126
127
  }) : null]
@@ -128,135 +129,161 @@ function se({ application: e, Lien: t }) {
128
129
  }) })
129
130
  });
130
131
  }
131
- function ce({ sections: e, Lien: t }) {
132
- return /* @__PURE__ */ K("nav", {
132
+ function le({ sections: e, Lien: t }) {
133
+ return /* @__PURE__ */ J("nav", {
133
134
  "aria-label": "Navigation principale",
134
- children: e.map((e, n) => /* @__PURE__ */ q(S, { children: [e.titre ? /* @__PURE__ */ K(w, { children: e.titre }) : null, /* @__PURE__ */ K(C, { children: /* @__PURE__ */ K(D, { children: e.liens.map(({ libelle: e, href: n, icone: r, actif: i }, a) => /* @__PURE__ */ K(k, { children: /* @__PURE__ */ q(O, {
135
- isActive: i,
136
- tooltip: e,
137
- render: /* @__PURE__ */ K(t, {
138
- href: n,
139
- "aria-current": i ? "page" : void 0
140
- }),
141
- children: [r ? /* @__PURE__ */ K(r, {}) : null, /* @__PURE__ */ K("span", {
142
- title: e,
143
- children: e
144
- })]
145
- }) }, a)) }) })] }, n))
135
+ children: e.map((e, n) => /* @__PURE__ */ Y(S, { children: [e.titre ? /* @__PURE__ */ J(ne, { children: e.titre }) : null, /* @__PURE__ */ J(C, { children: /* @__PURE__ */ J(E, { children: e.liens.map(({ libelle: e, href: n, icone: r, actif: i, badge: a, libelleBadge: o }, s) => {
136
+ let c = ue(a), l = o ?? c;
137
+ return /* @__PURE__ */ Y(k, { children: [/* @__PURE__ */ Y(O, {
138
+ isActive: i,
139
+ tooltip: c ? `${e} (${l})` : e,
140
+ className: c ? "relative pr-8" : void 0,
141
+ render: /* @__PURE__ */ J(t, {
142
+ href: n,
143
+ "aria-current": i ? "page" : void 0
144
+ }),
145
+ children: [
146
+ r ? /* @__PURE__ */ J(r, {}) : null,
147
+ c ? /* @__PURE__ */ J("span", {
148
+ "aria-hidden": "true",
149
+ "data-slot": "app-shell-badge-point",
150
+ className: "absolute top-1 right-1 hidden size-2 rounded-full bg-primary group-data-[collapsible=icon]:block"
151
+ }) : null,
152
+ /* @__PURE__ */ Y("span", {
153
+ title: e,
154
+ children: [e, c ? /* @__PURE__ */ Y("span", {
155
+ className: "sr-only",
156
+ children: [
157
+ " (",
158
+ l,
159
+ ")"
160
+ ]
161
+ }) : null]
162
+ })
163
+ ]
164
+ }), c ? /* @__PURE__ */ J(D, {
165
+ "aria-hidden": "true",
166
+ className: "rounded-full bg-primary text-primary-foreground peer-hover/menu-button:text-primary-foreground peer-data-active/menu-button:text-primary-foreground",
167
+ children: c
168
+ }) : null] }, s);
169
+ }) }) })] }, n))
146
170
  });
147
171
  }
148
- function le({ valeur: e, onChoisir: t }) {
149
- let { isMobile: n } = M(), { libelle: r, Icone: i } = R(e);
150
- return n ? /* @__PURE__ */ q(d, { children: [/* @__PURE__ */ K(p, { children: "Thème de l'interface" }), /* @__PURE__ */ K(L, {
172
+ function ue(e) {
173
+ return e == null || e === 0 || e === "" ? null : typeof e == "number" ? Number.isFinite(e) ? U(e) : null : e;
174
+ }
175
+ function de({ valeur: e, onChoisir: t }) {
176
+ let { isMobile: n } = N(), { libelle: r, Icone: i } = z(e);
177
+ return n ? /* @__PURE__ */ Y(f, { children: [/* @__PURE__ */ J(m, { children: "Thème de l'interface" }), /* @__PURE__ */ J(R, {
151
178
  valeur: e,
152
179
  onChoisir: t
153
- })] }) : /* @__PURE__ */ q(h, { children: [/* @__PURE__ */ q(_, { children: [/* @__PURE__ */ K(i, {}), r] }), /* @__PURE__ */ K(g, {
180
+ })] }) : /* @__PURE__ */ Y(g, { children: [/* @__PURE__ */ Y(v, { children: [/* @__PURE__ */ J(i, {}), r] }), /* @__PURE__ */ J(_, {
154
181
  className: "w-40",
155
- children: /* @__PURE__ */ K(L, {
182
+ children: /* @__PURE__ */ J(R, {
156
183
  valeur: e,
157
184
  onChoisir: t
158
185
  })
159
186
  })] });
160
187
  }
161
- function $({ compte: p, theme: h, Lien: g }) {
162
- let [_, y] = W(!1), { echec: b, effacerEchec: x, choisir: S } = z({
163
- valeur: h?.valeur ?? "system",
164
- onValeurChange: h?.onValeurChange ?? (() => {})
188
+ function fe({ compte: m, theme: g, Lien: _ }) {
189
+ let [v, y] = K(!1), { echec: b, effacerEchec: x, choisir: S } = B({
190
+ valeur: g?.valeur ?? "system",
191
+ onValeurChange: g?.onValeurChange ?? (() => {})
165
192
  });
166
- return /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ q(D, {
193
+ return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(E, {
167
194
  className: "relative min-w-0 flex-1",
168
- children: [/* @__PURE__ */ K(k, { children: /* @__PURE__ */ q(u, {
195
+ children: [/* @__PURE__ */ J(k, { children: /* @__PURE__ */ Y(u, {
169
196
  onOpenChange: (e) => e && x(),
170
- children: [/* @__PURE__ */ q(v, {
171
- render: /* @__PURE__ */ K(O, {
197
+ children: [/* @__PURE__ */ Y(te, {
198
+ render: /* @__PURE__ */ J(O, {
172
199
  size: "lg",
173
- isActive: p.actif,
174
- "aria-label": `${p.nom}, menu du compte`,
200
+ isActive: m.actif,
201
+ "aria-label": `${m.nom}, menu du compte`,
175
202
  className: "rounded-lg data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground"
176
203
  }),
177
204
  children: [
178
- /* @__PURE__ */ q(c, {
205
+ /* @__PURE__ */ Y(c, {
179
206
  className: "rounded-lg after:rounded-lg",
180
- children: [p.photo ? /* @__PURE__ */ K(l, {
181
- src: p.photo,
207
+ children: [m.photo ? /* @__PURE__ */ J(ee, {
208
+ src: m.photo,
182
209
  alt: "",
183
210
  className: "rounded-lg"
184
- }) : null, /* @__PURE__ */ K(ee, {
211
+ }) : null, /* @__PURE__ */ J(l, {
185
212
  className: "rounded-lg",
186
- children: p.initiales
213
+ children: m.initiales
187
214
  })]
188
215
  }),
189
- /* @__PURE__ */ q("span", {
216
+ /* @__PURE__ */ Y("span", {
190
217
  className: "grid flex-1 text-left leading-tight",
191
- children: [/* @__PURE__ */ K("span", {
218
+ children: [/* @__PURE__ */ J("span", {
192
219
  className: "truncate font-medium",
193
- children: p.nom
194
- }), p.detail ? /* @__PURE__ */ K("span", {
220
+ children: m.nom
221
+ }), m.detail ? /* @__PURE__ */ J("span", {
195
222
  className: "truncate text-xs text-muted-foreground",
196
- children: p.detail
223
+ children: m.detail
197
224
  }) : null]
198
225
  }),
199
- /* @__PURE__ */ K(J, { className: "ml-auto" })
226
+ /* @__PURE__ */ J(X, { className: "ml-auto" })
200
227
  ]
201
- }), /* @__PURE__ */ q(te, {
228
+ }), /* @__PURE__ */ Y(d, {
202
229
  side: "top",
203
230
  align: "start",
204
231
  className: "min-w-56",
205
232
  children: [
206
- p.entrees?.length ? /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(d, { children: p.entrees.map(({ libelle: e, icone: t, href: n, onChoisir: r }, i) => /* @__PURE__ */ q(f, {
207
- render: n ? /* @__PURE__ */ K(g, { href: n }) : void 0,
233
+ m.entrees?.length ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(f, { children: m.entrees.map(({ libelle: e, icone: t, href: n, onChoisir: r }, i) => /* @__PURE__ */ Y(p, {
234
+ render: n ? /* @__PURE__ */ J(_, { href: n }) : void 0,
208
235
  onClick: r,
209
- [Z]: !0,
210
- children: [t ? /* @__PURE__ */ K(t, {}) : null, e]
211
- }, i)) }), /* @__PURE__ */ K(m, {})] }) : null,
212
- h ? /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(le, {
213
- valeur: h.valeur,
236
+ [Q]: !0,
237
+ children: [t ? /* @__PURE__ */ J(t, {}) : null, e]
238
+ }, i)) }), /* @__PURE__ */ J(h, {})] }) : null,
239
+ g ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(de, {
240
+ valeur: g.valeur,
214
241
  onChoisir: S
215
- }), /* @__PURE__ */ K(m, {})] }) : null,
216
- /* @__PURE__ */ q(f, {
242
+ }), /* @__PURE__ */ J(h, {})] }) : null,
243
+ /* @__PURE__ */ Y(p, {
217
244
  onClick: () => y(!0),
218
- children: [/* @__PURE__ */ K(Y, {}), "Se déconnecter"]
245
+ children: [/* @__PURE__ */ J(Z, {}), "Se déconnecter"]
219
246
  })
220
247
  ]
221
248
  })]
222
- }) }), b ? /* @__PURE__ */ K(F, {
249
+ }) }), b ? /* @__PURE__ */ J(I, {
223
250
  side: "top",
224
251
  className: "left-0"
225
252
  }) : null]
226
- }), /* @__PURE__ */ K(e, {
227
- open: _,
253
+ }), /* @__PURE__ */ J(e, {
254
+ open: v,
228
255
  onOpenChange: y,
229
- children: /* @__PURE__ */ q(r, { children: [/* @__PURE__ */ q(o, { children: [/* @__PURE__ */ K(s, { children: "Se déconnecter" }), /* @__PURE__ */ K(i, { children: "Voulez-vous vraiment vous déconnecter ?" })] }), /* @__PURE__ */ q(a, { children: [/* @__PURE__ */ K(n, { children: "Annuler" }), /* @__PURE__ */ K(t, {
256
+ children: /* @__PURE__ */ Y(r, { children: [/* @__PURE__ */ Y(o, { children: [/* @__PURE__ */ J(s, { children: "Se déconnecter" }), /* @__PURE__ */ J(i, { children: "Voulez-vous vraiment vous déconnecter ?" })] }), /* @__PURE__ */ Y(a, { children: [/* @__PURE__ */ J(n, { children: "Annuler" }), /* @__PURE__ */ J(t, {
230
257
  variant: "destructive",
231
258
  onClick: () => {
232
- y(!1), p.onSeDeconnecter();
259
+ y(!1), m.onSeDeconnecter();
233
260
  },
234
261
  children: "Se déconnecter"
235
262
  })] })] })
236
263
  })] });
237
264
  }
238
- function ue({ application: e, Lien: t }) {
239
- let { isMobile: n, openMobile: r } = M();
240
- return n ? /* @__PURE__ */ q("header", {
265
+ function pe({ application: e, Lien: t }) {
266
+ let { isMobile: n, openMobile: r } = N();
267
+ return n ? /* @__PURE__ */ Y("header", {
241
268
  "data-slot": "app-shell-mobile-bar",
242
269
  className: "sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b bg-page px-2",
243
- children: [/* @__PURE__ */ K(j, {
270
+ children: [/* @__PURE__ */ J(M, {
244
271
  libelle: "Ouvrir le menu",
245
272
  "aria-expanded": r,
246
273
  className: "size-9"
247
- }), /* @__PURE__ */ q(t, {
274
+ }), /* @__PURE__ */ Y(t, {
248
275
  href: e.href ?? "/",
249
276
  className: "flex min-w-0 items-center gap-2 rounded-md px-1 font-semibold outline-none focus-visible:ring-2 focus-visible:ring-ring",
250
- children: [/* @__PURE__ */ K(Q, {
277
+ children: [/* @__PURE__ */ J($, {
251
278
  application: e,
252
279
  className: "size-6"
253
- }), /* @__PURE__ */ K("span", {
280
+ }), /* @__PURE__ */ J("span", {
254
281
  className: "truncate",
255
282
  children: e.nom
256
283
  })]
257
284
  })]
258
285
  }) : null;
259
286
  }
260
- export { re as AppShell };
287
+ export { ie as AppShell };
261
288
 
262
289
  //# sourceMappingURL=app-shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-shell.js","names":["_Fragment","Fragment$1","AppShell","Lien","useLien","lien","idContenu","useId","TooltipProvider","event","SidebarProvider","colonneRepliee","Colonne","SidebarHeader","Marque","BoutonRepli","SidebarContent","Navigation","compte","theme","SidebarFooter","MenuCompte","ThemeMenu","SidebarInset","BarreMobile","cn","GOUTTIERES_PAGE","bandeau","children","FERME_TIROIR","useSidebar","isMobile","libelle","open","TooltipButton","toggleSidebar","PanelLeftIcon","Sidebar","setOpenMobile","SidebarRail","Logo","application","className","SidebarMenu","SidebarMenuItem","SidebarMenuButton","sections","SidebarGroup","section","SidebarGroupLabel","SidebarGroupContent","Icone","actif","i","index","MenuTheme","themeActuel","valeur","DropdownMenuGroup","DropdownMenuLabel","ThemeRadioGroup","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","confirmer","setConfirmer","useState","useChoixTheme","DropdownMenu","ouvert","effacerEchec","DropdownMenuTrigger","Avatar","AvatarImage","AvatarFallback","ChevronsUpDownIcon","DropdownMenuContent","DropdownMenuItem","href","onChoisir","DropdownMenuSeparator","choisir","LogOutIcon","echec","EchecTheme","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","SidebarTrigger","openMobile"],"sources":["../../../src/components/etic/app-shell.tsx"],"sourcesContent":["import { useId, useState, type ReactNode } from \"react\"\nimport { cn } from \"cn\"\nimport {\n ChevronsUpDownIcon,\n LogOutIcon,\n PanelLeftIcon,\n type LucideIcon,\n} from \"lucide-react\"\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@etic-ui/components/ui/alert-dialog\"\nimport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n} from \"@etic-ui/components/ui/avatar\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@etic-ui/components/ui/dropdown-menu\"\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInset,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarProvider,\n SidebarRail,\n SidebarTrigger,\n useSidebar,\n} from \"@etic-ui/components/ui/sidebar\"\nimport { TooltipProvider } from \"@etic-ui/components/ui/tooltip\"\nimport { GOUTTIERES_PAGE } from \"@etic-ui/components/etic/page-container\"\nimport {\n EchecTheme,\n ThemeMenu,\n ThemeRadioGroup,\n themeActuel,\n useChoixTheme,\n type ThemeMenuProps,\n} from \"@etic-ui/components/etic/theme-menu\"\nimport type { ThemePreference } from \"@etic-ui/theme\"\nimport { TooltipButton } from \"@etic-ui/components/etic/tooltip-button\"\nimport { useLien, type LienComposant } from \"@etic-ui/components/etic/lien\"\n\n/** @deprecated Nom de la 0.2.0 : utiliser `LienComposant`. */\nexport type AppShellLienComposant = LienComposant\n\nexport interface AppShellLien {\n libelle: string\n href: string\n icone?: LucideIcon\n /** Page à l'écran. Calculé par l'application, seule à savoir qu'une fiche\n * appartient à telle rubrique. */\n actif?: boolean\n}\n\nexport interface AppShellSection {\n titre?: string\n liens: AppShellLien[]\n}\n\n/** Entrée du menu du compte : un lien, ou une action. */\nexport type AppShellEntreeCompte = {\n libelle: string\n icone?: LucideIcon\n} & (\n { href: string; onChoisir?: never } | { onChoisir: () => void; href?: never }\n)\n\nexport interface AppShellCompte {\n /** « Prénom Nom », ou le rôle d'un compte fonctionnel. */\n nom: string\n /** Seconde ligne, l'adresse par exemple. */\n detail?: string\n initiales: string\n /** Photo ; les initiales s'affichent tant qu'elle manque ou charge. */\n photo?: string | null\n /** La fiche du compte est la page à l'écran. */\n actif?: boolean\n /** Entrées du menu du compte, avant « Se déconnecter ». */\n entrees?: AppShellEntreeCompte[]\n /** Appelé après confirmation. */\n onSeDeconnecter: () => void\n}\n\nexport interface AppShellProps {\n application: {\n nom: string\n sousTitre?: string\n /** Image ou icône, carrée : 32 px dans la barre latérale, 24 px dans la\n * barre du haut sur mobile. */\n logo?: ReactNode\n /** Lien de la marque ; « / » par défaut. */\n href?: string\n }\n sections: AppShellSection[]\n compte?: AppShellCompte\n /** Choix du thème : entrée « Thème » du menu du compte, ou son propre\n * bouton dans le pied de la barre sans `compte`. */\n theme?: Pick<ThemeMenuProps, \"valeur\" | \"onValeurChange\">\n /** Composant de lien du routeur ; par défaut, celui du `LienProvider`,\n * sinon un `<a>`. */\n lien?: LienComposant\n /**\n * Au-dessus du contenu, avec les gouttières de `PageContainer` : message\n * qui concerne toute l'application (reprise de session impossible…). Il\n * prend toute la largeur du contenu : la coquille ignore la `largeur` de\n * la page, si bien qu'il déborde d'une page étroite (`largeur=\"md\"`) sur\n * grand écran. Un message propre à une page se place dans son\n * `PageContainer`.\n */\n bandeau?: ReactNode\n children: ReactNode\n}\n\n/**\n * Coquille commune des applications ETIC : la barre latérale de shadcn\n * (navigation par rubriques, menu du compte, thème), qui devient un tiroir\n * sous 1 025 px, ouvert par une barre du haut. Le tiroir se referme quand on\n * suit un de ses liens. Ne connaît ni le routeur ni l'authentification : l'application\n * fournit les liens, l'état actif, le compte et le thème.\n *\n * Un lien « Aller au contenu », visible au focus, ouvre la tabulation : il\n * saute la navigation et met le focus sur le `<main>`.\n */\nexport function AppShell({\n application,\n sections,\n compte,\n theme,\n lien,\n bandeau,\n children,\n}: AppShellProps) {\n const Lien = useLien(lien)\n const idContenu = useId()\n return (\n <TooltipProvider>\n <a\n href={`#${idContenu}`}\n data-slot=\"app-shell-skip-link\"\n onClick={(event) => {\n // Le focus, pas seulement le défilement ; et pas de `#…` ajouté à\n // l'adresse, que le routeur de l'application lirait.\n event.preventDefault()\n document.getElementById(idContenu)?.focus()\n }}\n className=\"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-3 ring-ring/50 outline-none focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50\"\n >\n Aller au contenu\n </a>\n <SidebarProvider defaultOpen={!colonneRepliee()}>\n <Colonne>\n <SidebarHeader className=\"flex-row items-center group-data-[collapsible=icon]:flex-col\">\n <Marque application={application} Lien={Lien} />\n <BoutonRepli />\n </SidebarHeader>\n <SidebarContent>\n <Navigation sections={sections} Lien={Lien} />\n </SidebarContent>\n {compte || theme ? (\n <SidebarFooter className=\"flex-row items-center gap-2 group-data-[collapsible=icon]:flex-col\">\n {/* Avec un compte, le thème est une entrée de son menu (comme le\n nav-user de shadcn) : le pied garde toute sa largeur pour le\n nom et l'adresse. Sans compte, son propre bouton. */}\n {compte ? (\n <MenuCompte compte={compte} theme={theme} Lien={Lien} />\n ) : theme ? (\n <ThemeMenu\n {...theme}\n side=\"top\"\n // Sans fond propre (le dark:bg-input/30 d'outline tranchait\n // sur la barre), le survol des entrées de la barre.\n className=\"size-12 shrink-0 bg-sidebar group-data-[collapsible=icon]:size-8 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-expanded:bg-sidebar-accent aria-expanded:text-sidebar-accent-foreground dark:bg-sidebar dark:hover:bg-sidebar-accent\"\n />\n ) : null}\n </SidebarFooter>\n ) : null}\n </Colonne>\n <SidebarInset\n id={idContenu}\n tabIndex={-1}\n // Fond de page (bg-page) au lieu de bg-background (shadcn).\n className=\"min-w-0 bg-page outline-none\"\n >\n <BarreMobile application={application} Lien={Lien} />\n {/* Gouttières de `PageContainer`, qui suit et pose sa propre marge\n haute. Masqué quand le bandeau est absent ou ne rend rien\n (`ErrorBanner` sans erreur…). */}\n <div\n data-slot=\"app-shell-bandeau\"\n className={cn(\n \"empty:hidden\",\n GOUTTIERES_PAGE.laterales,\n GOUTTIERES_PAGE.haute\n )}\n >\n {bandeau}\n </div>\n {children}\n </SidebarInset>\n </SidebarProvider>\n </TooltipProvider>\n )\n}\n\n/** Colonne repliée lors de la dernière visite : shadcn écrit le cookie\n * `sidebar_state` à chaque repli, sans le relire. */\nfunction colonneRepliee() {\n return (\n typeof document !== \"undefined\" &&\n /(?:^|;\\s*)sidebar_state=false(?:;|$)/.test(document.cookie)\n )\n}\n\n/** Attribut des éléments, autres que les liens, qui referment le tiroir. */\nconst FERME_TIROIR = \"data-ferme-tiroir\"\n\n/**\n * Sur ordinateur, le bouton visible qui replie ou déplie la colonne (le rail\n * de shadcn n'est ni visible ni atteignable au clavier, et Ctrl+B ne se\n * devine pas). Sur mobile, la barre du haut s'en charge.\n */\nfunction BoutonRepli() {\n const { isMobile, open, toggleSidebar } = useSidebar()\n if (isMobile) return null\n const libelle = open ? \"Replier le menu\" : \"Déplier le menu\"\n return (\n <TooltipButton\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={libelle}\n infobulle={`${libelle} (Ctrl+B)`}\n aria-keyshortcuts=\"Control+B Meta+B\"\n data-slot=\"app-shell-collapse\"\n className=\"shrink-0\"\n onClick={toggleSidebar}\n >\n <PanelLeftIcon />\n </TooltipButton>\n )\n}\n\n/**\n * La barre latérale. Sur ordinateur, elle se replie en colonne d'icônes\n * (bouton de l'en-tête, rail, ou Ctrl+B hors d'un champ de saisie). Sur mobile, le tiroir se referme dès\n * qu'on suit un de ses liens dans la page, ou une entrée marquée\n * `data-ferme-tiroir` : un seul écouteur, qui reçoit aussi les clics des\n * menus ouverts depuis le tiroir (React fait remonter les évènements des\n * portails dans l'arbre des composants). Un clic qui ouvre un nouvel onglet\n * (Ctrl, Cmd, Maj) le laisse ouvert.\n */\nfunction Colonne({ children }: { children: ReactNode }) {\n const { isMobile, setOpenMobile } = useSidebar()\n return (\n <Sidebar collapsible=\"icon\">\n <div\n className=\"contents\"\n onClick={(event) => {\n if (!isMobile || event.ctrlKey || event.metaKey || event.shiftKey) {\n return\n }\n const cible = event.target as Element\n if (cible.closest(`a[href], [${FERME_TIROIR}]`)) setOpenMobile(false)\n }}\n >\n {children}\n </div>\n <SidebarRail />\n </Sidebar>\n )\n}\n\nfunction Logo({\n application,\n className,\n}: Pick<AppShellProps, \"application\"> & { className: string }) {\n return application.logo ? (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center [&_img]:size-full [&_svg]:size-full\",\n className\n )}\n >\n {application.logo}\n </span>\n ) : null\n}\n\nfunction Marque({\n application,\n Lien,\n}: Pick<AppShellProps, \"application\"> & { Lien: LienComposant }) {\n return (\n <SidebarMenu className=\"min-w-0 flex-1\">\n <SidebarMenuItem>\n <SidebarMenuButton\n size=\"lg\"\n render={<Lien href={application.href ?? \"/\"} />}\n >\n {/* 32 px, comme le sélecteur d'équipe de shadcn : toute la hauteur\n utile du bouton (48 px moins ses marges) ; dans la barre\n repliée, il remplit le bouton de 32 px, donc centré. */}\n <Logo application={application} className=\"size-8\" />\n <span className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate font-semibold\">{application.nom}</span>\n {application.sousTitre ? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {application.sousTitre}\n </span>\n ) : null}\n </span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n\nfunction Navigation({\n sections,\n Lien,\n}: Pick<AppShellProps, \"sections\"> & { Lien: LienComposant }) {\n return (\n <nav aria-label=\"Navigation principale\">\n {sections.map((section, index) => (\n <SidebarGroup key={index}>\n {section.titre ? (\n <SidebarGroupLabel>{section.titre}</SidebarGroupLabel>\n ) : null}\n <SidebarGroupContent>\n <SidebarMenu>\n {section.liens.map(\n ({ libelle, href, icone: Icone, actif }, i) => (\n <SidebarMenuItem key={i}>\n <SidebarMenuButton\n isActive={actif}\n tooltip={libelle}\n render={\n <Lien\n href={href}\n aria-current={actif ? \"page\" : undefined}\n />\n }\n >\n {Icone ? <Icone /> : null}\n {/* Tronqué s'il est trop long : `title` le donne en\n entier au survol, barre dépliée. */}\n <span title={libelle}>{libelle}</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n )\n )}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n ))}\n </nav>\n )\n}\n\n/** Entrée « Thème : Sombre » du menu du compte, qui ouvre Clair / Système /\n * Sombre. Choisir ferme le menu. Dans le tiroir mobile, trop étroit pour un\n * sous-menu à côté du menu (il s'ouvrait dessous, sur « Se déconnecter »),\n * les trois choix sont dans le menu, sous un intitulé. */\nfunction MenuTheme({\n valeur,\n onChoisir,\n}: {\n valeur: ThemePreference\n onChoisir: (theme: ThemePreference) => void\n}) {\n const { isMobile } = useSidebar()\n const { libelle, Icone } = themeActuel(valeur)\n if (isMobile)\n return (\n <DropdownMenuGroup>\n <DropdownMenuLabel>Thème de l'interface</DropdownMenuLabel>\n <ThemeRadioGroup valeur={valeur} onChoisir={onChoisir} />\n </DropdownMenuGroup>\n )\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Icone />\n {libelle}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-40\">\n <ThemeRadioGroup valeur={valeur} onChoisir={onChoisir} />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n )\n}\n\nfunction MenuCompte({\n compte,\n theme,\n Lien,\n}: {\n compte: AppShellCompte\n theme?: AppShellProps[\"theme\"]\n Lien: LienComposant\n}) {\n const [confirmer, setConfirmer] = useState(false)\n const { echec, effacerEchec, choisir } = useChoixTheme({\n valeur: theme?.valeur ?? \"system\",\n onValeurChange: theme?.onValeurChange ?? (() => {}),\n })\n\n return (\n <>\n {/* relative : y pose « Thème non enregistré », au-dessus du bouton. */}\n <SidebarMenu className=\"relative min-w-0 flex-1\">\n <SidebarMenuItem>\n <DropdownMenu onOpenChange={(ouvert) => ouvert && effacerEchec()}>\n <DropdownMenuTrigger\n render={\n <SidebarMenuButton\n size=\"lg\"\n isActive={compte.actif}\n aria-label={`${compte.nom}, menu du compte`}\n // Sans contour, comme le nav-user de shadcn : le survol dit\n // qu'il s'ouvre. rounded-lg : le survol épouse l'avatar.\n className=\"rounded-lg data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground\"\n />\n }\n >\n {/* Carré arrondi, comme le nav-user de shadcn : la forme du\n survol du bouton. */}\n <Avatar className=\"rounded-lg after:rounded-lg\">\n {compte.photo ? (\n <AvatarImage\n src={compte.photo}\n alt=\"\"\n className=\"rounded-lg\"\n />\n ) : null}\n <AvatarFallback className=\"rounded-lg\">\n {compte.initiales}\n </AvatarFallback>\n </Avatar>\n <span className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate font-medium\">{compte.nom}</span>\n {compte.detail ? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {compte.detail}\n </span>\n ) : null}\n </span>\n <ChevronsUpDownIcon className=\"ml-auto\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"start\" className=\"min-w-56\">\n {compte.entrees?.length ? (\n <>\n <DropdownMenuGroup>\n {compte.entrees.map(\n ({ libelle, icone: Icone, href, onChoisir }, i) => (\n <DropdownMenuItem\n key={i}\n render={href ? <Lien href={href} /> : undefined}\n onClick={onChoisir}\n {...{ [FERME_TIROIR]: true }}\n >\n {Icone ? <Icone /> : null}\n {libelle}\n </DropdownMenuItem>\n )\n )}\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n </>\n ) : null}\n {theme ? (\n <>\n <MenuTheme valeur={theme.valeur} onChoisir={choisir} />\n <DropdownMenuSeparator />\n </>\n ) : null}\n <DropdownMenuItem onClick={() => setConfirmer(true)}>\n <LogOutIcon />\n Se déconnecter\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n {echec ? <EchecTheme side=\"top\" className=\"left-0\" /> : null}\n </SidebarMenu>\n\n <AlertDialog open={confirmer} onOpenChange={setConfirmer}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Se déconnecter</AlertDialogTitle>\n <AlertDialogDescription>\n Voulez-vous vraiment vous déconnecter&#8239;?\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Annuler</AlertDialogCancel>\n <AlertDialogAction\n variant=\"destructive\"\n onClick={() => {\n setConfirmer(false)\n compte.onSeDeconnecter()\n }}\n >\n Se déconnecter\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n )\n}\n\n/** Sous le seuil mobile, la barre latérale n'est plus à l'écran : cette barre\n * porte le bouton qui l'ouvre en tiroir, et la marque. */\nfunction BarreMobile({\n application,\n Lien,\n}: Pick<AppShellProps, \"application\"> & { Lien: LienComposant }) {\n const { isMobile, openMobile } = useSidebar()\n if (!isMobile) return null\n return (\n // Sa hauteur (h-12) est reprise par le `scroll-padding-top` de styles.css :\n // une ancre ne passe pas sous la barre collante. Sur le fond de la page.\n <header\n data-slot=\"app-shell-mobile-bar\"\n className=\"sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b bg-page px-2\"\n >\n {/* Un seul nom, par `libelle` : un `aria-label` aurait masqué le texte\n lu de shadcn, qui en divergeait. */}\n <SidebarTrigger\n libelle=\"Ouvrir le menu\"\n aria-expanded={openMobile}\n className=\"size-9\"\n />\n <Lien\n href={application.href ?? \"/\"}\n className=\"flex min-w-0 items-center gap-2 rounded-md px-1 font-semibold outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Logo application={application} className=\"size-6\" />\n <span className=\"truncate\">{application.nom}</span>\n </Lien>\n </header>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAoJA,SAAgBE,GAAS,EACvB,gBACA,aACA,WACA,UACA,SACA,YACA,eACgB;CAChB,IAAMC,IAAOC,EAAQC,CAAI,GACnBC,IAAYC,EAAM;CACxB,OACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAAC,KAAD;EACE,MAAM,IAAIF;EACV,aAAU;EACV,UAAU,MAAU;GAIlB,AADAG,EAAM,eAAe,GACrB,SAAS,eAAeH,CAAS,CAAC,EAAE,MAAM;EAC5C;EACA,WAAU;EACX,UAAA;CAEE,CAAA,GACH,kBAACI,IAAD;EAAiB,aAAa,CAACC,GAAe;EAA9C,UAAA,CACE,kBAACC,IAAD,EAAA,UAAA;GACE,kBAACC,GAAD;IAAe,WAAU;IAAzB,UAAA,CACE,kBAACC,IAAD;KAAqB;KAAmB;IAAO,CAAA,GAC/C,kBAACC,IAAD,CAAc,CAAA,CACD;;GACf,kBAACC,GAAD,EAAA,UACE,kBAACC,IAAD;IAAsB;IAAgB;GAAO,CAAA,EAC/B,CAAA;GACfC,KAAUC,IACT,kBAACC,GAAD;IAAe,WAAU;IAItB,UAAAF,IACC,kBAACG,GAAD;KAAoB;KAAe;KAAa;IAAO,CAAA,IACrDF,IACF,kBAACG,GAAD;KACE,GAAIH;KACJ,MAAK;KAGL,WAAU;IACX,CAAA,IACC;GACS,CAAA,IACb;EACG,EAAA,CAAA,GACT,kBAACI,GAAD;GACE,IAAIjB;GACJ,UAAU;GAEV,WAAU;GAJZ,UAAA;IAME,kBAACkB,IAAD;KAA0B;KAAmB;IAAO,CAAA;IAIpD,kBAAC,OAAD;KACE,aAAU;KACV,WAAWC,EACT,gBACAC,EAAgB,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B,UAA0B,CAAA,GAC7C,kBAACC,GAAD;GACE,SAAQ;GACR,eAAe;IAEb,AADA3B,EAAa,EAAK,GAClB/C,EAAO,gBAAgB;GACzB;GACD,UAAA;EAEkB,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;CACT,CAAA,CACb,EAAA,CAAA;AAEN;AAIA,SAASM,GAAY,EACnB,gBACA,WAC+D;CAC/D,IAAM,EAAE,aAAU,kBAAeM,EAAW;CAE5C,OADKC,IAIH,kBAAC,UAAD;EACE,aAAU;EACV,WAAU;EAFZ,UAAA,CAME,kBAAC8D,GAAD;GACE,SAAQ;GACR,iBAAeC;GACf,WAAU;EACX,CAAA,GACD,kBAAC3F,GAAD;GACE,MAAMsC,EAAY,QAAQ;GAC1B,WAAU;GAFZ,UAAA,CAIE,kBAACD,GAAD;IAAmB;IAAa,WAAU;GAAU,CAAA,GACpD,kBAAC,QAAD;IAAM,WAAU;IAAY,UAAAC,EAAY;GAAU,CAAA,CAC9C;EACA,CAAA,CAAA;C,KAtBY;AAwBxB"}
1
+ {"version":3,"file":"app-shell.js","names":["_Fragment","Fragment$1","AppShell","Lien","useLien","lien","idContenu","useId","TooltipProvider","event","SidebarProvider","colonneRepliee","Colonne","SidebarHeader","Marque","BoutonRepli","SidebarContent","Navigation","compte","theme","SidebarFooter","MenuCompte","ThemeMenu","SidebarInset","BarreMobile","cn","GOUTTIERES_PAGE","bandeau","children","FERME_TIROIR","useSidebar","isMobile","libelle","open","TooltipButton","toggleSidebar","PanelLeftIcon","Sidebar","setOpenMobile","SidebarRail","Logo","application","className","SidebarMenu","SidebarMenuItem","SidebarMenuButton","sections","SidebarGroup","section","SidebarGroupLabel","SidebarGroupContent","Icone","pastille","texteBadge","badge","lu","libelleBadge","actif","SidebarMenuBadge","i","index","nombreFr","MenuTheme","themeActuel","valeur","DropdownMenuGroup","DropdownMenuLabel","ThemeRadioGroup","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","confirmer","setConfirmer","useState","useChoixTheme","DropdownMenu","ouvert","effacerEchec","DropdownMenuTrigger","Avatar","AvatarImage","AvatarFallback","ChevronsUpDownIcon","DropdownMenuContent","DropdownMenuItem","href","onChoisir","DropdownMenuSeparator","choisir","LogOutIcon","echec","EchecTheme","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","SidebarTrigger","openMobile"],"sources":["../../../src/components/etic/app-shell.tsx"],"sourcesContent":["import { useId, useState, type ReactNode } from \"react\"\nimport { cn } from \"cn\"\nimport {\n ChevronsUpDownIcon,\n LogOutIcon,\n PanelLeftIcon,\n type LucideIcon,\n} from \"lucide-react\"\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@etic-ui/components/ui/alert-dialog\"\nimport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n} from \"@etic-ui/components/ui/avatar\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@etic-ui/components/ui/dropdown-menu\"\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInset,\n SidebarMenu,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarProvider,\n SidebarRail,\n SidebarTrigger,\n useSidebar,\n} from \"@etic-ui/components/ui/sidebar\"\nimport { TooltipProvider } from \"@etic-ui/components/ui/tooltip\"\nimport { GOUTTIERES_PAGE } from \"@etic-ui/components/etic/page-container\"\nimport {\n EchecTheme,\n ThemeMenu,\n ThemeRadioGroup,\n themeActuel,\n useChoixTheme,\n type ThemeMenuProps,\n} from \"@etic-ui/components/etic/theme-menu\"\nimport type { ThemePreference } from \"@etic-ui/theme\"\nimport { TooltipButton } from \"@etic-ui/components/etic/tooltip-button\"\nimport { useLien, type LienComposant } from \"@etic-ui/components/etic/lien\"\nimport { nombreFr } from \"@etic-ui/lib/format\"\n\n/** @deprecated Nom de la 0.2.0 : utiliser `LienComposant`. */\nexport type AppShellLienComposant = LienComposant\n\nexport interface AppShellLien {\n libelle: string\n href: string\n icone?: LucideIcon\n /** Page à l'écran. Calculé par l'application, seule à savoir qu'une fiche\n * appartient à telle rubrique. */\n actif?: boolean\n /**\n * Pastille à droite de l'entrée : un compteur (éléments à traiter…). Rien\n * pour `0`, `\"\"` ou sans valeur. Barre repliée : un point sur l'icône, le\n * compte dans l'infobulle.\n */\n badge?: number | string | null\n /** Ce que lisent les lecteurs d'écran après le libellé, et ce que dit\n * l'infobulle de la barre repliée : « 3 à traiter ». Le badge seul par\n * défaut. */\n libelleBadge?: string\n}\n\nexport interface AppShellSection {\n titre?: string\n liens: AppShellLien[]\n}\n\n/** Entrée du menu du compte : un lien, ou une action. */\nexport type AppShellEntreeCompte = {\n libelle: string\n icone?: LucideIcon\n} & (\n { href: string; onChoisir?: never } | { onChoisir: () => void; href?: never }\n)\n\nexport interface AppShellCompte {\n /** « Prénom Nom », ou le rôle d'un compte fonctionnel. */\n nom: string\n /** Seconde ligne, l'adresse par exemple. */\n detail?: string\n initiales: string\n /** Photo ; les initiales s'affichent tant qu'elle manque ou charge. */\n photo?: string | null\n /** La fiche du compte est la page à l'écran. */\n actif?: boolean\n /** Entrées du menu du compte, avant « Se déconnecter ». */\n entrees?: AppShellEntreeCompte[]\n /** Appelé après confirmation. */\n onSeDeconnecter: () => void\n}\n\nexport interface AppShellProps {\n application: {\n nom: string\n sousTitre?: string\n /** Image ou icône, carrée : 32 px dans la barre latérale, 24 px dans la\n * barre du haut sur mobile. */\n logo?: ReactNode\n /** Lien de la marque ; « / » par défaut. */\n href?: string\n }\n sections: AppShellSection[]\n compte?: AppShellCompte\n /** Choix du thème : entrée « Thème » du menu du compte, ou son propre\n * bouton dans le pied de la barre sans `compte`. */\n theme?: Pick<ThemeMenuProps, \"valeur\" | \"onValeurChange\">\n /** Composant de lien du routeur ; par défaut, celui du `LienProvider`,\n * sinon un `<a>`. */\n lien?: LienComposant\n /**\n * Au-dessus du contenu, avec les gouttières de `PageContainer` : message\n * qui concerne toute l'application (reprise de session impossible…). Il\n * prend toute la largeur du contenu : la coquille ignore la `largeur` de\n * la page, si bien qu'il déborde d'une page étroite (`largeur=\"md\"`) sur\n * grand écran. Un message propre à une page se place dans son\n * `PageContainer`.\n */\n bandeau?: ReactNode\n children: ReactNode\n}\n\n/**\n * Coquille commune des applications ETIC : la barre latérale de shadcn\n * (navigation par rubriques, menu du compte, thème), qui devient un tiroir\n * sous 1 025 px, ouvert par une barre du haut. Le tiroir se referme quand on\n * suit un de ses liens. Ne connaît ni le routeur ni l'authentification : l'application\n * fournit les liens, l'état actif, le compte et le thème.\n *\n * Un lien « Aller au contenu », visible au focus, ouvre la tabulation : il\n * saute la navigation et met le focus sur le `<main>`.\n */\nexport function AppShell({\n application,\n sections,\n compte,\n theme,\n lien,\n bandeau,\n children,\n}: AppShellProps) {\n const Lien = useLien(lien)\n const idContenu = useId()\n return (\n <TooltipProvider>\n <a\n href={`#${idContenu}`}\n data-slot=\"app-shell-skip-link\"\n onClick={(event) => {\n // Le focus, pas seulement le défilement ; et pas de `#…` ajouté à\n // l'adresse, que le routeur de l'application lirait.\n event.preventDefault()\n document.getElementById(idContenu)?.focus()\n }}\n className=\"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-3 ring-ring/50 outline-none focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50\"\n >\n Aller au contenu\n </a>\n <SidebarProvider defaultOpen={!colonneRepliee()}>\n <Colonne>\n <SidebarHeader className=\"flex-row items-center group-data-[collapsible=icon]:flex-col\">\n <Marque application={application} Lien={Lien} />\n <BoutonRepli />\n </SidebarHeader>\n <SidebarContent>\n <Navigation sections={sections} Lien={Lien} />\n </SidebarContent>\n {compte || theme ? (\n <SidebarFooter className=\"flex-row items-center gap-2 group-data-[collapsible=icon]:flex-col\">\n {/* Avec un compte, le thème est une entrée de son menu (comme le\n nav-user de shadcn) : le pied garde toute sa largeur pour le\n nom et l'adresse. Sans compte, son propre bouton. */}\n {compte ? (\n <MenuCompte compte={compte} theme={theme} Lien={Lien} />\n ) : theme ? (\n <ThemeMenu\n {...theme}\n side=\"top\"\n // Sans fond propre (le dark:bg-input/30 d'outline tranchait\n // sur la barre), le survol des entrées de la barre.\n className=\"size-12 shrink-0 bg-sidebar group-data-[collapsible=icon]:size-8 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-expanded:bg-sidebar-accent aria-expanded:text-sidebar-accent-foreground dark:bg-sidebar dark:hover:bg-sidebar-accent\"\n />\n ) : null}\n </SidebarFooter>\n ) : null}\n </Colonne>\n <SidebarInset\n id={idContenu}\n tabIndex={-1}\n // Fond de page (bg-page) au lieu de bg-background (shadcn).\n className=\"min-w-0 bg-page outline-none\"\n >\n <BarreMobile application={application} Lien={Lien} />\n {/* Gouttières de `PageContainer`, qui suit et pose sa propre marge\n haute. Masqué quand le bandeau est absent ou ne rend rien\n (`ErrorBanner` sans erreur…). */}\n <div\n data-slot=\"app-shell-bandeau\"\n className={cn(\n \"empty:hidden\",\n GOUTTIERES_PAGE.laterales,\n GOUTTIERES_PAGE.haute\n )}\n >\n {bandeau}\n </div>\n {children}\n </SidebarInset>\n </SidebarProvider>\n </TooltipProvider>\n )\n}\n\n/** Colonne repliée lors de la dernière visite : shadcn écrit le cookie\n * `sidebar_state` à chaque repli, sans le relire. */\nfunction colonneRepliee() {\n return (\n typeof document !== \"undefined\" &&\n /(?:^|;\\s*)sidebar_state=false(?:;|$)/.test(document.cookie)\n )\n}\n\n/** Attribut des éléments, autres que les liens, qui referment le tiroir. */\nconst FERME_TIROIR = \"data-ferme-tiroir\"\n\n/**\n * Sur ordinateur, le bouton visible qui replie ou déplie la colonne (le rail\n * de shadcn n'est ni visible ni atteignable au clavier, et Ctrl+B ne se\n * devine pas). Sur mobile, la barre du haut s'en charge.\n */\nfunction BoutonRepli() {\n const { isMobile, open, toggleSidebar } = useSidebar()\n if (isMobile) return null\n const libelle = open ? \"Replier le menu\" : \"Déplier le menu\"\n return (\n <TooltipButton\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={libelle}\n infobulle={`${libelle} (Ctrl+B)`}\n aria-keyshortcuts=\"Control+B Meta+B\"\n data-slot=\"app-shell-collapse\"\n className=\"shrink-0\"\n onClick={toggleSidebar}\n >\n <PanelLeftIcon />\n </TooltipButton>\n )\n}\n\n/**\n * La barre latérale. Sur ordinateur, elle se replie en colonne d'icônes\n * (bouton de l'en-tête, rail, ou Ctrl+B hors d'un champ de saisie). Sur mobile, le tiroir se referme dès\n * qu'on suit un de ses liens dans la page, ou une entrée marquée\n * `data-ferme-tiroir` : un seul écouteur, qui reçoit aussi les clics des\n * menus ouverts depuis le tiroir (React fait remonter les évènements des\n * portails dans l'arbre des composants). Un clic qui ouvre un nouvel onglet\n * (Ctrl, Cmd, Maj) le laisse ouvert.\n */\nfunction Colonne({ children }: { children: ReactNode }) {\n const { isMobile, setOpenMobile } = useSidebar()\n return (\n <Sidebar collapsible=\"icon\">\n <div\n className=\"contents\"\n onClick={(event) => {\n if (!isMobile || event.ctrlKey || event.metaKey || event.shiftKey) {\n return\n }\n const cible = event.target as Element\n if (cible.closest(`a[href], [${FERME_TIROIR}]`)) setOpenMobile(false)\n }}\n >\n {children}\n </div>\n <SidebarRail />\n </Sidebar>\n )\n}\n\nfunction Logo({\n application,\n className,\n}: Pick<AppShellProps, \"application\"> & { className: string }) {\n return application.logo ? (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center [&_img]:size-full [&_svg]:size-full\",\n className\n )}\n >\n {application.logo}\n </span>\n ) : null\n}\n\nfunction Marque({\n application,\n Lien,\n}: Pick<AppShellProps, \"application\"> & { Lien: LienComposant }) {\n return (\n <SidebarMenu className=\"min-w-0 flex-1\">\n <SidebarMenuItem>\n <SidebarMenuButton\n size=\"lg\"\n render={<Lien href={application.href ?? \"/\"} />}\n >\n {/* 32 px, comme le sélecteur d'équipe de shadcn : toute la hauteur\n utile du bouton (48 px moins ses marges), le nom à côté faisant\n contrepoids. Dans la barre repliée, seul parmi des icônes de\n 16 px, il pèserait le double : 24 px, centré dans le bouton de\n 32 px (sans marge intérieure) par 4 px de marge de chaque côté. */}\n <Logo\n application={application}\n className=\"size-8 group-data-[collapsible=icon]:mx-1 group-data-[collapsible=icon]:size-6\"\n />\n <span className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate font-semibold\">{application.nom}</span>\n {application.sousTitre ? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {application.sousTitre}\n </span>\n ) : null}\n </span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n\nfunction Navigation({\n sections,\n Lien,\n}: Pick<AppShellProps, \"sections\"> & { Lien: LienComposant }) {\n return (\n <nav aria-label=\"Navigation principale\">\n {sections.map((section, index) => (\n <SidebarGroup key={index}>\n {section.titre ? (\n <SidebarGroupLabel>{section.titre}</SidebarGroupLabel>\n ) : null}\n <SidebarGroupContent>\n <SidebarMenu>\n {section.liens.map(\n (\n { libelle, href, icone: Icone, actif, badge, libelleBadge },\n i\n ) => {\n const pastille = texteBadge(badge)\n const lu = libelleBadge ?? pastille\n return (\n <SidebarMenuItem key={i}>\n <SidebarMenuButton\n isActive={actif}\n tooltip={pastille ? `${libelle} (${lu})` : libelle}\n // Place de la pastille, à droite du libellé.\n className={pastille ? \"relative pr-8\" : undefined}\n render={\n <Lien\n href={href}\n aria-current={actif ? \"page\" : undefined}\n />\n }\n >\n {Icone ? <Icone /> : null}\n {pastille ? (\n // Barre repliée : la pastille est masquée, un\n // point sur l'icône la remplace.\n <span\n aria-hidden=\"true\"\n data-slot=\"app-shell-badge-point\"\n className=\"absolute top-1 right-1 hidden size-2 rounded-full bg-primary group-data-[collapsible=icon]:block\"\n />\n ) : null}\n {/* Tronqué s'il est trop long : `title` le donne en\n entier au survol, barre dépliée. Dernier enfant\n du bouton, que shadcn tronque. */}\n <span title={libelle}>\n {libelle}\n {pastille ? (\n <span className=\"sr-only\"> ({lu})</span>\n ) : null}\n </span>\n </SidebarMenuButton>\n {pastille ? (\n <SidebarMenuBadge\n aria-hidden=\"true\"\n className=\"rounded-full bg-primary text-primary-foreground peer-hover/menu-button:text-primary-foreground peer-data-active/menu-button:text-primary-foreground\"\n >\n {pastille}\n </SidebarMenuBadge>\n ) : null}\n </SidebarMenuItem>\n )\n }\n )}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n ))}\n </nav>\n )\n}\n\n/** Texte de la pastille d'une entrée, ou `null` sans pastille (0, vide, ou\n * un compte qui n'est pas un nombre fini : `NaN` d'un calcul sur une\n * donnée absente). */\nfunction texteBadge(badge: AppShellLien[\"badge\"]): string | null {\n if (badge === undefined || badge === null || badge === 0 || badge === \"\")\n return null\n if (typeof badge === \"number\")\n return Number.isFinite(badge) ? nombreFr(badge) : null\n return badge\n}\n\n/** Entrée « Thème : Sombre » du menu du compte, qui ouvre Clair / Système /\n * Sombre. Choisir ferme le menu. Dans le tiroir mobile, trop étroit pour un\n * sous-menu à côté du menu (il s'ouvrait dessous, sur « Se déconnecter »),\n * les trois choix sont dans le menu, sous un intitulé. */\nfunction MenuTheme({\n valeur,\n onChoisir,\n}: {\n valeur: ThemePreference\n onChoisir: (theme: ThemePreference) => void\n}) {\n const { isMobile } = useSidebar()\n const { libelle, Icone } = themeActuel(valeur)\n if (isMobile)\n return (\n <DropdownMenuGroup>\n <DropdownMenuLabel>Thème de l'interface</DropdownMenuLabel>\n <ThemeRadioGroup valeur={valeur} onChoisir={onChoisir} />\n </DropdownMenuGroup>\n )\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Icone />\n {libelle}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-40\">\n <ThemeRadioGroup valeur={valeur} onChoisir={onChoisir} />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n )\n}\n\nfunction MenuCompte({\n compte,\n theme,\n Lien,\n}: {\n compte: AppShellCompte\n theme?: AppShellProps[\"theme\"]\n Lien: LienComposant\n}) {\n const [confirmer, setConfirmer] = useState(false)\n const { echec, effacerEchec, choisir } = useChoixTheme({\n valeur: theme?.valeur ?? \"system\",\n onValeurChange: theme?.onValeurChange ?? (() => {}),\n })\n\n return (\n <>\n {/* relative : y pose « Thème non enregistré », au-dessus du bouton. */}\n <SidebarMenu className=\"relative min-w-0 flex-1\">\n <SidebarMenuItem>\n <DropdownMenu onOpenChange={(ouvert) => ouvert && effacerEchec()}>\n <DropdownMenuTrigger\n render={\n <SidebarMenuButton\n size=\"lg\"\n isActive={compte.actif}\n aria-label={`${compte.nom}, menu du compte`}\n // Sans contour, comme le nav-user de shadcn : le survol dit\n // qu'il s'ouvre. rounded-lg : le survol épouse l'avatar.\n className=\"rounded-lg data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground\"\n />\n }\n >\n {/* Carré arrondi, comme le nav-user de shadcn : la forme du\n survol du bouton. */}\n <Avatar className=\"rounded-lg after:rounded-lg\">\n {compte.photo ? (\n <AvatarImage\n src={compte.photo}\n alt=\"\"\n className=\"rounded-lg\"\n />\n ) : null}\n <AvatarFallback className=\"rounded-lg\">\n {compte.initiales}\n </AvatarFallback>\n </Avatar>\n <span className=\"grid flex-1 text-left leading-tight\">\n <span className=\"truncate font-medium\">{compte.nom}</span>\n {compte.detail ? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {compte.detail}\n </span>\n ) : null}\n </span>\n <ChevronsUpDownIcon className=\"ml-auto\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"top\" align=\"start\" className=\"min-w-56\">\n {compte.entrees?.length ? (\n <>\n <DropdownMenuGroup>\n {compte.entrees.map(\n ({ libelle, icone: Icone, href, onChoisir }, i) => (\n <DropdownMenuItem\n key={i}\n render={href ? <Lien href={href} /> : undefined}\n onClick={onChoisir}\n {...{ [FERME_TIROIR]: true }}\n >\n {Icone ? <Icone /> : null}\n {libelle}\n </DropdownMenuItem>\n )\n )}\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n </>\n ) : null}\n {theme ? (\n <>\n <MenuTheme valeur={theme.valeur} onChoisir={choisir} />\n <DropdownMenuSeparator />\n </>\n ) : null}\n <DropdownMenuItem onClick={() => setConfirmer(true)}>\n <LogOutIcon />\n Se déconnecter\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n {echec ? <EchecTheme side=\"top\" className=\"left-0\" /> : null}\n </SidebarMenu>\n\n <AlertDialog open={confirmer} onOpenChange={setConfirmer}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Se déconnecter</AlertDialogTitle>\n <AlertDialogDescription>\n Voulez-vous vraiment vous déconnecter&#8239;?\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Annuler</AlertDialogCancel>\n <AlertDialogAction\n variant=\"destructive\"\n onClick={() => {\n setConfirmer(false)\n compte.onSeDeconnecter()\n }}\n >\n Se déconnecter\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n )\n}\n\n/** Sous le seuil mobile, la barre latérale n'est plus à l'écran : cette barre\n * porte le bouton qui l'ouvre en tiroir, et la marque. */\nfunction BarreMobile({\n application,\n Lien,\n}: Pick<AppShellProps, \"application\"> & { Lien: LienComposant }) {\n const { isMobile, openMobile } = useSidebar()\n if (!isMobile) return null\n return (\n // Sa hauteur (h-12) est reprise par le `scroll-padding-top` de styles.css :\n // une ancre ne passe pas sous la barre collante. Sur le fond de la page.\n <header\n data-slot=\"app-shell-mobile-bar\"\n className=\"sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b bg-page px-2\"\n >\n {/* Un seul nom, par `libelle` : un `aria-label` aurait masqué le texte\n lu de shadcn, qui en divergeait. */}\n <SidebarTrigger\n libelle=\"Ouvrir le menu\"\n aria-expanded={openMobile}\n className=\"size-9\"\n />\n <Lien\n href={application.href ?? \"/\"}\n className=\"flex min-w-0 items-center gap-2 rounded-md px-1 font-semibold outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Logo application={application} className=\"size-6\" />\n <span className=\"truncate\">{application.nom}</span>\n </Lien>\n </header>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgKA,SAAgBE,GAAS,EACvB,gBACA,aACA,WACA,UACA,SACA,YACA,eACgB;CAChB,IAAMC,IAAOC,EAAQC,CAAI,GACnBC,IAAYC,EAAM;CACxB,OACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAAC,KAAD;EACE,MAAM,IAAIF;EACV,aAAU;EACV,UAAU,MAAU;GAIlB,AADAG,EAAM,eAAe,GACrB,SAAS,eAAeH,CAAS,CAAC,EAAE,MAAM;EAC5C;EACA,WAAU;EACX,UAAA;CAEE,CAAA,GACH,kBAACI,GAAD;EAAiB,aAAa,CAACC,GAAe;EAA9C,UAAA,CACE,kBAACC,IAAD,EAAA,UAAA;GACE,kBAACC,GAAD;IAAe,WAAU;IAAzB,UAAA,CACE,kBAACC,IAAD;KAAqB;KAAmB;IAAO,CAAA,GAC/C,kBAACC,IAAD,CAAc,CAAA,CACD;;GACf,kBAACC,GAAD,EAAA,UACE,kBAACC,IAAD;IAAsB;IAAgB;GAAO,CAAA,EAC/B,CAAA;GACfC,KAAUC,IACT,kBAACC,GAAD;IAAe,WAAU;IAItB,UAAAF,IACC,kBAACG,IAAD;KAAoB;KAAe;KAAa;IAAO,CAAA,IACrDF,IACF,kBAACG,GAAD;KACE,GAAIH;KACJ,MAAK;KAGL,WAAU;IACX,CAAA,IACC;GACS,CAAA,IACb;EACG,EAAA,CAAA,GACT,kBAACI,GAAD;GACE,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GAAD;IAAmB;IAAa,WAAU;GAAU,CAAA,GACpD,kBAAC,QAAD;IAAM,WAAU;IAAY,UAAAC,EAAY;GAAU,CAAA,CAC9C;EACA,CAAA,CAAA;C,KAtBY;AAwBxB"}
@@ -0,0 +1,15 @@
1
+ export interface CodeBlockProps {
2
+ /** Un texte, rendu tel quel ; toute autre valeur, en JSON indenté. */
3
+ valeur: unknown;
4
+ /** Lignes longues coupées au lieu de défiler de côté (message, trace lus
5
+ * sur téléphone). */
6
+ retourLigne?: boolean;
7
+ /** Classes du bloc : sa hauteur maximale (`max-h-80`), au-delà de laquelle
8
+ * il défile. */
9
+ className?: string;
10
+ }
11
+ /**
12
+ * Une donnée technique telle quelle (contexte enregistré, trace, réponse
13
+ * d'un service), en police à chasse fixe, dans un bloc qui défile.
14
+ */
15
+ export declare function CodeBlock({ valeur, retourLigne, className, }: CodeBlockProps): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { cn as e } from "cn";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ // src/components/etic/code-block.tsx
4
+ function n({ valeur: n, retourLigne: i = !1, className: a }) {
5
+ return /* @__PURE__ */ t("pre", {
6
+ "data-slot": "code-block",
7
+ className: e("min-w-0 overflow-auto rounded-md bg-muted p-3 font-mono text-xs", i && "break-words whitespace-pre-wrap", a),
8
+ children: r(n)
9
+ });
10
+ }
11
+ function r(e) {
12
+ if (typeof e == "string") return e;
13
+ try {
14
+ let t = JSON.stringify(e, null, 2);
15
+ if (t !== void 0) return t;
16
+ } catch {}
17
+ return String(e);
18
+ }
19
+ export { n as CodeBlock };
20
+
21
+ //# sourceMappingURL=code-block.js.map