@telefonica/mistica 16.59.0-beta.1 → 16.59.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 +1 -13
- 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/tooltip.tsx
DELETED
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {useBoundingRect, useTheme, useWindowSize} from './hooks';
|
|
4
|
-
import {Portal} from './portal';
|
|
5
|
-
import {Transition} from 'react-transition-group';
|
|
6
|
-
import * as styles from './tooltip.css';
|
|
7
|
-
import Stack from './stack';
|
|
8
|
-
import {Text2} from './text';
|
|
9
|
-
import {getCssVarValue} from './utils/dom';
|
|
10
|
-
import {ESC, TAB} from './utils/keys';
|
|
11
|
-
import {isTouchableDevice} from './utils/environment';
|
|
12
|
-
import {isEqual} from './utils/helpers';
|
|
13
|
-
import classNames from 'classnames';
|
|
14
|
-
import {vars} from './skins/skin-contract.css';
|
|
15
|
-
import {ThemeVariant, useThemeVariant} from './theme-variant-context';
|
|
16
|
-
import {combineRefs} from './utils/common';
|
|
17
|
-
import {useSetTooltipState, useTooltipState} from './tooltip-context-provider';
|
|
18
|
-
import {isRunningAcceptanceTest} from './utils/platform';
|
|
19
|
-
import {IconButton} from './icon-button';
|
|
20
|
-
import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
|
|
21
|
-
import * as tokens from './text-tokens';
|
|
22
|
-
|
|
23
|
-
import type {NonDeprecatedVariant} from './theme-variant-context';
|
|
24
|
-
import type {BoundingRect} from './hooks';
|
|
25
|
-
import type {DataAttributes, TrackingEvent} from './utils/types';
|
|
26
|
-
|
|
27
|
-
const getBorderStyle = (variant: NonDeprecatedVariant): React.CSSProperties => {
|
|
28
|
-
const borderColor = {
|
|
29
|
-
default: vars.colors.border,
|
|
30
|
-
alternative: vars.colors.border,
|
|
31
|
-
brand: vars.colors.backgroundContainer,
|
|
32
|
-
negative: vars.colors.backgroundContainer,
|
|
33
|
-
media: vars.colors.backgroundContainer,
|
|
34
|
-
}[variant];
|
|
35
|
-
return {border: `1px solid ${borderColor}`};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const TOOLTIP_MAX_WIDTH = 496;
|
|
39
|
-
const TOOLTIP_ENTER_TRANSITION_DURATION_IN_MS = 300;
|
|
40
|
-
const TOOLTIP_ENTER_TRANSITION_DELAY_IN_MS = 500;
|
|
41
|
-
const TOOLTIP_EXIT_TRANSITION_DURATION_IN_MS = 100;
|
|
42
|
-
const ARROW_SIZE = 20;
|
|
43
|
-
const TOOLTIP_OFFSET_FROM_TARGET = 6;
|
|
44
|
-
const TOOLTIP_PADDING_FROM_TARGET = TOOLTIP_OFFSET_FROM_TARGET + ARROW_SIZE / 2 + 1;
|
|
45
|
-
|
|
46
|
-
type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
47
|
-
|
|
48
|
-
const getTooltipEnterTransform = (position?: Position) => {
|
|
49
|
-
switch (position) {
|
|
50
|
-
case 'left':
|
|
51
|
-
return `translateX(-${TOOLTIP_OFFSET_FROM_TARGET}px)`;
|
|
52
|
-
case 'right':
|
|
53
|
-
return `translateX(${TOOLTIP_OFFSET_FROM_TARGET}px)`;
|
|
54
|
-
case 'top':
|
|
55
|
-
return `translateY(-${TOOLTIP_OFFSET_FROM_TARGET}px)`;
|
|
56
|
-
case 'bottom':
|
|
57
|
-
return `translateY(${TOOLTIP_OFFSET_FROM_TARGET}px)`;
|
|
58
|
-
default:
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const getElementDimensionsWithoutPadding = (element: HTMLElement) => {
|
|
64
|
-
const horizontalPadding =
|
|
65
|
-
parseFloat(getComputedStyle(element, null).paddingLeft) +
|
|
66
|
-
parseFloat(getComputedStyle(element, null).paddingRight);
|
|
67
|
-
|
|
68
|
-
const verticalPadding =
|
|
69
|
-
parseFloat(getComputedStyle(element, null).paddingTop) +
|
|
70
|
-
parseFloat(getComputedStyle(element, null).paddingBottom);
|
|
71
|
-
|
|
72
|
-
const width = element.offsetWidth - horizontalPadding;
|
|
73
|
-
const height = element.offsetHeight - verticalPadding;
|
|
74
|
-
return {width, height};
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const getFinalPosition = (
|
|
78
|
-
targetRect: BoundingRect | undefined,
|
|
79
|
-
tooltip: HTMLElement | undefined | null,
|
|
80
|
-
position: Position,
|
|
81
|
-
windowHeight: number,
|
|
82
|
-
windowWidth: number
|
|
83
|
-
): Position | undefined => {
|
|
84
|
-
if (!targetRect || !tooltip) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
const {top, bottom, left, right} = targetRect;
|
|
88
|
-
|
|
89
|
-
const availableSpaceOnBottom = windowHeight - bottom;
|
|
90
|
-
const availableSpaceOnRight = windowWidth - right;
|
|
91
|
-
const availableSpaceOnTop = top;
|
|
92
|
-
const availableSpaceOnLeft = left;
|
|
93
|
-
|
|
94
|
-
const {width, height} = getElementDimensionsWithoutPadding(tooltip);
|
|
95
|
-
|
|
96
|
-
const tooltipWidth = width + TOOLTIP_PADDING_FROM_TARGET;
|
|
97
|
-
const tooltipHeight = height + TOOLTIP_PADDING_FROM_TARGET;
|
|
98
|
-
|
|
99
|
-
const fitsHorizontal = tooltipWidth <= Math.max(availableSpaceOnLeft, availableSpaceOnRight);
|
|
100
|
-
const fitsVertical = tooltipHeight <= Math.max(availableSpaceOnBottom, availableSpaceOnTop);
|
|
101
|
-
|
|
102
|
-
if (!fitsVertical && !fitsHorizontal) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
switch (position) {
|
|
107
|
-
case 'left':
|
|
108
|
-
if (fitsHorizontal) {
|
|
109
|
-
return tooltipWidth <= availableSpaceOnLeft ? 'left' : 'right';
|
|
110
|
-
} else {
|
|
111
|
-
return availableSpaceOnBottom > availableSpaceOnTop ? 'bottom' : 'top';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
case 'right':
|
|
115
|
-
if (fitsHorizontal) {
|
|
116
|
-
return tooltipWidth <= availableSpaceOnRight ? 'right' : 'left';
|
|
117
|
-
} else {
|
|
118
|
-
return availableSpaceOnBottom > availableSpaceOnTop ? 'bottom' : 'top';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
case 'top':
|
|
122
|
-
if (fitsVertical) {
|
|
123
|
-
return tooltipHeight <= availableSpaceOnTop ? 'top' : 'bottom';
|
|
124
|
-
} else {
|
|
125
|
-
return availableSpaceOnLeft > availableSpaceOnRight ? 'left' : 'right';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
case 'bottom':
|
|
129
|
-
if (fitsVertical) {
|
|
130
|
-
return tooltipHeight <= availableSpaceOnBottom ? 'bottom' : 'top';
|
|
131
|
-
} else {
|
|
132
|
-
return availableSpaceOnLeft > availableSpaceOnRight ? 'left' : 'right';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
default:
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
type Props = {
|
|
141
|
-
children?: React.ReactNode;
|
|
142
|
-
extra?: React.ReactNode;
|
|
143
|
-
description?: string;
|
|
144
|
-
target: React.ReactNode;
|
|
145
|
-
targetStyle?: React.CSSProperties;
|
|
146
|
-
title?: string;
|
|
147
|
-
position?: Position;
|
|
148
|
-
width?: number;
|
|
149
|
-
delay?: boolean;
|
|
150
|
-
dataAttributes?: DataAttributes;
|
|
151
|
-
centerContent?: boolean;
|
|
152
|
-
open?: boolean;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
type BaseTooltipProps = {
|
|
156
|
-
content?: React.ReactNode;
|
|
157
|
-
target: React.ReactNode;
|
|
158
|
-
targetStyle?: React.CSSProperties;
|
|
159
|
-
position?: Position;
|
|
160
|
-
width?: number;
|
|
161
|
-
delay?: boolean;
|
|
162
|
-
dataAttributes?: DataAttributes;
|
|
163
|
-
centerContent?: boolean;
|
|
164
|
-
open?: boolean;
|
|
165
|
-
hasPointerInteractionOnly?: boolean;
|
|
166
|
-
onClose?: () => void;
|
|
167
|
-
closeButtonLabel?: string;
|
|
168
|
-
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const BaseTooltip = ({
|
|
172
|
-
content,
|
|
173
|
-
target,
|
|
174
|
-
targetStyle,
|
|
175
|
-
width,
|
|
176
|
-
position = 'top',
|
|
177
|
-
dataAttributes,
|
|
178
|
-
delay = true,
|
|
179
|
-
centerContent,
|
|
180
|
-
open,
|
|
181
|
-
onClose,
|
|
182
|
-
closeButtonLabel,
|
|
183
|
-
hasPointerInteractionOnly = false,
|
|
184
|
-
trackingEvent,
|
|
185
|
-
}: BaseTooltipProps): JSX.Element => {
|
|
186
|
-
const {texts, t} = useTheme();
|
|
187
|
-
const tooltipId = React.useId();
|
|
188
|
-
const {openTooltipId} = useTooltipState();
|
|
189
|
-
const {openTooltip, closeTooltip} = useSetTooltipState();
|
|
190
|
-
|
|
191
|
-
const [tooltipComputedStyles, setTooltipComputedStyles] = React.useState<React.CSSProperties>();
|
|
192
|
-
|
|
193
|
-
const [arrowComputedStyles, setArrowComputedStyles] = React.useState<React.CSSProperties>();
|
|
194
|
-
|
|
195
|
-
const targetRef = React.useRef<Element | null>(null);
|
|
196
|
-
const tooltipRef = React.useRef<HTMLDivElement | null>(null);
|
|
197
|
-
const [tooltip, setTooltip] = React.useState<HTMLElement | null>(null);
|
|
198
|
-
const isTouchable = isTouchableDevice();
|
|
199
|
-
const tooltipEnterDelay = delay ? TOOLTIP_ENTER_TRANSITION_DELAY_IN_MS : 0;
|
|
200
|
-
|
|
201
|
-
const [isMouseOverTooltip, setIsMouseOverTooltip] = React.useState(false);
|
|
202
|
-
const [isMouseOverTarget, setIsMouseOverTarget] = React.useState(false);
|
|
203
|
-
|
|
204
|
-
const hasControlledValue = open !== undefined;
|
|
205
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
206
|
-
const isTooltipOpen = hasControlledValue ? open : tooltipId === openTooltipId;
|
|
207
|
-
const themeVariant = useThemeVariant();
|
|
208
|
-
|
|
209
|
-
const targetRect = useBoundingRect(targetRef, isTooltipOpen);
|
|
210
|
-
const tooltipRect = useBoundingRect(tooltipRef, isTooltipOpen, true);
|
|
211
|
-
const windowSize = useWindowSize();
|
|
212
|
-
|
|
213
|
-
const resetTooltipInteractions = React.useCallback(() => {
|
|
214
|
-
setIsFocused(false);
|
|
215
|
-
setIsMouseOverTooltip(false);
|
|
216
|
-
setIsMouseOverTarget(false);
|
|
217
|
-
}, []);
|
|
218
|
-
|
|
219
|
-
React.useEffect(() => {
|
|
220
|
-
if (!isTooltipOpen) {
|
|
221
|
-
resetTooltipInteractions();
|
|
222
|
-
}
|
|
223
|
-
}, [isTooltipOpen, resetTooltipInteractions]);
|
|
224
|
-
|
|
225
|
-
React.useEffect(() => {
|
|
226
|
-
if (!tooltip || !isTooltipOpen) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const finalPosition = getFinalPosition(
|
|
231
|
-
targetRect,
|
|
232
|
-
tooltip,
|
|
233
|
-
position,
|
|
234
|
-
windowSize.height,
|
|
235
|
-
windowSize.width
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
if (!finalPosition || !targetRect) {
|
|
239
|
-
setTooltipComputedStyles(undefined);
|
|
240
|
-
setArrowComputedStyles(undefined);
|
|
241
|
-
resetTooltipInteractions();
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
let tooltipStyles: React.CSSProperties;
|
|
246
|
-
let arrowStyles: React.CSSProperties;
|
|
247
|
-
|
|
248
|
-
const {left, right, top, bottom} = targetRect;
|
|
249
|
-
const {width: tooltipWidth, height: tooltipHeight} = getElementDimensionsWithoutPadding(tooltip);
|
|
250
|
-
|
|
251
|
-
const maxLeftOffset = windowSize.width - tooltipWidth;
|
|
252
|
-
const maxTopOffset = windowSize.height - tooltipHeight;
|
|
253
|
-
|
|
254
|
-
const arrowOffsetFromViewport = parseInt(getCssVarValue(vars.borderRadii.popup)) ?? 8;
|
|
255
|
-
|
|
256
|
-
switch (finalPosition) {
|
|
257
|
-
case 'top':
|
|
258
|
-
tooltipStyles = {
|
|
259
|
-
left: Math.max(0, Math.min(maxLeftOffset, (left + right - tooltipWidth) / 2)),
|
|
260
|
-
top: top - tooltipHeight - ARROW_SIZE / 2,
|
|
261
|
-
padding: `0px 0px ${TOOLTIP_PADDING_FROM_TARGET}px 0px`,
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
arrowStyles = {
|
|
265
|
-
left: Math.max(
|
|
266
|
-
arrowOffsetFromViewport,
|
|
267
|
-
Math.min(
|
|
268
|
-
windowSize.width - arrowOffsetFromViewport - ARROW_SIZE,
|
|
269
|
-
(left + right - ARROW_SIZE) / 2
|
|
270
|
-
)
|
|
271
|
-
),
|
|
272
|
-
top: '100%',
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
break;
|
|
276
|
-
|
|
277
|
-
case 'bottom':
|
|
278
|
-
tooltipStyles = {
|
|
279
|
-
left: Math.max(0, Math.min(maxLeftOffset, (left + right - tooltipWidth) / 2)),
|
|
280
|
-
top: bottom - TOOLTIP_OFFSET_FROM_TARGET,
|
|
281
|
-
padding: `${TOOLTIP_PADDING_FROM_TARGET}px 0px 0px 0px`,
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
arrowStyles = {
|
|
285
|
-
left: Math.max(
|
|
286
|
-
arrowOffsetFromViewport,
|
|
287
|
-
Math.min(
|
|
288
|
-
windowSize.width - arrowOffsetFromViewport - ARROW_SIZE,
|
|
289
|
-
(left + right - ARROW_SIZE) / 2
|
|
290
|
-
)
|
|
291
|
-
),
|
|
292
|
-
bottom: '100%',
|
|
293
|
-
transform: 'rotate(180deg)',
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
break;
|
|
297
|
-
|
|
298
|
-
case 'left':
|
|
299
|
-
tooltipStyles = {
|
|
300
|
-
left: left - tooltipWidth - ARROW_SIZE / 2,
|
|
301
|
-
top: Math.max(0, Math.min(maxTopOffset, (top + bottom - tooltipHeight) / 2)),
|
|
302
|
-
padding: `0px ${TOOLTIP_PADDING_FROM_TARGET}px 0px 0px`,
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
arrowStyles = {
|
|
306
|
-
top: Math.max(
|
|
307
|
-
arrowOffsetFromViewport,
|
|
308
|
-
Math.min(
|
|
309
|
-
windowSize.height - arrowOffsetFromViewport - ARROW_SIZE,
|
|
310
|
-
(top + bottom - ARROW_SIZE) / 2
|
|
311
|
-
)
|
|
312
|
-
),
|
|
313
|
-
left: '100%',
|
|
314
|
-
transform: 'rotate(-90deg)',
|
|
315
|
-
transformOrigin: 'bottom',
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
break;
|
|
319
|
-
|
|
320
|
-
case 'right':
|
|
321
|
-
default:
|
|
322
|
-
tooltipStyles = {
|
|
323
|
-
left: right - TOOLTIP_OFFSET_FROM_TARGET,
|
|
324
|
-
top: Math.max(0, Math.min(maxTopOffset, (top + bottom - tooltipHeight) / 2)),
|
|
325
|
-
padding: `0px 0px 0px ${TOOLTIP_PADDING_FROM_TARGET}px`,
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
arrowStyles = {
|
|
329
|
-
top: Math.max(
|
|
330
|
-
arrowOffsetFromViewport,
|
|
331
|
-
Math.min(
|
|
332
|
-
windowSize.height - arrowOffsetFromViewport - ARROW_SIZE,
|
|
333
|
-
(top + bottom - ARROW_SIZE) / 2
|
|
334
|
-
)
|
|
335
|
-
),
|
|
336
|
-
right: '100%',
|
|
337
|
-
transform: 'rotate(90deg)',
|
|
338
|
-
transformOrigin: 'bottom',
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Using numbers for top/left positions of arrow element was causing the arrow to
|
|
346
|
-
* be misaligned by +/- 1 pixel in some cases. Using percentages works better when
|
|
347
|
-
* dealing with decimals for some reason.
|
|
348
|
-
*/
|
|
349
|
-
if (typeof arrowStyles.top === 'number') {
|
|
350
|
-
arrowStyles.top -= tooltipStyles.top as number;
|
|
351
|
-
arrowStyles.top = `${(arrowStyles.top / tooltipHeight) * 100}%`;
|
|
352
|
-
}
|
|
353
|
-
if (typeof arrowStyles.left === 'number') {
|
|
354
|
-
arrowStyles.left -= tooltipStyles.left as number;
|
|
355
|
-
arrowStyles.left = `${(arrowStyles.left / tooltipWidth) * 100}%`;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (!isEqual(tooltipStyles, tooltipComputedStyles)) {
|
|
359
|
-
setTooltipComputedStyles(tooltipStyles);
|
|
360
|
-
}
|
|
361
|
-
if (!isEqual(arrowStyles, arrowComputedStyles)) {
|
|
362
|
-
setArrowComputedStyles(arrowStyles);
|
|
363
|
-
}
|
|
364
|
-
}, [
|
|
365
|
-
tooltip,
|
|
366
|
-
targetRect,
|
|
367
|
-
tooltipRect,
|
|
368
|
-
isTooltipOpen,
|
|
369
|
-
position,
|
|
370
|
-
windowSize,
|
|
371
|
-
tooltipComputedStyles,
|
|
372
|
-
arrowComputedStyles,
|
|
373
|
-
isTouchable,
|
|
374
|
-
tooltipId,
|
|
375
|
-
resetTooltipInteractions,
|
|
376
|
-
]);
|
|
377
|
-
|
|
378
|
-
const isTabKeyDownRef = React.useRef(false);
|
|
379
|
-
|
|
380
|
-
React.useEffect(() => {
|
|
381
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
382
|
-
switch (e.key) {
|
|
383
|
-
case ESC:
|
|
384
|
-
if (!hasPointerInteractionOnly) {
|
|
385
|
-
resetTooltipInteractions();
|
|
386
|
-
}
|
|
387
|
-
break;
|
|
388
|
-
case TAB:
|
|
389
|
-
isTabKeyDownRef.current = true;
|
|
390
|
-
break;
|
|
391
|
-
default:
|
|
392
|
-
// do nothing
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
const handleKeyUp = () => (isTabKeyDownRef.current = false);
|
|
397
|
-
|
|
398
|
-
// click outside the target when tooltip is closed
|
|
399
|
-
const handleOnClick = (e: MouseEvent) => {
|
|
400
|
-
if (
|
|
401
|
-
!hasPointerInteractionOnly &&
|
|
402
|
-
isTouchable &&
|
|
403
|
-
targetRect &&
|
|
404
|
-
(e.clientX < targetRect.left ||
|
|
405
|
-
e.clientX > targetRect.right ||
|
|
406
|
-
e.clientY < targetRect.top ||
|
|
407
|
-
e.clientY > targetRect.bottom)
|
|
408
|
-
) {
|
|
409
|
-
resetTooltipInteractions();
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
document.addEventListener('keydown', handleKeyDown, false);
|
|
414
|
-
document.addEventListener('keyup', handleKeyUp, false);
|
|
415
|
-
document.addEventListener('click', handleOnClick, false);
|
|
416
|
-
return () => {
|
|
417
|
-
document.removeEventListener('keydown', handleKeyDown, false);
|
|
418
|
-
document.removeEventListener('keyup', handleKeyUp, false);
|
|
419
|
-
document.removeEventListener('click', handleOnClick, false);
|
|
420
|
-
};
|
|
421
|
-
}, [isTouchable, resetTooltipInteractions, targetRect, hasPointerInteractionOnly]);
|
|
422
|
-
|
|
423
|
-
React.useEffect(() => {
|
|
424
|
-
if (!hasControlledValue) {
|
|
425
|
-
if (isMouseOverTarget || isMouseOverTooltip || isFocused) {
|
|
426
|
-
openTooltip(tooltipId);
|
|
427
|
-
} else {
|
|
428
|
-
closeTooltip(tooltipId);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}, [
|
|
432
|
-
isMouseOverTarget,
|
|
433
|
-
isMouseOverTooltip,
|
|
434
|
-
isFocused,
|
|
435
|
-
tooltipId,
|
|
436
|
-
openTooltip,
|
|
437
|
-
closeTooltip,
|
|
438
|
-
hasControlledValue,
|
|
439
|
-
]);
|
|
440
|
-
|
|
441
|
-
const currentPosition = getFinalPosition(
|
|
442
|
-
targetRect,
|
|
443
|
-
tooltip,
|
|
444
|
-
position,
|
|
445
|
-
windowSize.height,
|
|
446
|
-
windowSize.width
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
// by default, center content only if tooltip has minimum possible width
|
|
450
|
-
const hasCenteredContent =
|
|
451
|
-
centerContent !== undefined ? centerContent : tooltipRect?.width === styles.CONTENT_MIN_WIDTH;
|
|
452
|
-
|
|
453
|
-
return (
|
|
454
|
-
<>
|
|
455
|
-
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
|
|
456
|
-
<div
|
|
457
|
-
style={targetStyle}
|
|
458
|
-
ref={(element) => {
|
|
459
|
-
/**
|
|
460
|
-
* Hack to set the target ref to the target element that was actually passed as prop.
|
|
461
|
-
* If the target is absolutely positioned and we attach targetRef to the container div instead,
|
|
462
|
-
* its size will be 0 (and we need the target dimensions to compute the tooltip's position).
|
|
463
|
-
*/
|
|
464
|
-
const targetElement = element?.firstElementChild;
|
|
465
|
-
if (targetElement && targetElement !== targetRef.current) {
|
|
466
|
-
targetRef.current = targetElement;
|
|
467
|
-
}
|
|
468
|
-
}}
|
|
469
|
-
onMouseOver={() => {
|
|
470
|
-
if (!isTouchable && !hasPointerInteractionOnly) {
|
|
471
|
-
setIsMouseOverTarget(true);
|
|
472
|
-
}
|
|
473
|
-
}}
|
|
474
|
-
onMouseLeave={() => {
|
|
475
|
-
if (!isTouchable && !hasPointerInteractionOnly) {
|
|
476
|
-
setIsMouseOverTarget(false);
|
|
477
|
-
}
|
|
478
|
-
}}
|
|
479
|
-
onClick={() => {
|
|
480
|
-
if (isTouchable || hasPointerInteractionOnly) {
|
|
481
|
-
// if hasPointerInteractionOnly is true, pressing on the target should switch the state of the tooltip
|
|
482
|
-
setIsMouseOverTarget(hasPointerInteractionOnly ? !isMouseOverTarget : true);
|
|
483
|
-
}
|
|
484
|
-
}}
|
|
485
|
-
onFocus={() => {
|
|
486
|
-
if (isTabKeyDownRef.current && !hasPointerInteractionOnly) {
|
|
487
|
-
setIsFocused(true);
|
|
488
|
-
}
|
|
489
|
-
}}
|
|
490
|
-
onBlur={() => {
|
|
491
|
-
if (!isTouchable && !hasPointerInteractionOnly) {
|
|
492
|
-
setIsFocused(false);
|
|
493
|
-
}
|
|
494
|
-
}}
|
|
495
|
-
aria-describedby={tooltipId}
|
|
496
|
-
>
|
|
497
|
-
{target}
|
|
498
|
-
</div>
|
|
499
|
-
|
|
500
|
-
<Portal>
|
|
501
|
-
<Transition
|
|
502
|
-
in={isTooltipOpen}
|
|
503
|
-
nodeRef={tooltipRef}
|
|
504
|
-
timeout={
|
|
505
|
-
isRunningAcceptanceTest()
|
|
506
|
-
? 0
|
|
507
|
-
: {
|
|
508
|
-
enter: TOOLTIP_ENTER_TRANSITION_DURATION_IN_MS + tooltipEnterDelay,
|
|
509
|
-
exit: TOOLTIP_EXIT_TRANSITION_DURATION_IN_MS,
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
onExited={() => {
|
|
513
|
-
setTooltipComputedStyles(undefined);
|
|
514
|
-
setArrowComputedStyles(undefined);
|
|
515
|
-
}}
|
|
516
|
-
mountOnEnter
|
|
517
|
-
unmountOnExit
|
|
518
|
-
>
|
|
519
|
-
{(transitionStatus) => {
|
|
520
|
-
return (
|
|
521
|
-
<div
|
|
522
|
-
style={{
|
|
523
|
-
/**
|
|
524
|
-
* Hack to prevent text from wrapping automatically when touching the viewport's edges,
|
|
525
|
-
* even if the content's width didn't reach the max width.
|
|
526
|
-
* https://stackoverflow.com/questions/66106629/how-to-disable-text-wrapping-when-viewport-border-is-reached
|
|
527
|
-
*/
|
|
528
|
-
width: `calc(100vw + ${TOOLTIP_MAX_WIDTH}px)`,
|
|
529
|
-
top: 0,
|
|
530
|
-
left: 0,
|
|
531
|
-
position: 'fixed',
|
|
532
|
-
visibility: tooltipComputedStyles ? 'visible' : 'hidden',
|
|
533
|
-
}}
|
|
534
|
-
{...dataAttributes}
|
|
535
|
-
role="tooltip"
|
|
536
|
-
aria-label={tooltipId}
|
|
537
|
-
tabIndex={-1}
|
|
538
|
-
>
|
|
539
|
-
<div
|
|
540
|
-
className={classNames(styles.container)}
|
|
541
|
-
style={{
|
|
542
|
-
pointerEvents: transitionStatus === 'entered' ? 'auto' : 'none',
|
|
543
|
-
transform: getTooltipEnterTransform(currentPosition),
|
|
544
|
-
...tooltipComputedStyles,
|
|
545
|
-
...styles.tooltipTransitionClasses[transitionStatus],
|
|
546
|
-
transition:
|
|
547
|
-
transitionStatus === 'entering'
|
|
548
|
-
? `opacity .1s linear ${tooltipEnterDelay}ms,transform .3s cubic-bezier(0.215,0.61,0.335,1) ${tooltipEnterDelay}ms`
|
|
549
|
-
: `opacity .1s linear`,
|
|
550
|
-
}}
|
|
551
|
-
ref={combineRefs(setTooltip, tooltipRef)}
|
|
552
|
-
onMouseEnter={() => {
|
|
553
|
-
if (
|
|
554
|
-
!isTouchable &&
|
|
555
|
-
transitionStatus === 'entered' &&
|
|
556
|
-
!hasPointerInteractionOnly
|
|
557
|
-
) {
|
|
558
|
-
setIsMouseOverTooltip(true);
|
|
559
|
-
}
|
|
560
|
-
}}
|
|
561
|
-
onMouseLeave={() => {
|
|
562
|
-
if (!isTouchable && !hasPointerInteractionOnly) {
|
|
563
|
-
setIsMouseOverTooltip(false);
|
|
564
|
-
}
|
|
565
|
-
}}
|
|
566
|
-
>
|
|
567
|
-
<div
|
|
568
|
-
className={styles.tooltip}
|
|
569
|
-
style={{
|
|
570
|
-
width,
|
|
571
|
-
...getBorderStyle(themeVariant),
|
|
572
|
-
maxWidth: Math.min(TOOLTIP_MAX_WIDTH, windowSize.width),
|
|
573
|
-
}}
|
|
574
|
-
>
|
|
575
|
-
<div
|
|
576
|
-
className={classNames(styles.contentContainer, {
|
|
577
|
-
[styles.tooltipCenter]: hasCenteredContent,
|
|
578
|
-
})}
|
|
579
|
-
>
|
|
580
|
-
<ThemeVariant variant="default">
|
|
581
|
-
{content}
|
|
582
|
-
|
|
583
|
-
{onClose && (
|
|
584
|
-
<div className={styles.closeButtonIcon}>
|
|
585
|
-
<IconButton
|
|
586
|
-
onPress={() => {
|
|
587
|
-
setIsMouseOverTarget(false);
|
|
588
|
-
onClose();
|
|
589
|
-
}}
|
|
590
|
-
trackingEvent={trackingEvent}
|
|
591
|
-
aria-label={
|
|
592
|
-
closeButtonLabel ||
|
|
593
|
-
texts.closeButtonLabel ||
|
|
594
|
-
t(tokens.closeButtonLabel)
|
|
595
|
-
}
|
|
596
|
-
Icon={IconCloseRegular}
|
|
597
|
-
small
|
|
598
|
-
/>
|
|
599
|
-
</div>
|
|
600
|
-
)}
|
|
601
|
-
</ThemeVariant>
|
|
602
|
-
</div>
|
|
603
|
-
<div className={styles.arrowContainer} style={arrowComputedStyles}>
|
|
604
|
-
<div
|
|
605
|
-
className={classNames(styles.arrow)}
|
|
606
|
-
style={getBorderStyle(themeVariant)}
|
|
607
|
-
/>
|
|
608
|
-
</div>
|
|
609
|
-
</div>
|
|
610
|
-
</div>
|
|
611
|
-
</div>
|
|
612
|
-
);
|
|
613
|
-
}}
|
|
614
|
-
</Transition>
|
|
615
|
-
</Portal>
|
|
616
|
-
</>
|
|
617
|
-
);
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
const Tooltip = ({
|
|
621
|
-
centerContent,
|
|
622
|
-
extra,
|
|
623
|
-
children,
|
|
624
|
-
dataAttributes,
|
|
625
|
-
title,
|
|
626
|
-
description,
|
|
627
|
-
...props
|
|
628
|
-
}: Props): JSX.Element => {
|
|
629
|
-
return (
|
|
630
|
-
<BaseTooltip
|
|
631
|
-
content={
|
|
632
|
-
<div className={styles.content}>
|
|
633
|
-
{(title || description) && (
|
|
634
|
-
<Stack space={4}>
|
|
635
|
-
{title && <Text2 medium>{title}</Text2>}
|
|
636
|
-
{description && <Text2 regular>{description}</Text2>}
|
|
637
|
-
</Stack>
|
|
638
|
-
)}
|
|
639
|
-
{extra ?? children}
|
|
640
|
-
</div>
|
|
641
|
-
}
|
|
642
|
-
centerContent={centerContent}
|
|
643
|
-
dataAttributes={{'component-name': 'Tooltip', ...dataAttributes}}
|
|
644
|
-
{...props}
|
|
645
|
-
/>
|
|
646
|
-
);
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
export default Tooltip;
|
package/src/touchable.css.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {sprinkles} from './sprinkles.css';
|
|
3
|
-
|
|
4
|
-
export const marginReset = style({
|
|
5
|
-
/**
|
|
6
|
-
* Setting margin to 0, in order to avoid Safari from automatically adding extra margin to
|
|
7
|
-
* the touchable container (https://stackoverflow.com/a/71093016)
|
|
8
|
-
*/
|
|
9
|
-
margin: 0,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const base = style([
|
|
13
|
-
sprinkles({
|
|
14
|
-
cursor: 'pointer',
|
|
15
|
-
}),
|
|
16
|
-
{
|
|
17
|
-
verticalAlign: 'bottom', // required to remove bottom gap when rendered as inline-block div
|
|
18
|
-
fontFamily: 'inherit',
|
|
19
|
-
appearance: 'none',
|
|
20
|
-
userSelect: 'none',
|
|
21
|
-
textAlign: 'inherit',
|
|
22
|
-
textDecoration: 'none',
|
|
23
|
-
fontSize: 'inherit',
|
|
24
|
-
WebkitTapHighlightColor: 'transparent',
|
|
25
|
-
outlineOffset: 1,
|
|
26
|
-
':active': {
|
|
27
|
-
textDecoration: 'none',
|
|
28
|
-
},
|
|
29
|
-
':hover': {
|
|
30
|
-
textDecoration: 'none',
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
selectors: {
|
|
34
|
-
'&[disabled]': {
|
|
35
|
-
cursor: 'default',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
]);
|
|
40
|
-
|
|
41
|
-
export const touchable = style([
|
|
42
|
-
base,
|
|
43
|
-
sprinkles({
|
|
44
|
-
display: 'block',
|
|
45
|
-
border: 'none',
|
|
46
|
-
width: '100%',
|
|
47
|
-
color: 'inherit',
|
|
48
|
-
background: 'transparent',
|
|
49
|
-
padding: 0,
|
|
50
|
-
overflow: 'visible',
|
|
51
|
-
}),
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
export const notTouchable = style({
|
|
55
|
-
cursor: 'auto',
|
|
56
|
-
});
|