@cgi-learning-hub/ui 1.5.0-dev.1743516190 → 1.5.0-dev.1743522751

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@mui/material"),o="50px",r=t.styled(t.Box,{shouldForwardProp:e=>e!=="maxHeight"})(({maxHeight:e})=>({maxHeight:typeof e=="number"?`${e}px`:e,overflowY:"auto"})),n={margin:"6px 0"},a={display:"flex",alignItems:"center",width:"100%"},i={display:"flex",marginLeft:"auto"},l={borderLeft:"1px solid #bdbdbd",paddingLeft:"12px",marginLeft:"11px",marginTop:"8px",marginBottom:"8px"},p={width:"24px",height:"24px"};exports.DEFAULT_CHILDREN_INDENT=o;exports.TreeContainer=r;exports.arrowContainerStyle=i;exports.expandedGroupStyle=l;exports.iconStyle=p;exports.treeContentStyle=a;exports.treeItemRootStyle=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@mui/material"),o="50px",r=t.styled(t.Box,{shouldForwardProp:e=>e!=="maxHeight"})(({maxHeight:e})=>({maxHeight:typeof e=="number"?`${e}px`:e,overflowY:"auto"})),n={display:"flex",flexDirection:"column"},i={display:"flex",alignItems:"center",width:"100%",margin:"4px 0",padding:"8px"},l={display:"flex",marginLeft:"auto"},a={borderLeft:"1px solid var(--theme-palette-divider)",paddingLeft:"15px",marginLeft:"18px"},d={width:"24px",height:"24px"};exports.DEFAULT_CHILDREN_INDENT=o;exports.TreeContainer=r;exports.arrowContainerStyle=l;exports.expandedGroupStyle=a;exports.iconStyle=d;exports.treeContentStyle=i;exports.treeItemRootStyle=n;
@@ -1,32 +1,35 @@
1
- import { styled as e, Box as o } from "@mui/material";
2
- const r = "50px", p = e(o, {
3
- shouldForwardProp: (t) => t !== "maxHeight"
4
- })(({ maxHeight: t }) => ({
5
- maxHeight: typeof t == "number" ? `${t}px` : t,
1
+ import { styled as t, Box as o } from "@mui/material";
2
+ const r = "50px", i = t(o, {
3
+ shouldForwardProp: (e) => e !== "maxHeight"
4
+ })(({ maxHeight: e }) => ({
5
+ maxHeight: typeof e == "number" ? `${e}px` : e,
6
6
  overflowY: "auto"
7
- })), i = { margin: "6px 0" }, a = {
7
+ })), p = {
8
+ display: "flex",
9
+ flexDirection: "column"
10
+ }, l = {
8
11
  display: "flex",
9
12
  alignItems: "center",
10
- width: "100%"
11
- }, d = {
13
+ width: "100%",
14
+ margin: "4px 0",
15
+ padding: "8px"
16
+ }, a = {
12
17
  display: "flex",
13
18
  marginLeft: "auto"
19
+ }, d = {
20
+ borderLeft: "1px solid var(--theme-palette-divider)",
21
+ paddingLeft: "15px",
22
+ marginLeft: "18px"
14
23
  }, x = {
15
- borderLeft: "1px solid #bdbdbd",
16
- paddingLeft: "12px",
17
- marginLeft: "11px",
18
- marginTop: "8px",
19
- marginBottom: "8px"
20
- }, l = {
21
24
  width: "24px",
22
25
  height: "24px"
23
26
  };
24
27
  export {
25
28
  r as DEFAULT_CHILDREN_INDENT,
26
- p as TreeContainer,
27
- d as arrowContainerStyle,
28
- x as expandedGroupStyle,
29
- l as iconStyle,
30
- a as treeContentStyle,
31
- i as treeItemRootStyle
29
+ i as TreeContainer,
30
+ a as arrowContainerStyle,
31
+ d as expandedGroupStyle,
32
+ x as iconStyle,
33
+ l as treeContentStyle,
34
+ p as treeItemRootStyle
32
35
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),w=require("../../createSvgIcon-DjTQ6UHI.cjs"),V=require("../../IconButton-Czd8uNt8.cjs"),L=require("../../Tooltip-arPEgWU6.cjs"),m=require("react"),p=require("../TreeView/TreeView.cjs.js"),o=require("../TreeView/types.cjs.js"),l=require("../../Box-ge7hyt34.cjs"),a=require("../../Typography-Daq_a9_t.cjs"),x=require("../../ListItemText-Yjh9Zoqh.cjs"),g=require("../../Paper-CRHSfFG5.cjs"),v=require("../../Button-BkHaHEAp.cjs"),O=require("../../Divider-D3QqAaaL.cjs"),Y=require("../../List-CBdWJkIa.cjs"),N=require("../../ListItem-B2M8rFxh.cjs"),P=w.createSvgIcon(e.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),R=w.createSvgIcon(e.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),q=w.createSvgIcon(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),_=w.createSvgIcon(e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),F={title:"Components/TreeView",component:p,argTypes:{items:{description:"**[Requis]** Liste des éléments à afficher dans le TreeView.",control:"object",table:{required:!0,type:{summary:"CustomTreeViewItem[]"}}},selectedItemId:{description:"**[Requis]** Identifiant de l'élément sélectionné.",control:"text",table:{required:!0,type:{summary:"string"}}},handleSelectedItemChange:{description:"**[Requis]** Fonction appelée lorsqu'un élément est sélectionné.",table:{required:!0,type:{summary:"(event: React.SyntheticEvent, itemIds: string | null) => void"}}},iconColor:{description:"**[Optionnel]** Couleur des icônes.",control:"select",options:["primary","secondary","success","error","info","warning"],defaultValue:"primary",table:{required:!1,type:{summary:"string"},defaultValue:{summary:"primary"}}},maxHeight:{description:"**[Optionnel]** Hauteur du TreeView avec gestion automatique du défilement.",control:"number",table:{required:!1,type:{summary:"number | string"},defaultValue:{summary:"auto"}}}},parameters:{docs:{description:{component:`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),O=require("../../createSvgIcon-DjTQ6UHI.cjs"),N=require("../../IconButton-Czd8uNt8.cjs"),B=require("../../Tooltip-arPEgWU6.cjs"),u=require("react"),h=require("../TreeView/TreeView.cjs.js"),t=require("../TreeView/types.cjs.js"),l=require("../../Box-ge7hyt34.cjs"),a=require("../../Typography-Daq_a9_t.cjs"),m=require("../../ListItemText-Yjh9Zoqh.cjs"),I=require("../../Paper-CRHSfFG5.cjs"),g=require("../../Button-BkHaHEAp.cjs"),P=require("../../Divider-D3QqAaaL.cjs"),L=require("../../List-CBdWJkIa.cjs"),_=require("../../ListItem-B2M8rFxh.cjs"),R=O.createSvgIcon(e.jsx("path",{d:"M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"}),"Bookmark"),D=O.createSvgIcon(e.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),V=O.createSvgIcon(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),q=O.createSvgIcon(e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),F={title:"Components/TreeView",component:h,argTypes:{items:{description:"**[Requis]** Liste des éléments à afficher dans le TreeView.",control:"object",table:{required:!0,type:{summary:"CustomTreeViewItem[]"}}},selectedItemId:{description:"**[Requis]** Identifiant de l'élément sélectionné.",control:"text",table:{required:!0,type:{summary:"string"}}},handleSelectedItemChange:{description:"**[Requis]** Fonction appelée lorsqu'un élément est sélectionné.",table:{required:!0,type:{summary:"(event: React.SyntheticEvent, itemIds: string | null) => void"}}},iconColor:{description:"**[Optionnel]** Couleur des icônes.",control:"select",options:["primary","secondary","success","error","info","warning"],defaultValue:"primary",table:{required:!1,type:{summary:"string"},defaultValue:{summary:"primary"}}},maxHeight:{description:"**[Optionnel]** Hauteur du TreeView avec gestion automatique du défilement.",control:"number",table:{required:!1,type:{summary:"number | string"},defaultValue:{summary:"auto"}}}},parameters:{docs:{description:{component:`
2
2
  ## TreeView
3
3
 
4
4
  Un composant pour afficher des données hiérarchiques sous forme d'arborescence.
@@ -47,7 +47,7 @@ interface CustomTreeViewItemProps {
47
47
 
48
48
  type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
49
49
  \`\`\`
50
- `}}}},D=s=>{const r=[],i=n=>{r.push(n),n.children&&n.children.forEach(t=>i(t))};return s.forEach(n=>i(n)),r},H=({items:s,selectedItemId:r,onItemSelect:i})=>{const n=D(s);return e.jsxs(g.Paper,{sx:{width:"100%",maxHeight:300,overflow:"auto"},children:[e.jsx(a.Typography,{variant:"h6",sx:{p:2},children:"Sélection externe"}),e.jsx(O.Divider,{}),e.jsx(Y.List,{children:n.map(t=>e.jsx(N.ListItem,{disablePadding:!0,children:e.jsx(x.ListItemButton,{selected:r===t.internalId,onClick:()=>i(t.internalId),children:e.jsx(x.ListItemText,{primary:t.label})})},t.internalId))})]})},k=({items:s,onRandomSelect:r})=>{const i=D(s),n=()=>{const t=Math.floor(Math.random()*i.length);r(i[t].internalId)};return e.jsx(l.Box,{sx:{mt:2,mb:2},children:e.jsx(v.Button,{variant:"contained",color:"primary",onClick:n,children:"Sélection aléatoire"})})},A=({id:s,label:r})=>e.jsx(l.Box,{draggable:!0,onDragStart:i=>{i.dataTransfer.setData("application/json",JSON.stringify({id:s,label:r}))},sx:{padding:1,margin:1,backgroundColor:"grey.100",borderRadius:1,display:"inline-block",cursor:"grab","&:hover":{backgroundColor:"grey.200"}},children:e.jsxs(a.Typography,{variant:"body2",display:"flex",alignItems:"center",children:[e.jsx(R,{fontSize:"small",sx:{mr:1}}),r]})}),j=[{internalId:"documents",label:"Mes formulaires",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"folder1",label:"Premier dossier",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"subfolder1",label:"Sous-dossier 1",iconType:o.ICON_TYPE.FOLDER},{internalId:"subfolder2",label:"Sous-dossier 2",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"folder2",label:"Deuxième dossier",iconType:o.ICON_TYPE.FOLDER},{internalId:"folder3",label:"Troisième dossier",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"shared",label:"Formulaires partagés avec moi",iconType:o.ICON_TYPE.SHARE},{internalId:"trash",label:"Corbeille",iconType:o.ICON_TYPE.TRASH}],B=[{internalId:"bookmarks",label:"Favoris",iconType:P,children:[{internalId:"important",label:"Important",iconType:o.ICON_TYPE.CUSTOM,customIcon:_}]},...j],S=[{internalId:"documents",label:"Documents",iconType:o.ICON_TYPE.SHARE,children:[{internalId:"reports",label:"Rapports",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"report1",label:"Rapport Janvier",iconType:o.ICON_TYPE.FOLDER},{internalId:"report2",label:"Rapport Février",iconType:o.ICON_TYPE.FOLDER},{internalId:"report3",label:"Rapport Mars",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"invoices",label:"Factures",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"media",label:"Médias",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"images",label:"Images",iconType:o.ICON_TYPE.FOLDER},{internalId:"videos",label:"Vidéos",iconType:o.ICON_TYPE.FOLDER}]},{internalId:"downloads",label:"Téléchargements",iconType:o.ICON_TYPE.FOLDER}],$={render:()=>{const[s,r]=m.useState(""),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:j,selectedItemId:s,handleSelectedItemChange:i})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple de base avec des icônes standard et démonstration de sélection."}}}},z={args:{items:j,selectedItemId:"folder1",handleSelectedItemChange:(s,r)=>{console.log(`Élément sélectionné: ${r}`)},iconColor:"success"},render:s=>e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{...s})}),parameters:{docs:{description:{story:"Cette story permet de contrôler les propriétés du TreeView directement via le panneau de contrôle de Storybook. Essayez de changer la couleur des icônes pour voir l'effet en temps réel."}}}},M={render:()=>{const[s,r]=m.useState("bookmarks"),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:B,selectedItemId:s,handleSelectedItemChange:i})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."}}}},G={render:()=>{const[s,r]=m.useState("item1"),i=m.useCallback((n,t)=>{console.log(`Élément sélectionné: ${t}`),t&&r(t)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(p,{items:B,selectedItemId:s,handleSelectedItemChange:i,hasNoIcons:!0})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'arborescence sans icônes, utilisant la prop hasNoIcons."}}}},U={render:()=>{const s=[{internalId:"root",label:"Structure imbriquée complexe",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level1-1",label:"Niveau 1.1",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level2-1",label:"Niveau 2.1",iconType:o.ICON_TYPE.FOLDER,children:[{internalId:"level3-1V",label:"VOUS M'AVEZ TROUVÉ HIHIHI",iconType:o.ICON_TYPE.FOLDER},{internalId:"level3-2",label:"Niveau 3.2",iconType:o.ICON_TYPE.SHARE}]},{internalId:"level2-2",label:"Niveau 2.2",iconType:o.ICON_TYPE.TRASH}]},{internalId:"level1-2",label:"Niveau 1.2",iconType:o.ICON_TYPE.CUSTOM,customIcon:P}]}],[r,i]=m.useState("level2-1"),n=m.useCallback((t,d)=>{console.log(`Élément sélectionné: ${d}`),d&&i(d)},[]);return e.jsx(l.Box,{sx:{maxWidth:400,overflowY:"hidden"},children:e.jsx(p,{items:s,selectedItemId:r,handleSelectedItemChange:n})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'une structure profondément imbriquée."}}}},W={render:()=>{const s=["primary","secondary","info"],[r,i]=m.useState({primary:"",secondary:"",info:""});return e.jsx(l.Box,{sx:{display:"flex",flexDirection:"row",gap:3,overflowY:"hidden"},children:s.map(n=>e.jsxs(l.Box,{sx:{maxWidth:250,overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:["Icônes ",n]}),e.jsx(p,{items:j,selectedItemId:r[n],handleSelectedItemChange:(t,d)=>{d&&i(u=>({...u,[n]:d}))},iconColor:n})]},n))})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration des principales options de couleurs disponibles pour les icônes."}}}},J={render:()=>{const s=()=>{var u,T;const d=[];for(let h=1;h<=5;h++){const y={internalId:`main-folder-${h}`,label:`Dossier principal ${h}`,iconType:o.ICON_TYPE.FOLDER,children:[]};for(let c=1;c<=10;c++){const I={internalId:`subfolder-${h}-${c}`,label:`Sous-dossier ${h}.${c}`,iconType:o.ICON_TYPE.FOLDER,children:[]};for(let b=1;b<=5;b++)(u=I.children)==null||u.push({internalId:`item-${h}-${c}-${b}`,label:`Élément ${h}.${c}.${b}`,iconType:o.ICON_TYPE.CUSTOM,customIcon:R});(T=y.children)==null||T.push(I)}d.push(y)}return d},[r,i]=m.useState(""),n=s(),t=m.useCallback((d,u)=>{u&&i(u)},[]);return e.jsxs(l.Box,{children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView avec hauteur limitée et défilement vertical"}),e.jsxs(x.Grid,{container:!0,spacing:3,children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 300px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:300}),e.jsx(l.Box,{sx:{p:2,bgcolor:"primary.light",color:"primary.contrastText",borderTop:"1px solid #e0e0e0"},children:e.jsx(a.Typography,{variant:"body2",children:"Cet élément reste collé sous le TreeView, même avec défilement"})})]})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 500px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:500}),e.jsxs(l.Box,{sx:{display:"flex",justifyContent:"space-between",p:1.5,bgcolor:"background.default",borderTop:"1px solid #e0e0e0"},children:[e.jsx(v.Button,{size:"small",variant:"outlined",children:"Annuler"}),e.jsx(v.Button,{size:"small",variant:"contained",children:"Confirmer"})]})]})]})})]}),e.jsx(l.Box,{mt:4,children:e.jsxs(g.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"TreeView expansé manuellement"}),e.jsxs(l.Box,{sx:{display:"flex",mb:2},children:[e.jsx(v.Button,{variant:"outlined",onClick:()=>i("subfolder-1-1"),sx:{mr:1},children:"Sélectionner Sous-dossier 1.1"}),e.jsx(v.Button,{variant:"outlined",onClick:()=>i("item-3-5-2"),children:"Sélectionner Élément 3.5.2"})]}),e.jsxs(l.Box,{sx:{borderRadius:1,border:"1px solid #e0e0e0"},children:[e.jsx(p,{items:n,selectedItemId:r,handleSelectedItemChange:t,maxHeight:400}),e.jsx(O.Divider,{}),e.jsxs(l.Box,{sx:{p:2,display:"flex",alignItems:"center"},children:[e.jsx(a.Typography,{variant:"body2",sx:{flexGrow:1},children:r?`Élément sélectionné: ${r}`:"Aucun élément sélectionné"}),e.jsx(L.Tooltip,{title:"Ce bandeau reste fixé sous l'arborescence",children:e.jsx(V.IconButton,{size:"small",color:"info",children:e.jsx(q,{fontSize:"small"})})})]})]})]})})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre l'utilisation de la prop `maxHeight` pour contrôler la hauteur maximale du TreeView. Elle permet de vérifier le comportement du défilement (overflow) lorsque le contenu dépasse la hauteur définie. Des éléments sont placés en dessous de chaque TreeView pour montrer que ceux-ci restent bien collés, tandis que seul le contenu de l'arborescence défile."}}}},Z={render:()=>{const[s,r]=m.useState("reports"),i=(d,u)=>{console.log("TreeView sélection:",u),u&&r(u)},n=d=>{console.log("Sélection externe:",d),r(d)},t=()=>{const u=D(S).find(T=>T.internalId===s);return u?u.label:"Aucun élément sélectionné"};return e.jsxs(l.Box,{sx:{width:"100%",overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:["Élément sélectionné: ",e.jsx("strong",{children:t()})," (ID:"," ",s,")"]}),e.jsx(k,{items:S,onRandomSelect:n}),e.jsxs(x.Grid,{container:!0,spacing:3,sx:{overflowY:"hidden"},children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView"}),e.jsx(p,{items:S,selectedItemId:s,handleSelectedItemChange:i})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsx(H,{items:S,selectedItemId:s,onItemSelect:n})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration de la synchronisation entre le TreeView et d'autres composants. Cette story montre comment le TreeView peut être intégré dans une interface complexe où la sélection peut provenir de différentes sources mais reste synchronisée."}}}},Q={render:()=>{var h,y;const[s,r]=m.useState([...j]),[i,n]=m.useState("folder1"),[t,d]=m.useState(null),u=[{id:"doc1",label:"Document 1"},{id:"doc2",label:"Document 2"},{id:"doc3",label:"Document 3"}],T=c=>{c.preventDefault();const I=c.target,b=I.closest("[data-treeview-item]");let f=null,E=null;b?(f=b.getAttribute("data-treeview-item"),E=b.getAttribute("data-treeview-item-label")):I.closest("[data-treeview-root]")&&(f=null,E="Racine du TreeView");try{const C=JSON.parse(c.dataTransfer.getData("application/json"));d({itemId:f,itemLabel:E,droppedItem:C}),f&&n(f)}catch(C){console.error("Erreur lors de la récupération des données",C)}};return e.jsxs(l.Box,{sx:{maxWidth:700,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"Exemple de Drag & Drop avec le TreeView"}),e.jsx(a.Typography,{variant:"body2",gutterBottom:!0,children:"Glissez-déposez un des documents ci-dessous sur un élément du TreeView."}),e.jsx(l.Box,{sx:{display:"flex",mb:2},children:u.map(c=>e.jsx(A,{id:c.id,label:c.label},c.id))}),e.jsxs(x.Grid,{container:!0,spacing:3,children:[e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(l.Box,{sx:{p:2,border:"1px dashed gray",borderRadius:1,minHeight:300,overflowY:"hidden",backgroundColor:"background.paper"},onDragOver:c=>c.preventDefault(),onDrop:T,children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Zone de drop"}),e.jsx(p,{items:s,selectedItemId:i,handleSelectedItemChange:(c,I)=>{I&&n(I)}})]})}),e.jsx(x.Grid,{item:!0,xs:12,md:6,children:e.jsxs(g.Paper,{sx:{p:2,minHeight:300},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Informations du dernier drop"}),t?e.jsxs(l.Box,{children:[e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément cible :"})," ",t.itemLabel," ",t.itemId&&`(ID: ${t.itemId})`]}),e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément déposé :"})," ",(h=t.droppedItem)==null?void 0:h.label," (ID:"," ",(y=t.droppedItem)==null?void 0:y.id,")"]}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(a.Typography,{variant:"body2",children:e.jsx("strong",{children:"Code pour gérer ce drop :"})}),e.jsx(g.Paper,{sx:{p:1,mt:1,backgroundColor:"grey.100"},children:e.jsx("pre",{style:{margin:0,fontSize:"0.8rem",whiteSpace:"pre-wrap"},children:`// Dans votre gestionnaire d'événements
50
+ `}}}},w=i=>{const n=[],o=s=>{n.push(s),s.children&&s.children.forEach(r=>o(r))};return i.forEach(s=>o(s)),n},k=({items:i,selectedItemId:n,onItemSelect:o})=>{const s=w(i);return e.jsxs(I.Paper,{sx:{width:"100%",maxHeight:300,overflow:"auto"},children:[e.jsx(a.Typography,{variant:"h6",sx:{p:2},children:"Sélection externe"}),e.jsx(P.Divider,{}),e.jsx(L.List,{children:s.map(r=>e.jsx(_.ListItem,{disablePadding:!0,children:e.jsx(m.ListItemButton,{selected:n===r.internalId,onClick:()=>o(r.internalId),children:e.jsx(m.ListItemText,{primary:r.label})})},r.internalId))})]})},H=({items:i,onRandomSelect:n})=>{const o=w(i),s=()=>{const r=Math.floor(Math.random()*o.length);n(o[r].internalId)};return e.jsx(l.Box,{sx:{mt:2,mb:2},children:e.jsx(g.Button,{variant:"contained",color:"primary",onClick:s,children:"Sélection aléatoire"})})},A=({id:i,label:n})=>e.jsx(l.Box,{draggable:!0,onDragStart:o=>{o.dataTransfer.setData("application/json",JSON.stringify({id:i,label:n}))},sx:{padding:1,margin:1,backgroundColor:"grey.100",borderRadius:1,display:"inline-block",cursor:"grab","&:hover":{backgroundColor:"grey.200"}},children:e.jsxs(a.Typography,{variant:"body2",display:"flex",alignItems:"center",children:[e.jsx(D,{fontSize:"small",sx:{mr:1}}),n]})}),j=[{internalId:"documents",label:"Mes formulaires",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder1",label:"Premier dossier",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"subfolder1",label:"Sous-dossier 1",iconType:t.ICON_TYPE.FOLDER},{internalId:"subfolder2",label:"Sous-dossier 2",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"folder2",label:"Deuxième dossier",iconType:t.ICON_TYPE.FOLDER},{internalId:"folder3",label:"Troisième dossier",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"shared",label:"Formulaires partagés avec moi",iconType:t.ICON_TYPE.SHARE},{internalId:"trash",label:"Corbeille",iconType:t.ICON_TYPE.TRASH}],Y=[{internalId:"bookmarks",label:"Favoris",iconType:R,children:[{internalId:"important",label:"Important",iconType:t.ICON_TYPE.CUSTOM,customIcon:q}]},...j],S=[{internalId:"documents",label:"Documents",iconType:t.ICON_TYPE.SHARE,children:[{internalId:"reports",label:"Rapports",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"report1",label:"Rapport Janvier",iconType:t.ICON_TYPE.FOLDER},{internalId:"report2",label:"Rapport Février",iconType:t.ICON_TYPE.FOLDER},{internalId:"report3",label:"Rapport Mars",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"invoices",label:"Factures",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"media",label:"Médias",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"images",label:"Images",iconType:t.ICON_TYPE.FOLDER},{internalId:"videos",label:"Vidéos",iconType:t.ICON_TYPE.FOLDER}]},{internalId:"downloads",label:"Téléchargements",iconType:t.ICON_TYPE.FOLDER}],M={render:()=>{const[i,n]=u.useState(""),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:j,selectedItemId:i,handleSelectedItemChange:o})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple de base avec des icônes standard et démonstration de sélection."}}}},z={args:{items:j,selectedItemId:"folder1",handleSelectedItemChange:(i,n)=>{console.log(`Élément sélectionné: ${n}`)},iconColor:"success"},render:i=>e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{...i})}),parameters:{docs:{description:{story:"Cette story permet de contrôler les propriétés du TreeView directement via le panneau de contrôle de Storybook. Essayez de changer la couleur des icônes pour voir l'effet en temps réel."}}}},$={render:()=>{const[i,n]=u.useState("bookmarks"),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:Y,selectedItemId:i,handleSelectedItemChange:o})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple utilisant à la fois des icônes prédéfinies et des icônes personnalisées."}}}},G={render:()=>{const[i,n]=u.useState("item1"),o=u.useCallback((s,r)=>{console.log(`Élément sélectionné: ${r}`),r&&n(r)},[]);return e.jsx(l.Box,{sx:{maxWidth:300,overflowY:"hidden"},children:e.jsx(h,{items:Y,selectedItemId:i,handleSelectedItemChange:o,hasNoIcons:!0})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'arborescence sans icônes, utilisant la prop hasNoIcons."}}}},U={render:()=>{const i=[{internalId:"root",label:"Structure imbriquée complexe",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level1-1",label:"Niveau 1.1",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level2-1",label:"Niveau 2.1",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"level3-1V",label:"VOUS M'AVEZ TROUVÉ HIHIHI",iconType:t.ICON_TYPE.FOLDER},{internalId:"level3-2",label:"Niveau 3.2",iconType:t.ICON_TYPE.SHARE}]},{internalId:"level2-2",label:"Niveau 2.2",iconType:t.ICON_TYPE.TRASH}]},{internalId:"level1-2",label:"Niveau 1.2",iconType:t.ICON_TYPE.CUSTOM,customIcon:R}]}],[n,o]=u.useState("level2-1"),s=u.useCallback((r,d)=>{console.log(`Élément sélectionné: ${d}`),d&&o(d)},[]);return e.jsx(l.Box,{sx:{maxWidth:400,overflowY:"hidden"},children:e.jsx(h,{items:i,selectedItemId:n,handleSelectedItemChange:s})})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Exemple d'une structure profondément imbriquée."}}}},W={render:()=>{const i=["primary","secondary","info"],[n,o]=u.useState({primary:"",secondary:"",info:""});return e.jsx(l.Box,{sx:{display:"flex",flexDirection:"row",gap:3,overflowY:"hidden"},children:i.map(s=>e.jsxs(l.Box,{sx:{maxWidth:250,overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:["Icônes ",s]}),e.jsx(h,{items:j,selectedItemId:n[s],handleSelectedItemChange:(r,d)=>{d&&o(p=>({...p,[s]:d}))},iconColor:s})]},s))})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration des principales options de couleurs disponibles pour les icônes."}}}},J={render:()=>{const i=()=>{var p,y;const d=[];for(let x=1;x<=5;x++){const f={internalId:`main-folder-${x}`,label:`Dossier principal ${x}`,iconType:t.ICON_TYPE.FOLDER,children:[]};for(let c=1;c<=10;c++){const T={internalId:`subfolder-${x}-${c}`,label:`Sous-dossier ${x}.${c}`,iconType:t.ICON_TYPE.FOLDER,children:[]};for(let b=1;b<=5;b++)(p=T.children)==null||p.push({internalId:`item-${x}-${c}-${b}`,label:`Élément ${x}.${c}.${b}`,iconType:t.ICON_TYPE.CUSTOM,customIcon:D});(y=f.children)==null||y.push(T)}d.push(f)}return d},[n,o]=u.useState(""),s=i(),r=u.useCallback((d,p)=>{p&&o(p)},[]);return e.jsxs(l.Box,{children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView avec hauteur limitée et défilement vertical"}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 300px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:300}),e.jsx(l.Box,{sx:{p:2,bgcolor:"primary.light",color:"primary.contrastText",borderTop:"1px solid #e0e0e0"},children:e.jsx(a.Typography,{variant:"body2",children:"Cet élément reste collé sous le TreeView, même avec défilement"})})]})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"Hauteur maximale de 500px avec overflow"}),e.jsxs(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:500}),e.jsxs(l.Box,{sx:{display:"flex",justifyContent:"space-between",p:1.5,bgcolor:"background.default",borderTop:"1px solid #e0e0e0"},children:[e.jsx(g.Button,{size:"small",variant:"outlined",children:"Annuler"}),e.jsx(g.Button,{size:"small",variant:"contained",children:"Confirmer"})]})]})]})})]}),e.jsx(l.Box,{mt:4,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle2",gutterBottom:!0,children:"TreeView expansé manuellement"}),e.jsxs(l.Box,{sx:{display:"flex",mb:2},children:[e.jsx(g.Button,{variant:"outlined",onClick:()=>o("subfolder-1-1"),sx:{mr:1},children:"Sélectionner Sous-dossier 1.1"}),e.jsx(g.Button,{variant:"outlined",onClick:()=>o("item-3-5-2"),children:"Sélectionner Élément 3.5.2"})]}),e.jsxs(l.Box,{sx:{borderRadius:1,border:"1px solid #e0e0e0"},children:[e.jsx(h,{items:s,selectedItemId:n,handleSelectedItemChange:r,maxHeight:400}),e.jsx(P.Divider,{}),e.jsxs(l.Box,{sx:{p:2,display:"flex",alignItems:"center"},children:[e.jsx(a.Typography,{variant:"body2",sx:{flexGrow:1},children:n?`Élément sélectionné: ${n}`:"Aucun élément sélectionné"}),e.jsx(B.Tooltip,{title:"Ce bandeau reste fixé sous l'arborescence",children:e.jsx(N.IconButton,{size:"small",color:"info",children:e.jsx(V,{fontSize:"small"})})})]})]})]})})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre l'utilisation de la prop `maxHeight` pour contrôler la hauteur maximale du TreeView. Elle permet de vérifier le comportement du défilement (overflow) lorsque le contenu dépasse la hauteur définie. Des éléments sont placés en dessous de chaque TreeView pour montrer que ceux-ci restent bien collés, tandis que seul le contenu de l'arborescence défile."}}}},X={render:()=>{const[i,n]=u.useState("reports"),o=(d,p)=>{console.log("TreeView sélection:",p),p&&n(p)},s=d=>{console.log("Sélection externe:",d),n(d)},r=()=>{const p=w(S).find(y=>y.internalId===i);return p?p.label:"Aucun élément sélectionné"};return e.jsxs(l.Box,{sx:{width:"100%",overflowY:"hidden"},children:[e.jsxs(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:["Élément sélectionné: ",e.jsx("strong",{children:r()})," (ID:"," ",i,")"]}),e.jsx(H,{items:S,onRandomSelect:s}),e.jsxs(m.Grid,{container:!0,spacing:3,sx:{overflowY:"hidden"},children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"TreeView"}),e.jsx(h,{items:S,selectedItemId:i,handleSelectedItemChange:o})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsx(k,{items:S,selectedItemId:i,onItemSelect:s})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Démonstration de la synchronisation entre le TreeView et d'autres composants. Cette story montre comment le TreeView peut être intégré dans une interface complexe où la sélection peut provenir de différentes sources mais reste synchronisée."}}}},Z={render:()=>{var x,f;const[i,n]=u.useState([...j]),[o,s]=u.useState("folder1"),[r,d]=u.useState(null),p=[{id:"doc1",label:"Document 1"},{id:"doc2",label:"Document 2"},{id:"doc3",label:"Document 3"}],y=c=>{c.preventDefault();const T=c.target,b=T.closest("[data-treeview-item]");let v=null,E=null;b?(v=b.getAttribute("data-treeview-item"),E=b.getAttribute("data-treeview-item-label")):T.closest("[data-treeview-root]")&&(v=null,E="Racine du TreeView");try{const C=JSON.parse(c.dataTransfer.getData("application/json"));d({itemId:v,itemLabel:E,droppedItem:C}),v&&s(v)}catch(C){console.error("Erreur lors de la récupération des données",C)}};return e.jsxs(l.Box,{sx:{maxWidth:700,overflowY:"hidden"},children:[e.jsx(a.Typography,{variant:"h6",gutterBottom:!0,children:"Exemple de Drag & Drop avec le TreeView"}),e.jsx(a.Typography,{variant:"body2",gutterBottom:!0,children:"Glissez-déposez un des documents ci-dessous sur un élément du TreeView."}),e.jsx(l.Box,{sx:{display:"flex",mb:2},children:p.map(c=>e.jsx(A,{id:c.id,label:c.label},c.id))}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(l.Box,{sx:{p:2,border:"1px dashed gray",borderRadius:1,minHeight:300,overflowY:"hidden",backgroundColor:"background.paper"},onDragOver:c=>c.preventDefault(),onDrop:y,children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Zone de drop"}),e.jsx(h,{items:i,selectedItemId:o,handleSelectedItemChange:(c,T)=>{T&&s(T)}})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2,minHeight:300},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Informations du dernier drop"}),r?e.jsxs(l.Box,{children:[e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément cible :"})," ",r.itemLabel," ",r.itemId&&`(ID: ${r.itemId})`]}),e.jsxs(a.Typography,{variant:"body2",children:[e.jsx("strong",{children:"Élément déposé :"})," ",(x=r.droppedItem)==null?void 0:x.label," (ID:"," ",(f=r.droppedItem)==null?void 0:f.id,")"]}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(a.Typography,{variant:"body2",children:e.jsx("strong",{children:"Code pour gérer ce drop :"})}),e.jsx(I.Paper,{sx:{p:1,mt:1,backgroundColor:"grey.100"},children:e.jsx("pre",{style:{margin:0,fontSize:"0.8rem",whiteSpace:"pre-wrap"},children:`// Dans votre gestionnaire d'événements
51
51
  const handleDrop = (e) => {
52
52
  e.preventDefault();
53
53
 
@@ -66,4 +66,4 @@ const handleDrop = (e) => {
66
66
 
67
67
  // Votre logique pour traiter le drop...
68
68
  }
69
- };`})})]})]}):e.jsx(a.Typography,{variant:"body2",children:"Aucun élément déposé pour le moment. Glissez un document sur le TreeView pour voir les informations ici."})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre comment utiliser les attributs `data-` du TreeView pour implémenter une fonctionnalité de drag and drop. Glissez un document sur un élément du TreeView pour voir comment accéder aux informations de l'élément cible."}}}};exports.AvecDragAndDrop=Q;exports.AvecIconesPersonnalisees=M;exports.Controlable=z;exports.Default=$;exports.GrandeHauteurLimitee=J;exports.OptionsDeCouleurs=W;exports.SansIcones=G;exports.StructureImbriquee=U;exports.Synchronicite=Z;exports.default=F;
69
+ };`})})]})]}):e.jsx(a.Typography,{variant:"body2",children:"Aucun élément déposé pour le moment. Glissez un document sur le TreeView pour voir les informations ici."})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story démontre comment utiliser les attributs `data-` du TreeView pour implémenter une fonctionnalité de drag and drop. Glissez un document sur un élément du TreeView pour voir comment accéder aux informations de l'élément cible."}}}},Q={render:()=>{const i=[{internalId:"root-1",label:"Dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-1-1",label:"Sous-dossier avec un nom très long pour tester",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-1-1",label:"Document A",iconType:t.ICON_TYPE.CUSTOM,customIcon:D},{internalId:"folder-1-1-2",label:"Sous-sous-dossier",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-1-2-1",label:"Image.jpg",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-1-1-2-2",label:"Document.pdf",iconType:t.ICON_TYPE.CUSTOM,children:[{internalId:"file-1-1-2-7",label:"Image.jpg",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-1-1-2-18",label:"Document.pdf",iconType:t.ICON_TYPE.CUSTOM}]}]}]},{internalId:"folder-1-2",label:"Court",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-1-2-1",label:"Fichier",iconType:t.ICON_TYPE.CUSTOM}]}]},{internalId:"root-2",label:"Second dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-2-1",label:"Sous-dossier A",iconType:t.ICON_TYPE.FOLDER},{internalId:"folder-2-2",label:"Sous-dossier B",iconType:t.ICON_TYPE.FOLDER,children:[]}]},{internalId:"root-3",label:"Troisième dossier principal",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"folder-3-1",label:"Sous-dossier X",iconType:t.ICON_TYPE.FOLDER,children:[{internalId:"file-3-1-1",label:"Fichier X-1",iconType:t.ICON_TYPE.CUSTOM},{internalId:"file-3-1-2",label:"Fichier X-2",iconType:t.ICON_TYPE.CUSTOM}]}]}],[n,o]=u.useState(""),s=u.useCallback((r,d)=>{d&&o(d)},[]);return e.jsxs(l.Box,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"h5",gutterBottom:!0,children:"Test d'alignement des lignes verticales"}),e.jsx(a.Typography,{variant:"body2",color:"text.secondary",paragraph:!0,children:"Cette story permet de vérifier si les lignes verticales s'arrêtent toutes au même niveau, indépendamment de la taille des éléments. Essayez d'expandre et de collapser les différents niveaux."}),e.jsxs(m.Grid,{container:!0,spacing:3,children:[e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"TreeView avec plusieurs niveaux imbriqués"}),e.jsx(l.Box,{sx:{border:"1px solid #e0e0e0",borderRadius:1},children:e.jsx(h,{items:i,selectedItemId:n,handleSelectedItemChange:s,maxHeight:400})})]})}),e.jsx(m.Grid,{item:!0,xs:12,md:6,children:e.jsxs(I.Paper,{sx:{p:2},children:[e.jsx(a.Typography,{variant:"subtitle1",gutterBottom:!0,children:"Détails de l'élément sélectionné"}),e.jsx(l.Box,{sx:{p:2,backgroundColor:"#f5f5f5",borderRadius:1,minHeight:100},children:n?e.jsxs(a.Typography,{children:["Élément sélectionné: ",e.jsx("strong",{children:n})]}):e.jsx(a.Typography,{color:"text.secondary",children:"Aucun élément sélectionné. Cliquez sur un élément dans l'arborescence."})}),e.jsxs(l.Box,{sx:{mt:2},children:[e.jsx(g.Button,{variant:"outlined",onClick:()=>o("file-1-1-2-1"),sx:{mr:1},children:'Sélectionner "Image.jpg"'}),e.jsx(g.Button,{variant:"outlined",onClick:()=>o("folder-3-1"),children:'Sélectionner "Sous-dossier X"'})]})]})})]})]})},parameters:{controls:{disable:!0},actions:{disable:!0},docs:{description:{story:"Cette story permet de tester si les lignes verticales du TreeView s'alignent correctement. Elle utilise une arborescence à plusieurs niveaux avec des éléments de différentes tailles et labels de différentes longueurs pour mettre en évidence le comportement des lignes. Vérifiez que toutes les lignes verticales s'arrêtent au même niveau, créant ainsi une structure d'arborescence propre et cohérente."}}}};exports.AvecDragAndDrop=Z;exports.AvecIconesPersonnalisees=$;exports.Controlable=z;exports.Default=M;exports.GrandeHauteurLimitee=J;exports.OptionsDeCouleurs=W;exports.SansIcones=G;exports.StructureImbriquee=U;exports.Synchronicite=X;exports.TestAlignementLignes=Q;exports.default=F;
@@ -12,3 +12,4 @@ export declare const OptionsDeCouleurs: Story;
12
12
  export declare const GrandeHauteurLimitee: Story;
