@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.
- package/.eslintrc +0 -10
- package/.storybook/main.js +0 -7
- package/package.json +3 -11
- package/src/components/Button/Button.js +2 -2
- package/src/components/Button/Button.stories.js +5 -5
- package/src/components/Button/Button.test.js +1 -1
- package/src/components/Button/ButtonSwitch.js +1 -1
- package/src/components/Button/ButtonWithDropdown.js +3 -3
- package/src/components/Button/ButtonWithDropdown.test.js +1 -1
- package/src/components/Card/Card.js +29 -29
- package/src/components/Card/Card.stories.js +6 -6
- package/src/components/Card/Card.test.js +1 -1
- package/src/components/Card/SimpleCard.js +2 -2
- package/src/components/Card/SimpleCard.styl +2 -2
- package/src/components/Card/SimpleCard.test.js +1 -1
- package/src/components/CodeSnippet/CodeSnippet.stories.js +1 -1
- package/src/components/CodeSnippet/CodeSnippet.test.js +1 -1
- package/src/components/CopyClipboardButton/CopyClipboardButton.js +3 -3
- package/src/components/CopyClipboardButton/CopyToClipboard.stories.js +1 -1
- package/src/components/CopyClipboardButton/CopyToClipboard.test.js +1 -1
- package/src/components/DateTime/DateTime.stories.js +1 -1
- package/src/components/DateTime/DateTime.test.js +1 -1
- package/src/components/Demo/AddressDemo.js +10 -10
- package/src/components/Demo/AddressDemo.stories.js +1 -1
- package/src/components/Demo/AutocompleteAddressDemo.js +10 -10
- package/src/components/Demo/AutocompleteAddressDemo.stories.js +2 -2
- package/src/components/Demo/DistanceDemo.js +12 -12
- package/src/components/Demo/DistanceDemo.stories.js +1 -1
- package/src/components/Demo/DistanceDemo.test.js +1 -1
- package/src/components/Demo/GeolocationDemo.js +7 -7
- package/src/components/Demo/GeolocationDemo.stories.js +1 -1
- package/src/components/Demo/GeolocationDemo.test.js +1 -1
- package/src/components/Demo/LocalitiesAddressDemo.js +8 -8
- package/src/components/Demo/LocalitiesAddressDemo.stories.js +1 -1
- package/src/components/Demo/LocalitiesAllDemo.js +5 -5
- package/src/components/Demo/LocalitiesAllDemo.stories.js +1 -1
- package/src/components/Demo/LocalitiesDemo.js +10 -10
- package/src/components/Demo/LocalitiesDemo.stories.js +1 -1
- package/src/components/Demo/LocalitiesFRAddressDemo.js +239 -261
- package/src/components/Demo/LocalitiesFRAddressDemo.stories.js +2 -2
- package/src/components/Demo/LocalitiesUKAddressDemo.js +271 -294
- package/src/components/Demo/LocalitiesUKAddressDemo.stories.js +1 -1
- package/src/components/Demo/MapDemo.js +231 -233
- package/src/components/Demo/MapDemo.stories.js +1 -1
- package/src/components/Demo/SearchDemo.js +9 -9
- package/src/components/Demo/SearchDemo.stories.js +1 -1
- package/src/components/Demo/SearchDemo.test.js +1 -1
- package/src/components/Demo/Showcase.stories.js +7 -7
- package/src/components/Demo/SkeletonDemo.js +8 -8
- package/src/components/Demo/SkeletonDemo.stories.js +2 -2
- package/src/components/Demo/SkeletonDemo.test.js +2 -2
- package/src/components/Demo/W3WDemo.js +9 -9
- package/src/components/Demo/W3WDemo.stories.js +2 -2
- package/src/components/Dropdown/Dropdown.js +4 -4
- package/src/components/Dropdown/Dropdown.stories.js +1 -1
- package/src/components/Dropdown/Dropdown.test.js +1 -1
- package/src/components/DynamicTag/DynamicTag.js +5 -5
- package/src/components/DynamicTag/DynamicTag.stories.js +1 -1
- package/src/components/DynamicTag/DynamicTag.test.js +1 -1
- package/src/components/Flash/Flash.js +1 -1
- package/src/components/Flash/Flash.stories.js +1 -1
- package/src/components/Flash/Flash.test.js +1 -1
- package/src/components/Icon/Icon.js +409 -409
- package/src/components/Icon/Icon.stories.js +1 -1
- package/src/components/Icon/Icon.test.js +1 -1
- package/src/components/Icon/WebSiteIcon.js +231 -231
- package/src/components/InfoMessage/Flash.js +1 -1
- package/src/components/InfoMessage/InfoMessage.js +2 -2
- package/src/components/InfoMessage/InfoMessage.stories.js +1 -1
- package/src/components/InfoMessage/InfoMessage.test.js +1 -1
- package/src/components/Input/Input.js +2 -2
- package/src/components/Input/Input.password.test.js +1 -1
- package/src/components/Input/Input.stories.js +1 -1
- package/src/components/Input/Input.test.js +1 -1
- package/src/components/Label/Label.js +1 -1
- package/src/components/Label/Label.stories.js +1 -1
- package/src/components/Label/Label.test.js +1 -1
- package/src/components/Map/InfoWindow.test.js +1 -1
- package/src/components/Map/Map.stories.js +3 -3
- package/src/components/Map/Marker.test.js +1 -1
- package/src/components/Map/drawOnMap.test.js +2 -10
- package/src/components/Map/marker.styl +2 -2
- package/src/components/Modal/ConfirmationModal.js +2 -2
- package/src/components/Modal/ConfirmationModal.test.js +1 -1
- package/src/components/Modal/Modal.js +6 -6
- package/src/components/Modal/Modal.stories.js +3 -3
- package/src/components/Modal/Modal.test.js +1 -1
- package/src/components/OfflineChatBot/OfflineChatBot.js +4 -4
- package/src/components/OfflineChatBot/OfflineChatBot.stories.js +2 -2
- package/src/components/Panel/Panel.js +2 -2
- package/src/components/Panel/Panel.stories.js +2 -2
- package/src/components/Panel/Panel.test.js +1 -1
- package/src/components/PasswordStrengthBar/PasswordStrengthBar.stories.js +1 -1
- package/src/components/PasswordStrengthBar/PasswordStrengthBar.test.js +1 -1
- package/src/components/Popover/ConfirmationPopover.js +3 -3
- package/src/components/Popover/ConfirmationPopover.test.js +1 -1
- package/src/components/Popover/Popover.js +1 -1
- package/src/components/Popover/Popover.stories.js +3 -3
- package/src/components/Popover/Popover.test.js +2 -2
- package/src/components/PricingSlider/PricingData.js +94 -113
- package/src/components/PricingSlider/PricingSimulator.js +132 -90
- package/src/components/PricingSlider/PricingSimulator.stories.js +1 -1
- package/src/components/PricingSlider/PricingSlider.js +9 -10
- package/src/components/ProgressBar/ProgressBar.js +1 -1
- package/src/components/ProgressBar/ProgressBar.stories.js +1 -1
- package/src/components/ProgressBar/ProgressBar.test.js +1 -1
- package/src/components/ScrollBar/ScrollBar.stories.js +1 -1
- package/src/components/ScrollBar/ScrollBar.test.js +1 -1
- package/src/components/Select/Select.stories.js +4 -4
- package/src/components/Select/TagSelect.test.js +1 -1
- package/src/components/ServiceMessage/ServiceMessage.js +1 -1
- package/src/components/ServiceMessage/ServiceMessage.stories.js +2 -2
- package/src/components/SnackBar/SnackBar.js +2 -2
- package/src/components/SnackBar/SnackBar.stories.js +3 -3
- package/src/components/SnackBar/SnackBar.test.js +3 -3
- package/src/components/SnackBar/withSnackBar.js +1 -1
- package/src/components/Stepper/Stepper.js +2 -2
- package/src/components/Stepper/Stepper.stories.js +1 -1
- package/src/components/Switch/Switch.stories.js +1 -1
- package/src/components/Switch/Switch.test.js +1 -1
- package/src/components/Tab/Tab.js +1 -1
- package/src/components/Tab/Tab.stories.js +1 -1
- package/src/components/Tooltip/Tooltip.stories.js +1 -1
- package/src/components/Tooltip/Tooltip.test.js +1 -1
- package/src/components/UseCase/UseCase.js +9 -9
- package/src/components/UseCase/UseCase.stories.js +4 -4
- package/src/components/UseCase/UseCase.styl +8 -8
- package/src/components/Woosmap/AddressAutocomplete.js +3 -3
- package/src/components/Woosmap/LocalitiesAutocomplete.js +1 -1
- package/src/components/Woosmap/Woosmap.stories.js +3 -3
- package/src/components/utils/Script.test.js +1 -1
- package/src/components/utils/locale.js +2 -2
- package/src/components/withClickOutside/withClickOutside.test.js +1 -1
- package/src/components/withFormValidation/withFormValidation.js +2 -2
- package/src/components/withFormValidation/withFormValidation.stories.js +2 -2
- package/src/components/withFormValidation/withFormValidation.test.js +2 -2
- package/src/index.js +61 -61
- package/src/locales/en/translation.json +143 -128
- package/src/locales/fr/translation.json +143 -128
- package/src/styles/commons/flags.styl +1 -1
- package/src/styles/console/button.styl +3 -3
- package/src/styles/console/{pricing-slider.styl → pricing-slider-back.styl} +48 -21
- package/src/styles/style-console.styl +1 -2
- package/src/website.js +25 -25
- package/craco.config.js +0 -9
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import React, { Component } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import Demo from
|
|
5
|
-
import Button from
|
|
6
|
-
import ButtonGroup from
|
|
7
|
-
import marker from
|
|
8
|
-
import markerAlt from
|
|
9
|
-
import { tr } from
|
|
10
|
-
import Input from
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import Demo from './SkeletonDemo';
|
|
5
|
+
import Button from '../Button/Button';
|
|
6
|
+
import ButtonGroup from '../Button/ButtonGroup';
|
|
7
|
+
import marker from '../../images/marker.png';
|
|
8
|
+
import markerAlt from '../../images/marker-alt.png';
|
|
9
|
+
import { tr } from '../utils/locale';
|
|
10
|
+
import Input from '../Input/Input';
|
|
11
11
|
|
|
12
12
|
export default class MapDemo extends Component {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.state = {
|
|
16
|
+
style: 'default',
|
|
17
|
+
hasStores: false,
|
|
18
|
+
hasPois: true,
|
|
19
|
+
};
|
|
20
|
+
this.map = null;
|
|
21
|
+
this.marker = null;
|
|
22
|
+
this.mounted = true;
|
|
23
|
+
this.viewport = null;
|
|
24
|
+
this.demoRef = React.createRef();
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
componentDidMount() {
|
|
28
|
+
this.displayMap();
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
componentWillUnmount() {
|
|
32
|
+
this.mounted = false;
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
renderCode = () => {
|
|
36
|
+
const { style, hasStores, hasPois } = this.state;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
let styleColor = '';
|
|
39
|
+
if (style === 'grey') {
|
|
40
|
+
styleColor = `
|
|
41
41
|
{featureType: "all", stylers:[{"saturation": -100, "lightness": -30}]},`;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
}
|
|
43
|
+
if (style === 'lightgrey') {
|
|
44
|
+
styleColor = `
|
|
45
45
|
{featureType: "all", stylers:[{"saturation": -100}]},`;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
}
|
|
47
|
+
if (style === 'blue') {
|
|
48
|
+
styleColor = `
|
|
49
49
|
{featureType: "all", stylers:[{"hue": "#4998ff"}, {gamma:0.5}]},`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{featureType: "poi", stylers:[{"visibility":"${hasPois ?
|
|
50
|
+
}
|
|
51
|
+
const styleConf = `[${styleColor}
|
|
52
|
+
{featureType: "poi", stylers:[{"visibility":"${hasPois ? 'on' : 'off'}"}]}
|
|
53
53
|
]`;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const stores = hasStores
|
|
55
|
+
? `
|
|
56
56
|
const storesOverlay = new window.woosmap.map.StoresOverlay({
|
|
57
57
|
breakPoint: 14,
|
|
58
58
|
rules: [],
|
|
@@ -78,9 +78,9 @@ const storesOverlay = new window.woosmap.map.StoresOverlay({
|
|
|
78
78
|
});
|
|
79
79
|
storesOverlay.setMap(map);
|
|
80
80
|
`
|
|
81
|
-
|
|
81
|
+
: '';
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
return `const map = new window.woosmap.map.Map(document.getElementById('map'), {
|
|
84
84
|
styles: ${styleConf},
|
|
85
85
|
center: {
|
|
86
86
|
lat: 51.52,
|
|
@@ -91,216 +91,214 @@ storesOverlay.setMap(map);
|
|
|
91
91
|
|
|
92
92
|
${stores}
|
|
93
93
|
`;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
renderHeaderFilters = () => {
|
|
97
|
-
const { style } = this.state;
|
|
98
|
-
|
|
99
|
-
const styleChoice = {
|
|
100
|
-
key: "usecase",
|
|
101
|
-
label: tr("Choose your style"),
|
|
102
|
-
component: (
|
|
103
|
-
<ButtonGroup isLight key="usecase">
|
|
104
|
-
<Button
|
|
105
|
-
type="group"
|
|
106
|
-
active={style === "default"}
|
|
107
|
-
onClick={() => {
|
|
108
|
-
this.setState({ style: "default" }, this.displayMap);
|
|
109
|
-
}}
|
|
110
|
-
label={tr("Default")}
|
|
111
|
-
/>
|
|
112
|
-
<Button
|
|
113
|
-
type="group"
|
|
114
|
-
active={style === "blue"}
|
|
115
|
-
onClick={() => {
|
|
116
|
-
this.setState({ style: "blue" }, this.displayMap);
|
|
117
|
-
}}
|
|
118
|
-
label={tr("Blue")}
|
|
119
|
-
/>
|
|
120
|
-
<Button
|
|
121
|
-
type="group"
|
|
122
|
-
active={style === "lightgrey"}
|
|
123
|
-
onClick={() => {
|
|
124
|
-
this.setState({ style: "lightgrey" }, this.displayMap);
|
|
125
|
-
}}
|
|
126
|
-
label={tr("Light Grey")}
|
|
127
|
-
/>
|
|
128
|
-
<Button
|
|
129
|
-
type="group"
|
|
130
|
-
active={style === "grey"}
|
|
131
|
-
onClick={() => {
|
|
132
|
-
this.setState({ style: "grey" }, this.displayMap);
|
|
133
|
-
}}
|
|
134
|
-
label={tr("Grey")}
|
|
135
|
-
/>
|
|
136
|
-
</ButtonGroup>
|
|
137
|
-
),
|
|
138
94
|
};
|
|
139
95
|
|
|
140
|
-
|
|
141
|
-
|
|
96
|
+
renderHeaderFilters = () => {
|
|
97
|
+
const { style } = this.state;
|
|
142
98
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
99
|
+
const styleChoice = {
|
|
100
|
+
key: 'usecase',
|
|
101
|
+
label: tr('Choose your style'),
|
|
102
|
+
component: (
|
|
103
|
+
<ButtonGroup isLight key="usecase">
|
|
104
|
+
<Button
|
|
105
|
+
type="group"
|
|
106
|
+
active={style === 'default'}
|
|
107
|
+
onClick={() => {
|
|
108
|
+
this.setState({ style: 'default' }, this.displayMap);
|
|
109
|
+
}}
|
|
110
|
+
label={tr('Default')}
|
|
111
|
+
/>
|
|
112
|
+
<Button
|
|
113
|
+
type="group"
|
|
114
|
+
active={style === 'blue'}
|
|
115
|
+
onClick={() => {
|
|
116
|
+
this.setState({ style: 'blue' }, this.displayMap);
|
|
117
|
+
}}
|
|
118
|
+
label={tr('Blue')}
|
|
119
|
+
/>
|
|
120
|
+
<Button
|
|
121
|
+
type="group"
|
|
122
|
+
active={style === 'lightgrey'}
|
|
123
|
+
onClick={() => {
|
|
124
|
+
this.setState({ style: 'lightgrey' }, this.displayMap);
|
|
125
|
+
}}
|
|
126
|
+
label={tr('Light Grey')}
|
|
127
|
+
/>
|
|
128
|
+
<Button
|
|
129
|
+
type="group"
|
|
130
|
+
active={style === 'grey'}
|
|
131
|
+
onClick={() => {
|
|
132
|
+
this.setState({ style: 'grey' }, this.displayMap);
|
|
133
|
+
}}
|
|
134
|
+
label={tr('Grey')}
|
|
135
|
+
/>
|
|
136
|
+
</ButtonGroup>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
159
139
|
|
|
160
|
-
|
|
161
|
-
label: "",
|
|
162
|
-
key: "stores",
|
|
163
|
-
component: (
|
|
164
|
-
<Input
|
|
165
|
-
label={tr("Display Woosmap Stores overlay")}
|
|
166
|
-
type="checkbox"
|
|
167
|
-
checked={hasStores}
|
|
168
|
-
onChange={(e) => {
|
|
169
|
-
this.setState({ hasStores: e.target.checked }, this.displayMap);
|
|
170
|
-
}}
|
|
171
|
-
/>
|
|
172
|
-
),
|
|
140
|
+
return [styleChoice];
|
|
173
141
|
};
|
|
174
|
-
return [filterPois, filterStores];
|
|
175
|
-
};
|
|
176
142
|
|
|
177
|
-
|
|
178
|
-
|
|
143
|
+
renderFooterFilters = () => {
|
|
144
|
+
const { hasStores, hasPois } = this.state;
|
|
145
|
+
const filterPois = {
|
|
146
|
+
label: '',
|
|
147
|
+
key: 'pois',
|
|
148
|
+
component: (
|
|
149
|
+
<Input
|
|
150
|
+
label={tr('Display Map POIs')}
|
|
151
|
+
type="checkbox"
|
|
152
|
+
checked={hasPois}
|
|
153
|
+
onChange={(e) => {
|
|
154
|
+
this.setState({ hasPois: e.target.checked }, this.displayMap);
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
),
|
|
158
|
+
};
|
|
179
159
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
const filterStores = {
|
|
161
|
+
label: '',
|
|
162
|
+
key: 'stores',
|
|
163
|
+
component: (
|
|
164
|
+
<Input
|
|
165
|
+
label={tr('Display Woosmap Stores overlay')}
|
|
166
|
+
type="checkbox"
|
|
167
|
+
checked={hasStores}
|
|
168
|
+
onChange={(e) => {
|
|
169
|
+
this.setState({ hasStores: e.target.checked }, this.displayMap);
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
),
|
|
173
|
+
};
|
|
174
|
+
return [filterPois, filterStores];
|
|
175
|
+
};
|
|
183
176
|
|
|
184
|
-
|
|
177
|
+
displayMap = () => {
|
|
178
|
+
const { style, hasStores, hasPois } = this.state;
|
|
185
179
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
);
|
|
180
|
+
if (this.timeoutMap) {
|
|
181
|
+
clearTimeout(this.timeoutMap);
|
|
182
|
+
}
|
|
190
183
|
|
|
191
|
-
|
|
192
|
-
this.storesOverlay = new window.woosmap.map.StoresOverlay({
|
|
193
|
-
breakPoint: 14,
|
|
194
|
-
rules: [],
|
|
195
|
-
default: {
|
|
196
|
-
color: "#5586f7",
|
|
197
|
-
size: 8,
|
|
198
|
-
minSize: 1,
|
|
199
|
-
icon: {
|
|
200
|
-
url: marker,
|
|
201
|
-
scaledSize: {
|
|
202
|
-
height: 46,
|
|
203
|
-
width: 30,
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
selectedIcon: {
|
|
207
|
-
url: markerAlt,
|
|
208
|
-
scaledSize: {
|
|
209
|
-
height: 46,
|
|
210
|
-
width: 30,
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
}
|
|
184
|
+
const MapHTMLElement = this.demoRef?.current?.getMap();
|
|
216
185
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
featureType: "point_of_interest",
|
|
220
|
-
stylers: [{ visibility: hasPois ? "on" : "off" }],
|
|
221
|
-
},
|
|
222
|
-
];
|
|
223
|
-
const colorStyle = this.applyStyle(style);
|
|
186
|
+
if (window?.woosmap?.map && MapHTMLElement) {
|
|
187
|
+
window.woosmap.map.config.setApiKey('woos-48c80350-88aa-333e-835a-07f4b658a9a4');
|
|
224
188
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
189
|
+
if (!this.storesOverlay) {
|
|
190
|
+
this.storesOverlay = new window.woosmap.map.StoresOverlay({
|
|
191
|
+
breakPoint: 14,
|
|
192
|
+
rules: [],
|
|
193
|
+
default: {
|
|
194
|
+
color: '#5586f7',
|
|
195
|
+
size: 8,
|
|
196
|
+
minSize: 1,
|
|
197
|
+
icon: {
|
|
198
|
+
url: marker,
|
|
199
|
+
scaledSize: {
|
|
200
|
+
height: 46,
|
|
201
|
+
width: 30,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
selectedIcon: {
|
|
205
|
+
url: markerAlt,
|
|
206
|
+
scaledSize: {
|
|
207
|
+
height: 46,
|
|
208
|
+
width: 30,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
}
|
|
240
214
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
215
|
+
const styles = [
|
|
216
|
+
{
|
|
217
|
+
featureType: 'point_of_interest',
|
|
218
|
+
stylers: [{ visibility: hasPois ? 'on' : 'off' }],
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
const colorStyle = this.applyStyle(style);
|
|
246
222
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
223
|
+
if (colorStyle) {
|
|
224
|
+
styles.push(colorStyle);
|
|
225
|
+
}
|
|
226
|
+
if (!this.map) {
|
|
227
|
+
this.map = new window.woosmap.map.Map(MapHTMLElement, {
|
|
228
|
+
styles,
|
|
229
|
+
center: {
|
|
230
|
+
lat: 51.51,
|
|
231
|
+
lng: -0.12,
|
|
232
|
+
},
|
|
233
|
+
zoom: 15,
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
this.map._style.setMapStyle(styles);
|
|
237
|
+
}
|
|
252
238
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
if (style === "lightgrey") {
|
|
261
|
-
return { featureType: "all", stylers: [{ saturation: -100 }] };
|
|
262
|
-
}
|
|
263
|
-
if (style === "blue") {
|
|
264
|
-
return {
|
|
265
|
-
featureType: "all",
|
|
266
|
-
stylers: [{ hue: "#4998ff" }, { gamma: 0.3 }],
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
return null;
|
|
270
|
-
};
|
|
239
|
+
if (hasStores) {
|
|
240
|
+
this.storesOverlay.setMap(this.map);
|
|
241
|
+
} else {
|
|
242
|
+
this.storesOverlay.setMap(null);
|
|
243
|
+
}
|
|
271
244
|
|
|
272
|
-
|
|
273
|
-
|
|
245
|
+
this.forceUpdate();
|
|
246
|
+
} else {
|
|
247
|
+
this.timeoutMap = setTimeout(this.displayMap, 300);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
274
250
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
251
|
+
applyStyle = (style) => {
|
|
252
|
+
if (style === 'grey') {
|
|
253
|
+
return {
|
|
254
|
+
featureType: 'all',
|
|
255
|
+
stylers: [{ saturation: -100, lightness: -30 }],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (style === 'lightgrey') {
|
|
259
|
+
return { featureType: 'all', stylers: [{ saturation: -100 }] };
|
|
260
|
+
}
|
|
261
|
+
if (style === 'blue') {
|
|
262
|
+
return {
|
|
263
|
+
featureType: 'all',
|
|
264
|
+
stylers: [{ hue: '#4998ff' }, { gamma: 0.3 }],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return null;
|
|
280
268
|
};
|
|
281
269
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
270
|
+
render() {
|
|
271
|
+
const { noheader } = this.props;
|
|
272
|
+
|
|
273
|
+
const headerLabels = {
|
|
274
|
+
title: tr('Map API'),
|
|
275
|
+
desc: tr(
|
|
276
|
+
'Woosmap Map is a vector tiles map based, which guarantees smooth zooming and panning transitions, a mobile-optimised loading and clear rendering at every scale. It provides a worldwide cover, cutting edge details and ability to display 3D buildings at closest/street zoom levels.'
|
|
277
|
+
),
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<Demo
|
|
282
|
+
ref={this.demoRef}
|
|
283
|
+
header={headerLabels}
|
|
284
|
+
id="map-demo"
|
|
285
|
+
className="demo--map"
|
|
286
|
+
footerFilters={this.renderFooterFilters()}
|
|
287
|
+
headerFilters={this.renderHeaderFilters()}
|
|
288
|
+
renderCode={this.renderCode}
|
|
289
|
+
noheader={noheader}
|
|
290
|
+
referer="http://localhost/"
|
|
291
|
+
withMap
|
|
292
|
+
response={null}
|
|
293
|
+
/>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
298
296
|
}
|
|
299
297
|
|
|
300
298
|
MapDemo.defaultProps = {
|
|
301
|
-
|
|
299
|
+
noheader: false,
|
|
302
300
|
};
|
|
303
301
|
|
|
304
302
|
MapDemo.propTypes = {
|
|
305
|
-
|
|
303
|
+
noheader: PropTypes.bool,
|
|
306
304
|
};
|
|
@@ -2,17 +2,17 @@ import axios from 'axios';
|
|
|
2
2
|
import cl from 'classnames';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import markerIcon from '
|
|
6
|
-
import markerIconAlt from '
|
|
7
|
-
import Demo from '
|
|
8
|
-
import Input from '
|
|
9
|
-
import Constants from '
|
|
5
|
+
import markerIcon from '../../images/marker.png';
|
|
6
|
+
import markerIconAlt from '../../images/marker-alt.png';
|
|
7
|
+
import Demo from './SkeletonDemo';
|
|
8
|
+
import Input from '../Input/Input';
|
|
9
|
+
import Constants from '../../Constants';
|
|
10
10
|
/* eslint-disable import/no-named-as-default */
|
|
11
11
|
/* eslint-disable import/no-named-as-default-member */
|
|
12
|
-
import FilterSelect from '
|
|
13
|
-
import LocalitiesAutocomplete from '
|
|
14
|
-
import { tr } from '
|
|
15
|
-
import { createWoosmapMap } from '
|
|
12
|
+
import FilterSelect from '../Select/FilterSelect';
|
|
13
|
+
import LocalitiesAutocomplete from '../Woosmap/LocalitiesAutocomplete';
|
|
14
|
+
import { tr } from '../utils/locale';
|
|
15
|
+
import { createWoosmapMap } from '../Map/drawOnMap';
|
|
16
16
|
import 'resize-observer-polyfill/dist/ResizeObserver.global';
|
|
17
17
|
|
|
18
18
|
export default class SearchDemo extends Component {
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
4
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
5
|
|
|
6
|
-
import SearchDemo from '
|
|
6
|
+
import SearchDemo from './SearchDemo';
|
|
7
7
|
|
|
8
8
|
it('renders a SearchDemo', () => {
|
|
9
9
|
const { container } = render(<SearchDemo />);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { changeLanguage } from '
|
|
3
|
-
import TrackEventContext from '
|
|
4
|
-
import DistanceDemo from '
|
|
5
|
-
import GeolocationDemo from '
|
|
6
|
-
import LocalitiesDemo from '
|
|
7
|
-
import MapDemo from '
|
|
8
|
-
import SearchDemo from '
|
|
2
|
+
import { changeLanguage } from '../utils/locale';
|
|
3
|
+
import TrackEventContext from '../utils/TrackEventContext';
|
|
4
|
+
import DistanceDemo from './DistanceDemo';
|
|
5
|
+
import GeolocationDemo from './GeolocationDemo';
|
|
6
|
+
import LocalitiesDemo from './LocalitiesAllDemo';
|
|
7
|
+
import MapDemo from './MapDemo';
|
|
8
|
+
import SearchDemo from './SearchDemo';
|
|
9
9
|
|
|
10
10
|
const trackEvent = {
|
|
11
11
|
trackEvent: (category, action, label) => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import cl from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import copy from '
|
|
6
|
-
import Constants from '
|
|
7
|
-
import { tr } from '
|
|
8
|
-
import Tab from '
|
|
9
|
-
import CodeSnippet from '
|
|
10
|
-
import uniqueid from '
|
|
11
|
-
import TrackEventContext from '
|
|
12
|
-
import Script from '
|
|
5
|
+
import copy from '../utils/CopyToClipoard';
|
|
6
|
+
import Constants from '../../Constants';
|
|
7
|
+
import { tr } from '../utils/locale';
|
|
8
|
+
import Tab from '../Tab/Tab';
|
|
9
|
+
import CodeSnippet from '../CodeSnippet/CodeSnippet';
|
|
10
|
+
import uniqueid from '../uniqueid';
|
|
11
|
+
import TrackEventContext from '../utils/TrackEventContext';
|
|
12
|
+
import Script from '../utils/Script';
|
|
13
13
|
|
|
14
14
|
const MAP_CLASSNAME = 'map';
|
|
15
15
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import GoogleMapReact from 'google-map-react';
|
|
3
|
-
import Demo from '
|
|
4
|
-
import Input from '
|
|
3
|
+
import Demo from './SkeletonDemo';
|
|
4
|
+
import Input from '../Input/Input';
|
|
5
5
|
|
|
6
6
|
const Story = {
|
|
7
7
|
title: 'demo/Skeleton',
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
|
|
5
|
-
import SkeletonDemo from '
|
|
6
|
-
import Constants from '
|
|
5
|
+
import SkeletonDemo from './SkeletonDemo';
|
|
6
|
+
import Constants from '../../Constants';
|
|
7
7
|
|
|
8
8
|
const mockScript = jest.fn();
|
|
9
9
|
jest.mock(
|
|
@@ -3,15 +3,15 @@ import axios from 'axios';
|
|
|
3
3
|
import cl from 'classnames';
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import Demo from '
|
|
7
|
-
import Input from '
|
|
8
|
-
import Button from '
|
|
9
|
-
import ButtonGroup from '
|
|
10
|
-
import Constants from '
|
|
11
|
-
import { tr } from '
|
|
12
|
-
import markerIcon from '
|
|
13
|
-
import markerIconAlt from '
|
|
14
|
-
import { createWoosmapMap } from '
|
|
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
15
|
|
|
16
16
|
const languages = [
|
|
17
17
|
{ value: 'fr', label: 'French' },
|