@telefonica/mistica 16.59.0-beta.1 → 16.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/mistica.css +1 -1
- package/dist/accordion.css-mistica.js +16 -16
- package/dist/align.css-mistica.js +2 -2
- package/dist/autocomplete.css-mistica.js +6 -6
- package/dist/avatar.css-mistica.js +3 -3
- package/dist/badge.css-mistica.js +7 -7
- package/dist/box.css-mistica.js +15 -15
- package/dist/boxed.css-mistica.js +31 -31
- package/dist/button-group.css-mistica.js +10 -10
- package/dist/button-layout.css-mistica.js +21 -21
- package/dist/button.css-mistica.js +51 -51
- package/dist/callout.css-mistica.js +16 -16
- package/dist/card-internal.css-mistica.js +38 -38
- package/dist/carousel.css-mistica.js +18 -18
- package/dist/checkbox.css-mistica.js +21 -21
- package/dist/chip.css-mistica.js +30 -30
- package/dist/circle.css-mistica.js +2 -2
- package/dist/community/advanced-data-card.css-mistica.js +26 -26
- package/dist/community/blocks.css-mistica.js +3 -3
- package/dist/community/example-component.css-mistica.js +2 -2
- package/dist/counter.css-mistica.js +12 -12
- package/dist/cover-hero.css-mistica.js +16 -16
- package/dist/credit-card-number-field.css-mistica.js +6 -6
- package/dist/date-field.css-mistica.js +1 -1
- package/dist/date-time-picker.css-mistica.js +2 -2
- package/dist/dialog.css-mistica.js +15 -15
- package/dist/divider.css-mistica.js +5 -5
- package/dist/double-field.css-mistica.js +4 -4
- package/dist/drawer.css-mistica.js +15 -15
- package/dist/empty-state-card.css-mistica.js +4 -4
- package/dist/empty-state.css-mistica.js +14 -14
- package/dist/fade-in.css-mistica.js +1 -1
- package/dist/feedback.css-mistica.js +14 -14
- package/dist/file-upload.css-mistica.js +14 -14
- package/dist/fixed-footer-layout.css-mistica.js +12 -12
- package/dist/form.css-mistica.js +2 -2
- package/dist/grid-layout.css-mistica.js +9 -9
- package/dist/grid.css-mistica.js +147 -147
- package/dist/header.css-mistica.js +5 -5
- package/dist/hero.css-mistica.js +11 -11
- package/dist/horizontal-scroll.css-mistica.js +3 -3
- package/dist/icon-button.css-mistica.js +66 -66
- package/dist/icons/icon-chevron.css-mistica.js +6 -6
- package/dist/icons/icon-error.css-mistica.js +3 -3
- package/dist/image.css-mistica.js +11 -11
- package/dist/inline.css-mistica.js +16 -16
- package/dist/list.css-mistica.js +15 -15
- package/dist/loading-bar.css-mistica.js +5 -5
- package/dist/loading-screen.css-mistica.js +15 -15
- package/dist/logo.css-mistica.js +9 -9
- package/dist/menu.css-mistica.js +24 -24
- package/dist/mosaic.css-mistica.js +3 -3
- package/dist/navigation-bar.css-mistica.js +45 -45
- package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
- package/dist/package-version.js +2 -2
- package/dist/pin-field.css-mistica.js +10 -10
- package/dist/popover.css-mistica.js +2 -2
- package/dist/progress-bar.css-mistica.js +12 -12
- package/dist/radio-button.css-mistica.js +33 -33
- package/dist/rating.css-mistica.js +12 -12
- package/dist/responsive-layout.css-mistica.js +20 -20
- package/dist/screen-reader-only.css-mistica.js +2 -2
- package/dist/select.css-mistica.js +29 -29
- package/dist/sheet-action-row.css-mistica.js +2 -2
- package/dist/sheet-common.css-mistica.js +16 -16
- package/dist/sheet-info.css-mistica.js +4 -4
- package/dist/skeletons.css-mistica.js +12 -12
- package/dist/skins/skin-contract.css-mistica.js +686 -686
- package/dist/skip-link.css-mistica.js +3 -3
- package/dist/slider.css-mistica.js +28 -28
- package/dist/snackbar.css-mistica.js +16 -16
- package/dist/spinner.css-mistica.js +5 -5
- package/dist/square.css-mistica.js +2 -2
- package/dist/stack.css-mistica.js +9 -9
- package/dist/stacking-group.css-mistica.js +2 -2
- package/dist/stepper.css-mistica.js +16 -16
- package/dist/switch-component.css-mistica.js +53 -53
- package/dist/table.css-mistica.js +24 -24
- package/dist/tabs.css-mistica.js +30 -30
- package/dist/tag.css-mistica.js +5 -5
- package/dist/text-field-base.css-mistica.js +30 -30
- package/dist/text-field-components.css-mistica.js +23 -20
- package/dist/text-field-components.css.d.ts +1 -0
- package/dist/text-field-components.js +31 -25
- package/dist/text-link.css-mistica.js +10 -10
- package/dist/text.css-mistica.js +13 -13
- package/dist/theme-context.css-mistica.js +2 -2
- package/dist/timeline.css-mistica.js +18 -18
- package/dist/timer.css-mistica.js +13 -13
- package/dist/tooltip.css-mistica.js +12 -12
- package/dist/touchable.css-mistica.js +5 -5
- package/dist/utils/aspect-ratio-support.css-mistica.js +7 -7
- package/dist/video.css-mistica.js +2 -2
- package/dist/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +3 -3
- package/dist-es/accordion.css-mistica.js +7 -7
- package/dist-es/align.css-mistica.js +2 -2
- package/dist-es/autocomplete.css-mistica.js +2 -2
- package/dist-es/avatar.css-mistica.js +2 -2
- package/dist-es/badge.css-mistica.js +2 -2
- package/dist-es/box.css-mistica.js +15 -15
- package/dist-es/boxed.css-mistica.js +25 -25
- package/dist-es/button-group.css-mistica.js +2 -2
- package/dist-es/button-layout.css-mistica.js +16 -16
- package/dist-es/button.css-mistica.js +38 -38
- package/dist-es/callout.css-mistica.js +12 -12
- package/dist-es/card-internal.css-mistica.js +20 -20
- package/dist-es/carousel.css-mistica.js +10 -10
- package/dist-es/checkbox.css-mistica.js +14 -14
- package/dist-es/chip.css-mistica.js +17 -17
- package/dist-es/circle.css-mistica.js +2 -2
- package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
- package/dist-es/community/blocks.css-mistica.js +2 -2
- package/dist-es/community/example-component.css-mistica.js +2 -2
- package/dist-es/counter.css-mistica.js +2 -2
- package/dist-es/cover-hero.css-mistica.js +4 -4
- package/dist-es/credit-card-number-field.css-mistica.js +4 -4
- package/dist-es/date-field.css-mistica.js +1 -1
- package/dist-es/date-time-picker.css-mistica.js +2 -2
- package/dist-es/dialog.css-mistica.js +5 -5
- package/dist-es/divider.css-mistica.js +5 -5
- package/dist-es/double-field.css-mistica.js +4 -4
- package/dist-es/drawer.css-mistica.js +2 -2
- package/dist-es/empty-state-card.css-mistica.js +2 -2
- package/dist-es/empty-state.css-mistica.js +7 -7
- package/dist-es/fade-in.css-mistica.js +1 -1
- package/dist-es/feedback.css-mistica.js +2 -2
- package/dist-es/file-upload.css-mistica.js +8 -8
- package/dist-es/fixed-footer-layout.css-mistica.js +4 -4
- package/dist-es/form.css-mistica.js +2 -2
- package/dist-es/grid-layout.css-mistica.js +4 -4
- package/dist-es/grid.css-mistica.js +127 -127
- package/dist-es/header.css-mistica.js +2 -2
- package/dist-es/hero.css-mistica.js +4 -4
- package/dist-es/horizontal-scroll.css-mistica.js +2 -2
- package/dist-es/icon-button.css-mistica.js +56 -56
- package/dist-es/icons/icon-chevron.css-mistica.js +4 -4
- package/dist-es/icons/icon-error.css-mistica.js +2 -2
- package/dist-es/image.css-mistica.js +4 -4
- package/dist-es/inline.css-mistica.js +10 -10
- package/dist-es/list.css-mistica.js +2 -2
- package/dist-es/loading-bar.css-mistica.js +2 -2
- package/dist-es/loading-screen.css-mistica.js +5 -5
- package/dist-es/logo.css-mistica.js +7 -7
- package/dist-es/menu.css-mistica.js +15 -15
- package/dist-es/mosaic.css-mistica.js +2 -2
- package/dist-es/navigation-bar.css-mistica.js +20 -20
- package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
- package/dist-es/package-version.js +2 -2
- package/dist-es/pin-field.css-mistica.js +2 -2
- package/dist-es/popover.css-mistica.js +2 -2
- package/dist-es/progress-bar.css-mistica.js +8 -8
- package/dist-es/radio-button.css-mistica.js +25 -25
- package/dist-es/rating.css-mistica.js +4 -4
- package/dist-es/responsive-layout.css-mistica.js +7 -7
- package/dist-es/screen-reader-only.css-mistica.js +2 -2
- package/dist-es/select.css-mistica.js +20 -20
- package/dist-es/sheet-action-row.css-mistica.js +2 -2
- package/dist-es/sheet-common.css-mistica.js +2 -2
- package/dist-es/sheet-info.css-mistica.js +2 -2
- package/dist-es/skeletons.css-mistica.js +8 -8
- package/dist-es/skins/skin-contract.css-mistica.js +686 -686
- package/dist-es/skip-link.css-mistica.js +2 -2
- package/dist-es/slider.css-mistica.js +20 -20
- package/dist-es/snackbar.css-mistica.js +5 -5
- package/dist-es/spinner.css-mistica.js +2 -2
- package/dist-es/square.css-mistica.js +2 -2
- package/dist-es/stack.css-mistica.js +7 -7
- package/dist-es/stacking-group.css-mistica.js +2 -2
- package/dist-es/stepper.css-mistica.js +4 -4
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.css-mistica.js +41 -41
- package/dist-es/table.css-mistica.js +11 -11
- package/dist-es/tabs.css-mistica.js +21 -21
- package/dist-es/tag.css-mistica.js +2 -2
- package/dist-es/text-field-base.css-mistica.js +17 -17
- package/dist-es/text-field-components.css-mistica.js +4 -4
- package/dist-es/text-field-components.js +52 -46
- package/dist-es/text-link.css-mistica.js +9 -9
- package/dist-es/text.css-mistica.js +8 -8
- package/dist-es/theme-context.css-mistica.js +2 -2
- package/dist-es/timeline.css-mistica.js +11 -11
- package/dist-es/timer.css-mistica.js +7 -7
- package/dist-es/tooltip.css-mistica.js +3 -3
- package/dist-es/touchable.css-mistica.js +2 -2
- package/dist-es/utils/aspect-ratio-support.css-mistica.js +4 -4
- package/dist-es/video.css-mistica.js +2 -2
- package/dist-es/vivinho-loading-animation/vivinho-loading-animation.css-mistica.js +2 -2
- package/doc/llms.md +0 -24
- package/package.json +2 -14
- package/src/accordion.css.ts +0 -121
- package/src/accordion.tsx +0 -366
- package/src/align.css.ts +0 -7
- package/src/align.tsx +0 -32
- package/src/autocomplete.css.ts +0 -62
- package/src/autocomplete.tsx +0 -239
- package/src/avatar.css.ts +0 -14
- package/src/avatar.tsx +0 -120
- package/src/badge.css.ts +0 -51
- package/src/badge.tsx +0 -79
- package/src/box.css.ts +0 -51
- package/src/box.tsx +0 -114
- package/src/boxed.css.ts +0 -132
- package/src/boxed.tsx +0 -153
- package/src/button-fixed-footer-layout.tsx +0 -62
- package/src/button-group.css.ts +0 -75
- package/src/button-group.tsx +0 -91
- package/src/button-layout.css.ts +0 -162
- package/src/button-layout.tsx +0 -91
- package/src/button.css.ts +0 -758
- package/src/button.tsx +0 -632
- package/src/callout.css.ts +0 -50
- package/src/callout.tsx +0 -147
- package/src/card-cover.tsx +0 -242
- package/src/card-data.tsx +0 -152
- package/src/card-internal.css.ts +0 -271
- package/src/card-internal.tsx +0 -1724
- package/src/card-media.tsx +0 -157
- package/src/card-naked.tsx +0 -63
- package/src/carousel.css.ts +0 -522
- package/src/carousel.tsx +0 -1300
- package/src/checkbox.css.ts +0 -94
- package/src/checkbox.tsx +0 -192
- package/src/chip.css.ts +0 -204
- package/src/chip.tsx +0 -191
- package/src/circle.css.ts +0 -14
- package/src/circle.tsx +0 -52
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +0 -84
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +0 -72
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +0 -66
- package/src/community/__stories__/advanced-data-card-story.tsx +0 -158
- package/src/community/__stories__/blocks-story.tsx +0 -272
- package/src/community/__stories__/example-component-story.tsx +0 -15
- package/src/community/__stories__/index-story.tsx +0 -154
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +0 -40
- package/src/community/advanced-data-card.css.ts +0 -271
- package/src/community/advanced-data-card.tsx +0 -431
- package/src/community/blocks.css.ts +0 -12
- package/src/community/blocks.tsx +0 -290
- package/src/community/example-component.css.ts +0 -7
- package/src/community/example-component.tsx +0 -17
- package/src/community/index.tsx +0 -10
- package/src/counter.css.ts +0 -150
- package/src/counter.tsx +0 -215
- package/src/cover-hero-media.tsx +0 -39
- package/src/cover-hero.css.ts +0 -133
- package/src/cover-hero.tsx +0 -262
- package/src/credit-card-expiration-field.tsx +0 -187
- package/src/credit-card-fields.tsx +0 -56
- package/src/credit-card-number-field.css.ts +0 -47
- package/src/credit-card-number-field.tsx +0 -245
- package/src/cvv-field.tsx +0 -169
- package/src/date-field.css.ts +0 -14
- package/src/date-field.tsx +0 -130
- package/src/date-time-field.tsx +0 -141
- package/src/date-time-picker.css.ts +0 -126
- package/src/date-time-picker.tsx +0 -188
- package/src/decimal-field.tsx +0 -160
- package/src/desktop-container-type-context.tsx +0 -15
- package/src/dialog-context.tsx +0 -81
- package/src/dialog.css.ts +0 -155
- package/src/dialog.tsx +0 -423
- package/src/divider.css.ts +0 -10
- package/src/divider.tsx +0 -11
- package/src/double-field.css.ts +0 -33
- package/src/double-field.tsx +0 -71
- package/src/drawer.css.ts +0 -123
- package/src/drawer.tsx +0 -304
- package/src/email-field.tsx +0 -76
- package/src/empty-state-card.css.ts +0 -40
- package/src/empty-state-card.tsx +0 -92
- package/src/empty-state.css.ts +0 -119
- package/src/empty-state.tsx +0 -141
- package/src/fade-in.css.ts +0 -12
- package/src/fade-in.tsx +0 -40
- package/src/feedback.css.ts +0 -119
- package/src/feedback.tsx +0 -432
- package/src/file-upload.css.ts +0 -156
- package/src/file-upload.tsx +0 -612
- package/src/fixed-footer-layout.css.ts +0 -96
- package/src/fixed-footer-layout.tsx +0 -215
- package/src/fixed-to-top.tsx +0 -21
- package/src/focus-trap.tsx +0 -17
- package/src/form-context.tsx +0 -198
- package/src/form.css.ts +0 -5
- package/src/form.tsx +0 -287
- package/src/grid-layout.css.ts +0 -68
- package/src/grid-layout.tsx +0 -201
- package/src/grid.css.ts +0 -203
- package/src/grid.tsx +0 -241
- package/src/header.css.ts +0 -30
- package/src/header.tsx +0 -319
- package/src/hero.css.ts +0 -71
- package/src/hero.tsx +0 -318
- package/src/hooks.tsx +0 -313
- package/src/horizontal-scroll.css.ts +0 -43
- package/src/horizontal-scroll.tsx +0 -18
- package/src/iban-field.tsx +0 -218
- package/src/icon-button.css.ts +0 -561
- package/src/icon-button.tsx +0 -221
- package/src/icons/__stories__/mistica-icons-story.tsx +0 -192
- package/src/icons/icon-amex.tsx +0 -40
- package/src/icons/icon-chevron.css.ts +0 -23
- package/src/icons/icon-chevron.tsx +0 -150
- package/src/icons/icon-cvv-amex.tsx +0 -31
- package/src/icons/icon-cvv-visa-mc.tsx +0 -31
- package/src/icons/icon-error.css.ts +0 -27
- package/src/icons/icon-error.tsx +0 -207
- package/src/icons/icon-info.tsx +0 -86
- package/src/icons/icon-mastercard.tsx +0 -36
- package/src/icons/icon-success-vivo-new.tsx +0 -51
- package/src/icons/icon-success-vivo.tsx +0 -36
- package/src/icons/icon-success.tsx +0 -211
- package/src/icons/icon-visa.tsx +0 -32
- package/src/image.css.ts +0 -48
- package/src/image.tsx +0 -345
- package/src/index.tsx +0 -2466
- package/src/inline.css.ts +0 -131
- package/src/inline.tsx +0 -135
- package/src/integer-field.tsx +0 -93
- package/src/list.css.ts +0 -281
- package/src/list.tsx +0 -963
- package/src/loading-bar.css.ts +0 -69
- package/src/loading-bar.tsx +0 -25
- package/src/loading-screen.css.ts +0 -114
- package/src/loading-screen.tsx +0 -376
- package/src/logo-blau-shell.tsx +0 -30
- package/src/logo-blau.tsx +0 -60
- package/src/logo-common.tsx +0 -29
- package/src/logo-esimflag-shell.tsx +0 -30
- package/src/logo-esimflag.tsx +0 -56
- package/src/logo-movistar-new-shell.tsx +0 -30
- package/src/logo-movistar-new.tsx +0 -85
- package/src/logo-movistar-shell.tsx +0 -30
- package/src/logo-movistar.tsx +0 -63
- package/src/logo-o2-new-shell.tsx +0 -26
- package/src/logo-o2-new.tsx +0 -27
- package/src/logo-o2-shell.tsx +0 -26
- package/src/logo-o2.tsx +0 -27
- package/src/logo-telefonica-shell.tsx +0 -30
- package/src/logo-telefonica.tsx +0 -95
- package/src/logo-tu-shell.tsx +0 -26
- package/src/logo-tu.tsx +0 -28
- package/src/logo-vivo-shell.tsx +0 -30
- package/src/logo-vivo.tsx +0 -53
- package/src/logo.css.ts +0 -33
- package/src/logo.tsx +0 -313
- package/src/master-detail-layout.tsx +0 -28
- package/src/maybe-dismissable.css.ts +0 -37
- package/src/maybe-dismissable.tsx +0 -58
- package/src/media-queries.css.ts +0 -67
- package/src/menu.css.ts +0 -132
- package/src/menu.tsx +0 -468
- package/src/meter.tsx +0 -516
- package/src/modal-context-provider.tsx +0 -45
- package/src/month-field.tsx +0 -124
- package/src/mosaic.css.ts +0 -73
- package/src/mosaic.tsx +0 -205
- package/src/navigation-bar.css.ts +0 -558
- package/src/navigation-bar.tsx +0 -1637
- package/src/navigation-breadcrumbs.css.ts +0 -22
- package/src/navigation-breadcrumbs.tsx +0 -69
- package/src/negative-box.tsx +0 -15
- package/src/nestable-context.tsx +0 -139
- package/src/overlay.tsx +0 -86
- package/src/overscroll-color-context.tsx +0 -141
- package/src/package-version.tsx +0 -2
- package/src/password-field.tsx +0 -126
- package/src/phone-number-field-lite.tsx +0 -265
- package/src/phone-number-field.tsx +0 -171
- package/src/pin-field.css.ts +0 -90
- package/src/pin-field.tsx +0 -346
- package/src/placeholder.tsx +0 -41
- package/src/popover.css.ts +0 -8
- package/src/popover.tsx +0 -85
- package/src/portal.tsx +0 -43
- package/src/progress-bar.css.ts +0 -61
- package/src/progress-bar.tsx +0 -174
- package/src/radio-button.css.ts +0 -174
- package/src/radio-button.tsx +0 -322
- package/src/rating.css.ts +0 -128
- package/src/rating.tsx +0 -351
- package/src/responsive-layout.css.ts +0 -162
- package/src/responsive-layout.tsx +0 -106
- package/src/screen-reader-only.css.ts +0 -27
- package/src/screen-reader-only.tsx +0 -33
- package/src/screen-size-context-provider.tsx +0 -96
- package/src/screen-size-context.tsx +0 -23
- package/src/search-field.tsx +0 -126
- package/src/select.css.ts +0 -226
- package/src/select.tsx +0 -513
- package/src/sheet-action-row.css.ts +0 -33
- package/src/sheet-actions-list.tsx +0 -113
- package/src/sheet-actions.tsx +0 -95
- package/src/sheet-common.css.ts +0 -254
- package/src/sheet-common.tsx +0 -402
- package/src/sheet-info.css.ts +0 -19
- package/src/sheet-info.tsx +0 -127
- package/src/sheet-native.tsx +0 -189
- package/src/sheet-radio-list.tsx +0 -118
- package/src/sheet-root.tsx +0 -127
- package/src/sheet-types.tsx +0 -94
- package/src/sheet-web.tsx +0 -140
- package/src/skeleton-base.tsx +0 -38
- package/src/skeletons.css.ts +0 -56
- package/src/skeletons.tsx +0 -133
- package/src/skins/blau.tsx +0 -724
- package/src/skins/constants.tsx +0 -10
- package/src/skins/defaults.tsx +0 -104
- package/src/skins/esimflag.tsx +0 -728
- package/src/skins/movistar-new.tsx +0 -735
- package/src/skins/movistar.tsx +0 -740
- package/src/skins/o2-new.tsx +0 -731
- package/src/skins/o2.tsx +0 -727
- package/src/skins/skin-contract.css.ts +0 -380
- package/src/skins/telefonica.tsx +0 -768
- package/src/skins/tu.tsx +0 -741
- package/src/skins/types/colors.tsx +0 -286
- package/src/skins/types/index.tsx +0 -153
- package/src/skins/utils.tsx +0 -66
- package/src/skins/vivo-new.tsx +0 -745
- package/src/skins/vivo.tsx +0 -720
- package/src/skip-link.css.ts +0 -34
- package/src/skip-link.tsx +0 -52
- package/src/slider.css.ts +0 -181
- package/src/slider.tsx +0 -384
- package/src/snackbar-context.tsx +0 -98
- package/src/snackbar-native.ts +0 -37
- package/src/snackbar.css.ts +0 -176
- package/src/snackbar.tsx +0 -258
- package/src/spinner.css.ts +0 -66
- package/src/spinner.tsx +0 -136
- package/src/sprinkles.css.ts +0 -83
- package/src/square.css.ts +0 -15
- package/src/square.tsx +0 -55
- package/src/stack.css.ts +0 -44
- package/src/stack.tsx +0 -79
- package/src/stacking-group.css.ts +0 -15
- package/src/stacking-group.tsx +0 -82
- package/src/stepper.css.ts +0 -233
- package/src/stepper.tsx +0 -156
- package/src/switch-component.css.ts +0 -181
- package/src/switch-component.tsx +0 -187
- package/src/tab-focus.tsx +0 -68
- package/src/table-actions-header.tsx +0 -21
- package/src/table-cell-text.tsx +0 -35
- package/src/table.css.ts +0 -297
- package/src/table.tsx +0 -398
- package/src/tabs.css.ts +0 -212
- package/src/tabs.tsx +0 -263
- package/src/tag.css.ts +0 -42
- package/src/tag.tsx +0 -161
- package/src/test-utils/environment/setup-ssr.tsx +0 -10
- package/src/test-utils/fail-test-on-console-error.tsx +0 -22
- package/src/test-utils/index.tsx +0 -341
- package/src/test-utils/setup-ssr-test-env.tsx +0 -13
- package/src/test-utils/ssr.tsx +0 -197
- package/src/text-field-base.css.ts +0 -416
- package/src/text-field-base.tsx +0 -628
- package/src/text-field-components.css.ts +0 -159
- package/src/text-field-components.tsx +0 -225
- package/src/text-field.tsx +0 -118
- package/src/text-link.css.ts +0 -83
- package/src/text-link.tsx +0 -85
- package/src/text-tokens.tsx +0 -708
- package/src/text.css.ts +0 -60
- package/src/text.tsx +0 -516
- package/src/theme-context-provider.tsx +0 -370
- package/src/theme-context.css.ts +0 -3
- package/src/theme-context.tsx +0 -8
- package/src/theme-variant-context.tsx +0 -51
- package/src/theme.tsx +0 -184
- package/src/time-field.tsx +0 -99
- package/src/timeline.css.ts +0 -135
- package/src/timeline.tsx +0 -250
- package/src/timer.css.ts +0 -99
- package/src/timer.tsx +0 -420
- package/src/title.tsx +0 -119
- package/src/tooltip-context-provider.tsx +0 -57
- package/src/tooltip.css.ts +0 -106
- package/src/tooltip.tsx +0 -649
- package/src/touchable.css.ts +0 -56
- package/src/touchable.tsx +0 -355
- package/src/types/font-face.d.ts +0 -47
- package/src/types/libs.d.ts +0 -3
- package/src/utils/__tests__/analytics-test.tsx +0 -35
- package/src/utils/__tests__/browser-test.tsx +0 -28
- package/src/utils/__tests__/dom-test.tsx +0 -23
- package/src/utils/__tests__/helpers-test.tsx +0 -166
- package/src/utils/analytics.tsx +0 -28
- package/src/utils/animation.tsx +0 -201
- package/src/utils/aspect-ratio-support.css.ts +0 -28
- package/src/utils/aspect-ratio-support.tsx +0 -141
- package/src/utils/browser.tsx +0 -9
- package/src/utils/color.tsx +0 -46
- package/src/utils/common.tsx +0 -27
- package/src/utils/credit-card.tsx +0 -46
- package/src/utils/css.tsx +0 -25
- package/src/utils/document-visibility.tsx +0 -52
- package/src/utils/dom.tsx +0 -155
- package/src/utils/environment.tsx +0 -6
- package/src/utils/headings.tsx +0 -18
- package/src/utils/helpers.tsx +0 -182
- package/src/utils/keys.tsx +0 -8
- package/src/utils/locale.tsx +0 -27
- package/src/utils/platform.tsx +0 -94
- package/src/utils/region-code.tsx +0 -1
- package/src/utils/renders-element.tsx +0 -6
- package/src/utils/time.tsx +0 -22
- package/src/utils/types.tsx +0 -19
- package/src/utils/utility-types.tsx +0 -8
- package/src/video.css.ts +0 -11
- package/src/video.tsx +0 -355
- package/src/vivinho-loading-animation/in-lottie.json +0 -402
- package/src/vivinho-loading-animation/index.tsx +0 -90
- package/src/vivinho-loading-animation/out-lottie.json +0 -575
- package/src/vivinho-loading-animation/pulse-lottie.json +0 -551
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +0 -15
- package/src/vivinho-loading-animation/wave-lottie.json +0 -2829
package/src/meter.tsx
DELETED
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
// https://www.figma.com/design/jWWCJ9kYl6I5uHLz3GcgRp/%F0%9F%94%B6-%5BREADY%5D-Data-Visualizations-Specs
|
|
2
|
-
'use client';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import {vars} from './skins/skin-contract.css';
|
|
5
|
-
// @ts-expect-error - no types
|
|
6
|
-
import bezier from 'cubic-bezier';
|
|
7
|
-
import {getPrefixedDataAttributes} from './utils/dom';
|
|
8
|
-
import {useThemeVariant} from './theme-variant-context';
|
|
9
|
-
import {useElementDimensions, useTheme} from './hooks';
|
|
10
|
-
import {meterTotalLabel, meterSectionLabel} from './text-tokens';
|
|
11
|
-
import {isRunningAcceptanceTest} from './utils/platform';
|
|
12
|
-
|
|
13
|
-
import type {DataAttributes} from './utils/types';
|
|
14
|
-
|
|
15
|
-
const VIEW_BOX_WIDTH = 100;
|
|
16
|
-
const CENTER_X = VIEW_BOX_WIDTH / 2;
|
|
17
|
-
const CENTER_Y = VIEW_BOX_WIDTH / 2;
|
|
18
|
-
|
|
19
|
-
const STROKE_WIDTH_PX = 6;
|
|
20
|
-
const SEPARATION_PX = 2;
|
|
21
|
-
|
|
22
|
-
const ANIMATION_DELAY_MS = 200;
|
|
23
|
-
const ANIMATION_DURATION_MS = 1000;
|
|
24
|
-
const ANIMATION_EPSILON = 1000 / 60 / ANIMATION_DURATION_MS / 4;
|
|
25
|
-
|
|
26
|
-
const MAX_SEGMENT_VALUE = 100;
|
|
27
|
-
const SMALL_VALUE_THRESHOLD = 0.0001;
|
|
28
|
-
|
|
29
|
-
const TYPE_LINEAR = 'linear';
|
|
30
|
-
const TYPE_ANGULAR = 'angular';
|
|
31
|
-
const TYPE_CIRCULAR = 'circular';
|
|
32
|
-
|
|
33
|
-
export type MeterType = typeof TYPE_LINEAR | typeof TYPE_ANGULAR | typeof TYPE_CIRCULAR;
|
|
34
|
-
|
|
35
|
-
const DEFAULT_COLORS = [
|
|
36
|
-
vars.colors.controlActivated,
|
|
37
|
-
vars.colors.warning,
|
|
38
|
-
vars.colors.success,
|
|
39
|
-
vars.colors.highlight,
|
|
40
|
-
vars.colors.promo,
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
const DEFAULT_COLORS_OVER_BRAND = [
|
|
44
|
-
vars.colors.controlActivatedBrand,
|
|
45
|
-
vars.colors.warning,
|
|
46
|
-
vars.colors.success,
|
|
47
|
-
vars.colors.highlight,
|
|
48
|
-
vars.colors.promo,
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* "start"/"end" values for each segment of the meter. The values are in the range [0, 1]
|
|
53
|
-
*/
|
|
54
|
-
type Segment = {
|
|
55
|
-
start: number;
|
|
56
|
-
end: number;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Cubic bezier easing function https://github.com/arian/cubic-bezier/blob/27d2512d15a0b873fa0fca8769069c7b290e80f8/index.js
|
|
61
|
-
* @param time - time in the range [0, 1]
|
|
62
|
-
*/
|
|
63
|
-
const timingFunction: (time: number) => number = bezier(0.75, 0, 0.27, 1, ANIMATION_EPSILON);
|
|
64
|
-
|
|
65
|
-
const clamp = (n: number, min: number, max: number) => Math.min(Math.max(n, min), max);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Calculate the start and end segment values for each segment of the meter
|
|
69
|
-
*/
|
|
70
|
-
const calculateSegments = (
|
|
71
|
-
currentValues: Array<number>,
|
|
72
|
-
targetValues: Array<number>,
|
|
73
|
-
time: number,
|
|
74
|
-
reverse: boolean
|
|
75
|
-
): Array<Segment> => {
|
|
76
|
-
const segments: Array<Segment> = [];
|
|
77
|
-
|
|
78
|
-
let startValue = 0;
|
|
79
|
-
let endValue = 0;
|
|
80
|
-
for (let i = 0; i < currentValues.length; i++) {
|
|
81
|
-
startValue += currentValues[i];
|
|
82
|
-
endValue += targetValues[i];
|
|
83
|
-
|
|
84
|
-
// each segment has an accumulated delay time. The last segment has no delay
|
|
85
|
-
const delay = ANIMATION_DELAY_MS * (reverse ? i : currentValues.length - 1 - i);
|
|
86
|
-
const animationTime = clamp((time - delay) / ANIMATION_DURATION_MS, 0, 1);
|
|
87
|
-
|
|
88
|
-
const t = clamp(timingFunction(animationTime), 0, 1);
|
|
89
|
-
const start = segments.at(-1)?.end || 0;
|
|
90
|
-
const end = clamp(startValue + (endValue - startValue) * t, 0, 1 - SMALL_VALUE_THRESHOLD);
|
|
91
|
-
segments.push({start, end});
|
|
92
|
-
}
|
|
93
|
-
return segments;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const createPath = ({
|
|
97
|
-
x1,
|
|
98
|
-
y1,
|
|
99
|
-
x2,
|
|
100
|
-
y2,
|
|
101
|
-
radius,
|
|
102
|
-
clockwise = 1,
|
|
103
|
-
largeArchFlag = 0,
|
|
104
|
-
}: {
|
|
105
|
-
x1: number;
|
|
106
|
-
y1: number;
|
|
107
|
-
x2: number;
|
|
108
|
-
y2: number;
|
|
109
|
-
radius: number;
|
|
110
|
-
clockwise?: 0 | 1 | boolean;
|
|
111
|
-
largeArchFlag?: 0 | 1 | boolean;
|
|
112
|
-
}): string => {
|
|
113
|
-
const xAxisRotation = 0;
|
|
114
|
-
if (radius) {
|
|
115
|
-
// https://www.nan.fyi/svg-paths/arcs
|
|
116
|
-
return `M ${x1} ${y1} A ${radius} ${radius} ${xAxisRotation} ${+largeArchFlag} ${+clockwise} ${x2} ${y2}`;
|
|
117
|
-
} else {
|
|
118
|
-
// https://www.nan.fyi/svg-paths/lines
|
|
119
|
-
return `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
type MeterProps = {
|
|
124
|
-
type?: MeterType;
|
|
125
|
-
/** Position of the meter. 0 is at the start, 100 is at the end. The sum of the values must not exceed 100. */
|
|
126
|
-
values: Array<number>;
|
|
127
|
-
width?: number | string;
|
|
128
|
-
colors?: Array<string>;
|
|
129
|
-
reverse?: boolean;
|
|
130
|
-
dataAttributes?: DataAttributes;
|
|
131
|
-
extra?: React.ReactNode;
|
|
132
|
-
'aria-hidden'?: boolean | 'true' | 'false';
|
|
133
|
-
'aria-label'?: string;
|
|
134
|
-
'aria-labelledby'?: string;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const MeterComponent = ({
|
|
138
|
-
type = TYPE_ANGULAR,
|
|
139
|
-
width: widthProp = '100%',
|
|
140
|
-
colors,
|
|
141
|
-
values: valuesProp,
|
|
142
|
-
reverse = false,
|
|
143
|
-
dataAttributes,
|
|
144
|
-
'aria-hidden': ariaHidden = false,
|
|
145
|
-
'aria-label': ariaLabel,
|
|
146
|
-
'aria-labelledby': ariaLabelledBy,
|
|
147
|
-
extra,
|
|
148
|
-
}: MeterProps): JSX.Element => {
|
|
149
|
-
const {borderRadii, t} = useTheme();
|
|
150
|
-
const {ref: containerRef, width: containerWidth} = useElementDimensions();
|
|
151
|
-
const hasRoundLineCaps = parseInt(borderRadii.bar) !== 0;
|
|
152
|
-
const themeVariant = useThemeVariant();
|
|
153
|
-
const isOverMedia = themeVariant === 'media';
|
|
154
|
-
const isOverBrand = themeVariant === 'brand';
|
|
155
|
-
const isOverNegative = themeVariant === 'negative';
|
|
156
|
-
const segmentColors =
|
|
157
|
-
colors || (isOverBrand || isOverMedia || isOverNegative ? DEFAULT_COLORS_OVER_BRAND : DEFAULT_COLORS);
|
|
158
|
-
const [width, setWidth] = React.useState<number>(typeof widthProp === 'number' ? widthProp : 0);
|
|
159
|
-
const scaleFactor = width === 0 ? 1 : VIEW_BOX_WIDTH / width;
|
|
160
|
-
const lineCapRadiusPx = hasRoundLineCaps ? STROKE_WIDTH_PX / 2 : 0;
|
|
161
|
-
const lineCapRadius = lineCapRadiusPx * scaleFactor;
|
|
162
|
-
const strokeWidth = STROKE_WIDTH_PX * scaleFactor;
|
|
163
|
-
const radius = type === TYPE_LINEAR ? 0 : CENTER_X - strokeWidth / 2;
|
|
164
|
-
const separation = SEPARATION_PX * scaleFactor;
|
|
165
|
-
|
|
166
|
-
const id = React.useId();
|
|
167
|
-
const markerCurrentId = `marker-current-${id}`;
|
|
168
|
-
const markerStartId = `marker-start-${id}`;
|
|
169
|
-
const maskLastSegmentId = `mask-last-segment-${id}`;
|
|
170
|
-
const maskBarTrackId = `mask-bar-track-${id}`;
|
|
171
|
-
|
|
172
|
-
const shouldAnimate = React.useMemo(() => {
|
|
173
|
-
return (
|
|
174
|
-
window.matchMedia(`(prefers-reduced-motion: reduce)`).matches !== true &&
|
|
175
|
-
!isRunningAcceptanceTest()
|
|
176
|
-
);
|
|
177
|
-
}, []);
|
|
178
|
-
|
|
179
|
-
const maxValue =
|
|
180
|
-
type === TYPE_LINEAR
|
|
181
|
-
? VIEW_BOX_WIDTH - lineCapRadius * 2
|
|
182
|
-
: type === TYPE_CIRCULAR
|
|
183
|
-
? Math.PI * 2
|
|
184
|
-
: Math.PI;
|
|
185
|
-
|
|
186
|
-
const segmentSeparation =
|
|
187
|
-
type === TYPE_LINEAR ? separation / VIEW_BOX_WIDTH : separation / radius / maxValue;
|
|
188
|
-
|
|
189
|
-
const height =
|
|
190
|
-
type === TYPE_LINEAR ? STROKE_WIDTH_PX : type === TYPE_CIRCULAR ? width : width / 2 + lineCapRadiusPx;
|
|
191
|
-
|
|
192
|
-
const viewBoxHeight =
|
|
193
|
-
type === TYPE_LINEAR
|
|
194
|
-
? strokeWidth
|
|
195
|
-
: type === TYPE_CIRCULAR
|
|
196
|
-
? VIEW_BOX_WIDTH
|
|
197
|
-
: CENTER_X + lineCapRadius;
|
|
198
|
-
|
|
199
|
-
const trackbarColor = isOverMedia
|
|
200
|
-
? vars.colors.inverse
|
|
201
|
-
: isOverBrand
|
|
202
|
-
? vars.colors.barTrackBrand
|
|
203
|
-
: vars.colors.barTrack;
|
|
204
|
-
|
|
205
|
-
// scale values to the range [0, 1]
|
|
206
|
-
const values = React.useMemo(() => {
|
|
207
|
-
return valuesProp.map((v) => v / MAX_SEGMENT_VALUE);
|
|
208
|
-
}, [valuesProp]);
|
|
209
|
-
|
|
210
|
-
// the animation starts with these values
|
|
211
|
-
const initialValuesRef = React.useRef<Array<number>>(
|
|
212
|
-
Array.from({length: values.length}, () => (reverse ? 1 : 0))
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
const [segments, setSegments] = React.useState<Array<Segment>>(() => {
|
|
216
|
-
return values.map(() => ({start: 0, end: 0}));
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// this is to know which are the first and last visible segments, which have special treatments
|
|
220
|
-
let firstNonZeroIndex = -1;
|
|
221
|
-
let lastNonZeroIndex = -1;
|
|
222
|
-
for (let i = 0; i < segments.length; i++) {
|
|
223
|
-
if (segments[i].end - segments[i].start > SMALL_VALUE_THRESHOLD) {
|
|
224
|
-
if (firstNonZeroIndex < 0) {
|
|
225
|
-
firstNonZeroIndex = i;
|
|
226
|
-
}
|
|
227
|
-
lastNonZeroIndex = i;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const lastSegment: Segment | undefined = segments.at(-1);
|
|
232
|
-
|
|
233
|
-
React.useEffect(() => {
|
|
234
|
-
if (typeof widthProp === 'number') {
|
|
235
|
-
setWidth(widthProp);
|
|
236
|
-
} else {
|
|
237
|
-
setWidth(containerWidth);
|
|
238
|
-
}
|
|
239
|
-
}, [widthProp, containerWidth]);
|
|
240
|
-
|
|
241
|
-
React.useEffect(() => {
|
|
242
|
-
let raf: number;
|
|
243
|
-
const start = performance.now();
|
|
244
|
-
const end = start + ANIMATION_DURATION_MS + ANIMATION_DELAY_MS * (values.length - 1);
|
|
245
|
-
let currentSegments: Array<Segment> = [];
|
|
246
|
-
const animate = () => {
|
|
247
|
-
const now = performance.now();
|
|
248
|
-
currentSegments = calculateSegments(initialValuesRef.current, values, now - start, reverse);
|
|
249
|
-
if (shouldAnimate && now < end) {
|
|
250
|
-
raf = requestAnimationFrame(animate); // request next frame
|
|
251
|
-
} else {
|
|
252
|
-
currentSegments = calculateSegments(initialValuesRef.current, values, end - start, reverse); // set the final values
|
|
253
|
-
initialValuesRef.current = values;
|
|
254
|
-
}
|
|
255
|
-
setSegments(currentSegments);
|
|
256
|
-
};
|
|
257
|
-
animate();
|
|
258
|
-
return () => {
|
|
259
|
-
cancelAnimationFrame(raf);
|
|
260
|
-
// animation was cancelled, snapshot current values
|
|
261
|
-
initialValuesRef.current = currentSegments.map((s) => s.end - s.start);
|
|
262
|
-
};
|
|
263
|
-
}, [radius, values, type, reverse, shouldAnimate]);
|
|
264
|
-
|
|
265
|
-
const getX = React.useCallback(
|
|
266
|
-
(value: number) =>
|
|
267
|
-
type === TYPE_LINEAR
|
|
268
|
-
? lineCapRadius + maxValue * value
|
|
269
|
-
: CENTER_X - radius * Math.cos(value * maxValue),
|
|
270
|
-
[lineCapRadius, maxValue, radius, type]
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
const getY = React.useCallback(
|
|
274
|
-
(value: number) =>
|
|
275
|
-
type === TYPE_LINEAR ? strokeWidth / 2 : CENTER_Y - radius * Math.sin(value * maxValue),
|
|
276
|
-
[maxValue, radius, strokeWidth, type]
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
const getColor = (index: number) => segmentColors[index % segmentColors.length];
|
|
280
|
-
|
|
281
|
-
const totalPercent = Math.round((lastSegment?.end || 0) * 100);
|
|
282
|
-
|
|
283
|
-
const valueText =
|
|
284
|
-
t(meterTotalLabel, values.length, totalPercent) +
|
|
285
|
-
' ' +
|
|
286
|
-
values.map((v, i) => `${t(meterSectionLabel, i + 1, Math.round(v * 100))}`).join('. ');
|
|
287
|
-
|
|
288
|
-
const extraStyle = React.useMemo(() => {
|
|
289
|
-
if (type === TYPE_LINEAR) {
|
|
290
|
-
return {display: 'flex'};
|
|
291
|
-
}
|
|
292
|
-
const COS_45 = 0.707107;
|
|
293
|
-
const sizeFactor = (width / 2 - STROKE_WIDTH_PX) * COS_45;
|
|
294
|
-
return {
|
|
295
|
-
display: 'flex',
|
|
296
|
-
marginTop:
|
|
297
|
-
-1 * (type === TYPE_ANGULAR ? sizeFactor + STROKE_WIDTH_PX / 2 : sizeFactor + width / 2),
|
|
298
|
-
width: sizeFactor * 2,
|
|
299
|
-
minHeight: type === TYPE_ANGULAR ? sizeFactor + STROKE_WIDTH_PX / 2 : sizeFactor * 2,
|
|
300
|
-
marginLeft: 'auto',
|
|
301
|
-
marginRight: 'auto',
|
|
302
|
-
};
|
|
303
|
-
}, [width, type]);
|
|
304
|
-
|
|
305
|
-
return (
|
|
306
|
-
<div
|
|
307
|
-
ref={containerRef}
|
|
308
|
-
style={{width: widthProp, minHeight: height}}
|
|
309
|
-
role="meter"
|
|
310
|
-
aria-label={ariaLabel || (ariaLabelledBy ? undefined : valueText)}
|
|
311
|
-
aria-labelledby={ariaLabelledBy}
|
|
312
|
-
aria-valuenow={totalPercent}
|
|
313
|
-
aria-valuemin={0}
|
|
314
|
-
aria-valuemax={100}
|
|
315
|
-
aria-live="polite"
|
|
316
|
-
aria-valuetext={valueText}
|
|
317
|
-
aria-hidden={ariaHidden}
|
|
318
|
-
{...getPrefixedDataAttributes(dataAttributes, 'Meter')}
|
|
319
|
-
>
|
|
320
|
-
<svg
|
|
321
|
-
viewBox={`0 0 ${VIEW_BOX_WIDTH} ${viewBoxHeight}`}
|
|
322
|
-
style={{
|
|
323
|
-
width,
|
|
324
|
-
height,
|
|
325
|
-
display: 'block',
|
|
326
|
-
transform: `rotate(${type === TYPE_CIRCULAR ? '90deg' : 0})`,
|
|
327
|
-
}}
|
|
328
|
-
// always hidden
|
|
329
|
-
aria-hidden="true"
|
|
330
|
-
>
|
|
331
|
-
<defs>
|
|
332
|
-
{hasRoundLineCaps && (
|
|
333
|
-
<>
|
|
334
|
-
<marker
|
|
335
|
-
id={markerCurrentId}
|
|
336
|
-
viewBox="0 0 10 10"
|
|
337
|
-
markerWidth={1}
|
|
338
|
-
markerHeight={1}
|
|
339
|
-
orient="auto"
|
|
340
|
-
refX={5}
|
|
341
|
-
refY={5}
|
|
342
|
-
>
|
|
343
|
-
<rect x={4} y={0} width={2} height={10} fill={getColor(lastNonZeroIndex)} />
|
|
344
|
-
<path
|
|
345
|
-
d={createPath({x1: 5, y1: 0, x2: 5, y2: 10, radius: 5})}
|
|
346
|
-
fill={getColor(lastNonZeroIndex)}
|
|
347
|
-
/>
|
|
348
|
-
</marker>
|
|
349
|
-
<marker
|
|
350
|
-
id={markerStartId}
|
|
351
|
-
viewBox="0 0 10 10"
|
|
352
|
-
markerWidth={1}
|
|
353
|
-
markerHeight={1}
|
|
354
|
-
orient="auto"
|
|
355
|
-
refX={5}
|
|
356
|
-
refY={5}
|
|
357
|
-
>
|
|
358
|
-
<rect x={4} y={0} width={2} height={10} fill={getColor(firstNonZeroIndex)} />
|
|
359
|
-
<path
|
|
360
|
-
d={createPath({x1: 5, y1: 0, x2: 5, y2: 10, radius: 5, clockwise: 0})}
|
|
361
|
-
fill={getColor(firstNonZeroIndex)}
|
|
362
|
-
/>
|
|
363
|
-
</marker>
|
|
364
|
-
</>
|
|
365
|
-
)}
|
|
366
|
-
<mask id={maskBarTrackId} maskUnits="userSpaceOnUse">
|
|
367
|
-
<rect x={0} y={0} width={VIEW_BOX_WIDTH} height={viewBoxHeight} fill="white" />
|
|
368
|
-
{firstNonZeroIndex >= 0 && lastSegment && (
|
|
369
|
-
<>
|
|
370
|
-
<path
|
|
371
|
-
// this path is used to mask the trackbar
|
|
372
|
-
stroke="black"
|
|
373
|
-
fill="none"
|
|
374
|
-
strokeWidth={strokeWidth + separation * 2}
|
|
375
|
-
strokeLinecap={
|
|
376
|
-
type === TYPE_CIRCULAR || !hasRoundLineCaps ? 'butt' : 'round'
|
|
377
|
-
}
|
|
378
|
-
d={createPath({
|
|
379
|
-
x1: getX(0),
|
|
380
|
-
y1: getY(0),
|
|
381
|
-
x2: getX(
|
|
382
|
-
clamp(
|
|
383
|
-
lastSegment.end + (hasRoundLineCaps ? 0 : segmentSeparation),
|
|
384
|
-
0,
|
|
385
|
-
1 - SMALL_VALUE_THRESHOLD
|
|
386
|
-
)
|
|
387
|
-
),
|
|
388
|
-
y2: getY(
|
|
389
|
-
clamp(
|
|
390
|
-
lastSegment.end + (hasRoundLineCaps ? 0 : segmentSeparation),
|
|
391
|
-
0,
|
|
392
|
-
1 - SMALL_VALUE_THRESHOLD
|
|
393
|
-
)
|
|
394
|
-
),
|
|
395
|
-
radius,
|
|
396
|
-
largeArchFlag: type === TYPE_CIRCULAR ? lastSegment.end >= 0.5 : 0,
|
|
397
|
-
})}
|
|
398
|
-
/>
|
|
399
|
-
{type === TYPE_CIRCULAR && hasRoundLineCaps && (
|
|
400
|
-
// the circular type has butt line caps, so we need to add a circle to the end
|
|
401
|
-
<circle
|
|
402
|
-
cx={getX(lastSegment.end)}
|
|
403
|
-
cy={getY(lastSegment.end)}
|
|
404
|
-
r={strokeWidth / 2 + separation}
|
|
405
|
-
fill="black"
|
|
406
|
-
/>
|
|
407
|
-
)}
|
|
408
|
-
{type === TYPE_CIRCULAR && lastSegment.end <= 0.5 && (
|
|
409
|
-
// small patch to remove the circular mask when the last segment is too near to the start
|
|
410
|
-
<rect
|
|
411
|
-
x={0}
|
|
412
|
-
y={CENTER_Y + separation}
|
|
413
|
-
width={strokeWidth + separation * 2}
|
|
414
|
-
height={strokeWidth / 2 + separation}
|
|
415
|
-
fill="white"
|
|
416
|
-
/>
|
|
417
|
-
)}
|
|
418
|
-
</>
|
|
419
|
-
)}
|
|
420
|
-
</mask>
|
|
421
|
-
{type === TYPE_CIRCULAR && (
|
|
422
|
-
<mask id={maskLastSegmentId} maskUnits="userSpaceOnUse">
|
|
423
|
-
<rect x={0} y={0} width={VIEW_BOX_WIDTH} height={viewBoxHeight} fill="white" />
|
|
424
|
-
<path
|
|
425
|
-
stroke="black"
|
|
426
|
-
strokeWidth={strokeWidth}
|
|
427
|
-
fill="none"
|
|
428
|
-
d={createPath({
|
|
429
|
-
x1: getX(1 - segmentSeparation),
|
|
430
|
-
y1: getY(1 - segmentSeparation),
|
|
431
|
-
x2: getX(1),
|
|
432
|
-
y2: getY(1),
|
|
433
|
-
radius,
|
|
434
|
-
})}
|
|
435
|
-
/>
|
|
436
|
-
</mask>
|
|
437
|
-
)}
|
|
438
|
-
</defs>
|
|
439
|
-
|
|
440
|
-
<path
|
|
441
|
-
stroke={trackbarColor}
|
|
442
|
-
opacity={isOverMedia ? 0.5 : 1}
|
|
443
|
-
fill="none"
|
|
444
|
-
strokeWidth={strokeWidth}
|
|
445
|
-
strokeLinecap={type === TYPE_CIRCULAR || !hasRoundLineCaps ? 'butt' : 'round'}
|
|
446
|
-
d={createPath({
|
|
447
|
-
x1: getX(0),
|
|
448
|
-
y1: getY(0),
|
|
449
|
-
x2: getX(1 - (type === TYPE_CIRCULAR ? segmentSeparation : 0)),
|
|
450
|
-
y2: getY(1 - (type === TYPE_CIRCULAR ? segmentSeparation : 0)),
|
|
451
|
-
largeArchFlag: 1,
|
|
452
|
-
radius,
|
|
453
|
-
})}
|
|
454
|
-
mask={`url("#${maskBarTrackId}")`}
|
|
455
|
-
/>
|
|
456
|
-
|
|
457
|
-
{firstNonZeroIndex >= 0 &&
|
|
458
|
-
[...segments].reverse().map((segment, reversedIndex) => {
|
|
459
|
-
// note that the list is reversed, so the first segment is drawn last
|
|
460
|
-
const index = segments.length - 1 - reversedIndex;
|
|
461
|
-
const color = getColor(index);
|
|
462
|
-
const isFirst = index === firstNonZeroIndex;
|
|
463
|
-
const isLast = index === lastNonZeroIndex;
|
|
464
|
-
const start =
|
|
465
|
-
isFirst || segment.end - segment.start < segmentSeparation
|
|
466
|
-
? segment.start
|
|
467
|
-
: segment.start + segmentSeparation / 2;
|
|
468
|
-
const end =
|
|
469
|
-
isLast || segment.end - segment.start < segmentSeparation
|
|
470
|
-
? segment.end
|
|
471
|
-
: segment.end - segmentSeparation / 2;
|
|
472
|
-
|
|
473
|
-
if (end - start < SMALL_VALUE_THRESHOLD) {
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
const shouldIncludeStartMarker = isFirst && type !== TYPE_CIRCULAR;
|
|
478
|
-
return (
|
|
479
|
-
<path
|
|
480
|
-
key={reversedIndex}
|
|
481
|
-
stroke={color}
|
|
482
|
-
fill="none"
|
|
483
|
-
strokeWidth={strokeWidth}
|
|
484
|
-
strokeLinecap="butt"
|
|
485
|
-
markerEnd={isLast ? `url(#${markerCurrentId})` : undefined}
|
|
486
|
-
markerStart={shouldIncludeStartMarker ? `url(#${markerStartId})` : undefined}
|
|
487
|
-
mask={
|
|
488
|
-
isLast && type === TYPE_CIRCULAR
|
|
489
|
-
? `url("#${maskLastSegmentId}")`
|
|
490
|
-
: undefined
|
|
491
|
-
}
|
|
492
|
-
d={createPath({
|
|
493
|
-
x1: getX(start),
|
|
494
|
-
y1: getY(start),
|
|
495
|
-
x2: getX(end),
|
|
496
|
-
y2: getY(end),
|
|
497
|
-
largeArchFlag: type === TYPE_CIRCULAR ? end - start >= 0.5 : 0,
|
|
498
|
-
radius,
|
|
499
|
-
})}
|
|
500
|
-
/>
|
|
501
|
-
);
|
|
502
|
-
})}
|
|
503
|
-
</svg>
|
|
504
|
-
{extra && <div style={extraStyle}>{extra}</div>}
|
|
505
|
-
</div>
|
|
506
|
-
);
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* This wrapper is to force a remount when some specific props change
|
|
511
|
-
*/
|
|
512
|
-
const Meter = (props: MeterProps): JSX.Element => {
|
|
513
|
-
return <MeterComponent {...props} key={`${props.type},${props.values.length},${props.reverse}`} />;
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
export default Meter;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
type ModalState = {
|
|
5
|
-
isModalOpen: boolean;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const ModalStateContext = React.createContext<ModalState>({isModalOpen: false});
|
|
9
|
-
const ModalStateSetterContext = React.createContext<(newState: Partial<ModalState>) => void>(() => {});
|
|
10
|
-
|
|
11
|
-
const ModalContextProvider = ({children}: {children: React.ReactNode}): JSX.Element => {
|
|
12
|
-
const [modalState, setModalState] = React.useState<ModalState>({isModalOpen: false});
|
|
13
|
-
|
|
14
|
-
const updateModalState = React.useCallback((newState: Partial<ModalState>) => {
|
|
15
|
-
setModalState((prevState) => ({
|
|
16
|
-
...prevState,
|
|
17
|
-
...newState,
|
|
18
|
-
}));
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<ModalStateContext.Provider value={modalState}>
|
|
23
|
-
<ModalStateSetterContext.Provider value={updateModalState}>
|
|
24
|
-
{children}
|
|
25
|
-
</ModalStateSetterContext.Provider>
|
|
26
|
-
</ModalStateContext.Provider>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const useSetModalState = (): ((newModalState: Partial<ModalState>) => void) =>
|
|
31
|
-
React.useContext(ModalStateSetterContext);
|
|
32
|
-
|
|
33
|
-
export const useSetModalStateEffect = (): void => {
|
|
34
|
-
const setModalState = useSetModalState();
|
|
35
|
-
React.useEffect(() => {
|
|
36
|
-
setModalState({isModalOpen: true});
|
|
37
|
-
return () => {
|
|
38
|
-
setModalState({isModalOpen: false});
|
|
39
|
-
};
|
|
40
|
-
}, [setModalState]);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const useModalState = (): ModalState => React.useContext(ModalStateContext);
|
|
44
|
-
|
|
45
|
-
export default ModalContextProvider;
|
package/src/month-field.tsx
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {useFieldProps} from './form-context';
|
|
4
|
-
import {TextFieldBaseAutosuggest} from './text-field-base';
|
|
5
|
-
import {isInputTypeSupported} from './utils/dom';
|
|
6
|
-
import {isServerSide} from './utils/environment';
|
|
7
|
-
import IconCalendarRegular from './generated/mistica-icons/icon-calendar-regular';
|
|
8
|
-
import {getLocalYearMonthString} from './utils/time';
|
|
9
|
-
import {useTheme} from './hooks';
|
|
10
|
-
import * as dateStyles from './date-field.css';
|
|
11
|
-
import {iconSize} from './icon-button.css';
|
|
12
|
-
import * as tokens from './text-tokens';
|
|
13
|
-
|
|
14
|
-
import type {CommonFormFieldProps} from './text-field-base';
|
|
15
|
-
|
|
16
|
-
export interface DateFieldProps extends CommonFormFieldProps {
|
|
17
|
-
onChangeValue?: (value: string, rawValue: string) => void;
|
|
18
|
-
min?: Date;
|
|
19
|
-
max?: Date;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const ReactDateTimePicker = React.lazy(
|
|
23
|
-
() => import(/* webpackChunkName: "date-time-picker" */ './date-time-picker')
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const DateField = ({
|
|
27
|
-
disabled,
|
|
28
|
-
error,
|
|
29
|
-
helperText,
|
|
30
|
-
name,
|
|
31
|
-
label,
|
|
32
|
-
optional,
|
|
33
|
-
validate: validateProp,
|
|
34
|
-
validateOnBlurInsideForm,
|
|
35
|
-
onChange,
|
|
36
|
-
onChangeValue: onChangeValueProp,
|
|
37
|
-
onBlur,
|
|
38
|
-
value,
|
|
39
|
-
defaultValue,
|
|
40
|
-
min,
|
|
41
|
-
max,
|
|
42
|
-
dataAttributes,
|
|
43
|
-
...rest
|
|
44
|
-
}: DateFieldProps): JSX.Element => {
|
|
45
|
-
const processValue = (value: string) => value;
|
|
46
|
-
const hasNativePicker = React.useMemo(() => isInputTypeSupported('month'), []);
|
|
47
|
-
const {texts, t} = useTheme();
|
|
48
|
-
|
|
49
|
-
const isInRange = (value: string): boolean => {
|
|
50
|
-
if (min && value && value < getLocalYearMonthString(min)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (max && value && value > getLocalYearMonthString(max)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const validate = (value: string, rawValue: string) => {
|
|
60
|
-
if (!isInRange(value)) {
|
|
61
|
-
return texts.formDateOutOfRangeError || t(tokens.formDateOutOfRangeError);
|
|
62
|
-
}
|
|
63
|
-
return validateProp?.(value, rawValue);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const onChangeValue = (value: string, rawValue: string) => {
|
|
67
|
-
if (isInRange(value)) {
|
|
68
|
-
onChangeValueProp?.(value, rawValue);
|
|
69
|
-
}
|
|
70
|
-
// if not in range, onChangeValue is not called
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const fieldProps = useFieldProps({
|
|
74
|
-
name,
|
|
75
|
-
label,
|
|
76
|
-
value,
|
|
77
|
-
defaultValue,
|
|
78
|
-
processValue,
|
|
79
|
-
helperText,
|
|
80
|
-
optional,
|
|
81
|
-
error,
|
|
82
|
-
disabled,
|
|
83
|
-
onBlur,
|
|
84
|
-
validate,
|
|
85
|
-
validateOnBlurInsideForm,
|
|
86
|
-
onChange,
|
|
87
|
-
onChangeValue,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const nativePicker = (
|
|
91
|
-
<TextFieldBaseAutosuggest
|
|
92
|
-
{...rest}
|
|
93
|
-
{...fieldProps}
|
|
94
|
-
min={min ? getLocalYearMonthString(min) : undefined}
|
|
95
|
-
max={max ? getLocalYearMonthString(max) : undefined}
|
|
96
|
-
type="month"
|
|
97
|
-
endIconOverlay={
|
|
98
|
-
<div className={dateStyles.iconContainer} data-testid="endIcon">
|
|
99
|
-
<IconCalendarRegular size={iconSize.small} />
|
|
100
|
-
</div>
|
|
101
|
-
}
|
|
102
|
-
dataAttributes={{'component-name': 'MonthField', testid: 'MonthField', ...dataAttributes}}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
if (hasNativePicker || isServerSide()) {
|
|
107
|
-
return nativePicker;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<React.Suspense fallback={nativePicker}>
|
|
112
|
-
<ReactDateTimePicker
|
|
113
|
-
{...rest}
|
|
114
|
-
{...fieldProps}
|
|
115
|
-
optional={optional}
|
|
116
|
-
isValidDate={(currentDate) => isInRange(getLocalYearMonthString(currentDate.toDate()))}
|
|
117
|
-
mode="year-month"
|
|
118
|
-
dataAttributes={{'component-name': 'MonthField', testid: 'MonthField', ...dataAttributes}}
|
|
119
|
-
/>
|
|
120
|
-
</React.Suspense>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default DateField;
|