@telefonica/mistica 16.58.0 → 16.59.0-beta.1

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 (537) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +16 -16
  3. package/dist/align.css-mistica.js +2 -2
  4. package/dist/autocomplete.css-mistica.js +6 -6
  5. package/dist/avatar.css-mistica.js +3 -3
  6. package/dist/badge.css-mistica.js +7 -7
  7. package/dist/box.css-mistica.js +15 -15
  8. package/dist/boxed.css-mistica.js +31 -31
  9. package/dist/button-group.css-mistica.js +10 -10
  10. package/dist/button-layout.css-mistica.js +21 -21
  11. package/dist/button.css-mistica.js +51 -51
  12. package/dist/callout.css-mistica.js +16 -16
  13. package/dist/card-internal.css-mistica.js +38 -38
  14. package/dist/carousel.css-mistica.js +18 -18
  15. package/dist/checkbox.css-mistica.js +21 -21
  16. package/dist/chip.css-mistica.js +30 -30
  17. package/dist/circle.css-mistica.js +2 -2
  18. package/dist/community/advanced-data-card.css-mistica.js +26 -26
  19. package/dist/community/blocks.css-mistica.js +3 -3
  20. package/dist/community/example-component.css-mistica.js +2 -2
  21. package/dist/counter.css-mistica.js +12 -12
  22. package/dist/cover-hero.css-mistica.js +16 -16
  23. package/dist/credit-card-number-field.css-mistica.js +6 -6
  24. package/dist/date-field.css-mistica.js +1 -1
  25. package/dist/date-time-picker.css-mistica.js +2 -2
  26. package/dist/dialog.css-mistica.js +15 -15
  27. package/dist/divider.css-mistica.js +5 -5
  28. package/dist/double-field.css-mistica.js +4 -4
  29. package/dist/drawer.css-mistica.js +15 -15
  30. package/dist/empty-state-card.css-mistica.js +4 -4
  31. package/dist/empty-state.css-mistica.js +14 -14
  32. package/dist/fade-in.css-mistica.js +1 -1
  33. package/dist/feedback.css-mistica.js +14 -14
  34. package/dist/file-upload.css-mistica.js +14 -14
  35. package/dist/fixed-footer-layout.css-mistica.js +12 -12
  36. package/dist/form.css-mistica.js +2 -2
  37. package/dist/grid-layout.css-mistica.js +9 -9
  38. package/dist/grid.css-mistica.js +147 -147
  39. package/dist/header.css-mistica.js +5 -5
  40. package/dist/hero.css-mistica.js +11 -11
  41. package/dist/horizontal-scroll.css-mistica.js +3 -3
  42. package/dist/icon-button.css-mistica.js +66 -66
  43. package/dist/icons/icon-chevron.css-mistica.js +6 -6
  44. package/dist/icons/icon-error.css-mistica.js +3 -3
  45. package/dist/image.css-mistica.js +11 -11
  46. package/dist/inline.css-mistica.js +16 -16
  47. package/dist/list.css-mistica.js +15 -15
  48. package/dist/loading-bar.css-mistica.js +5 -5
  49. package/dist/loading-screen.css-mistica.js +15 -15
  50. package/dist/logo.css-mistica.js +9 -9
  51. package/dist/menu.css-mistica.js +24 -24
  52. package/dist/mosaic.css-mistica.js +3 -3
  53. package/dist/navigation-bar.css-mistica.js +45 -45
  54. package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
  55. package/dist/package-version.js +2 -2
  56. package/dist/pin-field.css-mistica.js +10 -10
  57. package/dist/popover.css-mistica.js +2 -2
  58. package/dist/progress-bar.css-mistica.js +12 -12
  59. package/dist/radio-button.css-mistica.js +33 -33
  60. package/dist/rating.css-mistica.js +12 -12
  61. package/dist/responsive-layout.css-mistica.js +20 -20
  62. package/dist/screen-reader-only.css-mistica.js +2 -2
  63. package/dist/select.css-mistica.js +29 -29
  64. package/dist/sheet-action-row.css-mistica.js +2 -2
  65. package/dist/sheet-common.css-mistica.js +16 -16
  66. package/dist/sheet-info.css-mistica.js +4 -4
  67. package/dist/skeletons.css-mistica.js +12 -12
  68. package/dist/skins/skin-contract.css-mistica.js +686 -686
  69. package/dist/skip-link.css-mistica.js +3 -3
  70. package/dist/slider.css-mistica.js +28 -28
  71. package/dist/snackbar.css-mistica.js +16 -16
  72. package/dist/spinner.css-mistica.js +5 -5
  73. package/dist/square.css-mistica.js +2 -2
  74. package/dist/stack.css-mistica.js +9 -9
  75. package/dist/stacking-group.css-mistica.js +2 -2
  76. package/dist/stepper.css-mistica.js +16 -16
  77. package/dist/switch-component.css-mistica.js +53 -53
  78. package/dist/table.css-mistica.js +24 -24
  79. package/dist/tabs.css-mistica.js +30 -30
  80. package/dist/tag.css-mistica.js +5 -5
  81. package/dist/text-field-base.css-mistica.js +30 -30
  82. package/dist/text-field-components.css-mistica.js +20 -20
  83. package/dist/text-link.css-mistica.js +10 -10
  84. package/dist/text.css-mistica.js +13 -13
  85. package/dist/theme-context.css-mistica.js +2 -2
  86. package/dist/timeline.css-mistica.js +18 -18
  87. package/dist/timer.css-mistica.js +13 -13
  88. package/dist/tooltip.css-mistica.js +12 -12
  89. package/dist/touchable.css-mistica.js +5 -5
  90. package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
  91. package/dist/video.css-mistica.js +2 -2
  92. package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
  93. package/dist-es/accordion.css-mistica.js +7 -7
  94. package/dist-es/align.css-mistica.js +2 -2
  95. package/dist-es/autocomplete.css-mistica.js +2 -2
  96. package/dist-es/avatar.css-mistica.js +2 -2
  97. package/dist-es/badge.css-mistica.js +2 -2
  98. package/dist-es/box.css-mistica.js +15 -15
  99. package/dist-es/boxed.css-mistica.js +25 -25
  100. package/dist-es/button-group.css-mistica.js +2 -2
  101. package/dist-es/button-layout.css-mistica.js +16 -16
  102. package/dist-es/button.css-mistica.js +38 -38
  103. package/dist-es/callout.css-mistica.js +12 -12
  104. package/dist-es/card-internal.css-mistica.js +20 -20
  105. package/dist-es/carousel.css-mistica.js +10 -10
  106. package/dist-es/checkbox.css-mistica.js +14 -14
  107. package/dist-es/chip.css-mistica.js +17 -17
  108. package/dist-es/circle.css-mistica.js +2 -2
  109. package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
  110. package/dist-es/community/blocks.css-mistica.js +2 -2
  111. package/dist-es/community/example-component.css-mistica.js +2 -2
  112. package/dist-es/counter.css-mistica.js +2 -2
  113. package/dist-es/cover-hero.css-mistica.js +4 -4
  114. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  115. package/dist-es/date-field.css-mistica.js +1 -1
  116. package/dist-es/date-time-picker.css-mistica.js +2 -2
  117. package/dist-es/dialog.css-mistica.js +5 -5
  118. package/dist-es/divider.css-mistica.js +5 -5
  119. package/dist-es/double-field.css-mistica.js +4 -4
  120. package/dist-es/drawer.css-mistica.js +2 -2
  121. package/dist-es/empty-state-card.css-mistica.js +2 -2
  122. package/dist-es/empty-state.css-mistica.js +7 -7
  123. package/dist-es/fade-in.css-mistica.js +1 -1
  124. package/dist-es/feedback.css-mistica.js +2 -2
  125. package/dist-es/file-upload.css-mistica.js +8 -8
  126. package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
  127. package/dist-es/form.css-mistica.js +2 -2
  128. package/dist-es/grid-layout.css-mistica.js +4 -4
  129. package/dist-es/grid.css-mistica.js +127 -127
  130. package/dist-es/header.css-mistica.js +2 -2
  131. package/dist-es/hero.css-mistica.js +4 -4
  132. package/dist-es/horizontal-scroll.css-mistica.js +2 -2
  133. package/dist-es/icon-button.css-mistica.js +56 -56
  134. package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
  135. package/dist-es/icons/icon-error.css-mistica.js +2 -2
  136. package/dist-es/image.css-mistica.js +4 -4
  137. package/dist-es/inline.css-mistica.js +10 -10
  138. package/dist-es/list.css-mistica.js +2 -2
  139. package/dist-es/loading-bar.css-mistica.js +2 -2
  140. package/dist-es/loading-screen.css-mistica.js +5 -5
  141. package/dist-es/logo.css-mistica.js +7 -7
  142. package/dist-es/menu.css-mistica.js +15 -15
  143. package/dist-es/mosaic.css-mistica.js +2 -2
  144. package/dist-es/navigation-bar.css-mistica.js +20 -20
  145. package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
  146. package/dist-es/package-version.js +2 -2
  147. package/dist-es/pin-field.css-mistica.js +2 -2
  148. package/dist-es/popover.css-mistica.js +2 -2
  149. package/dist-es/progress-bar.css-mistica.js +8 -8
  150. package/dist-es/radio-button.css-mistica.js +25 -25
  151. package/dist-es/rating.css-mistica.js +4 -4
  152. package/dist-es/responsive-layout.css-mistica.js +7 -7
  153. package/dist-es/screen-reader-only.css-mistica.js +2 -2
  154. package/dist-es/select.css-mistica.js +20 -20
  155. package/dist-es/sheet-action-row.css-mistica.js +2 -2
  156. package/dist-es/sheet-common.css-mistica.js +2 -2
  157. package/dist-es/sheet-info.css-mistica.js +2 -2
  158. package/dist-es/skeletons.css-mistica.js +8 -8
  159. package/dist-es/skins/skin-contract.css-mistica.js +686 -686
  160. package/dist-es/skip-link.css-mistica.js +2 -2
  161. package/dist-es/slider.css-mistica.js +20 -20
  162. package/dist-es/snackbar.css-mistica.js +5 -5
  163. package/dist-es/spinner.css-mistica.js +2 -2
  164. package/dist-es/square.css-mistica.js +2 -2
  165. package/dist-es/stack.css-mistica.js +7 -7
  166. package/dist-es/stacking-group.css-mistica.js +2 -2
  167. package/dist-es/stepper.css-mistica.js +4 -4
  168. package/dist-es/style.css +1 -1
  169. package/dist-es/switch-component.css-mistica.js +41 -41
  170. package/dist-es/table.css-mistica.js +11 -11
  171. package/dist-es/tabs.css-mistica.js +21 -21
  172. package/dist-es/tag.css-mistica.js +2 -2
  173. package/dist-es/text-field-base.css-mistica.js +17 -17
  174. package/dist-es/text-field-components.css-mistica.js +4 -4
  175. package/dist-es/text-link.css-mistica.js +9 -9
  176. package/dist-es/text.css-mistica.js +8 -8
  177. package/dist-es/theme-context.css-mistica.js +2 -2
  178. package/dist-es/timeline.css-mistica.js +11 -11
  179. package/dist-es/timer.css-mistica.js +7 -7
  180. package/dist-es/tooltip.css-mistica.js +3 -3
  181. package/dist-es/touchable.css-mistica.js +2 -2
  182. package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
  183. package/dist-es/video.css-mistica.js +2 -2
  184. package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
  185. package/doc/llms.md +60 -1
  186. package/doc/patterns.md +22 -20
  187. package/package.json +13 -1
  188. package/src/accordion.css.ts +121 -0
  189. package/src/accordion.tsx +366 -0
  190. package/src/align.css.ts +7 -0
  191. package/src/align.tsx +32 -0
  192. package/src/autocomplete.css.ts +62 -0
  193. package/src/autocomplete.tsx +239 -0
  194. package/src/avatar.css.ts +14 -0
  195. package/src/avatar.tsx +120 -0
  196. package/src/badge.css.ts +51 -0
  197. package/src/badge.tsx +79 -0
  198. package/src/box.css.ts +51 -0
  199. package/src/box.tsx +114 -0
  200. package/src/boxed.css.ts +132 -0
  201. package/src/boxed.tsx +153 -0
  202. package/src/button-fixed-footer-layout.tsx +62 -0
  203. package/src/button-group.css.ts +75 -0
  204. package/src/button-group.tsx +91 -0
  205. package/src/button-layout.css.ts +162 -0
  206. package/src/button-layout.tsx +91 -0
  207. package/src/button.css.ts +758 -0
  208. package/src/button.tsx +632 -0
  209. package/src/callout.css.ts +50 -0
  210. package/src/callout.tsx +147 -0
  211. package/src/card-cover.tsx +242 -0
  212. package/src/card-data.tsx +152 -0
  213. package/src/card-internal.css.ts +271 -0
  214. package/src/card-internal.tsx +1724 -0
  215. package/src/card-media.tsx +157 -0
  216. package/src/card-naked.tsx +63 -0
  217. package/src/carousel.css.ts +522 -0
  218. package/src/carousel.tsx +1300 -0
  219. package/src/checkbox.css.ts +94 -0
  220. package/src/checkbox.tsx +192 -0
  221. package/src/chip.css.ts +204 -0
  222. package/src/chip.tsx +191 -0
  223. package/src/circle.css.ts +14 -0
  224. package/src/circle.tsx +52 -0
  225. 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
  226. 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
  227. 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
  228. 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
  229. 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
  230. 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
  231. 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
  232. 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
  233. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
  234. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
  235. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
  236. 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
  237. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
  238. 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
  239. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
  240. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
  241. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
  242. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
  243. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
  244. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
  245. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
  246. package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
  247. package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
  248. package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
  249. package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
  250. package/src/community/__stories__/blocks-story.tsx +272 -0
  251. package/src/community/__stories__/example-component-story.tsx +15 -0
  252. package/src/community/__stories__/index-story.tsx +154 -0
  253. package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
  254. package/src/community/advanced-data-card.css.ts +271 -0
  255. package/src/community/advanced-data-card.tsx +431 -0
  256. package/src/community/blocks.css.ts +12 -0
  257. package/src/community/blocks.tsx +290 -0
  258. package/src/community/example-component.css.ts +7 -0
  259. package/src/community/example-component.tsx +17 -0
  260. package/src/community/index.tsx +10 -0
  261. package/src/counter.css.ts +150 -0
  262. package/src/counter.tsx +215 -0
  263. package/src/cover-hero-media.tsx +39 -0
  264. package/src/cover-hero.css.ts +133 -0
  265. package/src/cover-hero.tsx +262 -0
  266. package/src/credit-card-expiration-field.tsx +187 -0
  267. package/src/credit-card-fields.tsx +56 -0
  268. package/src/credit-card-number-field.css.ts +47 -0
  269. package/src/credit-card-number-field.tsx +245 -0
  270. package/src/cvv-field.tsx +169 -0
  271. package/src/date-field.css.ts +14 -0
  272. package/src/date-field.tsx +130 -0
  273. package/src/date-time-field.tsx +141 -0
  274. package/src/date-time-picker.css.ts +126 -0
  275. package/src/date-time-picker.tsx +188 -0
  276. package/src/decimal-field.tsx +160 -0
  277. package/src/desktop-container-type-context.tsx +15 -0
  278. package/src/dialog-context.tsx +81 -0
  279. package/src/dialog.css.ts +155 -0
  280. package/src/dialog.tsx +423 -0
  281. package/src/divider.css.ts +10 -0
  282. package/src/divider.tsx +11 -0
  283. package/src/double-field.css.ts +33 -0
  284. package/src/double-field.tsx +71 -0
  285. package/src/drawer.css.ts +123 -0
  286. package/src/drawer.tsx +304 -0
  287. package/src/email-field.tsx +76 -0
  288. package/src/empty-state-card.css.ts +40 -0
  289. package/src/empty-state-card.tsx +92 -0
  290. package/src/empty-state.css.ts +119 -0
  291. package/src/empty-state.tsx +141 -0
  292. package/src/fade-in.css.ts +12 -0
  293. package/src/fade-in.tsx +40 -0
  294. package/src/feedback.css.ts +119 -0
  295. package/src/feedback.tsx +432 -0
  296. package/src/file-upload.css.ts +156 -0
  297. package/src/file-upload.tsx +612 -0
  298. package/src/fixed-footer-layout.css.ts +96 -0
  299. package/src/fixed-footer-layout.tsx +215 -0
  300. package/src/fixed-to-top.tsx +21 -0
  301. package/src/focus-trap.tsx +17 -0
  302. package/src/form-context.tsx +198 -0
  303. package/src/form.css.ts +5 -0
  304. package/src/form.tsx +287 -0
  305. package/src/grid-layout.css.ts +68 -0
  306. package/src/grid-layout.tsx +201 -0
  307. package/src/grid.css.ts +203 -0
  308. package/src/grid.tsx +241 -0
  309. package/src/header.css.ts +30 -0
  310. package/src/header.tsx +319 -0
  311. package/src/hero.css.ts +71 -0
  312. package/src/hero.tsx +318 -0
  313. package/src/hooks.tsx +313 -0
  314. package/src/horizontal-scroll.css.ts +43 -0
  315. package/src/horizontal-scroll.tsx +18 -0
  316. package/src/iban-field.tsx +218 -0
  317. package/src/icon-button.css.ts +561 -0
  318. package/src/icon-button.tsx +221 -0
  319. package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
  320. package/src/icons/icon-amex.tsx +40 -0
  321. package/src/icons/icon-chevron.css.ts +23 -0
  322. package/src/icons/icon-chevron.tsx +150 -0
  323. package/src/icons/icon-cvv-amex.tsx +31 -0
  324. package/src/icons/icon-cvv-visa-mc.tsx +31 -0
  325. package/src/icons/icon-error.css.ts +27 -0
  326. package/src/icons/icon-error.tsx +207 -0
  327. package/src/icons/icon-info.tsx +86 -0
  328. package/src/icons/icon-mastercard.tsx +36 -0
  329. package/src/icons/icon-success-vivo-new.tsx +51 -0
  330. package/src/icons/icon-success-vivo.tsx +36 -0
  331. package/src/icons/icon-success.tsx +211 -0
  332. package/src/icons/icon-visa.tsx +32 -0
  333. package/src/image.css.ts +48 -0
  334. package/src/image.tsx +345 -0
  335. package/src/index.tsx +2466 -0
  336. package/src/inline.css.ts +131 -0
  337. package/src/inline.tsx +135 -0
  338. package/src/integer-field.tsx +93 -0
  339. package/src/list.css.ts +281 -0
  340. package/src/list.tsx +963 -0
  341. package/src/loading-bar.css.ts +69 -0
  342. package/src/loading-bar.tsx +25 -0
  343. package/src/loading-screen.css.ts +114 -0
  344. package/src/loading-screen.tsx +376 -0
  345. package/src/logo-blau-shell.tsx +30 -0
  346. package/src/logo-blau.tsx +60 -0
  347. package/src/logo-common.tsx +29 -0
  348. package/src/logo-esimflag-shell.tsx +30 -0
  349. package/src/logo-esimflag.tsx +56 -0
  350. package/src/logo-movistar-new-shell.tsx +30 -0
  351. package/src/logo-movistar-new.tsx +85 -0
  352. package/src/logo-movistar-shell.tsx +30 -0
  353. package/src/logo-movistar.tsx +63 -0
  354. package/src/logo-o2-new-shell.tsx +26 -0
  355. package/src/logo-o2-new.tsx +27 -0
  356. package/src/logo-o2-shell.tsx +26 -0
  357. package/src/logo-o2.tsx +27 -0
  358. package/src/logo-telefonica-shell.tsx +30 -0
  359. package/src/logo-telefonica.tsx +95 -0
  360. package/src/logo-tu-shell.tsx +26 -0
  361. package/src/logo-tu.tsx +28 -0
  362. package/src/logo-vivo-shell.tsx +30 -0
  363. package/src/logo-vivo.tsx +53 -0
  364. package/src/logo.css.ts +33 -0
  365. package/src/logo.tsx +313 -0
  366. package/src/master-detail-layout.tsx +28 -0
  367. package/src/maybe-dismissable.css.ts +37 -0
  368. package/src/maybe-dismissable.tsx +58 -0
  369. package/src/media-queries.css.ts +67 -0
  370. package/src/menu.css.ts +132 -0
  371. package/src/menu.tsx +468 -0
  372. package/src/meter.tsx +516 -0
  373. package/src/modal-context-provider.tsx +45 -0
  374. package/src/month-field.tsx +124 -0
  375. package/src/mosaic.css.ts +73 -0
  376. package/src/mosaic.tsx +205 -0
  377. package/src/navigation-bar.css.ts +558 -0
  378. package/src/navigation-bar.tsx +1637 -0
  379. package/src/navigation-breadcrumbs.css.ts +22 -0
  380. package/src/navigation-breadcrumbs.tsx +69 -0
  381. package/src/negative-box.tsx +15 -0
  382. package/src/nestable-context.tsx +139 -0
  383. package/src/overlay.tsx +86 -0
  384. package/src/overscroll-color-context.tsx +141 -0
  385. package/src/package-version.tsx +2 -0
  386. package/src/password-field.tsx +126 -0
  387. package/src/phone-number-field-lite.tsx +265 -0
  388. package/src/phone-number-field.tsx +171 -0
  389. package/src/pin-field.css.ts +90 -0
  390. package/src/pin-field.tsx +346 -0
  391. package/src/placeholder.tsx +41 -0
  392. package/src/popover.css.ts +8 -0
  393. package/src/popover.tsx +85 -0
  394. package/src/portal.tsx +43 -0
  395. package/src/progress-bar.css.ts +61 -0
  396. package/src/progress-bar.tsx +174 -0
  397. package/src/radio-button.css.ts +174 -0
  398. package/src/radio-button.tsx +322 -0
  399. package/src/rating.css.ts +128 -0
  400. package/src/rating.tsx +351 -0
  401. package/src/responsive-layout.css.ts +162 -0
  402. package/src/responsive-layout.tsx +106 -0
  403. package/src/screen-reader-only.css.ts +27 -0
  404. package/src/screen-reader-only.tsx +33 -0
  405. package/src/screen-size-context-provider.tsx +96 -0
  406. package/src/screen-size-context.tsx +23 -0
  407. package/src/search-field.tsx +126 -0
  408. package/src/select.css.ts +226 -0
  409. package/src/select.tsx +513 -0
  410. package/src/sheet-action-row.css.ts +33 -0
  411. package/src/sheet-actions-list.tsx +113 -0
  412. package/src/sheet-actions.tsx +95 -0
  413. package/src/sheet-common.css.ts +254 -0
  414. package/src/sheet-common.tsx +402 -0
  415. package/src/sheet-info.css.ts +19 -0
  416. package/src/sheet-info.tsx +127 -0
  417. package/src/sheet-native.tsx +189 -0
  418. package/src/sheet-radio-list.tsx +118 -0
  419. package/src/sheet-root.tsx +127 -0
  420. package/src/sheet-types.tsx +94 -0
  421. package/src/sheet-web.tsx +140 -0
  422. package/src/skeleton-base.tsx +38 -0
  423. package/src/skeletons.css.ts +56 -0
  424. package/src/skeletons.tsx +133 -0
  425. package/src/skins/blau.tsx +724 -0
  426. package/src/skins/constants.tsx +10 -0
  427. package/src/skins/defaults.tsx +104 -0
  428. package/src/skins/esimflag.tsx +728 -0
  429. package/src/skins/movistar-new.tsx +735 -0
  430. package/src/skins/movistar.tsx +740 -0
  431. package/src/skins/o2-new.tsx +731 -0
  432. package/src/skins/o2.tsx +727 -0
  433. package/src/skins/skin-contract.css.ts +380 -0
  434. package/src/skins/telefonica.tsx +768 -0
  435. package/src/skins/tu.tsx +741 -0
  436. package/src/skins/types/colors.tsx +286 -0
  437. package/src/skins/types/index.tsx +153 -0
  438. package/src/skins/utils.tsx +66 -0
  439. package/src/skins/vivo-new.tsx +745 -0
  440. package/src/skins/vivo.tsx +720 -0
  441. package/src/skip-link.css.ts +34 -0
  442. package/src/skip-link.tsx +52 -0
  443. package/src/slider.css.ts +181 -0
  444. package/src/slider.tsx +384 -0
  445. package/src/snackbar-context.tsx +98 -0
  446. package/src/snackbar-native.ts +37 -0
  447. package/src/snackbar.css.ts +176 -0
  448. package/src/snackbar.tsx +258 -0
  449. package/src/spinner.css.ts +66 -0
  450. package/src/spinner.tsx +136 -0
  451. package/src/sprinkles.css.ts +83 -0
  452. package/src/square.css.ts +15 -0
  453. package/src/square.tsx +55 -0
  454. package/src/stack.css.ts +44 -0
  455. package/src/stack.tsx +79 -0
  456. package/src/stacking-group.css.ts +15 -0
  457. package/src/stacking-group.tsx +82 -0
  458. package/src/stepper.css.ts +233 -0
  459. package/src/stepper.tsx +156 -0
  460. package/src/switch-component.css.ts +181 -0
  461. package/src/switch-component.tsx +187 -0
  462. package/src/tab-focus.tsx +68 -0
  463. package/src/table-actions-header.tsx +21 -0
  464. package/src/table-cell-text.tsx +35 -0
  465. package/src/table.css.ts +297 -0
  466. package/src/table.tsx +398 -0
  467. package/src/tabs.css.ts +212 -0
  468. package/src/tabs.tsx +263 -0
  469. package/src/tag.css.ts +42 -0
  470. package/src/tag.tsx +161 -0
  471. package/src/test-utils/environment/setup-ssr.tsx +10 -0
  472. package/src/test-utils/fail-test-on-console-error.tsx +22 -0
  473. package/src/test-utils/index.tsx +341 -0
  474. package/src/test-utils/setup-ssr-test-env.tsx +13 -0
  475. package/src/test-utils/ssr.tsx +197 -0
  476. package/src/text-field-base.css.ts +416 -0
  477. package/src/text-field-base.tsx +628 -0
  478. package/src/text-field-components.css.ts +159 -0
  479. package/src/text-field-components.tsx +225 -0
  480. package/src/text-field.tsx +118 -0
  481. package/src/text-link.css.ts +83 -0
  482. package/src/text-link.tsx +85 -0
  483. package/src/text-tokens.tsx +708 -0
  484. package/src/text.css.ts +60 -0
  485. package/src/text.tsx +516 -0
  486. package/src/theme-context-provider.tsx +370 -0
  487. package/src/theme-context.css.ts +3 -0
  488. package/src/theme-context.tsx +8 -0
  489. package/src/theme-variant-context.tsx +51 -0
  490. package/src/theme.tsx +184 -0
  491. package/src/time-field.tsx +99 -0
  492. package/src/timeline.css.ts +135 -0
  493. package/src/timeline.tsx +250 -0
  494. package/src/timer.css.ts +99 -0
  495. package/src/timer.tsx +420 -0
  496. package/src/title.tsx +119 -0
  497. package/src/tooltip-context-provider.tsx +57 -0
  498. package/src/tooltip.css.ts +106 -0
  499. package/src/tooltip.tsx +649 -0
  500. package/src/touchable.css.ts +56 -0
  501. package/src/touchable.tsx +355 -0
  502. package/src/types/font-face.d.ts +47 -0
  503. package/src/types/libs.d.ts +3 -0
  504. package/src/utils/__tests__/analytics-test.tsx +35 -0
  505. package/src/utils/__tests__/browser-test.tsx +28 -0
  506. package/src/utils/__tests__/dom-test.tsx +23 -0
  507. package/src/utils/__tests__/helpers-test.tsx +166 -0
  508. package/src/utils/analytics.tsx +28 -0
  509. package/src/utils/animation.tsx +201 -0
  510. package/src/utils/aspect-ratio-support.css.ts +28 -0
  511. package/src/utils/aspect-ratio-support.tsx +141 -0
  512. package/src/utils/browser.tsx +9 -0
  513. package/src/utils/color.tsx +46 -0
  514. package/src/utils/common.tsx +27 -0
  515. package/src/utils/credit-card.tsx +46 -0
  516. package/src/utils/css.tsx +25 -0
  517. package/src/utils/document-visibility.tsx +52 -0
  518. package/src/utils/dom.tsx +155 -0
  519. package/src/utils/environment.tsx +6 -0
  520. package/src/utils/headings.tsx +18 -0
  521. package/src/utils/helpers.tsx +182 -0
  522. package/src/utils/keys.tsx +8 -0
  523. package/src/utils/locale.tsx +27 -0
  524. package/src/utils/platform.tsx +94 -0
  525. package/src/utils/region-code.tsx +1 -0
  526. package/src/utils/renders-element.tsx +6 -0
  527. package/src/utils/time.tsx +22 -0
  528. package/src/utils/types.tsx +19 -0
  529. package/src/utils/utility-types.tsx +8 -0
  530. package/src/video.css.ts +11 -0
  531. package/src/video.tsx +355 -0
  532. package/src/vivinho-loading-animation/in-lottie.json +402 -0
  533. package/src/vivinho-loading-animation/index.tsx +90 -0
  534. package/src/vivinho-loading-animation/out-lottie.json +575 -0
  535. package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
  536. package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
  537. package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
