@duetds/components 4.30.1 → 4.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hydrate/index.js +1531 -442
- package/lib/cjs/{dom-e89ebf90.js → dom-c850c8d7.js} +1 -1
- package/lib/cjs/duet-alert.cjs.entry.js +4 -2
- package/lib/cjs/duet-badge.cjs.entry.js +2 -2
- package/lib/cjs/duet-button_2.cjs.entry.js +6 -5
- package/lib/cjs/duet-caption_4.cjs.entry.js +21 -15
- package/lib/cjs/duet-card.cjs.entry.js +6 -6
- package/lib/cjs/duet-checkbox.cjs.entry.js +2 -2
- package/lib/cjs/duet-choice_2.cjs.entry.js +55 -25
- package/lib/cjs/duet-collapsible.cjs.entry.js +5 -2
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +23 -13
- 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 +4 -4
- package/lib/cjs/duet-grid_2.cjs.entry.js +52 -4
- package/lib/cjs/duet-header_2.cjs.entry.js +26 -10
- package/lib/cjs/duet-hero.cjs.entry.js +6 -6
- package/lib/cjs/duet-icon.cjs.entry.js +21 -19
- package/lib/cjs/duet-input_2.cjs.entry.js +7 -7
- 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 +8 -7
- package/lib/cjs/duet-notification_2.cjs.entry.js +6 -5
- package/lib/cjs/duet-number-input.cjs.entry.js +36 -15
- 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 +6 -6
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-tab_2.cjs.entry.js +12 -6
- 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 +21 -10
- package/lib/cjs/duet-tray.cjs.entry.js +21 -10
- 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-7605778f.js → focus-utils-b609a7a5.js} +1 -1
- package/lib/cjs/{index-0c949193.js → index-9a57d969.js} +95 -77
- package/lib/cjs/{language-utils-70d6a9a4.js → language-utils-aa282901.js} +28 -9
- package/lib/cjs/loader.cjs.js +3 -3
- package/lib/cjs/{shadow-css-0c8c175b.js → shadow-css-e3edeed1.js} +9 -10
- package/lib/cjs/{string-utils-a6de43d8.js → string-utils-267e3dbb.js} +7 -0
- package/lib/cjs/{token-utils-13e5d13e.js → token-utils-63a9c8dc.js} +1 -1
- 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 +16 -8
- package/lib/collection/components/duet-alert/duet-alert.js +12 -6
- package/lib/collection/components/duet-badge/duet-badge.css +1 -0
- package/lib/collection/components/duet-button/duet-button.js +17 -15
- package/lib/collection/components/duet-card/duet-card.css +30 -7
- package/lib/collection/components/duet-card/duet-card.js +4 -3
- 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 +122 -36
- package/lib/collection/components/duet-choice-group/duet-choice-group.css +1 -0
- package/lib/collection/components/duet-choice-group/duet-choice-group.js +4 -4
- package/lib/collection/components/duet-date-picker/duet-date-picker.css +1 -1
- package/lib/collection/components/duet-date-picker/duet-date-picker.js +78 -43
- 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 +17 -15
- package/lib/collection/components/duet-grid/duet-grid.js +57 -6
- package/lib/collection/components/duet-grid-item/duet-grid-item.js +4 -4
- package/lib/collection/components/duet-header/duet-header.js +60 -35
- package/lib/collection/components/duet-heading/duet-heading.css +4 -0
- package/lib/collection/components/duet-heading/duet-heading.js +7 -6
- package/lib/collection/components/duet-hero/duet-hero.js +20 -15
- package/lib/collection/components/duet-icon/duet-icon.js +2 -6
- package/lib/collection/components/duet-icon/icon-utils.js +20 -13
- 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-label/duet-label.css +2 -0
- package/lib/collection/components/duet-link/duet-link.js +18 -19
- package/lib/collection/components/duet-logo/duet-logo.js +4 -4
- package/lib/collection/components/duet-modal/duet-modal.js +22 -17
- package/lib/collection/components/duet-notification/duet-notification.js +8 -8
- package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +20 -15
- package/lib/collection/components/duet-number-input/duet-number-input.js +153 -29
- 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 +43 -12
- 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 +82 -20
- package/lib/collection/components/duet-tray/duet-tray.js +79 -17
- package/lib/collection/components/duet-upload/duet-upload.css +17 -86
- package/lib/collection/components/duet-upload/duet-upload.js +587 -164
- package/lib/collection/components/duet-upload/errorcodes.utils.js +16 -4
- 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/{duet-upload-validators.js → upload-validators.js} +0 -0
- package/lib/collection/components/duet-upload/xhr.helpers.js +2 -6
- package/lib/collection/components/duet-upload-aria-status/duet-upload-aria-status.js +217 -0
- package/lib/collection/utils/fixture-utils.js +7 -5
- package/lib/collection/utils/js-utils.js +12 -0
- package/lib/collection/utils/language-utils.js +26 -9
- package/lib/collection/utils/string-utils.js +6 -0
- package/lib/collection/utils/watch-options.js +35 -6
- package/lib/custom-elements-bundle/index.d.ts +30 -0
- package/lib/custom-elements-bundle/index.js +1651 -730
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/p-00210a63.entry.js +4 -0
- package/lib/duet/{p-66dde4d2.entry.js → p-0205162d.entry.js} +1 -1
- package/lib/duet/{p-3dc9d15d.system.entry.js → p-020a2c42.system.entry.js} +1 -1
- package/lib/duet/{p-59a07cf9.entry.js → p-079795e5.entry.js} +1 -1
- package/lib/duet/p-09013a48.system.entry.js +4 -0
- package/lib/duet/p-0a89315d.entry.js +4 -0
- package/lib/duet/p-0d22396e.system.js +16 -0
- package/lib/duet/p-0e90f075.system.entry.js +4 -0
- package/lib/duet/p-12721178.js +4 -0
- package/lib/duet/p-19d7d9d5.system.entry.js +4 -0
- package/lib/duet/p-1cbc6269.entry.js +4 -0
- package/lib/duet/p-2297d13f.system.entry.js +4 -0
- package/lib/duet/p-2764f081.js +4 -0
- package/lib/duet/p-2a822e91.system.entry.js +4 -0
- package/lib/duet/{p-f81d8534.entry.js → p-2fdcff82.entry.js} +1 -1
- package/lib/duet/p-3013c9bb.system.entry.js +4 -0
- package/lib/duet/p-3212a556.entry.js +4 -0
- package/lib/duet/{p-dee41056.system.entry.js → p-323643af.system.entry.js} +1 -1
- package/lib/duet/p-32b7397d.entry.js +4 -0
- package/lib/duet/{p-bd9a7d8f.js → p-35a3794e.js} +0 -0
- package/lib/duet/p-360086f8.entry.js +4 -0
- package/lib/duet/{p-f71f12ed.entry.js → p-37cda933.entry.js} +1 -1
- package/lib/duet/{p-62806bb6.system.entry.js → p-3ba62cf1.system.entry.js} +1 -1
- package/lib/duet/{p-322d1c38.js → p-3c1971d8.js} +1 -1
- package/lib/duet/p-3fd9190b.system.entry.js +4 -0
- package/lib/duet/p-43847557.entry.js +4 -0
- package/lib/duet/{p-bbc229d8.system.entry.js → p-4b6e8558.system.entry.js} +1 -1
- package/lib/duet/p-4c5eedf8.entry.js +4 -0
- package/lib/duet/p-4c827f0d.entry.js +4 -0
- package/lib/duet/{p-de2be65b.system.js → p-51955fc0.system.js} +1 -1
- package/lib/duet/p-5cfc53f9.entry.js +4 -0
- package/lib/duet/p-5decc259.system.entry.js +4 -0
- package/lib/duet/p-5e0071d6.js +4 -0
- package/lib/duet/p-5e77432e.system.entry.js +4 -0
- package/lib/duet/{p-ce1374a4.system.entry.js → p-6024e484.system.entry.js} +1 -1
- package/lib/duet/p-68008644.entry.js +4 -0
- package/lib/duet/p-69385972.system.entry.js +4 -0
- package/lib/duet/p-6a4d85ed.system.entry.js +4 -0
- package/lib/duet/{p-f82709ba.entry.js → p-6a5ab3eb.entry.js} +1 -1
- package/lib/duet/p-6e363557.system.js +4 -0
- package/lib/duet/p-6e4b1c0d.entry.js +4 -0
- package/lib/duet/p-6f36f647.system.entry.js +4 -0
- package/lib/duet/p-6fa6c4fb.system.entry.js +4 -0
- package/lib/duet/p-70fafc98.system.js +4 -0
- package/lib/duet/p-71a77368.system.entry.js +4 -0
- package/lib/duet/p-73f9db25.system.entry.js +4 -0
- package/lib/duet/p-74f4a0d8.system.entry.js +4 -0
- package/lib/duet/p-7530be48.system.entry.js +4 -0
- package/lib/duet/{p-36007600.entry.js → p-75edcaed.entry.js} +1 -1
- package/lib/duet/{p-d1817efe.system.entry.js → p-7a8597c2.system.entry.js} +1 -1
- package/lib/duet/{p-1cfe38b1.system.entry.js → p-85ad012a.system.entry.js} +1 -1
- package/lib/duet/{p-a321a98c.entry.js → p-85e52be8.entry.js} +1 -1
- package/lib/duet/p-8aaf3383.entry.js +4 -0
- package/lib/duet/p-986779fb.js +4 -0
- package/lib/duet/p-987edcd0.js +15 -0
- package/lib/duet/{p-35e45c19.system.js → p-9a945278.system.js} +1 -1
- package/lib/duet/p-9e79e033.entry.js +4 -0
- package/lib/duet/{p-7e108b7e.entry.js → p-9f35d682.entry.js} +1 -1
- package/lib/duet/{p-f71e337e.system.entry.js → p-a2a00146.system.entry.js} +1 -1
- package/lib/duet/p-a545398c.entry.js +4 -0
- package/lib/duet/{p-2826f987.js → p-ad07f399.js} +1 -1
- package/lib/duet/{p-4a7911fd.entry.js → p-af49d4f9.entry.js} +1 -1
- package/lib/duet/{p-1c41525a.entry.js → p-b25edbbe.entry.js} +1 -1
- package/lib/duet/p-b314348c.system.js +4 -0
- package/lib/duet/p-b4111e88.system.entry.js +4 -0
- package/lib/duet/p-b5c7d304.system.entry.js +4 -0
- package/lib/duet/p-b6e9860a.entry.js +4 -0
- package/lib/duet/p-ba18b56e.entry.js +4 -0
- package/lib/duet/p-bf4596bd.system.entry.js +4 -0
- package/lib/duet/{p-4265de16.system.entry.js → p-bf9f6d80.system.entry.js} +1 -1
- package/lib/duet/{p-fd98468a.system.js → p-c18a599e.system.js} +0 -0
- package/lib/duet/p-c1a1ea1b.js +4 -0
- package/lib/duet/p-c742856b.system.entry.js +4 -0
- package/lib/duet/p-cbdb9e98.system.entry.js +4 -0
- package/lib/duet/{p-27d538f7.system.entry.js → p-cf319832.system.entry.js} +1 -1
- package/lib/duet/p-d67fff56.entry.js +4 -0
- package/lib/duet/{p-031c2cd8.system.entry.js → p-dd76db9b.system.entry.js} +1 -1
- package/lib/duet/p-ddb6344c.system.js +4 -0
- package/lib/duet/{p-345ea4f2.system.entry.js → p-de5ec54e.system.entry.js} +1 -1
- package/lib/duet/p-df6f39a3.entry.js +4 -0
- package/lib/duet/p-e1dc86b5.system.js +4 -0
- package/lib/duet/p-e2596ea0.entry.js +4 -0
- package/lib/duet/p-e370c18b.entry.js +4 -0
- package/lib/duet/{p-e26116e0.system.entry.js → p-e48f3a32.system.entry.js} +1 -1
- package/lib/duet/p-e5031543.entry.js +4 -0
- package/lib/duet/p-e60ee8b0.entry.js +4 -0
- package/lib/duet/p-e70088d5.entry.js +4 -0
- package/lib/duet/p-e7b90769.system.entry.js +4 -0
- package/lib/duet/{p-a88df408.entry.js → p-e8123a53.entry.js} +1 -1
- package/lib/duet/p-eb55ccd2.system.js +4 -0
- package/lib/duet/{p-2d2c45f9.entry.js → p-ef7251bf.entry.js} +1 -1
- package/lib/duet/p-f0cfe033.system.entry.js +4 -0
- package/lib/duet/p-f2a087a8.system.entry.js +4 -0
- package/lib/duet/p-f5a55b3c.entry.js +4 -0
- package/lib/duet/p-fd613733.entry.js +4 -0
- package/lib/esm/{dom-21034390.js → dom-58cd15f6.js} +1 -1
- package/lib/esm/duet-alert.entry.js +4 -2
- package/lib/esm/duet-badge.entry.js +2 -2
- package/lib/esm/duet-button_2.entry.js +6 -5
- package/lib/esm/duet-caption_4.entry.js +21 -15
- package/lib/esm/duet-card.entry.js +6 -6
- package/lib/esm/duet-checkbox.entry.js +2 -2
- package/lib/esm/duet-choice_2.entry.js +56 -26
- package/lib/esm/duet-collapsible.entry.js +5 -2
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +23 -13
- 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 +4 -4
- package/lib/esm/duet-grid_2.entry.js +52 -4
- package/lib/esm/duet-header_2.entry.js +26 -10
- package/lib/esm/duet-hero.entry.js +6 -6
- package/lib/esm/duet-icon.entry.js +21 -19
- package/lib/esm/duet-input_2.entry.js +7 -7
- 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 +8 -7
- package/lib/esm/duet-notification_2.entry.js +6 -5
- package/lib/esm/duet-number-input.entry.js +36 -15
- 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 +6 -6
- package/lib/esm/duet-step_2.entry.js +1 -1
- package/lib/esm/duet-tab_2.entry.js +12 -6
- 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 +21 -10
- package/lib/esm/duet-tray.entry.js +21 -10
- 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-0b12f0df.js → focus-utils-aeb6ca93.js} +1 -1
- package/lib/esm/{index-f70ddc7f.js → index-e8c7d36f.js} +94 -78
- package/lib/esm/{language-utils-ab9c3afc.js → language-utils-344d894c.js} +28 -10
- package/lib/esm/loader.js +3 -3
- package/lib/esm/{shadow-css-31e2d504.js → shadow-css-7c726abb.js} +9 -10
- package/lib/esm/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +7 -1
- package/lib/esm/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
- 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 +1 -1
- 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 +2 -2
- 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-aeb6ca93.js +4 -0
- package/lib/esm-es5/index-e8c7d36f.js +4 -0
- package/lib/esm-es5/language-utils-344d894c.js +4 -0
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/shadow-css-7c726abb.js +15 -0
- package/lib/esm-es5/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +1 -1
- package/lib/esm-es5/{token-utils-5a35377f.js → token-utils-590d9413.js} +1 -1
- 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 +4906 -0
- package/lib/types/components/duet-alert/duet-alert.d.ts +2 -1
- package/lib/types/components/duet-button/duet-button.d.ts +1 -1
- package/lib/types/components/duet-choice/duet-choice.d.ts +24 -5
- package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +15 -9
- 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-footer/duet-footer.d.ts +1 -1
- package/lib/types/components/duet-grid/duet-grid.d.ts +16 -2
- package/lib/types/components/duet-header/duet-header.d.ts +21 -5
- package/lib/types/components/duet-heading/duet-heading.d.ts +2 -2
- package/lib/types/components/duet-hero/duet-hero.d.ts +3 -3
- package/lib/types/components/duet-icon/duet-icon.d.ts +1 -1
- package/lib/types/components/duet-icon/icon-utils.d.ts +1 -1
- package/lib/types/components/duet-link/duet-link.d.ts +2 -3
- package/lib/types/components/duet-modal/duet-modal.d.ts +3 -3
- package/lib/types/components/duet-notification-drawer/duet-notification-drawer.d.ts +3 -3
- package/lib/types/components/duet-number-input/duet-number-input.d.ts +21 -0
- 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-tab-group/duet-tab-group.d.ts +6 -0
- package/lib/types/components/duet-tooltip/duet-tooltip.d.ts +11 -0
- package/lib/types/components/duet-tray/duet-tray.d.ts +11 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +124 -31
- package/lib/types/components/duet-upload/errorcodes.utils.d.ts +1 -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/{duet-upload-validators.d.ts → upload-validators.d.ts} +0 -0
- package/lib/types/components/duet-upload/xhr.helpers.d.ts +7 -1
- package/lib/types/components/duet-upload-aria-status/duet-upload-aria-status.d.ts +49 -0
- package/lib/types/components.d.ts +619 -87
- package/lib/types/utils/js-utils.d.ts +1 -0
- package/lib/types/utils/language-utils.d.ts +8 -3
- package/lib/types/utils/string-utils.d.ts +1 -0
- package/lib/types/utils/watch-options.d.ts +2 -0
- package/package.json +20 -15
- package/lib/cjs/duet-table.cjs.entry.js +0 -132
- package/lib/cjs/duet-upload.cjs.entry.js +0 -866
- package/lib/collection/components/duet-upload/duet-upload-file-list.js +0 -49
- package/lib/duet/p-0733c303.system.entry.js +0 -4
- package/lib/duet/p-095060cc.js +0 -4
- package/lib/duet/p-156864a1.system.entry.js +0 -4
- package/lib/duet/p-15c15c6a.js +0 -15
- package/lib/duet/p-1911dfe7.system.entry.js +0 -4
- package/lib/duet/p-2834a302.entry.js +0 -4
- package/lib/duet/p-28a3d38f.system.entry.js +0 -4
- package/lib/duet/p-2a1a9f9f.entry.js +0 -4
- package/lib/duet/p-2a4d7c5b.system.entry.js +0 -4
- package/lib/duet/p-4095dba5.entry.js +0 -4
- package/lib/duet/p-418b2ce7.system.js +0 -4
- package/lib/duet/p-4289b543.entry.js +0 -4
- package/lib/duet/p-43e39d98.system.js +0 -4
- package/lib/duet/p-46a3ae43.system.js +0 -4
- package/lib/duet/p-4a38cf9d.entry.js +0 -4
- package/lib/duet/p-4be8e814.entry.js +0 -4
- package/lib/duet/p-591b2137.entry.js +0 -4
- package/lib/duet/p-5c5bdb06.system.entry.js +0 -4
- package/lib/duet/p-5f70e318.entry.js +0 -4
- package/lib/duet/p-62c294d6.system.entry.js +0 -4
- package/lib/duet/p-6a356ab1.system.js +0 -4
- package/lib/duet/p-6c2729da.js +0 -4
- package/lib/duet/p-6f107847.system.entry.js +0 -4
- package/lib/duet/p-77a5fe4c.system.js +0 -4
- package/lib/duet/p-7809e78b.system.entry.js +0 -4
- package/lib/duet/p-7a36d76f.system.entry.js +0 -4
- package/lib/duet/p-7ee52f58.entry.js +0 -4
- package/lib/duet/p-884693f1.entry.js +0 -4
- package/lib/duet/p-8977b722.entry.js +0 -4
- package/lib/duet/p-89db3b94.entry.js +0 -4
- package/lib/duet/p-8cfce39e.system.entry.js +0 -4
- package/lib/duet/p-8ffe1461.system.entry.js +0 -4
- package/lib/duet/p-9381c2d4.entry.js +0 -4
- package/lib/duet/p-9a450c9a.entry.js +0 -4
- package/lib/duet/p-9a89ec39.js +0 -4
- package/lib/duet/p-9bbfe606.system.entry.js +0 -4
- package/lib/duet/p-a0a066cb.system.entry.js +0 -4
- package/lib/duet/p-a6096b05.system.entry.js +0 -4
- package/lib/duet/p-a89d5d7c.entry.js +0 -4
- package/lib/duet/p-b07055fd.system.entry.js +0 -4
- package/lib/duet/p-b4374f0e.entry.js +0 -4
- package/lib/duet/p-b456d684.system.entry.js +0 -4
- package/lib/duet/p-bd18c93f.js +0 -4
- package/lib/duet/p-bddb1c15.system.entry.js +0 -4
- package/lib/duet/p-c0b95b58.entry.js +0 -4
- package/lib/duet/p-c3688975.entry.js +0 -4
- package/lib/duet/p-c4d183e6.entry.js +0 -4
- package/lib/duet/p-c9303f9a.entry.js +0 -4
- package/lib/duet/p-cd4e8ccf.js +0 -4
- package/lib/duet/p-ceb75b35.system.entry.js +0 -4
- package/lib/duet/p-cf243bcb.system.entry.js +0 -4
- package/lib/duet/p-d37c8a05.system.js +0 -4
- package/lib/duet/p-d989af11.entry.js +0 -4
- package/lib/duet/p-e58ca7af.system.js +0 -16
- package/lib/duet/p-e6128d82.system.entry.js +0 -4
- package/lib/duet/p-e86cdc17.entry.js +0 -4
- package/lib/duet/p-eadb29c7.entry.js +0 -4
- package/lib/duet/p-f30b14d6.system.entry.js +0 -4
- package/lib/duet/p-f79f8da1.entry.js +0 -4
- package/lib/duet/p-fc397e03.system.entry.js +0 -4
- package/lib/esm/duet-table.entry.js +0 -128
- package/lib/esm/duet-upload.entry.js +0 -862
- package/lib/esm/watch-options-de55ea78.js +0 -35
- package/lib/esm-es5/duet-table.entry.js +0 -4
- package/lib/esm-es5/duet-upload.entry.js +0 -4
- package/lib/esm-es5/focus-utils-0b12f0df.js +0 -4
- package/lib/esm-es5/index-f70ddc7f.js +0 -4
- package/lib/esm-es5/language-utils-ab9c3afc.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
- package/lib/types/components/duet-upload/duet-upload-file-list.d.ts +0 -9
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { getLocaleString } from "../../utils/language-utils";
|
|
5
|
+
import errorCodes from "./errorcodes.json";
|
|
5
6
|
export const getError = (code) => {
|
|
6
7
|
let error = {
|
|
7
8
|
type: undefined,
|
|
8
9
|
system_message: undefined,
|
|
9
10
|
message: undefined,
|
|
10
11
|
};
|
|
11
|
-
error =
|
|
12
|
-
|
|
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;
|
|
13
15
|
})[0];
|
|
14
16
|
if (!error) {
|
|
15
|
-
error =
|
|
17
|
+
error = errorCodes.filter(errorItem => {
|
|
16
18
|
return errorItem.type === "default";
|
|
17
19
|
})[0];
|
|
18
20
|
}
|
|
19
21
|
return error;
|
|
20
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,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
|
+
};
|
package/lib/collection/components/duet-upload/{duet-upload-validators.js → upload-validators.js}
RENAMED
|
File without changes
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
export const makeXhrRequest = (payload, options, onFailure, onSuccess, onProgress) => {
|
|
5
|
-
const { type, xhr, uri, argument, headers } =
|
|
6
|
-
type: "POST",
|
|
7
|
-
argument: null,
|
|
8
|
-
headers: null,
|
|
9
|
-
}, options);
|
|
4
|
+
export const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress }) => {
|
|
5
|
+
const { type = "POST", xhr, uri, argument = null, headers = null } = options;
|
|
10
6
|
xhr.open(type, `${uri}${argument || ""}`, true);
|
|
11
7
|
const { data, name } = payload;
|
|
12
8
|
// headers must be added after open
|
|
@@ -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
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
+
require("dotenv").config();
|
|
5
|
+
const port = process.env.KOA_PROXY_PORT ? parseInt(process.env.KOA_PROXY_PORT) : 3334;
|
|
4
6
|
import * as fs from "fs";
|
|
5
7
|
import * as path from "path";
|
|
6
8
|
import { createPage } from "./test-utils";
|
|
@@ -37,7 +39,7 @@ function getAllFixturesFiles(dirPath, fixPath = "fixtures", skipFixture = []) {
|
|
|
37
39
|
/**
|
|
38
40
|
* Generate automatic fixture testing for jest
|
|
39
41
|
*/
|
|
40
|
-
const htmlFragment = (fixtureHtml, theme = "", minHeight = "0px") => {
|
|
42
|
+
const htmlFragment = (fixtureHtml, theme = "", minHeight = "0px", lang = "fi") => {
|
|
41
43
|
let fontFile = "localtapiola";
|
|
42
44
|
let className = "";
|
|
43
45
|
if (theme === "turva") {
|
|
@@ -45,7 +47,7 @@ const htmlFragment = (fixtureHtml, theme = "", minHeight = "0px") => {
|
|
|
45
47
|
className = "duet-theme-turva";
|
|
46
48
|
}
|
|
47
49
|
return `
|
|
48
|
-
<html class="${className}" lang="
|
|
50
|
+
<html class="${className}" lang="${lang}" style="min-height: auto">
|
|
49
51
|
<head>
|
|
50
52
|
<meta charset="utf-8" />
|
|
51
53
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -70,9 +72,9 @@ const htmlFragment = (fixtureHtml, theme = "", minHeight = "0px") => {
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
</style>
|
|
73
|
-
<link rel="stylesheet" href="http://
|
|
74
|
-
<link rel="stylesheet" href="http://
|
|
75
|
-
<link rel="stylesheet" href="http://
|
|
75
|
+
<link rel="stylesheet" href="http://0.0.0.0:${port}/fonts/lib/${fontFile}.css" />
|
|
76
|
+
<link rel="stylesheet" href="http://0.0.0.0:${port}/tokens/lib/tokens.custom-properties.css" />
|
|
77
|
+
<link rel="stylesheet" href="http://0.0.0.0:${port}/css/lib/duet.css" />
|
|
76
78
|
</head>
|
|
77
79
|
<body style="min-height: ${minHeight} !important; margin: 8px">
|
|
78
80
|
${fixtureHtml}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
+
import { convertHtmlQuotes } from "./string-utils";
|
|
4
5
|
const localeLookUpTable = {
|
|
5
6
|
fi: "fi-FI",
|
|
6
7
|
en: "en-GB",
|
|
@@ -15,13 +16,13 @@ const localeMonetarySignifierLookUpTable = {
|
|
|
15
16
|
};
|
|
16
17
|
const defLanguageArray = ["fi", "en", "sv"];
|
|
17
18
|
const defaultLanguage = "fi";
|
|
18
|
-
const
|
|
19
|
-
? document.documentElement.lang.toLowerCase()
|
|
20
|
-
|
|
19
|
+
export const getCurrentLanguage = () => {
|
|
20
|
+
return document.documentElement.lang ? document.documentElement.lang.toLowerCase() : defaultLanguage;
|
|
21
|
+
};
|
|
21
22
|
export const isOfTypeLanguage = (keyInput) => {
|
|
22
23
|
return defLanguageArray.includes(keyInput);
|
|
23
24
|
};
|
|
24
|
-
const checkForLanguage = (languageString =
|
|
25
|
+
const checkForLanguage = (languageString = getCurrentLanguage()) => {
|
|
25
26
|
if (isOfTypeLanguage(languageString)) {
|
|
26
27
|
return languageString;
|
|
27
28
|
}
|
|
@@ -35,7 +36,7 @@ const checkForLanguage = (languageString = currentLanguage) => {
|
|
|
35
36
|
* @param {string} lang=fi - "fi" | "sv" | "en"
|
|
36
37
|
* @default {string} "fi"
|
|
37
38
|
*/
|
|
38
|
-
export const getLanguage = (languageString =
|
|
39
|
+
export const getLanguage = (languageString = getCurrentLanguage()) => checkForLanguage(languageString);
|
|
39
40
|
/**
|
|
40
41
|
* Returns the current language and locale
|
|
41
42
|
* If language is not fi|sv|en it will default to "fi"
|
|
@@ -53,20 +54,36 @@ export const getLocale = (lang) => {
|
|
|
53
54
|
}
|
|
54
55
|
throw new Error(`Locale for "${lang}" not found`);
|
|
55
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Takes any json object that is passed and/or htmlencoded and converts it to proper json
|
|
59
|
+
*/
|
|
60
|
+
export const sanitizeString = (string) => {
|
|
61
|
+
const argIsString = typeof string === "string";
|
|
62
|
+
if (argIsString) {
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(convertHtmlQuotes(string));
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
console.log("sanitizeString received a string, that didnt parse to json object", string, e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return string;
|
|
71
|
+
};
|
|
56
72
|
/**
|
|
57
73
|
* Returns the current string / object from a given translation object
|
|
58
74
|
* If language is not fi|sv|en it will default to "fi"
|
|
59
75
|
* special case where lang can be ALSO be "us" in addition to other types - if user decides to override local language
|
|
60
|
-
* @param {object} langObject - {fi: "finnish", sv: "swedish", en: "english"}
|
|
76
|
+
* @param {object} langObject - {fi: "finnish", sv: "swedish", en: "english"} | string will get JSON.parsed
|
|
61
77
|
* @param {boolean} languageOverride = false - in case you want to override the actual language set in html tag
|
|
62
78
|
* @default {object} {locale: "fi-FI", money: "€"}
|
|
63
|
-
* @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"
|
|
64
80
|
*/
|
|
65
81
|
export const getLocaleString = (langObject, languageOverride) => {
|
|
82
|
+
const obj = sanitizeString(langObject);
|
|
66
83
|
if (languageOverride) {
|
|
67
|
-
return
|
|
84
|
+
return obj[checkForLanguage(languageOverride)];
|
|
68
85
|
}
|
|
69
86
|
else {
|
|
70
|
-
return
|
|
87
|
+
return obj[getLanguage()];
|
|
71
88
|
}
|
|
72
89
|
};
|
|
@@ -39,3 +39,9 @@ const MATCH_DISALLOWED_CHARS = /[^a-z0-9áéíóúñüöäå \.,_-]/gim;
|
|
|
39
39
|
export function sanitizeString(string) {
|
|
40
40
|
return string.replace(MATCH_DISALLOWED_CHARS, "").trim();
|
|
41
41
|
}
|
|
42
|
+
export const convertHtmlQuotes = string => {
|
|
43
|
+
if (typeof string === "string") {
|
|
44
|
+
return string.replace(/"/g, '"').replace(/'/g, '"');
|
|
45
|
+
}
|
|
46
|
+
return string;
|
|
47
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -74,6 +74,24 @@ export const DuetDivider: {
|
|
|
74
74
|
new (): DuetDivider;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
interface DuetEditableTable extends Components.DuetEditableTable, HTMLElement {}
|
|
78
|
+
export const DuetEditableTable: {
|
|
79
|
+
prototype: DuetEditableTable;
|
|
80
|
+
new (): DuetEditableTable;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
interface DuetEditableTableButton extends Components.DuetEditableTableButton, HTMLElement {}
|
|
84
|
+
export const DuetEditableTableButton: {
|
|
85
|
+
prototype: DuetEditableTableButton;
|
|
86
|
+
new (): DuetEditableTableButton;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
interface DuetEditableTableItem extends Components.DuetEditableTableItem, HTMLElement {}
|
|
90
|
+
export const DuetEditableTableItem: {
|
|
91
|
+
prototype: DuetEditableTableItem;
|
|
92
|
+
new (): DuetEditableTableItem;
|
|
93
|
+
};
|
|
94
|
+
|
|
77
95
|
interface DuetEmptyState extends Components.DuetEmptyState, HTMLElement {}
|
|
78
96
|
export const DuetEmptyState: {
|
|
79
97
|
prototype: DuetEmptyState;
|
|
@@ -200,6 +218,12 @@ export const DuetParagraph: {
|
|
|
200
218
|
new (): DuetParagraph;
|
|
201
219
|
};
|
|
202
220
|
|
|
221
|
+
interface DuetProgress extends Components.DuetProgress, HTMLElement {}
|
|
222
|
+
export const DuetProgress: {
|
|
223
|
+
prototype: DuetProgress;
|
|
224
|
+
new (): DuetProgress;
|
|
225
|
+
};
|
|
226
|
+
|
|
203
227
|
interface DuetRadio extends Components.DuetRadio, HTMLElement {}
|
|
204
228
|
export const DuetRadio: {
|
|
205
229
|
prototype: DuetRadio;
|
|
@@ -296,6 +320,12 @@ export const DuetUpload: {
|
|
|
296
320
|
new (): DuetUpload;
|
|
297
321
|
};
|
|
298
322
|
|
|
323
|
+
interface DuetUploadAriaStatus extends Components.DuetUploadAriaStatus, HTMLElement {}
|
|
324
|
+
export const DuetUploadAriaStatus: {
|
|
325
|
+
prototype: DuetUploadAriaStatus;
|
|
326
|
+
new (): DuetUploadAriaStatus;
|
|
327
|
+
};
|
|
328
|
+
|
|
299
329
|
interface DuetVisuallyHidden extends Components.DuetVisuallyHidden, HTMLElement {}
|
|
300
330
|
export const DuetVisuallyHidden: {
|
|
301
331
|
prototype: DuetVisuallyHidden;
|