@aiconomy/aico-components 0.0.57 → 0.0.78

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 (222) hide show
  1. package/dist/aico-components/aico-components.css +1 -1
  2. package/dist/aico-components/aico-components.esm.js +1 -1
  3. package/dist/aico-components/aico-components.esm.js.map +1 -1
  4. package/dist/aico-components/p-0b6e7469.entry.js +2 -0
  5. package/dist/aico-components/p-0b6e7469.entry.js.map +1 -0
  6. package/dist/aico-components/p-19752961.entry.js +2 -0
  7. package/dist/aico-components/p-19752961.entry.js.map +1 -0
  8. package/dist/aico-components/p-2677f2ab.js +2 -0
  9. package/dist/aico-components/p-2677f2ab.js.map +1 -0
  10. package/dist/aico-components/{p-1c4a07ef.entry.js → p-368503ee.entry.js} +3 -3
  11. package/dist/aico-components/p-368503ee.entry.js.map +1 -0
  12. package/dist/aico-components/p-7e0074f7.entry.js +2 -0
  13. package/dist/aico-components/p-7e0074f7.entry.js.map +1 -0
  14. package/dist/aico-components/p-9ea26390.entry.js +2 -0
  15. package/dist/aico-components/p-9ea26390.entry.js.map +1 -0
  16. package/dist/aico-components/p-bccf08d0.entry.js +2 -0
  17. package/dist/aico-components/p-bccf08d0.entry.js.map +1 -0
  18. package/dist/aico-components/p-c9eea1b1.entry.js +2 -0
  19. package/dist/aico-components/p-c9eea1b1.entry.js.map +1 -0
  20. package/dist/cjs/aico-album-content_19.cjs.entry.js +76 -53
  21. package/dist/cjs/aico-album-content_19.cjs.entry.js.map +1 -1
  22. package/dist/cjs/aico-article-detail.cjs.entry.js +18 -17
  23. package/dist/cjs/aico-article-detail.cjs.entry.js.map +1 -1
  24. package/dist/cjs/aico-components.cjs.js +1 -1
  25. package/dist/cjs/aico-fetch-article-detail.cjs.entry.js +3 -2
  26. package/dist/cjs/aico-fetch-article-detail.cjs.entry.js.map +1 -1
  27. package/dist/cjs/aico-news-list-item.cjs.entry.js +1 -1
  28. package/dist/cjs/aico-news-list-item.cjs.entry.js.map +1 -1
  29. package/dist/cjs/aico-news-list.cjs.entry.js +4 -3
  30. package/dist/cjs/aico-news-list.cjs.entry.js.map +1 -1
  31. package/dist/cjs/aico-no-content_2.cjs.entry.js +5 -3
  32. package/dist/cjs/aico-no-content_2.cjs.entry.js.map +1 -1
  33. package/dist/cjs/aico-special-news-carousel.cjs.entry.js +4 -3
  34. package/dist/cjs/aico-special-news-carousel.cjs.entry.js.map +1 -1
  35. package/dist/cjs/loader.cjs.js +1 -1
  36. package/dist/cjs/{utils-095ed22b.js → utils-c1b7a052.js} +11 -5
  37. package/dist/cjs/utils-c1b7a052.js.map +1 -0
  38. package/dist/collection/components/aico-article-detail/aico-article-detail.js +36 -17
  39. package/dist/collection/components/aico-article-detail/aico-article-detail.js.map +1 -1
  40. package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js +20 -1
  41. package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map +1 -1
  42. package/dist/collection/components/aico-news-list/aico-news-list.js +19 -2
  43. package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -1
  44. package/dist/collection/components/aico-news-list-item/aico-news-list-item.js +1 -1
  45. package/dist/collection/components/aico-news-list-item/aico-news-list-item.js.map +1 -1
  46. package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js +19 -2
  47. package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -1
  48. package/dist/collection/components/content/aico-asking-content/aico-asking-content.js +22 -3
  49. package/dist/collection/components/content/aico-asking-content/aico-asking-content.js.map +1 -1
  50. package/dist/collection/components/content/aico-asking-content/aico-asking-content.stories.js +16 -0
  51. package/dist/collection/components/content/aico-asking-content/aico-asking-content.stories.js.map +1 -1
  52. package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.js +21 -1
  53. package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.js.map +1 -1
  54. package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.stories.js +18 -0
  55. package/dist/collection/components/content/aico-block-quote-content/aico-block-quote-content.stories.js.map +1 -1
  56. package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.js +25 -5
  57. package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.js.map +1 -1
  58. package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.stories.js +29 -0
  59. package/dist/collection/components/content/aico-bullet-content/aico-bullet-content.stories.js.map +1 -1
  60. package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.js +25 -3
  61. package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.js.map +1 -1
  62. package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.stories.js +35 -3
  63. package/dist/collection/components/content/aico-carousel-content/aico-carousel-content.stories.js.map +1 -1
  64. package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.js +22 -3
  65. package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.js.map +1 -1
  66. package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.stories.js +10 -0
  67. package/dist/collection/components/content/aico-content-card-content/aico-content-card-content.stories.js.map +1 -1
  68. package/dist/collection/components/content/aico-divider-content/aico-divider-content.js +21 -1
  69. package/dist/collection/components/content/aico-divider-content/aico-divider-content.js.map +1 -1
  70. package/dist/collection/components/content/aico-divider-content/aico-divider-content.stories.js +9 -0
  71. package/dist/collection/components/content/aico-divider-content/aico-divider-content.stories.js.map +1 -1
  72. package/dist/collection/components/content/aico-document-content/aico-document-content.js +22 -3
  73. package/dist/collection/components/content/aico-document-content/aico-document-content.js.map +1 -1
  74. package/dist/collection/components/content/aico-document-content/aico-document-content.stories.js +11 -0
  75. package/dist/collection/components/content/aico-document-content/aico-document-content.stories.js.map +1 -1
  76. package/dist/collection/components/content/aico-faq-content/aico-faq-content.js +21 -1
  77. package/dist/collection/components/content/aico-faq-content/aico-faq-content.js.map +1 -1
  78. package/dist/collection/components/content/aico-faq-content/aico-faq-content.stories.js +25 -0
  79. package/dist/collection/components/content/aico-faq-content/aico-faq-content.stories.js.map +1 -1
  80. package/dist/collection/components/content/aico-heading-content/aico-heading-content.js +22 -2
  81. package/dist/collection/components/content/aico-heading-content/aico-heading-content.js.map +1 -1
  82. package/dist/collection/components/content/aico-heading-content/aico-heading-content.stories.js +10 -0
  83. package/dist/collection/components/content/aico-heading-content/aico-heading-content.stories.js.map +1 -1
  84. package/dist/collection/components/content/aico-html-content/aico-html-content.js +22 -4
  85. package/dist/collection/components/content/aico-html-content/aico-html-content.js.map +1 -1
  86. package/dist/collection/components/content/aico-link-content/aico-link-content.js +22 -3
  87. package/dist/collection/components/content/aico-link-content/aico-link-content.js.map +1 -1
  88. package/dist/collection/components/content/aico-link-content/aico-link-content.stories.js +24 -0
  89. package/dist/collection/components/content/aico-link-content/aico-link-content.stories.js.map +1 -1
  90. package/dist/collection/components/content/aico-page-content/aico-page-content.js +23 -4
  91. package/dist/collection/components/content/aico-page-content/aico-page-content.js.map +1 -1
  92. package/dist/collection/components/content/aico-page-content/aico-page-content.stories.js +11 -0
  93. package/dist/collection/components/content/aico-page-content/aico-page-content.stories.js.map +1 -1
  94. package/dist/collection/components/content/aico-table-content/aico-table-content.js +26 -6
  95. package/dist/collection/components/content/aico-table-content/aico-table-content.js.map +1 -1
  96. package/dist/collection/components/content/aico-table-content/aico-table-content.stories.js +58 -0
  97. package/dist/collection/components/content/aico-table-content/aico-table-content.stories.js.map +1 -1
  98. package/dist/collection/components/content/aico-text-content/aico-text-content.js +25 -9
  99. package/dist/collection/components/content/aico-text-content/aico-text-content.js.map +1 -1
  100. package/dist/collection/components/content/aico-text-content/aico-text-content.stories.js +55 -0
  101. package/dist/collection/components/content/aico-text-content/aico-text-content.stories.js.map +1 -1
  102. package/dist/collection/components/content/aico-title-content/aico-title-content.js +23 -3
  103. package/dist/collection/components/content/aico-title-content/aico-title-content.js.map +1 -1
  104. package/dist/collection/components/content/aico-title-content/aico-title-content.stories.js +12 -1
  105. package/dist/collection/components/content/aico-title-content/aico-title-content.stories.js.map +1 -1
  106. package/dist/collection/components/content/aico-upload-content/aico-upload-content.js +22 -2
  107. package/dist/collection/components/content/aico-upload-content/aico-upload-content.js.map +1 -1
  108. package/dist/collection/components/content/aico-upload-content/aico-upload-content.stories.js +8 -0
  109. package/dist/collection/components/content/aico-upload-content/aico-upload-content.stories.js.map +1 -1
  110. package/dist/collection/components/content/aico-video-content/aico-video-content.js +22 -2
  111. package/dist/collection/components/content/aico-video-content/aico-video-content.js.map +1 -1
  112. package/dist/collection/components/content/aico-video-content/aico-video-content.stories.js +17 -0
  113. package/dist/collection/components/content/aico-video-content/aico-video-content.stories.js.map +1 -1
  114. package/dist/collection/model/article/content/CarouselContent.js.map +1 -1
  115. package/dist/collection/utils/utils.js +10 -4
  116. package/dist/collection/utils/utils.js.map +1 -1
  117. package/dist/components/aico-article-detail2.js +20 -18
  118. package/dist/components/aico-article-detail2.js.map +1 -1
  119. package/dist/components/aico-asking-content2.js +6 -4
  120. package/dist/components/aico-asking-content2.js.map +1 -1
  121. package/dist/components/aico-block-quote-content2.js +5 -2
  122. package/dist/components/aico-block-quote-content2.js.map +1 -1
  123. package/dist/components/aico-bullet-content2.js +9 -6
  124. package/dist/components/aico-bullet-content2.js.map +1 -1
  125. package/dist/components/aico-carousel-content2.js +9 -4
  126. package/dist/components/aico-carousel-content2.js.map +1 -1
  127. package/dist/components/aico-content-card-content2.js +6 -4
  128. package/dist/components/aico-content-card-content2.js.map +1 -1
  129. package/dist/components/aico-divider-content2.js +5 -2
  130. package/dist/components/aico-divider-content2.js.map +1 -1
  131. package/dist/components/aico-document-content2.js +6 -4
  132. package/dist/components/aico-document-content2.js.map +1 -1
  133. package/dist/components/aico-faq-content2.js +5 -2
  134. package/dist/components/aico-faq-content2.js.map +1 -1
  135. package/dist/components/aico-fetch-article-detail.js +3 -1
  136. package/dist/components/aico-fetch-article-detail.js.map +1 -1
  137. package/dist/components/aico-heading-content2.js +6 -3
  138. package/dist/components/aico-heading-content2.js.map +1 -1
  139. package/dist/components/aico-html-content2.js +7 -12
  140. package/dist/components/aico-html-content2.js.map +1 -1
  141. package/dist/components/aico-link-content2.js +6 -4
  142. package/dist/components/aico-link-content2.js.map +1 -1
  143. package/dist/components/aico-news-list-item2.js +1 -1
  144. package/dist/components/aico-news-list-item2.js.map +1 -1
  145. package/dist/components/aico-news-list.js +4 -2
  146. package/dist/components/aico-news-list.js.map +1 -1
  147. package/dist/components/aico-page-content2.js +7 -5
  148. package/dist/components/aico-page-content2.js.map +1 -1
  149. package/dist/components/aico-special-news-carousel.js +4 -2
  150. package/dist/components/aico-special-news-carousel.js.map +1 -1
  151. package/dist/components/aico-table-content2.js +10 -7
  152. package/dist/components/aico-table-content2.js.map +1 -1
  153. package/dist/components/aico-text-content2.js +9 -10
  154. package/dist/components/aico-text-content2.js.map +1 -1
  155. package/dist/components/aico-title-content2.js +7 -4
  156. package/dist/components/aico-title-content2.js.map +1 -1
  157. package/dist/components/aico-upload-content2.js +6 -3
  158. package/dist/components/aico-upload-content2.js.map +1 -1
  159. package/dist/components/aico-video-content2.js +6 -3
  160. package/dist/components/aico-video-content2.js.map +1 -1
  161. package/dist/components/utils.js +10 -4
  162. package/dist/components/utils.js.map +1 -1
  163. package/dist/esm/aico-album-content_19.entry.js +76 -53
  164. package/dist/esm/aico-album-content_19.entry.js.map +1 -1
  165. package/dist/esm/aico-article-detail.entry.js +18 -17
  166. package/dist/esm/aico-article-detail.entry.js.map +1 -1
  167. package/dist/esm/aico-components.js +1 -1
  168. package/dist/esm/aico-fetch-article-detail.entry.js +3 -2
  169. package/dist/esm/aico-fetch-article-detail.entry.js.map +1 -1
  170. package/dist/esm/aico-news-list-item.entry.js +1 -1
  171. package/dist/esm/aico-news-list-item.entry.js.map +1 -1
  172. package/dist/esm/aico-news-list.entry.js +4 -3
  173. package/dist/esm/aico-news-list.entry.js.map +1 -1
  174. package/dist/esm/aico-no-content_2.entry.js +5 -3
  175. package/dist/esm/aico-no-content_2.entry.js.map +1 -1
  176. package/dist/esm/aico-special-news-carousel.entry.js +4 -3
  177. package/dist/esm/aico-special-news-carousel.entry.js.map +1 -1
  178. package/dist/esm/loader.js +1 -1
  179. package/dist/esm/{utils-54ffec33.js → utils-b4eec8e9.js} +11 -5
  180. package/dist/esm/utils-b4eec8e9.js.map +1 -0
  181. package/dist/types/components/aico-article-detail/aico-article-detail.d.ts +1 -0
  182. package/dist/types/components/aico-fetch-article-detail/aico-fetch-article-detail.d.ts +1 -0
  183. package/dist/types/components/aico-news-list/aico-news-list.d.ts +1 -0
  184. package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +1 -0
  185. package/dist/types/components/content/aico-asking-content/aico-asking-content.d.ts +1 -0
  186. package/dist/types/components/content/aico-block-quote-content/aico-block-quote-content.d.ts +1 -0
  187. package/dist/types/components/content/aico-bullet-content/aico-bullet-content.d.ts +1 -0
  188. package/dist/types/components/content/aico-carousel-content/aico-carousel-content.d.ts +1 -0
  189. package/dist/types/components/content/aico-content-card-content/aico-content-card-content.d.ts +1 -0
  190. package/dist/types/components/content/aico-divider-content/aico-divider-content.d.ts +1 -0
  191. package/dist/types/components/content/aico-document-content/aico-document-content.d.ts +1 -0
  192. package/dist/types/components/content/aico-faq-content/aico-faq-content.d.ts +1 -0
  193. package/dist/types/components/content/aico-heading-content/aico-heading-content.d.ts +1 -0
  194. package/dist/types/components/content/aico-html-content/aico-html-content.d.ts +1 -0
  195. package/dist/types/components/content/aico-link-content/aico-link-content.d.ts +1 -0
  196. package/dist/types/components/content/aico-page-content/aico-page-content.d.ts +1 -0
  197. package/dist/types/components/content/aico-table-content/aico-table-content.d.ts +1 -0
  198. package/dist/types/components/content/aico-text-content/aico-text-content.d.ts +1 -0
  199. package/dist/types/components/content/aico-title-content/aico-title-content.d.ts +1 -0
  200. package/dist/types/components/content/aico-upload-content/aico-upload-content.d.ts +1 -0
  201. package/dist/types/components/content/aico-video-content/aico-video-content.d.ts +1 -0
  202. package/dist/types/components.d.ts +42 -0
  203. package/dist/types/model/article/content/CarouselContent.d.ts +4 -2
  204. package/dist/types/utils/utils.d.ts +2 -2
  205. package/package.json +3 -2
  206. package/dist/aico-components/p-0ca1f065.entry.js +0 -2
  207. package/dist/aico-components/p-0ca1f065.entry.js.map +0 -1
  208. package/dist/aico-components/p-1c4a07ef.entry.js.map +0 -1
  209. package/dist/aico-components/p-406fa2e5.entry.js +0 -2
  210. package/dist/aico-components/p-406fa2e5.entry.js.map +0 -1
  211. package/dist/aico-components/p-4c0f3325.entry.js +0 -2
  212. package/dist/aico-components/p-4c0f3325.entry.js.map +0 -1
  213. package/dist/aico-components/p-5109399b.entry.js +0 -2
  214. package/dist/aico-components/p-5109399b.entry.js.map +0 -1
  215. package/dist/aico-components/p-6464810e.entry.js +0 -2
  216. package/dist/aico-components/p-6464810e.entry.js.map +0 -1
  217. package/dist/aico-components/p-b1f8308f.entry.js +0 -2
  218. package/dist/aico-components/p-b1f8308f.entry.js.map +0 -1
  219. package/dist/aico-components/p-dfd3b0d3.js +0 -2
  220. package/dist/aico-components/p-dfd3b0d3.js.map +0 -1
  221. package/dist/cjs/utils-095ed22b.js.map +0 -1
  222. package/dist/esm/utils-54ffec33.js.map +0 -1
