@telefonica/mistica 16.60.0 → 16.62.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 (548) 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-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 +10 -10
  12. package/dist/button-layout.css-mistica.js +21 -21
  13. package/dist/button.css-mistica.js +51 -51
  14. package/dist/callout.css-mistica.js +16 -16
  15. package/dist/card-internal.css-mistica.js +38 -38
  16. package/dist/carousel.css-mistica.js +18 -18
  17. package/dist/checkbox.css-mistica.js +21 -21
  18. package/dist/chip.css-mistica.js +30 -30
  19. package/dist/circle.css-mistica.js +2 -2
  20. package/dist/community/advanced-data-card.css-mistica.js +26 -26
  21. package/dist/community/blocks.css-mistica.js +3 -3
  22. package/dist/community/example-component.css-mistica.js +2 -2
  23. package/dist/counter.css-mistica.js +12 -12
  24. package/dist/cover-hero.css-mistica.js +16 -16
  25. package/dist/credit-card-number-field.css-mistica.js +6 -6
  26. package/dist/date-field.css-mistica.js +1 -1
  27. package/dist/date-time-picker.css-mistica.js +2 -2
  28. package/dist/dialog.css-mistica.js +15 -15
  29. package/dist/divider.css-mistica.js +5 -5
  30. package/dist/double-field.css-mistica.js +4 -4
  31. package/dist/drawer.css-mistica.js +15 -15
  32. package/dist/empty-state-card.css-mistica.js +4 -4
  33. package/dist/empty-state.css-mistica.js +14 -14
  34. package/dist/fade-in.css-mistica.js +1 -1
  35. package/dist/feedback.css-mistica.js +14 -14
  36. package/dist/file-upload.css-mistica.js +14 -14
  37. package/dist/fixed-footer-layout.css-mistica.js +12 -12
  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 +2 -2
  41. package/dist/grid-layout.css-mistica.js +9 -9
  42. package/dist/grid.css-mistica.js +147 -147
  43. package/dist/header.css-mistica.js +5 -5
  44. package/dist/hero.css-mistica.js +11 -11
  45. package/dist/horizontal-scroll.css-mistica.js +3 -3
  46. package/dist/icon-button.css-mistica.js +66 -66
  47. package/dist/icons/icon-chevron.css-mistica.js +6 -6
  48. package/dist/icons/icon-error.css-mistica.js +3 -3
  49. package/dist/image.css-mistica.js +11 -11
  50. package/dist/image.js +8 -1
  51. package/dist/inline.css-mistica.js +16 -16
  52. package/dist/list.css-mistica.js +15 -15
  53. package/dist/loading-bar.css-mistica.js +5 -5
  54. package/dist/loading-screen.css-mistica.js +15 -15
  55. package/dist/logo.css-mistica.js +9 -9
  56. package/dist/menu.css-mistica.js +24 -24
  57. package/dist/mosaic.css-mistica.js +3 -3
  58. package/dist/navigation-bar.css-mistica.js +45 -45
  59. package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
  60. package/dist/package-version.js +2 -2
  61. package/dist/pin-field.css-mistica.js +10 -10
  62. package/dist/popover.css-mistica.js +2 -2
  63. package/dist/progress-bar.css-mistica.js +12 -12
  64. package/dist/radio-button.css-mistica.js +33 -33
  65. package/dist/rating.css-mistica.js +12 -12
  66. package/dist/responsive-layout.css-mistica.js +20 -20
  67. package/dist/screen-reader-only.css-mistica.js +2 -2
  68. package/dist/select.css-mistica.js +29 -29
  69. package/dist/sheet-action-row.css-mistica.js +2 -2
  70. package/dist/sheet-common.css-mistica.js +16 -16
  71. package/dist/sheet-info.css-mistica.js +4 -4
  72. package/dist/skeletons.css-mistica.js +12 -12
  73. package/dist/skins/skin-contract.css-mistica.js +686 -686
  74. package/dist/skip-link.css-mistica.js +3 -3
  75. package/dist/slider.css-mistica.js +28 -28
  76. package/dist/snackbar.css-mistica.js +16 -16
  77. package/dist/spinner.css-mistica.js +5 -5
  78. package/dist/square.css-mistica.js +2 -2
  79. package/dist/stack.css-mistica.js +9 -9
  80. package/dist/stacking-group.css-mistica.js +2 -2
  81. package/dist/stepper.css-mistica.js +16 -16
  82. package/dist/switch-component.css-mistica.js +53 -53
  83. package/dist/table.css-mistica.js +24 -24
  84. package/dist/tabs.css-mistica.js +30 -30
  85. package/dist/tag.css-mistica.js +5 -5
  86. package/dist/text-field-base.css-mistica.js +30 -30
  87. package/dist/text-field-components.css-mistica.js +19 -19
  88. package/dist/text-link.css-mistica.js +10 -10
  89. package/dist/text.css-mistica.js +13 -13
  90. package/dist/theme-context.css-mistica.js +2 -2
  91. package/dist/timeline.css-mistica.js +18 -18
  92. package/dist/timer.css-mistica.js +13 -13
  93. package/dist/tooltip.css-mistica.js +12 -12
  94. package/dist/touchable.css-mistica.js +5 -5
  95. package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
  96. package/dist/video.css-mistica.js +2 -2
  97. package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
  98. package/dist-es/accordion.css-mistica.js +7 -7
  99. package/dist-es/align.css-mistica.js +2 -2
  100. package/dist-es/autocomplete.css-mistica.js +2 -2
  101. package/dist-es/avatar.css-mistica.js +2 -2
  102. package/dist-es/badge.css-mistica.js +2 -2
  103. package/dist-es/box.css-mistica.js +15 -15
  104. package/dist-es/boxed.css-mistica.js +25 -25
  105. package/dist-es/button-fixed-footer-layout.js +12 -11
  106. package/dist-es/button-group.css-mistica.js +2 -2
  107. package/dist-es/button-layout.css-mistica.js +16 -16
  108. package/dist-es/button.css-mistica.js +38 -38
  109. package/dist-es/callout.css-mistica.js +12 -12
  110. package/dist-es/card-internal.css-mistica.js +20 -20
  111. package/dist-es/carousel.css-mistica.js +10 -10
  112. package/dist-es/checkbox.css-mistica.js +14 -14
  113. package/dist-es/chip.css-mistica.js +17 -17
  114. package/dist-es/circle.css-mistica.js +2 -2
  115. package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
  116. package/dist-es/community/blocks.css-mistica.js +2 -2
  117. package/dist-es/community/example-component.css-mistica.js +2 -2
  118. package/dist-es/counter.css-mistica.js +2 -2
  119. package/dist-es/cover-hero.css-mistica.js +4 -4
  120. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  121. package/dist-es/date-field.css-mistica.js +1 -1
  122. package/dist-es/date-time-picker.css-mistica.js +2 -2
  123. package/dist-es/dialog.css-mistica.js +5 -5
  124. package/dist-es/divider.css-mistica.js +5 -5
  125. package/dist-es/double-field.css-mistica.js +4 -4
  126. package/dist-es/drawer.css-mistica.js +2 -2
  127. package/dist-es/empty-state-card.css-mistica.js +2 -2
  128. package/dist-es/empty-state.css-mistica.js +7 -7
  129. package/dist-es/fade-in.css-mistica.js +1 -1
  130. package/dist-es/feedback.css-mistica.js +2 -2
  131. package/dist-es/file-upload.css-mistica.js +8 -8
  132. package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
  133. package/dist-es/fixed-footer-layout.js +57 -56
  134. package/dist-es/form.css-mistica.js +2 -2
  135. package/dist-es/grid-layout.css-mistica.js +4 -4
  136. package/dist-es/grid.css-mistica.js +127 -127
  137. package/dist-es/header.css-mistica.js +2 -2
  138. package/dist-es/hero.css-mistica.js +4 -4
  139. package/dist-es/horizontal-scroll.css-mistica.js +2 -2
  140. package/dist-es/icon-button.css-mistica.js +56 -56
  141. package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
  142. package/dist-es/icons/icon-error.css-mistica.js +2 -2
  143. package/dist-es/image.css-mistica.js +4 -4
  144. package/dist-es/image.js +8 -1
  145. package/dist-es/inline.css-mistica.js +10 -10
  146. package/dist-es/list.css-mistica.js +2 -2
  147. package/dist-es/loading-bar.css-mistica.js +2 -2
  148. package/dist-es/loading-screen.css-mistica.js +5 -5
  149. package/dist-es/logo.css-mistica.js +7 -7
  150. package/dist-es/menu.css-mistica.js +15 -15
  151. package/dist-es/mosaic.css-mistica.js +2 -2
  152. package/dist-es/navigation-bar.css-mistica.js +20 -20
  153. package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
  154. package/dist-es/package-version.js +2 -2
  155. package/dist-es/pin-field.css-mistica.js +2 -2
  156. package/dist-es/popover.css-mistica.js +2 -2
  157. package/dist-es/progress-bar.css-mistica.js +8 -8
  158. package/dist-es/radio-button.css-mistica.js +25 -25
  159. package/dist-es/rating.css-mistica.js +4 -4
  160. package/dist-es/responsive-layout.css-mistica.js +7 -7
  161. package/dist-es/screen-reader-only.css-mistica.js +2 -2
  162. package/dist-es/select.css-mistica.js +20 -20
  163. package/dist-es/sheet-action-row.css-mistica.js +2 -2
  164. package/dist-es/sheet-common.css-mistica.js +2 -2
  165. package/dist-es/sheet-info.css-mistica.js +2 -2
  166. package/dist-es/skeletons.css-mistica.js +8 -8
  167. package/dist-es/skins/skin-contract.css-mistica.js +686 -686
  168. package/dist-es/skip-link.css-mistica.js +2 -2
  169. package/dist-es/slider.css-mistica.js +20 -20
  170. package/dist-es/snackbar.css-mistica.js +5 -5
  171. package/dist-es/spinner.css-mistica.js +2 -2
  172. package/dist-es/square.css-mistica.js +2 -2
  173. package/dist-es/stack.css-mistica.js +7 -7
  174. package/dist-es/stacking-group.css-mistica.js +2 -2
  175. package/dist-es/stepper.css-mistica.js +4 -4
  176. package/dist-es/style.css +1 -1
  177. package/dist-es/switch-component.css-mistica.js +41 -41
  178. package/dist-es/table.css-mistica.js +11 -11
  179. package/dist-es/tabs.css-mistica.js +21 -21
  180. package/dist-es/tag.css-mistica.js +2 -2
  181. package/dist-es/text-field-base.css-mistica.js +17 -17
  182. package/dist-es/text-field-components.css-mistica.js +4 -4
  183. package/dist-es/text-link.css-mistica.js +9 -9
  184. package/dist-es/text.css-mistica.js +8 -8
  185. package/dist-es/theme-context.css-mistica.js +2 -2
  186. package/dist-es/timeline.css-mistica.js +11 -11
  187. package/dist-es/timer.css-mistica.js +7 -7
  188. package/dist-es/tooltip.css-mistica.js +3 -3
  189. package/dist-es/touchable.css-mistica.js +2 -2
  190. package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
  191. package/dist-es/video.css-mistica.js +2 -2
  192. package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
  193. package/doc/components.md +19 -0
  194. package/doc/figma-mcp.md +136 -0
  195. package/doc/layout.md +20 -1
  196. package/doc/llms.md +18 -0
  197. package/doc/patterns.md +6 -17
  198. package/package.json +13 -1
  199. package/src/accordion.css.ts +121 -0
  200. package/src/accordion.tsx +366 -0
  201. package/src/align.css.ts +7 -0
  202. package/src/align.tsx +32 -0
  203. package/src/autocomplete.css.ts +62 -0
  204. package/src/autocomplete.tsx +239 -0
  205. package/src/avatar.css.ts +14 -0
  206. package/src/avatar.tsx +120 -0
  207. package/src/badge.css.ts +51 -0
  208. package/src/badge.tsx +79 -0
  209. package/src/box.css.ts +51 -0
  210. package/src/box.tsx +114 -0
  211. package/src/boxed.css.ts +132 -0
  212. package/src/boxed.tsx +153 -0
  213. package/src/button-fixed-footer-layout.tsx +65 -0
  214. package/src/button-group.css.ts +75 -0
  215. package/src/button-group.tsx +91 -0
  216. package/src/button-layout.css.ts +162 -0
  217. package/src/button-layout.tsx +91 -0
  218. package/src/button.css.ts +758 -0
  219. package/src/button.tsx +632 -0
  220. package/src/callout.css.ts +50 -0
  221. package/src/callout.tsx +147 -0
  222. package/src/card-cover.tsx +242 -0
  223. package/src/card-data.tsx +152 -0
  224. package/src/card-internal.css.ts +271 -0
  225. package/src/card-internal.tsx +1724 -0
  226. package/src/card-media.tsx +157 -0
  227. package/src/card-naked.tsx +63 -0
  228. package/src/carousel.css.ts +522 -0
  229. package/src/carousel.tsx +1300 -0
  230. package/src/checkbox.css.ts +94 -0
  231. package/src/checkbox.tsx +192 -0
  232. package/src/chip.css.ts +204 -0
  233. package/src/chip.tsx +191 -0
  234. package/src/circle.css.ts +14 -0
  235. package/src/circle.tsx +52 -0
  236. 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
  237. 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
  238. 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
  239. 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
  240. 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
  241. 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
  242. 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
  243. 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
  244. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
  245. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
  246. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
  247. 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
  248. package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
  249. 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
  250. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
  251. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
  252. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
  253. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
  254. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
  255. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
  256. package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
  257. package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
  258. package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
  259. package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
  260. package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
  261. package/src/community/__stories__/blocks-story.tsx +272 -0
  262. package/src/community/__stories__/example-component-story.tsx +15 -0
  263. package/src/community/__stories__/index-story.tsx +154 -0
  264. package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
  265. package/src/community/advanced-data-card.css.ts +271 -0
  266. package/src/community/advanced-data-card.tsx +431 -0
  267. package/src/community/blocks.css.ts +12 -0
  268. package/src/community/blocks.tsx +290 -0
  269. package/src/community/example-component.css.ts +7 -0
  270. package/src/community/example-component.tsx +17 -0
  271. package/src/community/index.tsx +10 -0
  272. package/src/counter.css.ts +150 -0
  273. package/src/counter.tsx +215 -0
  274. package/src/cover-hero-media.tsx +39 -0
  275. package/src/cover-hero.css.ts +133 -0
  276. package/src/cover-hero.tsx +262 -0
  277. package/src/credit-card-expiration-field.tsx +187 -0
  278. package/src/credit-card-fields.tsx +56 -0
  279. package/src/credit-card-number-field.css.ts +47 -0
  280. package/src/credit-card-number-field.tsx +245 -0
  281. package/src/cvv-field.tsx +169 -0
  282. package/src/date-field.css.ts +14 -0
  283. package/src/date-field.tsx +130 -0
  284. package/src/date-time-field.tsx +141 -0
  285. package/src/date-time-picker.css.ts +126 -0
  286. package/src/date-time-picker.tsx +188 -0
  287. package/src/decimal-field.tsx +160 -0
  288. package/src/desktop-container-type-context.tsx +15 -0
  289. package/src/dialog-context.tsx +81 -0
  290. package/src/dialog.css.ts +155 -0
  291. package/src/dialog.tsx +423 -0
  292. package/src/divider.css.ts +10 -0
  293. package/src/divider.tsx +11 -0
  294. package/src/double-field.css.ts +33 -0
  295. package/src/double-field.tsx +71 -0
  296. package/src/drawer.css.ts +123 -0
  297. package/src/drawer.tsx +304 -0
  298. package/src/email-field.tsx +76 -0
  299. package/src/empty-state-card.css.ts +40 -0
  300. package/src/empty-state-card.tsx +92 -0
  301. package/src/empty-state.css.ts +119 -0
  302. package/src/empty-state.tsx +141 -0
  303. package/src/fade-in.css.ts +12 -0
  304. package/src/fade-in.tsx +40 -0
  305. package/src/feedback.css.ts +119 -0
  306. package/src/feedback.tsx +432 -0
  307. package/src/file-upload.css.ts +156 -0
  308. package/src/file-upload.tsx +612 -0
  309. package/src/fixed-footer-layout.css.ts +96 -0
  310. package/src/fixed-footer-layout.tsx +227 -0
  311. package/src/fixed-to-top.tsx +21 -0
  312. package/src/focus-trap.tsx +17 -0
  313. package/src/form-context.tsx +198 -0
  314. package/src/form.css.ts +5 -0
  315. package/src/form.tsx +287 -0
  316. package/src/grid-layout.css.ts +68 -0
  317. package/src/grid-layout.tsx +201 -0
  318. package/src/grid.css.ts +203 -0
  319. package/src/grid.tsx +241 -0
  320. package/src/header.css.ts +30 -0
  321. package/src/header.tsx +319 -0
  322. package/src/hero.css.ts +71 -0
  323. package/src/hero.tsx +318 -0
  324. package/src/hooks.tsx +313 -0
  325. package/src/horizontal-scroll.css.ts +43 -0
  326. package/src/horizontal-scroll.tsx +18 -0
  327. package/src/iban-field.tsx +218 -0
  328. package/src/icon-button.css.ts +561 -0
  329. package/src/icon-button.tsx +221 -0
  330. package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
  331. package/src/icons/icon-amex.tsx +40 -0
  332. package/src/icons/icon-chevron.css.ts +23 -0
  333. package/src/icons/icon-chevron.tsx +150 -0
  334. package/src/icons/icon-cvv-amex.tsx +31 -0
  335. package/src/icons/icon-cvv-visa-mc.tsx +31 -0
  336. package/src/icons/icon-error.css.ts +27 -0
  337. package/src/icons/icon-error.tsx +207 -0
  338. package/src/icons/icon-info.tsx +86 -0
  339. package/src/icons/icon-mastercard.tsx +36 -0
  340. package/src/icons/icon-success-vivo-new.tsx +51 -0
  341. package/src/icons/icon-success-vivo.tsx +36 -0
  342. package/src/icons/icon-success.tsx +211 -0
  343. package/src/icons/icon-visa.tsx +32 -0
  344. package/src/image.css.ts +48 -0
  345. package/src/image.tsx +352 -0
  346. package/src/index.tsx +2466 -0
  347. package/src/inline.css.ts +131 -0
  348. package/src/inline.tsx +135 -0
  349. package/src/integer-field.tsx +93 -0
  350. package/src/list.css.ts +281 -0
  351. package/src/list.tsx +963 -0
  352. package/src/loading-bar.css.ts +69 -0
  353. package/src/loading-bar.tsx +25 -0
  354. package/src/loading-screen.css.ts +114 -0
  355. package/src/loading-screen.tsx +376 -0
  356. package/src/logo-blau-shell.tsx +30 -0
  357. package/src/logo-blau.tsx +60 -0
  358. package/src/logo-common.tsx +29 -0
  359. package/src/logo-esimflag-shell.tsx +30 -0
  360. package/src/logo-esimflag.tsx +56 -0
  361. package/src/logo-movistar-new-shell.tsx +30 -0
  362. package/src/logo-movistar-new.tsx +85 -0
  363. package/src/logo-movistar-shell.tsx +30 -0
  364. package/src/logo-movistar.tsx +63 -0
  365. package/src/logo-o2-new-shell.tsx +26 -0
  366. package/src/logo-o2-new.tsx +27 -0
  367. package/src/logo-o2-shell.tsx +26 -0
  368. package/src/logo-o2.tsx +27 -0
  369. package/src/logo-telefonica-shell.tsx +30 -0
  370. package/src/logo-telefonica.tsx +95 -0
  371. package/src/logo-tu-shell.tsx +26 -0
  372. package/src/logo-tu.tsx +28 -0
  373. package/src/logo-vivo-shell.tsx +30 -0
  374. package/src/logo-vivo.tsx +53 -0
  375. package/src/logo.css.ts +33 -0
  376. package/src/logo.tsx +313 -0
  377. package/src/master-detail-layout.tsx +28 -0
  378. package/src/maybe-dismissable.css.ts +37 -0
  379. package/src/maybe-dismissable.tsx +58 -0
  380. package/src/media-queries.css.ts +67 -0
  381. package/src/menu.css.ts +132 -0
  382. package/src/menu.tsx +468 -0
  383. package/src/meter.tsx +516 -0
  384. package/src/modal-context-provider.tsx +45 -0
  385. package/src/month-field.tsx +124 -0
  386. package/src/mosaic.css.ts +73 -0
  387. package/src/mosaic.tsx +205 -0
  388. package/src/navigation-bar.css.ts +558 -0
  389. package/src/navigation-bar.tsx +1637 -0
  390. package/src/navigation-breadcrumbs.css.ts +22 -0
  391. package/src/navigation-breadcrumbs.tsx +69 -0
  392. package/src/negative-box.tsx +15 -0
  393. package/src/nestable-context.tsx +139 -0
  394. package/src/overlay.tsx +86 -0
  395. package/src/overscroll-color-context.tsx +141 -0
  396. package/src/package-version.tsx +2 -0
  397. package/src/password-field.tsx +126 -0
  398. package/src/phone-number-field-lite.tsx +265 -0
  399. package/src/phone-number-field.tsx +171 -0
  400. package/src/pin-field.css.ts +90 -0
  401. package/src/pin-field.tsx +346 -0
  402. package/src/placeholder.tsx +41 -0
  403. package/src/popover.css.ts +8 -0
  404. package/src/popover.tsx +85 -0
  405. package/src/portal.tsx +43 -0
  406. package/src/progress-bar.css.ts +61 -0
  407. package/src/progress-bar.tsx +174 -0
  408. package/src/radio-button.css.ts +174 -0
  409. package/src/radio-button.tsx +322 -0
  410. package/src/rating.css.ts +128 -0
  411. package/src/rating.tsx +351 -0
  412. package/src/responsive-layout.css.ts +162 -0
  413. package/src/responsive-layout.tsx +106 -0
  414. package/src/screen-reader-only.css.ts +27 -0
  415. package/src/screen-reader-only.tsx +33 -0
  416. package/src/screen-size-context-provider.tsx +96 -0
  417. package/src/screen-size-context.tsx +23 -0
  418. package/src/search-field.tsx +126 -0
  419. package/src/select.css.ts +226 -0
  420. package/src/select.tsx +513 -0
  421. package/src/sheet-action-row.css.ts +33 -0
  422. package/src/sheet-actions-list.tsx +113 -0
  423. package/src/sheet-actions.tsx +95 -0
  424. package/src/sheet-common.css.ts +254 -0
  425. package/src/sheet-common.tsx +402 -0
  426. package/src/sheet-info.css.ts +19 -0
  427. package/src/sheet-info.tsx +127 -0
  428. package/src/sheet-native.tsx +189 -0
  429. package/src/sheet-radio-list.tsx +118 -0
  430. package/src/sheet-root.tsx +127 -0
  431. package/src/sheet-types.tsx +94 -0
  432. package/src/sheet-web.tsx +140 -0
  433. package/src/skeleton-base.tsx +38 -0
  434. package/src/skeletons.css.ts +56 -0
  435. package/src/skeletons.tsx +133 -0
  436. package/src/skins/blau.tsx +724 -0
  437. package/src/skins/constants.tsx +10 -0
  438. package/src/skins/defaults.tsx +104 -0
  439. package/src/skins/esimflag.tsx +728 -0
  440. package/src/skins/movistar-new.tsx +735 -0
  441. package/src/skins/movistar.tsx +740 -0
  442. package/src/skins/o2-new.tsx +731 -0
  443. package/src/skins/o2.tsx +727 -0
  444. package/src/skins/skin-contract.css.ts +380 -0
  445. package/src/skins/telefonica.tsx +768 -0
  446. package/src/skins/tu.tsx +741 -0
  447. package/src/skins/types/colors.tsx +286 -0
  448. package/src/skins/types/index.tsx +153 -0
  449. package/src/skins/utils.tsx +66 -0
  450. package/src/skins/vivo-new.tsx +745 -0
  451. package/src/skins/vivo.tsx +720 -0
  452. package/src/skip-link.css.ts +34 -0
  453. package/src/skip-link.tsx +52 -0
  454. package/src/slider.css.ts +181 -0
  455. package/src/slider.tsx +384 -0
  456. package/src/snackbar-context.tsx +98 -0
  457. package/src/snackbar-native.ts +37 -0
  458. package/src/snackbar.css.ts +176 -0
  459. package/src/snackbar.tsx +258 -0
  460. package/src/spinner.css.ts +66 -0
  461. package/src/spinner.tsx +136 -0
  462. package/src/sprinkles.css.ts +83 -0
  463. package/src/square.css.ts +15 -0
  464. package/src/square.tsx +55 -0
  465. package/src/stack.css.ts +44 -0
  466. package/src/stack.tsx +79 -0
  467. package/src/stacking-group.css.ts +15 -0
  468. package/src/stacking-group.tsx +82 -0
  469. package/src/stepper.css.ts +233 -0
  470. package/src/stepper.tsx +156 -0
  471. package/src/switch-component.css.ts +181 -0
  472. package/src/switch-component.tsx +187 -0
  473. package/src/tab-focus.tsx +68 -0
  474. package/src/table-actions-header.tsx +21 -0
  475. package/src/table-cell-text.tsx +35 -0
  476. package/src/table.css.ts +297 -0
  477. package/src/table.tsx +398 -0
  478. package/src/tabs.css.ts +212 -0
  479. package/src/tabs.tsx +263 -0
  480. package/src/tag.css.ts +42 -0
  481. package/src/tag.tsx +161 -0
  482. package/src/test-utils/environment/setup-ssr.tsx +10 -0
  483. package/src/test-utils/fail-test-on-console-error.tsx +22 -0
  484. package/src/test-utils/index.tsx +341 -0
  485. package/src/test-utils/setup-ssr-test-env.tsx +13 -0
  486. package/src/test-utils/ssr.tsx +197 -0
  487. package/src/text-field-base.css.ts +416 -0
  488. package/src/text-field-base.tsx +628 -0
  489. package/src/text-field-components.css.ts +165 -0
  490. package/src/text-field-components.tsx +230 -0
  491. package/src/text-field.tsx +118 -0
  492. package/src/text-link.css.ts +83 -0
  493. package/src/text-link.tsx +85 -0
  494. package/src/text-tokens.tsx +708 -0
  495. package/src/text.css.ts +60 -0
  496. package/src/text.tsx +516 -0
  497. package/src/theme-context-provider.tsx +370 -0
  498. package/src/theme-context.css.ts +3 -0
  499. package/src/theme-context.tsx +8 -0
  500. package/src/theme-variant-context.tsx +51 -0
  501. package/src/theme.tsx +184 -0
  502. package/src/time-field.tsx +99 -0
  503. package/src/timeline.css.ts +135 -0
  504. package/src/timeline.tsx +250 -0
  505. package/src/timer.css.ts +99 -0
  506. package/src/timer.tsx +420 -0
  507. package/src/title.tsx +119 -0
  508. package/src/tooltip-context-provider.tsx +57 -0
  509. package/src/tooltip.css.ts +106 -0
  510. package/src/tooltip.tsx +649 -0
  511. package/src/touchable.css.ts +56 -0
  512. package/src/touchable.tsx +355 -0
  513. package/src/types/font-face.d.ts +47 -0
  514. package/src/types/libs.d.ts +3 -0
  515. package/src/utils/__tests__/analytics-test.tsx +35 -0
  516. package/src/utils/__tests__/browser-test.tsx +28 -0
  517. package/src/utils/__tests__/dom-test.tsx +23 -0
  518. package/src/utils/__tests__/helpers-test.tsx +166 -0
  519. package/src/utils/analytics.tsx +28 -0
  520. package/src/utils/animation.tsx +201 -0
  521. package/src/utils/aspect-ratio-support.css.ts +28 -0
  522. package/src/utils/aspect-ratio-support.tsx +141 -0
  523. package/src/utils/browser.tsx +9 -0
  524. package/src/utils/color.tsx +46 -0
  525. package/src/utils/common.tsx +27 -0
  526. package/src/utils/credit-card.tsx +46 -0
  527. package/src/utils/css.tsx +25 -0
  528. package/src/utils/document-visibility.tsx +52 -0
  529. package/src/utils/dom.tsx +155 -0
  530. package/src/utils/environment.tsx +6 -0
  531. package/src/utils/headings.tsx +18 -0
  532. package/src/utils/helpers.tsx +182 -0
  533. package/src/utils/keys.tsx +8 -0
  534. package/src/utils/locale.tsx +27 -0
  535. package/src/utils/platform.tsx +94 -0
  536. package/src/utils/region-code.tsx +1 -0
  537. package/src/utils/renders-element.tsx +6 -0
  538. package/src/utils/time.tsx +22 -0
  539. package/src/utils/types.tsx +19 -0
  540. package/src/utils/utility-types.tsx +8 -0
  541. package/src/video.css.ts +11 -0
  542. package/src/video.tsx +355 -0
  543. package/src/vivinho-loading-animation/in-lottie.json +402 -0
  544. package/src/vivinho-loading-animation/index.tsx +90 -0
  545. package/src/vivinho-loading-animation/out-lottie.json +575 -0
  546. package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
  547. package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
  548. package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