@@ -0,0 +1,94 @@
1
+ import {style, styleVariants} from '@vanilla-extract/css';
2
+ import {vars} from './skins/skin-contract.css';
3
+ import {sprinkles} from './sprinkles.css';
4
+
5
+ const checkboxContainerBase = style([
6
+ sprinkles({
7
+ display: 'inline',
8
+ }),
9
+ {
10
+ WebkitTapHighlightColor: 'transparent',
11
+ },
12
+ ]);
13
+
14
+ export const checkboxContainer = style([
15
+ checkboxContainerBase,
16
+ {
17
+ cursor: 'pointer',
18
+ },
19
+ ]);
20
+
21
+ export const checkboxContainerDisabled = style([
22
+ checkboxContainerBase,
23
+ {
24
+ cursor: 'default',
25
+ },
26
+ ]);
27
+
28
+ const boxBase = style([
29
+ sprinkles({
30
+ display: 'inline-flex',
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ flexShrink: 0,
34
+ borderRadius: vars.borderRadii.checkbox,
35
+ }),
36
+ {
37
+ height: 18,
38
+ width: 18,
39
+ userSelect: 'none',
40
+ outline: '1px solid transparent',
41
+ verticalAlign: 'middle',
42
+ transition: 'box-shadow 0.3s',
43
+ },
44
+ ]);
45
+
46
+ export const boxVariant = styleVariants({
47
+ ios: [boxBase, {background: vars.colors.background, boxShadow: `inset 0 0 0 1px ${vars.colors.control}`}],
48
+ rest: [
49
+ boxBase,
50
+ {background: vars.colors.background, boxShadow: `inset 0 0 0 2px ${vars.colors.control}`},
51
+ ],
52
+ checked: [
53
+ boxBase,
54
+ {background: vars.colors.background, boxShadow: `inset 0 0 0 12px ${vars.colors.controlActivated}`},
55
+ ],
56
+ });
57
+
58
+ export const overBrandBoxVariant = styleVariants({
59
+ ios: [boxBase, {background: 'transparent', boxShadow: `inset 0 0 0 1px ${vars.colors.controlBrand}`}],
60
+ rest: [boxBase, {background: 'transparent', boxShadow: `inset 0 0 0 2px ${vars.colors.controlBrand}`}],
61
+ checked: [
62
+ boxBase,
63
+ {background: 'transparent', boxShadow: `inset 0 0 0 12px ${vars.colors.controlActivatedBrand}`},
64
+ ],
65
+ });
66
+
67
+ export const overNegativeBoxVariant = styleVariants({
68
+ ios: [boxBase, {background: 'transparent', boxShadow: `inset 0 0 0 1px ${vars.colors.controlNegative}`}],
69
+ rest: [boxBase, {background: 'transparent', boxShadow: `inset 0 0 0 2px ${vars.colors.controlNegative}`}],
70
+ checked: [
71
+ boxBase,
72
+ {background: 'transparent', boxShadow: `inset 0 0 0 12px ${vars.colors.controlActivatedNegative}`},
73
+ ],
74
+ });
75
+
76
+ export const check = style([
77
+ sprinkles({
78
+ display: 'block',
79
+ }),
80
+ {
81
+ transform: 'scale(0, 0)',
82
+ transformOrigin: 'center',
83
+ transition: 'transform 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6)', // https://easings.net/#easeInOutBack
84
+ },
85
+ ]);
86
+
87
+ export const checkChecked = style({
88
+ transform: 'scale(1, 1)',
89
+ });
90
+
91
+ export const disabled = style({
92
+ opacity: 0.5,
93
+ cursor: 'default',
94
+ });
@@ -0,0 +1,192 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import {SPACE} from './utils/keys';
4
+ import {useControlProps} from './form-context';
5
+ import Inline from './inline';
6
+ import {Text3} from './text';
7
+ import {useTheme} from './hooks';
8
+ import classnames from 'classnames';
9
+ import {getPrefixedDataAttributes} from './utils/dom';
10
+ import * as styles from './checkbox.css';
11
+ import {vars} from './skins/skin-contract.css';
12
+ import {combineRefs} from './utils/common';
13
+ import {useThemeVariant} from './theme-variant-context';
14
+
15
+ import type {DataAttributes} from './utils/types';
16
+
17
+ const IconCheckbox = ({isChecked, disabled}: {isChecked: boolean; disabled?: boolean}) => {
18
+ const {isIos} = useTheme();
19
+ const externalVariant = useThemeVariant();
20
+ const kind = isChecked ? 'checked' : isIos ? 'ios' : 'rest';
21
+
22
+ const knobColor = {
23
+ default: vars.colors.inverse,
24
+ alternative: vars.colors.inverse,
25
+ brand: vars.colors.controlKnobBrand,
26
+ media: vars.colors.controlKnobBrand,
27
+ negative: vars.colors.controlKnobNegative,
28
+ }[externalVariant];
29
+
30
+ const icon = isIos ? (
31
+ <svg
32
+ viewBox="0 0 10 8"
33
+ width="10"
34
+ height="8"
35
+ className={classnames(styles.check, {[styles.checkChecked]: isChecked})}
36
+ >
37
+ <path
38
+ d="M2.659 7.724c.33.366.92.368 1.254.005L9.79 1.336A.782.782 0 009.719.202a.858.858 0 00-1.178.069l-5.236 5.72-1.841-2.038a.857.857 0 00-1.177-.078.782.782 0 00-.082 1.133l2.454 2.716z"
39
+ fill={knobColor}
40
+ />
41
+ </svg>
42
+ ) : (
43
+ <svg
44
+ viewBox="0 0 14 10"
45
+ width="14"
46
+ height="10"
47
+ className={classnames(styles.check, {[styles.checkChecked]: isChecked})}
48
+ >
49
+ <path d="M5 10L0 5.192l1.4-1.346L5 7.308 12.6 0 14 1.346z" fill={knobColor} />
50
+ </svg>
51
+ );
52
+
53
+ return (
54
+ <div
55
+ className={classnames(
56
+ externalVariant === 'brand' || externalVariant === 'media'
57
+ ? styles.overBrandBoxVariant[kind]
58
+ : externalVariant === 'negative'
59
+ ? styles.overNegativeBoxVariant[kind]
60
+ : styles.boxVariant[kind],
61
+ {
62
+ [styles.disabled]: disabled,
63
+ }
64
+ )}
65
+ >
66
+ {icon}
67
+ </div>
68
+ );
69
+ };
70
+
71
+ type RenderProps = {
72
+ name: string;
73
+ defaultChecked?: boolean;
74
+ checked?: boolean;
75
+ onChange?: (value: boolean) => void;
76
+ id?: string;
77
+ render?: (renderProps: {
78
+ controlElement: React.ReactElement;
79
+ labelId: string;
80
+ disabled: boolean;
81
+ checked: boolean;
82
+ }) => React.ReactElement;
83
+ children?: undefined;
84
+ disabled?: boolean;
85
+ 'aria-labelledby'?: string;
86
+ 'aria-label'?: string;
87
+ role?: 'checkbox' | 'menuitemcheckbox';
88
+ dataAttributes?: DataAttributes;
89
+ };
90
+
91
+ type ChildrenProps = {
92
+ name: string;
93
+ defaultChecked?: boolean;
94
+ checked?: boolean;
95
+ onChange?: (value: boolean) => void;
96
+ id?: string;
97
+ render?: undefined;
98
+ children: React.ReactNode;
99
+ disabled?: boolean;
100
+ 'aria-label'?: string;
101
+ 'aria-labelledby'?: string;
102
+ role?: 'checkbox' | 'menuitemcheckbox';
103
+ dataAttributes?: DataAttributes;
104
+ };
105
+
106
+ const Checkbox = React.forwardRef<HTMLDivElement, RenderProps | ChildrenProps>((props, ref) => {
107
+ const reactId = React.useId();
108
+ const labelId = props['aria-labelledby'] || reactId;
109
+ const ariaLabel = props['aria-label'];
110
+ const hasExternalLabel = ariaLabel || props['aria-labelledby'];
111
+
112
+ const {defaultValue, value, onChange, focusableRef, disabled} = useControlProps({
113
+ name: props.name,
114
+ value: props.checked,
115
+ defaultValue: props.defaultChecked,
116
+ onChange: props.onChange,
117
+ disabled: props.disabled,
118
+ });
119
+
120
+ const [checkedState, setCheckedState] = React.useState(!!defaultValue);
121
+
122
+ const handleChange = () => {
123
+ if (value === undefined) {
124
+ setCheckedState(!checkedState);
125
+ onChange(!checkedState);
126
+ } else {
127
+ onChange(!value);
128
+ }
129
+ };
130
+
131
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
132
+ if (event.key === SPACE) {
133
+ event.preventDefault();
134
+ event.stopPropagation();
135
+ handleChange();
136
+ }
137
+ };
138
+
139
+ const iconCheckbox = <IconCheckbox disabled={disabled} isChecked={value ?? checkedState} />;
140
+
141
+ return (
142
+ // When the checkbox is disabled, it shouldn't be focusable
143
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
144
+ <div
145
+ id={props.id}
146
+ role={props.role || 'checkbox'}
147
+ aria-checked={value ?? checkedState}
148
+ onKeyDown={disabled ? undefined : handleKeyDown}
149
+ onClick={(e) => {
150
+ e.stopPropagation();
151
+ if (!disabled) {
152
+ handleChange();
153
+ }
154
+ }}
155
+ tabIndex={disabled ? undefined : 0}
156
+ ref={combineRefs(ref, focusableRef)}
157
+ className={disabled ? styles.checkboxContainerDisabled : styles.checkboxContainer}
158
+ aria-label={ariaLabel}
159
+ aria-labelledby={ariaLabel ? undefined : labelId}
160
+ aria-disabled={disabled}
161
+ {...getPrefixedDataAttributes(props.dataAttributes, 'Checkbox')}
162
+ >
163
+ {props.render ? (
164
+ props.render({
165
+ controlElement: iconCheckbox,
166
+ labelId,
167
+ checked: value ?? checkedState,
168
+ disabled: !!disabled,
169
+ })
170
+ ) : (
171
+ <Inline space={8}>
172
+ {/* Text3 wrapper added to have the same line-height and center checkbox with text and -2px to perfect pixel center icon */}
173
+ <Text3 regular as="div">
174
+ <div style={{position: 'relative', top: -2}}>{iconCheckbox}</div>
175
+ </Text3>
176
+ {props.children && (
177
+ <Text3
178
+ regular
179
+ as="div"
180
+ id={labelId}
181
+ role={hasExternalLabel ? 'presentation' : undefined}
182
+ >
183
+ <span className={disabled ? styles.disabled : ''}>{props.children}</span>
184
+ </Text3>
185
+ )}
186
+ </Inline>
187
+ )}
188
+ </div>
189
+ );
190
+ });
191
+
192
+ export default Checkbox;
@@ -0,0 +1,204 @@
1
+ import {createVar, style, styleVariants} from '@vanilla-extract/css';
2
+ import * as mq from './media-queries.css';
3
+ import {vars} from './skins/skin-contract.css';
4
+ import {sprinkles} from './sprinkles.css';
5
+
6
+ export const chipWrapper = sprinkles({
7
+ display: 'inline-flex',
8
+ justifyContent: 'center',
9
+ alignItems: 'center',
10
+ });
11
+
12
+ export const wrappedContent = sprinkles({
13
+ display: 'flex',
14
+ flex: 1,
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ });
18
+
19
+ const minButtonArea = {
20
+ pointer: '48px',
21
+ touchable: '48px',
22
+ };
23
+
24
+ const interactiveAreaSize = createVar();
25
+
26
+ export const minimumInteractiveArea = style({
27
+ vars: {
28
+ [interactiveAreaSize]: minButtonArea.pointer,
29
+ },
30
+ '@media': {
31
+ [mq.touchableOnly]: {
32
+ vars: {
33
+ [interactiveAreaSize]: minButtonArea.touchable,
34
+ },
35
+ },
36
+ },
37
+
38
+ position: 'relative',
39
+ '::after': {
40
+ content: '',
41
+ position: 'absolute',
42
+ /**
43
+ * min() is not supported in old browsers (https://caniuse.com/css-math-functions).
44
+ * We don't force the minimum touchable area in that case.
45
+ */
46
+ top: [0, `min(0px, calc((100% - ${interactiveAreaSize}) / 2))`],
47
+ bottom: [0, `min(0px, calc((100% - ${interactiveAreaSize}) / 2))`],
48
+ left: [0, `min(0px, calc((100% - ${interactiveAreaSize}) / 2))`],
49
+ right: [0, `min(0px, calc((100% - ${interactiveAreaSize}) / 2))`],
50
+ },
51
+ });
52
+
53
+ const containerBase = style([
54
+ sprinkles({
55
+ border: 'regular',
56
+ minHeight: 40,
57
+ minWidth: 72,
58
+ }),
59
+ {
60
+ borderRadius: vars.borderRadii.chip,
61
+ verticalAlign: 'middle',
62
+ cursor: 'default',
63
+ borderColor: vars.colors.control,
64
+ },
65
+ ]);
66
+
67
+ export const containerSmall = style({
68
+ minHeight: 32,
69
+ minWidth: 56,
70
+ });
71
+
72
+ const chipActive = style({});
73
+
74
+ export const chipVariants = styleVariants({
75
+ default: [
76
+ containerBase,
77
+ sprinkles({
78
+ background: vars.colors.backgroundContainer,
79
+ color: vars.colors.textPrimary,
80
+ }),
81
+ ],
82
+ overAlternative: [
83
+ containerBase,
84
+ sprinkles({
85
+ background: vars.colors.backgroundContainerAlternative,
86
+ color: vars.colors.textPrimary,
87
+ }),
88
+ ],
89
+ active: [
90
+ chipActive,
91
+ containerBase,
92
+ sprinkles({
93
+ color: vars.colors.textActivated,
94
+ background: vars.colors.brandLow,
95
+ }),
96
+ {
97
+ borderColor: vars.colors.controlActivated,
98
+ cursor: 'pointer',
99
+ },
100
+ ],
101
+ navigationActive: [
102
+ chipActive,
103
+ containerBase,
104
+ sprinkles({
105
+ color: vars.colors.textButtonPrimary,
106
+ background: vars.colors.buttonPrimaryBackground,
107
+ }),
108
+ {
109
+ borderColor: vars.colors.buttonPrimaryBackground,
110
+ cursor: 'pointer',
111
+ },
112
+ ],
113
+ navigationActiveOverBrand: [
114
+ containerBase,
115
+ sprinkles({
116
+ color: vars.colors.textActivated,
117
+ background: vars.colors.brandLow,
118
+ }),
119
+ {
120
+ borderColor: vars.colors.controlActivated,
121
+ cursor: 'pointer',
122
+ },
123
+ ],
124
+ });
125
+
126
+ export const interactive = style({
127
+ position: 'relative',
128
+ userSelect: 'none',
129
+ cursor: 'pointer',
130
+ });
131
+
132
+ export const button = style({
133
+ border: 'none',
134
+ background: 'transparent',
135
+ padding: 0,
136
+ });
137
+
138
+ export const interactiveChipOverlay = style([
139
+ sprinkles({
140
+ left: 0,
141
+ right: 0,
142
+ top: 0,
143
+ bottom: 0,
144
+ position: 'absolute',
145
+ }),
146
+ {
147
+ backgroundColor: 'transparent',
148
+ transition: 'background-color 0.1s ease-in-out',
149
+ borderRadius: vars.borderRadii.chip,
150
+ selectors: {
151
+ [`${interactive}:active &`]: {
152
+ backgroundColor: vars.colors.backgroundContainerPressed,
153
+ },
154
+ },
155
+ '@media': {
156
+ [mq.supportsHover]: {
157
+ selectors: {
158
+ [`${interactive}:hover &`]: {
159
+ backgroundColor: vars.colors.backgroundContainerHover,
160
+ },
161
+ [`${interactive}:active &`]: {
162
+ backgroundColor: vars.colors.backgroundContainerPressed,
163
+ },
164
+ },
165
+ },
166
+ [mq.touchableOnly]: {
167
+ transition: 'none',
168
+ },
169
+ },
170
+ },
171
+ ]);
172
+
173
+ export const icon = style([
174
+ sprinkles({paddingRight: 4}),
175
+ {color: vars.colors.neutralMedium, paddingRight: 4},
176
+ ]);
177
+ export const iconNavigation = style([
178
+ sprinkles({paddingRight: 4}),
179
+ {color: vars.colors.textPrimaryBrand, paddingRight: 4},
180
+ ]);
181
+
182
+ export const iconNavigationOverBrand = style([
183
+ sprinkles({paddingRight: 4}),
184
+ {color: vars.colors.controlActivated, paddingRight: 4},
185
+ ]);
186
+
187
+ export const iconActive = style([
188
+ sprinkles({paddingRight: 4}),
189
+ {color: vars.colors.controlActivated, paddingRight: 4},
190
+ ]);
191
+
192
+ export const leftPadding = styleVariants({
193
+ default: [sprinkles({paddingLeft: 20})],
194
+ small: [sprinkles({paddingLeft: 12})],
195
+ withIcon: [sprinkles({paddingLeft: 16})],
196
+ withIconSmall: [sprinkles({paddingLeft: 8})],
197
+ });
198
+
199
+ export const rightPadding = styleVariants({
200
+ default: [sprinkles({paddingRight: 20})],
201
+ small: [sprinkles({paddingRight: 12})],
202
+ withIcon: [sprinkles({paddingRight: 16})],
203
+ withIconSmall: [sprinkles({paddingRight: 8})],
204
+ });
package/src/chip.tsx ADDED
@@ -0,0 +1,191 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import classnames from 'classnames';
4
+ import {useTheme} from './hooks';
5
+ import Badge from './badge';
6
+ import Box from './box';
7
+ import Text, {getTextSizesWithWeight} from './text';
8
+ import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
9
+ import {pxToRem} from './utils/css';
10
+ import * as styles from './chip.css';
11
+ import {vars} from './skins/skin-contract.css';
12
+ import {useThemeVariant} from './theme-variant-context';
13
+ import Touchable, {BaseTouchable} from './touchable';
14
+ import * as tokens from './text-tokens';
15
+ import {getPrefixedDataAttributes} from './utils/dom';
16
+
17
+ import type {TouchableComponentProps} from './touchable';
18
+ import type {ExclusifyUnion} from './utils/utility-types';
19
+ import type {DataAttributes, IconProps} from './utils/types';
20
+
21
+ interface SimpleChipProps {
22
+ children: string;
23
+ Icon?: (props: IconProps) => JSX.Element;
24
+ id?: string;
25
+ dataAttributes?: DataAttributes;
26
+ badge?: boolean | number;
27
+ small?: boolean;
28
+ }
29
+
30
+ interface ClosableChipProps extends SimpleChipProps {
31
+ onClose: () => void;
32
+ closeButtonLabel?: string;
33
+ }
34
+
35
+ interface ToggleChipProps extends SimpleChipProps {
36
+ active: boolean;
37
+ }
38
+
39
+ interface ToggleChipProps extends SimpleChipProps {
40
+ active: boolean;
41
+ }
42
+
43
+ type ClickableChipProps = TouchableComponentProps<SimpleChipProps & {active?: boolean}>;
44
+
45
+ type ChipProps = ExclusifyUnion<ClosableChipProps | ToggleChipProps | ClickableChipProps>;
46
+
47
+ const Chip = (props: ChipProps): JSX.Element => {
48
+ const {Icon, children, id, dataAttributes, badge, active, onClose, closeButtonLabel} = props;
49
+ const {texts, textPresets, t} = useTheme();
50
+ const themeVariant = useThemeVariant();
51
+ const isOverAlternative = themeVariant === 'alternative';
52
+ const isOverBrand = themeVariant === 'brand' || themeVariant === 'media' || themeVariant === 'negative';
53
+
54
+ const isTouchable = props.href || props.onPress || props.to;
55
+ const isInteractive = active !== undefined || isTouchable;
56
+
57
+ const body = (
58
+ <>
59
+ {Icon && (
60
+ <div
61
+ className={
62
+ active
63
+ ? isTouchable
64
+ ? isOverBrand
65
+ ? styles.iconNavigationOverBrand
66
+ : styles.iconNavigation
67
+ : styles.iconActive
68
+ : styles.icon
69
+ }
70
+ >
71
+ <Icon color="currentColor" size={pxToRem(16)} />
72
+ </div>
73
+ )}
74
+ <Box paddingRight={badge ? 8 : 0 || onClose ? 4 : 0}>
75
+ <Text
76
+ id={id}
77
+ {...getTextSizesWithWeight({textPreset: textPresets.chipLabel})}
78
+ truncate={1}
79
+ color="currentColor"
80
+ >
81
+ {children}
82
+ </Text>
83
+ </Box>
84
+ </>
85
+ );
86
+
87
+ const chipDataAttributes = {'component-name': 'Chip', testid: 'Chip', ...dataAttributes};
88
+
89
+ if (onClose) {
90
+ return (
91
+ <div
92
+ className={classnames(
93
+ isOverAlternative ? styles.chipVariants.overAlternative : styles.chipVariants.default,
94
+ styles.chipWrapper,
95
+ Icon
96
+ ? props.small
97
+ ? styles.leftPadding.withIconSmall
98
+ : styles.leftPadding.withIcon
99
+ : props.small
100
+ ? styles.leftPadding.small
101
+ : styles.leftPadding.default,
102
+ props.small ? styles.rightPadding.withIconSmall : styles.rightPadding.withIcon,
103
+ {[styles.containerSmall]: props.small}
104
+ )}
105
+ {...getPrefixedDataAttributes(chipDataAttributes)}
106
+ >
107
+ {body}
108
+ <Touchable
109
+ style={{
110
+ display: 'flex',
111
+ justifyContent: 'center',
112
+ alignItems: 'center',
113
+ width: pxToRem(24),
114
+ height: pxToRem(24),
115
+ }}
116
+ aria-label={closeButtonLabel || texts.closeButtonLabel || t(tokens.closeButtonLabel)}
117
+ onPress={() => onClose()}
118
+ >
119
+ <IconCloseRegular size={pxToRem(16)} color={vars.colors.neutralMedium} />
120
+ </Touchable>
121
+ </div>
122
+ );
123
+ }
124
+
125
+ const renderBadge = () => {
126
+ if (!badge) {
127
+ return null;
128
+ }
129
+ return badge === true ? <Badge /> : <Badge value={badge} />;
130
+ };
131
+
132
+ const renderContent = (dataAttributes?: DataAttributes) => (
133
+ <div
134
+ className={classnames(
135
+ isTouchable ? styles.minimumInteractiveArea : undefined,
136
+ styles.chipVariants[
137
+ active
138
+ ? isTouchable
139
+ ? isOverBrand
140
+ ? 'navigationActiveOverBrand'
141
+ : 'navigationActive'
142
+ : 'active'
143
+ : isOverAlternative
144
+ ? 'overAlternative'
145
+ : 'default'
146
+ ],
147
+
148
+ isTouchable ? styles.wrappedContent : styles.chipWrapper,
149
+ {
150
+ [styles.interactive]: isInteractive,
151
+ [styles.containerSmall]: props.small,
152
+ },
153
+ Icon
154
+ ? props.small
155
+ ? styles.leftPadding.withIconSmall
156
+ : styles.leftPadding.withIcon
157
+ : props.small
158
+ ? styles.leftPadding.small
159
+ : styles.leftPadding.default,
160
+ badge
161
+ ? props.small
162
+ ? styles.rightPadding.withIconSmall
163
+ : styles.rightPadding.withIcon
164
+ : props.small
165
+ ? styles.rightPadding.small
166
+ : styles.rightPadding.default
167
+ )}
168
+ {...getPrefixedDataAttributes(dataAttributes)}
169
+ >
170
+ {isInteractive && <div className={styles.interactiveChipOverlay} />}
171
+ {body}
172
+ {renderBadge()}
173
+ </div>
174
+ );
175
+
176
+ if (isTouchable) {
177
+ return (
178
+ <BaseTouchable
179
+ {...props}
180
+ className={classnames(styles.chipWrapper, styles.button)}
181
+ dataAttributes={chipDataAttributes}
182
+ >
183
+ {renderContent()}
184
+ </BaseTouchable>
185
+ );
186
+ }
187
+
188
+ return renderContent(chipDataAttributes);
189
+ };
190
+
191
+ export default Chip;
@@ -0,0 +1,14 @@
1
+ import {style} from '@vanilla-extract/css';
2
+ import {sprinkles} from './sprinkles.css';
3
+
4
+ export const circle = style([
5
+ {
6
+ boxSizing: 'border-box',
7
+ },
8
+ sprinkles({
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ borderRadius: '50%',
13
+ }),
14
+ ]);