@geotrekce/geotrek-rando-widget 0.0.2 → 0.0.3

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 (71) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +1 -1
  2. package/dist/cjs/{grw-app_7.cjs.entry.js → grw-app_10.cjs.entry.js} +275 -47
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +3 -0
  5. package/dist/collection/components/grw-app/grw-app.css +1 -0
  6. package/dist/collection/components/grw-app/grw-app.js +82 -6
  7. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +30 -0
  8. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +53 -0
  9. package/dist/collection/components/grw-map/grw-map.css +81 -0
  10. package/dist/collection/components/grw-map/grw-map.js +255 -31
  11. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +30 -0
  12. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +41 -0
  13. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +16 -0
  14. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +38 -0
  15. package/dist/collection/components/grw-trek-card/grw-trek-card.css +3 -0
  16. package/dist/collection/components/grw-trek-card/grw-trek-card.js +4 -4
  17. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +35 -0
  18. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +40 -6
  19. package/dist/collection/components/grw-treks-list/grw-treks-list.css +1 -0
  20. package/dist/collection/components/grw-treks-list/grw-treks-list.js +2 -2
  21. package/dist/collection/store/grw-trek-provider.js +11 -5
  22. package/dist/collection/store/grw-treks-provider.js +3 -3
  23. package/dist/collection/store/store.js +3 -0
  24. package/dist/collection/stories/App.js +14 -6
  25. package/dist/collection/stories/App.stories.js +10 -6
  26. package/dist/collection/stories/TrekCard.js +2 -1
  27. package/dist/collection/stories/TrekCard.stories.js +4 -3
  28. package/dist/collection/stories/TrekDetail.js +3 -1
  29. package/dist/collection/stories/TrekDetail.stories.js +5 -3
  30. package/dist/collection/stories/TrekMap.js +6 -4
  31. package/dist/collection/stories/TrekMap.stories.js +7 -5
  32. package/dist/collection/stories/TreksList.js +2 -1
  33. package/dist/collection/stories/TreksList.stories.js +4 -3
  34. package/dist/collection/stories/TreksMap.stories.js +3 -3
  35. package/dist/collection/utils/utils.js +2 -2
  36. package/dist/components/grw-app.js +31 -5
  37. package/dist/components/grw-information-desk-detail.d.ts +11 -0
  38. package/dist/components/grw-information-desk-detail.js +6 -0
  39. package/dist/components/grw-information-desk-detail2.js +34 -0
  40. package/dist/components/grw-map2.js +203 -28
  41. package/dist/components/grw-poi-detail.d.ts +11 -0
  42. package/dist/components/grw-poi-detail.js +6 -0
  43. package/dist/components/grw-poi-detail2.js +32 -0
  44. package/dist/components/grw-sensitive-area-detail.d.ts +11 -0
  45. package/dist/components/grw-sensitive-area-detail.js +6 -0
  46. package/dist/components/grw-sensitive-area-detail2.js +32 -0
  47. package/dist/components/grw-trek-card2.js +3 -3
  48. package/dist/components/grw-trek-detail2.js +25 -5
  49. package/dist/components/grw-trek-provider2.js +11 -5
  50. package/dist/components/grw-treks-list2.js +2 -2
  51. package/dist/components/grw-treks-provider2.js +3 -3
  52. package/dist/components/length.js +2 -2
  53. package/dist/components/store.js +3 -0
  54. package/dist/esm/geotrek-rando-widget.js +1 -1
  55. package/dist/esm/{grw-app_7.entry.js → grw-app_10.entry.js} +273 -48
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -1
  58. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  59. package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +1 -0
  60. package/dist/types/components/grw-app/grw-app.d.ts +4 -0
  61. package/dist/types/components/grw-information-desk-detail/grw-information-desk-detail.d.ts +5 -0
  62. package/dist/types/components/grw-map/grw-map.d.ts +13 -4
  63. package/dist/types/components/grw-poi-detail/grw-poi-detail.d.ts +5 -0
  64. package/dist/types/components/grw-sensitive-area-detail/grw-sensitive-area-detail.d.ts +5 -0
  65. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -0
  66. package/dist/types/components.d.ts +65 -1
  67. package/dist/types/store/store.d.ts +7 -1
  68. package/dist/types/types/types.d.ts +46 -3
  69. package/package.json +5 -7
  70. package/readme.md +20 -1
  71. package/dist/geotrek-rando-widget/p-b7c66d2d.entry.js +0 -1
