@woosmap/ui 3.25.0 → 3.29.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.25.0",
3
+ "version": "3.29.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -210,6 +210,7 @@ export default class DistanceDemo extends Component {
210
210
  }
211
211
 
212
212
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
213
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
213
214
  this.map = createWoosmapMap(this.demoRef.current.getMap());
214
215
  this.requestDistance();
215
216
  } else {
@@ -218,6 +219,9 @@ export default class DistanceDemo extends Component {
218
219
  };
219
220
 
220
221
  localitiesOnChangeCallBack = (type) => (item) => {
222
+ if (!item) {
223
+ return;
224
+ }
221
225
  const newState = {};
222
226
  newState[`${type}Location`] = item ? item.location : {};
223
227
  this.setState(newState, this.requestDistance);
@@ -346,7 +350,7 @@ export default class DistanceDemo extends Component {
346
350
  };
347
351
  return (
348
352
  <>
349
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
353
+ <Script url="https://sdk.woosmap.com/map/map.js" />
350
354
  <Demo
351
355
  id="distance-demo"
352
356
  className="demo--distance"
@@ -180,6 +180,7 @@ export default class GeolocationDemo extends Component {
180
180
  }
181
181
 
182
182
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
183
+ window.woosmap.map.config.setApiKey(Constants.geolocationWoosmapSearchKey);
183
184
  this.map = createWoosmapMap(this.demoRef.current.getMap());
184
185
  this.requestGeolocation();
185
186
  } else {
@@ -211,7 +212,7 @@ export default class GeolocationDemo extends Component {
211
212
  }
212
213
  return (
213
214
  <>
214
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.geolocationWoosmapSearchKey}`} />
215
+ <Script url="https://sdk.woosmap.com/map/map.js" />
215
216
  <Demo
216
217
  className="demo--geolocation"
217
218
  docLink="https://developers.woosmap.com/products/geolocation-api/location/"
@@ -328,6 +328,7 @@ export default class LocalitiesAddressDemo extends Component {
328
328
  }
329
329
 
330
330
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
331
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
331
332
  this.map = createWoosmapMap(this.demoRef.current.getMap());
332
333
  this.requestAddress();
333
334
  } else {
@@ -344,7 +345,7 @@ export default class LocalitiesAddressDemo extends Component {
344
345
  }
345
346
  return (
346
347
  <>
347
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
348
+ <Script url="https://sdk.woosmap.com/map/map.js" />
348
349
  <Demo
349
350
  noheader={noheader}
350
351
  header={headerLabels}
@@ -195,6 +195,7 @@ export default class LocalitiesDemo extends Component {
195
195
  }
196
196
 
197
197
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
198
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
198
199
  this.map = createWoosmapMap(this.demoRef.current.getMap());
199
200
  this.requestLocalities();
200
201
  } else {
@@ -268,7 +269,7 @@ export default class LocalitiesDemo extends Component {
268
269
  const { noheader, headerLabels, subHeader } = this.props;
269
270
  return (
270
271
  <>
271
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
272
+ <Script url="https://sdk.woosmap.com/map/map.js" />
272
273
  <Demo
273
274
  id="localities-demo"
274
275
  header={headerLabels}
@@ -2,7 +2,6 @@
2
2
  import React, { Component } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Demo from './SkeletonDemo';
5
- import Constants from '../../Constants';
6
5
  import Button from '../Button/Button';
7
6
  import ButtonGroup from '../Button/ButtonGroup';
8
7
  import marker from '../../images/marker.png';
@@ -253,7 +252,7 @@ storesOverlay.setMap(map);
253
252
  };
254
253
  return (
255
254
  <>
256
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
255
+ <Script url="https://sdk.woosmap.com/map/map.js" />
257
256
  <Demo
258
257
  ref={this.demoRef}
259
258
  header={headerLabels}
@@ -73,7 +73,7 @@ export default class SearchDemo extends Component {
73
73
  key: Constants.woosmapKey,
74
74
  lat: location.lat,
75
75
  lng: location.lng,
76
- stores_by_page: maxStore,
76
+ stores_by_page: maxStore || '5',
77
77
  query,
78
78
  };
79
79
  };
@@ -190,6 +190,7 @@ export default class SearchDemo extends Component {
190
190
  if (this.timeoutMap) clearTimeout(this.timeoutMap);
191
191
 
192
192
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
193
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
193
194
  this.map = createWoosmapMap(this.demoRef.current.getMap());
194
195
  this.requestSearch();
195
196
  } else {
@@ -310,7 +311,7 @@ export default class SearchDemo extends Component {
310
311
  };
311
312
  return (
312
313
  <>
313
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
314
+ <Script url="https://sdk.woosmap.com/map/map.js" />
314
315
  <Demo
315
316
  id="search-demo"
316
317
  className="demo--search"
@@ -6,14 +6,14 @@ import Button from '../Button/Button';
6
6
  import ConfirmationPopover from '../Popover/ConfirmationPopover';
7
7
  import withClickOutside from '../withClickOutside/withClickOutside';
8
8
 
9
- function mapChildrenWithProps(children, childrenRefs, closeCb) {
9
+ function mapChildrenWithProps(children, childrenRefs, props) {
10
10
  if (children) {
11
11
  return React.Children.map(children, (child, index) => {
12
12
  if (React.isValidElement(child)) {
13
13
  // only add ref to non functional components
14
14
  return React.cloneElement(child, {
15
15
  ...child.props,
16
- closeCb,
16
+ ...props,
17
17
  ref:
18
18
  !child.type.prototype || (child.type.prototype && child.type.prototype.render)
19
19
  ? (elem) => {
@@ -49,8 +49,8 @@ class DropdownMenu extends Component {
49
49
  };
50
50
 
51
51
  render() {
52
- const { direction, children, closeCb, testId, isSection, ...rest } = this.props;
53
- const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, closeCb);
52
+ const { direction, children, closeCb, onMouseEnter, onMouseLeave, testId, isSection, ...rest } = this.props;
53
+ const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, { closeCb });
54
54
  if (isSection) {
55
55
  return (
56
56
  <div className="dropdown__container">
@@ -58,6 +58,9 @@ class DropdownMenu extends Component {
58
58
  role="menu"
59
59
  className={cl('dropdown__menu', direction, 'dropdown__menu--section')}
60
60
  data-testid={testId}
61
+ tabIndex="-1"
62
+ onMouseEnter={onMouseEnter}
63
+ onMouseLeave={onMouseLeave}
61
64
  {...rest}
62
65
  >
63
66
  {childrenWithProps}
@@ -66,7 +69,14 @@ class DropdownMenu extends Component {
66
69
  );
67
70
  }
68
71
  return (
69
- <ul role="menu" className={cl('dropdown__menu', direction)} data-testid={testId} {...rest}>
72
+ <ul
73
+ role="menu"
74
+ className={cl('dropdown__menu', direction)}
75
+ data-testid={testId}
76
+ {...rest}
77
+ onMouseEnter={onMouseEnter}
78
+ onMouseLeave={onMouseLeave}
79
+ >
70
80
  {childrenWithProps}
71
81
  </ul>
72
82
  );
@@ -76,6 +86,8 @@ class DropdownMenu extends Component {
76
86
  DropdownMenu.defaultProps = {
77
87
  direction: 'sw',
78
88
  closeCb: null,
89
+ onMouseEnter: null,
90
+ onMouseLeave: null,
79
91
  testId: 'dropdown-menu',
80
92
  isSection: false,
81
93
  };
@@ -83,6 +95,8 @@ DropdownMenu.defaultProps = {
83
95
  DropdownMenu.propTypes = {
84
96
  children: PropTypes.node.isRequired,
85
97
  closeCb: PropTypes.func,
98
+ onMouseEnter: PropTypes.func,
99
+ onMouseLeave: PropTypes.func,
86
100
  testId: PropTypes.string,
87
101
  isSection: PropTypes.bool,
88
102
  direction: PropTypes.oneOf(['ne', 'e', 'se', 's', 'sw', 'w']),
@@ -100,7 +114,7 @@ class DropdownMenuSection extends Component {
100
114
 
101
115
  render() {
102
116
  const { title, children, closeCb, ...rest } = this.props;
103
- const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, closeCb);
117
+ const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, { closeCb });
104
118
  return (
105
119
  <div className="dropdown__menu__section">
106
120
  {title && <div className="dropdown__menu__item dropdown__menu__item__title">{title}</div>}
@@ -313,7 +327,7 @@ class Dropdown extends Component {
313
327
  }
314
328
  this.mouseLeaveTimeout = setTimeout(() => {
315
329
  this.setOpen(false);
316
- }, 500);
330
+ }, 300);
317
331
  }
318
332
  };
319
333
 
@@ -351,15 +365,17 @@ class Dropdown extends Component {
351
365
  ...rest
352
366
  } = this.props;
353
367
  const { open } = this.state;
354
- const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, this.handleClickOutside);
368
+ const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, {
369
+ closeCb: this.handleClickOutside,
370
+ onMouseEnter: this.onMouseEnter,
371
+ onMouseLeave: this.onMouseLeave,
372
+ });
355
373
 
356
374
  return (
357
375
  <div
358
376
  ref={openOnMouseEnter ? null : this.clickOutsideRef}
359
377
  className={cl('dropdown', { open }, `dropdown--${size}`, className)}
360
378
  {...rest}
361
- onMouseEnter={this.onMouseEnter}
362
- onMouseLeave={this.onMouseLeave}
363
379
  >
364
380
  <Button
365
381
  disabled={disabled}
@@ -371,6 +387,8 @@ class Dropdown extends Component {
371
387
  iconSize={btnFaceIconSize}
372
388
  label={label}
373
389
  testId={testId}
390
+ onMouseEnter={this.onMouseEnter}
391
+ onMouseLeave={this.onMouseLeave}
374
392
  />
375
393
  {childrenWithProps}
376
394
  </div>
@@ -126,6 +126,7 @@ export const createWoosmapMap = (node) => {
126
126
  ],
127
127
  });
128
128
  } catch (e) {
129
+ console.error('Cound not instantiate a Map');
129
130
  console.error(e);
130
131
  return null;
131
132
  }
package/src/index.js CHANGED
@@ -46,6 +46,8 @@ export { default as withClickOutside } from './components/withClickOutside/withC
46
46
  export { default as withFormValidation } from './components/withFormValidation/withFormValidation';
47
47
  export { default as Marker } from './components/Map/Marker';
48
48
  export { default as LocalitiesDemo } from './components/Demo/LocalitiesDemo';
49
+ export { default as LocalitiesAddressDemo } from './components/Demo/LocalitiesAddressDemo';
50
+ export { default as LocalitiesAllDemo } from './components/Demo/LocalitiesAllDemo';
49
51
  export { default as MerchantDemo } from './components/Demo/MerchantDemo';
50
52
  export { default as GeolocationDemo } from './components/Demo/GeolocationDemo';
51
53
  export { default as DistanceDemo } from './components/Demo/DistanceDemo';
@@ -9,7 +9,8 @@ html
9
9
  body
10
10
  width 100%
11
11
  height 100%
12
-
12
+ body
13
+ font()
13
14
  pre
14
15
  code
15
16
  box-sizing border-box
@@ -1,7 +1 @@
1
1
  @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');
2
-
3
- body
4
- input
5
- textarea
6
- select
7
- font()
@@ -1,3 +1,5 @@
1
+ input
2
+ font()
1
3
  .input
2
4
  width 100%
3
5
  &__container
@@ -1,3 +1,5 @@
1
+ select
2
+ font()
1
3
  .asyncselect__control--is-focused .asyncselect__single-value
2
4
  display none
3
5
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  .demo
3
3
  fullwh()
4
- margin 6rem auto
4
+ margin auto
5
5
  color $secondary
6
6
  .title
7
7
  font-size $title3
@@ -44,6 +44,7 @@
44
44
  .map
45
45
  width 100%
46
46
  height 100%
47
+ background-color $inputDemoBgColor
47
48
  &__results
48
49
  width $demofilterWidth
49
50
  display flex
@@ -93,7 +94,7 @@
93
94
  br($demoBr)
94
95
  background-color $inputDemoBgColor !important
95
96
  border-color $inputDemoBorderColor
96
- font-size $inputFontSizeDemo
97
+ font-size $inputFontSizeDemo !important
97
98
  height $inputDemoHeight
98
99
  padding 0 1rem 0 1rem
99
100
  .mbi
@@ -101,15 +102,15 @@
101
102
  .input
102
103
  &__label
103
104
  inputFont()
104
- font-size $inputFontSizeDemo
105
+ font-size $inputFontSizeDemo !important
105
106
  .select
106
107
  .asyncselect
107
- inputFont()
108
- font-size $inputFontSizeDemo
109
108
  &__control
109
+ inputFont()
110
+ font-size $inputFontSizeDemo !important
110
111
  border-radius $demoBr !important
111
112
  background-color $inputDemoBgColor !important
112
- min-height 2.4rem !important
113
+ min-height $inputDemoHeight !important
113
114
  height auto !important
114
115
  &:not(.select__control--is-focused):not(.asyncselect__control--is-focused)
115
116
  border-color $inputDemoBorderColor !important
@@ -167,7 +168,7 @@
167
168
  &__filters
168
169
  .btn
169
170
  br(.2)
170
- font-size $inputFontSizeDemo
171
+ font-size $inputFontSizeDemo !important
171
172
  line-height 2.2rem
172
173
  padding 0 .8rem
173
174
  height $inputDemoHeight
@@ -193,18 +194,18 @@
193
194
  color $inputDemoBgColor
194
195
  &.language
195
196
  &.transportation
196
- mbi(.4)
197
+ mbi(.6)
197
198
  .btn
198
199
  br(.3)
199
200
  border 0
200
- height 1.9rem
201
- padding .2rem
201
+ height 2.2rem
202
+ padding .4rem
202
203
  &.active
203
204
  background-color $light
204
205
  box-shadow 0 0 .1rem .1rem $activeColorDark
205
206
  .flag
206
- width 2.2rem
207
- height 1.5rem
207
+ width 2.4rem
208
+ height 1.6rem
208
209
  &.transportation
209
210
  .btn
210
211
  height 2.8rem
@@ -232,9 +233,16 @@
232
233
  br(2)
233
234
  inputFont()
234
235
  padding 0 1rem
235
- font-size $inputFontSizeDemo
236
+ font-size $inputFontSizeDemo !important
236
237
  border .1rem solid $activeColor
237
238
  color darken($activeColor, 20%)
239
+ &--address
240
+ &__formcontainer
241
+ mbib(.9)
242
+ .input
243
+ &__label
244
+ margin-bottom .2rem
245
+
238
246
  @media screen and (max-width 769px)
239
247
  .demo__showcase
240
248
  max-height 100%
@@ -1,4 +1 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,900;1,400;0,500;1,600;1,700;1,900&family=Roboto+Mono&display=swap');
2
-
3
- body
4
- font()
1
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;0,900;1,400;0,500;1,600;1,700;1,900&family=Roboto+Mono&display=swap');
@@ -2,6 +2,8 @@
2
2
  width 100%
3
3
  &__container
4
4
  position relative
5
+ inputFont()
6
+ font-size 1.3rem
5
7
  &__label
6
8
  display block
7
9
  margin-bottom 1rem
@@ -47,7 +47,7 @@ trans()
47
47
  transition all .3s
48
48
 
49
49
  inputFont()
50
- font-family 'Roboto Mono', monospace
50
+ font-family $fontFamily2
51
51
  btn()
52
52
  br()
53
53
  flexBtn()
@@ -14,6 +14,8 @@
14
14
  margin-top 1rem
15
15
  color $error
16
16
  &__control
17
+ inputFont()
18
+ font-size 1.3rem
17
19
  min-width $inputMinWidth
18
20
  min-height $inputHeight !important
19
21
  border-radius .6rem !important
@@ -1,4 +1,5 @@
1
1
  $fontFamily = "Poppins", arial, sans-serif
2
+ $fontFamily2 = 'Roboto Mono', monospace
2
3
  $fontSize = 1.8rem
3
4
  $lineHeight = $fontSize * 2 - .8
4
5
  $fontSizeSmall = $fontSize - .2
@@ -1,7 +1 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap');
2
-
3
- body
4
- input
5
- textarea
6
- select
7
- font()
1
+ @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@@ -1,3 +1,5 @@
1
+ input
2
+ font()
1
3
  .input
2
4
  width 100%
3
5
  &__container
@@ -1,3 +1,5 @@
1
+ select
2
+ font()
1
3
  .asyncselect__control--is-focused .asyncselect__single-value
2
4
  display none
3
5