@telefonica/mistica 16.59.0 → 16.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (544) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +6 -6
  3. package/dist/align.css-mistica.js +1 -1
  4. package/dist/autocomplete.css-mistica.js +1 -1
  5. package/dist/avatar.css-mistica.js +1 -1
  6. package/dist/badge.css-mistica.js +1 -1
  7. package/dist/box.css-mistica.js +13 -13
  8. package/dist/boxed.css-mistica.js +24 -24
  9. package/dist/button-fixed-footer-layout.d.ts +2 -1
  10. package/dist/button-fixed-footer-layout.js +4 -3
  11. package/dist/button-group.css-mistica.js +1 -1
  12. package/dist/button-layout.css-mistica.js +14 -14
  13. package/dist/button.css-mistica.js +30 -30
  14. package/dist/callout.css-mistica.js +11 -11
  15. package/dist/card-internal.css-mistica.js +15 -15
  16. package/dist/carousel.css-mistica.js +8 -8
  17. package/dist/checkbox.css-mistica.js +11 -11
  18. package/dist/chip.css-mistica.js +15 -15
  19. package/dist/circle.css-mistica.js +1 -1
  20. package/dist/community/advanced-data-card.css-mistica.js +6 -6
  21. package/dist/community/blocks.css-mistica.js +1 -1
  22. package/dist/community/example-component.css-mistica.js +1 -1
  23. package/dist/counter.css-mistica.js +1 -1
  24. package/dist/cover-hero.css-mistica.js +2 -2
  25. package/dist/credit-card-number-field.css-mistica.js +3 -3
  26. package/dist/date-field.css-mistica.js +1 -1
  27. package/dist/date-time-picker.css-mistica.js +1 -1
  28. package/dist/dialog.css-mistica.js +4 -4
  29. package/dist/divider.css-mistica.js +5 -5
  30. package/dist/double-field.css-mistica.js +2 -2
  31. package/dist/drawer.css-mistica.js +1 -1
  32. package/dist/empty-state-card.css-mistica.js +1 -1
  33. package/dist/empty-state.css-mistica.js +5 -5
  34. package/dist/fade-in.css-mistica.js +1 -1
  35. package/dist/feedback.css-mistica.js +1 -1
  36. package/dist/file-upload.css-mistica.js +7 -7
  37. package/dist/fixed-footer-layout.css-mistica.js +2 -2
  38. package/dist/fixed-footer-layout.d.ts +6 -1
  39. package/dist/fixed-footer-layout.js +29 -28
  40. package/dist/form.css-mistica.js +1 -1
  41. package/dist/grid-layout.css-mistica.js +3 -3
  42. package/dist/grid.css-mistica.js +120 -120
  43. package/dist/header.css-mistica.js +1 -1
  44. package/dist/hero.css-mistica.js +2 -2
  45. package/dist/horizontal-scroll.css-mistica.js +1 -1
  46. package/dist/icon-button.css-mistica.js +53 -53
  47. package/dist/icons/icon-chevron.css-mistica.js +2 -2
  48. package/dist/icons/icon-error.css-mistica.js +1 -1
  49. package/dist/image.css-mistica.js +2 -2
  50. package/dist/image.js +8 -1
  51. package/dist/inline.css-mistica.js +9 -9
  52. package/dist/list.css-mistica.js +1 -1
  53. package/dist/loading-bar.css-mistica.js +1 -1
  54. package/dist/loading-screen.css-mistica.js +4 -4
  55. package/dist/logo.css-mistica.js +5 -5
  56. package/dist/menu.css-mistica.js +13 -13
  57. package/dist/mosaic.css-mistica.js +1 -1
  58. package/dist/navigation-bar.css-mistica.js +18 -18
  59. package/dist/navigation-breadcrumbs.css-mistica.js +1 -1
  60. package/dist/package-version.js +1 -1
  61. package/dist/pin-field.css-mistica.js +1 -1
  62. package/dist/popover.css-mistica.js +1 -1
  63. package/dist/progress-bar.css-mistica.js +6 -6
  64. package/dist/radio-button.css-mistica.js +19 -19
  65. package/dist/rating.css-mistica.js +2 -2
  66. package/dist/responsive-layout.css-mistica.js +6 -6
  67. package/dist/screen-reader-only.css-mistica.js +1 -1
  68. package/dist/select.css-mistica.js +15 -15
  69. package/dist/sheet-action-row.css-mistica.js +1 -1
  70. package/dist/sheet-common.css-mistica.js +1 -1
  71. package/dist/sheet-info.css-mistica.js +1 -1
  72. package/dist/skeletons.css-mistica.js +6 -6
  73. package/dist/skins/skin-contract.css-mistica.js +684 -684
  74. package/dist/skip-link.css-mistica.js +1 -1
  75. package/dist/slider.css-mistica.js +18 -18
  76. package/dist/snackbar.css-mistica.js +4 -4
  77. package/dist/spinner.css-mistica.js +1 -1
  78. package/dist/square.css-mistica.js +1 -1
  79. package/dist/stack.css-mistica.js +5 -5
  80. package/dist/stacking-group.css-mistica.js +1 -1
  81. package/dist/stepper.css-mistica.js +2 -2
  82. package/dist/switch-component.css-mistica.js +35 -35
  83. package/dist/table.css-mistica.js +9 -9
  84. package/dist/tabs.css-mistica.js +17 -17
  85. package/dist/tag.css-mistica.js +1 -1
  86. package/dist/text-field-base.css-mistica.js +15 -15
  87. package/dist/text-field-components.css-mistica.js +3 -3
  88. package/dist/text-link.css-mistica.js +6 -6
  89. package/dist/text.css-mistica.js +6 -6
  90. package/dist/theme-context.css-mistica.js +1 -1
  91. package/dist/timeline.css-mistica.js +9 -9
  92. package/dist/timer.css-mistica.js +6 -6
  93. package/dist/tooltip.css-mistica.js +1 -1
  94. package/dist/touchable.css-mistica.js +1 -1
  95. package/dist/utils/aspect-ratio-support.css-mistica.js +2 -2
  96. package/dist/video.css-mistica.js +1 -1
  97. package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
  98. package/dist-es/accordion.css-mistica.js +6 -6
  99. package/dist-es/align.css-mistica.js +1 -1
  100. package/dist-es/autocomplete.css-mistica.js +1 -1
  101. package/dist-es/avatar.css-mistica.js +1 -1
  102. package/dist-es/badge.css-mistica.js +1 -1
  103. package/dist-es/box.css-mistica.js +13 -13
  104. package/dist-es/boxed.css-mistica.js +23 -23
  105. package/dist-es/button-fixed-footer-layout.js +12 -11
  106. package/dist-es/button-group.css-mistica.js +1 -1
  107. package/dist-es/button-layout.css-mistica.js +14 -14
  108. package/dist-es/button.css-mistica.js +30 -30
  109. package/dist-es/callout.css-mistica.js +11 -11
  110. package/dist-es/card-internal.css-mistica.js +15 -15
  111. package/dist-es/carousel.css-mistica.js +8 -8
  112. package/dist-es/checkbox.css-mistica.js +11 -11
  113. package/dist-es/chip.css-mistica.js +15 -15
  114. package/dist-es/circle.css-mistica.js +1 -1
  115. package/dist-es/community/advanced-data-card.css-mistica.js +6 -6
  116. package/dist-es/community/blocks.css-mistica.js +1 -1
  117. package/dist-es/community/example-component.css-mistica.js +1 -1
  118. package/dist-es/counter.css-mistica.js +1 -1
  119. package/dist-es/cover-hero.css-mistica.js +2 -2
  120. package/dist-es/credit-card-number-field.css-mistica.js +3 -3
  121. package/dist-es/date-field.css-mistica.js +1 -1
  122. package/dist-es/date-time-picker.css-mistica.js +1 -1
  123. package/dist-es/dialog.css-mistica.js +4 -4
  124. package/dist-es/divider.css-mistica.js +5 -5
  125. package/dist-es/double-field.css-mistica.js +2 -2
  126. package/dist-es/drawer.css-mistica.js +1 -1
  127. package/dist-es/empty-state-card.css-mistica.js +1 -1
  128. package/dist-es/empty-state.css-mistica.js +5 -5
  129. package/dist-es/fade-in.css-mistica.js +1 -1
  130. package/dist-es/feedback.css-mistica.js +1 -1
  131. package/dist-es/file-upload.css-mistica.js +7 -7
  132. package/dist-es/fixed-footer-layout.css-mistica.js +2 -2
  133. package/dist-es/fixed-footer-layout.js +57 -56
  134. package/dist-es/form.css-mistica.js +1 -1
  135. package/dist-es/grid-layout.css-mistica.js +3 -3
  136. package/dist-es/grid.css-mistica.js +120 -120
  137. package/dist-es/header.css-mistica.js +1 -1
  138. package/dist-es/hero.css-mistica.js +2 -2
  139. package/dist-es/horizontal-scroll.css-mistica.js +1 -1
  140. package/dist-es/icon-button.css-mistica.js +53 -53
  141. package/dist-es/icons/icon-chevron.css-mistica.js +2 -2
  142. package/dist-es/icons/icon-error.css-mistica.js +1 -1
  143. package/dist-es/image.css-mistica.js +2 -2
  144. package/dist-es/image.js +8 -1
  145. package/dist-es/inline.css-mistica.js +9 -9
  146. package/dist-es/list.css-mistica.js +1 -1
  147. package/dist-es/loading-bar.css-mistica.js +1 -1
  148. package/dist-es/loading-screen.css-mistica.js +4 -4
  149. package/dist-es/logo.css-mistica.js +5 -5
  150. package/dist-es/menu.css-mistica.js +13 -13
  151. package/dist-es/mosaic.css-mistica.js +1 -1
  152. package/dist-es/navigation-bar.css-mistica.js +18 -18
  153. package/dist-es/navigation-breadcrumbs.css-mistica.js +1 -1
  154. package/dist-es/package-version.js +1 -1
  155. package/dist-es/pin-field.css-mistica.js +1 -1
  156. package/dist-es/popover.css-mistica.js +1 -1
  157. package/dist-es/progress-bar.css-mistica.js +6 -6
  158. package/dist-es/radio-button.css-mistica.js +19 -19
  159. package/dist-es/rating.css-mistica.js +2 -2
  160. package/dist-es/responsive-layout.css-mistica.js +6 -6
  161. package/dist-es/screen-reader-only.css-mistica.js +1 -1
  162. package/dist-es/select.css-mistica.js +15 -15
  163. package/dist-es/sheet-action-row.css-mistica.js +1 -1
  164. package/dist-es/sheet-common.css-mistica.js +1 -1
  165. package/dist-es/sheet-info.css-mistica.js +1 -1
  166. package/dist-es/skeletons.css-mistica.js +6 -6
  167. package/dist-es/skins/skin-contract.css-mistica.js +684 -684
  168. package/dist-es/skip-link.css-mistica.js +1 -1
  169. package/dist-es/slider.css-mistica.js +18 -18
  170. package/dist-es/snackbar.css-mistica.js +4 -4
  171. package/dist-es/spinner.css-mistica.js +1 -1
  172. package/dist-es/square.css-mistica.js +1 -1
  173. package/dist-es/stack.css-mistica.js +5 -5
  174. package/dist-es/stacking-group.css-mistica.js +1 -1
  175. package/dist-es/stepper.css-mistica.js +2 -2
  176. package/dist-es/style.css +1 -1
  177. package/dist-es/switch-component.css-mistica.js +35 -35
  178. package/dist-es/table.css-mistica.js +9 -9
  179. package/dist-es/tabs.css-mistica.js +17 -17
  180. package/dist-es/tag.css-mistica.js +1 -1
  181. package/dist-es/text-field-base.css-mistica.js +15 -15
  182. package/dist-es/text-field-components.css-mistica.js +3 -3
  183. package/dist-es/text-link.css-mistica.js +6 -6
  184. package/dist-es/text.css-mistica.js +6 -6
  185. package/dist-es/theme-context.css-mistica.js +1 -1
  186. package/dist-es/timeline.css-mistica.js +9 -9
  187. package/dist-es/timer.css-mistica.js +6 -6
  188. package/dist-es/tooltip.css-mistica.js +1 -1
  189. package/dist-es/touchable.css-mistica.js +1 -1
  190. package/dist-es/utils/aspect-ratio-support.css-mistica.js +2 -2
  191. package/dist-es/video.css-mistica.js +1 -1
  192. package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
  193. package/doc/llms.md +11 -0
  194. package/package.json +14 -2
  195. package/src/accordion.css.ts +121 -0
  196. package/src/accordion.tsx +366 -0
  197. package/src/align.css.ts +7 -0
  198. package/src/align.tsx +32 -0
  199. package/src/autocomplete.css.ts +62 -0
  200. package/src/autocomplete.tsx +239 -0
  201. package/src/avatar.css.ts +14 -0
  202. package/src/avatar.tsx +120 -0
  203. package/src/badge.css.ts +51 -0
  204. package/src/badge.tsx +79 -0
  205. package/src/box.css.ts +51 -0
  206. package/src/box.tsx +114 -0
  207. package/src/boxed.css.ts +132 -0
  208. package/src/boxed.tsx +153 -0
  209. package/src/button-fixed-footer-layout.tsx +65 -0
  210. package/src/button-group.css.ts +75 -0
  211. package/src/button-group.tsx +91 -0
  212. package/src/button-layout.css.ts +162 -0
  213. package/src/button-layout.tsx +91 -0
  214. package/src/button.css.ts +758 -0
  215. package/src/button.tsx +632 -0
  216. package/src/callout.css.ts +50 -0
  217. package/src/callout.tsx +147 -0
  218. package/src/card-cover.tsx +242 -0
  219. package/src/card-data.tsx +152 -0
  220. package/src/card-internal.css.ts +271 -0
  221. package/src/card-internal.tsx +1724 -0
  222. package/src/card-media.tsx +157 -0
  223. package/src/card-naked.tsx +63 -0
  224. package/src/carousel.css.ts +522 -0
  225. package/src/carousel.tsx +1300 -0
  226. package/src/checkbox.css.ts +94 -0
  227. package/src/checkbox.tsx +192 -0
  228. package/src/chip.css.ts +204 -0
  229. package/src/chip.tsx +191 -0
  230. package/src/circle.css.ts +14 -0
  231. package/src/circle.tsx +52 -0
  232. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
  233. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
  234. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
  235. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
  236. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
  237. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
  238. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
  239. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
  240. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
  241. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
  242. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
  243. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
  244. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
  245. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
  246. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
  247. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
  248. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
  249. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
  250. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
  251. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
  252. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
  253. package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
  254. package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
  255. package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
  256. package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
  257. package/src/community/__stories__/blocks-story.tsx +272 -0
  258. package/src/community/__stories__/example-component-story.tsx +15 -0
  259. package/src/community/__stories__/index-story.tsx +154 -0
  260. package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
  261. package/src/community/advanced-data-card.css.ts +271 -0
  262. package/src/community/advanced-data-card.tsx +431 -0
  263. package/src/community/blocks.css.ts +12 -0
  264. package/src/community/blocks.tsx +290 -0
  265. package/src/community/example-component.css.ts +7 -0
  266. package/src/community/example-component.tsx +17 -0
  267. package/src/community/index.tsx +10 -0
  268. package/src/counter.css.ts +150 -0
  269. package/src/counter.tsx +215 -0
  270. package/src/cover-hero-media.tsx +39 -0
  271. package/src/cover-hero.css.ts +133 -0
  272. package/src/cover-hero.tsx +262 -0
  273. package/src/credit-card-expiration-field.tsx +187 -0
  274. package/src/credit-card-fields.tsx +56 -0
  275. package/src/credit-card-number-field.css.ts +47 -0
  276. package/src/credit-card-number-field.tsx +245 -0
  277. package/src/cvv-field.tsx +169 -0
  278. package/src/date-field.css.ts +14 -0
  279. package/src/date-field.tsx +130 -0
  280. package/src/date-time-field.tsx +141 -0
  281. package/src/date-time-picker.css.ts +126 -0
  282. package/src/date-time-picker.tsx +188 -0
  283. package/src/decimal-field.tsx +160 -0
  284. package/src/desktop-container-type-context.tsx +15 -0
  285. package/src/dialog-context.tsx +81 -0
  286. package/src/dialog.css.ts +155 -0
  287. package/src/dialog.tsx +423 -0
  288. package/src/divider.css.ts +10 -0
  289. package/src/divider.tsx +11 -0
  290. package/src/double-field.css.ts +33 -0
  291. package/src/double-field.tsx +71 -0
  292. package/src/drawer.css.ts +123 -0
  293. package/src/drawer.tsx +304 -0
  294. package/src/email-field.tsx +76 -0
  295. package/src/empty-state-card.css.ts +40 -0
  296. package/src/empty-state-card.tsx +92 -0
  297. package/src/empty-state.css.ts +119 -0
  298. package/src/empty-state.tsx +141 -0
  299. package/src/fade-in.css.ts +12 -0
  300. package/src/fade-in.tsx +40 -0
  301. package/src/feedback.css.ts +119 -0
  302. package/src/feedback.tsx +432 -0
  303. package/src/file-upload.css.ts +156 -0
  304. package/src/file-upload.tsx +612 -0
  305. package/src/fixed-footer-layout.css.ts +96 -0
  306. package/src/fixed-footer-layout.tsx +227 -0
  307. package/src/fixed-to-top.tsx +21 -0
  308. package/src/focus-trap.tsx +17 -0
  309. package/src/form-context.tsx +198 -0
  310. package/src/form.css.ts +5 -0
  311. package/src/form.tsx +287 -0
  312. package/src/grid-layout.css.ts +68 -0
  313. package/src/grid-layout.tsx +201 -0
  314. package/src/grid.css.ts +203 -0
  315. package/src/grid.tsx +241 -0
  316. package/src/header.css.ts +30 -0
  317. package/src/header.tsx +319 -0
  318. package/src/hero.css.ts +71 -0
  319. package/src/hero.tsx +318 -0
  320. package/src/hooks.tsx +313 -0
  321. package/src/horizontal-scroll.css.ts +43 -0
  322. package/src/horizontal-scroll.tsx +18 -0
  323. package/src/iban-field.tsx +218 -0
  324. package/src/icon-button.css.ts +561 -0
  325. package/src/icon-button.tsx +221 -0
  326. package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
  327. package/src/icons/icon-amex.tsx +40 -0
  328. package/src/icons/icon-chevron.css.ts +23 -0
  329. package/src/icons/icon-chevron.tsx +150 -0
  330. package/src/icons/icon-cvv-amex.tsx +31 -0
  331. package/src/icons/icon-cvv-visa-mc.tsx +31 -0
  332. package/src/icons/icon-error.css.ts +27 -0
  333. package/src/icons/icon-error.tsx +207 -0
  334. package/src/icons/icon-info.tsx +86 -0
  335. package/src/icons/icon-mastercard.tsx +36 -0
  336. package/src/icons/icon-success-vivo-new.tsx +51 -0
  337. package/src/icons/icon-success-vivo.tsx +36 -0
  338. package/src/icons/icon-success.tsx +211 -0
  339. package/src/icons/icon-visa.tsx +32 -0
  340. package/src/image.css.ts +48 -0
  341. package/src/image.tsx +352 -0
  342. package/src/index.tsx +2466 -0
  343. package/src/inline.css.ts +131 -0
  344. package/src/inline.tsx +135 -0
  345. package/src/integer-field.tsx +93 -0
  346. package/src/list.css.ts +281 -0
  347. package/src/list.tsx +963 -0
  348. package/src/loading-bar.css.ts +69 -0
  349. package/src/loading-bar.tsx +25 -0
  350. package/src/loading-screen.css.ts +114 -0
  351. package/src/loading-screen.tsx +376 -0
  352. package/src/logo-blau-shell.tsx +30 -0
  353. package/src/logo-blau.tsx +60 -0
  354. package/src/logo-common.tsx +29 -0
  355. package/src/logo-esimflag-shell.tsx +30 -0
  356. package/src/logo-esimflag.tsx +56 -0
  357. package/src/logo-movistar-new-shell.tsx +30 -0
  358. package/src/logo-movistar-new.tsx +85 -0
  359. package/src/logo-movistar-shell.tsx +30 -0
  360. package/src/logo-movistar.tsx +63 -0
  361. package/src/logo-o2-new-shell.tsx +26 -0
  362. package/src/logo-o2-new.tsx +27 -0
  363. package/src/logo-o2-shell.tsx +26 -0
  364. package/src/logo-o2.tsx +27 -0
  365. package/src/logo-telefonica-shell.tsx +30 -0
  366. package/src/logo-telefonica.tsx +95 -0
  367. package/src/logo-tu-shell.tsx +26 -0
  368. package/src/logo-tu.tsx +28 -0
  369. package/src/logo-vivo-shell.tsx +30 -0
  370. package/src/logo-vivo.tsx +53 -0
  371. package/src/logo.css.ts +33 -0
  372. package/src/logo.tsx +313 -0
  373. package/src/master-detail-layout.tsx +28 -0
  374. package/src/maybe-dismissable.css.ts +37 -0
  375. package/src/maybe-dismissable.tsx +58 -0
  376. package/src/media-queries.css.ts +67 -0
  377. package/src/menu.css.ts +132 -0
  378. package/src/menu.tsx +468 -0
  379. package/src/meter.tsx +516 -0
  380. package/src/modal-context-provider.tsx +45 -0
  381. package/src/month-field.tsx +124 -0
  382. package/src/mosaic.css.ts +73 -0
  383. package/src/mosaic.tsx +205 -0
  384. package/src/navigation-bar.css.ts +558 -0
  385. package/src/navigation-bar.tsx +1637 -0
  386. package/src/navigation-breadcrumbs.css.ts +22 -0
  387. package/src/navigation-breadcrumbs.tsx +69 -0
  388. package/src/negative-box.tsx +15 -0
  389. package/src/nestable-context.tsx +139 -0
  390. package/src/overlay.tsx +86 -0
  391. package/src/overscroll-color-context.tsx +141 -0
  392. package/src/package-version.tsx +2 -0
  393. package/src/password-field.tsx +126 -0
  394. package/src/phone-number-field-lite.tsx +265 -0
  395. package/src/phone-number-field.tsx +171 -0
  396. package/src/pin-field.css.ts +90 -0
  397. package/src/pin-field.tsx +346 -0
  398. package/src/placeholder.tsx +41 -0
  399. package/src/popover.css.ts +8 -0
  400. package/src/popover.tsx +85 -0
  401. package/src/portal.tsx +43 -0
  402. package/src/progress-bar.css.ts +61 -0
  403. package/src/progress-bar.tsx +174 -0
  404. package/src/radio-button.css.ts +174 -0
  405. package/src/radio-button.tsx +322 -0
  406. package/src/rating.css.ts +128 -0
  407. package/src/rating.tsx +351 -0
  408. package/src/responsive-layout.css.ts +162 -0
  409. package/src/responsive-layout.tsx +106 -0
  410. package/src/screen-reader-only.css.ts +27 -0
  411. package/src/screen-reader-only.tsx +33 -0
  412. package/src/screen-size-context-provider.tsx +96 -0
  413. package/src/screen-size-context.tsx +23 -0
  414. package/src/search-field.tsx +126 -0
  415. package/src/select.css.ts +226 -0
  416. package/src/select.tsx +513 -0
  417. package/src/sheet-action-row.css.ts +33 -0
  418. package/src/sheet-actions-list.tsx +113 -0
  419. package/src/sheet-actions.tsx +95 -0
  420. package/src/sheet-common.css.ts +254 -0
  421. package/src/sheet-common.tsx +402 -0
  422. package/src/sheet-info.css.ts +19 -0
  423. package/src/sheet-info.tsx +127 -0
  424. package/src/sheet-native.tsx +189 -0
  425. package/src/sheet-radio-list.tsx +118 -0
  426. package/src/sheet-root.tsx +127 -0
  427. package/src/sheet-types.tsx +94 -0
  428. package/src/sheet-web.tsx +140 -0
  429. package/src/skeleton-base.tsx +38 -0
  430. package/src/skeletons.css.ts +56 -0
  431. package/src/skeletons.tsx +133 -0
  432. package/src/skins/blau.tsx +724 -0
  433. package/src/skins/constants.tsx +10 -0
  434. package/src/skins/defaults.tsx +104 -0
  435. package/src/skins/esimflag.tsx +728 -0
  436. package/src/skins/movistar-new.tsx +735 -0
  437. package/src/skins/movistar.tsx +740 -0
  438. package/src/skins/o2-new.tsx +731 -0
  439. package/src/skins/o2.tsx +727 -0
  440. package/src/skins/skin-contract.css.ts +380 -0
  441. package/src/skins/telefonica.tsx +768 -0
  442. package/src/skins/tu.tsx +741 -0
  443. package/src/skins/types/colors.tsx +286 -0
  444. package/src/skins/types/index.tsx +153 -0
  445. package/src/skins/utils.tsx +66 -0
  446. package/src/skins/vivo-new.tsx +745 -0
  447. package/src/skins/vivo.tsx +720 -0
  448. package/src/skip-link.css.ts +34 -0
  449. package/src/skip-link.tsx +52 -0
  450. package/src/slider.css.ts +181 -0
  451. package/src/slider.tsx +384 -0
  452. package/src/snackbar-context.tsx +98 -0
  453. package/src/snackbar-native.ts +37 -0
  454. package/src/snackbar.css.ts +176 -0
  455. package/src/snackbar.tsx +258 -0
  456. package/src/spinner.css.ts +66 -0
  457. package/src/spinner.tsx +136 -0
  458. package/src/sprinkles.css.ts +83 -0
  459. package/src/square.css.ts +15 -0
  460. package/src/square.tsx +55 -0
  461. package/src/stack.css.ts +44 -0
  462. package/src/stack.tsx +79 -0
  463. package/src/stacking-group.css.ts +15 -0
  464. package/src/stacking-group.tsx +82 -0
  465. package/src/stepper.css.ts +233 -0
  466. package/src/stepper.tsx +156 -0
  467. package/src/switch-component.css.ts +181 -0
  468. package/src/switch-component.tsx +187 -0
  469. package/src/tab-focus.tsx +68 -0
  470. package/src/table-actions-header.tsx +21 -0
  471. package/src/table-cell-text.tsx +35 -0
  472. package/src/table.css.ts +297 -0
  473. package/src/table.tsx +398 -0
  474. package/src/tabs.css.ts +212 -0
  475. package/src/tabs.tsx +263 -0
  476. package/src/tag.css.ts +42 -0
  477. package/src/tag.tsx +161 -0
  478. package/src/test-utils/environment/setup-ssr.tsx +10 -0
  479. package/src/test-utils/fail-test-on-console-error.tsx +22 -0
  480. package/src/test-utils/index.tsx +341 -0
  481. package/src/test-utils/setup-ssr-test-env.tsx +13 -0
  482. package/src/test-utils/ssr.tsx +197 -0
  483. package/src/text-field-base.css.ts +416 -0
  484. package/src/text-field-base.tsx +628 -0
  485. package/src/text-field-components.css.ts +165 -0
  486. package/src/text-field-components.tsx +230 -0
  487. package/src/text-field.tsx +118 -0
  488. package/src/text-link.css.ts +83 -0
  489. package/src/text-link.tsx +85 -0
  490. package/src/text-tokens.tsx +708 -0
  491. package/src/text.css.ts +60 -0
  492. package/src/text.tsx +516 -0
  493. package/src/theme-context-provider.tsx +370 -0
  494. package/src/theme-context.css.ts +3 -0
  495. package/src/theme-context.tsx +8 -0
  496. package/src/theme-variant-context.tsx +51 -0
  497. package/src/theme.tsx +184 -0
  498. package/src/time-field.tsx +99 -0
  499. package/src/timeline.css.ts +135 -0
  500. package/src/timeline.tsx +250 -0
  501. package/src/timer.css.ts +99 -0
  502. package/src/timer.tsx +420 -0
  503. package/src/title.tsx +119 -0
  504. package/src/tooltip-context-provider.tsx +57 -0
  505. package/src/tooltip.css.ts +106 -0
  506. package/src/tooltip.tsx +649 -0
  507. package/src/touchable.css.ts +56 -0
  508. package/src/touchable.tsx +355 -0
  509. package/src/types/font-face.d.ts +47 -0
  510. package/src/types/libs.d.ts +3 -0
  511. package/src/utils/__tests__/analytics-test.tsx +35 -0
  512. package/src/utils/__tests__/browser-test.tsx +28 -0
  513. package/src/utils/__tests__/dom-test.tsx +23 -0
  514. package/src/utils/__tests__/helpers-test.tsx +166 -0
  515. package/src/utils/analytics.tsx +28 -0
  516. package/src/utils/animation.tsx +201 -0
  517. package/src/utils/aspect-ratio-support.css.ts +28 -0
  518. package/src/utils/aspect-ratio-support.tsx +141 -0
  519. package/src/utils/browser.tsx +9 -0
  520. package/src/utils/color.tsx +46 -0
  521. package/src/utils/common.tsx +27 -0
  522. package/src/utils/credit-card.tsx +46 -0
  523. package/src/utils/css.tsx +25 -0
  524. package/src/utils/document-visibility.tsx +52 -0
  525. package/src/utils/dom.tsx +155 -0
  526. package/src/utils/environment.tsx +6 -0
  527. package/src/utils/headings.tsx +18 -0
  528. package/src/utils/helpers.tsx +182 -0
  529. package/src/utils/keys.tsx +8 -0
  530. package/src/utils/locale.tsx +27 -0
  531. package/src/utils/platform.tsx +94 -0
  532. package/src/utils/region-code.tsx +1 -0
  533. package/src/utils/renders-element.tsx +6 -0
  534. package/src/utils/time.tsx +22 -0
  535. package/src/utils/types.tsx +19 -0
  536. package/src/utils/utility-types.tsx +8 -0
  537. package/src/video.css.ts +11 -0
  538. package/src/video.tsx +355 -0
  539. package/src/vivinho-loading-animation/in-lottie.json +402 -0
  540. package/src/vivinho-loading-animation/index.tsx +90 -0
  541. package/src/vivinho-loading-animation/out-lottie.json +575 -0
  542. package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
  543. package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
  544. package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
