@cgi-learning-hub/ui 1.6.0-dev.1749207390 → 1.6.0-dev.1749572967
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/dist/{Autocomplete-XmIFWgiQ.js → Autocomplete-BVy1WjPe.js} +45 -45
- package/dist/Autocomplete-v4ZcHulv.cjs +6 -0
- package/dist/components/ButtonGroup/ButtonGroup.cjs.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +3 -0
- package/dist/components/{SwitchView/SwitchView.es.js → ButtonGroup/ButtonGroup.es.js} +12 -9
- package/dist/components/ButtonGroup/index.cjs.js +1 -0
- package/dist/components/ButtonGroup/index.d.ts +2 -0
- package/dist/components/ButtonGroup/index.es.js +4 -0
- package/dist/components/{SwitchView → ButtonGroup}/types.d.ts +4 -3
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.es.js +23 -23
- package/dist/components/stories/Autocomplete.stories.cjs.js +1 -1
- package/dist/components/stories/Autocomplete.stories.es.js +1 -1
- package/dist/components/stories/ButtonGroup.stories.cjs.js +153 -0
- package/dist/components/stories/{SwitchView.stories.d.ts → ButtonGroup.stories.d.ts} +4 -3
- package/dist/components/stories/{SwitchView.stories.es.js → ButtonGroup.stories.es.js} +433 -272
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +23 -23
- package/package.json +1 -1
- package/dist/Autocomplete-CpRv6_iv.cjs +0 -6
- package/dist/components/SwitchView/SwitchView.cjs.js +0 -1
- package/dist/components/SwitchView/SwitchView.d.ts +0 -3
- package/dist/components/SwitchView/index.cjs.js +0 -1
- package/dist/components/SwitchView/index.d.ts +0 -2
- package/dist/components/SwitchView/index.es.js +0 -4
- package/dist/components/stories/SwitchView.stories.cjs.js +0 -143
- /package/dist/components/{SwitchView → ButtonGroup}/style.cjs.js +0 -0
- /package/dist/components/{SwitchView → ButtonGroup}/style.es.js +0 -0
- /package/dist/components/{SwitchView → ButtonGroup}/types.cjs.js +0 -0
- /package/dist/components/{SwitchView → ButtonGroup}/types.es.js +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { useState as u, useCallback as
|
|
4
|
-
import
|
|
5
|
-
import { B as
|
|
6
|
-
import { T as
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { c as S } from "../../createSvgIcon-BWru5SCV.js";
|
|
3
|
+
import { useState as u, useCallback as w } from "react";
|
|
4
|
+
import p from "../ButtonGroup/ButtonGroup.es.js";
|
|
5
|
+
import { B as m } from "../../Box-DjbKEblU.js";
|
|
6
|
+
import { T as t } from "../../Typography-CYUXO-Vm.js";
|
|
7
7
|
import { G as l } from "../../Grid-CpuW2Xrl.js";
|
|
8
8
|
import { B as y } from "../../Button-WTdCmXYm.js";
|
|
9
9
|
import { P as s } from "../../Paper-yeP8q4RO.js";
|
|
10
|
-
const
|
|
10
|
+
const M = S(/* @__PURE__ */ e("path", {
|
|
11
11
|
d: "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2M8 11H4V6h4zm6 0h-4V6h4zm6 0h-4V6h4zM8 18H4v-5h4zm6 0h-4v-5h4zm6 0h-4v-5h4z"
|
|
12
|
-
}), "CalendarViewMonth"),
|
|
12
|
+
}), "CalendarViewMonth"), z = S(/* @__PURE__ */ e("path", {
|
|
13
13
|
fillRule: "evenodd",
|
|
14
14
|
d: "M3 3v8h8V3zm6 6H5V5h4zm-6 4v8h8v-8zm6 6H5v-4h4zm4-16v8h8V3zm6 6h-4V5h4zm-6 4v8h8v-8zm6 6h-4v-4h4z"
|
|
15
|
-
}), "GridView"),
|
|
15
|
+
}), "GridView"), x = S(/* @__PURE__ */ e("path", {
|
|
16
16
|
d: "M3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm4 4h14v-2H7zm0 4h14v-2H7zM7 7v2h14V7z"
|
|
17
|
-
}), "List"),
|
|
17
|
+
}), "List"), V = S(/* @__PURE__ */ e("path", {
|
|
18
18
|
d: "M21 8H3V4h18zm0 2H3v4h18zm0 6H3v4h18z"
|
|
19
|
-
}), "TableRows"), T =
|
|
19
|
+
}), "TableRows"), T = S(/* @__PURE__ */ e("path", {
|
|
20
20
|
d: "M2 4v7h20V4zm8 16h12v-7H10zm-8 0h6v-7H2z"
|
|
21
|
-
}), "ViewComfy"), B =
|
|
21
|
+
}), "ViewComfy"), B = S(/* @__PURE__ */ e("path", {
|
|
22
22
|
d: "M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"
|
|
23
|
-
}), "ViewModule"),
|
|
24
|
-
title: "Components/
|
|
25
|
-
component:
|
|
23
|
+
}), "ViewModule"), F = {
|
|
24
|
+
title: "Components/ButtonGroup",
|
|
25
|
+
component: p,
|
|
26
26
|
argTypes: {
|
|
27
|
-
|
|
28
|
-
description: "**[Requis]** Liste des boutons à afficher dans le
|
|
27
|
+
buttonList: {
|
|
28
|
+
description: "**[Requis]** Liste des boutons à afficher dans le ButtonGroup.",
|
|
29
29
|
control: "object",
|
|
30
30
|
table: {
|
|
31
31
|
required: !0,
|
|
32
|
-
type: { summary: "readonly
|
|
32
|
+
type: { summary: "readonly ButtonItem[]" }
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
viewMode: {
|
|
@@ -87,13 +87,13 @@ const I = z(/* @__PURE__ */ e("path", {
|
|
|
87
87
|
docs: {
|
|
88
88
|
description: {
|
|
89
89
|
component: `
|
|
90
|
-
##
|
|
90
|
+
## ButtonGroup
|
|
91
91
|
|
|
92
92
|
Un composant générique TypeScript pour permettre à l'utilisateur de basculer entre différents modes d'affichage ou options avec une sécurité de type complète.
|
|
93
93
|
|
|
94
94
|
### 🔥 Typage générique et sécurité des types
|
|
95
95
|
|
|
96
|
-
Le
|
|
96
|
+
Le ButtonGroup utilise TypeScript générique avancé pour inférer automatiquement les types des valeurs possibles à partir de la liste des boutons fournie. **Il n'est plus nécessaire de définir un enum**, les types sont déduits automatiquement grâce à la magie de TypeScript !
|
|
97
97
|
|
|
98
98
|
**Point clé** : Utilisez toujours \`as const\` après votre tableau de boutons pour permettre l'inférence de type littéral.
|
|
99
99
|
|
|
@@ -117,8 +117,8 @@ const handleViewChange = useCallback((value: ViewType) => {
|
|
|
117
117
|
setCurrentView(value);
|
|
118
118
|
}, []);
|
|
119
119
|
|
|
120
|
-
<
|
|
121
|
-
|
|
120
|
+
<ButtonGroup
|
|
121
|
+
buttonList={viewButtons}
|
|
122
122
|
viewMode={currentView}
|
|
123
123
|
onChange={handleViewChange} // ← Pas d'erreur 'any' !
|
|
124
124
|
/>
|
|
@@ -148,18 +148,18 @@ const handleViewChange = (value) => { // ← 'value' aura le type 'any'
|
|
|
148
148
|
|
|
149
149
|
### 📋 Structure des données
|
|
150
150
|
|
|
151
|
-
Le composant attend un tableau d'objets \`
|
|
151
|
+
Le composant attend un tableau d'objets \`ButtonItem\` typé de manière générique :
|
|
152
152
|
|
|
153
153
|
\`\`\`typescript
|
|
154
|
-
interface
|
|
154
|
+
interface ButtonItem<T extends string = string> {
|
|
155
155
|
value: T; // Valeur unique pour ce bouton (obligatoire)
|
|
156
156
|
icon: ReactNode; // Icône à afficher (obligatoire)
|
|
157
157
|
disabled?: boolean; // Désactiver ce bouton spécifique (facultatif)
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
// Le composant infère automatiquement T à partir de votre tableau
|
|
161
|
-
type SwitchViewProps<T extends readonly
|
|
162
|
-
|
|
161
|
+
type SwitchViewProps<T extends readonly ButtonItem<string>[]> = {
|
|
162
|
+
buttonList: T;
|
|
163
163
|
viewMode: T[number]["value"]; // Type inféré automatiquement
|
|
164
164
|
onChange: (value: T[number]["value"]) => void; // Type inféré automatiquement
|
|
165
165
|
// ... autres props
|
|
@@ -204,36 +204,36 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, f = [
|
|
208
208
|
{ value: "cards", icon: /* @__PURE__ */ e(B, {}) },
|
|
209
|
-
{ value: "table", icon: /* @__PURE__ */ e(
|
|
210
|
-
{ value: "list", icon: /* @__PURE__ */ e(
|
|
211
|
-
],
|
|
212
|
-
{ value: "grid", icon: /* @__PURE__ */ e(
|
|
209
|
+
{ value: "table", icon: /* @__PURE__ */ e(V, {}) },
|
|
210
|
+
{ value: "list", icon: /* @__PURE__ */ e(x, {}) }
|
|
211
|
+
], I = [
|
|
212
|
+
{ value: "grid", icon: /* @__PURE__ */ e(z, {}) },
|
|
213
213
|
{ value: "cards", icon: /* @__PURE__ */ e(T, {}) },
|
|
214
|
-
{ value: "table", icon: /* @__PURE__ */ e(
|
|
215
|
-
{ value: "list", icon: /* @__PURE__ */ e(
|
|
216
|
-
{ value: "calendar", icon: /* @__PURE__ */ e(
|
|
217
|
-
],
|
|
214
|
+
{ value: "table", icon: /* @__PURE__ */ e(V, {}) },
|
|
215
|
+
{ value: "list", icon: /* @__PURE__ */ e(x, {}) },
|
|
216
|
+
{ value: "calendar", icon: /* @__PURE__ */ e(M, {}) }
|
|
217
|
+
], D = [
|
|
218
218
|
{ value: "cards", icon: /* @__PURE__ */ e(B, {}) },
|
|
219
|
-
{ value: "table", icon: /* @__PURE__ */ e(
|
|
220
|
-
{ value: "list", icon: /* @__PURE__ */ e(
|
|
221
|
-
],
|
|
219
|
+
{ value: "table", icon: /* @__PURE__ */ e(V, {}), disabled: !0 },
|
|
220
|
+
{ value: "list", icon: /* @__PURE__ */ e(x, {}) }
|
|
221
|
+
], W = {
|
|
222
222
|
render: () => {
|
|
223
|
-
const [o, r] = u("cards"), c =
|
|
223
|
+
const [o, r] = u("cards"), c = w((i) => {
|
|
224
224
|
console.log(`Vue sélectionnée: ${i}`), r(i);
|
|
225
225
|
}, []);
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */ e(
|
|
226
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
227
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Sélecteur de vue standard" }),
|
|
228
228
|
/* @__PURE__ */ e(
|
|
229
|
-
|
|
229
|
+
p,
|
|
230
230
|
{
|
|
231
|
-
|
|
231
|
+
buttonList: f,
|
|
232
232
|
viewMode: o,
|
|
233
233
|
onChange: c
|
|
234
234
|
}
|
|
235
235
|
),
|
|
236
|
-
/* @__PURE__ */ t
|
|
236
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
237
237
|
"Vue actuelle: ",
|
|
238
238
|
/* @__PURE__ */ e("strong", { children: o })
|
|
239
239
|
] })
|
|
@@ -248,19 +248,19 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
},
|
|
251
|
+
}, j = {
|
|
252
252
|
render: () => {
|
|
253
253
|
const [o, r] = u("table"), [c, i] = u(
|
|
254
254
|
"primary"
|
|
255
|
-
), [h, a] = u("small"), [v,
|
|
255
|
+
), [h, a] = u("small"), [v, b] = u(
|
|
256
256
|
"horizontal"
|
|
257
257
|
);
|
|
258
|
-
return /* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */ e(
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */ e(
|
|
263
|
-
/* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
259
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Personnalisation en temps réel" }),
|
|
260
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 2, sx: { mb: 3 }, children: [
|
|
261
|
+
/* @__PURE__ */ n(l, { size: { xs: 12, sm: 6, md: 3 }, children: [
|
|
262
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Couleur" }),
|
|
263
|
+
/* @__PURE__ */ n(m, { sx: { display: "flex", gap: 1 }, children: [
|
|
264
264
|
/* @__PURE__ */ e(
|
|
265
265
|
y,
|
|
266
266
|
{
|
|
@@ -281,28 +281,28 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
281
281
|
)
|
|
282
282
|
] })
|
|
283
283
|
] }),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */ e(
|
|
286
|
-
/* @__PURE__ */ e(
|
|
284
|
+
/* @__PURE__ */ n(l, { size: { xs: 12, sm: 6, md: 3 }, children: [
|
|
285
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Taille" }),
|
|
286
|
+
/* @__PURE__ */ e(m, { sx: { display: "flex", gap: 1 }, children: ["small", "medium", "large"].map((g) => /* @__PURE__ */ e(
|
|
287
287
|
y,
|
|
288
288
|
{
|
|
289
289
|
size: "small",
|
|
290
|
-
variant: h ===
|
|
291
|
-
onClick: () => a(
|
|
292
|
-
children:
|
|
290
|
+
variant: h === g ? "contained" : "outlined",
|
|
291
|
+
onClick: () => a(g),
|
|
292
|
+
children: g
|
|
293
293
|
},
|
|
294
|
-
|
|
294
|
+
g
|
|
295
295
|
)) })
|
|
296
296
|
] }),
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */ e(
|
|
299
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ n(l, { size: { xs: 12, sm: 6, md: 3 }, children: [
|
|
298
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Orientation" }),
|
|
299
|
+
/* @__PURE__ */ n(m, { sx: { display: "flex", gap: 1 }, children: [
|
|
300
300
|
/* @__PURE__ */ e(
|
|
301
301
|
y,
|
|
302
302
|
{
|
|
303
303
|
size: "small",
|
|
304
304
|
variant: v === "horizontal" ? "contained" : "outlined",
|
|
305
|
-
onClick: () =>
|
|
305
|
+
onClick: () => b("horizontal"),
|
|
306
306
|
children: "Horizontal"
|
|
307
307
|
}
|
|
308
308
|
),
|
|
@@ -311,24 +311,24 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
311
311
|
{
|
|
312
312
|
size: "small",
|
|
313
313
|
variant: v === "vertical" ? "contained" : "outlined",
|
|
314
|
-
onClick: () =>
|
|
314
|
+
onClick: () => b("vertical"),
|
|
315
315
|
children: "Vertical"
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
] })
|
|
319
319
|
] }),
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */ e(
|
|
322
|
-
/* @__PURE__ */ e(
|
|
320
|
+
/* @__PURE__ */ n(l, { size: { xs: 12, sm: 6, md: 3 }, children: [
|
|
321
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Vue actuelle" }),
|
|
322
|
+
/* @__PURE__ */ e(t, { variant: "body2", color: "primary", children: /* @__PURE__ */ e("strong", { children: o }) })
|
|
323
323
|
] })
|
|
324
324
|
] }),
|
|
325
325
|
/* @__PURE__ */ e(s, { sx: { p: 3, display: "inline-block" }, children: /* @__PURE__ */ e(
|
|
326
|
-
|
|
326
|
+
p,
|
|
327
327
|
{
|
|
328
|
-
|
|
328
|
+
buttonList: f,
|
|
329
329
|
viewMode: o,
|
|
330
|
-
onChange: (
|
|
331
|
-
console.log(`Vue sélectionnée: ${
|
|
330
|
+
onChange: (g) => {
|
|
331
|
+
console.log(`Vue sélectionnée: ${g}`), r(g);
|
|
332
332
|
},
|
|
333
333
|
colorVariant: c,
|
|
334
334
|
size: h,
|
|
@@ -347,28 +347,28 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
},
|
|
350
|
+
}, N = {
|
|
351
351
|
render: () => {
|
|
352
352
|
const o = [
|
|
353
353
|
{ value: "on", icon: /* @__PURE__ */ e(B, {}) },
|
|
354
|
-
{ value: "off", icon: /* @__PURE__ */ e(
|
|
354
|
+
{ value: "off", icon: /* @__PURE__ */ e(V, {}) }
|
|
355
355
|
], r = [
|
|
356
356
|
{ value: "active", icon: /* @__PURE__ */ e(T, {}) },
|
|
357
|
-
{ value: "inactive", icon: /* @__PURE__ */ e(
|
|
358
|
-
{ value: "pending", icon: /* @__PURE__ */ e(
|
|
357
|
+
{ value: "inactive", icon: /* @__PURE__ */ e(x, {}) },
|
|
358
|
+
{ value: "pending", icon: /* @__PURE__ */ e(z, {}) }
|
|
359
359
|
], c = [
|
|
360
360
|
{ value: "edit", icon: /* @__PURE__ */ e(B, {}) },
|
|
361
|
-
{ value: "view", icon: /* @__PURE__ */ e(
|
|
362
|
-
{ value: "preview", icon: /* @__PURE__ */ e(
|
|
363
|
-
], [i, h] = u("on"), [a, v] = u("active"), [
|
|
364
|
-
return /* @__PURE__ */
|
|
365
|
-
/* @__PURE__ */ e(
|
|
366
|
-
/* @__PURE__ */ e(
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ e(
|
|
361
|
+
{ value: "view", icon: /* @__PURE__ */ e(V, {}) },
|
|
362
|
+
{ value: "preview", icon: /* @__PURE__ */ e(x, {}) }
|
|
363
|
+
], [i, h] = u("on"), [a, v] = u("active"), [b, g] = u("edit");
|
|
364
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
365
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Différents contextes d'utilisation" }),
|
|
366
|
+
/* @__PURE__ */ e(t, { variant: "body2", color: "text.secondary", paragraph: !0, children: "Le même composant s'adapte automatiquement à différents types de données." }),
|
|
367
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
368
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
369
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Mode binaire" }),
|
|
370
370
|
/* @__PURE__ */ e(
|
|
371
|
-
|
|
371
|
+
t,
|
|
372
372
|
{
|
|
373
373
|
variant: "caption",
|
|
374
374
|
color: "text.secondary",
|
|
@@ -378,24 +378,24 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
378
378
|
}
|
|
379
379
|
),
|
|
380
380
|
/* @__PURE__ */ e(
|
|
381
|
-
|
|
381
|
+
p,
|
|
382
382
|
{
|
|
383
|
-
|
|
383
|
+
buttonList: o,
|
|
384
384
|
viewMode: i,
|
|
385
|
-
onChange: (
|
|
386
|
-
console.log("Simple:",
|
|
385
|
+
onChange: (d) => {
|
|
386
|
+
console.log("Simple:", d), h(d);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
),
|
|
390
|
-
/* @__PURE__ */ t
|
|
390
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
391
391
|
"État: ",
|
|
392
392
|
i
|
|
393
393
|
] })
|
|
394
394
|
] }) }),
|
|
395
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */ e(
|
|
395
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
396
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Statut système" }),
|
|
397
397
|
/* @__PURE__ */ e(
|
|
398
|
-
|
|
398
|
+
t,
|
|
399
399
|
{
|
|
400
400
|
variant: "caption",
|
|
401
401
|
color: "text.secondary",
|
|
@@ -405,25 +405,25 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
405
405
|
}
|
|
406
406
|
),
|
|
407
407
|
/* @__PURE__ */ e(
|
|
408
|
-
|
|
408
|
+
p,
|
|
409
409
|
{
|
|
410
|
-
|
|
410
|
+
buttonList: r,
|
|
411
411
|
viewMode: a,
|
|
412
|
-
onChange: (
|
|
413
|
-
console.log("Status:",
|
|
412
|
+
onChange: (d) => {
|
|
413
|
+
console.log("Status:", d), v(d);
|
|
414
414
|
},
|
|
415
415
|
colorVariant: "secondary"
|
|
416
416
|
}
|
|
417
417
|
),
|
|
418
|
-
/* @__PURE__ */ t
|
|
418
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
419
419
|
"Statut: ",
|
|
420
420
|
a
|
|
421
421
|
] })
|
|
422
422
|
] }) }),
|
|
423
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */ e(
|
|
423
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
424
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Mode d'édition" }),
|
|
425
425
|
/* @__PURE__ */ e(
|
|
426
|
-
|
|
426
|
+
t,
|
|
427
427
|
{
|
|
428
428
|
variant: "caption",
|
|
429
429
|
color: "text.secondary",
|
|
@@ -433,23 +433,23 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
433
433
|
}
|
|
434
434
|
),
|
|
435
435
|
/* @__PURE__ */ e(
|
|
436
|
-
|
|
436
|
+
p,
|
|
437
437
|
{
|
|
438
|
-
|
|
439
|
-
viewMode:
|
|
440
|
-
onChange: (
|
|
441
|
-
console.log("Mode:",
|
|
438
|
+
buttonList: c,
|
|
439
|
+
viewMode: b,
|
|
440
|
+
onChange: (d) => {
|
|
441
|
+
console.log("Mode:", d), g(d);
|
|
442
442
|
},
|
|
443
443
|
size: "medium"
|
|
444
444
|
}
|
|
445
445
|
),
|
|
446
|
-
/* @__PURE__ */ t
|
|
446
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
447
447
|
"Mode: ",
|
|
448
|
-
|
|
448
|
+
b
|
|
449
449
|
] })
|
|
450
450
|
] }) })
|
|
451
451
|
] }),
|
|
452
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ n(
|
|
453
453
|
s,
|
|
454
454
|
{
|
|
455
455
|
sx: {
|
|
@@ -459,8 +459,8 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
459
459
|
color: "info.contrastText"
|
|
460
460
|
},
|
|
461
461
|
children: [
|
|
462
|
-
/* @__PURE__ */ e(
|
|
463
|
-
/* @__PURE__ */ e(
|
|
462
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "🎯 Flexibilité du composant" }),
|
|
463
|
+
/* @__PURE__ */ e(t, { variant: "body2", children: "Un seul composant peut gérer n'importe quel ensemble d'options, s'adaptant automatiquement au contexte d'utilisation." })
|
|
464
464
|
]
|
|
465
465
|
}
|
|
466
466
|
)
|
|
@@ -481,17 +481,17 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
481
481
|
primary: "cards",
|
|
482
482
|
secondary: "table"
|
|
483
483
|
});
|
|
484
|
-
return /* @__PURE__ */
|
|
485
|
-
/* @__PURE__ */ e(
|
|
486
|
-
/* @__PURE__ */ e(l, { container: !0, spacing: 3, children: o.map((i) => /* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
487
|
-
/* @__PURE__ */ t
|
|
484
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
485
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Comparaison des variantes de couleurs" }),
|
|
486
|
+
/* @__PURE__ */ e(l, { container: !0, spacing: 3, children: o.map((i) => /* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
487
|
+
/* @__PURE__ */ n(t, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
488
488
|
"Variante ",
|
|
489
489
|
i
|
|
490
490
|
] }),
|
|
491
491
|
/* @__PURE__ */ e(
|
|
492
|
-
|
|
492
|
+
p,
|
|
493
493
|
{
|
|
494
|
-
|
|
494
|
+
buttonList: f,
|
|
495
495
|
viewMode: r[i],
|
|
496
496
|
onChange: (h) => {
|
|
497
497
|
c((a) => ({ ...a, [i]: h }));
|
|
@@ -499,7 +499,7 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
499
499
|
colorVariant: i
|
|
500
500
|
}
|
|
501
501
|
),
|
|
502
|
-
/* @__PURE__ */ t
|
|
502
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
503
503
|
"Sélectionné: ",
|
|
504
504
|
r[i]
|
|
505
505
|
] })
|
|
@@ -526,17 +526,17 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
526
526
|
medium: "table",
|
|
527
527
|
large: "list"
|
|
528
528
|
});
|
|
529
|
-
return /* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */ e(
|
|
531
|
-
/* @__PURE__ */ e(l, { container: !0, spacing: 3, children: o.map((i) => /* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */ t
|
|
529
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
530
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Comparaison des tailles" }),
|
|
531
|
+
/* @__PURE__ */ e(l, { container: !0, spacing: 3, children: o.map((i) => /* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
532
|
+
/* @__PURE__ */ n(t, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
533
533
|
"Taille ",
|
|
534
534
|
i
|
|
535
535
|
] }),
|
|
536
536
|
/* @__PURE__ */ e(
|
|
537
|
-
|
|
537
|
+
p,
|
|
538
538
|
{
|
|
539
|
-
|
|
539
|
+
buttonList: f,
|
|
540
540
|
viewMode: r[i],
|
|
541
541
|
onChange: (h) => {
|
|
542
542
|
c((a) => ({ ...a, [i]: h }));
|
|
@@ -544,7 +544,7 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
544
544
|
size: i
|
|
545
545
|
}
|
|
546
546
|
),
|
|
547
|
-
/* @__PURE__ */ t
|
|
547
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
548
548
|
"Sélectionné: ",
|
|
549
549
|
r[i]
|
|
550
550
|
] })
|
|
@@ -562,18 +562,18 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
562
562
|
}
|
|
563
563
|
}, J = {
|
|
564
564
|
render: () => {
|
|
565
|
-
const [o, r] = u("grid"), c =
|
|
565
|
+
const [o, r] = u("grid"), c = w((i) => {
|
|
566
566
|
r(i);
|
|
567
567
|
}, []);
|
|
568
|
-
return /* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */ e(
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
572
|
-
/* @__PURE__ */ e(
|
|
568
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
569
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Orientation verticale" }),
|
|
570
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
571
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
572
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Orientation verticale - Taille medium" }),
|
|
573
573
|
/* @__PURE__ */ e(
|
|
574
|
-
|
|
574
|
+
p,
|
|
575
575
|
{
|
|
576
|
-
|
|
576
|
+
buttonList: I,
|
|
577
577
|
viewMode: o,
|
|
578
578
|
onChange: c,
|
|
579
579
|
orientation: "vertical",
|
|
@@ -581,12 +581,12 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
581
581
|
}
|
|
582
582
|
)
|
|
583
583
|
] }) }),
|
|
584
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */ e(
|
|
584
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
585
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Orientation horizontale (comparaison)" }),
|
|
586
586
|
/* @__PURE__ */ e(
|
|
587
|
-
|
|
587
|
+
p,
|
|
588
588
|
{
|
|
589
|
-
|
|
589
|
+
buttonList: I,
|
|
590
590
|
viewMode: o,
|
|
591
591
|
onChange: c,
|
|
592
592
|
orientation: "horizontal",
|
|
@@ -595,7 +595,7 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
595
595
|
)
|
|
596
596
|
] }) })
|
|
597
597
|
] }),
|
|
598
|
-
/* @__PURE__ */ t
|
|
598
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
599
599
|
"Vue actuelle: ",
|
|
600
600
|
/* @__PURE__ */ e("strong", { children: o })
|
|
601
601
|
] })
|
|
@@ -612,27 +612,187 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
612
612
|
}
|
|
613
613
|
}, K = {
|
|
614
614
|
render: () => {
|
|
615
|
-
const
|
|
615
|
+
const o = [
|
|
616
|
+
{
|
|
617
|
+
value: "grid",
|
|
618
|
+
icon: /* @__PURE__ */ e(z, {}),
|
|
619
|
+
text: "Grille"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
value: "table",
|
|
623
|
+
icon: /* @__PURE__ */ e(V, {}),
|
|
624
|
+
text: "Tableau"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
value: "list",
|
|
628
|
+
icon: /* @__PURE__ */ e(x, {}),
|
|
629
|
+
text: "Liste"
|
|
630
|
+
}
|
|
631
|
+
], r = [
|
|
632
|
+
{ value: "cards", icon: /* @__PURE__ */ e(B, {}) },
|
|
633
|
+
{ value: "comfort", icon: /* @__PURE__ */ e(T, {}) },
|
|
634
|
+
{ value: "calendar", icon: /* @__PURE__ */ e(M, {}) }
|
|
635
|
+
], c = [
|
|
636
|
+
{
|
|
637
|
+
value: "overview",
|
|
638
|
+
icon: /* @__PURE__ */ e(z, {}),
|
|
639
|
+
text: "Vue d'ensemble"
|
|
640
|
+
},
|
|
641
|
+
{ value: "details", icon: /* @__PURE__ */ e(T, {}) },
|
|
642
|
+
// Pas de texte
|
|
643
|
+
{
|
|
644
|
+
value: "settings",
|
|
645
|
+
icon: /* @__PURE__ */ e(M, {}),
|
|
646
|
+
text: "Paramètres"
|
|
647
|
+
}
|
|
648
|
+
], [i, h] = u("grid"), [a, v] = u("cards"), [b, g] = u("overview");
|
|
649
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
650
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Texte optionnel dans les boutons" }),
|
|
651
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
652
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
653
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Avec texte" }),
|
|
654
|
+
/* @__PURE__ */ e(
|
|
655
|
+
t,
|
|
656
|
+
{
|
|
657
|
+
variant: "caption",
|
|
658
|
+
color: "text.secondary",
|
|
659
|
+
display: "block",
|
|
660
|
+
sx: { mb: 2 },
|
|
661
|
+
children: "Tous les boutons ont un texte explicatif"
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
/* @__PURE__ */ e(
|
|
665
|
+
p,
|
|
666
|
+
{
|
|
667
|
+
buttonList: o,
|
|
668
|
+
viewMode: i,
|
|
669
|
+
onChange: (d) => h(d),
|
|
670
|
+
size: "medium"
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
674
|
+
"Sélection: ",
|
|
675
|
+
i
|
|
676
|
+
] })
|
|
677
|
+
] }) }),
|
|
678
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
679
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Icônes seulement" }),
|
|
680
|
+
/* @__PURE__ */ e(
|
|
681
|
+
t,
|
|
682
|
+
{
|
|
683
|
+
variant: "caption",
|
|
684
|
+
color: "text.secondary",
|
|
685
|
+
display: "block",
|
|
686
|
+
sx: { mb: 2 },
|
|
687
|
+
children: "Format classique avec icônes uniquement"
|
|
688
|
+
}
|
|
689
|
+
),
|
|
690
|
+
/* @__PURE__ */ e(
|
|
691
|
+
p,
|
|
692
|
+
{
|
|
693
|
+
buttonList: r,
|
|
694
|
+
viewMode: a,
|
|
695
|
+
onChange: (d) => v(d),
|
|
696
|
+
colorVariant: "secondary",
|
|
697
|
+
size: "medium"
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
701
|
+
"Sélection: ",
|
|
702
|
+
a
|
|
703
|
+
] })
|
|
704
|
+
] }) }),
|
|
705
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
706
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Format mixte" }),
|
|
707
|
+
/* @__PURE__ */ e(
|
|
708
|
+
t,
|
|
709
|
+
{
|
|
710
|
+
variant: "caption",
|
|
711
|
+
color: "text.secondary",
|
|
712
|
+
display: "block",
|
|
713
|
+
sx: { mb: 2 },
|
|
714
|
+
children: "Certains boutons avec texte, d'autres sans"
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ e(
|
|
718
|
+
p,
|
|
719
|
+
{
|
|
720
|
+
buttonList: c,
|
|
721
|
+
viewMode: b,
|
|
722
|
+
onChange: (d) => g(d),
|
|
723
|
+
size: "medium",
|
|
724
|
+
orientation: "vertical"
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
728
|
+
"Sélection: ",
|
|
729
|
+
b
|
|
730
|
+
] })
|
|
731
|
+
] }) })
|
|
732
|
+
] }),
|
|
733
|
+
/* @__PURE__ */ n(s, { sx: { p: 3, mt: 3, backgroundColor: "info.light" }, children: [
|
|
734
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "💡 Utilisation du texte optionnel" }),
|
|
735
|
+
/* @__PURE__ */ n(t, { variant: "body2", component: "div", children: [
|
|
736
|
+
"• Le texte s'affiche automatiquement si la propriété",
|
|
737
|
+
" ",
|
|
738
|
+
/* @__PURE__ */ e("code", { children: "text" }),
|
|
739
|
+
" est définie",
|
|
740
|
+
/* @__PURE__ */ e("br", {}),
|
|
741
|
+
"• Compatible avec l'ancien format (icônes seules)",
|
|
742
|
+
/* @__PURE__ */ e("br", {}),
|
|
743
|
+
"• Possibilité de mélanger boutons avec et sans texte",
|
|
744
|
+
/* @__PURE__ */ e("br", {}),
|
|
745
|
+
"• L'espacement est automatiquement ajusté entre l'icône et le texte"
|
|
746
|
+
] })
|
|
747
|
+
] }),
|
|
748
|
+
/* @__PURE__ */ n(s, { sx: { p: 2, mt: 2, backgroundColor: "grey.100" }, children: [
|
|
749
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Exemple de code" }),
|
|
750
|
+
/* @__PURE__ */ e("pre", { style: { margin: 0, fontSize: "0.875rem", overflow: "auto" }, children: `const buttons = [
|
|
751
|
+
{
|
|
752
|
+
value: "grid",
|
|
753
|
+
icon: <GridIcon />,
|
|
754
|
+
text: "Grille" // ← Texte optionnel
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
value: "list",
|
|
758
|
+
icon: <ListIcon /> // ← Pas de texte, seule l'icône
|
|
759
|
+
}
|
|
760
|
+
] as const;` })
|
|
761
|
+
] })
|
|
762
|
+
] });
|
|
763
|
+
},
|
|
764
|
+
parameters: {
|
|
765
|
+
controls: { disable: !0 },
|
|
766
|
+
actions: { disable: !0 },
|
|
767
|
+
docs: {
|
|
768
|
+
description: {
|
|
769
|
+
story: "Démonstration de l'utilisation du texte optionnel dans les boutons. Le texte s'affiche automatiquement si la propriété `text` est présente, permettant une grande flexibilité dans la présentation."
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}, Q = {
|
|
774
|
+
render: () => {
|
|
775
|
+
const [o, r] = u("cards"), c = w((i) => {
|
|
616
776
|
r(i);
|
|
617
777
|
}, []);
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */ e(
|
|
620
|
-
/* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
779
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Gestion des boutons désactivés" }),
|
|
780
|
+
/* @__PURE__ */ n(s, { sx: { p: 3 }, children: [
|
|
621
781
|
/* @__PURE__ */ e(
|
|
622
|
-
|
|
782
|
+
p,
|
|
623
783
|
{
|
|
624
|
-
|
|
784
|
+
buttonList: D,
|
|
625
785
|
viewMode: o,
|
|
626
786
|
onChange: c,
|
|
627
787
|
size: "medium"
|
|
628
788
|
}
|
|
629
789
|
),
|
|
630
|
-
/* @__PURE__ */ t
|
|
790
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
631
791
|
"Vue actuelle: ",
|
|
632
792
|
/* @__PURE__ */ e("strong", { children: o })
|
|
633
793
|
] }),
|
|
634
|
-
/* @__PURE__ */ e(
|
|
635
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ e(t, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: 'Le bouton "Table" est désactivé dans cet exemple' }),
|
|
795
|
+
/* @__PURE__ */ n(m, { sx: { mt: 2 }, children: [
|
|
636
796
|
/* @__PURE__ */ e(
|
|
637
797
|
y,
|
|
638
798
|
{
|
|
@@ -665,29 +825,29 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
665
825
|
}
|
|
666
826
|
}
|
|
667
827
|
}
|
|
668
|
-
},
|
|
828
|
+
}, X = {
|
|
669
829
|
render: () => {
|
|
670
|
-
const [o, r] = u("grid"), c =
|
|
830
|
+
const [o, r] = u("grid"), c = w((i) => {
|
|
671
831
|
r(i);
|
|
672
832
|
}, []);
|
|
673
|
-
return /* @__PURE__ */
|
|
674
|
-
/* @__PURE__ */ e(
|
|
675
|
-
/* @__PURE__ */
|
|
833
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
834
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Plus d'options d'affichage" }),
|
|
835
|
+
/* @__PURE__ */ n(s, { sx: { p: 3 }, children: [
|
|
676
836
|
/* @__PURE__ */ e(
|
|
677
|
-
|
|
837
|
+
p,
|
|
678
838
|
{
|
|
679
|
-
|
|
839
|
+
buttonList: I,
|
|
680
840
|
viewMode: o,
|
|
681
841
|
onChange: c,
|
|
682
842
|
colorVariant: "secondary",
|
|
683
843
|
size: "large"
|
|
684
844
|
}
|
|
685
845
|
),
|
|
686
|
-
/* @__PURE__ */ t
|
|
846
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
687
847
|
"Vue actuelle: ",
|
|
688
848
|
/* @__PURE__ */ e("strong", { children: o })
|
|
689
849
|
] }),
|
|
690
|
-
/* @__PURE__ */ e(
|
|
850
|
+
/* @__PURE__ */ e(t, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: "Cet exemple montre un ButtonGroup avec 5 options différentes en variante secondary et taille large" })
|
|
691
851
|
] })
|
|
692
852
|
] });
|
|
693
853
|
},
|
|
@@ -700,20 +860,20 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
700
860
|
}
|
|
701
861
|
}
|
|
702
862
|
}
|
|
703
|
-
},
|
|
863
|
+
}, Y = {
|
|
704
864
|
render: () => {
|
|
705
|
-
const [o, r] = u("cards"), c =
|
|
865
|
+
const [o, r] = u("cards"), c = w((a) => {
|
|
706
866
|
console.log("Changement de vue:", a), r(a);
|
|
707
|
-
}, []), i =
|
|
867
|
+
}, []), i = w((a) => {
|
|
708
868
|
console.log("Changement externe:", a), r(a);
|
|
709
869
|
}, []);
|
|
710
|
-
return /* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */ e(
|
|
712
|
-
/* @__PURE__ */ t
|
|
870
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
871
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Synchronisation avec d'autres composants" }),
|
|
872
|
+
/* @__PURE__ */ n(t, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
713
873
|
"Vue actuelle: ",
|
|
714
874
|
/* @__PURE__ */ e("strong", { children: o })
|
|
715
875
|
] }),
|
|
716
|
-
/* @__PURE__ */ e(
|
|
876
|
+
/* @__PURE__ */ e(t, { variant: "body2", color: "text.secondary", paragraph: !0, children: (() => {
|
|
717
877
|
switch (o) {
|
|
718
878
|
case "cards":
|
|
719
879
|
return "Affichage en cartes - Idéal pour une vue d'ensemble visuelle";
|
|
@@ -725,22 +885,22 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
725
885
|
return "Mode d'affichage inconnu";
|
|
726
886
|
}
|
|
727
887
|
})() }),
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */ e(
|
|
888
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
889
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
890
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "ButtonGroup Principal" }),
|
|
731
891
|
/* @__PURE__ */ e(
|
|
732
|
-
|
|
892
|
+
p,
|
|
733
893
|
{
|
|
734
|
-
|
|
894
|
+
buttonList: f,
|
|
735
895
|
viewMode: o,
|
|
736
896
|
onChange: c,
|
|
737
897
|
size: "medium"
|
|
738
898
|
}
|
|
739
899
|
)
|
|
740
900
|
] }) }),
|
|
741
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */ e(
|
|
743
|
-
/* @__PURE__ */ e(
|
|
901
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
902
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Contrôles externes" }),
|
|
903
|
+
/* @__PURE__ */ e(m, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: f.map((a) => /* @__PURE__ */ n(
|
|
744
904
|
y,
|
|
745
905
|
{
|
|
746
906
|
variant: o === a.value ? "contained" : "outlined",
|
|
@@ -756,8 +916,8 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
756
916
|
)) })
|
|
757
917
|
] }) })
|
|
758
918
|
] }),
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */ e(
|
|
919
|
+
/* @__PURE__ */ n(s, { sx: { p: 2, mt: 2, backgroundColor: "grey.50" }, children: [
|
|
920
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "Actions rapides" }),
|
|
761
921
|
/* @__PURE__ */ e(
|
|
762
922
|
y,
|
|
763
923
|
{
|
|
@@ -777,10 +937,10 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
777
937
|
variant: "text",
|
|
778
938
|
size: "small",
|
|
779
939
|
onClick: () => {
|
|
780
|
-
const v = (
|
|
781
|
-
(
|
|
782
|
-
) + 1) %
|
|
783
|
-
i(
|
|
940
|
+
const v = (f.findIndex(
|
|
941
|
+
(b) => b.value === o
|
|
942
|
+
) + 1) % f.length;
|
|
943
|
+
i(f[v].value);
|
|
784
944
|
},
|
|
785
945
|
children: "Vue suivante"
|
|
786
946
|
}
|
|
@@ -793,83 +953,83 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
793
953
|
actions: { disable: !0 },
|
|
794
954
|
docs: {
|
|
795
955
|
description: {
|
|
796
|
-
story: "Démonstration de la synchronisation entre le
|
|
956
|
+
story: "Démonstration de la synchronisation entre le ButtonGroup et d'autres composants. Cette story montre comment le ButtonGroup peut être intégré dans une interface complexe où la sélection peut provenir de différentes sources mais reste synchronisée."
|
|
797
957
|
}
|
|
798
958
|
}
|
|
799
959
|
}
|
|
800
|
-
},
|
|
960
|
+
}, Z = {
|
|
801
961
|
render: () => {
|
|
802
962
|
const o = [
|
|
803
963
|
{ value: "overview", icon: /* @__PURE__ */ e(T, {}) },
|
|
804
|
-
{ value: "detailed", icon: /* @__PURE__ */ e(
|
|
805
|
-
{ value: "analytics", icon: /* @__PURE__ */ e(
|
|
964
|
+
{ value: "detailed", icon: /* @__PURE__ */ e(V, {}) },
|
|
965
|
+
{ value: "analytics", icon: /* @__PURE__ */ e(z, {}) }
|
|
806
966
|
], r = [
|
|
807
|
-
{ value: "grid", icon: /* @__PURE__ */ e(
|
|
808
|
-
{ value: "list", icon: /* @__PURE__ */ e(
|
|
967
|
+
{ value: "grid", icon: /* @__PURE__ */ e(z, {}) },
|
|
968
|
+
{ value: "list", icon: /* @__PURE__ */ e(x, {}) },
|
|
809
969
|
{ value: "tree", icon: /* @__PURE__ */ e(B, {}) }
|
|
810
970
|
], c = [
|
|
811
|
-
{ value: "chart", icon: /* @__PURE__ */ e(
|
|
812
|
-
{ value: "table", icon: /* @__PURE__ */ e(
|
|
813
|
-
{ value: "raw", icon: /* @__PURE__ */ e(
|
|
814
|
-
], [i, h] = u("overview"), [a, v] = u("grid"), [
|
|
815
|
-
return /* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */ e(
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */ e(
|
|
971
|
+
{ value: "chart", icon: /* @__PURE__ */ e(M, {}) },
|
|
972
|
+
{ value: "table", icon: /* @__PURE__ */ e(V, {}) },
|
|
973
|
+
{ value: "raw", icon: /* @__PURE__ */ e(x, {}), disabled: !0 }
|
|
974
|
+
], [i, h] = u("overview"), [a, v] = u("grid"), [b, g] = u("chart");
|
|
975
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
976
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "Cas d'utilisation dans une interface complexe" }),
|
|
977
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
978
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2, height: "100%" }, children: [
|
|
979
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Dashboard" }),
|
|
820
980
|
/* @__PURE__ */ e(
|
|
821
|
-
|
|
981
|
+
p,
|
|
822
982
|
{
|
|
823
|
-
|
|
983
|
+
buttonList: o,
|
|
824
984
|
viewMode: i,
|
|
825
|
-
onChange: (
|
|
985
|
+
onChange: (d) => h(d),
|
|
826
986
|
colorVariant: "primary",
|
|
827
987
|
size: "small",
|
|
828
988
|
orientation: "vertical"
|
|
829
989
|
}
|
|
830
990
|
),
|
|
831
|
-
/* @__PURE__ */ t
|
|
991
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
832
992
|
"Mode: ",
|
|
833
993
|
i
|
|
834
994
|
] })
|
|
835
995
|
] }) }),
|
|
836
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */ e(
|
|
996
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2, height: "100%" }, children: [
|
|
997
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Explorateur de fichiers" }),
|
|
838
998
|
/* @__PURE__ */ e(
|
|
839
|
-
|
|
999
|
+
p,
|
|
840
1000
|
{
|
|
841
|
-
|
|
1001
|
+
buttonList: r,
|
|
842
1002
|
viewMode: a,
|
|
843
|
-
onChange: (
|
|
1003
|
+
onChange: (d) => v(d),
|
|
844
1004
|
colorVariant: "secondary",
|
|
845
1005
|
size: "medium"
|
|
846
1006
|
}
|
|
847
1007
|
),
|
|
848
|
-
/* @__PURE__ */ t
|
|
1008
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
849
1009
|
"Affichage: ",
|
|
850
1010
|
a
|
|
851
1011
|
] })
|
|
852
1012
|
] }) }),
|
|
853
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */ e(
|
|
1013
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 4 }, children: /* @__PURE__ */ n(s, { sx: { p: 2, height: "100%" }, children: [
|
|
1014
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Visualisation de données" }),
|
|
855
1015
|
/* @__PURE__ */ e(
|
|
856
|
-
|
|
1016
|
+
p,
|
|
857
1017
|
{
|
|
858
|
-
|
|
859
|
-
viewMode:
|
|
860
|
-
onChange: (
|
|
1018
|
+
buttonList: c,
|
|
1019
|
+
viewMode: b,
|
|
1020
|
+
onChange: (d) => g(d),
|
|
861
1021
|
colorVariant: "primary",
|
|
862
1022
|
size: "large"
|
|
863
1023
|
}
|
|
864
1024
|
),
|
|
865
|
-
/* @__PURE__ */ t
|
|
1025
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 2 }, children: [
|
|
866
1026
|
"Format: ",
|
|
867
|
-
|
|
1027
|
+
b
|
|
868
1028
|
] }),
|
|
869
|
-
/* @__PURE__ */ e(
|
|
1029
|
+
/* @__PURE__ */ e(t, { variant: "caption", color: "text.secondary", children: '(Le mode "raw" est temporairement désactivé)' })
|
|
870
1030
|
] }) })
|
|
871
1031
|
] }),
|
|
872
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ n(
|
|
873
1033
|
s,
|
|
874
1034
|
{
|
|
875
1035
|
sx: {
|
|
@@ -879,20 +1039,20 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
879
1039
|
color: "info.contrastText"
|
|
880
1040
|
},
|
|
881
1041
|
children: [
|
|
882
|
-
/* @__PURE__ */ e(
|
|
883
|
-
/* @__PURE__ */ t
|
|
1042
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "📊 Résumé des sélections (tous typés !)" }),
|
|
1043
|
+
/* @__PURE__ */ n(t, { variant: "body2", children: [
|
|
884
1044
|
"Dashboard: ",
|
|
885
1045
|
/* @__PURE__ */ e("strong", { children: i }),
|
|
886
1046
|
" | Fichiers:",
|
|
887
1047
|
" ",
|
|
888
1048
|
/* @__PURE__ */ e("strong", { children: a }),
|
|
889
1049
|
" | Données: ",
|
|
890
|
-
/* @__PURE__ */ e("strong", { children:
|
|
1050
|
+
/* @__PURE__ */ e("strong", { children: b })
|
|
891
1051
|
] })
|
|
892
1052
|
]
|
|
893
1053
|
}
|
|
894
1054
|
),
|
|
895
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ n(
|
|
896
1056
|
s,
|
|
897
1057
|
{
|
|
898
1058
|
sx: {
|
|
@@ -902,8 +1062,8 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
902
1062
|
color: "warning.contrastText"
|
|
903
1063
|
},
|
|
904
1064
|
children: [
|
|
905
|
-
/* @__PURE__ */ e(
|
|
906
|
-
/* @__PURE__ */ t
|
|
1065
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "🔍 Inspection des types" }),
|
|
1066
|
+
/* @__PURE__ */ n(t, { variant: "body2", component: "div", children: [
|
|
907
1067
|
/* @__PURE__ */ e("code", { children: "DashboardType:" }),
|
|
908
1068
|
" ",
|
|
909
1069
|
'"overview" | "detailed" | "analytics"',
|
|
@@ -916,7 +1076,7 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
916
1076
|
" ",
|
|
917
1077
|
'"chart" | "table" | "raw"'
|
|
918
1078
|
] }),
|
|
919
|
-
/* @__PURE__ */ e(
|
|
1079
|
+
/* @__PURE__ */ e(t, { variant: "caption", sx: { mt: 1, display: "block" }, children: "Chaque callback reçoit exactement le bon type, aucune configuration supplémentaire requise !" })
|
|
920
1080
|
]
|
|
921
1081
|
}
|
|
922
1082
|
)
|
|
@@ -927,40 +1087,40 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
927
1087
|
actions: { disable: !0 },
|
|
928
1088
|
docs: {
|
|
929
1089
|
description: {
|
|
930
|
-
story: "Exemple d'utilisation complexe montrant comment le
|
|
1090
|
+
story: "Exemple d'utilisation complexe montrant comment le ButtonGroup peut être utilisé dans différents contextes au sein d'une même interface, avec différentes configurations (tailles, couleurs, orientations) selon le besoin. Chaque instance a son propre type inféré automatiquement."
|
|
931
1091
|
}
|
|
932
1092
|
}
|
|
933
1093
|
}
|
|
934
|
-
},
|
|
1094
|
+
}, ee = {
|
|
935
1095
|
render: () => {
|
|
936
1096
|
const o = {
|
|
937
1097
|
CARDS: "cards",
|
|
938
1098
|
TABLE: "table",
|
|
939
1099
|
LIST: "list"
|
|
940
|
-
}, r = (C, L,
|
|
1100
|
+
}, r = (C, L, q = !1) => ({ value: C, icon: L, disabled: q }), c = [
|
|
941
1101
|
r(o.CARDS, /* @__PURE__ */ e(B, {})),
|
|
942
|
-
r(o.TABLE, /* @__PURE__ */ e(
|
|
943
|
-
r(o.LIST, /* @__PURE__ */ e(
|
|
1102
|
+
r(o.TABLE, /* @__PURE__ */ e(V, {})),
|
|
1103
|
+
r(o.LIST, /* @__PURE__ */ e(x, {}))
|
|
944
1104
|
], i = [
|
|
945
|
-
r("dashboard", /* @__PURE__ */ e(
|
|
1105
|
+
r("dashboard", /* @__PURE__ */ e(z, {})),
|
|
946
1106
|
r("users", /* @__PURE__ */ e(T, {})),
|
|
947
|
-
r("settings", /* @__PURE__ */ e(
|
|
948
|
-
r("logs", /* @__PURE__ */ e(
|
|
1107
|
+
r("settings", /* @__PURE__ */ e(M, {})),
|
|
1108
|
+
r("logs", /* @__PURE__ */ e(x, {}), !0)
|
|
949
1109
|
// désactivé
|
|
950
1110
|
], [h, a] = u(
|
|
951
1111
|
o.CARDS
|
|
952
|
-
), [v,
|
|
1112
|
+
), [v, b] = u("dashboard"), g = w((C) => {
|
|
953
1113
|
console.log("Vue commune changée:", C), a(C);
|
|
954
|
-
}, []),
|
|
955
|
-
console.log("Vue admin changée:", C),
|
|
1114
|
+
}, []), d = w((C) => {
|
|
1115
|
+
console.log("Vue admin changée:", C), b(C);
|
|
956
1116
|
}, []);
|
|
957
|
-
return /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */ e(
|
|
959
|
-
/* @__PURE__ */
|
|
960
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
961
|
-
/* @__PURE__ */ e(
|
|
1117
|
+
return /* @__PURE__ */ n(m, { sx: { p: 2 }, children: [
|
|
1118
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "🚀 Bonnes pratiques pour le typage" }),
|
|
1119
|
+
/* @__PURE__ */ n(l, { container: !0, spacing: 3, children: [
|
|
1120
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
1121
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Configuration standard" }),
|
|
962
1122
|
/* @__PURE__ */ e(
|
|
963
|
-
|
|
1123
|
+
t,
|
|
964
1124
|
{
|
|
965
1125
|
variant: "caption",
|
|
966
1126
|
color: "text.secondary",
|
|
@@ -970,23 +1130,23 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
970
1130
|
}
|
|
971
1131
|
),
|
|
972
1132
|
/* @__PURE__ */ e(
|
|
973
|
-
|
|
1133
|
+
p,
|
|
974
1134
|
{
|
|
975
|
-
|
|
1135
|
+
buttonList: c,
|
|
976
1136
|
viewMode: h,
|
|
977
|
-
onChange:
|
|
1137
|
+
onChange: g,
|
|
978
1138
|
size: "medium"
|
|
979
1139
|
}
|
|
980
1140
|
),
|
|
981
|
-
/* @__PURE__ */ t
|
|
1141
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
982
1142
|
"Sélection: ",
|
|
983
1143
|
h
|
|
984
1144
|
] })
|
|
985
1145
|
] }) }),
|
|
986
|
-
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */
|
|
987
|
-
/* @__PURE__ */ e(
|
|
1146
|
+
/* @__PURE__ */ e(l, { size: { xs: 12, md: 6 }, children: /* @__PURE__ */ n(s, { sx: { p: 2 }, children: [
|
|
1147
|
+
/* @__PURE__ */ e(t, { variant: "subtitle1", gutterBottom: !0, children: "Configuration avancée" }),
|
|
988
1148
|
/* @__PURE__ */ e(
|
|
989
|
-
|
|
1149
|
+
t,
|
|
990
1150
|
{
|
|
991
1151
|
variant: "caption",
|
|
992
1152
|
color: "text.secondary",
|
|
@@ -996,25 +1156,25 @@ const createViewButton = <T extends string>(value: T, icon: ReactNode) =>
|
|
|
996
1156
|
}
|
|
997
1157
|
),
|
|
998
1158
|
/* @__PURE__ */ e(
|
|
999
|
-
|
|
1159
|
+
p,
|
|
1000
1160
|
{
|
|
1001
|
-
|
|
1161
|
+
buttonList: i,
|
|
1002
1162
|
viewMode: v,
|
|
1003
|
-
onChange:
|
|
1163
|
+
onChange: d,
|
|
1004
1164
|
colorVariant: "secondary",
|
|
1005
1165
|
size: "medium"
|
|
1006
1166
|
}
|
|
1007
1167
|
),
|
|
1008
|
-
/* @__PURE__ */ t
|
|
1168
|
+
/* @__PURE__ */ n(t, { variant: "body2", sx: { mt: 1 }, children: [
|
|
1009
1169
|
"Admin: ",
|
|
1010
1170
|
v
|
|
1011
1171
|
] })
|
|
1012
1172
|
] }) })
|
|
1013
1173
|
] }),
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
/* @__PURE__ */ e(
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */ e(
|
|
1174
|
+
/* @__PURE__ */ n(s, { sx: { p: 3, mt: 3, backgroundColor: "success.light" }, children: [
|
|
1175
|
+
/* @__PURE__ */ e(t, { variant: "h6", gutterBottom: !0, children: "📚 Code examples - Bonnes pratiques" }),
|
|
1176
|
+
/* @__PURE__ */ n(m, { sx: { mb: 2 }, children: [
|
|
1177
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "1. ✅ Utilisation de constantes réutilisables" }),
|
|
1018
1178
|
/* @__PURE__ */ e(s, { sx: { p: 2, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
|
|
1019
1179
|
"pre",
|
|
1020
1180
|
{
|
|
@@ -1031,8 +1191,8 @@ const buttons = [
|
|
|
1031
1191
|
}
|
|
1032
1192
|
) })
|
|
1033
1193
|
] }),
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */ e(
|
|
1194
|
+
/* @__PURE__ */ n(m, { sx: { mb: 2 }, children: [
|
|
1195
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "2. ✅ Factory functions pour la réutilisabilité" }),
|
|
1036
1196
|
/* @__PURE__ */ e(s, { sx: { p: 2, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
|
|
1037
1197
|
"pre",
|
|
1038
1198
|
{
|
|
@@ -1050,8 +1210,8 @@ const buttons = [
|
|
|
1050
1210
|
}
|
|
1051
1211
|
) })
|
|
1052
1212
|
] }),
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */ e(
|
|
1213
|
+
/* @__PURE__ */ n(m, { sx: { mb: 2 }, children: [
|
|
1214
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "3. ✅ Types helper pour éviter la répétition" }),
|
|
1055
1215
|
/* @__PURE__ */ e(s, { sx: { p: 2, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
|
|
1056
1216
|
"pre",
|
|
1057
1217
|
{
|
|
@@ -1067,14 +1227,14 @@ const handleChange = useCallback((value: ViewType) => {
|
|
|
1067
1227
|
}
|
|
1068
1228
|
) })
|
|
1069
1229
|
] }),
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */ e(
|
|
1230
|
+
/* @__PURE__ */ n(m, { children: [
|
|
1231
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "4. ✅ Handler avec typage explicite" }),
|
|
1072
1232
|
/* @__PURE__ */ e(s, { sx: { p: 2, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
|
|
1073
1233
|
"pre",
|
|
1074
1234
|
{
|
|
1075
1235
|
style: { margin: 0, fontSize: "0.875rem", overflow: "auto" },
|
|
1076
|
-
children: `<
|
|
1077
|
-
|
|
1236
|
+
children: `<ButtonGroup
|
|
1237
|
+
buttonList={buttons}
|
|
1078
1238
|
viewMode={view}
|
|
1079
1239
|
onChange={handleChange} // ← Pas de type 'any' !
|
|
1080
1240
|
/>`
|
|
@@ -1082,7 +1242,7 @@ const handleChange = useCallback((value: ViewType) => {
|
|
|
1082
1242
|
) })
|
|
1083
1243
|
] })
|
|
1084
1244
|
] }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1245
|
+
/* @__PURE__ */ n(
|
|
1086
1246
|
s,
|
|
1087
1247
|
{
|
|
1088
1248
|
sx: {
|
|
@@ -1092,8 +1252,8 @@ const handleChange = useCallback((value: ViewType) => {
|
|
|
1092
1252
|
color: "error.contrastText"
|
|
1093
1253
|
},
|
|
1094
1254
|
children: [
|
|
1095
|
-
/* @__PURE__ */ e(
|
|
1096
|
-
/* @__PURE__ */ t
|
|
1255
|
+
/* @__PURE__ */ e(t, { variant: "subtitle2", gutterBottom: !0, children: "❌ À éviter" }),
|
|
1256
|
+
/* @__PURE__ */ n(t, { variant: "body2", component: "div", children: [
|
|
1097
1257
|
"• Oublier ",
|
|
1098
1258
|
/* @__PURE__ */ e("code", { children: "as const" }),
|
|
1099
1259
|
" après les tableaux",
|
|
@@ -1114,22 +1274,23 @@ const handleChange = useCallback((value: ViewType) => {
|
|
|
1114
1274
|
actions: { disable: !0 },
|
|
1115
1275
|
docs: {
|
|
1116
1276
|
description: {
|
|
1117
|
-
story: "Cette story présente les meilleures pratiques pour utiliser le
|
|
1277
|
+
story: "Cette story présente les meilleures pratiques pour utiliser le ButtonGroup avec un typage TypeScript optimal. Elle montre comment structurer votre code pour éviter les types 'any' et maximiser la sécurité de type."
|
|
1118
1278
|
}
|
|
1119
1279
|
}
|
|
1120
1280
|
}
|
|
1121
1281
|
};
|
|
1122
1282
|
export {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
j as
|
|
1128
|
-
|
|
1283
|
+
Q as AvecBoutonsDesactives,
|
|
1284
|
+
K as AvecTexteOptionnel,
|
|
1285
|
+
ee as BonnesPratiques,
|
|
1286
|
+
Z as CasUtilisationComplexe,
|
|
1287
|
+
j as Controlable,
|
|
1288
|
+
W as Default,
|
|
1289
|
+
X as OptionsEtendues,
|
|
1129
1290
|
J as OrientationVerticale,
|
|
1130
|
-
|
|
1291
|
+
Y as Synchronisation,
|
|
1131
1292
|
$ as TaillesDifferentes,
|
|
1132
|
-
|
|
1293
|
+
N as TypageGenerique,
|
|
1133
1294
|
_ as VariantesDecouleurs,
|
|
1134
|
-
|
|
1295
|
+
F as default
|
|
1135
1296
|
};
|