@woosmap/ui 4.220.10 → 4.220.13

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.
Files changed (145) hide show
  1. package/.eslintrc +0 -10
  2. package/.storybook/main.js +0 -7
  3. package/package.json +3 -11
  4. package/src/components/Button/Button.js +2 -2
  5. package/src/components/Button/Button.stories.js +5 -5
  6. package/src/components/Button/Button.test.js +1 -1
  7. package/src/components/Button/ButtonSwitch.js +1 -1
  8. package/src/components/Button/ButtonWithDropdown.js +3 -3
  9. package/src/components/Button/ButtonWithDropdown.test.js +1 -1
  10. package/src/components/Card/Card.js +29 -29
  11. package/src/components/Card/Card.stories.js +6 -6
  12. package/src/components/Card/Card.test.js +1 -1
  13. package/src/components/Card/SimpleCard.js +2 -2
  14. package/src/components/Card/SimpleCard.styl +2 -2
  15. package/src/components/Card/SimpleCard.test.js +1 -1
  16. package/src/components/CodeSnippet/CodeSnippet.stories.js +1 -1
  17. package/src/components/CodeSnippet/CodeSnippet.test.js +1 -1
  18. package/src/components/CopyClipboardButton/CopyClipboardButton.js +3 -3
  19. package/src/components/CopyClipboardButton/CopyToClipboard.stories.js +1 -1
  20. package/src/components/CopyClipboardButton/CopyToClipboard.test.js +1 -1
  21. package/src/components/DateTime/DateTime.stories.js +1 -1
  22. package/src/components/DateTime/DateTime.test.js +1 -1
  23. package/src/components/Demo/AddressDemo.js +10 -10
  24. package/src/components/Demo/AddressDemo.stories.js +1 -1
  25. package/src/components/Demo/AutocompleteAddressDemo.js +10 -10
  26. package/src/components/Demo/AutocompleteAddressDemo.stories.js +2 -2
  27. package/src/components/Demo/DistanceDemo.js +12 -12
  28. package/src/components/Demo/DistanceDemo.stories.js +1 -1
  29. package/src/components/Demo/DistanceDemo.test.js +1 -1
  30. package/src/components/Demo/GeolocationDemo.js +7 -7
  31. package/src/components/Demo/GeolocationDemo.stories.js +1 -1
  32. package/src/components/Demo/GeolocationDemo.test.js +1 -1
  33. package/src/components/Demo/LocalitiesAddressDemo.js +8 -8
  34. package/src/components/Demo/LocalitiesAddressDemo.stories.js +1 -1
  35. package/src/components/Demo/LocalitiesAllDemo.js +5 -5
  36. package/src/components/Demo/LocalitiesAllDemo.stories.js +1 -1
  37. package/src/components/Demo/LocalitiesDemo.js +10 -10
  38. package/src/components/Demo/LocalitiesDemo.stories.js +1 -1
  39. package/src/components/Demo/LocalitiesFRAddressDemo.js +239 -261
  40. package/src/components/Demo/LocalitiesFRAddressDemo.stories.js +2 -2
  41. package/src/components/Demo/LocalitiesUKAddressDemo.js +271 -294
  42. package/src/components/Demo/LocalitiesUKAddressDemo.stories.js +1 -1
  43. package/src/components/Demo/MapDemo.js +231 -233
  44. package/src/components/Demo/MapDemo.stories.js +1 -1
  45. package/src/components/Demo/SearchDemo.js +9 -9
  46. package/src/components/Demo/SearchDemo.stories.js +1 -1
  47. package/src/components/Demo/SearchDemo.test.js +1 -1
  48. package/src/components/Demo/Showcase.stories.js +7 -7
  49. package/src/components/Demo/SkeletonDemo.js +8 -8
  50. package/src/components/Demo/SkeletonDemo.stories.js +2 -2
  51. package/src/components/Demo/SkeletonDemo.test.js +2 -2
  52. package/src/components/Demo/W3WDemo.js +9 -9
  53. package/src/components/Demo/W3WDemo.stories.js +2 -2
  54. package/src/components/Dropdown/Dropdown.js +4 -4
  55. package/src/components/Dropdown/Dropdown.stories.js +1 -1
  56. package/src/components/Dropdown/Dropdown.test.js +1 -1
  57. package/src/components/DynamicTag/DynamicTag.js +5 -5
  58. package/src/components/DynamicTag/DynamicTag.stories.js +1 -1
  59. package/src/components/DynamicTag/DynamicTag.test.js +1 -1
  60. package/src/components/Flash/Flash.js +1 -1
  61. package/src/components/Flash/Flash.stories.js +1 -1
  62. package/src/components/Flash/Flash.test.js +1 -1
  63. package/src/components/Icon/Icon.js +409 -409
  64. package/src/components/Icon/Icon.stories.js +1 -1
  65. package/src/components/Icon/Icon.test.js +1 -1
  66. package/src/components/Icon/WebSiteIcon.js +231 -231
  67. package/src/components/InfoMessage/Flash.js +1 -1
  68. package/src/components/InfoMessage/InfoMessage.js +2 -2
  69. package/src/components/InfoMessage/InfoMessage.stories.js +1 -1
  70. package/src/components/InfoMessage/InfoMessage.test.js +1 -1
  71. package/src/components/Input/Input.js +2 -2
  72. package/src/components/Input/Input.password.test.js +1 -1
  73. package/src/components/Input/Input.stories.js +1 -1
  74. package/src/components/Input/Input.test.js +1 -1
  75. package/src/components/Label/Label.js +1 -1
  76. package/src/components/Label/Label.stories.js +1 -1
  77. package/src/components/Label/Label.test.js +1 -1
  78. package/src/components/Map/InfoWindow.test.js +1 -1
  79. package/src/components/Map/Map.stories.js +3 -3
  80. package/src/components/Map/Marker.test.js +1 -1
  81. package/src/components/Map/drawOnMap.test.js +2 -10
  82. package/src/components/Map/marker.styl +2 -2
  83. package/src/components/Modal/ConfirmationModal.js +2 -2
  84. package/src/components/Modal/ConfirmationModal.test.js +1 -1
  85. package/src/components/Modal/Modal.js +6 -6
  86. package/src/components/Modal/Modal.stories.js +3 -3
  87. package/src/components/Modal/Modal.test.js +1 -1
  88. package/src/components/OfflineChatBot/OfflineChatBot.js +4 -4
  89. package/src/components/OfflineChatBot/OfflineChatBot.stories.js +2 -2
  90. package/src/components/Panel/Panel.js +2 -2
  91. package/src/components/Panel/Panel.stories.js +2 -2
  92. package/src/components/Panel/Panel.test.js +1 -1
  93. package/src/components/PasswordStrengthBar/PasswordStrengthBar.stories.js +1 -1
  94. package/src/components/PasswordStrengthBar/PasswordStrengthBar.test.js +1 -1
  95. package/src/components/Popover/ConfirmationPopover.js +3 -3
  96. package/src/components/Popover/ConfirmationPopover.test.js +1 -1
  97. package/src/components/Popover/Popover.js +1 -1
  98. package/src/components/Popover/Popover.stories.js +3 -3
  99. package/src/components/Popover/Popover.test.js +2 -2
  100. package/src/components/PricingSlider/PricingData.js +94 -113
  101. package/src/components/PricingSlider/PricingSimulator.js +132 -90
  102. package/src/components/PricingSlider/PricingSimulator.stories.js +1 -1
  103. package/src/components/PricingSlider/PricingSlider.js +9 -10
  104. package/src/components/ProgressBar/ProgressBar.js +1 -1
  105. package/src/components/ProgressBar/ProgressBar.stories.js +1 -1
  106. package/src/components/ProgressBar/ProgressBar.test.js +1 -1
  107. package/src/components/ScrollBar/ScrollBar.stories.js +1 -1
  108. package/src/components/ScrollBar/ScrollBar.test.js +1 -1
  109. package/src/components/Select/Select.stories.js +4 -4
  110. package/src/components/Select/TagSelect.test.js +1 -1
  111. package/src/components/ServiceMessage/ServiceMessage.js +1 -1
  112. package/src/components/ServiceMessage/ServiceMessage.stories.js +2 -2
  113. package/src/components/SnackBar/SnackBar.js +2 -2
  114. package/src/components/SnackBar/SnackBar.stories.js +3 -3
  115. package/src/components/SnackBar/SnackBar.test.js +3 -3
  116. package/src/components/SnackBar/withSnackBar.js +1 -1
  117. package/src/components/Stepper/Stepper.js +2 -2
  118. package/src/components/Stepper/Stepper.stories.js +1 -1
  119. package/src/components/Switch/Switch.stories.js +1 -1
  120. package/src/components/Switch/Switch.test.js +1 -1
  121. package/src/components/Tab/Tab.js +1 -1
  122. package/src/components/Tab/Tab.stories.js +1 -1
  123. package/src/components/Tooltip/Tooltip.stories.js +1 -1
  124. package/src/components/Tooltip/Tooltip.test.js +1 -1
  125. package/src/components/UseCase/UseCase.js +9 -9
  126. package/src/components/UseCase/UseCase.stories.js +4 -4
  127. package/src/components/UseCase/UseCase.styl +8 -8
  128. package/src/components/Woosmap/AddressAutocomplete.js +3 -3
  129. package/src/components/Woosmap/LocalitiesAutocomplete.js +1 -1
  130. package/src/components/Woosmap/Woosmap.stories.js +3 -3
  131. package/src/components/utils/Script.test.js +1 -1
  132. package/src/components/utils/locale.js +2 -2
  133. package/src/components/withClickOutside/withClickOutside.test.js +1 -1
  134. package/src/components/withFormValidation/withFormValidation.js +2 -2
  135. package/src/components/withFormValidation/withFormValidation.stories.js +2 -2
  136. package/src/components/withFormValidation/withFormValidation.test.js +2 -2
  137. package/src/index.js +61 -61
  138. package/src/locales/en/translation.json +143 -128
  139. package/src/locales/fr/translation.json +143 -128
  140. package/src/styles/commons/flags.styl +1 -1
  141. package/src/styles/console/button.styl +3 -3
  142. package/src/styles/console/{pricing-slider.styl → pricing-slider-back.styl} +48 -21
  143. package/src/styles/style-console.styl +1 -2
  144. package/src/website.js +25 -25
  145. package/craco.config.js +0 -9
