@telefonica/mistica 16.55.0 → 16.56.1-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.
- package/README.md +31 -0
- 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/autocomplete.css.d.ts +1 -0
- 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-blau-shell.d.ts +10 -0
- package/dist/logo-blau-shell.js +25 -0
- package/dist/logo-blau.d.ts +1 -1
- package/dist/logo-blau.js +25 -40
- package/dist/logo-common.d.ts +0 -1
- package/dist/logo-esimflag-shell.d.ts +10 -0
- package/dist/logo-esimflag-shell.js +25 -0
- package/dist/logo-esimflag.d.ts +1 -1
- package/dist/logo-esimflag.js +11 -26
- package/dist/logo-movistar-new-shell.d.ts +10 -0
- package/dist/logo-movistar-new-shell.js +25 -0
- package/dist/logo-movistar-new.d.ts +1 -1
- package/dist/logo-movistar-new.js +84 -103
- package/dist/logo-movistar-shell.d.ts +10 -0
- package/dist/logo-movistar-shell.js +25 -0
- package/dist/logo-movistar.d.ts +1 -1
- package/dist/logo-movistar.js +16 -31
- package/dist/logo-o2-new-shell.d.ts +8 -0
- package/dist/logo-o2-new-shell.js +24 -0
- package/dist/logo-o2-new.d.ts +1 -1
- package/dist/logo-o2-new.js +6 -13
- package/dist/logo-o2-shell.d.ts +8 -0
- package/dist/logo-o2-shell.js +24 -0
- package/dist/logo-o2.d.ts +1 -1
- package/dist/logo-o2.js +6 -13
- package/dist/logo-telefonica-shell.d.ts +10 -0
- package/dist/logo-telefonica-shell.js +25 -0
- package/dist/logo-telefonica.d.ts +1 -1
- package/dist/logo-telefonica.js +11 -26
- package/dist/logo-tu-shell.d.ts +8 -0
- package/dist/logo-tu-shell.js +24 -0
- package/dist/logo-tu.d.ts +1 -1
- package/dist/logo-tu.js +10 -14
- package/dist/logo-vivo-shell.d.ts +10 -0
- package/dist/logo-vivo-shell.js +25 -0
- package/dist/logo-vivo.d.ts +1 -1
- package/dist/logo-vivo.js +11 -26
- package/dist/logo.css-mistica.js +9 -9
- package/dist/logo.js +223 -205
- package/dist/media-queries.css-mistica.js +13 -13
- 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/select.css.d.ts +1 -0
- 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-base.css.d.ts +1 -0
- package/dist/text-field-base.js +52 -51
- package/dist/text-field-components.css-mistica.js +20 -17
- package/dist/text-field-components.css.d.ts +1 -0
- package/dist/text-field-components.d.ts +2 -1
- package/dist/text-field-components.js +25 -25
- 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-blau-shell.js +16 -0
- package/dist-es/logo-blau.js +36 -51
- package/dist-es/logo-esimflag-shell.js +16 -0
- package/dist-es/logo-esimflag.js +13 -28
- package/dist-es/logo-movistar-new-shell.js +16 -0
- package/dist-es/logo-movistar-new.js +86 -105
- package/dist-es/logo-movistar-shell.js +16 -0
- package/dist-es/logo-movistar.js +18 -33
- package/dist-es/logo-o2-new-shell.js +15 -0
- package/dist-es/logo-o2-new.js +7 -14
- package/dist-es/logo-o2-shell.js +15 -0
- package/dist-es/logo-o2.js +7 -14
- package/dist-es/logo-telefonica-shell.js +16 -0
- package/dist-es/logo-telefonica.js +13 -28
- package/dist-es/logo-tu-shell.js +15 -0
- package/dist-es/logo-tu.js +12 -16
- package/dist-es/logo-vivo-shell.js +16 -0
- package/dist-es/logo-vivo.js +13 -28
- package/dist-es/logo.css-mistica.js +7 -7
- package/dist-es/logo.js +221 -203
- package/dist-es/media-queries.css-mistica.js +3 -3
- 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-base.js +52 -51
- package/dist-es/text-field-components.css-mistica.js +4 -4
- package/dist-es/text-field-components.js +52 -52
- 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/analytics.md +145 -0
- package/doc/components.md +730 -0
- package/doc/design-tokens.md +199 -0
- package/doc/fonts.md +169 -0
- package/doc/forms.md +177 -0
- package/doc/images/layout/box.svg +6 -0
- package/doc/images/layout/grid-layout-desktop-5-4.svg +8 -0
- package/doc/images/layout/grid-layout-desktop-6-6.svg +8 -0
- package/doc/images/layout/grid-layout-desktop-8-4.svg +8 -0
- package/doc/images/layout/grid-layout-desktop.svg +16 -0
- package/doc/images/layout/grid-layout-mobile-5-4.svg +9 -0
- package/doc/images/layout/grid-layout-mobile-6-6.svg +9 -0
- package/doc/images/layout/grid-layout-mobile-8-4.svg +9 -0
- package/doc/images/layout/grid-layout-mobile.svg +5 -0
- package/doc/images/layout/grid-layout-tablet-5-4.svg +8 -0
- package/doc/images/layout/grid-layout-tablet-6-6.svg +8 -0
- package/doc/images/layout/grid-layout-tablet-8-4.svg +8 -0
- package/doc/images/layout/grid-layout-tablet.svg +5 -0
- package/doc/images/layout/header-layout-desktop.svg +6 -0
- package/doc/images/layout/header-layout-mobile.svg +6 -0
- package/doc/images/layout/header-layout-tablet.svg +6 -0
- package/doc/images/layout/inline-around.svg +6 -0
- package/doc/images/layout/inline-between.svg +6 -0
- package/doc/images/layout/inline-evenly.svg +6 -0
- package/doc/images/layout/inline.svg +6 -0
- package/doc/images/layout/master-detail-layout-desktop.svg +8 -0
- package/doc/images/layout/master-detail-layout-mobile-detail.svg +6 -0
- package/doc/images/layout/master-detail-layout-mobile-master.svg +6 -0
- package/doc/images/layout/negative-box-ok-outline.svg +17 -0
- package/doc/images/layout/negative-box-ok-preview.svg +11 -0
- package/doc/images/layout/negative-box-wrong-outline.svg +14 -0
- package/doc/images/layout/negative-box-wrong-preview.svg +11 -0
- package/doc/images/layout/responsive-layout-desktop.svg +4 -0
- package/doc/images/layout/responsive-layout-mobile.svg +4 -0
- package/doc/images/layout/responsive-layout-tablet.svg +4 -0
- package/doc/images/layout/stack.svg +8 -0
- package/doc/images/layout/vertical-rhythm.png +0 -0
- package/doc/layout.md +527 -0
- package/doc/llms.md +258 -0
- package/doc/lottie.md +17 -0
- package/doc/migration-guide.md +76 -0
- package/doc/patterns.md +546 -0
- package/doc/sheet.md +122 -0
- package/doc/testing.md +43 -0
- package/doc/texts.md +42 -0
- package/doc/theme-config.md +124 -0
- package/package.json +4 -4
package/doc/llms.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# @telefonica/mistica
|
|
2
|
+
|
|
3
|
+
> React components library for Telefonica Design System (Mistica). Provides UI components, layout primitives,
|
|
4
|
+
> form fields, theming, analytics, and more for building web applications following Telefonica's design
|
|
5
|
+
> guidelines.
|
|
6
|
+
|
|
7
|
+
## Documentation location
|
|
8
|
+
|
|
9
|
+
This file is the main entry point. All docs live at:
|
|
10
|
+
|
|
11
|
+
- **Installed package**: `node_modules/@telefonica/mistica/doc/`
|
|
12
|
+
- **GitHub fallback** (use when node_modules is not available):
|
|
13
|
+
`https://github.com/Telefonica/mistica-web/tree/master/doc`
|
|
14
|
+
|
|
15
|
+
If you cannot find a documentation file in `node_modules`, fetch the equivalent file from the GitHub
|
|
16
|
+
repository at `https://github.com/Telefonica/mistica-web/blob/master/doc/<filename>`.
|
|
17
|
+
|
|
18
|
+
## Critical Rules
|
|
19
|
+
|
|
20
|
+
1. **NEVER hardcode colors.** Always use `skinVars.colors.*` design tokens from `@telefonica/mistica`.
|
|
21
|
+
2. **Try not to use raw `<div>` for layout.** Use Mistica layout components: `Box`, `Stack`, `Inline`,
|
|
22
|
+
`Align`, `ResponsiveLayout`, `GridLayout`, `Grid`.
|
|
23
|
+
3. **NEVER set font sizes manually.** Use text components: `Text1`-`Text10`, `Title1`-`Title4`.
|
|
24
|
+
4. **NEVER set border radius manually.** Use `skinVars.borderRadii.*` or Mistica components that handle it
|
|
25
|
+
automatically.
|
|
26
|
+
5. **Always wrap your app** with `<ThemeContextProvider>` and import `@telefonica/mistica/css/mistica.css`.
|
|
27
|
+
6. **Always namespace React hooks**: `React.useState`, `React.useEffect`, `React.useRef`.
|
|
28
|
+
7. **Add `'use client';`** directive to client components when using Next.js app router.
|
|
29
|
+
8. Use `skinVars.rawColors.*` (not `skinVars.colors.*`) when applying alpha with `applyAlpha`.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
yarn add @telefonica/mistica
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
or
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
npm install @telefonica/mistica
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
'use client';
|
|
47
|
+
|
|
48
|
+
import '@telefonica/mistica/css/mistica.css';
|
|
49
|
+
import {
|
|
50
|
+
ThemeContextProvider,
|
|
51
|
+
getMovistarSkin,
|
|
52
|
+
ResponsiveLayout,
|
|
53
|
+
Box,
|
|
54
|
+
Stack,
|
|
55
|
+
Title1,
|
|
56
|
+
Text2,
|
|
57
|
+
ButtonPrimary,
|
|
58
|
+
} from '@telefonica/mistica';
|
|
59
|
+
|
|
60
|
+
const misticaTheme = {
|
|
61
|
+
skin: getMovistarSkin(),
|
|
62
|
+
i18n: {locale: 'es-ES', phoneNumberFormattingRegionCode: 'ES'},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const App = () => (
|
|
66
|
+
<ThemeContextProvider theme={misticaTheme}>
|
|
67
|
+
<ResponsiveLayout>
|
|
68
|
+
<Box paddingY={24}>
|
|
69
|
+
<Stack space={16}>
|
|
70
|
+
<Title1 as="h1">Hello Mistica</Title1>
|
|
71
|
+
<Text2 regular as="p">
|
|
72
|
+
Build beautiful UIs with design system components.
|
|
73
|
+
</Text2>
|
|
74
|
+
<ButtonPrimary onPress={() => console.log('clicked')}>Get Started</ButtonPrimary>
|
|
75
|
+
</Stack>
|
|
76
|
+
</Box>
|
|
77
|
+
</ResponsiveLayout>
|
|
78
|
+
</ThemeContextProvider>
|
|
79
|
+
);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Theme Configuration
|
|
83
|
+
|
|
84
|
+
The `theme` prop in `ThemeContextProvider` is mandatory. Only `skin` and `i18n` are required:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
type ThemeConfig = {
|
|
88
|
+
skin: Skin;
|
|
89
|
+
colorScheme?: 'light' | 'dark' | 'auto'; // default: 'auto'
|
|
90
|
+
i18n: {locale: Locale; phoneNumberFormattingRegionCode: RegionCode};
|
|
91
|
+
platformOverrides?: {platform?: 'ios' | 'android'; insideNovumNativeApp?: boolean; userAgent?: string};
|
|
92
|
+
texts?: Partial<Dictionary>;
|
|
93
|
+
analytics?: {
|
|
94
|
+
logEvent: (event: TrackingEvent) => Promise<void>;
|
|
95
|
+
eventFormat?: 'universal-analytics' | 'google-analytics-4';
|
|
96
|
+
};
|
|
97
|
+
Link?: LinkComponent;
|
|
98
|
+
useHrefDecorator?: () => (href: string) => string;
|
|
99
|
+
preventCopyInFormFields?: boolean;
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Available skins: `getMovistarSkin()`, `getVivoSkin()`, `getO2Skin()`, `getTelefonicaSkin()`, `getBlauSkin()`,
|
|
104
|
+
`getTuSkin()`, and others via `getSkinByName()`. You can also create a custom skin.
|
|
105
|
+
|
|
106
|
+
Built-in Link integrations: `Next12`, `Next13`, `Next14`, `ReactRouter5`, `ReactRouter6`.
|
|
107
|
+
|
|
108
|
+
The `theme` object should be constant (outside the component) or memoized with `React.useMemo`.
|
|
109
|
+
|
|
110
|
+
### Next.js optimization
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
experimental: {
|
|
114
|
+
optimizePackageImports: ['@telefonica/mistica'];
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Standard Page Layout
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<MainNavigationBar sections={[...]} selectedIndex={0} />
|
|
122
|
+
<HeaderLayout header={<Header pretitle="Section" title="Page Title" description="..." />} />
|
|
123
|
+
<ResponsiveLayout>
|
|
124
|
+
<Box paddingY={24}>
|
|
125
|
+
<Stack space={32}>
|
|
126
|
+
{/* Section with 16px element spacing */}
|
|
127
|
+
<Stack space={16}>
|
|
128
|
+
<Title1 as="h2">Section</Title1>
|
|
129
|
+
<Text2 regular as="p">Content</Text2>
|
|
130
|
+
</Stack>
|
|
131
|
+
{/* List section */}
|
|
132
|
+
<Stack space={16}>
|
|
133
|
+
<Title1 as="h2">List</Title1>
|
|
134
|
+
<NegativeBox>
|
|
135
|
+
<RowList>
|
|
136
|
+
<Row title="Item" onPress={() => {}} />
|
|
137
|
+
</RowList>
|
|
138
|
+
</NegativeBox>
|
|
139
|
+
</Stack>
|
|
140
|
+
</Stack>
|
|
141
|
+
</Box>
|
|
142
|
+
</ResponsiveLayout>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Vertical rhythm: containers 24px padding, sections 32px spacing, elements 16px spacing.
|
|
146
|
+
|
|
147
|
+
## Component Categories
|
|
148
|
+
|
|
149
|
+
### Core Layout Primitives
|
|
150
|
+
|
|
151
|
+
`Box`, `Stack`, `Inline`, `Align`, `Grid`/`GridItem`, `NegativeBox`, `Divider`, `HorizontalScroll`, `Boxed`,
|
|
152
|
+
`Overlay`, `StackingGroup`
|
|
153
|
+
|
|
154
|
+
### Page Layouts
|
|
155
|
+
|
|
156
|
+
`ResponsiveLayout`, `HeaderLayout`, `GridLayout`, `MainSectionHeaderLayout`, `MasterDetailLayout`,
|
|
157
|
+
`FixedFooterLayout`, `ButtonFixedFooterLayout`, `ButtonLayout`, `DoubleField`
|
|
158
|
+
|
|
159
|
+
### Buttons
|
|
160
|
+
|
|
161
|
+
`ButtonPrimary`, `ButtonSecondary`, `ButtonDanger`, `ButtonLink`, `ButtonLinkDanger`, `ButtonGroup`,
|
|
162
|
+
`ButtonLayout`, `IconButton`, `ToggleIconButton`
|
|
163
|
+
|
|
164
|
+
### Text
|
|
165
|
+
|
|
166
|
+
`Text1`-`Text10`, `Title1`-`Title4`, `TextLink`
|
|
167
|
+
|
|
168
|
+
### Cards
|
|
169
|
+
|
|
170
|
+
`DataCard`, `MediaCard`, `CoverCard`, `NakedCard` (each with size variants: `'default'`, `'snap'`,
|
|
171
|
+
`'display'`)
|
|
172
|
+
|
|
173
|
+
### Forms
|
|
174
|
+
|
|
175
|
+
`Form`, `TextField`, `EmailField`, `PhoneNumberField`, `PasswordField`, `Select`, `DateField`, `IntegerField`,
|
|
176
|
+
`DecimalField`, `CreditCardFields`, `IbanField`, `SearchField`, `PinField`, `Switch`, `Checkbox`,
|
|
177
|
+
`RadioGroup`/`RadioButton`, `DoubleField`, `Autocomplete`, `FileUpload`
|
|
178
|
+
|
|
179
|
+
### Lists
|
|
180
|
+
|
|
181
|
+
`RowList`/`Row`, `BoxedRowList`/`BoxedRow`, `UnorderedList`, `OrderedList`, `ListItem`
|
|
182
|
+
|
|
183
|
+
### Navigation
|
|
184
|
+
|
|
185
|
+
`MainNavigationBar`, `NavigationBar`, `FunnelNavigationBar`, `NavigationBarAction`,
|
|
186
|
+
`NavigationBarActionGroup`, `Tabs`, `NavigationBreadcrumbs`
|
|
187
|
+
|
|
188
|
+
### Headers
|
|
189
|
+
|
|
190
|
+
`Header`, `HeaderLayout`, `MainSectionHeader`, `MainSectionHeaderLayout`
|
|
191
|
+
|
|
192
|
+
### Feedback
|
|
193
|
+
|
|
194
|
+
`SuccessFeedbackScreen`, `ErrorFeedbackScreen`, `InfoFeedbackScreen`, `Snackbar` (via `useSnackbar`),
|
|
195
|
+
`alert`/`confirm`/`dialog` (via `useDialog`)
|
|
196
|
+
|
|
197
|
+
### Loading
|
|
198
|
+
|
|
199
|
+
`SkeletonLine`, `SkeletonText`, `SkeletonCircle`, `SkeletonRow`, `SkeletonRectangle`, `LoadingScreen`,
|
|
200
|
+
`BrandLoadingScreen`, `Spinner`, `LoadingBar`
|
|
201
|
+
|
|
202
|
+
### Data Display
|
|
203
|
+
|
|
204
|
+
`Tag`, `Badge`, `Chip`, `Avatar`, `Image`, `Video`, `Table`, `Divider`, `Callout`, `ProgressBar`,
|
|
205
|
+
`ProgressBarStepped`, `Stepper`, `Meter`, `Rating`, `InfoRating`, `Timer`, `TextTimer`,
|
|
206
|
+
`Timeline`/`TimelineItem`, `Counter`
|
|
207
|
+
|
|
208
|
+
### Containers / Surfaces
|
|
209
|
+
|
|
210
|
+
`Boxed`, `Carousel`, `CenteredCarousel`, `Slideshow`, `Hero`, `CoverHero`, `EmptyState`, `EmptyStateCard`,
|
|
211
|
+
`Accordion`/`AccordionItem`, `BoxedAccordion`/`BoxedAccordionItem`, `Drawer`, `Tooltip`, `Popover`,
|
|
212
|
+
`Menu`/`MenuItem`/`MenuSection`, `Sheet`/`SheetRoot`/`showSheet`
|
|
213
|
+
|
|
214
|
+
### Media
|
|
215
|
+
|
|
216
|
+
`Circle`, `Square`, `StackingGroup`, `Logo`
|
|
217
|
+
|
|
218
|
+
### Icons
|
|
219
|
+
|
|
220
|
+
~2000 icons following the pattern `Icon{Name}{Variant}` where Variant is `Regular`, `Filled`, or `Light`. All
|
|
221
|
+
accept `size` and `color` props. Use `color="currentColor"` inside buttons/navigation.
|
|
222
|
+
|
|
223
|
+
### Hooks
|
|
224
|
+
|
|
225
|
+
`useTheme`, `useScreenSize`, `useDialog`, `useSnackbar`, `useForm`, `useThemeVariant`, `useIsInViewport`,
|
|
226
|
+
`useElementDimensions`, `useWindowSize`, `useTrackingConfig`, `useCarouselContext`
|
|
227
|
+
|
|
228
|
+
## Design Tokens
|
|
229
|
+
|
|
230
|
+
All tokens via `skinVars` from `@telefonica/mistica`:
|
|
231
|
+
|
|
232
|
+
- **Colors**: `skinVars.colors.*` (286 tokens for backgrounds, text, borders, controls, status, tags)
|
|
233
|
+
- **Raw colors**: `skinVars.rawColors.*` (same tokens as RGB values, for use with `applyAlpha`)
|
|
234
|
+
- **Border radii**: `skinVars.borderRadii.*` (container, button, input, popup, chip, sheet, avatar, tag, etc.)
|
|
235
|
+
- **Text presets**: Handled by text components, not accessed directly
|
|
236
|
+
|
|
237
|
+
## Docs
|
|
238
|
+
|
|
239
|
+
- [Components reference](./components.md): full component catalog with props and usage examples
|
|
240
|
+
- [Design tokens](./design-tokens.md): skinVars colors, rawColors, applyAlpha, border radii, text presets,
|
|
241
|
+
theme variants
|
|
242
|
+
- [Patterns and best practices](./patterns.md): page composition, layout dos/don'ts, color rules, responsive
|
|
243
|
+
patterns, form patterns, card patterns, list patterns, skeleton loading, funnel flows, routing integration,
|
|
244
|
+
dark mode
|
|
245
|
+
- [Theme configuration](./theme-config.md): full ThemeConfig reference, Link component setup, custom skins
|
|
246
|
+
- [Layout](./layout.md): Core layout primitives (Box, Stack, Inline, Align, Grid/GridItem, NegativeBox,
|
|
247
|
+
Divider, HorizontalScroll, Boxed, Overlay, StackingGroup) and page layouts (ResponsiveLayout, HeaderLayout,
|
|
248
|
+
GridLayout, MasterDetailLayout, FixedFooterLayout, ButtonFixedFooterLayout, ButtonLayout, DoubleField),
|
|
249
|
+
vertical rhythm
|
|
250
|
+
- [Forms](./forms.md): Form component, all form field types, DoubleField, useForm hook
|
|
251
|
+
- [Analytics](./analytics.md): trackingEvent prop, logEvent setup, default tracking, GA4 support,
|
|
252
|
+
TrackingConfig
|
|
253
|
+
- [Fonts](./fonts.md): font family setup, system fonts, custom fonts, weight mapping, dynamic font sizes
|
|
254
|
+
- [Texts](./texts.md): customizable text tokens, Dictionary type, translate function
|
|
255
|
+
- [Sheets](./sheet.md): predefined sheets, SheetRoot, showSheet API, native webview integration, custom sheets
|
|
256
|
+
- [Testing](./testing.md): NODE_ENV, unit tests, acceptance tests, isRunningAcceptanceTest
|
|
257
|
+
- [Lottie](./lottie.md): optimizing bundle size with lottie-web light build
|
|
258
|
+
- [Migration guide](./migration-guide.md): cards ecosystem migration (v16), v12 to v13 migration
|
package/doc/lottie.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Optimizing bundles size when using Lotties
|
|
2
|
+
|
|
3
|
+
You may notice that when using `BrandLoadingScreen` component, the `lottie-web` package is imported lazily.
|
|
4
|
+
This package is a dependency of the `lottie-react` library that we use to render Lottie files.
|
|
5
|
+
|
|
6
|
+
There are several reports mentioning that `lottie-web` is quiet big, so their developers have created a
|
|
7
|
+
"light" version of it, that only supports some of the features
|
|
8
|
+
([Link](https://github.com/airbnb/lottie-web/wiki/Lottie-Light)).
|
|
9
|
+
|
|
10
|
+
If your use case of `lottie-react` library is not too complex and this light version covers your needs, you
|
|
11
|
+
can patch their library to import the `lottie-web` functionalities from `lottie-web/build/player/lottie_light`
|
|
12
|
+
instead. This will reduce the size of the library considerably.
|
|
13
|
+
|
|
14
|
+
You can refer to this [example patch](../.yarn/patches/lottie-react-npm-2.4.0-d4d95c55aa.patch) generated by
|
|
15
|
+
using `yarn patch` to understand how to update the `lottie-react` library. There is also
|
|
16
|
+
[a pull request](https://github.com/Gamote/lottie-react/pull/86) in their GitHub repository where you can see
|
|
17
|
+
the required diff in the `lottie-react` source code.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
## Migration Guide for the New Cards Ecosystem (Starting from Mistica 16.xx.xx)
|
|
2
|
+
|
|
3
|
+
The changes introduced in this version are backwards compatible; however, several components and props have
|
|
4
|
+
been deprecated. To ensure your code remains compatible with future major updates, please update your
|
|
5
|
+
implementation to replace the deprecated components and props as outlined below. This will prepare your
|
|
6
|
+
codebase for the eventual removal of these deprecated features.
|
|
7
|
+
|
|
8
|
+
### Card Components
|
|
9
|
+
|
|
10
|
+
- The `PosterCard` component has been deprecated. Use `<CoverCard size="default" />`.
|
|
11
|
+
- The `DisplayMediaCard` component has been deprecated. Use `<CoverCard size="display" />`.
|
|
12
|
+
- The `SmallNakedCard` component has been deprecated. Use `<NakedCard size="snap" />`.
|
|
13
|
+
- The `SnapCard` component has been deprecated. Use `<DataCard size="snap" />`.
|
|
14
|
+
- The `DisplayDataCard` component has been deprecated. Use `<DataCard size="display" />`.
|
|
15
|
+
- The `HighlightCard` component has been deprecated. Use `<MediaCard mediaPosition="right" />`.
|
|
16
|
+
|
|
17
|
+
### Card Props
|
|
18
|
+
|
|
19
|
+
- The `poster` prop has been deprecated. Use `imageSrc`. The `imageSrc` will be used as the poster when a
|
|
20
|
+
video is provided.
|
|
21
|
+
- The `media` prop has been deprecated. Use `imageSrc`, `imageSrcSet`, or `videoSrc` and related props like
|
|
22
|
+
`mediaAspectRatio`.
|
|
23
|
+
- The `extra` prop has been deprecated. Use `slot`.
|
|
24
|
+
- The `actions` prop has been deprecated. Use `topActions`.
|
|
25
|
+
- The `button` prop has been deprecated. Use `buttonPrimary`.
|
|
26
|
+
- The `secondaryButton` prop has been deprecated. Use `buttonSecondary`.
|
|
27
|
+
- The `isInverse` prop has been deprecated. Use `variant`.
|
|
28
|
+
|
|
29
|
+
### Behavior changes
|
|
30
|
+
|
|
31
|
+
- A card with onPress and buttons will show the Footer, containing the buttons, even if it was set to `false`
|
|
32
|
+
via props.
|
|
33
|
+
- Cards now accept 3 kind of buttons: `buttonPrimary`, `buttonSecondary`, and `buttonLink`. You must use at
|
|
34
|
+
most 2 buttons at the same time.
|
|
35
|
+
- Deprecated cards have a default `slotAlignment` of `bottom`. New cards have a default `slotAlignment` of
|
|
36
|
+
`content`. If you want to keep the previous behavior, you must set `slotAlignment="bottom"` explicitly.
|
|
37
|
+
|
|
38
|
+
## Migration Guide from mistica 12.x to mistica 13.x
|
|
39
|
+
|
|
40
|
+
- First of all, we recommend to run the [`theme-colors-codemod.js`](../codemods/theme-colors-codemod.js). This
|
|
41
|
+
codemod will replace all the usages of mistica colors from `Theme` (`useTheme`) with the css variables
|
|
42
|
+
defined in `skinVars.colors`.
|
|
43
|
+
- If you aren't familiar with codemods, take a look at
|
|
44
|
+
[jscodeshift doc](https://github.com/facebook/jscodeshift)
|
|
45
|
+
- To run the codemod execute:
|
|
46
|
+
```sh
|
|
47
|
+
npx jscodeshift -t codemods/theme-colors-codemod.js <path-to-your-code>
|
|
48
|
+
```
|
|
49
|
+
- `ThemeConfig.colorScheme` is now `'auto'` by default, this means that mistica will automatically detect the
|
|
50
|
+
user's preferred color scheme and apply it. If you want to force a color scheme in your app, you can set it
|
|
51
|
+
to `'light'` or `'dark'` instead.
|
|
52
|
+
- If you were using the `borderLight` and/or `borderDark` colors, you'll need to replace them with `borderLow`
|
|
53
|
+
and `borderHigh` respectively.
|
|
54
|
+
- If you were applying alpha to mistica colors using some custom function, you'll need to use the new
|
|
55
|
+
`applyAlpha` function from mistica instead.
|
|
56
|
+
- Don't use `applyAlpha` with `skinVars.colors`, use it with `skinVars.rawColors` instead.
|
|
57
|
+
- Mistica doesn't ship with builtin jss anymore. If you are using `createUseStyles` in your app, you will need
|
|
58
|
+
to install `jss` and `react-jss` as dependencies of your app.
|
|
59
|
+
- Keep in mind that the `jss` that mistica was using in versions 12 and below had some plugins that you may
|
|
60
|
+
still need in your app if you have decided to keep using `jss`. In that case, take a look at mistica
|
|
61
|
+
[`jss` setup in v12](https://github.com/Telefonica/mistica-web/blob/v12.13.0/src/jss.tsx#L15-L26) because
|
|
62
|
+
you may need some similar setup.
|
|
63
|
+
- From version 13, mistica ships with a css file that your app must serve. You can find it in
|
|
64
|
+
`@telefonica/mistica/css/mistica.css`. The way of serve this css may be different depending on your bundler
|
|
65
|
+
setup, but the most common way is importing it like this:
|
|
66
|
+
```js
|
|
67
|
+
import '@telefonica/mistica/css/mistica.css';
|
|
68
|
+
```
|
|
69
|
+
- If you were using the `extra` prop in `DataCard`, `MediaCard` and/or `SnapCard` components, you may need to
|
|
70
|
+
adjust some paddings, because previous versions of mistica were adding a top padding of 16px.
|
|
71
|
+
- Some icons changes:
|
|
72
|
+
- If you were using the `chevron-top-regular` icon, replace the usages with `chevron-up-regular`
|
|
73
|
+
- If you were using the `play` or `pause` icons, replace them with `play-circle` and `pause-circle`
|
|
74
|
+
respectively.
|
|
75
|
+
- The `small` prop has been removed from `TextLink`. Wrapping `TextLink` with a `<Text2 regular>` should be
|
|
76
|
+
equivalent in font size, but with a small variation in line height.
|