allaw-ui 4.9.9 → 5.0.1

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.
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import React, { useState } from "react";
48
+ import React, { useState, useEffect } from "react";
49
49
  import styles from "./searchBar.module.css";
50
50
  import "../../../styles/global.css";
51
51
  import "../../../styles/icons.css";
@@ -53,6 +53,10 @@ import TinyInfo from "../typography/TinyInfo";
53
53
  var SearchBar = function (_a) {
54
54
  var _b = _a.placeholder, placeholder = _b === void 0 ? "Faites une recherche" : _b, endIcon = _a.endIcon, startIcon = _a.startIcon, _c = _a.value, controlledValue = _c === void 0 ? "" : _c, onChange = _a.onChange, _d = _a.showClear, showClear = _d === void 0 ? false : _d, _e = _a.size, size = _e === void 0 ? "normal" : _e, _f = _a.style, styleProp = _f === void 0 ? "classic" : _f, _g = _a.disableAutofill, disableAutofill = _g === void 0 ? false : _g, _h = _a.showLocate, showLocate = _h === void 0 ? false : _h, minChar = _a.minChar, _j = _a.loading, loading = _j === void 0 ? false : _j, resolveCityFromCoords = _a.resolveCityFromCoords;
55
55
  var _k = useState(controlledValue), value = _k[0], setValue = _k[1];
56
+ // Synchroniser l'état interne avec la prop value (mode controlled)
57
+ useEffect(function () {
58
+ setValue(controlledValue);
59
+ }, [controlledValue]);
56
60
  var _l = useState(null), locationError = _l[0], setLocationError = _l[1];
57
61
  var handleChange = function (event) {
58
62
  var newValue = event.target.value;
@@ -21,7 +21,7 @@
21
21
  }
22
22
 
23
23
  .searchBarPlaceholder {
24
- color: #728ea7;
24
+ color: #171e25;
25
25
  font-family: "Open Sans";
26
26
  font-size: 16px;
27
27
  font-style: normal;
@@ -35,6 +35,11 @@
35
35
  padding-left: 3px;
36
36
  }
37
37
 
38
+ .searchBarPlaceholder::placeholder {
39
+ color: #728ea7;
40
+ opacity: 0.8;
41
+ }
42
+
38
43
  .searchBarStartIcon {
39
44
  display: inline-flex;
40
45
  align-items: center;
@@ -1,5 +1,15 @@
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
+
3
13
  .heading {
4
14
  font-family: Poppins;
5
15
  font-style: normal;
@@ -45,6 +55,35 @@
45
55
  font-weight: 600;
46
56
  }
47
57
 
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
+
48
87
  .heading.color-bleu-allaw {
49
88
  color: var(--bleu-allaw);
50
89
  }
@@ -1,38 +1,28 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React 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 ? "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));
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));
37
27
  };
38
28
  export default Heading;
@@ -46,12 +46,7 @@ declare namespace _default {
46
46
  }
47
47
  }
48
48
  export namespace args {
49
- let responsiveSize_1: {
50
- 480: string;
51
- 768: string;
52
- 1024: string;
53
- 1440: string;
54
- };
49
+ let responsiveSize_1: undefined;
55
50
  export { responsiveSize_1 as responsiveSize };
56
51
  }
57
52
  export namespace parameters {
@@ -50,12 +50,7 @@ export default {
50
50
  },
51
51
  args: {
52
52
  // Valeurs par défaut pour tous les stories
53
- responsiveSize: {
54
- 480: "h5",
55
- 768: "h4",
56
- 1024: "h3",
57
- 1440: "h2",
58
- },
53
+ responsiveSize: undefined,
59
54
  },
60
55
  parameters: {
61
56
  backgrounds: {
@@ -73,49 +68,49 @@ var Template = function (args) { return React.createElement(Heading, __assign({}
73
68
  export var H1 = Template.bind({});
74
69
  H1.args = {
75
70
  variant: "h1",
76
- color: "pure-white",
71
+ color: "noir",
77
72
  text: "Poppins – SemiBold – 60px",
78
73
  as: "h1",
79
74
  };
80
75
  export var H2 = Template.bind({});
81
76
  H2.args = {
82
77
  variant: "h2",
83
- color: "pure-white",
78
+ color: "noir",
84
79
  text: "Poppins – SemiBold – 36px",
85
80
  as: "h2",
86
81
  };
87
82
  export var H3 = Template.bind({});
88
83
  H3.args = {
89
84
  variant: "h3",
90
- color: "pure-white",
85
+ color: "noir",
91
86
  text: "Poppins – SemiBold – 28px",
92
87
  as: "h3",
93
88
  };
94
89
  export var H4 = Template.bind({});
95
90
  H4.args = {
96
91
  variant: "h4",
97
- color: "pure-white",
92
+ color: "noir",
98
93
  text: "Poppins – SemiBold – 24px",
99
94
  as: "h4",
100
95
  };
101
96
  export var H5 = Template.bind({});
102
97
  H5.args = {
103
98
  variant: "h5",
104
- color: "pure-white",
99
+ color: "noir",
105
100
  text: "Poppins – Medium – 24px",
106
101
  as: "h5",
107
102
  };
108
103
  export var H6 = Template.bind({});
109
104
  H6.args = {
110
105
  variant: "h6",
111
- color: "pure-white",
106
+ color: "noir",
112
107
  text: "Poppins – SemiBold – 18px",
113
108
  as: "h6",
114
109
  };
115
110
  export var H7 = Template.bind({});
116
111
  H7.args = {
117
112
  variant: "h7",
118
- color: "pure-white",
113
+ color: "noir",
119
114
  text: "Poppins – SemiBold – 14px",
120
115
  as: "span",
121
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "4.9.9",
3
+ "version": "5.0.1",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",