@dubai-design-system/components-js 5.0.3 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +233 -1
- package/MIGRATION.md +423 -0
- package/dist/cjs/dda-accordion.cjs.entry.js +12 -7
- package/dist/cjs/dda-alert.cjs.entry.js +20 -3
- package/dist/cjs/dda-attach-file.cjs.entry.js +24 -8
- package/dist/cjs/dda-avatar.cjs.entry.js +23 -12
- package/dist/cjs/dda-banner.cjs.entry.js +14 -5
- package/dist/cjs/dda-breadcrumb.cjs.entry.js +22 -10
- package/dist/cjs/dda-button.cjs.entry.js +16 -9
- package/dist/cjs/dda-checkbox.cjs.entry.js +5 -4
- package/dist/cjs/dda-chip.cjs.entry.js +8 -3
- package/dist/cjs/dda-credit-card.cjs.entry.js +5 -3
- package/dist/cjs/dda-creditcard-field.cjs.entry.js +26 -8
- package/dist/cjs/dda-dropdown.cjs.entry.js +31 -5
- package/dist/cjs/dda-footer.cjs.entry.js +9 -3
- package/dist/cjs/dda-header.cjs.entry.js +88 -8
- package/dist/cjs/dda-home-banner.cjs.entry.js +11 -5
- package/dist/cjs/dda-horizontal-stepper.cjs.entry.js +22 -5
- package/dist/cjs/dda-input.cjs.entry.js +17 -10
- package/dist/cjs/dda-link-button_2.cjs.entry.js +21 -13
- package/dist/cjs/dda-number-field.cjs.entry.js +20 -8
- package/dist/cjs/dda-pagination.cjs.entry.js +21 -11
- package/dist/cjs/dda-phonefield.cjs.entry.js +27 -9
- package/dist/cjs/dda-progressbar.cjs.entry.js +8 -3
- package/dist/cjs/dda-range-slider.cjs.entry.js +15 -3
- package/dist/cjs/dda-search-input.cjs.entry.js +27 -12
- package/dist/cjs/dda-segmented-tabs.cjs.entry.js +54 -6
- package/dist/cjs/dda-select.cjs.entry.js +40 -8
- package/dist/cjs/dda-sticky-footer.cjs.entry.js +20 -3
- package/dist/cjs/dda-tabs.cjs.entry.js +10 -4
- package/dist/cjs/dda-textarea.cjs.entry.js +22 -12
- package/dist/cjs/dda-toggle.cjs.entry.js +5 -4
- package/dist/cjs/dda-tooltip.cjs.entry.js +6 -4
- package/dist/cjs/dda-ui-card.cjs.entry.js +19 -2
- package/dist/cjs/dda-vertical-stepper.cjs.entry.js +23 -3
- package/dist/cjs/dda.cjs.js +2 -2
- package/dist/cjs/index-Bgd2iAET.js +2116 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/unique-id-DahNGdQy.js +14 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/dda-accordion/dda-accordion.js +16 -11
- package/dist/collection/components/dda-alert/dda-alert.js +74 -17
- package/dist/collection/components/dda-alert/dda-alert.stories.js +2 -8
- package/dist/collection/components/dda-attach-file/dda-attach-file.js +35 -19
- package/dist/collection/components/dda-attach-file/dda-attach-file.stories.js +0 -9
- package/dist/collection/components/dda-avatar/dda-avatar.js +53 -25
- package/dist/collection/components/dda-avatar/dda-avatar.stories.js +1 -1
- package/dist/collection/components/dda-banner/dda-banner.css +35 -0
- package/dist/collection/components/dda-banner/dda-banner.js +34 -5
- package/dist/collection/components/dda-breadcrumb/dda-breadcrumb.js +49 -12
- package/dist/collection/components/dda-button/dda-button.js +29 -22
- package/dist/collection/components/dda-checkbox/dda-checkbox.css +13 -0
- package/dist/collection/components/dda-checkbox/dda-checkbox.js +13 -12
- package/dist/collection/components/dda-checkbox/dda-checkbox.stories.js +0 -11
- package/dist/collection/components/dda-chip/dda-chip.js +34 -9
- package/dist/collection/components/dda-chip/dda-chip.stories.js +0 -11
- package/dist/collection/components/dda-credit-card/dda-credit-card.js +10 -8
- package/dist/collection/components/dda-creditcard-field/dda-creditcard-field.js +58 -23
- package/dist/collection/components/dda-creditcard-field/dda-creditcard-field.stories.js +1 -10
- package/dist/collection/components/dda-dropdown/dda-dropdown.js +90 -18
- package/dist/collection/components/dda-dropdown/dda-dropdown.stories.js +0 -4
- package/dist/collection/components/dda-footer/dda-footer.js +57 -10
- package/dist/collection/components/dda-footer/dda-footer.stories.js +5 -4
- package/dist/collection/components/dda-header/dda-header.css +11 -0
- package/dist/collection/components/dda-header/dda-header.js +232 -37
- package/dist/collection/components/dda-header/dda-header.stories.js +12 -21
- package/dist/collection/components/dda-home-banner/dda-home-banner.js +8 -2
- package/dist/collection/components/dda-home-banner/home-banner.css +23 -2
- package/dist/collection/components/dda-input/dda-input.js +47 -21
- package/dist/collection/components/dda-input/dda-input.stories.js +0 -13
- package/dist/collection/components/dda-link-button/dda-link-button.js +30 -23
- package/dist/collection/components/dda-number-field/dda-number-field.js +54 -22
- package/dist/collection/components/dda-number-field/dda-number-field.stories.js +0 -9
- package/dist/collection/components/dda-pagination/dda-pagination.js +95 -28
- package/dist/collection/components/dda-pagination/dda-pagination.stories.js +24 -24
- package/dist/collection/components/dda-phonefield/dda-phonefield.js +62 -24
- package/dist/collection/components/dda-phonefield/dda-phonefield.stories.js +0 -13
- package/dist/collection/components/dda-progressbar/dda-progressbar.js +13 -8
- package/dist/collection/components/dda-radiobutton/dda-radiobutton.css +156 -25
- package/dist/collection/components/dda-radiobutton/dda-radiobutton.js +13 -12
- package/dist/collection/components/dda-radiobutton/dda-radiobutton.stories.js +5 -16
- package/dist/collection/components/dda-range-slider/dda-range-slider.js +29 -17
- package/dist/collection/components/dda-search-input/dda-search-input.js +61 -26
- package/dist/collection/components/dda-search-input/dda-search-input.stories.js +0 -9
- package/dist/collection/components/dda-select/dda-select.js +78 -20
- package/dist/collection/components/dda-sticky-footer/dda-sticky-footer.js +80 -43
- package/dist/collection/components/dda-sticky-footer/dda-sticky-footer.stories.js +1 -1
- package/dist/collection/components/dda-tabs/dda-tabs.js +21 -15
- package/dist/collection/components/dda-tabs/dda-tabs.stories.js +3 -10
- package/dist/collection/components/dda-textarea/dda-textarea.js +33 -23
- package/dist/collection/components/dda-textarea/dda-textarea.stories.js +0 -9
- package/dist/collection/components/dda-toggle/dda-toggle.css +9 -0
- package/dist/collection/components/dda-toggle/dda-toggle.js +47 -8
- package/dist/collection/components/dda-toggle/dda-toggle.stories.js +10 -22
- package/dist/collection/components/dda-tooltip/dda-tooltip.js +9 -7
- package/dist/collection/components/dda-ui-card/dda-ui-card.js +55 -13
- package/dist/collection/components/segmented-groups/dda-segmented-tabs/dda-segmented-tabs.js +79 -11
- package/dist/collection/components/stepper/dda-horizontal-stepper/dda-horizontal-stepper.css +4 -1
- package/dist/collection/components/stepper/dda-horizontal-stepper/dda-horizontal-stepper.js +24 -6
- package/dist/collection/components/stepper/dda-horizontal-stepper/dda-horizontal-stepper.stories.js +2 -2
- package/dist/collection/components/stepper/dda-vertical-stepper/dda-vertical-stepper.js +49 -6
- package/dist/collection/components/stepper/dda-vertical-stepper/dda-vertical-stepper.stories.js +2 -2
- package/dist/collection/global/global.css +152 -25
- package/dist/collection/global/input.css +56 -2
- package/dist/collection/storybook/component-api.js +15 -0
- package/dist/collection/utils/placeholder-color.js +89 -0
- package/dist/collection/utils/unique-id.js +10 -0
- package/dist/components/dda-accordion.js +1 -1
- package/dist/components/dda-alert.js +1 -1
- package/dist/components/dda-attach-file.js +1 -1
- package/dist/components/dda-avatar.js +1 -1
- package/dist/components/dda-banner.js +1 -1
- package/dist/components/dda-breadcrumb.js +1 -1
- package/dist/components/dda-button.js +1 -1
- package/dist/components/dda-checkbox.js +1 -1
- package/dist/components/dda-chip.js +1 -1
- package/dist/components/dda-credit-card.js +1 -1
- package/dist/components/dda-creditcard-field.js +1 -1
- package/dist/components/dda-dropdown.js +1 -1
- package/dist/components/dda-footer.js +1 -1
- package/dist/components/dda-header.js +1 -1
- package/dist/components/dda-home-banner.js +1 -1
- package/dist/components/dda-horizontal-stepper.js +1 -1
- package/dist/components/dda-input.js +1 -1
- package/dist/components/dda-link-button.js +1 -1
- package/dist/components/dda-number-field.js +1 -1
- package/dist/components/dda-pagination.js +1 -1
- package/dist/components/dda-phonefield.js +1 -1
- package/dist/components/dda-progressbar.js +1 -1
- package/dist/components/dda-radiobutton.js +1 -1
- package/dist/components/dda-range-slider.js +1 -1
- package/dist/components/dda-search-input.js +1 -1
- package/dist/components/dda-segmented-tabs.js +1 -1
- package/dist/components/dda-select.js +1 -1
- package/dist/components/dda-sticky-footer.js +1 -1
- package/dist/components/dda-tabs.js +1 -1
- package/dist/components/dda-textarea.js +1 -1
- package/dist/components/dda-toggle.js +1 -1
- package/dist/components/dda-tooltip.js +1 -1
- package/dist/components/dda-ui-card.js +1 -1
- package/dist/components/dda-vertical-stepper.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-B-I003EB.js +1 -0
- package/dist/components/p-Bc2V1U4_.js +1 -0
- package/dist/components/p-Bzqf-PpF.js +1 -0
- package/dist/components/p-D-CHT-as.js +1 -0
- package/dist/components/p-DJw8qV7U.js +1 -0
- package/dist/components/p-DpwQ9sGp.js +1 -0
- package/dist/dda/dda.css +2 -2
- package/dist/dda/dda.esm.js +1 -1
- package/dist/dda/p-03400387.entry.js +1 -0
- package/dist/dda/p-04bcda8a.entry.js +1 -0
- package/dist/dda/p-18a3d7b1.entry.js +1 -0
- package/dist/dda/p-1f7b8486.entry.js +1 -0
- package/dist/dda/p-3024288f.entry.js +1 -0
- package/dist/dda/p-41b8ed7d.entry.js +1 -0
- package/dist/dda/p-56f60336.entry.js +1 -0
- package/dist/dda/p-65776d80.entry.js +1 -0
- package/dist/dda/p-73611084.entry.js +1 -0
- package/dist/dda/p-7ad8cde9.entry.js +1 -0
- package/dist/dda/p-8134e59d.entry.js +1 -0
- package/dist/dda/p-8494fd9e.entry.js +1 -0
- package/dist/dda/p-876d55b2.entry.js +1 -0
- package/dist/dda/p-88d884a8.entry.js +1 -0
- package/dist/dda/p-8b25ae94.entry.js +1 -0
- package/dist/dda/p-8f376986.entry.js +1 -0
- package/dist/dda/p-90019b80.entry.js +1 -0
- package/dist/dda/p-92fa4777.entry.js +1 -0
- package/dist/dda/p-97431faf.entry.js +1 -0
- package/dist/dda/p-B-I003EB.js +1 -0
- package/dist/dda/p-D6L6zgH9.js +2 -0
- package/dist/dda/p-a5456de2.entry.js +1 -0
- package/dist/dda/p-aa7b4c13.entry.js +1 -0
- package/dist/dda/p-ad40eb27.entry.js +1 -0
- package/dist/dda/p-c055f0d2.entry.js +1 -0
- package/dist/dda/p-c42c8733.entry.js +1 -0
- package/dist/dda/p-c77282be.entry.js +1 -0
- package/dist/dda/p-ca64abe6.entry.js +1 -0
- package/dist/dda/p-ceca8088.entry.js +1 -0
- package/dist/dda/p-d6786b43.entry.js +1 -0
- package/dist/dda/p-e2113e42.entry.js +1 -0
- package/dist/dda/p-ee862207.entry.js +1 -0
- package/dist/dda/p-ef38e28b.entry.js +1 -0
- package/dist/dda/p-f43fb910.entry.js +1 -0
- package/dist/dda/p-fb4db977.entry.js +1 -0
- package/dist/esm/dda-accordion.entry.js +12 -7
- package/dist/esm/dda-alert.entry.js +20 -3
- package/dist/esm/dda-attach-file.entry.js +24 -8
- package/dist/esm/dda-avatar.entry.js +23 -12
- package/dist/esm/dda-banner.entry.js +14 -5
- package/dist/esm/dda-breadcrumb.entry.js +22 -10
- package/dist/esm/dda-button.entry.js +16 -9
- package/dist/esm/dda-checkbox.entry.js +5 -4
- package/dist/esm/dda-chip.entry.js +8 -3
- package/dist/esm/dda-credit-card.entry.js +5 -3
- package/dist/esm/dda-creditcard-field.entry.js +26 -8
- package/dist/esm/dda-dropdown.entry.js +31 -5
- package/dist/esm/dda-footer.entry.js +9 -3
- package/dist/esm/dda-header.entry.js +88 -8
- package/dist/esm/dda-home-banner.entry.js +11 -5
- package/dist/esm/dda-horizontal-stepper.entry.js +22 -5
- package/dist/esm/dda-input.entry.js +17 -10
- package/dist/esm/dda-link-button_2.entry.js +21 -13
- package/dist/esm/dda-number-field.entry.js +20 -8
- package/dist/esm/dda-pagination.entry.js +21 -11
- package/dist/esm/dda-phonefield.entry.js +27 -9
- package/dist/esm/dda-progressbar.entry.js +8 -3
- package/dist/esm/dda-range-slider.entry.js +15 -3
- package/dist/esm/dda-search-input.entry.js +27 -12
- package/dist/esm/dda-segmented-tabs.entry.js +54 -6
- package/dist/esm/dda-select.entry.js +40 -8
- package/dist/esm/dda-sticky-footer.entry.js +20 -3
- package/dist/esm/dda-tabs.entry.js +10 -4
- package/dist/esm/dda-textarea.entry.js +22 -12
- package/dist/esm/dda-toggle.entry.js +5 -4
- package/dist/esm/dda-tooltip.entry.js +6 -4
- package/dist/esm/dda-ui-card.entry.js +19 -2
- package/dist/esm/dda-vertical-stepper.entry.js +23 -3
- package/dist/esm/dda.js +3 -3
- package/dist/esm/index-D6L6zgH9.js +2106 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/unique-id-B-I003EB.js +12 -0
- package/dist/types/components/dda-accordion/dda-accordion.d.ts +6 -0
- package/dist/types/components/dda-alert/dda-alert.d.ts +21 -0
- package/dist/types/components/dda-attach-file/dda-attach-file.d.ts +17 -0
- package/dist/types/components/dda-attach-file/dda-attach-file.stories.d.ts +0 -4
- package/dist/types/components/dda-avatar/dda-avatar.d.ts +20 -0
- package/dist/types/components/dda-banner/dda-banner.d.ts +5 -0
- package/dist/types/components/dda-breadcrumb/dda-breadcrumb.d.ts +12 -6
- package/dist/types/components/dda-button/dda-button.d.ts +15 -4
- package/dist/types/components/dda-checkbox/dda-checkbox.d.ts +11 -0
- package/dist/types/components/dda-checkbox/dda-checkbox.stories.d.ts +0 -10
- package/dist/types/components/dda-chip/dda-chip.d.ts +10 -0
- package/dist/types/components/dda-chip/dda-chip.stories.d.ts +0 -6
- package/dist/types/components/dda-credit-card/dda-credit-card.d.ts +7 -0
- package/dist/types/components/dda-creditcard-field/dda-creditcard-field.d.ts +24 -0
- package/dist/types/components/dda-creditcard-field/dda-creditcard-field.stories.d.ts +0 -6
- package/dist/types/components/dda-dropdown/dda-dropdown.d.ts +25 -0
- package/dist/types/components/dda-dropdown/dda-dropdown.stories.d.ts +0 -4
- package/dist/types/components/dda-footer/dda-footer.d.ts +13 -0
- package/dist/types/components/dda-header/dda-header.d.ts +62 -0
- package/dist/types/components/dda-header/dda-header.stories.d.ts +6 -0
- package/dist/types/components/dda-home-banner/dda-home-banner.d.ts +1 -0
- package/dist/types/components/dda-input/dda-input.d.ts +18 -0
- package/dist/types/components/dda-input/dda-input.stories.d.ts +0 -6
- package/dist/types/components/dda-link-button/dda-link-button.d.ts +14 -3
- package/dist/types/components/dda-number-field/dda-number-field.d.ts +21 -0
- package/dist/types/components/dda-number-field/dda-number-field.stories.d.ts +0 -6
- package/dist/types/components/dda-pagination/dda-pagination.d.ts +26 -0
- package/dist/types/components/dda-phonefield/dda-phonefield.d.ts +21 -0
- package/dist/types/components/dda-phonefield/dda-phonefield.stories.d.ts +0 -6
- package/dist/types/components/dda-progressbar/dda-progressbar.d.ts +7 -0
- package/dist/types/components/dda-radiobutton/dda-radiobutton.d.ts +11 -0
- package/dist/types/components/dda-radiobutton/dda-radiobutton.stories.d.ts +5 -15
- package/dist/types/components/dda-range-slider/dda-range-slider.d.ts +16 -0
- package/dist/types/components/dda-search-input/dda-search-input.d.ts +21 -0
- package/dist/types/components/dda-search-input/dda-search-input.stories.d.ts +0 -6
- package/dist/types/components/dda-select/dda-select.d.ts +23 -0
- package/dist/types/components/dda-sticky-footer/dda-sticky-footer.d.ts +46 -3
- package/dist/types/components/dda-tabs/dda-tabs.d.ts +12 -1
- package/dist/types/components/dda-tabs/dda-tabs.stories.d.ts +0 -4
- package/dist/types/components/dda-textarea/dda-textarea.d.ts +16 -0
- package/dist/types/components/dda-textarea/dda-textarea.stories.d.ts +0 -6
- package/dist/types/components/dda-toggle/dda-toggle.d.ts +11 -0
- package/dist/types/components/dda-toggle/dda-toggle.stories.d.ts +2 -12
- package/dist/types/components/dda-tooltip/dda-tooltip.d.ts +5 -0
- package/dist/types/components/dda-ui-card/dda-ui-card.d.ts +13 -1
- package/dist/types/components/segmented-groups/dda-segmented-tabs/dda-segmented-tabs.d.ts +19 -2
- package/dist/types/components/stepper/dda-horizontal-stepper/dda-horizontal-stepper.d.ts +6 -0
- package/dist/types/components/stepper/dda-vertical-stepper/dda-vertical-stepper.d.ts +8 -0
- package/dist/types/components.d.ts +2373 -38
- package/dist/types/utils/placeholder-color.d.ts +10 -0
- package/dist/types/utils/unique-id.d.ts +6 -0
- package/package.json +4 -3
- package/readme.md +6 -0
- package/dist/cjs/index-CDUC0Pdj.js +0 -1986
- package/dist/components/p-9UeqjDnY.js +0 -1
- package/dist/components/p-CrTEb7xH.js +0 -1
- package/dist/components/p-DldlmGnP.js +0 -1
- package/dist/components/p-NvTw9Mx1.js +0 -1
- package/dist/components/p-i15-_er0.js +0 -1
- package/dist/dda/p-016e4090.entry.js +0 -1
- package/dist/dda/p-0229b303.entry.js +0 -1
- package/dist/dda/p-05a6f90d.entry.js +0 -1
- package/dist/dda/p-1c9a6035.entry.js +0 -1
- package/dist/dda/p-2c313105.entry.js +0 -1
- package/dist/dda/p-2cec7be6.entry.js +0 -1
- package/dist/dda/p-2f4ace4c.entry.js +0 -1
- package/dist/dda/p-360a0577.entry.js +0 -1
- package/dist/dda/p-3e49128d.entry.js +0 -1
- package/dist/dda/p-3fa27728.entry.js +0 -1
- package/dist/dda/p-43e1c12f.entry.js +0 -1
- package/dist/dda/p-4428417d.entry.js +0 -1
- package/dist/dda/p-44ce832e.entry.js +0 -1
- package/dist/dda/p-560a3f0c.entry.js +0 -1
- package/dist/dda/p-5712bbd9.entry.js +0 -1
- package/dist/dda/p-626d7e7b.entry.js +0 -1
- package/dist/dda/p-68008c64.entry.js +0 -1
- package/dist/dda/p-6f3d9f78.entry.js +0 -1
- package/dist/dda/p-79db1218.entry.js +0 -1
- package/dist/dda/p-84911fab.entry.js +0 -1
- package/dist/dda/p-90d9648b.entry.js +0 -1
- package/dist/dda/p-91040abe.entry.js +0 -1
- package/dist/dda/p-Cq6A4mXg.js +0 -2
- package/dist/dda/p-a1421a54.entry.js +0 -1
- package/dist/dda/p-a22b1c56.entry.js +0 -1
- package/dist/dda/p-aa0e9035.entry.js +0 -1
- package/dist/dda/p-b2981646.entry.js +0 -1
- package/dist/dda/p-c1f45887.entry.js +0 -1
- package/dist/dda/p-c50e1141.entry.js +0 -1
- package/dist/dda/p-d8a9cab1.entry.js +0 -1
- package/dist/dda/p-dd966009.entry.js +0 -1
- package/dist/dda/p-ed099201.entry.js +0 -1
- package/dist/dda/p-f4bd2b2e.entry.js +0 -1
- package/dist/dda/p-fc30c60e.entry.js +0 -1
- package/dist/esm/index-Cq6A4mXg.js +0 -1976
|
@@ -6,11 +6,15 @@ import excelIcon from "../../assets/img/icn/icn-Excel.svg";
|
|
|
6
6
|
import imageIcon from "../../assets/img/icn/icn-Image.svg";
|
|
7
7
|
import videoIcon from "../../assets/img/icn/icn-Video.svg";
|
|
8
8
|
import onenoteIcon from "../../assets/img/icn/icn-OneNote.svg";
|
|
9
|
+
import { uniqueId } from "../../utils/unique-id";
|
|
9
10
|
export class DdaAttachFile {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.file = null;
|
|
13
|
+
/** Extra CSS classes added to the field container. */
|
|
12
14
|
this.custom_class = '';
|
|
15
|
+
/** Accessible name of the file input. Not rendered when empty. */
|
|
13
16
|
this.aria_label = '';
|
|
17
|
+
/** Accessible name of the remove button shown after a file is chosen, e.g. `Remove file`. */
|
|
14
18
|
this.button_aria_label = '';
|
|
15
19
|
this.fileIcons = {
|
|
16
20
|
pdf: pdfIcon,
|
|
@@ -24,6 +28,9 @@ export class DdaAttachFile {
|
|
|
24
28
|
mkv: videoIcon,
|
|
25
29
|
one: onenoteIcon,
|
|
26
30
|
};
|
|
31
|
+
// Per-instance fallback, so the labels, helper and error text stay linked
|
|
32
|
+
// to the file input when the consumer omits input_id.
|
|
33
|
+
this.fallbackId = uniqueId('dda-attach-file');
|
|
27
34
|
}
|
|
28
35
|
handleFileInput(event) {
|
|
29
36
|
const files = event.target.files;
|
|
@@ -36,18 +43,26 @@ export class DdaAttachFile {
|
|
|
36
43
|
}
|
|
37
44
|
removeFile() {
|
|
38
45
|
this.file = null;
|
|
46
|
+
// The file input stays in the DOM (so a native form submit sends the
|
|
47
|
+
// file), so clear it too, or the removed file would still be submitted.
|
|
48
|
+
if (this.fileInput) {
|
|
49
|
+
this.fileInput.value = '';
|
|
50
|
+
}
|
|
39
51
|
}
|
|
40
52
|
getFileIcon(fileName) {
|
|
41
53
|
const extension = fileName.split('.').pop().toLowerCase();
|
|
42
54
|
return this.fileIcons[extension] || 'path/to/default-icon.png';
|
|
43
55
|
}
|
|
44
|
-
// F-016: ids derived from the
|
|
45
|
-
// dda-input
|
|
56
|
+
// F-016: ids derived from the file input id (the consumer-supplied
|
|
57
|
+
// input_id, or the generated fallback), same pattern as dda-input.
|
|
58
|
+
get inputId() {
|
|
59
|
+
return this.input_id || this.fallbackId;
|
|
60
|
+
}
|
|
46
61
|
get helperId() {
|
|
47
|
-
return
|
|
62
|
+
return `${this.inputId}-helper`;
|
|
48
63
|
}
|
|
49
64
|
get errorId() {
|
|
50
|
-
return
|
|
65
|
+
return `${this.inputId}-error`;
|
|
51
66
|
}
|
|
52
67
|
get describedBy() {
|
|
53
68
|
const ids = [
|
|
@@ -65,7 +80,8 @@ export class DdaAttachFile {
|
|
|
65
80
|
this.custom_class,
|
|
66
81
|
this.component_mode,
|
|
67
82
|
].filter(Boolean).join(' ');
|
|
68
|
-
|
|
83
|
+
const id = this.inputId;
|
|
84
|
+
return (h(Host, { key: '6c02affad592523dbfd0718c7e3a1c3cdaabaa5d' }, h("div", { key: 'adbb23b5820fc0691005ab2b0b24437ae9d8de5e', class: inputClass }, this.label && h("label", { key: '0752ba9cc62ab42342275a3404f24015eaee2970', htmlFor: id, class: "dda-input-label" }, this.label), h("div", { key: '0fdf02bdb47946440d0d942a191228dfc16b0faa', class: "dda-input-field-group dda-attach-file" }, h("input", { key: 'd8a998efbc6c89a5f71a1f5f453f530772c89f54', ref: (el) => (this.fileInput = el), id: id, name: this.input_name, "aria-label": this.aria_label || (this.label ? undefined : 'Choose file'), type: "file", onInput: (event) => { this.handleFileInput(event); }, "aria-describedby": this.describedBy, "aria-invalid": this.error_message ? 'true' : undefined }), this.file ? (h("div", { class: "dda-file-details" }, h("div", { class: "dda-items" }, h("img", { src: this.getFileIcon(this.file.name), alt: "File Icon", class: "dda-file-icon" }), h("span", { class: "dda-file-name" }, this.file.name)), h("button", { type: "button", id: this.button_id, name: this.button_name, "aria-label": this.button_aria_label || `Remove ${this.file.name}`, class: "remove-file", onClick: () => this.removeFile() }, h("i", { class: "material-icons material-symbols-outlined", "aria-hidden": "true" }, "close")))) : (h("div", { class: "dda-file-input" }, h("span", null, "No File Selected"), h("label", { htmlFor: id, class: "dda-file-choose" }, "Choose File")))), this.helper_text && h("span", { key: '8ae9ce5a344e6bae48398514f5e4709064c2ff07', id: this.helperId, class: "dda-helper-text" }, this.helper_text), this.error_message && h("span", { key: 'f16a52e31eddf59fbb6e05f3285bf5abb0f91aa3', id: this.errorId, class: "dda-error-message" }, this.error_message))));
|
|
69
85
|
}
|
|
70
86
|
static get is() { return "dda-attach-file"; }
|
|
71
87
|
static get originalStyleUrls() {
|
|
@@ -92,7 +108,7 @@ export class DdaAttachFile {
|
|
|
92
108
|
"optional": false,
|
|
93
109
|
"docs": {
|
|
94
110
|
"tags": [],
|
|
95
|
-
"text": ""
|
|
111
|
+
"text": "Label text shown above the field. Linked to the file input through `input_id` (or a generated id)."
|
|
96
112
|
},
|
|
97
113
|
"getter": false,
|
|
98
114
|
"setter": false,
|
|
@@ -111,7 +127,7 @@ export class DdaAttachFile {
|
|
|
111
127
|
"optional": false,
|
|
112
128
|
"docs": {
|
|
113
129
|
"tags": [],
|
|
114
|
-
"text": ""
|
|
130
|
+
"text": "Helper text shown below the field. Linked by `aria-describedby`."
|
|
115
131
|
},
|
|
116
132
|
"getter": false,
|
|
117
133
|
"setter": false,
|
|
@@ -130,7 +146,7 @@ export class DdaAttachFile {
|
|
|
130
146
|
"optional": false,
|
|
131
147
|
"docs": {
|
|
132
148
|
"tags": [],
|
|
133
|
-
"text": ""
|
|
149
|
+
"text": "Error text shown below the field. Also sets `aria-invalid=\"true\"` on the file input."
|
|
134
150
|
},
|
|
135
151
|
"getter": false,
|
|
136
152
|
"setter": false,
|
|
@@ -149,7 +165,7 @@ export class DdaAttachFile {
|
|
|
149
165
|
"optional": true,
|
|
150
166
|
"docs": {
|
|
151
167
|
"tags": [],
|
|
152
|
-
"text": ""
|
|
168
|
+
"text": "Size: `default` or `small`."
|
|
153
169
|
},
|
|
154
170
|
"getter": false,
|
|
155
171
|
"setter": false,
|
|
@@ -168,7 +184,7 @@ export class DdaAttachFile {
|
|
|
168
184
|
"optional": true,
|
|
169
185
|
"docs": {
|
|
170
186
|
"tags": [],
|
|
171
|
-
"text": ""
|
|
187
|
+
"text": "Validation state: `error` applies the error colors."
|
|
172
188
|
},
|
|
173
189
|
"getter": false,
|
|
174
190
|
"setter": false,
|
|
@@ -187,7 +203,7 @@ export class DdaAttachFile {
|
|
|
187
203
|
"optional": true,
|
|
188
204
|
"docs": {
|
|
189
205
|
"tags": [],
|
|
190
|
-
"text": ""
|
|
206
|
+
"text": "Adds the class `dda-input-<value>`. `disabled` gives the disabled look only; it does not disable the file input."
|
|
191
207
|
},
|
|
192
208
|
"getter": false,
|
|
193
209
|
"setter": false,
|
|
@@ -206,7 +222,7 @@ export class DdaAttachFile {
|
|
|
206
222
|
"optional": true,
|
|
207
223
|
"docs": {
|
|
208
224
|
"tags": [],
|
|
209
|
-
"text": ""
|
|
225
|
+
"text": "Extra CSS classes added to the field container."
|
|
210
226
|
},
|
|
211
227
|
"getter": false,
|
|
212
228
|
"setter": false,
|
|
@@ -226,7 +242,7 @@ export class DdaAttachFile {
|
|
|
226
242
|
"optional": true,
|
|
227
243
|
"docs": {
|
|
228
244
|
"tags": [],
|
|
229
|
-
"text": ""
|
|
245
|
+
"text": "Theme override class for the field, e.g. `light-mode`."
|
|
230
246
|
},
|
|
231
247
|
"getter": false,
|
|
232
248
|
"setter": false,
|
|
@@ -245,7 +261,7 @@ export class DdaAttachFile {
|
|
|
245
261
|
"optional": true,
|
|
246
262
|
"docs": {
|
|
247
263
|
"tags": [],
|
|
248
|
-
"text": ""
|
|
264
|
+
"text": "Accessible name of the file input. Not rendered when empty."
|
|
249
265
|
},
|
|
250
266
|
"getter": false,
|
|
251
267
|
"setter": false,
|
|
@@ -265,7 +281,7 @@ export class DdaAttachFile {
|
|
|
265
281
|
"optional": true,
|
|
266
282
|
"docs": {
|
|
267
283
|
"tags": [],
|
|
268
|
-
"text": ""
|
|
284
|
+
"text": "Accessible name of the remove button shown after a file is chosen, e.g. `Remove file`."
|
|
269
285
|
},
|
|
270
286
|
"getter": false,
|
|
271
287
|
"setter": false,
|
|
@@ -285,7 +301,7 @@ export class DdaAttachFile {
|
|
|
285
301
|
"optional": false,
|
|
286
302
|
"docs": {
|
|
287
303
|
"tags": [],
|
|
288
|
-
"text": ""
|
|
304
|
+
"text": "`id` of the file input. Also used to link the label, helper text and error message. Optional: an id is generated when it is not set."
|
|
289
305
|
},
|
|
290
306
|
"getter": false,
|
|
291
307
|
"setter": false,
|
|
@@ -304,7 +320,7 @@ export class DdaAttachFile {
|
|
|
304
320
|
"optional": false,
|
|
305
321
|
"docs": {
|
|
306
322
|
"tags": [],
|
|
307
|
-
"text": ""
|
|
323
|
+
"text": "`id` of the remove button shown after a file is chosen."
|
|
308
324
|
},
|
|
309
325
|
"getter": false,
|
|
310
326
|
"setter": false,
|
|
@@ -323,7 +339,7 @@ export class DdaAttachFile {
|
|
|
323
339
|
"optional": true,
|
|
324
340
|
"docs": {
|
|
325
341
|
"tags": [],
|
|
326
|
-
"text": ""
|
|
342
|
+
"text": "`name` of the remove button shown after a file is chosen."
|
|
327
343
|
},
|
|
328
344
|
"getter": false,
|
|
329
345
|
"setter": false,
|
|
@@ -342,7 +358,7 @@ export class DdaAttachFile {
|
|
|
342
358
|
"optional": true,
|
|
343
359
|
"docs": {
|
|
344
360
|
"tags": [],
|
|
345
|
-
"text": ""
|
|
361
|
+
"text": "`name` of the file input."
|
|
346
362
|
},
|
|
347
363
|
"getter": false,
|
|
348
364
|
"setter": false,
|
|
@@ -23,7 +23,6 @@ export default {
|
|
|
23
23
|
button_aria_label="button"
|
|
24
24
|
button_name="button"
|
|
25
25
|
input_name="input"
|
|
26
|
-
onchange="console.log('changed')"
|
|
27
26
|
></dda-attach-file>
|
|
28
27
|
\`\`\`
|
|
29
28
|
`,
|
|
@@ -83,10 +82,6 @@ export default {
|
|
|
83
82
|
control: 'text',
|
|
84
83
|
description: 'Aria label for the upload button',
|
|
85
84
|
},
|
|
86
|
-
onchange: {
|
|
87
|
-
control: 'text',
|
|
88
|
-
description: 'onchange event for the attach file component',
|
|
89
|
-
},
|
|
90
85
|
button_name: {
|
|
91
86
|
control: 'text',
|
|
92
87
|
description: 'Name for the upload button',
|
|
@@ -118,7 +113,6 @@ Default.args = {
|
|
|
118
113
|
button_id: 'button',
|
|
119
114
|
aria_label: 'input',
|
|
120
115
|
button_aria_label: 'button',
|
|
121
|
-
onchange: '',
|
|
122
116
|
button_name: 'button',
|
|
123
117
|
input_name: 'input'
|
|
124
118
|
};
|
|
@@ -136,7 +130,6 @@ Small.args = {
|
|
|
136
130
|
button_id: 'button',
|
|
137
131
|
aria_label: 'input',
|
|
138
132
|
button_aria_label: 'button',
|
|
139
|
-
onchange: '',
|
|
140
133
|
button_name: 'button',
|
|
141
134
|
input_name: 'input'
|
|
142
135
|
};
|
|
@@ -154,7 +147,6 @@ ErrorState.args = {
|
|
|
154
147
|
button_id: 'button',
|
|
155
148
|
aria_label: 'input',
|
|
156
149
|
button_aria_label: 'button',
|
|
157
|
-
onchange: '',
|
|
158
150
|
button_name: 'button',
|
|
159
151
|
input_name: 'input'
|
|
160
152
|
};
|
|
@@ -172,7 +164,6 @@ Disabled.args = {
|
|
|
172
164
|
button_id: 'button',
|
|
173
165
|
aria_label: 'input',
|
|
174
166
|
button_aria_label: 'button',
|
|
175
|
-
onchange: '',
|
|
176
167
|
button_name: 'button',
|
|
177
168
|
input_name: 'input'
|
|
178
169
|
};
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export class DdaAvatar {
|
|
3
3
|
constructor() {
|
|
4
|
+
/** Content: `photo` shows the `src` image, `icon` shows a smiley icon, `text` shows `text` as initials. */
|
|
4
5
|
this.type = 'photo';
|
|
6
|
+
/** Size: `xs` (24px), `sm` (32px), `md` (40px), `lg` (48px), `xl` (56px) or `xxl` (64px). */
|
|
5
7
|
this.size = 'md';
|
|
8
|
+
/** Badge: `default` (none), `status` (green dot), `verified` (check badge), `notification` (count from `notification_number`). `story` has no style yet. */
|
|
6
9
|
this.design = 'default';
|
|
10
|
+
/** Shape: `circle` or `square` (rounded corners). */
|
|
7
11
|
this.rounded = 'circle';
|
|
8
|
-
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
+
/** Image URL shown when `type` is `photo`. */
|
|
13
|
+
this.src = '';
|
|
14
|
+
/** CSS class of the icon font used when `type` is `icon`, e.g. `material-icons`. The icon glyph is always `sentiment_satisfied`. */
|
|
15
|
+
this.icon = 'material-icons';
|
|
16
|
+
/** Initials shown when `type` is `text`. */
|
|
17
|
+
this.text = 'AB';
|
|
18
|
+
/** Count shown in the badge when `design` is `notification`. Hidden at sizes `xs` and `sm`. */
|
|
19
|
+
this.notification_number = 0;
|
|
20
|
+
/** Extra CSS classes added to the avatar container. */
|
|
12
21
|
this.custom_class = '';
|
|
13
22
|
this.isOpen = false;
|
|
14
23
|
}
|
|
@@ -18,6 +27,7 @@ export class DdaAvatar {
|
|
|
18
27
|
selectOption(option) {
|
|
19
28
|
this.selected = option;
|
|
20
29
|
this.isOpen = false;
|
|
30
|
+
this.optionSelect.emit({ value: option });
|
|
21
31
|
}
|
|
22
32
|
get parsedOptions() {
|
|
23
33
|
try {
|
|
@@ -30,11 +40,11 @@ export class DdaAvatar {
|
|
|
30
40
|
render() {
|
|
31
41
|
const hasOptions = this.parsedOptions.length > 0;
|
|
32
42
|
const avatarContent = [
|
|
33
|
-
this.type === 'photo' && h("img", { key: '
|
|
34
|
-
this.type === 'icon' && h("i", { key: '
|
|
35
|
-
this.type === 'text' && h("span", { key: '
|
|
43
|
+
this.type === 'photo' && h("img", { key: '4823e200a9e782d34c89a440e4bcf8c721d2dbac', src: this.src, alt: "Avatar" }),
|
|
44
|
+
this.type === 'icon' && h("i", { key: 'df5437bbfaf72949ef5a0fb73668cbce45f97b92', class: `${this.icon} dda-smile` }, "sentiment_satisfied"),
|
|
45
|
+
this.type === 'text' && h("span", { key: '765b4a8c095760ab4f93561869a04af5b0a8629e', class: 'avatar-main-text' }, this.text),
|
|
36
46
|
];
|
|
37
|
-
return (h("div", { key: '
|
|
47
|
+
return (h("div", { key: '6682fd805892257e209e89b5514d1ec946ca6c93', class: {
|
|
38
48
|
'dda-avatar': true,
|
|
39
49
|
[`avatar-type-${this.type}`]: true,
|
|
40
50
|
[`avatar-size-${this.size}`]: true,
|
|
@@ -43,7 +53,7 @@ export class DdaAvatar {
|
|
|
43
53
|
[`${this.custom_class}`]: true,
|
|
44
54
|
[`${this.component_mode}`]: true,
|
|
45
55
|
[`${this.button_name}`]: true,
|
|
46
|
-
} }, hasOptions ? (h("button", { type: "button", class: "avatar-trigger", onClick: () => this.toggleDropdown(), "aria-expanded": this.isOpen ? 'true' : 'false', "aria-label": this.aria_label || 'Avatar options' }, avatarContent)) : (h("div", { class: "avatar-trigger" }, avatarContent)), hasOptions && this.isOpen && (h("div", { key: '
|
|
56
|
+
} }, hasOptions ? (h("button", { type: "button", class: "avatar-trigger", onClick: () => this.toggleDropdown(), "aria-expanded": this.isOpen ? 'true' : 'false', "aria-label": this.aria_label || 'Avatar options' }, avatarContent)) : (h("div", { class: "avatar-trigger" }, avatarContent)), hasOptions && this.isOpen && (h("div", { key: '162d00860b22f1ffd6dce0d7aad1e834e4f3375f', class: "dda-input-dropdown-list" }, this.parsedOptions.map(option => (h("button", { id: this.button_id, name: this.button_name, "aria-label": this.aria_label, type: "button", class: `dda-input-dropdown-item ${this.selected === option ? 'selected' : ''}`, onClick: () => { this.selectOption(option); } }, option))))), this.design === 'status' && h("div", { key: '7619e3c34b74c0c6454b0967eec02302fc23c020', class: "status-circle" }), this.design === 'verified' && h("div", { key: 'd728730b0b15f67836fc2e76b1e660f11954afdd', class: "verified-icon" }, h("span", { key: '38ae3cafca90b8764cf86dea697eb2d5b498173a', class: "material-icons material-symbols-outlined" }, "verified")), this.design === 'notification' && h("div", { key: 'b023a7473841c84d8b14321d7d1113063b114b70', class: "notification-circle" }, this.notification_number)));
|
|
47
57
|
}
|
|
48
58
|
static get is() { return "dda-avatar"; }
|
|
49
59
|
static get originalStyleUrls() {
|
|
@@ -70,7 +80,7 @@ export class DdaAvatar {
|
|
|
70
80
|
"optional": false,
|
|
71
81
|
"docs": {
|
|
72
82
|
"tags": [],
|
|
73
|
-
"text": ""
|
|
83
|
+
"text": "Content: `photo` shows the `src` image, `icon` shows a smiley icon, `text` shows `text` as initials."
|
|
74
84
|
},
|
|
75
85
|
"getter": false,
|
|
76
86
|
"setter": false,
|
|
@@ -90,7 +100,7 @@ export class DdaAvatar {
|
|
|
90
100
|
"optional": false,
|
|
91
101
|
"docs": {
|
|
92
102
|
"tags": [],
|
|
93
|
-
"text": ""
|
|
103
|
+
"text": "Size: `xs` (24px), `sm` (32px), `md` (40px), `lg` (48px), `xl` (56px) or `xxl` (64px)."
|
|
94
104
|
},
|
|
95
105
|
"getter": false,
|
|
96
106
|
"setter": false,
|
|
@@ -110,7 +120,7 @@ export class DdaAvatar {
|
|
|
110
120
|
"optional": false,
|
|
111
121
|
"docs": {
|
|
112
122
|
"tags": [],
|
|
113
|
-
"text": ""
|
|
123
|
+
"text": "Badge: `default` (none), `status` (green dot), `verified` (check badge), `notification` (count from `notification_number`). `story` has no style yet."
|
|
114
124
|
},
|
|
115
125
|
"getter": false,
|
|
116
126
|
"setter": false,
|
|
@@ -130,7 +140,7 @@ export class DdaAvatar {
|
|
|
130
140
|
"optional": false,
|
|
131
141
|
"docs": {
|
|
132
142
|
"tags": [],
|
|
133
|
-
"text": ""
|
|
143
|
+
"text": "Shape: `circle` or `square` (rounded corners)."
|
|
134
144
|
},
|
|
135
145
|
"getter": false,
|
|
136
146
|
"setter": false,
|
|
@@ -150,7 +160,7 @@ export class DdaAvatar {
|
|
|
150
160
|
"optional": false,
|
|
151
161
|
"docs": {
|
|
152
162
|
"tags": [],
|
|
153
|
-
"text": ""
|
|
163
|
+
"text": "Image URL shown when `type` is `photo`."
|
|
154
164
|
},
|
|
155
165
|
"getter": false,
|
|
156
166
|
"setter": false,
|
|
@@ -170,7 +180,7 @@ export class DdaAvatar {
|
|
|
170
180
|
"optional": false,
|
|
171
181
|
"docs": {
|
|
172
182
|
"tags": [],
|
|
173
|
-
"text": ""
|
|
183
|
+
"text": "CSS class of the icon font used when `type` is `icon`, e.g. `material-icons`. The icon glyph is always `sentiment_satisfied`."
|
|
174
184
|
},
|
|
175
185
|
"getter": false,
|
|
176
186
|
"setter": false,
|
|
@@ -190,7 +200,7 @@ export class DdaAvatar {
|
|
|
190
200
|
"optional": false,
|
|
191
201
|
"docs": {
|
|
192
202
|
"tags": [],
|
|
193
|
-
"text": ""
|
|
203
|
+
"text": "Initials shown when `type` is `text`."
|
|
194
204
|
},
|
|
195
205
|
"getter": false,
|
|
196
206
|
"setter": false,
|
|
@@ -210,7 +220,7 @@ export class DdaAvatar {
|
|
|
210
220
|
"optional": false,
|
|
211
221
|
"docs": {
|
|
212
222
|
"tags": [],
|
|
213
|
-
"text": ""
|
|
223
|
+
"text": "Count shown in the badge when `design` is `notification`. Hidden at sizes `xs` and `sm`."
|
|
214
224
|
},
|
|
215
225
|
"getter": false,
|
|
216
226
|
"setter": false,
|
|
@@ -230,7 +240,7 @@ export class DdaAvatar {
|
|
|
230
240
|
"optional": true,
|
|
231
241
|
"docs": {
|
|
232
242
|
"tags": [],
|
|
233
|
-
"text": ""
|
|
243
|
+
"text": "Extra CSS classes added to the avatar container."
|
|
234
244
|
},
|
|
235
245
|
"getter": false,
|
|
236
246
|
"setter": false,
|
|
@@ -240,7 +250,7 @@ export class DdaAvatar {
|
|
|
240
250
|
},
|
|
241
251
|
"selected": {
|
|
242
252
|
"type": "string",
|
|
243
|
-
"mutable":
|
|
253
|
+
"mutable": true,
|
|
244
254
|
"complexType": {
|
|
245
255
|
"original": "string",
|
|
246
256
|
"resolved": "string",
|
|
@@ -250,7 +260,7 @@ export class DdaAvatar {
|
|
|
250
260
|
"optional": false,
|
|
251
261
|
"docs": {
|
|
252
262
|
"tags": [],
|
|
253
|
-
"text": ""
|
|
263
|
+
"text": "The selected option. Matches one entry of `options`; updated when the user picks an option. Mutable: the component assigns it."
|
|
254
264
|
},
|
|
255
265
|
"getter": false,
|
|
256
266
|
"setter": false,
|
|
@@ -269,7 +279,7 @@ export class DdaAvatar {
|
|
|
269
279
|
"optional": false,
|
|
270
280
|
"docs": {
|
|
271
281
|
"tags": [],
|
|
272
|
-
"text": ""
|
|
282
|
+
"text": "Dropdown options as a JSON array of strings, e.g. `[\"Profile\",\"Sign out\"]`. When set, the avatar becomes a button that opens the list."
|
|
273
283
|
},
|
|
274
284
|
"getter": false,
|
|
275
285
|
"setter": false,
|
|
@@ -288,7 +298,7 @@ export class DdaAvatar {
|
|
|
288
298
|
"optional": true,
|
|
289
299
|
"docs": {
|
|
290
300
|
"tags": [],
|
|
291
|
-
"text": ""
|
|
301
|
+
"text": "Theme override class for the avatar, e.g. `light-mode`."
|
|
292
302
|
},
|
|
293
303
|
"getter": false,
|
|
294
304
|
"setter": false,
|
|
@@ -307,7 +317,7 @@ export class DdaAvatar {
|
|
|
307
317
|
"optional": false,
|
|
308
318
|
"docs": {
|
|
309
319
|
"tags": [],
|
|
310
|
-
"text": ""
|
|
320
|
+
"text": "Accessible name of the avatar button and of each option button. The avatar button falls back to `Avatar options`."
|
|
311
321
|
},
|
|
312
322
|
"getter": false,
|
|
313
323
|
"setter": false,
|
|
@@ -326,7 +336,7 @@ export class DdaAvatar {
|
|
|
326
336
|
"optional": true,
|
|
327
337
|
"docs": {
|
|
328
338
|
"tags": [],
|
|
329
|
-
"text": ""
|
|
339
|
+
"text": "`id` applied to each option button in the dropdown."
|
|
330
340
|
},
|
|
331
341
|
"getter": false,
|
|
332
342
|
"setter": false,
|
|
@@ -345,7 +355,7 @@ export class DdaAvatar {
|
|
|
345
355
|
"optional": true,
|
|
346
356
|
"docs": {
|
|
347
357
|
"tags": [],
|
|
348
|
-
"text": ""
|
|
358
|
+
"text": "`name` of each option button in the dropdown. Also added as a CSS class on the avatar container."
|
|
349
359
|
},
|
|
350
360
|
"getter": false,
|
|
351
361
|
"setter": false,
|
|
@@ -359,4 +369,22 @@ export class DdaAvatar {
|
|
|
359
369
|
"isOpen": {}
|
|
360
370
|
};
|
|
361
371
|
}
|
|
372
|
+
static get events() {
|
|
373
|
+
return [{
|
|
374
|
+
"method": "optionSelect",
|
|
375
|
+
"name": "optionSelect",
|
|
376
|
+
"bubbles": true,
|
|
377
|
+
"cancelable": true,
|
|
378
|
+
"composed": true,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": "Emitted every time the user picks an option from the dropdown, also when it is already selected. `detail.value` is the option."
|
|
382
|
+
},
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "{ value: string }",
|
|
385
|
+
"resolved": "{ value: string; }",
|
|
386
|
+
"references": {}
|
|
387
|
+
}
|
|
388
|
+
}];
|
|
389
|
+
}
|
|
362
390
|
}
|
|
@@ -69,7 +69,7 @@ To use the \`dda-avatar\` component, pass the following props:
|
|
|
69
69
|
icon="sentiment_satisfied"
|
|
70
70
|
text="AB"
|
|
71
71
|
options='["Option 1","Option 2","Option 3"]'
|
|
72
|
-
|
|
72
|
+
notification_number="20"
|
|
73
73
|
custom_class=""
|
|
74
74
|
component_mode=""
|
|
75
75
|
aria_label="avatar"
|
|
@@ -1,3 +1,38 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
}
|
|
4
|
+
|
|
5
|
+
.dda-banner-slider {
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 16px;
|
|
8
|
+
overflow-x: auto;
|
|
9
|
+
scroll-snap-type: x mandatory;
|
|
10
|
+
scroll-behavior: smooth;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* The slider is the keyboard focus stop. The ring is outside the box, so the slider's own
|
|
14
|
+
overflow does not clip it; white inner and dark outer rings read on any background. */
|
|
15
|
+
.dda-banner-slider:focus-visible {
|
|
16
|
+
outline: none;
|
|
17
|
+
box-shadow:
|
|
18
|
+
0 0 0 2px #ffffff,
|
|
19
|
+
0 0 0 4px rgba(0, 0, 0, 0.65);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dda-banner-slide {
|
|
23
|
+
flex: 0 0 auto;
|
|
24
|
+
scroll-snap-align: start;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dda-banner-slide img {
|
|
28
|
+
display: block;
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
object-fit: cover;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (prefers-reduced-motion: reduce) {
|
|
35
|
+
.dda-banner-slider {
|
|
36
|
+
scroll-behavior: auto;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
export class DdaBanner {
|
|
3
3
|
constructor() {
|
|
4
|
+
/** Accessible name of the scrollable slide region that keyboard users focus to scroll. */
|
|
5
|
+
this.aria_label = 'Slides';
|
|
4
6
|
this.parsedSlides = [];
|
|
5
7
|
}
|
|
6
8
|
componentWillLoad() {
|
|
7
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
try {
|
|
11
|
+
const slides = JSON.parse((_a = this.slides) !== null && _a !== void 0 ? _a : '[]');
|
|
12
|
+
this.parsedSlides = Array.isArray(slides) ? slides : [];
|
|
13
|
+
}
|
|
14
|
+
catch (_b) {
|
|
15
|
+
this.parsedSlides = [];
|
|
16
|
+
}
|
|
8
17
|
}
|
|
9
18
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
19
|
+
return (h(Host, { key: '65403933ce5ab094906d55c7fabaa7c56c409817' }, h("div", { key: 'd4944ddf46c232aab0d02df97f120ffc76589e24', class: 'dda-banner-slider', tabIndex: 0, role: "region", "aria-label": this.aria_label }, this.parsedSlides.map((slide) => (h("div", { class: 'dda-banner-slide' }, h("img", { src: slide.image, alt: slide.title, style: { width: this.slider_width, height: this.slider_height } })))))));
|
|
11
20
|
}
|
|
12
21
|
static get is() { return "dda-banner"; }
|
|
13
22
|
static get encapsulation() { return "shadow"; }
|
|
@@ -35,7 +44,7 @@ export class DdaBanner {
|
|
|
35
44
|
"optional": false,
|
|
36
45
|
"docs": {
|
|
37
46
|
"tags": [],
|
|
38
|
-
"text": ""
|
|
47
|
+
"text": "Slide images. JSON array of `{ image, title }`; `image` is the image URL and `title` its alternative text. Read once, when the component loads."
|
|
39
48
|
},
|
|
40
49
|
"getter": false,
|
|
41
50
|
"setter": false,
|
|
@@ -54,7 +63,7 @@ export class DdaBanner {
|
|
|
54
63
|
"optional": false,
|
|
55
64
|
"docs": {
|
|
56
65
|
"tags": [],
|
|
57
|
-
"text": ""
|
|
66
|
+
"text": "CSS width of each slide image, e.g. `360px`."
|
|
58
67
|
},
|
|
59
68
|
"getter": false,
|
|
60
69
|
"setter": false,
|
|
@@ -73,12 +82,32 @@ export class DdaBanner {
|
|
|
73
82
|
"optional": false,
|
|
74
83
|
"docs": {
|
|
75
84
|
"tags": [],
|
|
76
|
-
"text": ""
|
|
85
|
+
"text": "CSS height of each slide image, e.g. `220px`."
|
|
77
86
|
},
|
|
78
87
|
"getter": false,
|
|
79
88
|
"setter": false,
|
|
80
89
|
"reflect": false,
|
|
81
90
|
"attribute": "slider_height"
|
|
91
|
+
},
|
|
92
|
+
"aria_label": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "string",
|
|
97
|
+
"resolved": "string",
|
|
98
|
+
"references": {}
|
|
99
|
+
},
|
|
100
|
+
"required": false,
|
|
101
|
+
"optional": false,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": "Accessible name of the scrollable slide region that keyboard users focus to scroll."
|
|
105
|
+
},
|
|
106
|
+
"getter": false,
|
|
107
|
+
"setter": false,
|
|
108
|
+
"reflect": false,
|
|
109
|
+
"attribute": "aria_label",
|
|
110
|
+
"defaultValue": "'Slides'"
|
|
82
111
|
}
|
|
83
112
|
};
|
|
84
113
|
}
|