@telefonica/mistica 16.59.0-beta.1 → 16.60.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 +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/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 +23 -20
- package/dist/text-field-components.css.d.ts +1 -0
- package/dist/text-field-components.js +31 -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.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-field-components.js +52 -46
- 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/llms.md +0 -24
- package/package.json +2 -14
- package/src/accordion.css.ts +0 -121
- package/src/accordion.tsx +0 -366
- package/src/align.css.ts +0 -7
- package/src/align.tsx +0 -32
- package/src/autocomplete.css.ts +0 -62
- package/src/autocomplete.tsx +0 -239
- package/src/avatar.css.ts +0 -14
- package/src/avatar.tsx +0 -120
- package/src/badge.css.ts +0 -51
- package/src/badge.tsx +0 -79
- package/src/box.css.ts +0 -51
- package/src/box.tsx +0 -114
- package/src/boxed.css.ts +0 -132
- package/src/boxed.tsx +0 -153
- package/src/button-fixed-footer-layout.tsx +0 -62
- package/src/button-group.css.ts +0 -75
- package/src/button-group.tsx +0 -91
- package/src/button-layout.css.ts +0 -162
- package/src/button-layout.tsx +0 -91
- package/src/button.css.ts +0 -758
- package/src/button.tsx +0 -632
- package/src/callout.css.ts +0 -50
- package/src/callout.tsx +0 -147
- package/src/card-cover.tsx +0 -242
- package/src/card-data.tsx +0 -152
- package/src/card-internal.css.ts +0 -271
- package/src/card-internal.tsx +0 -1724
- package/src/card-media.tsx +0 -157
- package/src/card-naked.tsx +0 -63
- package/src/carousel.css.ts +0 -522
- package/src/carousel.tsx +0 -1300
- package/src/checkbox.css.ts +0 -94
- package/src/checkbox.tsx +0 -192
- package/src/chip.css.ts +0 -204
- package/src/chip.tsx +0 -191
- package/src/circle.css.ts +0 -14
- package/src/circle.tsx +0 -52
- 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 +0 -84
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +0 -72
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +0 -66
- package/src/community/__stories__/advanced-data-card-story.tsx +0 -158
- package/src/community/__stories__/blocks-story.tsx +0 -272
- package/src/community/__stories__/example-component-story.tsx +0 -15
- package/src/community/__stories__/index-story.tsx +0 -154
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +0 -40
- package/src/community/advanced-data-card.css.ts +0 -271
- package/src/community/advanced-data-card.tsx +0 -431
- package/src/community/blocks.css.ts +0 -12
- package/src/community/blocks.tsx +0 -290
- package/src/community/example-component.css.ts +0 -7
- package/src/community/example-component.tsx +0 -17
- package/src/community/index.tsx +0 -10
- package/src/counter.css.ts +0 -150
- package/src/counter.tsx +0 -215
- package/src/cover-hero-media.tsx +0 -39
- package/src/cover-hero.css.ts +0 -133
- package/src/cover-hero.tsx +0 -262
- package/src/credit-card-expiration-field.tsx +0 -187
- package/src/credit-card-fields.tsx +0 -56
- package/src/credit-card-number-field.css.ts +0 -47
- package/src/credit-card-number-field.tsx +0 -245
- package/src/cvv-field.tsx +0 -169
- package/src/date-field.css.ts +0 -14
- package/src/date-field.tsx +0 -130
- package/src/date-time-field.tsx +0 -141
- package/src/date-time-picker.css.ts +0 -126
- package/src/date-time-picker.tsx +0 -188
- package/src/decimal-field.tsx +0 -160
- package/src/desktop-container-type-context.tsx +0 -15
- package/src/dialog-context.tsx +0 -81
- package/src/dialog.css.ts +0 -155
- package/src/dialog.tsx +0 -423
- package/src/divider.css.ts +0 -10
- package/src/divider.tsx +0 -11
- package/src/double-field.css.ts +0 -33
- package/src/double-field.tsx +0 -71
- package/src/drawer.css.ts +0 -123
- package/src/drawer.tsx +0 -304
- package/src/email-field.tsx +0 -76
- package/src/empty-state-card.css.ts +0 -40
- package/src/empty-state-card.tsx +0 -92
- package/src/empty-state.css.ts +0 -119
- package/src/empty-state.tsx +0 -141
- package/src/fade-in.css.ts +0 -12
- package/src/fade-in.tsx +0 -40
- package/src/feedback.css.ts +0 -119
- package/src/feedback.tsx +0 -432
- package/src/file-upload.css.ts +0 -156
- package/src/file-upload.tsx +0 -612
- package/src/fixed-footer-layout.css.ts +0 -96
- package/src/fixed-footer-layout.tsx +0 -215
- package/src/fixed-to-top.tsx +0 -21
- package/src/focus-trap.tsx +0 -17
- package/src/form-context.tsx +0 -198
- package/src/form.css.ts +0 -5
- package/src/form.tsx +0 -287
- package/src/grid-layout.css.ts +0 -68
- package/src/grid-layout.tsx +0 -201
- package/src/grid.css.ts +0 -203
- package/src/grid.tsx +0 -241
- package/src/header.css.ts +0 -30
- package/src/header.tsx +0 -319
- package/src/hero.css.ts +0 -71
- package/src/hero.tsx +0 -318
- package/src/hooks.tsx +0 -313
- package/src/horizontal-scroll.css.ts +0 -43
- package/src/horizontal-scroll.tsx +0 -18
- package/src/iban-field.tsx +0 -218
- package/src/icon-button.css.ts +0 -561
- package/src/icon-button.tsx +0 -221
- package/src/icons/__stories__/mistica-icons-story.tsx +0 -192
- package/src/icons/icon-amex.tsx +0 -40
- package/src/icons/icon-chevron.css.ts +0 -23
- package/src/icons/icon-chevron.tsx +0 -150
- package/src/icons/icon-cvv-amex.tsx +0 -31
- package/src/icons/icon-cvv-visa-mc.tsx +0 -31
- package/src/icons/icon-error.css.ts +0 -27
- package/src/icons/icon-error.tsx +0 -207
- package/src/icons/icon-info.tsx +0 -86
- package/src/icons/icon-mastercard.tsx +0 -36
- package/src/icons/icon-success-vivo-new.tsx +0 -51
- package/src/icons/icon-success-vivo.tsx +0 -36
- package/src/icons/icon-success.tsx +0 -211
- package/src/icons/icon-visa.tsx +0 -32
- package/src/image.css.ts +0 -48
- package/src/image.tsx +0 -345
- package/src/index.tsx +0 -2466
- package/src/inline.css.ts +0 -131
- package/src/inline.tsx +0 -135
- package/src/integer-field.tsx +0 -93
- package/src/list.css.ts +0 -281
- package/src/list.tsx +0 -963
- package/src/loading-bar.css.ts +0 -69
- package/src/loading-bar.tsx +0 -25
- package/src/loading-screen.css.ts +0 -114
- package/src/loading-screen.tsx +0 -376
- package/src/logo-blau-shell.tsx +0 -30
- package/src/logo-blau.tsx +0 -60
- package/src/logo-common.tsx +0 -29
- package/src/logo-esimflag-shell.tsx +0 -30
- package/src/logo-esimflag.tsx +0 -56
- package/src/logo-movistar-new-shell.tsx +0 -30
- package/src/logo-movistar-new.tsx +0 -85
- package/src/logo-movistar-shell.tsx +0 -30
- package/src/logo-movistar.tsx +0 -63
- package/src/logo-o2-new-shell.tsx +0 -26
- package/src/logo-o2-new.tsx +0 -27
- package/src/logo-o2-shell.tsx +0 -26
- package/src/logo-o2.tsx +0 -27
- package/src/logo-telefonica-shell.tsx +0 -30
- package/src/logo-telefonica.tsx +0 -95
- package/src/logo-tu-shell.tsx +0 -26
- package/src/logo-tu.tsx +0 -28
- package/src/logo-vivo-shell.tsx +0 -30
- package/src/logo-vivo.tsx +0 -53
- package/src/logo.css.ts +0 -33
- package/src/logo.tsx +0 -313
- package/src/master-detail-layout.tsx +0 -28
- package/src/maybe-dismissable.css.ts +0 -37
- package/src/maybe-dismissable.tsx +0 -58
- package/src/media-queries.css.ts +0 -67
- package/src/menu.css.ts +0 -132
- package/src/menu.tsx +0 -468
- package/src/meter.tsx +0 -516
- package/src/modal-context-provider.tsx +0 -45
- package/src/month-field.tsx +0 -124
- package/src/mosaic.css.ts +0 -73
- package/src/mosaic.tsx +0 -205
- package/src/navigation-bar.css.ts +0 -558
- package/src/navigation-bar.tsx +0 -1637
- package/src/navigation-breadcrumbs.css.ts +0 -22
- package/src/navigation-breadcrumbs.tsx +0 -69
- package/src/negative-box.tsx +0 -15
- package/src/nestable-context.tsx +0 -139
- package/src/overlay.tsx +0 -86
- package/src/overscroll-color-context.tsx +0 -141
- package/src/package-version.tsx +0 -2
- package/src/password-field.tsx +0 -126
- package/src/phone-number-field-lite.tsx +0 -265
- package/src/phone-number-field.tsx +0 -171
- package/src/pin-field.css.ts +0 -90
- package/src/pin-field.tsx +0 -346
- package/src/placeholder.tsx +0 -41
- package/src/popover.css.ts +0 -8
- package/src/popover.tsx +0 -85
- package/src/portal.tsx +0 -43
- package/src/progress-bar.css.ts +0 -61
- package/src/progress-bar.tsx +0 -174
- package/src/radio-button.css.ts +0 -174
- package/src/radio-button.tsx +0 -322
- package/src/rating.css.ts +0 -128
- package/src/rating.tsx +0 -351
- package/src/responsive-layout.css.ts +0 -162
- package/src/responsive-layout.tsx +0 -106
- package/src/screen-reader-only.css.ts +0 -27
- package/src/screen-reader-only.tsx +0 -33
- package/src/screen-size-context-provider.tsx +0 -96
- package/src/screen-size-context.tsx +0 -23
- package/src/search-field.tsx +0 -126
- package/src/select.css.ts +0 -226
- package/src/select.tsx +0 -513
- package/src/sheet-action-row.css.ts +0 -33
- package/src/sheet-actions-list.tsx +0 -113
- package/src/sheet-actions.tsx +0 -95
- package/src/sheet-common.css.ts +0 -254
- package/src/sheet-common.tsx +0 -402
- package/src/sheet-info.css.ts +0 -19
- package/src/sheet-info.tsx +0 -127
- package/src/sheet-native.tsx +0 -189
- package/src/sheet-radio-list.tsx +0 -118
- package/src/sheet-root.tsx +0 -127
- package/src/sheet-types.tsx +0 -94
- package/src/sheet-web.tsx +0 -140
- package/src/skeleton-base.tsx +0 -38
- package/src/skeletons.css.ts +0 -56
- package/src/skeletons.tsx +0 -133
- package/src/skins/blau.tsx +0 -724
- package/src/skins/constants.tsx +0 -10
- package/src/skins/defaults.tsx +0 -104
- package/src/skins/esimflag.tsx +0 -728
- package/src/skins/movistar-new.tsx +0 -735
- package/src/skins/movistar.tsx +0 -740
- package/src/skins/o2-new.tsx +0 -731
- package/src/skins/o2.tsx +0 -727
- package/src/skins/skin-contract.css.ts +0 -380
- package/src/skins/telefonica.tsx +0 -768
- package/src/skins/tu.tsx +0 -741
- package/src/skins/types/colors.tsx +0 -286
- package/src/skins/types/index.tsx +0 -153
- package/src/skins/utils.tsx +0 -66
- package/src/skins/vivo-new.tsx +0 -745
- package/src/skins/vivo.tsx +0 -720
- package/src/skip-link.css.ts +0 -34
- package/src/skip-link.tsx +0 -52
- package/src/slider.css.ts +0 -181
- package/src/slider.tsx +0 -384
- package/src/snackbar-context.tsx +0 -98
- package/src/snackbar-native.ts +0 -37
- package/src/snackbar.css.ts +0 -176
- package/src/snackbar.tsx +0 -258
- package/src/spinner.css.ts +0 -66
- package/src/spinner.tsx +0 -136
- package/src/sprinkles.css.ts +0 -83
- package/src/square.css.ts +0 -15
- package/src/square.tsx +0 -55
- package/src/stack.css.ts +0 -44
- package/src/stack.tsx +0 -79
- package/src/stacking-group.css.ts +0 -15
- package/src/stacking-group.tsx +0 -82
- package/src/stepper.css.ts +0 -233
- package/src/stepper.tsx +0 -156
- package/src/switch-component.css.ts +0 -181
- package/src/switch-component.tsx +0 -187
- package/src/tab-focus.tsx +0 -68
- package/src/table-actions-header.tsx +0 -21
- package/src/table-cell-text.tsx +0 -35
- package/src/table.css.ts +0 -297
- package/src/table.tsx +0 -398
- package/src/tabs.css.ts +0 -212
- package/src/tabs.tsx +0 -263
- package/src/tag.css.ts +0 -42
- package/src/tag.tsx +0 -161
- package/src/test-utils/environment/setup-ssr.tsx +0 -10
- package/src/test-utils/fail-test-on-console-error.tsx +0 -22
- package/src/test-utils/index.tsx +0 -341
- package/src/test-utils/setup-ssr-test-env.tsx +0 -13
- package/src/test-utils/ssr.tsx +0 -197
- package/src/text-field-base.css.ts +0 -416
- package/src/text-field-base.tsx +0 -628
- package/src/text-field-components.css.ts +0 -159
- package/src/text-field-components.tsx +0 -225
- package/src/text-field.tsx +0 -118
- package/src/text-link.css.ts +0 -83
- package/src/text-link.tsx +0 -85
- package/src/text-tokens.tsx +0 -708
- package/src/text.css.ts +0 -60
- package/src/text.tsx +0 -516
- package/src/theme-context-provider.tsx +0 -370
- package/src/theme-context.css.ts +0 -3
- package/src/theme-context.tsx +0 -8
- package/src/theme-variant-context.tsx +0 -51
- package/src/theme.tsx +0 -184
- package/src/time-field.tsx +0 -99
- package/src/timeline.css.ts +0 -135
- package/src/timeline.tsx +0 -250
- package/src/timer.css.ts +0 -99
- package/src/timer.tsx +0 -420
- package/src/title.tsx +0 -119
- package/src/tooltip-context-provider.tsx +0 -57
- package/src/tooltip.css.ts +0 -106
- package/src/tooltip.tsx +0 -649
- package/src/touchable.css.ts +0 -56
- package/src/touchable.tsx +0 -355
- package/src/types/font-face.d.ts +0 -47
- package/src/types/libs.d.ts +0 -3
- package/src/utils/__tests__/analytics-test.tsx +0 -35
- package/src/utils/__tests__/browser-test.tsx +0 -28
- package/src/utils/__tests__/dom-test.tsx +0 -23
- package/src/utils/__tests__/helpers-test.tsx +0 -166
- package/src/utils/analytics.tsx +0 -28
- package/src/utils/animation.tsx +0 -201
- package/src/utils/aspect-ratio-support.css.ts +0 -28
- package/src/utils/aspect-ratio-support.tsx +0 -141
- package/src/utils/browser.tsx +0 -9
- package/src/utils/color.tsx +0 -46
- package/src/utils/common.tsx +0 -27
- package/src/utils/credit-card.tsx +0 -46
- package/src/utils/css.tsx +0 -25
- package/src/utils/document-visibility.tsx +0 -52
- package/src/utils/dom.tsx +0 -155
- package/src/utils/environment.tsx +0 -6
- package/src/utils/headings.tsx +0 -18
- package/src/utils/helpers.tsx +0 -182
- package/src/utils/keys.tsx +0 -8
- package/src/utils/locale.tsx +0 -27
- package/src/utils/platform.tsx +0 -94
- package/src/utils/region-code.tsx +0 -1
- package/src/utils/renders-element.tsx +0 -6
- package/src/utils/time.tsx +0 -22
- package/src/utils/types.tsx +0 -19
- package/src/utils/utility-types.tsx +0 -8
- package/src/video.css.ts +0 -11
- package/src/video.tsx +0 -355
- package/src/vivinho-loading-animation/in-lottie.json +0 -402
- package/src/vivinho-loading-animation/index.tsx +0 -90
- package/src/vivinho-loading-animation/out-lottie.json +0 -575
- package/src/vivinho-loading-animation/pulse-lottie.json +0 -551
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +0 -15
- package/src/vivinho-loading-animation/wave-lottie.json +0 -2829
package/src/hero.tsx
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import {useScreenSize} from './hooks';
|
|
5
|
-
import {Text3, Text8} from './text';
|
|
6
|
-
import GridLayout from './grid-layout';
|
|
7
|
-
import Box from './box';
|
|
8
|
-
import Stack from './stack';
|
|
9
|
-
import ButtonGroup from './button-group';
|
|
10
|
-
import {vars as skinVars} from './skins/skin-contract.css';
|
|
11
|
-
import * as styles from './hero.css';
|
|
12
|
-
import * as mediaStyles from './image.css';
|
|
13
|
-
import {useSlideshowContext} from './carousel';
|
|
14
|
-
import {getPrefixedDataAttributes} from './utils/dom';
|
|
15
|
-
import {useThemeVariant} from './theme-variant-context';
|
|
16
|
-
import {applyCssVars} from './utils/css';
|
|
17
|
-
import {InternalResponsiveLayout, ResetResponsiveLayout} from './responsive-layout';
|
|
18
|
-
import {
|
|
19
|
-
type DataAttributes,
|
|
20
|
-
type HeadingType,
|
|
21
|
-
type RendersElement,
|
|
22
|
-
type RendersNullableElement,
|
|
23
|
-
} from './utils/types';
|
|
24
|
-
import {isBiggerHeading} from './utils/headings';
|
|
25
|
-
|
|
26
|
-
import type {NonDeprecatedVariant} from './theme-variant-context';
|
|
27
|
-
import type Image from './image';
|
|
28
|
-
import type Video from './video';
|
|
29
|
-
import type {ButtonLink, ButtonPrimary, ButtonSecondary} from './button';
|
|
30
|
-
import type Tag from './tag';
|
|
31
|
-
|
|
32
|
-
const CONTENT_BACKGROUND_COLOR = {
|
|
33
|
-
default: skinVars.colors.background,
|
|
34
|
-
alternative: skinVars.colors.backgroundAlternative,
|
|
35
|
-
brand: skinVars.colors.backgroundBrand,
|
|
36
|
-
'brand-secondary': skinVars.colors.backgroundBrandSecondary,
|
|
37
|
-
none: 'transparent',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
type LayoutProps = {children: React.ReactNode; variant: NonDeprecatedVariant; backgroundColor?: string};
|
|
41
|
-
|
|
42
|
-
const Layout = ({children, variant, backgroundColor}: LayoutProps) => {
|
|
43
|
-
return (
|
|
44
|
-
<InternalResponsiveLayout
|
|
45
|
-
variant={variant}
|
|
46
|
-
className={styles.layout}
|
|
47
|
-
innerDivClassName={styles.layout}
|
|
48
|
-
shouldExpandWhenNested
|
|
49
|
-
backgroundColor={backgroundColor ?? 'transparent'}
|
|
50
|
-
>
|
|
51
|
-
{children}
|
|
52
|
-
</InternalResponsiveLayout>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
type HeroContentProps = {
|
|
57
|
-
headline?: RendersNullableElement<typeof Tag>;
|
|
58
|
-
pretitle?: string;
|
|
59
|
-
pretitleAs?: HeadingType;
|
|
60
|
-
title?: string;
|
|
61
|
-
titleAs?: HeadingType;
|
|
62
|
-
description?: string;
|
|
63
|
-
descriptionLinesMax?: number;
|
|
64
|
-
extra?: React.ReactNode;
|
|
65
|
-
button?: RendersNullableElement<typeof ButtonPrimary>;
|
|
66
|
-
secondaryButton?: RendersNullableElement<typeof ButtonSecondary>;
|
|
67
|
-
buttonLink?: RendersNullableElement<typeof ButtonLink>;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const HeroContent = ({
|
|
71
|
-
headline,
|
|
72
|
-
title,
|
|
73
|
-
titleAs = 'h1',
|
|
74
|
-
pretitle,
|
|
75
|
-
pretitleAs,
|
|
76
|
-
description,
|
|
77
|
-
descriptionLinesMax,
|
|
78
|
-
extra,
|
|
79
|
-
button,
|
|
80
|
-
secondaryButton,
|
|
81
|
-
buttonLink,
|
|
82
|
-
}: HeroContentProps) => {
|
|
83
|
-
const titleContent = title ? (
|
|
84
|
-
<Text8 as={titleAs} dataAttributes={{testid: 'title'}}>
|
|
85
|
-
{title}
|
|
86
|
-
</Text8>
|
|
87
|
-
) : undefined;
|
|
88
|
-
|
|
89
|
-
const pretitleContent = pretitle ? (
|
|
90
|
-
<Text3 as={pretitleAs} regular dataAttributes={{testid: 'pretitle'}}>
|
|
91
|
-
{pretitle}
|
|
92
|
-
</Text3>
|
|
93
|
-
) : undefined;
|
|
94
|
-
|
|
95
|
-
const headlineContent = headline ? (
|
|
96
|
-
<div
|
|
97
|
-
data-testid="headline"
|
|
98
|
-
style={{paddingBottom: pretitle || title || description ? 16 : 0, order: -1}}
|
|
99
|
-
>
|
|
100
|
-
{headline}
|
|
101
|
-
</div>
|
|
102
|
-
) : undefined;
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<section className={styles.contentContainer}>
|
|
106
|
-
<div>
|
|
107
|
-
<Stack space={16}>
|
|
108
|
-
{/** using flex instead of nested Stacks, this way we can rearrange texts so the DOM structure makes more sense for screen reader users */}
|
|
109
|
-
<div className={styles.flexColumn}>
|
|
110
|
-
{isBiggerHeading(titleAs, pretitleAs) ? (
|
|
111
|
-
<>
|
|
112
|
-
{titleContent}
|
|
113
|
-
{headlineContent}
|
|
114
|
-
{pretitleContent && (
|
|
115
|
-
<div style={{paddingBottom: title ? 8 : 0, order: -1}}>
|
|
116
|
-
{pretitleContent}
|
|
117
|
-
</div>
|
|
118
|
-
)}
|
|
119
|
-
</>
|
|
120
|
-
) : (
|
|
121
|
-
<>
|
|
122
|
-
{pretitleContent && (
|
|
123
|
-
<div style={{paddingBottom: title ? 8 : 0}}>{pretitleContent}</div>
|
|
124
|
-
)}
|
|
125
|
-
{headlineContent}
|
|
126
|
-
{titleContent}
|
|
127
|
-
</>
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
{description && (
|
|
132
|
-
<Text3
|
|
133
|
-
as="p"
|
|
134
|
-
regular
|
|
135
|
-
color={skinVars.colors.textSecondary}
|
|
136
|
-
truncate={descriptionLinesMax}
|
|
137
|
-
dataAttributes={{testid: 'description'}}
|
|
138
|
-
>
|
|
139
|
-
{description}
|
|
140
|
-
</Text3>
|
|
141
|
-
)}
|
|
142
|
-
</Stack>
|
|
143
|
-
{extra && <div data-testid="slot">{extra}</div>}
|
|
144
|
-
</div>
|
|
145
|
-
{(button || buttonLink) && (
|
|
146
|
-
<div className={styles.actions}>
|
|
147
|
-
<ButtonGroup primaryButton={button} secondaryButton={secondaryButton} link={buttonLink} />
|
|
148
|
-
</div>
|
|
149
|
-
)}
|
|
150
|
-
</section>
|
|
151
|
-
);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
type HeroProps = {
|
|
155
|
-
height?: string | number;
|
|
156
|
-
background?: 'default' | 'alternative' | 'brand' | 'brand-secondary' | 'none';
|
|
157
|
-
noPaddingY?: boolean;
|
|
158
|
-
media: RendersElement<typeof Image> | RendersElement<typeof Video>;
|
|
159
|
-
headline?: RendersNullableElement<typeof Tag>;
|
|
160
|
-
pretitle?: string;
|
|
161
|
-
pretitleAs?: HeadingType;
|
|
162
|
-
title?: string;
|
|
163
|
-
titleAs?: HeadingType;
|
|
164
|
-
description?: string;
|
|
165
|
-
descriptionLinesMax?: number;
|
|
166
|
-
extra?: React.ReactNode;
|
|
167
|
-
button?: RendersNullableElement<typeof ButtonPrimary>;
|
|
168
|
-
buttonLink?: RendersNullableElement<typeof ButtonLink>;
|
|
169
|
-
dataAttributes?: DataAttributes;
|
|
170
|
-
desktopMediaPosition?: 'left' | 'right';
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const Hero = React.forwardRef<HTMLDivElement, HeroProps>(
|
|
174
|
-
(
|
|
175
|
-
{
|
|
176
|
-
height,
|
|
177
|
-
background = 'default',
|
|
178
|
-
media,
|
|
179
|
-
desktopMediaPosition = 'left',
|
|
180
|
-
dataAttributes,
|
|
181
|
-
noPaddingY,
|
|
182
|
-
...rest
|
|
183
|
-
},
|
|
184
|
-
ref
|
|
185
|
-
) => {
|
|
186
|
-
const {isTabletOrSmaller} = useScreenSize();
|
|
187
|
-
const slideshowContext = useSlideshowContext();
|
|
188
|
-
const hasSlideshowBullets = !!slideshowContext?.withBullets;
|
|
189
|
-
const outsideVariant = useThemeVariant();
|
|
190
|
-
const variant =
|
|
191
|
-
background === 'none'
|
|
192
|
-
? outsideVariant
|
|
193
|
-
: (
|
|
194
|
-
{
|
|
195
|
-
default: 'default',
|
|
196
|
-
alternative: 'alternative',
|
|
197
|
-
brand: 'brand',
|
|
198
|
-
'brand-secondary': 'negative',
|
|
199
|
-
} as const
|
|
200
|
-
)[background];
|
|
201
|
-
|
|
202
|
-
if (isTabletOrSmaller) {
|
|
203
|
-
return (
|
|
204
|
-
<ResetResponsiveLayout>
|
|
205
|
-
<div style={applyCssVars({[mediaStyles.vars.mediaBorderRadius]: '0px'})}>
|
|
206
|
-
<div
|
|
207
|
-
{...getPrefixedDataAttributes(dataAttributes, 'Hero')}
|
|
208
|
-
ref={ref}
|
|
209
|
-
style={{
|
|
210
|
-
...(height === '100vh' ? {maxHeight: '-webkit-fill-available'} : {}), // Hack to avoid issues in Safari with 100vh
|
|
211
|
-
...applyCssVars({
|
|
212
|
-
[styles.vars.height]:
|
|
213
|
-
typeof height === 'number' ? `${height}px` : height ?? '100%',
|
|
214
|
-
[mediaStyles.vars.mediaBorderRadius]: '0px',
|
|
215
|
-
}),
|
|
216
|
-
}}
|
|
217
|
-
className={classnames(styles.container, styles.containerMobile, {
|
|
218
|
-
[styles.containerMinHeight]: !noPaddingY,
|
|
219
|
-
})}
|
|
220
|
-
>
|
|
221
|
-
{media}
|
|
222
|
-
|
|
223
|
-
<Layout variant={variant} backgroundColor={CONTENT_BACKGROUND_COLOR[background]}>
|
|
224
|
-
<div className={styles.expandedContent}>
|
|
225
|
-
<div
|
|
226
|
-
style={{
|
|
227
|
-
paddingTop: skinVars.spacing.heroPadding.top,
|
|
228
|
-
paddingBottom: hasSlideshowBullets
|
|
229
|
-
? 48
|
|
230
|
-
: noPaddingY
|
|
231
|
-
? 0
|
|
232
|
-
: skinVars.spacing.heroPadding.bottom,
|
|
233
|
-
}}
|
|
234
|
-
className={styles.layout}
|
|
235
|
-
>
|
|
236
|
-
<HeroContent {...rest} />
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
</Layout>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</ResetResponsiveLayout>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const left =
|
|
247
|
-
desktopMediaPosition === 'left' ? (
|
|
248
|
-
media
|
|
249
|
-
) : (
|
|
250
|
-
<Box paddingRight={24}>
|
|
251
|
-
<HeroContent {...rest} />
|
|
252
|
-
</Box>
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
const right =
|
|
256
|
-
desktopMediaPosition === 'right' ? (
|
|
257
|
-
media
|
|
258
|
-
) : (
|
|
259
|
-
<Box paddingLeft={24}>
|
|
260
|
-
<HeroContent {...rest} />
|
|
261
|
-
</Box>
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
<div
|
|
266
|
-
{...getPrefixedDataAttributes(dataAttributes, 'Hero')}
|
|
267
|
-
ref={ref}
|
|
268
|
-
style={{
|
|
269
|
-
...(height === '100vh' ? {maxHeight: '-webkit-fill-available'} : {}), // Hack to avoid issues in Safari with 100vh
|
|
270
|
-
...applyCssVars({
|
|
271
|
-
[styles.vars.height]: typeof height === 'number' ? `${height}px` : height ?? '100%',
|
|
272
|
-
[mediaStyles.vars.mediaBorderRadius]: skinVars.borderRadii.container,
|
|
273
|
-
}),
|
|
274
|
-
background: CONTENT_BACKGROUND_COLOR[background],
|
|
275
|
-
}}
|
|
276
|
-
className={styles.hero}
|
|
277
|
-
>
|
|
278
|
-
<Layout variant={variant}>
|
|
279
|
-
<GridLayout
|
|
280
|
-
template="6+6"
|
|
281
|
-
left={
|
|
282
|
-
<div
|
|
283
|
-
style={{
|
|
284
|
-
paddingTop: noPaddingY ? 0 : skinVars.spacing.heroPadding.top,
|
|
285
|
-
paddingBottom:
|
|
286
|
-
noPaddingY && !hasSlideshowBullets
|
|
287
|
-
? 0
|
|
288
|
-
: skinVars.spacing.heroPadding.bottom,
|
|
289
|
-
}}
|
|
290
|
-
className={classnames(styles.container, styles.containerDesktop, {
|
|
291
|
-
[styles.containerMinHeight]: !noPaddingY,
|
|
292
|
-
})}
|
|
293
|
-
>
|
|
294
|
-
{left}
|
|
295
|
-
</div>
|
|
296
|
-
}
|
|
297
|
-
right={
|
|
298
|
-
<div
|
|
299
|
-
style={{
|
|
300
|
-
paddingTop: noPaddingY ? 0 : skinVars.spacing.heroPadding.top,
|
|
301
|
-
paddingBottom:
|
|
302
|
-
noPaddingY && !hasSlideshowBullets
|
|
303
|
-
? 0
|
|
304
|
-
: skinVars.spacing.heroPadding.bottom,
|
|
305
|
-
}}
|
|
306
|
-
className={classnames(styles.container, styles.containerDesktop)}
|
|
307
|
-
>
|
|
308
|
-
{right}
|
|
309
|
-
</div>
|
|
310
|
-
}
|
|
311
|
-
/>
|
|
312
|
-
</Layout>
|
|
313
|
-
</div>
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
export default Hero;
|
package/src/hooks.tsx
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
// this is a false positive, because there isn't any component in this module
|
|
2
|
-
/* eslint-disable mistica-local-rules/use-client */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import ThemeContext from './theme-context';
|
|
5
|
-
import ScreenSizeContext from './screen-size-context';
|
|
6
|
-
import {listenResize} from './utils/dom';
|
|
7
|
-
import {isClientSide} from './utils/environment';
|
|
8
|
-
import {isEqual} from './utils/helpers';
|
|
9
|
-
|
|
10
|
-
import type {Theme} from './theme';
|
|
11
|
-
import type {ScreenSizeContextType} from './screen-size-context';
|
|
12
|
-
|
|
13
|
-
export const useTheme = (): Theme => {
|
|
14
|
-
const theme = React.useContext(ThemeContext);
|
|
15
|
-
if (!theme) {
|
|
16
|
-
throw Error(
|
|
17
|
-
`To use @telefonica/mistica components you must instantiate <ThemeContextProvider> as their parent.`
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
return theme;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let bodyStyles = '';
|
|
24
|
-
let bodyScrollTop = 0;
|
|
25
|
-
let disableBodyDepth = 0;
|
|
26
|
-
|
|
27
|
-
export const useDisableBodyScroll = (disable: boolean): void => {
|
|
28
|
-
React.useEffect(() => {
|
|
29
|
-
if (disable) {
|
|
30
|
-
const scrollContainer = document.scrollingElement || document.documentElement;
|
|
31
|
-
|
|
32
|
-
const disableBodyScroll = () => {
|
|
33
|
-
disableBodyDepth++;
|
|
34
|
-
if (disableBodyDepth > 1) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
bodyScrollTop = scrollContainer?.scrollTop ?? 0;
|
|
38
|
-
bodyStyles = document.body?.style.cssText ?? '';
|
|
39
|
-
if (document.body) {
|
|
40
|
-
const hasScrollbar =
|
|
41
|
-
window.innerWidth > (scrollContainer?.clientWidth ?? window.innerWidth);
|
|
42
|
-
|
|
43
|
-
// if the scrollbar is visible, we don't want to hide it because content will be resized
|
|
44
|
-
const overflowY = hasScrollbar ? 'scroll' : 'hidden';
|
|
45
|
-
|
|
46
|
-
document.body.style.cssText =
|
|
47
|
-
bodyStyles +
|
|
48
|
-
(bodyStyles.endsWith(';') ? '' : ';') +
|
|
49
|
-
[
|
|
50
|
-
'overflow: hidden;',
|
|
51
|
-
`overflow-y: ${overflowY};`,
|
|
52
|
-
'position: fixed;',
|
|
53
|
-
`top: ${-bodyScrollTop}px;`,
|
|
54
|
-
'left: 0px;',
|
|
55
|
-
'right: 0px;',
|
|
56
|
-
'overscroll-behavior-y: contain;', // disable overscroll
|
|
57
|
-
].join('');
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const enableBodyScroll = () => {
|
|
61
|
-
disableBodyDepth--;
|
|
62
|
-
if (disableBodyDepth > 0) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (document.body) {
|
|
66
|
-
document.body.style.cssText = bodyStyles;
|
|
67
|
-
}
|
|
68
|
-
if (scrollContainer) {
|
|
69
|
-
scrollContainer.scrollTop = bodyScrollTop;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
disableBodyScroll();
|
|
73
|
-
return enableBodyScroll;
|
|
74
|
-
}
|
|
75
|
-
return () => {};
|
|
76
|
-
}, [disable]);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const useScreenSize = (): ScreenSizeContextType => React.useContext(ScreenSizeContext);
|
|
80
|
-
|
|
81
|
-
export const useElementDimensions = ({includeMargins = false}: {includeMargins?: boolean} = {}): {
|
|
82
|
-
width: number;
|
|
83
|
-
height: number;
|
|
84
|
-
ref: (node: HTMLElement | null) => void;
|
|
85
|
-
} => {
|
|
86
|
-
const [width, setWidth] = React.useState(0);
|
|
87
|
-
const [height, setHeight] = React.useState(0);
|
|
88
|
-
const [element, setElement] = React.useState<HTMLElement | null>(null);
|
|
89
|
-
|
|
90
|
-
const updateSize = React.useCallback(
|
|
91
|
-
(entries: Array<ResizeObserverEntry>) => {
|
|
92
|
-
if (!entries) {
|
|
93
|
-
setWidth(0);
|
|
94
|
-
setHeight(0);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const {width, height} = entries[0].contentRect;
|
|
99
|
-
if (includeMargins) {
|
|
100
|
-
const style = window.getComputedStyle(entries[0].target);
|
|
101
|
-
const marginTop = parseInt(style.marginTop, 10);
|
|
102
|
-
const marginBottom = parseInt(style.marginBottom, 10);
|
|
103
|
-
const marginLeft = parseInt(style.marginLeft, 10);
|
|
104
|
-
const marginRight = parseInt(style.marginRight, 10);
|
|
105
|
-
setWidth(width + marginLeft + marginRight);
|
|
106
|
-
setHeight(height + marginTop + marginBottom);
|
|
107
|
-
} else {
|
|
108
|
-
setWidth(width);
|
|
109
|
-
setHeight(height);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
[includeMargins]
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
const ref = React.useCallback((node: HTMLElement | null) => {
|
|
116
|
-
setElement(node);
|
|
117
|
-
}, []);
|
|
118
|
-
|
|
119
|
-
React.useEffect(() => {
|
|
120
|
-
if (!element) {
|
|
121
|
-
setWidth(0);
|
|
122
|
-
setHeight(0);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return listenResize(element, updateSize);
|
|
127
|
-
}, [element, updateSize]);
|
|
128
|
-
|
|
129
|
-
return {width, height, ref};
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const useWindowSize = (): {
|
|
133
|
-
height: number;
|
|
134
|
-
width: number;
|
|
135
|
-
screenHeight: number;
|
|
136
|
-
screenWidth: number;
|
|
137
|
-
/** Size of the available window size, removing virtual keyboard and native navigation bar or status bar */
|
|
138
|
-
visualHeight: number;
|
|
139
|
-
} => {
|
|
140
|
-
const [windowHeight, setWindowHeight] = React.useState<number>(
|
|
141
|
-
isClientSide() ? window.innerHeight : 1200 // Best guess
|
|
142
|
-
);
|
|
143
|
-
const [windowWidth, setWindowWidth] = React.useState<number>(
|
|
144
|
-
isClientSide() ? window.innerWidth : 800 // Best guess
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const [screenHeight, setScreenHeight] = React.useState<number>(
|
|
148
|
-
isClientSide() ? window.screen.availHeight : 1200
|
|
149
|
-
);
|
|
150
|
-
const [screenWidth, setScreenWidth] = React.useState<number>(
|
|
151
|
-
isClientSide() ? window.screen.availWidth : 800
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
const [visualHeight, setVisualHeight] = React.useState<number>(
|
|
155
|
-
isClientSide() ? window.visualViewport?.height || window.screen.availHeight : 1200
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
React.useEffect(() => {
|
|
159
|
-
const handleResize = () => {
|
|
160
|
-
setWindowHeight(window.innerHeight);
|
|
161
|
-
setWindowWidth(window.innerWidth);
|
|
162
|
-
setScreenHeight(window.screen.availHeight);
|
|
163
|
-
setScreenWidth(window.screen.availWidth);
|
|
164
|
-
setVisualHeight(window.visualViewport?.height || window.screen.availHeight);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
window.addEventListener('resize', handleResize);
|
|
168
|
-
|
|
169
|
-
return () => {
|
|
170
|
-
window.removeEventListener('resize', handleResize);
|
|
171
|
-
};
|
|
172
|
-
}, []);
|
|
173
|
-
|
|
174
|
-
// do not create new result instances if values don't change
|
|
175
|
-
return React.useMemo(
|
|
176
|
-
() => ({
|
|
177
|
-
height: windowHeight,
|
|
178
|
-
width: windowWidth,
|
|
179
|
-
screenHeight,
|
|
180
|
-
screenWidth,
|
|
181
|
-
visualHeight,
|
|
182
|
-
}),
|
|
183
|
-
[windowHeight, windowWidth, screenHeight, screenWidth, visualHeight]
|
|
184
|
-
);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export const useWindowHeight = (): number => {
|
|
188
|
-
const {height} = useWindowSize();
|
|
189
|
-
return height;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export const useWindowWidth = (): number => {
|
|
193
|
-
const {width} = useWindowSize();
|
|
194
|
-
return width;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const useScreenHeight = (): number => {
|
|
198
|
-
const {screenHeight} = useWindowSize();
|
|
199
|
-
return screenHeight;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export const useIsWithinIFrame = (): boolean => {
|
|
203
|
-
return isClientSide() && window.top !== window.self;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// React currently throws a warning when using useLayoutEffect on the server.
|
|
207
|
-
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
208
|
-
// useLayoutEffect in the browser
|
|
209
|
-
export const useIsomorphicLayoutEffect = isClientSide() ? React.useLayoutEffect : React.useEffect;
|
|
210
|
-
|
|
211
|
-
type IntersectionObserverOptions = {
|
|
212
|
-
root?: Element | Document | null;
|
|
213
|
-
rootMargin?: string;
|
|
214
|
-
threshold?: number | Array<number>;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
export const useIsInViewport = (
|
|
218
|
-
ref: React.RefObject<Element | null>,
|
|
219
|
-
defaultValue: boolean,
|
|
220
|
-
options?: IntersectionObserverOptions
|
|
221
|
-
): boolean => {
|
|
222
|
-
const [isInViewport, setIsInViewport] = React.useState<boolean>(defaultValue);
|
|
223
|
-
|
|
224
|
-
React.useEffect(() => {
|
|
225
|
-
if (!ref.current) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (typeof window.IntersectionObserver === 'undefined') {
|
|
230
|
-
return () => {};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const observer = new IntersectionObserver(
|
|
234
|
-
(entries) => {
|
|
235
|
-
setIsInViewport(entries[0].isIntersecting);
|
|
236
|
-
},
|
|
237
|
-
{root: options?.root, rootMargin: options?.rootMargin, threshold: options?.threshold}
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
observer.observe(ref.current);
|
|
241
|
-
|
|
242
|
-
return () => {
|
|
243
|
-
observer.disconnect();
|
|
244
|
-
};
|
|
245
|
-
}, [ref, options?.root, options?.rootMargin, options?.threshold]);
|
|
246
|
-
|
|
247
|
-
return isInViewport;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
export type BoundingRect = {
|
|
251
|
-
top: number;
|
|
252
|
-
right: number;
|
|
253
|
-
bottom: number;
|
|
254
|
-
left: number;
|
|
255
|
-
width: number;
|
|
256
|
-
height: number;
|
|
257
|
-
x: number;
|
|
258
|
-
y: number;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const getBoundingClientRect = (element: Element): BoundingRect => {
|
|
262
|
-
const {top, right, bottom, left, width, height, x, y} = element.getBoundingClientRect();
|
|
263
|
-
return {top, right, bottom, left, width, height, x, y};
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
export const useBoundingRect = (
|
|
267
|
-
ref: React.RefObject<Element | null>,
|
|
268
|
-
computeOnEveryFrame = true,
|
|
269
|
-
trackIfNotVisible = false
|
|
270
|
-
): BoundingRect | undefined => {
|
|
271
|
-
const [rect, setRect] = React.useState<BoundingRect>();
|
|
272
|
-
const isVisible = useIsInViewport(ref, false);
|
|
273
|
-
|
|
274
|
-
React.useEffect(() => {
|
|
275
|
-
let id: number;
|
|
276
|
-
|
|
277
|
-
const check = () => {
|
|
278
|
-
if (ref.current && (isVisible || trackIfNotVisible)) {
|
|
279
|
-
const current = getBoundingClientRect(ref.current);
|
|
280
|
-
if (!isEqual(rect, current)) {
|
|
281
|
-
setRect(current);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (computeOnEveryFrame) {
|
|
285
|
-
id = requestAnimationFrame(check);
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
setRect(undefined);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
id = requestAnimationFrame(check);
|
|
293
|
-
|
|
294
|
-
return () => {
|
|
295
|
-
cancelAnimationFrame(id);
|
|
296
|
-
};
|
|
297
|
-
}, [ref, rect, isVisible, computeOnEveryFrame, trackIfNotVisible]);
|
|
298
|
-
|
|
299
|
-
return rect;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export const useInnerText = (): {text: string; ref: (instance: HTMLElement | null) => void} => {
|
|
303
|
-
const [text, setText] = React.useState('');
|
|
304
|
-
|
|
305
|
-
const ref: React.LegacyRef<HTMLElement> = React.useCallback((node: HTMLElement) => {
|
|
306
|
-
if (node) {
|
|
307
|
-
// jsdom doesn't implements innerText. Using textContent as fallback in unit tests although it's not the same
|
|
308
|
-
setText((process.env.NODE_ENV === 'test' ? node.textContent : node.innerText) || '');
|
|
309
|
-
}
|
|
310
|
-
}, []);
|
|
311
|
-
|
|
312
|
-
return {text, ref};
|
|
313
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {fallbackVar, globalStyle, style} from '@vanilla-extract/css';
|
|
2
|
-
import * as mq from './media-queries.css';
|
|
3
|
-
import {vars as responsiveLayoutVars} from './responsive-layout.css';
|
|
4
|
-
import {sprinkles} from './sprinkles.css';
|
|
5
|
-
|
|
6
|
-
const responsiveLayoutSideMargin = fallbackVar(responsiveLayoutVars.sideMargin, '0px');
|
|
7
|
-
|
|
8
|
-
const sideMarginSpacer = {
|
|
9
|
-
content: '""',
|
|
10
|
-
display: 'block',
|
|
11
|
-
flexShrink: 0,
|
|
12
|
-
width: responsiveLayoutSideMargin,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const hideScrollbar = {
|
|
16
|
-
scrollbarWidth: 'none', // Firefox
|
|
17
|
-
'::-webkit-scrollbar': {
|
|
18
|
-
display: 'none', // Safari + Chrome
|
|
19
|
-
},
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
export const scroll = style([
|
|
23
|
-
sprinkles({
|
|
24
|
-
display: 'flex',
|
|
25
|
-
}),
|
|
26
|
-
{
|
|
27
|
-
overflowX: 'auto',
|
|
28
|
-
overflowY: 'hidden',
|
|
29
|
-
margin: `0 calc(${responsiveLayoutSideMargin} * -1)`,
|
|
30
|
-
':after': sideMarginSpacer,
|
|
31
|
-
':before': sideMarginSpacer,
|
|
32
|
-
|
|
33
|
-
'@media': {
|
|
34
|
-
[mq.touchableOnly]: hideScrollbar,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
]);
|
|
38
|
-
|
|
39
|
-
export const noScrollbar = style(hideScrollbar);
|
|
40
|
-
|
|
41
|
-
globalStyle(`${scroll} > *`, {
|
|
42
|
-
flexShrink: 0,
|
|
43
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as styles from './horizontal-scroll.css';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
noScrollbar?: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const HorizontalScroll = React.forwardRef<HTMLDivElement, Props>(({children, noScrollbar}: Props, ref) => {
|
|
11
|
-
return (
|
|
12
|
-
<div className={classNames(styles.scroll, {[styles.noScrollbar]: noScrollbar})} ref={ref}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export default HorizontalScroll;
|