@geotrekce/geotrek-rando-widget 0.0.1 → 0.0.2

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.
Files changed (53) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app_7.cjs.entry.js +137 -55
  3. package/dist/cjs/{index-31255e29.js → index-c6f73e30.js} +36 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/assets/departure-arrival.svg +1 -1
  6. package/dist/collection/components/grw-app/grw-app.css +60 -37
  7. package/dist/collection/components/grw-app/grw-app.js +277 -15
  8. package/dist/collection/components/grw-map/grw-map.css +36 -0
  9. package/dist/collection/components/grw-map/grw-map.js +157 -18
  10. package/dist/collection/components/grw-trek-card/grw-trek-card.js +87 -32
  11. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +1 -1
  12. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +87 -32
  13. package/dist/collection/components/grw-treks-list/grw-treks-list.css +3 -12
  14. package/dist/collection/components/grw-treks-list/grw-treks-list.js +46 -4
  15. package/dist/collection/store/grw-trek-provider.js +28 -6
  16. package/dist/collection/store/grw-treks-provider.js +155 -9
  17. package/dist/collection/stories/App.js +31 -1
  18. package/dist/collection/stories/App.stories.js +21 -1
  19. package/dist/collection/stories/TrekCard.js +8 -3
  20. package/dist/collection/stories/TrekCard.stories.js +2 -0
  21. package/dist/collection/stories/TrekDetail.js +8 -3
  22. package/dist/collection/stories/TrekDetail.stories.js +2 -0
  23. package/dist/collection/stories/TrekMap.js +10 -3
  24. package/dist/collection/stories/TrekMap.stories.js +13 -1
  25. package/dist/collection/stories/TreksList.js +16 -3
  26. package/dist/collection/stories/TreksList.stories.js +10 -0
  27. package/dist/collection/stories/TreksMap.js +12 -3
  28. package/dist/collection/stories/TreksMap.stories.js +15 -1
  29. package/dist/components/grw-app.js +39 -6
  30. package/dist/components/grw-map2.js +56 -20
  31. package/dist/components/grw-trek-card2.js +25 -7
  32. package/dist/components/grw-trek-detail2.js +26 -8
  33. package/dist/components/grw-trek-provider2.js +10 -7
  34. package/dist/components/grw-treks-list2.js +10 -4
  35. package/dist/components/grw-treks-provider2.js +26 -11
  36. package/dist/esm/geotrek-rando-widget.js +2 -2
  37. package/dist/esm/grw-app_7.entry.js +137 -55
  38. package/dist/esm/{index-b36f38f5.js → index-7aa9e822.js} +36 -0
  39. package/dist/esm/loader.js +2 -2
  40. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  41. package/dist/geotrek-rando-widget/p-332ba9ab.js +2 -0
  42. package/dist/geotrek-rando-widget/p-b7c66d2d.entry.js +1 -0
  43. package/dist/types/components/grw-app/grw-app.d.ts +21 -2
  44. package/dist/types/components/grw-map/grw-map.d.ts +8 -0
  45. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +3 -1
  46. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +2 -0
  47. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +2 -0
  48. package/dist/types/components.d.ts +70 -0
  49. package/dist/types/store/grw-trek-provider.d.ts +1 -0
  50. package/dist/types/store/grw-treks-provider.d.ts +8 -0
  51. package/package.json +1 -1
  52. package/dist/geotrek-rando-widget/p-f721481d.js +0 -2
  53. package/dist/geotrek-rando-widget/p-fe788eaa.entry.js +0 -1
