@duetds/components 4.33.2 → 4.34.3
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 +427 -90
- package/lib/cjs/{dom-c850c8d7.js → dom-52a4f07a.js} +1 -1
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-badge.cjs.entry.js +1 -1
- package/lib/cjs/duet-button_2.cjs.entry.js +4 -3
- package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
- package/lib/cjs/duet-card.cjs.entry.js +2 -2
- package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
- package/lib/cjs/duet-choice_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-collapsible.cjs.entry.js +2 -2
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +2 -2
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-editable-table-button.cjs.entry.js +14 -7
- package/lib/cjs/duet-editable-table_4.cjs.entry.js +95 -11
- 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 +9 -3
- package/lib/cjs/duet-header_2.cjs.entry.js +220 -47
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-icon.cjs.entry.js +7 -5
- package/lib/cjs/duet-input_2.cjs.entry.js +3 -4
- 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 +2 -2
- package/lib/cjs/duet-notification_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
- package/lib/cjs/duet-progress.cjs.entry.js +1 -1
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-range-slider.cjs.entry.js +1 -1
- package/lib/cjs/duet-select.cjs.entry.js +1 -1
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-tab_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
- package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
- package/lib/cjs/duet-tray.cjs.entry.js +1 -1
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +4 -4
- package/lib/cjs/{focus-utils-27c696bb.js → focus-utils-3d73245e.js} +1 -1
- package/lib/cjs/form-search-d61b2843.js +8 -0
- package/lib/cjs/{index-18b0f43a.js → index-b8c8ebe4.js} +2 -2
- package/lib/cjs/loader.cjs.js +3 -3
- package/lib/cjs/{shadow-css-e3edeed1.js → shadow-css-e1b62a99.js} +1 -1
- package/lib/cjs/token-utils-05bd23b4.js +77 -0
- package/lib/collection/collection-manifest.json +2 -2
- package/lib/collection/components/duet-button/duet-button.css +21 -4
- package/lib/collection/components/duet-button/duet-button.js +5 -1
- package/lib/collection/components/duet-collapsible/duet-collapsible.js +4 -1
- package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +13 -6
- package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +25 -3
- package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +3 -3
- package/lib/collection/components/duet-editable-table/duet-editable-table.js +58 -2
- package/lib/collection/components/duet-footer/duet-footer.css +2 -0
- package/lib/collection/components/duet-grid/duet-grid.js +8 -2
- package/lib/collection/components/duet-header/duet-header-dropdown.js +27 -0
- package/lib/collection/components/duet-header/duet-header-hamburger.js +9 -0
- package/lib/collection/components/duet-header/duet-header-icon.js +9 -0
- package/lib/collection/components/duet-header/duet-header.css +272 -39
- package/lib/collection/components/duet-header/duet-header.js +316 -122
- package/lib/collection/components/duet-icon/duet-icon.js +5 -3
- package/lib/collection/components/duet-link/duet-link.js +4 -1
- package/lib/collection/components/duet-list-item/duet-list-item.css +1 -1
- package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.css +4 -3
- package/lib/collection/components/duet-table/duet-table.css +42 -17
- package/lib/collection/components/duet-table/duet-table.js +2 -2
- package/lib/collection/components/duet-upload/duet-upload.js +51 -4
- package/lib/collection/utils/template-utils.js +33 -0
- package/lib/collection/utils/token-utils.js +67 -14
- package/lib/custom-elements-bundle/index.js +411 -93
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-637df820.entry.js → p-01927eb0.entry.js} +1 -1
- package/lib/duet/{p-ba6214be.entry.js → p-032607e4.entry.js} +1 -1
- package/lib/duet/{p-68635a1c.entry.js → p-04597b37.entry.js} +1 -1
- package/lib/duet/{p-5b9621e2.entry.js → p-061d59b3.entry.js} +1 -1
- package/lib/duet/{p-33538e90.system.entry.js → p-08a34bd4.system.entry.js} +1 -1
- package/lib/duet/{p-be349a3d.system.entry.js → p-0b64cf3d.system.entry.js} +1 -1
- package/lib/duet/{p-50b796eb.entry.js → p-117e0339.entry.js} +1 -1
- package/lib/duet/{p-9125ed25.entry.js → p-11f389cd.entry.js} +1 -1
- package/lib/duet/{p-2d8e0faa.system.entry.js → p-129bc252.system.entry.js} +1 -1
- package/lib/duet/{p-b1ad7a52.system.entry.js → p-13058dc6.system.entry.js} +1 -1
- package/lib/duet/p-16de4b21.entry.js +4 -0
- package/lib/duet/{p-35a3794e.js → p-183726f7.js} +0 -0
- package/lib/duet/{p-d0fb19f7.system.entry.js → p-1e3ec7dc.system.entry.js} +1 -1
- package/lib/duet/{p-dd9b8fcb.system.entry.js → p-25aa7ac3.system.entry.js} +1 -1
- package/lib/duet/{p-0435b54a.system.entry.js → p-279aa668.system.entry.js} +1 -1
- package/lib/duet/p-2ce50cc6.system.entry.js +4 -0
- package/lib/duet/{p-5727cd82.system.entry.js → p-3211cb0d.system.entry.js} +1 -1
- package/lib/duet/{p-7f8cce41.system.entry.js → p-349c6990.system.entry.js} +1 -1
- package/lib/duet/{p-3a7e519e.entry.js → p-3839858e.entry.js} +1 -1
- package/lib/duet/{p-cd21755b.entry.js → p-3c173e89.entry.js} +1 -1
- package/lib/duet/p-3dc1e5c7.entry.js +4 -0
- package/lib/duet/{p-350cea4e.system.entry.js → p-414a29ba.system.entry.js} +2 -2
- package/lib/duet/p-4bb35e6f.entry.js +4 -0
- package/lib/duet/{p-042ec8b1.entry.js → p-4eca4ef3.entry.js} +1 -1
- package/lib/duet/p-50b4fb2c.js +4 -0
- package/lib/duet/{p-60ef3d05.entry.js → p-5152f1e4.entry.js} +1 -1
- package/lib/duet/{p-987edcd0.js → p-52621211.js} +0 -0
- package/lib/duet/p-53fb919f.entry.js +4 -0
- package/lib/duet/{p-15fae689.entry.js → p-59d4e6b8.entry.js} +1 -1
- package/lib/duet/p-5a6e464a.system.entry.js +4 -0
- package/lib/duet/{p-4e17a6cb.system.entry.js → p-5d2ec61d.system.entry.js} +1 -1
- package/lib/duet/{p-3cad13af.system.entry.js → p-5e6e0547.system.entry.js} +1 -1
- package/lib/duet/{p-04b3e682.entry.js → p-61a0e3f7.entry.js} +1 -1
- package/lib/duet/{p-c506017d.entry.js → p-62b3e73e.entry.js} +1 -1
- package/lib/duet/{p-8c2f14d8.system.entry.js → p-64f8c8e0.system.entry.js} +1 -1
- package/lib/duet/{p-cff461b6.entry.js → p-6aaf4be0.entry.js} +1 -1
- package/lib/duet/{p-c18a599e.system.js → p-6e4fd6ba.system.js} +0 -0
- package/lib/duet/{p-f37ffb6f.system.entry.js → p-6f288b44.system.entry.js} +1 -1
- package/lib/duet/{p-7ab0bad8.entry.js → p-6f35218d.entry.js} +1 -1
- package/lib/duet/{p-408e8cdb.system.js → p-715eb86e.system.js} +1 -1
- package/lib/duet/{p-0ac2e60d.system.entry.js → p-7232506d.system.entry.js} +1 -1
- package/lib/duet/{p-9a09ac2b.system.entry.js → p-7241b006.system.entry.js} +1 -1
- package/lib/duet/{p-c74cecf2.system.entry.js → p-75c48ba1.system.entry.js} +1 -1
- package/lib/duet/{p-9584411c.entry.js → p-77434f16.entry.js} +1 -1
- package/lib/duet/{p-66fdebc5.js → p-79cc24ee.js} +1 -1
- package/lib/duet/{p-61fc3872.system.js → p-7b4d646d.system.js} +1 -1
- package/lib/duet/{p-d4e706ac.system.entry.js → p-7cdfbafd.system.entry.js} +1 -1
- package/lib/duet/{p-f8744611.entry.js → p-7dadfd66.entry.js} +1 -1
- package/lib/duet/{p-de43620d.system.entry.js → p-8402709a.system.entry.js} +1 -1
- package/lib/duet/{p-659d6cb7.entry.js → p-8e70de92.entry.js} +1 -1
- package/lib/duet/p-8f477bd6.system.js +4 -0
- package/lib/duet/p-8fda2b95.entry.js +4 -0
- package/lib/duet/{p-1cf8dbc7.system.js → p-942856d9.system.js} +1 -1
- package/lib/duet/p-9d8421d4.entry.js +4 -0
- package/lib/duet/{p-c3c95a34.system.entry.js → p-a01664b5.system.entry.js} +1 -1
- package/lib/duet/p-a16a58c1.system.js +4 -0
- package/lib/duet/{p-7ceaf4ef.system.entry.js → p-a2373348.system.entry.js} +2 -2
- package/lib/duet/{p-1ecddc1d.entry.js → p-a35f849e.entry.js} +1 -1
- package/lib/duet/{p-582f3a2c.entry.js → p-a43ed343.entry.js} +1 -1
- package/lib/duet/{p-3bcf2054.system.entry.js → p-a76ae6e9.system.entry.js} +1 -1
- package/lib/duet/p-accaacf9.entry.js +4 -0
- package/lib/duet/{p-1c7d7cdd.system.entry.js → p-aefca63e.system.entry.js} +1 -1
- package/lib/duet/{p-720a36f2.entry.js → p-b2e9e246.entry.js} +1 -1
- package/lib/duet/p-bf246e5d.system.entry.js +4 -0
- package/lib/duet/{p-65451003.entry.js → p-c414a7d0.entry.js} +1 -1
- package/lib/duet/{p-2b4bd1b2.system.entry.js → p-c75bf5dd.system.entry.js} +1 -1
- package/lib/duet/{p-3364cfd2.entry.js → p-c90c17c7.entry.js} +1 -1
- package/lib/duet/p-c95b0a0e.system.entry.js +4 -0
- package/lib/duet/{p-b5dc29b8.system.entry.js → p-cb7921b9.system.entry.js} +1 -1
- package/lib/duet/{p-c0f3f60f.system.entry.js → p-cd795dee.system.entry.js} +1 -1
- package/lib/duet/p-d004da5f.js +4 -0
- package/lib/duet/p-d30c3f2c.system.entry.js +4 -0
- package/lib/duet/{p-d1dfa30e.entry.js → p-d855249b.entry.js} +1 -1
- package/lib/duet/{p-8c730326.entry.js → p-d8ac3d77.entry.js} +1 -1
- package/lib/duet/p-d992e2b5.entry.js +4 -0
- package/lib/duet/{p-6402041d.system.entry.js → p-daeb205a.system.entry.js} +1 -1
- package/lib/duet/{p-c9a11360.entry.js → p-db33afbe.entry.js} +1 -1
- package/lib/duet/{p-5f79eff8.system.entry.js → p-dd1bc83c.system.entry.js} +1 -1
- package/lib/duet/{p-a2b2fa13.system.entry.js → p-de658899.system.entry.js} +1 -1
- package/lib/duet/{p-d5e2bb48.system.entry.js → p-e1a40bab.system.entry.js} +1 -1
- package/lib/duet/{p-0d22396e.system.js → p-e5c1751e.system.js} +0 -0
- package/lib/duet/{p-4a14da52.entry.js → p-e9b95f7c.entry.js} +1 -1
- package/lib/duet/{p-1dcbd837.system.entry.js → p-ed57e786.system.entry.js} +1 -1
- package/lib/duet/{p-75e5d4d1.system.entry.js → p-f137fdb6.system.entry.js} +1 -1
- package/lib/duet/{p-fd00b025.entry.js → p-f96efcb6.entry.js} +1 -1
- package/lib/duet/{p-39e9d638.entry.js → p-fae44e29.entry.js} +1 -1
- package/lib/duet/{p-ebc4e334.js → p-fceb0df8.js} +1 -1
- package/lib/duet/p-fdc358b8.entry.js +4 -0
- package/lib/duet/{p-933c2774.system.entry.js → p-fefe12f8.system.entry.js} +1 -1
- package/lib/esm/{dom-58cd15f6.js → dom-5d060ace.js} +1 -1
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-badge.entry.js +1 -1
- package/lib/esm/duet-button_2.entry.js +4 -3
- package/lib/esm/duet-caption_4.entry.js +3 -3
- package/lib/esm/duet-card.entry.js +2 -2
- package/lib/esm/duet-checkbox.entry.js +1 -1
- package/lib/esm/duet-choice_2.entry.js +2 -2
- package/lib/esm/duet-collapsible.entry.js +2 -2
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +2 -2
- package/lib/esm/duet-divider_2.entry.js +1 -1
- package/lib/esm/duet-editable-table-button.entry.js +14 -7
- package/lib/esm/duet-editable-table_4.entry.js +95 -11
- 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 +9 -3
- package/lib/esm/duet-header_2.entry.js +220 -47
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-icon.entry.js +7 -5
- package/lib/esm/duet-input_2.entry.js +2 -3
- 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 +2 -2
- package/lib/esm/duet-notification_2.entry.js +2 -2
- package/lib/esm/duet-number-input.entry.js +1 -1
- package/lib/esm/duet-progress.entry.js +1 -1
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-range-slider.entry.js +1 -1
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-step_2.entry.js +1 -1
- package/lib/esm/duet-tab_2.entry.js +1 -1
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet-toggle.entry.js +1 -1
- package/lib/esm/duet-tooltip.entry.js +1 -1
- package/lib/esm/duet-tray.entry.js +1 -1
- package/lib/esm/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +4 -4
- package/lib/esm/{focus-utils-c1fa24c4.js → focus-utils-6989cada.js} +1 -1
- package/lib/esm/form-search-ea8e19ae.js +6 -0
- package/lib/esm/{index-05e43a37.js → index-ddb14345.js} +2 -2
- package/lib/esm/loader.js +3 -3
- package/lib/esm/{shadow-css-7c726abb.js → shadow-css-13d024f4.js} +1 -1
- package/lib/esm/token-utils-75f78ca4.js +75 -0
- package/lib/esm-es5/{dom-58cd15f6.js → dom-5d060ace.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 +1 -1
- 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 +1 -1
- package/lib/esm-es5/duet-editable-table_4.entry.js +2 -2
- 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 +1 -1
- package/lib/esm-es5/duet-header_2.entry.js +2 -2
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-icon.entry.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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-6989cada.js +4 -0
- package/lib/esm-es5/form-search-ea8e19ae.js +4 -0
- package/lib/esm-es5/{index-05e43a37.js → index-ddb14345.js} +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/{shadow-css-7c726abb.js → shadow-css-13d024f4.js} +0 -0
- package/lib/esm-es5/token-utils-75f78ca4.js +4 -0
- package/lib/html.html-data.json +36 -11
- package/lib/types/common-types.d.ts +0 -1
- package/lib/types/components/duet-button/duet-button.d.ts +2 -1
- package/lib/types/components/duet-collapsible/duet-collapsible.d.ts +3 -0
- package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +1 -0
- package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +5 -1
- package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +1 -0
- package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +10 -0
- package/lib/types/components/duet-header/duet-header-dropdown.d.ts +16 -0
- package/lib/types/components/duet-header/duet-header-hamburger.d.ts +2 -0
- package/lib/types/components/duet-header/duet-header-icon.d.ts +8 -0
- package/lib/types/components/duet-header/duet-header.d.ts +41 -4
- package/lib/types/components/duet-link/duet-link.d.ts +3 -0
- package/lib/types/components/duet-table/duet-table.d.ts +1 -1
- package/lib/types/components/duet-upload/duet-upload.d.ts +10 -0
- package/lib/types/components.d.ts +52 -10
- package/lib/types/stencil-public-runtime.d.ts +6 -4
- package/lib/types/utils/template-utils.d.ts +13 -0
- package/lib/types/utils/token-utils.d.ts +8 -2
- package/package.json +13 -13
- package/lib/cjs/token-utils-63a9c8dc.js +0 -30
- package/lib/duet/p-1082d9f2.system.entry.js +0 -4
- package/lib/duet/p-12fc4849.system.entry.js +0 -4
- package/lib/duet/p-1ad58142.entry.js +0 -4
- package/lib/duet/p-3c1971d8.js +0 -4
- package/lib/duet/p-60e721aa.system.entry.js +0 -4
- package/lib/duet/p-64c0aa2a.entry.js +0 -4
- package/lib/duet/p-6708db8a.entry.js +0 -4
- package/lib/duet/p-6e363557.system.js +0 -4
- package/lib/duet/p-72629304.entry.js +0 -4
- package/lib/duet/p-75a104e3.entry.js +0 -4
- package/lib/duet/p-7fed7f57.entry.js +0 -4
- package/lib/duet/p-9930e52e.entry.js +0 -4
- package/lib/duet/p-a09ddd8f.entry.js +0 -4
- package/lib/duet/p-cd597d62.system.entry.js +0 -4
- package/lib/duet/p-dd79932a.entry.js +0 -4
- package/lib/duet/p-e038da47.system.entry.js +0 -4
- package/lib/esm/token-utils-590d9413.js +0 -28
- package/lib/esm-es5/focus-utils-c1fa24c4.js +0 -4
- package/lib/esm-es5/token-utils-590d9413.js +0 -4
|
@@ -84,11 +84,13 @@ export class DuetIcon {
|
|
|
84
84
|
* Always the last one in the class.
|
|
85
85
|
*/
|
|
86
86
|
render() {
|
|
87
|
-
const color = this.color === "currentColor"
|
|
87
|
+
const color = this.color === "currentColor"
|
|
88
|
+
? "currentColor"
|
|
89
|
+
: getColorByName(this.color, this.theme) || getColorByName(this.outline, this.theme);
|
|
88
90
|
const styles = {
|
|
89
91
|
color,
|
|
90
|
-
background: getColorByName(this.background),
|
|
91
|
-
"border-color": getColorByName(this.outline),
|
|
92
|
+
background: getColorByName(this.background, this.theme),
|
|
93
|
+
"border-color": getColorByName(this.outline, this.theme),
|
|
92
94
|
};
|
|
93
95
|
return (h(Host, { class: {
|
|
94
96
|
"duet-m-0": this.margin === "none",
|
|
@@ -6,6 +6,9 @@ import { Build, Component, Fragment, h, Host, Method, Prop } from "@stencil/core
|
|
|
6
6
|
import { DuetStringsExternalDefaults } from "../../common-strings";
|
|
7
7
|
import { getLanguage, getLocaleString } from "../../utils/language-utils";
|
|
8
8
|
import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
9
|
+
/**
|
|
10
|
+
* @part duet-link - piercing selector for styling the link
|
|
11
|
+
*/
|
|
9
12
|
export class DuetLink {
|
|
10
13
|
constructor() {
|
|
11
14
|
/**
|
|
@@ -61,7 +64,7 @@ export class DuetLink {
|
|
|
61
64
|
"duet-link": true,
|
|
62
65
|
"duet-link-is-external": this.external,
|
|
63
66
|
"duet-theme-turva": this.theme === "turva",
|
|
64
|
-
}, target: this.external ? "_blank" : "_self", "aria-label": this.accessibleLabel, id: this.identifier, ref: el => (this.nativeLink = el) },
|
|
67
|
+
}, target: this.external ? "_blank" : "_self", "aria-label": this.accessibleLabel, id: this.identifier, ref: el => (this.nativeLink = el), part: "duet-link" },
|
|
65
68
|
h("slot", null),
|
|
66
69
|
Build.isBrowser && this.external && (h(Fragment, null,
|
|
67
70
|
h("duet-visually-hidden", null, this.accessibleLabelExternal),
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
}
|
|
40
40
|
:host dt,
|
|
41
41
|
:host dd {
|
|
42
|
+
margin-inline-start: 0;
|
|
42
43
|
-webkit-hyphens: auto;
|
|
43
44
|
hyphens: auto;
|
|
44
45
|
text-align: left;
|
|
45
46
|
word-break: break-all;
|
|
46
47
|
word-break: break-word;
|
|
47
|
-
margin-inline-start: 0;
|
|
48
48
|
}
|
|
49
49
|
@media (max-width: 35.9375em) {
|
|
50
50
|
:host dt,
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
text-overflow: ellipsis;
|
|
53
53
|
white-space: nowrap;
|
|
54
54
|
cursor: pointer;
|
|
55
|
+
background-color: white;
|
|
55
56
|
border-bottom: 1px solid #e1e3e6;
|
|
56
57
|
border-radius: 0;
|
|
57
58
|
-webkit-appearance: none;
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
overflow: hidden;
|
|
67
68
|
font-size: 0.875rem;
|
|
68
69
|
line-height: 4rem;
|
|
69
|
-
background-color: white;
|
|
70
70
|
border: 0;
|
|
71
71
|
border-radius: 4px;
|
|
72
72
|
transition: border 300ms ease;
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
.duet-theme-turva .duet-drawer-toggle {
|
|
76
76
|
font-family: "turva-sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
77
77
|
color: #171c3a;
|
|
78
|
+
background-color: white;
|
|
78
79
|
border-color: #e4e4e6;
|
|
79
80
|
}
|
|
80
81
|
.duet-drawer-toggle:active {
|
|
@@ -200,14 +201,14 @@
|
|
|
200
201
|
|
|
201
202
|
.duet-drawer-content {
|
|
202
203
|
display: none;
|
|
203
|
-
background-color:
|
|
204
|
+
background-color: white;
|
|
204
205
|
border-bottom: 1px solid #e1e3e6;
|
|
205
206
|
}
|
|
206
207
|
.duet-drawer-content:focus {
|
|
207
208
|
outline: 0;
|
|
208
209
|
}
|
|
209
210
|
.duet-theme-turva .duet-drawer-content {
|
|
210
|
-
background-color:
|
|
211
|
+
background-color: white;
|
|
211
212
|
border-color: #e1e3e6;
|
|
212
213
|
}
|
|
213
214
|
@media (min-width: 62em) {
|
|
@@ -177,59 +177,60 @@ duet-table.duet-theme-turva tbody th {
|
|
|
177
177
|
border-top-color: #e4e4e6;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.duet-table-minimal th, .duet-table-plain th {
|
|
180
|
+
.duet-table-fixed th, .duet-table-minimal th, .duet-table-plain th {
|
|
181
181
|
padding: 16px !important;
|
|
182
182
|
border-bottom: 1px solid #657787;
|
|
183
183
|
}
|
|
184
|
-
.duet-table-minimal th:first-child, .duet-table-plain th:first-child {
|
|
184
|
+
.duet-table-fixed th:first-child, .duet-table-minimal th:first-child, .duet-table-plain th:first-child {
|
|
185
185
|
padding-left: 0 !important;
|
|
186
186
|
}
|
|
187
|
-
.duet-table-minimal th:last-child, .duet-table-plain th:last-child {
|
|
187
|
+
.duet-table-fixed th:last-child, .duet-table-minimal th:last-child, .duet-table-plain th:last-child {
|
|
188
188
|
padding-right: 0 !important;
|
|
189
189
|
}
|
|
190
|
-
.duet-theme-turva.duet-table-minimal th, .duet-theme-turva.duet-table-plain th {
|
|
190
|
+
.duet-theme-turva.duet-table-fixed th, .duet-theme-turva.duet-table-minimal th, .duet-theme-turva.duet-table-plain th {
|
|
191
191
|
border-bottom-color: #444445;
|
|
192
192
|
}
|
|
193
|
-
.duet-table-minimal tbody th, .duet-table-plain tbody th {
|
|
193
|
+
.duet-table-fixed tbody th, .duet-table-minimal tbody th, .duet-table-plain tbody th {
|
|
194
194
|
padding-top: 40px !important;
|
|
195
195
|
border-bottom-color: #e1e3e6;
|
|
196
196
|
}
|
|
197
|
-
.duet-theme-turva.duet-table-minimal tbody th, .duet-theme-turva.duet-table-plain tbody th {
|
|
197
|
+
.duet-theme-turva.duet-table-fixed tbody th, .duet-theme-turva.duet-table-minimal tbody th, .duet-theme-turva.duet-table-plain tbody th {
|
|
198
198
|
border-bottom-color: #e4e4e6;
|
|
199
199
|
}
|
|
200
|
-
.duet-table-minimal td, .duet-table-plain td {
|
|
200
|
+
.duet-table-fixed td, .duet-table-minimal td, .duet-table-plain td {
|
|
201
201
|
padding: 16px !important;
|
|
202
202
|
}
|
|
203
|
-
.duet-table-minimal td:first-child, .duet-table-plain td:first-child {
|
|
203
|
+
.duet-table-fixed td:first-child, .duet-table-minimal td:first-child, .duet-table-plain td:first-child {
|
|
204
204
|
padding-left: 0 !important;
|
|
205
205
|
}
|
|
206
|
-
.duet-table-minimal td:last-child, .duet-table-plain td:last-child {
|
|
206
|
+
.duet-table-fixed td:last-child, .duet-table-minimal td:last-child, .duet-table-plain td:last-child {
|
|
207
207
|
padding-right: 0 !important;
|
|
208
208
|
}
|
|
209
|
-
.duet-table-minimal tbody td, .duet-table-plain tbody td {
|
|
209
|
+
.duet-table-fixed tbody td, .duet-table-minimal tbody td, .duet-table-plain tbody td {
|
|
210
210
|
border-bottom: 1px solid #e1e3e6;
|
|
211
211
|
}
|
|
212
|
-
.duet-theme-turva.duet-table-minimal tbody td, .duet-theme-turva.duet-table-plain tbody td {
|
|
212
|
+
.duet-theme-turva.duet-table-fixed tbody td, .duet-theme-turva.duet-table-minimal tbody td, .duet-theme-turva.duet-table-plain tbody td {
|
|
213
213
|
border-bottom-color: #e4e4e6;
|
|
214
214
|
}
|
|
215
|
-
.duet-table-flattened.duet-table-minimal tbody:first-of-type th, .duet-table-flattened.duet-table-plain tbody:first-of-type th {
|
|
215
|
+
.duet-table-flattened.duet-table-fixed tbody:first-of-type th, .duet-table-flattened.duet-table-minimal tbody:first-of-type th, .duet-table-flattened.duet-table-plain tbody:first-of-type th {
|
|
216
216
|
padding-top: 0 !important;
|
|
217
217
|
}
|
|
218
|
-
.duet-table-flattened.duet-table-minimal td, .duet-table-flattened.duet-table-plain td,
|
|
218
|
+
.duet-table-flattened.duet-table-fixed td, .duet-table-flattened.duet-table-minimal td, .duet-table-flattened.duet-table-plain td,
|
|
219
|
+
.duet-table-flattened.duet-table-fixed tbody th,
|
|
219
220
|
.duet-table-flattened.duet-table-minimal tbody th,
|
|
220
221
|
.duet-table-flattened.duet-table-plain tbody th {
|
|
221
222
|
border-bottom: 0;
|
|
222
223
|
}
|
|
223
|
-
.duet-table-flattened.duet-table-minimal tr, .duet-table-flattened.duet-table-plain tr {
|
|
224
|
+
.duet-table-flattened.duet-table-fixed tr, .duet-table-flattened.duet-table-minimal tr, .duet-table-flattened.duet-table-plain tr {
|
|
224
225
|
padding: 20px 0 !important;
|
|
225
226
|
}
|
|
226
|
-
.duet-table-flattened.duet-table-minimal tbody th, .duet-table-flattened.duet-table-plain tbody th {
|
|
227
|
+
.duet-table-flattened.duet-table-fixed tbody th, .duet-table-flattened.duet-table-minimal tbody th, .duet-table-flattened.duet-table-plain tbody th {
|
|
227
228
|
padding-top: 20px !important;
|
|
228
229
|
}
|
|
229
|
-
.duet-table-flattened.duet-table-minimal tfoot td, .duet-table-flattened.duet-table-plain tfoot td {
|
|
230
|
+
.duet-table-flattened.duet-table-fixed tfoot td, .duet-table-flattened.duet-table-minimal tfoot td, .duet-table-flattened.duet-table-plain tfoot td {
|
|
230
231
|
margin-bottom: 4px !important;
|
|
231
232
|
}
|
|
232
|
-
.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child, .duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child {
|
|
233
|
+
.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child, .duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child, .duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child {
|
|
233
234
|
border-bottom: 0;
|
|
234
235
|
}
|
|
235
236
|
|
|
@@ -263,6 +264,30 @@ duet-table.duet-theme-turva tbody th {
|
|
|
263
264
|
border-top-color: #e4e4e6;
|
|
264
265
|
}
|
|
265
266
|
|
|
267
|
+
.duet-table-fixed table {
|
|
268
|
+
table-layout: fixed;
|
|
269
|
+
}
|
|
270
|
+
.duet-table-fixed tbody tr,
|
|
271
|
+
.duet-table-fixed tbody tr td,
|
|
272
|
+
.duet-table-fixed tbody tr td:first-child {
|
|
273
|
+
padding: 4px !important;
|
|
274
|
+
vertical-align: text-bottom;
|
|
275
|
+
border-bottom: 0 none;
|
|
276
|
+
}
|
|
277
|
+
.duet-table-fixed thead {
|
|
278
|
+
display: none;
|
|
279
|
+
}
|
|
280
|
+
.duet-table-fixed tbody tr,
|
|
281
|
+
.duet-table-fixed tbody tr td {
|
|
282
|
+
border-bottom: 0 none;
|
|
283
|
+
}
|
|
284
|
+
.duet-table-fixed:not(.duet-table-flattened) tfoot {
|
|
285
|
+
border-top: 1px solid #e1e3e6;
|
|
286
|
+
}
|
|
287
|
+
.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot {
|
|
288
|
+
border-top-color: #e4e4e6;
|
|
289
|
+
}
|
|
290
|
+
|
|
266
291
|
.duet-table-scrollable {
|
|
267
292
|
position: relative;
|
|
268
293
|
width: 100%;
|
|
@@ -64,7 +64,7 @@ export class DuetTable {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
this.mq = matchMedia(breakpointToToken[this.breakpoint]);
|
|
67
|
-
this.mq.
|
|
67
|
+
this.mq.addEventListener("change", this.handleMediaQueryChange);
|
|
68
68
|
this.handleMediaQueryChange(this.mq);
|
|
69
69
|
this.observer = new MutationObserver(() => this.copyHeadingsToCells());
|
|
70
70
|
this.observer.observe(this.element, {
|
|
@@ -185,7 +185,7 @@ export class DuetTable {
|
|
|
185
185
|
"mutable": false,
|
|
186
186
|
"complexType": {
|
|
187
187
|
"original": "DuetTableVariant",
|
|
188
|
-
"resolved": "\"plain\" | \"striped\"",
|
|
188
|
+
"resolved": "\"fixed\" | \"plain\" | \"striped\"",
|
|
189
189
|
"references": {
|
|
190
190
|
"DuetTableVariant": {
|
|
191
191
|
"location": "local"
|
|
@@ -59,7 +59,7 @@ export class DuetUpload {
|
|
|
59
59
|
{
|
|
60
60
|
icon: "action-delete",
|
|
61
61
|
color: "color-danger",
|
|
62
|
-
color_hover: "
|
|
62
|
+
color_hover: "primary-dark",
|
|
63
63
|
id: "delete",
|
|
64
64
|
map: ["success", "failure"],
|
|
65
65
|
label: {
|
|
@@ -71,7 +71,7 @@ export class DuetUpload {
|
|
|
71
71
|
{
|
|
72
72
|
icon: "navigation-close",
|
|
73
73
|
color: "primary",
|
|
74
|
-
color_hover: "
|
|
74
|
+
color_hover: "primary-dark",
|
|
75
75
|
id: "cancel",
|
|
76
76
|
map: ["inprogress"],
|
|
77
77
|
label: {
|
|
@@ -192,6 +192,10 @@ export class DuetUpload {
|
|
|
192
192
|
* browser from displaying its own validation errors.
|
|
193
193
|
*/
|
|
194
194
|
this.required = false;
|
|
195
|
+
/**
|
|
196
|
+
* Key used to set vertical alignment of action buttons
|
|
197
|
+
*/
|
|
198
|
+
this.alignment = "middle";
|
|
195
199
|
/**
|
|
196
200
|
* Visually hides the groups labels in the editable table list used to display the list of files
|
|
197
201
|
*/
|
|
@@ -735,6 +739,15 @@ export class DuetUpload {
|
|
|
735
739
|
this.nativeInput.click();
|
|
736
740
|
return;
|
|
737
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
744
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
745
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
746
|
+
*/
|
|
747
|
+
async refresh() {
|
|
748
|
+
this.kick();
|
|
749
|
+
await this.setFocus();
|
|
750
|
+
}
|
|
738
751
|
/**
|
|
739
752
|
* Get list of files, divided in errors and valid sections
|
|
740
753
|
*/
|
|
@@ -769,7 +782,7 @@ export class DuetUpload {
|
|
|
769
782
|
}, id: this.labelId, for: identifier }, this.fileListEmpty)),
|
|
770
783
|
!!this.files.size && h("slot", { name: "fileheader" }),
|
|
771
784
|
!!this.files.size && (h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })),
|
|
772
|
-
!!this.files.size && (h("duet-editable-table", { "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, items: this.convertToDuetEditableTableItems() })),
|
|
785
|
+
!!this.files.size && (h("duet-editable-table", { "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, alignment: this.alignment, items: this.convertToDuetEditableTableItems() })),
|
|
773
786
|
!!this.files.size && h("slot", { name: "filefooter" }),
|
|
774
787
|
h("duet-spacer", { size: "large" }),
|
|
775
788
|
!this.hideButton && (h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle" }, this.buttonLabel)),
|
|
@@ -919,7 +932,7 @@ export class DuetUpload {
|
|
|
919
932
|
},
|
|
920
933
|
"attribute": "actions",
|
|
921
934
|
"reflect": false,
|
|
922
|
-
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n color_hover: \"
|
|
935
|
+
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n color_hover: \"primary-dark\",\n id: \"delete\",\n map: [\"success\", \"failure\"],\n label: {\n fi: \"Poista tiedosto\",\n en: \"Poista tiedosto\",\n sv: \"Ta bort filen\",\n },\n },\n {\n icon: \"navigation-close\",\n color: \"primary\",\n color_hover: \"primary-dark\",\n id: \"cancel\",\n map: [\"inprogress\"],\n label: {\n fi: \"Keskeyt\u00E4 l\u00E4hetys\",\n en: \"Cancel the upload\",\n sv: \"Stop \u00F6verf\u00F6ringen\",\n },\n },\n ]"
|
|
923
936
|
},
|
|
924
937
|
"uri": {
|
|
925
938
|
"type": "string",
|
|
@@ -1214,6 +1227,24 @@ export class DuetUpload {
|
|
|
1214
1227
|
"attribute": "groups",
|
|
1215
1228
|
"reflect": false
|
|
1216
1229
|
},
|
|
1230
|
+
"alignment": {
|
|
1231
|
+
"type": "string",
|
|
1232
|
+
"mutable": false,
|
|
1233
|
+
"complexType": {
|
|
1234
|
+
"original": "string",
|
|
1235
|
+
"resolved": "string",
|
|
1236
|
+
"references": {}
|
|
1237
|
+
},
|
|
1238
|
+
"required": false,
|
|
1239
|
+
"optional": false,
|
|
1240
|
+
"docs": {
|
|
1241
|
+
"tags": [],
|
|
1242
|
+
"text": "Key used to set vertical alignment of action buttons"
|
|
1243
|
+
},
|
|
1244
|
+
"attribute": "alignment",
|
|
1245
|
+
"reflect": false,
|
|
1246
|
+
"defaultValue": "\"middle\""
|
|
1247
|
+
},
|
|
1217
1248
|
"hideGroups": {
|
|
1218
1249
|
"type": "boolean",
|
|
1219
1250
|
"mutable": false,
|
|
@@ -1813,6 +1844,22 @@ export class DuetUpload {
|
|
|
1813
1844
|
"tags": []
|
|
1814
1845
|
}
|
|
1815
1846
|
},
|
|
1847
|
+
"refresh": {
|
|
1848
|
+
"complexType": {
|
|
1849
|
+
"signature": "() => Promise<void>",
|
|
1850
|
+
"parameters": [],
|
|
1851
|
+
"references": {
|
|
1852
|
+
"Promise": {
|
|
1853
|
+
"location": "global"
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
"return": "Promise<void>"
|
|
1857
|
+
},
|
|
1858
|
+
"docs": {
|
|
1859
|
+
"text": "Method for forcing a render of the upload list, element.files can be changed externally\nBut it will only rerender on a new Map or a top Level change - this can be used to update\nthe tabular data if the automatic re-render is no sufficient",
|
|
1860
|
+
"tags": []
|
|
1861
|
+
}
|
|
1862
|
+
},
|
|
1816
1863
|
"getFiles": {
|
|
1817
1864
|
"complexType": {
|
|
1818
1865
|
"signature": "() => Promise<false | { valid: any[]; invalid: any[]; }>",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Produces a function which uses template strings to do simple interpolation from objects.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* var makeMeKing = generateTemplateFn('${name} is now the king of ${country}!');
|
|
9
|
+
*
|
|
10
|
+
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
|
|
11
|
+
* // Logs 'Bryan is now the king of Scotland!'
|
|
12
|
+
*/
|
|
13
|
+
export const generateTemplateFn = (function () {
|
|
14
|
+
const cache = {};
|
|
15
|
+
function generateTemplate(template) {
|
|
16
|
+
if (typeof template !== "string") {
|
|
17
|
+
template = template.outerHTML;
|
|
18
|
+
}
|
|
19
|
+
let fn = cache[template];
|
|
20
|
+
if (!fn) {
|
|
21
|
+
// Replace ${expressions} (etc) with ${map.expressions}.
|
|
22
|
+
const sanitized = template
|
|
23
|
+
.replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
|
|
24
|
+
return `\$\{map.${match.trim()}\}`;
|
|
25
|
+
})
|
|
26
|
+
// Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
|
|
27
|
+
.replace(/(\$\{(?!map\.)[^}]+\})/g, "");
|
|
28
|
+
fn = Function("map", `return \`${sanitized}\``);
|
|
29
|
+
}
|
|
30
|
+
return fn;
|
|
31
|
+
}
|
|
32
|
+
return generateTemplate;
|
|
33
|
+
})();
|
|
@@ -2,24 +2,77 @@
|
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
4
|
import * as tokens from "@duetds/tokens";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const allowedThemes = ["turva"];
|
|
6
|
+
const MATCH_CAPITAL_CASE = /[A-Z]/g;
|
|
7
|
+
export function isCamelCase(str) {
|
|
8
|
+
const camel = MATCH_CAPITAL_CASE.test(str);
|
|
9
|
+
const barredString = !str.includes("_") && !str.includes("-") && !str.includes(" ");
|
|
10
|
+
return camel && barredString;
|
|
8
11
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
12
|
+
export function isDashCase(str) {
|
|
13
|
+
const dash = str.includes("-");
|
|
14
|
+
const barredString = str.includes(" ") || str.includes("_");
|
|
15
|
+
const barredStartingString = str.charAt(0) === "-";
|
|
16
|
+
return dash && !barredString && !barredStartingString;
|
|
11
17
|
}
|
|
12
|
-
export function
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
export function capitalize(str = "") {
|
|
19
|
+
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
|
|
20
|
+
}
|
|
21
|
+
function lowerCaseFirst(str = "") {
|
|
22
|
+
return `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
23
|
+
}
|
|
24
|
+
export function camelize(str = "") {
|
|
25
|
+
const arr = str.split("-");
|
|
26
|
+
//loop through each element of the array and capitalize the first letter.'
|
|
27
|
+
arr.forEach((string, index) => {
|
|
28
|
+
arr[index] = capitalize(string);
|
|
29
|
+
});
|
|
30
|
+
return arr.join("");
|
|
31
|
+
}
|
|
32
|
+
export function getTheme(theme = "") {
|
|
33
|
+
if (allowedThemes.includes(theme.toLowerCase())) {
|
|
34
|
+
return theme.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
function hasColor(str = "") {
|
|
39
|
+
return str.indexOf("Color") === 0 || str.indexOf("color") === 0;
|
|
40
|
+
}
|
|
41
|
+
function addColor(str = "") {
|
|
42
|
+
if (str && !isDashCase(str) && !hasColor(str)) {
|
|
43
|
+
return `color${capitalize(str)}`;
|
|
44
|
+
}
|
|
45
|
+
return str;
|
|
46
|
+
}
|
|
47
|
+
function addTheme(str, theme) {
|
|
48
|
+
const hasTheme = getTheme(theme).length;
|
|
49
|
+
if (hasTheme && str.indexOf(theme) === -1) {
|
|
50
|
+
return `${str}${capitalize(theme)}`;
|
|
51
|
+
}
|
|
52
|
+
return str;
|
|
53
|
+
}
|
|
54
|
+
export function getColorByName(name, theme = "") {
|
|
55
|
+
if (!name) {
|
|
56
|
+
return undefined;
|
|
15
57
|
}
|
|
16
|
-
|
|
17
|
-
|
|
58
|
+
const defaultColor = convertToColorName(name);
|
|
59
|
+
const themedColor = convertToColorName(name, theme);
|
|
60
|
+
// lets just try to get the color first to save some cycles
|
|
61
|
+
let resolvedToken = tokens[themedColor];
|
|
62
|
+
if (!resolvedToken) {
|
|
63
|
+
resolvedToken = tokens[defaultColor];
|
|
18
64
|
}
|
|
19
|
-
return
|
|
65
|
+
return resolvedToken;
|
|
20
66
|
}
|
|
21
|
-
export function
|
|
22
|
-
|
|
23
|
-
|
|
67
|
+
export function convertToColorName(name = "", theme = "") {
|
|
68
|
+
let colorResolution = name;
|
|
69
|
+
const dash = isDashCase(name);
|
|
70
|
+
if (dash) {
|
|
71
|
+
colorResolution = camelize(colorResolution);
|
|
24
72
|
}
|
|
73
|
+
colorResolution = addColor(colorResolution);
|
|
74
|
+
colorResolution = addTheme(colorResolution, theme);
|
|
75
|
+
// takes care of the case where colorPrimaryDark ends up with ColorPrimaryDark
|
|
76
|
+
colorResolution = lowerCaseFirst(colorResolution);
|
|
77
|
+
return colorResolution;
|
|
25
78
|
}
|