@woosmap/ui 4.100.0 → 4.100.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.
- package/.idea/encodings.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +18 -0
- package/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/misc.xml +4 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/ui.iml +15 -0
- package/.idea/vcs.xml +6 -0
- package/package.json +1 -1
- package/src/components/Demo/W3WDemo.js +317 -0
- package/src/components/Demo/W3WDemo.stories.js +12 -0
- package/src/components/Demo/skeletondemo.styl +47 -1
- package/src/components/Icon/Icon.js +2 -0
- package/src/components/Input/Input.js +37 -3
- package/src/components/Input/Input.stories.js +1 -0
- package/src/components/OfflineChatBot/offlinechatbot.styl +9 -2
- package/src/icons/menu-sandwitch.svg +1 -0
- package/src/images/products/product-what3words-sq.png +0 -0
- package/src/images/products/product-what3words.png +0 -0
- package/src/index.js +1 -0
- package/src/styles/commons/sf.styl +10 -0
- package/src/styles/console/button.styl +6 -2
- package/src/styles/website/button.styl +15 -0
- package/src/styles/website/mixins.styl +12 -0
- package/src/styles/website/variables.styl +2 -2
- package/src/website.js +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
6
|
+
<option name="ignoredPackages">
|
|
7
|
+
<value>
|
|
8
|
+
<list size="4">
|
|
9
|
+
<item index="0" class="java.lang.String" itemvalue="Fabric" />
|
|
10
|
+
<item index="1" class="java.lang.String" itemvalue="PyYAML" />
|
|
11
|
+
<item index="2" class="java.lang.String" itemvalue="Jinja2" />
|
|
12
|
+
<item index="3" class="java.lang.String" itemvalue="github3.py" />
|
|
13
|
+
</list>
|
|
14
|
+
</value>
|
|
15
|
+
</option>
|
|
16
|
+
</inspection_tool>
|
|
17
|
+
</profile>
|
|
18
|
+
</component>
|
package/.idea/misc.xml
ADDED
package/.idea/ui.iml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
<component name="TemplatesService">
|
|
9
|
+
<option name="TEMPLATE_FOLDERS">
|
|
10
|
+
<list>
|
|
11
|
+
<option value="$MODULE_DIR$/node_modules/@storybook/core/dist/server/templates" />
|
|
12
|
+
</list>
|
|
13
|
+
</option>
|
|
14
|
+
</component>
|
|
15
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/package.json
CHANGED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import cl from 'classnames';
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Demo from './SkeletonDemo';
|
|
7
|
+
import Input from '../Input/Input';
|
|
8
|
+
import Button from '../Button/Button';
|
|
9
|
+
import ButtonGroup from '../Button/ButtonGroup';
|
|
10
|
+
import Constants from '../../Constants';
|
|
11
|
+
import { tr } from '../utils/locale';
|
|
12
|
+
import markerIcon from '../../images/marker.png';
|
|
13
|
+
import markerIconAlt from '../../images/marker-alt.png';
|
|
14
|
+
import { createWoosmapMap } from '../Map/drawOnMap';
|
|
15
|
+
|
|
16
|
+
const languages = [
|
|
17
|
+
{ value: 'fr', label: 'French' },
|
|
18
|
+
{ value: 'en', label: 'English' },
|
|
19
|
+
{ value: 'es', label: 'Spanish' },
|
|
20
|
+
{ value: 'it', label: 'Italian' },
|
|
21
|
+
{ value: 'de', label: 'German' },
|
|
22
|
+
{ value: 'nl', label: 'Dutch' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export default class W3WDemo extends Component {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
const lang = (typeof window === 'object' && (navigator.language || navigator.userLanguage)) || 'gb';
|
|
29
|
+
const defaultLang = languages.find((item) => lang.startsWith(item.value));
|
|
30
|
+
this.state = {
|
|
31
|
+
w3w: null,
|
|
32
|
+
selectedAddress: null,
|
|
33
|
+
error: null,
|
|
34
|
+
input: '///walnuts.octopus.mount',
|
|
35
|
+
language: (defaultLang || languages[1]).value,
|
|
36
|
+
suggestions: null,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
this.mounted = true;
|
|
40
|
+
this.map = null;
|
|
41
|
+
this.markers = [];
|
|
42
|
+
this.viewport = null;
|
|
43
|
+
this.baseRequestUrl = 'https://develop-api.woosmap.com/what3words/';
|
|
44
|
+
this.demoRef = React.createRef();
|
|
45
|
+
this.overlay = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentDidMount() {
|
|
49
|
+
this.displayMap();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
componentWillUnmount() {
|
|
53
|
+
this.mounted = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
requestW3W = (words) => {
|
|
57
|
+
axios
|
|
58
|
+
.get(`${this.baseRequestUrl}convert-to-address`, {
|
|
59
|
+
params: this.getRequestparams({ words }),
|
|
60
|
+
})
|
|
61
|
+
.then((response) => {
|
|
62
|
+
if (this.mounted) {
|
|
63
|
+
const selectedAddress = response.data.results.length > 0 ? response.data.results[0] : null;
|
|
64
|
+
this.setState(
|
|
65
|
+
{
|
|
66
|
+
w3w: response.data,
|
|
67
|
+
error: null,
|
|
68
|
+
},
|
|
69
|
+
() => this.selectAddress(selectedAddress)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
.catch((error) => {
|
|
74
|
+
const errorResult = (error && error.response && error.response.data) || 'Unhandled error';
|
|
75
|
+
this.setState({ error: errorResult });
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
autosuggestW3W = () => {
|
|
80
|
+
const { input } = this.state;
|
|
81
|
+
axios
|
|
82
|
+
.get(`${this.baseRequestUrl}autosuggest`, {
|
|
83
|
+
params: this.getRequestparams({ input }),
|
|
84
|
+
})
|
|
85
|
+
.then((response) => {
|
|
86
|
+
if (this.mounted) {
|
|
87
|
+
this.setState({
|
|
88
|
+
w3w: null,
|
|
89
|
+
suggestions: response.data,
|
|
90
|
+
error: null,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
.catch((error) => {
|
|
95
|
+
const errorResult = (error && error.response && error.response.data) || 'Unhandled error';
|
|
96
|
+
this.setState({ error: errorResult });
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
getRequestparams = (input) => {
|
|
101
|
+
const { language } = this.state;
|
|
102
|
+
return {
|
|
103
|
+
key: 'woos-0efb08b8-9072-3717-8dfb-a9c776c7ada9',
|
|
104
|
+
language,
|
|
105
|
+
...input,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
selectAddress = (address) => {
|
|
110
|
+
this.setState({ selectedAddress: address }, this.displayOnMap);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
114
|
+
displayOnMap = () => {
|
|
115
|
+
const { w3w, selectedAddress } = this.state;
|
|
116
|
+
if (this.map) {
|
|
117
|
+
if (this.markers.length > 0) {
|
|
118
|
+
this.markers.forEach((marker) => marker.setMap(null));
|
|
119
|
+
this.marker = [];
|
|
120
|
+
}
|
|
121
|
+
w3w.results.forEach((address) => {
|
|
122
|
+
if (address.geometry.location) {
|
|
123
|
+
const marker = new window.woosmap.map.Marker({
|
|
124
|
+
icon: {
|
|
125
|
+
url: address === selectedAddress ? markerIconAlt : markerIcon,
|
|
126
|
+
scaledSize: { height: 46, width: 30 },
|
|
127
|
+
},
|
|
128
|
+
position: address.geometry.location,
|
|
129
|
+
map: this.map,
|
|
130
|
+
});
|
|
131
|
+
this.markers.push(marker);
|
|
132
|
+
marker.addListener('click', () => {
|
|
133
|
+
this.markers.forEach((_marker) => {
|
|
134
|
+
_marker.setIcon({
|
|
135
|
+
url: marker === _marker ? markerIconAlt : markerIcon,
|
|
136
|
+
scaledSize: { height: 46, width: 30 },
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
this.setState({ selectedAddress: address });
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
this.map.setCenter(address.geometry.location);
|
|
143
|
+
this.map.setZoom(18);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
renderAutocompleteList = () => {
|
|
150
|
+
const { w3w, suggestions } = this.state;
|
|
151
|
+
if (w3w) {
|
|
152
|
+
const result = w3w.results.map((address) => {
|
|
153
|
+
const { selectedAddress } = this.state;
|
|
154
|
+
return (
|
|
155
|
+
<li key={address.public_id}>
|
|
156
|
+
<Button
|
|
157
|
+
type="link-flex"
|
|
158
|
+
label={address.formatted_address}
|
|
159
|
+
active={selectedAddress === address}
|
|
160
|
+
onClick={() => this.selectAddress(address)}
|
|
161
|
+
/>
|
|
162
|
+
</li>
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
if (result.length === 0) {
|
|
166
|
+
return (
|
|
167
|
+
<div className="demo__results__content__action">
|
|
168
|
+
{suggestions && (
|
|
169
|
+
<Button
|
|
170
|
+
icon="arrow-left"
|
|
171
|
+
type="secondary"
|
|
172
|
+
size="mini"
|
|
173
|
+
label={tr('Back')}
|
|
174
|
+
onClick={() => this.setState({ w3w: null })}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
<div className="demo__empty">{tr('No address found for this location')}</div>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return (
|
|
182
|
+
<div className="demo__results__content__action">
|
|
183
|
+
{suggestions && (
|
|
184
|
+
<Button
|
|
185
|
+
icon="arrow-left"
|
|
186
|
+
type="secondary"
|
|
187
|
+
size="mini"
|
|
188
|
+
label={tr('Back')}
|
|
189
|
+
onClick={() => this.setState({ w3w: null })}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
<ul>{result}</ul>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
if (suggestions) {
|
|
197
|
+
const result = suggestions.suggestions.map((suggestion) => (
|
|
198
|
+
<li key={`sugg_${suggestion.words}`}>
|
|
199
|
+
<button
|
|
200
|
+
type="button"
|
|
201
|
+
className="btn btn--link-flex btn--two-lines"
|
|
202
|
+
onClick={() => this.requestW3W(suggestion.words)}
|
|
203
|
+
>
|
|
204
|
+
<span>{suggestion.nearestPlace}</span>
|
|
205
|
+
<strong>{suggestion.words}</strong>
|
|
206
|
+
</button>
|
|
207
|
+
</li>
|
|
208
|
+
));
|
|
209
|
+
if (result.length === 0) {
|
|
210
|
+
return <div className="demo__empty">{tr('No locality found')}</div>;
|
|
211
|
+
}
|
|
212
|
+
return <ul>{result}</ul>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return <div className="demo__empty">{tr('No locality found')}</div>;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
displayMap = () => {
|
|
219
|
+
if (this.timeoutMap) {
|
|
220
|
+
clearTimeout(this.timeoutMap);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (window.woosmap && window.woosmap.map && this.demoRef.current) {
|
|
224
|
+
window.woosmap.map.config.setApiKey(Constants.woosmapKey);
|
|
225
|
+
this.map = createWoosmapMap(this.demoRef.current.getMap());
|
|
226
|
+
const { input } = this.state;
|
|
227
|
+
this.requestW3W(input);
|
|
228
|
+
} else {
|
|
229
|
+
this.timeoutMap = setTimeout(this.displayMap, 300);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
renderHeaderFilters = () => {
|
|
234
|
+
const { input } = this.state;
|
|
235
|
+
const { usecaseFilter } = this.props;
|
|
236
|
+
const inputFilter = {
|
|
237
|
+
label: tr('Type in '),
|
|
238
|
+
component: (
|
|
239
|
+
<Input
|
|
240
|
+
value={input}
|
|
241
|
+
autocomplete={false}
|
|
242
|
+
placeholder={tr('Type a locality name...')}
|
|
243
|
+
onChange={(e) => {
|
|
244
|
+
let { value } = e.target;
|
|
245
|
+
if (value.indexOf('///') !== 0) {
|
|
246
|
+
value = `///${value.replaceAll('/', '')}`;
|
|
247
|
+
}
|
|
248
|
+
this.setState({ input: value }, this.autosuggestW3W);
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
),
|
|
252
|
+
};
|
|
253
|
+
return [usecaseFilter, inputFilter];
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
renderFooterFilters = () => {
|
|
257
|
+
const { language, input } = this.state;
|
|
258
|
+
const filterCountries = {
|
|
259
|
+
label: tr('Response language'),
|
|
260
|
+
component: (
|
|
261
|
+
<ButtonGroup className="language" isLight>
|
|
262
|
+
{languages.map((item) => (
|
|
263
|
+
<Button
|
|
264
|
+
size="small"
|
|
265
|
+
type="group"
|
|
266
|
+
key={item.value}
|
|
267
|
+
active={language === item.value}
|
|
268
|
+
onClick={() => {
|
|
269
|
+
this.setState({ language: item.value }, () => this.requestW3W(input));
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
<span className={cl('flag', `flag-${item.value}`)} title={item.label} />
|
|
273
|
+
</Button>
|
|
274
|
+
))}
|
|
275
|
+
</ButtonGroup>
|
|
276
|
+
),
|
|
277
|
+
};
|
|
278
|
+
return [filterCountries];
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
render() {
|
|
282
|
+
const { w3w, error } = this.state;
|
|
283
|
+
const { noheader, headerLabels, subHeader } = this.props;
|
|
284
|
+
return (
|
|
285
|
+
<Demo
|
|
286
|
+
id="w3w-demo"
|
|
287
|
+
header={headerLabels}
|
|
288
|
+
subHeader={subHeader}
|
|
289
|
+
docLink="https://developers.woosmap.com/products/w3w/get-started/"
|
|
290
|
+
className="demo--w3w"
|
|
291
|
+
footerFilters={this.renderFooterFilters()}
|
|
292
|
+
headerFilters={this.renderHeaderFilters()}
|
|
293
|
+
request={this.requestUrl}
|
|
294
|
+
noheader={noheader}
|
|
295
|
+
params={this.getRequestparams()}
|
|
296
|
+
referer="http://localhost/"
|
|
297
|
+
response={error || w3w}
|
|
298
|
+
result={this.renderAutocompleteList()}
|
|
299
|
+
withMap
|
|
300
|
+
ref={this.demoRef}
|
|
301
|
+
/>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
W3WDemo.defaultProps = {
|
|
307
|
+
noheader: false,
|
|
308
|
+
headerLabels: {},
|
|
309
|
+
usecaseFilter: null,
|
|
310
|
+
subHeader: null,
|
|
311
|
+
};
|
|
312
|
+
W3WDemo.propTypes = {
|
|
313
|
+
noheader: PropTypes.bool,
|
|
314
|
+
headerLabels: PropTypes.object,
|
|
315
|
+
usecaseFilter: PropTypes.object,
|
|
316
|
+
subHeader: PropTypes.object,
|
|
317
|
+
};
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
box-shadow 0 .3rem 1rem rgba($secondary, .15)
|
|
23
23
|
.demo--merchant &
|
|
24
24
|
border .1rem solid $light
|
|
25
|
-
|
|
26
25
|
&__showcase
|
|
27
26
|
&__data
|
|
28
27
|
display flex
|
|
@@ -90,6 +89,53 @@
|
|
|
90
89
|
padding $demoPadding
|
|
91
90
|
background-color $light
|
|
92
91
|
overflow-y auto
|
|
92
|
+
.demo--w3w &
|
|
93
|
+
mbib(1.6)
|
|
94
|
+
li
|
|
95
|
+
margin-bottom 1.4rem
|
|
96
|
+
.btn
|
|
97
|
+
color $primary
|
|
98
|
+
&.active
|
|
99
|
+
&:hover
|
|
100
|
+
font-weight bold
|
|
101
|
+
color $logo5 !important
|
|
102
|
+
&--link-flex
|
|
103
|
+
text-decoration none
|
|
104
|
+
.btn__label
|
|
105
|
+
line-height 1.4
|
|
106
|
+
&--two-lines
|
|
107
|
+
&.btn
|
|
108
|
+
mbib(.6)
|
|
109
|
+
color $dark
|
|
110
|
+
display flex
|
|
111
|
+
flex-direction column
|
|
112
|
+
align-items flex-start
|
|
113
|
+
strong
|
|
114
|
+
font-weight 600
|
|
115
|
+
color $primary
|
|
116
|
+
&.active
|
|
117
|
+
&:hover
|
|
118
|
+
font-weight 400
|
|
119
|
+
color $logo5
|
|
120
|
+
strong
|
|
121
|
+
font-weight 600
|
|
122
|
+
color $logo5
|
|
123
|
+
|
|
124
|
+
&__action
|
|
125
|
+
mbib(1.6)
|
|
126
|
+
display flex
|
|
127
|
+
justify-content space-between
|
|
128
|
+
align-items flex-start
|
|
129
|
+
flex-direction column
|
|
130
|
+
.btn
|
|
131
|
+
.icon
|
|
132
|
+
fill none !important
|
|
133
|
+
stroke $dark !important
|
|
134
|
+
&:hover
|
|
135
|
+
.icon
|
|
136
|
+
stroke $light !important
|
|
137
|
+
&__empty
|
|
138
|
+
color $error
|
|
93
139
|
&__code
|
|
94
140
|
inputFont()
|
|
95
141
|
width 100%
|
|
@@ -168,6 +168,7 @@ import { ReactComponent as Manage } from '../../icons/manage.svg';
|
|
|
168
168
|
import { ReactComponent as Marker } from '../../icons/marker.svg';
|
|
169
169
|
import { ReactComponent as Members } from '../../icons/members.svg';
|
|
170
170
|
import { ReactComponent as Member } from '../../icons/member.svg';
|
|
171
|
+
import { ReactComponent as MenuSandwitch } from '../../icons/menu-sandwitch.svg';
|
|
171
172
|
import { ReactComponent as MenuVertical } from '../../icons/menu-vertical.svg';
|
|
172
173
|
import { ReactComponent as Phone } from '../../icons/phone.svg';
|
|
173
174
|
import { ReactComponent as Play } from '../../icons/play.svg';
|
|
@@ -486,6 +487,7 @@ const ConsoleIcons = {
|
|
|
486
487
|
marker: Marker,
|
|
487
488
|
member: Member,
|
|
488
489
|
members: Members,
|
|
490
|
+
'menu-sandwitch': MenuSandwitch,
|
|
489
491
|
'menu-vertical': MenuVertical,
|
|
490
492
|
phone: Phone,
|
|
491
493
|
play: Play,
|
|
@@ -9,7 +9,7 @@ export default class Input extends Component {
|
|
|
9
9
|
super(props);
|
|
10
10
|
this.inputId = uniqueId();
|
|
11
11
|
this.inputRef = React.createRef();
|
|
12
|
-
this.state = { showPassword: false };
|
|
12
|
+
this.state = { showPassword: false, value: null };
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
componentDidMount() {
|
|
@@ -27,6 +27,30 @@ export default class Input extends Component {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
increment = () => {
|
|
31
|
+
const { onChange, value: oldValue, name } = this.props;
|
|
32
|
+
const { value: stateValue } = this.state;
|
|
33
|
+
const theValue = oldValue || stateValue;
|
|
34
|
+
const newValue = theValue ? theValue + 1 : 1;
|
|
35
|
+
if (onChange) {
|
|
36
|
+
onChange({ target: { name, value: newValue } });
|
|
37
|
+
} else {
|
|
38
|
+
this.setState({ value: newValue });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
decrement = () => {
|
|
43
|
+
const { onChange, value: oldValue, name } = this.props;
|
|
44
|
+
const { value: stateValue } = this.state;
|
|
45
|
+
const theValue = oldValue || stateValue;
|
|
46
|
+
const newValue = theValue ? theValue - 1 : 0;
|
|
47
|
+
if (onChange) {
|
|
48
|
+
onChange({ target: { name, value: newValue } });
|
|
49
|
+
} else {
|
|
50
|
+
this.setState({ value: newValue });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
30
54
|
renderInput = () => {
|
|
31
55
|
const {
|
|
32
56
|
type,
|
|
@@ -47,7 +71,7 @@ export default class Input extends Component {
|
|
|
47
71
|
enableTogglePassword,
|
|
48
72
|
} = this.props;
|
|
49
73
|
|
|
50
|
-
const { showPassword } = this.state;
|
|
74
|
+
const { showPassword, value: stateValue } = this.state;
|
|
51
75
|
|
|
52
76
|
let iconSize = size;
|
|
53
77
|
|
|
@@ -82,11 +106,21 @@ export default class Input extends Component {
|
|
|
82
106
|
onFocus,
|
|
83
107
|
onKeyDown: this.onKeyDown,
|
|
84
108
|
type: type === 'password' && showPassword ? 'text' : type,
|
|
85
|
-
value,
|
|
109
|
+
value: value || stateValue,
|
|
86
110
|
size: length,
|
|
87
111
|
disabled,
|
|
88
112
|
onChange,
|
|
89
113
|
})}
|
|
114
|
+
{type === 'number' && (
|
|
115
|
+
<div>
|
|
116
|
+
<button onClick={this.increment} type="button">
|
|
117
|
+
+
|
|
118
|
+
</button>
|
|
119
|
+
<button onClick={this.decrement} type="button">
|
|
120
|
+
-
|
|
121
|
+
</button>
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
90
124
|
{type === 'password' && enableTogglePassword && (
|
|
91
125
|
<span
|
|
92
126
|
onKeyDown={() => ({})}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
border-radius .8rem .8rem 0 0
|
|
18
18
|
color $light
|
|
19
19
|
cursor pointer
|
|
20
|
+
border .1rem solid $light
|
|
21
|
+
border-bottom 0
|
|
20
22
|
&__icon
|
|
21
23
|
max-width 1.7rem
|
|
22
24
|
&__label
|
|
@@ -71,5 +73,10 @@
|
|
|
71
73
|
&__link
|
|
72
74
|
color $primary
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
@media screen and (max-width 767px)
|
|
77
|
+
.sf-chat
|
|
78
|
+
&__button
|
|
79
|
+
br(3)
|
|
80
|
+
border-bottom .1rem solid $light
|
|
81
|
+
position: relative
|
|
82
|
+
bottom 1.2rem
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><line x1="3.707" y1="5.038" x2="20.293" y2="5.038" /><line x1="3.707" y1="12" x2="20.293" y2="12" /><line x1="20.293" y1="18.962" x2="3.707" y2="18.962" /></svg>
|
|
Binary file
|
|
Binary file
|
package/src/index.js
CHANGED
|
@@ -49,6 +49,7 @@ export { default as withClickOutside } from './components/withClickOutside/withC
|
|
|
49
49
|
export { default as withFormValidation } from './components/withFormValidation/withFormValidation';
|
|
50
50
|
export { default as Marker } from './components/Map/Marker';
|
|
51
51
|
export { default as LocalitiesDemo } from './components/Demo/LocalitiesDemo';
|
|
52
|
+
export { default as W3WDemo } from './components/Demo/W3WDemo';
|
|
52
53
|
export { default as LocalitiesCheckoutUKDemo } from './components/Demo/LocalitiesUKAddressDemo';
|
|
53
54
|
export { default as LocalitiesCheckoutFRDemo } from './components/Demo/LocalitiesFRAddressDemo';
|
|
54
55
|
export { default as LocalitiesAddressDemo } from './components/Demo/LocalitiesAddressDemo';
|
|
@@ -5,6 +5,7 @@ body
|
|
|
5
5
|
display block !important
|
|
6
6
|
.helpButton
|
|
7
7
|
right 0
|
|
8
|
+
min-width 17rem
|
|
8
9
|
.uiButton
|
|
9
10
|
trans()
|
|
10
11
|
right 2rem
|
|
@@ -14,6 +15,9 @@ body
|
|
|
14
15
|
min-width 1rem
|
|
15
16
|
text-decoration none
|
|
16
17
|
box-shadow 0 0 .2rem transparent
|
|
18
|
+
border .1rem solid $light
|
|
19
|
+
border-bottom 0
|
|
20
|
+
margin-left auto
|
|
17
21
|
&.helpButtonDisabled
|
|
18
22
|
position fixed
|
|
19
23
|
right 2rem
|
|
@@ -328,5 +332,11 @@ body
|
|
|
328
332
|
display block
|
|
329
333
|
&.smoothScroll
|
|
330
334
|
scroll-behavior smooth
|
|
335
|
+
@media screen and (max-width 767px)
|
|
336
|
+
body
|
|
337
|
+
.embeddedServiceHelpButton
|
|
338
|
+
.helpButton
|
|
339
|
+
.uiButton
|
|
340
|
+
border-bottom 1px solid $light
|
|
331
341
|
// End SF Chat Customization
|
|
332
342
|
|
|
@@ -372,7 +372,11 @@
|
|
|
372
372
|
trans()
|
|
373
373
|
.btn__label
|
|
374
374
|
trans()
|
|
375
|
-
|
|
375
|
+
&--link-flex
|
|
376
|
+
&.active
|
|
377
|
+
color $primary
|
|
378
|
+
.icon
|
|
379
|
+
stroke $primary
|
|
376
380
|
&--has-icon
|
|
377
381
|
&:not(.btn--icon):not(.btn--link):not(.btn--link-primary):not(.btn--link-info):not(.btn--link-flex):not(.btn--link-flex-info):not(.btn--loading):not(.btn--mini):not(.btn--small):not(.btn--large):not(.btn--dropdown-item):not(.btn--tab):not(.btn--sidebar-link):not(.btn--icon-right)
|
|
378
382
|
padding 0 $padding 0 $padding - .6
|
|
@@ -675,7 +679,7 @@
|
|
|
675
679
|
.icon
|
|
676
680
|
margin-right .4rem
|
|
677
681
|
&.btn--has-icon
|
|
678
|
-
padding-left $padding - .
|
|
682
|
+
padding-left $padding - .8
|
|
679
683
|
&.btn--loading
|
|
680
684
|
padding-left $padding - .3
|
|
681
685
|
disableHoverEffect()
|
|
@@ -619,6 +619,21 @@
|
|
|
619
619
|
disableHoverEffect()
|
|
620
620
|
.icon
|
|
621
621
|
sq(3.2)
|
|
622
|
+
&--mini
|
|
623
|
+
buttonMini()
|
|
624
|
+
&:not(.btn--custom-icon-size)
|
|
625
|
+
.icon
|
|
626
|
+
sq(1.6)
|
|
627
|
+
&:not(.btn--icon)
|
|
628
|
+
.icon
|
|
629
|
+
margin-right .4rem
|
|
630
|
+
&.btn--has-icon
|
|
631
|
+
padding-left $padding - 1.6
|
|
632
|
+
&.btn--loading
|
|
633
|
+
padding-left $padding - .3
|
|
634
|
+
disableHoverEffect()
|
|
635
|
+
.icon
|
|
636
|
+
sq(1.6)
|
|
622
637
|
&--group
|
|
623
638
|
btn()
|
|
624
639
|
color $secondary-medium40
|
|
@@ -137,6 +137,18 @@ buttonLarge()
|
|
|
137
137
|
&.btn--link-flex
|
|
138
138
|
height auto
|
|
139
139
|
line-height unset
|
|
140
|
+
buttonMini()
|
|
141
|
+
height $buttonHeightMini
|
|
142
|
+
font-size $buttonFontSizeMini
|
|
143
|
+
line-height $buttonLineHeightMini
|
|
144
|
+
padding $buttonPaddingMini
|
|
145
|
+
&.btn--no-label
|
|
146
|
+
&.btn--link
|
|
147
|
+
&.btn--link-primary
|
|
148
|
+
&.btn--link-info
|
|
149
|
+
&.btn--link-flex
|
|
150
|
+
height auto
|
|
151
|
+
line-height unset
|
|
140
152
|
|
|
141
153
|
fullw()
|
|
142
154
|
width 100%
|
|
@@ -86,8 +86,8 @@ $buttonFontSizeSmall = $fontSize - .1
|
|
|
86
86
|
$buttonLineHeightSmall = $buttonFontSizeSmall * 2
|
|
87
87
|
|
|
88
88
|
$buttonHeightMini = $buttonHeight - 1
|
|
89
|
-
$buttonPaddingMini = 0 $padding - .
|
|
90
|
-
$buttonFontSizeMini = $fontSizeSmall
|
|
89
|
+
$buttonPaddingMini = 0 $padding - 1.2 0 $padding - 1.2
|
|
90
|
+
$buttonFontSizeMini = $fontSizeSmall - .4
|
|
91
91
|
$buttonLineHeightMini = $buttonFontSizeMini * 2
|
|
92
92
|
|
|
93
93
|
$buttonHeightNano = $buttonHeight - 1.4
|
package/src/website.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Popover } from './components/Popover/Popover';
|
|
|
11
11
|
export { default as Select } from './components/Select/Select';
|
|
12
12
|
|
|
13
13
|
export { default as LocalitiesDemo } from './components/Demo/LocalitiesDemo';
|
|
14
|
+
export { default as W3WDemo } from './components/Demo/W3WDemo';
|
|
14
15
|
export { default as LocalitiesCheckoutUKDemo } from './components/Demo/LocalitiesUKAddressDemo';
|
|
15
16
|
export { default as LocalitiesCheckoutFRDemo } from './components/Demo/LocalitiesFRAddressDemo';
|
|
16
17
|
export { default as LocalitiesAddressDemo } from './components/Demo/LocalitiesAddressDemo';
|