@@ -4,15 +4,16 @@ import ConditionalRender from "../../../utils/ConditionalRender";
4
4
  export class AicoPageContent {
5
5
  constructor() {
6
6
  this.content = undefined;
7
+ this.locale = 'de';
7
8
  }
8
9
  render() {
9
- var _a, _b, _c, _d;
10
- const translation = this.content.landingPage.translations.length > 0 ? this.content.landingPage.translations[0] : null;
11
- return (h(Host, { style: { 'max-width': '300px' } }, h("div", { class: "card pe-auto" }, h("div", { class: "ratio ratio-4x3" }, h("img", { class: "card-img-top img-fluid object-fit-cover", style: { 'object-position': 'center' }, src: (_a = this.content.landingPage.image) !== null && _a !== void 0 ? _a : 'https://cdn.shopify.com/s/files/1/0565/2201/4813/files/blank-img.png?v=13432316686103745237%20406w', alt: (_b = translation === null || translation === void 0 ? void 0 : translation.imageAlt) !== null && _b !== void 0 ? _b : 'Landing page image' })), h("div", { class: "card-body", style: { 'min-height': '6rem' } }, h("h5", { class: "card-title" }, translation === null || translation === void 0 ? void 0 : translation.name), h(ConditionalRender, { condition: this.content.openExternalLink && !strIsNullOrEmptyOrWhitespace(this.content.externalLink) }, h("a", { href: this.content.externalLink, class: "card-link" }, (_c = translation === null || translation === void 0 ? void 0 : translation.buttonText) !== null && _c !== void 0 ? _c : 'Navigate to page')), h(ConditionalRender, { condition: !this.content.openExternalLink }, h("a", { href: "#", class: "card-link", onClick: e => {
10
+ var _a, _b, _c, _d, _e;
11
+ const translation = (_a = this.content.landingPage.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
12
+ return (h(Host, { style: { 'max-width': '300px' } }, h("div", { class: "card pe-auto" }, h("div", { class: "ratio ratio-4x3" }, h("img", { class: "card-img-top img-fluid object-fit-cover", style: { 'object-position': 'center' }, src: (_b = this.content.landingPage.image) !== null && _b !== void 0 ? _b : 'https://cdn.shopify.com/s/files/1/0565/2201/4813/files/blank-img.png?v=13432316686103745237%20406w', alt: (_c = translation === null || translation === void 0 ? void 0 : translation.imageAlt) !== null && _c !== void 0 ? _c : 'Landing page image' })), h("div", { class: "card-body", style: { 'min-height': '6rem' } }, h("h5", { class: "card-title" }, translation === null || translation === void 0 ? void 0 : translation.name), h(ConditionalRender, { condition: this.content.openExternalLink && !strIsNullOrEmptyOrWhitespace(this.content.externalLink) }, h("a", { href: this.content.externalLink, class: "card-link" }, (_d = translation === null || translation === void 0 ? void 0 : translation.buttonText) !== null && _d !== void 0 ? _d : 'Navigate to page')), h(ConditionalRender, { condition: !this.content.openExternalLink }, h("a", { href: "#", class: "card-link", onClick: e => {
12
13
  var _a;
13
14
  e.preventDefault();
14
15
  (_a = this.pageClicked) === null || _a === void 0 ? void 0 : _a.emit(this.content);
15
- } }, (_d = translation === null || translation === void 0 ? void 0 : translation.buttonText) !== null && _d !== void 0 ? _d : 'Navigate to page'))), h(ConditionalRender, { condition: translation !== null && !strIsNullOrEmptyOrWhitespace(translation.excerpt) }, h("div", { class: "card-footer" }, h("small", { class: "text-muted" }, translation === null || translation === void 0 ? void 0 : translation.excerpt))))));
16
+ } }, (_e = translation === null || translation === void 0 ? void 0 : translation.buttonText) !== null && _e !== void 0 ? _e : 'Navigate to page'))), h(ConditionalRender, { condition: translation !== null && !strIsNullOrEmptyOrWhitespace(translation.excerpt) }, h("div", { class: "card-footer" }, h("small", { class: "text-muted" }, translation === null || translation === void 0 ? void 0 : translation.excerpt))))));
16
17
  }
17
18
  static get is() { return "aico-page-content"; }
18
19
  static get encapsulation() { return "scoped"; }
@@ -48,6 +49,24 @@ export class AicoPageContent {
48
49
  "tags": [],
49
50
  "text": ""
50
51
  }
52
+ },
53
+ "locale": {
54
+ "type": "string",
55
+ "mutable": false,
56
+ "complexType": {
57
+ "original": "string",
58
+ "resolved": "string",
59
+ "references": {}
60
+ },
61
+ "required": false,
62
+ "optional": false,
63
+ "docs": {
64
+ "tags": [],
65
+ "text": ""
66
+ },
67
+ "attribute": "locale",
68
+ "reflect": false,
69
+ "defaultValue": "'de'"
51
70
  }
52
71
  };
