@duetds/components 4.34.2 → 4.35.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 +386 -25
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-badge.cjs.entry.js +2 -2
- package/lib/cjs/duet-breadcrumb.cjs.entry.js +48 -0
- package/lib/cjs/duet-breadcrumbs.cjs.entry.js +68 -0
- package/lib/cjs/duet-button_2.cjs.entry.js +4 -3
- package/lib/cjs/duet-caption_4.cjs.entry.js +2 -2
- package/lib/cjs/duet-card.cjs.entry.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/cjs/duet-editable-table_4.cjs.entry.js +12 -3
- 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 +1 -1
- package/lib/cjs/duet-grid_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-header_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-icon.cjs.entry.js +1 -1
- package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-layout.cjs.entry.js +1 -1
- package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-modal.cjs.entry.js +15 -3
- package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
- 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-scrollable_3.cjs.entry.js +414 -0
- 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-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 +2 -2
- package/lib/cjs/{focus-utils-b57facfe.js → focus-utils-e1efc65c.js} +1 -1
- package/lib/cjs/{index-e2021bf7.js → index-6128deac.js} +1 -1
- package/lib/cjs/loader.cjs.js +2 -2
- package/lib/collection/collection-manifest.json +10 -6
- package/lib/collection/components/duet-badge/duet-badge.js +1 -1
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumb.css +57 -0
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumb.js +131 -0
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumbs.css +63 -0
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumbs.js +104 -0
- package/lib/collection/components/duet-button/duet-button.css +22 -4
- package/lib/collection/components/duet-button/duet-button.js +6 -2
- package/lib/collection/components/duet-link/duet-link.js +1 -1
- package/lib/collection/components/duet-modal/duet-modal.js +33 -3
- package/lib/collection/components/duet-scrollable/duet-scrollable.css +83 -0
- package/lib/collection/components/duet-scrollable/duet-scrollable.js +240 -0
- package/lib/collection/components/duet-tab/duet-tab.js +63 -1
- package/lib/collection/components/duet-tab-group/duet-tab-group.css +12 -13
- package/lib/collection/components/duet-tab-group/duet-tab-group.js +101 -16
- package/lib/collection/components/duet-upload/duet-upload.js +32 -4
- package/lib/custom-elements-bundle/index.d.ts +18 -0
- package/lib/custom-elements-bundle/index.js +356 -29
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/p-00b447fe.entry.js +4 -0
- package/lib/duet/{p-69133107.system.entry.js → p-02f369f0.system.entry.js} +1 -1
- package/lib/duet/{p-d3b5d2ef.system.entry.js → p-03bb1f47.system.entry.js} +1 -1
- package/lib/duet/{p-c67a63cc.system.entry.js → p-0569a7ac.system.entry.js} +1 -1
- package/lib/duet/{p-f7f4f98a.system.entry.js → p-08e5b6ec.system.entry.js} +1 -1
- package/lib/duet/{p-75261615.system.entry.js → p-096c0b9e.system.entry.js} +1 -1
- package/lib/duet/{p-7a0a375e.system.entry.js → p-09ba1ab9.system.entry.js} +2 -2
- package/lib/duet/{p-ddbdac54.entry.js → p-0d9989c5.entry.js} +1 -1
- package/lib/duet/{p-8b01f978.system.entry.js → p-0f20c5c4.system.entry.js} +1 -1
- package/lib/duet/{p-a900d55b.entry.js → p-1229b08d.entry.js} +1 -1
- package/lib/duet/{p-2524481a.system.entry.js → p-1b0b462f.system.entry.js} +1 -1
- package/lib/duet/{p-f01494f9.system.entry.js → p-1b134dc3.system.entry.js} +1 -1
- package/lib/duet/p-1fbcd741.entry.js +4 -0
- package/lib/duet/{p-8d42cb7c.entry.js → p-26ab4386.entry.js} +1 -1
- package/lib/duet/{p-08d1abc7.entry.js → p-29d1e8dc.entry.js} +1 -1
- package/lib/duet/{p-4a742d83.entry.js → p-2c8d7bbb.entry.js} +1 -1
- package/lib/duet/{p-5c67bb73.system.entry.js → p-2cc5934d.system.entry.js} +1 -1
- package/lib/duet/{p-8e16057d.system.entry.js → p-2dcc9779.system.entry.js} +1 -1
- package/lib/duet/{p-e1c6f74b.entry.js → p-30cde172.entry.js} +1 -1
- package/lib/duet/{p-e0038277.system.entry.js → p-34381bd0.system.entry.js} +1 -1
- package/lib/duet/{p-baef2241.entry.js → p-39d4e2d4.entry.js} +1 -1
- package/lib/duet/{p-488addbc.entry.js → p-3cc68d7d.entry.js} +1 -1
- package/lib/duet/{p-e242bf98.entry.js → p-3e67d7a2.entry.js} +1 -1
- package/lib/duet/{p-354bf924.entry.js → p-3ea21701.entry.js} +1 -1
- package/lib/duet/{p-c50bbff5.entry.js → p-3f2ac2e1.entry.js} +1 -1
- package/lib/duet/{p-5f2fb5db.entry.js → p-3f954a67.entry.js} +1 -1
- package/lib/duet/{p-a52d436c.entry.js → p-41019921.entry.js} +1 -1
- package/lib/duet/{p-c6ba80c6.entry.js → p-47986fa6.entry.js} +1 -1
- package/lib/duet/{p-ee74ff67.entry.js → p-482f91b0.entry.js} +1 -1
- package/lib/duet/p-4ac19266.entry.js +4 -0
- package/lib/duet/{p-ae8401c9.system.entry.js → p-4cdfa148.system.entry.js} +1 -1
- package/lib/duet/{p-939bf739.system.entry.js → p-4e0cca44.system.entry.js} +1 -1
- package/lib/duet/{p-f6e1fb0f.system.entry.js → p-4e588759.system.entry.js} +1 -1
- package/lib/duet/{p-5f866721.entry.js → p-4eda81b6.entry.js} +1 -1
- package/lib/duet/{p-ae46a7d2.system.entry.js → p-4f77c165.system.entry.js} +1 -1
- package/lib/duet/{p-4d5531be.entry.js → p-58832650.entry.js} +1 -1
- package/lib/duet/p-638ec570.system.entry.js +4 -0
- package/lib/duet/{p-f3c258d8.system.entry.js → p-65d61e92.system.entry.js} +1 -1
- package/lib/duet/p-66ada8c2.system.entry.js +4 -0
- package/lib/duet/{p-ec5d0cda.entry.js → p-6994cca1.entry.js} +1 -1
- package/lib/duet/p-6bbe6707.entry.js +4 -0
- package/lib/duet/{p-62de4645.system.entry.js → p-6bc17eac.system.entry.js} +1 -1
- package/lib/duet/{p-9849a4ab.system.entry.js → p-73cd52c3.system.entry.js} +1 -1
- package/lib/duet/{p-db87c4b1.system.entry.js → p-75d53642.system.entry.js} +1 -1
- package/lib/duet/{p-1fff32a9.system.entry.js → p-796becd9.system.entry.js} +1 -1
- package/lib/duet/{p-e3973f41.system.js → p-7d3a5621.system.js} +1 -1
- package/lib/duet/{p-3998eed6.entry.js → p-8040cc39.entry.js} +1 -1
- package/lib/duet/{p-45a6838d.system.entry.js → p-821da899.system.entry.js} +1 -1
- package/lib/duet/{p-b70f164d.entry.js → p-85170cb2.entry.js} +1 -1
- package/lib/duet/{p-90e7e876.entry.js → p-8a4a55a9.entry.js} +1 -1
- package/lib/duet/{p-3e0a774d.entry.js → p-905e62f0.entry.js} +1 -1
- package/lib/duet/{p-2862054c.entry.js → p-93bd2040.entry.js} +1 -1
- package/lib/duet/{p-13d5fe80.system.entry.js → p-9b56c174.system.entry.js} +1 -1
- package/lib/duet/{p-cdaa629d.system.entry.js → p-9b7a869e.system.entry.js} +1 -1
- package/lib/duet/{p-9793f3d8.entry.js → p-9d1ac81f.entry.js} +1 -1
- package/lib/duet/p-9ee29b96.js +4 -0
- package/lib/duet/{p-a58f0665.system.entry.js → p-9f53bfcc.system.entry.js} +1 -1
- package/lib/duet/{p-0dc01111.system.entry.js → p-a13cceae.system.entry.js} +1 -1
- package/lib/duet/p-a28308b5.entry.js +4 -0
- package/lib/duet/{p-de23ae41.entry.js → p-a5082840.entry.js} +1 -1
- package/lib/duet/{p-5f813e15.entry.js → p-a5d1c883.entry.js} +1 -1
- package/lib/duet/{p-58d7f2d1.entry.js → p-a5f67f2f.entry.js} +1 -1
- package/lib/duet/{p-5e03b63f.system.entry.js → p-ac525a17.system.entry.js} +1 -1
- package/lib/duet/p-ae5596da.js +4 -0
- package/lib/duet/{p-b8dde0c8.system.entry.js → p-af38d5b2.system.entry.js} +1 -1
- package/lib/duet/{p-0e742087.system.entry.js → p-b4fd3539.system.entry.js} +1 -1
- package/lib/duet/{p-f9a096a9.system.entry.js → p-b63dad81.system.entry.js} +1 -1
- package/lib/duet/p-b9bb03cb.system.js +4 -0
- package/lib/duet/{p-eed6f9cc.system.entry.js → p-bae3ae1d.system.entry.js} +1 -1
- package/lib/duet/{p-6a8b3cf0.system.entry.js → p-bf35379f.system.entry.js} +1 -1
- package/lib/duet/{p-72ad7798.entry.js → p-cc916a11.entry.js} +1 -1
- package/lib/duet/{p-4db07868.entry.js → p-d09f2dd8.entry.js} +1 -1
- package/lib/duet/{p-00bf3bbb.system.entry.js → p-d87aa545.system.entry.js} +1 -1
- package/lib/duet/{p-3e47c910.entry.js → p-da6aa538.entry.js} +1 -1
- package/lib/duet/p-ddda5f80.system.js +4 -0
- package/lib/duet/{p-760d2226.entry.js → p-e14ab836.entry.js} +1 -1
- package/lib/duet/{p-582f9135.system.entry.js → p-e193d6f7.system.entry.js} +1 -1
- package/lib/duet/{p-3e273d8d.entry.js → p-e4ebd229.entry.js} +1 -1
- package/lib/duet/{p-ffd449ef.system.entry.js → p-e5224000.system.entry.js} +1 -1
- package/lib/duet/{p-66c35cd2.entry.js → p-ec3cf4d1.entry.js} +1 -1
- package/lib/duet/{p-12941c46.system.entry.js → p-edcd137c.system.entry.js} +1 -1
- package/lib/duet/p-ee13c2e9.system.entry.js +4 -0
- package/lib/duet/{p-4836f66d.entry.js → p-f1013864.entry.js} +1 -1
- package/lib/duet/{p-5a5e7977.entry.js → p-f10d3f3d.entry.js} +1 -1
- package/lib/duet/p-f863e4f8.system.entry.js +4 -0
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-badge.entry.js +2 -2
- package/lib/esm/duet-breadcrumb.entry.js +44 -0
- package/lib/esm/duet-breadcrumbs.entry.js +64 -0
- package/lib/esm/duet-button_2.entry.js +4 -3
- package/lib/esm/duet-caption_4.entry.js +2 -2
- package/lib/esm/duet-card.entry.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/esm/duet-editable-table_4.entry.js +12 -3
- 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 +1 -1
- package/lib/esm/duet-grid_2.entry.js +1 -1
- package/lib/esm/duet-header_2.entry.js +1 -1
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-icon.entry.js +1 -1
- package/lib/esm/duet-input_2.entry.js +1 -1
- package/lib/esm/duet-layout.entry.js +1 -1
- package/lib/esm/duet-list_2.entry.js +1 -1
- package/lib/esm/duet-modal.entry.js +15 -3
- package/lib/esm/duet-notification_2.entry.js +1 -1
- 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-scrollable_3.entry.js +408 -0
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-step_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 +2 -2
- package/lib/esm/{focus-utils-fc14cf36.js → focus-utils-5b40a8be.js} +1 -1
- package/lib/esm/{index-9ef5d3bc.js → index-795979f3.js} +1 -1
- package/lib/esm/loader.js +2 -2
- 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-breadcrumb.entry.js +4 -0
- package/lib/esm-es5/duet-breadcrumbs.entry.js +4 -0
- 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 +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 +1 -1
- package/lib/esm-es5/duet-editable-table_4.entry.js +1 -1
- 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 +1 -1
- 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-scrollable_3.entry.js +4 -0
- 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-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-5b40a8be.js +4 -0
- package/lib/esm-es5/index-795979f3.js +4 -0
- package/lib/esm-es5/loader.js +1 -1
- package/lib/types/components/duet-badge/duet-badge.d.ts +1 -1
- package/lib/types/components/duet-breadcrumbs/duet-breadcrumb.d.ts +31 -0
- package/lib/types/components/duet-breadcrumbs/duet-breadcrumbs.d.ts +23 -0
- package/lib/types/components/duet-button/duet-button.d.ts +2 -1
- package/lib/types/components/duet-modal/duet-modal.d.ts +5 -1
- package/lib/types/components/duet-scrollable/duet-scrollable.d.ts +51 -0
- package/lib/types/components/duet-tab/duet-tab.d.ts +11 -0
- package/lib/types/components/duet-tab-group/duet-tab-group.d.ts +15 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +9 -0
- package/lib/types/components.d.ts +162 -1
- package/package.json +6 -5
- package/lib/cjs/duet-tab_2.cjs.entry.js +0 -213
- package/lib/duet/p-13bc14a6.system.js +0 -4
- package/lib/duet/p-30d13a27.system.js +0 -4
- package/lib/duet/p-60aa83c0.js +0 -4
- package/lib/duet/p-746b3bee.entry.js +0 -4
- package/lib/duet/p-9d487a0d.entry.js +0 -4
- package/lib/duet/p-c92b1af1.system.entry.js +0 -4
- package/lib/duet/p-ce566b2b.js +0 -4
- package/lib/duet/p-d1adeb76.entry.js +0 -4
- package/lib/duet/p-f2c402a9.system.entry.js +0 -4
- package/lib/esm/duet-tab_2.entry.js +0 -208
- package/lib/esm-es5/duet-tab_2.entry.js +0 -4
- package/lib/esm-es5/focus-utils-fc14cf36.js +0 -4
- package/lib/esm-es5/index-9ef5d3bc.js +0 -4
- package/lib/html.html-data.json +0 -4925
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::after,
|
|
3
|
+
*::before {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
background: transparent;
|
|
8
|
+
border: 0;
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
-webkit-appearance: none;
|
|
11
|
+
appearance: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
padding: 0;
|
|
17
|
+
margin: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
border: 0;
|
|
20
|
+
-moz-appearance: none;
|
|
21
|
+
-webkit-appearance: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
display: block;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.duet-breadcrumbs {
|
|
27
|
+
font-family: "localtapiola-sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
28
|
+
}
|
|
29
|
+
.duet-breadcrumbs ol {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
padding: 10px 16px;
|
|
37
|
+
color: #00294d;
|
|
38
|
+
list-style: none;
|
|
39
|
+
background: #f3f9fc;
|
|
40
|
+
border-bottom: 1px solid #e1e3e6;
|
|
41
|
+
}
|
|
42
|
+
@media (min-width: 62em) {
|
|
43
|
+
.duet-breadcrumbs ol {
|
|
44
|
+
padding: 10px 36px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.duet-breadcrumbs.duet-theme-turva {
|
|
48
|
+
font-family: "turva-sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
49
|
+
}
|
|
50
|
+
.duet-breadcrumbs.duet-theme-turva ol {
|
|
51
|
+
color: #171c3a;
|
|
52
|
+
background: #fcf3f4;
|
|
53
|
+
}
|
|
54
|
+
.duet-breadcrumbs .duet-breadrumbs-arrow {
|
|
55
|
+
display: inherit;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
width: 0.375rem;
|
|
59
|
+
height: 0.375rem;
|
|
60
|
+
}
|
|
61
|
+
.duet-breadcrumbs .hide {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import arrowRightSmallIcon from "@duetds/icons/lib/assets/action-arrow-right-small";
|
|
5
|
+
import { Build, Component, Element, Fragment, h, Host, Prop, State } from "@stencil/core";
|
|
6
|
+
import { getLocaleString } from "../../utils/language-utils";
|
|
7
|
+
import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
8
|
+
export class DuetBreadcrumbs {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.observers = [];
|
|
11
|
+
this.breadcrumbsAriaLabel = getLocaleString({
|
|
12
|
+
fi: "Murupolku",
|
|
13
|
+
sv: "Ströbröd",
|
|
14
|
+
en: "Breadcrumbs",
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Theme
|
|
18
|
+
*/
|
|
19
|
+
this.theme = "";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Component lifecycle events.
|
|
23
|
+
*/
|
|
24
|
+
componentWillLoad() {
|
|
25
|
+
inheritGlobalTheme(this);
|
|
26
|
+
this.children = Array.from(this.element.children);
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
if (Build.isServer) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
Array.from(this.element.children).forEach(child => {
|
|
33
|
+
const observer = new MutationObserver(() => (this.children = Array.from(this.element.children)));
|
|
34
|
+
observer.observe(child, {
|
|
35
|
+
childList: true,
|
|
36
|
+
subtree: true,
|
|
37
|
+
attributes: true,
|
|
38
|
+
characterData: true,
|
|
39
|
+
});
|
|
40
|
+
this.observers = [...this.observers, observer];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
if (Build.isServer) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.observers.forEach(observer => observer.disconnect());
|
|
48
|
+
this.observers = [];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* render() function
|
|
52
|
+
* Always the last one in the class.
|
|
53
|
+
*/
|
|
54
|
+
render() {
|
|
55
|
+
return (h(Host, null,
|
|
56
|
+
h("nav", { "aria-label": this.breadcrumbsAriaLabel, class: {
|
|
57
|
+
"duet-breadcrumbs": true,
|
|
58
|
+
"duet-theme-turva": this.theme === "turva",
|
|
59
|
+
} },
|
|
60
|
+
h("ol", null, this.children.map((child, index) => (h(Fragment, null,
|
|
61
|
+
index > 0 && (h("li", { "aria-hidden": "true" },
|
|
62
|
+
h("duet-icon", { class: "duet-breadrumbs-arrow", size: "auto", icon: arrowRightSmallIcon.svg, margin: "none", color: "currentColor" }))),
|
|
63
|
+
h("li", { innerHTML: child.outerHTML }),
|
|
64
|
+
h("div", { class: "hide" },
|
|
65
|
+
h("slot", null)))))))));
|
|
66
|
+
}
|
|
67
|
+
static get is() { return "duet-breadcrumbs"; }
|
|
68
|
+
static get encapsulation() { return "shadow"; }
|
|
69
|
+
static get originalStyleUrls() { return {
|
|
70
|
+
"$": ["duet-breadcrumbs.scss"]
|
|
71
|
+
}; }
|
|
72
|
+
static get styleUrls() { return {
|
|
73
|
+
"$": ["duet-breadcrumbs.css"]
|
|
74
|
+
}; }
|
|
75
|
+
static get properties() { return {
|
|
76
|
+
"theme": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"mutable": true,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "DuetTheme",
|
|
81
|
+
"resolved": "\"\" | \"default\" | \"turva\"",
|
|
82
|
+
"references": {
|
|
83
|
+
"DuetTheme": {
|
|
84
|
+
"location": "import",
|
|
85
|
+
"path": "../../common-types"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": "Theme"
|
|
94
|
+
},
|
|
95
|
+
"attribute": "theme",
|
|
96
|
+
"reflect": false,
|
|
97
|
+
"defaultValue": "\"\""
|
|
98
|
+
}
|
|
99
|
+
}; }
|
|
100
|
+
static get states() { return {
|
|
101
|
+
"children": {}
|
|
102
|
+
}; }
|
|
103
|
+
static get elementRef() { return "element"; }
|
|
104
|
+
}
|
|
@@ -318,22 +318,40 @@
|
|
|
318
318
|
.duet-theme-turva .duet-button.negative:focus {
|
|
319
319
|
box-shadow: 0 0 0 1px #171c3a, 0 0 0 4px rgba(255, 255, 255, 0.7);
|
|
320
320
|
}
|
|
321
|
-
.duet-button.destructive {
|
|
321
|
+
.duet-button.destructive-primary {
|
|
322
|
+
color: white !important;
|
|
323
|
+
background: #de2362;
|
|
324
|
+
border-color: #de2362;
|
|
325
|
+
}
|
|
326
|
+
.duet-theme-turva .duet-button.destructive-primary {
|
|
327
|
+
color: white !important;
|
|
328
|
+
background: #e02a0d;
|
|
329
|
+
border-color: #e02a0d;
|
|
330
|
+
}
|
|
331
|
+
.duet-button.destructive-primary:hover {
|
|
332
|
+
background: #b21c4e;
|
|
333
|
+
border-color: #b21c4e;
|
|
334
|
+
box-shadow: 0 4px 20px rgba(34, 34, 34, 0.1);
|
|
335
|
+
}
|
|
336
|
+
.duet-theme-turva .duet-button.destructive-primary:hover {
|
|
337
|
+
background: #b3220a;
|
|
338
|
+
}
|
|
339
|
+
.duet-button.destructive, .duet-button.destructive-secondary {
|
|
322
340
|
color: #de2362 !important;
|
|
323
341
|
background: white;
|
|
324
342
|
border-color: #de2362;
|
|
325
343
|
}
|
|
326
|
-
.duet-theme-turva .duet-button.destructive {
|
|
344
|
+
.duet-theme-turva .duet-button.destructive, .duet-theme-turva .duet-button.destructive-secondary {
|
|
327
345
|
color: #e02a0d !important;
|
|
328
346
|
background: white;
|
|
329
347
|
border-color: #e02a0d;
|
|
330
348
|
}
|
|
331
|
-
.duet-button.destructive:hover {
|
|
349
|
+
.duet-button.destructive:hover, .duet-button.destructive-secondary:hover {
|
|
332
350
|
color: white !important;
|
|
333
351
|
background: #b21c4e;
|
|
334
352
|
border-color: #b21c4e;
|
|
335
353
|
}
|
|
336
|
-
.duet-theme-turva .duet-button.destructive:hover {
|
|
354
|
+
.duet-theme-turva .duet-button.destructive:hover, .duet-theme-turva .duet-button.destructive-secondary:hover {
|
|
337
355
|
color: white !important;
|
|
338
356
|
background: #b3220a;
|
|
339
357
|
border-color: #b3220a;
|
|
@@ -15,6 +15,7 @@ export class DuetButton {
|
|
|
15
15
|
/**
|
|
16
16
|
* Style variation of the button.
|
|
17
17
|
* @negative - value is deprecated and should be used in combination with negative prop in the future
|
|
18
|
+
* @destructive - value is deprecated and should be replace with destructive-secondary
|
|
18
19
|
*/
|
|
19
20
|
this.variation = "default";
|
|
20
21
|
/**
|
|
@@ -227,7 +228,7 @@ export class DuetButton {
|
|
|
227
228
|
"duet-button-negative": this.negative || this.variation === "negative",
|
|
228
229
|
[this.variation]: true,
|
|
229
230
|
} },
|
|
230
|
-
this.url ? (h("a", Object.assign({}, commonProps, { href: this.url, target: this.external ? "_blank" : "_self" }),
|
|
231
|
+
this.url ? (h("a", Object.assign({}, commonProps, { href: this.url, target: this.external ? "_blank" : "_self", rel: this.external ? "noopener" : undefined }),
|
|
231
232
|
commonChildren,
|
|
232
233
|
this.external && h("duet-visually-hidden", null,
|
|
233
234
|
", ",
|
|
@@ -385,7 +386,7 @@ export class DuetButton {
|
|
|
385
386
|
"mutable": false,
|
|
386
387
|
"complexType": {
|
|
387
388
|
"original": "DuetButtonVariation",
|
|
388
|
-
"resolved": "\"default\" | \"destructive\" | \"negative\" | \"plain\" | \"primary\" | \"secondary\"",
|
|
389
|
+
"resolved": "\"default\" | \"destructive\" | \"destructive-primary\" | \"destructive-secondary\" | \"negative\" | \"plain\" | \"primary\" | \"secondary\"",
|
|
389
390
|
"references": {
|
|
390
391
|
"DuetButtonVariation": {
|
|
391
392
|
"location": "local"
|
|
@@ -398,6 +399,9 @@ export class DuetButton {
|
|
|
398
399
|
"tags": [{
|
|
399
400
|
"name": "negative",
|
|
400
401
|
"text": "- value is deprecated and should be used in combination with negative prop in the future"
|
|
402
|
+
}, {
|
|
403
|
+
"name": "destructive",
|
|
404
|
+
"text": "- value is deprecated and should be replace with destructive-secondary"
|
|
401
405
|
}],
|
|
402
406
|
"text": "Style variation of the button."
|
|
403
407
|
},
|
|
@@ -64,7 +64,7 @@ export class DuetLink {
|
|
|
64
64
|
"duet-link": true,
|
|
65
65
|
"duet-link-is-external": this.external,
|
|
66
66
|
"duet-theme-turva": this.theme === "turva",
|
|
67
|
-
}, target: this.external ? "_blank" : "_self", "aria-label": this.accessibleLabel, id: this.identifier, ref: el => (this.nativeLink = el), part: "duet-link" },
|
|
67
|
+
}, target: this.external ? "_blank" : "_self", "aria-label": this.accessibleLabel, id: this.identifier, ref: el => (this.nativeLink = el), part: "duet-link", rel: this.external ? "noopener" : undefined },
|
|
68
68
|
h("slot", null),
|
|
69
69
|
Build.isBrowser && this.external && (h(Fragment, null,
|
|
70
70
|
h("duet-visually-hidden", null, this.accessibleLabelExternal),
|
|
@@ -103,6 +103,10 @@ export class DuetModal {
|
|
|
103
103
|
* Use this property when you need to have the modal dialog initially active.
|
|
104
104
|
*/
|
|
105
105
|
this.active = false;
|
|
106
|
+
/**
|
|
107
|
+
* Use this property when you want the modal to close when clicked outside of modal.
|
|
108
|
+
*/
|
|
109
|
+
this.closeOnBlur = false;
|
|
106
110
|
}
|
|
107
111
|
openChanged() {
|
|
108
112
|
if (this.open) {
|
|
@@ -217,8 +221,16 @@ export class DuetModal {
|
|
|
217
221
|
h("div", { class: {
|
|
218
222
|
"duet-modal-inner": true,
|
|
219
223
|
"duet-modal-large": this.size === "large",
|
|
220
|
-
}, role: "document"
|
|
221
|
-
|
|
224
|
+
}, role: "document", onClick: e => {
|
|
225
|
+
if (this.closeOnBlur) {
|
|
226
|
+
this.closeModal(e);
|
|
227
|
+
}
|
|
228
|
+
} },
|
|
229
|
+
h("div", { class: { "duet-modal": true, [this.size]: true }, onClick: e => {
|
|
230
|
+
if (this.closeOnBlur) {
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
}
|
|
233
|
+
} },
|
|
222
234
|
h("duet-spacer", null),
|
|
223
235
|
h("div", { class: "duet-modal-close" },
|
|
224
236
|
h("duet-button", { ref: button => (this.buttonEl = button), variation: "plain", accessibleLabel: this.accessibleCloseLabel, color: closeColor, iconSize: "large", icon: "navigation-close", iconOnly: true, margin: "none", theme: this.theme, onClick: ev => this.closeModal(ev), fixed: true })),
|
|
@@ -493,6 +505,24 @@ export class DuetModal {
|
|
|
493
505
|
"attribute": "active",
|
|
494
506
|
"reflect": true,
|
|
495
507
|
"defaultValue": "false"
|
|
508
|
+
},
|
|
509
|
+
"closeOnBlur": {
|
|
510
|
+
"type": "boolean",
|
|
511
|
+
"mutable": true,
|
|
512
|
+
"complexType": {
|
|
513
|
+
"original": "boolean",
|
|
514
|
+
"resolved": "boolean",
|
|
515
|
+
"references": {}
|
|
516
|
+
},
|
|
517
|
+
"required": false,
|
|
518
|
+
"optional": false,
|
|
519
|
+
"docs": {
|
|
520
|
+
"tags": [],
|
|
521
|
+
"text": "Use this property when you want the modal to close when clicked outside of modal."
|
|
522
|
+
},
|
|
523
|
+
"attribute": "close-on-blur",
|
|
524
|
+
"reflect": false,
|
|
525
|
+
"defaultValue": "false"
|
|
496
526
|
}
|
|
497
527
|
}; }
|
|
498
528
|
static get states() { return {
|
|
@@ -536,7 +566,7 @@ export class DuetModal {
|
|
|
536
566
|
"composed": true,
|
|
537
567
|
"docs": {
|
|
538
568
|
"tags": [],
|
|
539
|
-
"text": "Emitted
|
|
569
|
+
"text": "Emitted before the modal is closed. To prevent the modal from actually closing, use ev.detail.originalEvent.preventDefault()."
|
|
540
570
|
},
|
|
541
571
|
"complexType": {
|
|
542
572
|
"original": "DuetModalCloseEvent",
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::after,
|
|
3
|
+
*::before {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
background: transparent;
|
|
8
|
+
border: 0;
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
-webkit-appearance: none;
|
|
11
|
+
appearance: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
padding: 0;
|
|
17
|
+
margin: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
border: 0;
|
|
20
|
+
-moz-appearance: none;
|
|
21
|
+
-webkit-appearance: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
-webkit-tap-highlight-color: transparent;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host {
|
|
27
|
+
position: relative !important;
|
|
28
|
+
}
|
|
29
|
+
:host .duet-scrollable-items {
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
:host .duet-scrollable-items .duet-scrollable-button {
|
|
33
|
+
position: relative;
|
|
34
|
+
flex: 0 0 auto;
|
|
35
|
+
flex-basis: 40px;
|
|
36
|
+
padding: 10px;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
:host .duet-scrollable-items .duet-scrollable-button:active {
|
|
40
|
+
transform: scale(0.8);
|
|
41
|
+
}
|
|
42
|
+
:host .duet-scrollable-items .duet-scrollable-button--left {
|
|
43
|
+
left: -12px;
|
|
44
|
+
}
|
|
45
|
+
:host .duet-scrollable-items .duet-scrollable-button--right {
|
|
46
|
+
right: -12px;
|
|
47
|
+
}
|
|
48
|
+
:host .duet-scrollable-items .duet-scrollable-button--occluded {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
:host .duet-scrollable-items .duet-scrollable-list {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-wrap: nowrap;
|
|
54
|
+
gap: 20px;
|
|
55
|
+
padding-top: 2px;
|
|
56
|
+
/* Make this scrollable when needed */
|
|
57
|
+
overflow-x: auto;
|
|
58
|
+
/* We don't want vertical scrolling */
|
|
59
|
+
overflow-y: hidden;
|
|
60
|
+
/* We don't want internal inline elements to wrap */
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
scroll-snap-type: x mandatory;
|
|
63
|
+
scroll-behavior: smooth;
|
|
64
|
+
/* Add margin at ends to make visual appearance better */
|
|
65
|
+
scroll-margin: 0 20px;
|
|
66
|
+
/* Make an auto-hiding scroller for the 3 people using a IE */
|
|
67
|
+
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
68
|
+
/* For WebKit implementations, provide inertia scrolling */
|
|
69
|
+
-webkit-overflow-scrolling: touch;
|
|
70
|
+
/* Remove the default scrollbar for WebKit implementations */
|
|
71
|
+
}
|
|
72
|
+
:host .duet-scrollable-items .duet-scrollable-list::-webkit-scrollbar {
|
|
73
|
+
display: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
::slotted(*) {
|
|
77
|
+
scroll-snap-align: center;
|
|
78
|
+
margin-left: 0;
|
|
79
|
+
-webkit-transition: -webkit-transform 0.2s ease-in-out;
|
|
80
|
+
transition: -webkit-transform 0.2s ease-in-out;
|
|
81
|
+
transition: transform 0.2s ease-in-out;
|
|
82
|
+
transition: transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;
|
|
83
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Duet Design System
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Element, h, Host, Prop, State, Watch } from "@stencil/core";
|
|
5
|
+
import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
6
|
+
export class DuetScrollable {
|
|
7
|
+
constructor() {
|
|
8
|
+
/**
|
|
9
|
+
* Private variables and constants index
|
|
10
|
+
*/
|
|
11
|
+
this.currentIndex = 0;
|
|
12
|
+
this.tabListElement = undefined;
|
|
13
|
+
this.tabListClass = "duet-scrollable-list";
|
|
14
|
+
this.tablistAtStart = true;
|
|
15
|
+
this.isTabContentSmallerThanWrapper = false;
|
|
16
|
+
this.tablistAtEnd = false;
|
|
17
|
+
this.childrenData = {};
|
|
18
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
20
|
+
// otherwise, something is wrong, expecting 1 element only
|
|
21
|
+
if ((entries === null || entries === void 0 ? void 0 : entries.length) === 1) {
|
|
22
|
+
const currentWidth = (_b = (_a = entries[0]) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width;
|
|
23
|
+
const scrollWidth = (_d = (_c = entries[0]) === null || _c === void 0 ? void 0 : _c.target) === null || _d === void 0 ? void 0 : _d.scrollWidth;
|
|
24
|
+
// in order to avoid state "jumping" on the boundary condition we add a few pixels to the comparison
|
|
25
|
+
this.isTabContentSmallerThanWrapper = scrollWidth > currentWidth + 5;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Theme of duet-tab-scrollable. When used this will override the color setting and
|
|
30
|
+
* use "primary" or "primary-turva" as the color depending on which theme
|
|
31
|
+
* is chosen.
|
|
32
|
+
*/
|
|
33
|
+
this.theme = "";
|
|
34
|
+
/**
|
|
35
|
+
* Optional identifier to add to buttons in the tab group
|
|
36
|
+
*/
|
|
37
|
+
this.identifier = "";
|
|
38
|
+
/**
|
|
39
|
+
* Selected element
|
|
40
|
+
*/
|
|
41
|
+
this.selected = 0;
|
|
42
|
+
}
|
|
43
|
+
watchPropHandler(newValue) {
|
|
44
|
+
this.scrollToTab(newValue, "center");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Component lifecycle events.
|
|
48
|
+
*/
|
|
49
|
+
componentWillLoad() {
|
|
50
|
+
inheritGlobalTheme(this);
|
|
51
|
+
const slotted = this.host.children;
|
|
52
|
+
this.childrenData = { hasChildren: slotted && slotted.length > 0, numberOfChildren: slotted && slotted.length };
|
|
53
|
+
}
|
|
54
|
+
componentDidLoad() {
|
|
55
|
+
this.resizeObserver.observe(this.tabListElement);
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
this.resizeObserver.disconnect();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Private methods.
|
|
62
|
+
*/
|
|
63
|
+
getLastVisibleElement() {
|
|
64
|
+
const clientWidth = this.tabListElement.clientWidth;
|
|
65
|
+
const xValues = Array.from(this.host.querySelectorAll("button")).findIndex(element => element.getBoundingClientRect().x > clientWidth);
|
|
66
|
+
return xValues;
|
|
67
|
+
}
|
|
68
|
+
getFirstVisibleElement() {
|
|
69
|
+
const buttonCollection = this.host.querySelectorAll("button");
|
|
70
|
+
// reverse the array because we want the first invisible element form the middle, not the first in the list
|
|
71
|
+
const arrayOfXValues = Array.from(buttonCollection).map(el => el.getBoundingClientRect().x - el.getBoundingClientRect().width);
|
|
72
|
+
const xValues = arrayOfXValues.findIndex(element => {
|
|
73
|
+
return element > 0;
|
|
74
|
+
});
|
|
75
|
+
return xValues;
|
|
76
|
+
}
|
|
77
|
+
updateScrollButtons(container = this.tabListElement) {
|
|
78
|
+
if (container.scrollLeft <= 0) {
|
|
79
|
+
this.tablistAtStart = true;
|
|
80
|
+
}
|
|
81
|
+
else if (container.scrollLeft > 0) {
|
|
82
|
+
this.tablistAtStart = false;
|
|
83
|
+
}
|
|
84
|
+
if (container.clientWidth + container.scrollLeft + 10 >= container.scrollWidth) {
|
|
85
|
+
this.tablistAtEnd = true;
|
|
86
|
+
}
|
|
87
|
+
else if (container.clientWidth + container.scrollLeft + 10 < container.scrollWidth) {
|
|
88
|
+
this.tablistAtEnd = false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
scrollToTab(index = this.currentIndex, inline) {
|
|
92
|
+
if (!this.childrenData.hasChildren) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (index + 1 >= this.childrenData.numberOfChildren) {
|
|
96
|
+
index = this.childrenData.numberOfChildren - 1;
|
|
97
|
+
}
|
|
98
|
+
if (index < 0) {
|
|
99
|
+
index = 0;
|
|
100
|
+
}
|
|
101
|
+
const buttons = this.host.querySelectorAll("button");
|
|
102
|
+
// store previous position
|
|
103
|
+
let prevPosition = buttons[0].getBoundingClientRect().x;
|
|
104
|
+
// iterations to run
|
|
105
|
+
let ticksWhereScrollDidNotHappen = 5;
|
|
106
|
+
const getAnimationFrame = () => {
|
|
107
|
+
// if we get the same value enter the logic loop
|
|
108
|
+
if (buttons[0].getBoundingClientRect().x === prevPosition) {
|
|
109
|
+
ticksWhereScrollDidNotHappen--;
|
|
110
|
+
// When iteration is not complete run the calculation again
|
|
111
|
+
if (ticksWhereScrollDidNotHappen !== 0) {
|
|
112
|
+
window.requestAnimationFrame(getAnimationFrame);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.updateScrollButtons();
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
window.requestAnimationFrame(getAnimationFrame);
|
|
119
|
+
prevPosition = buttons[0].getBoundingClientRect().x;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
buttons[index].scrollIntoView({ behavior: "smooth", inline });
|
|
123
|
+
window.requestAnimationFrame(getAnimationFrame);
|
|
124
|
+
}
|
|
125
|
+
scrollLeft() {
|
|
126
|
+
this.tablistAtEnd = false;
|
|
127
|
+
const first = this.getFirstVisibleElement() - 1;
|
|
128
|
+
this.scrollToTab(first, "center");
|
|
129
|
+
}
|
|
130
|
+
scrollRight() {
|
|
131
|
+
this.tablistAtStart = false;
|
|
132
|
+
const last = this.getLastVisibleElement() + 1;
|
|
133
|
+
this.scrollToTab(last, "center");
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* render() function
|
|
137
|
+
* Always the last one in the class.
|
|
138
|
+
*/
|
|
139
|
+
render() {
|
|
140
|
+
return (h(Host, { class: {
|
|
141
|
+
"duet-theme-turva": this.theme === "turva",
|
|
142
|
+
"duet-theme-default": this.theme === "default",
|
|
143
|
+
} },
|
|
144
|
+
h("div", { class: "duet-scrollable-items" },
|
|
145
|
+
h("button", { part: `${this.identifier}-button-left`, "aria-hidden": "true", class: {
|
|
146
|
+
"duet-scrollable-button": true,
|
|
147
|
+
"duet-scrollable-button--left": true,
|
|
148
|
+
"duet-scrollable-button--occluded": !this.isTabContentSmallerThanWrapper,
|
|
149
|
+
}, onClick: () => this.scrollLeft(), disabled: this.tablistAtStart, tabindex: "-1" },
|
|
150
|
+
h("duet-icon", { name: "action-arrow-left-small", size: "small", margin: "none" })),
|
|
151
|
+
h("div", { class: this.tabListClass, onScroll: () => this.updateScrollButtons(), ref: element => (this.tabListElement = element) },
|
|
152
|
+
h("slot", null)),
|
|
153
|
+
h("button", { part: `${this.identifier}-button-right`, "aria-hidden": "true", class: {
|
|
154
|
+
"duet-scrollable-button": true,
|
|
155
|
+
"duet-scrollable-button--right": true,
|
|
156
|
+
"duet-scrollable-button--occluded": !this.isTabContentSmallerThanWrapper,
|
|
157
|
+
}, onClick: () => this.scrollRight(), disabled: this.tablistAtEnd, tabindex: "-1" },
|
|
158
|
+
h("duet-icon", { name: "action-arrow-right-small", size: "small", margin: "none" })))));
|
|
159
|
+
}
|
|
160
|
+
static get is() { return "duet-scrollable"; }
|
|
161
|
+
static get encapsulation() { return "shadow"; }
|
|
162
|
+
static get originalStyleUrls() { return {
|
|
163
|
+
"$": ["duet-scrollable.scss"]
|
|
164
|
+
}; }
|
|
165
|
+
static get styleUrls() { return {
|
|
166
|
+
"$": ["duet-scrollable.css"]
|
|
167
|
+
}; }
|
|
168
|
+
static get properties() { return {
|
|
169
|
+
"theme": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": true,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "DuetTheme",
|
|
174
|
+
"resolved": "\"\" | \"default\" | \"turva\"",
|
|
175
|
+
"references": {
|
|
176
|
+
"DuetTheme": {
|
|
177
|
+
"location": "import",
|
|
178
|
+
"path": "../../common-types"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "Theme of duet-tab-scrollable. When used this will override the color setting and\nuse \"primary\" or \"primary-turva\" as the color depending on which theme\nis chosen."
|
|
187
|
+
},
|
|
188
|
+
"attribute": "theme",
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"defaultValue": "\"\""
|
|
191
|
+
},
|
|
192
|
+
"identifier": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "string",
|
|
197
|
+
"resolved": "string",
|
|
198
|
+
"references": {}
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"optional": false,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [],
|
|
204
|
+
"text": "Optional identifier to add to buttons in the tab group"
|
|
205
|
+
},
|
|
206
|
+
"attribute": "identifier",
|
|
207
|
+
"reflect": false,
|
|
208
|
+
"defaultValue": "\"\""
|
|
209
|
+
},
|
|
210
|
+
"selected": {
|
|
211
|
+
"type": "number",
|
|
212
|
+
"mutable": true,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "number",
|
|
215
|
+
"resolved": "number",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": false,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": "Selected element"
|
|
223
|
+
},
|
|
224
|
+
"attribute": "selected",
|
|
225
|
+
"reflect": false,
|
|
226
|
+
"defaultValue": "0"
|
|
227
|
+
}
|
|
228
|
+
}; }
|
|
229
|
+
static get states() { return {
|
|
230
|
+
"tablistAtStart": {},
|
|
231
|
+
"isTabContentSmallerThanWrapper": {},
|
|
232
|
+
"tablistAtEnd": {},
|
|
233
|
+
"childrenData": {}
|
|
234
|
+
}; }
|
|
235
|
+
static get elementRef() { return "host"; }
|
|
236
|
+
static get watchers() { return [{
|
|
237
|
+
"propName": "selected",
|
|
238
|
+
"methodName": "watchPropHandler"
|
|
239
|
+
}]; }
|
|
240
|
+
}
|