@@ -1,34 +1,43 @@
1
- .header-container {
1
+ .app-container {
2
+ position: relative;
3
+ height: 100%;
4
+ max-height: 100vh;
5
+ }
6
+
7
+ .header-container,
8
+ .large-view-header-container {
2
9
  display: flex;
3
10
  align-items: center;
4
11
  background-color: var(--color-primary);
5
12
  height: 64px;
6
13
  }
7
- .header-container .title {
14
+ .header-container .title,
15
+ .large-view-header-container .title {
8
16
  color: #ffffff;
9
- font-size: 24px;
10
17
  margin-left: 24px;
11
18
  }
12
- .header-container .arrow-back-icon {
19
+ .header-container .arrow-back-icon,
20
+ .large-view-header-container .arrow-back-icon {
13
21
  width: 48px;
14
22
  height: auto;
15
23
  margin-left: 24px;
16
24
  }
17
- .header-container .arrow-back-icon svg {
25
+ .header-container .arrow-back-icon svg,
26
+ .large-view-header-container .arrow-back-icon svg {
18
27
  cursor: pointer;
19
28
  width: 48px;
20
29
  height: auto;
21
30
  }
22
31
 
23
- .loader-container {
24
- position: absolute;
32
+ .loader-container,
33
+ .large-view-loader-container {
25
34
  display: flex;
26
35
  justify-content: center;
27
36
  align-items: center;
28
- width: 100vw;
29
37
  height: 100%;
30
38
  }
31
- .loader-container .loader {
39
+ .loader-container .loader,
40
+ .large-view-loader-container .loader {
32
41
  width: 48px;
33
42
  height: 48px;
34
43
  border: 5px solid var(--color-primary-tint);
@@ -48,20 +57,22 @@
48
57
  }
49
58
 
50
59
  .content-container {
60
+ position: relative;
51
61
  display: flex;
52
- height: calc(100vh - 64px);
62
+ height: calc(100% - 64px);
53
63
  }
54
64
 
55
65
  .app-treks-list-container,
56
- .app-trek-detail-container {
57
- width: 100vw;
66
+ .app-trek-detail-container,
67
+ .large-view-app-treks-list-container,
68
+ .large-view-app-trek-detail-container {
58
69
  height: 100%;
59
70
  }
60
71
 
61
- .app-map-container {
62
- position: absolute;
63
- width: 100vw;
64
- height: calc(100vh - 64px);
72
+ .app-map-container,
73
+ .large-view-app-map-container {
74
+ width: 100%;
75
+ height: 100%;
65
76
  }
66
77
 
67
78
  .map-visibility-button {
@@ -84,29 +95,41 @@
84
95
  text-align: center;
85
96
  }
86
97
 
87
- @media (min-width: 664px) {
88
- .map-visibility-button {
89
- display: none;
90
- }
91
-
92
- .header-container .title {
93
- font-size: 32px;
94
- }
98
+ .header-container .title {
99
+ font-size: 24px;
100
+ }
95
101
 
96
- .loader-container {
97
- position: relative;
98
- width: 50vw;
99
- }
102
+ .loader-container {
103
+ position: absolute;
104
+ width: 100%;
105
+ }
100
106
 
101
- .app-treks-list-container,
107
+ .app-treks-list-container,
102
108
  .app-trek-detail-container {
103
- width: 50vw;
104
- height: 100%;
105
- }
109
+ width: 100%;
110
+ }
106
111
 
107
- .app-map-container {
108
- position: relative;
109
- width: 50vw;
110
- height: 100%;
111
- }
112
+ .app-map-container {
113
+ position: relative;
114
+ width: 100%;
115
+ position: absolute;
116
+ }
117
+
118
+ .large-view-header-container .title {
119
+ font-size: 32px;
120
+ }
121
+
122
+ .large-view-loader-container {
123
+ position: relative;
124
+ width: 50%;
125
+ }
126
+
127
+ .large-view-app-treks-list-container,
128
+ .large-view-app-trek-detail-container {
129
+ width: 50%;
130
+ }
131
+
132
+ .large-view-app-map-container {
133
+ position: relative;
134
+ width: 50%;
112
135
  }
@@ -1,40 +1,55 @@
1
- import { Component, Host, h, Listen, State, Prop } from '@stencil/core';
1
+ import { Component, Host, h, Listen, State, Prop, Element, Watch } from '@stencil/core';
2
2
  import state from 'store/store';
3
3
  import arrowBackImage from '../../assets/arrow-back.svg';
4
4
  export class GrwApp {
5
5
  constructor() {
6
+ this.showTrek = false;
7
+ this.showMap = false;
8
+ this.isLargeView = false;
6
9
  this.appName = 'Geotrek Rando Widget';
7
10
  this.colorPrimary = '#6b0030';
8
11
  this.colorPrimaryTint = '#d2b2c0';
12
+ this.colorTrekLine = '#6b0030';
13
+ this.colorDepartureIcon = '#006b3b';
14
+ this.colorArrivalIcon = '#85003b';
15
+ this.largeViewSize = 664;
9
16
  }
10
17
  onTrekCardPress(event) {
11
18
  this.currentTrekId = event.detail;
12
19
  this.showTrek = !this.showTrek;
13
20
  }
14
- onWindowResize(event) {
15
- this.showMap = !(event.composedPath()[0].innerWidth < 664);
21
+ onWindowResize() {
22
+ this.handleView();
23
+ }
24
+ watchPropHandler() {
25
+ window.dispatchEvent(new window.Event('resize'));
26
+ }
27
+ componentDidLoad() {
28
+ this.handleView();
16
29
  }
17
30
  onTrekDetailsClose() {
18
31
  this.currentTrekId = null;
19
32
  this.showTrek = !this.showTrek;
20
33
  }
21
- componentWillLoad() {
22
- this.showMap = !(window.innerWidth < 664);
34
+ handleView() {
35
+ this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
36
+ this.showMap = this.isLargeView;
23
37
  }
24
38
  render() {
25
39
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
26
- h("grw-treks-provider", { api: this.api, portals: this.portals },
27
- h("div", { class: "header-container" }, this.showTrek ? h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage }) : h("div", { class: "title" }, this.appName)),
40
+ h("grw-treks-provider", { api: this.api, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }),
41
+ this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, "trek-id": this.currentTrekId }),
42
+ h("div", { class: "app-container" },
43
+ h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage }) : h("div", { class: "title" }, this.appName)),
28
44
  h("div", { class: "content-container" },
29
- h("div", { class: "app-treks-list-container", style: { visibility: this.showTrek ? 'hidden' : 'visible', position: this.showTrek ? 'absolute' : 'relative' } },
30
- h("grw-treks-list", null)),
31
- this.showTrek && !state.currentTrek && (h("div", { class: "loader-container" },
45
+ h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } },
46
+ h("grw-treks-list", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })),
47
+ this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' },
32
48
  h("span", { class: "loader" }))),
33
- this.showTrek && this.currentTrekId && (h("grw-trek-provider", { api: state.api, "trek-id": this.currentTrekId }, state.currentTrek && (h("div", { class: "app-trek-detail-container" },
34
- h("grw-trek-detail", null))))),
35
- h("div", { class: "app-map-container", style: { visibility: this.showMap ? 'visible' : 'hidden' } },
36
- h("grw-map", null))),
37
- h("div", { class: "map-visibility-button" },
49
+ state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' },
50
+ h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint }))),
51
+ h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: this.showMap ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon })),
52
+ h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } },
38
53
  h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
