@telefonica/mistica 16.56.0 → 16.57.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 (295) hide show
  1. package/README.md +31 -0
  2. package/css/mistica.css +1 -1
  3. package/dist/accordion.css-mistica.js +16 -16
  4. package/dist/align.css-mistica.js +2 -2
  5. package/dist/autocomplete.css-mistica.js +6 -6
  6. package/dist/avatar.css-mistica.js +3 -3
  7. package/dist/badge.css-mistica.js +7 -7
  8. package/dist/box.css-mistica.js +15 -15
  9. package/dist/boxed.css-mistica.js +31 -31
  10. package/dist/button-group.css-mistica.js +10 -10
  11. package/dist/button-layout.css-mistica.js +21 -21
  12. package/dist/button.css-mistica.js +51 -51
  13. package/dist/callout.css-mistica.js +16 -16
  14. package/dist/card-internal.css-mistica.js +36 -36
  15. package/dist/carousel.css-mistica.js +18 -18
  16. package/dist/checkbox.css-mistica.js +21 -21
  17. package/dist/chip.css-mistica.js +30 -30
  18. package/dist/circle.css-mistica.js +2 -2
  19. package/dist/community/advanced-data-card.css-mistica.js +26 -26
  20. package/dist/community/blocks.css-mistica.js +3 -3
  21. package/dist/community/example-component.css-mistica.js +2 -2
  22. package/dist/counter.css-mistica.js +12 -12
  23. package/dist/cover-hero.css-mistica.js +16 -16
  24. package/dist/credit-card-number-field.css-mistica.js +6 -6
  25. package/dist/date-field.css-mistica.js +1 -1
  26. package/dist/date-time-picker.css-mistica.js +2 -2
  27. package/dist/dialog.css-mistica.js +15 -15
  28. package/dist/divider.css-mistica.js +5 -5
  29. package/dist/double-field.css-mistica.js +4 -4
  30. package/dist/drawer.css-mistica.js +15 -15
  31. package/dist/empty-state-card.css-mistica.js +4 -4
  32. package/dist/empty-state.css-mistica.js +14 -14
  33. package/dist/fade-in.css-mistica.js +1 -1
  34. package/dist/feedback.css-mistica.js +14 -14
  35. package/dist/file-upload.css-mistica.js +14 -14
  36. package/dist/fixed-footer-layout.css-mistica.js +12 -12
  37. package/dist/form.css-mistica.js +2 -2
  38. package/dist/grid-layout.css-mistica.js +9 -9
  39. package/dist/grid.css-mistica.js +147 -147
  40. package/dist/header.css-mistica.js +5 -5
  41. package/dist/hero.css-mistica.js +11 -11
  42. package/dist/horizontal-scroll.css-mistica.js +3 -3
  43. package/dist/icon-button.css-mistica.js +66 -66
  44. package/dist/icons/icon-chevron.css-mistica.js +6 -6
  45. package/dist/icons/icon-error.css-mistica.js +3 -3
  46. package/dist/image.css-mistica.js +11 -11
  47. package/dist/inline.css-mistica.js +16 -16
  48. package/dist/list.css-mistica.js +15 -15
  49. package/dist/loading-bar.css-mistica.js +5 -5
  50. package/dist/loading-screen.css-mistica.js +15 -15
  51. package/dist/logo-blau-shell.d.ts +10 -0
  52. package/dist/logo-blau-shell.js +25 -0
  53. package/dist/logo-blau.d.ts +1 -1
  54. package/dist/logo-blau.js +25 -40
  55. package/dist/logo-common.d.ts +0 -1
  56. package/dist/logo-esimflag-shell.d.ts +10 -0
  57. package/dist/logo-esimflag-shell.js +25 -0
  58. package/dist/logo-esimflag.d.ts +1 -1
  59. package/dist/logo-esimflag.js +11 -26
  60. package/dist/logo-movistar-new-shell.d.ts +10 -0
  61. package/dist/logo-movistar-new-shell.js +25 -0
  62. package/dist/logo-movistar-new.d.ts +1 -1
  63. package/dist/logo-movistar-new.js +84 -103
  64. package/dist/logo-movistar-shell.d.ts +10 -0
  65. package/dist/logo-movistar-shell.js +25 -0
  66. package/dist/logo-movistar.d.ts +1 -1
  67. package/dist/logo-movistar.js +16 -31
  68. package/dist/logo-o2-new-shell.d.ts +8 -0
  69. package/dist/logo-o2-new-shell.js +24 -0
  70. package/dist/logo-o2-new.d.ts +1 -1
  71. package/dist/logo-o2-new.js +6 -13
  72. package/dist/logo-o2-shell.d.ts +8 -0
  73. package/dist/logo-o2-shell.js +24 -0
  74. package/dist/logo-o2.d.ts +1 -1
  75. package/dist/logo-o2.js +6 -13
  76. package/dist/logo-telefonica-shell.d.ts +10 -0
  77. package/dist/logo-telefonica-shell.js +25 -0
  78. package/dist/logo-telefonica.d.ts +1 -1
  79. package/dist/logo-telefonica.js +11 -26
  80. package/dist/logo-tu-shell.d.ts +8 -0
  81. package/dist/logo-tu-shell.js +24 -0
  82. package/dist/logo-tu.d.ts +1 -1
  83. package/dist/logo-tu.js +10 -14
  84. package/dist/logo-vivo-shell.d.ts +10 -0
  85. package/dist/logo-vivo-shell.js +25 -0
  86. package/dist/logo-vivo.d.ts +1 -1
  87. package/dist/logo-vivo.js +11 -26
  88. package/dist/logo.css-mistica.js +9 -9
  89. package/dist/logo.js +223 -205
  90. package/dist/menu.css-mistica.js +24 -24
  91. package/dist/mosaic.css-mistica.js +3 -3
  92. package/dist/navigation-bar.css-mistica.js +45 -45
  93. package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
  94. package/dist/package-version.js +2 -2
  95. package/dist/pin-field.css-mistica.js +10 -10
  96. package/dist/popover.css-mistica.js +2 -2
  97. package/dist/progress-bar.css-mistica.js +12 -12
  98. package/dist/radio-button.css-mistica.js +33 -33
  99. package/dist/rating.css-mistica.js +12 -12
  100. package/dist/responsive-layout.css-mistica.js +20 -20
  101. package/dist/screen-reader-only.css-mistica.js +2 -2
  102. package/dist/select.css-mistica.js +29 -29
  103. package/dist/sheet-action-row.css-mistica.js +2 -2
  104. package/dist/sheet-common.css-mistica.js +16 -16
  105. package/dist/sheet-info.css-mistica.js +4 -4
  106. package/dist/skeletons.css-mistica.js +12 -12
  107. package/dist/skins/skin-contract.css-mistica.js +686 -686
  108. package/dist/skip-link.css-mistica.js +3 -3
  109. package/dist/slider.css-mistica.js +28 -28
  110. package/dist/snackbar.css-mistica.js +16 -16
  111. package/dist/spinner.css-mistica.js +5 -5
  112. package/dist/square.css-mistica.js +2 -2
  113. package/dist/stack.css-mistica.js +9 -9
  114. package/dist/stacking-group.css-mistica.js +2 -2
  115. package/dist/stepper.css-mistica.js +16 -16
  116. package/dist/switch-component.css-mistica.js +53 -53
  117. package/dist/table.css-mistica.js +24 -24
  118. package/dist/tabs.css-mistica.js +30 -30
  119. package/dist/tag.css-mistica.js +5 -5
  120. package/dist/text-field-base.css-mistica.js +30 -30
  121. package/dist/text-field-base.js +52 -51
  122. package/dist/text-field-components.css-mistica.js +20 -17
  123. package/dist/text-field-components.css.d.ts +1 -0
  124. package/dist/text-field-components.d.ts +2 -1
  125. package/dist/text-field-components.js +25 -25
  126. package/dist/text-link.css-mistica.js +10 -10
  127. package/dist/text.css-mistica.js +13 -13
  128. package/dist/theme-context.css-mistica.js +2 -2
  129. package/dist/timeline.css-mistica.js +18 -18
  130. package/dist/timer.css-mistica.js +13 -13
  131. package/dist/tooltip.css-mistica.js +12 -12
  132. package/dist/touchable.css-mistica.js +5 -5
  133. package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
  134. package/dist/video.css-mistica.js +2 -2
  135. package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
  136. package/dist-es/accordion.css-mistica.js +7 -7
  137. package/dist-es/align.css-mistica.js +2 -2
  138. package/dist-es/autocomplete.css-mistica.js +2 -2
  139. package/dist-es/avatar.css-mistica.js +2 -2
  140. package/dist-es/badge.css-mistica.js +2 -2
  141. package/dist-es/box.css-mistica.js +15 -15
  142. package/dist-es/boxed.css-mistica.js +25 -25
  143. package/dist-es/button-group.css-mistica.js +2 -2
  144. package/dist-es/button-layout.css-mistica.js +16 -16
  145. package/dist-es/button.css-mistica.js +38 -38
  146. package/dist-es/callout.css-mistica.js +12 -12
  147. package/dist-es/card-internal.css-mistica.js +20 -20
  148. package/dist-es/carousel.css-mistica.js +10 -10
  149. package/dist-es/checkbox.css-mistica.js +14 -14
  150. package/dist-es/chip.css-mistica.js +17 -17
  151. package/dist-es/circle.css-mistica.js +2 -2
  152. package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
  153. package/dist-es/community/blocks.css-mistica.js +2 -2
  154. package/dist-es/community/example-component.css-mistica.js +2 -2
  155. package/dist-es/counter.css-mistica.js +2 -2
  156. package/dist-es/cover-hero.css-mistica.js +4 -4
  157. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  158. package/dist-es/date-field.css-mistica.js +1 -1
  159. package/dist-es/date-time-picker.css-mistica.js +2 -2
  160. package/dist-es/dialog.css-mistica.js +5 -5
  161. package/dist-es/divider.css-mistica.js +5 -5
  162. package/dist-es/double-field.css-mistica.js +4 -4
  163. package/dist-es/drawer.css-mistica.js +2 -2
  164. package/dist-es/empty-state-card.css-mistica.js +2 -2
  165. package/dist-es/empty-state.css-mistica.js +7 -7
  166. package/dist-es/fade-in.css-mistica.js +1 -1
  167. package/dist-es/feedback.css-mistica.js +2 -2
  168. package/dist-es/file-upload.css-mistica.js +8 -8
  169. package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
  170. package/dist-es/form.css-mistica.js +2 -2
  171. package/dist-es/grid-layout.css-mistica.js +4 -4
  172. package/dist-es/grid.css-mistica.js +127 -127
  173. package/dist-es/header.css-mistica.js +2 -2
  174. package/dist-es/hero.css-mistica.js +4 -4
  175. package/dist-es/horizontal-scroll.css-mistica.js +2 -2
  176. package/dist-es/icon-button.css-mistica.js +56 -56
  177. package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
  178. package/dist-es/icons/icon-error.css-mistica.js +2 -2
  179. package/dist-es/image.css-mistica.js +4 -4
  180. package/dist-es/inline.css-mistica.js +10 -10
  181. package/dist-es/list.css-mistica.js +2 -2
  182. package/dist-es/loading-bar.css-mistica.js +2 -2
  183. package/dist-es/loading-screen.css-mistica.js +5 -5
  184. package/dist-es/logo-blau-shell.js +16 -0
  185. package/dist-es/logo-blau.js +36 -51
  186. package/dist-es/logo-esimflag-shell.js +16 -0
  187. package/dist-es/logo-esimflag.js +13 -28
  188. package/dist-es/logo-movistar-new-shell.js +16 -0
  189. package/dist-es/logo-movistar-new.js +86 -105
  190. package/dist-es/logo-movistar-shell.js +16 -0
  191. package/dist-es/logo-movistar.js +18 -33
  192. package/dist-es/logo-o2-new-shell.js +15 -0
  193. package/dist-es/logo-o2-new.js +7 -14
  194. package/dist-es/logo-o2-shell.js +15 -0
  195. package/dist-es/logo-o2.js +7 -14
  196. package/dist-es/logo-telefonica-shell.js +16 -0
  197. package/dist-es/logo-telefonica.js +13 -28
  198. package/dist-es/logo-tu-shell.js +15 -0
  199. package/dist-es/logo-tu.js +12 -16
  200. package/dist-es/logo-vivo-shell.js +16 -0
  201. package/dist-es/logo-vivo.js +13 -28
  202. package/dist-es/logo.css-mistica.js +7 -7
  203. package/dist-es/logo.js +221 -203
  204. package/dist-es/menu.css-mistica.js +15 -15
  205. package/dist-es/mosaic.css-mistica.js +2 -2
  206. package/dist-es/navigation-bar.css-mistica.js +20 -20
  207. package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
  208. package/dist-es/package-version.js +2 -2
  209. package/dist-es/pin-field.css-mistica.js +2 -2
  210. package/dist-es/popover.css-mistica.js +2 -2
  211. package/dist-es/progress-bar.css-mistica.js +8 -8
  212. package/dist-es/radio-button.css-mistica.js +25 -25
  213. package/dist-es/rating.css-mistica.js +4 -4
  214. package/dist-es/responsive-layout.css-mistica.js +7 -7
  215. package/dist-es/screen-reader-only.css-mistica.js +2 -2
  216. package/dist-es/select.css-mistica.js +20 -20
  217. package/dist-es/sheet-action-row.css-mistica.js +2 -2
  218. package/dist-es/sheet-common.css-mistica.js +2 -2
  219. package/dist-es/sheet-info.css-mistica.js +2 -2
  220. package/dist-es/skeletons.css-mistica.js +8 -8
  221. package/dist-es/skins/skin-contract.css-mistica.js +686 -686
  222. package/dist-es/skip-link.css-mistica.js +2 -2
  223. package/dist-es/slider.css-mistica.js +20 -20
  224. package/dist-es/snackbar.css-mistica.js +5 -5
  225. package/dist-es/spinner.css-mistica.js +2 -2
  226. package/dist-es/square.css-mistica.js +2 -2
  227. package/dist-es/stack.css-mistica.js +7 -7
  228. package/dist-es/stacking-group.css-mistica.js +2 -2
  229. package/dist-es/stepper.css-mistica.js +4 -4
  230. package/dist-es/style.css +1 -1
  231. package/dist-es/switch-component.css-mistica.js +41 -41
  232. package/dist-es/table.css-mistica.js +11 -11
  233. package/dist-es/tabs.css-mistica.js +21 -21
  234. package/dist-es/tag.css-mistica.js +2 -2
  235. package/dist-es/text-field-base.css-mistica.js +17 -17
  236. package/dist-es/text-field-base.js +52 -51
  237. package/dist-es/text-field-components.css-mistica.js +4 -4
  238. package/dist-es/text-field-components.js +52 -52
  239. package/dist-es/text-link.css-mistica.js +9 -9
  240. package/dist-es/text.css-mistica.js +8 -8
  241. package/dist-es/theme-context.css-mistica.js +2 -2
  242. package/dist-es/timeline.css-mistica.js +11 -11
  243. package/dist-es/timer.css-mistica.js +7 -7
  244. package/dist-es/tooltip.css-mistica.js +3 -3
  245. package/dist-es/touchable.css-mistica.js +2 -2
  246. package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
  247. package/dist-es/video.css-mistica.js +2 -2
  248. package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
  249. package/doc/analytics.md +145 -0
  250. package/doc/components.md +730 -0
  251. package/doc/design-tokens.md +199 -0
  252. package/doc/fonts.md +287 -0
  253. package/doc/forms.md +177 -0
  254. package/doc/images/layout/box.svg +6 -0
  255. package/doc/images/layout/grid-layout-desktop-5-4.svg +8 -0
  256. package/doc/images/layout/grid-layout-desktop-6-6.svg +8 -0
  257. package/doc/images/layout/grid-layout-desktop-8-4.svg +8 -0
  258. package/doc/images/layout/grid-layout-desktop.svg +16 -0
  259. package/doc/images/layout/grid-layout-mobile-5-4.svg +9 -0
  260. package/doc/images/layout/grid-layout-mobile-6-6.svg +9 -0
  261. package/doc/images/layout/grid-layout-mobile-8-4.svg +9 -0
  262. package/doc/images/layout/grid-layout-mobile.svg +5 -0
  263. package/doc/images/layout/grid-layout-tablet-5-4.svg +8 -0
  264. package/doc/images/layout/grid-layout-tablet-6-6.svg +8 -0
  265. package/doc/images/layout/grid-layout-tablet-8-4.svg +8 -0
  266. package/doc/images/layout/grid-layout-tablet.svg +5 -0
  267. package/doc/images/layout/header-layout-desktop.svg +6 -0
  268. package/doc/images/layout/header-layout-mobile.svg +6 -0
  269. package/doc/images/layout/header-layout-tablet.svg +6 -0
  270. package/doc/images/layout/inline-around.svg +6 -0
  271. package/doc/images/layout/inline-between.svg +6 -0
  272. package/doc/images/layout/inline-evenly.svg +6 -0
  273. package/doc/images/layout/inline.svg +6 -0
  274. package/doc/images/layout/master-detail-layout-desktop.svg +8 -0
  275. package/doc/images/layout/master-detail-layout-mobile-detail.svg +6 -0
  276. package/doc/images/layout/master-detail-layout-mobile-master.svg +6 -0
  277. package/doc/images/layout/negative-box-ok-outline.svg +17 -0
  278. package/doc/images/layout/negative-box-ok-preview.svg +11 -0
  279. package/doc/images/layout/negative-box-wrong-outline.svg +14 -0
  280. package/doc/images/layout/negative-box-wrong-preview.svg +11 -0
  281. package/doc/images/layout/responsive-layout-desktop.svg +4 -0
  282. package/doc/images/layout/responsive-layout-mobile.svg +4 -0
  283. package/doc/images/layout/responsive-layout-tablet.svg +4 -0
  284. package/doc/images/layout/stack.svg +8 -0
  285. package/doc/images/layout/vertical-rhythm.png +0 -0
  286. package/doc/layout.md +527 -0
  287. package/doc/llms.md +290 -0
  288. package/doc/lottie.md +17 -0
  289. package/doc/migration-guide.md +76 -0
  290. package/doc/patterns.md +548 -0
  291. package/doc/sheet.md +122 -0
  292. package/doc/testing.md +43 -0
  293. package/doc/texts.md +42 -0
  294. package/doc/theme-config.md +124 -0
  295. package/package.json +2 -1
