@oiz/stzh-components 2.6.0-aalpha → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-2de776c8.js → app-globals-4dcdf160.js} +2 -2
- package/dist/cjs/{app-globals-2de776c8.js.map → app-globals-4dcdf160.js.map} +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-actions.cjs.entry.js +1 -5
- package/dist/cjs/stzh-actions.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-actionset.cjs.entry.js +2 -2
- package/dist/cjs/stzh-actionset.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-amount.cjs.entry.js +74 -20
- package/dist/cjs/stzh-amount.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-badge_3.cjs.entry.js +2 -2
- package/dist/cjs/stzh-badge_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-checkboxgroup.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datatable.cjs.entry.js +2 -2
- package/dist/cjs/stzh-datatable.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-dropdown.cjs.entry.js +4 -4
- package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-ghettobox_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-ghettobox_2.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-input.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-invert.cjs.entry.js +1 -1
- package/dist/cjs/stzh-invert.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-table.cjs.entry.js +2 -2
- package/dist/cjs/stzh-table.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-upload.cjs.entry.js +19 -7
- package/dist/cjs/stzh-upload.cjs.entry.js.map +1 -1
- package/dist/collection/assets/i18n/de.json +7 -0
- package/dist/collection/assets/i18n/en.json +7 -0
- package/dist/collection/components/stzh-actions/stzh-actions.js +1 -5
- package/dist/collection/components/stzh-actions/stzh-actions.js.map +1 -1
- package/dist/collection/components/stzh-actionset/stzh-actionset.js +2 -2
- package/dist/collection/components/stzh-actionset/stzh-actionset.js.map +1 -1
- package/dist/collection/components/stzh-amount/stzh-amount.css +1 -0
- package/dist/collection/components/stzh-amount/stzh-amount.js +127 -29
- package/dist/collection/components/stzh-amount/stzh-amount.js.map +1 -1
- package/dist/collection/components/stzh-amount/stzh-amount.localization.js +2 -0
- package/dist/collection/components/stzh-amount/stzh-amount.localization.js.map +1 -0
- package/dist/collection/components/stzh-amount/stzh-amount.stories.js +17 -2
- package/dist/collection/components/stzh-button/stzh-button.css +2 -2
- package/dist/collection/components/stzh-button/stzh-button.js +1 -1
- package/dist/collection/components/stzh-button/stzh-button.js.map +1 -1
- package/dist/collection/components/stzh-chart/stzh-chart.stories.js +1 -3
- package/dist/collection/components/stzh-checkbox/stzh-checkbox.js +1 -1
- package/dist/collection/components/stzh-checkbox/stzh-checkbox.js.map +1 -1
- package/dist/collection/components/stzh-checkboxgroup/stzh-checkboxgroup.js +1 -1
- package/dist/collection/components/stzh-checkboxgroup/stzh-checkboxgroup.js.map +1 -1
- package/dist/collection/components/stzh-datatable/stzh-datatable.css +18 -19
- package/dist/collection/components/stzh-datatable/stzh-datatable.js +2 -2
- package/dist/collection/components/stzh-datatable/stzh-datatable.js.map +1 -1
- package/dist/collection/components/stzh-datatable/stzh-datatable.stories.js +1 -0
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js +1 -1
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +11 -0
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +3 -3
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
- package/dist/collection/components/stzh-ghettobox/stzh-ghettobox.css +4 -4
- package/dist/collection/components/stzh-input/stzh-input.js +1 -1
- package/dist/collection/components/stzh-input/stzh-input.js.map +1 -1
- package/dist/collection/components/stzh-invert/stzh-invert.css +2 -2
- package/dist/collection/components/stzh-radio/stzh-radio.js +1 -1
- package/dist/collection/components/stzh-radio/stzh-radio.js.map +1 -1
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.js +1 -1
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.js.map +1 -1
- package/dist/collection/components/stzh-table/stzh-table.css +18 -19
- package/dist/collection/components/stzh-table/stzh-table.js +2 -1
- package/dist/collection/components/stzh-table/stzh-table.js.map +1 -1
- package/dist/collection/components/stzh-table/stzh-table.stories.js +1 -0
- package/dist/collection/components/stzh-textandimage/stzh-textandimage.stories.js +1 -1
- package/dist/collection/components/stzh-toggle/stzh-toggle.js +1 -1
- package/dist/collection/components/stzh-toggle/stzh-toggle.js.map +1 -1
- package/dist/collection/components/stzh-upload/stzh-upload.js +53 -3
- package/dist/collection/components/stzh-upload/stzh-upload.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/libraries/dropzone/dropzone-amd-module.js +11 -5
- package/dist/collection/libraries/dropzone/dropzone.js +11 -5
- package/dist/collection/libraries/dropzone/min/dropzone-amd-module.min.js +1 -1
- package/dist/collection/libraries/dropzone/min/dropzone.min.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/stzh-actions.js +1 -5
- package/dist/components/stzh-actions.js.map +1 -1
- package/dist/components/stzh-actionset2.js +2 -2
- package/dist/components/stzh-actionset2.js.map +1 -1
- package/dist/components/stzh-amount.js +85 -30
- package/dist/components/stzh-amount.js.map +1 -1
- package/dist/components/stzh-button2.js +2 -2
- package/dist/components/stzh-button2.js.map +1 -1
- package/dist/components/stzh-checkbox.js.map +1 -1
- package/dist/components/stzh-checkboxgroup.js.map +1 -1
- package/dist/components/stzh-datatable.js +2 -2
- package/dist/components/stzh-datatable.js.map +1 -1
- package/dist/components/stzh-datepicker2.js.map +1 -1
- package/dist/components/stzh-dropdown2.js +4 -4
- package/dist/components/stzh-dropdown2.js.map +1 -1
- package/dist/components/stzh-ghettobox2.js +1 -1
- package/dist/components/stzh-ghettobox2.js.map +1 -1
- package/dist/components/stzh-input2.js.map +1 -1
- package/dist/components/stzh-invert.js +1 -1
- package/dist/components/stzh-invert.js.map +1 -1
- package/dist/components/stzh-radio2.js.map +1 -1
- package/dist/components/stzh-radiogroup2.js.map +1 -1
- package/dist/components/stzh-table.js +2 -2
- package/dist/components/stzh-table.js.map +1 -1
- package/dist/components/stzh-toggle.js.map +1 -1
- package/dist/components/stzh-upload.js +22 -8
- package/dist/components/stzh-upload.js.map +1 -1
- package/dist/esm/{app-globals-08f8b108.js → app-globals-91875913.js} +2 -2
- package/dist/esm/{app-globals-08f8b108.js.map → app-globals-91875913.js.map} +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-actions.entry.js +1 -5
- package/dist/esm/stzh-actions.entry.js.map +1 -1
- package/dist/esm/stzh-actionset.entry.js +2 -2
- package/dist/esm/stzh-actionset.entry.js.map +1 -1
- package/dist/esm/stzh-amount.entry.js +75 -21
- package/dist/esm/stzh-amount.entry.js.map +1 -1
- package/dist/esm/stzh-badge_3.entry.js +2 -2
- package/dist/esm/stzh-badge_3.entry.js.map +1 -1
- package/dist/esm/stzh-checkbox.entry.js.map +1 -1
- package/dist/esm/stzh-checkboxgroup.entry.js.map +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datatable.entry.js +2 -2
- package/dist/esm/stzh-datatable.entry.js.map +1 -1
- package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm/stzh-dropdown.entry.js +4 -4
- package/dist/esm/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm/stzh-ghettobox_2.entry.js.map +1 -1
- package/dist/esm/stzh-input.entry.js.map +1 -1
- package/dist/esm/stzh-invert.entry.js +1 -1
- package/dist/esm/stzh-invert.entry.js.map +1 -1
- package/dist/esm/stzh-table.entry.js +2 -2
- package/dist/esm/stzh-table.entry.js.map +1 -1
- package/dist/esm/stzh-toggle.entry.js.map +1 -1
- package/dist/esm/stzh-upload.entry.js +19 -7
- package/dist/esm/stzh-upload.entry.js.map +1 -1
- package/dist/esm-es5/{app-globals-08f8b108.js → app-globals-91875913.js} +2 -2
- package/dist/esm-es5/{app-globals-08f8b108.js.map → app-globals-91875913.js.map} +1 -1
- package/dist/esm-es5/index.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/stzh-actions.entry.js +1 -1
- package/dist/esm-es5/stzh-actions.entry.js.map +1 -1
- package/dist/esm-es5/stzh-actionset.entry.js +1 -1
- package/dist/esm-es5/stzh-actionset.entry.js.map +1 -1
- package/dist/esm-es5/stzh-amount.entry.js +1 -1
- package/dist/esm-es5/stzh-amount.entry.js.map +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js.map +1 -1
- package/dist/esm-es5/stzh-checkbox.entry.js.map +1 -1
- package/dist/esm-es5/stzh-checkboxgroup.entry.js.map +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-components.js.map +1 -1
- package/dist/esm-es5/stzh-datatable.entry.js +1 -1
- package/dist/esm-es5/stzh-datatable.entry.js.map +1 -1
- package/dist/esm-es5/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm-es5/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm-es5/stzh-ghettobox_2.entry.js.map +1 -1
- package/dist/esm-es5/stzh-input.entry.js.map +1 -1
- package/dist/esm-es5/stzh-invert.entry.js +1 -1
- package/dist/esm-es5/stzh-invert.entry.js.map +1 -1
- package/dist/esm-es5/stzh-table.entry.js +1 -1
- package/dist/esm-es5/stzh-table.entry.js.map +1 -1
- package/dist/esm-es5/stzh-toggle.entry.js.map +1 -1
- package/dist/esm-es5/stzh-upload.entry.js +1 -1
- package/dist/esm-es5/stzh-upload.entry.js.map +1 -1
- package/dist/stzh-components/assets/i18n/de.json +7 -0
- package/dist/stzh-components/assets/i18n/en.json +7 -0
- package/dist/stzh-components/index.esm.js.map +1 -1
- package/dist/stzh-components/{p-8228cd4c.system.entry.js → p-09191103.system.entry.js} +2 -2
- package/dist/stzh-components/{p-8228cd4c.system.entry.js.map → p-09191103.system.entry.js.map} +1 -1
- package/dist/stzh-components/p-0f328a2d.system.entry.js +2 -0
- package/dist/stzh-components/{p-12964da2.system.entry.js.map → p-0f328a2d.system.entry.js.map} +1 -1
- package/dist/stzh-components/{p-772ca734.entry.js → p-1cc48f98.entry.js} +5 -5
- package/dist/stzh-components/{p-772ca734.entry.js.map → p-1cc48f98.entry.js.map} +1 -1
- package/dist/stzh-components/p-2615433f.system.entry.js +2 -0
- package/dist/stzh-components/p-2615433f.system.entry.js.map +1 -0
- package/dist/stzh-components/p-2907f1b5.entry.js +2 -0
- package/dist/stzh-components/{p-72da8eba.entry.js.map → p-2907f1b5.entry.js.map} +1 -1
- package/dist/stzh-components/{p-728cc738.entry.js → p-2d25bcc8.entry.js} +2 -2
- package/dist/stzh-components/p-2d25bcc8.entry.js.map +1 -0
- package/dist/stzh-components/p-2f3add2f.system.entry.js +2 -0
- package/dist/stzh-components/{p-0fa1dc9b.system.entry.js.map → p-2f3add2f.system.entry.js.map} +1 -1
- package/dist/stzh-components/{p-8cf10d79.js → p-362af013.js} +2 -2
- package/dist/stzh-components/{p-8cf10d79.js.map → p-362af013.js.map} +1 -1
- package/dist/stzh-components/p-39a4904e.system.entry.js.map +1 -1
- package/dist/stzh-components/p-3aa5623c.entry.js.map +1 -1
- package/dist/stzh-components/p-3cb43903.entry.js.map +1 -1
- package/dist/stzh-components/p-3d056a49.entry.js +2 -0
- package/dist/stzh-components/{p-a8cd5621.entry.js.map → p-3d056a49.entry.js.map} +1 -1
- package/dist/stzh-components/p-3e10addb.system.js +2 -0
- package/dist/stzh-components/{p-4b07ade3.system.js.map → p-3e10addb.system.js.map} +1 -1
- package/dist/stzh-components/p-49a0420a.entry.js +2 -0
- package/dist/stzh-components/{p-8bbb27f2.entry.js.map → p-49a0420a.entry.js.map} +1 -1
- package/dist/stzh-components/p-5d8ad1f4.system.entry.js.map +1 -1
- package/dist/stzh-components/{p-ea158f08.system.js → p-61b66e55.system.js} +2 -2
- package/dist/stzh-components/{p-ea158f08.system.js.map → p-61b66e55.system.js.map} +1 -1
- package/dist/stzh-components/{p-6ee544b4.entry.js → p-62188444.entry.js} +2 -2
- package/dist/stzh-components/{p-6ee544b4.entry.js.map → p-62188444.entry.js.map} +1 -1
- package/dist/stzh-components/p-67b11b03.system.entry.js +2 -0
- package/dist/stzh-components/p-67b11b03.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-f223ed11.system.entry.js → p-6bb83b30.system.entry.js} +4 -4
- package/dist/stzh-components/{p-f223ed11.system.entry.js.map → p-6bb83b30.system.entry.js.map} +1 -1
- package/dist/stzh-components/{p-e683abe3.system.entry.js → p-6d097e82.system.entry.js} +2 -2
- package/dist/stzh-components/p-6d097e82.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-88cd596e.system.entry.js → p-80d581ac.system.entry.js} +2 -2
- package/dist/stzh-components/p-80d581ac.system.entry.js.map +1 -0
- package/dist/stzh-components/p-82e886d4.entry.js.map +1 -1
- package/dist/stzh-components/{p-d69b11ec.system.entry.js → p-94a5e295.system.entry.js} +2 -2
- package/dist/stzh-components/p-94a5e295.system.entry.js.map +1 -0
- package/dist/stzh-components/p-9b7d4e8d.entry.js.map +1 -1
- package/dist/stzh-components/p-9d46101e.entry.js +2 -0
- package/dist/stzh-components/p-9d46101e.entry.js.map +1 -0
- package/dist/stzh-components/p-a2bdc528.system.entry.js +2 -0
- package/dist/stzh-components/{p-7902eb77.system.entry.js.map → p-a2bdc528.system.entry.js.map} +1 -1
- package/dist/stzh-components/p-b05c240b.system.entry.js.map +1 -1
- package/dist/stzh-components/p-b8ad5f47.system.entry.js.map +1 -1
- package/dist/stzh-components/{p-5e09547b.entry.js → p-bcd5b20e.entry.js} +2 -2
- package/dist/stzh-components/p-bcd5b20e.entry.js.map +1 -0
- package/dist/stzh-components/p-c94f7331.entry.js +2 -0
- package/dist/stzh-components/p-c94f7331.entry.js.map +1 -0
- package/dist/stzh-components/p-cc35e963.entry.js.map +1 -1
- package/dist/stzh-components/{p-3c86c595.entry.js → p-d5b4d345.entry.js} +2 -2
- package/dist/stzh-components/p-d5b4d345.entry.js.map +1 -0
- package/dist/stzh-components/p-eaa65f52.system.js.map +1 -1
- package/dist/stzh-components/p-f2d74491.system.entry.js.map +1 -1
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.esm.js.map +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components/stzh-amount/stzh-amount.localization.d.ts +8 -0
- package/dist/types/components.d.ts +38 -18
- package/dist/types/index.d.ts +5 -0
- package/dist/vscode-data.json +19 -7
- package/package.json +1 -1
- package/dist/stzh-components/p-0fa1dc9b.system.entry.js +0 -2
- package/dist/stzh-components/p-12964da2.system.entry.js +0 -2
- package/dist/stzh-components/p-3c86c595.entry.js.map +0 -1
- package/dist/stzh-components/p-427461c5.system.entry.js +0 -2
- package/dist/stzh-components/p-427461c5.system.entry.js.map +0 -1
- package/dist/stzh-components/p-4b07ade3.system.js +0 -2
- package/dist/stzh-components/p-5e09547b.entry.js.map +0 -1
- package/dist/stzh-components/p-66c1942a.entry.js +0 -2
- package/dist/stzh-components/p-66c1942a.entry.js.map +0 -1
- package/dist/stzh-components/p-728cc738.entry.js.map +0 -1
- package/dist/stzh-components/p-72da8eba.entry.js +0 -2
- package/dist/stzh-components/p-7902eb77.system.entry.js +0 -2
- package/dist/stzh-components/p-88cd596e.system.entry.js.map +0 -1
- package/dist/stzh-components/p-8bbb27f2.entry.js +0 -2
- package/dist/stzh-components/p-a8cd5621.entry.js +0 -2
- package/dist/stzh-components/p-d69b11ec.system.entry.js.map +0 -1
- package/dist/stzh-components/p-e683abe3.system.entry.js.map +0 -1
- package/dist/stzh-components/p-f533c689.system.entry.js +0 -2
- package/dist/stzh-components/p-f533c689.system.entry.js.map +0 -1
- package/dist/stzh-components/p-fc3e596a.entry.js +0 -2
- package/dist/stzh-components/p-fc3e596a.entry.js.map +0 -1
- package/dist/types/components/stzh-amount/stzh-amount.d.ts +0 -64
|
@@ -178,13 +178,13 @@
|
|
|
178
178
|
--hover-background-color: var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));
|
|
179
179
|
--hover-border-color: var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));
|
|
180
180
|
}
|
|
181
|
-
:host[disabled]:not([disabled=false]) {
|
|
181
|
+
:host[disabled]:not([disabled=false]), :host[a11y-disabled]:not([a11y-disabled=false]) {
|
|
182
182
|
--border-color: var(--stzh-color-grey13);
|
|
183
183
|
--background-color: var(--stzh-color-grey13);
|
|
184
184
|
--hover-border-color: var(--stzh-color-grey13);
|
|
185
185
|
--hover-background-color: var(--stzh-color-grey13);
|
|
186
186
|
}
|
|
187
|
-
:host[disabled]:not([disabled=false])[variant=secondary], :host[disabled]:not([disabled=false])[variant=input], :host[disabled]:not([disabled=false])[variant=tertiary] {
|
|
187
|
+
:host[disabled]:not([disabled=false])[variant=secondary], :host[disabled]:not([disabled=false])[variant=input], :host[disabled]:not([disabled=false])[variant=tertiary], :host[a11y-disabled]:not([a11y-disabled=false])[variant=secondary], :host[a11y-disabled]:not([a11y-disabled=false])[variant=input], :host[a11y-disabled]:not([a11y-disabled=false])[variant=tertiary] {
|
|
188
188
|
--color: var(--stzh-color-grey25);
|
|
189
189
|
--border-color: var(--stzh-color-grey13);
|
|
190
190
|
--background-color: transparent;
|
|
@@ -128,7 +128,7 @@ export class StzhButton {
|
|
|
128
128
|
"stzh-button--is-floating": this.floating,
|
|
129
129
|
"stzh-button--is-rounded": this.rounded,
|
|
130
130
|
"stzh-button--is-fullwidth": this.fullwidth,
|
|
131
|
-
"stzh-button--is-disabled": this.disabled,
|
|
131
|
+
"stzh-button--is-disabled": this.disabled || this.a11yDisabled,
|
|
132
132
|
"stzh-button--is-active": this.active,
|
|
133
133
|
[`stzh-button--effect-${this.effect}`]: !!this.effect,
|
|
134
134
|
[`stzh-button--badge-position-${this.badgePosition}`]: !!this.badgePosition,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stzh-button.js","sourceRoot":"","sources":["../../../src/components/stzh-button/stzh-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EAEN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF;;;GAGG;AAMH,MAAM,OAAO,UAAU;;IA+Hb,mBAAc,GAAY,KAAK,CAAC;IAEhC,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;MAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;OACtB,CAAC,CAAC;IACL,CAAC,CAAA;IAEO,gBAAW,GAAG,G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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Method,\n Fragment,\n Element,\n h,\n Prop,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhButtonFocusEvent,\n StzhButtonBlurEvent,\n StzhButtonChangeEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for label/text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-button\",\n styleUrl: \"stzh-button.scss\",\n scoped: true\n})\nexport class StzhButton {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Display a badge aligned to button or icons */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"button\" = \"button\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Whether the button is rounded */\n @Prop({ reflect: true }) rounded: boolean = false;\n\n /** Whether the button is floating */\n @Prop({ reflect: true }) floating: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"tiny\" = \"default\";\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"default\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Checked status (if type is radio) */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** The name of the input element (if type is radio) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** The value of the input element (if type is radio) */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** Type of the button */\n @Prop() type: \"button\" | \"submit\" | \"reset\" | \"radio\" = \"button\";\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Effect/Animation used */\n @Prop() effect: \"default\" | \"cta\" = \"default\";\n\n /** Whether only an icon is used inside the button */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhButtonElement;\n\n /** Focus button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhButtonFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhButtonBlurEvent>;\n\n /** Change event (only called if type is radio) */\n @Event() stzhChange: EventEmitter<StzhButtonChangeEvent>;\n\n private button: HTMLButtonElement | HTMLAnchorElement | HTMLLabelElement;\n private input: HTMLInputElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-button\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private renderIcon(iconUsed: boolean): HTMLInputElement {\n return (\n <div class=\"stzh-button__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-button__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) && this.badgePosition === \"icon\" && iconUsed &&\n <stzh-badge class=\"stzh-button__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-button__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-button__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-button__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div\n class=\"stzh-button__inner\"\n onClick={this.onClick}\n >\n {this.type === \"radio\" &&\n <div class=\"stzh-button__mark\">\n <div class=\"stzh-button__check\"></div>\n </div>\n }\n {this.iconPosition === \"left\" && this.renderIcon(iconUsed)}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon(iconUsed)}\n </div>\n {(this.badge || this.badgeEmpty) && (this.badgePosition === \"button\" || !iconUsed) &&\n <stzh-badge\n class=\"stzh-button__badge\"\n label={this.badge}\n type={this.badgeType}\n onClick={this.onClick}\n ></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"button\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.button.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-button\": true,\n \"stzh-button--has-icon\": iconUsed,\n \"stzh-button--has-icon-only\": this.iconOnly,\n \"stzh-button--has-badge\": !!this.badge,\n \"stzh-button--is-floating\": this.floating,\n \"stzh-button--is-rounded\": this.rounded,\n \"stzh-button--is-fullwidth\": this.fullwidth,\n \"stzh-button--is-disabled\": this.disabled,\n \"stzh-button--is-active\": this.active,\n [`stzh-button--effect-${this.effect}`]: !!this.effect,\n [`stzh-button--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-button--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-button--size-${this.size}`]: !!this.size,\n [`stzh-button--type-${this.type}`]: !!this.type,\n [`stzh-button--${this.variant}`]: !!this.variant\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n rel={this.rel}\n download={this.download}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n this.type === \"radio\" ?\n <label\n ref={(el) => (this.button = el as HTMLLabelElement)}\n class={classes}\n onClick={this.onClick}\n >\n <input\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"radio\"\n class=\"stzh-button__input\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n onInput={this.onInput}\n />\n {this.renderInner(iconUsed)}\n </label>\n :\n <button\n ref={(el) => (this.button = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stzh-button.js","sourceRoot":"","sources":["../../../src/components/stzh-button/stzh-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EAEN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF;;;GAGG;AAMH,MAAM,OAAO,UAAU;;IA+Hb,mBAAc,GAAY,KAAK,CAAC;IAEhC,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;MAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;OACtB,CAAC,CAAC;IACL,CAAC,CAAA;IAEO,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC,CAAA;IAEO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Method,\n Fragment,\n Element,\n h,\n Prop,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhButtonFocusEvent,\n StzhButtonBlurEvent,\n StzhButtonChangeEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for label/text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-button\",\n styleUrl: \"stzh-button.scss\",\n scoped: true\n})\nexport class StzhButton {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Display a badge aligned to button or icons */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"button\" = \"button\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Whether the button is rounded */\n @Prop({ reflect: true }) rounded: boolean = false;\n\n /** Whether the button is floating */\n @Prop({ reflect: true }) floating: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"tiny\" = \"default\";\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"default\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Checked status (if type is radio) */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** The name of the input element (if type is radio) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** The value of the input element (if type is radio) */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** Type of the button */\n @Prop() type: \"button\" | \"submit\" | \"reset\" | \"radio\" = \"button\";\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Effect/Animation used */\n @Prop() effect: \"default\" | \"cta\" = \"default\";\n\n /** Whether only an icon is used inside the button */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhButtonElement;\n\n /** Focus button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhButtonFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhButtonBlurEvent>;\n\n /** Change event (only called if type is radio) */\n @Event() stzhChange: EventEmitter<StzhButtonChangeEvent>;\n\n private button: HTMLButtonElement | HTMLAnchorElement | HTMLLabelElement;\n private input: HTMLInputElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-button\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private renderIcon(iconUsed: boolean): HTMLInputElement {\n return (\n <div class=\"stzh-button__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-button__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) && this.badgePosition === \"icon\" && iconUsed &&\n <stzh-badge class=\"stzh-button__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-button__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-button__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-button__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div\n class=\"stzh-button__inner\"\n onClick={this.onClick}\n >\n {this.type === \"radio\" &&\n <div class=\"stzh-button__mark\">\n <div class=\"stzh-button__check\"></div>\n </div>\n }\n {this.iconPosition === \"left\" && this.renderIcon(iconUsed)}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon(iconUsed)}\n </div>\n {(this.badge || this.badgeEmpty) && (this.badgePosition === \"button\" || !iconUsed) &&\n <stzh-badge\n class=\"stzh-button__badge\"\n label={this.badge}\n type={this.badgeType}\n onClick={this.onClick}\n ></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"button\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.button.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-button\": true,\n \"stzh-button--has-icon\": iconUsed,\n \"stzh-button--has-icon-only\": this.iconOnly,\n \"stzh-button--has-badge\": !!this.badge,\n \"stzh-button--is-floating\": this.floating,\n \"stzh-button--is-rounded\": this.rounded,\n \"stzh-button--is-fullwidth\": this.fullwidth,\n \"stzh-button--is-disabled\": this.disabled || this.a11yDisabled,\n \"stzh-button--is-active\": this.active,\n [`stzh-button--effect-${this.effect}`]: !!this.effect,\n [`stzh-button--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-button--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-button--size-${this.size}`]: !!this.size,\n [`stzh-button--type-${this.type}`]: !!this.type,\n [`stzh-button--${this.variant}`]: !!this.variant\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n rel={this.rel}\n download={this.download}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n this.type === \"radio\" ?\n <label\n ref={(el) => (this.button = el as HTMLLabelElement)}\n class={classes}\n onClick={this.onClick}\n >\n <input\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"radio\"\n class=\"stzh-button__input\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n onInput={this.onInput}\n />\n {this.renderInner(iconUsed)}\n </label>\n :\n <button\n ref={(el) => (this.button = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"]}
|
|
@@ -8,9 +8,7 @@ const COMPONENT_NAME = 'stzh-chart';
|
|
|
8
8
|
const story = createComponentStory(COMPONENT_NAME);
|
|
9
9
|
|
|
10
10
|
const TEMPLATE = `
|
|
11
|
-
<stzh-
|
|
12
|
-
<stzh-chart></stzh-chart>
|
|
13
|
-
</stzh-figure>
|
|
11
|
+
<stzh-chart></stzh-chart>
|
|
14
12
|
`;
|
|
15
13
|
|
|
16
14
|
export default {
|
|
@@ -326,7 +326,7 @@ export class StzhCheckbox {
|
|
|
326
326
|
"optional": false,
|
|
327
327
|
"docs": {
|
|
328
328
|
"tags": [],
|
|
329
|
-
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show
|
|
329
|
+
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing"
|
|
330
330
|
},
|
|
331
331
|
"attribute": "show-marker",
|
|
332
332
|
"reflect": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stzh-checkbox.js","sourceRoot":"","sources":["../../../src/components/stzh-checkbox/stzh-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,MAAM,EACN,CAAC,EACD,KAAK,EACN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC,I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Q,CAAC,mBAAmB,GACnE,CACE,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Host,\n Component,\n Prop,\n Event,\n EventEmitter,\n Element,\n Method,\n h,\n Watch\n} from \"@stencil/core\";\n\nimport {\n StzhCheckboxChangeEvent,\n StzhCheckboxFocusEvent,\n StzhCheckboxBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nimport Check from './assets/check.svg';\n\nlet checkboxCounter = 0;\n\n/**\n * @slot - Slot for label content\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-checkbox\",\n styleUrl: \"stzh-checkbox.scss\",\n scoped: true\n})\nexport class StzhCheckbox {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the checkbox is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Name of the input element */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of the input element */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Checked status */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show noting */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Id for element which describes the input (this will be overwritten if description prop or slot is used) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Focus input field */\n @Method()\n async setFocus() {\n this.input.focus();\n }\n\n /** Change event */\n @Event() stzhChange: EventEmitter<StzhCheckboxChangeEvent>;\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhCheckboxFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhCheckboxBlurEvent>;\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n\n this.invalid = this._error.length > 0;\n }\n\n @Element() element: HTMLStzhRadioElement;\n\n private input: HTMLInputElement;\n private inputId: string;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-checkbox\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent('focus', {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-checkbox\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent('blur', {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-checkbox\",\n originalEvent: event\n });\n }\n\n async componentWillLoad() {\n this.inputId = `stzh-checkbox-${checkboxCounter++}`;\n this.errorWatcher(this.error);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, 'checkbox');\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, 'description') || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, 'description-long') || !!this.descriptionLong;\n const errorUsed = hasSlot(this.element, 'error') || !!this.error;\n\n const classes = {\n \"stzh-checkbox\": true,\n \"stzh-checkbox--has-description\": descriptionUsed,\n \"stzh-checkbox--has-description-long\": descriptionLongUsed,\n \"stzh-checkbox--has-error\": errorUsed,\n \"stzh-checkbox--is-required\": this.required,\n \"stzh-checkbox--is-invalid\": this.invalid,\n \"stzh-checkbox--is-disabled\": this.disabled\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <label class=\"stzh-checkbox__field-wrapper\">\n <input\n class=\"stzh-checkbox__input\"\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"checkbox\"\n id={this.inputId}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-describedby={`${this.inputId}-description ${this.a11yDescribedby}`}\n aria-required={this.required ? \"true\" : \"false\"}\n aria-invalid={this.invalid ? \"true\" : \"false\"}\n checked={this.checked}\n onInput={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n />\n <div class=\"stzh-checkbox__mark\">\n <div class=\"stzh-checkbox__check\" innerHTML={Check} />\n </div>\n <div class=\"stzh-checkbox__label\">\n {this.label ? this.label : <slot></slot>}\n {this.showMarker &&\n <span class=\"stzh-checkbox__marker\">\n <span class=\"stzh-checkbox__marker-symbol\" aria-hidden=\"true\">\n {this.required\n ? this.localization.$globals.requiredFieldMarker\n : this.localization.$globals.optionalFieldMarker\n }\n </span>\n <span class=\"stzh-checkbox__marker-text\">\n {this.required\n ? this.localization.$globals.requiredFieldText\n : this.localization.$globals.optionalFieldText\n }\n </span>\n </span>\n }\n </div>\n </label>\n <StzhInputDescription\n classPrefix=\"stzh-checkbox\"\n id={`${this.inputId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stzh-checkbox.js","sourceRoot":"","sources":["../../../src/components/stzh-checkbox/stzh-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,MAAM,EACN,CAAC,EACD,KAAK,EACN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;;GAKG;AAMH,MAAM,OAAO,YAAY;;IAiFf,mBAAc,GAAY,KAAK,CAAC;IAEhC,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;MAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,eAAe;QAC1B,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;OACtB,CAAC,CAAC;IACL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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Host,\n Component,\n Prop,\n Event,\n EventEmitter,\n Element,\n Method,\n h,\n Watch\n} from \"@stencil/core\";\n\nimport {\n StzhCheckboxChangeEvent,\n StzhCheckboxFocusEvent,\n StzhCheckboxBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nimport Check from './assets/check.svg';\n\nlet checkboxCounter = 0;\n\n/**\n * @slot - Slot for label content\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-checkbox\",\n styleUrl: \"stzh-checkbox.scss\",\n scoped: true\n})\nexport class StzhCheckbox {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the checkbox is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Name of the input element */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of the input element */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Checked status */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Id for element which describes the input (this will be overwritten if description prop or slot is used) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Focus input field */\n @Method()\n async setFocus() {\n this.input.focus();\n }\n\n /** Change event */\n @Event() stzhChange: EventEmitter<StzhCheckboxChangeEvent>;\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhCheckboxFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhCheckboxBlurEvent>;\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n\n this.invalid = this._error.length > 0;\n }\n\n @Element() element: HTMLStzhRadioElement;\n\n private input: HTMLInputElement;\n private inputId: string;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-checkbox\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent('focus', {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-checkbox\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent('blur', {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-checkbox\",\n originalEvent: event\n });\n }\n\n async componentWillLoad() {\n this.inputId = `stzh-checkbox-${checkboxCounter++}`;\n this.errorWatcher(this.error);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, 'checkbox');\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, 'description') || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, 'description-long') || !!this.descriptionLong;\n const errorUsed = hasSlot(this.element, 'error') || !!this.error;\n\n const classes = {\n \"stzh-checkbox\": true,\n \"stzh-checkbox--has-description\": descriptionUsed,\n \"stzh-checkbox--has-description-long\": descriptionLongUsed,\n \"stzh-checkbox--has-error\": errorUsed,\n \"stzh-checkbox--is-required\": this.required,\n \"stzh-checkbox--is-invalid\": this.invalid,\n \"stzh-checkbox--is-disabled\": this.disabled\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <label class=\"stzh-checkbox__field-wrapper\">\n <input\n class=\"stzh-checkbox__input\"\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"checkbox\"\n id={this.inputId}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-describedby={`${this.inputId}-description ${this.a11yDescribedby}`}\n aria-required={this.required ? \"true\" : \"false\"}\n aria-invalid={this.invalid ? \"true\" : \"false\"}\n checked={this.checked}\n onInput={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n />\n <div class=\"stzh-checkbox__mark\">\n <div class=\"stzh-checkbox__check\" innerHTML={Check} />\n </div>\n <div class=\"stzh-checkbox__label\">\n {this.label ? this.label : <slot></slot>}\n {this.showMarker &&\n <span class=\"stzh-checkbox__marker\">\n <span class=\"stzh-checkbox__marker-symbol\" aria-hidden=\"true\">\n {this.required\n ? this.localization.$globals.requiredFieldMarker\n : this.localization.$globals.optionalFieldMarker\n }\n </span>\n <span class=\"stzh-checkbox__marker-text\">\n {this.required\n ? this.localization.$globals.requiredFieldText\n : this.localization.$globals.optionalFieldText\n }\n </span>\n </span>\n }\n </div>\n </label>\n <StzhInputDescription\n classPrefix=\"stzh-checkbox\"\n id={`${this.inputId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -293,7 +293,7 @@ export class StzhCheckboxgroup {
|
|
|
293
293
|
"optional": false,
|
|
294
294
|
"docs": {
|
|
295
295
|
"tags": [],
|
|
296
|
-
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show
|
|
296
|
+
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing"
|
|
297
297
|
},
|
|
298
298
|
"attribute": "show-marker",
|
|
299
299
|
"reflect": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stzh-checkboxgroup.js","sourceRoot":"","sources":["../../../src/components/stzh-checkboxgroup/stzh-checkboxgroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,OAAO,EACP,KAAK,EACL,CAAC,EACD,MAAM,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,IAAI,oBAAoB,GAAG,CAAC,CAAC;AAE7B;;;;;GAKG;AAMH,MAAM,OAAO,iBAAiB;;IAwBpB,WAAM,GAAa,EAAE,CAAC;IAoBtB,6BAAwB,GAAa,EAAE,CAAC;IA+FxC,SAAI,GAAG,GAAG,EAAE;MAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;MAC7E,IAAI,CAAC,wBAAwB,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,eAAe,cAAc,CAAC,CAAC;MAEzF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;MAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,C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AC,MAAM;QACV,cAAQ,KAAK,EAAC,4BAA4B,IACvC,IAAI,CAAC,MAAM,CACL;MAEX,WAAK,KAAK,EAAC,4BAA4B;QACrC,eAAa,CACT;MACN,EAAC,oBAAoB,IACnB,WAAW,EAAC,oBAAoB,EAChC,EAAE,EAAE,GAAG,IAAI,CAAC,eAAe,cAAc,EACzC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,mBAAmB,EAAE,mBAAmB,EACxC,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,mBAAmB,GACnE,CACO,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n Element,\n Watch,\n h,\n Listen,\n} from \"@stencil/core\";\n\nimport { hasSlot } from \"../../utils/utils\";\n\nimport { StzhCheckboxChangeEvent } from \"../../index\";\nimport { camelCase } from \"../../utils/string-utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nlet checkboxgroupCounter = 0;\n\n/**\n * @slot - Slot for `stzh-checkbox` elements\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-checkboxgroup\",\n styleUrl: \"stzh-checkboxgroup.scss\",\n scoped: true\n})\nexport class StzhCheckboxgroup {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** The name of the input checkbox elements */\n @Prop({ reflect: true }) name: string;\n\n /** The legend */\n @Prop() legend: string;\n\n /** Hide legend to show only for screenreaders */\n @Prop({ reflect: true }) hideLegend: boolean = false;\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show noting */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Select a checkbox by value */\n @Prop({ mutable: true }) value: string[] | string = \"\";\n private _value: string[] = [];\n\n /** Direction */\n @Prop({ reflect: true }) direction: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Current checked checkbox elements (readonly) */\n @Prop() checkedCheckbox: HTMLStzhCheckboxElement[] | null = null;\n\n /** Prevent updating certain properties of radio elements (possible values inside array: disabled, invalid) */\n @Prop() preventUpdateProperties: string[] | string = [];\n private _preventUpdateProperties: string[] = [];\n\n /** Host element */\n @Element() element: HTMLElement;\n\n @Watch(\"name\")\n watchName(newValue: string) {\n this.updateCheckboxesProperty(\"name\", newValue);\n }\n\n @Watch(\"disabled\")\n watchDisabled(newValue: boolean) {\n this.updateCheckboxesProperty(\"disabled\", newValue);\n }\n\n @Watch(\"invalid\")\n watchInvalid(newValue: boolean) {\n this.updateCheckboxesProperty(\"invalid\", newValue);\n }\n\n @Watch(\"showMarker\")\n watchShowMarker(newValue: boolean) {\n this.updateCheckboxesProperty(\"showMarker\", newValue)\n }\n\n @Watch(\"value\")\n watchValue(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._value = JSON.parse(newValue);\n } else {\n this._value = newValue;\n }\n\n this.updateCheckedCheckboxByValue(this._value);\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n\n this.invalid = this._error.length > 0;\n }\n\n @Watch(\"preventUpdateProperties\")\n preventUpdatePropertiesWatcher(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._preventUpdateProperties = JSON.parse(newValue);\n } else {\n this._preventUpdateProperties = newValue;\n }\n }\n\n @Listen(\"stzhChange\")\n onChange(event: CustomEvent<StzhCheckboxChangeEvent>) {\n if (event.detail.checked) {\n this._value.push(event.detail.value);\n } else {\n this._value = this._value.filter(value => value !== event.detail.value);\n }\n\n this.value = this._value;\n }\n\n /** Checkbox elements */\n private checkboxes: HTMLStzhCheckboxElement[];\n private checkboxgroupId: string;\n private observer: MutationObserver;\n\n private updateCheckboxesProperty(prop: string, value: any) {\n this.checkboxes.forEach((checkbox: HTMLStzhCheckboxElement) => {\n if (prop === \"name\" || (this._preventUpdateProperties.indexOf(prop) === -1)) {\n checkbox[camelCase(prop)] = value;\n }\n });\n }\n\n private updateCheckedCheckboxByValue(value: string[]) {\n this.checkedCheckbox = this.checkboxes.filter(checkbox => value.indexOf(checkbox.value) > -1);\n this.checkboxes.forEach(checkbox => checkbox.checked = value.indexOf(checkbox.value) > -1);\n }\n\n private init = () => {\n this.checkboxes = Array.from(this.element.querySelectorAll(\"stzh-checkbox\"));\n this.updateCheckboxesProperty(\"a11y-describedby\", `${this.checkboxgroupId}-description`);\n\n this.watchValue(this.value);\n this.watchName(this.name);\n this.watchDisabled(this.disabled);\n this.watchInvalid(this.invalid);\n this.watchShowMarker(this.showMarker);\n }\n\n async componentWillLoad() {\n this.checkboxgroupId = `stzh-checkboxgroup-${checkboxgroupCounter++}`;\n this.errorWatcher(this.error);\n this.preventUpdatePropertiesWatcher(this.preventUpdateProperties);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, 'checkboxgroup');\n }\n }\n\n componentShouldUpdate(_newValue, _oldValue, prop: string) {\n return prop !== \"checkedCheckbox\";\n }\n\n componentDidRender() {\n this.init();\n }\n\n connectedCallback() {\n if (!this.value.length) {\n this.checkboxes = Array.from(this.element.querySelectorAll(\"stzh-checkbox\"));\n\n // try to find checkboxes that might have checked set to true\n this.value = this.checkboxes\n .filter(checkbox => checkbox.checked)\n .map(checkbox => checkbox.value);\n }\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true\n });\n }\n\n disconnectedCallback() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, 'description') || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, 'description-long') || !!this.descriptionLong;\n const errorUsed = hasSlot(this.element, 'error') || !!this.error;\n\n const classes = {\n \"stzh-checkboxgroup\": true,\n \"stzh-checkboxgroup--has-description\": descriptionUsed,\n \"stzh-checkboxgroup--has-description-long\": descriptionLongUsed,\n \"stzh-checkboxgroup--has-error\": errorUsed,\n \"stzh-checkboxgroup--is-disabled\": this.disabled,\n \"stzh-checkboxgroup--is-invalid\": this.invalid,\n \"stzh-checkboxgroup--hide-legend\": this.hideLegend,\n [`stzh-checkboxgroup--direction-${this.direction}`]: !!this.direction\n };\n\n return (\n <fieldset class={classes}>\n {this.legend &&\n <legend class=\"stzh-checkboxgroup__legend\">\n {this.legend}\n </legend>\n }\n <div class=\"stzh-checkboxgroup__fields\">\n <slot></slot>\n </div>\n <StzhInputDescription\n classPrefix=\"stzh-checkboxgroup\"\n id={`${this.checkboxgroupId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />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CAAC,WAAW,EAC7B,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,mBAAmB,EAAE,mBAAmB,EACxC,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,mBAAmB,GACnE,CACO,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n Element,\n Watch,\n h,\n Listen,\n} from \"@stencil/core\";\n\nimport { hasSlot } from \"../../utils/utils\";\n\nimport { StzhCheckboxChangeEvent } from \"../../index\";\nimport { camelCase } from \"../../utils/string-utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nlet checkboxgroupCounter = 0;\n\n/**\n * @slot - Slot for `stzh-checkbox` elements\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-checkboxgroup\",\n styleUrl: \"stzh-checkboxgroup.scss\",\n scoped: true\n})\nexport class StzhCheckboxgroup {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** The name of the input checkbox elements */\n @Prop({ reflect: true }) name: string;\n\n /** The legend */\n @Prop() legend: string;\n\n /** Hide legend to show only for screenreaders */\n @Prop({ reflect: true }) hideLegend: boolean = false;\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Select a checkbox by value */\n @Prop({ mutable: true }) value: string[] | string = \"\";\n private _value: string[] = [];\n\n /** Direction */\n @Prop({ reflect: true }) direction: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Current checked checkbox elements (readonly) */\n @Prop() checkedCheckbox: HTMLStzhCheckboxElement[] | null = null;\n\n /** Prevent updating certain properties of radio elements (possible values inside array: disabled, invalid) */\n @Prop() preventUpdateProperties: string[] | string = [];\n private _preventUpdateProperties: string[] = [];\n\n /** Host element */\n @Element() element: HTMLElement;\n\n @Watch(\"name\")\n watchName(newValue: string) {\n this.updateCheckboxesProperty(\"name\", newValue);\n }\n\n @Watch(\"disabled\")\n watchDisabled(newValue: boolean) {\n this.updateCheckboxesProperty(\"disabled\", newValue);\n }\n\n @Watch(\"invalid\")\n watchInvalid(newValue: boolean) {\n this.updateCheckboxesProperty(\"invalid\", newValue);\n }\n\n @Watch(\"showMarker\")\n watchShowMarker(newValue: boolean) {\n this.updateCheckboxesProperty(\"showMarker\", newValue)\n }\n\n @Watch(\"value\")\n watchValue(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._value = JSON.parse(newValue);\n } else {\n this._value = newValue;\n }\n\n this.updateCheckedCheckboxByValue(this._value);\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n\n this.invalid = this._error.length > 0;\n }\n\n @Watch(\"preventUpdateProperties\")\n preventUpdatePropertiesWatcher(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._preventUpdateProperties = JSON.parse(newValue);\n } else {\n this._preventUpdateProperties = newValue;\n }\n }\n\n @Listen(\"stzhChange\")\n onChange(event: CustomEvent<StzhCheckboxChangeEvent>) {\n if (event.detail.checked) {\n this._value.push(event.detail.value);\n } else {\n this._value = this._value.filter(value => value !== event.detail.value);\n }\n\n this.value = this._value;\n }\n\n /** Checkbox elements */\n private checkboxes: HTMLStzhCheckboxElement[];\n private checkboxgroupId: string;\n private observer: MutationObserver;\n\n private updateCheckboxesProperty(prop: string, value: any) {\n this.checkboxes.forEach((checkbox: HTMLStzhCheckboxElement) => {\n if (prop === \"name\" || (this._preventUpdateProperties.indexOf(prop) === -1)) {\n checkbox[camelCase(prop)] = value;\n }\n });\n }\n\n private updateCheckedCheckboxByValue(value: string[]) {\n this.checkedCheckbox = this.checkboxes.filter(checkbox => value.indexOf(checkbox.value) > -1);\n this.checkboxes.forEach(checkbox => checkbox.checked = value.indexOf(checkbox.value) > -1);\n }\n\n private init = () => {\n this.checkboxes = Array.from(this.element.querySelectorAll(\"stzh-checkbox\"));\n this.updateCheckboxesProperty(\"a11y-describedby\", `${this.checkboxgroupId}-description`);\n\n this.watchValue(this.value);\n this.watchName(this.name);\n this.watchDisabled(this.disabled);\n this.watchInvalid(this.invalid);\n this.watchShowMarker(this.showMarker);\n }\n\n async componentWillLoad() {\n this.checkboxgroupId = `stzh-checkboxgroup-${checkboxgroupCounter++}`;\n this.errorWatcher(this.error);\n this.preventUpdatePropertiesWatcher(this.preventUpdateProperties);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, 'checkboxgroup');\n }\n }\n\n componentShouldUpdate(_newValue, _oldValue, prop: string) {\n return prop !== \"checkedCheckbox\";\n }\n\n componentDidRender() {\n this.init();\n }\n\n connectedCallback() {\n if (!this.value.length) {\n this.checkboxes = Array.from(this.element.querySelectorAll(\"stzh-checkbox\"));\n\n // try to find checkboxes that might have checked set to true\n this.value = this.checkboxes\n .filter(checkbox => checkbox.checked)\n .map(checkbox => checkbox.value);\n }\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true\n });\n }\n\n disconnectedCallback() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, 'description') || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, 'description-long') || !!this.descriptionLong;\n const errorUsed = hasSlot(this.element, 'error') || !!this.error;\n\n const classes = {\n \"stzh-checkboxgroup\": true,\n \"stzh-checkboxgroup--has-description\": descriptionUsed,\n \"stzh-checkboxgroup--has-description-long\": descriptionLongUsed,\n \"stzh-checkboxgroup--has-error\": errorUsed,\n \"stzh-checkboxgroup--is-disabled\": this.disabled,\n \"stzh-checkboxgroup--is-invalid\": this.invalid,\n \"stzh-checkboxgroup--hide-legend\": this.hideLegend,\n [`stzh-checkboxgroup--direction-${this.direction}`]: !!this.direction\n };\n\n return (\n <fieldset class={classes}>\n {this.legend &&\n <legend class=\"stzh-checkboxgroup__legend\">\n {this.legend}\n </legend>\n }\n <div class=\"stzh-checkboxgroup__fields\">\n <slot></slot>\n </div>\n <StzhInputDescription\n classPrefix=\"stzh-checkboxgroup\"\n id={`${this.checkboxgroupId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />\n </fieldset>\n );\n }\n}\n"]}
|
|
@@ -130,8 +130,6 @@ stzh-datatable[disable-min-width]:not([disable-min-width=false]) {
|
|
|
130
130
|
/* Scroll left/right shadow variant */
|
|
131
131
|
}
|
|
132
132
|
.stzh-datatable__header {
|
|
133
|
-
display: flex;
|
|
134
|
-
flex-direction: column;
|
|
135
133
|
border-bottom: 0.0625rem solid var(--stzh-base-border-color);
|
|
136
134
|
padding-bottom: var(--stzh-space-small);
|
|
137
135
|
margin-bottom: var(--stzh-space-medium);
|
|
@@ -156,28 +154,29 @@ stzh-datatable[disable-min-width]:not([disable-min-width=false]) {
|
|
|
156
154
|
margin-bottom: var(--stzh-space-xlarge);
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
157
|
+
.stzh-datatable__sub-header {
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: space-between;
|
|
164
161
|
}
|
|
165
162
|
.stzh-datatable__heading {
|
|
166
163
|
margin-bottom: var(--stzh-space-small);
|
|
167
164
|
}
|
|
168
|
-
@media screen and (min-width: 1024px) {
|
|
169
|
-
.stzh-datatable__heading {
|
|
170
|
-
margin-bottom: 0;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
165
|
.stzh-datatable__header .stzh-datatable__search {
|
|
174
|
-
|
|
166
|
+
flex-grow: 1;
|
|
175
167
|
}
|
|
176
|
-
@media screen and (min-width:
|
|
168
|
+
@media screen and (min-width: 600px) {
|
|
177
169
|
.stzh-datatable__header .stzh-datatable__search {
|
|
178
|
-
|
|
170
|
+
width: var(--stzh-table-input-width);
|
|
171
|
+
flex-grow: 0;
|
|
179
172
|
}
|
|
180
173
|
}
|
|
174
|
+
.stzh-datatable__action-button {
|
|
175
|
+
flex-shrink: 0;
|
|
176
|
+
}
|
|
177
|
+
.stzh-datatable__action-button:not(:empty) {
|
|
178
|
+
margin-left: var(--stzh-space-medium);
|
|
179
|
+
}
|
|
181
180
|
.stzh-datatable__outer-wrapper {
|
|
182
181
|
position: relative;
|
|
183
182
|
}
|
|
@@ -214,7 +213,7 @@ stzh-datatable[disable-min-width]:not([disable-min-width=false]) {
|
|
|
214
213
|
appearance: none;
|
|
215
214
|
background: none;
|
|
216
215
|
border: none;
|
|
217
|
-
display: flex;
|
|
216
|
+
display: inline-flex;
|
|
218
217
|
align-items: center;
|
|
219
218
|
font-size: inherit;
|
|
220
219
|
line-height: inherit;
|
|
@@ -224,8 +223,8 @@ stzh-datatable[disable-min-width]:not([disable-min-width=false]) {
|
|
|
224
223
|
.stzh-datatable__sort-button:hover, .stzh-datatable__sort-button:focus {
|
|
225
224
|
color: var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));
|
|
226
225
|
}
|
|
227
|
-
.stzh-datatable__sort-icon {
|
|
228
|
-
|
|
226
|
+
.stzh-datatable stzh-icon.stzh-datatable__sort-icon {
|
|
227
|
+
display: none;
|
|
229
228
|
}
|
|
230
229
|
.stzh-datatable__table {
|
|
231
230
|
width: 100%;
|
|
@@ -343,7 +342,7 @@ stzh-datatable[disable-min-width]:not([disable-min-width=false]) {
|
|
|
343
342
|
padding: 0;
|
|
344
343
|
}
|
|
345
344
|
.stzh-datatable__cell.has-sorted .stzh-datatable__sort-icon {
|
|
346
|
-
|
|
345
|
+
display: inline-flex;
|
|
347
346
|
}
|
|
348
347
|
.stzh-datatable__cell.has-sorted-desc .stzh-datatable__sort-icon {
|
|
349
348
|
transform: rotate(180deg);
|
|
@@ -2,7 +2,7 @@ import { Host, h } from "@stencil/core";
|
|
|
2
2
|
import { Document } from 'flexsearch/dist/flexsearch.bundle.js';
|
|
3
3
|
import { fetchTranslations } from "../../utils/translation-utils";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @slot action-button - Slot for action `stzh-button` element
|
|
6
6
|
*/
|
|
7
7
|
export class StzhDatatable {
|
|
8
8
|
constructor() {
|
|
@@ -174,7 +174,7 @@ export class StzhDatatable {
|
|
|
174
174
|
"has-scroll-left-shadow": this.hasScrollLeft && this.cellsStickyLeft.length === 0,
|
|
175
175
|
"has-scroll-right-shadow": this.hasScrollRight && this.cellsStickyRight.length === 0
|
|
176
176
|
};
|
|
177
|
-
return (h(Host, null, h("div", { class: classes }, h("div", { class: "stzh-datatable__header" }, h("div", { class: "stzh-datatable__heading" }, h("slot", { name: "heading" })), h("stzh-input", { ref: (el) => (this.input = el), class: "stzh-datatable__search", size: "small", name: "stzh-datatable-search", onStzhChange: this.onInputChange, label: this.localization.searchLabel })), h("div", { class: "stzh-datatable__outer-wrapper" }, h("div", { ref: (el) => (this.tableWrapper = el), class: "stzh-datatable__wrapper", onScroll: this.handleScroll }, h("table", { class: "stzh-datatable__table" }, h("thead", { class: "stzh-datatable__thead" }, h("tr", { class: "stzh-datatable__row stzh-datatable__row--head" }, this._columns.map((column, index) => h("th", { class: {
|
|
177
|
+
return (h(Host, null, h("div", { class: classes }, h("div", { class: "stzh-datatable__header" }, h("div", { class: "stzh-datatable__heading" }, h("slot", { name: "heading" })), h("div", { class: "stzh-datatable__sub-header" }, h("stzh-input", { ref: (el) => (this.input = el), class: "stzh-datatable__search", size: "small", name: "stzh-datatable-search", onStzhChange: this.onInputChange, label: this.localization.searchLabel }), h("div", { class: "stzh-datatable__action-button" }, h("slot", { name: "action-button" })))), h("div", { class: "stzh-datatable__outer-wrapper" }, h("div", { ref: (el) => (this.tableWrapper = el), class: "stzh-datatable__wrapper", onScroll: this.handleScroll }, h("table", { class: "stzh-datatable__table" }, h("thead", { class: "stzh-datatable__thead" }, h("tr", { class: "stzh-datatable__row stzh-datatable__row--head" }, this._columns.map((column, index) => h("th", { class: {
|
|
178
178
|
"stzh-datatable__cell stzh-datatable__cell--head": true,
|
|
179
179
|
"is-sticky-left": column.fixed === "left",
|
|
180
180
|
"is-sticky-right": column.fixed === "right",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stzh-datatable.js","sourceRoot":"","sources":["../../../src/components/stzh-datatable/stzh-datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EACD,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,EACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Watch,\n Method,\n State\n} from \"@stencil/core\";\n\nimport { Document } from 'flexsearch/dist/flexsearch.bundle.js';\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { StzhDatatableLocalizedText } from './stzh-datatable.localization';\n\n/**\n *\n */\n@Component({\n tag: \"stzh-datatable\",\n styleUrl: \"stzh-datatable.scss\"\n})\nexport class StzhDatatable {\n /** Translation strings */\n @Prop() localization: StzhDatatableLocalizedText;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Sort by given column key */\n @Prop({ mutable: true }) sortBy: string = \"\";\n\n /** Sort direction */\n @Prop({ mutable: true }) sortDirection: \"asc\" | \"desc\" = \"asc\";\n\n /** Tokenize type */\n @Prop() tokenize: \"strict\" | \"forward\" | \"reverse\" | \"full\" = \"forward\";\n\n /** ID field */\n @Prop() idField = \"id\";\n\n /**\n * Whether to disable min-width of the table.\n *\n * If `false`, the default `min-width` is `700px`\n * If `true`, the `min-width` is `none`, so the table will try to squeeze down content as much as possible.\n *\n * You can also overwrite the min-width via CSS with the custom property `--min-width`.\n */\n @Prop({ reflect: true }) disableMinWidth: boolean = false;\n\n /** Rows */\n @Prop() rows: any[] | string = [];\n private _rows: any[];\n private _rowsManaged: any[];\n\n /** Columns */\n @Prop() columns: any[] | string = [];\n private _columns: any[];\n\n @State() query: string = \"\";\n @State() hasScrollLeft: boolean = false;\n @State() hasScrollRight: boolean = false;\n @State() isScrollable: boolean = false;\n @State() cellsStickyLeft: number[] = [];\n @State() cellsStickyRight: number[] = [];\n\n @Element() element: HTMLStzhDatatableElement;\n\n /** Toggle sort by a given column key like when clicking on a column header */\n @Method()\n async toggleSort(columnKey: string) {\n if (columnKey === this.sortBy) {\n this.sortDirection = this.sortDirection === \"asc\" ? \"desc\" : \"asc\";\n } else {\n this.sortDirection = \"asc\";\n this.sortBy = columnKey;\n }\n }\n\n @Watch(\"rows\")\n rowsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._rows = JSON.parse(newValue);\n } else {\n this._rows = newValue;\n }\n\n this.buildSearchIndex();\n }\n\n @Watch(\"columns\")\n columnsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._columns = JSON.parse(newValue);\n } else {\n this._columns = newValue;\n }\n\n this.buildSearchIndex();\n }\n\n private input: HTMLStzhInputElement;\n private searchIndex: Document;\n private tableWrapper: HTMLDivElement;\n private debounceScroll: number;\n\n private debounceResize: number;\n private resizeObserver: ResizeObserver;\n\n private updateScrollStates = () => {\n if (!this.tableWrapper) {\n return;\n }\n\n const wrapperScrollLeft = this.tableWrapper.scrollLeft;\n const wrapperScrollWidth = this.tableWrapper.scrollWidth;\n const wrapperClientWidth = this.tableWrapper.clientWidth;\n\n this.isScrollable = wrapperScrollWidth > wrapperClientWidth;\n this.hasScrollLeft = wrapperScrollLeft > 0;\n this.hasScrollRight = wrapperScrollLeft < wrapperScrollWidth - wrapperClientWidth;\n\n const rows: HTMLTableRowElement[] = Array.from(this.tableWrapper.querySelectorAll(\"tr\"));\n const firstRow = rows[0];\n\n if (!firstRow) {\n return;\n }\n\n this.cellsStickyLeft = [];\n this.cellsStickyRight = [];\n const cells: Element[] = Array.from(firstRow.children);\n\n cells.forEach((cell: HTMLTableCellElement, index: number) => {\n const offsetLeft = cell.offsetLeft;\n const offsetRight = offsetLeft + cell.offsetWidth;\n\n if (\n this.hasScrollLeft\n && this._columns[index].fixed === \"left\"\n && Math.ceil(wrapperScrollLeft) >= offsetLeft\n ) {\n this.cellsStickyLeft.push(index);\n }\n\n if (\n this.hasScrollRight\n && this._columns[index].fixed === \"right\"\n && Math.ceil(wrapperScrollLeft) + wrapperClientWidth <= offsetRight\n ) {\n this.cellsStickyRight.push(index);\n }\n });\n }\n\n private handleResize = () => {\n if (this.debounceResize) {\n window.cancelAnimationFrame(this.debounceResize);\n }\n\n this.debounceResize = requestAnimationFrame(this.updateScrollStates);\n }\n\n private handleScroll = () => {\n if (this.debounceScroll) {\n window.cancelAnimationFrame(this.debounceScroll);\n }\n\n this.debounceScroll = requestAnimationFrame(this.updateScrollStates);\n }\n\n private buildSearchIndex() {\n if (!this._rows || this._rows.length === 0\n || !this._columns || this._columns.length === 0\n ) {\n return;\n }\n\n this.searchIndex = new Document({\n tokenize: this.tokenize,\n matcher: {\n '[äà]': 'a',\n '[öó]': 'o',\n '[üûúù]': 'u',\n '[éè]': 'e'\n },\n document: {\n id: this.idField,\n index: this._columns.map(column => column.key)\n }\n });\n\n this._rows.forEach(row => {\n this.searchIndex.add(row);\n });\n }\n\n private onInputChange = () => {\n this.query = this.input.value;\n }\n\n async componentWillLoad() {\n this.columnsWatcher(this.columns);\n this.rowsWatcher(this.rows);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"datatable\");\n }\n }\n\n componentDidLoad() {\n this.updateScrollStates();\n }\n\n componentWillRender() {\n this._rowsManaged = [];\n\n if (this.query) {\n let resultIds = [];\n\n this.searchIndex.search(this.query).forEach((result) => {\n resultIds = [...resultIds, ...result.result];\n });\n\n resultIds = resultIds.filter(function (item, pos) {\n return resultIds.indexOf(item) === pos;\n });\n\n this._rows.forEach((row) => {\n if (resultIds.indexOf(row[this.idField]) > -1) {\n this._rowsManaged.push(row);\n }\n });\n } else {\n this._rowsManaged = [...this._rows];\n }\n\n if (this.sortBy) {\n this._rowsManaged.sort((rowA, rowB) => {\n const comparison = rowA[this.sortBy].localeCompare(rowB[this.sortBy])\n return this.sortDirection === \"asc\" ? comparison : comparison / -1;\n });\n }\n }\n\n connectedCallback() {\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(this.element);\n }\n\n disconnectedCallback() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n render() {\n const classes = {\n \"stzh-datatable\": true,\n \"is-scrollable\": this.isScrollable,\n \"has-scroll-left\": this.hasScrollLeft,\n \"has-scroll-right\": this.hasScrollRight,\n \"has-scroll-left-shadow\": this.hasScrollLeft && this.cellsStickyLeft.length === 0,\n \"has-scroll-right-shadow\": this.hasScrollRight && this.cellsStickyRight.length === 0\n };\n\n return (\n <Host>\n <div class={classes}>\n <div class=\"stzh-datatable__header\">\n <div class=\"stzh-datatable__heading\">\n <slot name=\"heading\"></slot>\n </div>\n <stzh-input\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n class=\"stzh-datatable__search\"\n size=\"small\"\n name=\"stzh-datatable-search\"\n onStzhChange={this.onInputChange}\n label={this.localization.searchLabel}\n ></stzh-input>\n </div>\n <div class=\"stzh-datatable__outer-wrapper\">\n <div\n ref={(el) => (this.tableWrapper = el as HTMLDivElement)}\n class=\"stzh-datatable__wrapper\"\n onScroll={this.handleScroll}\n >\n <table class=\"stzh-datatable__table\">\n <thead class=\"stzh-datatable__thead\">\n <tr class=\"stzh-datatable__row stzh-datatable__row--head\">\n {this._columns.map((column, index) =>\n <th\n class={{\n \"stzh-datatable__cell stzh-datatable__cell--head\": true,\n \"is-sticky-left\": column.fixed === \"left\",\n \"is-sticky-right\": column.fixed === \"right\",\n \"is-sortable\": column.sort,\n \"has-sticked\": this.cellsStickyLeft.indexOf(index) > -1 || this.cellsStickyRight.indexOf(index) > -1,\n \"has-sorted\": column.key === this.sortBy,\n \"has-sorted-asc\": column.key === this.sortBy && this.sortDirection === \"asc\",\n \"has-sorted-desc\": column.key === this.sortBy && this.sortDirection === \"desc\",\n [`align-${column.align}`]: column.align,\n [`valign-${column.valign}`]: column.valign\n }}\n >\n {column.sort ?\n <button\n class=\"stzh-datatable__sort-button\"\n type=\"button\"\n onClick={() => this.toggleSort(column.key)}\n s-object-id={column.analyticsId || `${column.text} ${this.localization.columnSort}`}\n >\n <span>{column.text}</span>\n <stzh-icon name=\"arrow-up\" class=\"stzh-datatable__sort-icon\" a11yTitle={this.localization.columnSort}></stzh-icon>\n </button>\n :\n <span>{column.text}</span>\n }\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {this._rowsManaged.map((row) =>\n <tr class=\"stzh-datatable__row stzh-datatable__row--body\">\n {this._columns.map((column, index) =>\n <td\n innerHTML={row[column.key]?.text || row[column.key] || \"\"}\n class={{\n \"stzh-datatable__cell stzh-datatable__cell--body\": true,\n \"is-sticky-left\": column.fixed === \"left\",\n \"is-sticky-right\": column.fixed === \"right\",\n \"is-sortable\": column.sort,\n \"has-sticked\": this.cellsStickyLeft.indexOf(index) > -1 || this.cellsStickyRight.indexOf(index) > -1,\n \"has-sorted\": column.key === this.sortBy,\n \"has-sorted-asc\": column.key === this.sortBy && this.sortDirection === \"asc\",\n \"has-sorted-desc\": column.key === this.sortBy && this.sortDirection === \"desc\",\n [`align-${row[column.key]?.align || column.align}`]: row[column.key]?.align || column.align,\n [`valign-${row[column.key]?.valign || column.valign}`]: row[column.key]?.valign || column.valign\n }}\n ></td>\n )}\n </tr>\n )}\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stzh-datatable.js","sourceRoot":"","sources":["../../../src/components/stzh-datatable/stzh-datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EACD,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,EACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE;;GAEG;AAKH,MAAM,OAAO,aAAa;;IAwFhB,uBAAkB,GAAG,GAAG,EAAE;MAChC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;QACtB,OAAO;OACR;MAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Watch,\n Method,\n State\n} from \"@stencil/core\";\n\nimport { Document } from 'flexsearch/dist/flexsearch.bundle.js';\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { StzhDatatableLocalizedText } from './stzh-datatable.localization';\n\n/**\n * @slot action-button - Slot for action `stzh-button` element\n */\n@Component({\n tag: \"stzh-datatable\",\n styleUrl: \"stzh-datatable.scss\"\n})\nexport class StzhDatatable {\n /** Translation strings */\n @Prop() localization: StzhDatatableLocalizedText;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Sort by given column key */\n @Prop({ mutable: true }) sortBy: string = \"\";\n\n /** Sort direction */\n @Prop({ mutable: true }) sortDirection: \"asc\" | \"desc\" = \"asc\";\n\n /** Tokenize type */\n @Prop() tokenize: \"strict\" | \"forward\" | \"reverse\" | \"full\" = \"forward\";\n\n /** ID field */\n @Prop() idField = \"id\";\n\n /**\n * Whether to disable min-width of the table.\n *\n * If `false`, the default `min-width` is `700px`\n * If `true`, the `min-width` is `none`, so the table will try to squeeze down content as much as possible.\n *\n * You can also overwrite the min-width via CSS with the custom property `--min-width`.\n */\n @Prop({ reflect: true }) disableMinWidth: boolean = false;\n\n /** Rows */\n @Prop() rows: any[] | string = [];\n private _rows: any[];\n private _rowsManaged: any[];\n\n /** Columns */\n @Prop() columns: any[] | string = [];\n private _columns: any[];\n\n @State() query: string = \"\";\n @State() hasScrollLeft: boolean = false;\n @State() hasScrollRight: boolean = false;\n @State() isScrollable: boolean = false;\n @State() cellsStickyLeft: number[] = [];\n @State() cellsStickyRight: number[] = [];\n\n @Element() element: HTMLStzhDatatableElement;\n\n /** Toggle sort by a given column key like when clicking on a column header */\n @Method()\n async toggleSort(columnKey: string) {\n if (columnKey === this.sortBy) {\n this.sortDirection = this.sortDirection === \"asc\" ? \"desc\" : \"asc\";\n } else {\n this.sortDirection = \"asc\";\n this.sortBy = columnKey;\n }\n }\n\n @Watch(\"rows\")\n rowsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._rows = JSON.parse(newValue);\n } else {\n this._rows = newValue;\n }\n\n this.buildSearchIndex();\n }\n\n @Watch(\"columns\")\n columnsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._columns = JSON.parse(newValue);\n } else {\n this._columns = newValue;\n }\n\n this.buildSearchIndex();\n }\n\n private input: HTMLStzhInputElement;\n private searchIndex: Document;\n private tableWrapper: HTMLDivElement;\n private debounceScroll: number;\n\n private debounceResize: number;\n private resizeObserver: ResizeObserver;\n\n private updateScrollStates = () => {\n if (!this.tableWrapper) {\n return;\n }\n\n const wrapperScrollLeft = this.tableWrapper.scrollLeft;\n const wrapperScrollWidth = this.tableWrapper.scrollWidth;\n const wrapperClientWidth = this.tableWrapper.clientWidth;\n\n this.isScrollable = wrapperScrollWidth > wrapperClientWidth;\n this.hasScrollLeft = wrapperScrollLeft > 0;\n this.hasScrollRight = wrapperScrollLeft < wrapperScrollWidth - wrapperClientWidth;\n\n const rows: HTMLTableRowElement[] = Array.from(this.tableWrapper.querySelectorAll(\"tr\"));\n const firstRow = rows[0];\n\n if (!firstRow) {\n return;\n }\n\n this.cellsStickyLeft = [];\n this.cellsStickyRight = [];\n const cells: Element[] = Array.from(firstRow.children);\n\n cells.forEach((cell: HTMLTableCellElement, index: number) => {\n const offsetLeft = cell.offsetLeft;\n const offsetRight = offsetLeft + cell.offsetWidth;\n\n if (\n this.hasScrollLeft\n && this._columns[index].fixed === \"left\"\n && Math.ceil(wrapperScrollLeft) >= offsetLeft\n ) {\n this.cellsStickyLeft.push(index);\n }\n\n if (\n this.hasScrollRight\n && this._columns[index].fixed === \"right\"\n && Math.ceil(wrapperScrollLeft) + wrapperClientWidth <= offsetRight\n ) {\n this.cellsStickyRight.push(index);\n }\n });\n }\n\n private handleResize = () => {\n if (this.debounceResize) {\n window.cancelAnimationFrame(this.debounceResize);\n }\n\n this.debounceResize = requestAnimationFrame(this.updateScrollStates);\n }\n\n private handleScroll = () => {\n if (this.debounceScroll) {\n window.cancelAnimationFrame(this.debounceScroll);\n }\n\n this.debounceScroll = requestAnimationFrame(this.updateScrollStates);\n }\n\n private buildSearchIndex() {\n if (!this._rows || this._rows.length === 0\n || !this._columns || this._columns.length === 0\n ) {\n return;\n }\n\n this.searchIndex = new Document({\n tokenize: this.tokenize,\n matcher: {\n '[äà]': 'a',\n '[öó]': 'o',\n '[üûúù]': 'u',\n '[éè]': 'e'\n },\n document: {\n id: this.idField,\n index: this._columns.map(column => column.key)\n }\n });\n\n this._rows.forEach(row => {\n this.searchIndex.add(row);\n });\n }\n\n private onInputChange = () => {\n this.query = this.input.value;\n }\n\n async componentWillLoad() {\n this.columnsWatcher(this.columns);\n this.rowsWatcher(this.rows);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"datatable\");\n }\n }\n\n componentDidLoad() {\n this.updateScrollStates();\n }\n\n componentWillRender() {\n this._rowsManaged = [];\n\n if (this.query) {\n let resultIds = [];\n\n this.searchIndex.search(this.query).forEach((result) => {\n resultIds = [...resultIds, ...result.result];\n });\n\n resultIds = resultIds.filter(function (item, pos) {\n return resultIds.indexOf(item) === pos;\n });\n\n this._rows.forEach((row) => {\n if (resultIds.indexOf(row[this.idField]) > -1) {\n this._rowsManaged.push(row);\n }\n });\n } else {\n this._rowsManaged = [...this._rows];\n }\n\n if (this.sortBy) {\n this._rowsManaged.sort((rowA, rowB) => {\n const comparison = rowA[this.sortBy].localeCompare(rowB[this.sortBy])\n return this.sortDirection === \"asc\" ? comparison : comparison / -1;\n });\n }\n }\n\n connectedCallback() {\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(this.element);\n }\n\n disconnectedCallback() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n render() {\n const classes = {\n \"stzh-datatable\": true,\n \"is-scrollable\": this.isScrollable,\n \"has-scroll-left\": this.hasScrollLeft,\n \"has-scroll-right\": this.hasScrollRight,\n \"has-scroll-left-shadow\": this.hasScrollLeft && this.cellsStickyLeft.length === 0,\n \"has-scroll-right-shadow\": this.hasScrollRight && this.cellsStickyRight.length === 0\n };\n\n return (\n <Host>\n <div class={classes}>\n <div class=\"stzh-datatable__header\">\n <div class=\"stzh-datatable__heading\">\n <slot name=\"heading\"></slot>\n </div>\n <div class=\"stzh-datatable__sub-header\">\n <stzh-input\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n class=\"stzh-datatable__search\"\n size=\"small\"\n name=\"stzh-datatable-search\"\n onStzhChange={this.onInputChange}\n label={this.localization.searchLabel}\n ></stzh-input>\n <div class=\"stzh-datatable__action-button\">\n <slot name=\"action-button\"></slot>\n </div>\n </div>\n\n </div>\n <div class=\"stzh-datatable__outer-wrapper\">\n <div\n ref={(el) => (this.tableWrapper = el as HTMLDivElement)}\n class=\"stzh-datatable__wrapper\"\n onScroll={this.handleScroll}\n >\n <table class=\"stzh-datatable__table\">\n <thead class=\"stzh-datatable__thead\">\n <tr class=\"stzh-datatable__row stzh-datatable__row--head\">\n {this._columns.map((column, index) =>\n <th\n class={{\n \"stzh-datatable__cell stzh-datatable__cell--head\": true,\n \"is-sticky-left\": column.fixed === \"left\",\n \"is-sticky-right\": column.fixed === \"right\",\n \"is-sortable\": column.sort,\n \"has-sticked\": this.cellsStickyLeft.indexOf(index) > -1 || this.cellsStickyRight.indexOf(index) > -1,\n \"has-sorted\": column.key === this.sortBy,\n \"has-sorted-asc\": column.key === this.sortBy && this.sortDirection === \"asc\",\n \"has-sorted-desc\": column.key === this.sortBy && this.sortDirection === \"desc\",\n [`align-${column.align}`]: column.align,\n [`valign-${column.valign}`]: column.valign\n }}\n >\n {column.sort ?\n <button\n class=\"stzh-datatable__sort-button\"\n type=\"button\"\n onClick={() => this.toggleSort(column.key)}\n s-object-id={column.analyticsId || `${column.text} ${this.localization.columnSort}`}\n >\n <span>{column.text}</span>\n <stzh-icon name=\"arrow-up\" class=\"stzh-datatable__sort-icon\" a11yTitle={this.localization.columnSort}></stzh-icon>\n </button>\n :\n <span>{column.text}</span>\n }\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {this._rowsManaged.map((row) =>\n <tr class=\"stzh-datatable__row stzh-datatable__row--body\">\n {this._columns.map((column, index) =>\n <td\n innerHTML={row[column.key]?.text || row[column.key] || \"\"}\n class={{\n \"stzh-datatable__cell stzh-datatable__cell--body\": true,\n \"is-sticky-left\": column.fixed === \"left\",\n \"is-sticky-right\": column.fixed === \"right\",\n \"is-sortable\": column.sort,\n \"has-sticked\": this.cellsStickyLeft.indexOf(index) > -1 || this.cellsStickyRight.indexOf(index) > -1,\n \"has-sorted\": column.key === this.sortBy,\n \"has-sorted-asc\": column.key === this.sortBy && this.sortDirection === \"asc\",\n \"has-sorted-desc\": column.key === this.sortBy && this.sortDirection === \"desc\",\n [`align-${row[column.key]?.align || column.align}`]: row[column.key]?.align || column.align,\n [`valign-${row[column.key]?.valign || column.valign}`]: row[column.key]?.valign || column.valign\n }}\n ></td>\n )}\n </tr>\n )}\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -10,6 +10,7 @@ const story = createComponentStory(COMPONENT_NAME);
|
|
|
10
10
|
const TEMPLATE = `
|
|
11
11
|
<stzh-datatable>
|
|
12
12
|
<stzh-heading slot="heading" level="2">Table heading</stzh-heading>
|
|
13
|
+
<stzh-button slot="action-button" variant="primary" icon="plus" size="small">Create</stzh-button>
|
|
13
14
|
</stzh-datatable>
|
|
14
15
|
`;
|
|
15
16
|
|
|
@@ -385,7 +385,7 @@ export class StzhDatepicker {
|
|
|
385
385
|
"optional": false,
|
|
386
386
|
"docs": {
|
|
387
387
|
"tags": [],
|
|
388
|
-
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show
|
|
388
|
+
"text": "Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing"
|
|
389
389
|
},
|
|
390
390
|
"attribute": "show-marker",
|
|
391
391
|
"reflect": true,
|