@@ -7,7 +7,8 @@ import lengthImage from '../../assets/length.svg';
7
7
  export class GrwTrekDetail {
8
8
  constructor() {
9
9
  this.colorPrimary = '#6b0030';
10
- this.colorPrimaryTint = '#d2b2c0';
10
+ this.colorPrimaryShade = '#4a0021';
11
+ this.colorPrimaryTint = '#974c6e';
11
12
  }
12
13
  componentWillLoad() {
13
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -27,9 +28,9 @@ export class GrwTrekDetail {
27
28
  }
28
29
  render() {
29
30
  var _a, _b, _c, _d, _e, _f, _g;
30
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" },
31
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" },
31
32
  h("div", { class: "name" }, this.currentTrek.name),
32
- this.currentTrek.attachments && this.currentTrek.attachments[0] && h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" }),
33
+ this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })),
33
34
  h("div", { class: "sub-container" },
34
35
  h("div", { class: "icons-labels-container" },
35
36
  h("div", { class: "row" },
@@ -52,7 +53,22 @@ export class GrwTrekDetail {
52
53
  h("div", { class: "icon-label practice" },
53
54
  ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
54
55
  _g.name)))),
55
- h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser })))));
56
+ h("div", { class: "downloads-container" },
57
+ h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"),
58
+ h("div", { class: "links-container" },
59
+ h("a", { href: `${this.currentTrek.gpx}` }, "GPX"),
60
+ h("a", { href: `${this.currentTrek.kml}` }, "KML"),
61
+ h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))),
62
+ h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser }),
63
+ state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" },
64
+ h("div", { class: "sensitive-areas-title" }, "Zones sensibles"),
65
+ state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))),
66
+ state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" },
67
+ h("div", { class: "information-desks-title" }, "Lieux de renseignement"),
68
+ state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))),
69
+ state.currentPois && state.currentPois.length > 0 && (h("div", { class: "pois-container" },
70
+ h("div", { class: "pois-title" }, "Points d'int\u00E9r\u00EAts"),
71
+ state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi })))))))));
56
72
  }
57
73
  static get is() { return "grw-trek-detail"; }
58
74
  static get encapsulation() { return "shadow"; }
