@woosmap/ui 2.58.0 → 3.4.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.
@@ -36,12 +36,12 @@ let isConsoleStyle = false;
36
36
 
37
37
 
38
38
  if (mode === 'prod') {
39
- import('../src/styles/style-website.styl');
39
+ import('../src/styles/style-next-website.styl');
40
40
  import('../src/styles/style-stories.styl');
41
41
  } else {
42
42
  import('../src/styles/style-stories.styl').then((storiesStyl) => {
43
43
  import('../src/styles/style-console.styl').then((consoleStylLoaded) => {
44
- import('../src/styles/style-website.styl').then((websiteStylLoaded) => {
44
+ import('../src/styles/style-next-website.styl').then((websiteStylLoaded) => {
45
45
  const storeGlobals = sessionStorage.getItem('@storybook/preview/store');
46
46
  const globalTheme = storeGlobals ? JSON.parse(storeGlobals).globals.theme : null;
47
47
  const defaultStyle = urlParams.get('theme')|| globalTheme || "Website theme";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "2.58.0",
3
+ "version": "3.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -28,7 +28,7 @@
28
28
  "scripts": {
29
29
  "start": "yarn storybook:dev",
30
30
  "build": "rimraf dist && NODE_ENV=production babel src --out-dir dist --copy-files --no-copy-ignored --ignore '**/*.stories.js,**/*.test.js,**/*.styl' && yarn build-css",
31
- "build-css": "stylus ./src/styles/style-website.styl -o dist && stylus ./src/styles/style-console.styl -o dist && stylus ./src/styles/style-stories.styl -o dist",
31
+ "build-css": "stylus ./src/styles/style-next-website.styl -o dist && stylus ./src/styles/style-console.styl -o dist && stylus ./src/styles/style-stories.styl -o dist",
32
32
  "test": "react-scripts test",
33
33
  "test:generate-output": "react-scripts test --json --outputFile=./.storybook/jest-test-results.json --silent",
34
34
  "prestorybook:dev": "clear && echo \"DOING FIRST TEST RUN\" && CI=true npm run test:generate-output",
@@ -160,78 +160,26 @@ export default class SkeletonDemo extends Component {
160
160
  };
161
161
 
162
162
  render() {
163
- const {
164
- noheader,
165
- header,
166
- id,
167
- result,
168
- withMap,
169
- request,
170
- response,
171
- className,
172
- leftContent,
173
- docLink,
174
- docLabel,
175
- renderCode,
176
- subHeader,
177
- } = this.props;
163
+ const { result, request, response, renderCode } = this.props;
178
164
  const { copied } = this.state;
179
165
  return (
180
- <div className={cl('demo', className)} id={id}>
181
- <div className="demo__header">
182
- {!noheader && (
183
- <div className="demo__presentation">
184
- <div className="demo__title">
185
- <h1>{header.title}</h1>
186
- </div>
187
- <p className="demo__desc">
188
- {header.desc} &nbsp;
189
- <a
190
- rel="noreferrer"
191
- href={docLink || tr('http://developers.woosmap.com')}
192
- target="_blank"
193
- onClick={() => {
194
- const { trackEvent } = this.context;
195
- if (trackEvent) {
196
- trackEvent(
197
- 'Showcase',
198
- "Developer's Documentation",
199
- `User went to the ${header.title} documentation`
200
- );
201
- }
202
- }}
203
- >
204
- {docLabel || tr('Go to documentation')}
205
- </a>
206
- </p>
207
- <div className="demo__desc">{subHeader}</div>
166
+ <article className="demo">
167
+ <div className="demo__content">
168
+ <div className="demo__showcase">
169
+ <div className="demo__filters">
170
+ {this.renderHeaderFilters()}
171
+ {this.renderFooterFilters()}
172
+ </div>
173
+ <div className="demo__map">
174
+ <div className="map" ref={this.mapDivRef} />
208
175
  </div>
209
- )}
210
- </div>
211
- <div className="demo__content-wrapper">
212
- <div className="demo__content-header">
213
- {this.renderHeaderTagline()}
214
- {this.renderHeaderFilters()}
215
176
  </div>
216
- {this.renderFooterFilters()}
217
- <div className="demo__content">
218
- <div className="demo__results__leftcontent">{leftContent}</div>
219
- {result ? (
220
- <div className="demo__results">
221
- <div className="demo__results__header">{tr('Results')}</div>
222
- <div className="demo__results__content">{result}</div>
223
- </div>
224
- ) : null}
225
- {withMap ? (
226
- <div
227
- className={cl('demo__map', {
228
- 'demo__map--small': result,
229
- })}
230
- >
231
- <div className="map" ref={this.mapDivRef} />
232
- </div>
233
- ) : null}
234
- <div className="demo__api">
177
+ <div className="demo__data">
178
+ <div className="demo__results">
179
+ <div className="demo__results__header">{tr('Results')}</div>
180
+ <div className="demo__results__content">{result}</div>
181
+ </div>
182
+ <div className="demo__code">
235
183
  <Tab
236
184
  actions={[
237
185
  {
@@ -271,7 +219,7 @@ export default class SkeletonDemo extends Component {
271
219
  </div>
272
220
  </div>
273
221
  </div>
274
- </div>
222
+ </article>
275
223
  );
276
224
  }
277
225
  }
@@ -279,46 +227,28 @@ export default class SkeletonDemo extends Component {
279
227
  SkeletonDemo.contextType = TrackEventContext;
280
228
 
281
229
  SkeletonDemo.defaultProps = {
282
- id: '',
283
- docLink: null,
284
- docLabel: null,
285
230
  renderCode: null,
286
231
  headerFilters: null,
287
232
  headerTagline: null,
288
233
  footerFilters: null,
289
- leftContent: null,
290
- className: '',
291
234
  result: null,
292
- withMap: false,
293
235
  request: null,
294
236
  response: {},
295
237
  params: {},
296
- noheader: false,
297
238
  referer: '',
298
239
  body: '',
299
240
  method: '',
300
- header: null,
301
- subHeader: null,
302
241
  };
303
242
  SkeletonDemo.propTypes = {
304
- id: PropTypes.string,
305
- docLink: PropTypes.string,
306
243
  renderCode: PropTypes.func,
307
- docLabel: PropTypes.string,
308
244
  params: PropTypes.object,
309
- noheader: PropTypes.bool,
310
- header: PropTypes.object,
311
245
  headerTagline: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
312
- className: PropTypes.string,
313
246
  headerFilters: PropTypes.array,
314
247
  footerFilters: PropTypes.array,
315
248
  result: PropTypes.node,
316
- withMap: PropTypes.bool,
317
- leftContent: PropTypes.node,
318
249
  request: PropTypes.string,
319
250
  referer: PropTypes.string,
320
251
  body: PropTypes.string,
321
252
  method: PropTypes.string,
322
- subHeader: PropTypes.object,
323
253
  response: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
324
254
  };
@@ -1,23 +1,6 @@
1
1
  import React, { Component } from 'react';
2
2
  import cl from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
- import { ReactComponent as Autocomplete } from '../../icons/autocomplete.svg';
5
- import { ReactComponent as Buildings } from '../../icons/buildings.svg';
6
- import { ReactComponent as Battery } from '../../icons/battery.svg';
7
- import { ReactComponent as Cars } from '../../icons/cars.svg';
8
- import { ReactComponent as Github } from '../../icons/github.svg';
9
- import { ReactComponent as Green } from '../../icons/green.svg';
10
- import { ReactComponent as MapHd } from '../../icons/map-hd.svg';
11
- import { ReactComponent as Markers } from '../../icons/markers.svg';
12
- import { ReactComponent as Notification } from '../../icons/notification.svg';
13
- import { ReactComponent as Quote } from '../../icons/quote.svg';
14
- import { ReactComponent as Position } from '../../icons/position.svg';
15
- import { ReactComponent as SaveMoney } from '../../icons/save-money.svg';
16
- import { ReactComponent as Schedule } from '../../icons/schedule.svg';
17
- import { ReactComponent as Security } from '../../icons/security.svg';
18
- import { ReactComponent as World } from '../../icons/world.svg';
19
- import { ReactComponent as Zoom } from '../../icons/zoom.svg';
20
-
21
4
  import { ReactComponent as Access } from '../../icons/access.svg';
22
5
  import { ReactComponent as Add } from '../../icons/add.svg';
23
6
  import { ReactComponent as AddCircle } from '../../icons/add-circle.svg';
@@ -37,10 +20,12 @@ import { ReactComponent as ArrowLink } from '../../icons/arrow-link.svg';
37
20
  import { ReactComponent as Asset } from '../../icons/asset.svg';
38
21
  import { ReactComponent as AssetAddFile } from '../../icons/asset-add-file.svg';
39
22
  import { ReactComponent as AssetAdd } from '../../icons/asset-add.svg';
23
+ import { ReactComponent as Autocomplete } from '../../icons/autocomplete.svg';
40
24
  import { ReactComponent as Bank } from '../../icons/bank.svg';
41
25
  import { ReactComponent as Beaker } from '../../icons/beaker.svg';
42
26
  import { ReactComponent as Bell } from '../../icons/bell.svg';
43
27
  import { ReactComponent as Bookmark } from '../../icons/bookmark.svg';
28
+ import { ReactComponent as Buildings } from '../../icons/buildings.svg';
44
29
  import { ReactComponent as Bulb } from '../../icons/bulb.svg';
45
30
  import { ReactComponent as CaretBotton } from '../../icons/caret-bottom.svg';
46
31
  import { ReactComponent as CaretLeft } from '../../icons/caret-left.svg';
@@ -72,6 +57,7 @@ import { ReactComponent as Exchange } from '../../icons/exchange.svg';
72
57
  import { ReactComponent as Expand } from '../../icons/expand.svg';
73
58
  import { ReactComponent as Export } from '../../icons/export.svg';
74
59
  import { ReactComponent as Flag } from '../../icons/flag.svg';
60
+ import { ReactComponent as Github } from '../../icons/github.svg';
75
61
  import { ReactComponent as Globe } from '../../icons/globe.svg';
76
62
  import { ReactComponent as Home } from '../../icons/home.svg';
77
63
  import { ReactComponent as HomeUser } from '../../icons/home-user.svg';
@@ -93,19 +79,23 @@ import { ReactComponent as Organization } from '../../icons/organization.svg';
93
79
  import { ReactComponent as Organizations } from '../../icons/organizations.svg';
94
80
  import { ReactComponent as Phone } from '../../icons/phone.svg';
95
81
  import { ReactComponent as Platform } from '../../icons/platform.svg';
82
+ import { ReactComponent as Position } from '../../icons/position.svg';
96
83
  import { ReactComponent as ProductActivated } from '../../icons/product-activated.svg';
97
84
  import { ReactComponent as ProductAdd } from '../../icons/product-add.svg';
98
85
  import { ReactComponent as Products } from '../../icons/products.svg';
99
86
  import { ReactComponent as Projects } from '../../icons/projects.svg';
100
87
  import { ReactComponent as Puzzle } from '../../icons/puzzle.svg';
101
88
  import { ReactComponent as Question } from '../../icons/question.svg';
89
+ import { ReactComponent as Quote } from '../../icons/quote.svg';
102
90
  import { ReactComponent as Receipt } from '../../icons/receipt.svg';
91
+ import { ReactComponent as SaveMoney } from '../../icons/save-money.svg';
103
92
  import { ReactComponent as Search } from '../../icons/search.svg';
104
93
  import { ReactComponent as SeePage } from '../../icons/see-page.svg';
105
94
  import { ReactComponent as Settings } from '../../icons/settings.svg';
106
95
  import { ReactComponent as Shield } from '../../icons/shield.svg';
107
96
  import { ReactComponent as Star } from '../../icons/star.svg';
108
97
  import { ReactComponent as StarFilled } from '../../icons/star-filled.svg';
98
+ import { ReactComponent as Stores } from '../../icons/stores.svg';
109
99
  import { ReactComponent as Support } from '../../icons/support.svg';
110
100
  import { ReactComponent as Switch } from '../../icons/switch.svg';
111
101
  import { ReactComponent as Team } from '../../icons/team.svg';
@@ -117,36 +107,19 @@ import { ReactComponent as ViewList } from '../../icons/view-list.svg';
117
107
  import { ReactComponent as ViewMiniCard } from '../../icons/view-mini-card.svg';
118
108
  import { ReactComponent as Warning } from '../../icons/warning.svg';
119
109
  import { ReactComponent as Woosmap } from '../../icons/woosmap.svg';
110
+ import { ReactComponent as World } from '../../icons/world.svg';
120
111
  import { ReactComponent as Address } from '../../icons/address.svg';
121
112
  import { ReactComponent as Distance } from '../../icons/distance.svg';
122
113
  import { ReactComponent as Geolocation } from '../../icons/geolocation.svg';
123
114
  import { ReactComponent as Localities } from '../../icons/localities.svg';
124
115
  import { ReactComponent as Map } from '../../icons/map.svg';
125
116
  import { ReactComponent as Merchant } from '../../icons/merchant.svg';
126
- import { ReactComponent as Stores } from '../../icons/stores.svg';
127
117
  import { ReactComponent as Traffic } from '../../icons/traffic.svg';
128
118
  import { ReactComponent as SocialFacebook } from '../../icons/social-facebook.svg';
129
119
  import { ReactComponent as SocialLinkedin } from '../../icons/social-linkedin.svg';
130
120
  import { ReactComponent as SocialTwitter } from '../../icons/social-twitter.svg';
131
121
 
132
122
  const Icons = {
133
- autocomplete: Autocomplete,
134
- battery: Battery,
135
- buildings: Buildings,
136
- cars: Cars,
137
- github: Github,
138
- green: Green,
139
- 'map-hd': MapHd,
140
- markers: Markers,
141
- notification: Notification,
142
- position: Position,
143
- quote: Quote,
144
- 'save-money': SaveMoney,
145
- schedule: Schedule,
146
- security: Security,
147
- world: World,
148
- zoom: Zoom,
149
-
150
123
  access: Access,
151
124
  add: Add,
152
125
  'add-circle': AddCircle,
@@ -166,10 +139,12 @@ const Icons = {
166
139
  asset: Asset,
167
140
  'asset-add-file': AssetAddFile,
168
141
  'asset-add': AssetAdd,
142
+ autocomplete: Autocomplete,
169
143
  bank: Bank,
170
144
  beaker: Beaker,
171
145
  bell: Bell,
172
146
  bookmark: Bookmark,
147
+ buildings: Buildings,
173
148
  bulb: Bulb,
174
149
  'caret-bottom': CaretBotton,
175
150
  'caret-left': CaretLeft,
@@ -202,6 +177,7 @@ const Icons = {
202
177
  export: Export,
203
178
  flag: Flag,
204
179
  globe: Globe,
180
+ github: Github,
205
181
  home: Home,
206
182
  'home-user': HomeUser,
207
183
  import: Import,
@@ -222,13 +198,16 @@ const Icons = {
222
198
  organizations: Organizations,
223
199
  phone: Phone,
224
200
  platform: Platform,
201
+ position: Position,
225
202
  'product-activated': ProductActivated,
226
203
  'product-add': ProductAdd,
227
204
  products: Products,
228
205
  projects: Projects,
229
206
  puzzle: Puzzle,
230
207
  question: Question,
208
+ quote: Quote,
231
209
  receipt: Receipt,
210
+ 'save-money': SaveMoney,
232
211
  search: Search,
233
212
  'see-page': SeePage,
234
213
  settings: Settings,
@@ -247,6 +226,7 @@ const Icons = {
247
226
  'view-mini-card': ViewMiniCard,
248
227
  warning: Warning,
249
228
  woosmap: Woosmap,
229
+ world: World,
250
230
  address: Address,
251
231
  distance: Distance,
252
232
  geolocation: Geolocation,
@@ -84,46 +84,52 @@ export const woosmapBoundsFromViewport = function woosmapBoundsFromViewport(view
84
84
  );
85
85
  };
86
86
 
87
- export const createWoosmapMap = (node) =>
88
- new window.woosmap.map.Map(node, {
89
- styles: [
90
- {
91
- featureType: 'administrative',
92
- elementType: 'all',
93
- stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 20 }],
94
- },
95
- {
96
- featureType: 'road',
97
- elementType: 'all',
98
- stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 40 }],
99
- },
100
- {
101
- featureType: 'water',
102
- elementType: 'all',
103
- stylers: [{ visibility: 'on' }, { saturation: -10 }, { lightness: 30 }],
104
- },
105
- {
106
- featureType: 'landscape.man_made',
107
- elementType: 'all',
108
- stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 10 }],
109
- },
110
- {
111
- featureType: 'landscape.natural',
112
- elementType: 'all',
113
- stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 60 }],
114
- },
115
- {
116
- featureType: 'poi',
117
- elementType: 'all',
118
- stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
119
- },
120
- {
121
- featureType: 'transit',
122
- elementType: 'all',
123
- stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
124
- },
125
- ],
126
- });
87
+ export const createWoosmapMap = (node) => {
88
+ try {
89
+ return new window.woosmap.map.Map(node, {
90
+ styles: [
91
+ {
92
+ featureType: 'administrative',
93
+ elementType: 'all',
94
+ stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 20 }],
95
+ },
96
+ {
97
+ featureType: 'road',
98
+ elementType: 'all',
99
+ stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 40 }],
100
+ },
101
+ {
102
+ featureType: 'water',
103
+ elementType: 'all',
104
+ stylers: [{ visibility: 'on' }, { saturation: -10 }, { lightness: 30 }],
105
+ },
106
+ {
107
+ featureType: 'landscape.man_made',
108
+ elementType: 'all',
109
+ stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 10 }],
110
+ },
111
+ {
112
+ featureType: 'landscape.natural',
113
+ elementType: 'all',
114
+ stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 60 }],
115
+ },
116
+ {
117
+ featureType: 'poi',
118
+ elementType: 'all',
119
+ stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
120
+ },
121
+ {
122
+ featureType: 'transit',
123
+ elementType: 'all',
124
+ stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
125
+ },
126
+ ],
127
+ });
128
+ } catch (e) {
129
+ console.error(e);
130
+ return null;
131
+ }
132
+ };
127
133
  export class WoosmapMapBoundingBox {
128
134
  constructor(bounds, padding) {
129
135
  this.overlayView = new window.woosmap.map.OverlayView();