@everymatrix/blog-articles-grid 1.98.29 → 1.98.30

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.
@@ -5,39 +5,65 @@ const TRANSLATIONS$1 = {
5
5
  en: {
6
6
  error: 'Error',
7
7
  readmore: 'Read more',
8
+ home: 'Home',
9
+ blog: 'Blog',
10
+ blogPageTitle: 'Blog',
8
11
  },
9
12
  ro: {
10
13
  error: 'Eroare',
11
14
  readmore: 'Read more',
15
+ home: 'Acasă',
16
+ blog: 'Blog',
17
+ blogPageTitle: 'Blog',
12
18
  },
13
19
  fr: {
14
20
  error: 'Error',
15
21
  readmore: 'Read more',
22
+ home: 'Accueil',
23
+ blog: 'Blog',
24
+ blogPageTitle: 'Blog',
16
25
  },
17
26
  ar: {
18
27
  error: 'خطأ',
19
28
  readmore: 'Read more',
29
+ home: 'الرئيسية',
30
+ blog: 'المدونة',
31
+ blogPageTitle: 'المدونة',
20
32
  },
21
33
  hu: {
22
34
  error: 'خطأ',
23
35
  readmore: 'Tovább olvasom',
36
+ home: 'Kezdőlap',
37
+ blog: 'Blog',
38
+ blogPageTitle: 'Blog',
24
39
  },
25
40
  hr: {
26
41
  error: 'Greška',
27
- readmore: 'Pročitaj više'
42
+ readmore: 'Pročitaj više',
43
+ home: 'Početna',
44
+ blog: 'Blog',
45
+ blogPageTitle: 'Blog',
28
46
  },
29
47
  'pt-br': {
30
48
  error: 'Erro',
31
- readmore: 'Ler mais'
49
+ readmore: 'Ler mais',
50
+ home: 'Início',
51
+ blog: 'Blog',
52
+ blogPageTitle: 'Blog',
32
53
  },
33
54
  'es-mx': {
34
55
  error: 'Error',
35
- readmore: 'Leer más'
56
+ readmore: 'Leer más',
57
+ home: 'Inicio',
58
+ blog: 'Blog',
59
+ blogPageTitle: 'Blog',
36
60
  }
37
61
  };
