allaw-ui 4.5.3 → 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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "4.5.3",
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",