@telefonica/mistica 16.59.0-beta.1 → 16.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/mistica.css +1 -1
- package/dist/accordion.css-mistica.js +16 -16
- package/dist/align.css-mistica.js +2 -2
- package/dist/autocomplete.css-mistica.js +6 -6
- package/dist/avatar.css-mistica.js +3 -3
- package/dist/badge.css-mistica.js +7 -7
- package/dist/box.css-mistica.js +15 -15
- package/dist/boxed.css-mistica.js +31 -31
- package/dist/button-group.css-mistica.js +10 -10
- package/dist/button-layout.css-mistica.js +21 -21
- package/dist/button.css-mistica.js +51 -51
- package/dist/callout.css-mistica.js +16 -16
- package/dist/card-internal.css-mistica.js +38 -38
- package/dist/carousel.css-mistica.js +18 -18
- package/dist/checkbox.css-mistica.js +21 -21
- package/dist/chip.css-mistica.js +30 -30
- package/dist/circle.css-mistica.js +2 -2
- package/dist/community/advanced-data-card.css-mistica.js +26 -26
- package/dist/community/blocks.css-mistica.js +3 -3
- package/dist/community/example-component.css-mistica.js +2 -2
- package/dist/counter.css-mistica.js +12 -12
- package/dist/cover-hero.css-mistica.js +16 -16
- package/dist/credit-card-number-field.css-mistica.js +6 -6
- package/dist/date-field.css-mistica.js +1 -1
- package/dist/date-time-picker.css-mistica.js +2 -2
- package/dist/dialog.css-mistica.js +15 -15
- package/dist/divider.css-mistica.js +5 -5
- package/dist/double-field.css-mistica.js +4 -4
- package/dist/drawer.css-mistica.js +15 -15
- package/dist/empty-state-card.css-mistica.js +4 -4
- package/dist/empty-state.css-mistica.js +14 -14
- package/dist/fade-in.css-mistica.js +1 -1
- package/dist/feedback.css-mistica.js +14 -14
- package/dist/file-upload.css-mistica.js +14 -14
- package/dist/fixed-footer-layout.css-mistica.js +12 -12
- package/dist/form.css-mistica.js +2 -2
- package/dist/grid-layout.css-mistica.js +9 -9
- package/dist/grid.css-mistica.js +147 -147
- package/dist/header.css-mistica.js +5 -5
- package/dist/hero.css-mistica.js +11 -11
- package/dist/horizontal-scroll.css-mistica.js +3 -3
- package/dist/icon-button.css-mistica.js +66 -66
- package/dist/icons/icon-chevron.css-mistica.js +6 -6
- package/dist/icons/icon-error.css-mistica.js +3 -3
- package/dist/image.css-mistica.js +11 -11
- package/dist/inline.css-mistica.js +16 -16
- package/dist/list.css-mistica.js +15 -15
- package/dist/loading-bar.css-mistica.js +5 -5
- package/dist/loading-screen.css-mistica.js +15 -15
- package/dist/logo.css-mistica.js +9 -9
- package/dist/menu.css-mistica.js +24 -24
- package/dist/mosaic.css-mistica.js +3 -3
- package/dist/navigation-bar.css-mistica.js +45 -45
- package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
- package/dist/package-version.js +2 -2
- package/dist/pin-field.css-mistica.js +10 -10
- package/dist/popover.css-mistica.js +2 -2
- package/dist/progress-bar.css-mistica.js +12 -12
- package/dist/radio-button.css-mistica.js +33 -33
- package/dist/rating.css-mistica.js +12 -12
- package/dist/responsive-layout.css-mistica.js +20 -20
- package/dist/screen-reader-only.css-mistica.js +2 -2
- package/dist/select.css-mistica.js +29 -29
- package/dist/sheet-action-row.css-mistica.js +2 -2
- package/dist/sheet-common.css-mistica.js +16 -16
- package/dist/sheet-info.css-mistica.js +4 -4
- package/dist/skeletons.css-mistica.js +12 -12
- package/dist/skins/skin-contract.css-mistica.js +686 -686
- package/dist/skip-link.css-mistica.js +3 -3
- package/dist/slider.css-mistica.js +28 -28
- package/dist/snackbar.css-mistica.js +16 -16
- package/dist/spinner.css-mistica.js +5 -5
- package/dist/square.css-mistica.js +2 -2
- package/dist/stack.css-mistica.js +9 -9
- package/dist/stacking-group.css-mistica.js +2 -2
- package/dist/stepper.css-mistica.js +16 -16
- package/dist/switch-component.css-mistica.js +53 -53
- package/dist/table.css-mistica.js +24 -24
- package/dist/tabs.css-mistica.js +30 -30
- package/dist/tag.css-mistica.js +5 -5
- package/dist/text-field-base.css-mistica.js +30 -30
- package/dist/text-field-components.css-mistica.js +23 -20
- package/dist/text-field-components.css.d.ts +1 -0
- package/dist/text-field-components.js +31 -25
- package/dist/text-link.css-mistica.js +10 -10
- package/dist/text.css-mistica.js +13 -13
- package/dist/theme-context.css-mistica.js +2 -2
- package/dist/timeline.css-mistica.js +18 -18
- package/dist/timer.css-mistica.js +13 -13
- package/dist/tooltip.css-mistica.js +12 -12
- package/dist/touchable.css-mistica.js +5 -5
- package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
- package/dist/video.css-mistica.js +2 -2
- package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
- package/dist-es/accordion.css-mistica.js +7 -7
- package/dist-es/align.css-mistica.js +2 -2
- package/dist-es/autocomplete.css-mistica.js +2 -2
- package/dist-es/avatar.css-mistica.js +2 -2
- package/dist-es/badge.css-mistica.js +2 -2
- package/dist-es/box.css-mistica.js +15 -15
- package/dist-es/boxed.css-mistica.js +25 -25
- package/dist-es/button-group.css-mistica.js +2 -2
- package/dist-es/button-layout.css-mistica.js +16 -16
- package/dist-es/button.css-mistica.js +38 -38
- package/dist-es/callout.css-mistica.js +12 -12
- package/dist-es/card-internal.css-mistica.js +20 -20
- package/dist-es/carousel.css-mistica.js +10 -10
- package/dist-es/checkbox.css-mistica.js +14 -14
- package/dist-es/chip.css-mistica.js +17 -17
- package/dist-es/circle.css-mistica.js +2 -2
- package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
- package/dist-es/community/blocks.css-mistica.js +2 -2
- package/dist-es/community/example-component.css-mistica.js +2 -2
- package/dist-es/counter.css-mistica.js +2 -2
- package/dist-es/cover-hero.css-mistica.js +4 -4
- package/dist-es/credit-card-number-field.css-mistica.js +4 -4
- package/dist-es/date-field.css-mistica.js +1 -1
- package/dist-es/date-time-picker.css-mistica.js +2 -2
- package/dist-es/dialog.css-mistica.js +5 -5
- package/dist-es/divider.css-mistica.js +5 -5
- package/dist-es/double-field.css-mistica.js +4 -4
- package/dist-es/drawer.css-mistica.js +2 -2
- package/dist-es/empty-state-card.css-mistica.js +2 -2
- package/dist-es/empty-state.css-mistica.js +7 -7
- package/dist-es/fade-in.css-mistica.js +1 -1
- package/dist-es/feedback.css-mistica.js +2 -2
- package/dist-es/file-upload.css-mistica.js +8 -8
- package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
- package/dist-es/form.css-mistica.js +2 -2
- package/dist-es/grid-layout.css-mistica.js +4 -4
- package/dist-es/grid.css-mistica.js +127 -127
- package/dist-es/header.css-mistica.js +2 -2
- package/dist-es/hero.css-mistica.js +4 -4
- package/dist-es/horizontal-scroll.css-mistica.js +2 -2
- package/dist-es/icon-button.css-mistica.js +56 -56
- package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
- package/dist-es/icons/icon-error.css-mistica.js +2 -2
- package/dist-es/image.css-mistica.js +4 -4
- package/dist-es/inline.css-mistica.js +10 -10
- package/dist-es/list.css-mistica.js +2 -2
- package/dist-es/loading-bar.css-mistica.js +2 -2
- package/dist-es/loading-screen.css-mistica.js +5 -5
- package/dist-es/logo.css-mistica.js +7 -7
- package/dist-es/menu.css-mistica.js +15 -15
- package/dist-es/mosaic.css-mistica.js +2 -2
- package/dist-es/navigation-bar.css-mistica.js +20 -20
- package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
- package/dist-es/package-version.js +2 -2
- package/dist-es/pin-field.css-mistica.js +2 -2
- package/dist-es/popover.css-mistica.js +2 -2
- package/dist-es/progress-bar.css-mistica.js +8 -8
- package/dist-es/radio-button.css-mistica.js +25 -25
- package/dist-es/rating.css-mistica.js +4 -4
- package/dist-es/responsive-layout.css-mistica.js +7 -7
- package/dist-es/screen-reader-only.css-mistica.js +2 -2
- package/dist-es/select.css-mistica.js +20 -20
- package/dist-es/sheet-action-row.css-mistica.js +2 -2
- package/dist-es/sheet-common.css-mistica.js +2 -2
- package/dist-es/sheet-info.css-mistica.js +2 -2
- package/dist-es/skeletons.css-mistica.js +8 -8
- package/dist-es/skins/skin-contract.css-mistica.js +686 -686
- package/dist-es/skip-link.css-mistica.js +2 -2
- package/dist-es/slider.css-mistica.js +20 -20
- package/dist-es/snackbar.css-mistica.js +5 -5
- package/dist-es/spinner.css-mistica.js +2 -2
- package/dist-es/square.css-mistica.js +2 -2
- package/dist-es/stack.css-mistica.js +7 -7
- package/dist-es/stacking-group.css-mistica.js +2 -2
- package/dist-es/stepper.css-mistica.js +4 -4
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.css-mistica.js +41 -41
- package/dist-es/table.css-mistica.js +11 -11
- package/dist-es/tabs.css-mistica.js +21 -21
- package/dist-es/tag.css-mistica.js +2 -2
- package/dist-es/text-field-base.css-mistica.js +17 -17
- package/dist-es/text-field-components.css-mistica.js +4 -4
- package/dist-es/text-field-components.js +52 -46
- package/dist-es/text-link.css-mistica.js +9 -9
- package/dist-es/text.css-mistica.js +8 -8
- package/dist-es/theme-context.css-mistica.js +2 -2
- package/dist-es/timeline.css-mistica.js +11 -11
- package/dist-es/timer.css-mistica.js +7 -7
- package/dist-es/tooltip.css-mistica.js +3 -3
- package/dist-es/touchable.css-mistica.js +2 -2
- package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
- package/dist-es/video.css-mistica.js +2 -2
- package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
- package/doc/llms.md +0 -24
- package/package.json +2 -14
- package/src/accordion.css.ts +0 -121
- package/src/accordion.tsx +0 -366
- package/src/align.css.ts +0 -7
- package/src/align.tsx +0 -32
- package/src/autocomplete.css.ts +0 -62
- package/src/autocomplete.tsx +0 -239
- package/src/avatar.css.ts +0 -14
- package/src/avatar.tsx +0 -120
- package/src/badge.css.ts +0 -51
- package/src/badge.tsx +0 -79
- package/src/box.css.ts +0 -51
- package/src/box.tsx +0 -114
- package/src/boxed.css.ts +0 -132
- package/src/boxed.tsx +0 -153
- package/src/button-fixed-footer-layout.tsx +0 -62
- package/src/button-group.css.ts +0 -75
- package/src/button-group.tsx +0 -91
- package/src/button-layout.css.ts +0 -162
- package/src/button-layout.tsx +0 -91
- package/src/button.css.ts +0 -758
- package/src/button.tsx +0 -632
- package/src/callout.css.ts +0 -50
- package/src/callout.tsx +0 -147
- package/src/card-cover.tsx +0 -242
- package/src/card-data.tsx +0 -152
- package/src/card-internal.css.ts +0 -271
- package/src/card-internal.tsx +0 -1724
- package/src/card-media.tsx +0 -157
- package/src/card-naked.tsx +0 -63
- package/src/carousel.css.ts +0 -522
- package/src/carousel.tsx +0 -1300
- package/src/checkbox.css.ts +0 -94
- package/src/checkbox.tsx +0 -192
- package/src/chip.css.ts +0 -204
- package/src/chip.tsx +0 -191
- package/src/circle.css.ts +0 -14
- package/src/circle.tsx +0 -52
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +0 -84
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +0 -72
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +0 -66
- package/src/community/__stories__/advanced-data-card-story.tsx +0 -158
- package/src/community/__stories__/blocks-story.tsx +0 -272
- package/src/community/__stories__/example-component-story.tsx +0 -15
- package/src/community/__stories__/index-story.tsx +0 -154
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +0 -40
- package/src/community/advanced-data-card.css.ts +0 -271
- package/src/community/advanced-data-card.tsx +0 -431
- package/src/community/blocks.css.ts +0 -12
- package/src/community/blocks.tsx +0 -290
- package/src/community/example-component.css.ts +0 -7
- package/src/community/example-component.tsx +0 -17
- package/src/community/index.tsx +0 -10
- package/src/counter.css.ts +0 -150
- package/src/counter.tsx +0 -215
- package/src/cover-hero-media.tsx +0 -39
- package/src/cover-hero.css.ts +0 -133
- package/src/cover-hero.tsx +0 -262
- package/src/credit-card-expiration-field.tsx +0 -187
- package/src/credit-card-fields.tsx +0 -56
- package/src/credit-card-number-field.css.ts +0 -47
- package/src/credit-card-number-field.tsx +0 -245
- package/src/cvv-field.tsx +0 -169
- package/src/date-field.css.ts +0 -14
- package/src/date-field.tsx +0 -130
- package/src/date-time-field.tsx +0 -141
- package/src/date-time-picker.css.ts +0 -126
- package/src/date-time-picker.tsx +0 -188
- package/src/decimal-field.tsx +0 -160
- package/src/desktop-container-type-context.tsx +0 -15
- package/src/dialog-context.tsx +0 -81
- package/src/dialog.css.ts +0 -155
- package/src/dialog.tsx +0 -423
- package/src/divider.css.ts +0 -10
- package/src/divider.tsx +0 -11
- package/src/double-field.css.ts +0 -33
- package/src/double-field.tsx +0 -71
- package/src/drawer.css.ts +0 -123
- package/src/drawer.tsx +0 -304
- package/src/email-field.tsx +0 -76
- package/src/empty-state-card.css.ts +0 -40
- package/src/empty-state-card.tsx +0 -92
- package/src/empty-state.css.ts +0 -119
- package/src/empty-state.tsx +0 -141
- package/src/fade-in.css.ts +0 -12
- package/src/fade-in.tsx +0 -40
- package/src/feedback.css.ts +0 -119
- package/src/feedback.tsx +0 -432
- package/src/file-upload.css.ts +0 -156
- package/src/file-upload.tsx +0 -612
- package/src/fixed-footer-layout.css.ts +0 -96
- package/src/fixed-footer-layout.tsx +0 -215
- package/src/fixed-to-top.tsx +0 -21
- package/src/focus-trap.tsx +0 -17
- package/src/form-context.tsx +0 -198
- package/src/form.css.ts +0 -5
- package/src/form.tsx +0 -287
- package/src/grid-layout.css.ts +0 -68
- package/src/grid-layout.tsx +0 -201
- package/src/grid.css.ts +0 -203
- package/src/grid.tsx +0 -241
- package/src/header.css.ts +0 -30
- package/src/header.tsx +0 -319
- package/src/hero.css.ts +0 -71
- package/src/hero.tsx +0 -318
- package/src/hooks.tsx +0 -313
- package/src/horizontal-scroll.css.ts +0 -43
- package/src/horizontal-scroll.tsx +0 -18
- package/src/iban-field.tsx +0 -218
- package/src/icon-button.css.ts +0 -561
- package/src/icon-button.tsx +0 -221
- package/src/icons/__stories__/mistica-icons-story.tsx +0 -192
- package/src/icons/icon-amex.tsx +0 -40
- package/src/icons/icon-chevron.css.ts +0 -23
- package/src/icons/icon-chevron.tsx +0 -150
- package/src/icons/icon-cvv-amex.tsx +0 -31
- package/src/icons/icon-cvv-visa-mc.tsx +0 -31
- package/src/icons/icon-error.css.ts +0 -27
- package/src/icons/icon-error.tsx +0 -207
- package/src/icons/icon-info.tsx +0 -86
- package/src/icons/icon-mastercard.tsx +0 -36
- package/src/icons/icon-success-vivo-new.tsx +0 -51
- package/src/icons/icon-success-vivo.tsx +0 -36
- package/src/icons/icon-success.tsx +0 -211
- package/src/icons/icon-visa.tsx +0 -32
- package/src/image.css.ts +0 -48
- package/src/image.tsx +0 -345
- package/src/index.tsx +0 -2466
- package/src/inline.css.ts +0 -131
- package/src/inline.tsx +0 -135
- package/src/integer-field.tsx +0 -93
- package/src/list.css.ts +0 -281
- package/src/list.tsx +0 -963
- package/src/loading-bar.css.ts +0 -69
- package/src/loading-bar.tsx +0 -25
- package/src/loading-screen.css.ts +0 -114
- package/src/loading-screen.tsx +0 -376
- package/src/logo-blau-shell.tsx +0 -30
- package/src/logo-blau.tsx +0 -60
- package/src/logo-common.tsx +0 -29
- package/src/logo-esimflag-shell.tsx +0 -30
- package/src/logo-esimflag.tsx +0 -56
- package/src/logo-movistar-new-shell.tsx +0 -30
- package/src/logo-movistar-new.tsx +0 -85
- package/src/logo-movistar-shell.tsx +0 -30
- package/src/logo-movistar.tsx +0 -63
- package/src/logo-o2-new-shell.tsx +0 -26
- package/src/logo-o2-new.tsx +0 -27
- package/src/logo-o2-shell.tsx +0 -26
- package/src/logo-o2.tsx +0 -27
- package/src/logo-telefonica-shell.tsx +0 -30
- package/src/logo-telefonica.tsx +0 -95
- package/src/logo-tu-shell.tsx +0 -26
- package/src/logo-tu.tsx +0 -28
- package/src/logo-vivo-shell.tsx +0 -30
- package/src/logo-vivo.tsx +0 -53
- package/src/logo.css.ts +0 -33
- package/src/logo.tsx +0 -313
- package/src/master-detail-layout.tsx +0 -28
- package/src/maybe-dismissable.css.ts +0 -37
- package/src/maybe-dismissable.tsx +0 -58
- package/src/media-queries.css.ts +0 -67
- package/src/menu.css.ts +0 -132
- package/src/menu.tsx +0 -468
- package/src/meter.tsx +0 -516
- package/src/modal-context-provider.tsx +0 -45
- package/src/month-field.tsx +0 -124
- package/src/mosaic.css.ts +0 -73
- package/src/mosaic.tsx +0 -205
- package/src/navigation-bar.css.ts +0 -558
- package/src/navigation-bar.tsx +0 -1637
- package/src/navigation-breadcrumbs.css.ts +0 -22
- package/src/navigation-breadcrumbs.tsx +0 -69
- package/src/negative-box.tsx +0 -15
- package/src/nestable-context.tsx +0 -139
- package/src/overlay.tsx +0 -86
- package/src/overscroll-color-context.tsx +0 -141
- package/src/package-version.tsx +0 -2
- package/src/password-field.tsx +0 -126
- package/src/phone-number-field-lite.tsx +0 -265
- package/src/phone-number-field.tsx +0 -171
- package/src/pin-field.css.ts +0 -90
- package/src/pin-field.tsx +0 -346
- package/src/placeholder.tsx +0 -41
- package/src/popover.css.ts +0 -8
- package/src/popover.tsx +0 -85
- package/src/portal.tsx +0 -43
- package/src/progress-bar.css.ts +0 -61
- package/src/progress-bar.tsx +0 -174
- package/src/radio-button.css.ts +0 -174
- package/src/radio-button.tsx +0 -322
- package/src/rating.css.ts +0 -128
- package/src/rating.tsx +0 -351
- package/src/responsive-layout.css.ts +0 -162
- package/src/responsive-layout.tsx +0 -106
- package/src/screen-reader-only.css.ts +0 -27
- package/src/screen-reader-only.tsx +0 -33
- package/src/screen-size-context-provider.tsx +0 -96
- package/src/screen-size-context.tsx +0 -23
- package/src/search-field.tsx +0 -126
- package/src/select.css.ts +0 -226
- package/src/select.tsx +0 -513
- package/src/sheet-action-row.css.ts +0 -33
- package/src/sheet-actions-list.tsx +0 -113
- package/src/sheet-actions.tsx +0 -95
- package/src/sheet-common.css.ts +0 -254
- package/src/sheet-common.tsx +0 -402
- package/src/sheet-info.css.ts +0 -19
- package/src/sheet-info.tsx +0 -127
- package/src/sheet-native.tsx +0 -189
- package/src/sheet-radio-list.tsx +0 -118
- package/src/sheet-root.tsx +0 -127
- package/src/sheet-types.tsx +0 -94
- package/src/sheet-web.tsx +0 -140
- package/src/skeleton-base.tsx +0 -38
- package/src/skeletons.css.ts +0 -56
- package/src/skeletons.tsx +0 -133
- package/src/skins/blau.tsx +0 -724
- package/src/skins/constants.tsx +0 -10
- package/src/skins/defaults.tsx +0 -104
- package/src/skins/esimflag.tsx +0 -728
- package/src/skins/movistar-new.tsx +0 -735
- package/src/skins/movistar.tsx +0 -740
- package/src/skins/o2-new.tsx +0 -731
- package/src/skins/o2.tsx +0 -727
- package/src/skins/skin-contract.css.ts +0 -380
- package/src/skins/telefonica.tsx +0 -768
- package/src/skins/tu.tsx +0 -741
- package/src/skins/types/colors.tsx +0 -286
- package/src/skins/types/index.tsx +0 -153
- package/src/skins/utils.tsx +0 -66
- package/src/skins/vivo-new.tsx +0 -745
- package/src/skins/vivo.tsx +0 -720
- package/src/skip-link.css.ts +0 -34
- package/src/skip-link.tsx +0 -52
- package/src/slider.css.ts +0 -181
- package/src/slider.tsx +0 -384
- package/src/snackbar-context.tsx +0 -98
- package/src/snackbar-native.ts +0 -37
- package/src/snackbar.css.ts +0 -176
- package/src/snackbar.tsx +0 -258
- package/src/spinner.css.ts +0 -66
- package/src/spinner.tsx +0 -136
- package/src/sprinkles.css.ts +0 -83
- package/src/square.css.ts +0 -15
- package/src/square.tsx +0 -55
- package/src/stack.css.ts +0 -44
- package/src/stack.tsx +0 -79
- package/src/stacking-group.css.ts +0 -15
- package/src/stacking-group.tsx +0 -82
- package/src/stepper.css.ts +0 -233
- package/src/stepper.tsx +0 -156
- package/src/switch-component.css.ts +0 -181
- package/src/switch-component.tsx +0 -187
- package/src/tab-focus.tsx +0 -68
- package/src/table-actions-header.tsx +0 -21
- package/src/table-cell-text.tsx +0 -35
- package/src/table.css.ts +0 -297
- package/src/table.tsx +0 -398
- package/src/tabs.css.ts +0 -212
- package/src/tabs.tsx +0 -263
- package/src/tag.css.ts +0 -42
- package/src/tag.tsx +0 -161
- package/src/test-utils/environment/setup-ssr.tsx +0 -10
- package/src/test-utils/fail-test-on-console-error.tsx +0 -22
- package/src/test-utils/index.tsx +0 -341
- package/src/test-utils/setup-ssr-test-env.tsx +0 -13
- package/src/test-utils/ssr.tsx +0 -197
- package/src/text-field-base.css.ts +0 -416
- package/src/text-field-base.tsx +0 -628
- package/src/text-field-components.css.ts +0 -159
- package/src/text-field-components.tsx +0 -225
- package/src/text-field.tsx +0 -118
- package/src/text-link.css.ts +0 -83
- package/src/text-link.tsx +0 -85
- package/src/text-tokens.tsx +0 -708
- package/src/text.css.ts +0 -60
- package/src/text.tsx +0 -516
- package/src/theme-context-provider.tsx +0 -370
- package/src/theme-context.css.ts +0 -3
- package/src/theme-context.tsx +0 -8
- package/src/theme-variant-context.tsx +0 -51
- package/src/theme.tsx +0 -184
- package/src/time-field.tsx +0 -99
- package/src/timeline.css.ts +0 -135
- package/src/timeline.tsx +0 -250
- package/src/timer.css.ts +0 -99
- package/src/timer.tsx +0 -420
- package/src/title.tsx +0 -119
- package/src/tooltip-context-provider.tsx +0 -57
- package/src/tooltip.css.ts +0 -106
- package/src/tooltip.tsx +0 -649
- package/src/touchable.css.ts +0 -56
- package/src/touchable.tsx +0 -355
- package/src/types/font-face.d.ts +0 -47
- package/src/types/libs.d.ts +0 -3
- package/src/utils/__tests__/analytics-test.tsx +0 -35
- package/src/utils/__tests__/browser-test.tsx +0 -28
- package/src/utils/__tests__/dom-test.tsx +0 -23
- package/src/utils/__tests__/helpers-test.tsx +0 -166
- package/src/utils/analytics.tsx +0 -28
- package/src/utils/animation.tsx +0 -201
- package/src/utils/aspect-ratio-support.css.ts +0 -28
- package/src/utils/aspect-ratio-support.tsx +0 -141
- package/src/utils/browser.tsx +0 -9
- package/src/utils/color.tsx +0 -46
- package/src/utils/common.tsx +0 -27
- package/src/utils/credit-card.tsx +0 -46
- package/src/utils/css.tsx +0 -25
- package/src/utils/document-visibility.tsx +0 -52
- package/src/utils/dom.tsx +0 -155
- package/src/utils/environment.tsx +0 -6
- package/src/utils/headings.tsx +0 -18
- package/src/utils/helpers.tsx +0 -182
- package/src/utils/keys.tsx +0 -8
- package/src/utils/locale.tsx +0 -27
- package/src/utils/platform.tsx +0 -94
- package/src/utils/region-code.tsx +0 -1
- package/src/utils/renders-element.tsx +0 -6
- package/src/utils/time.tsx +0 -22
- package/src/utils/types.tsx +0 -19
- package/src/utils/utility-types.tsx +0 -8
- package/src/video.css.ts +0 -11
- package/src/video.tsx +0 -355
- package/src/vivinho-loading-animation/in-lottie.json +0 -402
- package/src/vivinho-loading-animation/index.tsx +0 -90
- package/src/vivinho-loading-animation/out-lottie.json +0 -575
- package/src/vivinho-loading-animation/pulse-lottie.json +0 -551
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +0 -15
- package/src/vivinho-loading-animation/wave-lottie.json +0 -2829
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import {debounce} from './utils/helpers';
|
|
5
|
-
import {isRunningAcceptanceTest} from './utils/platform';
|
|
6
|
-
import {
|
|
7
|
-
useBoundingRect,
|
|
8
|
-
useElementDimensions,
|
|
9
|
-
useIsomorphicLayoutEffect,
|
|
10
|
-
useScreenSize,
|
|
11
|
-
useTheme,
|
|
12
|
-
useWindowSize,
|
|
13
|
-
} from './hooks';
|
|
14
|
-
import {
|
|
15
|
-
addPassiveEventListener,
|
|
16
|
-
getScrollableParentElement,
|
|
17
|
-
getScrollDistanceToBottom,
|
|
18
|
-
hasScroll,
|
|
19
|
-
removePassiveEventListener,
|
|
20
|
-
} from './utils/dom';
|
|
21
|
-
import {Portal} from './portal';
|
|
22
|
-
import {vars} from './skins/skin-contract.css';
|
|
23
|
-
import * as styles from './fixed-footer-layout.css';
|
|
24
|
-
import {applyCssVars, safeAreaInsetBottom} from './utils/css';
|
|
25
|
-
import {useFixedToTopHeight} from './fixed-to-top';
|
|
26
|
-
import {useOverScrollColor} from './overscroll-color-context';
|
|
27
|
-
|
|
28
|
-
const getScrollEventTarget = (el: HTMLElement) => (el === document.documentElement ? window : el);
|
|
29
|
-
|
|
30
|
-
const waitForSwitchTransitionToStart = (fn: () => void) => {
|
|
31
|
-
const timeoutId = setTimeout(fn, 0);
|
|
32
|
-
return {
|
|
33
|
-
cancel: () => clearTimeout(timeoutId),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
type Props = {
|
|
38
|
-
isFooterVisible?: boolean;
|
|
39
|
-
footer: React.ReactNode;
|
|
40
|
-
footerHeight?: number | string;
|
|
41
|
-
footerBgColor?: string;
|
|
42
|
-
footerRole?: string;
|
|
43
|
-
containerBgColor?: string;
|
|
44
|
-
children: React.ReactNode;
|
|
45
|
-
onChangeFooterHeight?: (heightInPx: number) => void;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const MIN_AVAILABLE_HEIGHT_FOR_FIXED = 200;
|
|
49
|
-
|
|
50
|
-
const FixedFooterLayout = ({
|
|
51
|
-
isFooterVisible = true,
|
|
52
|
-
footer,
|
|
53
|
-
footerHeight = 'auto',
|
|
54
|
-
footerBgColor = vars.colors.background,
|
|
55
|
-
footerRole,
|
|
56
|
-
containerBgColor = vars.colors.background,
|
|
57
|
-
children,
|
|
58
|
-
onChangeFooterHeight,
|
|
59
|
-
}: Props): JSX.Element => {
|
|
60
|
-
const [displayElevation, setDisplayElevation] = React.useState(false);
|
|
61
|
-
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
62
|
-
const {height: contentHeight} = useBoundingRect(containerRef) || {height: 0};
|
|
63
|
-
const {isTabletOrSmaller} = useScreenSize();
|
|
64
|
-
const {platformOverrides} = useTheme();
|
|
65
|
-
// include margins to take into account marginBottom: safe-area-inset-bottom
|
|
66
|
-
const {height: domFooterHeight, ref} = useElementDimensions({includeMargins: true});
|
|
67
|
-
const {visualHeight} = useWindowSize();
|
|
68
|
-
const topDistance = useFixedToTopHeight();
|
|
69
|
-
const availableHeight = visualHeight - topDistance - domFooterHeight;
|
|
70
|
-
const isFooterFixed = availableHeight > MIN_AVAILABLE_HEIGHT_FOR_FIXED;
|
|
71
|
-
const {topColor = footerBgColor} = useOverScrollColor();
|
|
72
|
-
const {height: gradientHeight, ref: gradientRef} = useElementDimensions();
|
|
73
|
-
|
|
74
|
-
useIsomorphicLayoutEffect(() => {
|
|
75
|
-
onChangeFooterHeight?.(domFooterHeight);
|
|
76
|
-
}, [onChangeFooterHeight, domFooterHeight]);
|
|
77
|
-
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
/**
|
|
80
|
-
* There is no elevation in desktop devices and we don't display it in acceptance tests or when the
|
|
81
|
-
* content's height is too small, so we avoid unnecesary calculations in these cases.
|
|
82
|
-
*/
|
|
83
|
-
if (!isTabletOrSmaller || isRunningAcceptanceTest(platformOverrides) || !isFooterFixed) {
|
|
84
|
-
setDisplayElevation(false);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const scrollable = getScrollableParentElement(containerRef.current);
|
|
89
|
-
|
|
90
|
-
const shouldDisplayElevation = () =>
|
|
91
|
-
hasScroll(scrollable) && getScrollDistanceToBottom(scrollable) > topDistance + 1; // This is 1 and not 0 because a weird bug with Safari
|
|
92
|
-
|
|
93
|
-
const checkDisplayElevation = debounce(
|
|
94
|
-
() => {
|
|
95
|
-
setDisplayElevation(shouldDisplayElevation());
|
|
96
|
-
},
|
|
97
|
-
50,
|
|
98
|
-
{leading: true, maxWait: 100}
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const transitionAwaiter = waitForSwitchTransitionToStart(checkDisplayElevation);
|
|
102
|
-
const scrollEventTarget = getScrollEventTarget(scrollable);
|
|
103
|
-
addPassiveEventListener(scrollEventTarget, 'resize', checkDisplayElevation);
|
|
104
|
-
addPassiveEventListener(scrollEventTarget, 'scroll', checkDisplayElevation);
|
|
105
|
-
return () => {
|
|
106
|
-
checkDisplayElevation.cancel();
|
|
107
|
-
removePassiveEventListener(scrollEventTarget, 'scroll', checkDisplayElevation);
|
|
108
|
-
removePassiveEventListener(scrollEventTarget, 'resize', checkDisplayElevation);
|
|
109
|
-
transitionAwaiter.cancel();
|
|
110
|
-
};
|
|
111
|
-
}, [
|
|
112
|
-
platformOverrides,
|
|
113
|
-
isTabletOrSmaller,
|
|
114
|
-
isFooterFixed,
|
|
115
|
-
// `topDistance` and `contentHeight` dependencies are needed to recalculate the elevation state
|
|
116
|
-
topDistance,
|
|
117
|
-
contentHeight,
|
|
118
|
-
]);
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Diagram of the layout:
|
|
122
|
-
* https://excalidraw.com/#json=No0s6LB7QO735nv-wGIEP,9OOuqiaFInbtr1YjMm4g4Q
|
|
123
|
-
*/
|
|
124
|
-
const renderBackground = () => {
|
|
125
|
-
return (
|
|
126
|
-
<Portal className={styles.portal}>
|
|
127
|
-
<div
|
|
128
|
-
className={styles.fixedBackgroundLayer}
|
|
129
|
-
style={{
|
|
130
|
-
background: `linear-gradient(180deg, ${topColor} 50%, ${footerBgColor} 50% 100%)`,
|
|
131
|
-
}}
|
|
132
|
-
/>
|
|
133
|
-
<div
|
|
134
|
-
ref={gradientRef}
|
|
135
|
-
className={styles.absoluteBackgroundLayer}
|
|
136
|
-
style={{
|
|
137
|
-
background: containerBgColor, // this color could be a gradient
|
|
138
|
-
top: topDistance - 1, // -1 because the navigationbar could have a 1px transparent background
|
|
139
|
-
bottom: isFooterFixed ? domFooterHeight : 'unset',
|
|
140
|
-
height: isFooterFixed ? 'unset' : contentHeight,
|
|
141
|
-
}}
|
|
142
|
-
/>
|
|
143
|
-
|
|
144
|
-
<div
|
|
145
|
-
className={styles.absoluteBackgroundLayer}
|
|
146
|
-
style={{
|
|
147
|
-
background: footerBgColor,
|
|
148
|
-
top: gradientHeight + topDistance - 1,
|
|
149
|
-
height: `calc(${contentHeight}px - ${gradientHeight}px)`,
|
|
150
|
-
}}
|
|
151
|
-
/>
|
|
152
|
-
</Portal>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<>
|
|
158
|
-
<div
|
|
159
|
-
ref={containerRef}
|
|
160
|
-
className={styles.container}
|
|
161
|
-
style={applyCssVars({
|
|
162
|
-
[styles.vars.footerHeight]: isFooterFixed ? `${domFooterHeight}px` : '0px',
|
|
163
|
-
})}
|
|
164
|
-
>
|
|
165
|
-
{renderBackground()}
|
|
166
|
-
{children}
|
|
167
|
-
</div>
|
|
168
|
-
{isFooterVisible && isFooterFixed && (
|
|
169
|
-
/**
|
|
170
|
-
* This style is added to the `html` element to prevent the footer
|
|
171
|
-
* from covering the focus of elements when there is overflow.
|
|
172
|
-
*/
|
|
173
|
-
<style>{`html {scroll-padding-bottom: ${domFooterHeight}px}`}</style>
|
|
174
|
-
)}
|
|
175
|
-
<div
|
|
176
|
-
className={classnames(styles.footer, {
|
|
177
|
-
[styles.withoutFooter]: !isFooterVisible,
|
|
178
|
-
[styles.elevated]: displayElevation,
|
|
179
|
-
[styles.fixedFooter]: isFooterFixed,
|
|
180
|
-
})}
|
|
181
|
-
/**
|
|
182
|
-
* This style is inline to avoid creating a class that may collide with
|
|
183
|
-
* other fixed footers during the page animation transition
|
|
184
|
-
*/
|
|
185
|
-
style={{
|
|
186
|
-
background: isTabletOrSmaller ? footerBgColor : undefined,
|
|
187
|
-
}}
|
|
188
|
-
data-testid={`fixed-footer${isFooterVisible ? '-visible' : '-hidden'}`}
|
|
189
|
-
/**
|
|
190
|
-
* This hints about the position of the fixed element. Other components could select nodes
|
|
191
|
-
* with this data attribute to correctly position it while transitioning. For example in
|
|
192
|
-
* WebApp's PageTransition (see `switch-transition.js` in webapp repo)
|
|
193
|
-
*/
|
|
194
|
-
data-position-fixed="bottom"
|
|
195
|
-
>
|
|
196
|
-
{isFooterVisible && (
|
|
197
|
-
<div
|
|
198
|
-
role={footerRole}
|
|
199
|
-
ref={ref}
|
|
200
|
-
data-component-name="FixedFooter"
|
|
201
|
-
data-testid="FixedFooter"
|
|
202
|
-
style={{
|
|
203
|
-
height: footerHeight,
|
|
204
|
-
marginBottom: safeAreaInsetBottom,
|
|
205
|
-
}}
|
|
206
|
-
>
|
|
207
|
-
{footer}
|
|
208
|
-
</div>
|
|
209
|
-
)}
|
|
210
|
-
</div>
|
|
211
|
-
</>
|
|
212
|
-
);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
export default FixedFooterLayout;
|
package/src/fixed-to-top.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
export const TopDistanceContext: React.Context<number> = React.createContext(0);
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
children: (topDistance: number) => React.ReactNode;
|
|
8
|
-
// The height of the element to be positioned fixed to top
|
|
9
|
-
height: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const FixedToTop = ({children, height}: Props): JSX.Element => {
|
|
13
|
-
const top = React.useContext(TopDistanceContext);
|
|
14
|
-
return <TopDistanceContext.Provider value={top + height}>{children(top)}</TopDistanceContext.Provider>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const useFixedToTopHeight = (): number => {
|
|
18
|
-
return React.useContext(TopDistanceContext);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default FixedToTop;
|
package/src/focus-trap.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import ReactFocusLock from 'react-focus-lock';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
group?: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const FocusTrap = ({children, disabled, className, group}: Props): JSX.Element => (
|
|
12
|
-
<ReactFocusLock noFocusGuards disabled={disabled} className={className} group={group}>
|
|
13
|
-
{children}
|
|
14
|
-
</ReactFocusLock>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export default FocusTrap;
|
package/src/form-context.tsx
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {useTheme} from './hooks';
|
|
4
|
-
import * as tokens from './text-tokens';
|
|
5
|
-
|
|
6
|
-
export type FormStatus = 'filling' | 'sending';
|
|
7
|
-
export type FormErrors = {[name: string]: string | undefined};
|
|
8
|
-
export type FieldValidator = (value: any, rawValue: string) => string | undefined;
|
|
9
|
-
|
|
10
|
-
export type FieldRegistration = {
|
|
11
|
-
input?: HTMLInputElement | HTMLSelectElement | null;
|
|
12
|
-
validator?: FieldValidator;
|
|
13
|
-
focusableElement?: HTMLDivElement | HTMLSelectElement | null;
|
|
14
|
-
label?: string;
|
|
15
|
-
required?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type Context = {
|
|
19
|
-
// raw values are the real input values
|
|
20
|
-
rawValues: {[name: string]: any};
|
|
21
|
-
setRawValue: (param: {readonly name: string; readonly value: any}) => void;
|
|
22
|
-
// these values can have some kind of postprocessing. For example, remove spaces from credit card numbers
|
|
23
|
-
values: {[name: string]: any};
|
|
24
|
-
setValue: (param: {readonly name: string; readonly value: any}) => void;
|
|
25
|
-
formStatus: FormStatus;
|
|
26
|
-
register: (name: string, ref: FieldRegistration) => void;
|
|
27
|
-
formErrors: FormErrors;
|
|
28
|
-
setFormError: (param: {readonly name: string; readonly error?: string}) => void;
|
|
29
|
-
jumpToNext: (currentName: string) => void;
|
|
30
|
-
submit: () => void;
|
|
31
|
-
validate: () => FormErrors;
|
|
32
|
-
formId: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const FormContext = React.createContext<Context>({
|
|
36
|
-
values: {},
|
|
37
|
-
setValue: () => {},
|
|
38
|
-
rawValues: {},
|
|
39
|
-
setRawValue: () => {},
|
|
40
|
-
formStatus: 'filling',
|
|
41
|
-
register: () => {},
|
|
42
|
-
formErrors: {},
|
|
43
|
-
setFormError: () => {},
|
|
44
|
-
jumpToNext: () => {},
|
|
45
|
-
submit: () => {},
|
|
46
|
-
validate: () => ({}),
|
|
47
|
-
formId: '',
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export const useForm = (): Context => React.useContext(FormContext);
|
|
51
|
-
|
|
52
|
-
export const useControlProps = <T,>({
|
|
53
|
-
name,
|
|
54
|
-
label,
|
|
55
|
-
value,
|
|
56
|
-
defaultValue,
|
|
57
|
-
onChange,
|
|
58
|
-
disabled,
|
|
59
|
-
}: {
|
|
60
|
-
name: string;
|
|
61
|
-
label?: string;
|
|
62
|
-
value: undefined | T;
|
|
63
|
-
defaultValue: undefined | T;
|
|
64
|
-
onChange: undefined | ((value: T) => void);
|
|
65
|
-
disabled?: boolean;
|
|
66
|
-
}): {
|
|
67
|
-
name: string;
|
|
68
|
-
label?: string;
|
|
69
|
-
value?: T;
|
|
70
|
-
defaultValue?: T;
|
|
71
|
-
onChange: (value: T) => void;
|
|
72
|
-
focusableRef: (focusableElement: HTMLDivElement | null) => void;
|
|
73
|
-
disabled: boolean | undefined;
|
|
74
|
-
} => {
|
|
75
|
-
const {setRawValue, setValue, rawValues, setFormError, register, formStatus} = useForm();
|
|
76
|
-
|
|
77
|
-
React.useEffect(() => {
|
|
78
|
-
if (rawValues[name] === undefined) {
|
|
79
|
-
const initialValue = value ?? defaultValue ?? false;
|
|
80
|
-
setValue({name, value: initialValue});
|
|
81
|
-
setRawValue({name, value: initialValue});
|
|
82
|
-
}
|
|
83
|
-
}, [value, name, defaultValue, rawValues, setValue, setRawValue]);
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
name,
|
|
87
|
-
label,
|
|
88
|
-
value,
|
|
89
|
-
defaultValue: defaultValue ?? (value === undefined ? rawValues[name] ?? false : undefined),
|
|
90
|
-
focusableRef: (focusableElement: HTMLDivElement | null) =>
|
|
91
|
-
register(name, {
|
|
92
|
-
focusableElement,
|
|
93
|
-
label,
|
|
94
|
-
}),
|
|
95
|
-
onChange: (value: T) => {
|
|
96
|
-
setRawValue({name, value});
|
|
97
|
-
setValue({name, value});
|
|
98
|
-
setFormError({name, error: ''});
|
|
99
|
-
onChange?.(value);
|
|
100
|
-
},
|
|
101
|
-
disabled: formStatus === 'sending' || disabled,
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const useFieldProps = ({
|
|
106
|
-
name,
|
|
107
|
-
label,
|
|
108
|
-
value,
|
|
109
|
-
defaultValue,
|
|
110
|
-
processValue,
|
|
111
|
-
helperText,
|
|
112
|
-
optional,
|
|
113
|
-
error,
|
|
114
|
-
disabled,
|
|
115
|
-
onBlur,
|
|
116
|
-
validate,
|
|
117
|
-
validateOnBlurInsideForm = true,
|
|
118
|
-
onChange,
|
|
119
|
-
onChangeValue,
|
|
120
|
-
}: {
|
|
121
|
-
name: string;
|
|
122
|
-
label: string;
|
|
123
|
-
value?: string;
|
|
124
|
-
defaultValue?: string;
|
|
125
|
-
processValue: (value: string) => unknown;
|
|
126
|
-
helperText?: string;
|
|
127
|
-
optional?: boolean;
|
|
128
|
-
error?: boolean;
|
|
129
|
-
disabled?: boolean;
|
|
130
|
-
onBlur?: React.FocusEventHandler;
|
|
131
|
-
validate?: (value: any, rawValue: string) => string | undefined;
|
|
132
|
-
validateOnBlurInsideForm?: boolean;
|
|
133
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
134
|
-
onChangeValue?: (value: any, rawValue: string) => void;
|
|
135
|
-
}): {
|
|
136
|
-
value?: string;
|
|
137
|
-
defaultValue?: string;
|
|
138
|
-
name: string;
|
|
139
|
-
label: string;
|
|
140
|
-
helperText?: string;
|
|
141
|
-
required: boolean;
|
|
142
|
-
error: boolean;
|
|
143
|
-
disabled: boolean;
|
|
144
|
-
onBlur: React.FocusEventHandler | undefined;
|
|
145
|
-
inputRef: (field: HTMLInputElement | null) => void;
|
|
146
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
147
|
-
} => {
|
|
148
|
-
const {texts, t} = useTheme();
|
|
149
|
-
const {setRawValue, setValue, rawValues, values, formErrors, formStatus, setFormError, register} =
|
|
150
|
-
useForm();
|
|
151
|
-
const rawValue = value ?? defaultValue ?? rawValues[name] ?? '';
|
|
152
|
-
const processValueRef = React.useRef(processValue);
|
|
153
|
-
|
|
154
|
-
React.useEffect(() => {
|
|
155
|
-
setRawValue({name, value: rawValue});
|
|
156
|
-
setValue({name, value: processValueRef.current(rawValue)});
|
|
157
|
-
}, [name, rawValue, setRawValue, setValue]);
|
|
158
|
-
|
|
159
|
-
React.useEffect(() => {
|
|
160
|
-
if (disabled) {
|
|
161
|
-
setFormError({name, error: undefined});
|
|
162
|
-
}
|
|
163
|
-
}, [disabled, name, setFormError]);
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
value,
|
|
167
|
-
defaultValue: defaultValue ?? (value === undefined ? rawValues[name] ?? '' : undefined),
|
|
168
|
-
name,
|
|
169
|
-
label,
|
|
170
|
-
helperText: formErrors[name] || helperText,
|
|
171
|
-
required: !optional,
|
|
172
|
-
error: error || !!formErrors[name],
|
|
173
|
-
disabled: disabled || formStatus === 'sending',
|
|
174
|
-
onBlur: validateOnBlurInsideForm
|
|
175
|
-
? (e: React.FocusEvent) => {
|
|
176
|
-
let error: string | undefined;
|
|
177
|
-
if (!rawValues[name] && !optional) {
|
|
178
|
-
error = texts.formFieldErrorIsMandatory || t(tokens.formFieldErrorIsMandatory);
|
|
179
|
-
} else if (validate) {
|
|
180
|
-
error = validate(values[name], rawValues[name]);
|
|
181
|
-
}
|
|
182
|
-
setFormError({name, error});
|
|
183
|
-
onBlur?.(e);
|
|
184
|
-
}
|
|
185
|
-
: onBlur,
|
|
186
|
-
inputRef: (input: HTMLInputElement | null) =>
|
|
187
|
-
register(name, {input, validator: validate, label, required: !optional}),
|
|
188
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
189
|
-
const rawValue = event.currentTarget.value;
|
|
190
|
-
const value = processValue(rawValue);
|
|
191
|
-
setRawValue({name, value: rawValue});
|
|
192
|
-
setValue({name, value});
|
|
193
|
-
setFormError({name, error: ''});
|
|
194
|
-
onChange?.(event);
|
|
195
|
-
onChangeValue?.(value, rawValue);
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
};
|