38
- const translate$1 = (key, customLang) => {
39
- const lang = customLang;
40
- return TRANSLATIONS$1[(lang !== undefined) && (lang in TRANSLATIONS$1) ? lang : DEFAULT_LANGUAGE$1][key];
62
+ const translate$1 = (key, customLang, customTranslations) => {
63
+ var _a;
64
+ const lang = customLang !== null && customLang !== void 0 ? customLang : DEFAULT_LANGUAGE$1;
65
+ const override = (_a = customTranslations === null || customTranslations === void 0 ? void 0 : customTranslations[lang]) === null || _a === void 0 ? void 0 : _a[key];
66
+ return typeof override === 'string' ? override : TRANSLATIONS$1[lang in TRANSLATIONS$1 ? lang : DEFAULT_LANGUAGE$1][key];
41
67
  };
42
68
 
43
69
  const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
@@ -245,7 +271,7 @@ const getDevicePlatform = () => {
245
271
  return 'mtWeb';
246
272
  };
247
273
 
248
- const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n position: relative;\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n position: static;\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n pointer-events: none;\n}\n.GridContainer .BlogTitle {\n margin: 0;\n font-size: 24px;\n font-weight: 400;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogTitle .BlogCardLink {\n display: block;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.GridContainer .BlogTitle .BlogCardLink::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 2;\n}\n.GridContainer .BlogContent {\n margin: 0;\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #22B04E;\n font-size: 14px;\n position: absolute;\n bottom: 16px;\n padding-top: 2.5px;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
274
+ const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n padding: 0 20px;\n margin: 40px auto 20px;\n color: var(--emw--color-white, #FFFFFF);\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.BlogPageTitle {\n max-width: 1300px;\n padding: 0 20px;\n margin: 0 auto;\n color: var(--emw--color-primary);\n font-size: 22px;\n font-weight: 600;\n line-height: 1.2;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n position: relative;\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n position: static;\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n pointer-events: none;\n}\n.GridContainer .BlogTitle {\n margin: 0;\n font-size: 24px;\n font-weight: 400;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogTitle .BlogCardLink {\n display: block;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.GridContainer .BlogTitle .BlogCardLink::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 2;\n}\n.GridContainer .BlogContent {\n margin: 0;\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #22B04E;\n font-size: 14px;\n position: absolute;\n bottom: 16px;\n padding-top: 2.5px;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
249
275
  const BlogArticlesGridStyle0 = blogArticlesGridCss;
250
276
 
251
277
  const BlogArticlesGrid = class {
@@ -255,43 +281,43 @@ const BlogArticlesGrid = class {
255
281
  this.lastPage = 1;
256
282
  this.isInitialized = false;
257
283
  this.paginationDefaultStyling = `
258
- div#PaginationContainer {
284
+ nav#PaginationContainer {
259
285
  justify-content: right;
260
286
  }
261
- .LeftItems button .NavigationButton {
287
+ .LeftItems a .NavigationButton {
262
288
  display: none;
263
289
  }
264
- .LeftItems button:after, .RightItems button:after {
290
+ .LeftItems a:after, .RightItems a:after {
265
291
  padding: 7px 12px;
266
292
  font-size: 18px;
267
293
  font-weight: 700;
268
294
  line-height: 46px;
269
295
  }
270
- .LeftItems button:after {
296
+ .LeftItems a:after {
271
297
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z'/%3E%3C/svg%3E");
272
298
  }
273
- .RightItems button:after {
299
+ .RightItems a:after {
274
300
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z'/%3E%3C/svg%3E");
275
301
  display: block;
276
302
  height: 38px;
277
303
  }
278
- div.LeftItems button, div.RightItems button {
304
+ div.LeftItems a, div.RightItems a {
279
305
  width: unset;
280
306
  height: 40px;
281
307
  background-color: #fff;
282
308
  color: #000;
283
309
  border: 1px solid #000;
284
310
  overflow: hidden;
285
- &:disabled {
311
+ &[aria-disabled="true"] {
286
312
  background-color: #989898;
287
313
  }
288
314
  }
289
- div.LeftItems button {
315
+ div.LeftItems a {
290
316
  min-width: 60px;
291
317
  border-radius: 20px 0 0 20px;
292
318
  border-right: 0;
293
319
  }
294
- div.RightItems button {
320
+ div.RightItems a {
295
321
  display: flex;
296
322
  min-width: 100px;
297
323
  justify-content: space-evenly;
@@ -299,7 +325,7 @@ const BlogArticlesGrid = class {
299
325
  border-radius: 0 20px 20px 0;
300
326
  text-transform: none;
301
327
  }
302
- .RightItems button .NavigationButton {
328
+ .RightItems a .NavigationButton {
303
329
  padding: 12px 0 12px 12px;
304
330
  font-weight: 700;
305
331
  }`;
@@ -314,6 +340,7 @@ const BlogArticlesGrid = class {
314
340
  };
315
341
  this.cmsEndpoint = undefined;
316
342
  this.language = 'en';
343
+ this.translationUrl = '';
317
344
  this.userRoles = 'everyone';
318
345
  this.cmsEnv = 'stage';
319
346
  this.mbSource = undefined;
@@ -322,6 +349,8 @@ const BlogArticlesGrid = class {
322
349
  this.showPublishingDate = true;
323
350
  this.showImage = true;
324
351
  this.showTitle = true;
352
+ this.showPageTitle = false;
353
+ this.showBreadcrumb = false;
325
354
  this.showContent = true;
326
355
  this.showButton = true;
327
356
  this.hideError = false;
@@ -334,6 +363,7 @@ const BlogArticlesGrid = class {
334
363
  this.numberedNavActive = false;
335
364
  this.intlDateTimeFormat = '';
336
365
  this.page = '1';
366
+ this.pageQueryParam = undefined;
337
367
  this.eventId = undefined;
338
368
  this.paginationBlogList = {
339
369
  offset: 0
@@ -349,6 +379,7 @@ const BlogArticlesGrid = class {
349
379
  this.paginationBlogResponse = undefined;
350
380
  this.allBlogResponse = undefined;
351
381
  this.totalBlogs = 0;
382
+ this.customTranslations = {};
352
383
  }
353
384
  getArticleId(event, post) {
354
385
  var _a;
@@ -387,6 +418,21 @@ const BlogArticlesGrid = class {
387
418
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
388
419
  }
389
420
  }
421
+ async loadTranslations() {
422
+ if (!this.translationUrl) {
423
+ this.customTranslations = {};
424
+ return;
425
+ }
426
+ try {
427
+ const response = await fetch(this.translationUrl);
428
+ if (!response.ok)
429
+ throw new Error(`HTTP error! status: ${response.status}`);
430
+ this.customTranslations = await response.json();
431
+ }
432
+ catch (error) {
433
+ console.error('Failed to fetch or parse translations from URL:', error);
434
+ }
435
+ }
390
436
  hpPageChange(event) {
391
437
  var _a, _b;
392
438
  this.paginationBlogList = event.detail;
@@ -527,6 +573,7 @@ const BlogArticlesGrid = class {
527
573
  this.getBlogArticleGrid();
528
574
  }
529
575
  }
576
+ return this.loadTranslations();
530
577
  }
531
578
  handleClientStyling() {
532
579
  if (window.emMessageBus !== undefined) {
@@ -567,7 +614,7 @@ const BlogArticlesGrid = class {
567
614
  }
568
615
  render() {
569
616
  if (this.hasErrors) {
570
- return (h("div", { class: "BlogsContainer" }, !this.hideError && (h("div", { class: "ErrorMessage" }, translate$1('error', this.language)))));
617
+ return (h("div", { class: "BlogsContainer" }, !this.hideError && (h("div", { class: "ErrorMessage" }, translate$1('error', this.language, this.customTranslations)))));
571
618
  }
572
619
  // Create an array to store the placeholder elements for each card
573
620
  const placeholderCards = [];
@@ -577,14 +624,14 @@ const BlogArticlesGrid = class {
577
624
  }
578
625
  const showPagination = Boolean(this.paginationActive) && this.totalBlogs > +this.blogsLimit;
579
626
  const paginationClientStyling = !this.mbSource ? (this.clientStyling || this.paginationDefaultStyling) : undefined;
580
- return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "BlogPageContainer" }, h("div", { class: "BlogGridPaginationWrapper" }, showPagination && h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: this.totalBlogs, language: this.language, "mb-source": this.mbSource, "client-styling": paginationClientStyling, "client-styling-url": this.clientStylingUrl, "arrows-active": this.arrowsActive, "secondary-arrows-active": this.secondaryArrowsActive, "numbered-nav-active": this.numberedNavActive })), (!this.isLoading) &&
627
+ return (h("div", { ref: el => this.stylingContainer = el }, this.showBreadcrumb && (h("nav", { class: "breadcrumb", "aria-label": "Breadcrumb" }, h("a", { href: `/${encodeURIComponent(this.language)}` }, translate$1('home', this.language, this.customTranslations)), h("span", { "aria-hidden": "true" }, "\u203A"), h("span", { "aria-current": "page" }, translate$1('blog', this.language, this.customTranslations)))), this.showPageTitle && h("h1", { class: "BlogPageTitle" }, translate$1('blogPageTitle', this.language, this.customTranslations)), h("div", { class: "BlogPageContainer" }, h("div", { class: "BlogGridPaginationWrapper" }, showPagination && h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: this.totalBlogs, language: this.language, "mb-source": this.mbSource, "client-styling": paginationClientStyling, "client-styling-url": this.clientStylingUrl, "arrows-active": this.arrowsActive, "secondary-arrows-active": this.secondaryArrowsActive, "numbered-nav-active": this.numberedNavActive, "page-query-param": this.pageQueryParam, page: +this.page || 1 })), (!this.isLoading) &&
581
628
  h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage} ${this.device}` }, this.displayedBlogResponse && this.displayedBlogResponse.items.map((data) => {
582
629
  var _a, _b;
583
630
  return h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
584
631
  h("div", { class: "BlogDate" }, h("time", { dateTime: data.publishingDate }, this.formatDate(data.publishingDate))), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (h("img", { class: "VisualContent", src: this.setImage(data.image), alt: data.image.alt || data.title, width: "400", height: "225", loading: "lazy" })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device] })) : (h("span", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
585
632
  h("h2", { class: "BlogTitle" }, h("a", { class: "BlogCardLink", href: `/${encodeURIComponent(this.language)}/blog/${encodeURIComponent(data.customPath || data.slug)}`, onClick: event => this.getArticleId(event, data) }, data.title)), this.showContent &&
586
633
  this.renderContentConditionally(data.descriptionPreview), this.showButton &&
587
- h("span", { class: "BlogLink" }, translate$1('readmore', this.language)))));
634
+ h("span", { class: "BlogLink" }, translate$1('readmore', this.language, this.customTranslations)))));
588
635
  })), (this.isLoading) &&
589
636
  h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
590
637
  }
@@ -598,7 +645,8 @@ const BlogArticlesGrid = class {
598
645
  "blogsLimit": ["watchEndpoint"],
599
646
  "eventId": ["watchEndpoint"],
600
647
  "clientStyling": ["handleClientStylingChange"],
601
- "clientStylingUrl": ["handleClientStylingChangeURL"]
648
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
649
+ "translationUrl": ["loadTranslations"]
602
650
  }; }
603
651
  };
604
652
  BlogArticlesGrid.style = BlogArticlesGridStyle0;
@@ -660,7 +708,7 @@ const translate = (key, customLang) => {
660
708
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
661
709
  };
662
710
 
663
- const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:14px}}@media screen and (max-width: 480px){button{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}";
711
+ const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems a:not(:first-child),.RightItems a:not(:last-child){margin:0 10px}.LeftItems a,.RightItems a{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li a{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem a{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem a[aria-disabled=true]{pointer-events:none;cursor:not-allowed}.PaginationItem a:hover,.PaginationItem a:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}a{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-decoration:none;width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}a:hover,a:active{background:#004D4A;border-color:#004D4A}a[aria-disabled=true]{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){a{width:90px;font-size:14px}}@media screen and (max-width: 480px){a{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){a{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem a:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem a:hover{background:#009993;border-color:#009993;color:#fff}}";
664
712
  const HelperPaginationStyle0 = helperPaginationCss;
665
713
 
666
714
  const HelperPagination = class {
@@ -739,6 +787,8 @@ const HelperPagination = class {
739
787
  this.arrowsActive = true;
740
788
  this.secondaryArrowsActive = false;
741
789
  this.numberedNavActive = false;
790
+ this.pageQueryParam = undefined;
791
+ this.page = 1;
742
792
  this.offsetInt = 0;
743
793
  this.lastPage = false;
744
794
  this.previousPage = false;
@@ -799,32 +849,70 @@ const HelperPagination = class {
799
849
  disconnectedCallback() {
800
850
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
801
851
  }
852
+ pageHref(page) {
853
+ if (!this.pageQueryParam)
854
+ return '#';
855
+ const url = new URL(window.location.href);
856
+ url.searchParams.set(this.pageQueryParam, String(page + this.page - 1));
857
+ return `${url.search}${url.hash}`;
858
+ }
802
859
  render() {
803
860
  /**
804
861
  * Center navigation area
805
862
  */
806
863
  let navigationArea = h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index) => {
807
- return (h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, h("button", { disabled: item === this.currentPage ? true : false, onClick: this.paginationNavigation.bind(this, item, index) }, h("span", null, item))));
864
+ const page = typeof item === 'number' ? item : index === 0
865
+ ? Math.max(1, this.currentPage - 5)
866
+ : Math.min(this.endInt + 1, this.currentPage + 5);
867
+ return (h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, h("a", { href: this.pageHref(page), "aria-current": item === this.currentPage ? 'page' : undefined, "aria-disabled": item === this.currentPage ? 'true' : undefined, tabIndex: item === this.currentPage ? -1 : undefined, onClick: event => {
868
+ event.preventDefault();
869
+ if (item !== this.currentPage)
870
+ this.paginationNavigation(item, index);
871
+ } }, h("span", null, item))));
808
872
  }));
809
873
  /**
810
874
  * Left navigation area
811
875
  */
812
- let buttonSecondaryLeftSide = h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'firstPage') }, h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), h("span", { class: "NavigationIcon" }));
813
- let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
876
+ let buttonSecondaryLeftSide = h("a", { href: this.prevPage ? this.pageHref(1) : '#', "aria-disabled": !this.prevPage ? 'true' : undefined, tabIndex: !this.prevPage ? -1 : undefined, onClick: event => {
877
+ event.preventDefault();
878
+ if (this.prevPage)
879
+ this.navigateTo('firstPage');
880
+ } }, h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), h("span", { class: "NavigationIcon" }));
881
+ let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("a", { href: this.prevPage ? this.pageHref(this.currentPage - 1) : '#', rel: "prev", "aria-label": translate('previousPage', this.language), "aria-disabled": !this.prevPage ? 'true' : undefined, tabIndex: !this.prevPage ? -1 : undefined, onClick: event => {
882
+ event.preventDefault();
883
+ if (this.prevPage)
884
+ this.navigateTo('previousPage');
885
+ } }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
814
886
  if (isMobile(this.userAgent)) {
815
887
  buttonsLeftSide =
816
- h("div", { class: "LeftItems" }, h("button", { disabled: this.prevPage ? false : true, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
888
+ h("div", { class: "LeftItems" }, h("a", { href: this.prevPage ? this.pageHref(this.currentPage - 1) : '#', rel: "prev", "aria-label": translate('previousPage', this.language), "aria-disabled": !this.prevPage ? 'true' : undefined, tabIndex: !this.prevPage ? -1 : undefined, onClick: event => {
889
+ event.preventDefault();
890
+ if (this.prevPage)
891
+ this.navigateTo('previousPage');
892
+ } }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
817
893
  }
818
894
  /**
819
895
  * Right navigation area
820
896
  */
821
- let buttonSecondaryRightSide = h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'lastPage') }, h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), h("span", { class: "NavigationIcon" }));
822
- let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
897
+ let buttonSecondaryRightSide = h("a", { href: this.nextPage ? this.pageHref(this.endInt + 1) : '#', "aria-disabled": !this.nextPage ? 'true' : undefined, tabIndex: !this.nextPage ? -1 : undefined, onClick: event => {
898
+ event.preventDefault();
899
+ if (this.nextPage)
900
+ this.navigateTo('lastPage');
901
+ } }, h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), h("span", { class: "NavigationIcon" }));
902
+ let buttonsRightSide = h("div", { class: "RightItems" }, h("a", { href: this.nextPage ? this.pageHref(this.currentPage + 1) : '#', rel: "next", "aria-label": translate('nextPage', this.language), "aria-disabled": !this.nextPage ? 'true' : undefined, tabIndex: !this.nextPage ? -1 : undefined, onClick: event => {
903
+ event.preventDefault();
904
+ if (this.nextPage)
905
+ this.navigateTo('nextPage');
906
+ } }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
823
907
  if (isMobile(this.userAgent)) {
824
908
  buttonsRightSide =
825
- h("div", { class: "RightItems" }, h("button", { disabled: this.nextPage ? false : true, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })));
909
+ h("div", { class: "RightItems" }, h("a", { href: this.nextPage ? this.pageHref(this.currentPage + 1) : '#', rel: "next", "aria-label": translate('nextPage', this.language), "aria-disabled": !this.nextPage ? 'true' : undefined, tabIndex: !this.nextPage ? -1 : undefined, onClick: event => {
910
+ event.preventDefault();
911
+ if (this.nextPage)
912
+ this.navigateTo('nextPage');
913
+ } }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })));
826
914
  }
827
- return (h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
915
+ return (h("nav", { id: "PaginationContainer", class: "PaginationContainer", "aria-label": "Blog pagination", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
828
916
  }
829
917
  static get watchers() { return {
830
918
  "clientStyling": ["handleClientStylingChange"],
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"hideError":[516,"hide-error"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[513,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"intlDateTimeFormat":[513,"intl-date-time-format"],"page":[513],"eventId":[513,"event-id"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32],"displayedBlogResponse":[32],"paginationBlogResponse":[32],"allBlogResponse":[32],"totalBlogs":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]],{"page":["watchEndpoint"],"hasErrors":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"blogsLimit":["watchEndpoint"],"eventId":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}],[1,"helper-pagination",{"nextPage":[1537,"next-page"],"prevPage":[1537,"prev-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"mbSource":[1,"mb-source"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[1537,"client-styling-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"previousPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
8
+ return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"translationUrl":[513,"translation-url"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showPageTitle":[516,"show-page-title"],"showBreadcrumb":[516,"show-breadcrumb"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"hideError":[516,"hide-error"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[513,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"intlDateTimeFormat":[513,"intl-date-time-format"],"page":[513],"pageQueryParam":[1,"page-query-param"],"eventId":[513,"event-id"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32],"displayedBlogResponse":[32],"paginationBlogResponse":[32],"allBlogResponse":[32],"totalBlogs":[32],"customTranslations":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]],{"page":["watchEndpoint"],"hasErrors":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"blogsLimit":["watchEndpoint"],"eventId":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["loadTranslations"]}],[1,"helper-pagination",{"nextPage":[1537,"next-page"],"prevPage":[1537,"prev-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"mbSource":[1,"mb-source"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[1537,"client-styling-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"pageQueryParam":[1,"page-query-param"],"page":[2],"offsetInt":[32],"lastPage":[32],"previousPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -11,6 +11,10 @@ export declare class BlogArticlesGrid {
11
11
  * Language of the widget
12
12
  */
13
13
  language: string;
14
+ /**
15
+ * Override translations using a language-keyed JSON file
16
+ */
17
+ translationUrl: string;
14
18
  /**
15
19
  * User roles
16
20
  */
@@ -43,6 +47,14 @@ export declare class BlogArticlesGrid {
43
47
  * Property used to display the image
44
48
  */
45
49
  showTitle: boolean;
50
+ /**
51
+ * Display the blog page heading independently of card titles
52
+ */
53
+ showPageTitle: boolean;
54
+ /**
55
+ * Display breadcrumb navigation
56
+ */
57
+ showBreadcrumb: boolean;
46
58
  /**
47
59
  * Property used to display the description
48
60
  */
@@ -91,6 +103,7 @@ export declare class BlogArticlesGrid {
91
103
  * Page to particularly be opened on start
92
104
  */
93
105
  page: string;
106
+ pageQueryParam?: string;
94
107
  /**
95
108
  * Filter blog post list using eventId from Sport page
96
109
  */
@@ -109,12 +122,14 @@ export declare class BlogArticlesGrid {
109
122
  paginationBlogResponse?: BlogPostResponse;
110
123
  allBlogResponse?: BlogPostResponse;
111
124
  totalBlogs: number;
125
+ private customTranslations;
112
126
  lastPage: number;
113
127
  private isInitialized;
114
128
  handleBannerReady(): void;
115
129
  watchEndpoint(newValue: string, oldValue: string): void;
116
130
  handleClientStylingChange(newValue: string, oldValue: string): void;
117
131
  handleClientStylingChangeURL(newValue: string, oldValue: string): void;
132
+ loadTranslations(): Promise<void>;
118
133
  private stylingContainer?;
119
134
  private stylingSubscription;
120
135
  private paginationDefaultStyling;
@@ -124,7 +139,7 @@ export declare class BlogArticlesGrid {
124
139
  moveLatestFeatureToStart(blogItems: BlogPost[], latestFeatured: BlogPost | null): BlogPost[];
125
140
  fetchBlogPosts(page?: number, allPosts?: boolean): Promise<BlogPostResponse>;
126
141
  getBlogArticleGrid(forceFetch?: boolean, page?: number): Promise<void>;
127
- componentWillLoad(): void;
142
+ componentWillLoad(): Promise<void>;
128
143
  handleClientStyling(): void;
129
144
  componentDidLoad(): void;
130
145
  disconnectedCallback(): void;
@@ -59,6 +59,7 @@ export namespace Components {
59
59
  * Page to particularly be opened on start
60
60
  */
61
61
  "page": string;
62
+ "pageQueryParam"?: string;
62
63
  /**
63
64
  * Customize pagination: Activate pagination
64
65
  */
@@ -71,6 +72,10 @@ export namespace Components {
71
72
  * Customize pagination: Activate pagination secondary arrows
72
73
  */
73
74
  "secondaryArrowsActive": boolean;
75
+ /**
76
+ * Display breadcrumb navigation
77
+ */
78
+ "showBreadcrumb": boolean;
74
79
  /**
75
80
  * Property used to display the read-more label
76
81
  */
@@ -83,6 +88,10 @@ export namespace Components {
83
88
  * Property used to display the image
84
89
  */
85
90
  "showImage": boolean;
91
+ /**
92
+ * Display the blog page heading independently of card titles
93
+ */
94
+ "showPageTitle": boolean;
86
95
  /**
87
96
  * Property used to display the publishing date
88
97
  */
@@ -91,6 +100,10 @@ export namespace Components {
91
100
  * Property used to display the image
92
101
  */
93
102
  "showTitle": boolean;
103
+ /**
104
+ * Override translations using a language-keyed JSON file
105
+ */
106
+ "translationUrl": string;
94
107
  /**
95
108
  * Keep the host app's SPA navigation when enabled.
96
109
  */
@@ -182,6 +195,7 @@ declare namespace LocalJSX {
182
195
  * Page to particularly be opened on start
183
196
  */
184
197
  "page"?: string;
198
+ "pageQueryParam"?: string;
185
199
  /**
186
200
  * Customize pagination: Activate pagination
187
201
  */
@@ -194,6 +208,10 @@ declare namespace LocalJSX {
194
208
  * Customize pagination: Activate pagination secondary arrows
195
209
  */
196
210
  "secondaryArrowsActive"?: boolean;
211
+ /**
212
+ * Display breadcrumb navigation
213
+ */
214
+ "showBreadcrumb"?: boolean;
197
215
  /**
198
216
  * Property used to display the read-more label
199
217
  */
@@ -206,6 +224,10 @@ declare namespace LocalJSX {
206
224
  * Property used to display the image
207
225
  */
208
226
  "showImage"?: boolean;
227
+ /**
228
+ * Display the blog page heading independently of card titles
229
+ */
230
+ "showPageTitle"?: boolean;
209
231
  /**
210
232
  * Property used to display the publishing date
211
233
  */
@@ -214,6 +236,10 @@ declare namespace LocalJSX {
214
236
  * Property used to display the image
215
237
  */
216
238
  "showTitle"?: boolean;
239
+ /**
240
+ * Override translations using a language-keyed JSON file
241
+ */
242
+ "translationUrl"?: string;
217
243
  /**
218
244
  * Keep the host app's SPA navigation when enabled.
219
245
  */
@@ -1 +1 @@
1
- export declare const translate: (key: string, customLang?: any) => string;
1
+ export declare const translate: (key: string, customLang?: any, customTranslations?: Record<string, Record<string, string>>) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/blog-articles-grid",
3
- "version": "1.98.29",
3
+ "version": "1.98.30",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",