@@ -1,283 +1,261 @@
1
1
  /* eslint-disable */
2
2
  import axios from 'axios';
3
3
  import React, { Component } from 'react';
4
- import Demo from '@/components/Demo/SkeletonDemo';
5
- import LocalitiesAutocomplete from '@/components/Woosmap/LocalitiesAutocomplete';
6
- import Constants from '@/Constants';
7
- import { tr } from '@/components/utils/locale';
8
- import Input from '@/components/Input/Input';
4
+ import { changeLanguage } from '../utils/locale';
5
+ import Demo from './SkeletonDemo';
6
+ import LocalitiesAutocomplete from '../Woosmap/LocalitiesAutocomplete';
7
+ import Constants from '../../Constants';
8
+ import { tr } from '../utils/locale';
9
+ import Input from '../Input/Input';
9
10
 
10
11
  export default class LocalitiesDemo extends Component {
11
- constructor(props) {
12
- super(props);
13
- const types = [
14
- { label: tr("Localities"), value: "locality" },
15
- { label: tr("Postal codes"), value: "postal_code" },
16
- {
17
- label: tr("Administrative areas (States, regions, ...)"),
18
- value: "admin_level",
19
- },
20
- { label: tr("Airports"), value: "airport" },
21
- { label: tr("Train stations"), value: "train_station" },
22
- { label: tr("Metro stations"), value: "metro_station" },
23
- { label: tr("Shopping centers"), value: "shopping" },
24
- { label: tr("Museums"), value: "museum" },
25
- { label: tr("Tourist attractions"), value: "tourist_attraction" },
26
- { label: tr("Amusement parks"), value: "amusement_park" },
27
- { label: tr("Art galleries"), value: "art_gallery" },
28
- { label: tr("Zoos"), value: "zoo" },
29
- ];
30
- this.state = {
31
- localities: null,
32
- selectedLocality: null,
33
- error: null,
34
- input: "",
35
- localitiesTypes: [{ label: "Address", value: "address" }],
36
- countries: [{ label: "FR", value: "fr" }],
37
- language: "fr",
38
- };
39
- this.types = types.map((item) => ({
40
- label: item.label,
41
- value: item.value,
42
- }));
43
- this.mounted = true;
44
- this.viewport = null;
45
- this.requestUrl = "https://api.woosmap.com/localities/autocomplete/";
46
- this.requestDetailsUrl = "https://api.woosmap.com/localities/details/";
47
- this.inputRef = React.createRef();
48
- }
49
-
50
- componentDidMount() {
51
- this.requestLocalities();
52
- }
53
-
54
- componentWillUnmount() {
55
- this.mounted = false;
56
- }
57
-
58
- requestLocalities = () => {
59
- axios
60
- .get(this.requestUrl, {
61
- params: this.getRequestparams(),
62
- })
63
- .then((response) => {
64
- if (this.mounted) {
65
- this.setState({
66
- localities: response.data,
67
- error: null,
68
- });
69
- }
70
- })
71
- .catch((error) => {
72
- const errorResult =
73
- (error && error.response && error.response.data) || "Unhandled error";
74
- this.setState({ error: errorResult });
75
- });
76
- };
77
-
78
- requestLocalityDetails = (publicId) => {
79
- axios
80
- .get(this.requestDetailsUrl, {
81
- params: {
82
- public_id: publicId,
83
- key: Constants.woosmapKey,
84
- language: "fr",
85
- },
86
- })
87
- .then((response) => {
88
- if (this.mounted) {
89
- this.setState({
12
+ constructor(props) {
13
+ super(props);
14
+ const types = [
15
+ { label: tr('Localities'), value: 'locality' },
16
+ { label: tr('Postal codes'), value: 'postal_code' },
17
+ {
18
+ label: tr('Administrative areas (States, regions, ...)'),
19
+ value: 'admin_level',
20
+ },
21
+ { label: tr('Airports'), value: 'airport' },
22
+ { label: tr('Train stations'), value: 'train_station' },
23
+ { label: tr('Metro stations'), value: 'metro_station' },
24
+ { label: tr('Shopping centers'), value: 'shopping' },
25
+ { label: tr('Museums'), value: 'museum' },
26
+ { label: tr('Tourist attractions'), value: 'tourist_attraction' },
27
+ { label: tr('Amusement parks'), value: 'amusement_park' },
28
+ { label: tr('Art galleries'), value: 'art_gallery' },
29
+ { label: tr('Zoos'), value: 'zoo' },
30
+ ];
31
+ this.state = {
32
+ localities: null,
33
+ selectedLocality: null,
90
34
  error: null,
91
- selectedLocality: response.data.result,
92
- });
93
- }
94
- })
95
- .catch((error) => {
96
- const errorResult =
97
- (error && error.response && error.response.data) || "Unhandled error";
98
- this.setState({ error: errorResult });
99
- });
100
- };
101
-
102
- getRequestparams = () => {
103
- const { input, language, localitiesTypes, countries, selectedLocality } =
104
- this.state;
105
- if (selectedLocality) {
106
- return {
107
- key: Constants.woosmapKey,
108
- public_id: selectedLocality.public_id,
109
- };
35
+ input: '',
36
+ localitiesTypes: [{ label: 'Address', value: 'address' }],
37
+ countries: [{ label: 'FR', value: 'fr' }],
38
+ language: 'fr',
39
+ };
40
+ this.types = types.map((item) => ({
41
+ label: item.label,
42
+ value: item.value,
43
+ }));
44
+ this.mounted = true;
45
+ this.viewport = null;
46
+ this.requestUrl = 'https://api.woosmap.com/localities/autocomplete/';
47
+ this.requestDetailsUrl = 'https://api.woosmap.com/localities/details/';
48
+ this.inputRef = React.createRef();
110
49
  }
111
- return {
112
- key: Constants.woosmapKey,
113
- input,
114
- language,
115
- types: localitiesTypes.map((item) => item.value).join("|"),
116
- components: countries.map((item) => `country:${item.value}`).join("|"),
117
- };
118
- };
119
50
 
120
- selectLocality = (locality) => {
121
- if (locality) {
122
- this.requestLocalityDetails(locality.public_id);
123
- } else {
124
- this.setState({
125
- error: null,
126
- selectedLocality: null,
127
- });
51
+ componentDidMount() {
52
+ this.requestLocalities();
128
53
  }
129
- };
130
-
131
- getHighlightedLocalityDesc = (locality) => {
132
- let { description } = locality;
133
54
 
134
- if (
135
- locality.matched_substrings &&
136
- locality.matched_substrings.description
137
- ) {
138
- for (
139
- let j = locality.matched_substrings.description.length - 1;
140
- j >= 0;
141
- j--
142
- ) {
143
- const match = locality.matched_substrings.description[j];
144
- description = `${description.substring(
145
- 0,
146
- match.offset,
147
- )}<span class="localities-matched">${description.substring(
148
- match.offset,
149
- match.offset + match.length,
150
- )}</span>${description.substring(match.offset + match.length)}`;
151
- }
55
+ componentWillUnmount() {
56
+ this.mounted = false;
152
57
  }
153
- // eslint-disable-next-line react/no-danger
154
- return <div dangerouslySetInnerHTML={{ __html: description }} />;
155
- };
156
58
 
157
- renderHeaderFilters = () => {
158
- const inputFilter = {
159
- label: "Saisir une adresse française",
160
- component: (
161
- <LocalitiesAutocomplete
162
- inputRef={this.inputRef}
163
- woosmapKey={Constants.woosmapKey}
164
- placeholder="Saisir une adresse"
165
- defaultLocality={this.defaultOrigin}
166
- language="fr"
167
- components="country:fr"
168
- types="address"
169
- callback={this.selectLocality}
170
- />
171
- ),
59
+ requestLocalities = () => {
60
+ axios
61
+ .get(this.requestUrl, {
62
+ params: this.getRequestparams(),
63
+ })
64
+ .then((response) => {
65
+ if (this.mounted) {
66
+ this.setState({
67
+ localities: response.data,
68
+ error: null,
69
+ });
70
+ }
71
+ })
72
+ .catch((error) => {
73
+ const errorResult = (error && error.response && error.response.data) || 'Unhandled error';
74
+ this.setState({ error: errorResult });
75
+ });
172
76
  };
173
- return [inputFilter];
174
- };
175
77
 
176
- renderFooterFilters = () => [];
78
+ requestLocalityDetails = (publicId) => {
79
+ axios
80
+ .get(this.requestDetailsUrl, {
81
+ params: {
82
+ public_id: publicId,
83
+ key: Constants.woosmapKey,
84
+ language: 'fr',
85
+ },
86
+ })
87
+ .then((response) => {
88
+ if (this.mounted) {
89
+ this.setState({
90
+ error: null,
91
+ selectedLocality: response.data.result,
92
+ });
93
+ }
94
+ })
95
+ .catch((error) => {
96
+ const errorResult = (error && error.response && error.response.data) || 'Unhandled error';
97
+ this.setState({ error: errorResult });
98
+ });
99
+ };
177
100
 
178
- renderAddress = () => {
179
- const { selectedLocality } = this.state;
180
- let addressComponents = [];
181
- const hasComponents =
182
- selectedLocality && selectedLocality.address_components;
183
- if (hasComponents) {
184
- addressComponents = selectedLocality.address_components;
185
- }
186
- let shippingAddress = "";
187
- let postcode = "";
188
- let locality = "";
189
- let country = "";
190
- addressComponents.forEach((component) => {
191
- const [componentType] = component.types;
192
- switch (componentType) {
193
- case "street_number": {
194
- shippingAddress = `${component.long_name} ${shippingAddress}`;
195
- break;
196
- }
197
- case "route": {
198
- shippingAddress += component.short_name;
199
- break;
101
+ getRequestparams = () => {
102
+ const { input, language, localitiesTypes, countries, selectedLocality } = this.state;
103
+ if (selectedLocality) {
104
+ return {
105
+ key: Constants.woosmapKey,
106
+ public_id: selectedLocality.public_id,
107
+ };
200
108
  }
201
- case "postal_codes": {
202
- postcode = `${component.long_name}${postcode}`;
203
- break;
204
- }
205
- case "postal_code_suffix": {
206
- postcode = `${postcode}-${component.long_name}`;
207
- break;
109
+ return {
110
+ key: Constants.woosmapKey,
111
+ input,
112
+ language,
113
+ types: localitiesTypes.map((item) => item.value).join('|'),
114
+ components: countries.map((item) => `country:${item.value}`).join('|'),
115
+ };
116
+ };
117
+
118
+ selectLocality = (locality) => {
119
+ if (locality) {
120
+ this.requestLocalityDetails(locality.public_id);
121
+ } else {
122
+ this.setState({
123
+ error: null,
124
+ selectedLocality: null,
125
+ });
208
126
  }
209
- case "locality":
210
- locality = component.long_name;
211
- break;
212
- case "country": {
213
- country = component.long_name;
214
- break;
127
+ };
128
+
129
+ getHighlightedLocalityDesc = (locality) => {
130
+ let { description } = locality;
131
+
132
+ if (locality.matched_substrings && locality.matched_substrings.description) {
133
+ for (let j = locality.matched_substrings.description.length - 1; j >= 0; j--) {
134
+ const match = locality.matched_substrings.description[j];
135
+ description = `${description.substring(
136
+ 0,
137
+ match.offset
138
+ )}<span class="localities-matched">${description.substring(
139
+ match.offset,
140
+ match.offset + match.length
141
+ )}</span>${description.substring(match.offset + match.length)}`;
142
+ }
215
143
  }
216
- default:
217
- break;
218
- }
219
- });
144
+ // eslint-disable-next-line react/no-danger
145
+ return <div dangerouslySetInnerHTML={{ __html: description }} />;
146
+ };
220
147
 
221
- return (
222
- <div className="demo--localities--uk__formcontainer">
223
- {!hasComponents && (
224
- // eslint-disable-next-line jsx-a11y/interactive-supports-focus
225
- <div
226
- role="button"
227
- className="overlay"
228
- onClick={() => {
229
- this.inputRef.current.focus();
230
- }}
231
- />
232
- )}
233
- <Input
234
- label="Numéro et nom de rue"
235
- placeholder="Numéro et nom de rue"
236
- value={shippingAddress}
237
- onChange={() => {}}
238
- />
239
- <Input
240
- label="Ville"
241
- value={locality}
242
- placeholder="Ville"
243
- onChange={() => {}}
244
- />
245
- <div className="demo__input-container--inline">
246
- <Input
247
- className="fullw"
248
- label="Code postal"
249
- placeholder="Postal code"
250
- value={postcode}
251
- onChange={() => {}}
252
- />
253
- </div>
254
- <Input
255
- label="Pays"
256
- placeholder="Pays"
257
- value={country}
258
- onChange={() => {}}
259
- />
260
- </div>
261
- );
262
- };
148
+ renderHeaderFilters = () => {
149
+ const inputFilter = {
150
+ label: 'Saisir une adresse française',
151
+ component: (
152
+ <LocalitiesAutocomplete
153
+ inputRef={this.inputRef}
154
+ woosmapKey={Constants.woosmapKey}
155
+ placeholder="Saisir une adresse"
156
+ defaultLocality={this.defaultOrigin}
157
+ language="fr"
158
+ components="country:fr"
159
+ types="address"
160
+ callback={this.selectLocality}
161
+ />
162
+ ),
163
+ };
164
+ return [inputFilter];
165
+ };
166
+
167
+ renderFooterFilters = () => [];
263
168
 
264
- render() {
265
- const { localities, error, selectedLocality } = this.state;
266
- return (
267
- <Demo
268
- noheader
269
- id="localities-demo-fr"
270
- className="demo--localities--fr"
271
- footerFilters={this.renderFooterFilters()}
272
- headerFilters={this.renderHeaderFilters()}
273
- request={selectedLocality ? this.requestDetailsUrl : this.requestUrl}
274
- params={this.getRequestparams()}
275
- referer="http://localhost/"
276
- response={
277
- error || selectedLocality ? { result: selectedLocality } : localities
169
+ renderAddress = () => {
170
+ const { selectedLocality } = this.state;
171
+ let addressComponents = [];
172
+ const hasComponents = selectedLocality && selectedLocality.address_components;
173
+ if (hasComponents) {
174
+ addressComponents = selectedLocality.address_components;
278
175
  }
279
- result={this.renderAddress()}
280
- />
281
- );
282
- }
176
+ let shippingAddress = '';
177
+ let postcode = '';
178
+ let locality = '';
179
+ let country = '';
180
+ addressComponents.forEach((component) => {
181
+ const [componentType] = component.types;
182
+ switch (componentType) {
183
+ case 'street_number': {
184
+ shippingAddress = `${component.long_name} ${shippingAddress}`;
185
+ break;
186
+ }
187
+ case 'route': {
188
+ shippingAddress += component.short_name;
189
+ break;
190
+ }
191
+ case 'postal_codes': {
192
+ postcode = `${component.long_name}${postcode}`;
193
+ break;
194
+ }
195
+ case 'postal_code_suffix': {
196
+ postcode = `${postcode}-${component.long_name}`;
197
+ break;
198
+ }
199
+ case 'locality':
200
+ locality = component.long_name;
201
+ break;
202
+ case 'country': {
203
+ country = component.long_name;
204
+ break;
205
+ }
206
+ default:
207
+ break;
208
+ }
209
+ });
210
+
211
+ return (
212
+ <div className="demo--localities--uk__formcontainer">
213
+ {!hasComponents && (
214
+ // eslint-disable-next-line jsx-a11y/interactive-supports-focus
215
+ <div
216
+ role="button"
217
+ className="overlay"
218
+ onClick={() => {
219
+ this.inputRef.current.focus();
220
+ }}
221
+ />
222
+ )}
223
+ <Input
224
+ label="Numéro et nom de rue"
225
+ placeholder="Numéro et nom de rue"
226
+ value={shippingAddress}
227
+ onChange={() => {}}
228
+ />
229
+ <Input label="Ville" value={locality} placeholder="Ville" onChange={() => {}} />
230
+ <div className="demo__input-container--inline">
231
+ <Input
232
+ className="fullw"
233
+ label="Code postal"
234
+ placeholder="Postal code"
235
+ value={postcode}
236
+ onChange={() => {}}
237
+ />
238
+ </div>
239
+ <Input label="Pays" placeholder="Pays" value={country} onChange={() => {}} />
240
+ </div>
241
+ );
242
+ };
243
+
244
+ render() {
245
+ const { localities, error, selectedLocality } = this.state;
246
+ return (
247
+ <Demo
248
+ noheader
249
+ id="localities-demo-fr"
250
+ className="demo--localities--fr"
251
+ footerFilters={this.renderFooterFilters()}
252
+ headerFilters={this.renderHeaderFilters()}
253
+ request={selectedLocality ? this.requestDetailsUrl : this.requestUrl}
254
+ params={this.getRequestparams()}
255
+ referer="http://localhost/"
256
+ response={error || selectedLocality ? { result: selectedLocality } : localities}
257
+ result={this.renderAddress()}
258
+ />
259
+ );
260
+ }
283
261
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import LocalitiesFRAddressDemo from '@/components/Demo/LocalitiesFRAddressDemo';
3
- import { changeLanguage } from '@/components/utils/locale';
2
+ import LocalitiesFRAddressDemo from './LocalitiesFRAddressDemo';
3
+ import { changeLanguage } from '../utils/locale';
4
4
 
5
5
  const Story = {
6
6
  title: 'demo/LocalitiesFRAddress',