@telefonica/mistica 16.60.0 → 16.61.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 +6 -6
- package/dist/align.css-mistica.js +1 -1
- package/dist/autocomplete.css-mistica.js +1 -1
- package/dist/avatar.css-mistica.js +1 -1
- package/dist/badge.css-mistica.js +1 -1
- package/dist/box.css-mistica.js +13 -13
- package/dist/boxed.css-mistica.js +24 -24
- package/dist/button-fixed-footer-layout.d.ts +2 -1
- package/dist/button-fixed-footer-layout.js +4 -3
- package/dist/button-group.css-mistica.js +1 -1
- package/dist/button-layout.css-mistica.js +14 -14
- package/dist/button.css-mistica.js +30 -30
- package/dist/callout.css-mistica.js +11 -11
- package/dist/card-internal.css-mistica.js +15 -15
- package/dist/carousel.css-mistica.js +8 -8
- package/dist/checkbox.css-mistica.js +11 -11
- package/dist/chip.css-mistica.js +15 -15
- package/dist/circle.css-mistica.js +1 -1
- package/dist/community/advanced-data-card.css-mistica.js +6 -6
- package/dist/community/blocks.css-mistica.js +1 -1
- package/dist/community/example-component.css-mistica.js +1 -1
- package/dist/counter.css-mistica.js +1 -1
- package/dist/cover-hero.css-mistica.js +2 -2
- package/dist/credit-card-number-field.css-mistica.js +3 -3
- package/dist/date-field.css-mistica.js +1 -1
- package/dist/date-time-picker.css-mistica.js +1 -1
- package/dist/dialog.css-mistica.js +4 -4
- package/dist/divider.css-mistica.js +5 -5
- package/dist/double-field.css-mistica.js +2 -2
- package/dist/drawer.css-mistica.js +1 -1
- package/dist/empty-state-card.css-mistica.js +1 -1
- package/dist/empty-state.css-mistica.js +5 -5
- package/dist/fade-in.css-mistica.js +1 -1
- package/dist/feedback.css-mistica.js +1 -1
- package/dist/file-upload.css-mistica.js +7 -7
- package/dist/fixed-footer-layout.css-mistica.js +2 -2
- package/dist/fixed-footer-layout.d.ts +6 -1
- package/dist/fixed-footer-layout.js +29 -28
- package/dist/form.css-mistica.js +1 -1
- package/dist/grid-layout.css-mistica.js +3 -3
- package/dist/grid.css-mistica.js +120 -120
- package/dist/header.css-mistica.js +1 -1
- package/dist/hero.css-mistica.js +2 -2
- package/dist/horizontal-scroll.css-mistica.js +1 -1
- package/dist/icon-button.css-mistica.js +53 -53
- package/dist/icons/icon-chevron.css-mistica.js +2 -2
- package/dist/icons/icon-error.css-mistica.js +1 -1
- package/dist/image.css-mistica.js +2 -2
- package/dist/image.js +8 -1
- package/dist/inline.css-mistica.js +9 -9
- package/dist/list.css-mistica.js +1 -1
- package/dist/loading-bar.css-mistica.js +1 -1
- package/dist/loading-screen.css-mistica.js +4 -4
- package/dist/logo.css-mistica.js +5 -5
- package/dist/menu.css-mistica.js +13 -13
- package/dist/mosaic.css-mistica.js +1 -1
- package/dist/navigation-bar.css-mistica.js +18 -18
- package/dist/navigation-breadcrumbs.css-mistica.js +1 -1
- package/dist/package-version.js +1 -1
- package/dist/pin-field.css-mistica.js +1 -1
- package/dist/popover.css-mistica.js +1 -1
- package/dist/progress-bar.css-mistica.js +6 -6
- package/dist/radio-button.css-mistica.js +19 -19
- package/dist/rating.css-mistica.js +2 -2
- package/dist/responsive-layout.css-mistica.js +6 -6
- package/dist/screen-reader-only.css-mistica.js +1 -1
- package/dist/select.css-mistica.js +15 -15
- package/dist/sheet-action-row.css-mistica.js +1 -1
- package/dist/sheet-common.css-mistica.js +1 -1
- package/dist/sheet-info.css-mistica.js +1 -1
- package/dist/skeletons.css-mistica.js +6 -6
- package/dist/skins/skin-contract.css-mistica.js +684 -684
- package/dist/skip-link.css-mistica.js +1 -1
- package/dist/slider.css-mistica.js +18 -18
- package/dist/snackbar.css-mistica.js +4 -4
- package/dist/spinner.css-mistica.js +1 -1
- package/dist/square.css-mistica.js +1 -1
- package/dist/stack.css-mistica.js +5 -5
- package/dist/stacking-group.css-mistica.js +1 -1
- package/dist/stepper.css-mistica.js +2 -2
- package/dist/switch-component.css-mistica.js +35 -35
- package/dist/table.css-mistica.js +9 -9
- package/dist/tabs.css-mistica.js +17 -17
- package/dist/tag.css-mistica.js +1 -1
- package/dist/text-field-base.css-mistica.js +15 -15
- package/dist/text-field-components.css-mistica.js +3 -3
- package/dist/text-link.css-mistica.js +6 -6
- package/dist/text.css-mistica.js +6 -6
- package/dist/theme-context.css-mistica.js +1 -1
- package/dist/timeline.css-mistica.js +9 -9
- package/dist/timer.css-mistica.js +6 -6
- package/dist/tooltip.css-mistica.js +1 -1
- package/dist/touchable.css-mistica.js +1 -1
- package/dist/utils/aspect-ratio-support.css-mistica.js +2 -2
- package/dist/video.css-mistica.js +1 -1
- package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
- package/dist-es/accordion.css-mistica.js +6 -6
- package/dist-es/align.css-mistica.js +1 -1
- package/dist-es/autocomplete.css-mistica.js +1 -1
- package/dist-es/avatar.css-mistica.js +1 -1
- package/dist-es/badge.css-mistica.js +1 -1
- package/dist-es/box.css-mistica.js +13 -13
- package/dist-es/boxed.css-mistica.js +23 -23
- package/dist-es/button-fixed-footer-layout.js +12 -11
- package/dist-es/button-group.css-mistica.js +1 -1
- package/dist-es/button-layout.css-mistica.js +14 -14
- package/dist-es/button.css-mistica.js +30 -30
- package/dist-es/callout.css-mistica.js +11 -11
- package/dist-es/card-internal.css-mistica.js +15 -15
- package/dist-es/carousel.css-mistica.js +8 -8
- package/dist-es/checkbox.css-mistica.js +11 -11
- package/dist-es/chip.css-mistica.js +15 -15
- package/dist-es/circle.css-mistica.js +1 -1
- package/dist-es/community/advanced-data-card.css-mistica.js +6 -6
- package/dist-es/community/blocks.css-mistica.js +1 -1
- package/dist-es/community/example-component.css-mistica.js +1 -1
- package/dist-es/counter.css-mistica.js +1 -1
- package/dist-es/cover-hero.css-mistica.js +2 -2
- package/dist-es/credit-card-number-field.css-mistica.js +3 -3
- package/dist-es/date-field.css-mistica.js +1 -1
- package/dist-es/date-time-picker.css-mistica.js +1 -1
- package/dist-es/dialog.css-mistica.js +4 -4
- package/dist-es/divider.css-mistica.js +5 -5
- package/dist-es/double-field.css-mistica.js +2 -2
- package/dist-es/drawer.css-mistica.js +1 -1
- package/dist-es/empty-state-card.css-mistica.js +1 -1
- package/dist-es/empty-state.css-mistica.js +5 -5
- package/dist-es/fade-in.css-mistica.js +1 -1
- package/dist-es/feedback.css-mistica.js +1 -1
- package/dist-es/file-upload.css-mistica.js +7 -7
- package/dist-es/fixed-footer-layout.css-mistica.js +2 -2
- package/dist-es/fixed-footer-layout.js +57 -56
- package/dist-es/form.css-mistica.js +1 -1
- package/dist-es/grid-layout.css-mistica.js +3 -3
- package/dist-es/grid.css-mistica.js +120 -120
- package/dist-es/header.css-mistica.js +1 -1
- package/dist-es/hero.css-mistica.js +2 -2
- package/dist-es/horizontal-scroll.css-mistica.js +1 -1
- package/dist-es/icon-button.css-mistica.js +53 -53
- package/dist-es/icons/icon-chevron.css-mistica.js +2 -2
- package/dist-es/icons/icon-error.css-mistica.js +1 -1
- package/dist-es/image.css-mistica.js +2 -2
- package/dist-es/image.js +8 -1
- package/dist-es/inline.css-mistica.js +9 -9
- package/dist-es/list.css-mistica.js +1 -1
- package/dist-es/loading-bar.css-mistica.js +1 -1
- package/dist-es/loading-screen.css-mistica.js +4 -4
- package/dist-es/logo.css-mistica.js +5 -5
- package/dist-es/menu.css-mistica.js +13 -13
- package/dist-es/mosaic.css-mistica.js +1 -1
- package/dist-es/navigation-bar.css-mistica.js +18 -18
- package/dist-es/navigation-breadcrumbs.css-mistica.js +1 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/pin-field.css-mistica.js +1 -1
- package/dist-es/popover.css-mistica.js +1 -1
- package/dist-es/progress-bar.css-mistica.js +6 -6
- package/dist-es/radio-button.css-mistica.js +19 -19
- package/dist-es/rating.css-mistica.js +2 -2
- package/dist-es/responsive-layout.css-mistica.js +6 -6
- package/dist-es/screen-reader-only.css-mistica.js +1 -1
- package/dist-es/select.css-mistica.js +15 -15
- package/dist-es/sheet-action-row.css-mistica.js +1 -1
- package/dist-es/sheet-common.css-mistica.js +1 -1
- package/dist-es/sheet-info.css-mistica.js +1 -1
- package/dist-es/skeletons.css-mistica.js +6 -6
- package/dist-es/skins/skin-contract.css-mistica.js +684 -684
- package/dist-es/skip-link.css-mistica.js +1 -1
- package/dist-es/slider.css-mistica.js +18 -18
- package/dist-es/snackbar.css-mistica.js +4 -4
- package/dist-es/spinner.css-mistica.js +1 -1
- package/dist-es/square.css-mistica.js +1 -1
- package/dist-es/stack.css-mistica.js +5 -5
- package/dist-es/stacking-group.css-mistica.js +1 -1
- package/dist-es/stepper.css-mistica.js +2 -2
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.css-mistica.js +35 -35
- package/dist-es/table.css-mistica.js +9 -9
- package/dist-es/tabs.css-mistica.js +17 -17
- package/dist-es/tag.css-mistica.js +1 -1
- package/dist-es/text-field-base.css-mistica.js +15 -15
- package/dist-es/text-field-components.css-mistica.js +3 -3
- package/dist-es/text-link.css-mistica.js +6 -6
- package/dist-es/text.css-mistica.js +6 -6
- package/dist-es/theme-context.css-mistica.js +1 -1
- package/dist-es/timeline.css-mistica.js +9 -9
- package/dist-es/timer.css-mistica.js +6 -6
- package/dist-es/tooltip.css-mistica.js +1 -1
- package/dist-es/touchable.css-mistica.js +1 -1
- package/dist-es/utils/aspect-ratio-support.css-mistica.js +2 -2
- package/dist-es/video.css-mistica.js +1 -1
- package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +1 -1
- package/doc/llms.md +11 -0
- package/package.json +13 -1
- package/src/accordion.css.ts +121 -0
- package/src/accordion.tsx +366 -0
- package/src/align.css.ts +7 -0
- package/src/align.tsx +32 -0
- package/src/autocomplete.css.ts +62 -0
- package/src/autocomplete.tsx +239 -0
- package/src/avatar.css.ts +14 -0
- package/src/avatar.tsx +120 -0
- package/src/badge.css.ts +51 -0
- package/src/badge.tsx +79 -0
- package/src/box.css.ts +51 -0
- package/src/box.tsx +114 -0
- package/src/boxed.css.ts +132 -0
- package/src/boxed.tsx +153 -0
- package/src/button-fixed-footer-layout.tsx +65 -0
- package/src/button-group.css.ts +75 -0
- package/src/button-group.tsx +91 -0
- package/src/button-layout.css.ts +162 -0
- package/src/button-layout.tsx +91 -0
- package/src/button.css.ts +758 -0
- package/src/button.tsx +632 -0
- package/src/callout.css.ts +50 -0
- package/src/callout.tsx +147 -0
- package/src/card-cover.tsx +242 -0
- package/src/card-data.tsx +152 -0
- package/src/card-internal.css.ts +271 -0
- package/src/card-internal.tsx +1724 -0
- package/src/card-media.tsx +157 -0
- package/src/card-naked.tsx +63 -0
- package/src/carousel.css.ts +522 -0
- package/src/carousel.tsx +1300 -0
- package/src/checkbox.css.ts +94 -0
- package/src/checkbox.tsx +192 -0
- package/src/chip.css.ts +204 -0
- package/src/chip.tsx +191 -0
- package/src/circle.css.ts +14 -0
- package/src/circle.tsx +52 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
- package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
- package/src/community/__stories__/blocks-story.tsx +272 -0
- package/src/community/__stories__/example-component-story.tsx +15 -0
- package/src/community/__stories__/index-story.tsx +154 -0
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
- package/src/community/advanced-data-card.css.ts +271 -0
- package/src/community/advanced-data-card.tsx +431 -0
- package/src/community/blocks.css.ts +12 -0
- package/src/community/blocks.tsx +290 -0
- package/src/community/example-component.css.ts +7 -0
- package/src/community/example-component.tsx +17 -0
- package/src/community/index.tsx +10 -0
- package/src/counter.css.ts +150 -0
- package/src/counter.tsx +215 -0
- package/src/cover-hero-media.tsx +39 -0
- package/src/cover-hero.css.ts +133 -0
- package/src/cover-hero.tsx +262 -0
- package/src/credit-card-expiration-field.tsx +187 -0
- package/src/credit-card-fields.tsx +56 -0
- package/src/credit-card-number-field.css.ts +47 -0
- package/src/credit-card-number-field.tsx +245 -0
- package/src/cvv-field.tsx +169 -0
- package/src/date-field.css.ts +14 -0
- package/src/date-field.tsx +130 -0
- package/src/date-time-field.tsx +141 -0
- package/src/date-time-picker.css.ts +126 -0
- package/src/date-time-picker.tsx +188 -0
- package/src/decimal-field.tsx +160 -0
- package/src/desktop-container-type-context.tsx +15 -0
- package/src/dialog-context.tsx +81 -0
- package/src/dialog.css.ts +155 -0
- package/src/dialog.tsx +423 -0
- package/src/divider.css.ts +10 -0
- package/src/divider.tsx +11 -0
- package/src/double-field.css.ts +33 -0
- package/src/double-field.tsx +71 -0
- package/src/drawer.css.ts +123 -0
- package/src/drawer.tsx +304 -0
- package/src/email-field.tsx +76 -0
- package/src/empty-state-card.css.ts +40 -0
- package/src/empty-state-card.tsx +92 -0
- package/src/empty-state.css.ts +119 -0
- package/src/empty-state.tsx +141 -0
- package/src/fade-in.css.ts +12 -0
- package/src/fade-in.tsx +40 -0
- package/src/feedback.css.ts +119 -0
- package/src/feedback.tsx +432 -0
- package/src/file-upload.css.ts +156 -0
- package/src/file-upload.tsx +612 -0
- package/src/fixed-footer-layout.css.ts +96 -0
- package/src/fixed-footer-layout.tsx +227 -0
- package/src/fixed-to-top.tsx +21 -0
- package/src/focus-trap.tsx +17 -0
- package/src/form-context.tsx +198 -0
- package/src/form.css.ts +5 -0
- package/src/form.tsx +287 -0
- package/src/grid-layout.css.ts +68 -0
- package/src/grid-layout.tsx +201 -0
- package/src/grid.css.ts +203 -0
- package/src/grid.tsx +241 -0
- package/src/header.css.ts +30 -0
- package/src/header.tsx +319 -0
- package/src/hero.css.ts +71 -0
- package/src/hero.tsx +318 -0
- package/src/hooks.tsx +313 -0
- package/src/horizontal-scroll.css.ts +43 -0
- package/src/horizontal-scroll.tsx +18 -0
- package/src/iban-field.tsx +218 -0
- package/src/icon-button.css.ts +561 -0
- package/src/icon-button.tsx +221 -0
- package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
- package/src/icons/icon-amex.tsx +40 -0
- package/src/icons/icon-chevron.css.ts +23 -0
- package/src/icons/icon-chevron.tsx +150 -0
- package/src/icons/icon-cvv-amex.tsx +31 -0
- package/src/icons/icon-cvv-visa-mc.tsx +31 -0
- package/src/icons/icon-error.css.ts +27 -0
- package/src/icons/icon-error.tsx +207 -0
- package/src/icons/icon-info.tsx +86 -0
- package/src/icons/icon-mastercard.tsx +36 -0
- package/src/icons/icon-success-vivo-new.tsx +51 -0
- package/src/icons/icon-success-vivo.tsx +36 -0
- package/src/icons/icon-success.tsx +211 -0
- package/src/icons/icon-visa.tsx +32 -0
- package/src/image.css.ts +48 -0
- package/src/image.tsx +352 -0
- package/src/index.tsx +2466 -0
- package/src/inline.css.ts +131 -0
- package/src/inline.tsx +135 -0
- package/src/integer-field.tsx +93 -0
- package/src/list.css.ts +281 -0
- package/src/list.tsx +963 -0
- package/src/loading-bar.css.ts +69 -0
- package/src/loading-bar.tsx +25 -0
- package/src/loading-screen.css.ts +114 -0
- package/src/loading-screen.tsx +376 -0
- package/src/logo-blau-shell.tsx +30 -0
- package/src/logo-blau.tsx +60 -0
- package/src/logo-common.tsx +29 -0
- package/src/logo-esimflag-shell.tsx +30 -0
- package/src/logo-esimflag.tsx +56 -0
- package/src/logo-movistar-new-shell.tsx +30 -0
- package/src/logo-movistar-new.tsx +85 -0
- package/src/logo-movistar-shell.tsx +30 -0
- package/src/logo-movistar.tsx +63 -0
- package/src/logo-o2-new-shell.tsx +26 -0
- package/src/logo-o2-new.tsx +27 -0
- package/src/logo-o2-shell.tsx +26 -0
- package/src/logo-o2.tsx +27 -0
- package/src/logo-telefonica-shell.tsx +30 -0
- package/src/logo-telefonica.tsx +95 -0
- package/src/logo-tu-shell.tsx +26 -0
- package/src/logo-tu.tsx +28 -0
- package/src/logo-vivo-shell.tsx +30 -0
- package/src/logo-vivo.tsx +53 -0
- package/src/logo.css.ts +33 -0
- package/src/logo.tsx +313 -0
- package/src/master-detail-layout.tsx +28 -0
- package/src/maybe-dismissable.css.ts +37 -0
- package/src/maybe-dismissable.tsx +58 -0
- package/src/media-queries.css.ts +67 -0
- package/src/menu.css.ts +132 -0
- package/src/menu.tsx +468 -0
- package/src/meter.tsx +516 -0
- package/src/modal-context-provider.tsx +45 -0
- package/src/month-field.tsx +124 -0
- package/src/mosaic.css.ts +73 -0
- package/src/mosaic.tsx +205 -0
- package/src/navigation-bar.css.ts +558 -0
- package/src/navigation-bar.tsx +1637 -0
- package/src/navigation-breadcrumbs.css.ts +22 -0
- package/src/navigation-breadcrumbs.tsx +69 -0
- package/src/negative-box.tsx +15 -0
- package/src/nestable-context.tsx +139 -0
- package/src/overlay.tsx +86 -0
- package/src/overscroll-color-context.tsx +141 -0
- package/src/package-version.tsx +2 -0
- package/src/password-field.tsx +126 -0
- package/src/phone-number-field-lite.tsx +265 -0
- package/src/phone-number-field.tsx +171 -0
- package/src/pin-field.css.ts +90 -0
- package/src/pin-field.tsx +346 -0
- package/src/placeholder.tsx +41 -0
- package/src/popover.css.ts +8 -0
- package/src/popover.tsx +85 -0
- package/src/portal.tsx +43 -0
- package/src/progress-bar.css.ts +61 -0
- package/src/progress-bar.tsx +174 -0
- package/src/radio-button.css.ts +174 -0
- package/src/radio-button.tsx +322 -0
- package/src/rating.css.ts +128 -0
- package/src/rating.tsx +351 -0
- package/src/responsive-layout.css.ts +162 -0
- package/src/responsive-layout.tsx +106 -0
- package/src/screen-reader-only.css.ts +27 -0
- package/src/screen-reader-only.tsx +33 -0
- package/src/screen-size-context-provider.tsx +96 -0
- package/src/screen-size-context.tsx +23 -0
- package/src/search-field.tsx +126 -0
- package/src/select.css.ts +226 -0
- package/src/select.tsx +513 -0
- package/src/sheet-action-row.css.ts +33 -0
- package/src/sheet-actions-list.tsx +113 -0
- package/src/sheet-actions.tsx +95 -0
- package/src/sheet-common.css.ts +254 -0
- package/src/sheet-common.tsx +402 -0
- package/src/sheet-info.css.ts +19 -0
- package/src/sheet-info.tsx +127 -0
- package/src/sheet-native.tsx +189 -0
- package/src/sheet-radio-list.tsx +118 -0
- package/src/sheet-root.tsx +127 -0
- package/src/sheet-types.tsx +94 -0
- package/src/sheet-web.tsx +140 -0
- package/src/skeleton-base.tsx +38 -0
- package/src/skeletons.css.ts +56 -0
- package/src/skeletons.tsx +133 -0
- package/src/skins/blau.tsx +724 -0
- package/src/skins/constants.tsx +10 -0
- package/src/skins/defaults.tsx +104 -0
- package/src/skins/esimflag.tsx +728 -0
- package/src/skins/movistar-new.tsx +735 -0
- package/src/skins/movistar.tsx +740 -0
- package/src/skins/o2-new.tsx +731 -0
- package/src/skins/o2.tsx +727 -0
- package/src/skins/skin-contract.css.ts +380 -0
- package/src/skins/telefonica.tsx +768 -0
- package/src/skins/tu.tsx +741 -0
- package/src/skins/types/colors.tsx +286 -0
- package/src/skins/types/index.tsx +153 -0
- package/src/skins/utils.tsx +66 -0
- package/src/skins/vivo-new.tsx +745 -0
- package/src/skins/vivo.tsx +720 -0
- package/src/skip-link.css.ts +34 -0
- package/src/skip-link.tsx +52 -0
- package/src/slider.css.ts +181 -0
- package/src/slider.tsx +384 -0
- package/src/snackbar-context.tsx +98 -0
- package/src/snackbar-native.ts +37 -0
- package/src/snackbar.css.ts +176 -0
- package/src/snackbar.tsx +258 -0
- package/src/spinner.css.ts +66 -0
- package/src/spinner.tsx +136 -0
- package/src/sprinkles.css.ts +83 -0
- package/src/square.css.ts +15 -0
- package/src/square.tsx +55 -0
- package/src/stack.css.ts +44 -0
- package/src/stack.tsx +79 -0
- package/src/stacking-group.css.ts +15 -0
- package/src/stacking-group.tsx +82 -0
- package/src/stepper.css.ts +233 -0
- package/src/stepper.tsx +156 -0
- package/src/switch-component.css.ts +181 -0
- package/src/switch-component.tsx +187 -0
- package/src/tab-focus.tsx +68 -0
- package/src/table-actions-header.tsx +21 -0
- package/src/table-cell-text.tsx +35 -0
- package/src/table.css.ts +297 -0
- package/src/table.tsx +398 -0
- package/src/tabs.css.ts +212 -0
- package/src/tabs.tsx +263 -0
- package/src/tag.css.ts +42 -0
- package/src/tag.tsx +161 -0
- package/src/test-utils/environment/setup-ssr.tsx +10 -0
- package/src/test-utils/fail-test-on-console-error.tsx +22 -0
- package/src/test-utils/index.tsx +341 -0
- package/src/test-utils/setup-ssr-test-env.tsx +13 -0
- package/src/test-utils/ssr.tsx +197 -0
- package/src/text-field-base.css.ts +416 -0
- package/src/text-field-base.tsx +628 -0
- package/src/text-field-components.css.ts +165 -0
- package/src/text-field-components.tsx +230 -0
- package/src/text-field.tsx +118 -0
- package/src/text-link.css.ts +83 -0
- package/src/text-link.tsx +85 -0
- package/src/text-tokens.tsx +708 -0
- package/src/text.css.ts +60 -0
- package/src/text.tsx +516 -0
- package/src/theme-context-provider.tsx +370 -0
- package/src/theme-context.css.ts +3 -0
- package/src/theme-context.tsx +8 -0
- package/src/theme-variant-context.tsx +51 -0
- package/src/theme.tsx +184 -0
- package/src/time-field.tsx +99 -0
- package/src/timeline.css.ts +135 -0
- package/src/timeline.tsx +250 -0
- package/src/timer.css.ts +99 -0
- package/src/timer.tsx +420 -0
- package/src/title.tsx +119 -0
- package/src/tooltip-context-provider.tsx +57 -0
- package/src/tooltip.css.ts +106 -0
- package/src/tooltip.tsx +649 -0
- package/src/touchable.css.ts +56 -0
- package/src/touchable.tsx +355 -0
- package/src/types/font-face.d.ts +47 -0
- package/src/types/libs.d.ts +3 -0
- package/src/utils/__tests__/analytics-test.tsx +35 -0
- package/src/utils/__tests__/browser-test.tsx +28 -0
- package/src/utils/__tests__/dom-test.tsx +23 -0
- package/src/utils/__tests__/helpers-test.tsx +166 -0
- package/src/utils/analytics.tsx +28 -0
- package/src/utils/animation.tsx +201 -0
- package/src/utils/aspect-ratio-support.css.ts +28 -0
- package/src/utils/aspect-ratio-support.tsx +141 -0
- package/src/utils/browser.tsx +9 -0
- package/src/utils/color.tsx +46 -0
- package/src/utils/common.tsx +27 -0
- package/src/utils/credit-card.tsx +46 -0
- package/src/utils/css.tsx +25 -0
- package/src/utils/document-visibility.tsx +52 -0
- package/src/utils/dom.tsx +155 -0
- package/src/utils/environment.tsx +6 -0
- package/src/utils/headings.tsx +18 -0
- package/src/utils/helpers.tsx +182 -0
- package/src/utils/keys.tsx +8 -0
- package/src/utils/locale.tsx +27 -0
- package/src/utils/platform.tsx +94 -0
- package/src/utils/region-code.tsx +1 -0
- package/src/utils/renders-element.tsx +6 -0
- package/src/utils/time.tsx +22 -0
- package/src/utils/types.tsx +19 -0
- package/src/utils/utility-types.tsx +8 -0
- package/src/video.css.ts +11 -0
- package/src/video.tsx +355 -0
- package/src/vivinho-loading-animation/in-lottie.json +402 -0
- package/src/vivinho-loading-animation/index.tsx +90 -0
- package/src/vivinho-loading-animation/out-lottie.json +575 -0
- package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
- package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {style} from '@vanilla-extract/css';
|
|
2
|
+
import {sprinkles} from './sprinkles.css';
|
|
3
|
+
|
|
4
|
+
export const actions = style([
|
|
5
|
+
sprinkles({display: 'flex', flex: 1, alignItems: 'flex-end'}),
|
|
6
|
+
{marginTop: 16},
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
export const link = style({
|
|
10
|
+
':hover': {
|
|
11
|
+
textDecoration: 'underline',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const current = style({
|
|
16
|
+
textDecoration: 'none',
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const list = style([sprinkles({padding: 0}), {margin: 0, listStyleType: 'none'}]);
|
|
21
|
+
|
|
22
|
+
export const listItem = sprinkles({display: 'inline'});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma: https://www.figma.com/file/BctaFHf0PVPX2uwRSl8taf/Breadcrumbs?node-id=2%3A61
|
|
3
|
+
* Accessibility: https://www.w3.org/WAI/ARIA/apg/example-index/breadcrumb/index.html
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import {Text1} from './text';
|
|
9
|
+
import {getPrefixedDataAttributes} from './utils/dom';
|
|
10
|
+
import TextLink from './text-link';
|
|
11
|
+
import * as styles from './navigation-breadcrumbs.css';
|
|
12
|
+
import {vars} from './skins/skin-contract.css';
|
|
13
|
+
|
|
14
|
+
import type {DataAttributes} from './utils/types';
|
|
15
|
+
|
|
16
|
+
const BREADCRUMB_SEPARATOR = ' / ';
|
|
17
|
+
|
|
18
|
+
export type NavigationBreadcrumbsProps = {
|
|
19
|
+
title: string;
|
|
20
|
+
breadcrumbs: ReadonlyArray<{
|
|
21
|
+
readonly title: string;
|
|
22
|
+
readonly url: string;
|
|
23
|
+
onNavigate?: () => void;
|
|
24
|
+
}>;
|
|
25
|
+
children?: void;
|
|
26
|
+
dataAttributes?: DataAttributes;
|
|
27
|
+
'aria-label'?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const NavigationBreadcrumbs = ({
|
|
31
|
+
title,
|
|
32
|
+
breadcrumbs,
|
|
33
|
+
dataAttributes,
|
|
34
|
+
'aria-label': ariaLabel = 'Breadcrumb',
|
|
35
|
+
}: NavigationBreadcrumbsProps): JSX.Element => {
|
|
36
|
+
return (
|
|
37
|
+
<nav aria-label={ariaLabel} {...getPrefixedDataAttributes(dataAttributes, 'NavigationBreadcrumbs')}>
|
|
38
|
+
<ol className={styles.list}>
|
|
39
|
+
{breadcrumbs.map(({title, url, onNavigate}, index) => (
|
|
40
|
+
<li key={index} className={styles.listItem}>
|
|
41
|
+
<TextLink to={url} className={styles.link} onNavigate={onNavigate}>
|
|
42
|
+
<Text1 regular>{title}</Text1>
|
|
43
|
+
</TextLink>
|
|
44
|
+
<span role="presentation">
|
|
45
|
+
<Text1 regular>{BREADCRUMB_SEPARATOR}</Text1>
|
|
46
|
+
</span>
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
<li className={styles.listItem}>
|
|
50
|
+
{/* this anchor is added for accessibility, it is disabled */}
|
|
51
|
+
<a
|
|
52
|
+
aria-current="page"
|
|
53
|
+
href="#"
|
|
54
|
+
className={styles.current}
|
|
55
|
+
onClick={(e) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Text1 regular color={vars.colors.textSecondary}>
|
|
60
|
+
{title}
|
|
61
|
+
</Text1>
|
|
62
|
+
</a>
|
|
63
|
+
</li>
|
|
64
|
+
</ol>
|
|
65
|
+
</nav>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default NavigationBreadcrumbs;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
right?: boolean;
|
|
6
|
+
left?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const NegativeBox = ({left, right, children}: Props): JSX.Element => {
|
|
10
|
+
const marginLeft = left || (!left && !right) ? -16 : undefined;
|
|
11
|
+
const marginRight = right || (!left && !right) ? -16 : undefined;
|
|
12
|
+
return <div style={{marginLeft, marginRight}}>{children}</div>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default NegativeBox;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {isEqual} from './utils/helpers';
|
|
4
|
+
|
|
5
|
+
const useDeepCompareMemoize = (value: any) => {
|
|
6
|
+
const ref = React.useRef(undefined);
|
|
7
|
+
|
|
8
|
+
if (!isEqual(value, ref.current)) {
|
|
9
|
+
ref.current = value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return ref.current;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This is like `useEffect` but with deep equal checks
|
|
17
|
+
*/
|
|
18
|
+
const useDeepCompareEffect: typeof React.useEffect = (create, inputs) =>
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
React.useEffect(create, useDeepCompareMemoize(inputs));
|
|
21
|
+
|
|
22
|
+
type Action<Value> = Readonly<
|
|
23
|
+
| {
|
|
24
|
+
type: 'add';
|
|
25
|
+
value: Value;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
type: 'remove';
|
|
29
|
+
value: Value;
|
|
30
|
+
}
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
type Dispatch<Value> = (action: Action<Value>) => void;
|
|
34
|
+
|
|
35
|
+
type ProviderProps = {children: React.ReactNode};
|
|
36
|
+
|
|
37
|
+
const isObject = (object: any): object is Record<string, unknown> =>
|
|
38
|
+
object !== null && typeof object === 'object' && !Array.isArray(object);
|
|
39
|
+
|
|
40
|
+
export type NestableContext<Value> = {
|
|
41
|
+
Getter: (props: {children: (value: Value) => React.ReactNode}) => JSX.Element;
|
|
42
|
+
Provider: (props: ProviderProps) => JSX.Element;
|
|
43
|
+
Setter: (props: {value: Value}) => null;
|
|
44
|
+
useValue: () => Value;
|
|
45
|
+
useSetValue: (value: Value) => void;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const createNestableContext = <Value,>(
|
|
49
|
+
defaultValue: Value,
|
|
50
|
+
valuesReducer?: (values: Array<Value>) => Value
|
|
51
|
+
): NestableContext<Value> => {
|
|
52
|
+
const DispatchContext = React.createContext<Dispatch<Value>>(() => {});
|
|
53
|
+
const ValueContext = React.createContext<Value>(defaultValue);
|
|
54
|
+
|
|
55
|
+
let providerInstances = 0;
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
This component may have multiple children setting a value at the same time. When a child component mounts,
|
|
59
|
+
it fires an action {type: 'add', value}, when a child component unmounts (or changes the value) it fires
|
|
60
|
+
an action {type: 'remove', value}. See SetterComponent.
|
|
61
|
+
|
|
62
|
+
This parent component keeps track of all the set values, maintaining an array. The last value in the
|
|
63
|
+
array is used as current value (fallbacks to defaultValue when the array is empty).
|
|
64
|
+
The array is needed because we need to handle these edge cases:
|
|
65
|
+
|
|
66
|
+
- Page 1 sets value X, and following page 2 doesn't set any value. We need to use defaultValue in this
|
|
67
|
+
case.
|
|
68
|
+
- Page 1 sets value X, page 2 sets value Y. While transitioning between both values X and Y are set at
|
|
69
|
+
the same time, when Page 1 unmounts, value Y should be used.
|
|
70
|
+
*/
|
|
71
|
+
const reducer = (values: Array<Value>, action: Action<Value>): Array<Value> => {
|
|
72
|
+
switch (action.type) {
|
|
73
|
+
case 'add':
|
|
74
|
+
return [...values, action.value];
|
|
75
|
+
case 'remove': {
|
|
76
|
+
const idx = values.indexOf(action.value);
|
|
77
|
+
return [...values.slice(0, idx), ...values.slice(idx + 1, values.length)];
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
throw new Error(`Unhandled action type ${(action as any).type}`);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const Provider = ({children}: ProviderProps) => {
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
providerInstances++;
|
|
87
|
+
|
|
88
|
+
if (providerInstances > 1 && process.env.NODE_ENV !== 'production') {
|
|
89
|
+
console.warn(`Multiple NestableContext instances: ${providerInstances}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return () => {
|
|
93
|
+
providerInstances--;
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const [values, dispatch] = React.useReducer(reducer, []);
|
|
98
|
+
let computedValue: Value = defaultValue;
|
|
99
|
+
if (values.length) {
|
|
100
|
+
if (isObject(values[0])) {
|
|
101
|
+
if (valuesReducer) {
|
|
102
|
+
computedValue = valuesReducer(values);
|
|
103
|
+
} else {
|
|
104
|
+
computedValue = Object.assign({}, defaultValue, ...values);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
computedValue = values[values.length - 1];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<DispatchContext.Provider value={dispatch}>
|
|
113
|
+
<ValueContext.Provider value={computedValue}>{children}</ValueContext.Provider>
|
|
114
|
+
</DispatchContext.Provider>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const useSetValue = (value: Value) => {
|
|
119
|
+
const dispatch = React.useContext(DispatchContext);
|
|
120
|
+
|
|
121
|
+
useDeepCompareEffect(() => {
|
|
122
|
+
dispatch({type: 'add', value});
|
|
123
|
+
return () => {
|
|
124
|
+
dispatch({type: 'remove', value});
|
|
125
|
+
};
|
|
126
|
+
}, [value, dispatch]);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const useValue = () => React.useContext(ValueContext);
|
|
130
|
+
|
|
131
|
+
const Setter = ({value}: {value: Value}) => {
|
|
132
|
+
useSetValue(value);
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const Getter = ({children}: {children: (value: Value) => React.ReactNode}) => <>{children(useValue())}</>;
|
|
137
|
+
|
|
138
|
+
return {Setter, Provider, Getter, useSetValue, useValue};
|
|
139
|
+
};
|
package/src/overlay.tsx
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {isAndroid, isChrome} from './utils/platform';
|
|
4
|
+
import {useDisableBodyScroll, useTheme} from './hooks';
|
|
5
|
+
import {getPrefixedDataAttributes} from './utils/dom';
|
|
6
|
+
|
|
7
|
+
import type {DataAttributes} from './utils/types';
|
|
8
|
+
|
|
9
|
+
const defaultStyle: React.CSSProperties = {
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
top: 0,
|
|
12
|
+
right: 0,
|
|
13
|
+
bottom: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
outline: 'none',
|
|
16
|
+
WebkitTapHighlightColor: 'transparent',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Props = {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
onPress?: (evt: React.MouseEvent<HTMLDivElement>) => unknown;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
className?: string;
|
|
24
|
+
disableScroll?: boolean;
|
|
25
|
+
dataAttributes?: DataAttributes;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Overlay = ({
|
|
29
|
+
onPress,
|
|
30
|
+
children,
|
|
31
|
+
className,
|
|
32
|
+
style,
|
|
33
|
+
disableScroll = false,
|
|
34
|
+
dataAttributes,
|
|
35
|
+
}: Props): JSX.Element => {
|
|
36
|
+
useDisableBodyScroll(disableScroll);
|
|
37
|
+
const {platformOverrides} = useTheme();
|
|
38
|
+
|
|
39
|
+
// In mobile browsers event.button === 0. This event does not need to be handled in mobile. In desktop event.button === 2
|
|
40
|
+
const handleContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
41
|
+
if (event.button === 2 && onPress) {
|
|
42
|
+
onPress(event);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
data-overlay="true"
|
|
49
|
+
{...getPrefixedDataAttributes(dataAttributes, 'Overlay')}
|
|
50
|
+
style={{...defaultStyle, ...style}}
|
|
51
|
+
className={className}
|
|
52
|
+
onPointerDown={(e) => {
|
|
53
|
+
// We use listen to and cancel pointerdown to close overlay if user scrolls on iOS.
|
|
54
|
+
if ((e.target as any).dataset.overlay && onPress) {
|
|
55
|
+
if (children && isAndroid(platformOverrides) && isChrome(platformOverrides)) {
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
} else {
|
|
58
|
+
onPress(e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
onClick={(e) => {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
// In Android we need to call onPress here in onClick to ensure click event doesn't hit element below overlay.
|
|
65
|
+
if (
|
|
66
|
+
(e.target as any).dataset.overlay &&
|
|
67
|
+
onPress &&
|
|
68
|
+
children &&
|
|
69
|
+
isAndroid(platformOverrides) &&
|
|
70
|
+
isChrome(platformOverrides)
|
|
71
|
+
) {
|
|
72
|
+
onPress(e);
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
76
|
+
touch-action="auto" // Prop needed for Pointer Events Polyfill to work properly
|
|
77
|
+
onContextMenu={handleContextMenu}
|
|
78
|
+
role="button"
|
|
79
|
+
tabIndex={0}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default Overlay;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {useTheme} from './hooks';
|
|
4
|
+
import {createNestableContext} from './nestable-context';
|
|
5
|
+
import {getPlatform} from './utils/platform';
|
|
6
|
+
import {getCssVarValue, isCssVar} from './utils/dom';
|
|
7
|
+
|
|
8
|
+
import type {Theme} from './theme';
|
|
9
|
+
|
|
10
|
+
type OverscrollColorConfig = {topColor?: string; bottomColor?: string};
|
|
11
|
+
|
|
12
|
+
const {Provider, useSetValue, useValue} = createNestableContext<OverscrollColorConfig>({});
|
|
13
|
+
|
|
14
|
+
export const useOverScrollColor = useValue;
|
|
15
|
+
|
|
16
|
+
const shouldRender = (platformOverrides: Theme['platformOverrides']) =>
|
|
17
|
+
getPlatform(platformOverrides) === 'ios';
|
|
18
|
+
|
|
19
|
+
const TopOverscrollColor = () => {
|
|
20
|
+
const {topColor} = useValue();
|
|
21
|
+
const {isDarkMode} = useTheme();
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (!topColor) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const prevMetaTags = document.head.querySelectorAll('meta[name=theme-color]');
|
|
28
|
+
prevMetaTags.forEach((metaTag) => {
|
|
29
|
+
metaTag.remove();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const meta = document.createElement('meta');
|
|
33
|
+
meta.name = 'theme-color';
|
|
34
|
+
meta.media = isDarkMode ? '(prefers-color-scheme: dark)' : '(prefers-color-scheme: light)';
|
|
35
|
+
// css vars are not supported in theme-color meta tag
|
|
36
|
+
meta.content = isCssVar(topColor) ? getCssVarValue(topColor) : topColor;
|
|
37
|
+
|
|
38
|
+
document.head.appendChild(meta);
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
// remove the overscroll color meta tag and restore previous meta tags
|
|
42
|
+
meta.remove();
|
|
43
|
+
prevMetaTags.forEach((metaTag) => {
|
|
44
|
+
document.head.appendChild(metaTag);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}, [isDarkMode, topColor]);
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const useBodyBackgroundColor = () => {
|
|
52
|
+
const [bodyBackgroundColor, setBodyBackgroundColor] = React.useState<string>('transparent');
|
|
53
|
+
|
|
54
|
+
// When dark/light mode changes, body background color may change, so we need to listen to this event
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
const mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
57
|
+
|
|
58
|
+
let rafId: number;
|
|
59
|
+
const listener = () => {
|
|
60
|
+
// We need to wait for the next frame (requestAnimationFrame) to get the updated body background color
|
|
61
|
+
rafId = requestAnimationFrame(() => {
|
|
62
|
+
const bodyBackgroundColor = getComputedStyle(document.body).backgroundColor;
|
|
63
|
+
setBodyBackgroundColor(bodyBackgroundColor);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
mq.addListener(listener);
|
|
68
|
+
listener();
|
|
69
|
+
|
|
70
|
+
return () => {
|
|
71
|
+
mq.removeListener(listener);
|
|
72
|
+
cancelAnimationFrame(rafId);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
|
|
76
|
+
return bodyBackgroundColor;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const BottomOverscrollColor = () => {
|
|
80
|
+
const {topColor, bottomColor} = useValue();
|
|
81
|
+
const defaultBottomColor = useBodyBackgroundColor();
|
|
82
|
+
|
|
83
|
+
// if not specified a bottom color, dont render it, except if there is a top color defined,
|
|
84
|
+
// in that case we need to render the bottom color to avoid theme-color affecting the bottom overscroll
|
|
85
|
+
if (!bottomColor && !topColor) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const bottomColorToApply = bottomColor ?? defaultBottomColor;
|
|
90
|
+
|
|
91
|
+
// if top and bottom color are the same, theme-color set for top color will work for bottom too, so this is not needed
|
|
92
|
+
if (bottomColorToApply === topColor) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (bottomColorToApply === 'transparent') {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// This sets a fixed div at the bottom of the screen with the bottom color. Fixed elements aren't affected by iOS scroll bounce,
|
|
101
|
+
// so this div is always visible as background.
|
|
102
|
+
// There is a known issue with this approach, if the bottom overscroll color is different from the body background color and there is a
|
|
103
|
+
// page section with a transparent background which is expected to have the background color of the body, the div with the bottom overscroll
|
|
104
|
+
// color will be visible behind the transparent section.
|
|
105
|
+
return (
|
|
106
|
+
<div
|
|
107
|
+
style={{
|
|
108
|
+
position: 'fixed',
|
|
109
|
+
zIndex: -1,
|
|
110
|
+
background: bottomColorToApply,
|
|
111
|
+
width: '100%',
|
|
112
|
+
height: 300,
|
|
113
|
+
left: 0,
|
|
114
|
+
right: 0,
|
|
115
|
+
bottom: 0,
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type ProviderProps = {children: React.ReactNode};
|
|
122
|
+
|
|
123
|
+
export const OverscrollColorProvider = ({children}: ProviderProps): JSX.Element => {
|
|
124
|
+
const {platformOverrides} = useTheme();
|
|
125
|
+
|
|
126
|
+
if (!shouldRender(platformOverrides)) {
|
|
127
|
+
return <>{children}</>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Provider>
|
|
132
|
+
<TopOverscrollColor />
|
|
133
|
+
{children}
|
|
134
|
+
<BottomOverscrollColor />
|
|
135
|
+
</Provider>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const useSetOverscrollColor = (config: OverscrollColorConfig): void => {
|
|
140
|
+
useSetValue(config);
|
|
141
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {useFieldProps} from './form-context';
|
|
4
|
+
import {FieldEndIcon, TextFieldBaseAutosuggest} from './text-field-base';
|
|
5
|
+
import {useTheme} from './hooks';
|
|
6
|
+
import IconEyeOffRegular from './generated/mistica-icons/icon-eye-off-regular';
|
|
7
|
+
import IconEyeRegular from './generated/mistica-icons/icon-eye-regular';
|
|
8
|
+
import * as tokens from './text-tokens';
|
|
9
|
+
|
|
10
|
+
import type {CommonFormFieldProps} from './text-field-base';
|
|
11
|
+
|
|
12
|
+
export interface PasswordFieldProps extends CommonFormFieldProps {
|
|
13
|
+
onChangeValue?: (value: string, rawValue: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const PasswordAdornment = ({
|
|
17
|
+
isVisible,
|
|
18
|
+
setVisibility,
|
|
19
|
+
focus,
|
|
20
|
+
}: {
|
|
21
|
+
isVisible: boolean;
|
|
22
|
+
setVisibility: (isVisible: boolean) => void;
|
|
23
|
+
focus: () => void;
|
|
24
|
+
}) => {
|
|
25
|
+
const {texts, t} = useTheme();
|
|
26
|
+
return (
|
|
27
|
+
<FieldEndIcon
|
|
28
|
+
checkedProps={{
|
|
29
|
+
Icon: IconEyeOffRegular,
|
|
30
|
+
'aria-label': texts.disablePasswordVisibility || t(tokens.disablePasswordVisibility),
|
|
31
|
+
}}
|
|
32
|
+
uncheckedProps={{
|
|
33
|
+
Icon: IconEyeRegular,
|
|
34
|
+
'aria-label': texts.enablePasswordVisibility || t(tokens.enablePasswordVisibility),
|
|
35
|
+
}}
|
|
36
|
+
checked={isVisible}
|
|
37
|
+
onChange={(visible) => {
|
|
38
|
+
setVisibility(visible);
|
|
39
|
+
focus();
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const PasswordField = ({
|
|
46
|
+
disabled,
|
|
47
|
+
error,
|
|
48
|
+
helperText,
|
|
49
|
+
name,
|
|
50
|
+
label,
|
|
51
|
+
optional,
|
|
52
|
+
validate,
|
|
53
|
+
validateOnBlurInsideForm,
|
|
54
|
+
onChange,
|
|
55
|
+
onChangeValue,
|
|
56
|
+
onBlur,
|
|
57
|
+
value,
|
|
58
|
+
autoComplete = 'current-password',
|
|
59
|
+
defaultValue,
|
|
60
|
+
dataAttributes,
|
|
61
|
+
...rest
|
|
62
|
+
}: PasswordFieldProps): JSX.Element => {
|
|
63
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
64
|
+
const caretPositionRef = React.useRef<number>(0);
|
|
65
|
+
const inputRef = React.useRef<HTMLInputElement | null>(null);
|
|
66
|
+
|
|
67
|
+
const processValue = (value: string) => value;
|
|
68
|
+
|
|
69
|
+
const focus = () => {
|
|
70
|
+
const input = inputRef.current;
|
|
71
|
+
if (input) {
|
|
72
|
+
if (input.selectionStart !== null) {
|
|
73
|
+
caretPositionRef.current = input.selectionStart;
|
|
74
|
+
}
|
|
75
|
+
input.focus();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
const input = inputRef.current;
|
|
81
|
+
if (input) {
|
|
82
|
+
const rafId = requestAnimationFrame(() => {
|
|
83
|
+
input.selectionStart = caretPositionRef.current;
|
|
84
|
+
input.selectionEnd = caretPositionRef.current;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return () => {
|
|
88
|
+
cancelAnimationFrame(rafId);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}, [isVisible, caretPositionRef, inputRef]);
|
|
92
|
+
|
|
93
|
+
const fieldProps = useFieldProps({
|
|
94
|
+
name,
|
|
95
|
+
label,
|
|
96
|
+
value,
|
|
97
|
+
defaultValue,
|
|
98
|
+
processValue,
|
|
99
|
+
helperText,
|
|
100
|
+
optional,
|
|
101
|
+
error,
|
|
102
|
+
disabled,
|
|
103
|
+
onBlur,
|
|
104
|
+
validate,
|
|
105
|
+
validateOnBlurInsideForm,
|
|
106
|
+
onChange,
|
|
107
|
+
onChangeValue,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<TextFieldBaseAutosuggest
|
|
112
|
+
{...rest}
|
|
113
|
+
{...fieldProps}
|
|
114
|
+
type={isVisible ? 'text' : 'password'}
|
|
115
|
+
inputRef={(field: HTMLInputElement | null) => {
|
|
116
|
+
fieldProps.inputRef(field);
|
|
117
|
+
inputRef.current = field;
|
|
118
|
+
}}
|
|
119
|
+
autoComplete={autoComplete}
|
|
120
|
+
endIcon={<PasswordAdornment focus={focus} isVisible={isVisible} setVisibility={setIsVisible} />}
|
|
121
|
+
dataAttributes={{'component-name': 'PasswordField', testid: 'PasswordField', ...dataAttributes}}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default PasswordField;
|