39
54
  }
40
55
  static get is() { return "grw-app"; }
@@ -63,6 +78,91 @@ export class GrwApp {
63
78
  "attribute": "api",
64
79
  "reflect": false
65
80
  },
81
+ "inBbox": {
82
+ "type": "string",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "string",
86
+ "resolved": "string",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [],
93
+ "text": ""
94
+ },
95
+ "attribute": "in-bbox",
96
+ "reflect": false
97
+ },
98
+ "cities": {
99
+ "type": "string",
100
+ "mutable": false,
101
+ "complexType": {
102
+ "original": "string",
103
+ "resolved": "string",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": false,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": ""
111
+ },
112
+ "attribute": "cities",
113
+ "reflect": false
114
+ },
115
+ "districts": {
116
+ "type": "string",
117
+ "mutable": false,
118
+ "complexType": {
119
+ "original": "string",
120
+ "resolved": "string",
121
+ "references": {}
122
+ },
123
+ "required": false,
124
+ "optional": false,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "attribute": "districts",
130
+ "reflect": false
131
+ },
132
+ "structures": {
133
+ "type": "string",
134
+ "mutable": false,
135
+ "complexType": {
136
+ "original": "string",
137
+ "resolved": "string",
138
+ "references": {}
139
+ },
140
+ "required": false,
141
+ "optional": false,
142
+ "docs": {
143
+ "tags": [],
144
+ "text": ""
145
+ },
146
+ "attribute": "structures",
147
+ "reflect": false
148
+ },
149
+ "themes": {
150
+ "type": "string",
151
+ "mutable": false,
152
+ "complexType": {
153
+ "original": "string",
154
+ "resolved": "string",
155
+ "references": {}
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [],
161
+ "text": ""
162
+ },
163
+ "attribute": "themes",
164
+ "reflect": false
165
+ },
66
166
  "portals": {
67
167
  "type": "string",
68
168
  "mutable": false,
@@ -80,6 +180,40 @@ export class GrwApp {
80
180
  "attribute": "portals",
81
181
  "reflect": false
82
182
  },
183
+ "routes": {
184
+ "type": "string",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "string",
188
+ "resolved": "string",
189
+ "references": {}
190
+ },
191
+ "required": false,
192
+ "optional": false,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": ""
196
+ },
197
+ "attribute": "routes",
198
+ "reflect": false
199
+ },
200
+ "practices": {
201
+ "type": "string",
202
+ "mutable": false,
203
+ "complexType": {
204
+ "original": "string",
205
+ "resolved": "string",
206
+ "references": {}
207
+ },
208
+ "required": false,
209
+ "optional": false,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": ""
213
+ },
214
+ "attribute": "practices",
215
+ "reflect": false
216
+ },
83
217
  "appName": {
84
218
  "type": "string",
85
219
  "mutable": false,
@@ -98,6 +232,74 @@ export class GrwApp {
98
232
  "reflect": false,
99
233
  "defaultValue": "'Geotrek Rando Widget'"
100
234
  },
235
+ "urlLayer": {
236
+ "type": "string",
237
+ "mutable": false,
238
+ "complexType": {
239
+ "original": "string",
240
+ "resolved": "string",
241
+ "references": {}
242
+ },
243
+ "required": false,
244
+ "optional": false,
245
+ "docs": {
246
+ "tags": [],
247
+ "text": ""
248
+ },
249
+ "attribute": "url-layer",
250
+ "reflect": false
251
+ },
252
+ "center": {
253
+ "type": "string",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "string",
257
+ "resolved": "string",
258
+ "references": {}
259
+ },
260
+ "required": false,
261
+ "optional": false,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": ""
265
+ },
266
+ "attribute": "center",
267
+ "reflect": false
268
+ },
269
+ "zoom": {
270
+ "type": "any",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "any",
274
+ "resolved": "any",
275
+ "references": {}
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": ""
282
+ },
283
+ "attribute": "zoom",
284
+ "reflect": false
285
+ },
286
+ "attribution": {
287
+ "type": "string",
288
+ "mutable": false,
289
+ "complexType": {
290
+ "original": "string",
291
+ "resolved": "string",
292
+ "references": {}
293
+ },
294
+ "required": false,
295
+ "optional": false,
296
+ "docs": {
297
+ "tags": [],
298
+ "text": ""
299
+ },
300
+ "attribute": "attribution",
301
+ "reflect": false
302
+ },
101
303
  "colorPrimary": {
102
304
  "type": "string",
103
305
  "mutable": false,
@@ -133,13 +335,73 @@ export class GrwApp {
133
335
  "attribute": "color-primary-tint",
134
336
  "reflect": false,
135
337
  "defaultValue": "'#d2b2c0'"
338
+ },
339
+ "colorTrekLine": {
340
+ "type": "string",
341
+ "mutable": false,
342
+ "complexType": {
343
+ "original": "string",
344
+ "resolved": "string",
345
+ "references": {}
346
+ },
347
+ "required": false,
348
+ "optional": false,
349
+ "docs": {
350
+ "tags": [],
351
+ "text": ""
352
+ },
353
+ "attribute": "color-trek-line",
354
+ "reflect": false,
355
+ "defaultValue": "'#6b0030'"
356
+ },
357
+ "colorDepartureIcon": {
358
+ "type": "string",
359
+ "mutable": false,
360
+ "complexType": {
361
+ "original": "string",
362
+ "resolved": "string",
363
+ "references": {}
364
+ },
365
+ "required": false,
366
+ "optional": false,
367
+ "docs": {
368
+ "tags": [],
369
+ "text": ""
370
+ },
371
+ "attribute": "color-departure-icon",
372
+ "reflect": false,
373
+ "defaultValue": "'#006b3b'"
374
+ },
375
+ "colorArrivalIcon": {
376
+ "type": "string",
377
+ "mutable": false,
378
+ "complexType": {
379
+ "original": "string",
380
+ "resolved": "string",
381
+ "references": {}
382
+ },
383
+ "required": false,
384
+ "optional": false,
385
+ "docs": {
386
+ "tags": [],
387
+ "text": ""
388
+ },
389
+ "attribute": "color-arrival-icon",
390
+ "reflect": false,
391
+ "defaultValue": "'#85003b'"
136
392
  }
137
393
  }; }