package/src/select.tsx ADDED
@@ -0,0 +1,513 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import classnames from 'classnames';
4
+ import {useForm} from './form-context';
5
+ import {useTheme} from './hooks';
6
+ import {DOWN, ENTER, ESC, SPACE, TAB, UP} from './utils/keys';
7
+ import {FieldContainer, HelperText, Label, useApplyCssVars} from './text-field-components';
8
+ import IconChevronDownRegular from './generated/mistica-icons/icon-chevron-down-regular';
9
+ import {TextFieldBaseAutosuggest} from './text-field-base';
10
+ import Overlay from './overlay';
11
+ import {isAndroid, isIos} from './utils/platform';
12
+ import {cancelEvent} from './utils/dom';
13
+ import {Text3} from './text';
14
+ import * as styles from './select.css';
15
+ import * as textStyles from './text-field-base.css';
16
+ import {Portal} from './portal';
17
+ import {applyCssVars, pxToRem} from './utils/css';
18
+ import {ThemeVariant} from './theme-variant-context';
19
+ import {vars} from './skins/skin-contract.css';
20
+
21
+ import type {DataAttributes} from './utils/types';
22
+
23
+ export type SelectProps = {
24
+ disabled?: boolean;
25
+ error?: boolean;
26
+ helperText?: string;
27
+ id?: string;
28
+ label: string;
29
+ name: string;
30
+ optional?: boolean;
31
+ showOptionalLabel?: boolean;
32
+ validate?: (value: string | void, rawValue: string | void) => string | void;
33
+ onChangeValue?: (value: string) => void;
34
+ onBlur?: (event: React.FocusEvent<any>) => void;
35
+ options: ReadonlyArray<{
36
+ readonly value: string;
37
+ readonly text: string;
38
+ }>;
39
+ autoFocus?: boolean;
40
+ value?: string;
41
+ defaultValue?: string;
42
+ fullWidth?: boolean;
43
+ native?: boolean;
44
+ children?: void;
45
+ dataAttributes?: DataAttributes;
46
+ };
47
+
48
+ const Select = ({
49
+ id,
50
+ label,
51
+ helperText: helperTextProp,
52
+ value: valueProp,
53
+ defaultValue,
54
+ onChangeValue: onChangeValueProp,
55
+ name,
56
+ fullWidth,
57
+ options,
58
+ optional,
59
+ showOptionalLabel,
60
+ disabled: disabledProp,
61
+ error: errorProp,
62
+ onBlur,
63
+ autoFocus = false,
64
+ native,
65
+ dataAttributes,
66
+ }: SelectProps): JSX.Element => {
67
+ const inputRef = React.useRef<HTMLSelectElement | HTMLInputElement>(null);
68
+ const focusableRef = React.useRef<HTMLSelectElement | HTMLDivElement>(null);
69
+ const fieldRef = React.useRef<HTMLDivElement>(null);
70
+ const optionsMenuRef = React.useRef<HTMLUListElement>(null);
71
+ const optionRefs = React.useRef(new Map<string, HTMLLIElement>());
72
+ const [isServerSide, setIsServerSide] = React.useState(true);
73
+ const [valueState, setValueState] = React.useState<string | undefined>(defaultValue);
74
+ const [optionsShown, setOptionsShown] = React.useState(false);
75
+ const [animateShowOptions, setAnimateShowOptions] = React.useState(false);
76
+ const [isFocused, setIsFocused] = React.useState(false);
77
+ const [optionsComputedProps, setOptionsComputedProps] = React.useState<{
78
+ top?: number;
79
+ left?: number;
80
+ maxHeight?: number;
81
+ minWidth?: number;
82
+ transformOrigin?: string;
83
+ }>({});
84
+ const [tentativeValueState, setTentativeValueState] = React.useState<string>();
85
+ const lastElementSelectionScrollTop = React.useRef<number>(null);
86
+ const reactId = React.useId();
87
+ const inputId = id || reactId;
88
+ const {
89
+ rawValues,
90
+ setRawValue,
91
+ setValue: formSetValue,
92
+ formStatus,
93
+ formErrors,
94
+ setFormError,
95
+ register,
96
+ } = useForm();
97
+ const {platformOverrides} = useTheme();
98
+ const cssVarStyles = useApplyCssVars();
99
+
100
+ const shouldUseNative =
101
+ native ||
102
+ (process.env.NODE_ENV === 'test' && !process.env.SSR_TEST) ||
103
+ isAndroid(platformOverrides) ||
104
+ isIos(platformOverrides);
105
+
106
+ const disabled = disabledProp || formStatus === 'sending';
107
+ const error = errorProp || !!formErrors[name];
108
+ const helperText = formErrors[name] || helperTextProp;
109
+ const value = valueProp ?? rawValues[name];
110
+
111
+ const onChangeValue = (value: string) => {
112
+ onChangeValueProp?.(value);
113
+ setFormError({name, error: ''});
114
+ setRawValue({name, value});
115
+ formSetValue({name, value});
116
+ };
117
+
118
+ const toggleOptions = (show: boolean) => {
119
+ if (show) {
120
+ if (fieldRef?.current) {
121
+ const MAX_OPTIONS = 8;
122
+ const MARGIN_TOP_SIZE = 12;
123
+ const PADDING_SIZE = 16;
124
+
125
+ const clientRect = fieldRef.current.getBoundingClientRect();
126
+ const availableSpaceTop = clientRect.top;
127
+ const width = clientRect.width;
128
+ const left = clientRect.left;
129
+ const height = clientRect.height;
130
+
131
+ const top = availableSpaceTop + height;
132
+ const visibleOptions = Math.min(options.length, MAX_OPTIONS);
133
+ const spaceTaken = visibleOptions * 48 + PADDING_SIZE;
134
+ // if it doesn't fit on bottom
135
+ if (top + spaceTaken + MARGIN_TOP_SIZE > window.innerHeight) {
136
+ const availableSpaceBottom = window.innerHeight - top;
137
+ if (availableSpaceTop > availableSpaceBottom) {
138
+ const newTop = availableSpaceTop - spaceTaken;
139
+ setOptionsComputedProps({
140
+ minWidth: width,
141
+ left,
142
+ top: Math.max(newTop, MARGIN_TOP_SIZE),
143
+ maxHeight: Math.min(availableSpaceTop - MARGIN_TOP_SIZE, spaceTaken),
144
+ transformOrigin: 'center bottom',
145
+ });
146
+ } else {
147
+ setOptionsComputedProps({
148
+ minWidth: width,
149
+ top,
150
+ left,
151
+ maxHeight: window.innerHeight - top - MARGIN_TOP_SIZE,
152
+ transformOrigin: 'center top',
153
+ });
154
+ }
155
+ } else {
156
+ // if it fits on bottom
157
+ setOptionsComputedProps({
158
+ minWidth: width,
159
+ top,
160
+ left,
161
+ maxHeight: spaceTaken,
162
+ transformOrigin: 'center top',
163
+ });
164
+ }
165
+ }
166
+ setOptionsShown(true);
167
+ requestAnimationFrame(() => {
168
+ if (
169
+ lastElementSelectionScrollTop.current &&
170
+ optionsMenuRef.current &&
171
+ 'scrollTop' in optionsMenuRef.current
172
+ ) {
173
+ optionsMenuRef.current.scrollTop = lastElementSelectionScrollTop.current;
174
+ }
175
+ setAnimateShowOptions(true);
176
+ });
177
+ setTentativeValueState(valueState ?? value);
178
+ } else {
179
+ setAnimateShowOptions(false);
180
+ setOptionsShown(false);
181
+ setTentativeValueState(undefined);
182
+ }
183
+ };
184
+
185
+ const setValue = (val?: string) => {
186
+ // @ts-expect-error current is typed as read-only
187
+ lastElementSelectionScrollTop.current = optionsMenuRef.current?.scrollTop;
188
+ toggleOptions(false);
189
+ if (onChangeValue && typeof val === 'string') {
190
+ onChangeValue(val);
191
+ }
192
+ if (typeof value === 'undefined') {
193
+ setValueState(val);
194
+ }
195
+ };
196
+
197
+ const scrollIntoTargetListElement = (targetValueState: string) => {
198
+ const menuClientRect = optionsMenuRef.current?.getBoundingClientRect();
199
+ if (menuClientRect && targetValueState && optionRefs.current.has(targetValueState)) {
200
+ const itemRef = optionRefs.current.get(targetValueState);
201
+ const clientRect = itemRef?.getBoundingClientRect();
202
+ if (
203
+ clientRect &&
204
+ clientRect.top + clientRect.height / 2 >= menuClientRect.top + menuClientRect.height
205
+ ) {
206
+ itemRef?.scrollIntoView();
207
+ return;
208
+ }
209
+ if (clientRect && clientRect.top + clientRect.height / 2 <= menuClientRect.top) {
210
+ itemRef?.scrollIntoView(false);
211
+ }
212
+ }
213
+ };
214
+
215
+ const focusableElement = focusableRef.current;
216
+ const inputElement = inputRef.current;
217
+
218
+ React.useEffect(() => {
219
+ setRawValue({name, value});
220
+ formSetValue({name, value});
221
+ }, [name, setRawValue, formSetValue, value]);
222
+
223
+ React.useEffect(() => {
224
+ register(name, {
225
+ input: inputRef.current,
226
+ focusableElement: focusableRef.current,
227
+ label,
228
+ });
229
+ return () => {
230
+ register(name, {input: null, focusableElement: null, label: ''});
231
+ };
232
+ }, [name, register, focusableRef, inputRef, focusableElement, inputElement, label]);
233
+
234
+ React.useEffect(() => {
235
+ const updateTentativeValueState = (e: KeyboardEvent) => {
236
+ const keyToOperand: Record<string, 1 | -1 | undefined> = {[UP]: -1, [DOWN]: 1};
237
+ const operand = keyToOperand[e.key];
238
+ if (operand) {
239
+ cancelEvent(e);
240
+ const newTentativeValueState =
241
+ options[options.findIndex(({value}) => value === tentativeValueState) + operand]?.value ??
242
+ tentativeValueState;
243
+ setTentativeValueState(newTentativeValueState);
244
+ scrollIntoTargetListElement(newTentativeValueState);
245
+ }
246
+ };
247
+ const handleKeyDown = (e: KeyboardEvent) => {
248
+ if (optionsShown) {
249
+ switch (e.key) {
250
+ case TAB:
251
+ cancelEvent(e);
252
+ break;
253
+ case ESC:
254
+ toggleOptions(false);
255
+ break;
256
+ case ENTER:
257
+ case SPACE:
258
+ cancelEvent(e);
259
+ if (
260
+ options.findIndex(({value}) => value === tentativeValueState) !== -1 &&
261
+ tentativeValueState !== valueState
262
+ ) {
263
+ setValue(tentativeValueState);
264
+ }
265
+ toggleOptions(false);
266
+ break;
267
+ default:
268
+ // do nothing
269
+ }
270
+ }
271
+ // so we don't change the tentativeValueState while menu is closing
272
+ if (animateShowOptions) {
273
+ updateTentativeValueState(e);
274
+ }
275
+ };
276
+ document.addEventListener('keydown', handleKeyDown, false);
277
+ return () => {
278
+ document.removeEventListener('keydown', handleKeyDown, false);
279
+ };
280
+ });
281
+
282
+ React.useEffect(() => {
283
+ if (autoFocus && focusableRef.current) {
284
+ focusableRef.current.focus();
285
+ }
286
+ }, [autoFocus]);
287
+
288
+ React.useEffect(() => {
289
+ // We use this Ref to always use the native variant in the first render, this way we avoid hydration issues when using SSR
290
+ setIsServerSide(false);
291
+ }, []);
292
+
293
+ // When the value is null/undefined/'' we assume it's the default empty option and we don't show any label
294
+ const getOptionText = (val?: string) => (val ? options.find(({value}) => value === val)?.text : '');
295
+
296
+ const containerActiveProps = {
297
+ tabIndex: 0,
298
+ onFocus: () => setIsFocused(true),
299
+ onBlur: () => setIsFocused(false),
300
+ onClick: () => {
301
+ toggleOptions(true);
302
+ setIsFocused(true);
303
+ },
304
+ onKeyDown: (e: React.KeyboardEvent) => {
305
+ if (!optionsShown && (e.key === SPACE || e.key === ENTER)) {
306
+ cancelEvent(e);
307
+ toggleOptions(true);
308
+ }
309
+ },
310
+ };
311
+
312
+ const iconSize = pxToRem(20);
313
+
314
+ const selectedValue = valueState ?? value;
315
+
316
+ return (
317
+ <ThemeVariant variant="default">
318
+ {shouldUseNative || isServerSide ? (
319
+ <FieldContainer
320
+ disabled={disabled}
321
+ helperText={<HelperText error={error} leftText={helperText} />}
322
+ fieldRef={fieldRef}
323
+ fullWidth={fullWidth}
324
+ dataAttributes={{testid: 'Select', ...dataAttributes}}
325
+ >
326
+ {label && (
327
+ <Label
328
+ error={error}
329
+ forId={inputId}
330
+ inputState={
331
+ isFocused
332
+ ? 'focused'
333
+ : selectedValue ?? inputRef.current?.value
334
+ ? 'filled'
335
+ : 'default'
336
+ }
337
+ showOptional={optional && showOptionalLabel}
338
+ >
339
+ {label}
340
+ </Label>
341
+ )}
342
+ <select
343
+ className={classnames(
344
+ styles.selectVariants[disabled ? 'disabled' : 'default'],
345
+ label ? textStyles.inputWithLabel : textStyles.inputWithoutLabel
346
+ )}
347
+ id={inputId}
348
+ aria-invalid={!!error}
349
+ value={selectedValue}
350
+ required={!optional}
351
+ disabled={disabled}
352
+ onChange={(e) => {
353
+ setValue(e.target.value);
354
+ }}
355
+ onFocus={() => setIsFocused(true)}
356
+ onBlur={(e) => {
357
+ setIsFocused(false);
358
+ onBlur?.(e);
359
+ }}
360
+ ref={(actualRef) => {
361
+ [inputRef, focusableRef].forEach((currentRef) => {
362
+ currentRef.current = actualRef;
363
+ });
364
+ }}
365
+ style={{
366
+ // Override default browser opacity when disabled. This opacity also affects the label.
367
+ // Without this fix, the label is invisible when disabled
368
+ opacity: 1,
369
+ // Use transparent color for the empty option (show below) to avoid showing it when the menu is closed
370
+ color: selectedValue ? undefined : 'transparent',
371
+ }}
372
+ >
373
+ {!selectedValue && options.every(({value}) => !!value) && (
374
+ // If no "empty" option exists, insert a dummy empty option. Once an option is selected,
375
+ // this empty option is removed. This is needed to allow a native select without a selected
376
+ // default option.
377
+ // Chrome doesn't show this option when the select menu is open (because of display: none),
378
+ // but Safari does. So we use the select's label for this option, otherwise it would be shown
379
+ // as an empty option, which is weirder.
380
+ <option value="" style={{display: 'none'}} aria-label="">
381
+ {label}
382
+ </option>
383
+ )}
384
+ {options.map(({value: val, text}) => (
385
+ // Set color: 'initial' to avoid wrong text color in some browsers when using dark mode.
386
+ // Similar issue in another lib: https://github.com/chakra-ui/chakra-ui/issues/417#issue-566611352
387
+ <option key={val} value={val} style={{color: 'initial'}}>
388
+ {text}
389
+ </option>
390
+ ))}
391
+ </select>
392
+ <div className={styles.arrowDown} aria-hidden>
393
+ <div className={styles.iconContainer} data-testid="endIcon">
394
+ <IconChevronDownRegular size={iconSize} color={vars.colors.neutralMedium} />
395
+ </div>
396
+ </div>
397
+ </FieldContainer>
398
+ ) : (
399
+ <>
400
+ <div
401
+ className={styles.selectContainerVariants[fullWidth ? 'fullWidth' : 'default']}
402
+ role="button"
403
+ aria-haspopup="listbox"
404
+ ref={focusableRef as React.Ref<HTMLDivElement>}
405
+ {...(!disabled && containerActiveProps)}
406
+ style={cssVarStyles}
407
+ >
408
+ <TextFieldBaseAutosuggest
409
+ style={{visibility: 'hidden'}}
410
+ fullWidth={fullWidth}
411
+ endIcon={
412
+ <div className={styles.iconContainer}>
413
+ <IconChevronDownRegular
414
+ size={iconSize}
415
+ color={vars.colors.neutralMedium}
416
+ />
417
+ </div>
418
+ }
419
+ focus={isFocused}
420
+ label={label}
421
+ value={selectedValue}
422
+ shrinkLabel={!!(value || valueState)}
423
+ name={name}
424
+ helperText={helperText}
425
+ required={!optional}
426
+ disabled={disabled}
427
+ id={inputId}
428
+ error={error}
429
+ inputRef={inputRef}
430
+ fieldRef={fieldRef}
431
+ dataAttributes={{testid: 'Select', ...dataAttributes}}
432
+ />
433
+
434
+ <div
435
+ className={classnames(
436
+ styles.selectTextVariants[disabled ? 'disabled' : 'default'],
437
+ label ? textStyles.inputWithLabel : textStyles.inputWithoutLabel
438
+ )}
439
+ >
440
+ {getOptionText(selectedValue)}
441
+ </div>
442
+ </div>
443
+ {optionsShown && (
444
+ <Overlay
445
+ onPress={(e) => {
446
+ toggleOptions(false);
447
+ cancelEvent(e);
448
+ }}
449
+ disableScroll
450
+ >
451
+ <Portal>
452
+ <ul
453
+ style={applyCssVars({
454
+ [styles.vars.top]: optionsComputedProps.top
455
+ ? `${optionsComputedProps.top}px`
456
+ : '',
457
+ [styles.vars.left]: optionsComputedProps.left
458
+ ? `${optionsComputedProps.left}px`
459
+ : '',
460
+ [styles.vars.maxHeight]: optionsComputedProps.maxHeight
461
+ ? `${optionsComputedProps.maxHeight}px`
462
+ : '',
463
+ [styles.vars.minWidth]: optionsComputedProps.minWidth
464
+ ? `${optionsComputedProps.minWidth}px`
465
+ : '',
466
+ [styles.vars.transformOrigin]:
467
+ optionsComputedProps.transformOrigin ?? '',
468
+ })}
469
+ onPointerDown={cancelEvent}
470
+ className={classnames(
471
+ styles.optionsContainer,
472
+ animateShowOptions
473
+ ? styles.optionsAnimationsVariants.show
474
+ : styles.optionsAnimationsVariants.hide
475
+ )}
476
+ role="listbox"
477
+ ref={optionsMenuRef}
478
+ >
479
+ {options.map(({value: val, text}) => (
480
+ <li
481
+ role="option"
482
+ aria-selected={val === (valueState ?? value)}
483
+ key={val}
484
+ data-value={val}
485
+ className={classnames(styles.menuItem, {
486
+ [styles.menuItemSelected]:
487
+ val === tentativeValueState ||
488
+ val === (valueState ?? value),
489
+ })}
490
+ onPointerDown={cancelEvent}
491
+ onClick={() => setValue(val)}
492
+ ref={(liRef) => {
493
+ if (liRef) {
494
+ optionRefs.current.set(val, liRef);
495
+ } else {
496
+ optionRefs.current.delete(val);
497
+ }
498
+ }}
499
+ >
500
+ <Text3 regular>{text}</Text3>
501
+ </li>
502
+ ))}
503
+ </ul>
504
+ </Portal>
505
+ </Overlay>
506
+ )}
507
+ </>
508
+ )}
509
+ </ThemeVariant>
510
+ );
511
+ };
512
+
513
+ export default Select;
@@ -0,0 +1,33 @@
1
+ import {style} from '@vanilla-extract/css';
2
+ import * as mq from './media-queries.css';
3
+ import {vars as skinVars} from './skins/skin-contract.css';
4
+ import {sprinkles} from './sprinkles.css';
5
+
6
+ export const sheetActionRow = style([
7
+ sprinkles({
8
+ display: 'flex',
9
+ padding: 16,
10
+ minHeight: 72,
11
+ alignItems: 'center',
12
+ }),
13
+ {
14
+ transition: 'background-color 0.1s ease-in-out',
15
+ ':active': {
16
+ background: skinVars.colors.backgroundContainerPressed,
17
+ },
18
+ '@media': {
19
+ [mq.supportsHover]: {
20
+ ':hover': {
21
+ background: skinVars.colors.backgroundContainerHover,
22
+ },
23
+ // need to repeat this inside of @media to avoid :hover background to take precedence over :active
24
+ ':active': {
25
+ background: skinVars.colors.backgroundContainerPressed,
26
+ },
27
+ },
28
+ [mq.touchableOnly]: {
29
+ transition: 'none',
30
+ },
31
+ },
32
+ },
33
+ ]);
@@ -0,0 +1,113 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import Sheet, {SheetBody} from './sheet-common';
4
+ import {useTheme} from './hooks';
5
+ import Box from './box';
6
+ import {Text3} from './text';
7
+ import {vars as skinVars} from './skins/skin-contract.css';
8
+ import * as styles from './sheet-action-row.css';
9
+ import Image from './image';
10
+ import NegativeBox from './negative-box';
11
+ import Touchable from './touchable';
12
+
13
+ import type {ExclusifyUnion} from './utils/utility-types';
14
+ import type {DataAttributes, IconProps} from './utils/types';
15
+
16
+ type ActionsListSheetProps = {
17
+ title?: string;
18
+ subtitle?: string;
19
+ description?: string | ReadonlyArray<string>;
20
+ items: ReadonlyArray<{
21
+ id: string;
22
+ title: string;
23
+ /** "normal" by default */
24
+ style?: 'normal' | 'destructive';
25
+ icon?: ExclusifyUnion<
26
+ | {
27
+ /** @deprecated - use url instead */
28
+ Icon: React.ComponentType<IconProps>;
29
+ }
30
+ | {
31
+ url: string;
32
+ urlDark?: string;
33
+ }
34
+ >;
35
+ }>;
36
+ onClose?: () => void;
37
+ onSelect?: (id: string) => void;
38
+ dataAttributes?: DataAttributes;
39
+ };
40
+
41
+ const ActionsListSheet = React.forwardRef<HTMLDivElement, ActionsListSheetProps>(
42
+ ({title, subtitle, description, items, onClose, onSelect, dataAttributes}, ref) => {
43
+ const {isDarkMode} = useTheme();
44
+
45
+ return (
46
+ <Sheet
47
+ onClose={onClose}
48
+ ref={ref}
49
+ dataAttributes={{'component-name': 'ActionsListSheet', ...dataAttributes}}
50
+ >
51
+ {({closeModal, modalTitleId}) => (
52
+ <SheetBody
53
+ title={title}
54
+ subtitle={subtitle}
55
+ description={description}
56
+ modalTitleId={modalTitleId}
57
+ >
58
+ <NegativeBox>
59
+ {items.map(({id, style, title, icon}) => (
60
+ <Touchable
61
+ key={id}
62
+ onPress={() => {
63
+ onSelect?.(id);
64
+ closeModal();
65
+ }}
66
+ >
67
+ <div className={styles.sheetActionRow}>
68
+ {icon && (
69
+ <Box paddingRight={16}>
70
+ {icon.Icon ? (
71
+ <icon.Icon
72
+ size={24}
73
+ color={
74
+ style === 'destructive'
75
+ ? skinVars.colors.textLinkDanger
76
+ : skinVars.colors.neutralHigh
77
+ }
78
+ />
79
+ ) : (
80
+ <Image
81
+ circular
82
+ src={
83
+ isDarkMode && icon.urlDark
84
+ ? icon.urlDark
85
+ : icon.url
86
+ }
87
+ width={40}
88
+ />
89
+ )}
90
+ </Box>
91
+ )}
92
+ <Text3
93
+ regular
94
+ color={
95
+ style === 'destructive'
96
+ ? skinVars.colors.textLinkDanger
97
+ : skinVars.colors.textPrimary
98
+ }
99
+ >
100
+ {title}
101
+ </Text3>
102
+ </div>
103
+ </Touchable>
104
+ ))}
105
+ </NegativeBox>
106
+ </SheetBody>
107
+ )}
108
+ </Sheet>
109
+ );
110
+ }
111
+ );
112
+
113
+ export default ActionsListSheet;