@cgi-learning-hub/ui 1.5.1-dev.1744643558 → 1.5.1-dev.1744644969
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";const t=require("react/jsx-runtime"),d=require("@mui/material"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),d=require("@mui/material"),T=require("react"),r=require("../../Autocomplete-C6uWQlAq.cjs");var a=(n=>(n.SELECT_ALL="TOUT_SELECTIONNER",n.DESELECT_ALL="TOUT_DE_SELECTIONNER",n))(a||{});const x=({isAllSelectable:n=!1,onSelectAll:c,onDeselectAll:i,selectAllLabel:o="Tout sélectionner",deselectAllLabel:O="Tout désélectionner",...e})=>{if(!n||!e.multiple)return t.jsx(r.Autocomplete,{...e});const[s,l]=T.useState(!0),m=()=>{c&&c(),l(!1)},L=()=>{i&&i(),l(!0)};T.useEffect(()=>{!e.value||!e.options||l(e.value.length!==e.options.length)},[e.value,e.options]);const N=[s?"TOUT_SELECTIONNER":"TOUT_DE_SELECTIONNER",...e.options];return t.jsx(r.Autocomplete,{...e,options:N,renderOption:(E,u)=>{if(Object.values(a).includes(u)){const S=u;return t.jsxs(t.Fragment,{children:[t.jsx("li",{...E,onClick:S==="TOUT_SELECTIONNER"?m:L,children:s?o:O}),t.jsx(d.Divider,{sx:{marginTop:1,marginBottom:1}})]})}return t.jsx("li",{...E,children:u})}})};module.exports=x;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { jsx as n, jsxs as L, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { Divider as N } from "@mui/material";
|
|
3
3
|
import { useState as S, useEffect as _ } from "react";
|
|
4
|
-
import { A as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
4
|
+
import { A as s } from "../../Autocomplete-BjXP0c_4.js";
|
|
5
|
+
var a = /* @__PURE__ */ ((t) => (t.SELECT_ALL = "TOUT_SELECTIONNER", t.DESELECT_ALL = "TOUT_DE_SELECTIONNER", t))(a || {});
|
|
6
|
+
const R = ({
|
|
7
7
|
isAllSelectable: t = !1,
|
|
8
|
-
onSelectAll:
|
|
9
|
-
onDeselectAll:
|
|
10
|
-
selectAllLabel:
|
|
11
|
-
deselectAllLabel:
|
|
8
|
+
onSelectAll: E,
|
|
9
|
+
onDeselectAll: u,
|
|
10
|
+
selectAllLabel: o = "Tout sélectionner",
|
|
11
|
+
deselectAllLabel: r = "Tout désélectionner",
|
|
12
12
|
...e
|
|
13
13
|
}) => {
|
|
14
14
|
if (!t || !e.multiple)
|
|
15
|
-
return /* @__PURE__ */ n(
|
|
16
|
-
const [
|
|
17
|
-
|
|
15
|
+
return /* @__PURE__ */ n(s, { ...e });
|
|
16
|
+
const [c, l] = S(!0), m = () => {
|
|
17
|
+
E && E(), l(!1);
|
|
18
18
|
}, O = () => {
|
|
19
|
-
|
|
19
|
+
u && u(), l(!0);
|
|
20
20
|
};
|
|
21
21
|
_(() => {
|
|
22
|
-
l(e.value.length !== e.options.length);
|
|
22
|
+
!e.value || !e.options || l(e.value.length !== e.options.length);
|
|
23
23
|
}, [e.value, e.options]);
|
|
24
|
-
const f = [
|
|
24
|
+
const f = [c ? "TOUT_SELECTIONNER" : "TOUT_DE_SELECTIONNER", ...e.options];
|
|
25
25
|
return /* @__PURE__ */ n(
|
|
26
|
-
|
|
26
|
+
s,
|
|
27
27
|
{
|
|
28
28
|
...e,
|
|
29
29
|
options: f,
|
|
30
|
-
renderOption: (
|
|
30
|
+
renderOption: (T, i) => Object.values(a).includes(i) ? /* @__PURE__ */ L(d, { children: [
|
|
31
31
|
/* @__PURE__ */ n(
|
|
32
32
|
"li",
|
|
33
33
|
{
|
|
34
|
-
...
|
|
35
|
-
onClick:
|
|
36
|
-
children:
|
|
34
|
+
...T,
|
|
35
|
+
onClick: i === "TOUT_SELECTIONNER" ? m : O,
|
|
36
|
+
children: c ? o : r
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ n(N, { sx: { marginTop: 1, marginBottom: 1 } })
|
|
40
40
|
] }) : /* @__PURE__ */ n(
|
|
41
41
|
"li",
|
|
42
42
|
{
|
|
43
|
-
...
|
|
44
|
-
children:
|
|
43
|
+
...T,
|
|
44
|
+
children: i
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
};
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
R as default
|
|
52
52
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),c=require("react"),d=require("../Autocomplete/Autocomplete.cjs.js"),m=require("../../TextField-SGIs7v2v.cjs"),p=e=>{const[a,l]=c.useState([]),t=["Paris","Londres","Berlin","Madrid","Rome","Amsterdam","Bruxelles","Lisbonne","Vienne","Athènes"],n=(s,u)=>{l(u)},i=()=>{l(t)},r=()=>{l([])};return o.jsx(d,{options:t,sx:{width:300},renderInput:s=>o.jsx(m.TextField,{...s,label:"Choisissez une ville"}),onChange:n,value:a,onSelectAll:i,onDeselectAll:r,multiple:e.multiple,isAllSelectable:e.isAllSelectable,...e})},b={title:"Components/Autocomplete",component:p,parameters:{docs:{description:{component:`L'autocomplete est une saisie de texte normale enrichie d'un panel d'options suggérées.
|
|
2
2
|
|
|
3
|
-
Pour explorer les cas d'usage possibles : [Autocomplete component - Material UI](https://mui.com/material-ui/react-autocomplete)`}}},argTypes:{autoHighlight:{control:"boolean",description:"Met automatiquement en surbrillance la première option",table:{defaultValue:{summary:"false"}}},disableClearable:{control:"boolean",description:"Désactive la possibilité de vider le champ",table:{defaultValue:{summary:"false"}}},disabled:{control:"boolean",description:"Désactive le composant",table:{defaultValue:{summary:"false"}}}}},
|
|
3
|
+
Pour explorer les cas d'usage possibles : [Autocomplete component - Material UI](https://mui.com/material-ui/react-autocomplete)`}}},argTypes:{autoHighlight:{control:"boolean",description:"Met automatiquement en surbrillance la première option",table:{defaultValue:{summary:"false"}}},disableClearable:{control:"boolean",description:"Désactive la possibilité de vider le champ",table:{defaultValue:{summary:"false"}}},disabled:{control:"boolean",description:"Désactive le composant",table:{defaultValue:{summary:"false"}}},multiple:{control:"boolean",description:"Permet de sélectionner plusieurs options",table:{defaultValue:{summary:"false"}}},isAllSelectable:{control:"boolean",description:"Permet de sélectionner/désélectionner toutes les options",table:{defaultValue:{summary:"false"}}},disableCloseOnSelect:{control:"boolean",description:"Désactive la fermeture de la liste des options lors de la sélection",table:{defaultValue:{summary:"false"}}}}},f={args:{autoHighlight:!1,disableClearable:!1,disabled:!1,multiple:!0,isAllSelectable:!0,disableCloseOnSelect:!1}};exports.Default=f;exports.default=b;
|
|
@@ -1,28 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
),
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i } from "react";
|
|
3
|
+
import r from "../Autocomplete/Autocomplete.es.js";
|
|
4
|
+
import { T as c } from "../../TextField-ChDtIm6f.js";
|
|
5
|
+
const u = (e) => {
|
|
6
|
+
const [s, l] = i([]), t = [
|
|
7
|
+
"Paris",
|
|
8
|
+
"Londres",
|
|
9
|
+
"Berlin",
|
|
10
|
+
"Madrid",
|
|
11
|
+
"Rome",
|
|
12
|
+
"Amsterdam",
|
|
13
|
+
"Bruxelles",
|
|
14
|
+
"Lisbonne",
|
|
15
|
+
"Vienne",
|
|
16
|
+
"Athènes"
|
|
17
|
+
];
|
|
18
|
+
return /* @__PURE__ */ o(
|
|
19
|
+
r,
|
|
20
|
+
{
|
|
21
|
+
options: t,
|
|
22
|
+
sx: { width: 300 },
|
|
23
|
+
renderInput: (a) => /* @__PURE__ */ o(c, { ...a, label: "Choisissez une ville" }),
|
|
24
|
+
onChange: (a, n) => {
|
|
25
|
+
l(n);
|
|
26
|
+
},
|
|
27
|
+
value: s,
|
|
28
|
+
onSelectAll: () => {
|
|
29
|
+
l(t);
|
|
30
|
+
},
|
|
31
|
+
onDeselectAll: () => {
|
|
32
|
+
l([]);
|
|
33
|
+
},
|
|
34
|
+
multiple: e.multiple,
|
|
35
|
+
isAllSelectable: e.isAllSelectable,
|
|
36
|
+
...e
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}, g = {
|
|
24
40
|
title: "Components/Autocomplete",
|
|
25
|
-
component:
|
|
41
|
+
component: u,
|
|
26
42
|
parameters: {
|
|
27
43
|
docs: {
|
|
28
44
|
description: {
|
|
@@ -47,16 +63,34 @@ Pour explorer les cas d'usage possibles : [Autocomplete component - Material UI]
|
|
|
47
63
|
control: "boolean",
|
|
48
64
|
description: "Désactive le composant",
|
|
49
65
|
table: { defaultValue: { summary: "false" } }
|
|
66
|
+
},
|
|
67
|
+
multiple: {
|
|
68
|
+
control: "boolean",
|
|
69
|
+
description: "Permet de sélectionner plusieurs options",
|
|
70
|
+
table: { defaultValue: { summary: "false" } }
|
|
71
|
+
},
|
|
72
|
+
isAllSelectable: {
|
|
73
|
+
control: "boolean",
|
|
74
|
+
description: "Permet de sélectionner/désélectionner toutes les options",
|
|
75
|
+
table: { defaultValue: { summary: "false" } }
|
|
76
|
+
},
|
|
77
|
+
disableCloseOnSelect: {
|
|
78
|
+
control: "boolean",
|
|
79
|
+
description: "Désactive la fermeture de la liste des options lors de la sélection",
|
|
80
|
+
table: { defaultValue: { summary: "false" } }
|
|
50
81
|
}
|
|
51
82
|
}
|
|
52
|
-
},
|
|
83
|
+
}, S = {
|
|
53
84
|
args: {
|
|
54
85
|
autoHighlight: !1,
|
|
55
86
|
disableClearable: !1,
|
|
56
|
-
disabled: !1
|
|
87
|
+
disabled: !1,
|
|
88
|
+
multiple: !0,
|
|
89
|
+
isAllSelectable: !0,
|
|
90
|
+
disableCloseOnSelect: !1
|
|
57
91
|
}
|
|
58
92
|
};
|
|
59
93
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
94
|
+
S as Default,
|
|
95
|
+
g as default
|
|
62
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "1.5.1-dev.
|
|
3
|
+
"version": "1.5.1-dev.1744644969",
|
|
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",
|