138
394
  static get states() { return {
139
395
  "showTrek": {},
140
396
  "showMap": {},
397
+ "isLargeView": {},
141
398
  "currentTrekId": {}
142
399
  }; }
400
+ static get elementRef() { return "element"; }
401
+ static get watchers() { return [{
402
+ "propName": "isLargeView",
403
+ "methodName": "watchPropHandler"
404
+ }]; }
143
405
  static get listeners() { return [{
144
406
  "name": "trekCardPress",
145
407
  "method": "onTrekCardPress",
@@ -659,6 +659,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
659
659
  grw-map {
660
660
  display: block;
661
661
  height: 100%;
662
+ max-height: 100vh;
662
663
  }
663
664
 
664
665
  .departure-icon svg,
@@ -683,4 +684,39 @@ grw-map {
683
684
  .trek-marker {
684
685
  background-color: var(--color-primary);
685
686
  border-radius: 50%;
687
+ display: flex;
688
+ justify-content: center;
689
+ align-items: center;
690
+ }
691
+ .trek-marker img {
692
+ width: 36px !important;
693
+ }
694
+
695
+ .map-loader-container {
696
+ position: absolute;
697
+ z-index: 500;
698
+ width: 100%;
699
+ height: 100%;
700
+ background: rgba(255, 255, 255, 0.5);
701
+ display: flex;
702
+ justify-content: center;
703
+ align-items: center;
704
+ }
705
+ .map-loader-container .loader {
706
+ width: 48px;
707
+ height: 48px;
708
+ border: 5px solid var(--color-primary-tint);
709
+ border-bottom-color: var(--color-primary);
710
+ border-radius: 50%;
711
+ display: inline-block;
712
+ box-sizing: border-box;
713
+ animation: rotation 1s linear infinite;
714
+ }
715
+ @keyframes rotation {
716
+ 0% {
717
+ transform: rotate(0deg);
718
+ }
719
+ 100% {
720
+ transform: rotate(360deg);
721
+ }
686
722
  }