@duetds/components 4.31.0 → 4.33.2
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/hydrate/index.js +1895 -77
- package/lib/cjs/{dom-e89ebf90.js → dom-c850c8d7.js} +1 -1
- package/lib/cjs/duet-alert.cjs.entry.js +2 -2
- package/lib/cjs/duet-badge.cjs.entry.js +1 -1
- package/lib/cjs/duet-button_2.cjs.entry.js +4 -4
- package/lib/cjs/duet-caption_4.cjs.entry.js +17 -10
- package/lib/cjs/duet-card.cjs.entry.js +5 -5
- package/lib/cjs/duet-checkbox.cjs.entry.js +2 -2
- package/lib/cjs/duet-choice_2.cjs.entry.js +53 -24
- package/lib/cjs/duet-collapsible.cjs.entry.js +4 -449
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +7 -7
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-editable-table-button.cjs.entry.js +89 -0
- package/lib/cjs/duet-editable-table_4.cjs.entry.js +1445 -0
- package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
- package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
- package/lib/cjs/duet-footer.cjs.entry.js +2 -2
- package/lib/cjs/duet-grid_2.cjs.entry.js +69 -4
- package/lib/cjs/duet-header_2.cjs.entry.js +3 -3
- package/lib/cjs/duet-hero.cjs.entry.js +2 -2
- package/lib/cjs/duet-icon.cjs.entry.js +5 -13
- package/lib/cjs/duet-input_2.cjs.entry.js +6 -6
- package/lib/cjs/duet-layout.cjs.entry.js +1 -1
- package/lib/cjs/duet-list_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-modal.cjs.entry.js +3 -3
- package/lib/cjs/duet-notification_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-number-input.cjs.entry.js +2 -2
- package/lib/cjs/duet-progress.cjs.entry.js +75 -0
- package/lib/cjs/duet-radio_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
- package/lib/cjs/duet-select.cjs.entry.js +5 -5
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-tab_2.cjs.entry.js +3 -3
- package/lib/cjs/duet-textarea.cjs.entry.js +5 -5
- package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
- package/lib/cjs/duet-tooltip.cjs.entry.js +2 -2
- package/lib/cjs/duet-tray.cjs.entry.js +3 -3
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +100 -0
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +4 -4
- package/lib/cjs/{focus-utils-bd331feb.js → focus-utils-27c696bb.js} +1 -1
- package/lib/cjs/{index-113c2add.js → index-18b0f43a.js} +91 -77
- package/lib/cjs/{language-utils-48b8860b.js → language-utils-aa282901.js} +6 -2
- package/lib/cjs/loader.cjs.js +3 -3
- package/lib/cjs/{shadow-css-0c8c175b.js → shadow-css-e3edeed1.js} +9 -10
- package/lib/cjs/{token-utils-13e5d13e.js → token-utils-63a9c8dc.js} +1 -1
- package/lib/cjs/tokens-8596cece.js +459 -0
- package/lib/cjs/{tokens.module-53b3bd92.js → tokens.module-6b2df1c2.js} +2 -0
- package/lib/cjs/{watch-options-3877c082.js → watch-options-d88afac0.js} +29 -6
- package/lib/collection/collection-manifest.json +17 -3
- package/lib/collection/components/duet-alert/duet-alert.js +4 -4
- package/lib/collection/components/duet-button/duet-button.js +10 -10
- package/lib/collection/components/duet-card/duet-card.css +20 -0
- package/lib/collection/components/duet-card/duet-card.js +4 -1
- package/lib/collection/components/duet-checkbox/duet-checkbox.css +1 -1
- package/lib/collection/components/duet-choice/duet-choice.css +16 -3
- package/lib/collection/components/duet-choice/duet-choice.js +117 -33
- package/lib/collection/components/duet-choice-group/duet-choice-group.js +4 -4
- package/lib/collection/components/duet-date-picker/duet-date-picker.js +16 -16
- package/lib/collection/components/duet-editable-table/duet-editable-table-button.css +32 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +218 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table-item.css +36 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +203 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +13 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table.css +16 -0
- package/lib/collection/components/duet-editable-table/duet-editable-table.js +348 -0
- package/lib/collection/components/duet-footer/duet-footer.js +10 -10
- package/lib/collection/components/duet-grid/duet-grid.js +74 -6
- package/lib/collection/components/duet-grid-item/duet-grid-item.js +4 -4
- package/lib/collection/components/duet-header/duet-header.js +16 -16
- package/lib/collection/components/duet-heading/duet-heading.css +3 -0
- package/lib/collection/components/duet-heading/duet-heading.js +7 -6
- package/lib/collection/components/duet-hero/duet-hero.js +8 -8
- package/lib/collection/components/duet-icon/icon-utils.js +5 -8
- package/lib/collection/components/duet-input/duet-input.css +15 -0
- package/lib/collection/components/duet-input/duet-input.js +4 -4
- package/lib/collection/components/duet-link/duet-link.js +8 -8
- package/lib/collection/components/duet-logo/duet-logo.js +4 -4
- package/lib/collection/components/duet-modal/duet-modal.js +8 -8
- package/lib/collection/components/duet-notification/duet-notification.js +8 -8
- package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +8 -8
- package/lib/collection/components/duet-number-input/duet-number-input.js +20 -20
- package/lib/collection/components/duet-paragraph/duet-paragraph.css +6 -0
- package/lib/collection/components/duet-paragraph/duet-paragraph.js +34 -3
- package/lib/collection/components/duet-progress/duet-progress.css +103 -0
- package/lib/collection/components/duet-progress/duet-progress.js +240 -0
- package/lib/collection/components/duet-radio/duet-radio.js +6 -6
- package/lib/collection/components/duet-select/duet-select.css +15 -0
- package/lib/collection/components/duet-select/duet-select.js +3 -3
- package/lib/collection/components/duet-step/duet-step.js +8 -8
- package/lib/collection/components/duet-tab-group/duet-tab-group.css +2 -2
- package/lib/collection/components/duet-tab-group/duet-tab-group.js +10 -10
- package/lib/collection/components/duet-textarea/duet-textarea.css +19 -0
- package/lib/collection/components/duet-textarea/duet-textarea.js +5 -4
- package/lib/collection/components/duet-tooltip/duet-tooltip.js +14 -14
- package/lib/collection/components/duet-tray/duet-tray.js +12 -12
- package/lib/collection/components/duet-upload/duet-upload.css +64 -0
- package/lib/collection/components/duet-upload/duet-upload.js +1863 -0
- package/lib/collection/components/duet-upload/errorcodes.utils.js +32 -0
- package/lib/collection/components/duet-upload/mock.helpers.js +91 -0
- package/lib/collection/components/duet-upload/upload-editable-item-error.js +16 -0
- package/lib/collection/components/duet-upload/upload-editable-item-inprogres.js +8 -0
- package/lib/collection/components/duet-upload/upload-editable-item-success.js +30 -0
- package/lib/collection/components/duet-upload/upload-validators.js +93 -0
- package/lib/collection/components/duet-upload/upload.helpers.js +13 -0
- package/lib/collection/components/duet-upload/xhr.helpers.js +30 -0
- package/lib/collection/components/duet-upload-aria-status/duet-upload-aria-status.js +217 -0
- package/lib/collection/utils/js-utils.js +12 -0
- package/lib/collection/utils/language-utils.js +6 -3
- package/lib/collection/utils/watch-options.js +35 -6
- package/lib/custom-elements-bundle/index.d.ts +36 -0
- package/lib/custom-elements-bundle/index.js +2014 -322
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-60ab57d4.entry.js → p-042ec8b1.entry.js} +1 -1
- package/lib/duet/{p-bcae23fc.system.entry.js → p-0435b54a.system.entry.js} +1 -1
- package/lib/duet/{p-dc85d2a4.entry.js → p-04b3e682.entry.js} +1 -1
- package/lib/duet/p-0ac2e60d.system.entry.js +4 -0
- package/lib/duet/p-0d22396e.system.js +16 -0
- package/lib/duet/p-1082d9f2.system.entry.js +4 -0
- package/lib/duet/p-12721178.js +4 -0
- package/lib/duet/{p-7d080785.system.entry.js → p-12fc4849.system.entry.js} +1 -1
- package/lib/duet/{p-c4737f88.entry.js → p-15fae689.entry.js} +1 -1
- package/lib/duet/p-1ad58142.entry.js +4 -0
- package/lib/duet/{p-c5f10483.system.entry.js → p-1c7d7cdd.system.entry.js} +1 -1
- package/lib/duet/p-1cf8dbc7.system.js +4 -0
- package/lib/duet/p-1dcbd837.system.entry.js +4 -0
- package/lib/duet/{p-fdecaf46.entry.js → p-1ecddc1d.entry.js} +1 -1
- package/lib/duet/p-2764f081.js +4 -0
- package/lib/duet/p-2b4bd1b2.system.entry.js +4 -0
- package/lib/duet/p-2d8e0faa.system.entry.js +4 -0
- package/lib/duet/{p-453955cc.system.entry.js → p-33538e90.system.entry.js} +1 -1
- package/lib/duet/{p-b1b8e510.entry.js → p-3364cfd2.entry.js} +1 -1
- package/lib/duet/p-350cea4e.system.entry.js +4 -0
- package/lib/duet/{p-bd9a7d8f.js → p-35a3794e.js} +0 -0
- package/lib/duet/p-39e9d638.entry.js +4 -0
- package/lib/duet/{p-1e7222c2.entry.js → p-3a7e519e.entry.js} +1 -1
- package/lib/duet/{p-9ce1baab.system.entry.js → p-3bcf2054.system.entry.js} +1 -1
- package/lib/duet/{p-322d1c38.js → p-3c1971d8.js} +1 -1
- package/lib/duet/{p-ef45cfe9.system.entry.js → p-3cad13af.system.entry.js} +1 -1
- package/lib/duet/p-408e8cdb.system.js +4 -0
- package/lib/duet/p-4a14da52.entry.js +4 -0
- package/lib/duet/{p-f96c4093.system.entry.js → p-4e17a6cb.system.entry.js} +1 -1
- package/lib/duet/{p-fbd83d67.entry.js → p-50b796eb.entry.js} +1 -1
- package/lib/duet/{p-22f56356.system.entry.js → p-5727cd82.system.entry.js} +1 -1
- package/lib/duet/{p-9c94be45.entry.js → p-582f3a2c.entry.js} +1 -1
- package/lib/duet/{p-e39471b6.entry.js → p-5b9621e2.entry.js} +1 -1
- package/lib/duet/{p-3e1ef509.system.entry.js → p-5f79eff8.system.entry.js} +1 -1
- package/lib/duet/{p-95626e7e.system.entry.js → p-60e721aa.system.entry.js} +1 -1
- package/lib/duet/{p-b03a46b6.entry.js → p-60ef3d05.entry.js} +1 -1
- package/lib/duet/{p-57ea2576.system.js → p-61fc3872.system.js} +1 -1
- package/lib/duet/{p-1cd7177f.entry.js → p-637df820.entry.js} +1 -1
- package/lib/duet/{p-07263910.system.entry.js → p-6402041d.system.entry.js} +1 -1
- package/lib/duet/p-64c0aa2a.entry.js +4 -0
- package/lib/duet/{p-28b67b94.entry.js → p-65451003.entry.js} +1 -1
- package/lib/duet/{p-1bfbc988.entry.js → p-659d6cb7.entry.js} +1 -1
- package/lib/duet/{p-91fa68a5.js → p-66fdebc5.js} +1 -1
- package/lib/duet/p-6708db8a.entry.js +4 -0
- package/lib/duet/{p-e08b8909.entry.js → p-68635a1c.entry.js} +1 -1
- package/lib/duet/p-6e363557.system.js +4 -0
- package/lib/duet/p-70fafc98.system.js +4 -0
- package/lib/duet/p-720a36f2.entry.js +4 -0
- package/lib/duet/{p-f53c8019.entry.js → p-72629304.entry.js} +1 -1
- package/lib/duet/p-75a104e3.entry.js +4 -0
- package/lib/duet/{p-02ad46a0.system.entry.js → p-75e5d4d1.system.entry.js} +1 -1
- package/lib/duet/{p-33cf6ed1.entry.js → p-7ab0bad8.entry.js} +1 -1
- package/lib/duet/{p-e834c8d5.system.entry.js → p-7ceaf4ef.system.entry.js} +1 -1
- package/lib/duet/{p-a1d12e94.system.entry.js → p-7f8cce41.system.entry.js} +1 -1
- package/lib/duet/{p-6d2da245.entry.js → p-7fed7f57.entry.js} +1 -1
- package/lib/duet/p-8143f3de.js +4 -0
- package/lib/duet/p-8c2f14d8.system.entry.js +4 -0
- package/lib/duet/{p-4670a654.entry.js → p-8c730326.entry.js} +1 -1
- package/lib/duet/{p-de093c16.entry.js → p-9125ed25.entry.js} +1 -1
- package/lib/duet/p-933c2774.system.entry.js +4 -0
- package/lib/duet/{p-b7e50cfa.entry.js → p-9584411c.entry.js} +1 -1
- package/lib/duet/p-987edcd0.js +15 -0
- package/lib/duet/p-9930e52e.entry.js +4 -0
- package/lib/duet/p-9a09ac2b.system.entry.js +4 -0
- package/lib/duet/{p-64109493.entry.js → p-a09ddd8f.entry.js} +1 -1
- package/lib/duet/{p-504dbf8f.system.entry.js → p-a2b2fa13.system.entry.js} +1 -1
- package/lib/duet/{p-2826f987.js → p-ad07f399.js} +1 -1
- package/lib/duet/{p-605bc214.system.entry.js → p-b1ad7a52.system.entry.js} +1 -1
- package/lib/duet/{p-f0b1850a.system.entry.js → p-b5dc29b8.system.entry.js} +1 -1
- package/lib/duet/p-ba6214be.entry.js +4 -0
- package/lib/duet/{p-92d38668.system.entry.js → p-be349a3d.system.entry.js} +1 -1
- package/lib/duet/{p-56e172f5.system.entry.js → p-c0f3f60f.system.entry.js} +1 -1
- package/lib/duet/{p-fd98468a.system.js → p-c18a599e.system.js} +0 -0
- package/lib/duet/p-c3c95a34.system.entry.js +4 -0
- package/lib/duet/{p-d4b4bfa6.entry.js → p-c506017d.entry.js} +1 -1
- package/lib/duet/p-c74cecf2.system.entry.js +4 -0
- package/lib/duet/p-c9a11360.entry.js +4 -0
- package/lib/duet/p-cd21755b.entry.js +4 -0
- package/lib/duet/p-cd597d62.system.entry.js +4 -0
- package/lib/duet/p-cff461b6.entry.js +4 -0
- package/lib/duet/{p-7b6db837.system.entry.js → p-d0fb19f7.system.entry.js} +1 -1
- package/lib/duet/{p-69a5dc6b.entry.js → p-d1dfa30e.entry.js} +1 -1
- package/lib/duet/{p-1cec5a70.system.entry.js → p-d4e706ac.system.entry.js} +1 -1
- package/lib/duet/{p-8cb47a70.system.entry.js → p-d5e2bb48.system.entry.js} +1 -1
- package/lib/duet/p-dd79932a.entry.js +4 -0
- package/lib/duet/p-dd9b8fcb.system.entry.js +4 -0
- package/lib/duet/p-ddb6344c.system.js +4 -0
- package/lib/duet/{p-47645ea8.system.entry.js → p-de43620d.system.entry.js} +1 -1
- package/lib/duet/p-e038da47.system.entry.js +4 -0
- package/lib/duet/p-eb55ccd2.system.js +4 -0
- package/lib/duet/p-ebc4e334.js +4 -0
- package/lib/duet/{p-5fc7e1f7.system.entry.js → p-f37ffb6f.system.entry.js} +1 -1
- package/lib/duet/p-f8744611.entry.js +4 -0
- package/lib/duet/p-fa99eaa4.system.js +4 -0
- package/lib/duet/{p-746655ba.entry.js → p-fd00b025.entry.js} +1 -1
- package/lib/esm/{dom-21034390.js → dom-58cd15f6.js} +1 -1
- package/lib/esm/duet-alert.entry.js +2 -2
- package/lib/esm/duet-badge.entry.js +1 -1
- package/lib/esm/duet-button_2.entry.js +4 -4
- package/lib/esm/duet-caption_4.entry.js +17 -10
- package/lib/esm/duet-card.entry.js +5 -5
- package/lib/esm/duet-checkbox.entry.js +2 -2
- package/lib/esm/duet-choice_2.entry.js +54 -25
- package/lib/esm/duet-collapsible.entry.js +3 -448
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +7 -7
- package/lib/esm/duet-divider_2.entry.js +1 -1
- package/lib/esm/duet-editable-table-button.entry.js +85 -0
- package/lib/esm/duet-editable-table_4.entry.js +1438 -0
- package/lib/esm/duet-empty-state.entry.js +1 -1
- package/lib/esm/duet-fieldset.entry.js +1 -1
- package/lib/esm/duet-footer.entry.js +2 -2
- package/lib/esm/duet-grid_2.entry.js +69 -4
- package/lib/esm/duet-header_2.entry.js +3 -3
- package/lib/esm/duet-hero.entry.js +2 -2
- package/lib/esm/duet-icon.entry.js +5 -13
- package/lib/esm/duet-input_2.entry.js +6 -6
- package/lib/esm/duet-layout.entry.js +1 -1
- package/lib/esm/duet-list_2.entry.js +2 -2
- package/lib/esm/duet-modal.entry.js +3 -3
- package/lib/esm/duet-notification_2.entry.js +2 -2
- package/lib/esm/duet-number-input.entry.js +2 -2
- package/lib/esm/duet-progress.entry.js +71 -0
- package/lib/esm/duet-radio_2.entry.js +2 -2
- package/lib/esm/duet-range-slider.entry.js +2 -2
- package/lib/esm/duet-select.entry.js +5 -5
- package/lib/esm/duet-step_2.entry.js +1 -1
- package/lib/esm/duet-tab_2.entry.js +3 -3
- package/lib/esm/duet-textarea.entry.js +5 -5
- package/lib/esm/duet-toggle.entry.js +1 -1
- package/lib/esm/duet-tooltip.entry.js +2 -2
- package/lib/esm/duet-tray.entry.js +3 -3
- package/lib/esm/duet-upload-aria-status.entry.js +96 -0
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +4 -4
- package/lib/esm/{focus-utils-1995e5a9.js → focus-utils-c1fa24c4.js} +1 -1
- package/lib/esm/{index-6e246691.js → index-05e43a37.js} +91 -78
- package/lib/esm/{language-utils-d5c38f65.js → language-utils-344d894c.js} +6 -3
- package/lib/esm/loader.js +3 -3
- package/lib/esm/{shadow-css-31e2d504.js → shadow-css-7c726abb.js} +9 -10
- package/lib/esm/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
- package/lib/esm/tokens-e110dc89.js +453 -0
- package/lib/esm/{tokens.module-edb66c04.js → tokens.module-49cbf963.js} +3 -1
- package/lib/esm/watch-options-dd55bce8.js +57 -0
- package/lib/esm-es5/{dom-21034390.js → dom-58cd15f6.js} +0 -0
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-badge.entry.js +1 -1
- package/lib/esm-es5/duet-button_2.entry.js +1 -1
- package/lib/esm-es5/duet-caption_4.entry.js +2 -2
- package/lib/esm-es5/duet-card.entry.js +1 -1
- package/lib/esm-es5/duet-checkbox.entry.js +1 -1
- package/lib/esm-es5/duet-choice_2.entry.js +1 -1
- package/lib/esm-es5/duet-collapsible.entry.js +2 -2
- package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-divider_2.entry.js +1 -1
- package/lib/esm-es5/duet-editable-table-button.entry.js +4 -0
- package/lib/esm-es5/duet-editable-table_4.entry.js +4 -0
- package/lib/esm-es5/duet-empty-state.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-footer.entry.js +1 -1
- package/lib/esm-es5/duet-grid_2.entry.js +2 -2
- package/lib/esm-es5/duet-header_2.entry.js +1 -1
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-icon.entry.js +2 -2
- package/lib/esm-es5/duet-input_2.entry.js +1 -1
- package/lib/esm-es5/duet-layout.entry.js +1 -1
- package/lib/esm-es5/duet-list_2.entry.js +1 -1
- package/lib/esm-es5/duet-modal.entry.js +1 -1
- package/lib/esm-es5/duet-notification_2.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +1 -1
- package/lib/esm-es5/duet-progress.entry.js +4 -0
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-range-slider.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +1 -1
- package/lib/esm-es5/duet-step_2.entry.js +1 -1
- package/lib/esm-es5/duet-tab_2.entry.js +2 -2
- package/lib/esm-es5/duet-textarea.entry.js +1 -1
- package/lib/esm-es5/duet-toggle.entry.js +1 -1
- package/lib/esm-es5/duet-tooltip.entry.js +1 -1
- package/lib/esm-es5/duet-tray.entry.js +1 -1
- package/lib/esm-es5/duet-upload-aria-status.entry.js +4 -0
- package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/{focus-utils-1995e5a9.js → focus-utils-c1fa24c4.js} +1 -1
- package/lib/esm-es5/index-05e43a37.js +4 -0
- package/lib/esm-es5/{language-utils-d5c38f65.js → language-utils-344d894c.js} +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/shadow-css-7c726abb.js +15 -0
- package/lib/esm-es5/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
- package/lib/esm-es5/tokens-e110dc89.js +4 -0
- package/lib/esm-es5/tokens.module-49cbf963.js +4 -0
- package/lib/esm-es5/watch-options-dd55bce8.js +4 -0
- package/lib/html.html-data.json +427 -10
- package/lib/types/components/duet-choice/duet-choice.d.ts +23 -4
- package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +5 -5
- package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +72 -0
- package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +72 -0
- package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +7 -0
- package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +84 -0
- package/lib/types/components/duet-grid/duet-grid.d.ts +17 -2
- package/lib/types/components/duet-heading/duet-heading.d.ts +2 -2
- package/lib/types/components/duet-paragraph/duet-paragraph.d.ts +9 -1
- package/lib/types/components/duet-progress/duet-progress.d.ts +64 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +404 -0
- package/lib/types/components/duet-upload/errorcodes.utils.d.ts +8 -0
- package/lib/types/components/duet-upload/mock.helpers.d.ts +2 -0
- package/lib/types/components/duet-upload/upload-editable-item-error.d.ts +7 -0
- package/lib/types/components/duet-upload/upload-editable-item-inprogres.d.ts +7 -0
- package/lib/types/components/duet-upload/upload-editable-item-success.d.ts +8 -0
- package/lib/types/components/duet-upload/upload-validators.d.ts +12 -0
- package/lib/types/components/duet-upload/upload.helpers.d.ts +1 -0
- package/lib/types/components/duet-upload/xhr.helpers.d.ts +18 -0
- package/lib/types/components/duet-upload-aria-status/duet-upload-aria-status.d.ts +49 -0
- package/lib/types/components.d.ts +791 -21
- package/lib/types/utils/js-utils.d.ts +1 -0
- package/lib/types/utils/language-utils.d.ts +5 -1
- package/lib/types/utils/watch-options.d.ts +2 -0
- package/package.json +6 -6
- package/lib/cjs/duet-table.cjs.entry.js +0 -132
- package/lib/duet/p-0058512b.js +0 -4
- package/lib/duet/p-0224db45.entry.js +0 -4
- package/lib/duet/p-15c15c6a.js +0 -15
- package/lib/duet/p-202bbd70.entry.js +0 -4
- package/lib/duet/p-33426ddc.entry.js +0 -4
- package/lib/duet/p-3d3f773d.system.entry.js +0 -4
- package/lib/duet/p-3f78a826.system.js +0 -4
- package/lib/duet/p-418b2ce7.system.js +0 -4
- package/lib/duet/p-43e39d98.system.js +0 -4
- package/lib/duet/p-44ffb960.entry.js +0 -4
- package/lib/duet/p-5230ee3c.system.entry.js +0 -4
- package/lib/duet/p-5aa0d34d.entry.js +0 -4
- package/lib/duet/p-6a230911.system.entry.js +0 -4
- package/lib/duet/p-6a356ab1.system.js +0 -4
- package/lib/duet/p-6a760b8a.entry.js +0 -4
- package/lib/duet/p-712e7dde.system.entry.js +0 -4
- package/lib/duet/p-82dc2e0b.entry.js +0 -4
- package/lib/duet/p-8c8e82aa.system.js +0 -4
- package/lib/duet/p-8c980350.system.entry.js +0 -4
- package/lib/duet/p-8f03c3eb.entry.js +0 -4
- package/lib/duet/p-96808a2e.system.entry.js +0 -4
- package/lib/duet/p-96c103b2.system.entry.js +0 -4
- package/lib/duet/p-9a89ec39.js +0 -4
- package/lib/duet/p-9ff25646.entry.js +0 -4
- package/lib/duet/p-b694cbf5.system.js +0 -4
- package/lib/duet/p-b82927b0.system.entry.js +0 -4
- package/lib/duet/p-ba205dca.entry.js +0 -4
- package/lib/duet/p-be19c57b.system.entry.js +0 -4
- package/lib/duet/p-c5beceed.js +0 -4
- package/lib/duet/p-d35fd913.system.entry.js +0 -4
- package/lib/duet/p-d7623eb8.system.entry.js +0 -4
- package/lib/duet/p-de842863.entry.js +0 -4
- package/lib/duet/p-e58ca7af.system.js +0 -16
- package/lib/esm/duet-table.entry.js +0 -128
- package/lib/esm/watch-options-de55ea78.js +0 -35
- package/lib/esm-es5/duet-table.entry.js +0 -4
- package/lib/esm-es5/index-6e246691.js +0 -4
- package/lib/esm-es5/shadow-css-31e2d504.js +0 -15
- package/lib/esm-es5/tokens.module-edb66c04.js +0 -4
- package/lib/esm-es5/watch-options-de55ea78.js +0 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { getLocaleString } from "../../utils/language-utils";
|
|
5
|
+
import errorCodes from "./errorcodes.json";
|
|
6
|
+
export const getError = (code) => {
|
|
7
|
+
let error = {
|
|
8
|
+
type: undefined,
|
|
9
|
+
system_message: undefined,
|
|
10
|
+
message: undefined,
|
|
11
|
+
};
|
|
12
|
+
error = errorCodes.filter(errorItem => {
|
|
13
|
+
// the == is intentional we may be comparing numbers to strings - and that is ok here
|
|
14
|
+
return errorItem.type == code;
|
|
15
|
+
})[0];
|
|
16
|
+
if (!error) {
|
|
17
|
+
error = errorCodes.filter(errorItem => {
|
|
18
|
+
return errorItem.type === "default";
|
|
19
|
+
})[0];
|
|
20
|
+
}
|
|
21
|
+
return error;
|
|
22
|
+
};
|
|
23
|
+
export const getI18nError = (errorCode) => {
|
|
24
|
+
const errorFromJson = getError(errorCode);
|
|
25
|
+
const i18String = getLocaleString(errorFromJson.message);
|
|
26
|
+
if (i18String === "" || !i18String) {
|
|
27
|
+
return errorFromJson.system_message;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return i18String;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
/** list of mock File elements to pass the duet-upload component */
|
|
5
|
+
//mock functions to show uploaded file state
|
|
6
|
+
export function getBrowsedFiles() {
|
|
7
|
+
return fileListFromArray([
|
|
8
|
+
mockFileCreator({
|
|
9
|
+
name: "action-add-circle.svg",
|
|
10
|
+
type: "image/svg",
|
|
11
|
+
size: 234 * 1000,
|
|
12
|
+
lastModified: new Date(),
|
|
13
|
+
error: "400",
|
|
14
|
+
}),
|
|
15
|
+
mockFileCreator({
|
|
16
|
+
name: "action-arrow-down.svg",
|
|
17
|
+
type: "image/svg",
|
|
18
|
+
size: 56 * 10000,
|
|
19
|
+
lastModified: new Date(),
|
|
20
|
+
error: "401",
|
|
21
|
+
}),
|
|
22
|
+
mockFileCreator({
|
|
23
|
+
name: "action-car-transfer.svg",
|
|
24
|
+
type: "image/svg",
|
|
25
|
+
size: 56 * 100,
|
|
26
|
+
lastModified: new Date(),
|
|
27
|
+
error: "403",
|
|
28
|
+
}),
|
|
29
|
+
mockFileCreator({
|
|
30
|
+
name: "action-car-enable.svg",
|
|
31
|
+
type: "image/svg",
|
|
32
|
+
size: 12 * 100000,
|
|
33
|
+
lastModified: new Date(),
|
|
34
|
+
error: "413",
|
|
35
|
+
}),
|
|
36
|
+
mockFileCreator({ name: "action-car-disable.svg", type: "image/svg", size: 23 * 1000, lastModified: new Date() }),
|
|
37
|
+
mockFileCreator({
|
|
38
|
+
name: "action-buy-insurance.svg",
|
|
39
|
+
type: "image/svg",
|
|
40
|
+
size: 11 * 1000,
|
|
41
|
+
lastModified: new Date(),
|
|
42
|
+
error: "duet-upload-101",
|
|
43
|
+
}),
|
|
44
|
+
mockFileCreator({
|
|
45
|
+
name: "category-detached-house.svg",
|
|
46
|
+
type: "image/svg",
|
|
47
|
+
size: 78 * 1000,
|
|
48
|
+
lastModified: new Date(),
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
function mockFileCreator({ name, size, type, lastModified, error = undefined }) {
|
|
53
|
+
var file;
|
|
54
|
+
try {
|
|
55
|
+
const blob = new Blob(["a".repeat(size)], { type });
|
|
56
|
+
blob["lastModifiedDate"] = lastModified;
|
|
57
|
+
var file = new File([blob], name, { type });
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
try {
|
|
61
|
+
var file = new File(["foo"], name, { type });
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
var file = { name, size };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { file, error };
|
|
68
|
+
}
|
|
69
|
+
function fileListFromArray(files) {
|
|
70
|
+
const fileMap = new Map();
|
|
71
|
+
files.forEach(obj => {
|
|
72
|
+
const isValid = !obj.error;
|
|
73
|
+
const fileItem = {
|
|
74
|
+
uid: `${Date.now()}-${Math.random()}`,
|
|
75
|
+
item: obj.file,
|
|
76
|
+
size: obj.file.size,
|
|
77
|
+
valid: isValid,
|
|
78
|
+
error: {
|
|
79
|
+
type: isValid ? undefined : obj.error,
|
|
80
|
+
message: isValid ? undefined : "Random error message",
|
|
81
|
+
system_message: isValid ? undefined : "Random system error message",
|
|
82
|
+
},
|
|
83
|
+
progress: 100,
|
|
84
|
+
deleted: false,
|
|
85
|
+
xhr: false,
|
|
86
|
+
url: `https://cdn.duetds.com/api/icons/2.1.12/lib/assets/${obj.file.name}`,
|
|
87
|
+
};
|
|
88
|
+
fileMap.set(obj.file.name, fileItem);
|
|
89
|
+
});
|
|
90
|
+
return fileMap;
|
|
91
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { h } from "@stencil/core";
|
|
5
|
+
import { getI18nError } from "./errorcodes.utils";
|
|
6
|
+
export const ErrorItem = ({ data }) => {
|
|
7
|
+
const { item, error } = data;
|
|
8
|
+
const { name } = item;
|
|
9
|
+
const { type } = error;
|
|
10
|
+
return (h("span", { class: "duet-upload-item-error", role: "status" },
|
|
11
|
+
h("duet-paragraph", { class: "duet-upload-item-name", color: "danger", margin: "none", weight: "semi-bold" },
|
|
12
|
+
h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
|
|
13
|
+
" ",
|
|
14
|
+
name),
|
|
15
|
+
h("duet-paragraph", { class: "duet-upload-item-error-label", size: "small", margin: "none", color: "danger" }, getI18nError(type))));
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { h } from "@stencil/core";
|
|
5
|
+
export const ProgressItem = ({ progress, name }) => (h("span", null,
|
|
6
|
+
h("duet-paragraph", { color: "secondary", margin: "none", size: "small" }, name),
|
|
7
|
+
h("duet-spacer", { size: "xx-small" }),
|
|
8
|
+
h("duet-progress", { progress: Math.ceil(progress), "aria-hidden": true })));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { h } from "@stencil/core";
|
|
5
|
+
import { formatBytes } from "./upload.helpers";
|
|
6
|
+
export const SuccessItem = ({ data, showLinks }) => {
|
|
7
|
+
const { item, size, uploaded, url, meta } = data;
|
|
8
|
+
const { name } = item;
|
|
9
|
+
const ContentName = (h("span", { class: "duet-upload-item-name" },
|
|
10
|
+
h("duet-icon", { margin: "none", size: "xx-small", name: "messaging-attachment" }),
|
|
11
|
+
h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
|
|
12
|
+
name));
|
|
13
|
+
const SizeText = (h("span", { class: "duet-upload-item-size", style: { fontSize: "14px", fontWeight: "400" } },
|
|
14
|
+
"(",
|
|
15
|
+
formatBytes(size),
|
|
16
|
+
")"));
|
|
17
|
+
const FilenameLine = uploaded && url && showLinks ? (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
|
|
18
|
+
h("duet-link", { url: url, external: true }, ContentName),
|
|
19
|
+
h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
|
|
20
|
+
SizeText)) : (h("duet-paragraph", { color: "secondary", margin: "none", weight: "semi-bold" },
|
|
21
|
+
ContentName,
|
|
22
|
+
h("duet-spacer", { size: "xx-small", direction: "horizontal" }),
|
|
23
|
+
SizeText));
|
|
24
|
+
const Badges = meta && meta.badges ? (h("span", null,
|
|
25
|
+
h("duet-spacer", { size: "xx-small" }),
|
|
26
|
+
meta.badges.map(badgeText => (h("duet-badge", { color: "primary" }, badgeText))))) : undefined;
|
|
27
|
+
return (h("span", { class: "duet-upload-item-success" },
|
|
28
|
+
h("div", null, FilenameLine),
|
|
29
|
+
Badges));
|
|
30
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { getLocaleString } from "../../utils/language-utils";
|
|
5
|
+
import { getError } from "./errorcodes.utils";
|
|
6
|
+
export const validateFileExtension = (name, allowedExtensions) => {
|
|
7
|
+
if (!allowedExtensions) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
const ext = name.split(".");
|
|
11
|
+
const validExtension = allowedExtensions.split(",");
|
|
12
|
+
const extension = ext[ext.length - 1];
|
|
13
|
+
return validExtension.includes(extension);
|
|
14
|
+
};
|
|
15
|
+
export const validateFileMime = (type, allowedMimetypes) => {
|
|
16
|
+
if (!allowedMimetypes || !type) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const validMimeTypes = allowedMimetypes.split(",");
|
|
20
|
+
let valid = false;
|
|
21
|
+
validMimeTypes.forEach(mimeType => {
|
|
22
|
+
const allowedTypes = mimeType.split("/");
|
|
23
|
+
const fileType = type.split("/");
|
|
24
|
+
if (allowedTypes[0] === fileType[0] && (allowedTypes[1] === fileType[1] || allowedTypes[1] === "*")) {
|
|
25
|
+
valid = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return valid;
|
|
29
|
+
};
|
|
30
|
+
export const validateFileSize = (size, maxBytes) => {
|
|
31
|
+
if (!maxBytes || !size) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return maxBytes >= size;
|
|
35
|
+
};
|
|
36
|
+
export const validateFile = (item, validators) => {
|
|
37
|
+
const { allowedMimetypes, allowedExtensions, maxBytes } = validators;
|
|
38
|
+
let valid = false;
|
|
39
|
+
let errorMessage = getError("default");
|
|
40
|
+
if (item) {
|
|
41
|
+
const { name, type, size } = item;
|
|
42
|
+
const mime = validateFileMime(type, allowedMimetypes);
|
|
43
|
+
const ext = validateFileExtension(name, allowedExtensions);
|
|
44
|
+
const bytes = validateFileSize(size, maxBytes);
|
|
45
|
+
if (!mime) {
|
|
46
|
+
errorMessage = getError("duet-upload-101");
|
|
47
|
+
}
|
|
48
|
+
if (!ext) {
|
|
49
|
+
errorMessage = getError("duet-upload-100");
|
|
50
|
+
}
|
|
51
|
+
if (!bytes) {
|
|
52
|
+
errorMessage = getError("duet-upload-201");
|
|
53
|
+
}
|
|
54
|
+
valid = mime && ext && bytes;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
valid = false;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
valid,
|
|
61
|
+
errorMessage: valid ? undefined : getLocaleString(errorMessage.message),
|
|
62
|
+
errorSystem: valid ? undefined : errorMessage.system_message,
|
|
63
|
+
errorType: valid ? undefined : errorMessage.type,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export const validateTotalSizeIsAboveMax = (filelist, maxTotalBytes) => {
|
|
67
|
+
let total = 0;
|
|
68
|
+
if (maxTotalBytes) {
|
|
69
|
+
filelist.forEach(item => {
|
|
70
|
+
if (item.valid && item.size) {
|
|
71
|
+
total += item.size;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (total < maxTotalBytes) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
80
|
+
export const validateTotalAmountIsAboveMax = (filelist, maxFiles) => {
|
|
81
|
+
let total = 0;
|
|
82
|
+
if (maxFiles) {
|
|
83
|
+
filelist.forEach(item => {
|
|
84
|
+
if (item.valid) {
|
|
85
|
+
total++;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (total > maxFiles) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
export const formatBytes = (bytes, decimals = 2) => {
|
|
5
|
+
if (bytes === 0) {
|
|
6
|
+
return "0 Bytes";
|
|
7
|
+
}
|
|
8
|
+
const k = 1024;
|
|
9
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
10
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
11
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
12
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
export const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress }) => {
|
|
5
|
+
const { type = "POST", xhr, uri, argument = null, headers = null } = options;
|
|
6
|
+
xhr.open(type, `${uri}${argument || ""}`, true);
|
|
7
|
+
const { data, name } = payload;
|
|
8
|
+
// headers must be added after open
|
|
9
|
+
if (headers) {
|
|
10
|
+
Object.keys(headers).forEach(key => {
|
|
11
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (type === "POST") {
|
|
15
|
+
xhr.onreadystatechange = () => {
|
|
16
|
+
// Call a function when the state changes.
|
|
17
|
+
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status < 300) {
|
|
18
|
+
// Request finished without errors
|
|
19
|
+
onSuccess(xhr, name, xhr.status);
|
|
20
|
+
}
|
|
21
|
+
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status >= 300 && xhr.status < 999) {
|
|
22
|
+
// Request finished with errors
|
|
23
|
+
onFailure(xhr, name, xhr.status);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
onProgress(name);
|
|
27
|
+
}
|
|
28
|
+
xhr.send(data);
|
|
29
|
+
return xhr;
|
|
30
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { Component, h, Host, Prop, State, Watch } from "@stencil/core";
|
|
5
|
+
export class DuetUploadAriaStatus {
|
|
6
|
+
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* State() variables
|
|
9
|
+
*/
|
|
10
|
+
this.statusMessage = null;
|
|
11
|
+
/**
|
|
12
|
+
* Status labels used in the component
|
|
13
|
+
*/
|
|
14
|
+
this.statusMessageLabel = null;
|
|
15
|
+
/**
|
|
16
|
+
* Adds accessible label that is read aloud
|
|
17
|
+
*/
|
|
18
|
+
this.accessibleAriaLive = "polite";
|
|
19
|
+
/**
|
|
20
|
+
* valid file amount
|
|
21
|
+
*/
|
|
22
|
+
this.valid = undefined;
|
|
23
|
+
/**
|
|
24
|
+
* total files
|
|
25
|
+
*/
|
|
26
|
+
this.total = undefined;
|
|
27
|
+
/**
|
|
28
|
+
* invalid file amount
|
|
29
|
+
*/
|
|
30
|
+
this.invalid = undefined;
|
|
31
|
+
/**
|
|
32
|
+
* valid file amount
|
|
33
|
+
*/
|
|
34
|
+
this.inprogress = undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Private functions
|
|
37
|
+
*/
|
|
38
|
+
this.replacePlaceHolders = (statusString) => {
|
|
39
|
+
const addFiles = (amount) => {
|
|
40
|
+
return amount > 1 ? `${amount} ${this.statusMessageLabel.files}` : `${amount} ${this.statusMessageLabel.file}`;
|
|
41
|
+
};
|
|
42
|
+
return statusString
|
|
43
|
+
.replace("{filesUploaded}", addFiles(this.valid))
|
|
44
|
+
.replace("{filesInProgress}", addFiles(this.inprogress))
|
|
45
|
+
.replace("{filesTotal}", addFiles(this.total))
|
|
46
|
+
.replace("{filesWithErrors}", addFiles(this.invalid));
|
|
47
|
+
};
|
|
48
|
+
this.getStatusMessage = () => {
|
|
49
|
+
const { done, inProgress, doneWithErrors, inProgressWithErrors } = this.statusMessageLabel;
|
|
50
|
+
const hasErrors = this.invalid > 0;
|
|
51
|
+
const isInProgress = this.inprogress > 0;
|
|
52
|
+
const isInProgressWithErrors = this.inprogress > 0 && hasErrors;
|
|
53
|
+
const isDone = this.valid === this.total && !isInProgress && !hasErrors;
|
|
54
|
+
const isDoneWithErrors = this.valid + this.invalid === this.total && !isInProgress;
|
|
55
|
+
if (isDone) {
|
|
56
|
+
this.statusMessage = this.replacePlaceHolders(done);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
else if (isInProgressWithErrors) {
|
|
60
|
+
this.statusMessage = this.replacePlaceHolders(inProgressWithErrors);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
else if (isInProgress) {
|
|
64
|
+
this.statusMessage = this.replacePlaceHolders(inProgress);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
else if (isDoneWithErrors) {
|
|
68
|
+
this.statusMessage = this.replacePlaceHolders(doneWithErrors);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
watchHandler(newValue, oldValue) {
|
|
75
|
+
if (newValue !== oldValue) {
|
|
76
|
+
this.getStatusMessage();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* render() function
|
|
81
|
+
* Always the last one in the class.
|
|
82
|
+
*/
|
|
83
|
+
render() {
|
|
84
|
+
return (h(Host, { role: "status", "aria-live": "assertive", "aria-atomic": "true", "aria-relevant": "all" },
|
|
85
|
+
h("duet-visually-hidden", null, this.statusMessage)));
|
|
86
|
+
}
|
|
87
|
+
static get is() { return "duet-upload-aria-status"; }
|
|
88
|
+
static get encapsulation() { return "shadow"; }
|
|
89
|
+
static get properties() { return {
|
|
90
|
+
"statusMessageLabel": {
|
|
91
|
+
"type": "unknown",
|
|
92
|
+
"mutable": false,
|
|
93
|
+
"complexType": {
|
|
94
|
+
"original": "StatusMessage",
|
|
95
|
+
"resolved": "{ inProgress: string; inProgressWithErrors: string; done: string; doneWithErrors: string; file: string; files: string; }",
|
|
96
|
+
"references": {
|
|
97
|
+
"StatusMessage": {
|
|
98
|
+
"location": "local"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Status labels used in the component"
|
|
107
|
+
},
|
|
108
|
+
"defaultValue": "null"
|
|
109
|
+
},
|
|
110
|
+
"accessibleAriaLive": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"mutable": false,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "\"off\" | \"polite\" | \"assertive\"",
|
|
115
|
+
"resolved": "\"assertive\" | \"off\" | \"polite\"",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": false,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": "Adds accessible label that is read aloud"
|
|
123
|
+
},
|
|
124
|
+
"attribute": "accessible-aria-live",
|
|
125
|
+
"reflect": false,
|
|
126
|
+
"defaultValue": "\"polite\""
|
|
127
|
+
},
|
|
128
|
+
"valid": {
|
|
129
|
+
"type": "number",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "number",
|
|
133
|
+
"resolved": "number",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": "valid file amount"
|
|
141
|
+
},
|
|
142
|
+
"attribute": "valid",
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"defaultValue": "undefined"
|
|
145
|
+
},
|
|
146
|
+
"total": {
|
|
147
|
+
"type": "number",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "number",
|
|
151
|
+
"resolved": "number",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "total files"
|
|
159
|
+
},
|
|
160
|
+
"attribute": "total",
|
|
161
|
+
"reflect": false,
|
|
162
|
+
"defaultValue": "undefined"
|
|
163
|
+
},
|
|
164
|
+
"invalid": {
|
|
165
|
+
"type": "number",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "number",
|
|
169
|
+
"resolved": "number",
|
|
170
|
+
"references": {}
|
|
171
|
+
},
|
|
172
|
+
"required": false,
|
|
173
|
+
"optional": false,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": "invalid file amount"
|
|
177
|
+
},
|
|
178
|
+
"attribute": "invalid",
|
|
179
|
+
"reflect": false,
|
|
180
|
+
"defaultValue": "undefined"
|
|
181
|
+
},
|
|
182
|
+
"inprogress": {
|
|
183
|
+
"type": "number",
|
|
184
|
+
"mutable": false,
|
|
185
|
+
"complexType": {
|
|
186
|
+
"original": "number",
|
|
187
|
+
"resolved": "number",
|
|
188
|
+
"references": {}
|
|
189
|
+
},
|
|
190
|
+
"required": false,
|
|
191
|
+
"optional": false,
|
|
192
|
+
"docs": {
|
|
193
|
+
"tags": [],
|
|
194
|
+
"text": "valid file amount"
|
|
195
|
+
},
|
|
196
|
+
"attribute": "inprogress",
|
|
197
|
+
"reflect": false,
|
|
198
|
+
"defaultValue": "undefined"
|
|
199
|
+
}
|
|
200
|
+
}; }
|
|
201
|
+
static get states() { return {
|
|
202
|
+
"statusMessage": {}
|
|
203
|
+
}; }
|
|
204
|
+
static get watchers() { return [{
|
|
205
|
+
"propName": "valid",
|
|
206
|
+
"methodName": "watchHandler"
|
|
207
|
+
}, {
|
|
208
|
+
"propName": "invalid",
|
|
209
|
+
"methodName": "watchHandler"
|
|
210
|
+
}, {
|
|
211
|
+
"propName": "inprogress",
|
|
212
|
+
"methodName": "watchHandler"
|
|
213
|
+
}, {
|
|
214
|
+
"propName": "total",
|
|
215
|
+
"methodName": "watchHandler"
|
|
216
|
+
}]; }
|
|
217
|
+
}
|
|
@@ -54,14 +54,17 @@ export const getLocale = (lang) => {
|
|
|
54
54
|
}
|
|
55
55
|
throw new Error(`Locale for "${lang}" not found`);
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Takes any json object that is passed and/or htmlencoded and converts it to proper json
|
|
59
|
+
*/
|
|
60
|
+
export const sanitizeString = (string) => {
|
|
58
61
|
const argIsString = typeof string === "string";
|
|
59
62
|
if (argIsString) {
|
|
60
63
|
try {
|
|
61
64
|
return JSON.parse(convertHtmlQuotes(string));
|
|
62
65
|
}
|
|
63
66
|
catch (e) {
|
|
64
|
-
console.log("
|
|
67
|
+
console.log("sanitizeString received a string, that didnt parse to json object", string, e);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
return string;
|
|
@@ -73,7 +76,7 @@ const sanitizeString = (string) => {
|
|
|
73
76
|
* @param {object} langObject - {fi: "finnish", sv: "swedish", en: "english"} | string will get JSON.parsed
|
|
74
77
|
* @param {boolean} languageOverride = false - in case you want to override the actual language set in html tag
|
|
75
78
|
* @default {object} {locale: "fi-FI", money: "€"}
|
|
76
|
-
* @returns {(string|Object)} given example contains {fi:"something"} and
|
|
79
|
+
* @returns {(string|Object)} given example contains {fi:"something"} and language===fi this will return "something"
|
|
77
80
|
*/
|
|
78
81
|
export const getLocaleString = (langObject, languageOverride) => {
|
|
79
82
|
const obj = sanitizeString(langObject);
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
const watchFor = (containerEl, tagName, onChange, changeHandler, options = {
|
|
5
|
+
childList: true,
|
|
6
|
+
subtree: true,
|
|
7
|
+
}) => {
|
|
5
8
|
let mutation;
|
|
6
9
|
if (typeof MutationObserver !== "undefined") {
|
|
7
10
|
mutation = new MutationObserver(mutationList => {
|
|
8
|
-
onChange(
|
|
9
|
-
});
|
|
10
|
-
mutation.observe(containerEl, {
|
|
11
|
-
childList: true,
|
|
12
|
-
subtree: true,
|
|
11
|
+
onChange(changeHandler(mutationList, tagName));
|
|
13
12
|
});
|
|
13
|
+
mutation.observe(containerEl, options);
|
|
14
14
|
}
|
|
15
15
|
return mutation;
|
|
16
16
|
};
|
|
17
|
+
export const watchForOptions = (containerEl, tagName, onChange) => {
|
|
18
|
+
return watchFor(containerEl, tagName, onChange, getSelectedOption);
|
|
19
|
+
};
|
|
20
|
+
export const watchForElement = (containerEl, tagName, onChange) => {
|
|
21
|
+
return watchFor(containerEl, tagName, onChange, getElementItem, {
|
|
22
|
+
childList: true,
|
|
23
|
+
subtree: true,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const getElementItem = (mutationList) => {
|
|
27
|
+
let addedNode = false;
|
|
28
|
+
let removedNode = false;
|
|
29
|
+
mutationList.forEach(mut => {
|
|
30
|
+
if (mut.addedNodes.length) {
|
|
31
|
+
addedNode = true;
|
|
32
|
+
}
|
|
33
|
+
if (mut.removedNodes.length) {
|
|
34
|
+
removedNode = true;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return { addedNode, removedNode, mutationList };
|
|
38
|
+
};
|
|
17
39
|
const getSelectedOption = (mutationList, tagName) => {
|
|
18
40
|
let newOption;
|
|
19
41
|
mutationList.forEach(mut => {
|
|
@@ -31,3 +53,10 @@ export const findCheckedOption = (el, tagName) => {
|
|
|
31
53
|
const options = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));
|
|
32
54
|
return options.find((o) => o.checked === true);
|
|
33
55
|
};
|
|
56
|
+
export const findErrorItems = (el, tagName) => {
|
|
57
|
+
if (el.nodeType !== 1) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const options = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));
|
|
61
|
+
return options.find((o) => o.checked === true);
|
|
62
|
+
};
|