allaw-ui 4.5.2 → 4.5.4

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.
@@ -140,3 +140,10 @@
140
140
  .oauth-provider-button.microsoft .label {
141
141
  text-transform: none !important;
142
142
  }
143
+
144
+ /* Styles pour les boutons avec label court */
145
+ .oauth-provider-button.short-label {
146
+ min-width: 150px;
147
+ max-width: 200px;
148
+ gap: 10px;
149
+ }
@@ -7,6 +7,7 @@ export interface OAuthProviderButtonProps {
7
7
  url: string;
8
8
  size: 14 | 16 | 18 | 20 | 22 | 24;
9
9
  onClick?: () => void;
10
+ displayShortLabel?: boolean;
10
11
  }
11
12
  declare const OAuthProviderButton: React.FC<OAuthProviderButtonProps>;
12
13
  export default OAuthProviderButton;
@@ -2,8 +2,8 @@ import React, { useState, useEffect, useRef } from "react";
2
2
  import "./OAuthProviderButton.css";
3
3
  import "../../../styles/global.css";
4
4
  var OAuthProviderButton = function (_a) {
5
- var provider = _a.provider, type = _a.type, url = _a.url, size = _a.size, onClick = _a.onClick;
6
- var _b = useState(""), label = _b[0], setLabel = _b[1];
5
+ var provider = _a.provider, type = _a.type, url = _a.url, size = _a.size, onClick = _a.onClick, _b = _a.displayShortLabel, displayShortLabel = _b === void 0 ? false : _b;
6
+ var _c = useState(""), label = _c[0], setLabel = _c[1];
7
7
  var buttonRef = useRef(null);
8
8
  var getLabels = function () {
9
9
  var labels = {
@@ -66,9 +66,14 @@ var OAuthProviderButton = function (_a) {
66
66
  };
67
67
  window.addEventListener("resize", handleResize);
68
68
  return function () { return window.removeEventListener("resize", handleResize); };
69
- }, [size, type, provider]);
69
+ }, [size, type, provider, displayShortLabel]);
70
70
  var updateLabel = function () {
71
71
  var _a = getLabels(), labels = _a.labels, shortLabels = _a.shortLabels;
72
+ // Si displayShortLabel est true, toujours utiliser le label court
73
+ if (displayShortLabel) {
74
+ setLabel(shortLabels[provider]);
75
+ return;
76
+ }
72
77
  var thresholdWidth = getThresholdWidth(size);
73
78
  if (buttonRef.current) {
74
79
  var buttonWidth = buttonRef.current.offsetWidth;
@@ -172,7 +177,7 @@ var OAuthProviderButton = function (_a) {
172
177
  }
173
178
  };
174
179
  var maxWidth = getMaxWidth();
175
- return (React.createElement("button", { ref: buttonRef, className: "oauth-provider-button ".concat(provider), onClick: handleClick, style: { height: "".concat(size * 2.55, "px"), maxWidth: maxWidth } },
180
+ return (React.createElement("button", { ref: buttonRef, className: "oauth-provider-button ".concat(provider).concat(displayShortLabel ? " short-label" : ""), onClick: handleClick, style: { height: "".concat(size * 2.55, "px"), maxWidth: maxWidth } },
176
181
  renderIcon(),
177
182
  React.createElement("span", { className: "label", style: { fontSize: "".concat(size, "px") } }, label)));
178
183
  };
@@ -38,6 +38,13 @@ declare namespace _default {
38
38
  export namespace onClick {
39
39
  let action: string;
40
40
  }
41
+ export namespace displayShortLabel {
42
+ export namespace control_4 {
43
+ let type_5: string;
44
+ export { type_5 as type };
45
+ }
46
+ export { control_4 as control };
47
+ }
41
48
  }
42
49
  }
43
50
  export default _default;
@@ -53,4 +60,8 @@ export const GoogleCalendar: any;
53
60
  export const AppleCalendar: any;
54
61
  export const LinkedinCalendar: any;
55
62
  export const MicrosoftCalendar: any;
63
+ export const GoogleLoginShort: any;
64
+ export const AppleSignupShort: any;
65
+ export const LinkedinLoginShort: any;
66
+ export const MicrosoftSignupShort: any;
56
67
  import OAuthProviderButton from "./OAuthProviderButton";
@@ -41,6 +41,11 @@ export default {
41
41
  },
42
42
  },
43
43
  onClick: { action: "clicked" },
44
+ displayShortLabel: {
45
+ control: {
46
+ type: "boolean",
47
+ },
48
+ },
44
49
  },
45
50
  };
46
51
  var Template = function (args) { return React.createElement(OAuthProviderButton, __assign({}, args)); };
@@ -128,3 +133,36 @@ MicrosoftCalendar.args = {
128
133
  url: "https://outlook.office.com/calendar",
129
134
  size: 20,
130
135
  };
136
+ // Exemples avec displayShortLabel
137
+ export var GoogleLoginShort = Template.bind({});
138
+ GoogleLoginShort.args = {
139
+ provider: "google",
140
+ type: "login",
141
+ url: "https://google.com",
142
+ size: 20,
143
+ displayShortLabel: true,
144
+ };
145
+ export var AppleSignupShort = Template.bind({});
146
+ AppleSignupShort.args = {
147
+ provider: "apple",
148
+ type: "signup",
149
+ url: "https://apple.com/signup",
150
+ size: 20,
151
+ displayShortLabel: true,
152
+ };
153
+ export var LinkedinLoginShort = Template.bind({});
154
+ LinkedinLoginShort.args = {
155
+ provider: "linkedin",
156
+ type: "login",
157
+ url: "https://linkedin.com",
158
+ size: 20,
159
+ displayShortLabel: true,
160
+ };
161
+ export var MicrosoftSignupShort = Template.bind({});
162
+ MicrosoftSignupShort.args = {
163
+ provider: "microsoft",
164
+ type: "signup",
165
+ url: "https://microsoft.com/signup",
166
+ size: 20,
167
+ displayShortLabel: true,
168
+ };
@@ -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: 24px;
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
 
@@ -3,7 +3,7 @@ import "../../../styles/global.css";
3
3
  import "./RadioButton.css";
4
4
  export interface RadioButtonProps {
5
5
  label: string;
6
- style?: "user" | "hybride";
6
+ style?: "user" | "hybride" | "modern";
7
7
  isActive: boolean;
8
8
  onClick: () => void;
9
9
  dataTestId?: string;
@@ -33,4 +33,6 @@ export const UserDefault: any;
33
33
  export const UserActive: any;
34
34
  export const HybrideDefault: any;
35
35
  export const HybrideActive: any;
36
+ export const ModernDefault: any;
37
+ export const ModernActive: any;
36
38
  import RadioButton from "./RadioButton";
@@ -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
+ };
@@ -7,6 +7,7 @@ export interface RadioFormProps {
7
7
  options: string[];
8
8
  defaultSelected?: string;
9
9
  onChange?: (selectedOption: string | null) => void;
10
+ style?: "default" | "modern";
10
11
  }
11
12
  declare const RadioForm: React.FC<RadioFormProps>;
12
13
  export default RadioForm;
@@ -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 _b = useState(defaultSelected || null), selectedOption = _b[0], setSelectedOption = _b[1];
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: "hybride", isActive: selectedOption === option, onClick: function () { return handleOptionChange(option); } })); }))));
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "4.5.2",
3
+ "version": "4.5.4",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",