@@ -68,7 +84,7 @@ export class GrwTrekDetail {
68
84
  "mutable": false,
69
85
  "complexType": {
70
86
  "original": "Trek",
71
- "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; duration: number; length_2d: number; ascent: number; geometry?: LineString; departure_geom?: Position; }",
87
+ "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; duration: number; length_2d: number; ascent: number; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; }",
72
88
  "references": {
73
89
  "Trek": {
74
90
  "location": "import",
@@ -101,6 +117,24 @@ export class GrwTrekDetail {
101
117
  "reflect": false,
102
118
  "defaultValue": "'#6b0030'"
103
119
  },
120
+ "colorPrimaryShade": {
121
+ "type": "string",
122
+ "mutable": false,
123
+ "complexType": {
124
+ "original": "string",
125
+ "resolved": "string",
126
+ "references": {}
127
+ },
128
+ "required": false,
129
+ "optional": false,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": ""
133
+ },
134
+ "attribute": "color-primary-shade",
135
+ "reflect": false,
136
+ "defaultValue": "'#4a0021'"
137
+ },
104
138
  "colorPrimaryTint": {
105
139
  "type": "string",
106
140
  "mutable": false,
@@ -117,7 +151,7 @@ export class GrwTrekDetail {
117
151
  },
118
152
  "attribute": "color-primary-tint",
119
153
  "reflect": false,
120
- "defaultValue": "'#d2b2c0'"
154
+ "defaultValue": "'#974c6e'"
121
155
  }
122
156
  }; }
123
157
  static get states() { return {
@@ -1,4 +1,5 @@
1
1
  :host {
2
+ font-family: "Roboto";
2
3
  display: flex;
3
4
  flex-wrap: wrap;
4
5
  justify-content: space-around;
@@ -4,7 +4,7 @@ export class GrwTreksList {
4
4
  constructor() {
5
5
  this.treksToDisplay = [];
6
6
  this.colorPrimary = '#6b0030';
7
- this.colorPrimaryTint = '#d2b2c0';
7
+ this.colorPrimaryTint = '#974c6e';
8
8
  this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
9
9
  this.step = 10;
10
10
  }
@@ -70,7 +70,7 @@ export class GrwTreksList {
70
70
  },
71
71
  "attribute": "color-primary-tint",
72
72
  "reflect": false,
73
- "defaultValue": "'#d2b2c0'"
73
+ "defaultValue": "'#974c6e'"
74
74
  }
75
75
  }; }
76
76
  static get states() { return {
@@ -7,16 +7,22 @@ export class GrwTrekProvider {
7
7
  componentWillLoad() {
8
8
  state.api = this.api;
9
9
  return Promise.all([
10
- fetch(`${this.api}trek_difficulty/?language=${this.language}`),
11
- fetch(`${this.api}trek_route/?language=${this.language}`),
12
- fetch(`${this.api}trek_practice/?language=${this.language}`),
13
- fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry`),
10
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
11
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
12
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
13
+ fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description`).catch(() => new Response('[]')),
14
+ fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`),
15
+ fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`),
16
+ fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,route,geometry,gpx,kml,pdf,parking_location`),
14
17
  ])
15
18
  .then(responses => Promise.all(responses.map(response => response.json())))
16
- .then(([difficulties, routes, practices, trek]) => {
19
+ .then(([difficulties, routes, practices, sensitiveAreas, pois, informationDesks, trek]) => {
17
20
  state.difficulties = difficulties.results;
18
21
  state.routes = routes.results;
19
22
  state.practices = practices.results;
23
+ state.currentSensitiveAreas = sensitiveAreas.results;
24
+ state.currentPois = pois.results;
25
+ state.currentInformationDesks = informationDesks.results;
20
26
  state.currentTrek = trek;
21
27
  });
22
28
  }
@@ -17,9 +17,9 @@ export class GrwTreksProvider {
17
17
  this.practices && (treksRequest += `&practices=${this.practices}`);
18
18
  treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
19
19
  return Promise.all([
20
- fetch(`${this.api}trek_difficulty/?language=${this.language}`),
21
- fetch(`${this.api}trek_route/?language=${this.language}`),
22
- fetch(`${this.api}trek_practice/?language=${this.language}`),
20
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
21
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
22
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
23
23
  fetch(treksRequest),
24
24
  ])
25
25
  .then(responses => Promise.all(responses.map(response => response.json())))
@@ -5,7 +5,10 @@ const { state, onChange } = createStore({
5
5
  difficulties: [],
6
6
  routes: [],
7
7
  practices: [],
8
+ currentSensitiveAreas: null,
9
+ currentPois: null,
8
10
  currentTrek: null,
11
+ currentInformationDesks: null,
9
12
  });
10
13
  export { onChange };
11
14
  export default state;
@@ -1,5 +1,6 @@
1
1
  export const createApp = ({
2
2
  api,
3
+ language,
3
4
  inBbox,
4
5
  cities,
5
6
  districts,
@@ -12,13 +13,17 @@ export const createApp = ({
12
13
  urlLayer,
13
14
  attribution,
14
15
  colorPrimary,
16
+ colorPrimaryShade,
15
17
  colorPrimaryTint,
16
- trekLineColor,
17
- departureIconColor,
18
- arrivalIconColor,
18
+ colorTrekLine,
19
+ colorDepartureIcon,
20
+ colorArrivalIcon,
21
+ colorSensitiveArea,
22
+ colorPoiIcon,
19
23
  }) => {
20
24
  const app = document.createElement('grw-app');
21
25
  app.setAttribute('api', api);
26
+ app.setAttribute('language', language);
22
27
  app.setAttribute('in-bbox', inBbox);
23
28
  app.setAttribute('cities', cities);
24
29
  app.setAttribute('districts', districts);
@@ -31,9 +36,12 @@ export const createApp = ({
31
36
  app.setAttribute('url-layer', urlLayer);
32
37
  app.setAttribute('attribution', attribution);
33
38
  app.setAttribute('color-primary', colorPrimary);
39
+ app.setAttribute('color-primary-shade', colorPrimaryShade);
34
40
  app.setAttribute('color-primary-tint', colorPrimaryTint);
35
- app.setAttribute('trek-line-color', trekLineColor);
36
- app.setAttribute('departure-icon-color', departureIconColor);
37
- app.setAttribute('arrival-icon-color', arrivalIconColor);
41
+ app.setAttribute('color-trek-line', colorTrekLine);
42
+ app.setAttribute('color-departure-icon', colorDepartureIcon);
43
+ app.setAttribute('color-arrival-icon', colorArrivalIcon);
44
+ app.setAttribute('color-sensitive-area', colorSensitiveArea);
45
+ app.setAttribute('color-poi-icon', colorPoiIcon);
38
46
  return app;
39
47
  };
@@ -13,14 +13,15 @@ export default {
13
13
  },
14
14
  };
15
15
 
16
- const Template = ({ label, ...args }) => {
17
- return createApp({ label, ...args });
16
+ const Template = ({ ...args }) => {
17
+ return createApp({ ...args });
18
18
  };
19
19
 
20
20
  export const App = Template.bind({});
21
21
 
22
22
  App.args = {
23
23
  api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
24
+ language: 'fr',
24
25
  inBbox: '',
25
26
  cities: '',
26
27
  districts: '',
@@ -33,9 +34,12 @@ App.args = {
33
34
  urlLayer: 'openstreetmap',
34
35
  attribution: '© OpenStreetMap',
35
36
  colorPrimary: '#6b0030',
36
- colorPrimaryTint: '#d2b2c0',
37
- trekLineColor: '#6b0030',
38
- departureIconColor: '#006b3b',
39
- arrivalIconColor: '#85003b',
37
+ colorPrimaryShade: '4a0021',
38
+ colorPrimaryTint: '#974c6e',
39
+ colorTrekLine: '#6b0030',
40
+ colorDepartureIcon: '#006b3b',
41
+ colorArrivalIcon: '#85003b',
42
+ colorSensitiveArea: '#4974a5',
43
+ colorPoiIcon: '#974c6e',
40
44
  };
41
45
  App.storyName = 'App';
@@ -1,7 +1,8 @@
1
- export const createTrekCard = ({ api, trekId, colorPrimary, colorPrimaryTint }) => {
1
+ export const createTrekCard = ({ api, language, trekId, colorPrimary, colorPrimaryTint }) => {
2
2
  const container = document.createElement('div');
3
3
  const trek = document.createElement('grw-trek-provider');
4
4
  trek.setAttribute('api', api);
5
+ trek.setAttribute('language', language);
5
6
  trek.setAttribute('trek-id', trekId);
6
7
  container.appendChild(trek);
7
8
  const card = document.createElement('grw-trek-card');
@@ -5,16 +5,17 @@ export default {
5
5
  argTypes: {},
6
6
  };
7
7
 
8
- const Template = ({ label, ...args }) => {
9
- return createTrekCard({ label, ...args });
8
+ const Template = ({ ...args }) => {
9
+ return createTrekCard({ ...args });
10
10
  };
11
11
 
12
12
  export const TrekCard = Template.bind({});
13
13
 
14
14
  TrekCard.args = {
15
15
  api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
16
+ language: 'fr',
16
17
  trekId: 242872,
17
18
  colorPrimary: '#6b0030',
18
- colorPrimaryTint: '#d2b2c0',
19
+ colorPrimaryTint: '#974c6e',
19
20
  };
20
21
  TrekCard.storyName = 'Trek card';
@@ -1,11 +1,13 @@
1
- export const createTrekDetail = ({ api, trekId, colorPrimary, colorPrimaryTint }) => {
1
+ export const createTrekDetail = ({ api, language, trekId, colorPrimary, colorPrimaryShade, colorPrimaryTint }) => {
2
2
  const container = document.createElement('div');
3
3
  const trek = document.createElement('grw-trek-provider');
4
4
  trek.setAttribute('api', api);
5
+ trek.setAttribute('language', language);
5
6
  trek.setAttribute('trek-id', trekId);
6
7
  container.appendChild(trek);
7
8
  const detail = document.createElement('grw-trek-detail');
8
9
  detail.setAttribute('color-primary', colorPrimary);
10
+ detail.setAttribute('color-primary-shade', colorPrimaryShade);
9
11
  detail.setAttribute('color-primary-tint', colorPrimaryTint);
10
12
  container.appendChild(detail);
11
13
  return container;
@@ -5,16 +5,18 @@ export default {
5
5
  argTypes: {},
6
6
  };
7
7
 
8
- const Template = ({ label, ...args }) => {
9
- return createTrekDetail({ label, ...args });
8
+ const Template = ({ ...args }) => {
9
+ return createTrekDetail({ ...args });
10
10
  };
11
11
 
12
12
  export const TrekDetail = Template.bind({});
13
13
 
14
14
  TrekDetail.args = {
15
15
  api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
16
+ language: 'fr',
16
17
  trekId: 242872,
17
18
  colorPrimary: '#6b0030',
18
- colorPrimaryTint: '#d2b2c0',
19
+ colorPrimaryShade: '4a0021',
20
+ colorPrimaryTint: '#974c6e',
19
21
  };
20
22
  TrekDetail.storyName = 'Trek detail';
@@ -1,4 +1,4 @@
1
- export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution, trekLineColor, departureIconColor, arrivalIconColor }) => {
1
+ export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution, colorTrekLine, colorDepartureIcon, colorArrivalIcon, colorSensitiveArea, colorPoiIcon }) => {
2
2
  const container = document.createElement('div');
3
3
  container.style = 'height: 100%';
4
4
  const trek = document.createElement('grw-trek-provider');
@@ -10,9 +10,11 @@ export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution
10
10
  trekMap.setAttribute('center', center);
11
11
  trekMap.setAttribute('zoom', zoom);
12
12
  trekMap.setAttribute('attribution', attribution);
13
- trekMap.setAttribute('trek-line-color', trekLineColor);
14
- trekMap.setAttribute('departure-icon-color', departureIconColor);
15
- trekMap.setAttribute('arrival-icon-color', arrivalIconColor);
13
+ trekMap.setAttribute('color-trek-line', colorTrekLine);
14
+ trekMap.setAttribute('color-departure-icon', colorDepartureIcon);
15
+ trekMap.setAttribute('color-arrival-icon', colorArrivalIcon);
16
+ trekMap.setAttribute('color-sensitive-area', colorSensitiveArea);
17
+ trekMap.setAttribute('color-poi-icon', colorPoiIcon);
16
18
  container.appendChild(trekMap);
17
19
  return container;
18
20
  };
@@ -13,8 +13,8 @@ export default {
13
13
  },
14
14
  };
15
15
 
16
- const Template = ({ label, ...args }) => {
17
- return createTrekMap({ label, ...args });
16
+ const Template = ({ ...args }) => {
17
+ return createTrekMap({ ...args });
18
18
  };
19
19
 
20
20
  export const TrekMap = Template.bind({});
@@ -26,8 +26,10 @@ TrekMap.args = {
26
26
  center: '46.50761080179829, 5.927117067721017',
27
27
  zoom: 8,
28
28
  attribution: '© OpenStreetMap',
29
- trekLineColor: '#6b0030',
30
- departureIconColor: '#006b3b',
31
- arrivalIconColor: '#85003b',
29
+ colorTrekLine: '#6b0030',
30
+ colorDepartureIcon: '#006b3b',
31
+ colorArrivalIcon: '#85003b',
32
+ colorSensitiveArea: '#4974a5',
33
+ colorPoiIcon: '#974c6e',
32
34
  };
33
35
  TrekMap.storyName = 'Trek map';
@@ -1,7 +1,8 @@
1
- export const createTreksList = ({ api, inBbox, cities, districts, structures, themes, portals, routes, practices, colorPrimary, colorPrimaryTint }) => {
1
+ export const createTreksList = ({ api, language, inBbox, cities, districts, structures, themes, portals, routes, practices, colorPrimary, colorPrimaryTint }) => {
2
2
  const container = document.createElement('div');
3
3
  const treks = document.createElement('grw-treks-provider');
4
4
  treks.setAttribute('api', api);
5
+ treks.setAttribute('language', language);
5
6
  treks.setAttribute('in-bbox', inBbox);
6
7
  treks.setAttribute('cities', cities);
7
8
  treks.setAttribute('districts', districts);
@@ -5,14 +5,15 @@ export default {
5
5
  argTypes: {},
6
6
  };
7
7
 
8
- const Template = ({ label, ...args }) => {
9
- return createTreksList({ label, ...args });
8
+ const Template = ({ ...args }) => {
9
+ return createTreksList({ ...args });
10
10
  };
11
11
 
12
12
  export const TreksList = Template.bind({});
13
13
 
14
14
  TreksList.args = {
15
15
  api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
16
+ language: 'fr',
16
17
  inBbox: '',
17
18
  cities: '',
18
19
  districts: '',
@@ -22,6 +23,6 @@ TreksList.args = {
22
23
  routes: '',
23
24
  practices: '',
24
25
  colorPrimary: '#6b0030',
25
- colorPrimaryTint: '#d2b2c0',
26
+ colorPrimaryTint: '#974c6e',
26
27
  };
27
28
  TreksList.storyName = 'Treks list';
@@ -13,8 +13,8 @@ export default {
13
13
  },
14
14
  };
15
15
 
16
- const Template = ({ label, ...args }) => {
17
- return createTreksMap({ label, ...args });
16
+ const Template = ({ ...args }) => {
17
+ return createTreksMap({ ...args });
18
18
  };
19
19
 
20
20
  export const TreksMap = Template.bind({});
@@ -26,6 +26,6 @@ TreksMap.args = {
26
26
  zoom: 8,
27
27
  attribution: '© OpenStreetMap',
28
28
  colorPrimary: '#6b0030',
29
- colorPrimaryTint: '#d2b2c0',
29
+ colorPrimaryTint: '#974c6e',
30
30
  };
31
31
  TreksMap.storyName = 'Treks map';
@@ -12,8 +12,8 @@ export function formatDuration(duration) {
12
12
  return formattedDuration;
13
13
  }
14
14
  export function formatLength(length) {
15
- return `${Math.round(length / 1000)} km`;
15
+ return `${Math.round(length / 1000)}km`;
16
16
  }
17
17
  export function formatAscent(ascent) {
18
- return `${ascent} m`;
18
+ return `${ascent}m`;
19
19
  }
@@ -1,6 +1,9 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { s as state } from './store.js';
3
- import { d as defineCustomElement$7 } from './grw-map2.js';
3
+ import { d as defineCustomElement$a } from './grw-information-desk-detail2.js';
4
+ import { d as defineCustomElement$9 } from './grw-map2.js';
5
+ import { d as defineCustomElement$8 } from './grw-poi-detail2.js';
6
+ import { d as defineCustomElement$7 } from './grw-sensitive-area-detail2.js';
4
7
  import { d as defineCustomElement$6 } from './grw-trek-card2.js';
5
8
  import { d as defineCustomElement$5 } from './grw-trek-detail2.js';
6
9
  import { d as defineCustomElement$4 } from './grw-trek-provider2.js';
@@ -9,7 +12,7 @@ import { d as defineCustomElement$2 } from './grw-treks-provider2.js';
9
12
 
10
13
  const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
11
14
 
12
- const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .title,.large-view-header-container .title{color:#ffffff;margin-left:24px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.loader-container{position:absolute;width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{position:relative;width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
15
+ const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .title,.large-view-header-container .title{color:#ffffff;margin-left:24px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.loader-container{position:absolute;width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{position:relative;width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
13
16
 
14
17
  const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
18
  constructor() {
@@ -19,12 +22,16 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
19
22
  this.showTrek = false;
20
23
  this.showMap = false;
21
24
  this.isLargeView = false;
25
+ this.language = 'fr';
22
26
  this.appName = 'Geotrek Rando Widget';
23
27
  this.colorPrimary = '#6b0030';
24
- this.colorPrimaryTint = '#d2b2c0';
28
+ this.colorPrimaryShade = '#4a0021';
29
+ this.colorPrimaryTint = '#974c6e';
25
30
  this.colorTrekLine = '#6b0030';
26
31
  this.colorDepartureIcon = '#006b3b';
27
32
  this.colorArrivalIcon = '#85003b';
33
+ this.colorSensitiveArea = '#4974a5';
34
+ this.colorPoiIcon = '#974c6e';
28
35
  this.largeViewSize = 664;
29
36
  }
30
37
  onTrekCardPress(event) {
@@ -49,7 +56,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
49
56
  this.showMap = this.isLargeView;
50
57
  }
51
58
  render() {
52
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, 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 }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, 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)), h("div", { class: "content-container" }, 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' } }, h("grw-treks-list", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint }))), 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 })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
59
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("grw-treks-provider", { api: this.api, language: this.language, "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 }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, 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)), h("div", { class: "content-container" }, 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' } }, h("grw-treks-list", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), 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, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
53
60
  }
54
61
  get element() { return this; }
55
62
  static get watchers() { return {
@@ -58,6 +65,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
58
65
  static get style() { return grwAppCss; }
59
66
  }, [1, "grw-app", {
60
67
  "api": [1],
68
+ "language": [1],
61
69
  "inBbox": [1, "in-bbox"],
62
70
  "cities": [1],
63
71
  "districts": [1],
@@ -72,10 +80,13 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
72
80
  "zoom": [8],
73
81
  "attribution": [1],
74
82
  "colorPrimary": [1, "color-primary"],
83
+ "colorPrimaryShade": [1, "color-primary-shade"],
75
84
  "colorPrimaryTint": [1, "color-primary-tint"],
76
85
  "colorTrekLine": [1, "color-trek-line"],
77
86
  "colorDepartureIcon": [1, "color-departure-icon"],
78
87
  "colorArrivalIcon": [1, "color-arrival-icon"],
88
+ "colorSensitiveArea": [1, "color-sensitive-area"],
89
+ "colorPoiIcon": [1, "color-poi-icon"],
79
90
  "showTrek": [32],
80
91
  "showMap": [32],
81
92
  "isLargeView": [32],
@@ -85,14 +96,29 @@ function defineCustomElement$1() {
85
96
  if (typeof customElements === "undefined") {
86
97
  return;
87
98
  }
88
- const components = ["grw-app", "grw-map", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
99
+ const components = ["grw-app", "grw-information-desk-detail", "grw-map", "grw-poi-detail", "grw-sensitive-area-detail", "grw-trek-card", "grw-trek-detail", "grw-trek-provider", "grw-treks-list", "grw-treks-provider"];
89
100
  components.forEach(tagName => { switch (tagName) {
90
101
  case "grw-app":
91
102
  if (!customElements.get(tagName)) {
92
103
  customElements.define(tagName, GrwApp$1);
93
104
  }
94
105
  break;
106
+ case "grw-information-desk-detail":
107
+ if (!customElements.get(tagName)) {
108
+ defineCustomElement$a();
109
+ }
110
+ break;
95
111
  case "grw-map":
112
+ if (!customElements.get(tagName)) {
113
+ defineCustomElement$9();
114
+ }
115
+ break;
116
+ case "grw-poi-detail":
117
+ if (!customElements.get(tagName)) {
118
+ defineCustomElement$8();
119
+ }
120
+ break;
121
+ case "grw-sensitive-area-detail":
96
122
  if (!customElements.get(tagName)) {
97
123
  defineCustomElement$7();
98
124
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GrwInformationDeskDetail extends Components.GrwInformationDeskDetail, HTMLElement {}
4
+ export const GrwInformationDeskDetail: {
5
+ prototype: GrwInformationDeskDetail;
6
+ new (): GrwInformationDeskDetail;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GrwInformationDeskDetail$1, d as defineCustomElement$1 } from './grw-information-desk-detail2.js';
2
+
3
+ const GrwInformationDeskDetail = GrwInformationDeskDetail$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GrwInformationDeskDetail, defineCustomElement };
@@ -0,0 +1,34 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const grwInformationDeskDetailCss = ":host{display:flex;flex-direction:column;padding:0px 8px 8px 8px}.information-desk-img{width:180px}.information-desk-img img{width:180px;border-radius:8px}.information-desk-right-container{display:flex;flex-direction:column;padding:8px}.information-desk-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:0px 0px 8px 0px}.information-desk-description{font-size:16px}";
4
+
5
+ const GrwInformationDeskDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ }
11
+ render() {
12
+ return (h(Host, null, this.informationDesk.photo_url && (h("div", { class: "information-desk-img" }, h("img", { src: this.informationDesk.photo_url, loading: "lazy" }))), h("div", { class: "information-desk-right-container" }, this.informationDesk.name && h("div", { class: "information-desk-name" }, this.informationDesk.name), this.informationDesk.description && h("div", { class: "information-desk-description", innerHTML: this.informationDesk.description }), this.informationDesk.postal_code ||
13
+ this.informationDesk.municipality ||
14
+ (this.informationDesk.street && (h("div", null, this.informationDesk.postal_code, ` ${this.informationDesk.municipality}`, ` ${this.informationDesk.street}`))), this.informationDesk.phone && (h("div", null, h("a", { href: `tel:${this.informationDesk.phone}` }, this.informationDesk.phone))), this.informationDesk.email && (h("div", null, h("a", { href: `mailto:${this.informationDesk.email}` }, this.informationDesk.email))), this.informationDesk.website && (h("div", null, h("a", { href: `${this.informationDesk.website}` }, this.informationDesk.website))))));
15
+ }
16
+ static get style() { return grwInformationDeskDetailCss; }
17
+ }, [1, "grw-information-desk-detail", {
18
+ "informationDesk": [16]
19
+ }]);
20
+ function defineCustomElement() {
21
+ if (typeof customElements === "undefined") {
22
+ return;
23
+ }
24
+ const components = ["grw-information-desk-detail"];
25
+ components.forEach(tagName => { switch (tagName) {
26
+ case "grw-information-desk-detail":
27
+ if (!customElements.get(tagName)) {
28
+ customElements.define(tagName, GrwInformationDeskDetail);
29
+ }
30
+ break;
31
+ } });
32
+ }
33
+
34
+ export { GrwInformationDeskDetail as G, defineCustomElement as d };