13
13
  export declare const Synchronicite: Story;
14
14
  export declare const AvecDragAndDrop: Story;
15
+ export declare const TestAlignementLignes: Story;
@@ -1,25 +1,25 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { c as V } from "../../createSvgIcon-Dk3n_NBz.js";
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { c as O } from "../../createSvgIcon-Dk3n_NBz.js";
3
3
  import { I as k } from "../../IconButton-BfOmPY_b.js";
4
4
  import { T as B } from "../../Tooltip-UBiscQPm.js";
5
- import { useState as I, useCallback as S } from "react";
5
+ import { useState as b, useCallback as x } from "react";
6
6
  import p from "../TreeView/TreeView.es.js";
7
- import { ICON_TYPE as o } from "../TreeView/types.es.js";
7
+ import { ICON_TYPE as t } from "../TreeView/types.es.js";
8
8
  import { B as a } from "../../Box--MaxIKbn.js";
9
9
  import { T as d } from "../../Typography-BJPk_mTw.js";
10
- import { G as b, L as $, a as z } from "../../ListItemText-BeWOS4WA.js";
11
- import { P as v } from "../../Paper-D9hEGUDL.js";
12
- import { B as w } from "../../Button-kOBqHwsO.js";
13
- import { D as O } from "../../Divider-Bw612Jal.js";
14
- import { L as A } from "../../List-CV_4VCwT.js";
15
- import { L as P } from "../../ListItem--Hj6zz4n.js";
16
- const F = V(/* @__PURE__ */ e("path", {
10
+ import { G as h, L as A, a as M } from "../../ListItemText-BeWOS4WA.js";
11
+ import { P as f } from "../../Paper-D9hEGUDL.js";
12
+ import { B as y } from "../../Button-kOBqHwsO.js";
13
+ import { D as F } from "../../Divider-Bw612Jal.js";
14
+ import { L as z } from "../../List-CV_4VCwT.js";
15
+ import { L as $ } from "../../ListItem--Hj6zz4n.js";
16
+ const q = O(/* @__PURE__ */ e("path", {
17
17
  d: "M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2"
18
- }), "Bookmark"), H = V(/* @__PURE__ */ e("path", {
18
+ }), "Bookmark"), L = O(/* @__PURE__ */ e("path", {
19
19
  d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"
20
- }), "Description"), Y = V(/* @__PURE__ */ e("path", {
20
+ }), "Description"), U = O(/* @__PURE__ */ e("path", {
21
21
  d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"
22
- }), "Info"), M = V(/* @__PURE__ */ e("path", {
22
+ }), "Info"), P = O(/* @__PURE__ */ e("path", {
23
23
  d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"
24
24
  }), "Person"), se = {
25
25
  title: "Components/TreeView",
@@ -127,48 +127,48 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
127
127
  }
128
128
  }
129
129
  }
130
- }, L = (n) => {
131
- const r = [], l = (i) => {
132
- r.push(i), i.children && i.children.forEach(
133
- (t) => l(t)
130
+ }, V = (l) => {
131
+ const r = [], o = (s) => {
132
+ r.push(s), s.children && s.children.forEach(
133
+ (n) => o(n)
134
134
  );
135
135
  };
136
- return n.forEach((i) => l(i)), r;
137
- }, N = ({
138
- items: n,
136
+ return l.forEach((s) => o(s)), r;
137
+ }, Y = ({
138
+ items: l,
139
139
  selectedItemId: r,
140
- onItemSelect: l
140
+ onItemSelect: o
141
141
  }) => {
142
- const i = L(n);
143
- return /* @__PURE__ */ s(v, { sx: { width: "100%", maxHeight: 300, overflow: "auto" }, children: [
142
+ const s = V(l);
143
+ return /* @__PURE__ */ i(f, { sx: { width: "100%", maxHeight: 300, overflow: "auto" }, children: [
144
144
  /* @__PURE__ */ e(d, { variant: "h6", sx: { p: 2 }, children: "Sélection externe" }),
145
- /* @__PURE__ */ e(O, {}),
146
- /* @__PURE__ */ e(A, { children: i.map((t) => /* @__PURE__ */ e(P, { disablePadding: !0, children: /* @__PURE__ */ e(
147
- $,
145
+ /* @__PURE__ */ e(F, {}),
146
+ /* @__PURE__ */ e(z, { children: s.map((n) => /* @__PURE__ */ e($, { disablePadding: !0, children: /* @__PURE__ */ e(
147
+ A,
148
148
  {
149
- selected: r === t.internalId,
150
- onClick: () => l(t.internalId),
151
- children: /* @__PURE__ */ e(z, { primary: t.label })
149
+ selected: r === n.internalId,
150
+ onClick: () => o(n.internalId),
151
+ children: /* @__PURE__ */ e(M, { primary: n.label })
152
152
  }
153
- ) }, t.internalId)) })
153
+ ) }, n.internalId)) })
154
154
  ] });
155
- }, j = ({
156
- items: n,
155
+ }, N = ({
156
+ items: l,
157
157
  onRandomSelect: r
158
158
  }) => {
159
- const l = L(n);
160
- return /* @__PURE__ */ e(a, { sx: { mt: 2, mb: 2 }, children: /* @__PURE__ */ e(w, { variant: "contained", color: "primary", onClick: () => {
161
- const t = Math.floor(Math.random() * l.length);
162
- r(l[t].internalId);
159
+ const o = V(l);
160
+ return /* @__PURE__ */ e(a, { sx: { mt: 2, mb: 2 }, children: /* @__PURE__ */ e(y, { variant: "contained", color: "primary", onClick: () => {
161
+ const n = Math.floor(Math.random() * o.length);
162
+ r(o[n].internalId);
163
163
  }, children: "Sélection aléatoire" }) });
164
- }, U = ({ id: n, label: r }) => /* @__PURE__ */ e(
164
+ }, j = ({ id: l, label: r }) => /* @__PURE__ */ e(
165
165
  a,
166
166
  {
167
167
  draggable: !0,
168
- onDragStart: (l) => {
169
- l.dataTransfer.setData(
168
+ onDragStart: (o) => {
169
+ o.dataTransfer.setData(
170
170
  "application/json",
171
- JSON.stringify({ id: n, label: r })
171
+ JSON.stringify({ id: l, label: r })
172
172
  );
173
173
  },
174
174
  sx: {
@@ -182,130 +182,130 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
182
182
  backgroundColor: "grey.200"
183
183
  }
184
184
  },
185
- children: /* @__PURE__ */ s(d, { variant: "body2", display: "flex", alignItems: "center", children: [
186
- /* @__PURE__ */ e(H, { fontSize: "small", sx: { mr: 1 } }),
185
+ children: /* @__PURE__ */ i(d, { variant: "body2", display: "flex", alignItems: "center", children: [
186
+ /* @__PURE__ */ e(L, { fontSize: "small", sx: { mr: 1 } }),
187
187
  r
188
188
  ] })
189
189
  }
190
- ), D = [
190
+ ), w = [
191
191
  {
192
192
  internalId: "documents",
193
193
  label: "Mes formulaires",
194
- iconType: o.FOLDER,
194
+ iconType: t.FOLDER,
195
195
  children: [
196
196
  {
197
197
  internalId: "folder1",
198
198
  label: "Premier dossier",
199
- iconType: o.FOLDER,
199
+ iconType: t.FOLDER,
200
200
  children: [
201
201
  {
202
202
  internalId: "subfolder1",
203
203
  label: "Sous-dossier 1",
204
- iconType: o.FOLDER
204
+ iconType: t.FOLDER
205
205
  },
206
206
  {
207
207
  internalId: "subfolder2",
208
208
  label: "Sous-dossier 2",
209
- iconType: o.FOLDER
209
+ iconType: t.FOLDER
210
210
  }
211
211
  ]
212
212
  },
213
213
  {
214
214
  internalId: "folder2",
215
215
  label: "Deuxième dossier",
216
- iconType: o.FOLDER
216
+ iconType: t.FOLDER
217
217
  },
218
218
  {
219
219
  internalId: "folder3",
220
220
  label: "Troisième dossier",
221
- iconType: o.FOLDER
221
+ iconType: t.FOLDER
222
222
  }
223
223
  ]
224
224
  },
225
225
  {
226
226
  internalId: "shared",
227
227
  label: "Formulaires partagés avec moi",
228
- iconType: o.SHARE
228
+ iconType: t.SHARE
229
229
  },
230
230
  {
231
231
  internalId: "trash",
232
232
  label: "Corbeille",
233
- iconType: o.TRASH
233
+ iconType: t.TRASH
234
234
  }
235
- ], q = [
235
+ ], H = [
236
236
  {
237
237
  internalId: "bookmarks",
238
238
  label: "Favoris",
239
- iconType: F,
239
+ iconType: q,
240
240
  children: [
241
241
  {
242
242
  internalId: "important",
243
243
  label: "Important",
244
- iconType: o.CUSTOM,
245
- customIcon: M
244
+ iconType: t.CUSTOM,
245
+ customIcon: P
246
246
  }
247
247
  ]
248
248
  },
249
- ...D
249
+ ...w
250
250
  ], R = [
251
251
  {
252
252
  internalId: "documents",
253
253
  label: "Documents",
254
- iconType: o.SHARE,
254
+ iconType: t.SHARE,
255
255
  children: [
256
256
  {
257
257
  internalId: "reports",
258
258
  label: "Rapports",
259
- iconType: o.FOLDER,
259
+ iconType: t.FOLDER,
260
260
  children: [
261
261
  {
262
262
  internalId: "report1",
263
263
  label: "Rapport Janvier",
264
- iconType: o.FOLDER
264
+ iconType: t.FOLDER
265
265
  },
266
266
  {
267
267
  internalId: "report2",
268
268
  label: "Rapport Février",
269
- iconType: o.FOLDER
269
+ iconType: t.FOLDER
270
270
  },
271
271
  {
272
272
  internalId: "report3",
273
273
  label: "Rapport Mars",
274
- iconType: o.FOLDER
274
+ iconType: t.FOLDER
275
275
  }
276
276
  ]
277
277
  },
278
- { internalId: "invoices", label: "Factures", iconType: o.FOLDER }
278
+ { internalId: "invoices", label: "Factures", iconType: t.FOLDER }
279
279
  ]
280
280
  },
281
281
  {
282
282
  internalId: "media",
283
283
  label: "Médias",
284
- iconType: o.FOLDER,
284
+ iconType: t.FOLDER,
285
285
  children: [
286
- { internalId: "images", label: "Images", iconType: o.FOLDER },
287
- { internalId: "videos", label: "Vidéos", iconType: o.FOLDER }
286
+ { internalId: "images", label: "Images", iconType: t.FOLDER },
287
+ { internalId: "videos", label: "Vidéos", iconType: t.FOLDER }
288
288
  ]
289
289
  },
290
290
  {
291
291
  internalId: "downloads",
292
292
  label: "Téléchargements",
293
- iconType: o.FOLDER
293
+ iconType: t.FOLDER
294
294
  }
295
295
  ], ae = {
296
296
  render: () => {
297
- const [n, r] = I(""), l = S(
298
- (i, t) => {
299
- console.log(`Élément sélectionné: ${t}`), t && r(t);
297
+ const [l, r] = b(""), o = x(
298
+ (s, n) => {
299
+ console.log(`Élément sélectionné: ${n}`), n && r(n);
300
300
  },
301
301
  []
302
302
  );
303
303
  return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
304
304
  p,
305
305
  {
306
- items: D,
307
- selectedItemId: n,
308
- handleSelectedItemChange: l
306
+ items: w,
307
+ selectedItemId: l,
308
+ handleSelectedItemChange: o
309
309
  }
310
310
  ) });
311
311
  },
@@ -320,14 +320,14 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
320
320
  }
321
321
  }, de = {
322
322
  args: {
323
- items: D,
323
+ items: w,
324
324
  selectedItemId: "folder1",
325
- handleSelectedItemChange: (n, r) => {
325
+ handleSelectedItemChange: (l, r) => {
326
326
  console.log(`Élément sélectionné: ${r}`);
327
327
  },
328
328
  iconColor: "success"
329
329
  },
330
- render: (n) => /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(p, { ...n }) }),
330
+ render: (l) => /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(p, { ...l }) }),
331
331
  parameters: {
332
332
  docs: {
333
333
  description: {
@@ -337,18 +337,18 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
337
337
  }
338
338
  }, ce = {
339
339
  render: () => {
340
- const [n, r] = I("bookmarks"), l = S(
341
- (i, t) => {
342
- console.log(`Élément sélectionné: ${t}`), t && r(t);
340
+ const [l, r] = b("bookmarks"), o = x(
341
+ (s, n) => {
342
+ console.log(`Élément sélectionné: ${n}`), n && r(n);
343
343
  },
344
344
  []
345
345
  );
346
346
  return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
347
347
  p,
348
348
  {
349
- items: q,
350
- selectedItemId: n,
351
- handleSelectedItemChange: l
349
+ items: H,
350
+ selectedItemId: l,
351
+ handleSelectedItemChange: o
352
352
  }
353
353
  ) });
354
354
  },
@@ -363,18 +363,18 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
363
363
  }
364
364
  }, me = {
365
365
  render: () => {
366
- const [n, r] = I("item1"), l = S(
367
- (i, t) => {
368
- console.log(`Élément sélectionné: ${t}`), t && r(t);
366
+ const [l, r] = b("item1"), o = x(
367
+ (s, n) => {
368
+ console.log(`Élément sélectionné: ${n}`), n && r(n);
369
369
  },
370
370
  []
371
371
  );
372
372
  return /* @__PURE__ */ e(a, { sx: { maxWidth: 300, overflowY: "hidden" }, children: /* @__PURE__ */ e(
373
373
  p,
374
374
  {
375
- items: q,
376
- selectedItemId: n,
377
- handleSelectedItemChange: l,
375
+ items: H,
376
+ selectedItemId: l,
377
+ handleSelectedItemChange: o,
378
378
  hasNoIcons: !0
379
379
  }
380
380
  ) });
@@ -390,61 +390,61 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
390
390
  }
391
391
  }, ue = {
392
392
  render: () => {
393
- const n = [
393
+ const l = [
394
394
  {
395
395
  internalId: "root",
396
396
  label: "Structure imbriquée complexe",
397
- iconType: o.FOLDER,
397
+ iconType: t.FOLDER,
398
398
  children: [
399
399
  {
400
400
  internalId: "level1-1",
401
401
  label: "Niveau 1.1",
402
- iconType: o.FOLDER,
402
+ iconType: t.FOLDER,
403
403
  children: [
404
404
  {
405
405
  internalId: "level2-1",
406
406
  label: "Niveau 2.1",
407
- iconType: o.FOLDER,
407
+ iconType: t.FOLDER,
408
408
  children: [
409
409
  {
410
410
  internalId: "level3-1V",
411
411
  label: "VOUS M'AVEZ TROUVÉ HIHIHI",
412
- iconType: o.FOLDER
412
+ iconType: t.FOLDER
413
413
  },
414
414
  {
415
415
  internalId: "level3-2",
416
416
  label: "Niveau 3.2",
417
- iconType: o.SHARE
417
+ iconType: t.SHARE
418
418
  }
419
419
  ]
420
420
  },
421
421
  {
422
422
  internalId: "level2-2",
423
423
  label: "Niveau 2.2",
424
- iconType: o.TRASH
424
+ iconType: t.TRASH
425
425
  }
426
426
  ]
427
427
  },
428
428
  {
429
429
  internalId: "level1-2",
430
430
  label: "Niveau 1.2",
431
- iconType: o.CUSTOM,
432
- customIcon: F
431
+ iconType: t.CUSTOM,
432
+ customIcon: q
433
433
  }
434
434
  ]
435
435
  }
436
- ], [r, l] = I("level2-1"), i = S(
437
- (t, c) => {
438
- console.log(`Élément sélectionné: ${c}`), c && l(c);
436
+ ], [r, o] = b("level2-1"), s = x(
437
+ (n, c) => {
438
+ console.log(`Élément sélectionné: ${c}`), c && o(c);
439
439
  },
440
440
  []
441
441
  );
442
442
  return /* @__PURE__ */ e(a, { sx: { maxWidth: 400, overflowY: "hidden" }, children: /* @__PURE__ */ e(
443
443
  p,
444
444
  {
445
- items: n,
445
+ items: l,
446
446
  selectedItemId: r,
447
- handleSelectedItemChange: i
447
+ handleSelectedItemChange: s
448
448
  }
449
449
  ) });
450
450
  },
@@ -459,7 +459,7 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
459
459
  }
460
460
  }, pe = {
461
461
  render: () => {
462
- const n = ["primary", "secondary", "info"], [r, l] = I({
462
+ const l = ["primary", "secondary", "info"], [r, o] = b({
463
463
  primary: "",
464
464
  secondary: "",
465
465
  info: ""
@@ -473,7 +473,7 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
473
473
  gap: 3,
474
474
  overflowY: "hidden"
475
475
  },
476
- children: n.map((i) => /* @__PURE__ */ s(
476
+ children: l.map((s) => /* @__PURE__ */ i(
477
477
  a,
478
478
  {
479
479
  sx: {
@@ -481,24 +481,24 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
481
481
  overflowY: "hidden"
482
482
  },
483
483
  children: [
484
- /* @__PURE__ */ s(d, { variant: "subtitle2", gutterBottom: !0, children: [
484
+ /* @__PURE__ */ i(d, { variant: "subtitle2", gutterBottom: !0, children: [
485
485
  "Icônes ",
486
- i
486
+ s
487
487
  ] }),
488
488
  /* @__PURE__ */ e(
489
489
  p,
490
490
  {
491
- items: D,
492
- selectedItemId: r[i],
493
- handleSelectedItemChange: (t, c) => {
494
- c && l((u) => ({ ...u, [i]: c }));
491
+ items: w,
492
+ selectedItemId: r[s],
493
+ handleSelectedItemChange: (n, c) => {
494
+ c && o((u) => ({ ...u, [s]: c }));
495
495
  },
496
- iconColor: i
496
+ iconColor: s
497
497
  }
498
498
  )
499
499
  ]
500
500
  },
501
- i
501
+ s
502
502
  ))
503
503
  }
504
504
  );
@@ -514,53 +514,53 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
514
514
  }
515
515
  }, he = {
516
516
  render: () => {
517
- const n = () => {
518
- var u, y;
517
+ const l = () => {
518
+ var u, T;
519
519
  const c = [];
520
- for (let h = 1; h <= 5; h++) {
521
- const x = {
522
- internalId: `main-folder-${h}`,
523
- label: `Dossier principal ${h}`,
524
- iconType: o.FOLDER,
520
+ for (let I = 1; I <= 5; I++) {
521
+ const S = {
522
+ internalId: `main-folder-${I}`,
523
+ label: `Dossier principal ${I}`,
524
+ iconType: t.FOLDER,
525
525
  children: []
526
526
  };
527
527
  for (let m = 1; m <= 10; m++) {
528
- const f = {
529
- internalId: `subfolder-${h}-${m}`,
530
- label: `Sous-dossier ${h}.${m}`,
531
- iconType: o.FOLDER,
528
+ const g = {
529
+ internalId: `subfolder-${I}-${m}`,
530
+ label: `Sous-dossier ${I}.${m}`,
531
+ iconType: t.FOLDER,
532
532
  children: []
533
533
  };
534
- for (let g = 1; g <= 5; g++)
535
- (u = f.children) == null || u.push({
536
- internalId: `item-${h}-${m}-${g}`,
537
- label: `Élément ${h}.${m}.${g}`,
538
- iconType: o.CUSTOM,
539
- customIcon: H
534
+ for (let v = 1; v <= 5; v++)
535
+ (u = g.children) == null || u.push({
536
+ internalId: `item-${I}-${m}-${v}`,
537
+ label: `Élément ${I}.${m}.${v}`,
538
+ iconType: t.CUSTOM,
539
+ customIcon: L
540
540
  });
541
- (y = x.children) == null || y.push(f);
541
+ (T = S.children) == null || T.push(g);
542
542
  }
543
- c.push(x);
543
+ c.push(S);
544
544
  }
545
545
  return c;
546
- }, [r, l] = I(""), i = n(), t = S(
546
+ }, [r, o] = b(""), s = l(), n = x(
547
547
  (c, u) => {
548
- u && l(u);
548
+ u && o(u);
549
549
  },
550
550
  []
551
551
  );
552
- return /* @__PURE__ */ s(a, { children: [
552
+ return /* @__PURE__ */ i(a, { children: [
553
553
  /* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "TreeView avec hauteur limitée et défilement vertical" }),
554
- /* @__PURE__ */ s(b, { container: !0, spacing: 3, children: [
555
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(v, { sx: { p: 2 }, children: [
554
+ /* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
555
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
556
556
  /* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "Hauteur maximale de 300px avec overflow" }),
557
- /* @__PURE__ */ s(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
557
+ /* @__PURE__ */ i(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
558
558
  /* @__PURE__ */ e(
559
559
  p,
560
560
  {
561
- items: i,
561
+ items: s,
562
562
  selectedItemId: r,
563
- handleSelectedItemChange: t,
563
+ handleSelectedItemChange: n,
564
564
  maxHeight: 300
565
565
  }
566
566
  ),
@@ -578,19 +578,19 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
578
578
  )
579
579
  ] })
580
580
  ] }) }),
581
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(v, { sx: { p: 2 }, children: [
581
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
582
582
  /* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "Hauteur maximale de 500px avec overflow" }),
583
- /* @__PURE__ */ s(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
583
+ /* @__PURE__ */ i(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: [
584
584
  /* @__PURE__ */ e(
585
585
  p,
586
586
  {
587
- items: i,
587
+ items: s,
588
588
  selectedItemId: r,
589
- handleSelectedItemChange: t,
589
+ handleSelectedItemChange: n,
590
590
  maxHeight: 500
591
591
  }
592
592
  ),
593
- /* @__PURE__ */ s(
593
+ /* @__PURE__ */ i(
594
594
  a,
595
595
  {
596
596
  sx: {
@@ -601,49 +601,49 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
601
601
  borderTop: "1px solid #e0e0e0"
602
602
  },
603
603
  children: [
604
- /* @__PURE__ */ e(w, { size: "small", variant: "outlined", children: "Annuler" }),
605
- /* @__PURE__ */ e(w, { size: "small", variant: "contained", children: "Confirmer" })
604
+ /* @__PURE__ */ e(y, { size: "small", variant: "outlined", children: "Annuler" }),
605
+ /* @__PURE__ */ e(y, { size: "small", variant: "contained", children: "Confirmer" })
606
606
  ]
607
607
  }
608
608
  )
609
609
  ] })
610
610
  ] }) })
611
611
  ] }),
612
- /* @__PURE__ */ e(a, { mt: 4, children: /* @__PURE__ */ s(v, { sx: { p: 2 }, children: [
612
+ /* @__PURE__ */ e(a, { mt: 4, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
613
613
  /* @__PURE__ */ e(d, { variant: "subtitle2", gutterBottom: !0, children: "TreeView expansé manuellement" }),
614
- /* @__PURE__ */ s(a, { sx: { display: "flex", mb: 2 }, children: [
614
+ /* @__PURE__ */ i(a, { sx: { display: "flex", mb: 2 }, children: [
615
615
  /* @__PURE__ */ e(
616
- w,
616
+ y,
617
617
  {
618
618
  variant: "outlined",
619
- onClick: () => l("subfolder-1-1"),
619
+ onClick: () => o("subfolder-1-1"),
620
620
  sx: { mr: 1 },
621
621
  children: "Sélectionner Sous-dossier 1.1"
622
622
  }
623
623
  ),
624
624
  /* @__PURE__ */ e(
625
- w,
625
+ y,
626
626
  {
627
627
  variant: "outlined",
628
- onClick: () => l("item-3-5-2"),
628
+ onClick: () => o("item-3-5-2"),
629
629
  children: "Sélectionner Élément 3.5.2"
630
630
  }
631
631
  )
632
632
  ] }),
633
- /* @__PURE__ */ s(a, { sx: { borderRadius: 1, border: "1px solid #e0e0e0" }, children: [
633
+ /* @__PURE__ */ i(a, { sx: { borderRadius: 1, border: "1px solid #e0e0e0" }, children: [
634
634
  /* @__PURE__ */ e(
635
635
  p,
636
636
  {
637
- items: i,
637
+ items: s,
638
638
  selectedItemId: r,
639
- handleSelectedItemChange: t,
639
+ handleSelectedItemChange: n,
640
640
  maxHeight: 400
641
641
  }
642
642
  ),
643
- /* @__PURE__ */ e(O, {}),
644
- /* @__PURE__ */ s(a, { sx: { p: 2, display: "flex", alignItems: "center" }, children: [
643
+ /* @__PURE__ */ e(F, {}),
644
+ /* @__PURE__ */ i(a, { sx: { p: 2, display: "flex", alignItems: "center" }, children: [
645
645
  /* @__PURE__ */ e(d, { variant: "body2", sx: { flexGrow: 1 }, children: r ? `Élément sélectionné: ${r}` : "Aucun élément sélectionné" }),
646
- /* @__PURE__ */ e(B, { title: "Ce bandeau reste fixé sous l'arborescence", children: /* @__PURE__ */ e(k, { size: "small", color: "info", children: /* @__PURE__ */ e(Y, { fontSize: "small" }) }) })
646
+ /* @__PURE__ */ e(B, { title: "Ce bandeau reste fixé sous l'arborescence", children: /* @__PURE__ */ e(k, { size: "small", color: "info", children: /* @__PURE__ */ e(U, { fontSize: "small" }) }) })
647
647
  ] })
648
648
  ] })
649
649
  ] }) })
@@ -660,50 +660,50 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
660
660
  }
661
661
  }, Ie = {
662
662
  render: () => {
663
- const [n, r] = I("reports"), l = (c, u) => {
663
+ const [l, r] = b("reports"), o = (c, u) => {
664
664
  console.log("TreeView sélection:", u), u && r(u);
665
- }, i = (c) => {
665
+ }, s = (c) => {
666
666
  console.log("Sélection externe:", c), r(c);
667
667
  };
668
- return /* @__PURE__ */ s(a, { sx: { width: "100%", overflowY: "hidden" }, children: [
669
- /* @__PURE__ */ s(d, { variant: "subtitle1", gutterBottom: !0, children: [
668
+ return /* @__PURE__ */ i(a, { sx: { width: "100%", overflowY: "hidden" }, children: [
669
+ /* @__PURE__ */ i(d, { variant: "subtitle1", gutterBottom: !0, children: [
670
670
  "Élément sélectionné: ",
671
671
  /* @__PURE__ */ e("strong", { children: (() => {
672
- const u = L(R).find(
673
- (y) => y.internalId === n
672
+ const u = V(R).find(
673
+ (T) => T.internalId === l
674
674
  );
675
675
  return u ? u.label : "Aucun élément sélectionné";
676
676
  })() }),
677
677
  " (ID:",
678
678
  " ",
679
- n,
679
+ l,
680
680
  ")"
681
681
  ] }),
682
682
  /* @__PURE__ */ e(
683
- j,
683
+ N,
684
684
  {
685
685
  items: R,
686
- onRandomSelect: i
686
+ onRandomSelect: s
687
687
  }
688
688
  ),
689
- /* @__PURE__ */ s(b, { container: !0, spacing: 3, sx: { overflowY: "hidden" }, children: [
690
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(v, { sx: { p: 2, overflowY: "hidden" }, children: [
689
+ /* @__PURE__ */ i(h, { container: !0, spacing: 3, sx: { overflowY: "hidden" }, children: [
690
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2, overflowY: "hidden" }, children: [
691
691
  /* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "TreeView" }),
692
692
  /* @__PURE__ */ e(
693
693
  p,
694
694
  {
695
695
  items: R,
696
- selectedItemId: n,
697
- handleSelectedItemChange: l
696
+ selectedItemId: l,
697
+ handleSelectedItemChange: o
698
698
  }
699
699
  )
700
700
  ] }) }),
701
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ e(
702
- N,
701
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ e(
702
+ Y,
703
703
  {
704
704
  items: R,
705
- selectedItemId: n,
706
- onItemSelect: i
705
+ selectedItemId: l,
706
+ onItemSelect: s
707
707
  }
708
708
  ) })
709
709
  ] })
@@ -720,35 +720,35 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
720
720
  }
721
721
  }, be = {
722
722
  render: () => {
723
- var h, x;
724
- const [n, r] = I([
725
- ...D
726
- ]), [l, i] = I("folder1"), [t, c] = I(null), u = [
723
+ var I, S;
724
+ const [l, r] = b([
725
+ ...w
726
+ ]), [o, s] = b("folder1"), [n, c] = b(null), u = [
727
727
  { id: "doc1", label: "Document 1" },
728
728
  { id: "doc2", label: "Document 2" },
729
729
  { id: "doc3", label: "Document 3" }
730
- ], y = (m) => {
730
+ ], T = (m) => {
731
731
  m.preventDefault();
732
- const f = m.target, g = f.closest("[data-treeview-item]");
733
- let T = null, E = null;
734
- g ? (T = g.getAttribute("data-treeview-item"), E = g.getAttribute("data-treeview-item-label")) : f.closest("[data-treeview-root]") && (T = null, E = "Racine du TreeView");
732
+ const g = m.target, v = g.closest("[data-treeview-item]");
733
+ let D = null, E = null;
734
+ v ? (D = v.getAttribute("data-treeview-item"), E = v.getAttribute("data-treeview-item-label")) : g.closest("[data-treeview-root]") && (D = null, E = "Racine du TreeView");
735
735
  try {
736
736
  const C = JSON.parse(m.dataTransfer.getData("application/json"));
737
737
  c({
738
- itemId: T,
738
+ itemId: D,
739
739
  itemLabel: E,
740
740
  droppedItem: C
741
- }), T && i(T);
741
+ }), D && s(D);
742
742
  } catch (C) {
743
743
  console.error("Erreur lors de la récupération des données", C);
744
744
  }
745
745
  };
746
- return /* @__PURE__ */ s(a, { sx: { maxWidth: 700, overflowY: "hidden" }, children: [
746
+ return /* @__PURE__ */ i(a, { sx: { maxWidth: 700, overflowY: "hidden" }, children: [
747
747
  /* @__PURE__ */ e(d, { variant: "h6", gutterBottom: !0, children: "Exemple de Drag & Drop avec le TreeView" }),
748
748
  /* @__PURE__ */ e(d, { variant: "body2", gutterBottom: !0, children: "Glissez-déposez un des documents ci-dessous sur un élément du TreeView." }),
749
- /* @__PURE__ */ e(a, { sx: { display: "flex", mb: 2 }, children: u.map((m) => /* @__PURE__ */ e(U, { id: m.id, label: m.label }, m.id)) }),
750
- /* @__PURE__ */ s(b, { container: !0, spacing: 3, children: [
751
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(
749
+ /* @__PURE__ */ e(a, { sx: { display: "flex", mb: 2 }, children: u.map((m) => /* @__PURE__ */ e(j, { id: m.id, label: m.label }, m.id)) }),
750
+ /* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
751
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(
752
752
  a,
753
753
  {
754
754
  sx: {
@@ -760,44 +760,44 @@ type CustomTreeViewItem = TreeViewBaseItem<CustomTreeViewItemProps>;
760
760
  backgroundColor: "background.paper"
761
761
  },
762
762
  onDragOver: (m) => m.preventDefault(),
763
- onDrop: y,
763
+ onDrop: T,
764
764
  children: [
765
765
  /* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Zone de drop" }),
766
766
  /* @__PURE__ */ e(
767
767
  p,
768
768
  {
769
- items: n,
770
- selectedItemId: l,
771
- handleSelectedItemChange: (m, f) => {
772
- f && i(f);
769
+ items: l,
770
+ selectedItemId: o,
771
+ handleSelectedItemChange: (m, g) => {
772
+ g && s(g);
773
773
  }
774
774
  }
775
775
  )
776
776
  ]
777
777
  }
778
778
  ) }),
779
- /* @__PURE__ */ e(b, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(v, { sx: { p: 2, minHeight: 300 }, children: [
779
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2, minHeight: 300 }, children: [
780
780
  /* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Informations du dernier drop" }),
781
- t ? /* @__PURE__ */ s(a, { children: [
782
- /* @__PURE__ */ s(d, { variant: "body2", children: [
781
+ n ? /* @__PURE__ */ i(a, { children: [
782
+ /* @__PURE__ */ i(d, { variant: "body2", children: [
783
783
  /* @__PURE__ */ e("strong", { children: "Élément cible :" }),
784
784
  " ",
785
- t.itemLabel,
785
+ n.itemLabel,
786
786
  " ",
787
- t.itemId && `(ID: ${t.itemId})`
787
+ n.itemId && `(ID: ${n.itemId})`
788
788
  ] }),
789
- /* @__PURE__ */ s(d, { variant: "body2", children: [
789
+ /* @__PURE__ */ i(d, { variant: "body2", children: [
790
790
  /* @__PURE__ */ e("strong", { children: "Élément déposé :" }),
791
791
  " ",
792
- (h = t.droppedItem) == null ? void 0 : h.label,
792
+ (I = n.droppedItem) == null ? void 0 : I.label,
793
793
  " (ID:",
794
794
  " ",
795
- (x = t.droppedItem) == null ? void 0 : x.id,
795
+ (S = n.droppedItem) == null ? void 0 : S.id,
796
796
  ")"
797
797
  ] }),
798
- /* @__PURE__ */ s(a, { sx: { mt: 2 }, children: [
798
+ /* @__PURE__ */ i(a, { sx: { mt: 2 }, children: [
799
799
  /* @__PURE__ */ e(d, { variant: "body2", children: /* @__PURE__ */ e("strong", { children: "Code pour gérer ce drop :" }) }),
800
- /* @__PURE__ */ e(v, { sx: { p: 1, mt: 1, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
800
+ /* @__PURE__ */ e(f, { sx: { p: 1, mt: 1, backgroundColor: "grey.100" }, children: /* @__PURE__ */ e(
801
801
  "pre",
802
802
  {
803
803
  style: {
@@ -842,6 +842,183 @@ const handleDrop = (e) => {
842
842
  }
843
843
  }
844
844
  }
845
+ }, fe = {
846
+ render: () => {
847
+ const l = [
848
+ {
849
+ internalId: "root-1",
850
+ label: "Dossier principal",
851
+ iconType: t.FOLDER,
852
+ children: [
853
+ {
854
+ internalId: "folder-1-1",
855
+ label: "Sous-dossier avec un nom très long pour tester",
856
+ iconType: t.FOLDER,
857
+ children: [
858
+ {
859
+ internalId: "file-1-1-1",
860
+ label: "Document A",
861
+ iconType: t.CUSTOM,
862
+ customIcon: L
863
+ },
864
+ {
865
+ internalId: "folder-1-1-2",
866
+ label: "Sous-sous-dossier",
867
+ iconType: t.FOLDER,
868
+ children: [
869
+ {
870
+ internalId: "file-1-1-2-1",
871
+ label: "Image.jpg",
872
+ iconType: t.CUSTOM
873
+ },
874
+ {
875
+ internalId: "file-1-1-2-2",
876
+ label: "Document.pdf",
877
+ iconType: t.CUSTOM,
878
+ children: [
879
+ {
880
+ internalId: "file-1-1-2-7",
881
+ label: "Image.jpg",
882
+ iconType: t.CUSTOM
883
+ },
884
+ {
885
+ internalId: "file-1-1-2-18",
886
+ label: "Document.pdf",
887
+ iconType: t.CUSTOM
888
+ }
889
+ ]
890
+ }
891
+ ]
892
+ }
893
+ ]
894
+ },
895
+ {
896
+ internalId: "folder-1-2",
897
+ label: "Court",
898
+ iconType: t.FOLDER,
899
+ children: [
900
+ {
901
+ internalId: "file-1-2-1",
902
+ label: "Fichier",
903
+ iconType: t.CUSTOM
904
+ }
905
+ ]
906
+ }
907
+ ]
908
+ },
909
+ {
910
+ internalId: "root-2",
911
+ label: "Second dossier principal",
912
+ iconType: t.FOLDER,
913
+ children: [
914
+ {
915
+ internalId: "folder-2-1",
916
+ label: "Sous-dossier A",
917
+ iconType: t.FOLDER
918
+ },
919
+ {
920
+ internalId: "folder-2-2",
921
+ label: "Sous-dossier B",
922
+ iconType: t.FOLDER,
923
+ children: []
924
+ }
925
+ ]
926
+ },
927
+ {
928
+ internalId: "root-3",
929
+ label: "Troisième dossier principal",
930
+ iconType: t.FOLDER,
931
+ children: [
932
+ {
933
+ internalId: "folder-3-1",
934
+ label: "Sous-dossier X",
935
+ iconType: t.FOLDER,
936
+ children: [
937
+ {
938
+ internalId: "file-3-1-1",
939
+ label: "Fichier X-1",
940
+ iconType: t.CUSTOM
941
+ },
942
+ {
943
+ internalId: "file-3-1-2",
944
+ label: "Fichier X-2",
945
+ iconType: t.CUSTOM
946
+ }
947
+ ]
948
+ }
949
+ ]
950
+ }
951
+ ], [r, o] = b(""), s = x(
952
+ (n, c) => {
953
+ c && o(c);
954
+ },
955
+ []
956
+ );
957
+ return /* @__PURE__ */ i(a, { sx: { p: 2 }, children: [
958
+ /* @__PURE__ */ e(d, { variant: "h5", gutterBottom: !0, children: "Test d'alignement des lignes verticales" }),
959
+ /* @__PURE__ */ e(d, { variant: "body2", color: "text.secondary", paragraph: !0, children: "Cette story permet de vérifier si les lignes verticales s'arrêtent toutes au même niveau, indépendamment de la taille des éléments. Essayez d'expandre et de collapser les différents niveaux." }),
960
+ /* @__PURE__ */ i(h, { container: !0, spacing: 3, children: [
961
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
962
+ /* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "TreeView avec plusieurs niveaux imbriqués" }),
963
+ /* @__PURE__ */ e(a, { sx: { border: "1px solid #e0e0e0", borderRadius: 1 }, children: /* @__PURE__ */ e(
964
+ p,
965
+ {
966
+ items: l,
967
+ selectedItemId: r,
968
+ handleSelectedItemChange: s,
969
+ maxHeight: 400
970
+ }
971
+ ) })
972
+ ] }) }),
973
+ /* @__PURE__ */ e(h, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ i(f, { sx: { p: 2 }, children: [
974
+ /* @__PURE__ */ e(d, { variant: "subtitle1", gutterBottom: !0, children: "Détails de l'élément sélectionné" }),
975
+ /* @__PURE__ */ e(
976
+ a,
977
+ {
978
+ sx: {
979
+ p: 2,
980
+ backgroundColor: "#f5f5f5",
981
+ borderRadius: 1,
982
+ minHeight: 100
983
+ },
984
+ children: r ? /* @__PURE__ */ i(d, { children: [
985
+ "Élément sélectionné: ",
986
+ /* @__PURE__ */ e("strong", { children: r })
987
+ ] }) : /* @__PURE__ */ e(d, { color: "text.secondary", children: "Aucun élément sélectionné. Cliquez sur un élément dans l'arborescence." })
988
+ }
989
+ ),
990
+ /* @__PURE__ */ i(a, { sx: { mt: 2 }, children: [
991
+ /* @__PURE__ */ e(
992
+ y,
993
+ {
994
+ variant: "outlined",
995
+ onClick: () => o("file-1-1-2-1"),
996
+ sx: { mr: 1 },
997
+ children: 'Sélectionner "Image.jpg"'
998
+ }
999
+ ),
1000
+ /* @__PURE__ */ e(
1001
+ y,
1002
+ {
1003
+ variant: "outlined",
1004
+ onClick: () => o("folder-3-1"),
1005
+ children: 'Sélectionner "Sous-dossier X"'
1006
+ }
1007
+ )
1008
+ ] })
1009
+ ] }) })
1010
+ ] })
1011
+ ] });
1012
+ },
1013
+ parameters: {
1014
+ controls: { disable: !0 },
1015
+ actions: { disable: !0 },
1016
+ docs: {
1017
+ description: {
1018
+ story: "Cette story permet de tester si les lignes verticales du TreeView s'alignent correctement. Elle utilise une arborescence à plusieurs niveaux avec des éléments de différentes tailles et labels de différentes longueurs pour mettre en évidence le comportement des lignes. Vérifiez que toutes les lignes verticales s'arrêtent au même niveau, créant ainsi une structure d'arborescence propre et cohérente."
1019
+ }
1020
+ }
1021
+ }
845
1022
  };
846
1023
  export {
847
1024
  be as AvecDragAndDrop,
@@ -853,5 +1030,6 @@ export {
853
1030
  me as SansIcones,
854
1031
  ue as StructureImbriquee,
855
1032
  Ie as Synchronicite,
1033
+ fe as TestAlignementLignes,
856
1034
  se as default
857
1035
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgi-learning-hub/ui",
3
- "version": "1.5.0-dev.1743516190",
3
+ "version": "1.5.0-dev.1743522751",
4
4
  "private": false,
5
5
  "author": "CGI Learning-hub Team",
6
6
  "description": "@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features",