@gov-design-system-ce/components 4.1.0 → 4.1.2
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/core.cjs.js +1 -1
- package/dist/cjs/gov-attachments_3.cjs.entry.js +2 -2
- package/dist/cjs/gov-attachments_3.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-card.cjs.entry.js +9 -6
- package/dist/cjs/gov-card.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-chip.cjs.entry.js +2 -2
- package/dist/cjs/gov-container.cjs.entry.js +1 -1
- package/dist/cjs/gov-control-group.cjs.entry.js +1 -1
- package/dist/cjs/gov-cookiebar.cjs.entry.js +1 -1
- package/dist/cjs/gov-dialog.cjs.entry.js +1 -1
- package/dist/cjs/gov-empty.cjs.entry.js +1 -1
- package/dist/cjs/gov-error-code.cjs.entry.js +1 -1
- package/dist/cjs/{gov-flex_4.cjs.entry.js → gov-flex_3.cjs.entry.js} +57 -57
- package/dist/cjs/gov-flex_3.cjs.entry.js.map +1 -0
- package/dist/cjs/gov-form-autocomplete.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-checkbox-group.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-file.cjs.entry.js +2 -3
- package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-group.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-input_2.cjs.entry.js +6 -6
- package/dist/cjs/gov-form-label.cjs.entry.js +27 -0
- package/dist/cjs/gov-form-label.cjs.entry.js.map +1 -0
- package/dist/cjs/gov-form-multi-select.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-password-power.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-search.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-select.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/gov-grid.cjs.entry.js +1 -1
- package/dist/cjs/gov-infobar.cjs.entry.js +2 -2
- package/dist/cjs/gov-layout-column.cjs.entry.js +1 -1
- package/dist/cjs/gov-layout.cjs.entry.js +1 -1
- package/dist/cjs/gov-lifecycle.cjs.entry.js +1 -1
- package/dist/cjs/gov-link.cjs.entry.js +1 -1
- package/dist/cjs/gov-loading.cjs.entry.js +1 -1
- package/dist/cjs/gov-message.cjs.entry.js +1 -1
- package/dist/cjs/gov-spacer.cjs.entry.js +1 -1
- package/dist/cjs/gov-stepper-item.cjs.entry.js +1 -1
- package/dist/cjs/gov-stepper.cjs.entry.js +1 -1
- package/dist/cjs/gov-tabs-item.cjs.entry.js +1 -1
- package/dist/cjs/gov-tabs.cjs.entry.js +1 -1
- package/dist/cjs/gov-tag.cjs.entry.js +2 -1
- package/dist/cjs/gov-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tile.cjs.entry.js +1 -1
- package/dist/cjs/gov-tiles.cjs.entry.js +1 -1
- package/dist/cjs/gov-toast.cjs.entry.js +1 -1
- package/dist/cjs/gov-tooltip-content.cjs.entry.js +1 -1
- package/dist/cjs/gov-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/gov-wizard-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-wizard.cjs.entry.js +1 -1
- package/dist/cjs/index-7ff4447c.js +6 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gov-attachments/gov-attachments-item.css +2 -7
- package/dist/collection/components/gov-card/constants.js +7 -4
- package/dist/collection/components/gov-card/constants.js.map +1 -1
- package/dist/collection/components/gov-card/gov-card.js +16 -10
- package/dist/collection/components/gov-card/gov-card.js.map +1 -1
- package/dist/collection/components/gov-chip/gov-chip.js +2 -2
- package/dist/collection/components/gov-container/gov-container.js +1 -1
- package/dist/collection/components/gov-control-group/gov-control-group.js +1 -1
- package/dist/collection/components/gov-cookiebar/gov-cookiebar.js +1 -1
- package/dist/collection/components/gov-dialog/gov-dialog.js +1 -1
- package/dist/collection/components/gov-empty/gov-empty.js +1 -1
- package/dist/collection/components/gov-error-code/gov-error-code.js +1 -1
- package/dist/collection/components/gov-flex/constants.js +2 -0
- package/dist/collection/components/gov-flex/constants.js.map +1 -1
- package/dist/collection/components/gov-flex/gov-flex.js +33 -9
- package/dist/collection/components/gov-flex/gov-flex.js.map +1 -1
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +2 -2
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +2 -2
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
- package/dist/collection/components/gov-form/control/gov-form-control.js +1 -1
- package/dist/collection/components/gov-form/file/gov-form-file.js +3 -4
- package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
- package/dist/collection/components/gov-form/group/gov-form-checkbox-group.js +1 -1
- package/dist/collection/components/gov-form/group/gov-form-group.css +3 -8
- package/dist/collection/components/gov-form/group/gov-form-group.js +1 -1
- package/dist/collection/components/gov-form/group/gov-form-radio-group.js +1 -1
- package/dist/collection/components/gov-form/input/gov-form-input.js +5 -5
- package/dist/collection/components/gov-form/label/gov-form-label.js +1 -1
- package/dist/collection/components/gov-form/message/gov-form-message.js +1 -1
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +3 -3
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
- package/dist/collection/components/gov-form/password-power/gov-form-password-power.js +1 -1
- package/dist/collection/components/gov-form/radio/gov-form-radio.js +1 -1
- package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
- package/dist/collection/components/gov-form/search/gov-form-search.js +1 -1
- package/dist/collection/components/gov-form/select/gov-form-select.js +4 -4
- package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
- package/dist/collection/components/gov-form/switch/gov-form-switch.js +2 -2
- package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
- package/dist/collection/components/gov-grid/gov-grid-item.js +1 -1
- package/dist/collection/components/gov-grid/gov-grid.js +1 -1
- package/dist/collection/components/gov-icon/gov-icon.js +3 -4
- package/dist/collection/components/gov-icon/gov-icon.js.map +1 -1
- package/dist/collection/components/gov-icon/list.js +6 -0
- package/dist/collection/components/gov-icon/list.js.map +1 -1
- package/dist/collection/components/gov-infobar/gov-infobar.js +2 -2
- package/dist/collection/components/gov-layout/gov-layout-column.js +1 -1
- package/dist/collection/components/gov-layout/gov-layout.js +1 -1
- package/dist/collection/components/gov-lifecycle-tester/gov-lifecycle-tester.js +1 -1
- package/dist/collection/components/gov-link/gov-link.js +1 -1
- package/dist/collection/components/gov-loading/loading/gov-loading.js +1 -1
- package/dist/collection/components/gov-loading/skeleton/gov-skeleton.js +1 -1
- package/dist/collection/components/gov-message/gov-message.js +1 -1
- package/dist/collection/components/gov-spacer/gov-spacer.js +1 -1
- package/dist/collection/components/gov-stepper/gov-stepper-item.js +1 -1
- package/dist/collection/components/gov-stepper/gov-stepper.js +1 -1
- package/dist/collection/components/gov-tabs/gov-tabs-item.js +1 -1
- package/dist/collection/components/gov-tabs/gov-tabs.js +1 -1
- package/dist/collection/components/gov-tag/gov-tag.js +20 -1
- package/dist/collection/components/gov-tag/gov-tag.js.map +1 -1
- package/dist/collection/components/gov-theme-switch/constants.js +0 -2
- package/dist/collection/components/gov-theme-switch/constants.js.map +1 -1
- package/dist/collection/components/gov-theme-switch/gov-theme-switch.js +32 -9
- package/dist/collection/components/gov-theme-switch/gov-theme-switch.js.map +1 -1
- package/dist/collection/components/gov-tile/container/gov-tiles.js +1 -1
- package/dist/collection/components/gov-tile/gov-tile.js +1 -1
- package/dist/collection/components/gov-toast/gov-toast.js +1 -1
- package/dist/collection/components/gov-tooltip/gov-tooltip-content.js +1 -1
- package/dist/collection/components/gov-tooltip/gov-tooltip.js +2 -2
- package/dist/collection/components/gov-wizard/gov-wizard-item.js +2 -2
- package/dist/collection/components/gov-wizard/gov-wizard.js +1 -1
- package/dist/collection/helpers/Dom/document.js +18 -0
- package/dist/collection/helpers/Dom/document.js.map +1 -1
- package/dist/collection/pages/Card.js +22 -37
- package/dist/collection/pages/Card.js.map +1 -1
- package/dist/collection/pages/Flex.js +62 -0
- package/dist/collection/pages/Flex.js.map +1 -0
- package/dist/collection/pages/Forms.js +5 -5
- package/dist/collection/pages/Forms.js.map +1 -1
- package/dist/collection/pages/Tag.js +30 -23
- package/dist/collection/pages/Tag.js.map +1 -1
- package/dist/components/gov-accordion-item.js +1 -1
- package/dist/components/gov-accordion.js +1 -1
- package/dist/components/gov-attachments-item.js +1 -1
- package/dist/components/gov-attachments.js +1 -1
- package/dist/components/gov-backdrop.js +1 -1
- package/dist/components/gov-breadcrumbs.js +1 -1
- package/dist/components/gov-button.js +1 -1
- package/dist/components/gov-card.js +1 -1
- package/dist/components/gov-card.js.map +1 -1
- package/dist/components/gov-chip.js +1 -1
- package/dist/components/gov-container.js +1 -1
- package/dist/components/gov-control-group.js +1 -1
- package/dist/components/gov-cookiebar.js +1 -1
- package/dist/components/gov-dialog.js +1 -1
- package/dist/components/gov-empty.js +1 -1
- package/dist/components/gov-error-code.js +1 -1
- package/dist/components/gov-flex.js +1 -1
- package/dist/components/gov-flex.js.map +1 -1
- package/dist/components/gov-form-autocomplete.js +1 -1
- package/dist/components/gov-form-checkbox-group.js +1 -1
- package/dist/components/gov-form-checkbox-group.js.map +1 -1
- package/dist/components/gov-form-checkbox.js +1 -1
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +1 -1
- package/dist/components/gov-form-file.js +1 -1
- package/dist/components/gov-form-file.js.map +1 -1
- package/dist/components/gov-form-group.js +1 -1
- package/dist/components/gov-form-input.js +1 -1
- package/dist/components/gov-form-label.js +1 -1
- package/dist/components/gov-form-label.js.map +1 -1
- package/dist/components/gov-form-message.js +1 -1
- package/dist/components/gov-form-multi-select.js +1 -1
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-password-power.js +1 -1
- package/dist/components/gov-form-radio-group.js +1 -1
- package/dist/components/gov-form-radio-group.js.map +1 -1
- package/dist/components/gov-form-radio.js +1 -1
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-search.js +1 -1
- package/dist/components/gov-form-select.js +1 -1
- package/dist/components/gov-form-switch.js +1 -1
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-grid-item.js +1 -1
- package/dist/components/gov-grid.js +1 -1
- package/dist/components/gov-icon.js +1 -1
- package/dist/components/gov-infobar.js +1 -1
- package/dist/components/gov-layout-column.js +1 -1
- package/dist/components/gov-layout.js +1 -1
- package/dist/components/gov-lifecycle.js +1 -1
- package/dist/components/gov-link.js +1 -1
- package/dist/components/gov-loading.js +1 -1
- package/dist/components/gov-loading.js.map +1 -1
- package/dist/components/gov-message.js +1 -1
- package/dist/components/gov-pagination.js +1 -1
- package/dist/components/gov-skeleton.js +1 -1
- package/dist/components/gov-spacer.js +1 -1
- package/dist/components/gov-stepper-item.js +1 -1
- package/dist/components/gov-stepper.js +1 -1
- package/dist/components/gov-tabs-item.js +1 -1
- package/dist/components/gov-tabs.js +1 -1
- package/dist/components/gov-tag.js +1 -1
- package/dist/components/gov-tag.js.map +1 -1
- package/dist/components/gov-theme-switch.js +1 -1
- package/dist/components/gov-theme-switch.js.map +1 -1
- package/dist/components/gov-tile.js +1 -1
- package/dist/components/gov-tiles.js +1 -1
- package/dist/components/gov-toast.js +1 -1
- package/dist/components/gov-tooltip-content.js +1 -1
- package/dist/components/gov-tooltip.js +1 -1
- package/dist/components/gov-tooltip.js.map +1 -1
- package/dist/components/gov-wizard-item.js +1 -1
- package/dist/components/gov-wizard.js +1 -1
- package/dist/components/p-0b3574c2.js +2 -0
- package/dist/components/p-18ab0d24.js +2 -0
- package/dist/components/p-18ab0d24.js.map +1 -0
- package/dist/components/p-28776006.js +2 -0
- package/dist/components/{p-859a4f0d.js.map → p-28776006.js.map} +1 -1
- package/dist/components/p-40c2fb42.js +2 -0
- package/dist/components/{p-dc952cc2.js.map → p-40c2fb42.js.map} +1 -1
- package/dist/components/{p-2b87c27b.js → p-48c4d5c8.js} +2 -2
- package/dist/components/p-48c4d5c8.js.map +1 -0
- package/dist/components/{p-4149f195.js → p-73938936.js} +2 -2
- package/dist/components/{p-5952a5d0.js → p-7be2301a.js} +2 -2
- package/dist/components/{p-227eb30d.js → p-80dad64b.js} +2 -2
- package/dist/components/{p-7d4f2214.js → p-b25af2cf.js} +2 -2
- package/dist/components/{p-dfb5794a.js → p-b97d8edd.js} +2 -2
- package/dist/components/p-c438a723.js +2 -0
- package/dist/components/{p-45097b4c.js → p-ce90ff14.js} +2 -2
- package/dist/components/p-ce90ff14.js.map +1 -0
- package/dist/components/{p-929ebfb5.js → p-d962bf44.js} +2 -2
- package/dist/{core/p-20c2203a.js → components/p-e8ec030e.js} +2 -2
- package/dist/core/core.css +438 -273
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-0b3574c2.js +2 -0
- package/dist/core/{p-74458da3.entry.js → p-0dac0792.entry.js} +2 -2
- package/dist/core/p-0dac0792.entry.js.map +1 -0
- package/dist/core/{p-951823cb.entry.js → p-12d1e5bc.entry.js} +2 -2
- package/dist/core/p-182d03c1.entry.js +2 -0
- package/dist/core/p-2496f2a5.entry.js +2 -0
- package/dist/core/{p-a218e2eb.entry.js.map → p-2496f2a5.entry.js.map} +1 -1
- package/dist/core/{p-c52afdfc.js → p-29ac15d2.js} +2 -2
- package/dist/core/p-29d16111.entry.js +2 -0
- package/dist/core/{p-019e967c.entry.js.map → p-29d16111.entry.js.map} +1 -1
- package/dist/core/p-2b51b8e8.entry.js +2 -0
- package/dist/core/p-2b51b8e8.entry.js.map +1 -0
- package/dist/core/p-2bde147f.entry.js +2 -0
- package/dist/core/{p-bdc51179.entry.js.map → p-2bde147f.entry.js.map} +1 -1
- package/dist/core/{p-cb557873.entry.js → p-2e21a994.entry.js} +2 -2
- package/dist/core/p-2e21a994.entry.js.map +1 -0
- package/dist/core/p-3df6c6cd.entry.js +2 -0
- package/dist/core/p-436e7690.entry.js +2 -0
- package/dist/core/p-467f778b.entry.js +2 -0
- package/dist/core/p-4d81039c.entry.js +2 -0
- package/dist/core/p-520ac994.entry.js +2 -0
- package/dist/core/{p-f1056a83.entry.js.map → p-520ac994.entry.js.map} +1 -1
- package/dist/core/p-53fa7648.entry.js +2 -0
- package/dist/core/{p-c20fe3da.entry.js.map → p-53fa7648.entry.js.map} +1 -1
- package/dist/core/{p-7d6073aa.entry.js → p-581c8075.entry.js} +2 -2
- package/dist/core/{p-e2517a72.entry.js → p-5a92b9d9.entry.js} +2 -2
- package/dist/core/{p-8506b611.js → p-5fbde4f9.js} +2 -2
- package/dist/core/{p-7bf52eb9.entry.js → p-605e72b1.entry.js} +2 -2
- package/dist/core/{p-1ac9544f.entry.js → p-64dc1cdb.entry.js} +2 -2
- package/dist/core/p-64dc1cdb.entry.js.map +1 -0
- package/dist/core/{p-6454af62.entry.js → p-6603e3df.entry.js} +2 -2
- package/dist/core/p-6f260a90.entry.js +2 -0
- package/dist/core/{p-fca60e04.entry.js.map → p-6f260a90.entry.js.map} +1 -1
- package/dist/core/p-71dc8171.entry.js +2 -0
- package/dist/core/{p-443a813a.entry.js.map → p-71dc8171.entry.js.map} +1 -1
- package/dist/core/p-87562d9e.entry.js +2 -0
- package/dist/core/{p-773f71f6.entry.js.map → p-87562d9e.entry.js.map} +1 -1
- package/dist/core/p-88b69d30.entry.js +2 -0
- package/dist/core/{p-bc966c46.entry.js.map → p-88b69d30.entry.js.map} +1 -1
- package/dist/core/{p-fe6fed11.entry.js → p-8ece244d.entry.js} +2 -2
- package/dist/{components/p-45097b4c.js.map → core/p-8ece244d.entry.js.map} +1 -1
- package/dist/core/{p-db22d51c.entry.js → p-913331e8.entry.js} +2 -2
- package/dist/core/p-979b03eb.entry.js +2 -0
- package/dist/core/{p-b1efeb41.entry.js.map → p-979b03eb.entry.js.map} +1 -1
- package/dist/core/p-97c65665.entry.js +2 -0
- package/dist/core/{p-9da91318.entry.js.map → p-97c65665.entry.js.map} +1 -1
- package/dist/core/p-97e8b4b3.entry.js +2 -0
- package/dist/core/{p-439b66a5.entry.js.map → p-97e8b4b3.entry.js.map} +1 -1
- package/dist/core/{p-d65cef62.entry.js → p-abefa59b.entry.js} +2 -2
- package/dist/core/p-aeab9c1a.entry.js +2 -0
- package/dist/core/{p-c4ffcc37.entry.js → p-af9fe91a.entry.js} +2 -2
- package/dist/core/{p-d24710ff.entry.js → p-b0d1073c.entry.js} +2 -2
- package/dist/core/p-b245d627.entry.js +2 -0
- package/dist/core/{p-ed1131cb.entry.js.map → p-b245d627.entry.js.map} +1 -1
- package/dist/core/p-b2abc2fc.entry.js +2 -0
- package/dist/core/p-b2abc2fc.entry.js.map +1 -0
- package/dist/core/{p-0be19b89.entry.js → p-b4cf97ab.entry.js} +2 -2
- package/dist/core/p-b766810e.entry.js +2 -0
- package/dist/core/p-b766810e.entry.js.map +1 -0
- package/dist/core/p-bc0ed2c1.entry.js +2 -0
- package/dist/core/{p-dec3f948.entry.js → p-bf8529f8.entry.js} +2 -2
- package/dist/core/{p-783a6b5b.entry.js → p-cd988543.entry.js} +2 -2
- package/dist/core/p-cd988543.entry.js.map +1 -0
- package/dist/core/p-d2b11492.entry.js +2 -0
- package/dist/core/{p-f1fa5e1e.entry.js.map → p-d2b11492.entry.js.map} +1 -1
- package/dist/core/p-d3f7d3d5.entry.js +2 -0
- package/dist/core/p-d6e972c0.entry.js +2 -0
- package/dist/core/p-d952e56f.entry.js +2 -0
- package/dist/{components/p-20c2203a.js → core/p-e8ec030e.js} +2 -2
- package/dist/core/p-eaa83b2f.entry.js +2 -0
- package/dist/core/p-ebc318d7.entry.js +2 -0
- package/dist/core/p-ebeb1a03.entry.js +2 -0
- package/dist/core/{p-3fc3c26b.entry.js.map → p-ebeb1a03.entry.js.map} +1 -1
- package/dist/core/p-ee0f3bd9.entry.js +2 -0
- package/dist/core/p-ee0f3bd9.entry.js.map +1 -0
- package/dist/core/p-ee7af1ab.entry.js +2 -0
- package/dist/core/{p-8701c28e.entry.js.map → p-ee7af1ab.entry.js.map} +1 -1
- package/dist/core/{p-f7a4da9d.entry.js → p-eeee2325.entry.js} +2 -2
- package/dist/core/p-f83b9da5.entry.js +2 -0
- package/dist/core/{p-2c59483f.entry.js.map → p-f83b9da5.entry.js.map} +1 -1
- package/dist/core/p-fa161f10.entry.js +2 -0
- package/dist/core/{p-e834ee73.entry.js → p-fa5b72de.entry.js} +2 -2
- package/dist/core/p-fb8c019a.entry.js +2 -0
- package/dist/core/p-fb8c019a.entry.js.map +1 -0
- package/dist/core/p-ff609d0e.entry.js +2 -0
- package/dist/esm/core.js +3 -3
- package/dist/esm/gov-accordion-item.entry.js +3 -3
- package/dist/esm/gov-accordion.entry.js +3 -3
- package/dist/esm/gov-attachments_3.entry.js +6 -6
- package/dist/esm/gov-attachments_3.entry.js.map +1 -1
- package/dist/esm/gov-backdrop.entry.js +3 -3
- package/dist/esm/gov-breadcrumbs.entry.js +3 -3
- package/dist/esm/gov-button.entry.js +4 -4
- package/dist/esm/gov-card.entry.js +12 -9
- package/dist/esm/gov-card.entry.js.map +1 -1
- package/dist/esm/gov-chip.entry.js +5 -5
- package/dist/esm/gov-container.entry.js +2 -2
- package/dist/esm/gov-control-group.entry.js +4 -4
- package/dist/esm/gov-cookiebar.entry.js +2 -2
- package/dist/esm/gov-dialog.entry.js +4 -4
- package/dist/esm/gov-dropdown.entry.js +1 -1
- package/dist/esm/gov-empty.entry.js +4 -4
- package/dist/esm/gov-error-code.entry.js +2 -2
- package/dist/esm/{gov-flex_4.entry.js → gov-flex_3.entry.js} +61 -60
- package/dist/esm/gov-flex_3.entry.js.map +1 -0
- package/dist/esm/gov-form-autocomplete.entry.js +4 -4
- package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
- package/dist/esm/gov-form-checkbox-group.entry.js +5 -5
- package/dist/esm/gov-form-checkbox-group.entry.js.map +1 -1
- package/dist/esm/gov-form-checkbox.entry.js +3 -3
- package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
- package/dist/esm/gov-form-control.entry.js +2 -2
- package/dist/esm/gov-form-file.entry.js +3 -4
- package/dist/esm/gov-form-file.entry.js.map +1 -1
- package/dist/esm/gov-form-group.entry.js +4 -4
- package/dist/esm/gov-form-input_2.entry.js +9 -9
- package/dist/esm/gov-form-label.entry.js +23 -0
- package/dist/esm/gov-form-label.entry.js.map +1 -0
- package/dist/esm/gov-form-multi-select.entry.js +5 -5
- package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
- package/dist/esm/gov-form-password-power.entry.js +2 -2
- package/dist/esm/gov-form-radio-group.entry.js +5 -5
- package/dist/esm/gov-form-radio-group.entry.js.map +1 -1
- package/dist/esm/gov-form-radio.entry.js +3 -3
- package/dist/esm/gov-form-radio.entry.js.map +1 -1
- package/dist/esm/gov-form-search.entry.js +2 -2
- package/dist/esm/gov-form-select.entry.js +5 -5
- package/dist/esm/gov-form-select.entry.js.map +1 -1
- package/dist/esm/gov-form-switch.entry.js +3 -3
- package/dist/esm/gov-form-switch.entry.js.map +1 -1
- package/dist/esm/gov-grid-item.entry.js +2 -2
- package/dist/esm/gov-grid.entry.js +2 -2
- package/dist/esm/gov-infobar.entry.js +5 -5
- package/dist/esm/gov-layout-column.entry.js +2 -2
- package/dist/esm/gov-layout.entry.js +2 -2
- package/dist/esm/gov-lifecycle.entry.js +2 -2
- package/dist/esm/gov-link.entry.js +4 -4
- package/dist/esm/gov-loading.entry.js +4 -4
- package/dist/esm/gov-message.entry.js +4 -4
- package/dist/esm/gov-pagination.entry.js +3 -3
- package/dist/esm/gov-spacer.entry.js +4 -4
- package/dist/esm/gov-stepper-item.entry.js +4 -4
- package/dist/esm/gov-stepper.entry.js +4 -4
- package/dist/esm/gov-tabs-item.entry.js +2 -2
- package/dist/esm/gov-tabs.entry.js +4 -4
- package/dist/esm/gov-tag.entry.js +5 -4
- package/dist/esm/gov-tag.entry.js.map +1 -1
- package/dist/esm/gov-tile.entry.js +2 -2
- package/dist/esm/gov-tiles.entry.js +2 -2
- package/dist/esm/gov-toast.entry.js +4 -4
- package/dist/esm/gov-tooltip-content.entry.js +2 -2
- package/dist/esm/gov-tooltip.entry.js +5 -5
- package/dist/esm/gov-wizard-item.entry.js +5 -5
- package/dist/esm/gov-wizard.entry.js +5 -5
- package/dist/esm/{gov.log-066c3139.js → gov.log-6b64cda6.js} +2 -2
- package/dist/esm/{gov.log-066c3139.js.map → gov.log-6b64cda6.js.map} +1 -1
- package/dist/esm/{index-c263e031.js → index-8dc58a1a.js} +8 -4
- package/dist/esm/{index-c263e031.js.map → index-8dc58a1a.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{props-fb6587c3.js → props-9d3c7ac1.js} +2 -2
- package/dist/esm/{props-fb6587c3.js.map → props-9d3c7ac1.js.map} +1 -1
- package/dist/esm/{wcag-de9a3dc6.js → wcag-253a4421.js} +2 -2
- package/dist/esm/{wcag-de9a3dc6.js.map → wcag-253a4421.js.map} +1 -1
- package/dist/hydrate/index.js +147 -123
- package/dist/hydrate/index.mjs +147 -123
- package/dist/types/components/gov-card/constants.d.ts +8 -4
- package/dist/types/components/gov-card/gov-card.d.ts +3 -2
- package/dist/types/components/gov-flex/constants.d.ts +4 -0
- package/dist/types/components/gov-flex/gov-flex.d.ts +9 -7
- package/dist/types/components/gov-icon/gov-icon.d.ts +1 -2
- package/dist/types/components/gov-tag/gov-tag.d.ts +4 -0
- package/dist/types/components/gov-theme-switch/constants.d.ts +0 -2
- package/dist/types/components/gov-theme-switch/gov-theme-switch.d.ts +8 -4
- package/dist/types/components.d.ts +50 -22
- package/dist/types/helpers/Dom/document.d.ts +1 -0
- package/dist/types/pages/Flex.d.ts +3 -0
- package/package.json +4 -4
- package/dist/cjs/gov-flex_4.cjs.entry.js.map +0 -1
- package/dist/components/p-2b87c27b.js.map +0 -1
- package/dist/components/p-31a99bfc.js +0 -2
- package/dist/components/p-68a1aaec.js +0 -2
- package/dist/components/p-68a1aaec.js.map +0 -1
- package/dist/components/p-859a4f0d.js +0 -2
- package/dist/components/p-a2435993.js +0 -2
- package/dist/components/p-dc952cc2.js +0 -2
- package/dist/components/p-f44899e1.js +0 -2
- package/dist/components/p-f44899e1.js.map +0 -1
- package/dist/core/p-00d153bf.entry.js +0 -2
- package/dist/core/p-019e967c.entry.js +0 -2
- package/dist/core/p-1abdcb62.entry.js +0 -2
- package/dist/core/p-1ac9544f.entry.js.map +0 -1
- package/dist/core/p-1b3c808d.entry.js +0 -2
- package/dist/core/p-1b3c808d.entry.js.map +0 -1
- package/dist/core/p-22fa411d.entry.js +0 -2
- package/dist/core/p-2c290fe5.entry.js +0 -2
- package/dist/core/p-2c59483f.entry.js +0 -2
- package/dist/core/p-30eaeeec.entry.js +0 -2
- package/dist/core/p-3fc3c26b.entry.js +0 -2
- package/dist/core/p-40d764ac.entry.js +0 -2
- package/dist/core/p-410ec0dd.entry.js +0 -2
- package/dist/core/p-439b66a5.entry.js +0 -2
- package/dist/core/p-443a813a.entry.js +0 -2
- package/dist/core/p-48c93ac0.entry.js +0 -2
- package/dist/core/p-48c93ac0.entry.js.map +0 -1
- package/dist/core/p-52ca31be.entry.js +0 -2
- package/dist/core/p-52ca31be.entry.js.map +0 -1
- package/dist/core/p-535316b4.entry.js +0 -2
- package/dist/core/p-5396935e.entry.js +0 -2
- package/dist/core/p-5b2131c1.entry.js +0 -2
- package/dist/core/p-5ed63e9c.entry.js +0 -2
- package/dist/core/p-74458da3.entry.js.map +0 -1
- package/dist/core/p-773f71f6.entry.js +0 -2
- package/dist/core/p-783a6b5b.entry.js.map +0 -1
- package/dist/core/p-7b7e502b.entry.js +0 -2
- package/dist/core/p-8701c28e.entry.js +0 -2
- package/dist/core/p-9da91318.entry.js +0 -2
- package/dist/core/p-a218e2eb.entry.js +0 -2
- package/dist/core/p-a2435993.js +0 -2
- package/dist/core/p-b1efeb41.entry.js +0 -2
- package/dist/core/p-b4af0bec.entry.js +0 -2
- package/dist/core/p-b4af0bec.entry.js.map +0 -1
- package/dist/core/p-bc966c46.entry.js +0 -2
- package/dist/core/p-bdc51179.entry.js +0 -2
- package/dist/core/p-c20fe3da.entry.js +0 -2
- package/dist/core/p-cb557873.entry.js.map +0 -1
- package/dist/core/p-ed1131cb.entry.js +0 -2
- package/dist/core/p-f1056a83.entry.js +0 -2
- package/dist/core/p-f1fa5e1e.entry.js +0 -2
- package/dist/core/p-f4bcf817.entry.js +0 -2
- package/dist/core/p-f6709826.entry.js +0 -2
- package/dist/core/p-fca60e04.entry.js +0 -2
- package/dist/core/p-fe6fed11.entry.js.map +0 -1
- package/dist/esm/gov-flex_4.entry.js.map +0 -1
- /package/dist/components/{p-a2435993.js.map → p-0b3574c2.js.map} +0 -0
- /package/dist/components/{p-4149f195.js.map → p-73938936.js.map} +0 -0
- /package/dist/components/{p-5952a5d0.js.map → p-7be2301a.js.map} +0 -0
- /package/dist/components/{p-227eb30d.js.map → p-80dad64b.js.map} +0 -0
- /package/dist/components/{p-7d4f2214.js.map → p-b25af2cf.js.map} +0 -0
- /package/dist/components/{p-dfb5794a.js.map → p-b97d8edd.js.map} +0 -0
- /package/dist/components/{p-31a99bfc.js.map → p-c438a723.js.map} +0 -0
- /package/dist/components/{p-929ebfb5.js.map → p-d962bf44.js.map} +0 -0
- /package/dist/components/{p-20c2203a.js.map → p-e8ec030e.js.map} +0 -0
- /package/dist/core/{p-a2435993.js.map → p-0b3574c2.js.map} +0 -0
- /package/dist/core/{p-951823cb.entry.js.map → p-12d1e5bc.entry.js.map} +0 -0
- /package/dist/core/{p-22fa411d.entry.js.map → p-182d03c1.entry.js.map} +0 -0
- /package/dist/core/{p-c52afdfc.js.map → p-29ac15d2.js.map} +0 -0
- /package/dist/core/{p-30eaeeec.entry.js.map → p-3df6c6cd.entry.js.map} +0 -0
- /package/dist/core/{p-5396935e.entry.js.map → p-436e7690.entry.js.map} +0 -0
- /package/dist/core/{p-5ed63e9c.entry.js.map → p-467f778b.entry.js.map} +0 -0
- /package/dist/core/{p-7b7e502b.entry.js.map → p-4d81039c.entry.js.map} +0 -0
- /package/dist/core/{p-7d6073aa.entry.js.map → p-581c8075.entry.js.map} +0 -0
- /package/dist/core/{p-e2517a72.entry.js.map → p-5a92b9d9.entry.js.map} +0 -0
- /package/dist/core/{p-8506b611.js.map → p-5fbde4f9.js.map} +0 -0
- /package/dist/core/{p-7bf52eb9.entry.js.map → p-605e72b1.entry.js.map} +0 -0
- /package/dist/core/{p-6454af62.entry.js.map → p-6603e3df.entry.js.map} +0 -0
- /package/dist/core/{p-db22d51c.entry.js.map → p-913331e8.entry.js.map} +0 -0
- /package/dist/core/{p-d65cef62.entry.js.map → p-abefa59b.entry.js.map} +0 -0
- /package/dist/core/{p-1abdcb62.entry.js.map → p-aeab9c1a.entry.js.map} +0 -0
- /package/dist/core/{p-c4ffcc37.entry.js.map → p-af9fe91a.entry.js.map} +0 -0
- /package/dist/core/{p-d24710ff.entry.js.map → p-b0d1073c.entry.js.map} +0 -0
- /package/dist/core/{p-0be19b89.entry.js.map → p-b4cf97ab.entry.js.map} +0 -0
- /package/dist/core/{p-5b2131c1.entry.js.map → p-bc0ed2c1.entry.js.map} +0 -0
- /package/dist/core/{p-dec3f948.entry.js.map → p-bf8529f8.entry.js.map} +0 -0
- /package/dist/core/{p-40d764ac.entry.js.map → p-d3f7d3d5.entry.js.map} +0 -0
- /package/dist/core/{p-00d153bf.entry.js.map → p-d6e972c0.entry.js.map} +0 -0
- /package/dist/core/{p-410ec0dd.entry.js.map → p-d952e56f.entry.js.map} +0 -0
- /package/dist/core/{p-20c2203a.js.map → p-e8ec030e.js.map} +0 -0
- /package/dist/core/{p-2c290fe5.entry.js.map → p-eaa83b2f.entry.js.map} +0 -0
- /package/dist/core/{p-f6709826.entry.js.map → p-ebc318d7.entry.js.map} +0 -0
- /package/dist/core/{p-f7a4da9d.entry.js.map → p-eeee2325.entry.js.map} +0 -0
- /package/dist/core/{p-535316b4.entry.js.map → p-fa161f10.entry.js.map} +0 -0
- /package/dist/core/{p-e834ee73.entry.js.map → p-fa5b72de.entry.js.map} +0 -0
- /package/dist/core/{p-f4bcf817.entry.js.map → p-ff609d0e.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GovTooltip","constructor","hostRef","this","tooltipContentId","undefined","tooltipId","TooltipColors","PRIMARY","TooltipSize","_M","h","govHost","host","createID","validateColor","newValue","validateProp","TooltipClass","root","validateSize","validatePosition","TooltipPosition","rerenderMessage","createContentWrapper","connectedCallback","registerListeners","componentWillLoad","color","size","position","componentDidUpdate","disconnectedCallback","removeContent","tooltipContent","message","innerHTML","insideContent","content","documentNode","createElement","TooltipContentClass","setAttribute","_a","identifier","body","appendChild","querySelector","addEventListener","e","preventDefault","persist","showTooltip","hideTooltip","verifyPositionSpace","offset","windowWidth","window","innerWidth","document","documentElement","clientWidth","trigger","getBoundingClientRect","trgWidth","offsetWidth","trgHeight","offsetHeight","contentWidth","contentHeight","triggerPos","left","scrollLeft","top","scrollTop","isRightSpace","width","isLeftSpace","LEFT","RIGHT","style","TOP","BOTTOM","leftPosition","isNotLeftSpace","isNotRightSpace","right","opacity","hidden","tick","removeAttribute","contentEl","getElementById","remove","render","Host","key","id","class","classes","role","tabindex","onKeyPress","onBlur","show","hide"],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipColors,\n\tTooltipColorType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {documentNode} from \"../../helpers/Dom/win\";\nimport {Nullable} from \"../../utils/helpers.types\";\nimport {tick} from \"../../utils/stencil.utils\";\n\n@Component({\n\ttag: \"gov-tooltip\",\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate readonly tooltipContentId = undefined\n\tprivate readonly tooltipId = undefined\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID(\"GovTooltip\")\n\t\tthis.tooltipContentId = createID(\"GovContentTooltip\")\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop({mutable: true}) position: TooltipPositionType = \"right\"\n\t/**\n\t * Information contained in the tooltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({reflect: true}) readonly icon: boolean = undefined\n\n\t@State() persist = false\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TooltipColors, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"position\")\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"message\")\n\trerenderMessage(): void {\n\t\tthis.createContentWrapper();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateColor(this.color)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\t}\n\n\tcomponentDidUpdate() {\n\t\tthis.createContentWrapper()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.removeContent()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tif (this.tooltipContent) {\n\t\t\tif (this.message) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.message\n\t\t\t} else if (this.insideContent) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.insideContent.innerHTML\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet content: HTMLGovTooltipContentElement;\n\t\tif (this.insideContent) {\n\t\t\tcontent = this.insideContent\n\t\t} else {\n\t\t\tcontent = documentNode().createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tcontent.innerHTML = this.message\n\t\t}\n\n\t\tcontent.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n\t\tcontent.setAttribute(\"parent-id\", this.tooltipId)\n\t\tcontent.setAttribute(\"color\", this.color)\n\t\tcontent.setAttribute(\"size\", this.size)\n\t\tdocumentNode().body.appendChild(content)\n\t}\n\n\tprivate get tooltipContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn documentNode().body.querySelector(`#${this.identifier ?? this.tooltipContentId}`);\n\t}\n\n\tprivate get insideContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn this.host.querySelector(TooltipContentClass.root)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener(\"click\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.persist = true\n\t\t\tif (this.tooltipContent) {\n\t\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"true\")\n\t\t\t}\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseenter\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseleave\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth - (window.innerWidth - document.documentElement.clientWidth);\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst trgHeight = this.host.offsetHeight\n\t\tconst contentWidth = this.tooltipContent.offsetWidth\n\t\tconst contentHeight = this.tooltipContent.offsetHeight\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\n\t\tconst isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n\t\tconst isLeftSpace = triggerPos.left > contentWidth;\n\n\t\t// LEFT/RIGHT\n\t\tif (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n\t\t\tif (isRightSpace === false && isLeftSpace === false) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\t}\n\t\t\tif (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n\t\t\t\tthis.position = TooltipPosition.LEFT\n\t\t\t}\n\t\t\tif (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n\t\t\t\tthis.position = TooltipPosition.RIGHT\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.RIGHT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.LEFT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n\t\t}\n\n\t\t// LEFT/RIGHT FOR TOP/BOTTOM\n\t\tif (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n\t\t\tif (contentWidth > trgWidth) {\n\t\t\t\tlet leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n\t\t\t\tconst isNotLeftSpace = leftPosition < 0;\n\t\t\t\tconst isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n\t\t\t\tif (isNotLeftSpace && isNotRightSpace) {\n\t\t\t\t\tthis.tooltipContent.style.width = \"auto\";\n\t\t\t\t\tthis.tooltipContent.style.left = offset + \"px\";\n\t\t\t\t\tthis.tooltipContent.style.right = offset + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tif (isNotLeftSpace) {\n\t\t\t\t\t\tleftPosition = offset\n\t\t\t\t\t}\n\t\t\t\t\tif (isNotRightSpace) {\n\t\t\t\t\t\tleftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n\t\t\t\t\t}\n\t\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.TOP) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.BOTTOM) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.BOTTOM)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n\t\t}\n\n\t\tthis.tooltipContent.style.opacity = '1'\n\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.style.opacity = '0'\n\t\t\tthis.tooltipContent.hidden = false\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"true\")\n\t\t\ttick(() => {\n\t\t\t\tthis.verifyPositionSpace()\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"false\")\n\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"false\")\n\t\t\tthis.tooltipContent.removeAttribute('style')\n\t\t}\n\t}\n\n\tprivate removeContent() {\n\t\tconst contentEl = document.getElementById(this.tooltipContentId)\n\t\tif (contentEl) {\n\t\t\tcontentEl.remove()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tid={this.tooltipId}\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}>\n\t\t\t\t<span role={'button'}\n\t\t\t\t\t\t\ttabindex={0}\n\t\t\t\t\t\t\tonKeyPress={() => this.showTooltip()}\n\t\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\t\tif (this.persist === false) {\n\t\t\t\t\t\t\t\t\tthis.hideTooltip()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-describedby={this.identifier ?? this.tooltipContentId}><slot/></span>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(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ACT4F,MAAO/F,KAAKQ,EAAEwF,QAAQjF,EAAaC,MACnCW,SAAU3B,KAAK2B,UACfnB,EAAA,QAAAqF,IAAA,2CAAMI,KAAM,SACTC,SAAU,EACVC,WAAY,IAAMnG,KAAKiD,cACvBmD,OAAQ,KACP,GAAIpG,KAAKgD,UAAY,MAAO,CAC3BhD,KAAKkD,a,GAEN,oBACiBV,EAAAxC,KAAKyC,cAAU,MAAAD,SAAA,EAAAA,EAAIxC,KAAKC,kBAAkBO,EAAA,QAAAqF,IAAA,8C,CASlE,UAAMQ,GACLrG,KAAKiD,a,CAON,UAAMqD,GACLtG,KAAKgD,QAAU,MACfhD,KAAKkD,a","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GovTooltip","constructor","hostRef","this","tooltipContentId","undefined","tooltipId","TooltipColors","PRIMARY","TooltipSize","_M","h","govHost","host","createID","validateColor","newValue","validateProp","TooltipClass","root","validateSize","validatePosition","TooltipPosition","rerenderMessage","createContentWrapper","connectedCallback","registerListeners","componentWillLoad","color","size","position","componentDidUpdate","disconnectedCallback","removeContent","tooltipContent","message","innerHTML","insideContent","content","documentNode","createElement","TooltipContentClass","setAttribute","_a","identifier","body","appendChild","querySelector","addEventListener","e","preventDefault","persist","showTooltip","hideTooltip","verifyPositionSpace","offset","windowWidth","window","innerWidth","document","documentElement","clientWidth","trigger","getBoundingClientRect","trgWidth","offsetWidth","trgHeight","offsetHeight","contentWidth","contentHeight","triggerPos","left","scrollLeft","top","scrollTop","isRightSpace","width","isLeftSpace","LEFT","RIGHT","style","TOP","BOTTOM","leftPosition","isNotLeftSpace","isNotRightSpace","right","opacity","hidden","tick","removeAttribute","contentEl","getElementById","remove","render","Host","key","id","class","classes","role","tabindex","onKeyPress","onBlur","show","hide"],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipColors,\n\tTooltipColorType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {documentNode} from \"../../helpers/Dom/win\";\nimport {Nullable} from \"../../utils/helpers.types\";\nimport {tick} from \"../../utils/stencil.utils\";\n\n@Component({\n\ttag: \"gov-tooltip\",\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate readonly tooltipContentId = undefined\n\tprivate readonly tooltipId = undefined\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID(\"GovTooltip\")\n\t\tthis.tooltipContentId = createID(\"GovContentTooltip\")\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop({mutable: true}) position: TooltipPositionType = \"right\"\n\t/**\n\t * Information contained in the tooltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({reflect: true}) readonly icon: boolean = undefined\n\n\t@State() persist = false\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TooltipColors, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"position\")\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"message\")\n\trerenderMessage(): void {\n\t\tthis.createContentWrapper();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateColor(this.color)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\t}\n\n\tcomponentDidUpdate() {\n\t\tthis.createContentWrapper()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.removeContent()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tif (this.tooltipContent) {\n\t\t\tif (this.message) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.message\n\t\t\t} else if (this.insideContent) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.insideContent.innerHTML\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet content: HTMLGovTooltipContentElement;\n\t\tif (this.insideContent) {\n\t\t\tcontent = this.insideContent\n\t\t} else {\n\t\t\tcontent = documentNode().createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tcontent.innerHTML = this.message\n\t\t}\n\n\t\tcontent.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n\t\tcontent.setAttribute(\"parent-id\", this.tooltipId)\n\t\tcontent.setAttribute(\"color\", this.color)\n\t\tcontent.setAttribute(\"size\", this.size)\n\t\tdocumentNode().body.appendChild(content)\n\t}\n\n\tprivate get tooltipContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn documentNode().body.querySelector(`#${this.identifier ?? this.tooltipContentId}`);\n\t}\n\n\tprivate get insideContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn this.host.querySelector(TooltipContentClass.root)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener(\"click\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.persist = true\n\t\t\tif (this.tooltipContent) {\n\t\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"true\")\n\t\t\t}\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseenter\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseleave\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth - (window.innerWidth - document.documentElement.clientWidth);\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst trgHeight = this.host.offsetHeight\n\t\tconst contentWidth = this.tooltipContent.offsetWidth\n\t\tconst contentHeight = this.tooltipContent.offsetHeight\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\n\t\tconst isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n\t\tconst isLeftSpace = triggerPos.left > contentWidth;\n\n\t\t// LEFT/RIGHT\n\t\tif (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n\t\t\tif (isRightSpace === false && isLeftSpace === false) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\t}\n\t\t\tif (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n\t\t\t\tthis.position = TooltipPosition.LEFT\n\t\t\t}\n\t\t\tif (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n\t\t\t\tthis.position = TooltipPosition.RIGHT\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.RIGHT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.LEFT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n\t\t}\n\n\t\t// LEFT/RIGHT FOR TOP/BOTTOM\n\t\tif (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n\t\t\tif (contentWidth > trgWidth) {\n\t\t\t\tlet leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n\t\t\t\tconst isNotLeftSpace = leftPosition < 0;\n\t\t\t\tconst isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n\t\t\t\tif (isNotLeftSpace && isNotRightSpace) {\n\t\t\t\t\tthis.tooltipContent.style.width = \"auto\";\n\t\t\t\t\tthis.tooltipContent.style.left = offset + \"px\";\n\t\t\t\t\tthis.tooltipContent.style.right = offset + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tif (isNotLeftSpace) {\n\t\t\t\t\t\tleftPosition = offset\n\t\t\t\t\t}\n\t\t\t\t\tif (isNotRightSpace) {\n\t\t\t\t\t\tleftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n\t\t\t\t\t}\n\t\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.TOP) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.BOTTOM) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.BOTTOM)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n\t\t}\n\n\t\tthis.tooltipContent.style.opacity = '1'\n\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.style.opacity = '0'\n\t\t\tthis.tooltipContent.hidden = false\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"true\")\n\t\t\ttick(() => {\n\t\t\t\tthis.verifyPositionSpace()\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"false\")\n\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"false\")\n\t\t\tthis.tooltipContent.removeAttribute('style')\n\t\t}\n\t}\n\n\tprivate removeContent() {\n\t\tconst contentEl = document.getElementById(this.tooltipContentId)\n\t\tif (contentEl) {\n\t\t\tcontentEl.remove()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tid={this.tooltipId}\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}>\n\t\t\t\t<span role={'button'}\n\t\t\t\t\t\t\ttabindex={0}\n\t\t\t\t\t\t\tonKeyPress={() => this.showTooltip()}\n\t\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\t\tif (this.persist === false) {\n\t\t\t\t\t\t\t\t\tthis.hideTooltip()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-describedby={this.identifier ?? this.tooltipContentId}><slot/></span>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.persist = false\n\t\tthis.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AAU,EACVC,WAAY,IAAMnG,KAAKiD,cACvBmD,OAAQ,KACP,GAAIpG,KAAKgD,UAAY,MAAO,CAC3BhD,KAAKkD,a,GAEN,oBACiBV,EAAAxC,KAAKyC,cAAU,MAAAD,SAAA,EAAAA,EAAIxC,KAAKC,kBAAkBO,EAAA,QAAAqF,IAAA,8C,CASlE,UAAMQ,GACLrG,KAAKiD,a,CAON,UAAMqD,GACLtG,KAAKgD,QAAU,MACfhD,KAAKkD,a","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as t,d as s,h as i,a as e,g as o}from"./p-5fbde4f9.js";import{c as h}from"./p-cd6c2938.js";import{g as n,c as a,t as r}from"./p-ea7fdd2e.js";import{g as l}from"./p-da1db6fd.js";import{i as c}from"./p-d9a299a4.js";import{A as f,a as d}from"./p-9ac55bd1.js";import"./p-92f420cb.js";import"./p-e0e2e9c1.js";import"./p-7f3becc5.js";import"./p-5aad3497.js";import"./p-56efd4a2.js";import"./p-7ba4daf4.js";const m={root:"gov-form-file",area:"gov-form-file__area",input:"gov-form-file__input",attachments:"gov-form-file__attachments"};function p(t){const s=["bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let i=0,e=parseInt(t,10)||0;while(e>=1024&&++i){e=e/1024}return e.toFixed(e<10&&i>0?1:0)+" "+s[i]}function u(t,s){if(typeof s==="string"&&s.length){return s.replace(/\s/g,"").split(",").filter((s=>new RegExp(s.replace("*",".*")).test(t.type))).length>0}else{return true}}function g(t,s){const i=Math.round(t.size);return i<=s}const v=class{constructor(i){t(this,i);this.govFocus=s(this,"gov-focus",7);this.govBlur=s(this,"gov-blur",7);this.govFiles=s(this,"gov-files",7);this.govAddFile=s(this,"gov-add-file",7);this.govRemoveFile=s(this,"gov-remove-file",7);this.eventsRegistered=false;this.expanded=false;this.required=false;this.disabled=false;this.resetAfterPick=false;this.ignoreFileDuplicationCheck=false;this.displayAttachments=true;this.name=undefined;this.accept=undefined;this.multiple=false;this.maxFileSize=-1;this.identifier=undefined;this.invalid=undefined;this.errorSize="Soubor je větší než povolená velikost {FILE_SIZE}";this.errorAccept="Soubor tohoto typu není povolen";this.accessibleRemoveLabel="Odebrat soubor {FILE_NAME}";this.accessibleAttachmentsLabel="Přílohy";this.files=[];this.inheritedAttributes={};this.fileId=h("GovInputFile");this.h=n(this.host);this.f=l(this.h)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",a(this.invalid));this.f.passAttrToControl("disabled",a(this.disabled));this.f.passAttrToControl("type","File")}registerListeners(){if(this.eventsRegistered){return}this.eventsRegistered=true;function t(){this.areaRef.classList.add("highlight")}function s(){this.areaRef.classList.remove("highlight")}this.inputRef.addEventListener("change",(t=>{t.preventDefault();t.stopPropagation();const s=t.target.files;if(this.resetAfterPick){if(s.length){this.validateFiles(s)}}else{this.validateFiles(s)}}),false);if(this.expanded){const i=["dragover","dragleave"];const e=["dragenter","dragover","mouseenter"];const o=["dragleave","mouseleave"];i.map((t=>this.inputRef.addEventListener(t,this.preventDefaults.bind(this),false)));e.map((s=>this.inputRef.addEventListener(s,t.bind(this),false)));o.forEach((t=>this.inputRef.addEventListener(t,s.bind(this),false)))}}preventDefaults(t){t.preventDefault();t.stopPropagation()}handleDrop(t){const s=t.dataTransfer;this.validateFiles(s.files)}validateFiles(t){let s=[];Array.from(t).map((t=>{const i=this.files.find((s=>s.file.name===t.name&&s.file.size===t.size))||null;if(i===null||this.ignoreFileDuplicationCheck){const i=typeof this.maxFileSize==="number"&&this.maxFileSize>0?g(t,this.maxFileSize):true;const e=u(t,this.accept);const o={id:h("GovFormFile"),file:t,acceptValid:e,sizeValid:i};if(this.displayAttachments){this.files=[...this.files,o]}else{s=[...s,o]}this.govAddFile.emit({component:m.root,file:o})}}));this.govFiles.emit({component:m.root,files:s.length?s:this.files});if(this.resetAfterPick){this.reset().finally()}}componentDidLoad(){this.attributeObserver=new f(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(d)}componentWillLoad(){this.f.passAttrToLabel("required",String(this.required));this.passControlAttrs();this.inheritedAttributes=c(this.host)}async componentDidRender(){this.registerListeners()}disconnectedCallback(){this.attributeObserver.stopObserving()}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}render(){return i(e,{key:"92ee90aa5d8d28d310c0229ce513be88edafd68d",class:this.h.classes([m.root]),invalid:r(this.invalid),expanded:r(this.expanded)},i("div",{key:"ada51c64168a7cb4dcb4f123e7f74fe401b63c82",class:m.area,ref:t=>this.areaRef=t},i("slot",{key:"77a4e7096f1949c8c284b0d6607ffd96567669ef"}),i("input",Object.assign({key:"63382d1ccfc1254b9073923713677af25ed0fed3",class:m.input,ref:t=>this.inputRef=t,id:this.identifier||this.fileId,type:"file",name:this.name,accept:this.accept,multiple:this.multiple,onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,disabled:this.disabled},this.inheritedAttributes,{"aria-required":r(this.required),"aria-invalid":r(this.invalid),"aria-disabled":r(this.disabled)}))),this.h.hasSlot("attachments")?i("div",{class:m.attachments},i("slot",{name:"attachments"})):null,this.files.length&&this.displayAttachments?i("div",{class:m.attachments},i("gov-attachments",{label:this.accessibleAttachmentsLabel,"accessible-label":this.accessibleAttachmentsLabel},this.files.map((t=>i("gov-attachments-item",{"accessible-remove-labelledby":t.id,"on-gov-remove":()=>this.onRemoveFileHandler(t)},i("span",{class:"sr-only",id:t.id},this.accessibleRemoveLabel.replace("{FILE_NAME}",t.file.name)),t.file.name,t.acceptValid===false?i("gov-form-message",{slot:"message",color:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill",type:"components"}),t.acceptValid===false?this.errorAccept:null):null,t.sizeValid===false?i("gov-form-message",{slot:"message",color:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill",type:"components"}),this.errorSize.replace("{FILE_SIZE}",p(this.maxFileSize))):null,i("span",{slot:"info"},"(",p(t.file.size),")")))))):null)}onRemoveFileHandler(t){const s=this.files.findIndex((s=>s.id===t.id));if(s!==-1){const t=this.files;const i=this.files[s];t.splice(s,1);this.files=[...t];this.govRemoveFile.emit({component:m.root,file:i});this.govFiles.emit({component:m.root,files:t})}}onFocusHandler(t){t.stopPropagation();this.govFocus.emit({component:m.root,originalEvent:t})}onBlurHandler(t){t.stopPropagation();this.govBlur.emit({component:m.root,originalEvent:t})}onChangeHandler(t){t.stopPropagation()}async getRef(){return this.inputRef}async getAreaRef(){return this.areaRef}async reset(){this.files=[];this.inputRef.value=""}get host(){return o(this)}static get watchers(){return{disabled:["watchControlAttrs"],invalid:["watchControlAttrs"]}}};export{v as gov_form_file};
|
|
2
|
+
//# sourceMappingURL=p-ee0f3bd9.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FormFileClass","root","area","input","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","GovFormFile","constructor","hostRef","this","eventsRegistered","fileId","createID","h","govHost","host","f","govForm","watchControlAttrs","passControlAttrs","passAttrToControl","toBoolAttr","invalid","disabled","registerListeners","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","resetAfterPick","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","filesBuffer","Array","from","isFile","find","item","name","ignoreFileDuplicationCheck","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","displayAttachments","govAddFile","emit","component","govFiles","reset","finally","componentDidLoad","attributeObserver","AttributeObserver","attributeName","newValue","onAriaAttributeChange","startObserving","ariaAttributes","componentWillLoad","passAttrToLabel","String","required","inheritedAttributes","inheritAriaAttributes","componentDidRender","disconnectedCallback","stopObserving","removeAttribute","Object","assign","render","Host","key","class","classes","toBoolAttrIfDefined","ref","el","identifier","multiple","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","hasSlot","label","accessibleAttachmentsLabel","onRemoveFileHandler","accessibleRemoveLabel","slot","color","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemoveFile","govFocus","originalEvent","govBlur","getRef","getAreaRef","value"],"sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tinput: 'gov-form-file__input',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept === 'string' && accept.length) {\n\t\treturn (\n\t\t\taccept\n\t\t\t\t.replace(/\\s/g, '')\n\t\t\t\t.split(',')\n\t\t\t\t.filter(accept => {\n\t\t\t\t\treturn new RegExp(accept.replace('*', '.*')).test(file.type)\n\t\t\t\t}).length > 0\n\t\t)\n\t} else {\n\t\treturn true\n\t}\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size)\n\treturn fileSize <= maxSize\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormFileClass} from \"./constants\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {fileAcceptValidation, fileSizeValidation, formatBytes} from \"../../../utils/file.utils\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovFormFileEvent, GovFormFileItem} from \"./gov-form-file.types\"\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\n\n@Component({\n\ttag: \"gov-form-file\",\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\tprivate attributeObserver: AttributeObserver\n\tprivate eventsRegistered = false\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop({reflect: true}) readonly disabled: boolean = false\n\t/**\n\t * After selecting the files, the main input element will be reset.\n\t * The propagation of the event with the selected files will not be affected.\n\t */\n\t@Prop({attribute: \"reset-after-pick\"}) readonly resetAfterPick: boolean = false\n\t/**\n\t * Selected files will not be checked for duplicates based on name and size.\n\t */\n\t@Prop({attribute: \"ignore-file-duplication-check\"}) readonly ignoreFileDuplicationCheck: boolean = false\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({attribute: \"display-attachments\"}) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple\n\t */\n\t@Prop() readonly multiple: boolean = false\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({attribute: \"max-file-size\"}) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({attribute: \"error-size\"}) readonly errorSize: string = \"Soubor je větší než povolená velikost {FILE_SIZE}\"\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({attribute: \"error-accept\"}) readonly errorAccept: string = \"Soubor tohoto typu není povolen\"\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({attribute: \"accessible-remove-label\"}) readonly accessibleRemoveLabel: string = \"Odebrat soubor {FILE_NAME}\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({attribute: \"accessible-attachments-label\"}) readonly accessibleAttachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({eventName: \"gov-files\"}) govFiles: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({eventName: \"gov-add-file\"}) govAddFile: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({eventName: \"gov-remove-file\"}) govRemoveFile: EventEmitter<GovFormFileEvent>\n\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@State() files: GovFormFileItem[] = []\n\t@State() inheritedAttributes: Attributes = {}\n\n\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tif (this.eventsRegistered) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventsRegistered = true\n\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"mouseleave\"]\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tlet filesBuffer: GovFormFileItem[] = []\n\t\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null || this.ignoreFileDuplicationCheck) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === \"number\" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID(\"GovFormFile\"),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tif (this.displayAttachments) {\n\t\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\t} else {\n\t\t\t\t\tfilesBuffer = [...filesBuffer, newFile]\n\t\t\t\t}\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: filesBuffer.length ? filesBuffer : this.files,\n\t\t})\n\n\t\tif (this.resetAfterPick) {\n\t\t\tthis.reset().finally()\n\t\t}\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.registerListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])}\n\t\t\t\t invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t expanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot/>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\n\t\t\t\t\t\tmultiple={this.multiple}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t{...this.inheritedAttributes}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot(\"attachments\") ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={\"attachments\"}/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.accessibleAttachmentsLabel}\n\t\t\t\t\t\t\t\t\t\t accessible-label={this.accessibleAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item accessible-remove-labelledby={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t on-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t<span class={\"sr-only\"} id={item.id}>\n\t\t\t\t\t\t\t\t\t\t{this.accessibleRemoveLabel.replace(\"{FILE_NAME}\", item.file.name)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Remove all files from component state\n\t */\n\t@Method()\n\tasync reset(): Promise<void> {\n\t\tthis.files = []\n\t\tthis.inputRef.value = '';\n\t}\n}\n"],"mappings":"yZAAO,MAAMA,EAAgB,CAC5BC,KAAM,gBACNC,KAAM,sBACNC,MAAO,uBACPC,YAAa,8B,SCJEC,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b0.js";import{g as d,c as f,b as p}from"./p-ea7fdd2e.js";import{h as b}from"./p-2aedc81e.js";import{p as m}from"./p-016bbea6.js";import{A as u,a as y}from"./p-9ac55bd1.js";import{i as g}from"./p-d9a299a4.js";import"./p-e8ec030e.js";import"./p-e0e2e9c1.js";import"./p-92f420cb.js";import"./p-5aad3497.js";const v=class{constructor(i){t(this,i);this.govChange=s(this,"gov-change",7);this.triggerRefs={};this.type="text";this.size="m";this.color="primary";this.orientation="horizontal";this.direction="row";this.controllers=[];this.focusIndex=0;this.inheritedAttributes={};this.h=d(this.host)}validateType(t){h(c,t,r.root)}validateColor(t){h(n,t,r.root)}validateSize(t){h(l,t,r.root)}componentDidLoad(){this.attributeObserver=new u(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(y)}componentWillLoad(){this.prepareControllers();this.validateSize(this.size);this.inheritedAttributes=g(this.host)}disconnectedCallback(){this.attributeObserver.stopObserving()}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}prepareControllers(t=false){this.controllers=[];const s=[];this.host.querySelectorAll(o.root).forEach((t=>{const i=Promise.all([t.getIdentifier(),t.getTriggerIdentifier(),t.getDisableState()]).then((([s,i,e])=>{const a=typeof t.getAttribute("default")==="string";const h=m(t.getAttribute("icon-start"));const o=m(t.getAttribute("icon-end"));return{label:t.getAttribute("label"),direction:t.getAttribute("direction"),contentIdentifier:s,disabled:e,triggerIdentifier:i,element:t,active:false,default:a,iconStart:h,iconEnd:o}}));s.push(i)}));Promise.all(s).then((s=>{if(t===false){let t=s.findIndex((t=>t.default));if(t===-1)t=0;this.focusIndex=t;s[t].active=true}else if(this.focusIndex>-1&&b(s,this.focusIndex)){s[this.focusIndex].active=true}const i=s.findIndex((t=>t.active&&t.disabled));if(i>-1){s[i].active=false;const t=s.findIndex((t=>!t.disabled));if(t>-1){s[t].active=true;this.focusIndex=t}}this.controllers=[...s];this.reRender()}))}setActiveByIdentifier(t){const s=[];this.controllers.map((i=>{i.active=t===i.triggerIdentifier||t===i.contentIdentifier;s.push(i)}));this.controllers=[...s]}reRender(){this.controllers.map((t=>{t.element.setActiveStatus(t.active).catch()}))}render(){return i(e,{key:"4efcbedcc355a74456cc899bc48c7aaf8c604c12",class:this.h.classes(r.root),size:this.size,color:this.color,type:this.type,direction:this.direction,onKeyDown:this.onKeydownHandler.bind(this)},i("div",Object.assign({key:"a64d1a7cadd5950ebc687c3f3d741ea0a59a3684",class:r.tabs,role:"tablist"},this.inheritedAttributes),i("ul",{key:"adab5148c97b041e11f3e7d11a4d87492df5320a",class:r.list},this.controllers.map((t=>i("li",{class:r.item},this.type=="text"?i("button",{class:r.btn,id:t.triggerIdentifier,role:"tab",onClick:()=>this.onSelectHandler(t),disabled:t.disabled,"aria-disabled":f(t.disabled),"aria-selected":f(t.active),"aria-controls":t.contentIdentifier,tabindex:t.active&&!t.disabled?0:-1,ref:s=>this.triggerRefs[t.triggerIdentifier]=s},t.iconStart?i("gov-icon",{name:t.iconStart.name,type:t.iconStart.type}):null,t.label,t.iconEnd?i("gov-icon",{name:t.iconEnd.name,type:t.iconEnd.type}):null):i("gov-chip",{role:"tab",tag:"button",identifier:t.triggerIdentifier,"aria-selected":p(t.active),"aria-controls":t.contentIdentifier,focusable:t.active,disabled:t.disabled,color:this.color,size:this.size==="xs"?"xs":this.size==="s"?"s":"m",type:t.active?"solid":"outlined",ref:s=>this.triggerRefs[t.triggerIdentifier]=s,"on-gov-click":()=>this.onSelectHandler(t)},t.iconStart?i("gov-icon",{name:t.iconStart.name,type:t.iconStart.type,slot:"icon-start"}):null,t.label,t.iconEnd?i("gov-icon",{name:t.iconEnd.name,type:t.iconEnd.type,slot:"icon-end"}):null)))))),i("slot",{key:"2a3720ce9449d62ecd1d58bac806bf356d37375a"}))}getCurrentTab(){return this.controllers.find((t=>t.active))||null}onSelectHandler(t){const s=this.controllers.findIndex((s=>s.triggerIdentifier===t.triggerIdentifier));this.focusIndex=s;this.setActiveByIdentifier(t.triggerIdentifier);this.reRender();this.govChange.emit(this.getCurrentTab().element)}onKeydownHandler(t){const s=t.keyCode;t.stopPropagation();this.goToPrevNext(s)}goToPrevNext(t){if([37,38,39,40].includes(t)){if(false===(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1)){return}this.controllers[this.focusIndex].active=false;if(t===39||t===40){this.focusIndex++;if(this.focusIndex>=this.controllers.length){this.focusIndex=0}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(40)}}else if(t===37||t===38){this.focusIndex--;if(this.focusIndex<0){this.focusIndex=this.controllers.length-1}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(38)}}if(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1){const t=this.controllers[this.focusIndex];t.active=true;const s=this.triggerRefs[t.triggerIdentifier];if(s.nodeName.toLowerCase()==="gov-chip"){this.triggerRefs[t.triggerIdentifier].setFocus()}else{this.triggerRefs[t.triggerIdentifier].focus()}this.controllers=[...this.controllers];this.reRender();this.govChange.emit(this.getCurrentTab().element)}}}async refresh(){this.prepareControllers()}async currentTab(){return this.getCurrentTab().element||null}async setActiveTab(t){this.setActiveByIdentifier(t);this.reRender()}async rerender(){this.prepareControllers(true)}get host(){return a(this)}static get watchers(){return{type:["validateType"],color:["validateColor"],size:["validateSize"]}}};export{v as gov_tabs};
|
|
2
|
+
//# sourceMappingURL=p-ee7af1ab.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GovTabs","constructor","hostRef","this","triggerRefs","h","govHost","host","validateType","newValue","validateProp","TabTypes","TabsClass","root","validateColor","TabColors","validateSize","TabSizes","componentDidLoad","attributeObserver","AttributeObserver","attributeName","onAriaAttributeChange","startObserving","ariaAttributes","componentWillLoad","prepareControllers","size","inheritedAttributes","inheritAriaAttributes","disconnectedCallback","stopObserving","removeAttribute","Object","assign","skipDefault","controllers","promises","querySelectorAll","TabsItemClass","forEach","tab","controlItem","Promise","all","getIdentifier","getTriggerIdentifier","getDisableState","then","identifier","triggerIdentifier","disabled","isDefault","getAttribute","iconStart","prepareIconFormat","iconEnd","label","direction","contentIdentifier","element","active","default","push","defaultTabIndex","findIndex","controller","focusIndex","hasOwnProperty","isWrongCombination","firstGoodTab","reRender","setActiveByIdentifier","temp","map","item","control","setActiveStatus","catch","render","Host","key","class","classes","color","type","onKeyDown","onKeydownHandler","bind","tabs","role","list","btn","id","onClick","onSelectHandler","toBoolAttr","tabindex","ref","el","name","tag","booleanString","focusable","slot","getCurrentTab","find","index","t","govChange","emit","e","keyCode","stopPropagation","goToPrevNext","includes","length","current","trigger","nodeName","toLowerCase","setFocus","focus","refresh","currentTab","setActiveTab","rerender"],"sources":["../../../packages/core/src/components/gov-tabs/gov-tabs.tsx"],"sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tColorType,\n\tTabColors,\n\tTabOrientationType,\n\tTabsClass,\n\tTabsItemClass,\n\tTabSizes,\n\tTabSizeType,\n\tTabType,\n\tTabTypes\n} from \"./constants\"\nimport {GovTabControllerItem} from \"./gov-tabs.types\"\nimport {booleanString, govHost, toBoolAttr} from \"../../helpers/Dom/template\"\nimport {Nullable} from \"../../types/interfaces\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {hasOwnProperty} from \"../../utils/helpers.types\";\nimport {prepareIconFormat} from \"../gov-icon/helpers\";\nimport {AttributeObserver, Attributes} from \"../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../helpers/Accessibility/accessibility\";\n\n\n@Component({\n\ttag: \"gov-tabs\",\n})\nexport class GovTabs {\n\tprivate h: GovHost\n\tprivate triggerRefs: Record<string, HTMLButtonElement | HTMLGovChipElement> = {}\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTabsElement\n\t/**\n\t * Tabs type\n\t */\n\t@Prop() readonly type: TabType = \"text\"\n\t/**\n\t * Tabs size.\n\t */\n\t@Prop() readonly size?: TabSizeType = 'm'\n\t/**\n\t * Style variation of the tab chips.\n\t */\n\t@Prop() readonly color?: ColorType = \"primary\"\n\t/**\n\t * Tabs orientation\n\t */\n\t@Prop() readonly orientation: TabOrientationType = \"horizontal\"\n\t/**\n\t * Icon and description display direction\n\t */\n\t@Prop({reflect: true}) readonly direction: 'row' | 'column' = 'row'\n\t/**\n\t * Emitted when the tab is changed.\n\t */\n\t@Event({eventName: \"gov-change\"}) govChange: EventEmitter<HTMLGovTabsItemElement>\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(TabTypes, newValue, TabsClass.root)\n\t}\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TabColors, newValue, TabsClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TabSizes, newValue, TabsClass.root)\n\t}\n\n\t@State() controllers: GovTabControllerItem[] = []\n\t@State() focusIndex = 0\n\t@State() inheritedAttributes: Attributes = {}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.prepareControllers()\n\t\tthis.validateSize(this.size)\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tprivate prepareControllers(skipDefault = false): void {\n\t\tthis.controllers = []\n\t\tconst promises: Promise<GovTabControllerItem>[] = []\n\t\tthis.host.querySelectorAll(TabsItemClass.root).forEach((tab: HTMLGovTabsItemElement) => {\n\t\t\tconst controlItem = Promise.all([\n\t\t\t\ttab.getIdentifier(),\n\t\t\t\ttab.getTriggerIdentifier(),\n\t\t\t\ttab.getDisableState()\n\t\t\t]).then(([identifier, triggerIdentifier, disabled]) => {\n\t\t\t\tconst isDefault = typeof tab.getAttribute(\"default\") === \"string\"\n\t\t\t\tconst iconStart = prepareIconFormat(tab.getAttribute('icon-start'))\n\t\t\t\tconst iconEnd = prepareIconFormat(tab.getAttribute('icon-end'))\n\t\t\t\treturn {\n\t\t\t\t\tlabel: tab.getAttribute(\"label\"),\n\t\t\t\t\tdirection: tab.getAttribute(\"direction\"),\n\t\t\t\t\tcontentIdentifier: identifier,\n\t\t\t\t\tdisabled: disabled,\n\t\t\t\t\ttriggerIdentifier: triggerIdentifier,\n\t\t\t\t\telement: tab,\n\t\t\t\t\tactive: false,\n\t\t\t\t\tdefault: isDefault,\n\t\t\t\t\ticonStart,\n\t\t\t\t\ticonEnd\n\t\t\t\t}\n\t\t\t})\n\t\t\tpromises.push(controlItem)\n\t\t});\n\t\tPromise.all(promises).then(controllers => {\n\t\t\tif (skipDefault === false) {\n\t\t\t\tlet defaultTabIndex = controllers.findIndex(controller => controller.default)\n\t\t\t\tif (defaultTabIndex === -1) defaultTabIndex = 0\n\t\t\t\tthis.focusIndex = defaultTabIndex\n\t\t\t\tcontrollers[defaultTabIndex].active = true\n\t\t\t} else if (this.focusIndex > -1 && hasOwnProperty(controllers, this.focusIndex)) {\n\t\t\t\tcontrollers[this.focusIndex].active = true\n\t\t\t}\n\t\t\tconst isWrongCombination = controllers.findIndex((controller) => controller.active && controller.disabled)\n\t\t\tif (isWrongCombination > -1) {\n\t\t\t\tcontrollers[isWrongCombination].active = false;\n\t\t\t\tconst firstGoodTab = controllers.findIndex((controller) => !controller.disabled)\n\t\t\t\tif (firstGoodTab > -1) {\n\t\t\t\t\tcontrollers[firstGoodTab].active = true\n\t\t\t\t\tthis.focusIndex = firstGoodTab;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.controllers = [...controllers]\n\t\t\tthis.reRender()\n\t\t})\n\t}\n\n\tprivate setActiveByIdentifier(identifier: string) {\n\t\tconst temp = []\n\t\tthis.controllers.map(item => {\n\t\t\titem.active = identifier === item.triggerIdentifier || identifier === item.contentIdentifier\n\t\t\ttemp.push(item)\n\t\t})\n\t\tthis.controllers = [...temp]\n\t}\n\n\tprivate reRender() {\n\t\tthis.controllers.map(control => {\n\t\t\tcontrol.element.setActiveStatus(control.active).catch()\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TabsClass.root)}\n\t\t\t\tsize={this.size}\n\t\t\t\tcolor={this.color}\n\t\t\t\ttype={this.type}\n\t\t\t\tdirection={this.direction}\n\t\t\t\tonKeyDown={this.onKeydownHandler.bind(this)}\n\t\t\t>\n\t\t\t\t<div class={TabsClass.tabs}\n\t\t\t\t\t role=\"tablist\"\n\t\t\t\t\t {...this.inheritedAttributes}>\n\t\t\t\t\t<ul class={TabsClass.list}>\n\t\t\t\t\t\t{this.controllers.map(control => (\n\t\t\t\t\t\t\t<li class={TabsClass.item}>\n\t\t\t\t\t\t\t\t{this.type == \"text\" ? (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tclass={TabsClass.btn}\n\t\t\t\t\t\t\t\t\t\tid={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\taria-disabled={toBoolAttr(control.disabled)}\n\t\t\t\t\t\t\t\t\t\taria-selected={toBoolAttr(control.active)}\n\t\t\t\t\t\t\t\t\t\taria-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\ttabindex={control.active && !control.disabled ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLButtonElement)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.iconStart ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconStart.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconStart.type}></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t\t{control.iconEnd ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconEnd.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconEnd.type}></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<gov-chip\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\ttag={'button'}\n\t\t\t\t\t\t\t\t\t\tidentifier={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\taria-selected={booleanString(control.active)}\n\t\t\t\t\t\t\t\t\t\taria-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\tfocusable={control.active}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\tcolor={this.color}\n\t\t\t\t\t\t\t\t\t\tsize={this.size === \"xs\" ? \"xs\" : (this.size === \"s\" ? \"s\" : \"m\")}\n\t\t\t\t\t\t\t\t\t\ttype={control.active ? \"solid\" : \"outlined\"}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLGovChipElement)}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.iconStart ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconStart.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconStart.type}\n\t\t\t\t\t\t\t\t\t\t\tslot=\"icon-start\"></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t\t{control.iconEnd ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconEnd.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconEnd.type}\n\t\t\t\t\t\t\t\t\t\t\tslot=\"icon-end\"></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t</gov-chip>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate getCurrentTab(): GovTabControllerItem | null {\n\t\treturn this.controllers.find(control => control.active) || null\n\t}\n\n\tprivate onSelectHandler(control: GovTabControllerItem) {\n\t\tconst index = this.controllers.findIndex(t => t.triggerIdentifier === control.triggerIdentifier);\n\t\tthis.focusIndex = index\n\t\tthis.setActiveByIdentifier(control.triggerIdentifier)\n\t\tthis.reRender()\n\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t}\n\n\tprivate onKeydownHandler(e: KeyboardEvent) {\n\t\tconst keyCode = e.keyCode\n\n\t\te.stopPropagation()\n\t\tthis.goToPrevNext(keyCode)\n\t}\n\n\tprivate goToPrevNext(keyCode: number) {\n\t\tif ([37, 38, 39, 40].includes(keyCode)) {\n\t\t\tif (false === (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.controllers[this.focusIndex].active = false\n\n\t\t\tif (keyCode === 39 || keyCode === 40) {\n\t\t\t\tthis.focusIndex++\n\t\t\t\tif (this.focusIndex >= this.controllers.length) {\n\t\t\t\t\tthis.focusIndex = 0\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(40)\n\t\t\t\t}\n\t\t\t} else if (keyCode === 37 || keyCode === 38) {\n\t\t\t\tthis.focusIndex--\n\t\t\t\tif (this.focusIndex < 0) {\n\t\t\t\t\tthis.focusIndex = this.controllers.length - 1\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(38)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1) {\n\t\t\t\tconst current = this.controllers[this.focusIndex]\n\t\t\t\tcurrent.active = true\n\t\t\t\tconst trigger = this.triggerRefs[current.triggerIdentifier]\n\t\t\t\tif (trigger.nodeName.toLowerCase() === 'gov-chip') {\n\t\t\t\t\t(this.triggerRefs[current.triggerIdentifier] as HTMLGovChipElement).setFocus()\n\t\t\t\t} else {\n\t\t\t\t\tthis.triggerRefs[current.triggerIdentifier].focus()\n\t\t\t\t}\n\n\t\t\t\tthis.controllers = [...this.controllers]\n\t\t\t\tthis.reRender()\n\t\t\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync refresh(): Promise<void> {\n\t\tthis.prepareControllers()\n\t}\n\n\t/**\n\t * Returns the currently selected tabs-item\n\t */\n\t@Method()\n\tasync currentTab(): Promise<Nullable<HTMLGovTabsItemElement>> {\n\t\treturn this.getCurrentTab().element || null\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync setActiveTab(identifier: string): Promise<void> {\n\t\tthis.setActiveByIdentifier(identifier)\n\t\tthis.reRender()\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync rerender(): Promise<void> {\n\t\tthis.prepareControllers(true);\n\t}\n}\n"],"mappings":"ycA2BaA,EAAO,M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U,CAC/ChD,KAAK+G,aAAa,G,OAEb,GAAIF,IAAY,IAAMA,IAAY,GAAI,CAC5C7G,KAAKgE,aACL,GAAIhE,KAAKgE,WAAa,EAAG,CACxBhE,KAAKgE,WAAahE,KAAKiC,YAAYgF,OAAS,C,CAE7C,GAAIjH,KAAKiC,YAAYjC,KAAKgE,YAAYhB,SAAU,CAC/ChD,KAAK+G,aAAa,G,EAIpB,GAAI/G,KAAKgE,YAAc,GAAKhE,KAAKgE,YAAchE,KAAKiC,YAAYgF,OAAS,EAAG,CAC3E,MAAMC,EAAUlH,KAAKiC,YAAYjC,KAAKgE,YACtCkD,EAAQxD,OAAS,KACjB,MAAMyD,EAAUnH,KAAKC,YAAYiH,EAAQnE,mBACzC,GAAIoE,EAAQC,SAASC,gBAAkB,WAAY,CACjDrH,KAAKC,YAAYiH,EAAQnE,mBAA0CuE,U,KAC9D,CACNtH,KAAKC,YAAYiH,EAAQnE,mBAAmBwE,O,CAG7CvH,KAAKiC,YAAc,IAAIjC,KAAKiC,aAC5BjC,KAAKoE,WACLpE,KAAK0G,UAAUC,KAAK3G,KAAKsG,gBAAgB7C,Q,GAS5C,aAAM+D,GACLxH,KAAKuB,oB,CAON,gBAAMkG,GACL,OAAOzH,KAAKsG,gBAAgB7C,SAAW,I,CAOxC,kBAAMiE,CAAa5E,GAClB9C,KAAKqE,sBAAsBvB,GAC3B9C,KAAKoE,U,CAON,cAAMuD,GACL3H,KAAKuB,mBAAmB,K","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GovTabs","constructor","hostRef","this","triggerRefs","h","govHost","host","validateType","newValue","validateProp","TabTypes","TabsClass","root","validateColor","TabColors","validateSize","TabSizes","componentDidLoad","attributeObserver","AttributeObserver","attributeName","onAriaAttributeChange","startObserving","ariaAttributes","componentWillLoad","prepareControllers","size","inheritedAttributes","inheritAriaAttributes","disconnectedCallback","stopObserving","removeAttribute","Object","assign","skipDefault","controllers","promises","querySelectorAll","TabsItemClass","forEach","tab","controlItem","Promise","all","getIdentifier","getTriggerIdentifier","getDisableState","then","identifier","triggerIdentifier","disabled","isDefault","getAttribute","iconStart","prepareIconFormat","iconEnd","label","direction","contentIdentifier","element","active","default","push","defaultTabIndex","findIndex","controller","focusIndex","hasOwnProperty","isWrongCombination","firstGoodTab","reRender","setActiveByIdentifier","temp","map","item","control","setActiveStatus","catch","render","Host","key","class","classes","color","type","onKeyDown","onKeydownHandler","bind","tabs","role","list","btn","id","onClick","onSelectHandler","toBoolAttr","tabindex","ref","el","name","tag","booleanString","focusable","slot","getCurrentTab","find","index","t","govChange","emit","e","keyCode","stopPropagation","goToPrevNext","includes","length","current","trigger","nodeName","toLowerCase","setFocus","focus","refresh","currentTab","setActiveTab","rerender"],"sources":["../../../packages/core/src/components/gov-tabs/gov-tabs.tsx"],"sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tColorType,\n\tTabColors,\n\tTabOrientationType,\n\tTabsClass,\n\tTabsItemClass,\n\tTabSizes,\n\tTabSizeType,\n\tTabType,\n\tTabTypes\n} from \"./constants\"\nimport {GovTabControllerItem} from \"./gov-tabs.types\"\nimport {booleanString, govHost, toBoolAttr} from \"../../helpers/Dom/template\"\nimport {Nullable} from \"../../types/interfaces\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {hasOwnProperty} from \"../../utils/helpers.types\";\nimport {prepareIconFormat} from \"../gov-icon/helpers\";\nimport {AttributeObserver, Attributes} from \"../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../helpers/Accessibility/accessibility\";\n\n\n@Component({\n\ttag: \"gov-tabs\",\n})\nexport class GovTabs {\n\tprivate h: GovHost\n\tprivate triggerRefs: Record<string, HTMLButtonElement | HTMLGovChipElement> = {}\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTabsElement\n\t/**\n\t * Tabs type\n\t */\n\t@Prop() readonly type: TabType = \"text\"\n\t/**\n\t * Tabs size.\n\t */\n\t@Prop() readonly size?: TabSizeType = 'm'\n\t/**\n\t * Style variation of the tab chips.\n\t */\n\t@Prop() readonly color?: ColorType = \"primary\"\n\t/**\n\t * Tabs orientation\n\t */\n\t@Prop() readonly orientation: TabOrientationType = \"horizontal\"\n\t/**\n\t * Icon and description display direction\n\t */\n\t@Prop({reflect: true}) readonly direction: 'row' | 'column' = 'row'\n\t/**\n\t * Emitted when the tab is changed.\n\t */\n\t@Event({eventName: \"gov-change\"}) govChange: EventEmitter<HTMLGovTabsItemElement>\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(TabTypes, newValue, TabsClass.root)\n\t}\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TabColors, newValue, TabsClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TabSizes, newValue, TabsClass.root)\n\t}\n\n\t@State() controllers: GovTabControllerItem[] = []\n\t@State() focusIndex = 0\n\t@State() inheritedAttributes: Attributes = {}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.prepareControllers()\n\t\tthis.validateSize(this.size)\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tprivate prepareControllers(skipDefault = false): void {\n\t\tthis.controllers = []\n\t\tconst promises: Promise<GovTabControllerItem>[] = []\n\t\tthis.host.querySelectorAll(TabsItemClass.root).forEach((tab: HTMLGovTabsItemElement) => {\n\t\t\tconst controlItem = Promise.all([\n\t\t\t\ttab.getIdentifier(),\n\t\t\t\ttab.getTriggerIdentifier(),\n\t\t\t\ttab.getDisableState()\n\t\t\t]).then(([identifier, triggerIdentifier, disabled]) => {\n\t\t\t\tconst isDefault = typeof tab.getAttribute(\"default\") === \"string\"\n\t\t\t\tconst iconStart = prepareIconFormat(tab.getAttribute('icon-start'))\n\t\t\t\tconst iconEnd = prepareIconFormat(tab.getAttribute('icon-end'))\n\t\t\t\treturn {\n\t\t\t\t\tlabel: tab.getAttribute(\"label\"),\n\t\t\t\t\tdirection: tab.getAttribute(\"direction\"),\n\t\t\t\t\tcontentIdentifier: identifier,\n\t\t\t\t\tdisabled: disabled,\n\t\t\t\t\ttriggerIdentifier: triggerIdentifier,\n\t\t\t\t\telement: tab,\n\t\t\t\t\tactive: false,\n\t\t\t\t\tdefault: isDefault,\n\t\t\t\t\ticonStart,\n\t\t\t\t\ticonEnd\n\t\t\t\t}\n\t\t\t})\n\t\t\tpromises.push(controlItem)\n\t\t});\n\t\tPromise.all(promises).then(controllers => {\n\t\t\tif (skipDefault === false) {\n\t\t\t\tlet defaultTabIndex = controllers.findIndex(controller => controller.default)\n\t\t\t\tif (defaultTabIndex === -1) defaultTabIndex = 0\n\t\t\t\tthis.focusIndex = defaultTabIndex\n\t\t\t\tcontrollers[defaultTabIndex].active = true\n\t\t\t} else if (this.focusIndex > -1 && hasOwnProperty(controllers, this.focusIndex)) {\n\t\t\t\tcontrollers[this.focusIndex].active = true\n\t\t\t}\n\t\t\tconst isWrongCombination = controllers.findIndex((controller) => controller.active && controller.disabled)\n\t\t\tif (isWrongCombination > -1) {\n\t\t\t\tcontrollers[isWrongCombination].active = false;\n\t\t\t\tconst firstGoodTab = controllers.findIndex((controller) => !controller.disabled)\n\t\t\t\tif (firstGoodTab > -1) {\n\t\t\t\t\tcontrollers[firstGoodTab].active = true\n\t\t\t\t\tthis.focusIndex = firstGoodTab;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.controllers = [...controllers]\n\t\t\tthis.reRender()\n\t\t})\n\t}\n\n\tprivate setActiveByIdentifier(identifier: string) {\n\t\tconst temp = []\n\t\tthis.controllers.map(item => {\n\t\t\titem.active = identifier === item.triggerIdentifier || identifier === item.contentIdentifier\n\t\t\ttemp.push(item)\n\t\t})\n\t\tthis.controllers = [...temp]\n\t}\n\n\tprivate reRender() {\n\t\tthis.controllers.map(control => {\n\t\t\tcontrol.element.setActiveStatus(control.active).catch()\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TabsClass.root)}\n\t\t\t\tsize={this.size}\n\t\t\t\tcolor={this.color}\n\t\t\t\ttype={this.type}\n\t\t\t\tdirection={this.direction}\n\t\t\t\tonKeyDown={this.onKeydownHandler.bind(this)}\n\t\t\t>\n\t\t\t\t<div class={TabsClass.tabs}\n\t\t\t\t\t role=\"tablist\"\n\t\t\t\t\t {...this.inheritedAttributes}>\n\t\t\t\t\t<ul class={TabsClass.list}>\n\t\t\t\t\t\t{this.controllers.map(control => (\n\t\t\t\t\t\t\t<li class={TabsClass.item}>\n\t\t\t\t\t\t\t\t{this.type == \"text\" ? (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tclass={TabsClass.btn}\n\t\t\t\t\t\t\t\t\t\tid={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\taria-disabled={toBoolAttr(control.disabled)}\n\t\t\t\t\t\t\t\t\t\taria-selected={toBoolAttr(control.active)}\n\t\t\t\t\t\t\t\t\t\taria-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\ttabindex={control.active && !control.disabled ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLButtonElement)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.iconStart ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconStart.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconStart.type}></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t\t{control.iconEnd ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconEnd.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconEnd.type}></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<gov-chip\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\ttag={'button'}\n\t\t\t\t\t\t\t\t\t\tidentifier={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\taria-selected={booleanString(control.active)}\n\t\t\t\t\t\t\t\t\t\taria-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\tfocusable={control.active}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\tcolor={this.color}\n\t\t\t\t\t\t\t\t\t\tsize={this.size === \"xs\" ? \"xs\" : (this.size === \"s\" ? \"s\" : \"m\")}\n\t\t\t\t\t\t\t\t\t\ttype={control.active ? \"solid\" : \"outlined\"}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLGovChipElement)}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.iconStart ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconStart.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconStart.type}\n\t\t\t\t\t\t\t\t\t\t\tslot=\"icon-start\"></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t\t{control.iconEnd ? (<gov-icon\n\t\t\t\t\t\t\t\t\t\t\tname={control.iconEnd.name}\n\t\t\t\t\t\t\t\t\t\t\ttype={control.iconEnd.type}\n\t\t\t\t\t\t\t\t\t\t\tslot=\"icon-end\"></gov-icon>) : null}\n\t\t\t\t\t\t\t\t\t</gov-chip>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate getCurrentTab(): GovTabControllerItem | null {\n\t\treturn this.controllers.find(control => control.active) || null\n\t}\n\n\tprivate onSelectHandler(control: GovTabControllerItem) {\n\t\tconst index = this.controllers.findIndex(t => t.triggerIdentifier === control.triggerIdentifier);\n\t\tthis.focusIndex = index\n\t\tthis.setActiveByIdentifier(control.triggerIdentifier)\n\t\tthis.reRender()\n\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t}\n\n\tprivate onKeydownHandler(e: KeyboardEvent) {\n\t\tconst keyCode = e.keyCode\n\n\t\te.stopPropagation()\n\t\tthis.goToPrevNext(keyCode)\n\t}\n\n\tprivate goToPrevNext(keyCode: number) {\n\t\tif ([37, 38, 39, 40].includes(keyCode)) {\n\t\t\tif (false === (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.controllers[this.focusIndex].active = false\n\n\t\t\tif (keyCode === 39 || keyCode === 40) {\n\t\t\t\tthis.focusIndex++\n\t\t\t\tif (this.focusIndex >= this.controllers.length) {\n\t\t\t\t\tthis.focusIndex = 0\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(40)\n\t\t\t\t}\n\t\t\t} else if (keyCode === 37 || keyCode === 38) {\n\t\t\t\tthis.focusIndex--\n\t\t\t\tif (this.focusIndex < 0) {\n\t\t\t\t\tthis.focusIndex = this.controllers.length - 1\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(38)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1) {\n\t\t\t\tconst current = this.controllers[this.focusIndex]\n\t\t\t\tcurrent.active = true\n\t\t\t\tconst trigger = this.triggerRefs[current.triggerIdentifier]\n\t\t\t\tif (trigger.nodeName.toLowerCase() === 'gov-chip') {\n\t\t\t\t\t(this.triggerRefs[current.triggerIdentifier] as HTMLGovChipElement).setFocus()\n\t\t\t\t} else {\n\t\t\t\t\tthis.triggerRefs[current.triggerIdentifier].focus()\n\t\t\t\t}\n\n\t\t\t\tthis.controllers = [...this.controllers]\n\t\t\t\tthis.reRender()\n\t\t\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync refresh(): Promise<void> {\n\t\tthis.prepareControllers()\n\t}\n\n\t/**\n\t * Returns the currently selected tabs-item\n\t */\n\t@Method()\n\tasync currentTab(): Promise<Nullable<HTMLGovTabsItemElement>> {\n\t\treturn this.getCurrentTab().element || null\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync setActiveTab(identifier: string): Promise<void> {\n\t\tthis.setActiveByIdentifier(identifier)\n\t\tthis.reRender()\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync rerender(): Promise<void> {\n\t\tthis.prepareControllers(true);\n\t}\n}\n"],"mappings":"mdA2BaA,EAAO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AAU,CAC/ChD,KAAK+G,aAAa,G,OAEb,GAAIF,IAAY,IAAMA,IAAY,GAAI,CAC5C7G,KAAKgE,aACL,GAAIhE,KAAKgE,WAAa,EAAG,CACxBhE,KAAKgE,WAAahE,KAAKiC,YAAYgF,OAAS,C,CAE7C,GAAIjH,KAAKiC,YAAYjC,KAAKgE,YAAYhB,SAAU,CAC/ChD,KAAK+G,aAAa,G,EAIpB,GAAI/G,KAAKgE,YAAc,GAAKhE,KAAKgE,YAAchE,KAAKiC,YAAYgF,OAAS,EAAG,CAC3E,MAAMC,EAAUlH,KAAKiC,YAAYjC,KAAKgE,YACtCkD,EAAQxD,OAAS,KACjB,MAAMyD,EAAUnH,KAAKC,YAAYiH,EAAQnE,mBACzC,GAAIoE,EAAQC,SAASC,gBAAkB,WAAY,CACjDrH,KAAKC,YAAYiH,EAAQnE,mBAA0CuE,U,KAC9D,CACNtH,KAAKC,YAAYiH,EAAQnE,mBAAmBwE,O,CAG7CvH,KAAKiC,YAAc,IAAIjC,KAAKiC,aAC5BjC,KAAKoE,WACLpE,KAAK0G,UAAUC,KAAK3G,KAAKsG,gBAAgB7C,Q,GAS5C,aAAM+D,GACLxH,KAAKuB,oB,CAON,gBAAMkG,GACL,OAAOzH,KAAKsG,gBAAgB7C,SAAW,I,CAOxC,kBAAMiE,CAAa5E,GAClB9C,KAAKqE,sBAAsBvB,GAC3B9C,KAAKoE,U,CAON,cAAMuD,GACL3H,KAAKuB,mBAAmB,K","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,d as i,h as s,a as e,g as o}from"./p-5fbde4f9.js";import{g as r,c as n}from"./p-ea7fdd2e.js";import{c}from"./p-cd6c2938.js";import{B as a}from"./p-3bbb77a0.js";import"./p-92f420cb.js";import"./p-5aad3497.js";import"./p-e0e2e9c1.js";const h={triggerEvents:"click",exclude:""};function d(t,i,s,e=h){const o=p(e);f(e).forEach((e=>{window.addEventListener(e,(e=>{l(e,t,i,s,o)}),false)}))}function l(t,i,s,e,o){const r=t.target;if(!s.contains(r)&&!u(r,o)){e.call(i)}}function f(t){if(t.triggerEvents){return t.triggerEvents.split(",").map((t=>t.trim()))}return["click"]}function p(t){if(t.exclude){try{return Array.from(document.querySelectorAll(t.exclude))}catch(i){console.warn(`@ClickOutside: Exclude: '${t.exclude}' will not be evaluated. Check your exclude selector syntax.`,i)}}return}function u(t,i){if(t&&i){for(let s of i){if(s.contains(t)){return true}}}return false}var g;(function(t){t["LEFT"]="left";t["RIGHT"]="right"})(g||(g={}));const v={root:"gov-dropdown",list:"gov-dropdown__list"};const m=class{constructor(s){t(this,s);this.govChange=i(this,"gov-change",7);this.identifier=undefined;this.open=false;this.position=g.LEFT;this.h=r(this.host);this.listId=c("GovDropdownList");this.controlId=c("GovDropdownControl")}watchOpen(){var t;(t=this.trigger)===null||t===void 0?void 0:t.setAttribute("aria-expanded",n(this.open))}get trigger(){return this.host.querySelector(`* > ${a.root}`)}get list(){return this.h.getSlot("list")}componentWillLoad(){var t;if(!this.trigger)return;this.trigger.setAttribute("aria-controls",this.listId);this.trigger.setAttribute("aria-haspopup",n(!!this.list));this.trigger.setAttribute("aria-expanded",n(this.open));this.trigger.setAttribute("identifier",(t=this.identifier)!==null&&t!==void 0?t:this.controlId);this.trigger.addEventListener("gov-click",(t=>{t.preventDefault();t.stopPropagation();this.open=!this.open;this.govChange.emit({component:v.root,originalEvent:t,open:this.open})}))}render(){return s(e,{key:"43c2a03dcb27ebe54f8dd00ca1120b848cac957c",class:this.h.classes([v.root]),open:this.open,position:this.position},s("slot",{key:"732c956fe37283578a95c843cf94ad590cd16402"}),s("div",{key:"c3934a0f7c8303950a5c7898574fcea2e14e1890",ref:t=>d(this,t,(()=>this.open=false)),class:v.list,id:this.listId,"aria-labelledby":this.controlId,"aria-hidden":n(!this.open),hidden:!this.open},s("slot",{key:"cb685039c57f9d32ae7c238fcb7457fe72b4c9c4",name:"list"})))}async getState(){return this.open}async toggle(){this.open=!this.open}get host(){return o(this)}static get watchers(){return{open:["watchOpen"]}}};export{m as gov_dropdown};
|
|
2
|
+
//# sourceMappingURL=p-eeee2325.entry.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as t,d as i,h as s,a as e,g as h}from"./p-5fbde4f9.js";import{g as a,l as n,m as o}from"./p-da1db6fd.js";import{g as r,c,t as d,d as l}from"./p-ea7fdd2e.js";import{v as f}from"./p-0b3574c2.js";import{c as p}from"./p-cd6c2938.js";import{A as u,a as m}from"./p-9ac55bd1.js";import{i as b}from"./p-d9a299a4.js";import{p as v}from"./p-e0e2e9c1.js";import{S as g}from"./p-92f420cb.js";import{C as y}from"./p-5aad3497.js";import"./p-7f3becc5.js";import"./p-56efd4a2.js";import"./p-7ba4daf4.js";import"./p-e8ec030e.js";var k;(function(t){t["INPUT"]="input";t["TEXTAREA"]="textarea"})(k||(k={}));const j=class{constructor(s){t(this,s);this.govFocus=i(this,"gov-focus",7);this.govBlur=i(this,"gov-blur",7);this.govInput=i(this,"gov-input",7);this.govKeyUp=i(this,"gov-keyup",7);this.govHydrated=i(this,"gov-hydrated",7);this.govKeyDown=i(this,"gov-keydown",7);this.value=undefined;this.identifier=undefined;this.success=undefined;this.size="m";this.name=undefined;this.multiline=undefined;this.rows=undefined;this.cols=undefined;this.required=false;this.disabled=false;this.placeholder=undefined;this.readonly=undefined;this.minlength=undefined;this.maxlength=undefined;this.min=undefined;this.max=undefined;this.autocomplete=undefined;this.autocorrect=undefined;this.spellcheck=undefined;this.inputLang=undefined;this.type=undefined;this.inputType="text";this.role=undefined;this.invalid=undefined;this.accessibleShowPasswordLabel="Zobrazit heslo";this.accessibleHidePasswordLabel="Skrýt heslo";this.focused=undefined;this.showPassword=false;this.inheritedAttributes={};this.h=r(this.host);this.inputId=p("GovInput");this.f=a(this.h)}validateSize(t){f(o,t,n.root)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("success",c(this.success));this.f.passAttrToControl("disabled",c(this.disabled));this.f.passAttrToControl("invalid",c(this.invalid));this.f.passAttrToControl("type",this.multiline?k.TEXTAREA:k.INPUT)}componentDidLoad(){this.attributeObserver=new u(this.host,((t,i)=>{this.onAriaAttributeChange(t,i)}));this.attributeObserver.startObserving(m);this.govHydrated.emit()}componentWillLoad(){this.validateSize(this.size);this.inheritedAttributes=b(this.host)}componentDidRender(){this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required))}onAriaAttributeChange(t,i){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:i})}disconnectedCallback(){this.attributeObserver.stopObserving()}render(){const t=this.multiline?k.TEXTAREA:k.INPUT;return s(e,{key:"8b60864f0792fe1946d4b7cb6489cff0ffc767e1",class:n.root,size:this.size,type:this.type},this.h.hasSlot("prefix")&&s("slot",{key:"4d5d0bb755acbb42033f572633e4969c8e6e8b36",name:"prefix"}),s("span",{key:"eaac4a690052077ca631ae1e9c69a65518a1902f",class:"element"},this.h.hasSlot("icon-start")&&!this.multiline&&s("div",{key:"e8be567c923c023bce7d0ebf0cccff592ac15c5a",class:n.icons,onClick:()=>this.inputRef.focus()},s("slot",{key:"4c76013e8a7db99b43e7b8f426f3907d89708b5a",name:"icon-start"})),s(t,Object.assign({key:"22e1714e66085290e7fe984a4672512324143397",type:this.inputType==="password"&&this.showPassword?"text":this.inputType,disabled:this.disabled,id:this.identifier||this.inputId,name:this.name,onFocus:this.onFocusHandler.bind(this),onInput:this.onInputHandler.bind(this),onBlur:this.onBlurHandler.bind(this),onKeyUp:this.onKeyUpHandler.bind(this),onKeyDown:this.onKeyDownHandler.bind(this),ref:t=>this.inputRef=t,placeholder:this.placeholder,spellcheck:d(this.spellcheck),lang:this.inputLang,readonly:d(this.readonly),autocomplete:l(this.autocomplete),autocorrect:l(this.autocorrect),minlength:this.minlength,maxlength:this.maxlength,min:this.min,max:this.max,required:this.required,rows:this.rows,cols:this.cols,role:this.role,value:this.value},this.inheritedAttributes,{"aria-required":d(this.required),"aria-invalid":d(this.invalid),"aria-disabled":d(this.disabled)})),(this.success||this.invalid||this.h.hasSlot("icon-end")||this.inputType==="password")&&!this.multiline&&s("div",{key:"19ab7fe83fcecde7a506f21611fae64126464b88",class:n.icons,onClick:()=>this.inputRef.focus()},this.success&&!this.multiline&&s("gov-icon",{key:"9dd7b8413b351d957a63f7df09aee8b6e3e0ac53",class:"validation-icon",name:"check-lg",type:"components"}),this.invalid&&!this.multiline&&s("gov-icon",{key:"06540c7f7cf3c0fbdab8b5a63aba35cf7a78df3a",class:"validation-icon",name:"exclamation-lg",type:"components"}),this.h.hasSlot("icon-end")&&this.inputType!=="password"&&s("slot",{key:"8cb1103f101fa9bd5719f1657ae1a404fc3882f4",name:"icon-end"}),this.inputType==="password"?s("gov-button",{color:"primary",type:"base",size:this.size,"aria-label":this.showPassword?this.accessibleHidePasswordLabel:this.accessibleShowPasswordLabel,"on-gov-click":()=>this.showPassword=!this.showPassword},s("gov-icon",{slot:"icon-start",name:"eye",type:"components"})):null)),this.h.hasSlot("sufix")&&s("slot",{key:"78308cfef71f34839d86af88df5dadb28c01adf1",name:"sufix"}))}onFocusHandler(t){t.stopPropagation();this.focused=true;this.govFocus.emit({component:n.root,value:this.value,originalEvent:t})}onBlurHandler(t){t.stopPropagation();this.focused=false;this.govBlur.emit({component:n.root,value:this.value,originalEvent:t})}onKeyUpHandler(t){t.stopPropagation();this.govKeyUp.emit({component:n.root,value:this.value,originalEvent:t})}onKeyDownHandler(t){t.stopPropagation();this.govKeyDown.emit({component:n.root,value:this.value,originalEvent:t})}onInputHandler(t){this.value=t.target.value;t.stopPropagation();this.govInput.emit({component:n.root,value:this.value,originalEvent:t})}async setFocus(t){return this.inputRef.focus(t)}async setValue(t){this.value=t}async clearValue(){this.value="";this.inputRef.value=""}async getRef(){return this.inputRef}get host(){return h(this)}static get watchers(){return{size:["validateSize","watchControlAttrs"],disabled:["watchControlAttrs"],invalid:["watchControlAttrs"],success:["watchControlAttrs"]}}};const w=v(g,["_XS","_S","_M","_L","_XL"]);v(y,["PRIMARY","NEUTRAL"]);var A;(function(t){t["CIRCLE"]="circle";t["LINE"]="line"})(A||(A={}));var x;(function(t){t["PULSE"]="pulse";t["PROGRESS"]="progress";t["FALSE"]="false"})(x||(x={}));const C={root:"gov-skeleton"};const z=class{constructor(i){t(this,i);this.items=[];this.size="m";this.color="neutral";this.shape="line";this.width=null;this.height=null;this.animation="progress";this.inheritedAttributes={};this.h=r(this.host)}validateSize(t){f(w,t,C.root)}validateShape(t){f(A,t,C.root)}validateAnimation(t){f(x,t,C.root)}componentDidLoad(){this.attributeObserver=new u(this.host,((t,i)=>{this.onAriaAttributeChange(t,i)}));this.attributeObserver.startObserving(m)}componentWillLoad(){this.validateSize(this.size);this.validateShape(this.shape);this.validateAnimation(this.animation);this.init();this.inheritedAttributes=b(this.host)}componentWillUpdate(){this.init()}disconnectedCallback(){this.attributeObserver.stopObserving()}onAriaAttributeChange(t,i){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:i})}init(){this.items.fill(1)}get style(){const t={width:null,height:null};if(this.width){t.width=this.width}if(this.height){t.height=this.height}return Object.assign({},t)}render(){return s(e,Object.assign({key:"175dad78f57ee2e44fe3097e0595f59254e1003b",size:this.size,color:this.color,class:{[C.root]:true,circle:this.shape==="circle",line:this.shape==="line",progress:this.animation==="progress",pulse:this.animation==="pulse"}},this.inheritedAttributes,{"aria-busy":"true","aria-valuemin":"0","aria-valuemax":"100",role:"progressbar",tabindex:"0",style:this.style}))}get host(){return h(this)}static get watchers(){return{size:["validateSize"],shape:["validateShape"],animation:["validateAnimation"]}}};export{j as gov_form_input,z as gov_skeleton};
|
|
2
|
+
//# sourceMappingURL=p-f83b9da5.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Tags","GovFormInput","constructor","hostRef","this","h","govHost","host","inputId","createID","f","govForm","validateSize","newValue","validateProp","FormInputSizes","FormInputClass","root","watchControlAttrs","passControlAttrs","passAttrToControl","size","toBoolAttr","success","disabled","invalid","multiline","TEXTAREA","INPUT","componentDidLoad","attributeObserver","AttributeObserver","attributeName","onAriaAttributeChange","startObserving","ariaAttributes","govHydrated","emit","componentWillLoad","inheritedAttributes","inheritAriaAttributes","componentDidRender","passAttrToLabel","String","required","removeAttribute","Object","assign","disconnectedCallback","stopObserving","render","Tag","Host","key","class","type","hasSlot","name","icons","onClick","inputRef","focus","inputType","showPassword","id","identifier","onFocus","onFocusHandler","bind","onInput","onInputHandler","onBlur","onBlurHandler","onKeyUp","onKeyUpHandler","onKeyDown","onKeyDownHandler","ref","el","placeholder","spellcheck","toBoolAttrIfDefined","lang","inputLang","readonly","autocomplete","toOnOffAttrIfDefined","autocorrect","minlength","maxlength","min","max","rows","cols","role","value","color","accessibleHidePasswordLabel","accessibleShowPasswordLabel","slot","e","stopPropagation","focused","govFocus","component","originalEvent","govBlur","govKeyUp","govKeyDown","target","govInput","setFocus","options","setValue","clearValue","getRef","SkeletonSizes","pick","Sizes","Colors","SkeletonShapes","SkeletonAnimation","SkeletonClass","GovSkeleton","items","validateShape","validateAnimation","shape","animation","init","componentWillUpdate","fill","style","dimenssionsStyles","width","height","circle","line","progress","pulse","tabindex"],"sources":["../../../packages/core/src/components/gov-form/input/gov-form-input.tsx","../../../packages/core/src/components/gov-loading/skeleton/constants.ts","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.tsx"],"sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined, toOnOffAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {validateProp} from \"../../../helpers/Validate/props\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormInputClass, FormInputSizes, FormInputSizesType, InputType, Type,} from \"./constants\"\nimport {FormInputEvent} from \"./gov-form-input.types\"\nimport {Nullable} from \"../../../types/interfaces\"\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\nenum Tags {\n\tINPUT = \"input\",\n\tTEXTAREA = \"textarea\",\n}\n\n@Component({\n\ttag: \"gov-form-input\",\n})\nexport class GovFormInput {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly inputId: string\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.inputId = createID(\"GovInput\")\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormInputElement\n\t/**\n\t * Value of input\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string\n\t/**\n\t * Custom input identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop({reflect:true}) readonly success: boolean\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = \"m\"\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Generates a texarea for the possibility of multiple lines\n\t */\n\t@Prop() readonly multiline: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n\t */\n\t@Prop() readonly rows: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols\n\t */\n\t@Prop() readonly cols: number\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop({reflect:true}) readonly required: boolean = false\n\t/**\n\t * Makes the input component disabled.\n\t */\n\t@Prop({reflect:true}) readonly disabled: boolean = false\n\t/**\n\t * Text that appears in the form control when it has no value set\n\t */\n\t@Prop() readonly placeholder: string\n\t/**\n\t * The value is not editable\n\t */\n\t@Prop() readonly readonly: boolean\n\t/**\n\t * Minimum length (number of characters) of value\n\t */\n\t@Prop() readonly minlength: number\n\t/**\n\t * Maximum length (number of characters) of value\n\t */\n\t@Prop() readonly maxlength: number\n\t/**\n\t * Minimum value that is acceptable and valid for the input containing the attribute\n\t */\n\t@Prop() readonly min?: string | number\n\t/**\n\t * Maximum value that is acceptable and valid for the input containing the attribute\n\t */\n\t@Prop() readonly max?: string | number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocomplete\n\t */\n\t@Prop() readonly autocomplete: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocorrect\n\t */\n\t@Prop() readonly autocorrect: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck\n\t */\n\t@Prop() readonly spellcheck: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\n\t */\n\t@Prop({attribute: \"input-lang\"}) readonly inputLang: string\n\t/**\n\t * Defined the visual style of input\n\t */\n\t@Prop() readonly type?: Type\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n\t */\n\t@Prop({attribute: \"input-type\"}) readonly inputType: InputType = \"text\"\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role\n\t */\n\t@Prop() readonly role: Nullable<string>\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop({reflect:true}) readonly invalid: boolean\n\t/**\n\t * Accessible text for password display\n\t */\n\t@Prop({attribute: \"accessible-show-password-label\"}) readonly accessibleShowPasswordLabel = 'Zobrazit heslo'\n\t/**\n\t * Accessible text to hide the password\n\t */\n\t@Prop({attribute: \"accessible-hide-password-label\"}) readonly accessibleHidePasswordLabel = 'Skrýt heslo'\n\t/**\n\t * Emitted when the input has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-input\"}) govInput: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-keyup\"}) govKeyUp: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-hydrated\"}) govHydrated: EventEmitter<void>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-keydown\"}) govKeyDown: EventEmitter<FormInputEvent>\n\t@State() focused: boolean\n\t@State() showPassword: boolean = false\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormInputSizes, newValue, FormInputClass.root)\n\t}\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\t@Watch(\"success\")\n\t@Watch(\"size\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"size\", this.size)\n\t\tthis.f.passAttrToControl(\"success\", toBoolAttr(this.success))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"type\", this.multiline ? Tags.TEXTAREA : Tags.INPUT)\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t\tthis.govHydrated.emit();\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tcomponentDidRender() {\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\trender() {\n\t\tconst Tag = this.multiline ? Tags.TEXTAREA : Tags.INPUT\n\n\t\treturn (\n\t\t\t<Host class={FormInputClass.root} size={this.size} type={this.type}>\n\t\t\t\t{this.h.hasSlot(\"prefix\") && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t{(this.h.hasSlot(\"icon-start\") && !this.multiline) &&\n\t\t\t\t\t\t<div class={FormInputClass.icons} onClick={() => this.inputRef.focus()}>\n\t\t\t\t\t\t\t<slot name=\"icon-start\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\ttype={this.inputType === 'password' && this.showPassword ? 'text' : this.inputType}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tid={this.identifier || this.inputId}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonInput={this.onInputHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\tonKeyUp={this.onKeyUpHandler.bind(this)}\n\t\t\t\t\t\tonKeyDown={this.onKeyDownHandler.bind(this)}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\tspellcheck={toBoolAttrIfDefined(this.spellcheck)}\n\t\t\t\t\t\tlang={this.inputLang}\n\t\t\t\t\t\treadonly={toBoolAttrIfDefined(this.readonly)}\n\t\t\t\t\t\tautocomplete={toOnOffAttrIfDefined(this.autocomplete)}\n\t\t\t\t\t\tautocorrect={toOnOffAttrIfDefined(this.autocorrect)}\n\t\t\t\t\t\tminlength={this.minlength}\n\t\t\t\t\t\tmaxlength={this.maxlength}\n\t\t\t\t\t\tmin={this.min}\n\t\t\t\t\t\tmax={this.max}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\trows={this.rows}\n\t\t\t\t\t\tcols={this.cols}\n\t\t\t\t\t\trole={this.role}\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t{...this.inheritedAttributes}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t{((this.success || this.invalid || this.h.hasSlot(\"icon-end\") || this.inputType === 'password') && !this.multiline) &&\n\t\t\t\t\t\t<div class={FormInputClass.icons} onClick={() => this.inputRef.focus()}>\n\t\t\t\t\t\t\t{this.success && !this.multiline &&\n\t\t\t\t\t\t\t\t<gov-icon class=\"validation-icon\" name=\"check-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t\t\t{this.invalid && !this.multiline &&\n\t\t\t\t\t\t\t\t<gov-icon class=\"validation-icon\" name=\"exclamation-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t\t\t{this.h.hasSlot(\"icon-end\") && this.inputType !== 'password' && <slot name=\"icon-end\"/>}\n\t\t\t\t\t\t\t{this.inputType === 'password' ? (\n\t\t\t\t\t\t\t\t<gov-button color={'primary'}\n\t\t\t\t\t\t\t\t\t\t\ttype={'base'}\n\t\t\t\t\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\t\t\t\t\taria-label={this.showPassword ? this.accessibleHidePasswordLabel : this.accessibleShowPasswordLabel}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.showPassword = !this.showPassword}>\n\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon-start\" name=\"eye\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t</gov-button>) : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot(\"sufix\") && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onKeyUpHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\tthis.govKeyUp.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onKeyDownHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\tthis.govKeyDown.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: InputEvent) {\n\t\tthis.value = (e.target as HTMLInputElement).value\n\t\te.stopPropagation()\n\t\tthis.govInput.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.inputRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Clears input value\n\t */\n\t@Method()\n\tasync clearValue(): Promise<void> {\n\t\tthis.value = \"\"\n\t\tthis.inputRef.value = \"\"\n\t}\n\n\t/**\n\t * Returns an instance of the native html input element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n}\n","import { pick } from \"../../../utils/utils\"\nimport { ValueOf } from \"../../../types/interfaces\"\nimport {Sizes} from \"../../../core/constants/sizes\";\nimport {Colors} from \"../../../core/constants/colors\";\n\nexport const SkeletonSizes = pick(Sizes, ['_XS', '_S', '_M', '_L', '_XL'])\nexport type SkeletonSizesType = `${ValueOf<typeof SkeletonSizes>}`\n\nexport const SkeletonColors = pick(Colors, [\"PRIMARY\", \"NEUTRAL\"])\nexport type SkeletonColorType = `${ValueOf<typeof SkeletonColors>}`\n\nexport enum SkeletonShapes {\n\tCIRCLE = 'circle',\n\tLINE = 'line'\n}\nexport type SkeletonShapesType = `${ValueOf<typeof SkeletonShapes>}`\n\nexport enum SkeletonAnimation {\n\tPULSE = 'pulse',\n\tPROGRESS = 'progress',\n\tFALSE = 'false'\n}\nexport type SkeletonAnimationType = `${ValueOf<typeof SkeletonAnimation>}`\n\nexport const SkeletonClass = {\n\troot: 'gov-skeleton',\n}\n","import {Component, Element, h, Host, Prop, State, Watch} from \"@stencil/core\"\nimport {\n\tSkeletonAnimation,\n\tSkeletonAnimationType,\n\tSkeletonClass,\n\tSkeletonColorType,\n\tSkeletonShapes,\n\tSkeletonShapesType,\n\tSkeletonSizes,\n} from \"./constants\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govHost} from \"../../../helpers/Dom/template\"\nimport {validateProp} from \"../../../helpers/Validate/props\"\nimport {FormInputSizesType} from \"../../gov-form/input/constants\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\n@Component({\n\ttag: \"gov-skeleton\",\n})\nexport class GovSkeleton {\n\th: GovHost\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovSkeletonElement\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = \"m\"\n\t/**\n\t * Style variation of the skeleton.\n\t */\n\t@Prop() readonly color?: SkeletonColorType = \"neutral\"\n\t/**\n\t * Shape of the skeleton\n\t */\n\t@Prop() shape?: SkeletonShapesType = \"line\"\n\t/**\n\t * Width of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() width: string = null\n\t/**\n\t * Height of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() height: string = null\n\t/**\n\t * Animation type\n\t */\n\t@Prop() animation?: SkeletonAnimationType = \"progress\"\n\n\titems: number[] = []\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(SkeletonSizes, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('shape')\n\tvalidateShape(newValue: string): void {\n\t\tvalidateProp(SkeletonShapes, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('animation')\n\tvalidateAnimation(newValue: string): void {\n\t\tvalidateProp(SkeletonAnimation, newValue, SkeletonClass.root)\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\t\tthis.validateShape(this.shape)\n\t\tthis.validateAnimation(this.animation)\n\t\tthis.init()\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tcomponentWillUpdate() {\n\t\tthis.init()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tinit() {\n\t\tthis.items.fill(1)\n\t}\n\n\tget style() {\n\t\tconst dimenssionsStyles: {\n\t\t\twidth?: string,\n\t\t\theight?: string,\n\t\t} = {\n\t\t\twidth: null,\n\t\t\theight: null,\n\t\t}\n\t\tif (this.width) {\n\t\t\tdimenssionsStyles.width = this.width\n\t\t}\n\n\t\tif (this.height) {\n\t\t\tdimenssionsStyles.height = this.height\n\t\t}\n\n\t\treturn {...dimenssionsStyles}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host size={this.size}\n\t\t\t\t color={this.color}\n\t\t\t\t class={{\n\t\t\t\t\t [SkeletonClass.root]: true,\n\t\t\t\t\t circle: this.shape === \"circle\",\n\t\t\t\t\t line: this.shape === \"line\",\n\t\t\t\t\t progress: this.animation === \"progress\",\n\t\t\t\t\t pulse: this.animation === \"pulse\",\n\t\t\t\t }}\n\t\t\t\t {...this.inheritedAttributes}\n\t\t\t\t aria-busy=\"true\"\n\t\t\t\t aria-valuemin=\"0\"\n\t\t\t\t aria-valuemax=\"100\"\n\t\t\t\t role=\"progressbar\"\n\t\t\t\t tabindex=\"0\"\n\t\t\t\t style={this.style}>\n\t\t\t</Host>\n\t\t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,EAAC+C,EAAIN,OAAAC,OAAA,CAAAM,IAAA,2CAAChC,KAAMjB,KAAKiB,KACd2E,MAAO5F,KAAK4F,MACZ1C,MAAO,CACN,CAACoE,EAAczG,MAAO,KACtBuH,OAAQpI,KAAK2H,QAAU,SACvBU,KAAMrI,KAAK2H,QAAU,OACrBW,SAAUtI,KAAK4H,YAAc,WAC7BW,MAAOvI,KAAK4H,YAAc,UAEvB5H,KAAKmC,oBAAmB,aAClB,OAAM,gBACF,IAAG,gBACH,MACduD,KAAK,cACL8C,SAAS,IACTR,MAAOhI,KAAKgI,Q","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Tags","GovFormInput","constructor","hostRef","this","h","govHost","host","inputId","createID","f","govForm","validateSize","newValue","validateProp","FormInputSizes","FormInputClass","root","watchControlAttrs","passControlAttrs","passAttrToControl","size","toBoolAttr","success","disabled","invalid","multiline","TEXTAREA","INPUT","componentDidLoad","attributeObserver","AttributeObserver","attributeName","onAriaAttributeChange","startObserving","ariaAttributes","govHydrated","emit","componentWillLoad","inheritedAttributes","inheritAriaAttributes","componentDidRender","passAttrToLabel","String","required","removeAttribute","Object","assign","disconnectedCallback","stopObserving","render","Tag","Host","key","class","type","hasSlot","name","icons","onClick","inputRef","focus","inputType","showPassword","id","identifier","onFocus","onFocusHandler","bind","onInput","onInputHandler","onBlur","onBlurHandler","onKeyUp","onKeyUpHandler","onKeyDown","onKeyDownHandler","ref","el","placeholder","spellcheck","toBoolAttrIfDefined","lang","inputLang","readonly","autocomplete","toOnOffAttrIfDefined","autocorrect","minlength","maxlength","min","max","rows","cols","role","value","color","accessibleHidePasswordLabel","accessibleShowPasswordLabel","slot","e","stopPropagation","focused","govFocus","component","originalEvent","govBlur","govKeyUp","govKeyDown","target","govInput","setFocus","options","setValue","clearValue","getRef","SkeletonSizes","pick","Sizes","Colors","SkeletonShapes","SkeletonAnimation","SkeletonClass","GovSkeleton","items","validateShape","validateAnimation","shape","animation","init","componentWillUpdate","fill","style","dimenssionsStyles","width","height","circle","line","progress","pulse","tabindex"],"sources":["../../../packages/core/src/components/gov-form/input/gov-form-input.tsx","../../../packages/core/src/components/gov-loading/skeleton/constants.ts","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.tsx"],"sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined, toOnOffAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {validateProp} from \"../../../helpers/Validate/props\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormInputClass, FormInputSizes, FormInputSizesType, InputType, Type,} from \"./constants\"\nimport {FormInputEvent} from \"./gov-form-input.types\"\nimport {Nullable} from \"../../../types/interfaces\"\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\nenum Tags {\n\tINPUT = \"input\",\n\tTEXTAREA = \"textarea\",\n}\n\n@Component({\n\ttag: \"gov-form-input\",\n})\nexport class GovFormInput {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly inputId: string\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.inputId = createID(\"GovInput\")\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormInputElement\n\t/**\n\t * Value of input\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string\n\t/**\n\t * Custom input identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop({reflect:true}) readonly success: boolean\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = \"m\"\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Generates a texarea for the possibility of multiple lines\n\t */\n\t@Prop() readonly multiline: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n\t */\n\t@Prop() readonly rows: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols\n\t */\n\t@Prop() readonly cols: number\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop({reflect:true}) readonly required: boolean = false\n\t/**\n\t * Makes the input component disabled.\n\t */\n\t@Prop({reflect:true}) readonly disabled: boolean = false\n\t/**\n\t * Text that appears in the form control when it has no value set\n\t */\n\t@Prop() readonly placeholder: string\n\t/**\n\t * The value is not editable\n\t */\n\t@Prop() readonly readonly: boolean\n\t/**\n\t * Minimum length (number of characters) of value\n\t */\n\t@Prop() readonly minlength: number\n\t/**\n\t * Maximum length (number of characters) of value\n\t */\n\t@Prop() readonly maxlength: number\n\t/**\n\t * Minimum value that is acceptable and valid for the input containing the attribute\n\t */\n\t@Prop() readonly min?: string | number\n\t/**\n\t * Maximum value that is acceptable and valid for the input containing the attribute\n\t */\n\t@Prop() readonly max?: string | number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocomplete\n\t */\n\t@Prop() readonly autocomplete: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocorrect\n\t */\n\t@Prop() readonly autocorrect: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck\n\t */\n\t@Prop() readonly spellcheck: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\n\t */\n\t@Prop({attribute: \"input-lang\"}) readonly inputLang: string\n\t/**\n\t * Defined the visual style of input\n\t */\n\t@Prop() readonly type?: Type\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n\t */\n\t@Prop({attribute: \"input-type\"}) readonly inputType: InputType = \"text\"\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role\n\t */\n\t@Prop() readonly role: Nullable<string>\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop({reflect:true}) readonly invalid: boolean\n\t/**\n\t * Accessible text for password display\n\t */\n\t@Prop({attribute: \"accessible-show-password-label\"}) readonly accessibleShowPasswordLabel = 'Zobrazit heslo'\n\t/**\n\t * Accessible text to hide the password\n\t */\n\t@Prop({attribute: \"accessible-hide-password-label\"}) readonly accessibleHidePasswordLabel = 'Skrýt heslo'\n\t/**\n\t * Emitted when the input has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-input\"}) govInput: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-keyup\"}) govKeyUp: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-hydrated\"}) govHydrated: EventEmitter<void>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({eventName: \"gov-keydown\"}) govKeyDown: EventEmitter<FormInputEvent>\n\t@State() focused: boolean\n\t@State() showPassword: boolean = false\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormInputSizes, newValue, FormInputClass.root)\n\t}\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\t@Watch(\"success\")\n\t@Watch(\"size\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"size\", this.size)\n\t\tthis.f.passAttrToControl(\"success\", toBoolAttr(this.success))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"type\", this.multiline ? Tags.TEXTAREA : Tags.INPUT)\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t\tthis.govHydrated.emit();\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tcomponentDidRender() {\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\trender() {\n\t\tconst Tag = this.multiline ? Tags.TEXTAREA : Tags.INPUT\n\n\t\treturn (\n\t\t\t<Host class={FormInputClass.root} size={this.size} type={this.type}>\n\t\t\t\t{this.h.hasSlot(\"prefix\") && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t{(this.h.hasSlot(\"icon-start\") && !this.multiline) &&\n\t\t\t\t\t\t<div class={FormInputClass.icons} onClick={() => this.inputRef.focus()}>\n\t\t\t\t\t\t\t<slot name=\"icon-start\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\ttype={this.inputType === 'password' && this.showPassword ? 'text' : this.inputType}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tid={this.identifier || this.inputId}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonInput={this.onInputHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\tonKeyUp={this.onKeyUpHandler.bind(this)}\n\t\t\t\t\t\tonKeyDown={this.onKeyDownHandler.bind(this)}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\tspellcheck={toBoolAttrIfDefined(this.spellcheck)}\n\t\t\t\t\t\tlang={this.inputLang}\n\t\t\t\t\t\treadonly={toBoolAttrIfDefined(this.readonly)}\n\t\t\t\t\t\tautocomplete={toOnOffAttrIfDefined(this.autocomplete)}\n\t\t\t\t\t\tautocorrect={toOnOffAttrIfDefined(this.autocorrect)}\n\t\t\t\t\t\tminlength={this.minlength}\n\t\t\t\t\t\tmaxlength={this.maxlength}\n\t\t\t\t\t\tmin={this.min}\n\t\t\t\t\t\tmax={this.max}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\trows={this.rows}\n\t\t\t\t\t\tcols={this.cols}\n\t\t\t\t\t\trole={this.role}\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t{...this.inheritedAttributes}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t{((this.success || this.invalid || this.h.hasSlot(\"icon-end\") || this.inputType === 'password') && !this.multiline) &&\n\t\t\t\t\t\t<div class={FormInputClass.icons} onClick={() => this.inputRef.focus()}>\n\t\t\t\t\t\t\t{this.success && !this.multiline &&\n\t\t\t\t\t\t\t\t<gov-icon class=\"validation-icon\" name=\"check-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t\t\t{this.invalid && !this.multiline &&\n\t\t\t\t\t\t\t\t<gov-icon class=\"validation-icon\" name=\"exclamation-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t\t\t{this.h.hasSlot(\"icon-end\") && this.inputType !== 'password' && <slot name=\"icon-end\"/>}\n\t\t\t\t\t\t\t{this.inputType === 'password' ? (\n\t\t\t\t\t\t\t\t<gov-button color={'primary'}\n\t\t\t\t\t\t\t\t\t\t\ttype={'base'}\n\t\t\t\t\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\t\t\t\t\taria-label={this.showPassword ? this.accessibleHidePasswordLabel : this.accessibleShowPasswordLabel}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.showPassword = !this.showPassword}>\n\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon-start\" name=\"eye\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t</gov-button>) : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot(\"sufix\") && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onKeyUpHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\tthis.govKeyUp.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onKeyDownHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\tthis.govKeyDown.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: InputEvent) {\n\t\tthis.value = (e.target as HTMLInputElement).value\n\t\te.stopPropagation()\n\t\tthis.govInput.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.inputRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Clears input value\n\t */\n\t@Method()\n\tasync clearValue(): Promise<void> {\n\t\tthis.value = \"\"\n\t\tthis.inputRef.value = \"\"\n\t}\n\n\t/**\n\t * Returns an instance of the native html input element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n}\n","import { pick } from \"../../../utils/utils\"\nimport { ValueOf } from \"../../../types/interfaces\"\nimport {Sizes} from \"../../../core/constants/sizes\";\nimport {Colors} from \"../../../core/constants/colors\";\n\nexport const SkeletonSizes = pick(Sizes, ['_XS', '_S', '_M', '_L', '_XL'])\nexport type SkeletonSizesType = `${ValueOf<typeof SkeletonSizes>}`\n\nexport const SkeletonColors = pick(Colors, [\"PRIMARY\", \"NEUTRAL\"])\nexport type SkeletonColorType = `${ValueOf<typeof SkeletonColors>}`\n\nexport enum SkeletonShapes {\n\tCIRCLE = 'circle',\n\tLINE = 'line'\n}\nexport type SkeletonShapesType = `${ValueOf<typeof SkeletonShapes>}`\n\nexport enum SkeletonAnimation {\n\tPULSE = 'pulse',\n\tPROGRESS = 'progress',\n\tFALSE = 'false'\n}\nexport type SkeletonAnimationType = `${ValueOf<typeof SkeletonAnimation>}`\n\nexport const SkeletonClass = {\n\troot: 'gov-skeleton',\n}\n","import {Component, Element, h, Host, Prop, State, Watch} from \"@stencil/core\"\nimport {\n\tSkeletonAnimation,\n\tSkeletonAnimationType,\n\tSkeletonClass,\n\tSkeletonColorType,\n\tSkeletonShapes,\n\tSkeletonShapesType,\n\tSkeletonSizes,\n} from \"./constants\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govHost} from \"../../../helpers/Dom/template\"\nimport {validateProp} from \"../../../helpers/Validate/props\"\nimport {FormInputSizesType} from \"../../gov-form/input/constants\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\n@Component({\n\ttag: \"gov-skeleton\",\n})\nexport class GovSkeleton {\n\th: GovHost\n\tprivate attributeObserver: AttributeObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovSkeletonElement\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = \"m\"\n\t/**\n\t * Style variation of the skeleton.\n\t */\n\t@Prop() readonly color?: SkeletonColorType = \"neutral\"\n\t/**\n\t * Shape of the skeleton\n\t */\n\t@Prop() shape?: SkeletonShapesType = \"line\"\n\t/**\n\t * Width of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() width: string = null\n\t/**\n\t * Height of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() height: string = null\n\t/**\n\t * Animation type\n\t */\n\t@Prop() animation?: SkeletonAnimationType = \"progress\"\n\n\titems: number[] = []\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(SkeletonSizes, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('shape')\n\tvalidateShape(newValue: string): void {\n\t\tvalidateProp(SkeletonShapes, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('animation')\n\tvalidateAnimation(newValue: string): void {\n\t\tvalidateProp(SkeletonAnimation, newValue, SkeletonClass.root)\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\t\tthis.validateShape(this.shape)\n\t\tthis.validateAnimation(this.animation)\n\t\tthis.init()\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tcomponentWillUpdate() {\n\t\tthis.init()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tinit() {\n\t\tthis.items.fill(1)\n\t}\n\n\tget style() {\n\t\tconst dimenssionsStyles: {\n\t\t\twidth?: string,\n\t\t\theight?: string,\n\t\t} = {\n\t\t\twidth: null,\n\t\t\theight: null,\n\t\t}\n\t\tif (this.width) {\n\t\t\tdimenssionsStyles.width = this.width\n\t\t}\n\n\t\tif (this.height) {\n\t\t\tdimenssionsStyles.height = this.height\n\t\t}\n\n\t\treturn {...dimenssionsStyles}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host size={this.size}\n\t\t\t\t color={this.color}\n\t\t\t\t class={{\n\t\t\t\t\t [SkeletonClass.root]: true,\n\t\t\t\t\t circle: this.shape === \"circle\",\n\t\t\t\t\t line: this.shape === \"line\",\n\t\t\t\t\t progress: this.animation === \"progress\",\n\t\t\t\t\t pulse: this.animation === \"pulse\",\n\t\t\t\t }}\n\t\t\t\t {...this.inheritedAttributes}\n\t\t\t\t aria-busy=\"true\"\n\t\t\t\t aria-valuemin=\"0\"\n\t\t\t\t aria-valuemax=\"100\"\n\t\t\t\t role=\"progressbar\"\n\t\t\t\t tabindex=\"0\"\n\t\t\t\t style={this.style}>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"],"mappings":"ygBAcA,IAAKA,GAAL,SAAKA,GACJA,EAAA,iBACAA,EAAA,sBACA,EAHD,CAAKA,MAAI,K,MAQIC,EAAY,MAOxB,WAAAC,CAAAC,G,0TAsB6C,I,mGAqBM,M,cAIA,M,wRAiDc,O,4EAa2B,iB,iCAIA,c,yCA0B3D,M,yBAeU,GAzJ1CC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,QAAUC,EAAS,YACxBL,KAAKM,EAAIC,EAAQP,KAAKC,E,CA2IvB,YAAAO,CAAaC,GACZC,EAAaC,EAAgBF,EAAUG,EAAeC,K,CAOvD,iBAAAC,GACCd,KAAKe,kB,CAKE,gBAAAA,GACPf,KAAKM,EAAEU,kBAAkB,OAAQhB,KAAKiB,MACtCjB,KAAKM,EAAEU,kBAAkB,UAAWE,EAAWlB,KAAKmB,UACpDnB,KAAKM,EAAEU,kBAAkB,WAAYE,EAAWlB,KAAKoB,WACrDpB,KAAKM,EAAEU,kBAAkB,UAAWE,EAAWlB,KAAKqB,UACpDrB,KAAKM,EAAEU,kBAAkB,OAAQhB,KAAKsB,UAAY1B,EAAK2B,SAAW3B,EAAK4B,M,CAGxE,gBAAAC,GACCzB,KAAK0B,kBAAoB,IAAIC,EAAkB3B,KAAKG,MAAM,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KAAKG,KAAKsC,gBAAgBb,GAC1B5B,KAAKmC,oBAAmBO,OAAAC,OAAAD,OAAAC,OAAA,GAAO3C,KAAKmC,qBAAmB,CAAEP,CAACA,GAAgBnB,G,CAG3E,IAAAoH,GACC7H,KAAKwH,MAAMO,KAAK,E,CAGjB,SAAIC,GACH,MAAMC,EAGF,CACHC,MAAO,KACPC,OAAQ,MAET,GAAInI,KAAKkI,MAAO,CACfD,EAAkBC,MAAQlI,KAAKkI,K,CAGhC,GAAIlI,KAAKmI,OAAQ,CAChBF,EAAkBE,OAASnI,KAAKmI,M,CAGjC,OAAAzF,OAAAC,OAAA,GAAWsF,E,CAGZ,MAAAnF,GACC,OACC7C,EAAC+C,EAAIN,OAAAC,OAAA,CAAAM,IAAA,2CAAChC,KAAMjB,KAAKiB,KACd2E,MAAO5F,KAAK4F,MACZ1C,MAAO,CACN,CAACoE,EAAczG,MAAO,KACtBuH,OAAQpI,KAAK2H,QAAU,SACvBU,KAAMrI,KAAK2H,QAAU,OACrBW,SAAUtI,KAAK4H,YAAc,WAC7BW,MAAOvI,KAAK4H,YAAc,UAEvB5H,KAAKmC,oBAAmB,aAClB,OAAM,gBACF,IAAG,gBACH,MACduD,KAAK,cACL8C,SAAS,IACTR,MAAOhI,KAAKgI,Q","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as s,h as e,a as t,g as i}from"./p-5fbde4f9.js";import{g as a,b as o}from"./p-da1db6fd.js";import{g as r}from"./p-ea7fdd2e.js";import{s as c}from"./p-cd6c2938.js";import"./p-92f420cb.js";import"./p-e0e2e9c1.js";import"./p-7f3becc5.js";import"./p-5aad3497.js";import"./p-56efd4a2.js";import"./p-7ba4daf4.js";const d=class{constructor(e){s(this,e);this.identifier=undefined;this.invalid=false;this.disabled=false;this.success=false;this.fieldset=false;this.size="m";this.h=r(this.host);this.f=a(this.h)}componentDidRender(){this.syncControlMessages();this.formElementDescriptionControl()}disconnectedCallback(){var s;(s=this.observer)===null||s===void 0?void 0:s.disconnect()}formElementDescriptionControl(){const s=this.host.querySelector("."+o.bottom);if(!s)return;this.observer=new MutationObserver(function(){this.syncControlMessages()}.bind(this));this.observer.observe(s,{childList:true})}syncControlMessages(){Promise.all(this.f.messageElements.map((s=>s.identifier()))).then((s=>{this.f.mainElementsInControl.forEach((e=>{const t=c(e.getAttribute("aria-describedby"));e.removeAttribute("aria-describedby");if(Array.isArray(t)){t.forEach((e=>e.indexOf("GovFormMessage")===-1?s.push(e):null))}if(s.length){e.setAttribute("aria-describedby",s.join(" "))}}))}))}render(){const s=this.fieldset?"fieldset":"div";return e(t,{key:"ca3d81a16858cbe4b2c06580cb2e9523a77191be",size:this.size,class:this.h.classes(o.root)},e(s,{key:"4b2bdfbc3c227b910660596d5815c70ef8fa22dd",class:o.holder},this.h.hasSlot("top")&&e("slot",{key:"21e1b5d8e989e6e4ecf9795a2d9d3ccd6dc29543",name:"top"}),e("slot",{key:"d2acefce44c05404f9d1ce224f7f259361423d82"}),this.h.hasSlot("bottom")&&e("div",{key:"e5c095ee40f41623e9f6a871e29724be42a8be8f",class:o.bottom},e("slot",{key:"941873ca1268fca177d3ff92b10a205dea0faad3",name:"bottom"}))))}get host(){return i(this)}};export{d as gov_form_control};
|
|
2
|
+
//# sourceMappingURL=p-fa161f10.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,h as o,a as n}from"./p-5fbde4f9.js";import{a as c}from"./p-cd6c2938.js";const t=class{constructor(o){e(this,o);this.uniqueId="lifecycle-"+c()}connectedCallback(){console.log("connectedCallback",this.uniqueId)}disconnectedCallback(){console.log("disconnectedCallback",this.uniqueId)}componentWillLoad(){console.log("componentWillLoad",this.uniqueId)}componentDidLoad(){console.log("componentDidLoad",this.uniqueId)}componentShouldUpdate(){console.log("componentShouldUpdate",this.uniqueId)}componentWillRender(){console.log("componentWillRender",this.uniqueId)}componentDidRender(){console.log("componentDidRender",this.uniqueId)}componentWillUpdate(){console.log("componentWillUpdate",this.uniqueId)}componentDidUpdate(){console.log("componentDidUpdate",this.uniqueId)}render(){return o(n,{key:"506eabaae01ae888fa838c10572e55bbe6fb7015",identifier:this.uniqueId},o("span",{key:"7604a29214fdffb1a470d83d7db37a583e5072ed"},"lifecycle ",this.uniqueId))}};export{t as gov_lifecycle};
|
|
2
|
+
//# sourceMappingURL=p-fa5b72de.entry.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,d as i,h as s,a,g as t}from"./p-5fbde4f9.js";import{g as d,b as o}from"./p-ea7fdd2e.js";import{c}from"./p-cd6c2938.js";import{v as n}from"./p-29ac15d2.js";import{c as f}from"./p-e8ec030e.js";import{d as r}from"./p-e0e2e9c1.js";import"./p-2aedc81e.js";var h;(function(e){e["HORIZONTAL"]="horizontal";e["VERTICAL"]="vertical"})(h||(h={}));const l={root:"gov-card",header:"gov-card__header",arrow:"gov-card__arrow",inner:"gov-card__inner",img:"gov-card__img",icon:"gov-card__icon",content:"gov-card__content",footer:"gov-card__footer"};const b=class{constructor(s){e(this,s);this.govToggle=i(this,"gov-toggle",7);this.hydrated=false;this.direction="vertical";this.collapsible=false;this.open=true;this.accessibleTriggerLabel=undefined;this.accessibleTriggerLabelledBy=undefined;this.h=d(this.host);this.headlineId=c("GovCardHeadline");this.contentId=c("GovCardContent")}async componentDidRender(){if(f()){await r(500);await this.validateAccessibility()}}connectedCallback(){this.hydrated=true}render(){return s(a,{key:"16ef4ffbb0a84bb231008f4f52a4ffe1f2f809d8",class:this.h.classes(l.root),open:this.open,collapsible:o(this.collapsible),direction:this.direction,hydrated:this.hydrated},this.collapsible?s("button",{id:this.headlineId,class:l.header,"aria-label":this.accessibleTriggerLabel,"aria-labelledby":this.accessibleTriggerLabelledBy,"aria-expanded":o(this.open),"aria-controls":this.contentId,onClick:this.onClickHandler.bind(this)},s("slot",{name:"headline"}),s("gov-icon",{class:l.arrow,name:"chevron-down",type:"components"})):this.h.hasSlot("headline")?s("div",{class:l.header},s("slot",{name:"headline"})):null,s("div",{key:"749f6e4b624f4cdda53d2e3433b451d56c742667",class:l.inner,id:this.contentId,"aria-hidden":this.collapsible?o(!this.open):undefined,hidden:this.collapsible?!this.open:undefined,"aria-labelledby":this.collapsible?this.headlineId:undefined},this.h.hasSlot("img")&&s("div",{key:"f4b953ddf9b4f59bc111b512bb3de3510b28af7f",class:l.img},s("slot",{key:"2867a29e49e67aff041ac0705527c5f76f4a019e",name:"img"})),this.h.hasSlot("icon")&&s("div",{key:"8c8e55d3faff7cfbd6abe698cd8801f7fc41dbad",class:l.icon},s("slot",{key:"4d9eaeb0b3af65e4bf5de75090f9346942069e86",name:"icon"})),s("div",{key:"77a9a065fb2803b5f39f1b5716d9810c04b6971b",class:l.content},s("slot",{key:"acec7d3d4b6ac5533e5df218fe38e26147c440d8"})),this.h.hasSlot("footer")&&s("div",{key:"1e63a0811f487e18cbbef8b045651c0e5b745f37",class:l.footer},s("slot",{key:"4bffc12bffb3e29527aad38b6edbe8c00527a843",name:"footer"}))))}onClickHandler(e){e.stopPropagation();if(this.collapsible){this.open=!this.open;this.govToggle.emit({open:this.open,element:this.host})}}async validateAccessibility(){if(this.collapsible){n(this.accessibleTriggerLabel,this.accessibleTriggerLabelledBy,l.root,this.host)}}get host(){return t(this)}};export{b as gov_card};
|
|
2
|
+
//# sourceMappingURL=p-fb8c019a.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardDirection","CardClass","root","header","arrow","inner","img","icon","content","footer","GovCard","constructor","hostRef","this","hydrated","h","govHost","host","headlineId","createID","contentId","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","connectedCallback","render","Host","key","class","classes","open","collapsible","booleanString","direction","id","accessibleTriggerLabel","accessibleTriggerLabelledBy","onClick","onClickHandler","bind","name","type","hasSlot","undefined","hidden","e","stopPropagation","govToggle","emit","element","validateAccessibleLabel"],"sources":["../../../packages/core/src/components/gov-card/constants.ts","../../../packages/core/src/components/gov-card/gov-card.tsx"],"sourcesContent":["import {ValueOf} from \"../../types/interfaces\";\n\nexport enum CardDirection {\n\tHORIZONTAL = 'horizontal',\n\tVERTICAL = 'vertical',\n}\nexport type CardDirectionType = `${ValueOf<typeof CardDirection>}`\n\nexport const CardClass = {\n\troot: 'gov-card',\n\theader: 'gov-card__header',\n\tarrow: 'gov-card__arrow',\n\tinner: 'gov-card__inner',\n\timg: 'gov-card__img',\n\ticon: 'gov-card__icon',\n\tcontent: 'gov-card__content',\n\tfooter: 'gov-card__footer',\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop} from '@stencil/core'\nimport {CardClass, CardDirectionType} from './constants'\nimport {booleanString, govHost} from '../../helpers/Dom/template'\nimport {GovHost} from '../../helpers/Dom/template.types'\nimport {createID} from '../../utils/string.utils'\nimport {validateAccessibleLabel} from '../../helpers/Validate/wcag'\nimport {canValidateWcagOnRender} from '../../helpers/Dom/win'\nimport {delay} from '../../utils/utils'\nimport {GovCardChangeEvent} from './interfaces'\n\n@Component({\n\ttag: 'gov-card',\n})\nexport class GovCard {\n\tprivate h: GovHost\n\tprivate readonly headlineId: string\n\tprivate readonly contentId: string\n\tprivate hydrated = false\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.headlineId = createID('GovCardHeadline')\n\t\tthis.contentId = createID('GovCardContent')\n\t}\n\n\t@Element() host: HTMLGovCardElement\n\n\t/**\n\t * Card direction\n\t */\n\t@Prop() readonly direction: CardDirectionType = \"vertical\"\n\t/**\n\t * Defines weather the card can be collapsible\n\t */\n\t@Prop() readonly collapsible: boolean = false\n\t/**\n\t * Defines whether the card is open or closed\n\t */\n\t@Prop({reflect: true, mutable: true}) open = true\n\t/**\n\t * Adds accessible label for the collapsible button that is only shown for screen readers.\n\t */\n\t@Prop({attribute: 'accessible-label'}) accessibleTriggerLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for collapsible card\n\t */\n\t@Prop({attribute: 'accessible-labelledby'}) accessibleTriggerLabelledBy: string\n\t/**\n\t * Called when the card toggle state changes\n\t */\n\t@Event({eventName: 'gov-toggle'}) govToggle: EventEmitter<GovCardChangeEvent>\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateAccessibility()\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tthis.hydrated = true\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(CardClass.root)} open={this.open}\n\t\t\t\t collapsible={booleanString(this.collapsible)} direction={this.direction} hydrated={this.hydrated}>\n\t\t\t\t{this.collapsible ? (\n\t\t\t\t\t<button\n\t\t\t\t\t\tid={this.headlineId}\n\t\t\t\t\t\tclass={CardClass.header}\n\t\t\t\t\t\taria-label={this.accessibleTriggerLabel}\n\t\t\t\t\t\taria-labelledby={this.accessibleTriggerLabelledBy}\n\t\t\t\t\t\taria-expanded={booleanString(this.open)}\n\t\t\t\t\t\taria-controls={this.contentId}\n\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot name=\"headline\"/>\n\t\t\t\t\t\t<gov-icon class={CardClass.arrow} name=\"chevron-down\" type=\"components\"></gov-icon>\n\t\t\t\t\t</button>\n\t\t\t\t) : this.h.hasSlot(\"headline\") ? (\n\t\t\t\t\t<div class={CardClass.header}>\n\t\t\t\t\t\t<slot name=\"headline\"/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t<div\n\t\t\t\t\tclass={CardClass.inner}\n\t\t\t\t\tid={this.contentId}\n\t\t\t\t\taria-hidden={this.collapsible ? booleanString(!this.open) : undefined}\n\t\t\t\t\thidden={this.collapsible ? !this.open : undefined}\n\t\t\t\t\taria-labelledby={this.collapsible ? this.headlineId : undefined}\n\t\t\t\t>\n\t\t\t\t\t{this.h.hasSlot('img') && (\n\t\t\t\t\t\t<div class={CardClass.img}>\n\t\t\t\t\t\t\t<slot name=\"img\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t<div class={CardClass.icon}>\n\t\t\t\t\t\t\t<slot name=\"icon\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<div class={CardClass.content}>\n\t\t\t\t\t\t<slot/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{this.h.hasSlot('footer') && (\n\t\t\t\t\t\t<div class={CardClass.footer}>\n\t\t\t\t\t\t\t<slot name=\"footer\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e) {\n\t\te.stopPropagation()\n\t\tif (this.collapsible) {\n\t\t\tthis.open = !this.open\n\t\t\tthis.govToggle.emit({open: this.open, element: this.host})\n\t\t}\n\t}\n\n\t/**\n\t * Validate the accessible attributes of the component\n\t */\n\t@Method()\n\tasync validateAccessibility(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tvalidateAccessibleLabel(this.accessibleTriggerLabel, this.accessibleTriggerLabelledBy, CardClass.root, this.host)\n\t\t}\n\t}\n}\n"],"mappings":"yQAEA,IAAYA,GAAZ,SAAYA,GACXA,EAAA,2BACAA,EAAA,sBACA,EAHD,CAAYA,MAAa,KAMlB,MAAMC,EAAY,CACxBC,KAAM,WACNC,OAAQ,mBACRC,MAAO,kBACPC,MAAO,kBACPC,IAAK,gBACLC,KAAM,iBACNC,QAAS,oBACTC,OAAQ,oB,MCHIC,EAAO,MAMnB,WAAAC,CAAAC,G,gDAFQC,KAAAC,SAAW,M,eAa6B,W,iBAIR,M,UAIK,K,iFAlB5CD,KAAKE,EAAIC,EAAQH,KAAKI,MACtBJ,KAAKK,WAAaC,EAAS,mBAC3BN,KAAKO,UAAYD,EAAS,iB,CA8B3B,wBAAME,GACL,GAAIC,IAA2B,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Af,KAAKE,EAAE4B,QAAQ,WACf5B,EAAA,OAAAa,IAAA,2CAAKC,MAAO5B,EAAUQ,QACrBM,EAAA,QAAAa,IAAA,2CAAMa,KAAK,a,CAQT,cAAAF,CAAeO,GACtBA,EAAEC,kBACF,GAAIlC,KAAKmB,YAAa,CACrBnB,KAAKkB,MAAQlB,KAAKkB,KAClBlB,KAAKmC,UAAUC,KAAK,CAAClB,KAAMlB,KAAKkB,KAAMmB,QAASrC,KAAKI,M,EAQtD,2BAAMO,GACL,GAAIX,KAAKmB,YAAa,CACrBmB,EAAwBtC,KAAKuB,uBAAwBvB,KAAKwB,4BAA6BpC,EAAUC,KAAMW,KAAKI,K","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,h as t,F as s,a as i,g as a}from"./p-5fbde4f9.js";import{p as o}from"./p-e0e2e9c1.js";import{S as n}from"./p-92f420cb.js";import{g as d}from"./p-ea7fdd2e.js";o(n,["_S","_M","_L"]);const f={root:"gov-tile",link:"gov-tile__link",content:"gov-tile__content",text:"gov-tile__text",title:"gov-tile__title",icon:"gov-tile__icon",annotation:"gov-tile__annotation"};const c=class{constructor(t){e(this,t);this.size="m";this.orientation=undefined;this.noBorder=false;this.href=undefined;this.target=undefined;this.h=d(this.host)}render(){return t(i,{key:"c766f3d54f15e5a49a877fa2e67593d084f487f7",class:this.h.classes(f.root),size:this.size,orientation:this.orientation,clickable:this.href?true:null},t("slot",{key:"d07b106d781fead65a124c82d11ebe991fddfece",name:"icon"}),t("div",{key:"eeee0397b4384a473f3782750d1e04f0c8c7894d",class:f.content},t("div",{key:"f4081902e55b964b1ebbdd43f7b189f83dce8690",class:f.text},t("div",{key:"3bf8cf35db6f667de7c278786787e38b1392a5b2",class:f.title},this.href?t(s,null,t("a",{href:this.href,target:this.target,class:f.link,ref:e=>this.triggerRef=e},t("slot",{name:"title"})),t("span",{class:f.icon},t("gov-icon",{name:"chevron-right",type:"components"}))):t("slot",{name:"title"})),t("div",{key:"088f60531285a1457277352a011766f809d9280d",class:`${f.annotation} ${this.href?`${f.annotation}--padding`:""}`},t("slot",{key:"8d4a612e3aff054a60ec1030eb5a28903595ea6a"}))),t("slot",{key:"f7610d06a6d951b3a24f2e129342bb82c5e9d767",name:"button"})))}async getTriggerRef(){return this.triggerRef}get host(){return a(this)}};export{c as gov_tile};
|
|
2
|
+
//# sourceMappingURL=p-ff609d0e.entry.js.map
|