@six-group/ui-library 0.0.0-insider.d833923 → 0.0.0-insider.d9aec2b
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/dist/cjs/{form-control-b6ca8224.js → form-control-de259450.js} +2 -2
- package/dist/cjs/{form-control-b6ca8224.js.map → form-control-de259450.js.map} +1 -1
- package/dist/cjs/{index-5bfcf88b.js → index-1f707a55.js} +469 -14
- package/dist/cjs/index-1f707a55.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/six-alert.cjs.entry.js +1 -1
- package/dist/cjs/six-avatar.cjs.entry.js +1 -1
- package/dist/cjs/six-badge.cjs.entry.js +1 -1
- package/dist/cjs/six-button.cjs.entry.js +1 -1
- package/dist/cjs/six-card.cjs.entry.js +1 -1
- package/dist/cjs/six-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/six-checkbox_2.cjs.entry.js.map +1 -1
- package/dist/cjs/six-datepicker.cjs.entry.js +2 -2
- package/dist/cjs/six-datepicker.cjs.entry.js.map +1 -1
- package/dist/cjs/six-details.cjs.entry.js +1 -1
- package/dist/cjs/six-dialog.cjs.entry.js +1 -1
- package/dist/cjs/six-drawer.cjs.entry.js +1 -1
- package/dist/cjs/six-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/six-error-page.cjs.entry.js +1 -1
- package/dist/cjs/six-error.cjs.entry.js +1 -1
- package/dist/cjs/six-file-list-item.cjs.entry.js +1 -1
- package/dist/cjs/six-file-list.cjs.entry.js +1 -1
- package/dist/cjs/six-file-upload.cjs.entry.js +32 -8
- package/dist/cjs/six-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/six-footer.cjs.entry.js +1 -1
- package/dist/cjs/six-group-label.cjs.entry.js +2 -2
- package/dist/cjs/six-header.cjs.entry.js +1 -1
- package/dist/cjs/six-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/six-icon.cjs.entry.js +1 -1
- package/dist/cjs/six-input.cjs.entry.js +2 -2
- package/dist/cjs/six-item-picker.cjs.entry.js +1 -1
- package/dist/cjs/six-language-switcher.cjs.entry.js +7 -3
- package/dist/cjs/six-language-switcher.cjs.entry.js.map +1 -1
- package/dist/cjs/six-layout-grid.cjs.entry.js +1 -1
- package/dist/cjs/six-main-container.cjs.entry.js +1 -1
- package/dist/cjs/six-menu-divider.cjs.entry.js +1 -1
- package/dist/cjs/six-menu-label.cjs.entry.js +1 -1
- package/dist/cjs/six-picto.cjs.entry.js +1 -1
- package/dist/cjs/six-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/six-progress-ring.cjs.entry.js +1 -1
- package/dist/cjs/six-radio.cjs.entry.js +1 -1
- package/dist/cjs/six-range.cjs.entry.js +2 -2
- package/dist/cjs/six-root.cjs.entry.js +1 -1
- package/dist/cjs/six-search-field.cjs.entry.js +1 -1
- package/dist/cjs/six-select.cjs.entry.js +11 -8
- package/dist/cjs/six-select.cjs.entry.js.map +1 -1
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js +2 -2
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js.map +1 -1
- package/dist/cjs/six-sidebar-item.cjs.entry.js +1 -1
- package/dist/cjs/six-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/six-spinner.cjs.entry.js +1 -1
- package/dist/cjs/six-stage-indicator.cjs.entry.js +1 -1
- package/dist/cjs/six-switch.cjs.entry.js +2 -2
- package/dist/cjs/six-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/six-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/six-tab.cjs.entry.js +2 -2
- package/dist/cjs/six-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/six-tag.cjs.entry.js +1 -1
- package/dist/cjs/six-textarea.cjs.entry.js +2 -2
- package/dist/cjs/six-tile.cjs.entry.js +1 -1
- package/dist/cjs/six-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/six-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/ui-library.cjs.js +3 -3
- package/dist/cjs/ui-library.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/six-checkbox/six-checkbox.css +2 -0
- package/dist/collection/components/six-datepicker/six-datepicker.js +1 -1
- package/dist/collection/components/six-datepicker/six-datepicker.js.map +1 -1
- package/dist/collection/components/six-file-upload/six-file-upload.css +11 -0
- package/dist/collection/components/six-file-upload/six-file-upload.js +87 -7
- package/dist/collection/components/six-file-upload/six-file-upload.js.map +1 -1
- package/dist/collection/components/six-file-upload/test/six-file-upload.spec.js +187 -24
- package/dist/collection/components/six-file-upload/test/six-file-upload.spec.js.map +1 -1
- package/dist/collection/components/six-language-switcher/six-language-switcher.css +4 -0
- package/dist/collection/components/six-language-switcher/six-language-switcher.js +5 -1
- package/dist/collection/components/six-language-switcher/six-language-switcher.js.map +1 -1
- package/dist/collection/components/six-language-switcher/test/six-language-switcher.spec.js +12 -12
- package/dist/collection/components/six-language-switcher/test/six-language-switcher.spec.js.map +1 -1
- package/dist/collection/components/six-select/six-select.js +9 -6
- package/dist/collection/components/six-select/six-select.js.map +1 -1
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.css +1 -0
- package/dist/collection/components/six-tab/six-tab.js +1 -1
- package/dist/collection/components/six-tab/six-tab.js.map +1 -1
- package/dist/components/six-checkbox2.js +1 -1
- package/dist/components/six-checkbox2.js.map +1 -1
- package/dist/components/six-datepicker.js +1 -1
- package/dist/components/six-datepicker.js.map +1 -1
- package/dist/components/six-file-upload.js +51 -11
- package/dist/components/six-file-upload.js.map +1 -1
- package/dist/components/six-language-switcher.js +6 -2
- package/dist/components/six-language-switcher.js.map +1 -1
- package/dist/components/six-select.js +9 -6
- package/dist/components/six-select.js.map +1 -1
- package/dist/components/six-sidebar-item-group.js +1 -1
- package/dist/components/six-sidebar-item-group.js.map +1 -1
- package/dist/components/six-tab.js +1 -1
- package/dist/components/six-tab.js.map +1 -1
- package/dist/components.json +98 -8
- package/dist/esm/{form-control-5d3cf9d4.js → form-control-30c5bd8b.js} +2 -2
- package/dist/esm/{form-control-5d3cf9d4.js.map → form-control-30c5bd8b.js.map} +1 -1
- package/dist/esm/{index-d415464d.js → index-5390c1d6.js} +469 -14
- package/dist/esm/index-5390c1d6.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/six-alert.entry.js +1 -1
- package/dist/esm/six-avatar.entry.js +1 -1
- package/dist/esm/six-badge.entry.js +1 -1
- package/dist/esm/six-button.entry.js +1 -1
- package/dist/esm/six-card.entry.js +1 -1
- package/dist/esm/six-checkbox_2.entry.js +3 -3
- package/dist/esm/six-checkbox_2.entry.js.map +1 -1
- package/dist/esm/six-datepicker.entry.js +2 -2
- package/dist/esm/six-datepicker.entry.js.map +1 -1
- package/dist/esm/six-details.entry.js +1 -1
- package/dist/esm/six-dialog.entry.js +1 -1
- package/dist/esm/six-drawer.entry.js +1 -1
- package/dist/esm/six-dropdown_2.entry.js +1 -1
- package/dist/esm/six-error-page.entry.js +1 -1
- package/dist/esm/six-error.entry.js +1 -1
- package/dist/esm/six-file-list-item.entry.js +1 -1
- package/dist/esm/six-file-list.entry.js +1 -1
- package/dist/esm/six-file-upload.entry.js +32 -8
- package/dist/esm/six-file-upload.entry.js.map +1 -1
- package/dist/esm/six-footer.entry.js +1 -1
- package/dist/esm/six-group-label.entry.js +2 -2
- package/dist/esm/six-header.entry.js +1 -1
- package/dist/esm/six-icon-button.entry.js +1 -1
- package/dist/esm/six-icon.entry.js +1 -1
- package/dist/esm/six-input.entry.js +2 -2
- package/dist/esm/six-item-picker.entry.js +1 -1
- package/dist/esm/six-language-switcher.entry.js +7 -3
- package/dist/esm/six-language-switcher.entry.js.map +1 -1
- package/dist/esm/six-layout-grid.entry.js +1 -1
- package/dist/esm/six-main-container.entry.js +1 -1
- package/dist/esm/six-menu-divider.entry.js +1 -1
- package/dist/esm/six-menu-label.entry.js +1 -1
- package/dist/esm/six-picto.entry.js +1 -1
- package/dist/esm/six-progress-bar.entry.js +1 -1
- package/dist/esm/six-progress-ring.entry.js +1 -1
- package/dist/esm/six-radio.entry.js +1 -1
- package/dist/esm/six-range.entry.js +2 -2
- package/dist/esm/six-root.entry.js +1 -1
- package/dist/esm/six-search-field.entry.js +1 -1
- package/dist/esm/six-select.entry.js +11 -8
- package/dist/esm/six-select.entry.js.map +1 -1
- package/dist/esm/six-sidebar-item-group.entry.js +2 -2
- package/dist/esm/six-sidebar-item-group.entry.js.map +1 -1
- package/dist/esm/six-sidebar-item.entry.js +1 -1
- package/dist/esm/six-sidebar.entry.js +1 -1
- package/dist/esm/six-spinner.entry.js +1 -1
- package/dist/esm/six-stage-indicator.entry.js +1 -1
- package/dist/esm/six-switch.entry.js +2 -2
- package/dist/esm/six-tab-group.entry.js +1 -1
- package/dist/esm/six-tab-panel.entry.js +1 -1
- package/dist/esm/six-tab.entry.js +2 -2
- package/dist/esm/six-tab.entry.js.map +1 -1
- package/dist/esm/six-tag.entry.js +1 -1
- package/dist/esm/six-textarea.entry.js +2 -2
- package/dist/esm/six-tile.entry.js +1 -1
- package/dist/esm/six-timepicker.entry.js +1 -1
- package/dist/esm/six-tooltip.entry.js +1 -1
- package/dist/esm/ui-library.js +4 -4
- package/dist/esm/ui-library.js.map +1 -1
- package/dist/types/components/six-file-upload/six-file-upload.d.ts +10 -0
- package/dist/types/components.d.ts +24 -0
- package/dist/ui-library/{p-7130a678.entry.js → p-030fa1fa.entry.js} +2 -2
- package/dist/ui-library/{p-0a71815c.entry.js → p-03d1b956.entry.js} +2 -2
- package/dist/ui-library/{p-71a4a398.entry.js → p-047d02ad.entry.js} +2 -2
- package/dist/ui-library/p-05eb1bab.js +3 -0
- package/dist/ui-library/p-05eb1bab.js.map +1 -0
- package/dist/ui-library/{p-cec88a79.entry.js → p-060069d4.entry.js} +2 -2
- package/dist/ui-library/{p-fe483fc6.entry.js → p-06ba653e.entry.js} +2 -2
- package/dist/ui-library/{p-a995283c.entry.js → p-07c8de65.entry.js} +2 -2
- package/dist/ui-library/{p-d15331e7.entry.js → p-0fb3fb30.entry.js} +2 -2
- package/dist/ui-library/p-14e5fccc.entry.js +2 -0
- package/dist/ui-library/p-14e5fccc.entry.js.map +1 -0
- package/dist/ui-library/{p-2e7312fc.entry.js → p-16fb5aad.entry.js} +2 -2
- package/dist/ui-library/{p-2e7312fc.entry.js.map → p-16fb5aad.entry.js.map} +1 -1
- package/dist/ui-library/{p-254d32bf.entry.js → p-189602e4.entry.js} +2 -2
- package/dist/ui-library/{p-195619ed.entry.js → p-19560508.entry.js} +2 -2
- package/dist/ui-library/{p-bca7a8c8.entry.js → p-2386627e.entry.js} +2 -2
- package/dist/ui-library/p-2c25cb61.entry.js +2 -0
- package/dist/ui-library/p-2c25cb61.entry.js.map +1 -0
- package/dist/ui-library/{p-8af4ae3e.entry.js → p-3603dd96.entry.js} +2 -2
- package/dist/ui-library/{p-a0e324ad.entry.js → p-39ff5f61.entry.js} +2 -2
- package/dist/ui-library/{p-9e14b37a.entry.js → p-3b5a76ea.entry.js} +2 -2
- package/dist/ui-library/{p-b863dcc4.entry.js → p-419ed003.entry.js} +2 -2
- package/dist/ui-library/{p-6741b418.entry.js → p-45003bae.entry.js} +2 -2
- package/dist/ui-library/{p-9e0f0562.entry.js → p-4963f03c.entry.js} +2 -2
- package/dist/ui-library/{p-e6db01a9.entry.js → p-4d89932f.entry.js} +2 -2
- package/dist/ui-library/{p-6ee48e81.js → p-605bdd81.js} +2 -2
- package/dist/ui-library/{p-a4e3f4e5.entry.js → p-63acceb6.entry.js} +2 -2
- package/dist/ui-library/{p-e5c08d9f.entry.js → p-6888b9ee.entry.js} +2 -2
- package/dist/ui-library/{p-5b8a5a21.entry.js → p-6f9153be.entry.js} +2 -2
- package/dist/ui-library/{p-c46013f4.entry.js → p-73be87a7.entry.js} +2 -2
- package/dist/ui-library/{p-5cde0403.entry.js → p-7561b336.entry.js} +2 -2
- package/dist/ui-library/{p-46817c94.entry.js → p-7c18b8ca.entry.js} +2 -2
- package/dist/ui-library/p-82bd8781.entry.js +2 -0
- package/dist/ui-library/p-82bd8781.entry.js.map +1 -0
- package/dist/ui-library/{p-7254e090.entry.js → p-89db9a8b.entry.js} +2 -2
- package/dist/ui-library/{p-6bf442d5.entry.js → p-8f1d3461.entry.js} +2 -2
- package/dist/ui-library/{p-a31dfc45.entry.js → p-9bc1639b.entry.js} +2 -2
- package/dist/ui-library/{p-b4f81f97.entry.js → p-9cb83369.entry.js} +2 -2
- package/dist/ui-library/{p-f1dcaab0.entry.js → p-a398e3eb.entry.js} +2 -2
- package/dist/ui-library/{p-25b9dacc.entry.js → p-a7e2f511.entry.js} +2 -2
- package/dist/ui-library/{p-6adcd790.entry.js → p-a8863197.entry.js} +2 -2
- package/dist/ui-library/{p-9ddaa7e2.entry.js → p-a9e009af.entry.js} +2 -2
- package/dist/ui-library/{p-a627f6e0.entry.js → p-ac00076d.entry.js} +2 -2
- package/dist/ui-library/{p-957a36f7.entry.js → p-b10652dd.entry.js} +2 -2
- package/dist/ui-library/{p-3f84b852.entry.js → p-b4bc4915.entry.js} +2 -2
- package/dist/ui-library/{p-f2320c65.entry.js → p-b5acf54d.entry.js} +2 -2
- package/dist/ui-library/{p-9effba13.entry.js → p-b60c20aa.entry.js} +2 -2
- package/dist/ui-library/p-b60c632a.entry.js +2 -0
- package/dist/ui-library/{p-f4c61910.entry.js.map → p-b60c632a.entry.js.map} +1 -1
- package/dist/ui-library/p-c1d68730.entry.js +2 -0
- package/dist/ui-library/p-c1d68730.entry.js.map +1 -0
- package/dist/ui-library/{p-29b50eae.entry.js → p-c35a7cef.entry.js} +2 -2
- package/dist/ui-library/{p-a69ba529.entry.js → p-c62893e5.entry.js} +2 -2
- package/dist/ui-library/{p-65b32e2b.entry.js → p-c6464bfe.entry.js} +2 -2
- package/dist/ui-library/{p-65b32e2b.entry.js.map → p-c6464bfe.entry.js.map} +1 -1
- package/dist/ui-library/{p-9a4cc473.entry.js → p-cf109cbf.entry.js} +2 -2
- package/dist/ui-library/{p-57d3562c.entry.js → p-d07b549f.entry.js} +2 -2
- package/dist/ui-library/{p-51530e6d.entry.js → p-d42f1ea9.entry.js} +2 -2
- package/dist/ui-library/{p-35510b9d.entry.js → p-fe37dadf.entry.js} +2 -2
- package/dist/ui-library/{p-d668844e.entry.js → p-fe89a7c4.entry.js} +2 -2
- package/dist/ui-library/ui-library.esm.js +1 -1
- package/dist/ui-library/ui-library.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/index-5bfcf88b.js.map +0 -1
- package/dist/esm/index-d415464d.js.map +0 -1
- package/dist/ui-library/p-00c784f9.entry.js +0 -2
- package/dist/ui-library/p-00c784f9.entry.js.map +0 -1
- package/dist/ui-library/p-2b7e2bcb.entry.js +0 -2
- package/dist/ui-library/p-2b7e2bcb.entry.js.map +0 -1
- package/dist/ui-library/p-2f586b01.entry.js +0 -2
- package/dist/ui-library/p-2f586b01.entry.js.map +0 -1
- package/dist/ui-library/p-5ea7ffad.entry.js +0 -2
- package/dist/ui-library/p-5ea7ffad.entry.js.map +0 -1
- package/dist/ui-library/p-e8d5a789.js +0 -3
- package/dist/ui-library/p-e8d5a789.js.map +0 -1
- package/dist/ui-library/p-f4c61910.entry.js +0 -2
- /package/dist/ui-library/{p-7130a678.entry.js.map → p-030fa1fa.entry.js.map} +0 -0
- /package/dist/ui-library/{p-0a71815c.entry.js.map → p-03d1b956.entry.js.map} +0 -0
- /package/dist/ui-library/{p-71a4a398.entry.js.map → p-047d02ad.entry.js.map} +0 -0
- /package/dist/ui-library/{p-cec88a79.entry.js.map → p-060069d4.entry.js.map} +0 -0
- /package/dist/ui-library/{p-fe483fc6.entry.js.map → p-06ba653e.entry.js.map} +0 -0
- /package/dist/ui-library/{p-a995283c.entry.js.map → p-07c8de65.entry.js.map} +0 -0
- /package/dist/ui-library/{p-d15331e7.entry.js.map → p-0fb3fb30.entry.js.map} +0 -0
- /package/dist/ui-library/{p-254d32bf.entry.js.map → p-189602e4.entry.js.map} +0 -0
- /package/dist/ui-library/{p-195619ed.entry.js.map → p-19560508.entry.js.map} +0 -0
- /package/dist/ui-library/{p-bca7a8c8.entry.js.map → p-2386627e.entry.js.map} +0 -0
- /package/dist/ui-library/{p-8af4ae3e.entry.js.map → p-3603dd96.entry.js.map} +0 -0
- /package/dist/ui-library/{p-a0e324ad.entry.js.map → p-39ff5f61.entry.js.map} +0 -0
- /package/dist/ui-library/{p-9e14b37a.entry.js.map → p-3b5a76ea.entry.js.map} +0 -0
- /package/dist/ui-library/{p-b863dcc4.entry.js.map → p-419ed003.entry.js.map} +0 -0
- /package/dist/ui-library/{p-6741b418.entry.js.map → p-45003bae.entry.js.map} +0 -0
- /package/dist/ui-library/{p-9e0f0562.entry.js.map → p-4963f03c.entry.js.map} +0 -0
- /package/dist/ui-library/{p-e6db01a9.entry.js.map → p-4d89932f.entry.js.map} +0 -0
- /package/dist/ui-library/{p-6ee48e81.js.map → p-605bdd81.js.map} +0 -0
- /package/dist/ui-library/{p-a4e3f4e5.entry.js.map → p-63acceb6.entry.js.map} +0 -0
- /package/dist/ui-library/{p-e5c08d9f.entry.js.map → p-6888b9ee.entry.js.map} +0 -0
- /package/dist/ui-library/{p-5b8a5a21.entry.js.map → p-6f9153be.entry.js.map} +0 -0
- /package/dist/ui-library/{p-c46013f4.entry.js.map → p-73be87a7.entry.js.map} +0 -0
- /package/dist/ui-library/{p-5cde0403.entry.js.map → p-7561b336.entry.js.map} +0 -0
- /package/dist/ui-library/{p-46817c94.entry.js.map → p-7c18b8ca.entry.js.map} +0 -0
- /package/dist/ui-library/{p-7254e090.entry.js.map → p-89db9a8b.entry.js.map} +0 -0
- /package/dist/ui-library/{p-6bf442d5.entry.js.map → p-8f1d3461.entry.js.map} +0 -0
- /package/dist/ui-library/{p-a31dfc45.entry.js.map → p-9bc1639b.entry.js.map} +0 -0
- /package/dist/ui-library/{p-b4f81f97.entry.js.map → p-9cb83369.entry.js.map} +0 -0
- /package/dist/ui-library/{p-f1dcaab0.entry.js.map → p-a398e3eb.entry.js.map} +0 -0
- /package/dist/ui-library/{p-25b9dacc.entry.js.map → p-a7e2f511.entry.js.map} +0 -0
- /package/dist/ui-library/{p-6adcd790.entry.js.map → p-a8863197.entry.js.map} +0 -0
- /package/dist/ui-library/{p-9ddaa7e2.entry.js.map → p-a9e009af.entry.js.map} +0 -0
- /package/dist/ui-library/{p-a627f6e0.entry.js.map → p-ac00076d.entry.js.map} +0 -0
- /package/dist/ui-library/{p-957a36f7.entry.js.map → p-b10652dd.entry.js.map} +0 -0
- /package/dist/ui-library/{p-3f84b852.entry.js.map → p-b4bc4915.entry.js.map} +0 -0
- /package/dist/ui-library/{p-f2320c65.entry.js.map → p-b5acf54d.entry.js.map} +0 -0
- /package/dist/ui-library/{p-9effba13.entry.js.map → p-b60c20aa.entry.js.map} +0 -0
- /package/dist/ui-library/{p-29b50eae.entry.js.map → p-c35a7cef.entry.js.map} +0 -0
- /package/dist/ui-library/{p-a69ba529.entry.js.map → p-c62893e5.entry.js.map} +0 -0
- /package/dist/ui-library/{p-9a4cc473.entry.js.map → p-cf109cbf.entry.js.map} +0 -0
- /package/dist/ui-library/{p-57d3562c.entry.js.map → p-d07b549f.entry.js.map} +0 -0
- /package/dist/ui-library/{p-51530e6d.entry.js.map → p-d42f1ea9.entry.js.map} +0 -0
- /package/dist/ui-library/{p-35510b9d.entry.js.map → p-fe37dadf.entry.js.map} +0 -0
- /package/dist/ui-library/{p-d668844e.entry.js.map → p-fe89a7c4.entry.js.map} +0 -0
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
import { hasSlot } from "../../utils/slot";
|
|
2
3
|
/**
|
|
3
4
|
* @since 2.0.0
|
|
4
5
|
* @status experimental
|
|
5
6
|
*
|
|
7
|
+
* @slot error-text - Error text that is shown when the status is set to invalid. Alternatively, you can use the error-text prop.
|
|
6
8
|
*/
|
|
7
9
|
export class SixFileUpload {
|
|
8
10
|
constructor() {
|
|
11
|
+
this.handleSlotChange = () => {
|
|
12
|
+
let validType = false;
|
|
13
|
+
if (this.errorText != null &&
|
|
14
|
+
((typeof this.errorText == 'string' && this.errorText.trim().length > 0) ||
|
|
15
|
+
(typeof this.errorText == 'object' && this.errorText.length > 0))) {
|
|
16
|
+
validType = true;
|
|
17
|
+
}
|
|
18
|
+
this.hasError = validType || hasSlot(this.host, 'error-text');
|
|
19
|
+
console.log(this.errorText);
|
|
20
|
+
console.log(this.hasError);
|
|
21
|
+
};
|
|
9
22
|
this.handleFiles = (files) => {
|
|
10
|
-
if (this.disabled || files.length === 0) {
|
|
23
|
+
if (this.disabled || files.length === 0 || this.uploading) {
|
|
11
24
|
return;
|
|
12
25
|
}
|
|
13
26
|
if (!this.multiple && files.length > 1) {
|
|
@@ -42,12 +55,16 @@ export class SixFileUpload {
|
|
|
42
55
|
}
|
|
43
56
|
};
|
|
44
57
|
this.isOver = false;
|
|
58
|
+
this.hasError = false;
|
|
45
59
|
this.compact = false;
|
|
46
60
|
this.label = undefined;
|
|
47
61
|
this.disabled = false;
|
|
48
62
|
this.accept = undefined;
|
|
49
63
|
this.multiple = false;
|
|
50
64
|
this.maxFileSize = undefined;
|
|
65
|
+
this.uploading = false;
|
|
66
|
+
this.errorText = '';
|
|
67
|
+
this.invalid = false;
|
|
51
68
|
}
|
|
52
69
|
dragenterHandler() {
|
|
53
70
|
if (!this.disabled) {
|
|
@@ -72,17 +89,24 @@ export class SixFileUpload {
|
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
91
|
}
|
|
92
|
+
componentWillLoad() {
|
|
93
|
+
this.handleSlotChange();
|
|
94
|
+
}
|
|
75
95
|
componentDidLoad() {
|
|
96
|
+
var _a;
|
|
76
97
|
['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {
|
|
77
98
|
this.host.addEventListener(eventName, this.preventDefaults, false);
|
|
78
99
|
document.body.addEventListener(eventName, this.preventDefaults, false);
|
|
79
100
|
});
|
|
101
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.addEventListener('slotchange', this.handleSlotChange);
|
|
80
102
|
}
|
|
81
103
|
disconnectedCallback() {
|
|
104
|
+
var _a;
|
|
82
105
|
['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {
|
|
83
106
|
this.host.removeEventListener(eventName, this.preventDefaults, false);
|
|
84
107
|
document.body.removeEventListener(eventName, this.preventDefaults, false);
|
|
85
108
|
});
|
|
109
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeEventListener('slotchange', this.handleSlotChange);
|
|
86
110
|
}
|
|
87
111
|
preventDefaults(e) {
|
|
88
112
|
e.preventDefault();
|
|
@@ -94,17 +118,18 @@ export class SixFileUpload {
|
|
|
94
118
|
}
|
|
95
119
|
render() {
|
|
96
120
|
const Container = this.compact ? 'six-button' : 'six-card';
|
|
97
|
-
|
|
121
|
+
const errorMessages = (Array.isArray(this.errorText) ? this.errorText : [this.errorText]).filter((text) => text != null && text.trim() !== '');
|
|
122
|
+
return (h("div", { key: 'aeaeba82e5419d410bb070edc4c14e99658a2024', class: {
|
|
98
123
|
'six-file-upload': true,
|
|
99
|
-
'six-file-upload--disabled': this.disabled,
|
|
100
|
-
} }, h(Container, { key: '
|
|
124
|
+
'six-file-upload--disabled': this.disabled || this.uploading,
|
|
125
|
+
} }, h(Container, { key: '18a2c76f6c1cc07d6a8d69f17fa55df61bcfc486', disabled: this.disabled || this.uploading, "aria-invalid": this.invalid ? 'true' : 'false', class: {
|
|
101
126
|
'six-file-upload__container--compact': this.compact,
|
|
102
127
|
'six-file-upload__container--full': !this.compact,
|
|
103
|
-
} }, this.compact && (h("span", { slot: "prefix" }, h("six-icon", { class: "six-file-upload__label-icon" }, "arrow_circle_up"))), h("div", { key: '
|
|
128
|
+
} }, this.compact && !this.uploading && (h("span", { slot: "prefix" }, h("six-icon", { class: "six-file-upload__label-icon" }, "arrow_circle_up"))), h("div", { key: '1c4dee810b517670842708c438e280897b80c32a', class: {
|
|
104
129
|
'six-file-upload__drop-zone': true,
|
|
105
130
|
'six-file-upload__drop-zone--hover': this.isOver,
|
|
106
131
|
'six-file-upload__drop-zone--compact': this.compact,
|
|
107
|
-
} }, h("span", {
|
|
132
|
+
} }, this.uploading ? (h("span", { class: "six-file-upload__drop-zone__spinner-container" }, h("six-spinner", null), " Uploading...")) : (h("div", null, h("span", null, this.renderLabel()), h("input", { class: "six-file-upload__input", type: "file", name: "resume", disabled: this.disabled, accept: this.accept, multiple: this.multiple, onChange: this.onChange, ref: (el) => (this.fileInput = el) }))))), h("div", { key: '4d8524acc6ab4b919ab8ed469b16d11268ed9994', "aria-hidden": this.invalid ? 'false' : 'true' }, h("slot", { key: '8b104ee4a3feb6c5db255157a5530deeec5dec3d', name: "error-text" }, errorMessages.map((text) => (h("six-error", null, h("div", { class: "six-file-upload__error-text" }, text))))))));
|
|
108
133
|
}
|
|
109
134
|
static get is() { return "six-file-upload"; }
|
|
110
135
|
static get encapsulation() { return "scoped"; }
|
|
@@ -224,12 +249,67 @@ export class SixFileUpload {
|
|
|
224
249
|
},
|
|
225
250
|
"attribute": "max-file-size",
|
|
226
251
|
"reflect": false
|
|
252
|
+
},
|
|
253
|
+
"uploading": {
|
|
254
|
+
"type": "boolean",
|
|
255
|
+
"mutable": false,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "boolean",
|
|
258
|
+
"resolved": "boolean",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": "Set to true to draw the control in a loading state."
|
|
266
|
+
},
|
|
267
|
+
"attribute": "uploading",
|
|
268
|
+
"reflect": true,
|
|
269
|
+
"defaultValue": "false"
|
|
270
|
+
},
|
|
271
|
+
"errorText": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "string | string[]",
|
|
276
|
+
"resolved": "string | string[]",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": "The error message shown, if `invalid` is set to true."
|
|
284
|
+
},
|
|
285
|
+
"attribute": "error-text",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "''"
|
|
288
|
+
},
|
|
289
|
+
"invalid": {
|
|
290
|
+
"type": "boolean",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "boolean",
|
|
294
|
+
"resolved": "boolean",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": "If this property is set to true and an error message is provided by `errorText`, the error message is displayed."
|
|
302
|
+
},
|
|
303
|
+
"attribute": "invalid",
|
|
304
|
+
"reflect": true,
|
|
305
|
+
"defaultValue": "false"
|
|
227
306
|
}
|
|
228
307
|
};
|
|
229
308
|
}
|
|
230
309
|
static get states() {
|
|
231
310
|
return {
|
|
232
|
-
"isOver": {}
|
|
311
|
+
"isOver": {},
|
|
312
|
+
"hasError": {}
|
|
233
313
|
};
|
|
234
314
|
}
|
|
235
315
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-file-upload.js","sourceRoot":"","sources":["../../../src/components/six-file-upload/six-file-upload.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAgBhG;;;;GAIG;AAOH,MAAM,OAAO,aAAa;;QA8DhB,gBAAW,GAAG,CAAC,KAAe,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxC,OAAO;Y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AED,EAAC,SAAS,qDACR,KAAK,EAAE;oBACL,qCAAqC,EAAE,IAAI,CAAC,OAAO;oBACnD,kCAAkC,EAAE,CAAC,IAAI,CAAC,OAAO;iBAClD;gBAEA,IAAI,CAAC,OAAO,IAAI,CACf,YAAM,IAAI,EAAC,QAAQ;oBACjB,gBAAU,KAAK,EAAC,6BAA6B,sBAA2B,CACnE,CACR;gBACD,4DACE,KAAK,EAAE;wBACL,4BAA4B,EAAE,IAAI;wBAClC,mCAAmC,EAAE,IAAI,CAAC,MAAM;wBAChD,qCAAqC,EAAE,IAAI,CAAC,OAAO;qBACpD;oBAED,+DAAO,IAAI,CAAC,WAAW,EAAE,CAAQ;oBACjC,8DACE,KAAK,EAAC,wBAAwB,EAC9B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,GAClC,CACE,CACI,CACR,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\n\ninterface ISingleFile {\n file: File;\n}\n\ninterface IMultipleFiles {\n files: FileList;\n}\n\nexport type SixFileUploadSuccessPayload = ISingleFile | IMultipleFiles;\n\nexport interface SixFileUploadFailurePayload {\n reason: string;\n}\n\n/**\n * @since 2.0.0\n * @status experimental\n *\n */\n@Component({\n tag: 'six-file-upload',\n styleUrl: 'six-file-upload.scss',\n scoped: true,\n shadow: false,\n})\nexport class SixFileUpload {\n @Element() readonly host!: HTMLSixFileUploadElement;\n\n private fileInput?: HTMLInputElement;\n\n @State() isOver = false;\n\n /** Set to true if file control should be small. */\n @Prop() readonly compact: boolean = false;\n\n /** Label of the drop area. */\n @Prop() readonly label?: string;\n\n /** Set when button is disabled. */\n @Prop() readonly disabled = false;\n\n /** Accepted MIME-Types. */\n @Prop() readonly accept?: string;\n\n /** More than one file allowed. */\n @Prop() readonly multiple = false;\n\n /** Allowed max file size in bytes. */\n @Prop() readonly maxFileSize?: number;\n\n /** Triggers when a file is added. */\n @Event({ eventName: 'six-file-upload-success' }) success!: EventEmitter<SixFileUploadSuccessPayload>;\n\n /** Triggers when an uploaded file doesn't match MIME type or max file size. */\n @Event({ eventName: 'six-file-upload-failure' }) failure!: EventEmitter<SixFileUploadFailurePayload>;\n\n @Listen('dragenter', { capture: false })\n dragenterHandler() {\n if (!this.disabled) {\n this.isOver = true;\n }\n }\n\n @Listen('dragover', { capture: false })\n dragoverHandler() {\n if (!this.disabled) {\n this.isOver = true;\n }\n }\n\n @Listen('dragleave', { capture: false })\n dragleaveHandler() {\n if (!this.disabled) {\n this.isOver = false;\n }\n }\n\n @Listen('drop', { capture: false })\n dropHandler({ dataTransfer }: DragEvent) {\n if (!this.disabled) {\n this.isOver = false;\n if (dataTransfer != null) {\n this.handleFiles(dataTransfer.files);\n }\n }\n }\n\n private handleFiles = (files: FileList) => {\n if (this.disabled || files.length === 0) {\n return;\n }\n\n if (!this.multiple && files.length > 1) {\n return this.failure.emit({ reason: 'Only one file is allowed.' });\n }\n\n for (const file of files) {\n if (file == null) {\n return;\n }\n\n let acceptedTypesList: string[] = [];\n if (this.accept != null) {\n acceptedTypesList = this.accept.replace(/\\s/g, '').split(',');\n }\n\n if (acceptedTypesList.length > 0 && acceptedTypesList.indexOf(file.type) === -1) {\n const reason = files.length > 1 ? 'One or more files have invalid MIME type.' : 'File has invalid MIME type.';\n return this.failure.emit({ reason });\n }\n\n if (this.maxFileSize != null && file.size > this.maxFileSize) {\n const reason = files.length > 1 ? 'One or more files are too big' : 'File is too big.';\n return this.failure.emit({ reason });\n }\n }\n\n const eventPayload: SixFileUploadSuccessPayload = this.multiple ? { files } : { file: files[0] };\n this.success.emit(eventPayload);\n };\n\n componentDidLoad() {\n ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {\n this.host.addEventListener(eventName, this.preventDefaults, false);\n document.body.addEventListener(eventName, this.preventDefaults, false);\n });\n }\n\n disconnectedCallback() {\n ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {\n this.host.removeEventListener(eventName, this.preventDefaults, false);\n document.body.removeEventListener(eventName, this.preventDefaults, false);\n });\n }\n\n private preventDefaults(e: Event) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n private onChange = () => {\n if (this.fileInput?.files != null) {\n const files = this.fileInput.files;\n this.handleFiles(files);\n this.fileInput.value = '';\n }\n };\n\n private renderLabel() {\n return (\n this.label ??\n (this.compact ? (\n 'Upload'\n ) : (\n <span>\n Drop files to upload, or <span class=\"six-file-upload__label--highlighted\">browse</span>\n </span>\n ))\n );\n }\n\n render() {\n const Container = this.compact ? 'six-button' : 'six-card';\n\n return (\n <div\n class={{\n 'six-file-upload': true,\n 'six-file-upload--disabled': this.disabled,\n }}\n >\n <Container\n class={{\n 'six-file-upload__container--compact': this.compact,\n 'six-file-upload__container--full': !this.compact,\n }}\n >\n {this.compact && (\n <span slot=\"prefix\">\n <six-icon class=\"six-file-upload__label-icon\">arrow_circle_up</six-icon>\n </span>\n )}\n <div\n class={{\n 'six-file-upload__drop-zone': true,\n 'six-file-upload__drop-zone--hover': this.isOver,\n 'six-file-upload__drop-zone--compact': this.compact,\n }}\n >\n <span>{this.renderLabel()}</span>\n <input\n class=\"six-file-upload__input\"\n type=\"file\"\n name=\"resume\"\n disabled={this.disabled}\n accept={this.accept}\n multiple={this.multiple}\n onChange={this.onChange}\n ref={(el) => (this.fileInput = el)}\n />\n </div>\n </Container>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"six-file-upload.js","sourceRoot":"","sources":["../../../src/components/six-file-upload/six-file-upload.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAgB3C;;;;;GAKG;AAOH,MAAM,OAAO,aAAa;;QAwEhB,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,SAAS,GAAG,KAAK,CAAC;YAEtB,IACE,IAAI,CAAC,SAAS,IAAI,IAAI;gBACtB,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;oBACtE,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EACnE,CAAC;gBACD,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;YAED,IAAI,CAAC,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC;QAEM,gBAAW,GAAG,CAAC,KAAe,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC1D,OAAO;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C,CAAC,CAChB,YAAM,KAAK,EAAC,+CAA+C;oBACzD,sBAAe;oCACV,CACR,CAAC,CAAC,CAAC,CACF;oBACE,gBAAO,IAAI,CAAC,WAAW,EAAE,CAAQ;oBACjC,aACE,KAAK,EAAC,wBAAwB,EAC9B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,GAClC,CACE,CACP,CACG,CACI;YACZ,2EAAkB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;gBAC/C,6DAAM,IAAI,EAAC,YAAY,IACpB,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B;oBACE,WAAK,KAAK,EAAC,6BAA6B,IAAE,IAAI,CAAO,CAC3C,CACb,CAAC,CACG,CACH,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\nimport { hasSlot } from '../../utils/slot';\n\ninterface ISingleFile {\n file: File;\n}\n\ninterface IMultipleFiles {\n files: FileList;\n}\n\nexport type SixFileUploadSuccessPayload = ISingleFile | IMultipleFiles;\n\nexport interface SixFileUploadFailurePayload {\n reason: string;\n}\n\n/**\n * @since 2.0.0\n * @status experimental\n *\n * @slot error-text - Error text that is shown when the status is set to invalid. Alternatively, you can use the error-text prop.\n */\n@Component({\n tag: 'six-file-upload',\n styleUrl: 'six-file-upload.scss',\n scoped: true,\n shadow: false,\n})\nexport class SixFileUpload {\n @Element() readonly host!: HTMLSixFileUploadElement;\n\n private fileInput?: HTMLInputElement;\n\n @State() isOver = false;\n @State() hasError = false;\n\n /** Set to true if file control should be small. */\n @Prop() readonly compact: boolean = false;\n\n /** Label of the drop area. */\n @Prop() readonly label?: string;\n\n /** Set when button is disabled. */\n @Prop() readonly disabled = false;\n\n /** Accepted MIME-Types. */\n @Prop() readonly accept?: string;\n\n /** More than one file allowed. */\n @Prop() readonly multiple = false;\n\n /** Allowed max file size in bytes. */\n @Prop() readonly maxFileSize?: number;\n\n /** Set to true to draw the control in a loading state. */\n @Prop({ reflect: true }) uploading = false;\n\n /** The error message shown, if `invalid` is set to true. */\n @Prop() errorText: string | string[] = '';\n\n /** If this property is set to true and an error message is provided by `errorText`, the error message is displayed. */\n @Prop({ reflect: true }) invalid = false;\n\n /** Triggers when a file is added. */\n @Event({ eventName: 'six-file-upload-success' }) success!: EventEmitter<SixFileUploadSuccessPayload>;\n\n /** Triggers when an uploaded file doesn't match MIME type or max file size. */\n @Event({ eventName: 'six-file-upload-failure' }) failure!: EventEmitter<SixFileUploadFailurePayload>;\n\n @Listen('dragenter', { capture: false })\n dragenterHandler() {\n if (!this.disabled) {\n this.isOver = true;\n }\n }\n\n @Listen('dragover', { capture: false })\n dragoverHandler() {\n if (!this.disabled) {\n this.isOver = true;\n }\n }\n\n @Listen('dragleave', { capture: false })\n dragleaveHandler() {\n if (!this.disabled) {\n this.isOver = false;\n }\n }\n\n @Listen('drop', { capture: false })\n dropHandler({ dataTransfer }: DragEvent) {\n if (!this.disabled) {\n this.isOver = false;\n if (dataTransfer != null) {\n this.handleFiles(dataTransfer.files);\n }\n }\n }\n\n private handleSlotChange = () => {\n let validType = false;\n\n if (\n this.errorText != null &&\n ((typeof this.errorText == 'string' && this.errorText.trim().length > 0) ||\n (typeof this.errorText == 'object' && this.errorText.length > 0))\n ) {\n validType = true;\n }\n\n this.hasError = validType || hasSlot(this.host, 'error-text');\n console.log(this.errorText);\n console.log(this.hasError);\n };\n\n private handleFiles = (files: FileList) => {\n if (this.disabled || files.length === 0 || this.uploading) {\n return;\n }\n\n if (!this.multiple && files.length > 1) {\n return this.failure.emit({ reason: 'Only one file is allowed.' });\n }\n\n for (const file of files) {\n if (file == null) {\n return;\n }\n\n let acceptedTypesList: string[] = [];\n if (this.accept != null) {\n acceptedTypesList = this.accept.replace(/\\s/g, '').split(',');\n }\n\n if (acceptedTypesList.length > 0 && acceptedTypesList.indexOf(file.type) === -1) {\n const reason = files.length > 1 ? 'One or more files have invalid MIME type.' : 'File has invalid MIME type.';\n return this.failure.emit({ reason });\n }\n\n if (this.maxFileSize != null && file.size > this.maxFileSize) {\n const reason = files.length > 1 ? 'One or more files are too big' : 'File is too big.';\n return this.failure.emit({ reason });\n }\n }\n\n const eventPayload: SixFileUploadSuccessPayload = this.multiple ? { files } : { file: files[0] };\n this.success.emit(eventPayload);\n };\n\n componentWillLoad() {\n this.handleSlotChange();\n }\n\n componentDidLoad() {\n ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {\n this.host.addEventListener(eventName, this.preventDefaults, false);\n document.body.addEventListener(eventName, this.preventDefaults, false);\n });\n this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange);\n }\n\n disconnectedCallback() {\n ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => {\n this.host.removeEventListener(eventName, this.preventDefaults, false);\n document.body.removeEventListener(eventName, this.preventDefaults, false);\n });\n this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange);\n }\n\n private preventDefaults(e: Event) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n private onChange = () => {\n if (this.fileInput?.files != null) {\n const files = this.fileInput.files;\n this.handleFiles(files);\n this.fileInput.value = '';\n }\n };\n\n private renderLabel() {\n return (\n this.label ??\n (this.compact ? (\n 'Upload'\n ) : (\n <span>\n Drop files to upload, or <span class=\"six-file-upload__label--highlighted\">browse</span>\n </span>\n ))\n );\n }\n\n render() {\n const Container = this.compact ? 'six-button' : 'six-card';\n\n const errorMessages = (Array.isArray(this.errorText) ? this.errorText : [this.errorText]).filter(\n (text) => text != null && text.trim() !== ''\n );\n\n return (\n <div\n class={{\n 'six-file-upload': true,\n 'six-file-upload--disabled': this.disabled || this.uploading,\n }}\n >\n <Container\n disabled={this.disabled || this.uploading}\n aria-invalid={this.invalid ? 'true' : 'false'}\n class={{\n 'six-file-upload__container--compact': this.compact,\n 'six-file-upload__container--full': !this.compact,\n }}\n >\n {this.compact && !this.uploading && (\n <span slot=\"prefix\">\n <six-icon class=\"six-file-upload__label-icon\">arrow_circle_up</six-icon>\n </span>\n )}\n <div\n class={{\n 'six-file-upload__drop-zone': true,\n 'six-file-upload__drop-zone--hover': this.isOver,\n 'six-file-upload__drop-zone--compact': this.compact,\n }}\n >\n {this.uploading ? (\n <span class=\"six-file-upload__drop-zone__spinner-container\">\n <six-spinner /> Uploading...\n </span>\n ) : (\n <div>\n <span>{this.renderLabel()}</span>\n <input\n class=\"six-file-upload__input\"\n type=\"file\"\n name=\"resume\"\n disabled={this.disabled}\n accept={this.accept}\n multiple={this.multiple}\n onChange={this.onChange}\n ref={(el) => (this.fileInput = el)}\n />\n </div>\n )}\n </div>\n </Container>\n <div aria-hidden={this.invalid ? 'false' : 'true'}>\n <slot name=\"error-text\">\n {errorMessages.map((text) => (\n <six-error>\n <div class=\"six-file-upload__error-text\">{text}</div>\n </six-error>\n ))}\n </slot>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -12,19 +12,22 @@ describe('six-file-upload', () => {
|
|
|
12
12
|
expect(page.root).toEqualHtml(`
|
|
13
13
|
<six-file-upload>
|
|
14
14
|
<div class="six-file-upload">
|
|
15
|
-
<six-card class="six-file-upload__container--full">
|
|
15
|
+
<six-card aria-invalid="false" class="six-file-upload__container--full">
|
|
16
16
|
<div class="six-file-upload__drop-zone">
|
|
17
|
-
<
|
|
17
|
+
<div>
|
|
18
18
|
<span>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
<span>
|
|
20
|
+
Drop files to upload, or
|
|
21
|
+
<span class="six-file-upload__label--highlighted">
|
|
22
|
+
browse
|
|
23
|
+
</span>
|
|
22
24
|
</span>
|
|
23
25
|
</span>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
27
|
+
</div>
|
|
26
28
|
</div>
|
|
27
29
|
</six-card>
|
|
30
|
+
<div aria-hidden="true"></div>
|
|
28
31
|
</div>
|
|
29
32
|
</six-file-upload>
|
|
30
33
|
`);
|
|
@@ -37,14 +40,17 @@ describe('six-file-upload', () => {
|
|
|
37
40
|
expect(page.root).toEqualHtml(`
|
|
38
41
|
<six-file-upload label="some custom label">
|
|
39
42
|
<div class="six-file-upload">
|
|
40
|
-
<six-card class="six-file-upload__container--full">
|
|
43
|
+
<six-card aria-invalid="false" class="six-file-upload__container--full">
|
|
41
44
|
<div class="six-file-upload__drop-zone">
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
<div>
|
|
46
|
+
<span>
|
|
47
|
+
some custom label
|
|
48
|
+
</span>
|
|
49
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
50
|
+
</div>
|
|
46
51
|
</div>
|
|
47
52
|
</six-card>
|
|
53
|
+
<div aria-hidden="true"></div>
|
|
48
54
|
</div>
|
|
49
55
|
</six-file-upload>
|
|
50
56
|
`);
|
|
@@ -57,19 +63,22 @@ describe('six-file-upload', () => {
|
|
|
57
63
|
expect(page.root).toEqualHtml(`
|
|
58
64
|
<six-file-upload disabled="">
|
|
59
65
|
<div class="six-file-upload six-file-upload--disabled">
|
|
60
|
-
<six-card class="six-file-upload__container--full">
|
|
66
|
+
<six-card aria-invalid="false" class="six-file-upload__container--full" disabled="">
|
|
61
67
|
<div class="six-file-upload__drop-zone">
|
|
62
|
-
<
|
|
68
|
+
<div>
|
|
63
69
|
<span>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
<span>
|
|
71
|
+
Drop files to upload, or
|
|
72
|
+
<span class="six-file-upload__label--highlighted">
|
|
73
|
+
browse
|
|
74
|
+
</span>
|
|
67
75
|
</span>
|
|
68
76
|
</span>
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
<input class="six-file-upload__input" disabled="" name="resume" type="file">
|
|
78
|
+
</div>
|
|
71
79
|
</div>
|
|
72
80
|
</six-card>
|
|
81
|
+
<div aria-hidden="true"></div>
|
|
73
82
|
</div>
|
|
74
83
|
</six-file-upload>
|
|
75
84
|
`);
|
|
@@ -82,19 +91,173 @@ describe('six-file-upload', () => {
|
|
|
82
91
|
expect(page.root).toEqualHtml(`
|
|
83
92
|
<six-file-upload compact="">
|
|
84
93
|
<div class="six-file-upload">
|
|
85
|
-
<six-button class="six-file-upload__container--compact">
|
|
94
|
+
<six-button aria-invalid="false" class="six-file-upload__container--compact">
|
|
86
95
|
<span slot="prefix">
|
|
87
96
|
<six-icon class="six-file-upload__label-icon">
|
|
88
97
|
arrow_circle_up
|
|
89
98
|
</six-icon>
|
|
90
99
|
</span>
|
|
91
100
|
<div class="six-file-upload__drop-zone six-file-upload__drop-zone--compact">
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
<div>
|
|
102
|
+
<span>
|
|
103
|
+
Upload
|
|
104
|
+
</span>
|
|
105
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</six-button>
|
|
109
|
+
<div aria-hidden="true"></div>
|
|
110
|
+
</div>
|
|
111
|
+
</six-file-upload>
|
|
112
|
+
`);
|
|
113
|
+
});
|
|
114
|
+
it('renders compact and disabled', async () => {
|
|
115
|
+
const page = await newSpecPage({
|
|
116
|
+
components: [SixFileUpload],
|
|
117
|
+
html: `<six-file-upload compact disabled></six-file-upload>`,
|
|
118
|
+
});
|
|
119
|
+
expect(page.root).toEqualHtml(`
|
|
120
|
+
<six-file-upload compact="" disabled="">
|
|
121
|
+
<div class="six-file-upload six-file-upload--disabled">
|
|
122
|
+
<six-button aria-invalid="false" class="six-file-upload__container--compact" disabled="">
|
|
123
|
+
<span slot="prefix">
|
|
124
|
+
<six-icon class="six-file-upload__label-icon">
|
|
125
|
+
arrow_circle_up
|
|
126
|
+
</six-icon>
|
|
127
|
+
</span>
|
|
128
|
+
<div class="six-file-upload__drop-zone six-file-upload__drop-zone--compact">
|
|
129
|
+
<div>
|
|
130
|
+
<span>
|
|
131
|
+
Upload
|
|
132
|
+
</span>
|
|
133
|
+
<input class="six-file-upload__input" disabled="" name="resume" type="file">
|
|
134
|
+
</div>
|
|
96
135
|
</div>
|
|
97
136
|
</six-button>
|
|
137
|
+
<div aria-hidden="true"></div>
|
|
138
|
+
</div>
|
|
139
|
+
</six-file-upload>
|
|
140
|
+
`);
|
|
141
|
+
});
|
|
142
|
+
it('renders uploading', async () => {
|
|
143
|
+
const page = await newSpecPage({
|
|
144
|
+
components: [SixFileUpload],
|
|
145
|
+
html: `<six-file-upload uploading></six-file-upload>`,
|
|
146
|
+
});
|
|
147
|
+
expect(page.root).toEqualHtml(`
|
|
148
|
+
<six-file-upload uploading="">
|
|
149
|
+
<div class="six-file-upload six-file-upload--disabled">
|
|
150
|
+
<six-card aria-invalid="false" class="six-file-upload__container--full" disabled="">
|
|
151
|
+
<div class="six-file-upload__drop-zone">
|
|
152
|
+
<span class="six-file-upload__drop-zone__spinner-container">
|
|
153
|
+
<six-spinner></six-spinner>
|
|
154
|
+
Uploading...
|
|
155
|
+
</span>
|
|
156
|
+
</div>
|
|
157
|
+
</six-card>
|
|
158
|
+
<div aria-hidden="true"></div>
|
|
159
|
+
</div>
|
|
160
|
+
</six-file-upload>
|
|
161
|
+
`);
|
|
162
|
+
});
|
|
163
|
+
it('renders invalid', async () => {
|
|
164
|
+
const page = await newSpecPage({
|
|
165
|
+
components: [SixFileUpload],
|
|
166
|
+
html: `<six-file-upload invalid error-text="error message"></six-file-upload>`,
|
|
167
|
+
});
|
|
168
|
+
expect(page.root).toEqualHtml(`
|
|
169
|
+
<six-file-upload invalid error-text="error message">
|
|
170
|
+
<div class="six-file-upload">
|
|
171
|
+
<six-card aria-invalid="true" class="six-file-upload__container--full">
|
|
172
|
+
<div class="six-file-upload__drop-zone">
|
|
173
|
+
<div>
|
|
174
|
+
<span>
|
|
175
|
+
<span>
|
|
176
|
+
Drop files to upload, or
|
|
177
|
+
<span class="six-file-upload__label--highlighted">
|
|
178
|
+
browse
|
|
179
|
+
</span>
|
|
180
|
+
</span>
|
|
181
|
+
</span>
|
|
182
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</six-card>
|
|
186
|
+
<div aria-hidden="false">
|
|
187
|
+
<slot-fb name="error-text">
|
|
188
|
+
<six-error>
|
|
189
|
+
<div class="six-file-upload__error-text">error message</div>
|
|
190
|
+
</six-error>
|
|
191
|
+
</slot-fb>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</six-file-upload>
|
|
195
|
+
`);
|
|
196
|
+
});
|
|
197
|
+
it('does not render error message if not invalid', async () => {
|
|
198
|
+
const page = await newSpecPage({
|
|
199
|
+
components: [SixFileUpload],
|
|
200
|
+
html: `<six-file-upload error-text="error message"></six-file-upload>`,
|
|
201
|
+
});
|
|
202
|
+
expect(page.root).toEqualHtml(`
|
|
203
|
+
<six-file-upload error-text="error message">
|
|
204
|
+
<div class="six-file-upload">
|
|
205
|
+
<six-card aria-invalid="false" class="six-file-upload__container--full">
|
|
206
|
+
<div class="six-file-upload__drop-zone">
|
|
207
|
+
<div>
|
|
208
|
+
<span>
|
|
209
|
+
<span>
|
|
210
|
+
Drop files to upload, or
|
|
211
|
+
<span class="six-file-upload__label--highlighted">
|
|
212
|
+
browse
|
|
213
|
+
</span>
|
|
214
|
+
</span>
|
|
215
|
+
</span>
|
|
216
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</six-card>
|
|
220
|
+
<div aria-hidden="true">
|
|
221
|
+
<slot-fb name="error-text">
|
|
222
|
+
<six-error>
|
|
223
|
+
<div class="six-file-upload__error-text">error message</div>
|
|
224
|
+
</six-error>
|
|
225
|
+
</slot-fb>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</six-file-upload>
|
|
229
|
+
`);
|
|
230
|
+
});
|
|
231
|
+
it('render error slot when invalid', async () => {
|
|
232
|
+
const page = await newSpecPage({
|
|
233
|
+
components: [SixFileUpload],
|
|
234
|
+
html: `<six-file-upload invalid><slot name="error-text"><b>bold error</b></six-file-upload>`,
|
|
235
|
+
});
|
|
236
|
+
expect(page.root).toEqualHtml(`
|
|
237
|
+
<six-file-upload invalid>
|
|
238
|
+
<slot hidden="" name="error-text">
|
|
239
|
+
<b>
|
|
240
|
+
bold error
|
|
241
|
+
</b>
|
|
242
|
+
</slot>
|
|
243
|
+
<div class="six-file-upload">
|
|
244
|
+
<six-card aria-invalid="true" class="six-file-upload__container--full">
|
|
245
|
+
<div class="six-file-upload__drop-zone">
|
|
246
|
+
<div>
|
|
247
|
+
<span>
|
|
248
|
+
<span>
|
|
249
|
+
Drop files to upload, or
|
|
250
|
+
<span class="six-file-upload__label--highlighted">
|
|
251
|
+
browse
|
|
252
|
+
</span>
|
|
253
|
+
</span>
|
|
254
|
+
</span>
|
|
255
|
+
<input class="six-file-upload__input" name="resume" type="file">
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</six-card>
|
|
259
|
+
<div aria-hidden="false">
|
|
260
|
+
</div>
|
|
98
261
|
</div>
|
|
99
262
|
</six-file-upload>
|
|
100
263
|
`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-file-upload.spec.js","sourceRoot":"","sources":["../../../../src/components/six-file-upload/test/six-file-upload.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,IAAI,EAAE,qCAAqC;SAC5C,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;KAkB7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,IAAI,EAAE,+DAA+D;SACtE,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;KAa7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAChC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,IAAI,EAAE,8CAA8C;SACrD,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;KAkB7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,IAAI,EAAE,6CAA6C;SACpD,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;KAkB7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SixFileUpload } from '../six-file-upload';\nimport { newSpecPage } from '@stencil/core/testing';\n\ndescribe('six-file-upload', () => {\n it('should create a component instance', () => {\n expect(new SixFileUpload()).toBeInstanceOf(SixFileUpload);\n });\n\n it('renders minimal six-file-upload', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload>\n <div class=\"six-file-upload\">\n <six-card class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </six-card>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders custom label', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload label=\"some custom label\"></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload label=\"some custom label\">\n <div class=\"six-file-upload\">\n <six-card class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <span>\n some custom label\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </six-card>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders disabled', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload disabled></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload disabled=\"\">\n <div class=\"six-file-upload six-file-upload--disabled\">\n <six-card class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" disabled=\"\" name=\"resume\" type=\"file\">\n </div>\n </six-card>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders compact', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload compact></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload compact=\"\">\n <div class=\"six-file-upload\">\n <six-button class=\"six-file-upload__container--compact\">\n <span slot=\"prefix\">\n <six-icon class=\"six-file-upload__label-icon\">\n arrow_circle_up\n </six-icon>\n </span>\n <div class=\"six-file-upload__drop-zone six-file-upload__drop-zone--compact\">\n <span>\n Upload\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </six-button>\n </div>\n </six-file-upload>\n `);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"six-file-upload.spec.js","sourceRoot":"","sources":["../../../../src/components/six-file-upload/test/six-file-upload.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC,CAAC,C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,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,IAAI,EAAE,sFAAsF;SAC7F,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SixFileUpload } from '../six-file-upload';\nimport { newSpecPage } from '@stencil/core/testing';\n\ndescribe('six-file-upload', () => {\n it('should create a component instance', () => {\n expect(new SixFileUpload()).toBeInstanceOf(SixFileUpload);\n });\n\n it('renders minimal six-file-upload', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload>\n <div class=\"six-file-upload\">\n <six-card aria-invalid=\"false\" class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders custom label', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload label=\"some custom label\"></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload label=\"some custom label\">\n <div class=\"six-file-upload\">\n <six-card aria-invalid=\"false\" class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n some custom label\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders disabled', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload disabled></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload disabled=\"\">\n <div class=\"six-file-upload six-file-upload--disabled\">\n <six-card aria-invalid=\"false\" class=\"six-file-upload__container--full\" disabled=\"\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" disabled=\"\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders compact', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload compact></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload compact=\"\">\n <div class=\"six-file-upload\">\n <six-button aria-invalid=\"false\" class=\"six-file-upload__container--compact\">\n <span slot=\"prefix\">\n <six-icon class=\"six-file-upload__label-icon\">\n arrow_circle_up\n </six-icon>\n </span>\n <div class=\"six-file-upload__drop-zone six-file-upload__drop-zone--compact\">\n <div>\n <span>\n Upload\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-button>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders compact and disabled', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload compact disabled></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload compact=\"\" disabled=\"\">\n <div class=\"six-file-upload six-file-upload--disabled\">\n <six-button aria-invalid=\"false\" class=\"six-file-upload__container--compact\" disabled=\"\">\n <span slot=\"prefix\">\n <six-icon class=\"six-file-upload__label-icon\">\n arrow_circle_up\n </six-icon>\n </span>\n <div class=\"six-file-upload__drop-zone six-file-upload__drop-zone--compact\">\n <div>\n <span>\n Upload\n </span>\n <input class=\"six-file-upload__input\" disabled=\"\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-button>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders uploading', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload uploading></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload uploading=\"\">\n <div class=\"six-file-upload six-file-upload--disabled\">\n <six-card aria-invalid=\"false\" class=\"six-file-upload__container--full\" disabled=\"\">\n <div class=\"six-file-upload__drop-zone\">\n <span class=\"six-file-upload__drop-zone__spinner-container\">\n <six-spinner></six-spinner>\n Uploading...\n </span>\n </div>\n </six-card>\n <div aria-hidden=\"true\"></div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('renders invalid', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload invalid error-text=\"error message\"></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload invalid error-text=\"error message\">\n <div class=\"six-file-upload\">\n <six-card aria-invalid=\"true\" class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"false\">\n <slot-fb name=\"error-text\">\n <six-error>\n <div class=\"six-file-upload__error-text\">error message</div>\n </six-error>\n </slot-fb>\n </div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('does not render error message if not invalid', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload error-text=\"error message\"></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload error-text=\"error message\">\n <div class=\"six-file-upload\">\n <six-card aria-invalid=\"false\" class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"true\">\n <slot-fb name=\"error-text\">\n <six-error>\n <div class=\"six-file-upload__error-text\">error message</div>\n </six-error>\n </slot-fb>\n </div>\n </div>\n </six-file-upload>\n `);\n });\n\n it('render error slot when invalid', async () => {\n const page = await newSpecPage({\n components: [SixFileUpload],\n html: `<six-file-upload invalid><slot name=\"error-text\"><b>bold error</b></six-file-upload>`,\n });\n\n expect(page.root).toEqualHtml(`\n <six-file-upload invalid>\n <slot hidden=\"\" name=\"error-text\">\n <b>\n bold error\n </b>\n </slot>\n <div class=\"six-file-upload\">\n <six-card aria-invalid=\"true\" class=\"six-file-upload__container--full\">\n <div class=\"six-file-upload__drop-zone\">\n <div>\n <span>\n <span>\n Drop files to upload, or\n <span class=\"six-file-upload__label--highlighted\">\n browse\n </span>\n </span>\n </span>\n <input class=\"six-file-upload__input\" name=\"resume\" type=\"file\">\n </div>\n </div>\n </six-card>\n <div aria-hidden=\"false\">\n </div>\n </div>\n </six-file-upload>\n `);\n });\n});\n"]}
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
.language-switcher__label:hover {
|
|
11
11
|
color: var(--six-color-web-rock-600);
|
|
12
12
|
}
|
|
13
|
+
.language-switcher__label:focus-visible {
|
|
14
|
+
outline: var(--six-focus-ring);
|
|
15
|
+
outline-offset: var(--six-focus-ring-offset);
|
|
16
|
+
}
|
|
13
17
|
.language-switcher__label--selected {
|
|
14
18
|
color: var(--six-color-black);
|
|
15
19
|
text-decoration: underline;
|
|
@@ -46,7 +46,11 @@ export class SixLanguageSwitcher {
|
|
|
46
46
|
render() {
|
|
47
47
|
return (h("div", { key: '64f80894523a4b03643949135f18b553cd0517b6', part: "container", class: "language-switcher__container" }, this.languages.map((lang, index) => {
|
|
48
48
|
const language = typeof lang === 'string' ? lang : lang.key;
|
|
49
|
-
return (h("div", { onClick: this.handleLanguageSwitching(language, typeof lang === 'string' ? lang : lang.value)
|
|
49
|
+
return (h("div", { onClick: this.handleLanguageSwitching(language, typeof lang === 'string' ? lang : lang.value), onKeyDown: (e) => {
|
|
50
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
51
|
+
this.handleLanguageSwitching(language, typeof lang === 'string' ? lang : lang.value)();
|
|
52
|
+
}
|
|
53
|
+
} }, h("span", { part: "label", tabindex: "0", class: {
|
|
50
54
|
'language-switcher__label': true,
|
|
51
55
|
'language-switcher__label--selected': this.selected === language,
|
|
52
56
|
} }, language), index < this.languages.length - 1 && (h("span", { part: "separator", class: "language-switcher__separator" }, "|"))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"six-language-switcher.js","sourceRoot":"","sources":["../../../src/components/six-language-switcher/six-language-switcher.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAa/E,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE7C;;;;;;GAMG;AAMH,MAAM,OAAO,mBAAmB;;QAqCtB,4BAAuB,GAAG,CAAC,WAAmB,EAAE,aAAsB,EAAE,EAAE,CAAC,GAAG,EAAE;YACtF,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnC,CAAC;YACD,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;QAC9B,CAAC,CAAC;;yBAvCyD,iBAAiB;;IAG5E,sBAAsB,CAAC,QAAkB;QACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAMD,iBAAiB;QACf,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IAEO,sBAAsB;QAC5B,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YACzC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;YACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC;YACrC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAWD,MAAM;QACJ,OAAO,CACL,4DAAK,IAAI,EAAC,WAAW,EAAC,KAAK,EAAC,8BAA8B,IACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAClC,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5D,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"six-language-switcher.js","sourceRoot":"","sources":["../../../src/components/six-language-switcher/six-language-switcher.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAa/E,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE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ter, h, Prop, Watch } from '@stencil/core';\n\n/**\n * @since 2.1.0\n * @status experimental\n **/\n\nexport interface SixLanguageSwitcherInput {\n key: string;\n value: string;\n}\nexport type SixLanguageSwitcherChangePayload = string;\n\nconst DEFAULT_LANGUAGES = ['EN', 'DE', 'ES'];\n\n/*\n * @since 2.2.0\n * @status experimental\n * @part container - The whole component container\n * @part label - The language label\n * @part separator - The separator between the language labels\n */\n@Component({\n tag: 'six-language-switcher',\n styleUrl: 'six-language-switcher.scss',\n shadow: true,\n})\nexport class SixLanguageSwitcher {\n /** The language which should be shown as selected */\n @Prop({ mutable: true, reflect: true }) selected?: string;\n\n /** The languages which should be selectable options. */\n @Prop() languages: string[] | SixLanguageSwitcherInput[] = DEFAULT_LANGUAGES;\n\n @Watch('languages')\n handleChangesLanguages(newValue: string[]) {\n if (!Array.isArray(newValue)) {\n throw new Error('languages is expected to be an array');\n }\n\n this.updateSelectedLanguage();\n }\n /**\n * Emitted when the language switchers value changes\n */\n @Event({ eventName: 'six-language-switcher-change' }) sixChange!: EventEmitter<SixLanguageSwitcherChangePayload>;\n\n componentWillLoad() {\n if (this.selected === undefined) {\n this.updateSelectedLanguage();\n }\n }\n\n private updateSelectedLanguage() {\n const selectedLanguage = this.languages[0];\n if (typeof selectedLanguage === 'string') {\n this.selected = selectedLanguage;\n this.sixChange.emit(this.selected);\n } else {\n this.selected = selectedLanguage.key;\n this.sixChange.emit(selectedLanguage.value);\n }\n }\n\n private handleLanguageSwitching = (newLanguage: string, languageValue?: string) => () => {\n if (languageValue !== undefined) {\n this.sixChange.emit(languageValue);\n } else {\n this.sixChange.emit(newLanguage);\n }\n this.selected = newLanguage;\n };\n\n render() {\n return (\n <div part=\"container\" class=\"language-switcher__container\">\n {this.languages.map((lang, index) => {\n const language = typeof lang === 'string' ? lang : lang.key;\n return (\n <div\n onClick={this.handleLanguageSwitching(language, typeof lang === 'string' ? lang : lang.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n this.handleLanguageSwitching(language, typeof lang === 'string' ? lang : lang.value)();\n }\n }}\n >\n <span\n part=\"label\"\n tabindex=\"0\"\n class={{\n 'language-switcher__label': true,\n 'language-switcher__label--selected': this.selected === language,\n }}\n >\n {language}\n </span>\n\n {index < this.languages.length - 1 && (\n <span part=\"separator\" class=\"language-switcher__separator\">\n |\n </span>\n )}\n </div>\n );\n })}\n </div>\n );\n }\n}\n"]}
|