@telefonica/mistica 16.60.0 → 16.62.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-fixed-footer-layout.d.ts +2 -1
- package/dist/button-fixed-footer-layout.js +4 -3
- 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 +38 -38
- 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/fixed-footer-layout.d.ts +6 -1
- package/dist/fixed-footer-layout.js +29 -28
- 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/image.js +8 -1
- 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 +19 -19
- 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-fixed-footer-layout.js +12 -11
- 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/fixed-footer-layout.js +57 -56
- 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/image.js +8 -1
- 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/components.md +19 -0
- package/doc/figma-mcp.md +136 -0
- package/doc/layout.md +20 -1
- package/doc/llms.md +18 -0
- package/doc/patterns.md +6 -17
- package/package.json +13 -1
- package/src/accordion.css.ts +121 -0
- package/src/accordion.tsx +366 -0
- package/src/align.css.ts +7 -0
- package/src/align.tsx +32 -0
- package/src/autocomplete.css.ts +62 -0
- package/src/autocomplete.tsx +239 -0
- package/src/avatar.css.ts +14 -0
- package/src/avatar.tsx +120 -0
- package/src/badge.css.ts +51 -0
- package/src/badge.tsx +79 -0
- package/src/box.css.ts +51 -0
- package/src/box.tsx +114 -0
- package/src/boxed.css.ts +132 -0
- package/src/boxed.tsx +153 -0
- package/src/button-fixed-footer-layout.tsx +65 -0
- package/src/button-group.css.ts +75 -0
- package/src/button-group.tsx +91 -0
- package/src/button-layout.css.ts +162 -0
- package/src/button-layout.tsx +91 -0
- package/src/button.css.ts +758 -0
- package/src/button.tsx +632 -0
- package/src/callout.css.ts +50 -0
- package/src/callout.tsx +147 -0
- package/src/card-cover.tsx +242 -0
- package/src/card-data.tsx +152 -0
- package/src/card-internal.css.ts +271 -0
- package/src/card-internal.tsx +1724 -0
- package/src/card-media.tsx +157 -0
- package/src/card-naked.tsx +63 -0
- package/src/carousel.css.ts +522 -0
- package/src/carousel.tsx +1300 -0
- package/src/checkbox.css.ts +94 -0
- package/src/checkbox.tsx +192 -0
- package/src/chip.css.ts +204 -0
- package/src/chip.tsx +191 -0
- package/src/circle.css.ts +14 -0
- package/src/circle.tsx +52 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
- package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
- package/src/community/__stories__/blocks-story.tsx +272 -0
- package/src/community/__stories__/example-component-story.tsx +15 -0
- package/src/community/__stories__/index-story.tsx +154 -0
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
- package/src/community/advanced-data-card.css.ts +271 -0
- package/src/community/advanced-data-card.tsx +431 -0
- package/src/community/blocks.css.ts +12 -0
- package/src/community/blocks.tsx +290 -0
- package/src/community/example-component.css.ts +7 -0
- package/src/community/example-component.tsx +17 -0
- package/src/community/index.tsx +10 -0
- package/src/counter.css.ts +150 -0
- package/src/counter.tsx +215 -0
- package/src/cover-hero-media.tsx +39 -0
- package/src/cover-hero.css.ts +133 -0
- package/src/cover-hero.tsx +262 -0
- package/src/credit-card-expiration-field.tsx +187 -0
- package/src/credit-card-fields.tsx +56 -0
- package/src/credit-card-number-field.css.ts +47 -0
- package/src/credit-card-number-field.tsx +245 -0
- package/src/cvv-field.tsx +169 -0
- package/src/date-field.css.ts +14 -0
- package/src/date-field.tsx +130 -0
- package/src/date-time-field.tsx +141 -0
- package/src/date-time-picker.css.ts +126 -0
- package/src/date-time-picker.tsx +188 -0
- package/src/decimal-field.tsx +160 -0
- package/src/desktop-container-type-context.tsx +15 -0
- package/src/dialog-context.tsx +81 -0
- package/src/dialog.css.ts +155 -0
- package/src/dialog.tsx +423 -0
- package/src/divider.css.ts +10 -0
- package/src/divider.tsx +11 -0
- package/src/double-field.css.ts +33 -0
- package/src/double-field.tsx +71 -0
- package/src/drawer.css.ts +123 -0
- package/src/drawer.tsx +304 -0
- package/src/email-field.tsx +76 -0
- package/src/empty-state-card.css.ts +40 -0
- package/src/empty-state-card.tsx +92 -0
- package/src/empty-state.css.ts +119 -0
- package/src/empty-state.tsx +141 -0
- package/src/fade-in.css.ts +12 -0
- package/src/fade-in.tsx +40 -0
- package/src/feedback.css.ts +119 -0
- package/src/feedback.tsx +432 -0
- package/src/file-upload.css.ts +156 -0
- package/src/file-upload.tsx +612 -0
- package/src/fixed-footer-layout.css.ts +96 -0
- package/src/fixed-footer-layout.tsx +227 -0
- package/src/fixed-to-top.tsx +21 -0
- package/src/focus-trap.tsx +17 -0
- package/src/form-context.tsx +198 -0
- package/src/form.css.ts +5 -0
- package/src/form.tsx +287 -0
- package/src/grid-layout.css.ts +68 -0
- package/src/grid-layout.tsx +201 -0
- package/src/grid.css.ts +203 -0
- package/src/grid.tsx +241 -0
- package/src/header.css.ts +30 -0
- package/src/header.tsx +319 -0
- package/src/hero.css.ts +71 -0
- package/src/hero.tsx +318 -0
- package/src/hooks.tsx +313 -0
- package/src/horizontal-scroll.css.ts +43 -0
- package/src/horizontal-scroll.tsx +18 -0
- package/src/iban-field.tsx +218 -0
- package/src/icon-button.css.ts +561 -0
- package/src/icon-button.tsx +221 -0
- package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
- package/src/icons/icon-amex.tsx +40 -0
- package/src/icons/icon-chevron.css.ts +23 -0
- package/src/icons/icon-chevron.tsx +150 -0
- package/src/icons/icon-cvv-amex.tsx +31 -0
- package/src/icons/icon-cvv-visa-mc.tsx +31 -0
- package/src/icons/icon-error.css.ts +27 -0
- package/src/icons/icon-error.tsx +207 -0
- package/src/icons/icon-info.tsx +86 -0
- package/src/icons/icon-mastercard.tsx +36 -0
- package/src/icons/icon-success-vivo-new.tsx +51 -0
- package/src/icons/icon-success-vivo.tsx +36 -0
- package/src/icons/icon-success.tsx +211 -0
- package/src/icons/icon-visa.tsx +32 -0
- package/src/image.css.ts +48 -0
- package/src/image.tsx +352 -0
- package/src/index.tsx +2466 -0
- package/src/inline.css.ts +131 -0
- package/src/inline.tsx +135 -0
- package/src/integer-field.tsx +93 -0
- package/src/list.css.ts +281 -0
- package/src/list.tsx +963 -0
- package/src/loading-bar.css.ts +69 -0
- package/src/loading-bar.tsx +25 -0
- package/src/loading-screen.css.ts +114 -0
- package/src/loading-screen.tsx +376 -0
- package/src/logo-blau-shell.tsx +30 -0
- package/src/logo-blau.tsx +60 -0
- package/src/logo-common.tsx +29 -0
- package/src/logo-esimflag-shell.tsx +30 -0
- package/src/logo-esimflag.tsx +56 -0
- package/src/logo-movistar-new-shell.tsx +30 -0
- package/src/logo-movistar-new.tsx +85 -0
- package/src/logo-movistar-shell.tsx +30 -0
- package/src/logo-movistar.tsx +63 -0
- package/src/logo-o2-new-shell.tsx +26 -0
- package/src/logo-o2-new.tsx +27 -0
- package/src/logo-o2-shell.tsx +26 -0
- package/src/logo-o2.tsx +27 -0
- package/src/logo-telefonica-shell.tsx +30 -0
- package/src/logo-telefonica.tsx +95 -0
- package/src/logo-tu-shell.tsx +26 -0
- package/src/logo-tu.tsx +28 -0
- package/src/logo-vivo-shell.tsx +30 -0
- package/src/logo-vivo.tsx +53 -0
- package/src/logo.css.ts +33 -0
- package/src/logo.tsx +313 -0
- package/src/master-detail-layout.tsx +28 -0
- package/src/maybe-dismissable.css.ts +37 -0
- package/src/maybe-dismissable.tsx +58 -0
- package/src/media-queries.css.ts +67 -0
- package/src/menu.css.ts +132 -0
- package/src/menu.tsx +468 -0
- package/src/meter.tsx +516 -0
- package/src/modal-context-provider.tsx +45 -0
- package/src/month-field.tsx +124 -0
- package/src/mosaic.css.ts +73 -0
- package/src/mosaic.tsx +205 -0
- package/src/navigation-bar.css.ts +558 -0
- package/src/navigation-bar.tsx +1637 -0
- package/src/navigation-breadcrumbs.css.ts +22 -0
- package/src/navigation-breadcrumbs.tsx +69 -0
- package/src/negative-box.tsx +15 -0
- package/src/nestable-context.tsx +139 -0
- package/src/overlay.tsx +86 -0
- package/src/overscroll-color-context.tsx +141 -0
- package/src/package-version.tsx +2 -0
- package/src/password-field.tsx +126 -0
- package/src/phone-number-field-lite.tsx +265 -0
- package/src/phone-number-field.tsx +171 -0
- package/src/pin-field.css.ts +90 -0
- package/src/pin-field.tsx +346 -0
- package/src/placeholder.tsx +41 -0
- package/src/popover.css.ts +8 -0
- package/src/popover.tsx +85 -0
- package/src/portal.tsx +43 -0
- package/src/progress-bar.css.ts +61 -0
- package/src/progress-bar.tsx +174 -0
- package/src/radio-button.css.ts +174 -0
- package/src/radio-button.tsx +322 -0
- package/src/rating.css.ts +128 -0
- package/src/rating.tsx +351 -0
- package/src/responsive-layout.css.ts +162 -0
- package/src/responsive-layout.tsx +106 -0
- package/src/screen-reader-only.css.ts +27 -0
- package/src/screen-reader-only.tsx +33 -0
- package/src/screen-size-context-provider.tsx +96 -0
- package/src/screen-size-context.tsx +23 -0
- package/src/search-field.tsx +126 -0
- package/src/select.css.ts +226 -0
- package/src/select.tsx +513 -0
- package/src/sheet-action-row.css.ts +33 -0
- package/src/sheet-actions-list.tsx +113 -0
- package/src/sheet-actions.tsx +95 -0
- package/src/sheet-common.css.ts +254 -0
- package/src/sheet-common.tsx +402 -0
- package/src/sheet-info.css.ts +19 -0
- package/src/sheet-info.tsx +127 -0
- package/src/sheet-native.tsx +189 -0
- package/src/sheet-radio-list.tsx +118 -0
- package/src/sheet-root.tsx +127 -0
- package/src/sheet-types.tsx +94 -0
- package/src/sheet-web.tsx +140 -0
- package/src/skeleton-base.tsx +38 -0
- package/src/skeletons.css.ts +56 -0
- package/src/skeletons.tsx +133 -0
- package/src/skins/blau.tsx +724 -0
- package/src/skins/constants.tsx +10 -0
- package/src/skins/defaults.tsx +104 -0
- package/src/skins/esimflag.tsx +728 -0
- package/src/skins/movistar-new.tsx +735 -0
- package/src/skins/movistar.tsx +740 -0
- package/src/skins/o2-new.tsx +731 -0
- package/src/skins/o2.tsx +727 -0
- package/src/skins/skin-contract.css.ts +380 -0
- package/src/skins/telefonica.tsx +768 -0
- package/src/skins/tu.tsx +741 -0
- package/src/skins/types/colors.tsx +286 -0
- package/src/skins/types/index.tsx +153 -0
- package/src/skins/utils.tsx +66 -0
- package/src/skins/vivo-new.tsx +745 -0
- package/src/skins/vivo.tsx +720 -0
- package/src/skip-link.css.ts +34 -0
- package/src/skip-link.tsx +52 -0
- package/src/slider.css.ts +181 -0
- package/src/slider.tsx +384 -0
- package/src/snackbar-context.tsx +98 -0
- package/src/snackbar-native.ts +37 -0
- package/src/snackbar.css.ts +176 -0
- package/src/snackbar.tsx +258 -0
- package/src/spinner.css.ts +66 -0
- package/src/spinner.tsx +136 -0
- package/src/sprinkles.css.ts +83 -0
- package/src/square.css.ts +15 -0
- package/src/square.tsx +55 -0
- package/src/stack.css.ts +44 -0
- package/src/stack.tsx +79 -0
- package/src/stacking-group.css.ts +15 -0
- package/src/stacking-group.tsx +82 -0
- package/src/stepper.css.ts +233 -0
- package/src/stepper.tsx +156 -0
- package/src/switch-component.css.ts +181 -0
- package/src/switch-component.tsx +187 -0
- package/src/tab-focus.tsx +68 -0
- package/src/table-actions-header.tsx +21 -0
- package/src/table-cell-text.tsx +35 -0
- package/src/table.css.ts +297 -0
- package/src/table.tsx +398 -0
- package/src/tabs.css.ts +212 -0
- package/src/tabs.tsx +263 -0
- package/src/tag.css.ts +42 -0
- package/src/tag.tsx +161 -0
- package/src/test-utils/environment/setup-ssr.tsx +10 -0
- package/src/test-utils/fail-test-on-console-error.tsx +22 -0
- package/src/test-utils/index.tsx +341 -0
- package/src/test-utils/setup-ssr-test-env.tsx +13 -0
- package/src/test-utils/ssr.tsx +197 -0
- package/src/text-field-base.css.ts +416 -0
- package/src/text-field-base.tsx +628 -0
- package/src/text-field-components.css.ts +165 -0
- package/src/text-field-components.tsx +230 -0
- package/src/text-field.tsx +118 -0
- package/src/text-link.css.ts +83 -0
- package/src/text-link.tsx +85 -0
- package/src/text-tokens.tsx +708 -0
- package/src/text.css.ts +60 -0
- package/src/text.tsx +516 -0
- package/src/theme-context-provider.tsx +370 -0
- package/src/theme-context.css.ts +3 -0
- package/src/theme-context.tsx +8 -0
- package/src/theme-variant-context.tsx +51 -0
- package/src/theme.tsx +184 -0
- package/src/time-field.tsx +99 -0
- package/src/timeline.css.ts +135 -0
- package/src/timeline.tsx +250 -0
- package/src/timer.css.ts +99 -0
- package/src/timer.tsx +420 -0
- package/src/title.tsx +119 -0
- package/src/tooltip-context-provider.tsx +57 -0
- package/src/tooltip.css.ts +106 -0
- package/src/tooltip.tsx +649 -0
- package/src/touchable.css.ts +56 -0
- package/src/touchable.tsx +355 -0
- package/src/types/font-face.d.ts +47 -0
- package/src/types/libs.d.ts +3 -0
- package/src/utils/__tests__/analytics-test.tsx +35 -0
- package/src/utils/__tests__/browser-test.tsx +28 -0
- package/src/utils/__tests__/dom-test.tsx +23 -0
- package/src/utils/__tests__/helpers-test.tsx +166 -0
- package/src/utils/analytics.tsx +28 -0
- package/src/utils/animation.tsx +201 -0
- package/src/utils/aspect-ratio-support.css.ts +28 -0
- package/src/utils/aspect-ratio-support.tsx +141 -0
- package/src/utils/browser.tsx +9 -0
- package/src/utils/color.tsx +46 -0
- package/src/utils/common.tsx +27 -0
- package/src/utils/credit-card.tsx +46 -0
- package/src/utils/css.tsx +25 -0
- package/src/utils/document-visibility.tsx +52 -0
- package/src/utils/dom.tsx +155 -0
- package/src/utils/environment.tsx +6 -0
- package/src/utils/headings.tsx +18 -0
- package/src/utils/helpers.tsx +182 -0
- package/src/utils/keys.tsx +8 -0
- package/src/utils/locale.tsx +27 -0
- package/src/utils/platform.tsx +94 -0
- package/src/utils/region-code.tsx +1 -0
- package/src/utils/renders-element.tsx +6 -0
- package/src/utils/time.tsx +22 -0
- package/src/utils/types.tsx +19 -0
- package/src/utils/utility-types.tsx +8 -0
- package/src/video.css.ts +11 -0
- package/src/video.tsx +355 -0
- package/src/vivinho-loading-animation/in-lottie.json +402 -0
- package/src/vivinho-loading-animation/index.tsx +90 -0
- package/src/vivinho-loading-animation/out-lottie.json +575 -0
- package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
- package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import ScreenReaderOnly from './screen-reader-only';
|
|
5
|
+
import * as classes from './touchable.css';
|
|
6
|
+
import {useTheme} from './hooks';
|
|
7
|
+
import {isInsideNovumNativeApp} from './utils/platform';
|
|
8
|
+
import {ENTER, SPACE} from './utils/keys';
|
|
9
|
+
import {getPrefixedDataAttributes} from './utils/dom';
|
|
10
|
+
import {redirect} from './utils/browser';
|
|
11
|
+
import * as tokens from './text-tokens';
|
|
12
|
+
|
|
13
|
+
import type {ExclusifyUnion} from './utils/utility-types';
|
|
14
|
+
import type {DataAttributes, TrackingEvent} from './utils/types';
|
|
15
|
+
import type {Location} from 'history';
|
|
16
|
+
|
|
17
|
+
export type PressHandler = (event: React.MouseEvent<HTMLElement>) => void | undefined | Promise<void>;
|
|
18
|
+
|
|
19
|
+
interface CommonProps {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
26
|
+
'aria-label'?: string;
|
|
27
|
+
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
28
|
+
dataAttributes?: DataAttributes;
|
|
29
|
+
'aria-checked'?: 'true' | 'false' | boolean;
|
|
30
|
+
'aria-controls'?: string;
|
|
31
|
+
'aria-disabled'?: boolean;
|
|
32
|
+
'aria-expanded'?: 'true' | 'false' | boolean;
|
|
33
|
+
'aria-haspopup'?: 'true' | 'false' | 'menu' | 'dialog' | boolean;
|
|
34
|
+
'aria-hidden'?: 'true' | 'false' | boolean;
|
|
35
|
+
'aria-selected'?: 'true' | 'false' | boolean;
|
|
36
|
+
'aria-labelledby'?: string;
|
|
37
|
+
'aria-live'?: 'polite' | 'off' | 'assertive';
|
|
38
|
+
'aria-current'?: React.AriaAttributes['aria-current'];
|
|
39
|
+
'aria-description'?: string;
|
|
40
|
+
'aria-describedby'?: string;
|
|
41
|
+
/** IMPORTANT: try to avoid using role="link" with onPress and first consider other alternatives like to/href + onNavigate */
|
|
42
|
+
role?: string;
|
|
43
|
+
type?: 'button' | 'submit';
|
|
44
|
+
tabIndex?: number;
|
|
45
|
+
as?: 'a';
|
|
46
|
+
stopPropagation?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type OnPressProps = {
|
|
50
|
+
onPress: PressHandler;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type HrefProps = {
|
|
54
|
+
href: string;
|
|
55
|
+
newTab?: boolean;
|
|
56
|
+
loadOnTop?: boolean;
|
|
57
|
+
onNavigate?: () => void | Promise<void>;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type ToProps = {
|
|
61
|
+
to: string | Location;
|
|
62
|
+
newTab?: boolean;
|
|
63
|
+
fullPageOnWebView?: boolean;
|
|
64
|
+
replace?: boolean;
|
|
65
|
+
onNavigate?: () => void | Promise<void>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type SubmitProps = {
|
|
69
|
+
type: 'submit';
|
|
70
|
+
formId?: string;
|
|
71
|
+
onPress?: PressHandler;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type AlwaysTouchableComponentProps = ExclusifyUnion<OnPressProps | HrefProps | ToProps> &
|
|
75
|
+
Pick<
|
|
76
|
+
CommonProps,
|
|
77
|
+
| 'trackingEvent'
|
|
78
|
+
| 'dataAttributes'
|
|
79
|
+
| 'role'
|
|
80
|
+
| 'aria-label'
|
|
81
|
+
| 'aria-labelledby'
|
|
82
|
+
| 'aria-description'
|
|
83
|
+
| 'aria-describedby'
|
|
84
|
+
| 'aria-current'
|
|
85
|
+
>;
|
|
86
|
+
|
|
87
|
+
export type TouchableComponentProps<Props> = ExclusifyUnion<
|
|
88
|
+
Props | (OnPressProps & Props) | (HrefProps & Props) | (ToProps & Props)
|
|
89
|
+
> &
|
|
90
|
+
Pick<
|
|
91
|
+
CommonProps,
|
|
92
|
+
| 'trackingEvent'
|
|
93
|
+
| 'dataAttributes'
|
|
94
|
+
| 'role'
|
|
95
|
+
| 'aria-label'
|
|
96
|
+
| 'aria-labelledby'
|
|
97
|
+
| 'aria-description'
|
|
98
|
+
| 'aria-describedby'
|
|
99
|
+
| 'aria-current'
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
type Maybe<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K> & {maybe: true};
|
|
103
|
+
|
|
104
|
+
export type TouchableProps = ExclusifyUnion<
|
|
105
|
+
| OnPressProps
|
|
106
|
+
| HrefProps
|
|
107
|
+
| ToProps
|
|
108
|
+
| Maybe<OnPressProps, 'onPress'>
|
|
109
|
+
| Maybe<HrefProps, 'href'>
|
|
110
|
+
| Maybe<ToProps, 'to'>
|
|
111
|
+
| SubmitProps
|
|
112
|
+
> &
|
|
113
|
+
CommonProps;
|
|
114
|
+
|
|
115
|
+
export type TouchableElement = HTMLDivElement | HTMLAnchorElement | HTMLButtonElement;
|
|
116
|
+
|
|
117
|
+
const RawTouchable = React.forwardRef<TouchableElement, TouchableProps>((props, ref) => {
|
|
118
|
+
const {texts, analytics, platformOverrides, Link, useHrefDecorator, t} = useTheme();
|
|
119
|
+
const hrefDecorator = useHrefDecorator();
|
|
120
|
+
const isClicked = React.useRef(false);
|
|
121
|
+
let trackingEvents: ReadonlyArray<TrackingEvent> = [];
|
|
122
|
+
if (props.trackingEvent) {
|
|
123
|
+
if (Array.isArray(props.trackingEvent)) {
|
|
124
|
+
trackingEvents = props.trackingEvent;
|
|
125
|
+
} else {
|
|
126
|
+
trackingEvents = [props.trackingEvent as TrackingEvent];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const children = props.children;
|
|
131
|
+
|
|
132
|
+
const commonProps = {
|
|
133
|
+
className: props.className,
|
|
134
|
+
id: props.id,
|
|
135
|
+
disabled: props.disabled,
|
|
136
|
+
style: {
|
|
137
|
+
...props.style,
|
|
138
|
+
...(props['aria-disabled'] ? ({pointerEvents: 'none'} as const) : {}),
|
|
139
|
+
},
|
|
140
|
+
role: props.role,
|
|
141
|
+
tabIndex: props.tabIndex,
|
|
142
|
+
'aria-disabled': props['aria-disabled'],
|
|
143
|
+
'aria-hidden': props['aria-hidden'],
|
|
144
|
+
'aria-live': props['aria-live'],
|
|
145
|
+
...getPrefixedDataAttributes(props.dataAttributes, 'Touchable'),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// aria props that we want to apply to both <a> and <button> elements, not applicable to <div>
|
|
149
|
+
const touchableAriaProps = {
|
|
150
|
+
'aria-checked': props['aria-checked'],
|
|
151
|
+
'aria-disabled': props.disabled || props['aria-disabled'] ? true : undefined,
|
|
152
|
+
'aria-controls': props['aria-controls'],
|
|
153
|
+
'aria-expanded': props['aria-expanded'],
|
|
154
|
+
'aria-haspopup': props['aria-haspopup'],
|
|
155
|
+
'aria-selected': props['aria-selected'],
|
|
156
|
+
'aria-current': props['aria-current'],
|
|
157
|
+
'aria-label': props['aria-label'],
|
|
158
|
+
'aria-labelledby': props['aria-labelledby'],
|
|
159
|
+
'aria-description': props['aria-description'],
|
|
160
|
+
'aria-describedby': props['aria-describedby'],
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const type = props.type ? props.type : 'button';
|
|
164
|
+
|
|
165
|
+
const openNewTab = !!props.newTab;
|
|
166
|
+
const openInCurrentPage = props.href?.startsWith('#');
|
|
167
|
+
const loadOnTop = !openNewTab && !!props.href && !!props.loadOnTop;
|
|
168
|
+
|
|
169
|
+
const stopPropagationIfNeeded = (event: React.MouseEvent<HTMLElement>) => {
|
|
170
|
+
if (props.stopPropagation) {
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const onPress = (event: React.MouseEvent<HTMLElement>) => {
|
|
176
|
+
if (props.onPress) {
|
|
177
|
+
props.onPress(event);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const getHref = (): string => {
|
|
182
|
+
if (props.href) {
|
|
183
|
+
return hrefDecorator(props.href);
|
|
184
|
+
}
|
|
185
|
+
if (props.to && props.fullPageOnWebView) {
|
|
186
|
+
if (typeof props.to === 'string') {
|
|
187
|
+
return props.to;
|
|
188
|
+
}
|
|
189
|
+
return props.to.pathname ?? '';
|
|
190
|
+
}
|
|
191
|
+
return '';
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const trackEvent = () => Promise.all(trackingEvents.map((event) => analytics.logEvent(event)));
|
|
195
|
+
|
|
196
|
+
const trackOnce = (callback: () => void) => {
|
|
197
|
+
if (isClicked.current) return;
|
|
198
|
+
isClicked.current = true;
|
|
199
|
+
|
|
200
|
+
trackEvent().finally(() => {
|
|
201
|
+
isClicked.current = false;
|
|
202
|
+
callback();
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const handleButtonClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
207
|
+
stopPropagationIfNeeded(event);
|
|
208
|
+
// synchronously execute handler when no tracking is needed
|
|
209
|
+
if (!trackingEvents.length) {
|
|
210
|
+
onPress(event);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
trackOnce(() => onPress(event));
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const handleHrefClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
218
|
+
stopPropagationIfNeeded(event);
|
|
219
|
+
|
|
220
|
+
const hasOnNavigate = !!(props.href && props.onNavigate);
|
|
221
|
+
|
|
222
|
+
if (!trackingEvents.length && !hasOnNavigate) {
|
|
223
|
+
return; // let the browser handle the href
|
|
224
|
+
}
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
|
|
227
|
+
Promise.resolve(hasOnNavigate ? props.onNavigate?.() : undefined).finally(() => {
|
|
228
|
+
trackOnce(() => redirect(getHref(), openNewTab, loadOnTop));
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const handleToClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
233
|
+
stopPropagationIfNeeded(event);
|
|
234
|
+
if (props.to && props.onNavigate) {
|
|
235
|
+
props.onNavigate();
|
|
236
|
+
}
|
|
237
|
+
trackEvent();
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {
|
|
241
|
+
if (event.key === ENTER || event.key === SPACE) {
|
|
242
|
+
event.preventDefault();
|
|
243
|
+
event.currentTarget.click();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const renderScreenReaderOnlyHint = () => {
|
|
248
|
+
return openNewTab ? (
|
|
249
|
+
<ScreenReaderOnly>
|
|
250
|
+
<span>{texts.linkOpensInNewTab || t(tokens.linkOpensInNewTab)}</span>
|
|
251
|
+
</ScreenReaderOnly>
|
|
252
|
+
) : openInCurrentPage ? (
|
|
253
|
+
<ScreenReaderOnly>
|
|
254
|
+
<span>{texts.linkOpensInCurrentPage || t(tokens.linkOpensInCurrentPage)}</span>
|
|
255
|
+
</ScreenReaderOnly>
|
|
256
|
+
) : null;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
if (!!props.href || (props.to && props.fullPageOnWebView && isInsideNovumNativeApp(platformOverrides))) {
|
|
260
|
+
return (
|
|
261
|
+
<a
|
|
262
|
+
{...commonProps}
|
|
263
|
+
{...touchableAriaProps}
|
|
264
|
+
onClick={handleHrefClick}
|
|
265
|
+
onKeyDown={handleKeyDown}
|
|
266
|
+
href={props.disabled ? undefined : getHref()}
|
|
267
|
+
target={(() => {
|
|
268
|
+
if (openNewTab) return '_blank';
|
|
269
|
+
if (loadOnTop) return '_top';
|
|
270
|
+
return undefined;
|
|
271
|
+
})()}
|
|
272
|
+
rel={openNewTab ? 'noopener noreferrer' : undefined}
|
|
273
|
+
ref={ref as React.RefObject<HTMLAnchorElement>}
|
|
274
|
+
>
|
|
275
|
+
{children}
|
|
276
|
+
{renderScreenReaderOnlyHint()}
|
|
277
|
+
</a>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (props.to) {
|
|
282
|
+
return (
|
|
283
|
+
<Link
|
|
284
|
+
{...commonProps}
|
|
285
|
+
{...touchableAriaProps}
|
|
286
|
+
target={props.newTab ? '_blank' : undefined}
|
|
287
|
+
innerRef={ref as React.RefObject<HTMLAnchorElement>}
|
|
288
|
+
to={props.disabled ? '' : props.to}
|
|
289
|
+
replace={props.replace}
|
|
290
|
+
onClick={handleToClick}
|
|
291
|
+
onKeyDown={handleKeyDown}
|
|
292
|
+
>
|
|
293
|
+
{children}
|
|
294
|
+
{renderScreenReaderOnlyHint()}
|
|
295
|
+
</Link>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (props.onPress) {
|
|
300
|
+
const elementType = props.as ?? 'button';
|
|
301
|
+
const role = commonProps.role ?? (props.as === 'a' ? 'button' : undefined);
|
|
302
|
+
return React.createElement(elementType, {
|
|
303
|
+
...commonProps,
|
|
304
|
+
...touchableAriaProps,
|
|
305
|
+
role,
|
|
306
|
+
// When an <a/> is rendered without an href value, the element is not accesible
|
|
307
|
+
// by keyboard (using tab key). We add a fictional href to "#" to avoid this.
|
|
308
|
+
href: elementType === 'a' ? '#' : undefined,
|
|
309
|
+
// this "form" attribute is useful when the form's submit button
|
|
310
|
+
// is located outside the <form> element, for example if you use
|
|
311
|
+
// a ButtonFixedFooter layout inside a form with the submit
|
|
312
|
+
// button located at the footer, which is redered using a Portal
|
|
313
|
+
form: type === 'submit' && props.formId ? props.formId : undefined,
|
|
314
|
+
type,
|
|
315
|
+
ref: ref as React.RefObject<HTMLButtonElement>,
|
|
316
|
+
onClick: (e: React.MouseEvent<HTMLElement>) => {
|
|
317
|
+
// prevent navigating to fictional "#" if element is rendered as <a/>
|
|
318
|
+
if (elementType === 'a') {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
}
|
|
321
|
+
handleButtonClick(e);
|
|
322
|
+
},
|
|
323
|
+
children,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return (
|
|
328
|
+
<div
|
|
329
|
+
{...commonProps}
|
|
330
|
+
ref={ref as React.RefObject<HTMLDivElement>}
|
|
331
|
+
className={classnames(commonProps.className, classes.notTouchable)}
|
|
332
|
+
>
|
|
333
|
+
{children}
|
|
334
|
+
</div>
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const Touchable = React.forwardRef<TouchableElement, TouchableProps>((props, ref) => {
|
|
339
|
+
return <RawTouchable {...props} className={classnames(classes.touchable, props.className)} ref={ref} />;
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// Used internally by Mística's components to avoid styles collisions
|
|
343
|
+
export const BaseTouchable = React.forwardRef<TouchableElement, TouchableProps & {resetMargin?: boolean}>(
|
|
344
|
+
({resetMargin = true, ...props}, ref) => {
|
|
345
|
+
return (
|
|
346
|
+
<RawTouchable
|
|
347
|
+
{...props}
|
|
348
|
+
className={classnames(classes.base, props.className, {[classes.marginReset]: resetMargin})}
|
|
349
|
+
ref={ref}
|
|
350
|
+
/>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
export default Touchable;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Spec: https://www.w3.org/TR/css-font-loading/
|
|
2
|
+
export {};
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
const FontFace: FontFace;
|
|
6
|
+
|
|
7
|
+
interface Document {
|
|
8
|
+
fonts: FontFaceSet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type CSSOMString = string;
|
|
12
|
+
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error';
|
|
13
|
+
type FontFaceSetStatus = 'loading' | 'loaded';
|
|
14
|
+
|
|
15
|
+
class FontFace extends FontFaceDescriptors {
|
|
16
|
+
constructor(
|
|
17
|
+
family: string,
|
|
18
|
+
source: string | ArrayBuffer,
|
|
19
|
+
descriptors?: FontFaceDescriptors
|
|
20
|
+
): FontFace;
|
|
21
|
+
readonly status: FontFaceLoadStatus;
|
|
22
|
+
readonly loaded: Promise<FontFace>;
|
|
23
|
+
variationSettings: CSSOMString;
|
|
24
|
+
display: CSSOMString;
|
|
25
|
+
load(): Promise<FontFace>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface FontFaceDescriptors {
|
|
29
|
+
family: CSSOMString;
|
|
30
|
+
style: CSSOMString;
|
|
31
|
+
weight: CSSOMString;
|
|
32
|
+
stretch: CSSOMString;
|
|
33
|
+
unicodeRange: CSSOMString;
|
|
34
|
+
variant: CSSOMString;
|
|
35
|
+
featureSettings: CSSOMString;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface FontFaceSet extends Iterable<FontFace> {
|
|
39
|
+
readonly status: FontFaceSetStatus;
|
|
40
|
+
readonly ready: Promise<FontFaceSet>;
|
|
41
|
+
add(font: FontFace): void;
|
|
42
|
+
check(font: string, text?: string): boolean; // throws exception
|
|
43
|
+
load(font: string, text?: string): Promise<Array<FontFace>>;
|
|
44
|
+
delete(font: FontFace): void;
|
|
45
|
+
clear(): void;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ThemeContextProvider from '../../theme-context-provider';
|
|
3
|
+
import {render, screen} from '@testing-library/react';
|
|
4
|
+
import {makeTheme} from '../../__tests__/test-utils';
|
|
5
|
+
import {TrackingConfig, useTrackingConfig} from '../analytics';
|
|
6
|
+
|
|
7
|
+
const PrintEventFormat = ({prefix}: {prefix: string}) => {
|
|
8
|
+
const {eventFormat} = useTrackingConfig();
|
|
9
|
+
return <div>{`${prefix}: ${eventFormat}`}</div>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
test('TrackingConfig context providers', () => {
|
|
13
|
+
render(
|
|
14
|
+
<ThemeContextProvider
|
|
15
|
+
theme={makeTheme({
|
|
16
|
+
analytics: {
|
|
17
|
+
logEvent: () => Promise.resolve(),
|
|
18
|
+
eventFormat: 'google-analytics-4',
|
|
19
|
+
},
|
|
20
|
+
})}
|
|
21
|
+
>
|
|
22
|
+
<PrintEventFormat prefix="test1" />
|
|
23
|
+
<TrackingConfig eventFormat="universal-analytics">
|
|
24
|
+
<PrintEventFormat prefix="test2" />
|
|
25
|
+
<TrackingConfig eventFormat="google-analytics-4">
|
|
26
|
+
<PrintEventFormat prefix="test3" />
|
|
27
|
+
</TrackingConfig>
|
|
28
|
+
</TrackingConfig>
|
|
29
|
+
</ThemeContextProvider>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(screen.getByText('test1: google-analytics-4')).toBeInTheDocument();
|
|
33
|
+
expect(screen.getByText('test2: universal-analytics')).toBeInTheDocument();
|
|
34
|
+
expect(screen.getByText('test3: google-analytics-4')).toBeInTheDocument();
|
|
35
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {redirect} from '../browser';
|
|
2
|
+
|
|
3
|
+
// mock location.assign
|
|
4
|
+
const redirectSpy = jest.fn();
|
|
5
|
+
Object.defineProperty(window, 'location', {value: {...window.location, assign: redirectSpy}});
|
|
6
|
+
|
|
7
|
+
// mock window.open
|
|
8
|
+
const openSpy = jest.fn();
|
|
9
|
+
window.open = openSpy;
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
jest.resetAllMocks(); // reset spy calls
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('redirect', () => {
|
|
16
|
+
redirect('https://example.org');
|
|
17
|
+
expect(redirectSpy.mock.calls).toEqual([['https://example.org']]);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('open external', () => {
|
|
21
|
+
redirect('https://example.org', true, false);
|
|
22
|
+
expect(openSpy.mock.calls).toEqual([['https://example.org', '_blank']]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('open loadOnTop', () => {
|
|
26
|
+
redirect('https://example.org', false, true);
|
|
27
|
+
expect(openSpy.mock.calls).toEqual([['https://example.org', '_top']]);
|
|
28
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {getCssVarValue} from '../dom';
|
|
2
|
+
|
|
3
|
+
test('getCssVarValue', () => {
|
|
4
|
+
document.documentElement.style.setProperty('--color-primary', '#FABADA');
|
|
5
|
+
|
|
6
|
+
expect(getCssVarValue('--color-primary')).toBe('#FABADA');
|
|
7
|
+
expect(getCssVarValue('var(--color-primary)')).toBe('#FABADA');
|
|
8
|
+
expect(getCssVarValue('var(--non-defined)')).toBe('');
|
|
9
|
+
expect(getCssVarValue('var(--non-defined, #00FFFF)')).toBe('#00FFFF');
|
|
10
|
+
expect(getCssVarValue('var(--non-defined, var(--color-primary))')).toBe('#FABADA');
|
|
11
|
+
expect(getCssVarValue('var(--non-defined, var(--non-defined, #00FFFF))')).toBe('#00FFFF');
|
|
12
|
+
|
|
13
|
+
expect(() => getCssVarValue('non-css-var')).toThrow();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('getCssVarValue of element', () => {
|
|
17
|
+
document.documentElement.style.setProperty('--color-primary', '#FABADA');
|
|
18
|
+
const div = document.createElement('div');
|
|
19
|
+
div.style.setProperty('--color-primary', '#ABACAD');
|
|
20
|
+
|
|
21
|
+
expect(getCssVarValue('--color-primary', div)).toBe('#ABACAD');
|
|
22
|
+
expect(getCssVarValue('var(--color-primary)', div)).toBe('#ABACAD');
|
|
23
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {debounce, isEqual} from '../helpers';
|
|
2
|
+
|
|
3
|
+
beforeEach(() => {
|
|
4
|
+
jest.useFakeTimers();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test('debounce without leading and with trailing', () => {
|
|
8
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
9
|
+
const debounced = debounce(fn, 5000);
|
|
10
|
+
|
|
11
|
+
debounced(1);
|
|
12
|
+
jest.advanceTimersByTime(4500);
|
|
13
|
+
debounced(2);
|
|
14
|
+
jest.advanceTimersByTime(4500);
|
|
15
|
+
debounced(3);
|
|
16
|
+
expect(fn).not.toHaveBeenCalled();
|
|
17
|
+
|
|
18
|
+
jest.runAllTimers();
|
|
19
|
+
expect(fn.mock.calls).toEqual([[3]]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('debounce with leading and trailing', () => {
|
|
23
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
24
|
+
const debounced = debounce(fn, 5000, {leading: true});
|
|
25
|
+
|
|
26
|
+
debounced(1);
|
|
27
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
28
|
+
|
|
29
|
+
debounced(2);
|
|
30
|
+
debounced(3);
|
|
31
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
32
|
+
|
|
33
|
+
jest.runAllTimers();
|
|
34
|
+
expect(fn.mock.calls).toEqual([[1], [3]]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('debounce with leading and without trailing', () => {
|
|
38
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
39
|
+
const debounced = debounce(fn, 5000, {leading: true, trailing: false});
|
|
40
|
+
|
|
41
|
+
debounced(1);
|
|
42
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
43
|
+
|
|
44
|
+
debounced(2);
|
|
45
|
+
debounced(3);
|
|
46
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
47
|
+
|
|
48
|
+
jest.runAllTimers();
|
|
49
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('debounce with maxWait', () => {
|
|
53
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
54
|
+
const debounced = debounce(fn, 2500, {maxWait: 3000});
|
|
55
|
+
|
|
56
|
+
debounced(1);
|
|
57
|
+
jest.advanceTimersByTime(2000);
|
|
58
|
+
|
|
59
|
+
debounced(2);
|
|
60
|
+
debounced(3);
|
|
61
|
+
jest.advanceTimersByTime(2000);
|
|
62
|
+
expect(fn.mock.calls).toEqual([[3]]);
|
|
63
|
+
|
|
64
|
+
debounced(4);
|
|
65
|
+
jest.runAllTimers();
|
|
66
|
+
|
|
67
|
+
expect(fn.mock.calls).toEqual([[3], [4]]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("debounce with leading and maxWait don't gets called twice", () => {
|
|
71
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
72
|
+
const debounced = debounce(fn, 2500, {maxWait: 1000, leading: true});
|
|
73
|
+
|
|
74
|
+
debounced(1);
|
|
75
|
+
jest.runAllTimers();
|
|
76
|
+
|
|
77
|
+
expect(fn.mock.calls).toEqual([[1]]);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('debounce calls the function when maxWait expires', () => {
|
|
81
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
82
|
+
const debounced = debounce(fn, 1000, {maxWait: 2000});
|
|
83
|
+
|
|
84
|
+
debounced(1);
|
|
85
|
+
jest.advanceTimersByTime(500);
|
|
86
|
+
debounced(2);
|
|
87
|
+
jest.advanceTimersByTime(500);
|
|
88
|
+
debounced(3);
|
|
89
|
+
jest.advanceTimersByTime(500);
|
|
90
|
+
debounced(4);
|
|
91
|
+
jest.advanceTimersByTime(500);
|
|
92
|
+
|
|
93
|
+
expect(fn.mock.calls).toEqual([[4]]);
|
|
94
|
+
jest.runAllTimers();
|
|
95
|
+
expect(fn.mock.calls).toEqual([[4]]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('debounce cancel', () => {
|
|
99
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
100
|
+
const debounced = debounce(fn, 5000);
|
|
101
|
+
|
|
102
|
+
debounced(1);
|
|
103
|
+
debounced(2);
|
|
104
|
+
debounced(3);
|
|
105
|
+
|
|
106
|
+
debounced.cancel();
|
|
107
|
+
|
|
108
|
+
jest.runAllTimers();
|
|
109
|
+
|
|
110
|
+
expect(fn).not.toHaveBeenCalled();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('debounce flush', () => {
|
|
114
|
+
const fn = jest.fn().mockImplementation((a) => a);
|
|
115
|
+
const debounced = debounce(fn, 5000);
|
|
116
|
+
|
|
117
|
+
debounced(1);
|
|
118
|
+
debounced(2);
|
|
119
|
+
debounced(3);
|
|
120
|
+
|
|
121
|
+
debounced.flush();
|
|
122
|
+
|
|
123
|
+
jest.runAllTimers();
|
|
124
|
+
expect(fn.mock.calls).toEqual([[3]]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('isEqual happy case', () => {
|
|
128
|
+
const symbol = Symbol('abc');
|
|
129
|
+
|
|
130
|
+
const a = {
|
|
131
|
+
n: 123,
|
|
132
|
+
s: 'abc',
|
|
133
|
+
b: true,
|
|
134
|
+
nan: NaN,
|
|
135
|
+
nul: null,
|
|
136
|
+
und: undefined,
|
|
137
|
+
arr: [1, false, null, undefined, new Date(1234567890), {a: 1, b: 2, c: 3}],
|
|
138
|
+
date: new Date(1234567890),
|
|
139
|
+
obj: {a: 1, b: 2, c: 3},
|
|
140
|
+
symbol,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const b = {
|
|
144
|
+
n: 123,
|
|
145
|
+
s: 'abc',
|
|
146
|
+
b: true,
|
|
147
|
+
nan: NaN,
|
|
148
|
+
nul: null,
|
|
149
|
+
und: undefined,
|
|
150
|
+
arr: [1, false, null, undefined, new Date(1234567890), {a: 1, b: 2, c: 3}],
|
|
151
|
+
date: new Date(1234567890),
|
|
152
|
+
obj: {a: 1, b: 2, c: 3},
|
|
153
|
+
symbol,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
expect(isEqual(a, b)).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('isEqual with different primitives', () => {
|
|
160
|
+
expect(isEqual(1, 2)).toBe(false);
|
|
161
|
+
expect(isEqual('a', 'b')).toBe(false);
|
|
162
|
+
expect(isEqual(true, false)).toBe(false);
|
|
163
|
+
expect(isEqual(null, undefined)).toBe(false);
|
|
164
|
+
expect(isEqual(Symbol('abc'), Symbol('abc'))).toBe(false);
|
|
165
|
+
expect(isEqual(new Date(1234567890), new Date(1234567891))).toBe(false);
|
|
166
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type {EventFormat} from '../theme';
|
|
5
|
+
|
|
6
|
+
// Universal Analytics (legacy)
|
|
7
|
+
export const eventCategories = {userInteraction: 'user_interaction'} as const;
|
|
8
|
+
export const eventActions = {linkTapped: 'link_tapped'} as const;
|
|
9
|
+
|
|
10
|
+
// Google analytics 4
|
|
11
|
+
export const eventNames = {userInteraction: 'user_interaction'} as const;
|
|
12
|
+
|
|
13
|
+
const TrackingContext = React.createContext<{eventFormat: EventFormat}>({
|
|
14
|
+
eventFormat: 'universal-analytics',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
type TrackingConfigProps = {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
eventFormat: EventFormat;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const TrackingConfig = ({children, eventFormat}: TrackingConfigProps): JSX.Element => {
|
|
23
|
+
const value = React.useMemo(() => ({eventFormat}), [eventFormat]);
|
|
24
|
+
|
|
25
|
+
return <TrackingContext.Provider value={value}>{children}</TrackingContext.Provider>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const useTrackingConfig = (): {eventFormat: EventFormat} => React.useContext(TrackingContext);
|