allaw-ui 4.8.9 → 4.9.0

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.
@@ -13,6 +13,8 @@ export interface SearchBarProps {
13
13
  disableAutofill?: boolean;
14
14
  showLocate?: boolean;
15
15
  minChar?: number;
16
+ /** Affiche un indicateur de chargement à droite lorsque true */
17
+ loading?: boolean;
16
18
  resolveCityFromCoords?: (lat: number, lon: number) => Promise<string | undefined>;
17
19
  }
18
20
  declare const SearchBar: React.FC<SearchBarProps>;
@@ -51,9 +51,9 @@ import "../../../styles/global.css";
51
51
  import "../../../styles/icons.css";
52
52
  import TinyInfo from "../typography/TinyInfo";
53
53
  var SearchBar = function (_a) {
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, resolveCityFromCoords = _a.resolveCityFromCoords;
55
- var _j = useState(controlledValue), value = _j[0], setValue = _j[1];
56
- var _k = useState(null), locationError = _k[0], setLocationError = _k[1];
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
+ var _k = useState(controlledValue), value = _k[0], setValue = _k[1];
56
+ var _l = useState(null), locationError = _l[0], setLocationError = _l[1];
57
57
  var handleChange = function (event) {
58
58
  var newValue = event.target.value;
59
59
  setValue(newValue);
@@ -159,7 +159,8 @@ var SearchBar = function (_a) {
159
159
  }))),
160
160
  showClear && (controlledValue || value) && (React.createElement("button", { type: "button", className: styles.searchBarClearButton, onClick: handleClear, "aria-label": "Effacer la recherche" },
161
161
  React.createElement("i", { className: "allaw-icon-x-small" }))),
162
- endIcon && (React.createElement("button", { className: styles.searchBarIconButton, tabIndex: -1, "aria-label": "Rechercher" },
162
+ loading && (React.createElement("span", { className: styles.searchBarLoader, "aria-live": "polite", "aria-busy": "true" })),
163
+ !loading && endIcon && (React.createElement("button", { className: styles.searchBarIconButton, tabIndex: -1, "aria-label": "Rechercher" },
163
164
  React.createElement("i", { className: endIcon }))),
164
165
  showLocate && (React.createElement("button", { type: "button", className: styles.searchBarLocateButton, onClick: function (e) {
165
166
  e.preventDefault();
@@ -17,6 +17,7 @@ declare namespace _default {
17
17
  let showLocate: boolean;
18
18
  let locateIcon: string;
19
19
  let minChar: undefined;
20
+ let loading: boolean;
20
21
  }
21
22
  export namespace argTypes {
22
23
  export namespace placeholder {
@@ -103,6 +104,13 @@ declare namespace _default {
103
104
  export { description_4 as description };
104
105
  }
105
106
  export { minChar_1 as minChar };
107
+ export namespace loading_1 {
108
+ let control_10: string;
109
+ export { control_10 as control };
110
+ let description_5: string;
111
+ export { description_5 as description };
112
+ }
113
+ export { loading_1 as loading };
106
114
  export namespace onChange_1 {
107
115
  let action_1: string;
108
116
  export { action_1 as action };
@@ -130,4 +138,5 @@ export const BigFormStartIconNoEnd: any;
130
138
  export const WithLocate: any;
131
139
  export const WithMinChar: any;
132
140
  export const ResponsiveLocate: any;
141
+ export const WithLoading: any;
133
142
  import SearchBar from "./SearchBar";
@@ -21,7 +21,7 @@ export default {
21
21
  component: SearchBar,
22
22
  tags: ["autodocs"],
23
23
  excludeStories: /.*Data$/,
24
- args: __assign(__assign({}, ActionsData), { endIcon: "allaw-icon-search", showClear: false, size: "normal", style: "classic", startIcon: undefined, showLocate: false, locateIcon: "allaw-icon-map-pin", minChar: undefined }),
24
+ args: __assign(__assign({}, ActionsData), { endIcon: "allaw-icon-search", showClear: false, size: "normal", style: "classic", startIcon: undefined, showLocate: false, locateIcon: "allaw-icon-map-pin", minChar: undefined, loading: false }),
25
25
  argTypes: {
26
26
  placeholder: {
27
27
  control: {
@@ -72,6 +72,10 @@ export default {
72
72
  control: { type: "number", min: 0, max: 20 },
73
73
  description: "Nombre minimum de caractères pour changer la couleur de bordure en vert (#29a36a).",
74
74
  },
75
+ loading: {
76
+ control: "boolean",
77
+ description: "Affiche un loader à la fin du champ.",
78
+ },
75
79
  onChange: { action: "changed" },
76
80
  },
77
81
  parameters: {
@@ -175,6 +179,15 @@ ResponsiveLocate.args = {
175
179
  style: "form",
176
180
  showLocate: true,
177
181
  };
182
+ export var WithLoading = Template.bind({});
183
+ WithLoading.args = {
184
+ placeholder: "Recherche en cours...",
185
+ endIcon: "allaw-icon-search",
186
+ showClear: false,
187
+ size: "normal",
188
+ style: "classic",
189
+ loading: true,
190
+ };
178
191
  ResponsiveLocate.parameters = {
179
192
  docs: {
180
193
  description: {
@@ -186,13 +186,38 @@
186
186
 
187
187
  /* MinChar variant */
188
188
  .minCharReached {
189
- border-color: #29a36a !important;
189
+ border-color: #25beeb !important;
190
190
  }
191
191
 
192
192
  .minCharReached:hover {
193
- border-color: #29a36a !important;
193
+ border-color: #25beeb !important;
194
194
  }
195
195
 
196
196
  .minCharReached:focus-within {
197
- border-color: #29a36a !important;
197
+ border-color: #25beeb !important;
198
+ }
199
+
200
+ /* Loader */
201
+ .searchBarLoader {
202
+ width: 18px;
203
+ height: 18px;
204
+ border-radius: 50%;
205
+ border: 2px solid rgba(37, 190, 235, 0.25);
206
+ border-top-color: #25beeb;
207
+ animation: searchBarSpin 0.8s linear infinite;
208
+ margin-right: 8px; /* décale de 4px depuis la bordure droite */
209
+ }
210
+
211
+ .sizeBig .searchBarLoader {
212
+ width: 20px;
213
+ height: 20px;
214
+ }
215
+
216
+ @keyframes searchBarSpin {
217
+ from {
218
+ transform: rotate(0deg);
219
+ }
220
+ to {
221
+ transform: rotate(360deg);
222
+ }
198
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "4.8.9",
3
+ "version": "4.9.0",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",