@telefonica/mistica 16.56.1-beta.1 → 16.57.0-beta.2
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.
- package/css/mistica.css +1 -1
- package/dist/accordion.css-mistica.js +6 -6
- package/dist/align.css-mistica.js +1 -1
- package/dist/autocomplete.css-mistica.js +1 -1
- package/dist/avatar.css-mistica.js +1 -1
- package/dist/badge.css-mistica.js +1 -1
- package/dist/box.css-mistica.js +13 -13
- package/dist/boxed.css-mistica.js +24 -24
- package/dist/button-group.css-mistica.js +1 -1
- package/dist/button-layout.css-mistica.js +14 -14
- package/dist/button.css-mistica.js +30 -30
- package/dist/callout.css-mistica.js +11 -11
- package/dist/card-internal.css-mistica.js +15 -15
- package/dist/carousel.css-mistica.js +8 -8
- package/dist/checkbox.css-mistica.js +11 -11
- package/dist/chip.css-mistica.js +15 -15
- package/dist/circle.css-mistica.js +1 -1
- package/dist/community/advanced-data-card.css-mistica.js +6 -6
- package/dist/community/blocks.css-mistica.js +1 -1
- package/dist/community/example-component.css-mistica.js +1 -1
- package/dist/counter.css-mistica.js +1 -1
- package/dist/cover-hero.css-mistica.js +2 -2
- package/dist/credit-card-number-field.css-mistica.js +3 -3
- package/dist/date-field.css-mistica.js +1 -1
- package/dist/date-time-picker.css-mistica.js +1 -1
- package/dist/dialog.css-mistica.js +4 -4
- package/dist/divider.css-mistica.js +5 -5
- package/dist/double-field.css-mistica.js +2 -2
- package/dist/drawer.css-mistica.js +1 -1
- package/dist/empty-state-card.css-mistica.js +1 -1
- package/dist/empty-state.css-mistica.js +5 -5
- package/dist/fade-in.css-mistica.js +1 -1
- package/dist/feedback.css-mistica.js +1 -1
- package/dist/file-upload.css-mistica.js +7 -7
- package/dist/fixed-footer-layout.css-mistica.js +2 -2
- package/dist/form.css-mistica.js +1 -1
- package/dist/grid-layout.css-mistica.js +3 -3
- package/dist/grid.css-mistica.js +120 -120
- package/dist/header.css-mistica.js +1 -1
- package/dist/hero.css-mistica.js +2 -2
- package/dist/horizontal-scroll.css-mistica.js +1 -1
- package/dist/icon-button.css-mistica.js +53 -53
- package/dist/icons/icon-chevron.css-mistica.js +2 -2
- package/dist/icons/icon-error.css-mistica.js +1 -1
- package/dist/image.css-mistica.js +2 -2
- package/dist/inline.css-mistica.js +9 -9
- package/dist/list.css-mistica.js +1 -1
- package/dist/loading-bar.css-mistica.js +1 -1
- package/dist/loading-screen.css-mistica.js +4 -4
- package/dist/logo.css-mistica.js +5 -5
- package/dist/menu.css-mistica.js +13 -13
- package/dist/mosaic.css-mistica.js +1 -1
- package/dist/navigation-bar.css-mistica.js +18 -18
- package/dist/navigation-breadcrumbs.css-mistica.js +1 -1
- package/dist/package-version.js +1 -1
- package/dist/pin-field.css-mistica.js +1 -1
- package/dist/popover.css-mistica.js +1 -1
- package/dist/progress-bar.css-mistica.js +6 -6
- package/dist/radio-button.css-mistica.js +19 -19
- package/dist/rating.css-mistica.js +2 -2
- package/dist/responsive-layout.css-mistica.js +6 -6
- package/dist/screen-reader-only.css-mistica.js +1 -1
- package/dist/select.css-mistica.js +15 -15
- package/dist/sheet-action-row.css-mistica.js +1 -1
- package/dist/sheet-common.css-mistica.js +1 -1
- package/dist/sheet-info.css-mistica.js +1 -1
- package/dist/skeletons.css-mistica.js +6 -6
- package/dist/skins/skin-contract.css-mistica.js +684 -684
- package/dist/skip-link.css-mistica.js +1 -1
- package/dist/slider.css-mistica.js +18 -18
- package/dist/snackbar.css-mistica.js +4 -4
- package/dist/spinner.css-mistica.js +1 -1
- package/dist/square.css-mistica.js +1 -1
- package/dist/stack.css-mistica.js +5 -5
- package/dist/stacking-group.css-mistica.js +1 -1
- package/dist/stepper.css-mistica.js +2 -2
- package/dist/switch-component.css-mistica.js +35 -35
- package/dist/table.css-mistica.js +9 -9
- package/dist/tabs.css-mistica.js +17 -17
- package/dist/tag.css-mistica.js +1 -1
- package/dist/text-field-base.css-mistica.js +15 -15
- package/dist/text-field-components.css-mistica.js +3 -3
- package/dist/text-link.css-mistica.js +6 -6
- package/dist/text.css-mistica.js +6 -6
- package/dist/theme-context.css-mistica.js +1 -1
- package/dist/timeline.css-mistica.js +9 -9
- package/dist/timer.css-mistica.js +6 -6
- package/dist/tooltip.css-mistica.js +1 -1
- package/dist/touchable.css-mistica.js +1 -1
- package/dist/utils/aspect-ratio-support.css-mistica.js +2 -2
- package/dist/video.css-mistica.js +1 -1
- package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
- package/dist-es/accordion.css-mistica.js +6 -6
- package/dist-es/align.css-mistica.js +1 -1
- package/dist-es/autocomplete.css-mistica.js +1 -1
- package/dist-es/avatar.css-mistica.js +1 -1
- package/dist-es/badge.css-mistica.js +1 -1
- package/dist-es/box.css-mistica.js +13 -13
- package/dist-es/boxed.css-mistica.js +23 -23
- package/dist-es/button-group.css-mistica.js +1 -1
- package/dist-es/button-layout.css-mistica.js +14 -14
- package/dist-es/button.css-mistica.js +30 -30
- package/dist-es/callout.css-mistica.js +11 -11
- package/dist-es/card-internal.css-mistica.js +15 -15
- package/dist-es/carousel.css-mistica.js +8 -8
- package/dist-es/checkbox.css-mistica.js +11 -11
- package/dist-es/chip.css-mistica.js +15 -15
- package/dist-es/circle.css-mistica.js +1 -1
- package/dist-es/community/advanced-data-card.css-mistica.js +6 -6
- package/dist-es/community/blocks.css-mistica.js +1 -1
- package/dist-es/community/example-component.css-mistica.js +1 -1
- package/dist-es/counter.css-mistica.js +1 -1
- package/dist-es/cover-hero.css-mistica.js +2 -2
- package/dist-es/credit-card-number-field.css-mistica.js +3 -3
- package/dist-es/date-field.css-mistica.js +1 -1
- package/dist-es/date-time-picker.css-mistica.js +1 -1
- package/dist-es/dialog.css-mistica.js +4 -4
- package/dist-es/divider.css-mistica.js +5 -5
- package/dist-es/double-field.css-mistica.js +2 -2
- package/dist-es/drawer.css-mistica.js +1 -1
- package/dist-es/empty-state-card.css-mistica.js +1 -1
- package/dist-es/empty-state.css-mistica.js +5 -5
- package/dist-es/fade-in.css-mistica.js +1 -1
- package/dist-es/feedback.css-mistica.js +1 -1
- package/dist-es/file-upload.css-mistica.js +7 -7
- package/dist-es/fixed-footer-layout.css-mistica.js +2 -2
- package/dist-es/form.css-mistica.js +1 -1
- package/dist-es/grid-layout.css-mistica.js +3 -3
- package/dist-es/grid.css-mistica.js +120 -120
- package/dist-es/header.css-mistica.js +1 -1
- package/dist-es/hero.css-mistica.js +2 -2
- package/dist-es/horizontal-scroll.css-mistica.js +1 -1
- package/dist-es/icon-button.css-mistica.js +53 -53
- package/dist-es/icons/icon-chevron.css-mistica.js +2 -2
- package/dist-es/icons/icon-error.css-mistica.js +1 -1
- package/dist-es/image.css-mistica.js +2 -2
- package/dist-es/inline.css-mistica.js +9 -9
- package/dist-es/list.css-mistica.js +1 -1
- package/dist-es/loading-bar.css-mistica.js +1 -1
- package/dist-es/loading-screen.css-mistica.js +4 -4
- package/dist-es/logo.css-mistica.js +5 -5
- package/dist-es/menu.css-mistica.js +13 -13
- package/dist-es/mosaic.css-mistica.js +1 -1
- package/dist-es/navigation-bar.css-mistica.js +18 -18
- package/dist-es/navigation-breadcrumbs.css-mistica.js +1 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/pin-field.css-mistica.js +1 -1
- package/dist-es/popover.css-mistica.js +1 -1
- package/dist-es/progress-bar.css-mistica.js +6 -6
- package/dist-es/radio-button.css-mistica.js +19 -19
- package/dist-es/rating.css-mistica.js +2 -2
- package/dist-es/responsive-layout.css-mistica.js +6 -6
- package/dist-es/screen-reader-only.css-mistica.js +1 -1
- package/dist-es/select.css-mistica.js +15 -15
- package/dist-es/sheet-action-row.css-mistica.js +1 -1
- package/dist-es/sheet-common.css-mistica.js +1 -1
- package/dist-es/sheet-info.css-mistica.js +1 -1
- package/dist-es/skeletons.css-mistica.js +6 -6
- package/dist-es/skins/skin-contract.css-mistica.js +684 -684
- package/dist-es/skip-link.css-mistica.js +1 -1
- package/dist-es/slider.css-mistica.js +18 -18
- package/dist-es/snackbar.css-mistica.js +4 -4
- package/dist-es/spinner.css-mistica.js +1 -1
- package/dist-es/square.css-mistica.js +1 -1
- package/dist-es/stack.css-mistica.js +5 -5
- package/dist-es/stacking-group.css-mistica.js +1 -1
- package/dist-es/stepper.css-mistica.js +2 -2
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.css-mistica.js +35 -35
- package/dist-es/table.css-mistica.js +9 -9
- package/dist-es/tabs.css-mistica.js +17 -17
- package/dist-es/tag.css-mistica.js +1 -1
- package/dist-es/text-field-base.css-mistica.js +15 -15
- package/dist-es/text-field-components.css-mistica.js +3 -3
- package/dist-es/text-link.css-mistica.js +6 -6
- package/dist-es/text.css-mistica.js +6 -6
- package/dist-es/theme-context.css-mistica.js +1 -1
- package/dist-es/timeline.css-mistica.js +9 -9
- package/dist-es/timer.css-mistica.js +6 -6
- package/dist-es/tooltip.css-mistica.js +1 -1
- package/dist-es/touchable.css-mistica.js +1 -1
- package/dist-es/utils/aspect-ratio-support.css-mistica.js +2 -2
- package/dist-es/video.css-mistica.js +1 -1
- package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
- package/doc/design-tokens.md +19 -92
- package/doc/fonts.md +194 -76
- package/doc/layout.md +10 -3
- package/doc/llms.md +52 -9
- package/doc/patterns.md +11 -5
- package/doc/theme-config.md +38 -0
- package/package.json +1 -1
package/doc/fonts.md
CHANGED
|
@@ -1,127 +1,260 @@
|
|
|
1
1
|
# Fonts
|
|
2
2
|
|
|
3
|
-
|
|
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`.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
- [Font family](#font-family)
|
|
7
|
-
- [System Fonts (Roboto / San Francisco)](#system-fonts-roboto--san-francisco)
|
|
8
|
-
- [OnAir or Telefonica fonts](#onair-or-telefonica-fonts)
|
|
9
|
-
- [Override brower fonts for some specific html elements](#override-brower-fonts-for-some-specific-html-elements)
|
|
10
|
-
- [Dynamic font sizes](#dynamic-font-sizes)
|
|
7
|
+
## Font per skin
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Each skin has a designated font family. Use the correct one for the skin your app is using:
|
|
13
10
|
|
|
14
|
-
|
|
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'` |
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
also work fine with other font families.
|
|
24
|
+
## Setting font-family
|
|
18
25
|
|
|
19
|
-
|
|
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:
|
|
20
28
|
|
|
21
|
-
|
|
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)
|
|
22
50
|
|
|
23
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
|
+
|
|
24
77
|
body {
|
|
25
|
-
font-family:
|
|
78
|
+
font-family: 'On Air', 'Helvetica', 'Arial', sans-serif;
|
|
26
79
|
}
|
|
27
80
|
```
|
|
28
81
|
|
|
29
|
-
|
|
82
|
+
### Movistar Sans (Movistar New)
|
|
30
83
|
|
|
31
84
|
```css
|
|
32
85
|
@font-face {
|
|
33
|
-
font-family: '
|
|
86
|
+
font-family: 'Movistar Sans';
|
|
34
87
|
font-style: normal;
|
|
35
88
|
font-weight: 300;
|
|
36
|
-
src:
|
|
37
|
-
local('Roboto Light'),
|
|
38
|
-
local('Roboto-Light'),
|
|
39
|
-
url('/static/fonts/roboto-v18-latin_latin-ext-300.woff2') format('woff2');
|
|
89
|
+
src: url('/fonts/MovistarSans-Light.woff2') format('woff2');
|
|
40
90
|
}
|
|
41
91
|
@font-face {
|
|
42
|
-
font-family: '
|
|
92
|
+
font-family: 'Movistar Sans';
|
|
43
93
|
font-style: normal;
|
|
44
94
|
font-weight: 400;
|
|
45
|
-
src:
|
|
46
|
-
local('Roboto'),
|
|
47
|
-
local('Roboto-Regular'),
|
|
48
|
-
url('/static/fonts/roboto-v18-latin_latin-ext-regular.woff2') format('woff2');
|
|
95
|
+
src: url('/fonts/MovistarSans-Regular.woff2') format('woff2');
|
|
49
96
|
}
|
|
50
97
|
@font-face {
|
|
51
|
-
font-family: '
|
|
98
|
+
font-family: 'Movistar Sans';
|
|
52
99
|
font-style: normal;
|
|
53
100
|
font-weight: 500;
|
|
54
|
-
src:
|
|
55
|
-
local('Roboto Medium'),
|
|
56
|
-
local('Roboto-Medium'),
|
|
57
|
-
url('/static/fonts/roboto-v18-latin_latin-ext-500.woff2') format('woff2');
|
|
101
|
+
src: url('/fonts/MovistarSans-Medium.woff2') format('woff2');
|
|
58
102
|
}
|
|
59
103
|
@font-face {
|
|
60
|
-
font-family: '
|
|
104
|
+
font-family: 'Movistar Sans';
|
|
61
105
|
font-style: normal;
|
|
62
106
|
font-weight: 700;
|
|
63
|
-
src:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
107
|
+
src: url('/fonts/MovistarSans-Bold.woff2') format('woff2');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
body {
|
|
111
|
+
font-family: 'Movistar Sans', 'Helvetica', 'Arial', sans-serif;
|
|
67
112
|
}
|
|
68
113
|
```
|
|
69
114
|
|
|
70
|
-
|
|
71
|
-
web server. The important part here is to serve different font weights for 300 (light), 400 (regular), 500
|
|
72
|
-
(medium) and 700 (bold).
|
|
115
|
+
### Vivo Type (Vivo New)
|
|
73
116
|
|
|
74
|
-
|
|
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
|
+
```
|
|
75
147
|
|
|
76
|
-
|
|
77
|
-
weight (only light, regular and bold). In these cases, we recomend to use the regular font weight for the 500
|
|
78
|
-
`font-weight`. Something like this:
|
|
148
|
+
### Telefonica Sans (Telefonica, Tu)
|
|
79
149
|
|
|
80
150
|
```css
|
|
81
151
|
@font-face {
|
|
82
|
-
font-family: '
|
|
152
|
+
font-family: 'Telefonica Sans';
|
|
83
153
|
font-style: normal;
|
|
84
154
|
font-weight: 300;
|
|
85
|
-
src: url('/
|
|
155
|
+
src: url('/fonts/Telefonica_Sans_Light.woff2') format('woff2');
|
|
86
156
|
}
|
|
87
157
|
@font-face {
|
|
88
|
-
font-family: '
|
|
158
|
+
font-family: 'Telefonica Sans';
|
|
89
159
|
font-style: normal;
|
|
90
160
|
font-weight: 400;
|
|
91
|
-
src: url('/
|
|
161
|
+
src: url('/fonts/Telefonica_Sans_Regular.woff2') format('woff2');
|
|
92
162
|
}
|
|
93
163
|
@font-face {
|
|
94
|
-
font-family: '
|
|
164
|
+
font-family: 'Telefonica Sans';
|
|
95
165
|
font-style: normal;
|
|
96
166
|
font-weight: 500;
|
|
97
|
-
|
|
98
|
-
src: url('/static/fonts/OnAir-Regular.woff2') format('woff2');
|
|
167
|
+
src: url('/fonts/Telefonica_Sans_Medium.woff2') format('woff2');
|
|
99
168
|
}
|
|
100
169
|
@font-face {
|
|
101
|
-
font-family: '
|
|
170
|
+
font-family: 'Telefonica Sans';
|
|
102
171
|
font-style: normal;
|
|
103
172
|
font-weight: 700;
|
|
104
|
-
src: url('/
|
|
173
|
+
src: url('/fonts/Telefonica_Sans_Bold.woff2') format('woff2');
|
|
105
174
|
}
|
|
106
175
|
|
|
107
176
|
body {
|
|
108
|
-
font-family: '
|
|
177
|
+
font-family: 'Telefonica Sans', 'Helvetica', 'Arial', sans-serif;
|
|
109
178
|
}
|
|
110
179
|
```
|
|
111
180
|
|
|
112
|
-
###
|
|
181
|
+
### Roboto (Vivo, Blau)
|
|
113
182
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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.
|
|
117
186
|
|
|
118
|
-
|
|
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`:
|
|
119
199
|
|
|
120
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
|
+
|
|
121
238
|
body {
|
|
122
239
|
font-family: -apple-system, 'Roboto', 'Helvetica', 'Arial', sans-serif;
|
|
123
240
|
}
|
|
241
|
+
```
|
|
124
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
|
|
125
258
|
input,
|
|
126
259
|
textarea,
|
|
127
260
|
pre,
|
|
@@ -130,23 +263,12 @@ code {
|
|
|
130
263
|
}
|
|
131
264
|
```
|
|
132
265
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
```css
|
|
136
|
-
* {
|
|
137
|
-
font-family: -apple-system, 'Roboto', 'Helvetica', 'Arial', sans-serif;
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
3. Use a [reset.css](https://meyerweb.com/eric/tools/css/reset/) that does this for you.
|
|
142
|
-
|
|
143
|
-
We use to recomend option 3.
|
|
266
|
+
Or use a CSS reset that handles this, such as
|
|
267
|
+
[modern-normalize](https://github.com/sindresorhus/modern-normalize).
|
|
144
268
|
|
|
145
269
|
## Dynamic font sizes
|
|
146
270
|
|
|
147
|
-
|
|
148
|
-
you want your web to properly work with dynamic font sizes, we recommend to setup a base font size of 16px or
|
|
149
|
-
100% (which is the same as 16px in most browsers):
|
|
271
|
+
To support OS/browser accessibility font size settings, set the base size on `html`:
|
|
150
272
|
|
|
151
273
|
```css
|
|
152
274
|
html {
|
|
@@ -154,13 +276,9 @@ html {
|
|
|
154
276
|
}
|
|
155
277
|
```
|
|
156
278
|
|
|
157
|
-
|
|
279
|
+
To support Dynamic Type on iOS:
|
|
158
280
|
|
|
159
281
|
```css
|
|
160
|
-
/**
|
|
161
|
-
* To enable Dynamic Type in apple devices:
|
|
162
|
-
* See: https://dev.to/colingourlay/how-to-support-apple-s-dynamic-text-in-your-web-content-with-css-40c0
|
|
163
|
-
*/
|
|
164
282
|
@supports (font: -apple-system-body) {
|
|
165
283
|
html {
|
|
166
284
|
font: -apple-system-body !important;
|
package/doc/layout.md
CHANGED
|
@@ -73,15 +73,22 @@ Vertically distributes its children using the given `space` separation.
|
|
|
73
73
|
## Inline
|
|
74
74
|
|
|
75
75
|
Horizontally distributes its children using the given `space` separation. This component can be considered as
|
|
76
|
-
|
|
76
|
+
a horizontal `Stack`, and it covers the most common row-layout use cases you might otherwise solve with
|
|
77
|
+
`display: flex`.
|
|
77
78
|
|
|
78
|
-
:
|
|
79
|
+
It supports:
|
|
80
|
+
|
|
81
|
+
- horizontal distribution via `space={number}` or `space="between" | "around" | "evenly"`
|
|
82
|
+
- vertical alignment of children via `alignItems="flex-start" | "flex-end" | "center" | "stretch" | "baseline"`
|
|
83
|
+
- wrapping via `wrap` and row spacing via `verticalSpace`
|
|
84
|
+
|
|
85
|
+
:information_source: Check `Inline` in
|
|
79
86
|
[Storybook](https://mistica-web.vercel.app/?path=/story/layout-inline--default) to learn more about it.
|
|
80
87
|
|
|
81
88
|
### numeric space
|
|
82
89
|
|
|
83
90
|
```tsx
|
|
84
|
-
<Inline space={16}>
|
|
91
|
+
<Inline space={16} alignItems="center">
|
|
85
92
|
<Child1 />
|
|
86
93
|
<Child2 />
|
|
87
94
|
<Child3 />
|
package/doc/llms.md
CHANGED
|
@@ -17,16 +17,31 @@ repository at `https://github.com/Telefonica/mistica-web/blob/master/doc/<filena
|
|
|
17
17
|
|
|
18
18
|
## Critical Rules
|
|
19
19
|
|
|
20
|
-
1. **NEVER hardcode colors.** Always use `skinVars.colors.*` design tokens from
|
|
20
|
+
1. **NEVER hardcode colors in app/component UI code.** Always use `skinVars.colors.*` design tokens from
|
|
21
|
+
`@telefonica/mistica`. The exception is skin authoring: when creating or extending a `Skin`, you may use
|
|
22
|
+
built-in palette exports (for example `movistarNewPalette`) or your own custom palette/colors inside the
|
|
23
|
+
skin definition.
|
|
21
24
|
2. **Try not to use raw `<div>` for layout.** Use Mistica layout components: `Box`, `Stack`, `Inline`,
|
|
22
25
|
`Align`, `ResponsiveLayout`, `GridLayout`, `Grid`.
|
|
23
26
|
3. **NEVER set font sizes manually.** Use text components: `Text1`-`Text10`, `Title1`-`Title4`.
|
|
24
27
|
4. **NEVER set border radius manually.** Use `skinVars.borderRadii.*` or Mistica components that handle it
|
|
25
|
-
automatically.
|
|
28
|
+
automatically. If you need to change the default visual styling of components (colors, border radius,
|
|
29
|
+
etc.) and there is no specific prop for it, create or extend a custom skin instead of adding ad hoc style
|
|
30
|
+
overrides.
|
|
26
31
|
5. **Always wrap your app** with `<ThemeContextProvider>` and import `@telefonica/mistica/css/mistica.css`.
|
|
27
32
|
6. **Always namespace React hooks**: `React.useState`, `React.useEffect`, `React.useRef`.
|
|
28
33
|
7. **Add `'use client';`** directive to client components when using Next.js app router.
|
|
29
34
|
8. Use `skinVars.rawColors.*` (not `skinVars.colors.*`) when applying alpha with `applyAlpha`.
|
|
35
|
+
9. **Always set `font-family` on `body` and use the correct font for the active skin.** Mistica does NOT
|
|
36
|
+
inject a font — without it browsers render text with their default serif font (Times New Roman on desktop).
|
|
37
|
+
Each skin has a designated font; see the [fonts reference](./fonts.md) for `@font-face` setup and the
|
|
38
|
+
per-skin font table.
|
|
39
|
+
10. **Always set `body` background color using `skinVars.colors.background`.** Without it the page background
|
|
40
|
+
won't match the theme (especially in dark mode). Do this inside a component rendered under
|
|
41
|
+
`ThemeContextProvider` so `skinVars` resolves to the correct theme values:
|
|
42
|
+
```tsx
|
|
43
|
+
<style>{`body { background-color: ${skinVars.colors.background}; }`}</style>
|
|
44
|
+
```
|
|
30
45
|
|
|
31
46
|
## Install
|
|
32
47
|
|
|
@@ -42,13 +57,22 @@ npm install @telefonica/mistica
|
|
|
42
57
|
|
|
43
58
|
## Quick Start
|
|
44
59
|
|
|
60
|
+
**Two global CSS concerns that Mistica does NOT handle automatically:**
|
|
61
|
+
|
|
62
|
+
1. **Font family** — without it, browsers fall back to their default serif font (Times New Roman on desktop).
|
|
63
|
+
Each skin has its own font; see [fonts.md](./fonts.md) for the per-skin table and `@font-face` setup.
|
|
64
|
+
2. **Body background color** — without it, the page background won't match the active theme (critical in dark
|
|
65
|
+
mode). Set it from inside a component rendered under `ThemeContextProvider` using
|
|
66
|
+
`skinVars.colors.background`.
|
|
67
|
+
|
|
45
68
|
```tsx
|
|
46
69
|
'use client';
|
|
47
70
|
|
|
48
71
|
import '@telefonica/mistica/css/mistica.css';
|
|
49
72
|
import {
|
|
50
73
|
ThemeContextProvider,
|
|
51
|
-
|
|
74
|
+
getMovistarNewSkin,
|
|
75
|
+
skinVars,
|
|
52
76
|
ResponsiveLayout,
|
|
53
77
|
Box,
|
|
54
78
|
Stack,
|
|
@@ -58,12 +82,23 @@ import {
|
|
|
58
82
|
} from '@telefonica/mistica';
|
|
59
83
|
|
|
60
84
|
const misticaTheme = {
|
|
61
|
-
skin:
|
|
85
|
+
skin: getMovistarNewSkin(),
|
|
62
86
|
i18n: {locale: 'es-ES', phoneNumberFormattingRegionCode: 'ES'},
|
|
63
87
|
};
|
|
64
88
|
|
|
89
|
+
// Rendered under ThemeContextProvider so skinVars resolves correctly
|
|
90
|
+
const GlobalStyles = () => (
|
|
91
|
+
<style>{`
|
|
92
|
+
body {
|
|
93
|
+
font-family: 'Movistar Sans', 'Helvetica', 'Arial', sans-serif; /* font for Movistar New skin */
|
|
94
|
+
background-color: ${skinVars.colors.background};
|
|
95
|
+
}
|
|
96
|
+
`}</style>
|
|
97
|
+
);
|
|
98
|
+
|
|
65
99
|
const App = () => (
|
|
66
100
|
<ThemeContextProvider theme={misticaTheme}>
|
|
101
|
+
<GlobalStyles />
|
|
67
102
|
<ResponsiveLayout>
|
|
68
103
|
<Box paddingY={24}>
|
|
69
104
|
<Stack space={16}>
|
|
@@ -100,8 +135,13 @@ type ThemeConfig = {
|
|
|
100
135
|
};
|
|
101
136
|
```
|
|
102
137
|
|
|
103
|
-
Available skins: `
|
|
104
|
-
`getTuSkin()`, and others via `getSkinByName()`.
|
|
138
|
+
Available skins: `getMovistarNewSkin()`, `getVivoNewSkin()`, `getO2NewSkin()`, `getTelefonicaSkin()`,
|
|
139
|
+
`getBlauSkin()`, `getTuSkin()`, and others via `getSkinByName()`. Legacy variants without the `New` suffix
|
|
140
|
+
also exist (`getMovistarSkin()`, `getVivoSkin()`, `getO2Skin()`); prefer the `New` versions for new projects.
|
|
141
|
+
You can also create a custom skin. If you need to customize default component colors, radii, or other visual
|
|
142
|
+
tokens beyond the props exposed by a component, prefer extending a skin over overriding component styles.
|
|
143
|
+
Built-in palette exports such as `movistarNewPalette`, `o2NewPalette`, `vivoNewPalette`, etc. are available
|
|
144
|
+
for skin authoring, and custom skins may also define their own palette colors from scratch.
|
|
105
145
|
|
|
106
146
|
Built-in Link integrations: `Next12`, `Next13`, `Next14`, `ReactRouter5`, `ReactRouter6`.
|
|
107
147
|
|
|
@@ -159,11 +199,11 @@ Vertical rhythm: containers 24px padding, sections 32px spacing, elements 16px s
|
|
|
159
199
|
### Buttons
|
|
160
200
|
|
|
161
201
|
`ButtonPrimary`, `ButtonSecondary`, `ButtonDanger`, `ButtonLink`, `ButtonLinkDanger`, `ButtonGroup`,
|
|
162
|
-
`ButtonLayout`, `IconButton`, `ToggleIconButton`
|
|
202
|
+
`ButtonLayout`, `IconButton`, `ToggleIconButton`, `TextLink`
|
|
163
203
|
|
|
164
204
|
### Text
|
|
165
205
|
|
|
166
|
-
`Text1`-`Text10`, `Title1`-`Title4
|
|
206
|
+
`Text1`-`Text10`, `Title1`-`Title4`
|
|
167
207
|
|
|
168
208
|
### Cards
|
|
169
209
|
|
|
@@ -231,6 +271,9 @@ All tokens via `skinVars` from `@telefonica/mistica`:
|
|
|
231
271
|
|
|
232
272
|
- **Colors**: `skinVars.colors.*` (286 tokens for backgrounds, text, borders, controls, status, tags)
|
|
233
273
|
- **Raw colors**: `skinVars.rawColors.*` (same tokens as RGB values, for use with `applyAlpha`)
|
|
274
|
+
- **Palettes for skin authoring**: built-in palette exports such as `movistarNewPalette`, `o2NewPalette`,
|
|
275
|
+
`vivoNewPalette`, etc. Use these only when creating/extending a `Skin`, not for styling app components
|
|
276
|
+
directly.
|
|
234
277
|
- **Border radii**: `skinVars.borderRadii.*` (container, button, input, popup, chip, sheet, avatar, tag, etc.)
|
|
235
278
|
- **Text presets**: Handled by text components, not accessed directly
|
|
236
279
|
|
|
@@ -246,7 +289,7 @@ All tokens via `skinVars` from `@telefonica/mistica`:
|
|
|
246
289
|
- [Layout](./layout.md): Core layout primitives (Box, Stack, Inline, Align, Grid/GridItem, NegativeBox,
|
|
247
290
|
Divider, HorizontalScroll, Boxed, Overlay, StackingGroup) and page layouts (ResponsiveLayout, HeaderLayout,
|
|
248
291
|
GridLayout, MasterDetailLayout, FixedFooterLayout, ButtonFixedFooterLayout, ButtonLayout, DoubleField),
|
|
249
|
-
vertical rhythm
|
|
292
|
+
vertical rhythm, and `Inline` alignment/wrapping capabilities
|
|
250
293
|
- [Forms](./forms.md): Form component, all form field types, DoubleField, useForm hook
|
|
251
294
|
- [Analytics](./analytics.md): trackingEvent prop, logEvent setup, default tracking, GA4 support,
|
|
252
295
|
TrackingConfig
|
package/doc/patterns.md
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Critical rules
|
|
4
4
|
|
|
5
|
-
1. **NEVER hardcode colors.** Always use `skinVars.colors.*` from
|
|
5
|
+
1. **NEVER hardcode colors in app/component UI code.** Always use `skinVars.colors.*` from
|
|
6
|
+
`@telefonica/mistica`. For skins and theme-level customization, see [theme-config.md](./theme-config.md).
|
|
6
7
|
2. **NEVER use raw `<div>` for layout.** Use `Box`, `Stack`, `Inline`, `ResponsiveLayout`, `GridLayout`,
|
|
7
8
|
`Grid`.
|
|
8
9
|
3. **NEVER set font sizes manually.** Use text components (`Text1`-`Text10`, `Title1`-`Title4`).
|
|
9
10
|
4. **NEVER set border radius manually.** Use `skinVars.borderRadii.*` or components that handle it (`Boxed`,
|
|
10
|
-
cards, etc.).
|
|
11
|
+
cards, etc.). For theme-level visual customization without a dedicated component prop, use a custom skin.
|
|
11
12
|
5. **Always wrap your app** with `ThemeContextProvider` and import `@telefonica/mistica/css/mistica.css`.
|
|
12
13
|
6. **Always namespace React hooks**: `React.useState`, `React.useEffect`, `React.useRef`, etc.
|
|
13
14
|
7. **Add `'use client';`** directive to client components when using Next.js app router.
|
|
15
|
+
8. **Set `font-family` and `body` background color.** See [llms.md](./llms.md) rules 9–10 and
|
|
16
|
+
[fonts.md](./fonts.md) for the per-skin font table, `@font-face` setup, and the `GlobalStyles` pattern.
|
|
14
17
|
|
|
15
18
|
## Page layout composition
|
|
16
19
|
|
|
@@ -121,7 +124,7 @@ import {skinVars, applyAlpha} from '@telefonica/mistica';
|
|
|
121
124
|
const overlay = applyAlpha(skinVars.rawColors.backgroundBrand, 0.8);
|
|
122
125
|
```
|
|
123
126
|
|
|
124
|
-
### DON'T: Hardcode colors
|
|
127
|
+
### DON'T: Hardcode colors in component code
|
|
125
128
|
|
|
126
129
|
```tsx
|
|
127
130
|
// BAD - hardcoded colors
|
|
@@ -134,6 +137,9 @@ const overlay = applyAlpha(skinVars.rawColors.backgroundBrand, 0.8);
|
|
|
134
137
|
<Boxed><Text2 regular>Content in container</Text2></Boxed>
|
|
135
138
|
```
|
|
136
139
|
|
|
140
|
+
If you need brand-specific defaults, put those colors in a custom skin and then consume them through
|
|
141
|
+
`skinVars.colors.*` instead of styling individual components with palette values.
|
|
142
|
+
|
|
137
143
|
## Responsive patterns
|
|
138
144
|
|
|
139
145
|
### Conditional rendering by screen size
|
|
@@ -509,7 +515,7 @@ return (
|
|
|
509
515
|
import Link from 'next/link';
|
|
510
516
|
|
|
511
517
|
const theme = {
|
|
512
|
-
skin:
|
|
518
|
+
skin: getMovistarNewSkin(),
|
|
513
519
|
i18n: {locale: 'es-ES', phoneNumberFormattingRegionCode: 'ES'},
|
|
514
520
|
Link: {type: 'Next14', Component: Link},
|
|
515
521
|
};
|
|
@@ -521,7 +527,7 @@ const theme = {
|
|
|
521
527
|
import {Link} from 'react-router-dom';
|
|
522
528
|
|
|
523
529
|
const theme = {
|
|
524
|
-
skin:
|
|
530
|
+
skin: getMovistarNewSkin(),
|
|
525
531
|
i18n: {locale: 'es-ES', phoneNumberFormattingRegionCode: 'ES'},
|
|
526
532
|
Link: {type: 'ReactRouter6', Component: Link},
|
|
527
533
|
};
|
package/doc/theme-config.md
CHANGED
|
@@ -95,6 +95,13 @@ If your app doesn't follow the branding of mistica builtin skins (Movistar, Vivo
|
|
|
95
95
|
can still use mistica with your custom skin. Just import the `Skin` type and create a new skin config that
|
|
96
96
|
implements the `Skin` interface (you need to define all the required color constants):
|
|
97
97
|
|
|
98
|
+
If you need to customize default component colors, border radii, or similar visual tokens and there is no
|
|
99
|
+
component prop for that, prefer a custom skin over ad hoc CSS/style overrides. You can:
|
|
100
|
+
|
|
101
|
+
- start from a built-in skin like `getMovistarNewSkin()` and override the tokens you need
|
|
102
|
+
- start from a built-in palette export like `movistarNewPalette`
|
|
103
|
+
- define your own palette/colors from scratch
|
|
104
|
+
|
|
98
105
|
```ts
|
|
99
106
|
import type {Skin} from '@telefonica/mistica';
|
|
100
107
|
|
|
@@ -121,4 +128,35 @@ const skin: Skin = {
|
|
|
121
128
|
</ThemeContextProvider>;
|
|
122
129
|
```
|
|
123
130
|
|
|
131
|
+
You can also extend an existing skin instead of defining everything from scratch:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import {getMovistarNewSkin, movistarNewPalette, type Skin} from '@telefonica/mistica';
|
|
135
|
+
|
|
136
|
+
const baseSkin = getMovistarNewSkin();
|
|
137
|
+
const palette = {
|
|
138
|
+
...movistarNewPalette,
|
|
139
|
+
brandPrimary: '#0050D8',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const skin: Skin = {
|
|
143
|
+
...baseSkin,
|
|
144
|
+
name: 'Acme',
|
|
145
|
+
colors: {
|
|
146
|
+
...baseSkin.colors,
|
|
147
|
+
brand: palette.brandPrimary,
|
|
148
|
+
backgroundBrand: palette.brandPrimary,
|
|
149
|
+
backgroundBrandTop: palette.brandPrimary,
|
|
150
|
+
backgroundBrandBottom: palette.blue800,
|
|
151
|
+
buttonPrimaryBackground: palette.brandPrimary,
|
|
152
|
+
buttonPrimaryBackgroundHover: palette.blue800,
|
|
153
|
+
buttonPrimaryBackgroundPressed: palette.blue800,
|
|
154
|
+
textButtonPrimary: palette.white,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
If you also need different default radii, override `borderRadii` in the custom skin rather than setting
|
|
160
|
+
border radius ad hoc in component styles.
|
|
161
|
+
|
|
124
162
|
You can see an example in the [examples folder](../examples/custom-skin/).
|