allaw-ui 4.5.1 → 4.5.3
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/components/atoms/buttons/OAuthProviderButton.css +6 -0
- package/dist/components/atoms/buttons/OAuthProviderButton.js +14 -0
- package/dist/components/atoms/radios/RadioButton.css +53 -4
- package/dist/components/atoms/radios/RadioButton.d.ts +1 -1
- package/dist/components/atoms/radios/RadioButton.stories.d.ts +2 -0
- package/dist/components/atoms/radios/RadioButton.stories.js +13 -1
- package/dist/components/molecules/radioForm/RadioForm.d.ts +1 -0
- package/dist/components/molecules/radioForm/RadioForm.js +6 -3
- package/dist/components/molecules/radioForm/RadioForm.stories.d.ts +10 -0
- package/dist/components/molecules/radioForm/RadioForm.stories.js +23 -0
- package/package.json +1 -1
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
gap: 15px;
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
min-width: 210px;
|
|
10
|
+
max-width: 100%;
|
|
10
11
|
border-radius: 10px;
|
|
11
12
|
padding: 6px;
|
|
13
|
+
box-sizing: border-box;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.oauth-provider-button:hover {
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
|
|
22
24
|
.oauth-provider-button.google {
|
|
23
25
|
width: 100%;
|
|
26
|
+
max-width: 100%;
|
|
24
27
|
background: #ffffff;
|
|
25
28
|
box-shadow: 0px 2px 3px 0px #0000002b, 0px 0px 3px 0px #00000015;
|
|
26
29
|
}
|
|
@@ -39,11 +42,13 @@
|
|
|
39
42
|
.oauth-provider-button.apple {
|
|
40
43
|
background: #000000;
|
|
41
44
|
width: 100%;
|
|
45
|
+
max-width: 100%;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
.oauth-provider-button.linkedin {
|
|
45
49
|
background: #0a66c2;
|
|
46
50
|
width: 100%;
|
|
51
|
+
max-width: 100%;
|
|
47
52
|
padding-left: 10px;
|
|
48
53
|
padding-right: 10px;
|
|
49
54
|
}
|
|
@@ -99,6 +104,7 @@
|
|
|
99
104
|
|
|
100
105
|
.oauth-provider-button.microsoft {
|
|
101
106
|
width: 100%;
|
|
107
|
+
max-width: 100%;
|
|
102
108
|
background: #ffffff;
|
|
103
109
|
box-shadow: 0px 2px 3px 0px #0000002b, 0px 0px 3px 0px #00000015;
|
|
104
110
|
font-family: Roboto;
|
|
@@ -59,19 +59,33 @@ var OAuthProviderButton = function (_a) {
|
|
|
59
59
|
}, 50);
|
|
60
60
|
return function () { return clearTimeout(timer); };
|
|
61
61
|
}, []);
|
|
62
|
+
// Ajouter un useEffect pour surveiller les changements de taille
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
var handleResize = function () {
|
|
65
|
+
updateLabel();
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("resize", handleResize);
|
|
68
|
+
return function () { return window.removeEventListener("resize", handleResize); };
|
|
69
|
+
}, [size, type, provider]);
|
|
62
70
|
var updateLabel = function () {
|
|
63
71
|
var _a = getLabels(), labels = _a.labels, shortLabels = _a.shortLabels;
|
|
64
72
|
var thresholdWidth = getThresholdWidth(size);
|
|
65
73
|
if (buttonRef.current) {
|
|
66
74
|
var buttonWidth = buttonRef.current.offsetWidth;
|
|
75
|
+
// Debug: afficher les valeurs pour diagnostiquer
|
|
76
|
+
console.log("Button width:", buttonWidth, "Threshold:", thresholdWidth, "Size:", size);
|
|
77
|
+
// Toujours utiliser le label complet au début
|
|
67
78
|
if (!label) {
|
|
68
79
|
setLabel(labels[type][provider]);
|
|
69
80
|
return;
|
|
70
81
|
}
|
|
82
|
+
// Vérifier si on doit passer aux shortLabels
|
|
71
83
|
if (buttonWidth < thresholdWidth) {
|
|
84
|
+
console.log("Using short label for", provider);
|
|
72
85
|
setLabel(shortLabels[provider]);
|
|
73
86
|
}
|
|
74
87
|
else {
|
|
88
|
+
console.log("Using full label for", provider);
|
|
75
89
|
setLabel(labels[type][provider]);
|
|
76
90
|
}
|
|
77
91
|
}
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
border: none;
|
|
6
6
|
background: none;
|
|
7
7
|
cursor: pointer;
|
|
8
|
-
transition:
|
|
9
|
-
color 0.15s,
|
|
10
|
-
border-bottom 0.15s;
|
|
8
|
+
transition: color 0.15s, border-bottom 0.15s;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
.radio-button-user {
|
|
@@ -35,6 +33,29 @@
|
|
|
35
33
|
gap: 8px;
|
|
36
34
|
}
|
|
37
35
|
|
|
36
|
+
/* Style modern - cohérent avec Input */
|
|
37
|
+
.radio-button-modern {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 12px;
|
|
41
|
+
background: none;
|
|
42
|
+
border: none;
|
|
43
|
+
padding: 0;
|
|
44
|
+
transition: all 0.15s ease;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.radio-button-modern:hover {
|
|
48
|
+
background: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.radio-button-modern-active {
|
|
52
|
+
background: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.radio-button-modern-active:hover {
|
|
56
|
+
background: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
38
59
|
.radio-button-icon {
|
|
39
60
|
display: flex;
|
|
40
61
|
align-items: center;
|
|
@@ -84,7 +105,35 @@
|
|
|
84
105
|
width: 12px;
|
|
85
106
|
height: 12px;
|
|
86
107
|
flex-shrink: 0;
|
|
87
|
-
border-radius:
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
background: var(--primary-blue, #25beeb);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Style modern pour l'icône */
|
|
113
|
+
.radio-button-modern .radio-button-icon {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
117
|
+
border-radius: 50%;
|
|
118
|
+
transition: all 0.15s ease;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.radio-button-modern:hover .radio-button-icon {
|
|
122
|
+
border-color: var(--venom-grey-dark, #d1dce8);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.radio-button-modern-active .radio-button-icon {
|
|
126
|
+
width: 20px;
|
|
127
|
+
height: 20px;
|
|
128
|
+
/* padding: 3px; */
|
|
129
|
+
/* border: 2px solid var(--mid-grey, #728ea7); */
|
|
130
|
+
border-radius: 50%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.radio-button-modern-active .radio-button-icon-inner {
|
|
134
|
+
width: 14px;
|
|
135
|
+
height: 14px;
|
|
136
|
+
border-radius: 50%;
|
|
88
137
|
background: var(--primary-blue, #25beeb);
|
|
89
138
|
}
|
|
90
139
|
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
style: {
|
|
26
26
|
control: {
|
|
27
27
|
type: "radio",
|
|
28
|
-
options: ["user", "hybride"],
|
|
28
|
+
options: ["user", "hybride", "modern"],
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -73,3 +73,15 @@ HybrideActive.args = {
|
|
|
73
73
|
style: "hybride",
|
|
74
74
|
isActive: true,
|
|
75
75
|
};
|
|
76
|
+
export var ModernDefault = Template.bind({});
|
|
77
|
+
ModernDefault.args = {
|
|
78
|
+
label: "Option moderne",
|
|
79
|
+
style: "modern",
|
|
80
|
+
isActive: false,
|
|
81
|
+
};
|
|
82
|
+
export var ModernActive = Template.bind({});
|
|
83
|
+
ModernActive.args = {
|
|
84
|
+
label: "Option moderne",
|
|
85
|
+
style: "modern",
|
|
86
|
+
isActive: true,
|
|
87
|
+
};
|
|
@@ -4,8 +4,8 @@ import "../../../styles/global.css";
|
|
|
4
4
|
import Paragraph from "../../atoms/typography/Paragraph";
|
|
5
5
|
import RadioButton from "../../atoms/radios/RadioButton";
|
|
6
6
|
var RadioForm = function (_a) {
|
|
7
|
-
var label = _a.label, isRequired = _a.isRequired, options = _a.options, defaultSelected = _a.defaultSelected, onChange = _a.onChange;
|
|
8
|
-
var
|
|
7
|
+
var label = _a.label, isRequired = _a.isRequired, options = _a.options, defaultSelected = _a.defaultSelected, onChange = _a.onChange, _b = _a.style, style = _b === void 0 ? "default" : _b;
|
|
8
|
+
var _c = useState(defaultSelected || null), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
9
9
|
useEffect(function () {
|
|
10
10
|
if (defaultSelected) {
|
|
11
11
|
setSelectedOption(defaultSelected);
|
|
@@ -17,11 +17,14 @@ var RadioForm = function (_a) {
|
|
|
17
17
|
onChange(option);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
var getRadioButtonStyle = function () {
|
|
21
|
+
return style === "modern" ? "modern" : "hybride";
|
|
22
|
+
};
|
|
20
23
|
return (React.createElement("div", { className: "radio-form" },
|
|
21
24
|
React.createElement(Paragraph, { variant: "medium", color: "noir", text: React.createElement(React.Fragment, null,
|
|
22
25
|
label,
|
|
23
26
|
" ",
|
|
24
27
|
isRequired && React.createElement("span", { className: "radio-form-required" }, "*")), size: "default" }),
|
|
25
|
-
React.createElement("div", { className: "radio-form-options" }, options.map(function (option, index) { return (React.createElement(RadioButton, { key: index, label: option, style:
|
|
28
|
+
React.createElement("div", { className: "radio-form-options" }, options.map(function (option, index) { return (React.createElement(RadioButton, { key: index, label: option, style: getRadioButtonStyle(), isActive: selectedOption === option, onClick: function () { return handleOptionChange(option); } })); }))));
|
|
26
29
|
};
|
|
27
30
|
export default RadioForm;
|
|
@@ -18,10 +18,20 @@ declare namespace _default {
|
|
|
18
18
|
let control_3: string;
|
|
19
19
|
export { control_3 as control };
|
|
20
20
|
}
|
|
21
|
+
namespace style {
|
|
22
|
+
export namespace control_4 {
|
|
23
|
+
export let type: string;
|
|
24
|
+
let options_1: string[];
|
|
25
|
+
export { options_1 as options };
|
|
26
|
+
}
|
|
27
|
+
export { control_4 as control };
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
export default _default;
|
|
24
32
|
export const Default: any;
|
|
25
33
|
export const WithDefaultSelection: any;
|
|
26
34
|
export const MultipleOptions: any;
|
|
35
|
+
export const ModernStyle: any;
|
|
36
|
+
export const ModernStyleWithMultipleOptions: any;
|
|
27
37
|
import RadioForm from "./RadioForm";
|
|
@@ -21,6 +21,12 @@ export default {
|
|
|
21
21
|
isRequired: { control: "boolean" },
|
|
22
22
|
options: { control: "array" },
|
|
23
23
|
defaultSelected: { control: "text" },
|
|
24
|
+
style: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "radio",
|
|
27
|
+
options: ["default", "modern"],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
24
30
|
},
|
|
25
31
|
};
|
|
26
32
|
var Template = function (args) {
|
|
@@ -36,6 +42,7 @@ Default.args = {
|
|
|
36
42
|
label: "Référencer ma fiche pro dans les recherches sur allaw.fr",
|
|
37
43
|
isRequired: true,
|
|
38
44
|
options: ["Oui", "Non"],
|
|
45
|
+
style: "default",
|
|
39
46
|
};
|
|
40
47
|
export var WithDefaultSelection = Template.bind({});
|
|
41
48
|
WithDefaultSelection.args = {
|
|
@@ -43,10 +50,26 @@ WithDefaultSelection.args = {
|
|
|
43
50
|
isRequired: true,
|
|
44
51
|
options: ["Oui", "Non"],
|
|
45
52
|
defaultSelected: "Oui",
|
|
53
|
+
style: "default",
|
|
46
54
|
};
|
|
47
55
|
export var MultipleOptions = Template.bind({});
|
|
48
56
|
MultipleOptions.args = {
|
|
49
57
|
label: "Choisissez votre option préférée",
|
|
50
58
|
isRequired: false,
|
|
51
59
|
options: ["Option 1", "Option 2", "Option 3"],
|
|
60
|
+
style: "default",
|
|
61
|
+
};
|
|
62
|
+
export var ModernStyle = Template.bind({});
|
|
63
|
+
ModernStyle.args = {
|
|
64
|
+
label: "Référencer ma fiche pro dans les recherches sur allaw.fr",
|
|
65
|
+
isRequired: true,
|
|
66
|
+
options: ["Oui", "Non"],
|
|
67
|
+
style: "modern",
|
|
68
|
+
};
|
|
69
|
+
export var ModernStyleWithMultipleOptions = Template.bind({});
|
|
70
|
+
ModernStyleWithMultipleOptions.args = {
|
|
71
|
+
label: "Choisissez votre option préférée",
|
|
72
|
+
isRequired: false,
|
|
73
|
+
options: ["Option 1", "Option 2", "Option 3"],
|
|
74
|
+
style: "modern",
|
|
52
75
|
};
|