@@ -0,0 +1,199 @@
1
+ # Design Tokens
2
+
3
+ Mistica uses design tokens via CSS custom properties. All tokens are accessed through the `skinVars` object
4
+ exported from `@telefonica/mistica`. Tokens adapt automatically to the active skin and color scheme
5
+ (light/dark mode).
6
+
7
+ ## Critical rules
8
+
9
+ - **NEVER hardcode colors.** Always use `skinVars.colors.*` for all color values.
10
+ - Use `skinVars.rawColors.*` (not `skinVars.colors.*`) when applying alpha with `applyAlpha`.
11
+ - Use `skinVars.borderRadii.*` for border radius values.
12
+ - Tokens are CSS custom properties at runtime (e.g. `var(--colorBrand)`), so they work in both inline styles
13
+ and CSS.
14
+
15
+ ## Color tokens
16
+
17
+ All colors are accessed via `skinVars.colors.*`. Each token resolves to a CSS custom property.
18
+
19
+ ### Semantic colors
20
+
21
+ | Token | Usage |
22
+ | ----------------------- | -------------------------------------------------------- |
23
+ | `brand` | Primary brand color |
24
+ | `brandHigh` | High-emphasis brand color |
25
+ | `inverse` | Inverse foreground color |
26
+ | `neutralHigh` | High-emphasis neutral (e.g. primary text on default) |
27
+ | `neutralMedium` | Medium-emphasis neutral (e.g. secondary text on default) |
28
+ | `neutralLow` | Low-emphasis neutral |
29
+ | `neutralLowAlternative` | Alternative low-emphasis neutral |
30
+ | `success` | Success semantic color |
31
+ | `warning` | Warning semantic color |
32
+ | `error` | Error semantic color |
33
+ | `promo` | Promotional color |
34
+ | `highlight` | Highlight color |
35
+
36
+ ### Background colors
37
+
38
+ | Token | Usage |
39
+ | -------------------------------- | ----------------------------------- |
40
+ | `background` | Default page background |
41
+ | `backgroundAlternative` | Alternative section background |
42
+ | `backgroundBrand` | Brand-colored background |
43
+ | `backgroundBrandSecondary` | Secondary brand background |
44
+ | `backgroundContainer` | Container/card background |
45
+ | `backgroundContainerBrand` | Container on brand background |
46
+ | `backgroundContainerAlternative` | Container on alternative background |
47
+ | `backgroundOverlay` | Modal/sheet overlay |
48
+ | `backgroundSkeleton` | Skeleton loading placeholder |
49
+ | `appBarBackground` | App bar background |
50
+ | `navigationBarBackground` | Navigation bar background |
51
+
52
+ ### Text colors
53
+
54
+ | Token | Usage |
55
+ | ---------------------- | ------------------------------------------ |
56
+ | `textPrimary` | Primary text on default background |
57
+ | `textPrimaryInverse` | Primary text on brand/inverse background |
58
+ | `textPrimaryBrand` | Primary text on brand background |
59
+ | `textPrimaryMedia` | Primary text on media background |
60
+ | `textSecondary` | Secondary text on default background |
61
+ | `textSecondaryInverse` | Secondary text on brand/inverse background |
62
+ | `textSecondaryBrand` | Secondary text on brand background |
63
+ | `textError` | Error text |
64
+ | `textLink` | Link text color |
65
+ | `textLinkInverse` | Link text on brand/inverse background |
66
+ | `textLinkDanger` | Danger link text color |
67
+
68
+ ### Border colors
69
+
70
+ | Token | Usage |
71
+ | ---------------- | ---------------------- |
72
+ | `borderLow` | Low-emphasis border |
73
+ | `border` | Default border |
74
+ | `borderHigh` | High-emphasis border |
75
+ | `borderSelected` | Selected/active border |
76
+
77
+ ### Status colors (low/high emphasis)
78
+
79
+ | Low emphasis | High emphasis | Usage |
80
+ | ------------ | ------------- | -------------- |
81
+ | `successLow` | `successHigh` | Success status |
82
+ | `warningLow` | `warningHigh` | Warning status |
83
+ | `errorLow` | `errorHigh` | Error status |
84
+ | `promoLow` | `promoHigh` | Promo status |
85
+ | `brandLow` | `brandHigh` | Brand status |
86
+
87
+ ### Control colors
88
+
89
+ | Token | Usage |
90
+ | ------------------ | ----------------------------------------- |
91
+ | `control` | Default control (checkbox, radio, switch) |
92
+ | `controlActivated` | Activated control |
93
+ | `controlError` | Error state control |
94
+ | `loadingBar` | Loading bar color |
95
+ | `divider` | Divider line color |
96
+
97
+ ### Tag colors
98
+
99
+ Tags have paired `tagText*` and `tagBackground*` tokens for each type: `Promo`, `Active`, `Inactive`, `Info`,
100
+ `Success`, `Warning`, `Error`. Each also has `Inverse`, `Negative`, and `Brand` variants.
101
+
102
+ Example: `skinVars.colors.tagTextPromo`, `skinVars.colors.tagBackgroundPromo`.
103
+
104
+ ## Using colors in code
105
+
106
+ ```tsx
107
+ import {skinVars, Text2, Box} from '@telefonica/mistica';
108
+
109
+ // In inline styles
110
+ <div style={{color: skinVars.colors.textPrimary, backgroundColor: skinVars.colors.backgroundContainer}}>
111
+ Content
112
+ </div>
113
+
114
+ // In component color props
115
+ <Text2 regular color={skinVars.colors.textSecondary}>Secondary text</Text2>
116
+
117
+ // Prefer Mistica components over raw divs:
118
+ <Box padding={16}>
119
+ <Text2 regular color={skinVars.colors.textSecondary}>Secondary text</Text2>
120
+ </Box>
121
+ ```
122
+
123
+ ## Applying alpha to colors
124
+
125
+ Use `applyAlpha` with `skinVars.rawColors` (not `skinVars.colors`):
126
+
127
+ ```tsx
128
+ import {applyAlpha, skinVars} from '@telefonica/mistica';
129
+
130
+ // Correct: use rawColors for alpha
131
+ const semiTransparentBrand = applyAlpha(skinVars.rawColors.brand, 0.5);
132
+
133
+ // Wrong: skinVars.colors contains CSS var() references, not raw RGB values
134
+ // applyAlpha(skinVars.colors.brand, 0.5) // Don't do this
135
+ ```
136
+
137
+ ## Border radius tokens
138
+
139
+ Access via `skinVars.borderRadii.*`:
140
+
141
+ | Token | Usage |
142
+ | ------------ | ----------------------- |
143
+ | `container` | Cards, boxed containers |
144
+ | `button` | Buttons |
145
+ | `input` | Form inputs |
146
+ | `popup` | Popups, tooltips |
147
+ | `checkbox` | Checkboxes |
148
+ | `indicator` | Indicators |
149
+ | `chip` | Chips |
150
+ | `sheet` | Bottom sheets |
151
+ | `bar` | Progress bars |
152
+ | `avatar` | Avatars |
153
+ | `mediaSmall` | Small media elements |
154
+ | `tag` | Tags |
155
+
156
+ ```tsx
157
+ // Use in styles when building custom elements (prefer Mistica components instead)
158
+ <div style={{borderRadius: skinVars.borderRadii.container}}>...</div>
159
+ ```
160
+
161
+ ## Text presets
162
+
163
+ Text sizing is handled by text components (`Text1`-`Text10`, `Title1`-`Title4`). Do not manually set font
164
+ sizes -- use the appropriate text component instead.
165
+
166
+ | Component | Weight options | Usage |
167
+ | ---------------- | ------------------------------------ | ---------------------------------- |
168
+ | `Text1`-`Text4` | `light`, `regular`, `medium`, `bold` | Body text with configurable weight |
169
+ | `Text5`-`Text10` | Fixed per skin | Display/headline text |
170
+ | `Title1` | Default weight from skin | Section title |
171
+ | `Title2` | Default weight from skin | Subsection title |
172
+ | `Title3` | Default weight from skin | Card/small title |
173
+ | `Title4` | Default weight from skin | Smallest title |
174
+
175
+ ## ThemeVariant (variant contexts)
176
+
177
+ Some sections of a page use different color contexts. Use `variant` prop on `ResponsiveLayout` or `Boxed`:
178
+
179
+ ```tsx
180
+ // Brand section (colored background)
181
+ <ResponsiveLayout variant="brand">
182
+ <Box paddingY={24}>
183
+ <Text2 regular>Text automatically adapts colors</Text2>
184
+ <ButtonPrimary onPress={() => {}}>Action</ButtonPrimary>
185
+ </Box>
186
+ </ResponsiveLayout>
187
+
188
+ // Alternative section
189
+ <ResponsiveLayout variant="alternative">
190
+ <Box paddingY={24}>
191
+ <Text2 regular>Alternative background section</Text2>
192
+ </Box>
193
+ </ResponsiveLayout>
194
+ ```
195
+
196
+ Available variants: `'default'`, `'brand'`, `'negative'`, `'alternative'`, `'media'`.
197
+
198
+ Components inside a variant section automatically adapt their colors. You do not need to manually set inverse
199
+ colors.
package/doc/fonts.md ADDED
@@ -0,0 +1,287 @@
1
+ # Fonts
2
+
3
+ Mistica does **not** inject a font family automatically. Without explicit setup, browsers fall back to their
4
+ default serif font (Times New Roman on desktop). You must declare `@font-face` rules and set `font-family` on
5
+ `body`.
6
+
7
+ ## Font per skin
8
+
9
+ Each skin has a designated font family. Use the correct one for the skin your app is using:
10
+
11
+ | Skin | Getter function | Font family |
12
+ | ---------------------------- | ---------------------- | ------------------- |
13
+ | `movistar-new` _(preferred)_ | `getMovistarNewSkin()` | `'Movistar Sans'` |
14
+ | `movistar` _(legacy)_ | `getMovistarSkin()` | `'On Air'` |
15
+ | `o2-new` _(preferred)_ | `getO2NewSkin()` | `'On Air'` |
16
+ | `o2` _(legacy)_ | `getO2Skin()` | `'On Air'` |
17
+ | `vivo-new` _(preferred)_ | `getVivoNewSkin()` | `'Vivo Type'` |
18
+ | `vivo` _(legacy)_ | `getVivoSkin()` | `'Roboto'` |
19
+ | `telefonica` | `getTelefonicaSkin()` | `'Telefonica Sans'` |
20
+ | `blau` | `getBlauSkin()` | `'Roboto'` |
21
+ | `tu` | `getTuSkin()` | `'Telefonica Sans'` |
22
+ | `esimflag` | `getEsimflagSkin()` | `'On Air'` |
23
+
24
+ ## Setting font-family
25
+
26
+ Set the font from inside a component rendered under `ThemeContextProvider`. This keeps font and background
27
+ color in sync with the active theme, including in dark mode:
28
+
29
+ ```tsx
30
+ import {skinVars} from '@telefonica/mistica';
31
+
32
+ const GlobalStyles = () => (
33
+ <style>{`
34
+ body {
35
+ font-family: 'Movistar Sans', 'Helvetica', 'Arial', sans-serif;
36
+ background-color: ${skinVars.colors.background};
37
+ }
38
+ `}</style>
39
+ );
40
+ ```
41
+
42
+ Render `<GlobalStyles />` as a direct child of `ThemeContextProvider`, before the rest of the app.
43
+
44
+ ## @font-face setup
45
+
46
+ Declare the font weights your app needs. Mistica uses **300 (light), 400 (regular), 500 (medium) and 700
47
+ (bold)**. Serve the `.woff2` files from your own static hosting.
48
+
49
+ ### On Air (Movistar, O2, O2 New, Esimflag)
50
+
51
+ ```css
52
+ @font-face {
53
+ font-family: 'On Air';
54
+ font-style: normal;
55
+ font-weight: 300;
56
+ src: url('/fonts/OnAir-Light.woff2') format('woff2');
57
+ }
58
+ @font-face {
59
+ font-family: 'On Air';
60
+ font-style: normal;
61
+ font-weight: 400;
62
+ src: url('/fonts/OnAir-Regular.woff2') format('woff2');
63
+ }
64
+ @font-face {
65
+ font-family: 'On Air';
66
+ font-style: normal;
67
+ font-weight: 500;
68
+ src: url('/fonts/OnAir-Medium.woff2') format('woff2');
69
+ }
70
+ @font-face {
71
+ font-family: 'On Air';
72
+ font-style: normal;
73
+ font-weight: 700;
74
+ src: url('/fonts/OnAir-Bold.woff2') format('woff2');
75
+ }
76
+
77
+ body {
78
+ font-family: 'On Air', 'Helvetica', 'Arial', sans-serif;
79
+ }
80
+ ```
81
+
82
+ ### Movistar Sans (Movistar New)
83
+
84
+ ```css
85
+ @font-face {
86
+ font-family: 'Movistar Sans';
87
+ font-style: normal;
88
+ font-weight: 300;
89
+ src: url('/fonts/MovistarSans-Light.woff2') format('woff2');
90
+ }
91
+ @font-face {
92
+ font-family: 'Movistar Sans';
93
+ font-style: normal;
94
+ font-weight: 400;
95
+ src: url('/fonts/MovistarSans-Regular.woff2') format('woff2');
96
+ }
97
+ @font-face {
98
+ font-family: 'Movistar Sans';
99
+ font-style: normal;
100
+ font-weight: 500;
101
+ src: url('/fonts/MovistarSans-Medium.woff2') format('woff2');
102
+ }
103
+ @font-face {
104
+ font-family: 'Movistar Sans';
105
+ font-style: normal;
106
+ font-weight: 700;
107
+ src: url('/fonts/MovistarSans-Bold.woff2') format('woff2');
108
+ }
109
+
110
+ body {
111
+ font-family: 'Movistar Sans', 'Helvetica', 'Arial', sans-serif;
112
+ }
113
+ ```
114
+
115
+ ### Vivo Type (Vivo New)
116
+
117
+ ```css
118
+ @font-face {
119
+ font-family: 'Vivo Type';
120
+ font-style: normal;
121
+ font-weight: 300;
122
+ src: url('/fonts/vivo-type-light.woff2') format('woff2');
123
+ }
124
+ @font-face {
125
+ font-family: 'Vivo Type';
126
+ font-style: normal;
127
+ font-weight: 400;
128
+ src: url('/fonts/vivo-type-regular.woff2') format('woff2');
129
+ }
130
+ @font-face {
131
+ font-family: 'Vivo Type';
132
+ font-style: normal;
133
+ font-weight: 500;
134
+ src: url('/fonts/vivo-type-medium.woff2') format('woff2');
135
+ }
136
+ @font-face {
137
+ font-family: 'Vivo Type';
138
+ font-style: normal;
139
+ font-weight: 700;
140
+ src: url('/fonts/vivo-type-bold.woff2') format('woff2');
141
+ }
142
+
143
+ body {
144
+ font-family: 'Vivo Type', 'Helvetica', 'Arial', sans-serif;
145
+ }
146
+ ```
147
+
148
+ ### Telefonica Sans (Telefonica, Tu)
149
+
150
+ ```css
151
+ @font-face {
152
+ font-family: 'Telefonica Sans';
153
+ font-style: normal;
154
+ font-weight: 300;
155
+ src: url('/fonts/Telefonica_Sans_Light.woff2') format('woff2');
156
+ }
157
+ @font-face {
158
+ font-family: 'Telefonica Sans';
159
+ font-style: normal;
160
+ font-weight: 400;
161
+ src: url('/fonts/Telefonica_Sans_Regular.woff2') format('woff2');
162
+ }
163
+ @font-face {
164
+ font-family: 'Telefonica Sans';
165
+ font-style: normal;
166
+ font-weight: 500;
167
+ src: url('/fonts/Telefonica_Sans_Medium.woff2') format('woff2');
168
+ }
169
+ @font-face {
170
+ font-family: 'Telefonica Sans';
171
+ font-style: normal;
172
+ font-weight: 700;
173
+ src: url('/fonts/Telefonica_Sans_Bold.woff2') format('woff2');
174
+ }
175
+
176
+ body {
177
+ font-family: 'Telefonica Sans', 'Helvetica', 'Arial', sans-serif;
178
+ }
179
+ ```
180
+
181
+ ### Roboto (Vivo, Blau)
182
+
183
+ Roboto is available via [Google Fonts](https://fonts.google.com/specimen/Roboto) or
184
+ [Bunny Fonts](https://fonts.bunny.net/family/roboto) (GDPR-friendly alternative). The weights needed are 300,
185
+ 400, 500, and 700.
186
+
187
+ Google Fonts import:
188
+
189
+ ```html
190
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
191
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
192
+ <link
193
+ href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
194
+ rel="stylesheet"
195
+ />
196
+ ```
197
+
198
+ Or self-hosted `@font-face`:
199
+
200
+ ```css
201
+ @font-face {
202
+ font-family: 'Roboto';
203
+ font-style: normal;
204
+ font-weight: 300;
205
+ src:
206
+ local('Roboto Light'),
207
+ local('Roboto-Light'),
208
+ url('/fonts/roboto-300.woff2') format('woff2');
209
+ }
210
+ @font-face {
211
+ font-family: 'Roboto';
212
+ font-style: normal;
213
+ font-weight: 400;
214
+ src:
215
+ local('Roboto'),
216
+ local('Roboto-Regular'),
217
+ url('/fonts/roboto-400.woff2') format('woff2');
218
+ }
219
+ @font-face {
220
+ font-family: 'Roboto';
221
+ font-style: normal;
222
+ font-weight: 500;
223
+ src:
224
+ local('Roboto Medium'),
225
+ local('Roboto-Medium'),
226
+ url('/fonts/roboto-500.woff2') format('woff2');
227
+ }
228
+ @font-face {
229
+ font-family: 'Roboto';
230
+ font-style: normal;
231
+ font-weight: 700;
232
+ src:
233
+ local('Roboto Bold'),
234
+ local('Roboto-Bold'),
235
+ url('/fonts/roboto-700.woff2') format('woff2');
236
+ }
237
+
238
+ body {
239
+ font-family: -apple-system, 'Roboto', 'Helvetica', 'Arial', sans-serif;
240
+ }
241
+ ```
242
+
243
+ ## Body background color
244
+
245
+ Always set `body` background from inside a component under `ThemeContextProvider` using the
246
+ `skinVars.colors.background` token. This ensures the background matches the active theme in both light and
247
+ dark mode:
248
+
249
+ ```tsx
250
+ const GlobalStyles = () => <style>{`body { background-color: ${skinVars.colors.background}; }`}</style>;
251
+ ```
252
+
253
+ ## Override browser fonts for form elements
254
+
255
+ Some browsers apply a different `font-family` to form inputs, textareas, and code elements. Override with:
256
+
257
+ ```css
258
+ input,
259
+ textarea,
260
+ pre,
261
+ code {
262
+ font: inherit;
263
+ }
264
+ ```
265
+
266
+ Or use a CSS reset that handles this, such as
267
+ [modern-normalize](https://github.com/sindresorhus/modern-normalize).
268
+
269
+ ## Dynamic font sizes
270
+
271
+ To support OS/browser accessibility font size settings, set the base size on `html`:
272
+
273
+ ```css
274
+ html {
275
+ font-size: 16px; /* or 100% */
276
+ }
277
+ ```
278
+
279
+ To support Dynamic Type on iOS:
280
+
281
+ ```css
282
+ @supports (font: -apple-system-body) {
283
+ html {
284
+ font: -apple-system-body !important;
285
+ }
286
+ }
287
+ ```
package/doc/forms.md ADDED
@@ -0,0 +1,177 @@
1
+ # Forms
2
+
3
+ <!-- TOC depthFrom:2 -->
4
+
5
+ - [Form example](#form-example)
6
+ - [Important notes](#important-notes)
7
+ - [Form fields](#form-fields)
8
+ - [CreditCardFields](#creditcardfields)
9
+ - [CreditCardNumberField](#creditcardnumberfield)
10
+ - [CreditCardExpirationField](#creditcardexpirationfield)
11
+ - [CvvField](#cvvfield)
12
+ - [DateField](#datefield)
13
+ - [DecimalField](#decimalfield)
14
+ - [IntegerField](#integerfield)
15
+ - [PasswordField](#passwordfield)
16
+ - [EmailField](#emailfield)
17
+ - [Select](#select)
18
+ - [PhoneNumberField](#phonenumberfield)
19
+ - [IbanField](#ibanfield)
20
+ - [DoubleField](#doublefield)
21
+ - [useForm Hook](#useform-hook)
22
+
23
+ <!-- /TOC -->
24
+
25
+ You can build complex forms with automatic state handling using the components provided by this library
26
+
27
+ ## Form example
28
+
29
+ Let's see a quick example to see how it works
30
+
31
+ ```js
32
+ import {Form, TextField, ButtonPrimary} from '@telefonica/mistica';
33
+
34
+ const validateName = (name) => (/^\w+$/.test(name) ? '' : 'bad username');
35
+
36
+ const LoginForm = () => {
37
+ // {user, pass} contains field values for inputs named "user" and "pass"
38
+ const handleSubmit = ({user, pass}) =>
39
+ api.login({user, pass}).then(() => {
40
+ document.location.href = '/home';
41
+ });
42
+
43
+ return (
44
+ <Form onSubmit={handleSubmit}>
45
+ <TextField name="user" label="Username" validate={validateName} />
46
+ <TextField name="pass" label="Password" type="password" />
47
+ <ButtonPrimary submit>Log in</ButtonPrimary>
48
+ </Form>
49
+ );
50
+ };
51
+ ```
52
+
53
+ ### Important notes
54
+
55
+ - Submit button must include the `submit` prop
56
+ - :warning: Submit handler automatically prevents default submit event (calls to `event.preventDefault()`).
57
+ So, for now, you can't use this component to send a `POST` request to `action` attribute URL.
58
+ - Form fields are required by default. If a required field is empty it will be marked as error on submit or
59
+ blur. Add the `optional` prop to mark a field as optional.
60
+ - `Form`'s `onSubmit` prop is a `function` that receives an `object` whose keys are the names of the form
61
+ fields and the values are the values of the form fields. This function must return a promise.
62
+ - When the form is submitting (while the `onSubmit` promise is not resolved or rejected), all fields are
63
+ automatically disabled and a spinner is shown inside submit button.
64
+ - Form fields accept a `validate` prop that can be used to validate field values before submitting. This
65
+ validation is executed on blur or submit. Validation function must return a string with the error message or
66
+ empty string if succeeded.
67
+ - Form optionally accepts an object of `initialValues` e.g. `<Form initialValues={{email: prevEmail}}`
68
+ - You can also use FormField components outside a `<Form>` component but you will lose the magic: automatic
69
+ form validation, disable fields when sending, show spinner on submit button, etc.
70
+
71
+ ## Form fields
72
+
73
+ ### CreditCardFields
74
+
75
+ - Use it if you want to request credit card information
76
+ - This component will render 3 fields:
77
+ - `CreditCardNumberField`
78
+ - `CreditCardExpirationField`
79
+ - `CvvField`
80
+ - When used inside a `<Form>` component, these fields have built-in validations:
81
+ - Simple validation is performed in credit card number
82
+ - CVV length depends on card type
83
+ - Expiration date must be a future date
84
+
85
+ ### CreditCardNumberField
86
+
87
+ - To request a Credit Card number
88
+ - Use `acceptedCards` prop to set accepted cards. By default:
89
+ - `{americanExpress: true, visa: true, masterCard: true}`
90
+ - An icon will hint the card type based on the card number
91
+
92
+ ### CreditCardExpirationField
93
+
94
+ - To request a Credit Card expiration date
95
+ - Format as you write (MM/YY)
96
+
97
+ ### CvvField
98
+
99
+ - To request the Credit Card Verification value
100
+
101
+ ### DateField
102
+
103
+ - To select dates
104
+ - Uses device/browser native date picker
105
+
106
+ ### DecimalField
107
+
108
+ - Shows a numeric keypad in mobile devices
109
+ - Values restricted to decimal values
110
+ - Decimal separator characted (comma or dot) depends on context locale
111
+
112
+ ### IntegerField
113
+
114
+ - Shows a numeric keypad in mobile devices
115
+ - Values restricted to integer values
116
+
117
+ ### PasswordField
118
+
119
+ - Use this field to request a password
120
+ - Includes an "eye" icon to show/hide password
121
+ - Use the `autoComplete` prop to autocomplete to an existing password (`"current-password"`) or request a new
122
+ one (`"new-password"`)
123
+
124
+ ### EmailField
125
+
126
+ - Use this field to request an email address
127
+ - Has built-in email address validation (naive)
128
+ - Uses an email keypad on mobile
129
+ - Autocompletes to current email, to disable, set `autoComplete` to `"off"`
130
+
131
+ ### Select
132
+
133
+ Use this component to create a `Select`
134
+
135
+ ```js
136
+ const options = [
137
+ {value: 1, text: 'orange'},
138
+ {value: 2, text: 'apple'},
139
+ ];
140
+
141
+ //...
142
+
143
+ <Select options={options} />;
144
+ ```
145
+
146
+ ### PhoneNumberField
147
+
148
+ To enter phone numbers
149
+
150
+ - Uses Google's `libphonenumber` library to format numbers as you type (uses `locale` from theme context to
151
+ format numbers accordingly)
152
+
153
+ ### IbanField
154
+
155
+ To enter bank accounts using the IBAN format
156
+
157
+ - Formats the IBAN number as you type
158
+ - Validates the number using the checksum
159
+
160
+ ## DoubleField
161
+
162
+ Use this component to place two fields at the same row
163
+
164
+ ```js
165
+ <DoubleField>
166
+ <TextField name="foo" label="Foo" />
167
+ <TextField name="bar" label="Bar" />
168
+ </DoubleField>
169
+ ```
170
+
171
+ ## useForm Hook
172
+
173
+ With `useForm` you can access the form context. See `form-context.tsx`.
174
+
175
+ This allows you to implement advanced form logic. See form stories for examples.
176
+
177
+ Please open an issue if your use case is not covered or you need additional examples.
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="152" viewBox="-1 -1 302 152">
2
+ <rect y="0" width="300" height="150" fill="pink" />
3
+ <rect y="32" x="16" width="calc(300 - 32)" height="calc(150 - 64)" fill="lightgray" stroke="black" />
4
+ <text x="130" y="20">32px</text>
5
+ <text x="0" y="80" >16px</text>
6
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="243" viewBox="-1 -1 362 242">
2
+ <rect x="0" y="0" height="240" width="360" fill="pink" stroke="black"/>
3
+ <rect x="48" y="0" height="240" width="calc(360 - 96)" fill="lightgray" stroke="black"/>
4
+ <rect x="69.5" y="0" height="60" width="105.5" stroke="black" fill="rgba(255,0,0,0.3)"/>
5
+ <rect x="205.5" y="0" height="60" width="82" stroke="black" fill="rgba(0,0,255,0.3)"/>
6
+ <text x="78" y="20">Left</text>
7
+ <text x="214" y="20">Right</text>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="243" viewBox="-1 -1 362 242">
2
+ <rect x="0" y="0" height="240" width="360" fill="pink" stroke="black"/>
3
+ <rect x="48" y="0" height="240" width="calc(360 - 96)" fill="lightgray" stroke="black"/>
4
+ <rect x="48" y="0" height="60" width="128" stroke="black" fill="rgba(255,0,0,0.3)"/>
5
+ <rect x="184" y="0" height="60" width="128" stroke="black" fill="rgba(0,0,255,0.3)"/>
6
+ <text x="56" y="20">Left</text>
7
+ <text x="192" y="20">Right</text>
8
+ </svg>