@telefonica/mistica 16.58.0 → 16.59.0-beta.1
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 +20 -20
- 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-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 +60 -1
- package/doc/patterns.md +22 -20
- package/package.json +13 -1
- package/src/accordion.css.ts +121 -0
- package/src/accordion.tsx +366 -0
- package/src/align.css.ts +7 -0
- package/src/align.tsx +32 -0
- package/src/autocomplete.css.ts +62 -0
- package/src/autocomplete.tsx +239 -0
- package/src/avatar.css.ts +14 -0
- package/src/avatar.tsx +120 -0
- package/src/badge.css.ts +51 -0
- package/src/badge.tsx +79 -0
- package/src/box.css.ts +51 -0
- package/src/box.tsx +114 -0
- package/src/boxed.css.ts +132 -0
- package/src/boxed.tsx +153 -0
- package/src/button-fixed-footer-layout.tsx +62 -0
- package/src/button-group.css.ts +75 -0
- package/src/button-group.tsx +91 -0
- package/src/button-layout.css.ts +162 -0
- package/src/button-layout.tsx +91 -0
- package/src/button.css.ts +758 -0
- package/src/button.tsx +632 -0
- package/src/callout.css.ts +50 -0
- package/src/callout.tsx +147 -0
- package/src/card-cover.tsx +242 -0
- package/src/card-data.tsx +152 -0
- package/src/card-internal.css.ts +271 -0
- package/src/card-internal.tsx +1724 -0
- package/src/card-media.tsx +157 -0
- package/src/card-naked.tsx +63 -0
- package/src/carousel.css.ts +522 -0
- package/src/carousel.tsx +1300 -0
- package/src/checkbox.css.ts +94 -0
- package/src/checkbox.tsx +192 -0
- package/src/chip.css.ts +204 -0
- package/src/chip.tsx +191 -0
- package/src/circle.css.ts +14 -0
- package/src/circle.tsx +52 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-and-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-button-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-link-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-false-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-actions-none-footer-image-true-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-0-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-1-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-extras-3-no-divider-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-inside-carousel-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/advanced-data-card-screenshot-test-tsx-advanced-data-card-without-stacking-group-with-top-actions-and-too-long-title-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-highlighted-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-information-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-progress-block-2-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-row-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-simple-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/__image_snapshots__/blocks-screenshot-test-tsx-blocks-value-block-1-snap.png +0 -0
- package/src/community/__screenshot_tests__/advanced-data-card-screenshot-test.tsx +84 -0
- package/src/community/__screenshot_tests__/blocks-screenshot-test.tsx +72 -0
- package/src/community/__stories__/advanced-data-card-carousel-story.tsx +66 -0
- package/src/community/__stories__/advanced-data-card-story.tsx +158 -0
- package/src/community/__stories__/blocks-story.tsx +272 -0
- package/src/community/__stories__/example-component-story.tsx +15 -0
- package/src/community/__stories__/index-story.tsx +154 -0
- package/src/community/__type_tests__/advanced-data-card-type-test.tsx +40 -0
- package/src/community/advanced-data-card.css.ts +271 -0
- package/src/community/advanced-data-card.tsx +431 -0
- package/src/community/blocks.css.ts +12 -0
- package/src/community/blocks.tsx +290 -0
- package/src/community/example-component.css.ts +7 -0
- package/src/community/example-component.tsx +17 -0
- package/src/community/index.tsx +10 -0
- package/src/counter.css.ts +150 -0
- package/src/counter.tsx +215 -0
- package/src/cover-hero-media.tsx +39 -0
- package/src/cover-hero.css.ts +133 -0
- package/src/cover-hero.tsx +262 -0
- package/src/credit-card-expiration-field.tsx +187 -0
- package/src/credit-card-fields.tsx +56 -0
- package/src/credit-card-number-field.css.ts +47 -0
- package/src/credit-card-number-field.tsx +245 -0
- package/src/cvv-field.tsx +169 -0
- package/src/date-field.css.ts +14 -0
- package/src/date-field.tsx +130 -0
- package/src/date-time-field.tsx +141 -0
- package/src/date-time-picker.css.ts +126 -0
- package/src/date-time-picker.tsx +188 -0
- package/src/decimal-field.tsx +160 -0
- package/src/desktop-container-type-context.tsx +15 -0
- package/src/dialog-context.tsx +81 -0
- package/src/dialog.css.ts +155 -0
- package/src/dialog.tsx +423 -0
- package/src/divider.css.ts +10 -0
- package/src/divider.tsx +11 -0
- package/src/double-field.css.ts +33 -0
- package/src/double-field.tsx +71 -0
- package/src/drawer.css.ts +123 -0
- package/src/drawer.tsx +304 -0
- package/src/email-field.tsx +76 -0
- package/src/empty-state-card.css.ts +40 -0
- package/src/empty-state-card.tsx +92 -0
- package/src/empty-state.css.ts +119 -0
- package/src/empty-state.tsx +141 -0
- package/src/fade-in.css.ts +12 -0
- package/src/fade-in.tsx +40 -0
- package/src/feedback.css.ts +119 -0
- package/src/feedback.tsx +432 -0
- package/src/file-upload.css.ts +156 -0
- package/src/file-upload.tsx +612 -0
- package/src/fixed-footer-layout.css.ts +96 -0
- package/src/fixed-footer-layout.tsx +215 -0
- package/src/fixed-to-top.tsx +21 -0
- package/src/focus-trap.tsx +17 -0
- package/src/form-context.tsx +198 -0
- package/src/form.css.ts +5 -0
- package/src/form.tsx +287 -0
- package/src/grid-layout.css.ts +68 -0
- package/src/grid-layout.tsx +201 -0
- package/src/grid.css.ts +203 -0
- package/src/grid.tsx +241 -0
- package/src/header.css.ts +30 -0
- package/src/header.tsx +319 -0
- package/src/hero.css.ts +71 -0
- package/src/hero.tsx +318 -0
- package/src/hooks.tsx +313 -0
- package/src/horizontal-scroll.css.ts +43 -0
- package/src/horizontal-scroll.tsx +18 -0
- package/src/iban-field.tsx +218 -0
- package/src/icon-button.css.ts +561 -0
- package/src/icon-button.tsx +221 -0
- package/src/icons/__stories__/mistica-icons-story.tsx +192 -0
- package/src/icons/icon-amex.tsx +40 -0
- package/src/icons/icon-chevron.css.ts +23 -0
- package/src/icons/icon-chevron.tsx +150 -0
- package/src/icons/icon-cvv-amex.tsx +31 -0
- package/src/icons/icon-cvv-visa-mc.tsx +31 -0
- package/src/icons/icon-error.css.ts +27 -0
- package/src/icons/icon-error.tsx +207 -0
- package/src/icons/icon-info.tsx +86 -0
- package/src/icons/icon-mastercard.tsx +36 -0
- package/src/icons/icon-success-vivo-new.tsx +51 -0
- package/src/icons/icon-success-vivo.tsx +36 -0
- package/src/icons/icon-success.tsx +211 -0
- package/src/icons/icon-visa.tsx +32 -0
- package/src/image.css.ts +48 -0
- package/src/image.tsx +345 -0
- package/src/index.tsx +2466 -0
- package/src/inline.css.ts +131 -0
- package/src/inline.tsx +135 -0
- package/src/integer-field.tsx +93 -0
- package/src/list.css.ts +281 -0
- package/src/list.tsx +963 -0
- package/src/loading-bar.css.ts +69 -0
- package/src/loading-bar.tsx +25 -0
- package/src/loading-screen.css.ts +114 -0
- package/src/loading-screen.tsx +376 -0
- package/src/logo-blau-shell.tsx +30 -0
- package/src/logo-blau.tsx +60 -0
- package/src/logo-common.tsx +29 -0
- package/src/logo-esimflag-shell.tsx +30 -0
- package/src/logo-esimflag.tsx +56 -0
- package/src/logo-movistar-new-shell.tsx +30 -0
- package/src/logo-movistar-new.tsx +85 -0
- package/src/logo-movistar-shell.tsx +30 -0
- package/src/logo-movistar.tsx +63 -0
- package/src/logo-o2-new-shell.tsx +26 -0
- package/src/logo-o2-new.tsx +27 -0
- package/src/logo-o2-shell.tsx +26 -0
- package/src/logo-o2.tsx +27 -0
- package/src/logo-telefonica-shell.tsx +30 -0
- package/src/logo-telefonica.tsx +95 -0
- package/src/logo-tu-shell.tsx +26 -0
- package/src/logo-tu.tsx +28 -0
- package/src/logo-vivo-shell.tsx +30 -0
- package/src/logo-vivo.tsx +53 -0
- package/src/logo.css.ts +33 -0
- package/src/logo.tsx +313 -0
- package/src/master-detail-layout.tsx +28 -0
- package/src/maybe-dismissable.css.ts +37 -0
- package/src/maybe-dismissable.tsx +58 -0
- package/src/media-queries.css.ts +67 -0
- package/src/menu.css.ts +132 -0
- package/src/menu.tsx +468 -0
- package/src/meter.tsx +516 -0
- package/src/modal-context-provider.tsx +45 -0
- package/src/month-field.tsx +124 -0
- package/src/mosaic.css.ts +73 -0
- package/src/mosaic.tsx +205 -0
- package/src/navigation-bar.css.ts +558 -0
- package/src/navigation-bar.tsx +1637 -0
- package/src/navigation-breadcrumbs.css.ts +22 -0
- package/src/navigation-breadcrumbs.tsx +69 -0
- package/src/negative-box.tsx +15 -0
- package/src/nestable-context.tsx +139 -0
- package/src/overlay.tsx +86 -0
- package/src/overscroll-color-context.tsx +141 -0
- package/src/package-version.tsx +2 -0
- package/src/password-field.tsx +126 -0
- package/src/phone-number-field-lite.tsx +265 -0
- package/src/phone-number-field.tsx +171 -0
- package/src/pin-field.css.ts +90 -0
- package/src/pin-field.tsx +346 -0
- package/src/placeholder.tsx +41 -0
- package/src/popover.css.ts +8 -0
- package/src/popover.tsx +85 -0
- package/src/portal.tsx +43 -0
- package/src/progress-bar.css.ts +61 -0
- package/src/progress-bar.tsx +174 -0
- package/src/radio-button.css.ts +174 -0
- package/src/radio-button.tsx +322 -0
- package/src/rating.css.ts +128 -0
- package/src/rating.tsx +351 -0
- package/src/responsive-layout.css.ts +162 -0
- package/src/responsive-layout.tsx +106 -0
- package/src/screen-reader-only.css.ts +27 -0
- package/src/screen-reader-only.tsx +33 -0
- package/src/screen-size-context-provider.tsx +96 -0
- package/src/screen-size-context.tsx +23 -0
- package/src/search-field.tsx +126 -0
- package/src/select.css.ts +226 -0
- package/src/select.tsx +513 -0
- package/src/sheet-action-row.css.ts +33 -0
- package/src/sheet-actions-list.tsx +113 -0
- package/src/sheet-actions.tsx +95 -0
- package/src/sheet-common.css.ts +254 -0
- package/src/sheet-common.tsx +402 -0
- package/src/sheet-info.css.ts +19 -0
- package/src/sheet-info.tsx +127 -0
- package/src/sheet-native.tsx +189 -0
- package/src/sheet-radio-list.tsx +118 -0
- package/src/sheet-root.tsx +127 -0
- package/src/sheet-types.tsx +94 -0
- package/src/sheet-web.tsx +140 -0
- package/src/skeleton-base.tsx +38 -0
- package/src/skeletons.css.ts +56 -0
- package/src/skeletons.tsx +133 -0
- package/src/skins/blau.tsx +724 -0
- package/src/skins/constants.tsx +10 -0
- package/src/skins/defaults.tsx +104 -0
- package/src/skins/esimflag.tsx +728 -0
- package/src/skins/movistar-new.tsx +735 -0
- package/src/skins/movistar.tsx +740 -0
- package/src/skins/o2-new.tsx +731 -0
- package/src/skins/o2.tsx +727 -0
- package/src/skins/skin-contract.css.ts +380 -0
- package/src/skins/telefonica.tsx +768 -0
- package/src/skins/tu.tsx +741 -0
- package/src/skins/types/colors.tsx +286 -0
- package/src/skins/types/index.tsx +153 -0
- package/src/skins/utils.tsx +66 -0
- package/src/skins/vivo-new.tsx +745 -0
- package/src/skins/vivo.tsx +720 -0
- package/src/skip-link.css.ts +34 -0
- package/src/skip-link.tsx +52 -0
- package/src/slider.css.ts +181 -0
- package/src/slider.tsx +384 -0
- package/src/snackbar-context.tsx +98 -0
- package/src/snackbar-native.ts +37 -0
- package/src/snackbar.css.ts +176 -0
- package/src/snackbar.tsx +258 -0
- package/src/spinner.css.ts +66 -0
- package/src/spinner.tsx +136 -0
- package/src/sprinkles.css.ts +83 -0
- package/src/square.css.ts +15 -0
- package/src/square.tsx +55 -0
- package/src/stack.css.ts +44 -0
- package/src/stack.tsx +79 -0
- package/src/stacking-group.css.ts +15 -0
- package/src/stacking-group.tsx +82 -0
- package/src/stepper.css.ts +233 -0
- package/src/stepper.tsx +156 -0
- package/src/switch-component.css.ts +181 -0
- package/src/switch-component.tsx +187 -0
- package/src/tab-focus.tsx +68 -0
- package/src/table-actions-header.tsx +21 -0
- package/src/table-cell-text.tsx +35 -0
- package/src/table.css.ts +297 -0
- package/src/table.tsx +398 -0
- package/src/tabs.css.ts +212 -0
- package/src/tabs.tsx +263 -0
- package/src/tag.css.ts +42 -0
- package/src/tag.tsx +161 -0
- package/src/test-utils/environment/setup-ssr.tsx +10 -0
- package/src/test-utils/fail-test-on-console-error.tsx +22 -0
- package/src/test-utils/index.tsx +341 -0
- package/src/test-utils/setup-ssr-test-env.tsx +13 -0
- package/src/test-utils/ssr.tsx +197 -0
- package/src/text-field-base.css.ts +416 -0
- package/src/text-field-base.tsx +628 -0
- package/src/text-field-components.css.ts +159 -0
- package/src/text-field-components.tsx +225 -0
- package/src/text-field.tsx +118 -0
- package/src/text-link.css.ts +83 -0
- package/src/text-link.tsx +85 -0
- package/src/text-tokens.tsx +708 -0
- package/src/text.css.ts +60 -0
- package/src/text.tsx +516 -0
- package/src/theme-context-provider.tsx +370 -0
- package/src/theme-context.css.ts +3 -0
- package/src/theme-context.tsx +8 -0
- package/src/theme-variant-context.tsx +51 -0
- package/src/theme.tsx +184 -0
- package/src/time-field.tsx +99 -0
- package/src/timeline.css.ts +135 -0
- package/src/timeline.tsx +250 -0
- package/src/timer.css.ts +99 -0
- package/src/timer.tsx +420 -0
- package/src/title.tsx +119 -0
- package/src/tooltip-context-provider.tsx +57 -0
- package/src/tooltip.css.ts +106 -0
- package/src/tooltip.tsx +649 -0
- package/src/touchable.css.ts +56 -0
- package/src/touchable.tsx +355 -0
- package/src/types/font-face.d.ts +47 -0
- package/src/types/libs.d.ts +3 -0
- package/src/utils/__tests__/analytics-test.tsx +35 -0
- package/src/utils/__tests__/browser-test.tsx +28 -0
- package/src/utils/__tests__/dom-test.tsx +23 -0
- package/src/utils/__tests__/helpers-test.tsx +166 -0
- package/src/utils/analytics.tsx +28 -0
- package/src/utils/animation.tsx +201 -0
- package/src/utils/aspect-ratio-support.css.ts +28 -0
- package/src/utils/aspect-ratio-support.tsx +141 -0
- package/src/utils/browser.tsx +9 -0
- package/src/utils/color.tsx +46 -0
- package/src/utils/common.tsx +27 -0
- package/src/utils/credit-card.tsx +46 -0
- package/src/utils/css.tsx +25 -0
- package/src/utils/document-visibility.tsx +52 -0
- package/src/utils/dom.tsx +155 -0
- package/src/utils/environment.tsx +6 -0
- package/src/utils/headings.tsx +18 -0
- package/src/utils/helpers.tsx +182 -0
- package/src/utils/keys.tsx +8 -0
- package/src/utils/locale.tsx +27 -0
- package/src/utils/platform.tsx +94 -0
- package/src/utils/region-code.tsx +1 -0
- package/src/utils/renders-element.tsx +6 -0
- package/src/utils/time.tsx +22 -0
- package/src/utils/types.tsx +19 -0
- package/src/utils/utility-types.tsx +8 -0
- package/src/video.css.ts +11 -0
- package/src/video.tsx +355 -0
- package/src/vivinho-loading-animation/in-lottie.json +402 -0
- package/src/vivinho-loading-animation/index.tsx +90 -0
- package/src/vivinho-loading-animation/out-lottie.json +575 -0
- package/src/vivinho-loading-animation/pulse-lottie.json +551 -0
- package/src/vivinho-loading-animation/vivinho-loading-animation.css.ts +15 -0
- package/src/vivinho-loading-animation/wave-lottie.json +2829 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import Stack from './stack';
|
|
5
|
+
import {Text1, Text2, Text3} from './text';
|
|
6
|
+
import Inline from './inline';
|
|
7
|
+
import IconWarningRegular from './generated/mistica-icons/icon-warning-regular';
|
|
8
|
+
import {vars as skinVars} from './skins/skin-contract.css';
|
|
9
|
+
import Box from './box';
|
|
10
|
+
import {useInnerText, useTheme} from './hooks';
|
|
11
|
+
import * as textTokens from './text-tokens';
|
|
12
|
+
import Image from './image';
|
|
13
|
+
import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
|
|
14
|
+
import IconFilePdfRegular from './generated/mistica-icons/icon-file-pdf-regular';
|
|
15
|
+
import IconInvoicePlanFileRegular from './generated/mistica-icons/icon-invoice-plan-file-regular';
|
|
16
|
+
import IconFilePptRegular from './generated/mistica-icons/icon-file-ppt-regular';
|
|
17
|
+
import IconFileZipRegular from './generated/mistica-icons/icon-file-zip-regular';
|
|
18
|
+
import IconFileComressedRegular from './generated/mistica-icons/icon-file-compressed-regular';
|
|
19
|
+
import IconFileCssRegular from './generated/mistica-icons/icon-file-css-regular';
|
|
20
|
+
import IconFileHtmlRegular from './generated/mistica-icons/icon-file-html-regular';
|
|
21
|
+
import IconFileEnexRegular from './generated/mistica-icons/icon-file-enex-regular';
|
|
22
|
+
import IconFilePsdRegular from './generated/mistica-icons/icon-file-psd-regular';
|
|
23
|
+
import IconFileIllustratorRegular from './generated/mistica-icons/icon-file-illustrator-regular';
|
|
24
|
+
import IconFileMp4Regular from './generated/mistica-icons/icon-file-mp-4-regular';
|
|
25
|
+
import IconFileVideoRegular from './generated/mistica-icons/icon-video-regular';
|
|
26
|
+
import IconFileAviRegular from './generated/mistica-icons/icon-file-avi-regular';
|
|
27
|
+
import IconFileMp3Regular from './generated/mistica-icons/icon-file-mp-3-regular';
|
|
28
|
+
import IconFileMusicRegular from './generated/mistica-icons/icon-file-music-regular';
|
|
29
|
+
import IconClipRegular from './generated/mistica-icons/icon-clip-regular';
|
|
30
|
+
import * as styles from './file-upload.css';
|
|
31
|
+
import {useThemeVariant} from './theme-variant-context';
|
|
32
|
+
import {getPrefixedDataAttributes} from './utils/dom';
|
|
33
|
+
import {BoxedRow, BoxedRowList} from './list';
|
|
34
|
+
|
|
35
|
+
import type {DataAttributes, IconProps} from './utils/types';
|
|
36
|
+
import type {ExclusifyUnion} from './utils/utility-types';
|
|
37
|
+
|
|
38
|
+
const FileIcon = ({file}: {file: File}) => {
|
|
39
|
+
if (file.type.startsWith('image/')) {
|
|
40
|
+
return <Image src={URL.createObjectURL(file)} width={40} height={40} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const fileExtensionToIconComponent: {[key: string]: (props: IconProps) => JSX.Element} = {
|
|
44
|
+
pdf: IconFilePdfRegular,
|
|
45
|
+
doc: IconInvoicePlanFileRegular,
|
|
46
|
+
docx: IconInvoicePlanFileRegular,
|
|
47
|
+
txt: IconInvoicePlanFileRegular,
|
|
48
|
+
ppt: IconFilePptRegular,
|
|
49
|
+
pptx: IconFilePptRegular,
|
|
50
|
+
zip: IconFileZipRegular,
|
|
51
|
+
rar: IconFileComressedRegular,
|
|
52
|
+
css: IconFileCssRegular,
|
|
53
|
+
html: IconFileHtmlRegular,
|
|
54
|
+
enex: IconFileEnexRegular,
|
|
55
|
+
pds: IconFilePsdRegular,
|
|
56
|
+
ai: IconFileIllustratorRegular,
|
|
57
|
+
mp4: IconFileMp4Regular,
|
|
58
|
+
mov: IconFileVideoRegular,
|
|
59
|
+
avi: IconFileAviRegular,
|
|
60
|
+
mp3: IconFileMp3Regular,
|
|
61
|
+
wav: IconFileMusicRegular,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const extension = file.name.split('.').pop()?.toLowerCase() || '';
|
|
65
|
+
const IconComponent = fileExtensionToIconComponent[extension] || IconClipRegular;
|
|
66
|
+
|
|
67
|
+
return <IconComponent />;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const formatSize = (sizeInBytes: number, locale?: string): string => {
|
|
71
|
+
if (sizeInBytes < 1024) {
|
|
72
|
+
return `${sizeInBytes} B`;
|
|
73
|
+
} else if (sizeInBytes < 1024 * 1024) {
|
|
74
|
+
return `${Math.round(sizeInBytes / 1024).toLocaleString(locale)} KB`;
|
|
75
|
+
} else {
|
|
76
|
+
return `${(sizeInBytes / (1024 * 1024)).toLocaleString(locale, {minimumFractionDigits: 0, maximumFractionDigits: 2})} MB`;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const updateInputFiles = (input: HTMLInputElement | null, files: FileList | null) => {
|
|
81
|
+
if (!input) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (files && files.length > 0) {
|
|
85
|
+
input.files = files;
|
|
86
|
+
} else {
|
|
87
|
+
const dataTransfer = new DataTransfer();
|
|
88
|
+
input.value = '';
|
|
89
|
+
input.files = dataTransfer.files;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type UseFileUploadProps = {
|
|
94
|
+
id?: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
accept?: string;
|
|
97
|
+
capture?: boolean | 'user' | 'environment';
|
|
98
|
+
multiple?: boolean;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
errorText?: string;
|
|
101
|
+
/** When enabled, new files will be appended to the existing files instead of replacing them */
|
|
102
|
+
allowAppend?: boolean;
|
|
103
|
+
files?: FileList | null;
|
|
104
|
+
defaultFiles?: FileList | null;
|
|
105
|
+
onFilesChange?: (files: FileList | null) => void;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
type UseFileUploadReturn = {
|
|
109
|
+
id: string;
|
|
110
|
+
files: FileList | null;
|
|
111
|
+
setFiles: (files: FileList | null) => void;
|
|
112
|
+
inputProps: {
|
|
113
|
+
ref: React.RefObject<HTMLInputElement | null>;
|
|
114
|
+
type: 'file';
|
|
115
|
+
id: string;
|
|
116
|
+
name?: string;
|
|
117
|
+
accept?: string;
|
|
118
|
+
capture?: boolean | 'user' | 'environment';
|
|
119
|
+
multiple?: boolean;
|
|
120
|
+
disabled?: boolean;
|
|
121
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
122
|
+
'aria-describedby'?: string;
|
|
123
|
+
'aria-invalid'?: boolean;
|
|
124
|
+
};
|
|
125
|
+
dropZoneProps: {
|
|
126
|
+
onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
127
|
+
onDragLeave: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
128
|
+
onDragOver: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
129
|
+
onDrop: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
130
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
131
|
+
};
|
|
132
|
+
isDragActive: boolean;
|
|
133
|
+
openFileDialog: () => void;
|
|
134
|
+
removeFile: (file: File) => void;
|
|
135
|
+
errorTextId: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const useFileUpload = ({
|
|
139
|
+
id: idProp,
|
|
140
|
+
name,
|
|
141
|
+
accept,
|
|
142
|
+
capture,
|
|
143
|
+
multiple,
|
|
144
|
+
disabled = false,
|
|
145
|
+
errorText,
|
|
146
|
+
allowAppend = false,
|
|
147
|
+
files: filesProp,
|
|
148
|
+
defaultFiles = null,
|
|
149
|
+
onFilesChange,
|
|
150
|
+
}: UseFileUploadProps): UseFileUploadReturn => {
|
|
151
|
+
const generatedId = React.useId();
|
|
152
|
+
const id = idProp || generatedId;
|
|
153
|
+
const errorTextId = `${id}-error-text`;
|
|
154
|
+
const [filesState, setFilesState] = React.useState<FileList | null>(defaultFiles);
|
|
155
|
+
const [isDragActive, setIsDragActive] = React.useState(false);
|
|
156
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
157
|
+
// we need a counter because browsers trigger dragenter and dragleave multiple times when dragging over
|
|
158
|
+
// the drop zone, especially when there are child elements. The counter helps us determine when the drag
|
|
159
|
+
// is actually leaving the drop zone (counter goes to 0) vs just moving between child elements (counter > 0).
|
|
160
|
+
// Without this, the drop zone would flicker between active and inactive states as you move the mouse over it.
|
|
161
|
+
const dragCounterRef = React.useRef(0);
|
|
162
|
+
const isControlled = typeof filesProp !== 'undefined';
|
|
163
|
+
const files = isControlled ? filesProp : filesState;
|
|
164
|
+
|
|
165
|
+
const setFiles = (nextFiles: FileList | null) => {
|
|
166
|
+
if (!isControlled) {
|
|
167
|
+
setFilesState(nextFiles);
|
|
168
|
+
}
|
|
169
|
+
onFilesChange?.(nextFiles);
|
|
170
|
+
updateInputFiles(inputRef.current, nextFiles);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const handleFilesChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
174
|
+
if (disabled) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const newFiles = event.target.files;
|
|
178
|
+
if (!newFiles) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (allowAppend && files && files.length > 0) {
|
|
183
|
+
const dataTransfer = new DataTransfer();
|
|
184
|
+
for (let i = 0; i < files.length; i++) {
|
|
185
|
+
const existingFile = files.item(i);
|
|
186
|
+
if (existingFile) {
|
|
187
|
+
dataTransfer.items.add(existingFile);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
for (let i = 0; i < newFiles.length; i++) {
|
|
191
|
+
const newFile = newFiles.item(i);
|
|
192
|
+
if (newFile) {
|
|
193
|
+
dataTransfer.items.add(newFile);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
setFiles(dataTransfer.files);
|
|
197
|
+
} else {
|
|
198
|
+
setFiles(newFiles);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const handleDragEnter = (event: React.DragEvent<HTMLDivElement>) => {
|
|
203
|
+
if (disabled) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
event.stopPropagation();
|
|
208
|
+
dragCounterRef.current++;
|
|
209
|
+
if (event.dataTransfer.items && event.dataTransfer.items.length > 0) {
|
|
210
|
+
setIsDragActive(true);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const handleDragLeave = (event: React.DragEvent<HTMLDivElement>) => {
|
|
215
|
+
if (disabled) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
event.stopPropagation();
|
|
220
|
+
dragCounterRef.current--;
|
|
221
|
+
if (dragCounterRef.current === 0) {
|
|
222
|
+
setIsDragActive(false);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {
|
|
227
|
+
if (disabled) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
event.stopPropagation();
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const handleDrop = (event: React.DragEvent<HTMLDivElement>) => {
|
|
235
|
+
if (disabled) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
event.stopPropagation();
|
|
240
|
+
setIsDragActive(false);
|
|
241
|
+
dragCounterRef.current = 0;
|
|
242
|
+
|
|
243
|
+
const droppedFiles = event.dataTransfer.files;
|
|
244
|
+
if (droppedFiles && droppedFiles.length > 0) {
|
|
245
|
+
const dataTransfer = new DataTransfer();
|
|
246
|
+
|
|
247
|
+
if (allowAppend && files && files.length > 0) {
|
|
248
|
+
for (let i = 0; i < files.length; i++) {
|
|
249
|
+
const existingFile = files.item(i);
|
|
250
|
+
if (existingFile) {
|
|
251
|
+
dataTransfer.items.add(existingFile);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
for (let i = 0; i < droppedFiles.length; i++) {
|
|
255
|
+
const droppedFile = droppedFiles.item(i);
|
|
256
|
+
if (droppedFile) {
|
|
257
|
+
dataTransfer.items.add(droppedFile);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setFiles(dataTransfer.files);
|
|
261
|
+
} else if (!multiple && droppedFiles.length > 1) {
|
|
262
|
+
dataTransfer.items.add(droppedFiles[0]);
|
|
263
|
+
setFiles(dataTransfer.files);
|
|
264
|
+
} else {
|
|
265
|
+
setFiles(droppedFiles);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const removeFile = (file: File) => {
|
|
271
|
+
if (disabled) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const dataTransfer = new DataTransfer();
|
|
275
|
+
if (files) {
|
|
276
|
+
for (let i = 0; i < files.length; i++) {
|
|
277
|
+
const existingFile = files.item(i);
|
|
278
|
+
if (existingFile && existingFile !== file) {
|
|
279
|
+
dataTransfer.items.add(existingFile);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
setFiles(dataTransfer.files);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const openFileDialog = () => {
|
|
287
|
+
if (disabled) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
inputRef.current?.click();
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const handleDropZoneClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
294
|
+
if (disabled) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (event.defaultPrevented) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
302
|
+
// Ignore clicks on interactive descendants to avoid reopening the dialog.
|
|
303
|
+
if (target) {
|
|
304
|
+
const interactiveAncestor = target.closest('button, a, input, select, textarea, [role="button"]');
|
|
305
|
+
if (interactiveAncestor && interactiveAncestor !== event.currentTarget) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
openFileDialog();
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
React.useEffect(() => {
|
|
314
|
+
updateInputFiles(inputRef.current, files ?? null);
|
|
315
|
+
}, [files]);
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
id,
|
|
319
|
+
files,
|
|
320
|
+
setFiles,
|
|
321
|
+
inputProps: {
|
|
322
|
+
ref: inputRef,
|
|
323
|
+
type: 'file' as const,
|
|
324
|
+
id,
|
|
325
|
+
name,
|
|
326
|
+
accept,
|
|
327
|
+
capture,
|
|
328
|
+
multiple,
|
|
329
|
+
disabled,
|
|
330
|
+
onChange: handleFilesChange,
|
|
331
|
+
'aria-describedby': errorText ? errorTextId : undefined,
|
|
332
|
+
'aria-invalid': !!errorText,
|
|
333
|
+
},
|
|
334
|
+
dropZoneProps: {
|
|
335
|
+
onDragEnter: handleDragEnter,
|
|
336
|
+
onDragLeave: handleDragLeave,
|
|
337
|
+
onDragOver: handleDragOver,
|
|
338
|
+
onDrop: handleDrop,
|
|
339
|
+
onClick: handleDropZoneClick,
|
|
340
|
+
},
|
|
341
|
+
isDragActive,
|
|
342
|
+
openFileDialog,
|
|
343
|
+
removeFile,
|
|
344
|
+
errorTextId,
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
type FileItemProps = {
|
|
349
|
+
file: File;
|
|
350
|
+
onRemove: (file: File) => void;
|
|
351
|
+
removeLabel?: string;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export const FileItem = ({file, onRemove, removeLabel}: FileItemProps): JSX.Element => {
|
|
355
|
+
const {i18n, t, texts} = useTheme();
|
|
356
|
+
|
|
357
|
+
return (
|
|
358
|
+
<BoxedRow
|
|
359
|
+
title={file.name}
|
|
360
|
+
asset={<FileIcon file={file} />}
|
|
361
|
+
detail={formatSize(file.size, i18n.locale)}
|
|
362
|
+
iconButton={{
|
|
363
|
+
type: 'neutral',
|
|
364
|
+
Icon: IconCloseRegular,
|
|
365
|
+
small: true,
|
|
366
|
+
onPress: () => onRemove(file),
|
|
367
|
+
'aria-label':
|
|
368
|
+
removeLabel ??
|
|
369
|
+
texts.fileUploadRemoveFile ??
|
|
370
|
+
t(textTokens.fileUploadRemoveFile, file.name),
|
|
371
|
+
}}
|
|
372
|
+
/>
|
|
373
|
+
);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
type Props = {
|
|
377
|
+
id?: string;
|
|
378
|
+
name?: string;
|
|
379
|
+
accept?: string;
|
|
380
|
+
capture?: boolean | 'user' | 'environment';
|
|
381
|
+
multiple?: boolean;
|
|
382
|
+
disabled?: boolean;
|
|
383
|
+
errorText?: string;
|
|
384
|
+
/** When enabled, new files will be appended to the existing files instead of replacing them */
|
|
385
|
+
allowAppend?: boolean;
|
|
386
|
+
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
387
|
+
dataAttributes?: DataAttributes;
|
|
388
|
+
} & ExclusifyUnion<
|
|
389
|
+
| {
|
|
390
|
+
render: (props: {
|
|
391
|
+
id: string;
|
|
392
|
+
files: FileList | null;
|
|
393
|
+
setFiles: (files: FileList | null) => void;
|
|
394
|
+
dropZoneProps: {
|
|
395
|
+
onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
396
|
+
onDragLeave: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
397
|
+
onDragOver: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
398
|
+
onDrop: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
399
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
400
|
+
};
|
|
401
|
+
isDragActive: boolean;
|
|
402
|
+
openFileDialog: () => void;
|
|
403
|
+
removeFile: (file: File) => void;
|
|
404
|
+
errorTextId: string;
|
|
405
|
+
disabled: boolean;
|
|
406
|
+
}) => React.ReactNode;
|
|
407
|
+
}
|
|
408
|
+
| {
|
|
409
|
+
asset?: React.ReactNode;
|
|
410
|
+
title?: string;
|
|
411
|
+
description?: string;
|
|
412
|
+
slot?: React.ReactNode;
|
|
413
|
+
renderButton: (props: {
|
|
414
|
+
onPress: () => void;
|
|
415
|
+
small?: boolean;
|
|
416
|
+
disabled?: boolean;
|
|
417
|
+
tabIndex?: number;
|
|
418
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
419
|
+
}) => React.ReactNode;
|
|
420
|
+
renderFiles?: (props: {
|
|
421
|
+
files: FileList | null;
|
|
422
|
+
removeFile: (file: File) => void;
|
|
423
|
+
}) => React.ReactNode;
|
|
424
|
+
withDropZone?: boolean;
|
|
425
|
+
}
|
|
426
|
+
>;
|
|
427
|
+
|
|
428
|
+
const FileUpload = (props: Props): JSX.Element => {
|
|
429
|
+
const {
|
|
430
|
+
id: idProp,
|
|
431
|
+
name,
|
|
432
|
+
accept,
|
|
433
|
+
capture,
|
|
434
|
+
multiple,
|
|
435
|
+
disabled = false,
|
|
436
|
+
errorText,
|
|
437
|
+
allowAppend = false,
|
|
438
|
+
dataAttributes,
|
|
439
|
+
} = props;
|
|
440
|
+
const {texts, t} = useTheme();
|
|
441
|
+
const outsideVariant = useThemeVariant();
|
|
442
|
+
const {ref: buttonRef, text: buttonText} = useInnerText();
|
|
443
|
+
const {
|
|
444
|
+
id,
|
|
445
|
+
files,
|
|
446
|
+
setFiles,
|
|
447
|
+
inputProps,
|
|
448
|
+
dropZoneProps,
|
|
449
|
+
isDragActive,
|
|
450
|
+
openFileDialog,
|
|
451
|
+
removeFile,
|
|
452
|
+
errorTextId,
|
|
453
|
+
} = useFileUpload({
|
|
454
|
+
id: idProp,
|
|
455
|
+
name,
|
|
456
|
+
accept,
|
|
457
|
+
capture,
|
|
458
|
+
multiple,
|
|
459
|
+
disabled,
|
|
460
|
+
errorText,
|
|
461
|
+
allowAppend,
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
if (props.render) {
|
|
465
|
+
return (
|
|
466
|
+
<div
|
|
467
|
+
{...getPrefixedDataAttributes({
|
|
468
|
+
'component-name': 'FileUpload',
|
|
469
|
+
testid: 'FileUpload',
|
|
470
|
+
...dataAttributes,
|
|
471
|
+
})}
|
|
472
|
+
>
|
|
473
|
+
{props.render({
|
|
474
|
+
id,
|
|
475
|
+
files,
|
|
476
|
+
setFiles,
|
|
477
|
+
dropZoneProps,
|
|
478
|
+
isDragActive,
|
|
479
|
+
openFileDialog,
|
|
480
|
+
removeFile,
|
|
481
|
+
errorTextId,
|
|
482
|
+
disabled,
|
|
483
|
+
})}
|
|
484
|
+
<input style={{display: 'none'}} {...inputProps} />
|
|
485
|
+
</div>
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const {asset, title, description, slot, renderButton, renderFiles, withDropZone = false} = props;
|
|
490
|
+
|
|
491
|
+
const dropZoneHandlers = withDropZone && !disabled ? dropZoneProps : {};
|
|
492
|
+
const descriptionId = description ? `${id}-dropzone-description` : undefined;
|
|
493
|
+
const slotId = slot ? `${id}-dropzone-slot` : undefined;
|
|
494
|
+
|
|
495
|
+
const contentClassName = classnames({
|
|
496
|
+
[styles.disabled]: disabled,
|
|
497
|
+
[styles.dropZoneContainerBase]: withDropZone,
|
|
498
|
+
[styles.dropZoneVariant[outsideVariant]]: withDropZone,
|
|
499
|
+
[styles.dropZoneActive]: withDropZone && isDragActive,
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const assetClassName = withDropZone && isDragActive ? styles.assetScaleActive : '';
|
|
503
|
+
|
|
504
|
+
return (
|
|
505
|
+
<Stack
|
|
506
|
+
space={16}
|
|
507
|
+
dataAttributes={{'component-name': 'FileUpload', testid: 'FileUpload', ...dataAttributes}}
|
|
508
|
+
>
|
|
509
|
+
<Stack space={4}>
|
|
510
|
+
<div {...dropZoneHandlers} className={contentClassName}>
|
|
511
|
+
{withDropZone && !disabled && (
|
|
512
|
+
<button
|
|
513
|
+
type="button"
|
|
514
|
+
className={styles.dropZoneButton}
|
|
515
|
+
aria-label={[title, buttonText].filter(Boolean).join('. ')}
|
|
516
|
+
aria-describedby={[descriptionId, slotId].filter(Boolean).join(' ')}
|
|
517
|
+
onClick={openFileDialog}
|
|
518
|
+
/>
|
|
519
|
+
)}
|
|
520
|
+
<Stack space={8}>
|
|
521
|
+
{asset && (
|
|
522
|
+
<div
|
|
523
|
+
className={assetClassName}
|
|
524
|
+
style={{
|
|
525
|
+
color: {
|
|
526
|
+
default: skinVars.colors.brand,
|
|
527
|
+
alternative: skinVars.colors.brand,
|
|
528
|
+
brand: skinVars.colors.neutralHighBrand,
|
|
529
|
+
negative: skinVars.colors.negative,
|
|
530
|
+
media: skinVars.colors.negative,
|
|
531
|
+
}[outsideVariant],
|
|
532
|
+
}}
|
|
533
|
+
>
|
|
534
|
+
{asset}
|
|
535
|
+
</div>
|
|
536
|
+
)}
|
|
537
|
+
<Stack space={4}>
|
|
538
|
+
{title && (
|
|
539
|
+
<Text3 regular as="div" dataAttributes={{testid: 'title'}}>
|
|
540
|
+
<label htmlFor={id}>{title}</label>
|
|
541
|
+
</Text3>
|
|
542
|
+
)}
|
|
543
|
+
{description && (
|
|
544
|
+
<Text2
|
|
545
|
+
regular
|
|
546
|
+
as="div"
|
|
547
|
+
color={skinVars.colors.textSecondary}
|
|
548
|
+
dataAttributes={{testid: 'description'}}
|
|
549
|
+
id={descriptionId}
|
|
550
|
+
>
|
|
551
|
+
{description}
|
|
552
|
+
</Text2>
|
|
553
|
+
)}
|
|
554
|
+
</Stack>
|
|
555
|
+
</Stack>
|
|
556
|
+
{slot && <div id={slotId}>{slot}</div>}
|
|
557
|
+
<Box paddingTop={16}>
|
|
558
|
+
{withDropZone ? (
|
|
559
|
+
<div className={styles.centeredButton} ref={buttonRef} aria-hidden="true">
|
|
560
|
+
{renderButton({
|
|
561
|
+
onPress: openFileDialog,
|
|
562
|
+
small: true,
|
|
563
|
+
disabled,
|
|
564
|
+
tabIndex: -1,
|
|
565
|
+
'aria-hidden': true,
|
|
566
|
+
})}
|
|
567
|
+
</div>
|
|
568
|
+
) : (
|
|
569
|
+
renderButton({
|
|
570
|
+
onPress: openFileDialog,
|
|
571
|
+
small: true,
|
|
572
|
+
disabled,
|
|
573
|
+
})
|
|
574
|
+
)}
|
|
575
|
+
</Box>
|
|
576
|
+
<input style={{display: 'none'}} {...inputProps} />
|
|
577
|
+
</div>
|
|
578
|
+
{errorText && (
|
|
579
|
+
<div className={disabled ? styles.disabled : ''}>
|
|
580
|
+
<Text1
|
|
581
|
+
regular
|
|
582
|
+
color={skinVars.colors.textError}
|
|
583
|
+
as="div"
|
|
584
|
+
id={errorTextId}
|
|
585
|
+
aria-live="assertive"
|
|
586
|
+
dataAttributes={{testid: 'error-text'}}
|
|
587
|
+
>
|
|
588
|
+
<Inline space={4}>
|
|
589
|
+
<IconWarningRegular size={16} color="currentColor" />
|
|
590
|
+
{errorText}
|
|
591
|
+
</Inline>
|
|
592
|
+
</Text1>
|
|
593
|
+
</div>
|
|
594
|
+
)}
|
|
595
|
+
</Stack>
|
|
596
|
+
{renderFiles
|
|
597
|
+
? renderFiles({files, removeFile})
|
|
598
|
+
: files &&
|
|
599
|
+
files.length > 0 && (
|
|
600
|
+
<BoxedRowList
|
|
601
|
+
aria-label={texts.fileUploadListLabel ?? t(textTokens.fileUploadListLabel)}
|
|
602
|
+
>
|
|
603
|
+
{Array.from(files).map((file, index) => (
|
|
604
|
+
<FileItem key={index} file={file} onRemove={removeFile} />
|
|
605
|
+
))}
|
|
606
|
+
</BoxedRowList>
|
|
607
|
+
)}
|
|
608
|
+
</Stack>
|
|
609
|
+
);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
export default FileUpload;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {createVar, style} from '@vanilla-extract/css';
|
|
2
|
+
import {sprinkles} from './sprinkles.css';
|
|
3
|
+
import {vars as skinVars} from './skins/skin-contract.css';
|
|
4
|
+
import * as mq from './media-queries.css';
|
|
5
|
+
|
|
6
|
+
const footerHeight = createVar();
|
|
7
|
+
const backgroundColor = createVar();
|
|
8
|
+
|
|
9
|
+
export const vars = {footerHeight, backgroundColor};
|
|
10
|
+
|
|
11
|
+
export const footer = style([
|
|
12
|
+
sprinkles({
|
|
13
|
+
width: '100%',
|
|
14
|
+
}),
|
|
15
|
+
{
|
|
16
|
+
transition: 'box-shadow 0.2s linear',
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const fixedFooter = style({
|
|
21
|
+
'@media': {
|
|
22
|
+
[mq.tabletOrSmaller]: {
|
|
23
|
+
position: 'fixed',
|
|
24
|
+
left: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
boxShadow: '0 -2px 8px 0 rgba(0, 0, 0, 0)', // without this chrome mobile shows strange artifacts in the shadow animation
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const elevated = style({
|
|
32
|
+
'@media': {
|
|
33
|
+
[mq.tabletOrSmaller]: {
|
|
34
|
+
background: skinVars.colors.backgroundContainer,
|
|
35
|
+
boxShadow: '0 -2px 8px 0 rgba(0, 0, 0, 0.10)',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const withoutFooter = sprinkles({display: 'none'});
|
|
41
|
+
|
|
42
|
+
export const container = style({
|
|
43
|
+
'@media': {
|
|
44
|
+
[mq.tabletOrSmaller]: {
|
|
45
|
+
isolation: 'isolate',
|
|
46
|
+
paddingBottom: footerHeight,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const portal = style([
|
|
52
|
+
sprinkles({
|
|
53
|
+
top: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
right: 0,
|
|
56
|
+
bottom: 0,
|
|
57
|
+
position: 'fixed',
|
|
58
|
+
}),
|
|
59
|
+
{
|
|
60
|
+
zIndex: -1, // Render below everything, including other portals
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
export const fixedBackgroundLayer = style([
|
|
65
|
+
sprinkles({
|
|
66
|
+
top: 0,
|
|
67
|
+
left: 0,
|
|
68
|
+
right: 0,
|
|
69
|
+
bottom: 0,
|
|
70
|
+
position: 'fixed',
|
|
71
|
+
}),
|
|
72
|
+
{
|
|
73
|
+
zIndex: -3,
|
|
74
|
+
'@media': {
|
|
75
|
+
[mq.desktopOrBigger]: {
|
|
76
|
+
display: 'none',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
export const absoluteBackgroundLayer = style([
|
|
83
|
+
sprinkles({
|
|
84
|
+
left: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
}),
|
|
88
|
+
{
|
|
89
|
+
zIndex: -1,
|
|
90
|
+
'@media': {
|
|
91
|
+
[mq.desktopOrBigger]: {
|
|
92
|
+
display: 'none',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
]);
|