@@ -0,0 +1,215 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import {getPrefixedDataAttributes} from './utils/dom';
4
+ import * as styles from './counter.css';
5
+ import {ThemeVariant, useThemeVariant} from './theme-variant-context';
6
+ import {vars} from './skins/skin-contract.css';
7
+ import Inline from './inline';
8
+ import {Text3} from './text';
9
+ import {BaseTouchable} from './touchable';
10
+ import IconSubtractRegular from './generated/mistica-icons/icon-subtract-regular';
11
+ import IconAddMoreRegular from './generated/mistica-icons/icon-add-more-regular';
12
+ import IconTrashCanRegular from './generated/mistica-icons/icon-trash-can-regular';
13
+ import {useTheme} from './hooks';
14
+ import classNames from 'classnames';
15
+ import ScreenReaderOnly from './screen-reader-only';
16
+ import * as tokens from './text-tokens';
17
+
18
+ import type {DataAttributes} from './utils/types';
19
+
20
+ const ICON_SIZE = 20;
21
+
22
+ const useCounterState = ({
23
+ value,
24
+ defaultValue,
25
+ min,
26
+ max,
27
+ onChangeValue,
28
+ }: {
29
+ value?: number;
30
+ defaultValue?: number;
31
+ min: number;
32
+ max: number;
33
+ onChangeValue?: (value: number) => void;
34
+ }): [number, (value: number) => void] => {
35
+ const isControlledByParent = value !== undefined;
36
+
37
+ const getValueInRange = React.useCallback(
38
+ (value?: number) => {
39
+ return value === undefined ? min : Math.max(min, Math.min(max, value));
40
+ },
41
+ [min, max]
42
+ );
43
+
44
+ const [currentValue, setCurrentValue] = React.useState<number>(getValueInRange(defaultValue));
45
+
46
+ const updateValue = (newValue: number) => {
47
+ if (!isControlledByParent) {
48
+ setCurrentValue(newValue);
49
+ }
50
+ onChangeValue?.(newValue);
51
+ };
52
+
53
+ return [isControlledByParent ? getValueInRange(value) : currentValue, updateValue];
54
+ };
55
+
56
+ type Props = {
57
+ value?: number;
58
+ defaultValue?: number;
59
+ min?: number;
60
+ max?: number;
61
+ onChangeValue?: (value: number) => void;
62
+ onRemove?: () => void;
63
+ children?: void;
64
+ disabled?: boolean;
65
+ dataAttributes?: DataAttributes;
66
+ removeLabel?: string;
67
+ increaseLabel?: string;
68
+ decreaseLabel?: string;
69
+ valueLabel?: string;
70
+ };
71
+
72
+ const Counter = ({
73
+ value,
74
+ defaultValue,
75
+ onChangeValue,
76
+ onRemove,
77
+ min,
78
+ max,
79
+ dataAttributes,
80
+ disabled,
81
+ removeLabel,
82
+ increaseLabel,
83
+ decreaseLabel,
84
+ valueLabel,
85
+ }: Props): JSX.Element => {
86
+ const variant = useThemeVariant();
87
+ const counterId = React.useId();
88
+ const {texts, t, isDarkMode} = useTheme();
89
+
90
+ const minValue = min === undefined ? 0 : min;
91
+ const maxValue = Math.max(minValue, max === undefined ? 999 : max);
92
+
93
+ const [currentValue, setCurrentValue] = useCounterState({
94
+ value,
95
+ defaultValue,
96
+ min: minValue,
97
+ max: maxValue,
98
+ onChangeValue,
99
+ });
100
+
101
+ const hasTrashIcon = !!onRemove && currentValue === minValue;
102
+
103
+ const getRemoveLabel = () => {
104
+ return removeLabel ?? (texts.counterRemoveLabel || t(tokens.counterRemoveLabel));
105
+ };
106
+
107
+ const getIncreaseLabel = () => {
108
+ return increaseLabel ?? (texts.counterIncreaseLabel || t(tokens.counterIncreaseLabel));
109
+ };
110
+
111
+ const getDecreaseLabel = () => {
112
+ return decreaseLabel ?? (texts.counterDecreaseLabel || t(tokens.counterDecreaseLabel));
113
+ };
114
+
115
+ const getValueLabel = () => {
116
+ return `${currentValue}, ${valueLabel ?? (texts.counterQuantity || t(tokens.counterQuantity))}${
117
+ min !== undefined ? `, ${texts.counterMinValue || t(tokens.counterMinValue)} ${min}` : ''
118
+ }${max !== undefined ? `, ${texts.counterMaxValue || t(tokens.counterMaxValue)} ${max}` : ''}`;
119
+ };
120
+
121
+ return (
122
+ <div
123
+ className={classNames(styles.counter, {[styles.disabled]: disabled})}
124
+ {...getPrefixedDataAttributes(dataAttributes, 'Counter')}
125
+ style={{
126
+ border: `1px solid ${(variant === 'brand' || variant === 'media' || variant === 'negative') && !isDarkMode ? vars.colors.backgroundContainer : vars.colors.inputBorder}`,
127
+ }}
128
+ >
129
+ <Inline space={8} alignItems="center">
130
+ <div
131
+ className={classNames(styles.buttonContainer, {
132
+ [styles.hasTrashIcon]: hasTrashIcon,
133
+ [styles.isButtonDisabled]: disabled || (!hasTrashIcon && currentValue === minValue),
134
+ [styles.disabled]: !disabled && !hasTrashIcon && currentValue === minValue,
135
+ })}
136
+ >
137
+ <BaseTouchable
138
+ className={styles.button}
139
+ disabled={(!hasTrashIcon && currentValue === minValue) || disabled}
140
+ onPress={() => (hasTrashIcon ? onRemove?.() : setCurrentValue(currentValue - 1))}
141
+ aria-label={hasTrashIcon ? getRemoveLabel() : getDecreaseLabel()}
142
+ aria-controls={counterId}
143
+ >
144
+ <div className={styles.buttonBackground} />
145
+ <div className={styles.decreaseButtonIcon} aria-hidden={hasTrashIcon}>
146
+ <IconSubtractRegular
147
+ size={ICON_SIZE}
148
+ color={
149
+ (currentValue === minValue && !hasTrashIcon) || disabled
150
+ ? vars.colors.control
151
+ : vars.colors.controlActivated
152
+ }
153
+ />
154
+ </div>
155
+ <div className={styles.trashButtonIcon} aria-hidden={!hasTrashIcon}>
156
+ <IconTrashCanRegular size={ICON_SIZE} color={vars.colors.controlError} />
157
+ </div>
158
+ </BaseTouchable>
159
+ </div>
160
+
161
+ <div
162
+ className={styles.valueContainer}
163
+ /**
164
+ * Hack to avoid counter's width from changing because of some characters
165
+ * having different widths. Using fontVariantNumeric tabular-nums is not supported
166
+ * for new Vivo font.
167
+ * */
168
+ style={{width: `${Math.max(3, String(maxValue).length) * 1.25}ch`}}
169
+ id={counterId}
170
+ aria-live="polite"
171
+ >
172
+ <ThemeVariant variant="default">
173
+ <div aria-hidden>
174
+ <Text3 regular color={vars.colors.textPrimary}>
175
+ {currentValue}
176
+ </Text3>
177
+ </div>
178
+ <ScreenReaderOnly>
179
+ <span>{getValueLabel()}</span>
180
+ </ScreenReaderOnly>
181
+ </ThemeVariant>
182
+ </div>
183
+
184
+ <div
185
+ className={classNames(styles.buttonContainer, {
186
+ [styles.isButtonDisabled]: disabled || currentValue === maxValue,
187
+ [styles.disabled]: !disabled && currentValue === maxValue,
188
+ })}
189
+ >
190
+ <BaseTouchable
191
+ className={styles.button}
192
+ disabled={currentValue === maxValue || disabled}
193
+ onPress={() => setCurrentValue(currentValue + 1)}
194
+ aria-label={getIncreaseLabel()}
195
+ aria-controls={counterId}
196
+ >
197
+ <div className={styles.buttonBackground} />
198
+ <div className={styles.defaultButtonIcon}>
199
+ <IconAddMoreRegular
200
+ size={ICON_SIZE}
201
+ color={
202
+ currentValue === maxValue || disabled
203
+ ? vars.colors.control
204
+ : vars.colors.controlActivated
205
+ }
206
+ />
207
+ </div>
208
+ </BaseTouchable>
209
+ </div>
210
+ </Inline>
211
+ </div>
212
+ );
213
+ };
214
+
215
+ export default Counter;
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import {TopActions, useVideoWithControls} from './card-internal';
4
+ import * as styles from './cover-hero.css';
5
+ import Image from './image';
6
+
7
+ import type {ExclusifyUnion} from './utils/utility-types';
8
+ import type {VideoElement, VideoSource} from './video';
9
+
10
+ export type ImageProps = {
11
+ backgroundImage: string;
12
+ };
13
+
14
+ export type VideoProps = {
15
+ backgroundVideo: VideoSource;
16
+ poster?: string;
17
+ backgroundVideoRef?: React.RefObject<VideoElement>;
18
+ };
19
+
20
+ export const CoverHeroMedia = ({
21
+ backgroundVideo,
22
+ backgroundImage,
23
+ poster,
24
+ backgroundVideoRef,
25
+ }: ExclusifyUnion<ImageProps | VideoProps>): React.ReactElement => {
26
+ const {video, videoAction} = useVideoWithControls({
27
+ src: backgroundVideo,
28
+ poster,
29
+ ref: backgroundVideoRef,
30
+ });
31
+ return (
32
+ <div className={styles.mediaLayer}>
33
+ {backgroundImage && <Image width="100%" height="100%" src={backgroundImage} />}
34
+ {backgroundVideo && video}
35
+ <div className={styles.mediaOverlay} />
36
+ {videoAction && <TopActions actions={[videoAction]} variant="media" />}
37
+ </div>
38
+ );
39
+ };
@@ -0,0 +1,133 @@
1
+ import {createVar, globalStyle, style} from '@vanilla-extract/css';
2
+ import {sprinkles} from './sprinkles.css';
3
+ import * as mq from './media-queries.css';
4
+ import {slideshowWithBullets, slideshowContainer} from './carousel.css';
5
+
6
+ const aspectRatio = createVar();
7
+
8
+ export const vars = {aspectRatio};
9
+
10
+ export const coverHero = style([
11
+ sprinkles({
12
+ position: 'relative',
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ justifyContent: 'center',
16
+ width: '100%',
17
+ top: 0,
18
+ bottom: 0,
19
+ }),
20
+ {},
21
+ ]);
22
+
23
+ export const coverHeroContainer = style([
24
+ sprinkles({
25
+ position: 'relative',
26
+ display: 'flex',
27
+ width: '100%',
28
+ }),
29
+ {
30
+ selectors: {
31
+ [`${slideshowContainer} &`]: {
32
+ height: '100%',
33
+ },
34
+ },
35
+ },
36
+ ]);
37
+
38
+ export const withAspectRatio = style({
39
+ ':before': {
40
+ float: 'left',
41
+ content: '""',
42
+ paddingTop: `calc(100% / ${aspectRatio})`,
43
+ },
44
+ ':after': {
45
+ display: 'block',
46
+ content: '""',
47
+ clear: 'both',
48
+ },
49
+ });
50
+
51
+ export const minHeight = style({
52
+ minHeight: 400,
53
+ '@media': {
54
+ [mq.tabletOrBigger]: {
55
+ minHeight: 460,
56
+ },
57
+ },
58
+ });
59
+
60
+ // give some extra space for the slideshow bullets
61
+ globalStyle(`${slideshowWithBullets} ${coverHero}:after`, {
62
+ '@media': {
63
+ [mq.mobile]: {
64
+ display: 'block',
65
+ content: '""',
66
+ height: 24,
67
+ },
68
+ },
69
+ });
70
+
71
+ export const hasSideExtra = style({});
72
+
73
+ export const centered = style([
74
+ sprinkles({
75
+ alignItems: 'center',
76
+ }),
77
+ {
78
+ textAlign: 'center',
79
+ selectors: {
80
+ [`${hasSideExtra}&`]: {
81
+ '@media': {
82
+ [mq.tabletOrBigger]: {
83
+ textAlign: 'left',
84
+ },
85
+ },
86
+ },
87
+ },
88
+ },
89
+ ]);
90
+
91
+ export const mediaLayer = sprinkles({
92
+ position: 'absolute',
93
+ objectFit: 'cover',
94
+ width: '100%',
95
+ height: '100%',
96
+ });
97
+
98
+ export const mediaOverlay = style([
99
+ sprinkles({
100
+ position: 'absolute',
101
+ top: 0,
102
+ left: 0,
103
+ width: '100%',
104
+ height: '100%',
105
+ }),
106
+ {
107
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
108
+ },
109
+ ]);
110
+
111
+ export const mainContent = sprinkles({position: 'relative'});
112
+
113
+ // pretitle and description should be 6 grid columns wide, but they are already inside a grid item (the left side of GridLayout)
114
+ // so we can't adjust their width to the parent grid columns. 75% is a good approximation.
115
+ export const sixColumns = style({
116
+ '@media': {
117
+ [mq.tabletOrBigger]: {
118
+ width: '75%',
119
+ selectors: {
120
+ [`${centered}:not(${hasSideExtra}) &`]: {
121
+ margin: '0 auto',
122
+ },
123
+ },
124
+ },
125
+ },
126
+ });
127
+
128
+ export const sideExtra = sprinkles({position: 'relative'});
129
+
130
+ export const flexColumn = sprinkles({
131
+ display: 'flex',
132
+ flexDirection: 'column',
133
+ });
@@ -0,0 +1,262 @@
1
+ import * as React from 'react';
2
+ import ResponsiveLayout from './responsive-layout';
3
+ import Box from './box';
4
+ import ButtonGroup from './button-group';
5
+ import Stack from './stack';
6
+ import {Text3, Text8} from './text';
7
+ import {vars} from './skins/skin-contract.css';
8
+ import * as styles from './cover-hero.css';
9
+ import classnames from 'classnames';
10
+ import {applyCssVars} from './utils/css';
11
+ import * as mediaStyles from './image.css';
12
+ import GridLayout from './grid-layout';
13
+ import {CoverHeroMedia} from './cover-hero-media';
14
+ import {getPrefixedDataAttributes} from './utils/dom';
15
+ import {isBiggerHeading} from './utils/headings';
16
+ import {normalizeVariant, type Variant} from './theme-variant-context';
17
+
18
+ import type {DataAttributes, HeadingType} from './utils/types';
19
+ import type {ImageProps, VideoProps} from './cover-hero-media';
20
+ import type {AspectRatio} from './image';
21
+ import type {ExclusifyUnion} from './utils/utility-types';
22
+ import type {ButtonLink, ButtonPrimary, ButtonSecondary} from './button';
23
+ import type Tag from './tag';
24
+ import type {RendersNullableElement} from './utils/renders-element';
25
+
26
+ type BaseProps = {
27
+ headline?: RendersNullableElement<typeof Tag>;
28
+ pretitle?: string;
29
+ pretitleLinesMax?: number;
30
+ pretitleAs?: HeadingType;
31
+ title: string;
32
+ titleLinesMax?: number;
33
+ titleAs?: HeadingType;
34
+ description?: string;
35
+ descriptionLinesMax?: number;
36
+ extra?: React.ReactNode;
37
+ sideExtra?: React.ReactNode;
38
+ button?: RendersNullableElement<typeof ButtonPrimary>;
39
+ secondaryButton?: RendersNullableElement<typeof ButtonSecondary>;
40
+ buttonLink?: RendersNullableElement<typeof ButtonLink>;
41
+ minHeight?: string | number;
42
+ aspectRatio?: AspectRatio | number | 'auto';
43
+ centered?: boolean;
44
+ noPaddingY?: boolean;
45
+ /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
46
+ dataAttributes?: DataAttributes;
47
+ 'aria-label'?: string;
48
+ };
49
+
50
+ type BackgroundProps = {
51
+ background?: string;
52
+ variant?: Variant;
53
+ };
54
+
55
+ type CoverHeroProps = BaseProps & ExclusifyUnion<ImageProps | VideoProps | BackgroundProps>;
56
+
57
+ const aspectRatioToNumber = (aspectRatio?: BaseProps['aspectRatio']): number => {
58
+ if (!aspectRatio || aspectRatio === 'auto') {
59
+ return 0;
60
+ }
61
+ if (typeof aspectRatio === 'number') {
62
+ return aspectRatio;
63
+ }
64
+ return {
65
+ '1:1': 1,
66
+ '16:9': 16 / 9,
67
+ '7:10': 7 / 10,
68
+ '4:3': 9 / 10,
69
+ }[aspectRatio];
70
+ };
71
+
72
+ const CoverHero = React.forwardRef<HTMLDivElement, CoverHeroProps>(
73
+ (
74
+ {
75
+ headline,
76
+ pretitle,
77
+ pretitleLinesMax,
78
+ pretitleAs,
79
+ title,
80
+ titleLinesMax,
81
+ titleAs = 'h1',
82
+ description,
83
+ descriptionLinesMax,
84
+ extra,
85
+ sideExtra,
86
+ button,
87
+ secondaryButton,
88
+ buttonLink,
89
+ minHeight,
90
+ aspectRatio = 'auto',
91
+ variant,
92
+ centered,
93
+ noPaddingY,
94
+ dataAttributes,
95
+ 'aria-label': ariaLabel,
96
+ ...mediaProps
97
+ },
98
+ ref
99
+ ) => {
100
+ const hasMedia = mediaProps.backgroundVideo || mediaProps.backgroundImage;
101
+
102
+ const background = hasMedia
103
+ ? 'none'
104
+ : mediaProps.background ||
105
+ {
106
+ default: vars.colors.background,
107
+ brand: vars.colors.backgroundBrand,
108
+ negative: vars.colors.backgroundNegative,
109
+ alternative: vars.colors.backgroundAlternative,
110
+ media: 'none',
111
+ }[normalizeVariant(variant ?? 'default')];
112
+
113
+ const textShadow = hasMedia ? '0 0 15px rgba(0, 0, 0, 0.4)' : undefined;
114
+
115
+ const pretitleContent = pretitle ? (
116
+ <Text3
117
+ regular
118
+ as={pretitleAs}
119
+ truncate={pretitleLinesMax}
120
+ textShadow={textShadow}
121
+ dataAttributes={{testid: 'pretitle'}}
122
+ >
123
+ {pretitle}
124
+ </Text3>
125
+ ) : undefined;
126
+
127
+ const titleContent = title ? (
128
+ <Text8
129
+ as={titleAs}
130
+ truncate={titleLinesMax}
131
+ textShadow={textShadow}
132
+ dataAttributes={{testid: 'title'}}
133
+ >
134
+ {title}
135
+ </Text8>
136
+ ) : undefined;
137
+
138
+ const headlineContent = headline ? (
139
+ <div style={{order: -1}}>
140
+ <Box
141
+ dataAttributes={{testid: 'headline'}}
142
+ paddingBottom={{desktop: 8, tablet: 8, mobile: 16}}
143
+ >
144
+ {headline}
145
+ </Box>
146
+ </div>
147
+ ) : undefined;
148
+
149
+ const mainContent = (
150
+ <div className={styles.mainContent}>
151
+ <Stack space={16}>
152
+ {/** using flex instead of nested Stacks, this way we can rearrange texts so the DOM structure makes more sense for screen reader users */}
153
+ <div className={styles.flexColumn}>
154
+ {isBiggerHeading(titleAs, pretitleAs) ? (
155
+ <>
156
+ {titleContent}
157
+ {headlineContent}
158
+ {pretitleContent && (
159
+ <div
160
+ className={styles.sixColumns}
161
+ style={{paddingBottom: title ? 8 : 0, order: -1}}
162
+ >
163
+ {pretitleContent}
164
+ </div>
165
+ )}
166
+ </>
167
+ ) : (
168
+ <>
169
+ {pretitleContent && (
170
+ <div className={styles.sixColumns} style={{paddingBottom: title ? 8 : 0}}>
171
+ {pretitleContent}
172
+ </div>
173
+ )}
174
+ {headlineContent}
175
+ {titleContent}
176
+ </>
177
+ )}
178
+ </div>
179
+ {description && (
180
+ <div className={styles.sixColumns}>
181
+ <Text3
182
+ as="p"
183
+ regular
184
+ truncate={descriptionLinesMax}
185
+ color={hasMedia ? vars.colors.textPrimary : vars.colors.textSecondary}
186
+ textShadow={textShadow}
187
+ dataAttributes={{testid: 'description'}}
188
+ >
189
+ {description}
190
+ </Text3>
191
+ </div>
192
+ )}
193
+ </Stack>
194
+ {extra && <div data-testid="slot">{extra}</div>}
195
+ </div>
196
+ );
197
+
198
+ const withAspectRatio = aspectRatio && aspectRatio !== 'auto';
199
+
200
+ return (
201
+ <section
202
+ {...getPrefixedDataAttributes(dataAttributes, 'CoverHero')}
203
+ aria-label={ariaLabel}
204
+ ref={ref}
205
+ className={classnames(styles.coverHeroContainer, {
206
+ [styles.minHeight]: !noPaddingY,
207
+ [styles.withAspectRatio]: withAspectRatio,
208
+ })}
209
+ style={{
210
+ minHeight: withAspectRatio ? 'auto' : minHeight,
211
+ boxSizing: 'border-box',
212
+ background,
213
+ ...applyCssVars({
214
+ [styles.vars.aspectRatio]: String(aspectRatioToNumber(aspectRatio)),
215
+ [mediaStyles.vars.mediaBorderRadius]: '0px',
216
+ }),
217
+ }}
218
+ >
219
+ <div
220
+ className={classnames(styles.coverHero, {
221
+ [styles.centered]: centered,
222
+ [styles.hasSideExtra]: sideExtra,
223
+ })}
224
+ >
225
+ {hasMedia ? <CoverHeroMedia {...mediaProps} /> : null}
226
+ <ResponsiveLayout variant={hasMedia ? 'media' : variant}>
227
+ <Box paddingY={noPaddingY ? 0 : {desktop: 56, tablet: 56, mobile: 24}}>
228
+ <Stack space={24}>
229
+ {centered && !sideExtra ? (
230
+ <GridLayout template="8">{mainContent}</GridLayout>
231
+ ) : (
232
+ <GridLayout
233
+ template="8+4"
234
+ collapseBreakpoint="mobile"
235
+ left={mainContent}
236
+ right={
237
+ <div className={styles.sideExtra} data-testid="sideSlot">
238
+ {sideExtra}
239
+ </div>
240
+ }
241
+ />
242
+ )}
243
+ <ButtonGroup
244
+ align={{
245
+ mobile: centered ? 'center' : 'left',
246
+ tablet: centered && !sideExtra ? 'center' : 'left',
247
+ desktop: centered && !sideExtra ? 'center' : 'left',
248
+ }}
249
+ primaryButton={button}
250
+ secondaryButton={secondaryButton}
251
+ link={buttonLink}
252
+ />
253
+ </Stack>
254
+ </Box>
255
+ </ResponsiveLayout>
256
+ </div>
257
+ </section>
258
+ );
259
+ }
260
+ );
261
+
262
+ export default CoverHero;