homeflowjs 1.0.52 → 1.0.54

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -10,7 +10,8 @@
10
10
  "properties/property-streetview/**/*",
11
11
  "properties/stamp-duty-calculator/**/*",
12
12
  "search/range-controller/**/*",
13
- "properties/property-results-pagination/**/*"
13
+ "properties/property-results-pagination/**/*",
14
+ "shared/loading-icon/**/*"
14
15
  ],
15
16
  "description": "JavaScript toolkit for Homeflow themes",
16
17
  "main": "index.js",
@@ -18,6 +18,8 @@ const AddressLookupInput = ({
18
18
  required,
19
19
  setSelectedAddress,
20
20
  iconStokeInherit,
21
+ errorMessage,
22
+ onClear,
21
23
  }) => {
22
24
  const [locationQuery, setLocationQuery] = useState('');
23
25
  const [suggestions, setSuggestions] = useState([]);
@@ -35,7 +37,7 @@ const AddressLookupInput = ({
35
37
  if (json.suggestions.length === 0) {
36
38
  setAddress({
37
39
  value: address.value,
38
- error: 'Sorry we couldn\'t find that address',
40
+ error: errorMessage,
39
41
  });
40
42
  }
41
43
  if (json.suggestions.length !== 0) {
@@ -82,6 +84,9 @@ const AddressLookupInput = ({
82
84
  value: {},
83
85
  error: null,
84
86
  });
87
+ if (onClear) {
88
+ onClear();
89
+ }
85
90
  };
86
91
 
87
92
  // If there is an error remove suggestions
@@ -194,6 +199,8 @@ AddressLookupInput.propTypes = {
194
199
  className: PropTypes.string,
195
200
  setSelectedAddress: PropTypes.func,
196
201
  iconStokeInherit: PropTypes.bool,
202
+ errorMessage: PropTypes.node,
203
+ onClear: PropTypes.func,
197
204
  };
198
205
 
199
206
  AddressLookupInput.defaultProps = {
@@ -204,6 +211,8 @@ AddressLookupInput.defaultProps = {
204
211
  className: '',
205
212
  setSelectedAddress: null,
206
213
  iconStokeInherit: true,
214
+ errorMessage: <span className="input__error">Sorry we couldn't find that address</span>,
215
+ onClear: null,
207
216
  };
208
217
 
209
218
  export default AddressLookupInput;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import SearchIcon from '../../shared/search-icon.component';
4
4
  import CloseIcon from '../../shared/close-icon.component';
5
- import LoadingIcon from '../../shared/loading-icon.component';
5
+ import LoadingIcon from '../../shared/loading-icon/loading-icon.component';
6
6
 
7
7
  const ClearButton = ({ address, loading, onClear, iconStokeInherit }) => (
8
8
  <button
@@ -44,9 +44,7 @@ const Input = ({
44
44
  />
45
45
  <ClearButton address={address} loading={loading} onClear={onClear} iconStokeInherit={iconStokeInherit} />
46
46
  </div>
47
- {address?.error && typeof (address.error) === 'string' && (
48
- <span className="input__error">{address.error}</span>
49
- )}
47
+ {address?.error && address.error}
50
48
  </div>
51
49
  );
52
50
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import './loading-icon.styles.scss';
3
4
 
4
5
  const LoadingIcon = ({inherit}) => (
5
6
  <svg role="img" className="loading-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -0,0 +1,13 @@
1
+ @keyframes spin-loading-icon {
2
+ from {
3
+ transform: rotate(0deg);
4
+ }
5
+ to {
6
+ transform: rotate(360deg);
7
+ }
8
+ }
9
+
10
+ .loading-icon {
11
+ transform-origin: center;
12
+ animation: spin-loading-icon 1s linear infinite;
13
+ }