allaw-ui 5.0.1 → 5.0.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.
@@ -5,6 +5,7 @@ export interface InlineTagProps {
5
5
  weight?: "medium" | "semiBold" | "bold";
6
6
  backgroundColor?: "bleu-allaw" | "actions-error" | "actions-valid" | "actions-warning" | "mid-grey";
7
7
  startIcon?: string;
8
+ style?: "default" | "border";
8
9
  }
9
10
  declare const InlineTag: React.FC<InlineTagProps>;
10
11
  export default InlineTag;
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import TinyInfo from "../typography/TinyInfo";
4
4
  import styles from "./inlineTag.module.css";
5
5
  var InlineTag = function (_a) {
6
- var text = _a.text, _b = _a.size, size = _b === void 0 ? "14" : _b, _c = _a.weight, weight = _c === void 0 ? "medium" : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? "bleu-allaw" : _d, startIcon = _a.startIcon;
6
+ var text = _a.text, _b = _a.size, size = _b === void 0 ? "14" : _b, _c = _a.weight, weight = _c === void 0 ? "medium" : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? "bleu-allaw" : _d, startIcon = _a.startIcon, _e = _a.style, style = _e === void 0 ? "default" : _e;
7
7
  var variant;
8
8
  if (weight === "bold") {
9
9
  variant = "bold".concat(size);
@@ -14,7 +14,23 @@ var InlineTag = function (_a) {
14
14
  else {
15
15
  variant = "".concat(weight).concat(size);
16
16
  }
17
- return (React.createElement("div", { className: "".concat(styles.inlineTag, " ").concat(styles["bg-".concat(backgroundColor)]) },
18
- React.createElement(TinyInfo, { text: text, variant: variant, color: "pure-white", startIcon: startIcon })));
17
+ var isBorderStyle = style === "border";
18
+ var styleClass = isBorderStyle
19
+ ? styles["border-".concat(backgroundColor)]
20
+ : styles["bg-".concat(backgroundColor)];
21
+ // Mapping des couleurs pour TinyInfo
22
+ var getTextColor = function () {
23
+ if (!isBorderStyle)
24
+ return "pure-white";
25
+ // actions-warning n'est pas supporté par TinyInfo, on utilise une classe CSS custom
26
+ if (backgroundColor === "actions-warning")
27
+ return undefined;
28
+ // Pour les autres couleurs, on peut les utiliser directement
29
+ return backgroundColor;
30
+ };
31
+ return (React.createElement("div", { className: "".concat(styles.inlineTag, " ").concat(styleClass) },
32
+ React.createElement(TinyInfo, { text: text, variant: variant, color: getTextColor(), startIcon: startIcon, className: isBorderStyle && backgroundColor === "actions-warning"
33
+ ? styles["color-".concat(backgroundColor)]
34
+ : undefined })));
19
35
  };
20
36
  export default InlineTag;
@@ -49,13 +49,24 @@ declare namespace _default {
49
49
  let description_4: string;
50
50
  export { description_4 as description };
51
51
  }
52
+ namespace style {
53
+ export namespace control_5 {
54
+ let type_5: string;
55
+ export { type_5 as type };
56
+ }
57
+ export { control_5 as control };
58
+ let options_3: string[];
59
+ export { options_3 as options };
60
+ let description_5: string;
61
+ export { description_5 as description };
62
+ }
52
63
  }
53
64
  export namespace parameters {
54
65
  namespace docs {
55
- export namespace description_5 {
66
+ export namespace description_6 {
56
67
  let component: string;
57
68
  }
58
- export { description_5 as description };
69
+ export { description_6 as description };
59
70
  }
60
71
  }
61
72
  }
@@ -65,18 +76,34 @@ export const WithIcon: any;
65
76
  export const Error: any;
66
77
  export const Warning: any;
67
78
  export const Small: any;
79
+ export const BorderStyle: any;
80
+ export const BorderWithIcon: any;
68
81
  export function AllVariants(): React.JSX.Element;
69
82
  export namespace AllVariants {
70
83
  export namespace parameters_1 {
71
84
  export namespace docs_1 {
72
- export namespace description_6 {
85
+ export namespace description_7 {
73
86
  let story: string;
74
87
  }
75
- export { description_6 as description };
88
+ export { description_7 as description };
76
89
  }
77
90
  export { docs_1 as docs };
78
91
  }
79
92
  export { parameters_1 as parameters };
80
93
  }
94
+ export function AllBorderVariants(): React.JSX.Element;
95
+ export namespace AllBorderVariants {
96
+ export namespace parameters_2 {
97
+ export namespace docs_2 {
98
+ export namespace description_8 {
99
+ let story_1: string;
100
+ export { story_1 as story };
101
+ }
102
+ export { description_8 as description };
103
+ }
104
+ export { docs_2 as docs };
105
+ }
106
+ export { parameters_2 as parameters };
107
+ }
81
108
  import InlineTag from "./InlineTag";
82
109
  import React from "react";
@@ -45,6 +45,11 @@ export default {
45
45
  control: { type: "text" },
46
46
  description: "Icône à afficher au début (classe CSS)",
47
47
  },
48
+ style: {
49
+ control: { type: "select" },
50
+ options: ["default", "border"],
51
+ description: "Style du tag (default: fond coloré, border: bordure colorée)",
52
+ },
48
53
  },
49
54
  parameters: {
50
55
  docs: {
@@ -93,6 +98,23 @@ Small.args = {
93
98
  weight: "medium",
94
99
  backgroundColor: "mid-grey",
95
100
  };
101
+ export var BorderStyle = Template.bind({});
102
+ BorderStyle.args = {
103
+ text: "Style Border",
104
+ size: "14",
105
+ weight: "medium",
106
+ backgroundColor: "bleu-allaw",
107
+ style: "border",
108
+ };
109
+ export var BorderWithIcon = Template.bind({});
110
+ BorderWithIcon.args = {
111
+ text: "Certifié",
112
+ size: "14",
113
+ weight: "semiBold",
114
+ backgroundColor: "actions-valid",
115
+ startIcon: "allaw-icon-check",
116
+ style: "border",
117
+ };
96
118
  export var AllVariants = function () { return (React.createElement("div", { style: {
97
119
  display: "flex",
98
120
  flexWrap: "wrap",
@@ -114,3 +136,24 @@ AllVariants.parameters = {
114
136
  },
115
137
  },
116
138
  };
139
+ export var AllBorderVariants = function () { return (React.createElement("div", { style: {
140
+ display: "flex",
141
+ flexWrap: "wrap",
142
+ gap: "12px",
143
+ alignItems: "center",
144
+ } },
145
+ React.createElement(InlineTag, { text: "Bleu Allaw", backgroundColor: "bleu-allaw", style: "border" }),
146
+ React.createElement(InlineTag, { text: "Succ\u00E8s", backgroundColor: "actions-valid", startIcon: "allaw-icon-check", style: "border" }),
147
+ React.createElement(InlineTag, { text: "Erreur", backgroundColor: "actions-error", startIcon: "allaw-icon-alert", style: "border" }),
148
+ React.createElement(InlineTag, { text: "Attention", backgroundColor: "actions-warning", startIcon: "allaw-icon-warning", style: "border" }),
149
+ React.createElement(InlineTag, { text: "Neutre", backgroundColor: "mid-grey", style: "border" }),
150
+ React.createElement(InlineTag, { text: "Petit 12px", size: "12", backgroundColor: "bleu-allaw", style: "border" }),
151
+ React.createElement(InlineTag, { text: "Gras", weight: "bold", backgroundColor: "actions-valid", style: "border" }),
152
+ React.createElement(InlineTag, { text: "Semi-Bold", weight: "semiBold", backgroundColor: "bleu-allaw", style: "border" }))); };
153
+ AllBorderVariants.parameters = {
154
+ docs: {
155
+ description: {
156
+ story: "Toutes les variantes du composant InlineTag avec le style border.",
157
+ },
158
+ },
159
+ };
@@ -26,3 +26,48 @@
26
26
  .bg-mid-grey {
27
27
  background-color: #728ea7;
28
28
  }
29
+
30
+ .border-bleu-allaw {
31
+ background-color: #ffffff;
32
+ border: 1px solid #25beeb;
33
+ }
34
+
35
+ .border-actions-error {
36
+ background-color: #ffffff;
37
+ border: 1px solid #e15151;
38
+ }
39
+
40
+ .border-actions-valid {
41
+ background-color: #ffffff;
42
+ border: 1px solid #29a36a;
43
+ }
44
+
45
+ .border-actions-warning {
46
+ background-color: #ffffff;
47
+ border: 1px solid #ffc857;
48
+ }
49
+
50
+ .border-mid-grey {
51
+ background-color: #ffffff;
52
+ border: 1px solid #728ea7;
53
+ }
54
+
55
+ .color-bleu-allaw {
56
+ color: #25beeb;
57
+ }
58
+
59
+ .color-actions-error {
60
+ color: #e15151;
61
+ }
62
+
63
+ .color-actions-valid {
64
+ color: #29a36a;
65
+ }
66
+
67
+ .color-actions-warning {
68
+ color: #ffc857 !important;
69
+ }
70
+
71
+ .color-mid-grey {
72
+ color: #728ea7;
73
+ }
@@ -1,15 +1,5 @@
1
1
  @import "../../../styles/colors.css";
2
2
 
3
- :root {
4
- --heading-h1-font-size: 60px;
5
- --heading-h2-font-size: 36px;
6
- --heading-h3-font-size: 28px;
7
- --heading-h4-font-size: 24px;
8
- --heading-h5-font-size: 20px;
9
- --heading-h6-font-size: 18px;
10
- --heading-h7-font-size: 14px;
11
- }
12
-
13
3
  .heading {
14
4
  font-family: Poppins;
15
5
  font-style: normal;
@@ -55,35 +45,6 @@
55
45
  font-weight: 600;
56
46
  }
57
47
 
58
- /* Responsive heading - adjusts font-size only, keeps semantic HTML tag */
59
- .heading.responsive {
60
- /* Use the base variant size as fallback for mobile */
61
- }
62
-
63
- @media (min-width: 480px) {
64
- .heading.responsive {
65
- font-size: var(--font-size-480) !important;
66
- }
67
- }
68
-
69
- @media (min-width: 768px) {
70
- .heading.responsive {
71
- font-size: var(--font-size-768) !important;
72
- }
73
- }
74
-
75
- @media (min-width: 1024px) {
76
- .heading.responsive {
77
- font-size: var(--font-size-1024) !important;
78
- }
79
- }
80
-
81
- @media (min-width: 1440px) {
82
- .heading.responsive {
83
- font-size: var(--font-size-1440) !important;
84
- }
85
- }
86
-
87
48
  .heading.color-bleu-allaw {
88
49
  color: var(--bleu-allaw);
89
50
  }
@@ -1,28 +1,38 @@
1
- import React from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import "./Heading.css";
3
3
  var Heading = function (_a) {
4
- var variant = _a.variant, _b = _a.color, color = _b === void 0 ? "noir" : _b, text = _a.text, _c = _a.align, align = _c === void 0 ? "left" : _c, responsiveSize = _a.responsiveSize, _d = _a.as, Component = _d === void 0 ? "span" : _d;
5
- // Size mapping for responsive sizes
6
- var sizeMap = {
7
- h1: "60px",
8
- h2: "36px",
9
- h3: "28px",
10
- h4: "24px",
11
- h5: "20px",
12
- h6: "18px",
13
- h7: "14px",
14
- };
15
- // Generate responsive class if responsiveSize is provided
16
- var responsiveClass = responsiveSize ? "responsive" : "";
17
- // Generate inline style for responsive sizes
18
- var responsiveStyle = responsiveSize
19
- ? {
20
- "--font-size-480": sizeMap[responsiveSize[480] || variant],
21
- "--font-size-768": sizeMap[responsiveSize[768] || variant],
22
- "--font-size-1024": sizeMap[responsiveSize[1024] || variant],
23
- "--font-size-1440": sizeMap[responsiveSize[1440] || variant],
24
- }
25
- : undefined;
26
- return (React.createElement(Component, { className: "heading ".concat(variant, " color-").concat(color, " align-").concat(align, " ").concat(responsiveClass).trim(), style: responsiveStyle }, text));
4
+ var variant = _a.variant, _b = _a.color, color = _b === void 0 ? "pure-white" : _b, text = _a.text, _c = _a.align, align = _c === void 0 ? "left" : _c, responsiveSize = _a.responsiveSize, _d = _a.as, Component = _d === void 0 ? "span" : _d;
5
+ var _e = useState(variant), currentVariant = _e[0], setCurrentVariant = _e[1];
6
+ useEffect(function () {
7
+ if (!responsiveSize)
8
+ return;
9
+ var handleResize = function () {
10
+ var width = window.innerWidth;
11
+ var breakpoints = Object.keys(responsiveSize)
12
+ .map(Number)
13
+ .sort(function (a, b) { return a - b; });
14
+ // Find the appropriate variant for the current width
15
+ var selectedVariant = variant; // Default to the prop variant
16
+ for (var _i = 0, breakpoints_1 = breakpoints; _i < breakpoints_1.length; _i++) {
17
+ var breakpoint = breakpoints_1[_i];
18
+ if (width >= breakpoint) {
19
+ selectedVariant = responsiveSize[breakpoint];
20
+ }
21
+ else {
22
+ break;
23
+ }
24
+ }
25
+ setCurrentVariant(selectedVariant);
26
+ };
27
+ // Initial check
28
+ handleResize();
29
+ // Add event listener
30
+ window.addEventListener("resize", handleResize);
31
+ // Cleanup
32
+ return function () {
33
+ window.removeEventListener("resize", handleResize);
34
+ };
35
+ }, [responsiveSize, variant]);
36
+ return (React.createElement(Component, { className: "heading ".concat(currentVariant, " color-").concat(color, " align-").concat(align) }, text));
27
37
  };
28
38
  export default Heading;
@@ -46,7 +46,12 @@ declare namespace _default {
46
46
  }
47
47
  }
48
48
  export namespace args {
49
- let responsiveSize_1: undefined;
49
+ let responsiveSize_1: {
50
+ 480: string;
51
+ 768: string;
52
+ 1024: string;
53
+ 1440: string;
54
+ };
50
55
  export { responsiveSize_1 as responsiveSize };
51
56
  }
52
57
  export namespace parameters {
@@ -10,8 +10,8 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from "react";
13
- import Heading from "./Heading";
14
13
  import "../../../styles/global.css";
14
+ import Heading from "./Heading";
15
15
  export default {
16
16
  title: "Components/UI-Variables/Typography/Heading",
17
17
  component: Heading,
@@ -50,7 +50,12 @@ export default {
50
50
  },
51
51
  args: {
52
52
  // Valeurs par défaut pour tous les stories
53
- responsiveSize: undefined,
53
+ responsiveSize: {
54
+ 480: "h5",
55
+ 768: "h4",
56
+ 1024: "h3",
57
+ 1440: "h2",
58
+ },
54
59
  },
55
60
  parameters: {
56
61
  backgrounds: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",