@telefonica/mistica 16.57.0-beta.1 → 16.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/mistica.css +1 -1
- package/dist/accordion.css-mistica.js +16 -16
- package/dist/align.css-mistica.js +2 -2
- package/dist/autocomplete.css-mistica.js +6 -6
- package/dist/avatar.css-mistica.js +3 -3
- package/dist/badge.css-mistica.js +7 -7
- package/dist/box.css-mistica.js +15 -15
- package/dist/boxed.css-mistica.js +31 -31
- package/dist/button-group.css-mistica.js +10 -10
- package/dist/button-layout.css-mistica.js +21 -21
- package/dist/button.css-mistica.js +51 -51
- package/dist/callout.css-mistica.js +16 -16
- package/dist/card-internal.css-mistica.js +36 -36
- package/dist/carousel.css-mistica.js +18 -18
- package/dist/checkbox.css-mistica.js +21 -21
- package/dist/chip.css-mistica.js +30 -30
- package/dist/circle.css-mistica.js +2 -2
- package/dist/community/advanced-data-card.css-mistica.js +26 -26
- package/dist/community/blocks.css-mistica.js +3 -3
- package/dist/community/example-component.css-mistica.js +2 -2
- package/dist/counter.css-mistica.js +12 -12
- package/dist/cover-hero.css-mistica.js +16 -16
- package/dist/credit-card-number-field.css-mistica.js +6 -6
- package/dist/date-field.css-mistica.js +1 -1
- package/dist/date-time-picker.css-mistica.js +2 -2
- package/dist/dialog.css-mistica.js +15 -15
- package/dist/divider.css-mistica.js +5 -5
- package/dist/double-field.css-mistica.js +4 -4
- package/dist/drawer.css-mistica.js +15 -15
- package/dist/empty-state-card.css-mistica.js +4 -4
- package/dist/empty-state.css-mistica.js +14 -14
- package/dist/fade-in.css-mistica.js +1 -1
- package/dist/feedback.css-mistica.js +14 -14
- package/dist/file-upload.css-mistica.js +14 -14
- package/dist/fixed-footer-layout.css-mistica.js +12 -12
- package/dist/form.css-mistica.js +2 -2
- package/dist/grid-layout.css-mistica.js +9 -9
- package/dist/grid.css-mistica.js +147 -147
- package/dist/header.css-mistica.js +5 -5
- package/dist/hero.css-mistica.js +11 -11
- package/dist/horizontal-scroll.css-mistica.js +3 -3
- package/dist/icon-button.css-mistica.js +66 -66
- package/dist/icons/icon-chevron.css-mistica.js +6 -6
- package/dist/icons/icon-error.css-mistica.js +3 -3
- package/dist/image.css-mistica.js +11 -11
- package/dist/inline.css-mistica.js +16 -16
- package/dist/list.css-mistica.js +15 -15
- package/dist/loading-bar.css-mistica.js +5 -5
- package/dist/loading-screen.css-mistica.js +15 -15
- package/dist/logo.css-mistica.js +9 -9
- package/dist/menu.css-mistica.js +24 -24
- package/dist/mosaic.css-mistica.js +3 -3
- package/dist/navigation-bar.css-mistica.js +45 -45
- package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
- package/dist/package-version.js +2 -2
- package/dist/pin-field.css-mistica.js +10 -10
- package/dist/popover.css-mistica.js +2 -2
- package/dist/progress-bar.css-mistica.js +12 -12
- package/dist/radio-button.css-mistica.js +33 -33
- package/dist/rating.css-mistica.js +12 -12
- package/dist/responsive-layout.css-mistica.js +20 -20
- package/dist/screen-reader-only.css-mistica.js +2 -2
- package/dist/select.css-mistica.js +29 -29
- package/dist/sheet-action-row.css-mistica.js +2 -2
- package/dist/sheet-common.css-mistica.js +16 -16
- package/dist/sheet-info.css-mistica.js +4 -4
- package/dist/skeletons.css-mistica.js +12 -12
- package/dist/skins/skin-contract.css-mistica.js +686 -686
- package/dist/skip-link.css-mistica.js +3 -3
- package/dist/slider.css-mistica.js +28 -28
- package/dist/snackbar.css-mistica.js +16 -16
- package/dist/spinner.css-mistica.js +5 -5
- package/dist/square.css-mistica.js +2 -2
- package/dist/stack.css-mistica.js +9 -9
- package/dist/stacking-group.css-mistica.js +2 -2
- package/dist/stepper.css-mistica.js +16 -16
- package/dist/switch-component.css-mistica.js +53 -53
- package/dist/table.css-mistica.js +24 -24
- package/dist/tabs.css-mistica.js +30 -30
- package/dist/tag.css-mistica.js +5 -5
- package/dist/text-field-base.css-mistica.js +30 -30
- package/dist/text-field-components.css-mistica.js +20 -20
- package/dist/text-link.css-mistica.js +10 -10
- package/dist/text.css-mistica.js +13 -13
- package/dist/theme-context.css-mistica.js +2 -2
- package/dist/timeline.css-mistica.js +18 -18
- package/dist/timer.css-mistica.js +13 -13
- package/dist/tooltip.css-mistica.js +12 -12
- package/dist/touchable.css-mistica.js +5 -5
- package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
- package/dist/video.css-mistica.js +2 -2
- package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
- package/dist-es/accordion.css-mistica.js +7 -7
- package/dist-es/align.css-mistica.js +2 -2
- package/dist-es/autocomplete.css-mistica.js +2 -2
- package/dist-es/avatar.css-mistica.js +2 -2
- package/dist-es/badge.css-mistica.js +2 -2
- package/dist-es/box.css-mistica.js +15 -15
- package/dist-es/boxed.css-mistica.js +25 -25
- package/dist-es/button-group.css-mistica.js +2 -2
- package/dist-es/button-layout.css-mistica.js +16 -16
- package/dist-es/button.css-mistica.js +38 -38
- package/dist-es/callout.css-mistica.js +12 -12
- package/dist-es/card-internal.css-mistica.js +20 -20
- package/dist-es/carousel.css-mistica.js +10 -10
- package/dist-es/checkbox.css-mistica.js +14 -14
- package/dist-es/chip.css-mistica.js +17 -17
- package/dist-es/circle.css-mistica.js +2 -2
- package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
- package/dist-es/community/blocks.css-mistica.js +2 -2
- package/dist-es/community/example-component.css-mistica.js +2 -2
- package/dist-es/counter.css-mistica.js +2 -2
- package/dist-es/cover-hero.css-mistica.js +4 -4
- package/dist-es/credit-card-number-field.css-mistica.js +4 -4
- package/dist-es/date-field.css-mistica.js +1 -1
- package/dist-es/date-time-picker.css-mistica.js +2 -2
- package/dist-es/dialog.css-mistica.js +5 -5
- package/dist-es/divider.css-mistica.js +5 -5
- package/dist-es/double-field.css-mistica.js +4 -4
- package/dist-es/drawer.css-mistica.js +2 -2
- package/dist-es/empty-state-card.css-mistica.js +2 -2
- package/dist-es/empty-state.css-mistica.js +7 -7
- package/dist-es/fade-in.css-mistica.js +1 -1
- package/dist-es/feedback.css-mistica.js +2 -2
- package/dist-es/file-upload.css-mistica.js +8 -8
- package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
- package/dist-es/form.css-mistica.js +2 -2
- package/dist-es/grid-layout.css-mistica.js +4 -4
- package/dist-es/grid.css-mistica.js +127 -127
- package/dist-es/header.css-mistica.js +2 -2
- package/dist-es/hero.css-mistica.js +4 -4
- package/dist-es/horizontal-scroll.css-mistica.js +2 -2
- package/dist-es/icon-button.css-mistica.js +56 -56
- package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
- package/dist-es/icons/icon-error.css-mistica.js +2 -2
- package/dist-es/image.css-mistica.js +4 -4
- package/dist-es/inline.css-mistica.js +10 -10
- package/dist-es/list.css-mistica.js +2 -2
- package/dist-es/loading-bar.css-mistica.js +2 -2
- package/dist-es/loading-screen.css-mistica.js +5 -5
- package/dist-es/logo.css-mistica.js +7 -7
- package/dist-es/menu.css-mistica.js +15 -15
- package/dist-es/mosaic.css-mistica.js +2 -2
- package/dist-es/navigation-bar.css-mistica.js +20 -20
- package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
- package/dist-es/package-version.js +2 -2
- package/dist-es/pin-field.css-mistica.js +2 -2
- package/dist-es/popover.css-mistica.js +2 -2
- package/dist-es/progress-bar.css-mistica.js +8 -8
- package/dist-es/radio-button.css-mistica.js +25 -25
- package/dist-es/rating.css-mistica.js +4 -4
- package/dist-es/responsive-layout.css-mistica.js +7 -7
- package/dist-es/screen-reader-only.css-mistica.js +2 -2
- package/dist-es/select.css-mistica.js +20 -20
- package/dist-es/sheet-action-row.css-mistica.js +2 -2
- package/dist-es/sheet-common.css-mistica.js +2 -2
- package/dist-es/sheet-info.css-mistica.js +2 -2
- package/dist-es/skeletons.css-mistica.js +8 -8
- package/dist-es/skins/skin-contract.css-mistica.js +686 -686
- package/dist-es/skip-link.css-mistica.js +2 -2
- package/dist-es/slider.css-mistica.js +20 -20
- package/dist-es/snackbar.css-mistica.js +5 -5
- package/dist-es/spinner.css-mistica.js +2 -2
- package/dist-es/square.css-mistica.js +2 -2
- package/dist-es/stack.css-mistica.js +7 -7
- package/dist-es/stacking-group.css-mistica.js +2 -2
- package/dist-es/stepper.css-mistica.js +4 -4
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.css-mistica.js +41 -41
- package/dist-es/table.css-mistica.js +11 -11
- package/dist-es/tabs.css-mistica.js +21 -21
- package/dist-es/tag.css-mistica.js +2 -2
- package/dist-es/text-field-base.css-mistica.js +17 -17
- package/dist-es/text-field-components.css-mistica.js +4 -4
- package/dist-es/text-link.css-mistica.js +9 -9
- package/dist-es/text.css-mistica.js +8 -8
- package/dist-es/theme-context.css-mistica.js +2 -2
- package/dist-es/timeline.css-mistica.js +11 -11
- package/dist-es/timer.css-mistica.js +7 -7
- package/dist-es/tooltip.css-mistica.js +3 -3
- package/dist-es/touchable.css-mistica.js +2 -2
- package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
- package/dist-es/video.css-mistica.js +2 -2
- package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
- package/doc/design-tokens.md +48 -109
- package/doc/layout.md +10 -3
- package/doc/llms.md +22 -9
- package/doc/patterns.md +9 -4
- package/doc/theme-config.md +38 -0
- package/package.json +1 -1
package/doc/design-tokens.md
CHANGED
|
@@ -6,100 +6,18 @@ exported from `@telefonica/mistica`. Tokens adapt automatically to the active sk
|
|
|
6
6
|
|
|
7
7
|
## Critical rules
|
|
8
8
|
|
|
9
|
-
- **NEVER hardcode colors.** Always use `skinVars.colors.*` for all color values.
|
|
9
|
+
- **NEVER hardcode colors in app/component UI code.** Always use `skinVars.colors.*` for all color values.
|
|
10
10
|
- Use `skinVars.rawColors.*` (not `skinVars.colors.*`) when applying alpha with `applyAlpha`.
|
|
11
11
|
- Use `skinVars.borderRadii.*` for border radius values.
|
|
12
|
+
- For custom skins, palette-based skin authoring, or theme-level visual customization, see
|
|
13
|
+
[theme-config.md](./theme-config.md).
|
|
12
14
|
- Tokens are CSS custom properties at runtime (e.g. `var(--colorBrand)`), so they work in both inline styles
|
|
13
15
|
and CSS.
|
|
14
16
|
|
|
15
17
|
## Color tokens
|
|
16
18
|
|
|
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`.
|
|
19
|
+
All colors are accessed via `skinVars.colors.*`. Each token resolves to a CSS custom property. Low/High colors
|
|
20
|
+
mean low-contrast or high-contrast versions.
|
|
103
21
|
|
|
104
22
|
## Using colors in code
|
|
105
23
|
|
|
@@ -134,30 +52,47 @@ const semiTransparentBrand = applyAlpha(skinVars.rawColors.brand, 0.5);
|
|
|
134
52
|
// applyAlpha(skinVars.colors.brand, 0.5) // Don't do this
|
|
135
53
|
```
|
|
136
54
|
|
|
55
|
+
## Using palettes when authoring a skin
|
|
56
|
+
|
|
57
|
+
Palette exports are for skin authoring, not for styling components directly. If you need to customize default
|
|
58
|
+
colors, radii, or related visual tokens, create or extend a `Skin` and then consume those values through
|
|
59
|
+
`skinVars.*` in component code. See [theme-config.md](./theme-config.md) for the full custom-skin example.
|
|
60
|
+
|
|
137
61
|
## Border radius tokens
|
|
138
62
|
|
|
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 |
|
|
63
|
+
Access via `skinVars.borderRadii.*`.
|
|
155
64
|
|
|
156
65
|
```tsx
|
|
157
|
-
// Use in styles when building custom elements (prefer Mistica components instead)
|
|
66
|
+
// Use in styles when building custom elements (but STRONGLY prefer Mistica components instead)
|
|
158
67
|
<div style={{borderRadius: skinVars.borderRadii.container}}>...</div>
|
|
159
68
|
```
|
|
160
69
|
|
|
70
|
+
## Spacing tokens
|
|
71
|
+
|
|
72
|
+
Spacing tokens are exposed via `skinVars.spacing.*`. They are mainly useful for skin authoring and modifying
|
|
73
|
+
the spacing of mistica layout components like `Box`, `Stack`, `Inline`, `ResponsiveLayout`, and `GridLayout`.
|
|
74
|
+
|
|
75
|
+
These spacing tokens are responsive and adapt to the active skin.
|
|
76
|
+
|
|
77
|
+
Some tokens expose `top` / `bottom`, some expose `left` / `right`, and some expose all four sides depending on
|
|
78
|
+
the component they support.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import {skinVars} from '@telefonica/mistica';
|
|
82
|
+
|
|
83
|
+
// Use in styles when building custom elements (but STRONGLY prefer Mistica components instead)
|
|
84
|
+
<div
|
|
85
|
+
style={{
|
|
86
|
+
paddingTop: skinVars.spacing.cardDefaultPadding.top,
|
|
87
|
+
paddingRight: skinVars.spacing.cardDefaultPadding.right,
|
|
88
|
+
paddingBottom: skinVars.spacing.cardDefaultPadding.bottom,
|
|
89
|
+
paddingLeft: skinVars.spacing.cardDefaultPadding.left,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
...
|
|
93
|
+
</div>;
|
|
94
|
+
```
|
|
95
|
+
|
|
161
96
|
## Text presets
|
|
162
97
|
|
|
163
98
|
Text sizing is handled by text components (`Text1`-`Text10`, `Title1`-`Title4`). Do not manually set font
|
|
@@ -167,10 +102,10 @@ sizes -- use the appropriate text component instead.
|
|
|
167
102
|
| ---------------- | ------------------------------------ | ---------------------------------- |
|
|
168
103
|
| `Text1`-`Text4` | `light`, `regular`, `medium`, `bold` | Body text with configurable weight |
|
|
169
104
|
| `Text5`-`Text10` | Fixed per skin | Display/headline text |
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
105
|
+
| `Title4` | Default weight from skin | Section title |
|
|
106
|
+
| `Title3` | Default weight from skin | Subsection title |
|
|
107
|
+
| `Title2` | Default weight from skin | Card/small title |
|
|
108
|
+
| `Title1` | Default weight from skin | Smallest title |
|
|
174
109
|
|
|
175
110
|
## ThemeVariant (variant contexts)
|
|
176
111
|
|
|
@@ -193,7 +128,11 @@ Some sections of a page use different color contexts. Use `variant` prop on `Res
|
|
|
193
128
|
</ResponsiveLayout>
|
|
194
129
|
```
|
|
195
130
|
|
|
196
|
-
|
|
131
|
+
Also some components can receive a variant prop.
|
|
132
|
+
|
|
133
|
+
Available variants: `'default'` (white background), `'brand'` (brand color background), `'negative'` (dark
|
|
134
|
+
background where text should be white), `'alternative'` (light neutral background), `'media'` (meant for
|
|
135
|
+
content on top of images or videos).
|
|
197
136
|
|
|
198
137
|
Components inside a variant section automatically adapt their colors. You do not need to manually set inverse
|
|
199
138
|
colors.
|
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,12 +17,18 @@ 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
|
-
3. **NEVER set font sizes manually.** Use text components: `Text1`-`Text10`, `Title1`-`Title4`.
|
|
26
|
+
3. **NEVER set font sizes manually.** Use text components: `Text1`-`Text10`, `Title1`-`Title4`. If those don't
|
|
27
|
+
cover your necessities you can set custom sizes with `Text` component.
|
|
24
28
|
4. **NEVER set border radius manually.** Use `skinVars.borderRadii.*` or Mistica components that handle it
|
|
25
|
-
automatically.
|
|
29
|
+
automatically. If you need to change the default visual styling of components (colors, border radius, etc.)
|
|
30
|
+
and there is no specific prop for it, create or extend a custom skin instead of adding ad hoc style
|
|
31
|
+
overrides.
|
|
26
32
|
5. **Always wrap your app** with `<ThemeContextProvider>` and import `@telefonica/mistica/css/mistica.css`.
|
|
27
33
|
6. **Always namespace React hooks**: `React.useState`, `React.useEffect`, `React.useRef`.
|
|
28
34
|
7. **Add `'use client';`** directive to client components when using Next.js app router.
|
|
@@ -133,7 +139,10 @@ type ThemeConfig = {
|
|
|
133
139
|
Available skins: `getMovistarNewSkin()`, `getVivoNewSkin()`, `getO2NewSkin()`, `getTelefonicaSkin()`,
|
|
134
140
|
`getBlauSkin()`, `getTuSkin()`, and others via `getSkinByName()`. Legacy variants without the `New` suffix
|
|
135
141
|
also exist (`getMovistarSkin()`, `getVivoSkin()`, `getO2Skin()`); prefer the `New` versions for new projects.
|
|
136
|
-
You can also create a custom skin.
|
|
142
|
+
You can also create a custom skin. If you need to customize default component colors, radii, or other visual
|
|
143
|
+
tokens beyond the props exposed by a component, prefer extending a skin over overriding component styles.
|
|
144
|
+
Built-in palette exports such as `movistarNewPalette`, `o2NewPalette`, `vivoNewPalette`, etc. are available
|
|
145
|
+
for skin authoring, and custom skins may also define their own palette colors from scratch.
|
|
137
146
|
|
|
138
147
|
Built-in Link integrations: `Next12`, `Next13`, `Next14`, `ReactRouter5`, `ReactRouter6`.
|
|
139
148
|
|
|
@@ -191,11 +200,11 @@ Vertical rhythm: containers 24px padding, sections 32px spacing, elements 16px s
|
|
|
191
200
|
### Buttons
|
|
192
201
|
|
|
193
202
|
`ButtonPrimary`, `ButtonSecondary`, `ButtonDanger`, `ButtonLink`, `ButtonLinkDanger`, `ButtonGroup`,
|
|
194
|
-
`ButtonLayout`, `IconButton`, `ToggleIconButton`
|
|
203
|
+
`ButtonLayout`, `IconButton`, `ToggleIconButton`, `TextLink`
|
|
195
204
|
|
|
196
205
|
### Text
|
|
197
206
|
|
|
198
|
-
`Text1`-`Text10`, `Title1`-`Title4
|
|
207
|
+
`Text1`-`Text10`, `Title1`-`Title4`
|
|
199
208
|
|
|
200
209
|
### Cards
|
|
201
210
|
|
|
@@ -263,14 +272,18 @@ All tokens via `skinVars` from `@telefonica/mistica`:
|
|
|
263
272
|
|
|
264
273
|
- **Colors**: `skinVars.colors.*` (286 tokens for backgrounds, text, borders, controls, status, tags)
|
|
265
274
|
- **Raw colors**: `skinVars.rawColors.*` (same tokens as RGB values, for use with `applyAlpha`)
|
|
275
|
+
- **Palettes for skin authoring**: built-in palette exports such as `movistarNewPalette`, `o2NewPalette`,
|
|
276
|
+
`vivoNewPalette`, etc. Use these only when creating/extending a `Skin`, not for styling app components
|
|
277
|
+
directly.
|
|
266
278
|
- **Border radii**: `skinVars.borderRadii.*` (container, button, input, popup, chip, sheet, avatar, tag, etc.)
|
|
279
|
+
- **Spacing**: `skinVars.spacing.*` (button, card, input, tag, feedback, hero, header, drawer padding tokens)
|
|
267
280
|
- **Text presets**: Handled by text components, not accessed directly
|
|
268
281
|
|
|
269
282
|
## Docs
|
|
270
283
|
|
|
271
284
|
- [Components reference](./components.md): full component catalog with props and usage examples
|
|
272
|
-
- [Design tokens](./design-tokens.md): skinVars colors, rawColors, applyAlpha, border radii,
|
|
273
|
-
theme variants
|
|
285
|
+
- [Design tokens](./design-tokens.md): skinVars colors, rawColors, applyAlpha, border radii, spacing tokens,
|
|
286
|
+
text presets, theme variants
|
|
274
287
|
- [Patterns and best practices](./patterns.md): page composition, layout dos/don'ts, color rules, responsive
|
|
275
288
|
patterns, form patterns, card patterns, list patterns, skeleton loading, funnel flows, routing integration,
|
|
276
289
|
dark mode
|
|
@@ -278,7 +291,7 @@ All tokens via `skinVars` from `@telefonica/mistica`:
|
|
|
278
291
|
- [Layout](./layout.md): Core layout primitives (Box, Stack, Inline, Align, Grid/GridItem, NegativeBox,
|
|
279
292
|
Divider, HorizontalScroll, Boxed, Overlay, StackingGroup) and page layouts (ResponsiveLayout, HeaderLayout,
|
|
280
293
|
GridLayout, MasterDetailLayout, FixedFooterLayout, ButtonFixedFooterLayout, ButtonLayout, DoubleField),
|
|
281
|
-
vertical rhythm
|
|
294
|
+
vertical rhythm, and `Inline` alignment/wrapping capabilities
|
|
282
295
|
- [Forms](./forms.md): Form component, all form field types, DoubleField, useForm hook
|
|
283
296
|
- [Analytics](./analytics.md): trackingEvent prop, logEvent setup, default tracking, GA4 support,
|
|
284
297
|
TrackingConfig
|
package/doc/patterns.md
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
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
|
-
3. **NEVER set font sizes manually.** Use text components (`Text1`-`Text10`, `Title1`-`Title4`).
|
|
9
|
+
3. **NEVER set font sizes manually.** Use text components (`Text1`-`Text10`, `Title1`-`Title4`). If those don't
|
|
10
|
+
cover your necessities you can set custom sizes with `Text` component.
|
|
9
11
|
4. **NEVER set border radius manually.** Use `skinVars.borderRadii.*` or components that handle it (`Boxed`,
|
|
10
|
-
cards, etc.).
|
|
12
|
+
cards, etc.). For theme-level visual customization without a dedicated component prop, use a custom skin.
|
|
11
13
|
5. **Always wrap your app** with `ThemeContextProvider` and import `@telefonica/mistica/css/mistica.css`.
|
|
12
14
|
6. **Always namespace React hooks**: `React.useState`, `React.useEffect`, `React.useRef`, etc.
|
|
13
15
|
7. **Add `'use client';`** directive to client components when using Next.js app router.
|
|
@@ -123,7 +125,7 @@ import {skinVars, applyAlpha} from '@telefonica/mistica';
|
|
|
123
125
|
const overlay = applyAlpha(skinVars.rawColors.backgroundBrand, 0.8);
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
### DON'T: Hardcode colors
|
|
128
|
+
### DON'T: Hardcode colors in component code
|
|
127
129
|
|
|
128
130
|
```tsx
|
|
129
131
|
// BAD - hardcoded colors
|
|
@@ -136,6 +138,9 @@ const overlay = applyAlpha(skinVars.rawColors.backgroundBrand, 0.8);
|
|
|
136
138
|
<Boxed><Text2 regular>Content in container</Text2></Boxed>
|
|
137
139
|
```
|
|
138
140
|
|
|
141
|
+
If you need brand-specific defaults, put those colors in a custom skin and then consume them through
|
|
142
|
+
`skinVars.colors.*` instead of styling individual components with palette values.
|
|
143
|
+
|
|
139
144
|
## Responsive patterns
|
|
140
145
|
|
|
141
146
|
### Conditional rendering by screen size
|
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/).
|