53
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aico-page-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-page-content/aico-page-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAOjE,MAAM,OAAO,eAAe;;;;IAK1B,MAAM;;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACvH,OAAO,CACL,EAAC,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B;gBACN,EAAC,iBAAiB,IAAC,SAAS,EAAE,WAAW,KAAK,IAAI,IAAI,CAAC,4BAA4B,CAAC,WAAW,CAAC,OAAO,CAAC;oBACtG,WAAK,KAAK,EAAC,aAAa;wBACtB,aAAO,KAAK,EAAC,YAAY,IAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAS,CACpD,CACY,CAChB,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport type { PageContent } from '../../../model/article/content/PageContent';\nimport { strIsNullOrEmptyOrWhitespace } from '../../../utils/utils';\nimport ConditionalRender from '../../../utils/ConditionalRender';\n\n@Component({\n tag: 'aico-page-content',\n styleUrl: 'aico-page-content.css',\n scoped: true,\n})\nexport class AicoPageContent {\n @Prop() content!: PageContent;\n\n @Event() pageClicked?: EventEmitter<PageContent>;\n\n render() {\n const translation = this.content.landingPage.translations.length > 0 ? this.content.landingPage.translations[0] : null;\n return (\n <Host style={{ 'max-width': '300px' }}>\n <div class=\"card pe-auto\">\n <div class=\"ratio ratio-4x3\">\n <img\n class=\"card-img-top img-fluid object-fit-cover\"\n style={{ 'object-position': 'center' }}\n src={this.content.landingPage.image ?? 'https://cdn.shopify.com/s/files/1/0565/2201/4813/files/blank-img.png?v=13432316686103745237%20406w'}\n alt={translation?.imageAlt ?? 'Landing page image'}\n />\n </div>\n <div class=\"card-body\" style={{ 'min-height': '6rem' }}>\n <h5 class=\"card-title\">{translation?.name}</h5>\n <ConditionalRender condition={this.content.openExternalLink && !strIsNullOrEmptyOrWhitespace(this.content.externalLink)}>\n <a href={this.content.externalLink!} class=\"card-link\">\n {translation?.buttonText ?? 'Navigate to page'}\n </a>\n </ConditionalRender>\n <ConditionalRender condition={!this.content.openExternalLink}>\n <a\n href=\"#\"\n class=\"card-link\"\n onClick={e => {\n e.preventDefault();\n this.pageClicked?.emit(this.content);\n }}\n >\n {translation?.buttonText ?? 'Navigate to page'}\n </a>\n </ConditionalRender>\n </div>\n <ConditionalRender condition={translation !== null && !strIsNullOrEmptyOrWhitespace(translation.excerpt)}>\n <div class=\"card-footer\">\n <small class=\"text-muted\">{translation?.excerpt}</small>\n </div>\n </ConditionalRender>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"aico-page-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-page-content/aico-page-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAOjE,MAAM,OAAO,eAAe;;;sBAGD,IAAI;;IAI7B,MAAM;;QACJ,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;QAC1H,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE;YACnC,WAAK,KAAK,EAAC,cAAc;gBACvB,WAAK,KAAK,EAAC,iBAAiB;oBAC1B,WACE,KAAK,EAAC,yCAAyC,EAC/C,KAAK,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EACtC,GAAG,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,mCAAI,oGAAoG,EAC3I,GAAG,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,oBAAoB,GAClD,CACE;gBACN,WAAK,KAAK,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;oBACpD,UAAI,KAAK,EAAC,YAAY,IAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAM;oBAC/C,EAAC,iBAAiB,IAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;wBACrH,SAAG,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAa,EAAE,KAAK,EAAC,WAAW,IACnD,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAU,mCAAI,kBAAkB,CAC5C,CACc;oBACpB,EAAC,iBAAiB,IAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB;wBAC1D,SACE,IAAI,EAAC,GAAG,EACR,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,CAAC,CAAC,EAAE;;gCACX,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;4BACvC,CAAC,IAEA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAU,mCAAI,kBAAkB,CAC5C,CACc,CAChB;gBACN,EAAC,iBAAiB,IAAC,SAAS,EAAE,WAAW,KAAK,IAAI,IAAI,CAAC,4BAA4B,CAAC,WAAW,CAAC,OAAO,CAAC;oBACtG,WAAK,KAAK,EAAC,aAAa;wBACtB,aAAO,KAAK,EAAC,YAAY,IAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAS,CACpD,CACY,CAChB,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport type { PageContent } from '../../../model/article/content/PageContent';\nimport { strIsNullOrEmptyOrWhitespace } from '../../../utils/utils';\nimport ConditionalRender from '../../../utils/ConditionalRender';\n\n@Component({\n tag: 'aico-page-content',\n styleUrl: 'aico-page-content.css',\n scoped: true,\n})\nexport class AicoPageContent {\n @Prop() content!: PageContent;\n\n @Prop() locale: string = 'de';\n\n @Event() pageClicked?: EventEmitter<PageContent>;\n\n render() {\n const translation = this.content.landingPage.translations.find(translation => translation.locale === this.locale) ?? null;\n return (\n <Host style={{ 'max-width': '300px' }}>\n <div class=\"card pe-auto\">\n <div class=\"ratio ratio-4x3\">\n <img\n class=\"card-img-top img-fluid object-fit-cover\"\n style={{ 'object-position': 'center' }}\n src={this.content.landingPage.image ?? 'https://cdn.shopify.com/s/files/1/0565/2201/4813/files/blank-img.png?v=13432316686103745237%20406w'}\n alt={translation?.imageAlt ?? 'Landing page image'}\n />\n </div>\n <div class=\"card-body\" style={{ 'min-height': '6rem' }}>\n <h5 class=\"card-title\">{translation?.name}</h5>\n <ConditionalRender condition={this.content.openExternalLink && !strIsNullOrEmptyOrWhitespace(this.content.externalLink)}>\n <a href={this.content.externalLink!} class=\"card-link\">\n {translation?.buttonText ?? 'Navigate to page'}\n </a>\n </ConditionalRender>\n <ConditionalRender condition={!this.content.openExternalLink}>\n <a\n href=\"#\"\n class=\"card-link\"\n onClick={e => {\n e.preventDefault();\n this.pageClicked?.emit(this.content);\n }}\n >\n {translation?.buttonText ?? 'Navigate to page'}\n </a>\n </ConditionalRender>\n </div>\n <ConditionalRender condition={translation !== null && !strIsNullOrEmptyOrWhitespace(translation.excerpt)}>\n <div class=\"card-footer\">\n <small class=\"text-muted\">{translation?.excerpt}</small>\n </div>\n </ConditionalRender>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -4,6 +4,7 @@ const meta = {
4
4
  export default meta;
5
5
  export const Exampl = {
6
6
  args: {
7
+ locale: 'de',
7
8
  content: {
8
9
  id: 1234,
9
10
  createdAt: new Date(),
@@ -26,6 +27,16 @@ export const Exampl = {
26
27
  imageAlt: 'Image alt',
27
28
  excerpt: 'Soon',
28
29
  },
30
+ {
31
+ id: 1234,
32
+ createdAt: new Date(),
33
+ updatedAt: new Date(),
34
+ locale: 'de',
35
+ name: 'Page name de',
36
+ buttonText: 'See the article de',
37
+ imageAlt: 'Image alt',
38
+ excerpt: 'Soon de',
39
+ },
29
40
  ],
30
41
  isPublic: false,
31
42
  isTemplate: false,
@@ -1 +1 @@
1
- {"version":3,"file":"aico-page-content.stories.js","sourceRoot":"","sources":["../../../../src/components/content/aico-page-content/aico-page-content.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA8B;IACtC,SAAS,EAAE,mBAAmB;CAC/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,MAAM,GAAa;IAC9B,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,6CAA6C;YAC3D,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE;gBACX,EAAE,EAAE,IAAI;gBACR,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,YAAY,EAAE;oBACZ;wBACE,EAAE,EAAE,IAAI;wBACR,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,MAAM,EAAE,OAAO;wBACf,IAAI,EAAE,WAAW;wBACjB,UAAU,EAAE,iBAAiB;wBAC7B,QAAQ,EAAE,WAAW;wBACrB,OAAO,EAAE,MAAM;qBAChB;iBACF;gBACD,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,KAAK;gBACjB,KAAK,EAAE,4CAA4C;aACpD;SACa;KACjB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport type { PageContent } from '../../../model/article/content/PageContent';\nimport { JSX } from '../../../components';\n\nconst meta: Meta<JSX.AicoPageContent> = {\n component: 'aico-page-content',\n};\n\nexport default meta;\n\nexport const Exampl: StoryObj = {\n args: {\n content: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n openExternalLink: true,\n externalLink: 'https://www.youtube.com/watch?v=xvFZjo5PgG0',\n isImageZoomedIn: false,\n landingPage: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n locale: 'en-GB',\n name: 'Page name',\n buttonText: 'See the article',\n imageAlt: 'Image alt',\n excerpt: 'Soon',\n },\n ],\n isPublic: false,\n isTemplate: false,\n image: 'https://source.unsplash.com/random/320x240',\n },\n } as PageContent,\n },\n};\n"]}
1
+ {"version":3,"file":"aico-page-content.stories.js","sourceRoot":"","sources":["../../../../src/components/content/aico-page-content/aico-page-content.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA8B;IACtC,SAAS,EAAE,mBAAmB;CAC/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,MAAM,GAAa;IAC9B,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE;YACP,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,6CAA6C;YAC3D,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE;gBACX,EAAE,EAAE,IAAI;gBACR,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,YAAY,EAAE;oBACZ;wBACE,EAAE,EAAE,IAAI;wBACR,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,MAAM,EAAE,OAAO;wBACf,IAAI,EAAE,WAAW;wBACjB,UAAU,EAAE,iBAAiB;wBAC7B,QAAQ,EAAE,WAAW;wBACrB,OAAO,EAAE,MAAM;qBAChB;oBACD;wBACE,EAAE,EAAE,IAAI;wBACR,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;wBACrB,MAAM,EAAE,IAAI;wBACZ,IAAI,EAAE,cAAc;wBACpB,UAAU,EAAE,oBAAoB;wBAChC,QAAQ,EAAE,WAAW;wBACrB,OAAO,EAAE,SAAS;qBACnB;iBACF;gBACD,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,KAAK;gBACjB,KAAK,EAAE,4CAA4C;aACpD;SACa;KACjB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport type { PageContent } from '../../../model/article/content/PageContent';\nimport { JSX } from '../../../components';\n\nconst meta: Meta<JSX.AicoPageContent> = {\n component: 'aico-page-content',\n};\n\nexport default meta;\n\nexport const Exampl: StoryObj = {\n args: {\n locale: 'de',\n content: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n openExternalLink: true,\n externalLink: 'https://www.youtube.com/watch?v=xvFZjo5PgG0',\n isImageZoomedIn: false,\n landingPage: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n locale: 'en-GB',\n name: 'Page name',\n buttonText: 'See the article',\n imageAlt: 'Image alt',\n excerpt: 'Soon',\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n locale: 'de',\n name: 'Page name de',\n buttonText: 'See the article de',\n imageAlt: 'Image alt',\n excerpt: 'Soon de',\n },\n ],\n isPublic: false,\n isTemplate: false,\n image: 'https://source.unsplash.com/random/320x240',\n },\n } as PageContent,\n },\n};\n"]}
@@ -3,17 +3,19 @@ import ConditionalRender from "../../../utils/ConditionalRender";
3
3
  export class AicoTableContent {
4
4
  constructor() {
5
5
  this.content = undefined;
6
+ this.locale = 'de';
6
7
  }
7
8
  render() {
8
- var _a, _b;
9
- const translation = this.content.translations.length > 0 ? this.content.translations[0] : null;
10
- const firstBackgroundColor = (_a = this.content.firstColor) !== null && _a !== void 0 ? _a : '#d6dfe1';
11
- const secondBackgroundColor = (_b = this.content.secondColor) !== null && _b !== void 0 ? _b : '#e6eced';
12
- return (h("div", { class: "content-table card" }, h("div", { class: "card-body" }, h(ConditionalRender, { condition: translation !== null }, h("aico-title-content", { class: "card-title mt-0", content: this.makeTitleContent(translation) }), h("p", { class: "card-text" }, translation.additionalText)), h("table", { class: "table-content" }, this.content.tableRows
9
+ var _a, _b, _c;
10
+ const translation = (_a = this.content.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
11
+ const firstBackgroundColor = (_b = this.content.firstColor) !== null && _b !== void 0 ? _b : '#d6dfe1';
12
+ const secondBackgroundColor = (_c = this.content.secondColor) !== null && _c !== void 0 ? _c : '#e6eced';
13
+ return (h("div", { class: "content-table card" }, h("div", { class: "card-body" }, h(ConditionalRender, { condition: translation !== null }, h("aico-title-content", { class: "card-title mt-0", content: this.makeTitleContent(translation), locale: this.locale }), h("p", { class: "card-text" }, translation.additionalText)), h("table", { class: "table-content" }, this.content.tableRows
13
14
  .sort((a, b) => a.sort - b.sort)
14
15
  .map((row, index) => {
15
16
  return (h("tr", { style: { 'font-weight': '400', 'background-color': index % 2 === 0 ? firstBackgroundColor : secondBackgroundColor } }, row.rowColumns.map(col => {
16
- const translation = col.translations.length > 0 ? col.translations[0] : null;
17
+ var _a;
18
+ const translation = (_a = col.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
17
19
  if (!translation) {
18
20
  return row.isHeading ? h("th", null) : h("td", null);
19
21
  }
@@ -66,6 +68,24 @@ export class AicoTableContent {
66
68
  "tags": [],
67
69
  "text": ""
68
70
  }
71
+ },
72
+ "locale": {
73
+ "type": "string",
74
+ "mutable": false,
75
+ "complexType": {
76
+ "original": "string",
77
+ "resolved": "string",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": false,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": ""
85
+ },
86
+ "attribute": "locale",
87
+ "reflect": false,
88
+ "defaultValue": "'de'"
69
89
  }
70
90
  };
71
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aico-table-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-table-content/aico-table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAOjE,MAAM,OAAO,gBAAgB;;;;IAG3B,MAAM;;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE/F,MAAM,oBAAoB,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,UAAU,mCAAI,SAAS,CAAC;QAClE,MAAM,qBAAqB,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,WAAW,mCAAI,SAAS,CAAC;QAEpE,OAAO,CACL,WAAK,KAAK,EAAC,oBAAoB;YAC7B,WAAK,KAAK,EAAC,WAAW;gBACpB,EAAC,iBAAiB,IAAC,SAAS,EAAE,WAAW,KAAK,IAAI;oBAChD,0BAAoB,KAAK,EAAC,iBAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAY,CAAC,GAAI;oBAC5F,SAAG,KAAK,EAAC,WAAW,IAAE,WAAY,CAAC,cAAc,CAAK,CACpC;gBACpB,aAAO,KAAK,EAAC,eAAe,IACzB,IAAI,CAAC,OAAO,CAAC,SAAS;qBACpB,IAAI,CAAC,CAAC,CAAC,E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;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport type { TableContent } from '../../../model/article/content/TableContet';\nimport type { Translation } from '../../../model/article/Translation';\nimport type { TitleContent } from '../../../model/article/content/TitleContent';\nimport ConditionalRender from '../../../utils/ConditionalRender';\n\n@Component({\n tag: 'aico-table-content',\n styleUrl: 'aico-table-content.css',\n scoped: true,\n})\nexport class AicoTableContent {\n @Prop() content!: TableContent;\n\n render() {\n const translation = this.content.translations.length > 0 ? this.content.translations[0] : null;\n\n const firstBackgroundColor = this.content.firstColor ?? '#d6dfe1';\n const secondBackgroundColor = this.content.secondColor ?? '#e6eced';\n\n return (\n <div class=\"content-table card\">\n <div class=\"card-body\">\n <ConditionalRender condition={translation !== null}>\n <aico-title-content class=\"card-title mt-0\" content={this.makeTitleContent(translation!)} />\n <p class=\"card-text\">{translation!.additionalText}</p>\n </ConditionalRender>\n <table class=\"table-content\">\n {this.content.tableRows\n .sort((a, b) => a.sort - b.sort)\n .map((row, index) => {\n return (\n <tr style={{ 'font-weight': '400', 'background-color': index % 2 === 0 ? firstBackgroundColor : secondBackgroundColor }}>\n {row.rowColumns.map(col => {\n const translation = col.translations.length > 0 ? col.translations[0] : null;\n if (!translation) {\n return row.isHeading ? <th></th> : <td></td>;\n }\n\n return row.isHeading ? <th>{translation.columnData}</th> : <td>{translation.columnData}</td>;\n })}\n </tr>\n );\n })}\n </table>\n </div>\n </div>\n );\n }\n\n private makeTitleContent(translation: Translation): TitleContent {\n return {\n id: this.content.id,\n createdAt: this.content.createdAt,\n updatedAt: this.content.updatedAt,\n hasUnderscore: false,\n size: this.content.titleSize ?? 'h2',\n translations: [{ ...translation }],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"aico-table-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-table-content/aico-table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,iBA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WAAW,GAAG,MAAA,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;wBACrG,IAAI,CAAC,WAAW,EAAE;4BAChB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,aAAS,CAAC,CAAC,CAAC,aAAS,CAAC;yBAC9C;wBAED,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,cAAK,WAAW,CAAC,UAAU,CAAM,CAAC,CAAC,CAAC,cAAK,WAAW,CAAC,UAAU,CAAM,CAAC;oBAC/F,CAAC,CAAC,CACC,CACN,CAAC;gBACJ,CAAC,CAAC,CACE,CACJ,CACF,CACP,CAAC;IACJ,CAAC;IAEO,gBAAgB,CAAC,WAAwB;;QAC/C,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;YACnB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;YACjC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;YACjC,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,mCAAI,IAAI;YACpC,YAAY,EAAE,mBAAM,WAAW,EAAG;SACnC,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport type { TableContent } from '../../../model/article/content/TableContet';\nimport type { Translation } from '../../../model/article/Translation';\nimport type { TitleContent } from '../../../model/article/content/TitleContent';\nimport ConditionalRender from '../../../utils/ConditionalRender';\n\n@Component({\n tag: 'aico-table-content',\n styleUrl: 'aico-table-content.css',\n scoped: true,\n})\nexport class AicoTableContent {\n @Prop() content!: TableContent;\n\n @Prop() locale: string = 'de';\n\n render() {\n const translation = this.content.translations.find(translation => translation.locale === this.locale) ?? null;\n\n const firstBackgroundColor = this.content.firstColor ?? '#d6dfe1';\n const secondBackgroundColor = this.content.secondColor ?? '#e6eced';\n\n return (\n <div class=\"content-table card\">\n <div class=\"card-body\">\n <ConditionalRender condition={translation !== null}>\n <aico-title-content class=\"card-title mt-0\" content={this.makeTitleContent(translation!)} locale={this.locale} />\n <p class=\"card-text\">{translation!.additionalText}</p>\n </ConditionalRender>\n <table class=\"table-content\">\n {this.content.tableRows\n .sort((a, b) => a.sort - b.sort)\n .map((row, index) => {\n return (\n <tr style={{ 'font-weight': '400', 'background-color': index % 2 === 0 ? firstBackgroundColor : secondBackgroundColor }}>\n {row.rowColumns.map(col => {\n const translation = col.translations.find(translation => translation.locale === this.locale) ?? null;\n if (!translation) {\n return row.isHeading ? <th></th> : <td></td>;\n }\n\n return row.isHeading ? <th>{translation.columnData}</th> : <td>{translation.columnData}</td>;\n })}\n </tr>\n );\n })}\n </table>\n </div>\n </div>\n );\n }\n\n private makeTitleContent(translation: Translation): TitleContent {\n return {\n id: this.content.id,\n createdAt: this.content.createdAt,\n updatedAt: this.content.updatedAt,\n hasUnderscore: false,\n size: this.content.titleSize ?? 'h2',\n translations: [{ ...translation }],\n };\n }\n}\n"]}
@@ -4,6 +4,7 @@ const meta = {
4
4
  export default meta;
5
5
  export const Example = {
6
6
  args: {
7
+ locale: 'de',
7
8
  content: {
8
9
  id: 1234,
9
10
  createdAt: new Date(),
@@ -15,6 +16,15 @@ export const Example = {
15
16
  updatedAt: new Date(),
16
17
  title: 'Table title',
17
18
  additionalText: 'Additional text',
19
+ locale: 'de'
20
+ },
21
+ {
22
+ id: 1234,
23
+ createdAt: new Date(),
24
+ updatedAt: new Date(),
25
+ title: 'Table title en',
26
+ additionalText: 'Additional text en',
27
+ locale: 'en'
18
28
  },
19
29
  ],
20
30
  tableRows: [
@@ -35,6 +45,14 @@ export const Example = {
35
45
  createdAt: new Date(),
36
46
  updatedAt: new Date(),
37
47
  columnData: 'Heading 1',
48
+ locale: 'de'
49
+ },
50
+ {
51
+ id: 1234,
52
+ createdAt: new Date(),
53
+ updatedAt: new Date(),
54
+ columnData: 'Heading 1 en',
55
+ locale: 'en'
38
56
  },
39
57
  ],
40
58
  },
@@ -48,6 +66,14 @@ export const Example = {
48
66
  createdAt: new Date(),
49
67
  updatedAt: new Date(),
50
68
  columnData: 'Heading 2',
69
+ locale: 'de'
70
+ },
71
+ {
72
+ id: 1234,
73
+ createdAt: new Date(),
74
+ updatedAt: new Date(),
75
+ columnData: 'Heading 2 en',
76
+ locale: 'en'
51
77
  },
52
78
  ],
53
79
  },
@@ -70,6 +96,14 @@ export const Example = {
70
96
  createdAt: new Date(),
71
97
  updatedAt: new Date(),
72
98
  columnData: 'Cell 1x2',
99
+ locale: 'de'
100
+ },
101
+ {
102
+ id: 1234,
103
+ createdAt: new Date(),
104
+ updatedAt: new Date(),
105
+ columnData: 'Cell 1x2 en',
106
+ locale: 'en'
73
107
  },
74
108
  ],
75
109
  },
@@ -83,6 +117,14 @@ export const Example = {
83
117
  createdAt: new Date(),
84
118
  updatedAt: new Date(),
85
119
  columnData: 'Cell 2x2',
120
+ locale: 'de'
121
+ },
122
+ {
123
+ id: 1234,
124
+ createdAt: new Date(),
125
+ updatedAt: new Date(),
126
+ columnData: 'Cell 2x2 en',
127
+ locale: 'en'
86
128
  },
87
129
  ],
88
130
  },
@@ -105,6 +147,14 @@ export const Example = {
105
147
  createdAt: new Date(),
106
148
  updatedAt: new Date(),
107
149
  columnData: 'Cell 1x1',
150
+ locale: 'de'
151
+ },
152
+ {
153
+ id: 1234,
154
+ createdAt: new Date(),
155
+ updatedAt: new Date(),
156
+ columnData: 'Cell 1x1 en',
157
+ locale: 'en'
108
158
  },
109
159
  ],
110
160
  },
@@ -118,6 +168,14 @@ export const Example = {
118
168
  createdAt: new Date(),
119
169
  updatedAt: new Date(),
120
170
  columnData: 'Cell 2x1',
171
+ locale: 'de'
172
+ },
173
+ {
174
+ id: 1234,
175
+ createdAt: new Date(),
176
+ updatedAt: new Date(),
177
+ columnData: 'Cell 2x1 en',
178
+ locale: 'en'
121
179
  },
122
180
  ],
123
181
  },
@@ -1 +1 @@
1
- {"version":3,"file":"aico-table-content.stories.js","sourceRoot":"","sources":["../../../../src/components/content/aico-table-content/aico-table-content.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA+B;IACvC,SAAS,EAAE,oBAAoB;CAChC,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,YAAY,EAAE;gBACZ;oBACE,EAAE,EAAE,IAAI;oBACR,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,KAAK,EAAE,aAAa;oBACpB,cAAc,EAAE,iBAAiB;iBAClC;aACF;YACD,SAAS,EAAE;gBACT;oBACE,EAAE,EAAE,IAAI;oBACR,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,SAAS,EAAE,IAAI;oBACf,IAAI,EAAE,CAAC;oBACP,UAAU,EAAE;wBACV;4BACE,EAAE,EAAE,IAAI;4BACR,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,YAAY,EAAE;gCACZ;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,WAAW;iCACxB;6BACF;yBACF;wBACD;4BACE,EAAE,EAAE,IAAI;4BACR,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,YAAY,EAAE;gCACZ;oCACE,EAAE,EAAE,IAA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AS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,UAAU;iCACvB;6BACF;yBACF;wBACD;4BACE,EAAE,EAAE,IAAI;4BACR,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,YAAY,EAAE;gCACZ;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,UAAU;iCACvB;6BACF;yBACF;qBACF;iBACF;aACF;SACc;KAClB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport type { TableContent } from '../../../model/article/content/TableContet';\nimport { JSX } from '../../../components';\n\nconst meta: Meta<JSX.AicoTableContent> = {\n component: 'aico-table-content',\n};\n\nexport default meta;\ntype Story = StoryObj;\n\nexport const Example: Story = {\n args: {\n content: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n title: 'Table title',\n additionalText: 'Additional text',\n },\n ],\n tableRows: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: true,\n sort: 1,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 1',\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 2',\n },\n ],\n },\n ],\n },\n\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: false,\n sort: 3,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x2',\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 2x2',\n },\n ],\n },\n ],\n },\n\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: false,\n sort: 2,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x1',\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 2x1',\n },\n ],\n },\n ],\n },\n ],\n } as TableContent,\n },\n};\n"]}
1
+ {"version":3,"file":"aico-table-content.stories.js","sourceRoot":"","sources":["../../../../src/components/content/aico-table-content/aico-table-content.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA+B;IACvC,SAAS,EAAE,oBAAoB;CAChC,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE;YACP,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,YAAY,EAAE;gBACZ;oBACE,EAAE,EAAE,IAAI;oBACR,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,KAAK,EAAE,aAAa;oBACpB,cAAc,EAAE,iBAAiB;oBACjC,MAAM,EAAE,IAAI;iBACb;gBACD;oBACE,EAAE,EAAE,IAAI;oBACR,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,KAAK,EAAE,gBAAgB;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EAAE,IAAI;4BACR,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,YAAY,EAAE;gCACZ;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,UAAU;oCACtB,MAAM,EAAE,IAAI;iCACb;gCACD;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,aAAa;oCACzB,MAAM,EAAE,IAAI;iCACb;6BACF;yBACF;wBACD;4BACE,EAAE,EAAE,IAAI;4BACR,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;4BACrB,YAAY,EAAE;gCACZ;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,UAAU;oCACtB,MAAM,EAAE,IAAI;iCACb;gCACD;oCACE,EAAE,EAAE,IAAI;oCACR,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,SAAS,EAAE,IAAI,IAAI,EAAE;oCACrB,UAAU,EAAE,aAAa;oCACzB,MAAM,EAAE,IAAI;iCACb;6BACF;yBACF;qBACF;iBACF;aACF;SACc;KAClB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport type { TableContent } from '../../../model/article/content/TableContet';\nimport { JSX } from '../../../components';\n\nconst meta: Meta<JSX.AicoTableContent> = {\n component: 'aico-table-content',\n};\n\nexport default meta;\ntype Story = StoryObj;\n\nexport const Example: Story = {\n args: {\n locale: 'de',\n content: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n title: 'Table title',\n additionalText: 'Additional text',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n title: 'Table title en',\n additionalText: 'Additional text en',\n locale: 'en'\n },\n ],\n tableRows: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: true,\n sort: 1,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 1',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 1 en',\n locale: 'en'\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 2',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Heading 2 en',\n locale: 'en'\n },\n ],\n },\n ],\n },\n\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: false,\n sort: 3,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x2',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x2 en',\n locale: 'en'\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 2x2',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData:'Cell 2x2 en',\n locale: 'en'\n },\n ],\n },\n ],\n },\n\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n isHeading: false,\n sort: 2,\n rowColumns: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x1',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 1x1 en',\n locale: 'en'\n },\n ],\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 2x1',\n locale: 'de'\n },\n {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n columnData: 'Cell 2x1 en',\n locale: 'en'\n },\n ],\n },\n ],\n },\n ],\n } as TableContent,\n },\n};\n"]}
@@ -6,17 +6,15 @@ import "bootstrap";
6
6
  export class AicoTextContent {
7
7
  constructor() {
8
8
  this.content = undefined;
9
+ this.locale = 'de';
9
10
  }
10
11
  render() {
11
- var _a, _b, _c;
12
- if (this.content.translations.length === 0) {
13
- return h("aico-no-content", null);
14
- }
15
- const translation = this.content.translations.length > 0 ? this.content.translations[0] : null;
12
+ var _a, _b, _c, _d;
13
+ const translation = (_a = this.content.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
16
14
  const contentStyles = {};
17
15
  if (this.content.hasBackgroundColor) {
18
- contentStyles['background-color'] = (_a = this.content.backgroundColor) !== null && _a !== void 0 ? _a : 'white';
19
- contentStyles['color'] = (_b = this.content.textColor) !== null && _b !== void 0 ? _b : 'black';
16
+ contentStyles['background-color'] = (_b = this.content.backgroundColor) !== null && _b !== void 0 ? _b : 'white';
17
+ contentStyles['color'] = (_c = this.content.textColor) !== null && _c !== void 0 ? _c : 'black';
20
18
  contentStyles['width'] = '100%';
21
19
  contentStyles['padding'] = '15px';
22
20
  contentStyles['margin-top'] = '10px';
@@ -27,9 +25,9 @@ export class AicoTextContent {
27
25
  }
28
26
  if (this.content.alignmentEnabled) {
29
27
  contentStyles['display'] = 'flex';
30
- contentStyles['align-items'] = (_c = this.content.verticalAlign) !== null && _c !== void 0 ? _c : 'flex-start';
28
+ contentStyles['align-items'] = (_d = this.content.verticalAlign) !== null && _d !== void 0 ? _d : 'flex-start';
31
29
  }
32
- return (h(ConditionalRender, { condition: translation !== null }, h(ConditionalWrap, { condition: !strIsNullOrEmptyOrWhitespace(translation.promptText), wrap: children => (h("div", { class: "accordion", id: "aico-text-content" }, h("div", { class: "accordion-item" }, h("h2", { class: "accordion-header", id: "heading" }, h("button", { class: "accordion-button collapsed", type: "button", "data-bs-toggle": "collapse", "data-bs-target": "#collapse", "aria-expanded": "false", "aria-controls": "collapse" }, translation.promptText)), h("div", { id: "collapse", class: "accordion-collapse collapse", "aria-labelledby": "heading", "data-bs-parent": "#aico-text-content" }, h("div", { class: "accordion-body" }, children))))) }, h("div", { class: "card", style: contentStyles }, h("div", { class: "card-body w-100 border-0" }, h("aico-title-content", { class: "card-title", content: this.makeTitleContent(translation) }), h(ConditionalRender, { condition: this.shouldDisplayTextAndPicture(translation) }, h("div", { class: "row g-4" }, h("div", { class: getClass({
30
+ return (h(ConditionalRender, { condition: translation !== null }, h(ConditionalWrap, { condition: !strIsNullOrEmptyOrWhitespace(translation.promptText), wrap: children => (h("div", { class: "accordion", id: "aico-text-content" }, h("div", { class: "accordion-item" }, h("h2", { class: "accordion-header", id: "heading" }, h("button", { class: "accordion-button collapsed", type: "button", "data-bs-toggle": "collapse", "data-bs-target": "#collapse", "aria-expanded": "false", "aria-controls": "collapse" }, translation.promptText)), h("div", { id: "collapse", class: "accordion-collapse collapse", "aria-labelledby": "heading", "data-bs-parent": "#aico-text-content" }, h("div", { class: "accordion-body" }, children))))) }, h("div", { class: "card", style: contentStyles }, h("div", { class: "card-body w-100 border-0" }, h("aico-title-content", { class: "card-title", content: this.makeTitleContent(translation), locale: this.locale }), h(ConditionalRender, { condition: this.shouldDisplayTextAndPicture(translation) }, h("div", { class: "row g-4" }, h("div", { class: getClass({
33
31
  'col-md-8': true,
34
32
  'order-1': this.content.picturePosition === 'right',
35
33
  'order-2': this.content.picturePosition === 'left',
@@ -120,6 +118,24 @@ export class AicoTextContent {
120
118
  "tags": [],
121
119
  "text": ""
122
120
  }
121
+ },
122
+ "locale": {
123
+ "type": "string",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "string",
127
+ "resolved": "string",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": ""
135
+ },
136
+ "attribute": "locale",
137
+ "reflect": false,
138
+ "defaultValue": "'de'"
123
139
  }
124
140
  };
125
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aico-text-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-text-content/aico-text-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,WAAW,CAAC;AAOnB,MAAM,OAAO,eAAe;;;;IAG1B,MAAM;;QACJ,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,0BAAmB,CAAC;SAC5B;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/F,MAAM,aAAa,GAA0C,EAAE,CAAC;QAEhE,IAAI,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;YACnC,aAAa,CAAC,kBAAkB,CAAC,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,eA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;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, VNode, h } from '@stencil/core';\nimport ConditionalRender from '../../../utils/ConditionalRender';\nimport ConditionalWrap from '../../../utils/ConditionalWrap';\nimport type { TextContent, TextContentTranslation } from '../../../model/article/content/TextContent';\nimport type { TitleContent } from '../../../model/article/content/TitleContent';\nimport { getClass, strIsNullOrEmptyOrWhitespace } from '../../../utils/utils';\nimport 'bootstrap';\n\n@Component({\n tag: 'aico-text-content',\n styleUrl: 'aico-text-content.css',\n scoped: true,\n})\nexport class AicoTextContent {\n @Prop() content!: TextContent;\n\n render() {\n if (this.content.translations.length === 0) {\n return <aico-no-content />;\n }\n\n const translation = this.content.translations.length > 0 ? this.content.translations[0] : null;\n const contentStyles: { [key: string]: string | undefined } = {};\n\n if (this.content.hasBackgroundColor) {\n contentStyles['background-color'] = this.content.backgroundColor ?? 'white';\n contentStyles['color'] = this.content.textColor ?? 'black';\n contentStyles['width'] = '100%';\n contentStyles['padding'] = '15px';\n contentStyles['margin-top'] = '10px';\n }\n\n if (this.content.addBorder) {\n contentStyles['border'] = `3px solid ${this.content.borderColor}`;\n contentStyles['margin-top'] = '-3px';\n }\n\n if (this.content.alignmentEnabled) {\n contentStyles['display'] = 'flex';\n contentStyles['align-items'] = this.content.verticalAlign ?? 'flex-start';\n }\n\n return (\n <ConditionalRender condition={translation !== null}>\n <ConditionalWrap\n condition={!strIsNullOrEmptyOrWhitespace(translation!.promptText)}\n wrap={children => (\n <div class=\"accordion\" id=\"aico-text-content\">\n <div class=\"accordion-item\">\n <h2 class=\"accordion-header\" id=\"heading\">\n <button class=\"accordion-button collapsed\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapse\" aria-expanded=\"false\" aria-controls=\"collapse\">\n {translation!.promptText}\n </button>\n </h2>\n <div id=\"collapse\" class=\"accordion-collapse collapse\" aria-labelledby=\"heading\" data-bs-parent=\"#aico-text-content\">\n <div class=\"accordion-body\">{children}</div>\n </div>\n </div>\n </div>\n )}\n >\n <div class=\"card\" style={contentStyles}>\n <div class=\"card-body w-100 border-0\">\n <aico-title-content class=\"card-title\" content={this.makeTitleContent(translation!)} />\n <ConditionalRender condition={this.shouldDisplayTextAndPicture(translation!)}>\n <div class=\"row g-4\">\n <div\n class={getClass({\n 'col-md-8': true,\n 'order-1': this.content.picturePosition === 'right',\n 'order-2': this.content.picturePosition === 'left',\n })}\n >\n {this.getTextComponent(translation!)}\n </div>\n <div\n class={getClass({\n 'col-md-4 justify-content-center': true,\n 'order-2': this.content.picturePosition === 'right',\n 'order-1': this.content.picturePosition === 'left',\n })}\n >\n {this.getImageComponent(translation!)}\n </div>\n </div>\n </ConditionalRender>\n <ConditionalRender condition={this.shouldDisplayOnlyPicture(translation!)}>{this.getImageComponent(translation!)}</ConditionalRender>\n <ConditionalRender condition={this.shouldDisplayOnlyText(translation!)}>{this.getTextComponent(translation!)}</ConditionalRender>\n </div>\n </div>\n </ConditionalWrap>\n </ConditionalRender>\n );\n }\n\n private getImageComponent(translation: TextContentTranslation): VNode {\n const imageStyles: { [key: string]: string | undefined } = {};\n\n if (this.content.focusXPercentage && this.content.focusYCoordinate) {\n imageStyles['object-position'] = `${this.content.focusXPercentage}% ${this.content.focusYPercentage}%`;\n }\n\n return (\n <div class=\"card text-bg-dark text-white\">\n <img class=\"card-img img-fluid object-fit-contain\" src={translation.optimizedPicture ?? translation.picture} />\n <ConditionalRender condition={!strIsNullOrEmptyOrWhitespace(translation.pictureLabel)}>\n <div class=\"card-img-overlay\">\n <p\n class={getClass({\n 'card-text': true,\n 'text-end': this.content.pictureLabelPosition === 'right',\n 'text-center': this.content.pictureLabelPosition === 'center',\n })}\n >\n {translation.pictureLabel}\n </p>\n </div>\n </ConditionalRender>\n </div>\n );\n }\n\n private getTextComponent(translation: TextContentTranslation): VNode {\n const textStyles: { [key: string]: string | undefined } = { 'line-height': '1.3', 'white-space': 'pre-line' };\n if (this.content.fontSize) {\n textStyles['font-size'] = `${this.content.fontSize}px`;\n }\n\n if (this.content.fontFamily) {\n textStyles['font-family'] = this.content.fontFamily;\n }\n\n if (this.content.shouldJustifyText) {\n textStyles['text-align'] = 'justify';\n textStyles['text-justify'] = 'inner-word';\n }\n\n return (\n <p class=\"card-text\" style={textStyles}>\n {translation.text}\n </p>\n );\n }\n\n private makeTitleContent(translation: TextContentTranslation): TitleContent {\n return {\n id: this.content.id,\n createdAt: this.content.createdAt,\n updatedAt: this.content.updatedAt,\n hasUnderscore: false,\n size: this.content.titleSize ?? 'h1',\n titleColor: this.content.textColor,\n translations: [{ ...translation }],\n };\n }\n\n private shouldDisplayTextAndPicture(translation: TextContentTranslation): boolean {\n return !strIsNullOrEmptyOrWhitespace(translation.text) && (!strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) || !strIsNullOrEmptyOrWhitespace(translation.picture));\n }\n\n private shouldDisplayOnlyPicture(translation: TextContentTranslation): boolean {\n return strIsNullOrEmptyOrWhitespace(translation.text) && (!strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) || !strIsNullOrEmptyOrWhitespace(translation.picture));\n }\n\n private shouldDisplayOnlyText(translation: TextContentTranslation): boolean {\n return !strIsNullOrEmptyOrWhitespace(translation.text) && strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) && strIsNullOrEmptyOrWhitespace(translation.picture);\n }\n}\n"]}
1
+ {"version":3,"file":"aico-text-content.js","sourceRoot":"","sources":["../../../../src/components/content/aico-text-content/aico-text-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,WAAW,CAAC;AAOnB,MAAM,OAAO,eAAe;;;sBAGD,IAAI;;IAE7B,MAAM;;QACJ,MAAM,WAAW,GAAG,MA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AC,4BAA4B,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,4BAA4B,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/K,CAAC;IAEO,qBAAqB,CAAC,WAAmC;QAC/D,OAAO,CAAC,4BAA4B,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,4BAA4B,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,4BAA4B,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5K,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, VNode, h } from '@stencil/core';\nimport ConditionalRender from '../../../utils/ConditionalRender';\nimport ConditionalWrap from '../../../utils/ConditionalWrap';\nimport type { TextContent, TextContentTranslation } from '../../../model/article/content/TextContent';\nimport type { TitleContent } from '../../../model/article/content/TitleContent';\nimport { getClass, strIsNullOrEmptyOrWhitespace } from '../../../utils/utils';\nimport 'bootstrap';\n\n@Component({\n tag: 'aico-text-content',\n styleUrl: 'aico-text-content.css',\n scoped: true,\n})\nexport class AicoTextContent {\n @Prop() content!: TextContent;\n\n @Prop() locale: string = 'de';\n\n render() {\n const translation = this.content.translations.find(translation => translation.locale === this.locale) ?? null;\n const contentStyles: { [key: string]: string | undefined } = {};\n\n if (this.content.hasBackgroundColor) {\n contentStyles['background-color'] = this.content.backgroundColor ?? 'white';\n contentStyles['color'] = this.content.textColor ?? 'black';\n contentStyles['width'] = '100%';\n contentStyles['padding'] = '15px';\n contentStyles['margin-top'] = '10px';\n }\n\n if (this.content.addBorder) {\n contentStyles['border'] = `3px solid ${this.content.borderColor}`;\n contentStyles['margin-top'] = '-3px';\n }\n\n if (this.content.alignmentEnabled) {\n contentStyles['display'] = 'flex';\n contentStyles['align-items'] = this.content.verticalAlign ?? 'flex-start';\n }\n\n return (\n <ConditionalRender condition={translation !== null}>\n <ConditionalWrap\n condition={!strIsNullOrEmptyOrWhitespace(translation!.promptText)}\n wrap={children => (\n <div class=\"accordion\" id=\"aico-text-content\">\n <div class=\"accordion-item\">\n <h2 class=\"accordion-header\" id=\"heading\">\n <button class=\"accordion-button collapsed\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapse\" aria-expanded=\"false\" aria-controls=\"collapse\">\n {translation!.promptText}\n </button>\n </h2>\n <div id=\"collapse\" class=\"accordion-collapse collapse\" aria-labelledby=\"heading\" data-bs-parent=\"#aico-text-content\">\n <div class=\"accordion-body\">{children}</div>\n </div>\n </div>\n </div>\n )}\n >\n <div class=\"card\" style={contentStyles}>\n <div class=\"card-body w-100 border-0\">\n <aico-title-content class=\"card-title\" content={this.makeTitleContent(translation!)} locale={this.locale} />\n <ConditionalRender condition={this.shouldDisplayTextAndPicture(translation!)}>\n <div class=\"row g-4\">\n <div\n class={getClass({\n 'col-md-8': true,\n 'order-1': this.content.picturePosition === 'right',\n 'order-2': this.content.picturePosition === 'left',\n })}\n >\n {this.getTextComponent(translation!)}\n </div>\n <div\n class={getClass({\n 'col-md-4 justify-content-center': true,\n 'order-2': this.content.picturePosition === 'right',\n 'order-1': this.content.picturePosition === 'left',\n })}\n >\n {this.getImageComponent(translation!)}\n </div>\n </div>\n </ConditionalRender>\n <ConditionalRender condition={this.shouldDisplayOnlyPicture(translation!)}>{this.getImageComponent(translation!)}</ConditionalRender>\n <ConditionalRender condition={this.shouldDisplayOnlyText(translation!)}>{this.getTextComponent(translation!)}</ConditionalRender>\n </div>\n </div>\n </ConditionalWrap>\n </ConditionalRender>\n );\n }\n\n private getImageComponent(translation: TextContentTranslation): VNode {\n const imageStyles: { [key: string]: string | undefined } = {};\n\n if (this.content.focusXPercentage && this.content.focusYCoordinate) {\n imageStyles['object-position'] = `${this.content.focusXPercentage}% ${this.content.focusYPercentage}%`;\n }\n\n return (\n <div class=\"card text-bg-dark text-white\">\n <img class=\"card-img img-fluid object-fit-contain\" src={translation.optimizedPicture ?? translation.picture} />\n <ConditionalRender condition={!strIsNullOrEmptyOrWhitespace(translation.pictureLabel)}>\n <div class=\"card-img-overlay\">\n <p\n class={getClass({\n 'card-text': true,\n 'text-end': this.content.pictureLabelPosition === 'right',\n 'text-center': this.content.pictureLabelPosition === 'center',\n })}\n >\n {translation.pictureLabel}\n </p>\n </div>\n </ConditionalRender>\n </div>\n );\n }\n\n private getTextComponent(translation: TextContentTranslation): VNode {\n const textStyles: { [key: string]: string | undefined } = { 'line-height': '1.3', 'white-space': 'pre-line' };\n if (this.content.fontSize) {\n textStyles['font-size'] = `${this.content.fontSize}px`;\n }\n\n if (this.content.fontFamily) {\n textStyles['font-family'] = this.content.fontFamily;\n }\n\n if (this.content.shouldJustifyText) {\n textStyles['text-align'] = 'justify';\n textStyles['text-justify'] = 'inner-word';\n }\n\n return (\n <p class=\"card-text\" style={textStyles}>\n {translation.text}\n </p>\n );\n }\n\n private makeTitleContent(translation: TextContentTranslation): TitleContent {\n return {\n id: this.content.id,\n createdAt: this.content.createdAt,\n updatedAt: this.content.updatedAt,\n hasUnderscore: false,\n size: this.content.titleSize ?? 'h1',\n titleColor: this.content.textColor,\n translations: [{ ...translation }],\n };\n }\n\n private shouldDisplayTextAndPicture(translation: TextContentTranslation): boolean {\n return !strIsNullOrEmptyOrWhitespace(translation.text) && (!strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) || !strIsNullOrEmptyOrWhitespace(translation.picture));\n }\n\n private shouldDisplayOnlyPicture(translation: TextContentTranslation): boolean {\n return strIsNullOrEmptyOrWhitespace(translation.text) && (!strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) || !strIsNullOrEmptyOrWhitespace(translation.picture));\n }\n\n private shouldDisplayOnlyText(translation: TextContentTranslation): boolean {\n return !strIsNullOrEmptyOrWhitespace(translation.text) && strIsNullOrEmptyOrWhitespace(translation.optimizedPicture) && strIsNullOrEmptyOrWhitespace(translation.picture);\n }\n}\n"]}
@@ -4,6 +4,7 @@ const meta = {
4
4
  export default meta;
5
5
  export const Example = {
6
6
  args: {
7
+ locale: 'de',
7
8
  content: {
8
9
  id: 1234,
9
10
  createdAt: new Date(),
@@ -17,6 +18,14 @@ export const Example = {
17
18
  promptText: 'Prompt text',
18
19
  locale: 'en-GB',
19
20
  },
21
+ {
22
+ id: 1234,
23
+ createdAt: new Date(),
24
+ updatedAt: new Date(),
25
+ title: 'Howdy de',
26
+ promptText: 'Prompt text de',
27
+ locale: 'de',
28
+ },
20
29
  ],
21
30
  titleSize: 'h1',
22
31
  alignmentEnabled: true,
@@ -34,6 +43,7 @@ export const Example = {
34
43
  };
35
44
  export const NoPrompt = {
36
45
  args: {
46
+ locale: 'de',
37
47
  content: {
38
48
  id: 1234,
39
49
  createdAt: new Date(),
@@ -50,6 +60,17 @@ export const NoPrompt = {
50
60
  pictureLabel: 'Picture label',
51
61
  text: 'Foo\nBar\nBaz',
52
62
  },
63
+ {
64
+ id: 1234,
65
+ createdAt: new Date(),
66
+ updatedAt: new Date(),
67
+ title: 'Howdy de',
68
+ promptText: null,
69
+ locale: 'de',
70
+ picture: 'https://source.unsplash.com/random/800x600',
71
+ pictureLabel: 'Picture label de',
72
+ text: 'Foo de\nBar de\nBaz de',
73
+ },
53
74
  ],
54
75
  picturePosition: 'center',
55
76
  pictureSize: 'small',
@@ -69,6 +90,7 @@ export const NoPrompt = {
69
90
  };
70
91
  export const TextAndImage = {
71
92
  args: {
93
+ locale: 'de',
72
94
  content: {
73
95
  id: 1234,
74
96
  createdAt: new Date(),
@@ -85,6 +107,17 @@ export const TextAndImage = {
85
107
  pictureLabel: 'Picture label',
86
108
  text: 'Foo\nBar\nBaz',
87
109
  },
110
+ {
111
+ id: 1234,
112
+ createdAt: new Date(),
113
+ updatedAt: new Date(),
114
+ title: 'Howdy de',
115
+ promptText: 'Prompt text de',
116
+ locale: 'de',
117
+ picture: 'https://source.unsplash.com/random/800x600',
118
+ pictureLabel: 'Picture label de',
119
+ text: 'Foo de\nBar de\nBaz de',
120
+ },
88
121
  ],
89
122
  picturePosition: 'center',
90
123
  pictureSize: 'small',
@@ -104,6 +137,7 @@ export const TextAndImage = {
104
137
  };
105
138
  export const OnlyImage = {
106
139
  args: {
140
+ locale: 'de',
107
141
  content: {
108
142
  id: 1234,
109
143
  createdAt: new Date(),
@@ -119,6 +153,16 @@ export const OnlyImage = {
119
153
  picture: 'https://source.unsplash.com/random/800x600',
120
154
  pictureLabel: 'Picture label',
121
155
  },
156
+ {
157
+ id: 1234,
158
+ createdAt: new Date(),
159
+ updatedAt: new Date(),
160
+ title: 'Howdy de',
161
+ promptText: 'Prompt text de',
162
+ locale: 'de',
163
+ picture: 'https://source.unsplash.com/random/800x600',
164
+ pictureLabel: 'Picture label de',
165
+ },
122
166
  ],
123
167
  picturePosition: 'center',
124
168
  pictureSize: 'small',
@@ -138,6 +182,7 @@ export const OnlyImage = {
138
182
  };
139
183
  export const OnlyText = {
140
184
  args: {
185
+ locale: 'de',
141
186
  content: {
142
187
  id: 1234,
143
188
  createdAt: new Date(),
@@ -153,6 +198,16 @@ export const OnlyText = {
153
198
  text: 'Foo\nBar\nBaz',
154
199
  pictureLabel: 'Picture label',
155
200
  },
201
+ {
202
+ id: 1234,
203
+ createdAt: new Date(),
204
+ updatedAt: new Date(),
205
+ title: 'Howdy de',
206
+ promptText: 'Prompt text de',
207
+ locale: 'de',
208
+ text: 'Foo de\nBar de\nBaz de',
209
+ pictureLabel: 'Picture label de',
210
+ },
156
211
  ],
157
212
  picturePosition: 'center',
158
213
  pictureSize: 'small',