@gov-design-system-ce/components 0.0.12 → 0.0.14
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/{constants-e175be18.js → constants-0883e74c.js} +2 -2
- package/dist/cjs/constants-0883e74c.js.map +1 -0
- package/dist/cjs/{constants-245999e7.js → constants-adc8268f.js} +2 -2
- package/dist/cjs/constants-adc8268f.js.map +1 -0
- package/dist/cjs/core.cjs.js +2 -2
- package/dist/cjs/gov-accordion-item.cjs.entry.js +13 -9
- package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-accordion.cjs.entry.js +3 -3
- package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-alert.cjs.entry.js +2 -2
- package/dist/cjs/gov-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-app.cjs.entry.js +79 -7
- package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-attachments_3.cjs.entry.js +4 -4
- package/dist/cjs/gov-attachments_3.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-backdrop.cjs.entry.js +2 -2
- package/dist/cjs/gov-backdrop.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-badge.cjs.entry.js +3 -3
- package/dist/cjs/gov-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-breadcrumbs.cjs.entry.js +3 -33
- package/dist/cjs/gov-breadcrumbs.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-button.cjs.entry.js +3 -3
- package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-card.cjs.entry.js +2 -2
- package/dist/cjs/gov-card.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-container.cjs.entry.js +2 -2
- package/dist/cjs/gov-container.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-cookiebar.cjs.entry.js +2 -2
- package/dist/cjs/gov-cookiebar.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-empty.cjs.entry.js +2 -2
- package/dist/cjs/gov-empty.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-error-code.cjs.entry.js +2 -2
- package/dist/cjs/gov-error-code.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-autocomplete.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-file.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-group.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-group.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-input.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-label.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-label.cjs.entry.js.map +1 -1
- 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 +2 -2
- package/dist/cjs/gov-form-password-power.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-radio.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-search.cjs.entry.js +2 -2
- package/dist/cjs/gov-form-search.cjs.entry.js.map +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 +2 -2
- package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-grid-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-grid-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-grid.cjs.entry.js +2 -2
- package/dist/cjs/gov-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +3 -3
- package/dist/cjs/gov-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-layout-column.cjs.entry.js +2 -2
- package/dist/cjs/gov-layout-column.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-layout.cjs.entry.js +2 -2
- package/dist/cjs/gov-layout.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-loading.cjs.entry.js +2 -2
- package/dist/cjs/gov-loading.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-message.cjs.entry.js +2 -2
- package/dist/cjs/gov-message.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-modal.cjs.entry.js +2 -2
- package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-nav-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-nav.cjs.entry.js +2 -2
- package/dist/cjs/gov-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-pagination.cjs.entry.js +2 -2
- package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-prompt.cjs.entry.js +2 -2
- package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-side-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-side-nav-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-side-nav.cjs.entry.js +2 -2
- package/dist/cjs/gov-side-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-skeleton.cjs.entry.js +117 -0
- package/dist/cjs/gov-skeleton.cjs.entry.js.map +1 -0
- package/dist/cjs/gov-spacer.cjs.entry.js +2 -2
- package/dist/cjs/gov-spacer.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-statsbar-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-statsbar-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-statsbar.cjs.entry.js +2 -2
- package/dist/cjs/gov-statsbar.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-stepper-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-stepper-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-stepper.cjs.entry.js +2 -2
- package/dist/cjs/gov-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tabs-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-tabs-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tabs.cjs.entry.js +2 -2
- package/dist/cjs/gov-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tile.cjs.entry.js +2 -2
- package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tiles.cjs.entry.js +2 -2
- package/dist/cjs/gov-tiles.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-toast.cjs.entry.js +2 -2
- package/dist/cjs/gov-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tooltip-content.cjs.entry.js +2 -2
- package/dist/cjs/gov-tooltip-content.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/gov-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-wizzard-item.cjs.entry.js +2 -2
- package/dist/cjs/gov-wizzard-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-wizzard.cjs.entry.js +2 -2
- package/dist/cjs/gov-wizzard.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-356717ae.js → index-29ac07f6.js} +64 -2
- package/dist/cjs/index-29ac07f6.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/gov-accordion/constants.js +1 -1
- package/dist/collection/components/gov-accordion/constants.js.map +1 -1
- package/dist/collection/components/gov-accordion/gov-accordion-item.css +19 -0
- package/dist/collection/components/gov-accordion/gov-accordion-item.js +39 -17
- package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
- package/dist/collection/components/gov-accordion/gov-accordion.css +19 -0
- package/dist/collection/components/gov-accordion/gov-accordion.js +1 -1
- package/dist/collection/components/gov-alert/gov-alert.css +19 -0
- package/dist/collection/components/gov-app/gov-app.css +19 -0
- package/dist/collection/components/gov-attachments/gov-attachments-item.css +19 -0
- package/dist/collection/components/gov-attachments/gov-attachments.css +19 -0
- package/dist/collection/components/gov-backdrop/gov-backdrop.css +19 -0
- package/dist/collection/components/gov-badge/gov-badge.css +19 -0
- package/dist/collection/components/gov-badge/gov-badge.js +1 -1
- package/dist/collection/components/gov-breadcrumbs/constants.js +0 -4
- package/dist/collection/components/gov-breadcrumbs/constants.js.map +1 -1
- package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.css +45 -16
- package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.js +2 -81
- package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.js.map +1 -1
- package/dist/collection/components/gov-button/constants.js +1 -1
- package/dist/collection/components/gov-button/constants.js.map +1 -1
- package/dist/collection/components/gov-button/gov-button.css +19 -0
- package/dist/collection/components/gov-button/gov-button.js +1 -1
- package/dist/collection/components/gov-card/gov-card.css +19 -0
- package/dist/collection/components/gov-container/gov-container.css +19 -0
- package/dist/collection/components/gov-cookiebar/gov-cookiebar.css +19 -0
- package/dist/collection/components/gov-empty/gov-empty.css +19 -0
- package/dist/collection/components/gov-error-code/gov-error-code.css +19 -0
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.css +19 -0
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.css +19 -0
- package/dist/collection/components/gov-form/control/gov-form-control.css +19 -0
- package/dist/collection/components/gov-form/file/gov-form-file.css +19 -0
- package/dist/collection/components/gov-form/group/gov-form-group.css +19 -0
- package/dist/collection/components/gov-form/input/gov-form-input.css +19 -0
- package/dist/collection/components/gov-form/label/gov-form-label.css +19 -0
- package/dist/collection/components/gov-form/message/gov-form-message.css +19 -0
- package/dist/collection/components/gov-form/message/gov-form-message.js +1 -1
- package/dist/collection/components/gov-form/message/gov-form-message.js.map +1 -1
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +19 -0
- package/dist/collection/components/gov-form/password-power/gov-form-password-power.css +19 -0
- package/dist/collection/components/gov-form/radio/gov-form-radio.css +19 -0
- package/dist/collection/components/gov-form/search/gov-form-search.css +22 -3
- package/dist/collection/components/gov-form/select/gov-form-select.css +19 -0
- package/dist/collection/components/gov-form/switch/gov-form-switch.css +19 -0
- package/dist/collection/components/gov-grid/gov-grid-item.css +19 -0
- package/dist/collection/components/gov-grid/gov-grid.css +19 -0
- package/dist/collection/components/gov-icon/gov-icon.css +19 -0
- package/dist/collection/components/gov-layout/gov-layout-column.css +19 -0
- package/dist/collection/components/gov-layout/gov-layout.css +19 -0
- package/dist/collection/components/gov-loading/loading/constants.js.map +1 -0
- package/dist/collection/components/gov-loading/{gov-loading.css → loading/gov-loading.css} +19 -0
- package/dist/collection/components/gov-loading/{gov-loading.js → loading/gov-loading.js} +1 -1
- package/dist/collection/components/gov-loading/loading/gov-loading.js.map +1 -0
- package/dist/collection/components/gov-loading/skeleton/constants.js +20 -0
- package/dist/collection/components/gov-loading/skeleton/constants.js.map +1 -0
- package/dist/collection/components/gov-loading/skeleton/gov-skeleton.css +290 -0
- package/dist/collection/components/gov-loading/skeleton/gov-skeleton.js +267 -0
- package/dist/collection/components/gov-loading/skeleton/gov-skeleton.js.map +1 -0
- package/dist/collection/components/gov-message/gov-message.css +19 -0
- package/dist/collection/components/gov-modal/gov-modal.css +19 -0
- package/dist/collection/components/gov-nav/gov-nav-item.css +19 -0
- package/dist/collection/components/gov-nav/gov-nav.css +19 -0
- package/dist/collection/components/gov-pagination/gov-pagination.css +19 -0
- package/dist/collection/components/gov-promp/gov-prompt.css +19 -0
- package/dist/collection/components/gov-side-nav/gov-side-nav-item.css +19 -0
- package/dist/collection/components/gov-side-nav/gov-side-nav.css +19 -0
- package/dist/collection/components/gov-spacer/gov-spacer.css +19 -0
- package/dist/collection/components/gov-statsbar/gov-statsbar-item.css +19 -0
- package/dist/collection/components/gov-statsbar/gov-statsbar.css +19 -0
- package/dist/collection/components/gov-stepper/gov-stepper-item.css +19 -0
- package/dist/collection/components/gov-stepper/gov-stepper.css +19 -0
- package/dist/collection/components/gov-tabs/gov-tabs-item.css +19 -0
- package/dist/collection/components/gov-tabs/gov-tabs.css +19 -0
- package/dist/collection/components/gov-tile/container/constants.js.map +1 -0
- package/dist/collection/components/{gov-tiles → gov-tile/container}/gov-tiles.css +19 -0
- package/dist/collection/components/{gov-tiles → gov-tile/container}/gov-tiles.js +2 -2
- package/dist/collection/components/gov-tile/container/gov-tiles.js.map +1 -0
- package/dist/collection/components/gov-tile/gov-tile.css +19 -0
- package/dist/collection/components/gov-toast/gov-toast.css +19 -0
- package/dist/collection/components/gov-tooltip/gov-tooltip-content.css +19 -0
- package/dist/collection/components/gov-tooltip/gov-tooltip.css +19 -0
- package/dist/collection/components/gov-wizzard/gov-wizzard-item.css +19 -0
- package/dist/collection/components/gov-wizzard/gov-wizzard.css +19 -0
- package/dist/collection/pages/Breadcrumbs.js +25 -5
- package/dist/collection/pages/Breadcrumbs.js.map +1 -1
- package/dist/collection/pages/Loading.js +52 -0
- package/dist/collection/pages/Loading.js.map +1 -1
- package/dist/components/constants.js +1 -1
- package/dist/components/constants.js.map +1 -1
- package/dist/components/constants3.js +1 -1
- package/dist/components/constants3.js.map +1 -1
- package/dist/components/gov-accordion-item.js +13 -7
- package/dist/components/gov-accordion-item.js.map +1 -1
- package/dist/components/gov-accordion.js +2 -1
- package/dist/components/gov-accordion.js.map +1 -1
- package/dist/components/gov-alert.js +2 -1
- package/dist/components/gov-alert.js.map +1 -1
- package/dist/components/gov-app.js +79 -6
- package/dist/components/gov-app.js.map +1 -1
- package/dist/components/gov-attachments-item2.js +2 -1
- package/dist/components/gov-attachments-item2.js.map +1 -1
- package/dist/components/gov-attachments2.js +2 -1
- package/dist/components/gov-attachments2.js.map +1 -1
- package/dist/components/gov-backdrop2.js +2 -1
- package/dist/components/gov-backdrop2.js.map +1 -1
- package/dist/components/gov-badge2.js +2 -1
- package/dist/components/gov-badge2.js.map +1 -1
- package/dist/components/gov-breadcrumbs.js +6 -51
- package/dist/components/gov-breadcrumbs.js.map +1 -1
- package/dist/components/gov-button2.js +2 -1
- package/dist/components/gov-button2.js.map +1 -1
- package/dist/components/gov-card.js +2 -1
- package/dist/components/gov-card.js.map +1 -1
- package/dist/components/gov-container.js +2 -1
- package/dist/components/gov-container.js.map +1 -1
- package/dist/components/gov-cookiebar.js +2 -1
- package/dist/components/gov-cookiebar.js.map +1 -1
- package/dist/components/gov-empty.js +2 -1
- package/dist/components/gov-empty.js.map +1 -1
- package/dist/components/gov-error-code.js +2 -1
- package/dist/components/gov-error-code.js.map +1 -1
- package/dist/components/gov-form-autocomplete2.js +2 -1
- package/dist/components/gov-form-autocomplete2.js.map +1 -1
- package/dist/components/gov-form-checkbox.js +2 -1
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +2 -1
- package/dist/components/gov-form-control.js.map +1 -1
- package/dist/components/gov-form-file.js +2 -1
- package/dist/components/gov-form-file.js.map +1 -1
- package/dist/components/gov-form-group.js +2 -1
- package/dist/components/gov-form-group.js.map +1 -1
- package/dist/components/gov-form-input2.js +2 -1
- package/dist/components/gov-form-input2.js.map +1 -1
- package/dist/components/gov-form-label.js +2 -1
- package/dist/components/gov-form-label.js.map +1 -1
- package/dist/components/gov-form-message2.js +2 -1
- package/dist/components/gov-form-message2.js.map +1 -1
- package/dist/components/gov-form-multi-select.js +2 -1
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-password-power.js +2 -1
- package/dist/components/gov-form-password-power.js.map +1 -1
- package/dist/components/gov-form-radio.js +2 -1
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-search.js +2 -1
- package/dist/components/gov-form-search.js.map +1 -1
- package/dist/components/gov-form-select2.js +2 -1
- package/dist/components/gov-form-select2.js.map +1 -1
- package/dist/components/gov-form-switch.js +2 -1
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-grid-item.js +2 -1
- package/dist/components/gov-grid-item.js.map +1 -1
- package/dist/components/gov-grid.js +2 -1
- package/dist/components/gov-grid.js.map +1 -1
- package/dist/components/gov-icon2.js +3 -2
- package/dist/components/gov-icon2.js.map +1 -1
- package/dist/components/gov-layout-column.js +2 -1
- package/dist/components/gov-layout-column.js.map +1 -1
- package/dist/components/gov-layout.js +2 -1
- package/dist/components/gov-layout.js.map +1 -1
- package/dist/components/gov-loading.js +2 -1
- package/dist/components/gov-loading.js.map +1 -1
- package/dist/components/gov-message.js +2 -1
- package/dist/components/gov-message.js.map +1 -1
- package/dist/components/gov-modal.js +2 -1
- package/dist/components/gov-modal.js.map +1 -1
- package/dist/components/gov-nav-item.js +2 -1
- package/dist/components/gov-nav-item.js.map +1 -1
- package/dist/components/gov-nav.js +2 -1
- package/dist/components/gov-nav.js.map +1 -1
- package/dist/components/gov-pagination.js +2 -1
- package/dist/components/gov-pagination.js.map +1 -1
- package/dist/components/gov-prompt.js +2 -1
- package/dist/components/gov-prompt.js.map +1 -1
- package/dist/components/gov-side-nav-item.js +2 -1
- package/dist/components/gov-side-nav-item.js.map +1 -1
- package/dist/components/gov-side-nav.js +2 -1
- package/dist/components/gov-side-nav.js.map +1 -1
- package/dist/components/gov-skeleton.d.ts +11 -0
- package/dist/components/gov-skeleton.js +138 -0
- package/dist/components/gov-skeleton.js.map +1 -0
- package/dist/components/gov-spacer.js +2 -1
- package/dist/components/gov-spacer.js.map +1 -1
- package/dist/components/gov-statsbar-item.js +2 -1
- package/dist/components/gov-statsbar-item.js.map +1 -1
- package/dist/components/gov-statsbar.js +2 -1
- package/dist/components/gov-statsbar.js.map +1 -1
- package/dist/components/gov-stepper-item.js +2 -1
- package/dist/components/gov-stepper-item.js.map +1 -1
- package/dist/components/gov-stepper.js +2 -1
- package/dist/components/gov-stepper.js.map +1 -1
- package/dist/components/gov-tabs-item.js +2 -1
- package/dist/components/gov-tabs-item.js.map +1 -1
- package/dist/components/gov-tabs.js +2 -1
- package/dist/components/gov-tabs.js.map +1 -1
- package/dist/components/gov-tile.js +2 -1
- package/dist/components/gov-tile.js.map +1 -1
- package/dist/components/gov-tiles.js +2 -1
- package/dist/components/gov-tiles.js.map +1 -1
- package/dist/components/gov-toast.js +2 -1
- package/dist/components/gov-toast.js.map +1 -1
- package/dist/components/gov-tooltip-content.js +2 -1
- package/dist/components/gov-tooltip-content.js.map +1 -1
- package/dist/components/gov-tooltip.js +2 -1
- package/dist/components/gov-tooltip.js.map +1 -1
- package/dist/components/gov-wizzard-item.js +2 -1
- package/dist/components/gov-wizzard-item.js.map +1 -1
- package/dist/components/gov-wizzard.js +2 -1
- package/dist/components/gov-wizzard.js.map +1 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/core/core.css +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-0272ffa0.entry.js +2 -0
- package/dist/core/{p-5b4e3bdf.entry.js.map → p-0272ffa0.entry.js.map} +1 -1
- package/dist/core/p-042d5b20.entry.js +2 -0
- package/dist/core/{p-1bb5184f.entry.js.map → p-042d5b20.entry.js.map} +1 -1
- package/dist/core/p-0874a5ec.entry.js +2 -0
- package/dist/core/p-0874a5ec.entry.js.map +1 -0
- package/dist/core/p-0f0564e8.entry.js +2 -0
- package/dist/core/{p-c0d3d3e0.entry.js.map → p-0f0564e8.entry.js.map} +1 -1
- package/dist/core/p-131c50d1.entry.js +2 -0
- package/dist/core/{p-e86bffd0.entry.js.map → p-131c50d1.entry.js.map} +1 -1
- package/dist/core/p-1c877e8e.entry.js +2 -0
- package/dist/core/{p-02c1b4db.entry.js.map → p-1c877e8e.entry.js.map} +1 -1
- package/dist/core/p-1def0eb2.entry.js +2 -0
- package/dist/core/{p-733bd593.entry.js.map → p-1def0eb2.entry.js.map} +1 -1
- package/dist/core/p-2426fa82.entry.js +2 -0
- package/dist/core/{p-9d51ea56.entry.js.map → p-2426fa82.entry.js.map} +1 -1
- package/dist/core/p-24877419.entry.js +2 -0
- package/dist/core/{p-9ca0a11c.entry.js.map → p-24877419.entry.js.map} +1 -1
- package/dist/core/p-2f88b6d9.entry.js +2 -0
- package/dist/core/{p-a6c8d474.entry.js.map → p-2f88b6d9.entry.js.map} +1 -1
- package/dist/core/p-30b162df.entry.js +2 -0
- package/dist/core/p-30b162df.entry.js.map +1 -0
- package/dist/core/p-337fb136.entry.js +2 -0
- package/dist/core/{p-4e12d6e3.entry.js.map → p-337fb136.entry.js.map} +1 -1
- package/dist/core/p-3f92f3bf.entry.js +2 -0
- package/dist/core/{p-4b375a4d.entry.js.map → p-3f92f3bf.entry.js.map} +1 -1
- package/dist/core/p-402c2751.entry.js +2 -0
- package/dist/core/{p-9658b6ef.entry.js.map → p-402c2751.entry.js.map} +1 -1
- package/dist/core/p-405fc50f.entry.js +2 -0
- package/dist/core/{p-c9948e57.entry.js.map → p-405fc50f.entry.js.map} +1 -1
- package/dist/core/p-42636ddf.entry.js +2 -0
- package/dist/core/{p-fc9d66ae.entry.js.map → p-42636ddf.entry.js.map} +1 -1
- package/dist/core/p-429850b9.entry.js +2 -0
- package/dist/core/p-429850b9.entry.js.map +1 -0
- package/dist/core/p-471c0863.entry.js +2 -0
- package/dist/core/{p-613d8ed8.entry.js.map → p-471c0863.entry.js.map} +1 -1
- package/dist/core/p-4af5e4f4.js +3 -0
- package/dist/core/p-4af5e4f4.js.map +1 -0
- package/dist/core/p-52dc68aa.entry.js +2 -0
- package/dist/core/{p-f531f5c4.entry.js.map → p-52dc68aa.entry.js.map} +1 -1
- package/dist/core/p-540e79c4.entry.js +2 -0
- package/dist/core/{p-01bdd4a4.entry.js.map → p-540e79c4.entry.js.map} +1 -1
- package/dist/core/p-5a1c8d48.entry.js +2 -0
- package/dist/core/{p-68d968ac.entry.js.map → p-5a1c8d48.entry.js.map} +1 -1
- package/dist/core/p-5d348765.entry.js +2 -0
- package/dist/core/{p-8a8d846c.entry.js.map → p-5d348765.entry.js.map} +1 -1
- package/dist/core/p-5e4cf9a2.entry.js +2 -0
- package/dist/core/{p-8dacc8dc.entry.js.map → p-5e4cf9a2.entry.js.map} +1 -1
- package/dist/core/p-61103476.entry.js +2 -0
- package/dist/core/{p-533bd158.entry.js.map → p-61103476.entry.js.map} +1 -1
- package/dist/core/p-67006730.entry.js +2 -0
- package/dist/core/{p-ac33c5ef.entry.js.map → p-67006730.entry.js.map} +1 -1
- package/dist/core/p-6aa31f02.entry.js +2 -0
- package/dist/core/{p-7be3abb5.entry.js.map → p-6aa31f02.entry.js.map} +1 -1
- package/dist/core/p-732f74fe.entry.js +2 -0
- package/dist/core/{p-49853c5a.entry.js.map → p-732f74fe.entry.js.map} +1 -1
- package/dist/core/p-76e2aa52.entry.js +2 -0
- package/dist/core/{p-e57d250f.entry.js.map → p-76e2aa52.entry.js.map} +1 -1
- package/dist/core/p-7bfa06b1.entry.js +2 -0
- package/dist/core/{p-4d73d70e.entry.js.map → p-7bfa06b1.entry.js.map} +1 -1
- package/dist/core/p-8204070b.entry.js +2 -0
- package/dist/core/{p-b37ca132.entry.js.map → p-8204070b.entry.js.map} +1 -1
- package/dist/core/p-8bebbcc7.entry.js +2 -0
- package/dist/core/{p-63d2e8ec.entry.js.map → p-8bebbcc7.entry.js.map} +1 -1
- package/dist/core/p-93edcce2.entry.js +2 -0
- package/dist/core/{p-b5284ce3.entry.js.map → p-93edcce2.entry.js.map} +1 -1
- package/dist/core/p-9bdce72b.entry.js +2 -0
- package/dist/core/{p-8d5c9030.entry.js.map → p-9bdce72b.entry.js.map} +1 -1
- package/dist/core/p-a4d23e73.entry.js +2 -0
- package/dist/core/{p-25380da6.entry.js.map → p-a4d23e73.entry.js.map} +1 -1
- package/dist/core/p-a5d69694.js +2 -0
- package/dist/core/p-a5d69694.js.map +1 -0
- package/dist/core/p-a89c27c1.entry.js +2 -0
- package/dist/core/{p-3e9ba1c1.entry.js.map → p-a89c27c1.entry.js.map} +1 -1
- package/dist/core/p-aba39622.entry.js +2 -0
- package/dist/core/{p-a5e34e93.entry.js.map → p-aba39622.entry.js.map} +1 -1
- package/dist/core/p-b2275b3d.js +2 -0
- package/dist/core/p-b2275b3d.js.map +1 -0
- package/dist/core/p-b7587525.entry.js +2 -0
- package/dist/core/{p-ae3e2d60.entry.js.map → p-b7587525.entry.js.map} +1 -1
- package/dist/core/p-bce96aac.entry.js +2 -0
- package/dist/core/p-bce96aac.entry.js.map +1 -0
- package/dist/core/p-c836f7cd.entry.js +2 -0
- package/dist/core/{p-d2d8998d.entry.js.map → p-c836f7cd.entry.js.map} +1 -1
- package/dist/core/p-c91928ed.entry.js +2 -0
- package/dist/core/p-c91928ed.entry.js.map +1 -0
- package/dist/core/p-d2f6053f.entry.js +2 -0
- package/dist/core/{p-595a2301.entry.js.map → p-d2f6053f.entry.js.map} +1 -1
- package/dist/core/p-d389c001.entry.js +2 -0
- package/dist/core/{p-f1fe9358.entry.js.map → p-d389c001.entry.js.map} +1 -1
- package/dist/core/p-d5c2db32.entry.js +2 -0
- package/dist/core/{p-9ba104c3.entry.js.map → p-d5c2db32.entry.js.map} +1 -1
- package/dist/core/p-d8def432.entry.js +2 -0
- package/dist/core/{p-72f16a95.entry.js.map → p-d8def432.entry.js.map} +1 -1
- package/dist/core/p-d90a2718.entry.js +2 -0
- package/dist/core/{p-24cde59e.entry.js.map → p-d90a2718.entry.js.map} +1 -1
- package/dist/core/p-d9b4bc20.entry.js +2 -0
- package/dist/core/{p-84fda9dd.entry.js.map → p-d9b4bc20.entry.js.map} +1 -1
- package/dist/core/p-dc94a1da.entry.js +2 -0
- package/dist/core/{p-cf6576fd.entry.js.map → p-dc94a1da.entry.js.map} +1 -1
- package/dist/core/p-e1e4c8f8.entry.js +2 -0
- package/dist/core/p-e1e4c8f8.entry.js.map +1 -0
- package/dist/core/p-e3141382.entry.js +2 -0
- package/dist/core/{p-b966062a.entry.js.map → p-e3141382.entry.js.map} +1 -1
- package/dist/core/p-e4bb6100.entry.js +2 -0
- package/dist/core/{p-16608a87.entry.js.map → p-e4bb6100.entry.js.map} +1 -1
- package/dist/core/p-e4bb6114.entry.js +2 -0
- package/dist/core/{p-9d30e79e.entry.js.map → p-e4bb6114.entry.js.map} +1 -1
- package/dist/core/p-e6b8c610.entry.js +2 -0
- package/dist/core/{p-ef095a1f.entry.js.map → p-e6b8c610.entry.js.map} +1 -1
- package/dist/core/p-ef393836.entry.js +2 -0
- package/dist/core/{p-833ab414.entry.js.map → p-ef393836.entry.js.map} +1 -1
- package/dist/core/p-f0a4439e.entry.js +2 -0
- package/dist/core/p-f0a4439e.entry.js.map +1 -0
- package/dist/core/p-f644cad5.entry.js +2 -0
- package/dist/core/{p-fac1c202.entry.js.map → p-f644cad5.entry.js.map} +1 -1
- package/dist/core/p-f6e2f2f0.entry.js +2 -0
- package/dist/core/{p-00e1e600.entry.js.map → p-f6e2f2f0.entry.js.map} +1 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +1 -1
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/{constants-45f6db4c.js → constants-089b3fdd.js} +2 -2
- package/dist/esm/constants-089b3fdd.js.map +1 -0
- package/dist/esm/{constants-14a7ba8e.js → constants-ab132d9c.js} +2 -2
- package/dist/esm/constants-ab132d9c.js.map +1 -0
- package/dist/esm/core.js +2 -2
- package/dist/esm/gov-accordion-item.entry.js +13 -9
- package/dist/esm/gov-accordion-item.entry.js.map +1 -1
- package/dist/esm/gov-accordion.entry.js +3 -3
- package/dist/esm/gov-accordion.entry.js.map +1 -1
- package/dist/esm/gov-alert.entry.js +2 -2
- package/dist/esm/gov-alert.entry.js.map +1 -1
- package/dist/esm/gov-app.entry.js +79 -7
- package/dist/esm/gov-app.entry.js.map +1 -1
- package/dist/esm/gov-attachments_3.entry.js +4 -4
- package/dist/esm/gov-attachments_3.entry.js.map +1 -1
- package/dist/esm/gov-backdrop.entry.js +2 -2
- package/dist/esm/gov-backdrop.entry.js.map +1 -1
- package/dist/esm/gov-badge.entry.js +3 -3
- package/dist/esm/gov-badge.entry.js.map +1 -1
- package/dist/esm/gov-breadcrumbs.entry.js +4 -34
- package/dist/esm/gov-breadcrumbs.entry.js.map +1 -1
- package/dist/esm/gov-button.entry.js +3 -3
- package/dist/esm/gov-button.entry.js.map +1 -1
- package/dist/esm/gov-card.entry.js +2 -2
- package/dist/esm/gov-card.entry.js.map +1 -1
- package/dist/esm/gov-container.entry.js +2 -2
- package/dist/esm/gov-container.entry.js.map +1 -1
- package/dist/esm/gov-cookiebar.entry.js +2 -2
- package/dist/esm/gov-cookiebar.entry.js.map +1 -1
- package/dist/esm/gov-empty.entry.js +2 -2
- package/dist/esm/gov-empty.entry.js.map +1 -1
- package/dist/esm/gov-error-code.entry.js +2 -2
- package/dist/esm/gov-error-code.entry.js.map +1 -1
- package/dist/esm/gov-form-autocomplete.entry.js +2 -2
- package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
- package/dist/esm/gov-form-checkbox.entry.js +2 -2
- 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-control.entry.js.map +1 -1
- package/dist/esm/gov-form-file.entry.js +2 -2
- package/dist/esm/gov-form-file.entry.js.map +1 -1
- package/dist/esm/gov-form-group.entry.js +2 -2
- package/dist/esm/gov-form-group.entry.js.map +1 -1
- package/dist/esm/gov-form-input.entry.js +2 -2
- package/dist/esm/gov-form-input.entry.js.map +1 -1
- package/dist/esm/gov-form-label.entry.js +2 -2
- package/dist/esm/gov-form-label.entry.js.map +1 -1
- package/dist/esm/gov-form-multi-select.entry.js +2 -2
- 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-password-power.entry.js.map +1 -1
- package/dist/esm/gov-form-radio.entry.js +2 -2
- 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-search.entry.js.map +1 -1
- package/dist/esm/gov-form-select.entry.js +2 -2
- package/dist/esm/gov-form-select.entry.js.map +1 -1
- package/dist/esm/gov-form-switch.entry.js +2 -2
- 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-item.entry.js.map +1 -1
- package/dist/esm/gov-grid.entry.js +2 -2
- package/dist/esm/gov-grid.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +3 -3
- package/dist/esm/gov-icon.entry.js.map +1 -1
- package/dist/esm/gov-layout-column.entry.js +2 -2
- package/dist/esm/gov-layout-column.entry.js.map +1 -1
- package/dist/esm/gov-layout.entry.js +2 -2
- package/dist/esm/gov-layout.entry.js.map +1 -1
- package/dist/esm/gov-loading.entry.js +2 -2
- package/dist/esm/gov-loading.entry.js.map +1 -1
- package/dist/esm/gov-message.entry.js +2 -2
- package/dist/esm/gov-message.entry.js.map +1 -1
- package/dist/esm/gov-modal.entry.js +2 -2
- package/dist/esm/gov-modal.entry.js.map +1 -1
- package/dist/esm/gov-nav-item.entry.js +2 -2
- package/dist/esm/gov-nav-item.entry.js.map +1 -1
- package/dist/esm/gov-nav.entry.js +2 -2
- package/dist/esm/gov-nav.entry.js.map +1 -1
- package/dist/esm/gov-pagination.entry.js +2 -2
- package/dist/esm/gov-pagination.entry.js.map +1 -1
- package/dist/esm/gov-prompt.entry.js +2 -2
- package/dist/esm/gov-prompt.entry.js.map +1 -1
- package/dist/esm/gov-side-nav-item.entry.js +2 -2
- package/dist/esm/gov-side-nav-item.entry.js.map +1 -1
- package/dist/esm/gov-side-nav.entry.js +2 -2
- package/dist/esm/gov-side-nav.entry.js.map +1 -1
- package/dist/esm/gov-skeleton.entry.js +113 -0
- package/dist/esm/gov-skeleton.entry.js.map +1 -0
- package/dist/esm/gov-spacer.entry.js +2 -2
- package/dist/esm/gov-spacer.entry.js.map +1 -1
- package/dist/esm/gov-statsbar-item.entry.js +2 -2
- package/dist/esm/gov-statsbar-item.entry.js.map +1 -1
- package/dist/esm/gov-statsbar.entry.js +2 -2
- package/dist/esm/gov-statsbar.entry.js.map +1 -1
- package/dist/esm/gov-stepper-item.entry.js +2 -2
- package/dist/esm/gov-stepper-item.entry.js.map +1 -1
- package/dist/esm/gov-stepper.entry.js +2 -2
- package/dist/esm/gov-stepper.entry.js.map +1 -1
- package/dist/esm/gov-tabs-item.entry.js +2 -2
- package/dist/esm/gov-tabs-item.entry.js.map +1 -1
- package/dist/esm/gov-tabs.entry.js +2 -2
- package/dist/esm/gov-tabs.entry.js.map +1 -1
- package/dist/esm/gov-tile.entry.js +2 -2
- package/dist/esm/gov-tile.entry.js.map +1 -1
- package/dist/esm/gov-tiles.entry.js +2 -2
- package/dist/esm/gov-tiles.entry.js.map +1 -1
- package/dist/esm/gov-toast.entry.js +2 -2
- package/dist/esm/gov-toast.entry.js.map +1 -1
- package/dist/esm/gov-tooltip-content.entry.js +2 -2
- package/dist/esm/gov-tooltip-content.entry.js.map +1 -1
- package/dist/esm/gov-tooltip.entry.js +2 -2
- package/dist/esm/gov-tooltip.entry.js.map +1 -1
- package/dist/esm/gov-wizzard-item.entry.js +2 -2
- package/dist/esm/gov-wizzard-item.entry.js.map +1 -1
- package/dist/esm/gov-wizzard.entry.js +2 -2
- package/dist/esm/gov-wizzard.entry.js.map +1 -1
- package/dist/esm/{index-00e9a0d5.js → index-b010bfb4.js} +64 -2
- package/dist/esm/index-b010bfb4.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- package/dist/hydrate/index.js +285 -116
- package/dist/stencil.config.js +14 -0
- package/dist/stencil.config.js.map +1 -1
- package/dist/types/components/gov-accordion/constants.d.ts +1 -1
- package/dist/types/components/gov-accordion/gov-accordion-item.d.ts +8 -4
- package/dist/types/components/gov-breadcrumbs/constants.d.ts +0 -4
- package/dist/types/components/gov-breadcrumbs/gov-breadcrumbs.d.ts +0 -14
- package/dist/types/components/gov-button/constants.d.ts +1 -1
- package/dist/types/components/gov-form/checkbox/constants.d.ts +1 -1
- package/dist/types/components/gov-form/group/constants.d.ts +1 -1
- package/dist/types/components/gov-form/label/constants.d.ts +1 -1
- package/dist/types/components/gov-form/message/gov-form-message.d.ts +1 -1
- package/dist/types/components/gov-form/radio/constants.d.ts +1 -1
- package/dist/types/components/gov-form/switch/constants.d.ts +1 -1
- package/dist/types/components/gov-loading/skeleton/constants.d.ts +20 -0
- package/dist/types/components/gov-loading/skeleton/gov-skeleton.d.ts +52 -0
- package/dist/types/components/gov-spacer/constants.d.ts +1 -1
- package/dist/types/components/gov-stepper/constants.d.ts +1 -1
- package/dist/types/components/gov-wizzard/constants.d.ts +1 -1
- package/dist/types/components.d.ts +86 -16
- package/package.json +1 -1
- package/dist/cjs/constants-245999e7.js.map +0 -1
- package/dist/cjs/constants-e175be18.js.map +0 -1
- package/dist/cjs/index-356717ae.js.map +0 -1
- package/dist/collection/components/gov-loading/constants.js.map +0 -1
- package/dist/collection/components/gov-loading/gov-loading.js.map +0 -1
- package/dist/collection/components/gov-tiles/constants.js.map +0 -1
- package/dist/collection/components/gov-tiles/gov-tiles.js.map +0 -1
- package/dist/core/p-00e1e600.entry.js +0 -2
- package/dist/core/p-01bdd4a4.entry.js +0 -2
- package/dist/core/p-0284b5e2.js +0 -2
- package/dist/core/p-0284b5e2.js.map +0 -1
- package/dist/core/p-02c1b4db.entry.js +0 -2
- package/dist/core/p-16608a87.entry.js +0 -2
- package/dist/core/p-1bb5184f.entry.js +0 -2
- package/dist/core/p-24cde59e.entry.js +0 -2
- package/dist/core/p-25380da6.entry.js +0 -2
- package/dist/core/p-3e9ba1c1.entry.js +0 -2
- package/dist/core/p-43811261.entry.js +0 -2
- package/dist/core/p-43811261.entry.js.map +0 -1
- package/dist/core/p-49853c5a.entry.js +0 -2
- package/dist/core/p-4b375a4d.entry.js +0 -2
- package/dist/core/p-4d73d70e.entry.js +0 -2
- package/dist/core/p-4e12d6e3.entry.js +0 -2
- package/dist/core/p-533bd158.entry.js +0 -2
- package/dist/core/p-595a2301.entry.js +0 -2
- package/dist/core/p-5b4e3bdf.entry.js +0 -2
- package/dist/core/p-613d8ed8.entry.js +0 -2
- package/dist/core/p-63d2e8ec.entry.js +0 -2
- package/dist/core/p-682c7cc6.js +0 -3
- package/dist/core/p-682c7cc6.js.map +0 -1
- package/dist/core/p-68d968ac.entry.js +0 -2
- package/dist/core/p-71e57780.entry.js +0 -2
- package/dist/core/p-71e57780.entry.js.map +0 -1
- package/dist/core/p-72f16a95.entry.js +0 -2
- package/dist/core/p-733bd593.entry.js +0 -2
- package/dist/core/p-7ac5f119.entry.js +0 -2
- package/dist/core/p-7ac5f119.entry.js.map +0 -1
- package/dist/core/p-7be3abb5.entry.js +0 -2
- package/dist/core/p-833ab414.entry.js +0 -2
- package/dist/core/p-84fda9dd.entry.js +0 -2
- package/dist/core/p-8a8d846c.entry.js +0 -2
- package/dist/core/p-8d5c9030.entry.js +0 -2
- package/dist/core/p-8dacc8dc.entry.js +0 -2
- package/dist/core/p-9658b6ef.entry.js +0 -2
- package/dist/core/p-99155ec0.entry.js +0 -2
- package/dist/core/p-99155ec0.entry.js.map +0 -1
- package/dist/core/p-9ba104c3.entry.js +0 -2
- package/dist/core/p-9ca0a11c.entry.js +0 -2
- package/dist/core/p-9d30e79e.entry.js +0 -2
- package/dist/core/p-9d51ea56.entry.js +0 -2
- package/dist/core/p-9dd1bbdd.entry.js +0 -2
- package/dist/core/p-9dd1bbdd.entry.js.map +0 -1
- package/dist/core/p-a5e34e93.entry.js +0 -2
- package/dist/core/p-a6c8d474.entry.js +0 -2
- package/dist/core/p-ac33c5ef.entry.js +0 -2
- package/dist/core/p-ae3e2d60.entry.js +0 -2
- package/dist/core/p-b37ca132.entry.js +0 -2
- package/dist/core/p-b5284ce3.entry.js +0 -2
- package/dist/core/p-b966062a.entry.js +0 -2
- package/dist/core/p-bd560ffc.entry.js +0 -2
- package/dist/core/p-bd560ffc.entry.js.map +0 -1
- package/dist/core/p-c0d3d3e0.entry.js +0 -2
- package/dist/core/p-c9948e57.entry.js +0 -2
- package/dist/core/p-cd869237.js +0 -2
- package/dist/core/p-cd869237.js.map +0 -1
- package/dist/core/p-cf6576fd.entry.js +0 -2
- package/dist/core/p-d2d8998d.entry.js +0 -2
- package/dist/core/p-e57d250f.entry.js +0 -2
- package/dist/core/p-e86bffd0.entry.js +0 -2
- package/dist/core/p-ef095a1f.entry.js +0 -2
- package/dist/core/p-f1fe9358.entry.js +0 -2
- package/dist/core/p-f531f5c4.entry.js +0 -2
- package/dist/core/p-fac1c202.entry.js +0 -2
- package/dist/core/p-fc9d66ae.entry.js +0 -2
- package/dist/esm/constants-14a7ba8e.js.map +0 -1
- package/dist/esm/constants-45f6db4c.js.map +0 -1
- package/dist/esm/index-00e9a0d5.js.map +0 -1
- /package/dist/collection/components/gov-loading/{constants.js → loading/constants.js} +0 -0
- /package/dist/collection/components/{gov-tiles → gov-tile/container}/constants.js +0 -0
- /package/dist/types/components/gov-loading/{constants.d.ts → loading/constants.d.ts} +0 -0
- /package/dist/types/components/gov-loading/{gov-loading.d.ts → loading/gov-loading.d.ts} +0 -0
- /package/dist/types/components/{gov-tiles → gov-tile/container}/constants.d.ts +0 -0
- /package/dist/types/components/{gov-tiles → gov-tile/container}/gov-tiles.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-card/constants.ts","../../../packages/core/src/components/gov-card/gov-card.scss?tag=gov-card","../../../packages/core/src/components/gov-card/gov-card.tsx"],"names":["CardClass","root","header","title","inner","img","main","content","icon","btns","footer","arrow","govCardCss","GovCard","[object Object]","hostRef","this","h","govHost","host","headlineId","createID","contentId","newValue","validTags","includes","govErrorLog","isExpanded","label","expanded","validateHeadlineTag","headlineTag","canValidateWcagOnRender","delay","validateWcag","govToggle","emit","open","element","HeadlineTag","Host","class","classes","is-expanded","collapsible","booleanString","promotion","id","aria-label","wcagTriggerLabel","aria-labelledby","wcagTriggerLabelledBy","aria-expanded","aria-controls","onClick","onClickHandler","bind","name","aria-hidden","undefined","hidden","hasSlot","e","stopPropagation","emmitChange","validateWcagLabel"],"mappings":"0RAAO,MAAMA,EAAY,CACxBC,KAAM,WACNC,OAAQ,mBACRC,MAAO,kBACPC,MAAO,kBACPC,IAAK,gBACLC,KAAM,iBACNC,QAAS,oBACTC,KAAM,iBACNC,KAAM,iBACNC,OAAQ,mBACRC,MAAO,mBCXR,MAAMC,EAAa,mtKCeNC,EAAO,MAKnBC,YAAAC,kEAWsC,4CAQE,oBAIH,uBAI+B,oGA1BnEC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,WAAaC,EAAS,mBAC3BL,KAAKM,UAAYD,EAAS,kBAwC3BP,oBAAoBS,GACnB,MAAMC,EAAY,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QACvD,GAAID,EAAU,CACb,IAAKC,EAAUC,SAASF,GAAW,CAClCG,EAAY,IAAI1B,EAAUC,cAAcsB,uBAK3CT,oBACCE,KAAKW,WAAaX,KAAKY,MAAQZ,KAAKa,SAAW,KAC/Cb,KAAKc,oBAAoBd,KAAKe,aAG/BjB,2BACC,GAAIkB,IAA2B,OACxBC,EAAM,WACNjB,KAAKkB,gBAILpB,cACPE,KAAKmB,UAAUC,KAAK,CAAEC,KAAMrB,KAAKW,WAAYW,QAAStB,KAAKG,OAG5DL,SACC,MAAMyB,EAAcvB,KAAKe,YAEzB,OACCd,EAACuB,EAAI,CAACC,MAAOzB,KAAKC,EAAEyB,QAAQ1C,EAAUC,MAAK0C,cAAe3B,KAAKW,WAAYiB,YAAaC,EAAc7B,KAAK4B,aAAcE,UAAW9B,KAAK8B,WACvI9B,KAAKY,OAASZ,KAAK4B,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zC,EAAUU,QACrBO,EAAA,OAAA,CAAMwC,KAAK,cAQT3C,eAAegD,GACtBA,EAAEC,kBACF,GAAI/C,KAAK4B,YAAa,CACrB5B,KAAKW,YAAcX,KAAKW,WACxBX,KAAKgD,eAQPlD,aACC,GAAIE,KAAK4B,YAAa,CACrB5B,KAAKW,WAAa,KAClBX,KAAKgD,eAQPlD,cACC,GAAIE,KAAK4B,YAAa,CACrB5B,KAAKW,WAAa,MAClBX,KAAKgD,eAQPlD,qBACC,GAAIE,KAAK4B,YAAa,CACrBqB,EAAkBjD,KAAKiC,iBAAkBjC,KAAKmC,sBAAuBnD,EAAUC","sourcesContent":["export const CardClass = {\n\troot: 'gov-card',\n\theader: 'gov-card__header',\n\ttitle: 'gov-card__title',\n\tinner: 'gov-card__inner',\n\timg: 'gov-card__img',\n\tmain: 'gov-card__main',\n\tcontent: 'gov-card__content',\n\ticon: 'gov-card__icon',\n\tbtns: 'gov-card__btns',\n\tfooter: 'gov-card__footer',\n\tarrow: 'gov-card__arrow',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-card\";\n\n#{$class} {\n\t@include base(flex);\n\tflex-direction: column;\n\tborder: $card-border;\n\tborder-radius: $border-radius;\n\tbackground: $card-bg;\n\toverflow: hidden;\n\t&__header {\n\t\tgap: rem-calc(28);\n\t\twidth: 100%;\n\t\tpadding: rem-calc(24);\n\t\tborder-bottom: $card-border;\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttext-transform: none;\n\t\ttransition: background-color $t ease-in-out;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(16);\n\t\theight: rem-calc(16);\n\t\tcolor: $card-arrow-color;\n\t}\n\t&__title {\n\t\t@include general;\n\t\t@include typography($font-size-xl);\n\t\tcolor: $card-title-color;\n\t\tfont-weight: 700;\n\t}\n\t&__img {\n\t\twidth: 100%;\n\t\tmargin: 0;\n\t\tline-height: 1;\n\t\timg {\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\t@include parameter(\"aria-hidden\") {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\t&__main {\n\t\tdisplay: flex;\n\t\tgap: 16px 24px;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\tpadding: rem-calc(24);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(40);\n\t\theight: rem-calc(40);\n\t\tcolor: $card-icon-color;\n\t}\n\t&__btns {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tflex: 0 0 auto;\n\t\tflex-wrap: wrap;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t}\n\t&__footer {\n\t\t@include reset-last-margin();\n\t\tpadding: rem-calc(16 24);\n\t\tbackground: $card-footer-bg;\n\t\tp {\n\t\t\t@include typography($font-size-s);\n\t\t}\n\t}\n\n\t// STATES\n\t@include parameter(\"is-expanded\") {\n\t\theight: 100%;\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"collapsible\") {\n\t\t#{$class} {\n\t\t\t&__header {\n\t\t\t\t@include button-core();\n\t\t\t\t@include focus-outline($border-radius, rem-calc(-2));\n\t\t\t\tjustify-content: space-between;\n\t\t\t\ttext-align: left;\n\t\t\t\t@include hover() {\n\t\t\t\t\tbackground: $card-header-hover-bg;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"is-expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__header {\n\t\t\t\t\tborder-bottom: $card-border;\n\t\t\t\t}\n\t\t\t\t&__arrow {\n\t\t\t\t\ttransform: scale(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\t#{$class} {\n\t\t\t\t&__main {\n\t\t\t\t\tflex-direction: row;\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t\t&__icon {\n\t\t\t\t\twidth: rem-calc(48);\n\t\t\t\t\theight: rem-calc(48);\n\t\t\t\t}\n\t\t\t\t&__btns {\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch, State, Method, Event, EventEmitter } from '@stencil/core'\nimport { CardClass } from './constants'\nimport { govHost, booleanString } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { createID } from '../../utils/string.utils'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateWcagLabel } 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\tstyleUrl: 'gov-card.scss',\n})\nexport class GovCard {\n\tprivate h: GovHost\n\tprivate readonly headlineId: string\n\tprivate readonly contentId: string\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 * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Item label of the card\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Defines wether 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 by default\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Used to change the HMTL tag in the card headline for correct semantic structure\n\t */\n\t@Prop({ attribute: 'headline-tag' }) readonly headlineTag: string = 'h3'\n\t/**\n\t * Adds accessible label for the collapsible button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-trigger-label' }) wcagTriggerLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for collapsible card\n\t */\n\t@Prop({ attribute: 'wcag-trigger-labelled-by' }) wcagTriggerLabelledBy: string\n\t/**\n\t * Called when the card toggle state changes\n\t */\n\t@Event({ eventName: 'gov-toggle' }) govToggle: EventEmitter<GovCardChangeEvent>\n\t@State() isExpanded: boolean\n\n\t@Watch('headlineTag')\n\tvalidateHeadlineTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${CardClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpanded = this.label ? this.expanded : true\n\t\tthis.validateHeadlineTag(this.headlineTag)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govToggle.emit({ open: this.isExpanded, element: this.host })\n\t}\n\n\trender() {\n\t\tconst HeadlineTag = this.headlineTag\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(CardClass.root)} is-expanded={this.isExpanded} collapsible={booleanString(this.collapsible)} promotion={this.promotion}>\n\t\t\t\t{this.label && 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.wcagTriggerLabel}\n\t\t\t\t\t\taria-labelledby={this.wcagTriggerLabelledBy}\n\t\t\t\t\t\taria-expanded={booleanString(this.isExpanded)}\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<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\n\t\t\t\t\t\t<gov-icon class={CardClass.arrow} name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t</button>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.label && !this.collapsible ? (\n\t\t\t\t\t<div class={CardClass.header}>\n\t\t\t\t\t\t<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\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.isExpanded) : undefined}\n\t\t\t\t\thidden={this.collapsible ? !this.isExpanded : 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<p class={CardClass.img}>\n\t\t\t\t\t\t\t<slot name=\"img\" />\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<div class={CardClass.main}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<div class={CardClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{this.h.hasSlot('btn') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.btns}>\n\t\t\t\t\t\t\t\t<slot name=\"btn\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\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.isExpanded = !this.isExpanded\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Open the card if it is collapsible\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = true\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Close the card if it is collapsible\n\t */\n\t@Method()\n\tasync close(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = false\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tvalidateWcagLabel(this.wcagTriggerLabel, this.wcagTriggerLabelledBy, CardClass.root)\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-card/constants.ts","../../../packages/core/src/components/gov-card/gov-card.scss?tag=gov-card","../../../packages/core/src/components/gov-card/gov-card.tsx"],"names":["CardClass","root","header","title","inner","img","main","content","icon","btns","footer","arrow","govCardCss","GovCard","[object Object]","hostRef","this","h","govHost","host","headlineId","createID","contentId","newValue","validTags","includes","govErrorLog","isExpanded","label","expanded","validateHeadlineTag","headlineTag","canValidateWcagOnRender","delay","validateWcag","govToggle","emit","open","element","HeadlineTag","Host","class","classes","is-expanded","collapsible","booleanString","promotion","id","aria-label","wcagTriggerLabel","aria-labelledby","wcagTriggerLabelledBy","aria-expanded","aria-controls","onClick","onClickHandler","bind","name","aria-hidden","undefined","hidden","hasSlot","e","stopPropagation","emmitChange","validateWcagLabel"],"mappings":"+RAAO,MAAMA,EAAY,CACxBC,KAAM,WACNC,OAAQ,mBACRC,MAAO,kBACPC,MAAO,kBACPC,IAAK,gBACLC,KAAM,iBACNC,QAAS,oBACTC,KAAM,iBACNC,KAAM,iBACNC,OAAQ,mBACRC,MAAO,mBCXR,MAAMC,EA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__header',\n\ttitle: 'gov-card__title',\n\tinner: 'gov-card__inner',\n\timg: 'gov-card__img',\n\tmain: 'gov-card__main',\n\tcontent: 'gov-card__content',\n\ticon: 'gov-card__icon',\n\tbtns: 'gov-card__btns',\n\tfooter: 'gov-card__footer',\n\tarrow: 'gov-card__arrow',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-card\";\n\n#{$class} {\n\t@include base(flex);\n\tflex-direction: column;\n\tborder: $card-border;\n\tborder-radius: $border-radius;\n\tbackground: $card-bg;\n\toverflow: hidden;\n\t&__header {\n\t\tgap: rem-calc(28);\n\t\twidth: 100%;\n\t\tpadding: rem-calc(24);\n\t\tborder-bottom: $card-border;\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttext-transform: none;\n\t\ttransition: background-color $t ease-in-out;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(16);\n\t\theight: rem-calc(16);\n\t\tcolor: $card-arrow-color;\n\t}\n\t&__title {\n\t\t@include general;\n\t\t@include typography($font-size-xl);\n\t\tcolor: $card-title-color;\n\t\tfont-weight: 700;\n\t}\n\t&__img {\n\t\twidth: 100%;\n\t\tmargin: 0;\n\t\tline-height: 1;\n\t\timg {\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\t@include parameter(\"aria-hidden\") {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\t&__main {\n\t\tdisplay: flex;\n\t\tgap: 16px 24px;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\tpadding: rem-calc(24);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(40);\n\t\theight: rem-calc(40);\n\t\tcolor: $card-icon-color;\n\t}\n\t&__btns {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tflex: 0 0 auto;\n\t\tflex-wrap: wrap;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t}\n\t&__footer {\n\t\t@include reset-last-margin();\n\t\tpadding: rem-calc(16 24);\n\t\tbackground: $card-footer-bg;\n\t\tp {\n\t\t\t@include typography($font-size-s);\n\t\t}\n\t}\n\n\t// STATES\n\t@include parameter(\"is-expanded\") {\n\t\theight: 100%;\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"collapsible\") {\n\t\t#{$class} {\n\t\t\t&__header {\n\t\t\t\t@include button-core();\n\t\t\t\t@include focus-outline($border-radius, rem-calc(-2));\n\t\t\t\tjustify-content: space-between;\n\t\t\t\ttext-align: left;\n\t\t\t\t@include hover() {\n\t\t\t\t\tbackground: $card-header-hover-bg;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"is-expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__header {\n\t\t\t\t\tborder-bottom: $card-border;\n\t\t\t\t}\n\t\t\t\t&__arrow {\n\t\t\t\t\ttransform: scale(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\t#{$class} {\n\t\t\t\t&__main {\n\t\t\t\t\tflex-direction: row;\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t\t&__icon {\n\t\t\t\t\twidth: rem-calc(48);\n\t\t\t\t\theight: rem-calc(48);\n\t\t\t\t}\n\t\t\t\t&__btns {\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch, State, Method, Event, EventEmitter } from '@stencil/core'\nimport { CardClass } from './constants'\nimport { govHost, booleanString } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { createID } from '../../utils/string.utils'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateWcagLabel } 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\tstyleUrl: 'gov-card.scss',\n})\nexport class GovCard {\n\tprivate h: GovHost\n\tprivate readonly headlineId: string\n\tprivate readonly contentId: string\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 * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Item label of the card\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Defines wether 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 by default\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Used to change the HMTL tag in the card headline for correct semantic structure\n\t */\n\t@Prop({ attribute: 'headline-tag' }) readonly headlineTag: string = 'h3'\n\t/**\n\t * Adds accessible label for the collapsible button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-trigger-label' }) wcagTriggerLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for collapsible card\n\t */\n\t@Prop({ attribute: 'wcag-trigger-labelled-by' }) wcagTriggerLabelledBy: string\n\t/**\n\t * Called when the card toggle state changes\n\t */\n\t@Event({ eventName: 'gov-toggle' }) govToggle: EventEmitter<GovCardChangeEvent>\n\t@State() isExpanded: boolean\n\n\t@Watch('headlineTag')\n\tvalidateHeadlineTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${CardClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpanded = this.label ? this.expanded : true\n\t\tthis.validateHeadlineTag(this.headlineTag)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govToggle.emit({ open: this.isExpanded, element: this.host })\n\t}\n\n\trender() {\n\t\tconst HeadlineTag = this.headlineTag\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(CardClass.root)} is-expanded={this.isExpanded} collapsible={booleanString(this.collapsible)} promotion={this.promotion}>\n\t\t\t\t{this.label && 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.wcagTriggerLabel}\n\t\t\t\t\t\taria-labelledby={this.wcagTriggerLabelledBy}\n\t\t\t\t\t\taria-expanded={booleanString(this.isExpanded)}\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<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\n\t\t\t\t\t\t<gov-icon class={CardClass.arrow} name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t</button>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.label && !this.collapsible ? (\n\t\t\t\t\t<div class={CardClass.header}>\n\t\t\t\t\t\t<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\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.isExpanded) : undefined}\n\t\t\t\t\thidden={this.collapsible ? !this.isExpanded : 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<p class={CardClass.img}>\n\t\t\t\t\t\t\t<slot name=\"img\" />\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<div class={CardClass.main}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<div class={CardClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{this.h.hasSlot('btn') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.btns}>\n\t\t\t\t\t\t\t\t<slot name=\"btn\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\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.isExpanded = !this.isExpanded\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Open the card if it is collapsible\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = true\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Close the card if it is collapsible\n\t */\n\t@Method()\n\tasync close(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = false\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tvalidateWcagLabel(this.wcagTriggerLabel, this.wcagTriggerLabelledBy, CardClass.root)\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as a,h as i,H as n,g as o}from"./p-4af5e4f4.js";import{g as r,s as t}from"./p-3f37ddb6.js";const e={root:"gov-container"};const s=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-container{display:block;width:100%;max-width:calc(var(--gov-container-width, 73.75rem) + 2 * var(--gov-container-padding, 2.5rem));margin-right:auto;margin-left:auto;padding-right:var(--gov-container-padding-mobile, 1.25rem);padding-left:var(--gov-container-padding-mobile, 1.25rem)}@media (min-width: 48em){.gov-container{padding-right:var(--gov-container-padding, 2.5rem);padding-left:var(--gov-container-padding, 2.5rem)}}";const d=class{constructor(i){a(this,i);this.h=r(this.host)}render(){return i(n,{class:this.h.classes(e.root)},i("slot",null))}async slottedChildren(){return Promise.resolve(t(this.host))}get host(){return o(this)}};d.style=s;export{d as gov_container};
|
|
2
|
+
//# sourceMappingURL=p-2f88b6d9.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-container/constants.tsx","../../../packages/core/src/components/gov-container/gov-container.scss?tag=gov-container","../../../packages/core/src/components/gov-container/gov-container.tsx"],"names":["ContainerClass","root","govContainerCss","GovContainer","[object Object]","hostRef","this","h","govHost","host","Host","class","classes","Promise","resolve","slottedChildren"],"mappings":"oGAAO,MAAMA,EAAiB,CAC7BC,KAAM,iBCDP,MAAMC,EAAkB,
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-container/constants.tsx","../../../packages/core/src/components/gov-container/gov-container.scss?tag=gov-container","../../../packages/core/src/components/gov-container/gov-container.tsx"],"names":["ContainerClass","root","govContainerCss","GovContainer","[object Object]","hostRef","this","h","govHost","host","Host","class","classes","Promise","resolve","slottedChildren"],"mappings":"oGAAO,MAAMA,EAAiB,CAC7BC,KAAM,iBCDP,MAAMC,EAAkB,6wBCSXC,EAAY,MAGxBC,YAAAC,aACCC,KAAKC,EAAIC,EAAQF,KAAKG,MAKvBL,SACC,OACCG,EAACG,EAAI,CAACC,MAAOL,KAAKC,EAAEK,QAAQZ,EAAeC,OAC1CM,EAAA,OAAA,OAWHH,wBACC,OAAOS,QAAQC,QAAQC,EAAgBT,KAAKG","sourcesContent":["export const ContainerClass = {\n\troot: 'gov-container',\n}\n","/*\n * Container\n */\n\n$class: \".gov-container\";\n\n#{$class} {\n\t@include container();\n}\n","import { Component, Element, h, Host, Method } from '@stencil/core'\nimport { govHost, slottedChildren } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { ContainerClass } from './constants'\n\n@Component({\n\ttag: 'gov-container',\n\tstyleUrl: 'gov-container.scss',\n})\nexport class GovContainer {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovContainerElement\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(ContainerClass.root)}>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Returns slotted children\n\t *\n\t * @return {Promise<Node[]>}\n\t */\n\t@Method()\n\tasync slottedChildren(): Promise<Node[]> {\n\t\treturn Promise.resolve(slottedChildren(this.host))\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,h as i,H as n,g as a}from"./p-4af5e4f4.js";import{g as r,p as t}from"./p-3f37ddb6.js";const e={root:"gov-loading",content:"gov-loading__content",icon:"gov-loading__icon"};const s='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-loading{display:none}.gov-loading__content{z-index:101;position:fixed;top:50%;left:50%;display:flex;gap:1rem;flex-direction:column;align-items:center;min-width:9.6875rem;padding:1.5rem;border-radius:0.5rem;background:var(--gov-loading-bg, rgba(var(--gov-color-secondary-400-rgb), 0.8));color:var(--gov-loading-color, var(--gov-color-primary));text-align:center;transform:translate(-50%, -50%)}.gov-loading__icon{width:4rem;height:4rem;line-height:1}.gov-loading[loading=""],.gov-loading[loading=true i],.gov-loading[loading="1"]{display:block}';const g=class{constructor(i){o(this,i);this.loading=false;this.h=r(this.host)}render(){return i(n,{class:this.h.classes(e.root),loading:this.loading},i("div",{class:e.content},i("gov-icon",{class:t([e.icon,"gov-spin-animation"]),name:"loader"}),i("slot",null)),i("gov-backdrop",{visible:this.loading,inverse:true}))}get host(){return a(this)}};g.style=s;export{g as gov_loading};
|
|
2
|
+
//# sourceMappingURL=p-30b162df.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-loading/loading/constants.ts","../../../packages/core/src/components/gov-loading/loading/gov-loading.scss?tag=gov-loading","../../../packages/core/src/components/gov-loading/loading/gov-loading.tsx"],"names":["LoadingClass","root","content","icon","govLoadingCss","GovLoading","[object Object]","hostRef","this","h","govHost","host","Host","class","classes","loading","prepareClasses","name","visible","inverse"],"mappings":"oGAAO,MAAMA,EAAe,CAC3BC,KAAM,cACNC,QAAS,uBACTC,KAAM,qBCHP,MAAMC,EAAgB,m4BCSTC,EAAU,MAGtBC,YAAAC,0BAQkB,MAPjBC,KAAKC,EAAIC,EAAQF,KAAKG,MASvBL,SACC,OACCG,EAACG,EAAI,CAACC,MAAOL,KAAKC,EAAEK,QAAQd,EAAaC,MAAOc,QAASP,KAAKO,SAC7DN,EAAA,MAAA,CAAKI,MAAOb,EAAaE,SACxBO,EAAA,WAAA,CAAUI,MAAOG,EAAe,CAAChB,EAAaG,KAAM,uBAAwBc,KAAK,WACjFR,EAAA,OAAA,OAEDA,EAAA,eAAA,CAAcS,QAASV,KAAKO,QAASI,QAAS","sourcesContent":["export const LoadingClass = {\n\troot: 'gov-loading',\n\tcontent: 'gov-loading__content',\n\ticon: 'gov-loading__icon',\n}\n","/*\n * Loading\n */\n\n$class: \".gov-loading\";\n\n#{$class} {\n\tdisplay: none;\n\t&__content {\n\t\t@include z-index(\"modal\", 1);\n\t\tposition: fixed;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tmin-width: rem-calc(155);\n\t\tpadding: rem-calc(24);\n\t\tborder-radius: rem-calc(8);\n\t\tbackground: $loading-bg;\n\t\tcolor: $loading-color;\n\t\ttext-align: center;\n\t\ttransform: translate(-50%, -50%);\n\t}\n\t&__icon {\n\t\twidth: rem-calc(64);\n\t\theight: rem-calc(64);\n\t\tline-height: 1;\n\t}\n\n\t// STATES\n\t@include parameter(\"loading\") {\n\t\tdisplay: block;\n\t}\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core'\nimport { LoadingClass } from './constants'\nimport { govHost, prepareClasses } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-loading',\n\tstyleUrl: 'gov-loading.scss',\n})\nexport class GovLoading {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovLoadingElement\n\t/**\n\t * Determine if loading is active\n\t */\n\t@Prop() loading = false\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(LoadingClass.root)} loading={this.loading}>\n\t\t\t\t<div class={LoadingClass.content}>\n\t\t\t\t\t<gov-icon class={prepareClasses([LoadingClass.icon, 'gov-spin-animation'])} name=\"loader\"></gov-icon>\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\t\t\t\t<gov-backdrop visible={this.loading} inverse={true} />\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,c as r,h as t,H as e,g as n}from"./p-4af5e4f4.js";import{F as a}from"./p-1c1d0bbe.js";import{v as i}from"./p-26acf964.js";import{S as s}from"./p-55500e5a.js";import{V as g}from"./p-ff7365ae.js";import{p as c,d as v}from"./p-03990da5.js";import{g as l,p as u,t as p}from"./p-3f37ddb6.js";import{c as h,v as d}from"./p-364b4792.js";import{c as b}from"./p-c20102ff.js";import{c as m}from"./p-24636c53.js";import"./p-561fa17b.js";const _=c(s,["_S","_M"]);const y=c(g,["PRIMARY","SECONDARY"]);var f;(function(o){o["BUTTON"]="button";o["SELECT"]="select"})(f||(f={}));const w={root:"gov-pagination",list:"gov-pagination__list",item:"gov-pagination__item",itemArrow:"gov-pagination__item--arrow",itemMore:"gov-pagination__item--more",itemSelect:"gov-pagination__item--select",inner:"gov-pagination__inner",arrow:"gov-pagination__arrow"};function k(o,r=1,t=10,e=10){const n=Math.ceil(o/t);if(r<1){r=1}else if(r>n){r=n}let a,i;if(n<=e){a=1;i=n}else{const o=Math.floor(e/2);const t=Math.ceil(e/2)-1;if(r<=o){a=1;i=e}else if(r+t>=n){a=n-e+1;i=n}else{a=r-o;i=r+t}}const s=(r-1)*t;const g=Math.min(s+t-1,o-1);const c=Array.from(Array(i+1-a).keys()).map((o=>a+o));return{totalItems:o,currentPage:r,pageSize:t,totalPages:n,startPage:a,endPage:i,startIndex:s,endIndex:g,pages:c}}const x=(o,r)=>[...Array(r+1).keys()].slice(o);const z=".gov-pagination__list{margin:0;padding:0}.gov-pagination__list .gov-pagination__item{margin:0;padding:0;background:none}.gov-pagination__list .gov-pagination__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-pagination{position:relative;display:block;width:100%}.gov-pagination__list{display:flex;align-items:center;flex-wrap:wrap;font-weight:bold;text-align:center}.gov-pagination__list .gov-pagination__item{display:flex;justify-content:center;align-items:center;margin:0;padding:0.125rem;border-radius:var(--gov-border-radius, 0.1875rem);overflow:hidden}.gov-pagination__list .gov-pagination__item--arrow{display:flex}.gov-pagination__list .gov-pagination__item--select{z-index:1;display:flex;overflow:visible;padding:0rem 1rem}.gov-pagination__arrow{margin:0}.gov-pagination__item--more .gov-form-select select{border:none;padding-right:0.75rem !important}.gov-pagination__item--more .gov-form-select .gov-icon{display:none}.gov-pagination__inner{display:flex;justify-content:center;align-items:center;align-self:stretch;width:100%;text-decoration:none}.gov-pagination__inner[wcag-current=true][type=solid][variant=primary] .element{background-color:var(--gov-button-primary-solid-hover-bg, var(--gov-color-primary-700));color:var(--gov-button-primary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=primary] .element{background-color:var(--gov-button-primary-outlined-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-outlined-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=base][variant=primary] .element{background-color:var(--gov-button-primary-base-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-base-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=link][variant=primary] .element{background-color:var(--gov-button-primary-link-hover-bg, transparent);color:var(--gov-button-primary-link-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=secondary] .element{background-color:var(--gov-button-secondary-solid-hover-bg, var(--gov-color-secondary-900));color:var(--gov-button-secondary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=secondary] .element{background-color:var(--gov-button-secondary-outlined-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-outlined-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=base][variant=secondary] .element{background-color:var(--gov-button-secondary-base-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-base-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=link][variant=secondary] .element{background-color:var(--gov-button-secondary-link-hover-bg, transparent);color:var(--gov-button-secondary-link-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=error] .element{background-color:var(--gov-button-error-solid-hover-bg, var(--gov-color-error-500));color:var(--gov-button-error-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=error] .element{background-color:var(--gov-button-error-outlined-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-outlined-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=base][variant=error] .element{background-color:var(--gov-button-error-base-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-base-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=link][variant=error] .element{background-color:var(--gov-button-error-link-hover-bg, transparent);color:var(--gov-button-error-link-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=solid][variant=success] .element{background-color:var(--gov-button-success-solid-hover-bg, var(--gov-color-success-600));color:var(--gov-button-success-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=success] .element{background-color:var(--gov-button-success-outlined-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-outlined-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=success] .element{background-color:var(--gov-button-success-base-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-base-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=success] .element{background-color:var(--gov-button-success-link-hover-bg, transparent);color:var(--gov-button-success-link-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=solid][variant=warning] .element{background-color:var(--gov-button-warning-solid-hover-bg, var(--gov-color-warning-600));color:var(--gov-button-warning-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=warning] .element{background-color:var(--gov-button-warning-outlined-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-outlined-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=warning] .element{background-color:var(--gov-button-warning-base-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-base-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=warning] .element{background-color:var(--gov-button-warning-link-hover-bg, transparent);color:var(--gov-button-warning-link-hover-color, var(--gov-color-warning-500))}.gov-pagination[size=s] .gov-pagination__inner{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);font-weight:inherit}.gov-pagination[size=s] .gov-pagination__inner .element{min-width:var(--gov-pagination-s-button-size, 2rem)}.gov-pagination[size=m] .gov-pagination__inner{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);font-weight:inherit}.gov-pagination[size=m] .gov-pagination__inner .element{min-width:var(--gov-pagination-m-button-size, 2.5rem)}";const j=class{constructor(t){o(this,t);this.govPage=r(this,"gov-page",7);this.type="button";this.current=1;this.total=undefined;this.inverse=undefined;this.size="m";this.variant="primary";this.pageSize=10;this.maxPages=5;this.link=undefined;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.wcagSelectLabel="Vybrat stranu";this.wcagPageLabel="Strana";this.pagination=undefined;this.h=l(this.host);this.pageSelectId=m("GovPageSelect")}validateType(o){i(f,o,w.root)}validateSize(o){i(_,o,w.root)}validateVariant(o){i(y,o,w.root)}componentWillLoad(){this.recalculatePagination(this.current);this.validateSize(this.size);this.validateVariant(this.variant)}async componentDidRender(){if(b()){await v(500);await this.validateWcag()}}recalculatePagination(o){this.pagination=k(this.total,o,this.pageSize,this.maxPages)}isActivePageClass(o,r){if(this.pagination.currentPage===r){return o+" is-active"}else{return o}}prepareLinkUrl(o){if(this.link){return String(this.link).replace("{PAGE}",String(o))}return undefined}resetSelectValue(){if(this.spreadSelectRef){this.spreadSelectRef.getInstance().then((o=>{o.value="..."}))}}render(){const o=(o,r)=>{const e=o===-1;const n=p(this.pagination.currentPage===o?true:undefined);return t("gov-button",{href:this.prepareLinkUrl(o),variant:this.variant,size:this.size,type:"base",disabled:e,"on-gov-click":r=>this.onClickHandler(r,o),"wcag-label":o>-1?this.wcagPageLabel+" "+o:undefined,"wcag-current":n,class:w.inner},r)};return t(e,{class:this.h.classes(w.root),type:this.type,variant:this.variant,size:this.size},t("nav",{"aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy},t("ul",{class:w.list},t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.currentPage>1?1:-1,t("gov-icon",{class:w.arrow,name:"chevron-double-left"}))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.startPage<this.pagination.currentPage?this.pagination.currentPage-1:-1,t("gov-icon",{class:w.arrow,name:"chevron-left"}))),this.type=="select"?t("li",{class:u([w.item,w.itemSelect])},t("span",{class:w.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:"m","wcag-labelled-by":this.pageSelectId,"on-gov-change":this.onSelectHandler.bind(this)},x(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:this.pagination.currentPage===o},o)))))):t(a,null,this.pagination.pages.map((r=>t("li",{class:this.isActivePageClass(w.item,r)},o(r,r)))),t("li",{class:u([w.item,w.itemMore])},t("span",{class:w.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:"m","wcag-labelled-by":this.pageSelectId,ref:o=>this.spreadSelectRef=o,"on-gov-change":this.onSelectHandler.bind(this)},t("option",{selected:true,hidden:true},"..."),x(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:false},o))))))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.currentPage+1:-1,t("gov-icon",{class:w.arrow,name:"chevron-right"}))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.totalPages:-1,t("gov-icon",{class:w.arrow,name:"chevron-double-right"}))))))}onClickHandler(o,r){o.stopPropagation();this.recalculatePagination(r);this.govPage.emit(Object.assign({},this.pagination))}onSelectHandler(o){o.stopPropagation();const r=o.target;const t=parseInt(r.value);this.resetSelectValue();if(isNaN(t)===false){this.recalculatePagination(t);if(this.link){window.location.href=this.prepareLinkUrl(t)}else{this.govPage.emit(Object.assign({},this.pagination))}}}async validateWcag(){h(this.wcagPageLabel,"wcag-page-label",w.root);d(this.wcagLabel,this.wcagLabelledBy,w.root);if(this.type==="select"){h(this.wcagSelectLabel,"wcag-select-label",w.root)}}get host(){return n(this)}static get watchers(){return{type:["validateType"],size:["validateSize"],variant:["validateVariant"]}}};j.style=z;export{j as gov_pagination};
|
|
2
|
+
//# sourceMappingURL=p-337fb136.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-pagination/constants.ts","../../../packages/core/src/components/gov-pagination/pagination.ts","../../../packages/core/src/utils/array.utils.ts","../../../packages/core/src/components/gov-pagination/gov-pagination.scss?tag=gov-pagination","../../../packages/core/src/components/gov-pagination/gov-pagination.tsx"],"names":["PaginationSizes","pick","Sizes","PaginationVariants","Variants","PaginationTypes","PaginationClass","root","list","item","itemArrow","itemMore","itemSelect","inner","arrow","paginate","totalItems","currentPage","pageSize","maxPages","totalPages","Math","ceil","startPage","endPage","maxPagesBeforeCurrentPage","floor","maxPagesAfterCurrentPage","startIndex","endIndex","min","pages","Array","from","keys","map","i","createArrayRange","to","slice","govPaginationCss","GovPagination","[object Object]","hostRef","this","h","govHost","host","pageSelectId","createID","newValue","validateProp","recalculatePagination","current","validateSize","size","validateVariant","variant","canValidateWcagOnRender","delay","validateWcag","pagination","total","originalClass","page","link","String","replace","undefined","spreadSelectRef","getInstance","then","el","value","pageResolver","content","isDisabled","ariaCurrent","toBoolAttrIfDefined","href","prepareLinkUrl","type","disabled","on-gov-click","e","onClickHandler","wcag-label","wcagPageLabel","wcag-current","class","Host","classes","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","prepareClasses","name","id","hidden","wcagSelectLabel","wcag-labelled-by","on-gov-change","onSelectHandler","bind","selected","Fragment","isActivePageClass","ref","stopPropagation","govPage","emit","Object","assign","target","parseInt","resetSelectValue","isNaN","window","location","validateWcagProp","validateWcagLabel"],"mappings":"wbAKO,MAAMA,EAAkBC,EAAKC,EAAO,CAAC,KAAM,OAG3C,MAAMC,EAAqBF,EAAKG,EAAU,CAAC,UAAW,cAG7D,IAAYC,GAAZ,SAAYA,GACXA,EAAA,UAAA,SACAA,EAAA,UAAA,UAFD,CAAYA,IAAAA,EAAe,KAMpB,MAAMC,EAAkB,CAC9BC,KAAM,iBACNC,KAAM,uBACNC,KAAM,uBACNC,UAAW,8BACXC,SAAU,6BACVC,WAAY,+BACZC,MAAO,wBACPC,MAAO,kCCbQC,EAASC,EAAoBC,EAAc,EAAGC,EAAW,GAAIC,EAAW,IAEvF,MAAMC,EAAaC,KAAKC,KAAKN,EAAaE,GAG1C,GAAID,EAAc,EAAG,CACpBA,EAAc,OACR,GAAIA,EAAcG,EAAY,CACpCH,EAAcG,EAGf,IAAIG,EAAmBC,EACvB,GAAIJ,GAAcD,EAAU,CAE3BI,EAAY,EACZC,EAAUJ,MACJ,CAEN,MAAMK,EAA4BJ,KAAKK,MAAMP,EAAW,GACxD,MAAMQ,EAA2BN,KAAKC,KAAKH,EAAW,G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AAgBC","sourcesContent":["import { Sizes } from '../../core/constants/sizes'\nimport { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const PaginationSizes = pick(Sizes, ['_S', '_M'])\nexport type PaginationSizeType = `${ValueOf<typeof PaginationSizes>}`\n\nexport const PaginationVariants = pick(Variants, ['PRIMARY', 'SECONDARY'])\nexport type PaginationVariantType = `${ValueOf<typeof PaginationVariants>}`\n\nexport enum PaginationTypes {\n\tBUTTON = 'button',\n\tSELECT = 'select',\n}\nexport type PaginationType = `${ValueOf<typeof PaginationTypes>}`\n\nexport const PaginationClass = {\n\troot: 'gov-pagination',\n\tlist: 'gov-pagination__list',\n\titem: 'gov-pagination__item',\n\titemArrow: 'gov-pagination__item--arrow',\n\titemMore: 'gov-pagination__item--more',\n\titemSelect: 'gov-pagination__item--select',\n\tinner: 'gov-pagination__inner',\n\tarrow: 'gov-pagination__arrow',\n}\n","export interface Pagination {\n\ttotalItems: number\n\tcurrentPage: number\n\tpageSize: number\n\ttotalPages: number\n\tstartPage: number\n\tendPage: number\n\tstartIndex: number\n\tendIndex: number\n\tpages: number[]\n}\n\nexport function paginate(totalItems: number, currentPage = 1, pageSize = 10, maxPages = 10): Pagination {\n\t// calculate total pages\n\tconst totalPages = Math.ceil(totalItems / pageSize)\n\n\t// ensure current page isn't out of range\n\tif (currentPage < 1) {\n\t\tcurrentPage = 1\n\t} else if (currentPage > totalPages) {\n\t\tcurrentPage = totalPages\n\t}\n\n\tlet startPage: number, endPage: number\n\tif (totalPages <= maxPages) {\n\t\t// total pages less than max so show all pages\n\t\tstartPage = 1\n\t\tendPage = totalPages\n\t} else {\n\t\t// total pages more than max so calculate start and end pages\n\t\tconst maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)\n\t\tconst maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1\n\t\tif (currentPage <= maxPagesBeforeCurrentPage) {\n\t\t\t// current page near the start\n\t\t\tstartPage = 1\n\t\t\tendPage = maxPages\n\t\t} else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {\n\t\t\t// current page near the end\n\t\t\tstartPage = totalPages - maxPages + 1\n\t\t\tendPage = totalPages\n\t\t} else {\n\t\t\t// current page somewhere in the middle\n\t\t\tstartPage = currentPage - maxPagesBeforeCurrentPage\n\t\t\tendPage = currentPage + maxPagesAfterCurrentPage\n\t\t}\n\t}\n\n\t// calculate start and end item indexes\n\tconst startIndex = (currentPage - 1) * pageSize\n\tconst endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1)\n\n\t// create an array of pages to ng-repeat in the pager control\n\tconst pages = Array.from(Array(endPage + 1 - startPage).keys()).map(i => startPage + i)\n\n\t// return object with all pager properties required by the view\n\treturn {\n\t\ttotalItems: totalItems,\n\t\tcurrentPage: currentPage,\n\t\tpageSize: pageSize,\n\t\ttotalPages: totalPages,\n\t\tstartPage: startPage,\n\t\tendPage: endPage,\n\t\tstartIndex: startIndex,\n\t\tendIndex: endIndex,\n\t\tpages: pages,\n\t}\n}\n","export const createArrayRange = (from: number, to: number): number[] => [...Array(to + 1).keys()].slice(from);\n","/*\n * Pagination\n */\n\n$class: \".gov-pagination\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-wrap: wrap;\n\t\tfont-weight: bold;\n\t\ttext-align: center;\n\t}\n\t&__list &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin: 0;\n\t\tpadding: rem-calc(2);\n\t\tborder-radius: $border-radius;\n\t\toverflow: hidden;\n\t\t&--arrow {\n\t\t\tdisplay: flex;\n\t\t}\n\t\t&--select {\n\t\t\tz-index: 1;\n\t\t\tdisplay: flex;\n\t\t\toverflow: visible;\n\t\t\tpadding: rem-calc(0 16);\n\t\t}\n\t}\n\t&__arrow {\n\t\tmargin: 0;\n\t}\n\t&__item--more {\n\t\t.gov-form-select {\n\t\t\tselect {\n\t\t\t\tborder: none;\n\t\t\t\tpadding-right: rem-calc(12) !important;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\talign-self: stretch;\n\t\twidth: 100%;\n\t\ttext-decoration: none;\n\t\t// Use hover styles from gov-button to active page button\n\t\t&[wcag-current=\"true\"] {\n\t\t\t@each $variant, $types in $button-variants {\n\t\t\t\t@each $type, $definitions in $types {\n\t\t\t\t\t&[type=\"#{$type}\"][variant=\"#{$variant}\"] {\n\t\t\t\t\t\t.element {\n\t\t\t\t\t\t\tbackground-color: deep-map-get($button-variants, $variant, $type, \"hover-bg\");\n\t\t\t\t\t\t\tcolor: deep-map-get($button-variants, $variant, $type, \"hover-color\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $pagination-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__inner {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tfont-weight: inherit;\n\t\t\t\t\t.element {\n\t\t\t\t\t\tmin-width: get(\"button-size\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Fragment from \"../../helpers/Fragment\"\nimport { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport {\n\tPaginationClass,\n\tPaginationSizeType,\n\tPaginationSizes,\n\tPaginationVariantType,\n\tPaginationType,\n\tPaginationTypes,\n\tPaginationVariants,\n} from \"./constants\"\nimport { govHost, prepareClasses } from \"../../helpers/Dom/template\"\nimport { paginate, Pagination } from \"./pagination\"\nimport { toBoolAttrIfDefined } from \"../../helpers/Dom/template\"\nimport { validateWcagLabel, validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { createID } from \"../../utils/string.utils\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport {createArrayRange } from \"../../utils/array.utils\"\n\n@Component({\n\ttag: \"gov-pagination\",\n\tstyleUrl: \"gov-pagination.scss\",\n})\nexport class GovPagination {\n\tprivate h: GovHost\n\tprivate readonly pageSelectId: string\n\n\tprivate spreadSelectRef?: HTMLGovFormSelectElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.pageSelectId = createID(\"GovPageSelect\")\n\t}\n\n\t@Element() readonly host: HTMLGovPaginationElement\n\t/**\n\t * Pagination type\n\t */\n\t@Prop() readonly type: PaginationType = \"button\"\n\t/**\n\t * Currently displayed page\n\t */\n\t@Prop() readonly current: number = 1\n\t/**\n\t * Total count of entries\n\t */\n\t@Prop() readonly total: number\n\t/**\n\t * Set on active page\n\t */\n\t@Prop() readonly inverse: boolean\n\t/**\n\t * Pagination's size\n\t */\n\t@Prop() readonly size?: PaginationSizeType = \"m\"\n\t/**\n\t * Style variation of the pagination.\n\t */\n\t@Prop() readonly variant?: PaginationVariantType = \"primary\"\n\t/**\n\t * Maximum number of entries per page\n\t */\n\t@Prop({ attribute: \"page-size\" }) readonly pageSize: number = 10\n\t/**\n\t * Maximum pages displayed for selection\n\t */\n\t@Prop({ attribute: \"max-pages\" }) readonly maxPages: number = 5\n\t/**\n\t * Setting a link to redirect to a given page.\n\t * The {PAGE} wildcard can be used in the link to replace the page number.\n\t * Note that in the case of paging through a link, it is always necessary to send to the component the current page where the user is.\n\t */\n\t@Prop() readonly link: string\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-label\" }) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the page select\n\t */\n\t@Prop({ attribute: \"wcag-select-label\" }) readonly wcagSelectLabel: string = \"Vybrat stranu\"\n\t/**\n\t * Adds accessible label for the page item\n\t */\n\t@Prop({ attribute: \"wcag-page-label\" }) readonly wcagPageLabel: string = \"Strana\"\n\t/**\n\t * Event called when changing the page with the current setting of the whole paging\n\t */\n\t@Event({ eventName: \"gov-page\" }) govPage: EventEmitter<Pagination>\n\n\t@State() pagination: Pagination\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(PaginationTypes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(PaginationSizes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(PaginationVariants, newValue, PaginationClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.recalculatePagination(this.current)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate recalculatePagination(currentPage: number) {\n\t\tthis.pagination = paginate(this.total, currentPage, this.pageSize, this.maxPages)\n\t}\n\n\tprivate isActivePageClass(originalClass: string, page: number) {\n\t\tif (this.pagination.currentPage === page) {\n\t\t\treturn originalClass + \" is-active\"\n\t\t} else {\n\t\t\treturn originalClass\n\t\t}\n\t}\n\n\tprivate prepareLinkUrl(page: number) {\n\t\tif (this.link) {\n\t\t\treturn String(this.link).replace(\"{PAGE}\", String(page))\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate resetSelectValue() {\n\t\tif (this.spreadSelectRef) {\n\t\t\tthis.spreadSelectRef.getInstance()\n\t\t\t\t.then((el: HTMLSelectElement) => {\n\t\t\t\t\tel.value = '...'\n\t\t\t\t})\n\t\t}\n\t}\n\n\trender() {\n\t\tconst pageResolver = (page: number, content: any) => {\n\t\t\tconst isDisabled = page === -1\n\t\t\tconst ariaCurrent = toBoolAttrIfDefined(this.pagination.currentPage === page ? true : undefined)\n\t\t\treturn (\n\t\t\t\t<gov-button\n\t\t\t\t\thref={this.prepareLinkUrl(page)}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\ton-gov-click={(e) => this.onClickHandler(e, page)}\n\t\t\t\t\twcag-label={page > -1 ? this.wcagPageLabel + \" \" + page : undefined}\n\t\t\t\t\twcag-current={ariaCurrent}\n\t\t\t\t\tclass={PaginationClass.inner}>\n\t\t\t\t\t{content}\n\t\t\t\t</gov-button>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(PaginationClass.root)} type={this.type} variant={this.variant} size={this.size}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<ul class={PaginationClass.list}>\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.currentPage > 1 ? 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.startPage < this.pagination.currentPage ? this.pagination.currentPage - 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t{this.type == \"select\" ? (\n\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemSelect])}>\n\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={this.pagination.currentPage === page}>\n\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{this.pagination.pages.map(page => (\n\t\t\t\t\t\t\t\t\t<li class={this.isActivePageClass(PaginationClass.item, page)}>{pageResolver(page, page)}</li>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemMore])}>\n\t\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\t\tref={el => (this.spreadSelectRef = el as HTMLGovFormSelectElement)}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t\t<option selected hidden>...</option>\n\t\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={false}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.currentPage + 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.totalPages : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: CustomEvent, page: number): void {\n\t\te.stopPropagation()\n\t\tthis.recalculatePagination(page)\n\t\tthis.govPage.emit({ ...this.pagination })\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent): void {\n\t\te.stopPropagation()\n\t\tconst target = e.target as HTMLSelectElement\n\t\tconst page = parseInt(target.value)\n\t\tthis.resetSelectValue()\n\t\tif (isNaN(page) === false) {\n\t\t\tthis.recalculatePagination(page)\n\t\t\tif (this.link) {\n\t\t\t\twindow.location.href = this.prepareLinkUrl(page)\n\t\t\t} else {\n\t\t\t\tthis.govPage.emit({ ...this.pagination })\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.wcagPageLabel, \"wcag-page-label\", PaginationClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, PaginationClass.root)\n\t\tif (this.type === \"select\") {\n\t\t\tvalidateWcagProp(this.wcagSelectLabel, \"wcag-select-label\", PaginationClass.root)\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-pagination/constants.ts","../../../packages/core/src/components/gov-pagination/pagination.ts","../../../packages/core/src/utils/array.utils.ts","../../../packages/core/src/components/gov-pagination/gov-pagination.scss?tag=gov-pagination","../../../packages/core/src/components/gov-pagination/gov-pagination.tsx"],"names":["PaginationSizes","pick","Sizes","PaginationVariants","Variants","PaginationTypes","PaginationClass","root","list","item","itemArrow","itemMore","itemSelect","inner","arrow","paginate","totalItems","currentPage","pageSize","maxPages","totalPages","Math","ceil","startPage","endPage","maxPagesBeforeCurrentPage","floor","maxPagesAfterCurrentPage","startIndex","endIndex","min","pages","Array","from","keys","map","i","createArrayRange","to","slice","govPaginationCss","GovPagination","[object Object]","hostRef","this","h","govHost","host","pageSelectId","createID","newValue","validateProp","recalculatePagination","current","validateSize","size","validateVariant","variant","canValidateWcagOnRender","delay","validateWcag","pagination","total","originalClass","page","link","String","replace","undefined","spreadSelectRef","getInstance","then","el","value","pageResolver","content","isDisabled","ariaCurrent","toBoolAttrIfDefined","href","prepareLinkUrl","type","disabled","on-gov-click","e","onClickHandler","wcag-label","wcagPageLabel","wcag-current","class","Host","classes","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","prepareClasses","name","id","hidden","wcagSelectLabel","wcag-labelled-by","on-gov-change","onSelectHandler","bind","selected","Fragment","isActivePageClass","ref","stopPropagation","govPage","emit","Object","assign","target","parseInt","resetSelectValue","isNaN","window","location","validateWcagProp","validateWcagLabel"],"mappings":"wbAKO,MAAMA,EAAkBC,EAAKC,EAAO,CAAC,KAAM,OAG3C,MAAMC,EAAqBF,EAAKG,EAAU,CAAC,UAAW,cAG7D,IAAYC,GAAZ,SAAYA,GACXA,EAAA,UAAA,SACAA,EAAA,UAAA,UAFD,CAAYA,IAAAA,EAAe,KAMpB,MAAMC,EAAkB,CAC9BC,KAAM,iBACNC,KAAM,uBACNC,KAAM,uBACNC,UAAW,8BACXC,SAAU,6BACVC,WAAY,+BACZC,MAAO,wBACPC,MAAO,kCCbQC,EAASC,EAAoBC,EAAc,EAAGC,EAAW,GAAIC,EAAW,IAEvF,MAAMC,EAAaC,KAAKC,KAAKN,EAAaE,GAG1C,GAAID,EAAc,EAAG,CACpBA,EAAc,OACR,GAAIA,EAAcG,EAAY,CACpCH,EAAcG,EAGf,IAAIG,EAAmBC,EACvB,GAAIJ,GAAcD,EAAU,CAE3BI,EAAY,EACZC,EAAUJ,MACJ,CAEN,MAAMK,EAA4BJ,KAAKK,MAAMP,EAAW,GACxD,MAAMQ,EAA2BN,KAAKC,KAAKH,EAAW,GAAK,EAC3D,GAAIF,GAAeQ,EAA2B,CAE7CF,EAAY,EACZC,EAAUL,OACJ,GAAIF,EAAcU,GAA4BP,EAAY,CAEhEG,EAAYH,EAAaD,EAAW,EACpCK,EAAUJ,MACJ,CAENG,EAAYN,EAAcQ,EAC1BD,EAAUP,EAAcU,GAK1B,MAAMC,GAAcX,EAAc,GAAKC,EACvC,MAA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C,YAAc2B,KAAKiB,WAAW5C,YAAc,GAAK,EAC9F4B,EAAA,WAAA,CAAU4C,MAAOnF,EAAgBQ,MAAOmF,KAAK,oBAI/CpD,EAAA,KAAA,CAAI4C,MAAOO,EAAe,CAAC1F,EAAgBG,KAAMH,EAAgBI,aAC/DgE,EACA9B,KAAKiB,WAAWzC,WAAawB,KAAKiB,WAAW5C,YAAc2B,KAAKiB,WAAWzC,YAAc,EACzFyB,EAAA,WAAA,CAAU4C,MAAOnF,EAAgBQ,MAAOmF,KAAK,8BAS5CvD,eAAe0C,EAAgBpB,GACtCoB,EAAEyB,kBACFjE,KAAKQ,sBAAsBY,GAC3BpB,KAAKkE,QAAQC,KAAIC,OAAAC,OAAA,GAAMrE,KAAKiB,aAGrBnB,gBAAgB0C,GACvBA,EAAEyB,kBACF,MAAMK,EAAS9B,EAAE8B,OACjB,MAAMlD,EAAOmD,SAASD,EAAOzC,OAC7B7B,KAAKwE,mBACL,GAAIC,MAAMrD,KAAU,MAAO,CAC1BpB,KAAKQ,sBAAsBY,GAC3B,GAAIpB,KAAKqB,KAAM,CACdqD,OAAOC,SAASxC,KAAOnC,KAAKoC,eAAehB,OACrC,CACNpB,KAAKkE,QAAQC,KAAIC,OAAAC,OAAA,GAAMrE,KAAKiB,eAS/BnB,qBACC8E,EAAiB5E,KAAK2C,cAAe,kBAAmBjF,EAAgBC,MACxEkH,EAAkB7E,KAAKiD,UAAWjD,KAAKmD,eAAgBzF,EAAgBC,MACvE,GAAIqC,KAAKqC,OAAS,SAAU,CAC3BuC,EAAiB5E,KAAKwD,gBAAiB,oBAAqB9F,EAAgBC","sourcesContent":["import { Sizes } from '../../core/constants/sizes'\nimport { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const PaginationSizes = pick(Sizes, ['_S', '_M'])\nexport type PaginationSizeType = `${ValueOf<typeof PaginationSizes>}`\n\nexport const PaginationVariants = pick(Variants, ['PRIMARY', 'SECONDARY'])\nexport type PaginationVariantType = `${ValueOf<typeof PaginationVariants>}`\n\nexport enum PaginationTypes {\n\tBUTTON = 'button',\n\tSELECT = 'select',\n}\nexport type PaginationType = `${ValueOf<typeof PaginationTypes>}`\n\nexport const PaginationClass = {\n\troot: 'gov-pagination',\n\tlist: 'gov-pagination__list',\n\titem: 'gov-pagination__item',\n\titemArrow: 'gov-pagination__item--arrow',\n\titemMore: 'gov-pagination__item--more',\n\titemSelect: 'gov-pagination__item--select',\n\tinner: 'gov-pagination__inner',\n\tarrow: 'gov-pagination__arrow',\n}\n","export interface Pagination {\n\ttotalItems: number\n\tcurrentPage: number\n\tpageSize: number\n\ttotalPages: number\n\tstartPage: number\n\tendPage: number\n\tstartIndex: number\n\tendIndex: number\n\tpages: number[]\n}\n\nexport function paginate(totalItems: number, currentPage = 1, pageSize = 10, maxPages = 10): Pagination {\n\t// calculate total pages\n\tconst totalPages = Math.ceil(totalItems / pageSize)\n\n\t// ensure current page isn't out of range\n\tif (currentPage < 1) {\n\t\tcurrentPage = 1\n\t} else if (currentPage > totalPages) {\n\t\tcurrentPage = totalPages\n\t}\n\n\tlet startPage: number, endPage: number\n\tif (totalPages <= maxPages) {\n\t\t// total pages less than max so show all pages\n\t\tstartPage = 1\n\t\tendPage = totalPages\n\t} else {\n\t\t// total pages more than max so calculate start and end pages\n\t\tconst maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)\n\t\tconst maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1\n\t\tif (currentPage <= maxPagesBeforeCurrentPage) {\n\t\t\t// current page near the start\n\t\t\tstartPage = 1\n\t\t\tendPage = maxPages\n\t\t} else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {\n\t\t\t// current page near the end\n\t\t\tstartPage = totalPages - maxPages + 1\n\t\t\tendPage = totalPages\n\t\t} else {\n\t\t\t// current page somewhere in the middle\n\t\t\tstartPage = currentPage - maxPagesBeforeCurrentPage\n\t\t\tendPage = currentPage + maxPagesAfterCurrentPage\n\t\t}\n\t}\n\n\t// calculate start and end item indexes\n\tconst startIndex = (currentPage - 1) * pageSize\n\tconst endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1)\n\n\t// create an array of pages to ng-repeat in the pager control\n\tconst pages = Array.from(Array(endPage + 1 - startPage).keys()).map(i => startPage + i)\n\n\t// return object with all pager properties required by the view\n\treturn {\n\t\ttotalItems: totalItems,\n\t\tcurrentPage: currentPage,\n\t\tpageSize: pageSize,\n\t\ttotalPages: totalPages,\n\t\tstartPage: startPage,\n\t\tendPage: endPage,\n\t\tstartIndex: startIndex,\n\t\tendIndex: endIndex,\n\t\tpages: pages,\n\t}\n}\n","export const createArrayRange = (from: number, to: number): number[] => [...Array(to + 1).keys()].slice(from);\n","/*\n * Pagination\n */\n\n$class: \".gov-pagination\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-wrap: wrap;\n\t\tfont-weight: bold;\n\t\ttext-align: center;\n\t}\n\t&__list &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin: 0;\n\t\tpadding: rem-calc(2);\n\t\tborder-radius: $border-radius;\n\t\toverflow: hidden;\n\t\t&--arrow {\n\t\t\tdisplay: flex;\n\t\t}\n\t\t&--select {\n\t\t\tz-index: 1;\n\t\t\tdisplay: flex;\n\t\t\toverflow: visible;\n\t\t\tpadding: rem-calc(0 16);\n\t\t}\n\t}\n\t&__arrow {\n\t\tmargin: 0;\n\t}\n\t&__item--more {\n\t\t.gov-form-select {\n\t\t\tselect {\n\t\t\t\tborder: none;\n\t\t\t\tpadding-right: rem-calc(12) !important;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\talign-self: stretch;\n\t\twidth: 100%;\n\t\ttext-decoration: none;\n\t\t// Use hover styles from gov-button to active page button\n\t\t&[wcag-current=\"true\"] {\n\t\t\t@each $variant, $types in $button-variants {\n\t\t\t\t@each $type, $definitions in $types {\n\t\t\t\t\t&[type=\"#{$type}\"][variant=\"#{$variant}\"] {\n\t\t\t\t\t\t.element {\n\t\t\t\t\t\t\tbackground-color: deep-map-get($button-variants, $variant, $type, \"hover-bg\");\n\t\t\t\t\t\t\tcolor: deep-map-get($button-variants, $variant, $type, \"hover-color\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $pagination-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__inner {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tfont-weight: inherit;\n\t\t\t\t\t.element {\n\t\t\t\t\t\tmin-width: get(\"button-size\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Fragment from \"../../helpers/Fragment\"\nimport { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport {\n\tPaginationClass,\n\tPaginationSizeType,\n\tPaginationSizes,\n\tPaginationVariantType,\n\tPaginationType,\n\tPaginationTypes,\n\tPaginationVariants,\n} from \"./constants\"\nimport { govHost, prepareClasses } from \"../../helpers/Dom/template\"\nimport { paginate, Pagination } from \"./pagination\"\nimport { toBoolAttrIfDefined } from \"../../helpers/Dom/template\"\nimport { validateWcagLabel, validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { createID } from \"../../utils/string.utils\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport {createArrayRange } from \"../../utils/array.utils\"\n\n@Component({\n\ttag: \"gov-pagination\",\n\tstyleUrl: \"gov-pagination.scss\",\n})\nexport class GovPagination {\n\tprivate h: GovHost\n\tprivate readonly pageSelectId: string\n\n\tprivate spreadSelectRef?: HTMLGovFormSelectElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.pageSelectId = createID(\"GovPageSelect\")\n\t}\n\n\t@Element() readonly host: HTMLGovPaginationElement\n\t/**\n\t * Pagination type\n\t */\n\t@Prop() readonly type: PaginationType = \"button\"\n\t/**\n\t * Currently displayed page\n\t */\n\t@Prop() readonly current: number = 1\n\t/**\n\t * Total count of entries\n\t */\n\t@Prop() readonly total: number\n\t/**\n\t * Set on active page\n\t */\n\t@Prop() readonly inverse: boolean\n\t/**\n\t * Pagination's size\n\t */\n\t@Prop() readonly size?: PaginationSizeType = \"m\"\n\t/**\n\t * Style variation of the pagination.\n\t */\n\t@Prop() readonly variant?: PaginationVariantType = \"primary\"\n\t/**\n\t * Maximum number of entries per page\n\t */\n\t@Prop({ attribute: \"page-size\" }) readonly pageSize: number = 10\n\t/**\n\t * Maximum pages displayed for selection\n\t */\n\t@Prop({ attribute: \"max-pages\" }) readonly maxPages: number = 5\n\t/**\n\t * Setting a link to redirect to a given page.\n\t * The {PAGE} wildcard can be used in the link to replace the page number.\n\t * Note that in the case of paging through a link, it is always necessary to send to the component the current page where the user is.\n\t */\n\t@Prop() readonly link: string\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-label\" }) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the page select\n\t */\n\t@Prop({ attribute: \"wcag-select-label\" }) readonly wcagSelectLabel: string = \"Vybrat stranu\"\n\t/**\n\t * Adds accessible label for the page item\n\t */\n\t@Prop({ attribute: \"wcag-page-label\" }) readonly wcagPageLabel: string = \"Strana\"\n\t/**\n\t * Event called when changing the page with the current setting of the whole paging\n\t */\n\t@Event({ eventName: \"gov-page\" }) govPage: EventEmitter<Pagination>\n\n\t@State() pagination: Pagination\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(PaginationTypes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(PaginationSizes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(PaginationVariants, newValue, PaginationClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.recalculatePagination(this.current)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate recalculatePagination(currentPage: number) {\n\t\tthis.pagination = paginate(this.total, currentPage, this.pageSize, this.maxPages)\n\t}\n\n\tprivate isActivePageClass(originalClass: string, page: number) {\n\t\tif (this.pagination.currentPage === page) {\n\t\t\treturn originalClass + \" is-active\"\n\t\t} else {\n\t\t\treturn originalClass\n\t\t}\n\t}\n\n\tprivate prepareLinkUrl(page: number) {\n\t\tif (this.link) {\n\t\t\treturn String(this.link).replace(\"{PAGE}\", String(page))\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate resetSelectValue() {\n\t\tif (this.spreadSelectRef) {\n\t\t\tthis.spreadSelectRef.getInstance()\n\t\t\t\t.then((el: HTMLSelectElement) => {\n\t\t\t\t\tel.value = '...'\n\t\t\t\t})\n\t\t}\n\t}\n\n\trender() {\n\t\tconst pageResolver = (page: number, content: any) => {\n\t\t\tconst isDisabled = page === -1\n\t\t\tconst ariaCurrent = toBoolAttrIfDefined(this.pagination.currentPage === page ? true : undefined)\n\t\t\treturn (\n\t\t\t\t<gov-button\n\t\t\t\t\thref={this.prepareLinkUrl(page)}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\ton-gov-click={(e) => this.onClickHandler(e, page)}\n\t\t\t\t\twcag-label={page > -1 ? this.wcagPageLabel + \" \" + page : undefined}\n\t\t\t\t\twcag-current={ariaCurrent}\n\t\t\t\t\tclass={PaginationClass.inner}>\n\t\t\t\t\t{content}\n\t\t\t\t</gov-button>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(PaginationClass.root)} type={this.type} variant={this.variant} size={this.size}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<ul class={PaginationClass.list}>\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.currentPage > 1 ? 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.startPage < this.pagination.currentPage ? this.pagination.currentPage - 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t{this.type == \"select\" ? (\n\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemSelect])}>\n\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={this.pagination.currentPage === page}>\n\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{this.pagination.pages.map(page => (\n\t\t\t\t\t\t\t\t\t<li class={this.isActivePageClass(PaginationClass.item, page)}>{pageResolver(page, page)}</li>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemMore])}>\n\t\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\t\tref={el => (this.spreadSelectRef = el as HTMLGovFormSelectElement)}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t\t<option selected hidden>...</option>\n\t\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={false}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.currentPage + 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.totalPages : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: CustomEvent, page: number): void {\n\t\te.stopPropagation()\n\t\tthis.recalculatePagination(page)\n\t\tthis.govPage.emit({ ...this.pagination })\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent): void {\n\t\te.stopPropagation()\n\t\tconst target = e.target as HTMLSelectElement\n\t\tconst page = parseInt(target.value)\n\t\tthis.resetSelectValue()\n\t\tif (isNaN(page) === false) {\n\t\t\tthis.recalculatePagination(page)\n\t\t\tif (this.link) {\n\t\t\t\twindow.location.href = this.prepareLinkUrl(page)\n\t\t\t} else {\n\t\t\t\tthis.govPage.emit({ ...this.pagination })\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.wcagPageLabel, \"wcag-page-label\", PaginationClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, PaginationClass.root)\n\t\tif (this.type === \"select\") {\n\t\t\tvalidateWcagProp(this.wcagSelectLabel, \"wcag-select-label\", PaginationClass.root)\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r,c as o,h as a,H as e,g as t}from"./p-4af5e4f4.js";import{v}from"./p-26acf964.js";import{V as n}from"./p-ff7365ae.js";import{p as i}from"./p-03990da5.js";import{g as l}from"./p-3f37ddb6.js";import"./p-561fa17b.js";const g=i(n,["PRIMARY","SECONDARY","WARNING","ERROR","SUCCESS"]);const c={root:"gov-alert",section:"gov-alert__section",icon:"gov-alert__icon",content:"gov-alert__content",close:"gov-alert__close"};const s='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-alert{position:relative;display:block;width:100%}.gov-alert__section{display:block;width:100%;max-width:calc(var(--gov-container-width, 73.75rem) + 2 * var(--gov-container-padding, 2.5rem));margin-right:auto;margin-left:auto;padding-right:var(--gov-container-padding-mobile, 1.25rem);padding-left:var(--gov-container-padding-mobile, 1.25rem);display:flex;gap:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 48em){.gov-alert__section{padding-right:var(--gov-container-padding, 2.5rem);padding-left:var(--gov-container-padding, 2.5rem)}}.gov-alert__icon{flex:0 0 auto}.gov-alert__icon>*{width:1.25rem;height:1.25rem}.gov-alert__content{padding-right:3.25rem}.gov-alert__content>*:last-child{margin-bottom:0}.gov-alert__content p{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing)}.gov-alert__content a{color:inherit}@media not all and (pointer: coarse){.gov-alert__content a:hover{color:inherit}}.gov-alert__close{position:absolute;top:0.625rem;right:1rem}.gov-alert[variant=warning]{background-color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning] .gov-alert__icon{color:var(--gov-alert-warning-icon-color, var(--gov-color-secondary))}.gov-alert[variant=warning] .gov-alert__content{color:var(--gov-alert-warning-text-color, var(--gov-color-secondary))}.gov-alert[variant=warning][inverse=""],.gov-alert[variant=warning][inverse=true i],.gov-alert[variant=warning][inverse="1"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=warning][inverse=""] .gov-alert__icon,.gov-alert[variant=warning][inverse=true i] .gov-alert__icon,.gov-alert[variant=warning][inverse="1"] .gov-alert__icon{color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning][inverse=""] .gov-alert__content,.gov-alert[variant=warning][inverse=true i] .gov-alert__content,.gov-alert[variant=warning][inverse="1"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=error]{background-color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error] .gov-alert__icon{color:var(--gov-alert-error-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=error] .gov-alert__content{color:var(--gov-alert-error-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=""],.gov-alert[variant=error][inverse=true i],.gov-alert[variant=error][inverse="1"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=""] .gov-alert__icon,.gov-alert[variant=error][inverse=true i] .gov-alert__icon,.gov-alert[variant=error][inverse="1"] .gov-alert__icon{color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error][inverse=""] .gov-alert__content,.gov-alert[variant=error][inverse=true i] .gov-alert__content,.gov-alert[variant=error][inverse="1"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=secondary]{background-color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary] .gov-alert__icon{color:var(--gov-alert-secondary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary] .gov-alert__content{color:var(--gov-alert-secondary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=""],.gov-alert[variant=secondary][inverse=true i],.gov-alert[variant=secondary][inverse="1"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=""] .gov-alert__icon,.gov-alert[variant=secondary][inverse=true i] .gov-alert__icon,.gov-alert[variant=secondary][inverse="1"] .gov-alert__icon{color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary][inverse=""] .gov-alert__content,.gov-alert[variant=secondary][inverse=true i] .gov-alert__content,.gov-alert[variant=secondary][inverse="1"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=success]{background-color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success] .gov-alert__icon{color:var(--gov-alert-success-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=success] .gov-alert__content{color:var(--gov-alert-success-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=""],.gov-alert[variant=success][inverse=true i],.gov-alert[variant=success][inverse="1"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=""] .gov-alert__icon,.gov-alert[variant=success][inverse=true i] .gov-alert__icon,.gov-alert[variant=success][inverse="1"] .gov-alert__icon{color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success][inverse=""] .gov-alert__content,.gov-alert[variant=success][inverse=true i] .gov-alert__content,.gov-alert[variant=success][inverse="1"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=primary]{background-color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary] .gov-alert__icon{color:var(--gov-alert-primary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary] .gov-alert__content{color:var(--gov-alert-primary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=""],.gov-alert[variant=primary][inverse=true i],.gov-alert[variant=primary][inverse="1"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=""] .gov-alert__icon,.gov-alert[variant=primary][inverse=true i] .gov-alert__icon,.gov-alert[variant=primary][inverse="1"] .gov-alert__icon{color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary][inverse=""] .gov-alert__content,.gov-alert[variant=primary][inverse=true i] .gov-alert__content,.gov-alert[variant=primary][inverse="1"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}@media (min-width: 75em){.gov-alert__content{padding-right:2rem}}';const d=class{constructor(a){r(this,a);this.govClose=o(this,"gov-close",7);this.variant="primary";this.inverse=false;this.wcagCloseLabel=undefined;this.closable=false;this.h=l(this.host)}validateVariant(r){v(g,r,c.root)}componentWillLoad(){this.validateVariant(this.variant)}render(){let r=!this.inverse;let o=this.inverse?"secondary":this.variant;if(this.variant=="warning"){r=false;o="secondary"}const t=a("div",{class:c.close},a("gov-button",{size:"s","aria-label":this.wcagCloseLabel,type:"base",variant:o,inverse:r,onClick:r=>this.govClose.emit(r)},a("gov-icon",{name:"x-lg"})));return a(e,{class:this.h.classes(c.root),variant:this.variant},a("section",{class:c.section,role:"alert"},this.h.hasSlot("icon")&&a("div",{class:c.icon},a("slot",{name:"icon"})),a("div",{class:c.content},a("slot",null))),this.closable&&t)}get host(){return t(this)}static get watchers(){return{variant:["validateVariant"]}}};d.style=s;export{d as gov_alert};
|
|
2
|
+
//# sourceMappingURL=p-3f92f3bf.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-alert/constants.ts","../../../packages/core/src/components/gov-alert/gov-alert.scss?tag=gov-alert","../../../packages/core/src/components/gov-alert/gov-alert.tsx"],"names":["AlertVariants","pick","Variants","AlertClass","root","section","icon","content","close","govAlertCss","GovAlert","[object Object]","hostRef","this","h","govHost","host","newValue","validateProp","validateVariant","variant","inverse","closeButton","class","size","aria-label","wcagCloseLabel","type","onClick","e","govClose","emit","name","Host","classes","role","hasSlot","closable"],"mappings":"8NAIO,MAAMA,EAAgBC,EAAKC,EAAU,CAAC,UAAW,YAAa,UAAW,QAAS,YAGlF,MAAMC,EAAa,CACzBC,KAAM,YACNC,QAAS,qBACTC,KAAM,kBACNC,QAAS,qBACTC,MAAO,oBCZR,MAAMC,EAAc,
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-alert/constants.ts","../../../packages/core/src/components/gov-alert/gov-alert.scss?tag=gov-alert","../../../packages/core/src/components/gov-alert/gov-alert.tsx"],"names":["AlertVariants","pick","Variants","AlertClass","root","section","icon","content","close","govAlertCss","GovAlert","[object Object]","hostRef","this","h","govHost","host","newValue","validateProp","validateVariant","variant","inverse","closeButton","class","size","aria-label","wcagCloseLabel","type","onClick","e","govClose","emit","name","Host","classes","role","hasSlot","closable"],"mappings":"8NAIO,MAAMA,EAAgBC,EAAKC,EAAU,CAAC,UAAW,YAAa,UAAW,QAAS,YAGlF,MAAMC,EAAa,CACzBC,KAAM,YACNC,QAAS,qBACTC,KAAM,kBACNC,QAAS,qBACTC,MAAO,oBCZR,MAAMC,EAAc,q/NCUPC,EAAQ,MAGpBC,YAAAC,8DASwC,uBAIJ,kDAYE,MAxBrCC,KAAKC,EAAIC,EAAQF,KAAKG,MA2BvBL,gBAAgBM,GACfC,EAAalB,EAAeiB,EAAUd,EAAWC,MAGlDO,oBACCE,KAAKM,gBAAgBN,KAAKO,SAG3BT,SACC,IAAIU,GAAWR,KAAKQ,QACpB,IAAID,EAAUP,KAAKQ,QAAU,YAAcR,KAAKO,QAEhD,GAAIP,KAAKO,SAAW,UAAW,CAC9BC,EAAU,MACVD,EAAU,YAGX,MAAME,EACLR,EAAA,MAAA,CAAKS,MAAOpB,EAAWK,OACtBM,EAAA,aAAA,CACCU,KAAK,IAAGC,aACIZ,KAAKa,eACjBC,KAAK,OACLP,QAASA,EACTC,QAASA,EACTO,QAAUC,GAAoBhB,KAAKiB,SAASC,KAAKF,IAEjDf,EAAA,WAAA,CAAUkB,KAAK,WAKlB,OACClB,EAACmB,EAAI,CAACV,MAAOV,KAAKC,EAAEoB,QAAQ/B,EAAWC,MAAOgB,QAASP,KAAKO,SAC3DN,EAAA,UAAA,CAASS,MAAOpB,EAAWE,QAAS8B,KAAK,SACvCtB,KAAKC,EAAEsB,QAAQ,SACftB,EAAA,MAAA,CAAKS,MAAOpB,EAAWG,MACtBQ,EAAA,OAAA,CAAMkB,KAAK,UAIblB,EAAA,MAAA,CAAKS,MAAOpB,EAAWI,SACtBO,EAAA,OAAA,QAGDD,KAAKwB,UAAYf","sourcesContent":["import { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const AlertVariants = pick(Variants, ['PRIMARY', 'SECONDARY', 'WARNING', 'ERROR', 'SUCCESS'])\nexport type VariantType = `${ValueOf<typeof AlertVariants>}`\n\nexport const AlertClass = {\n\troot: 'gov-alert',\n\tsection: 'gov-alert__section',\n\ticon: 'gov-alert__icon',\n\tcontent: 'gov-alert__content',\n\tclose: 'gov-alert__close',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-alert\";\n\n#{$class} {\n\t@include base();\n\t&__section {\n\t\t@include container();\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tpadding-top: rem-calc(16);\n\t\tpadding-bottom: rem-calc(16);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\t& > * {\n\t\t\twidth: rem-calc(20);\n\t\t\theight: rem-calc(20);\n\t\t}\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tpadding-right: rem-calc(52);\n\t\tp {\n\t\t\t@include typography($font-size-m);\n\t\t}\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t\t@include hover() {\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t}\n\t}\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(10);\n\t\tright: rem-calc(16);\n\t}\n\n\t// VARIANTS\n\t@each $variant, $definitions in $alert-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tbackground-color: get(\"bg-color\", $definitions);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"icon-color\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tcolor: get(\"text-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t\t@if deep-map-check($definitions, \"border\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t}\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t\tbackground-color: $alert-inverse-bg;\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"bg-color\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tcolor: $alert-inverse-color;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: xl) {\n\t\t&__content {\n\t\t\tpadding-right: rem-calc(32);\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { AlertClass, AlertVariants, VariantType } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-alert',\n\tstyleUrl: 'gov-alert.scss',\n})\nexport class GovAlert {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovAlertElement\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant: VariantType = 'primary'\n\t/**\n\t * Determide if component should have inversed colors to be used on dark background\n\t */\n\t@Prop() readonly inverse: boolean = false\n\t/**\n\t * Aria label for the closing button. It is mandatory if the alert is closable\n\t */\n\t@Prop({ attribute: 'wcag-close-label' }) readonly wcagCloseLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: 'gov-close' }) govClose: EventEmitter<PointerEvent>\n\t/**\n\t * Displays the option to close the alert\n\t */\n\t@Prop() readonly closable?: boolean = false\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(AlertVariants, newValue, AlertClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\trender() {\n\t\tlet inverse = !this.inverse\n\t\tlet variant = this.inverse ? 'secondary' : this.variant\n\n\t\tif (this.variant == 'warning') {\n\t\t\tinverse = false\n\t\t\tvariant = 'secondary'\n\t\t}\n\n\t\tconst closeButton = (\n\t\t\t<div class={AlertClass.close}>\n\t\t\t\t<gov-button\n\t\t\t\t\tsize=\"s\"\n\t\t\t\t\taria-label={this.wcagCloseLabel}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tonClick={(e: PointerEvent) => this.govClose.emit(e)}\n\t\t\t\t>\n\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t</gov-button>\n\t\t\t</div>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(AlertClass.root)} variant={this.variant}>\n\t\t\t\t<section class={AlertClass.section} role=\"alert\">\n\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t<div class={AlertClass.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={AlertClass.content}>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t\t{this.closable && closeButton}\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as o,h as i,H as l,g as a}from"./p-4af5e4f4.js";import{c as t}from"./p-24636c53.js";import{g as r,t as s}from"./p-3f37ddb6.js";import{a as f,b as n}from"./p-364b4792.js";import{c as m}from"./p-c20102ff.js";import{d as g}from"./p-03990da5.js";import{g as d}from"./p-9cd80b05.js";import"./p-561fa17b.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-ef79904e.js";import"./p-6278531b.js";import"./p-f687452c.js";import"./p-3464136c.js";const v={root:"gov-form-file",area:"gov-form-file__area",label:"gov-form-file__label",input:"gov-form-file__input",list:"gov-form-file__list",item:"gov-form-file__item",attachments:"gov-form-file__attachments"};function h(e){const o=["bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let i=0,l=parseInt(e,10)||0;while(l>=1024&&++i){l=l/1024}return l.toFixed(l<10&&i>0?1:0)+" "+o[i]}function _(e,o){if(typeof o==="string"&&o.length){return o.replace(/\s/g,"").split(",").filter((o=>new RegExp(o.replace("*",".*")).test(e.type))).length>0}else{return true}}function b(e,o){const i=Math.round(e.size/1024);return i<=o}const c='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-file{position:relative;display:block;width:100%}.gov-form-file__label .gov-form-label__label>*:last-child{margin-bottom:0}.gov-form-file__input{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:0.0001;cursor:pointer}.gov-form-file__attachments{margin-top:1rem 0rem 0rem}.gov-form-file__item{display:flex;gap:1rem;align-items:center}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label{pointer-events:none}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label *{color:var(--gov-form-file-disabled-color, var(--gov-color-secondary-600))}.gov-form-file[expanded=""] .gov-form-file__area,.gov-form-file[expanded=true i] .gov-form-file__area,.gov-form-file[expanded="1"] .gov-form-file__area{position:relative;width:100%;padding:2rem 1.375rem 1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center;transition:background-color 150ms ease-in-out;will-change:background-color}.gov-form-file[expanded=""] .gov-form-file__area.highlight,.gov-form-file[expanded=true i] .gov-form-file__area.highlight,.gov-form-file[expanded="1"] .gov-form-file__area.highlight{background-color:var(--gov-color-primary-200)}.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{width:100%;padding:1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center}.gov-form-file[expanded=""] .gov-form-file__attachments,.gov-form-file[expanded=true i] .gov-form-file__attachments,.gov-form-file[expanded="1"] .gov-form-file__attachments{margin:1.5rem 0rem 0rem}.gov-form-file[expanded=""][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid="1"] .gov-form-file__label .gov-form-label__label{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}@media (min-width: 30em){.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{padding:2rem}}';const p=class{constructor(i){e(this,i);this.govFocus=o(this,"gov-focus",7);this.govBlur=o(this,"gov-blur",7);this.govFiles=o(this,"gov-files",7);this.govAddFile=o(this,"gov-add-file",7);this.govRemovFile=o(this,"gov-remove-file",7);this.expanded=false;this.required=false;this.disabled=undefined;this.displayAttachments=true;this.name=undefined;this.accept=undefined;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.attachmentsLabel="Přílohy";this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagRemoveLabel="Odebrat soubor {FILE_NAME}";this.wcagAttachmentsLabel="Přílohy";this.files=[];this.fileId=t("GovInputFile");this.h=r(this.host);this.f=d(this.h)}registerListeners(){function e(){this.areaRef.classList.add("highlight")}function o(){this.areaRef.classList.remove("highlight")}this.inputRef.addEventListener("change",(e=>{e.preventDefault();e.stopPropagation();const o=e.target.files;this.validateFiles(o)}),false);if(this.expanded){const i=["dragover","dragleave"];const l=["dragenter","dragover","mouseenter"];const a=["dragleave","drop","mouseleave"];i.map((e=>this.inputRef.addEventListener(e,this.preventDefaults.bind(this),false)));l.map((o=>this.inputRef.addEventListener(o,e.bind(this),false)));a.forEach((e=>this.inputRef.addEventListener(e,o.bind(this),false)));this.areaRef.addEventListener("drop",this.handleDrop.bind(this),false)}}preventDefaults(e){e.preventDefault();e.stopPropagation()}handleDrop(e){const o=e.dataTransfer;this.validateFiles(o.files)}validateFiles(e){Array.from(e).map((e=>{const o=this.files.find((o=>o.file.name===e.name&&o.file.size===e.size))||null;if(o===null){const o=typeof this.maxFileSize==="number"&&this.maxFileSize>0?b(e,this.maxFileSize):true;const i=_(e,this.accept);const l={id:t("GovFormFile"),file:e,acceptValid:i,sizeValid:o};this.files=[...this.files,l];this.govAddFile.emit(l)}}));this.govFiles.emit(this.files)}componentWillLoad(){this.f.passAttrToControl("type","File");this.f.passAttrToLabel("required",String(this.required))}async componentDidRender(){if(m()){await g(500);await this.validateWcag()}this.registerListeners()}render(){return i(l,{class:this.h.classes([v.root]),invalid:s(this.invalid),expanded:s(this.expanded)},i("div",{class:v.area,ref:e=>this.areaRef=e},i("slot",null),i("input",{class:v.input,ref:e=>this.inputRef=e,id:this.identifier||this.fileId,type:"file",name:this.name,accept:this.accept,onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,disabled:this.disabled,"aria-required":s(this.required),"aria-invalid":s(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-disabled":s(this.disabled)})),this.h.hasSlot("attachments")?i("div",{class:v.attachments},i("slot",{name:"attachments"})):null,this.files.length&&this.displayAttachments?i("div",{class:v.attachments},i("gov-attachments",{label:this.wcagAttachmentsLabel,"wcag-label":this.wcagAttachmentsLabel},this.files.map((e=>i("gov-attachments-item",{"wcag-remove-labelled-by":e.id,"on-gov-remove":()=>this.onRemoveFileHandler(e)},i("span",{class:"sr-only",id:e.id},this.wcagRemoveLabel.replace("{FILE_NAME}",e.file.name)),e.file.name,e.acceptValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),e.acceptValid===false?this.errorAccept:null):null,e.sizeValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),this.errorSize.replace("{FILE_SIZE}",h(this.maxFileSize*1024))):null,i("span",{slot:"info"},"(",h(e.file.size),")")))))):null)}onRemoveFileHandler(e){const o=this.files.findIndex((o=>o.id===e.id));if(o!==-1){const e=this.files;const i=this.files[o];e.splice(o,1);this.files=[...e];this.govRemovFile.emit(i);this.govFiles.emit(this.files)}}onFocusHandler(e){e.stopPropagation();this.govFocus.emit(e)}onBlurHandler(e){e.stopPropagation();this.govBlur.emit(e)}onChangeHandler(e){e.stopPropagation()}async validateWcag(){f(this.wcagDescribedBy,"wcag-described-by",v.root);f(this.wcagLabelledBy,"wcag-labelled-by",v.root);n(this.identifier||this.fileId,this.wcagLabelledBy,v.root)}get host(){return a(this)}};p.style=c;export{p as gov_form_file};
|
|
2
|
+
//# sourceMappingURL=p-402c2751.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFile","[object Object]","hostRef","this","fileId","createID","h","govHost","host","f","govForm","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","Array","from","isFile","find","name","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","govAddFile","emit","govFiles","passAttrToControl","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","registerListeners","Host","class","classes","invalid","toBoolAttrIfDefined","ref","el","identifier","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","hasSlot","displayAttachments","wcagAttachmentsLabel","wcag-label","wcag-remove-labelled-by","on-gov-remove","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemovFile","govFocus","govBlur","validateWcagRef","validateWcagLabelFor"],"mappings":"8cAAO,MAAMA,EAAgB,CAC5BC,KAAM,gBACNC,KAAM,sBACNC,MAAO,uBACPC,MAAO,uBACPC,KAAM,sBACNC,KAAM,sBACNC,YAAa,uCCPEC,EAAYC,GAC3B,MAAMC,EAAQ,CAAC,QAAS,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OACzE,IAAIC,EAAI,EACPC,EAAIC,SAASJ,EAAO,KAAO,EAE5B,MAAOG,GAAK,QAAUD,EAAG,CACxBC,EAAIA,EAAI,KAGT,OAAOA,EAAEE,QAAQF,EAAI,IAAMD,EAAI,EAAI,EAAI,GAAK,IAAMD,EAAMC,YAGzCI,EAAqBC,EAAYC,GAChD,UAAWA,IAAW,UAAYA,EAAOC,OAAQ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AAUzG,QAAQ,cAAeX,EAAY2B,KAAKuC,YAAc,QAEpE,KACJpC,EAAA,OAAA,CAAMmF,KAAK,QAAM,IAAGjH,EAAYF,EAAKU,KAAKc,MAAK,UAKhD,MAKCG,oBAAoBjB,GAC3B,MAAM6G,EAAQ1F,KAAKmB,MAAMwE,WAAUxH,GAAQA,EAAKuE,KAAO7D,EAAK6D,KAC5D,GAAIgD,KAAW,EAAG,CACjB,MAAMvE,EAAQnB,KAAKmB,MACnB,MAAMyE,EAAa5F,KAAKmB,MAAMuE,GAC9BvE,EAAM0E,OAAOH,EAAO,GACpB1F,KAAKmB,MAAQ,IAAIA,GACjBnB,KAAK8F,aAAahD,KAAK8C,GACvB5F,KAAK+C,SAASD,KAAK9C,KAAKmB,QAIlBrB,eAAekB,GACtBA,EAAEE,kBACFlB,KAAK+F,SAASjD,KAAK9B,GAGZlB,cAAckB,GACrBA,EAAEE,kBACFlB,KAAKgG,QAAQlD,KAAK9B,GAGXlB,gBAAgBkB,GACvBA,EAAEE,kBAOHpB,qBACCmG,EAAgBjG,KAAK0E,gBAAiB,oBAAqB7G,EAAcC,MACzEmI,EAAgBjG,KAAK4E,eAAgB,mBAAoB/G,EAAcC,MACvEoI,EAAqBlG,KAAK+D,YAAc/D,KAAKC,OAAQD,KAAK4E,eAAgB/G,EAAcC","sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\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 / 1024)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, Event, EventEmitter, Element, Method, State } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { FormFileClass } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { fileAcceptValidation, fileSizeValidation, formatBytes } from '../../../utils/file.utils'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { GovFormFileItem } from './gov-form-file.types'\n\n@Component({\n\ttag: 'gov-form-file',\n\tstyleUrl: 'gov-form-file.scss',\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\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() readonly disabled: boolean\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 * 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 * Description of the list of attachments\n\t */\n\t@Prop({ attribute: 'attachments-label' }) readonly attachmentsLabel: string = 'Přílohy'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-remove-label' }) readonly wcagRemoveLabel: string = 'Odebrat soubor {FILE_NAME}'\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({ attribute: 'wcag-attachments-label' }) readonly wcagAttachmentsLabel: string = 'Přílohy'\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({ eventName: 'gov-files' }) govFiles: EventEmitter<GovFormFileItem[]>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({ eventName: 'gov-add-file' }) govAddFile: EventEmitter<GovFormFileItem>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({ eventName: 'gov-remove-file' }) govRemovFile: EventEmitter<GovFormFileItem>\n\n\t@State() files: GovFormFileItem[] = []\n\n\tprivate registerListeners() {\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add('highlight')\n\t\t}\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\tthis.validateFiles(files)\n\t\t\t},\n\t\t\tfalse\n\t\t)\n\t\t//this.inputRef.addEventListener('focus')\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', 'drop', '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\n\t\t\tthis.areaRef.addEventListener('drop', this.handleDrop.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\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) {\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\tthis.files = [...this.files, newFile]\n\t\t\t\tthis.govAddFile.emit(newFile)\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit(this.files)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl('type', 'File')\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)} 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\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\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\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.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id} 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.wcagRemoveLabel.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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace('{FILE_SIZE}', formatBytes(this.maxFileSize * 1024))}\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.govRemovFile.emit(removeFile)\n\t\t\tthis.govFiles.emit(this.files)\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"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.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFile","[object Object]","hostRef","this","fileId","createID","h","govHost","host","f","govForm","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","Array","from","isFile","find","name","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","govAddFile","emit","govFiles","passAttrToControl","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","registerListeners","Host","class","classes","invalid","toBoolAttrIfDefined","ref","el","identifier","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","hasSlot","displayAttachments","wcagAttachmentsLabel","wcag-label","wcag-remove-labelled-by","on-gov-remove","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemovFile","govFocus","govBlur","validateWcagRef","validateWcagLab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AAK+D,YAAc/D,KAAKC,OAAQD,KAAK4E,eAAgB/G,EAAcC","sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\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 / 1024)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, Event, EventEmitter, Element, Method, State } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { FormFileClass } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { fileAcceptValidation, fileSizeValidation, formatBytes } from '../../../utils/file.utils'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { GovFormFileItem } from './gov-form-file.types'\n\n@Component({\n\ttag: 'gov-form-file',\n\tstyleUrl: 'gov-form-file.scss',\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\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() readonly disabled: boolean\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 * 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 * Description of the list of attachments\n\t */\n\t@Prop({ attribute: 'attachments-label' }) readonly attachmentsLabel: string = 'Přílohy'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-remove-label' }) readonly wcagRemoveLabel: string = 'Odebrat soubor {FILE_NAME}'\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({ attribute: 'wcag-attachments-label' }) readonly wcagAttachmentsLabel: string = 'Přílohy'\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({ eventName: 'gov-files' }) govFiles: EventEmitter<GovFormFileItem[]>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({ eventName: 'gov-add-file' }) govAddFile: EventEmitter<GovFormFileItem>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({ eventName: 'gov-remove-file' }) govRemovFile: EventEmitter<GovFormFileItem>\n\n\t@State() files: GovFormFileItem[] = []\n\n\tprivate registerListeners() {\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add('highlight')\n\t\t}\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\tthis.validateFiles(files)\n\t\t\t},\n\t\t\tfalse\n\t\t)\n\t\t//this.inputRef.addEventListener('focus')\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', 'drop', '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\n\t\t\tthis.areaRef.addEventListener('drop', this.handleDrop.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\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) {\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\tthis.files = [...this.files, newFile]\n\t\t\t\tthis.govAddFile.emit(newFile)\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit(this.files)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl('type', 'File')\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)} 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\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\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\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.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id} 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.wcagRemoveLabel.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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace('{FILE_SIZE}', formatBytes(this.maxFileSize * 1024))}\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.govRemovFile.emit(removeFile)\n\t\t\tthis.govFiles.emit(this.files)\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,c as a,h as r,H as s,g as i}from"./p-4af5e4f4.js";import{v as t}from"./p-364b4792.js";import{c as e}from"./p-c20102ff.js";import{d as c}from"./p-03990da5.js";import{g as n}from"./p-3f37ddb6.js";import"./p-561fa17b.js";import"./p-24636c53.js";const p={root:"gov-backdrop",bg:"gov-backdrop__bg"};const d='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-backdrop__bg{z-index:100;position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--gov-backdrop-bg, var(--gov-color-secondary));opacity:var(--gov-backdrop-opacity, 0.45)}.gov-backdrop[inverse=""] .gov-backdrop__bg,.gov-backdrop[inverse=true i] .gov-backdrop__bg,.gov-backdrop[inverse="1"] .gov-backdrop__bg{background-color:var(--gov-backdrop-bg-inverse, var(--gov-color-neutral-white));opacity:var(--gov-backdrop-opacity, 0.8)}';const g=class{constructor(r){o(this,r);this.govClick=a(this,"gov-click",7);this.inverse=false;this.visible=false;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.h=n(this.host)}async componentDidRender(){if(e()){await c(500);await this.validateWcag()}}render(){if(this.visible===false){return r(s,{class:this.h.classes(p.root)})}return r(s,{class:this.h.classes(p.root)},r("div",{role:"button","aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy,onClick:o=>this.govClick.emit(o),class:p.bg}))}async validateWcag(){t(this.wcagLabel,this.wcagLabelledBy,p.root)}get host(){return i(this)}};g.style=d;export{g as gov_backdrop};
|
|
2
|
+
//# sourceMappingURL=p-405fc50f.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-backdrop/constants.ts","../../../packages/core/src/components/gov-backdrop/gov-backdrop.scss?tag=gov-backdrop","../../../packages/core/src/components/gov-backdrop/gov-backdrop.tsx"],"names":["BackdropClass","root","bg","govBackdropCss","GovBackdrop","[object Object]","hostRef","this","h","govHost","host","canValidateWcagOnRender","delay","validateWcag","visible","Host","class","classes","role","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","onClick","e","govClick","emit","validateWcagLabel"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-backdrop/constants.ts","../../../packages/core/src/components/gov-backdrop/gov-backdrop.scss?tag=gov-backdrop","../../../packages/core/src/components/gov-backdrop/gov-backdrop.tsx"],"names":["BackdropClass","root","bg","govBackdropCss","GovBackdrop","[object Object]","hostRef","this","h","govHost","host","canValidateWcagOnRender","delay","validateWcag","visible","Host","class","classes","role","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","onClick","e","govClick","emit","validateWcagLabel"],"mappings":"gQAAO,MAAMA,EAAgB,CAC5BC,KAAM,eACNC,GAAI,oBCFL,MAAMC,EAAiB,0xBCYVC,EAAW,MAGvBC,YAAAC,8DAQoC,mBAIlB,6DAXjBC,KAAKC,EAAIC,EAAQF,KAAKG,MAyBvBL,2BACC,GAAIM,IAA2B,OACxBC,EAAM,WACNL,KAAKM,gBAIbR,SACC,GAAIE,KAAKO,UAAY,MAAO,CAC3B,OAAQN,EAACO,EAAI,CAACC,MAAOT,KAAKC,EAAES,QAAQjB,EAAcC,QAEnD,OACCO,EAACO,EAAI,CAACC,MAAOT,KAAKC,EAAES,QAAQjB,EAAcC,OACzCO,EAAA,MAAA,CACCU,KAAM,SAAQC,aACFZ,KAAKa,UAASC,kBACTd,KAAKe,eACtBC,QAASC,GAAKjB,KAAKkB,SAASC,KAAKF,GACjCR,MAAOhB,EAAcE,MAUzBG,qBACCsB,EAAkBpB,KAAKa,UAAWb,KAAKe,eAAgBtB,EAAcC","sourcesContent":["export const BackdropClass = {\n\troot: 'gov-backdrop',\n\tbg: 'gov-backdrop__bg',\n}\n","/*\n * Backdrop\n */\n\n$class: \".gov-backdrop\";\n\n#{$class} {\n\t&__bg {\n\t\t@include z-index(\"modal\", 0);\n\t\tposition: fixed;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tbackground-color: $backdrop-bg;\n\t\topacity: $backdrop-opacity;\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"inverse\") {\n\t\t#{$class} {\n\t\t\t&__bg {\n\t\t\t\tbackground-color: $backdrop-bg-inverse;\n\t\t\t\topacity: $backdrop-opacity-inverse;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Event, EventEmitter, h, Method, Prop, Host, Element } from '@stencil/core'\nimport { validateWcagLabel } from '../../helpers/Validate/wcag'\nimport { BackdropClass } from './constants'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay } from '../../utils/utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-backdrop',\n\tstyleUrl: 'gov-backdrop.scss',\n})\nexport class GovBackdrop {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovAlertElement\n\t/**\n\t * Determide if component should have inversed colors to be used on dark background.\n\t */\n\t@Prop() readonly inverse: boolean = false\n\t/**\n\t * Default attribute for backdrop display\n\t */\n\t@Prop() visible = false\n\t/**\n\t * Adds accessible label for the backdrop that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when button clicks.\n\t */\n\t@Event({ eventName: 'gov-click' }) govClick: EventEmitter<MouseEvent>\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tif (this.visible === false) {\n\t\t\treturn (<Host class={this.h.classes(BackdropClass.root)} />)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(BackdropClass.root)}>\n\t\t\t\t<div\n\t\t\t\t\trole={'button'}\n\t\t\t\t\taria-label={this.wcagLabel}\n\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\tonClick={e => this.govClick.emit(e)}\n\t\t\t\t\tclass={BackdropClass.bg}\n\t\t\t\t></div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, BackdropClass.root)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,h as t,H as i,g as e}from"./p-4af5e4f4.js";import{T as r}from"./p-404f469e.js";import{a as n}from"./p-3f37ddb6.js";import"./p-ff7365ae.js";import"./p-55500e5a.js";import"./p-03990da5.js";const l='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-tooltip-content{z-index:51;font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);position:absolute;display:block;width:-moz-max-content;width:max-content;max-width:var(--gov-tooltip-content-max-width, 21rem);padding:1rem;border-radius:0.1875rem;background-color:var(--gov-tooltip-content-bg-color, var(--gov-color-primary-300));color:var(--gov-tooltip-content-text-color, var(--gov-color-secondary));letter-spacing:0.0125rem;visibility:hidden;opacity:0;transition:opacity 0.2s ease-in}.gov-tooltip-content::before{content:"";position:absolute;display:block;width:0;height:0;border:0.625rem solid transparent}.gov-tooltip-content[is-visible=""],.gov-tooltip-content[is-visible=true i],.gov-tooltip-content[is-visible="1"]{opacity:1}.gov-tooltip[size=s] .gov-tooltip-content{--gov-tooltip-content-padding:var(--gov-tooltip-s-padding, 0.5rem);--gov-tooltip-content-arrow-size:var(--gov-tooltip-s-arrow-size, 0.4375rem);--gov-tooltip-content-letter-spacing:var(--gov-tooltip-s-letter-spacing, 0.0125rem);font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing)}.gov-tooltip[size=l] .gov-tooltip-content{--gov-tooltip-content-padding:var(--gov-tooltip-l-padding, 1rem);--gov-tooltip-content-arrow-size:var(--gov-tooltip-l-arrow-size, 0.875rem);--gov-tooltip-content-letter-spacing:var(--gov-tooltip-l-letter-spacing, 0.002rem);font-weight:var(--gov-text-xl-font-weight);font-size:var(--gov-text-xl-font-size);line-height:var(--gov-text-xl-line-height);letter-spacing:var(--gov-text-xl-letter-spacing)}.gov-tooltip[position=top] .gov-tooltip-content{bottom:100%;margin-bottom:0.625rem}.gov-tooltip[position=top] .gov-tooltip-content,.gov-tooltip[position=top] .gov-tooltip-content::before{left:50%;transform:translateX(-50%)}.gov-tooltip[position=top] .gov-tooltip-content::before{top:100%;border-bottom-width:0;border-top-color:var(--gov-tooltip-content-bg-color, var(--gov-color-primary-300))}.gov-tooltip[position=bottom] .gov-tooltip-content{top:100%;margin-top:0.625rem}.gov-tooltip[position=bottom] .gov-tooltip-content,.gov-tooltip[position=bottom] .gov-tooltip-content::before{left:50%;transform:translateX(-50%)}.gov-tooltip[position=bottom] .gov-tooltip-content::before{bottom:100%;border-top-width:0;border-bottom-color:var(--gov-tooltip-content-bg-color, var(--gov-color-primary-300))}.gov-tooltip[position=left] .gov-tooltip-content{right:100%;margin-right:0.625rem}.gov-tooltip[position=left] .gov-tooltip-content,.gov-tooltip[position=left] .gov-tooltip-content::before{top:50%;transform:translateY(-50%)}.gov-tooltip[position=left] .gov-tooltip-content::before{left:100%;border-right-width:0;border-left-color:var(--gov-tooltip-content-bg-color, var(--gov-color-primary-300))}.gov-tooltip[position=right] .gov-tooltip-content{left:100%;margin-left:0.625rem}.gov-tooltip[position=right] .gov-tooltip-content,.gov-tooltip[position=right] .gov-tooltip-content::before{top:50%;transform:translateY(-50%)}.gov-tooltip[position=right] .gov-tooltip-content::before{right:100%;border-left-width:0;border-right-color:var(--gov-tooltip-content-bg-color, var(--gov-color-primary-300))}';const p=class{constructor(t){o(this,t);this.isVisible=false}visibleContent(o){clearTimeout(this.timeout);if(o===false){this.timeout=setTimeout((()=>{this.host.style.visibility="hidden"}),250)}else{this.host.style.visibility="visible"}}render(){return t(i,{class:r.root,role:"tooltip",hidden:!this.isVisible,"aria-hidden":!n(this.isVisible),"is-visible":this.isVisible},t("slot",null))}get host(){return e(this)}static get watchers(){return{isVisible:["visibleContent"]}}};p.style=l;export{p as gov_tooltip_content};
|
|
2
|
+
//# sourceMappingURL=p-42636ddf.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.scss?tag=gov-tooltip-content","../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.tsx"],"names":["govTooltipContentCss","GovTooltipContent","[object Object]","newValue","clearTimeout","this","timeout","setTimeout","host","style","visibility","h","Host","class","TooltipContentClass","root","role","hidden","isVisible","aria-hidden","toBoolAttr","is-visible"],"mappings":"yMAAA,MAAMA,EAAuB,
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.scss?tag=gov-tooltip-content","../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.tsx"],"names":["govTooltipContentCss","GovTooltipContent","[object Object]","newValue","clearTimeout","this","timeout","setTimeout","host","style","visibility","h","Host","class","TooltipContentClass","root","role","hidden","isVisible","aria-hidden","toBoolAttr","is-visible"],"mappings":"yMAAA,MAAMA,EAAuB,qlHCQhBC,EAAiB,8CAOoC,MAGjEC,eAAeC,GACdC,aAAaC,KAAKC,SAClB,GAAIH,IAAa,MAAO,CACvBE,KAAKC,QAAUC,YAAW,KACzBF,KAAKG,KAAKC,MAAMC,WAAa,WAC3B,SACG,CACNL,KAAKG,KAAKC,MAAMC,WAAa,WAI/BR,SACC,OACCS,EAACC,EAAI,CAACC,MAAOC,EAAoBC,KAAMC,KAAM,UAAWC,QAASZ,KAAKa,UAASC,eAAgBC,EAAWf,KAAKa,WAAUG,aAAchB,KAAKa,WAC3IP,EAAA,OAAA","sourcesContent":["/*\n * Tooltip - Content\n */\n\n$class: \".gov-tooltip-content\";\n\n#{$class} {\n\t@include z-index(\"bar\", 1);\n\t@include typography($font-size-m);\n\tposition: absolute;\n\tdisplay: block;\n\twidth: max-content;\n\tmax-width: $tooltip-content-max-width;\n\tpadding: rem-calc(16);\n\tborder-radius: rem-calc(3);\n\tbackground-color: $tooltip-content-bg-color;\n\tcolor: $tooltip-content-text-color;\n\tletter-spacing: rem-calc(0.2);\n\tvisibility: hidden;\n\topacity: 0;\n\ttransition: opacity 0.2s ease-in;\n\t&::before {\n\t\t@include pseudo();\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder: rem-calc(10) solid transparent;\n\t}\n\n\t// STATES\n\t@include parameter(\"is-visible\") {\n\t\topacity: 1;\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $tooltip-content-sizes {\n\t\t.gov-tooltip[size=\"#{$size}\"] & {\n\t\t\t--#{$prefix}tooltip-content-padding: #{get(\"padding\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-arrow-size: #{get(\"arrow-size\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-letter-spacing: #{get(\"letter-spacing\", $definitions)};\n\t\t\t@include typography(get(\"typography\", $definitions));\n\t\t}\n\t}\n\t@each $position, $definitions in $tooltip-content-positions {\n\t\t$oppositeProperty: get(\"oppositeProperty\", $definitions);\n\n\t\t.gov-tooltip[position=\"#{$position}\"] & {\n\t\t\t#{$oppositeProperty}: 100%;\n\t\t\tmargin-#{$oppositeProperty}: rem-calc(10);\n\t\t\t&,\n\t\t\t&::before {\n\t\t\t\t#{get(\"directionProperty\", $definitions)}: 50%;\n\t\t\t\ttransform: #{get(\"transformFn\", $definitions) }(-50%);\n\t\t\t}\n\t\t\t&::before {\n\t\t\t\t#{$position}: 100%;\n\t\t\t\tborder-#{$oppositeProperty}-width: 0;\n\t\t\t\tborder-#{$position}-color: $tooltip-content-bg-color;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { TooltipContentClass } from './constants'\nimport { toBoolAttr } from '../../helpers/Dom/template'\n\n@Component({\n\ttag: 'gov-tooltip-content',\n\tstyleUrl: 'gov-tooltip-content.scss',\n})\nexport class GovTooltipContent {\n\tprivate timeout\n\n\t@Element() host: HTMLGovTooltipContentElement\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: 'is-visible' }) readonly isVisible: boolean = false\n\n\t@Watch('isVisible')\n\tvisibleContent(newValue: boolean): void {\n\t\tclearTimeout(this.timeout)\n\t\tif (newValue === false) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.style.visibility = 'hidden'\n\t\t\t}, 250)\n\t\t} else {\n\t\t\tthis.host.style.visibility = 'visible'\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={TooltipContentClass.root} role={'tooltip'} hidden={!this.isVisible} aria-hidden={!toBoolAttr(this.isVisible)} is-visible={this.isVisible}>\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,h as r,H as e,g as a}from"./p-4af5e4f4.js";import{p as n,d as s}from"./p-03990da5.js";import{V as t}from"./p-ff7365ae.js";import{g as i}from"./p-3f37ddb6.js";import{v as g}from"./p-26acf964.js";import{c as l}from"./p-c20102ff.js";import{v}from"./p-364b4792.js";import"./p-561fa17b.js";import"./p-24636c53.js";const c=n(t,["PRIMARY","SECONDARY","SUCCESS","ERROR","WARNING"]);var d;(function(o){o["CIRCLE"]="circle";o["REACT"]="rect";o["TEXT"]="text"})(d||(d={}));var k;(function(o){o["PULSE"]="pulse";o["PROGRESS"]="progress";o["FALSE"]="false"})(k||(k={}));const p={root:"gov-skeleton",loader:"gov-skeleton__loader"};const u=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-skeleton__loader{position:relative;display:inline-block;width:var(--gov-skeleton-width, 100%);height:var(--gov-skeleton-height, 20px);margin-bottom:var(--gov-skeleton-margin-bottom, 8px);border-radius:var(--gov-skeleton-border-radius, var(--gov-border-radius, 0.1875rem));outline:none;overflow:hidden;box-sizing:border-box;will-change:transform}.gov-skeleton__loader.circle{width:var(--gov-skeleton-circle-size, 60px);height:var(--gov-skeleton-circle-size, 60px);margin-bottom:var(--gov-skeleton-margin-bottom, 8px);border-radius:var(--gov-skeleton-circle-radius, 50%)}.gov-skeleton__loader.rect{border-radius:var(--gov-skeleton-rect-radius, 0)}.gov-skeleton__loader.progress{background-size:200px 100%;animation:progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite}.gov-skeleton__loader.pulse{animation:pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;animation-delay:0.5s}@media (prefers-reduced-motion: reduce){.gov-skeleton__loader.pulse,.gov-skeleton__loader.progress{background-image:none;animation:none}}.gov-skeleton[variant=warning] .gov-skeleton__loader{background-color:var(--gov-skeleton-warning-background, var(--gov-color-warning-100));background-repeat:no-repeat}.gov-skeleton[variant=warning] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-warning-background, var(--gov-color-warning-100)), var(--gov-skeleton-warning-foreground, var(--gov-color-warning-200)), var(--gov-skeleton-warning-background, var(--gov-color-warning-100)))}.gov-skeleton[variant=error] .gov-skeleton__loader{background-color:var(--gov-skeleton-error-background, var(--gov-color-error-100));background-repeat:no-repeat}.gov-skeleton[variant=error] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-error-background, var(--gov-color-error-100)), var(--gov-skeleton-error-foreground, var(--gov-color-error-200)), var(--gov-skeleton-error-background, var(--gov-color-error-100)))}.gov-skeleton[variant=secondary] .gov-skeleton__loader{background-color:var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300));background-repeat:no-repeat}.gov-skeleton[variant=secondary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)), var(--gov-skeleton-secondary-foreground, var(--gov-color-secondary-100)), var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)))}.gov-skeleton[variant=success] .gov-skeleton__loader{background-color:var(--gov-skeleton-success-background, var(--gov-color-success-100));background-repeat:no-repeat}.gov-skeleton[variant=success] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-success-background, var(--gov-color-success-100)), var(--gov-skeleton-success-foreground, var(--gov-color-success-200)), var(--gov-skeleton-success-background, var(--gov-color-success-100)))}.gov-skeleton[variant=primary] .gov-skeleton__loader{background-color:var(--gov-skeleton-primary-background, var(--gov-color-primary-100));background-repeat:no-repeat}.gov-skeleton[variant=primary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-primary-background, var(--gov-color-primary-100)), var(--gov-skeleton-primary-foreground, var(--gov-color-primary-200)), var(--gov-skeleton-primary-background, var(--gov-color-primary-100)))}";const m=class{constructor(r){o(this,r);this.items=[];this.variant="secondary";this.count=1;this.shape="text";this.width=null;this.height=null;this.animation="progress";this.wcagLabel=undefined;this.h=i(this.host)}validateVariant(o){g(c,o,p.root)}validateShape(o){g(d,o,p.root)}validateAnimation(o){g(k,o,p.root)}componentWillLoad(){this.validateVariant(this.variant);this.validateShape(this.shape);this.validateAnimation(this.animation);this.init()}componentWillUpdate(){this.init()}async componentDidRender(){if(l()){await s(500);await this.validateWcag()}}init(){this.items.length=this.count;this.items.fill(1)}get style(){const o={width:null,height:null};if(this.width){o.width=this.width}if(this.height){o.height=this.height}return Object.assign({},o)}render(){return r(e,{class:this.h.classes(p.root),variant:this.variant},this.items.map(((o,e)=>r("span",{key:e,class:{circle:this.shape==="circle",rect:this.shape==="rect",progress:this.animation==="progress",pulse:this.animation==="pulse",[p.loader]:true},"aria-busy":"true","aria-valuemin":"0","aria-valuemax":"100","aria-valuetext":this.wcagLabel,role:"progressbar",tabindex:"0",style:this.style}))))}async validateWcag(){v(this.wcagLabel,undefined,p.root)}get host(){return a(this)}static get watchers(){return{variant:["validateVariant"],shape:["validateShape"],animation:["validateAnimation"]}}};m.style=u;export{m as gov_skeleton};
|
|
2
|
+
//# sourceMappingURL=p-429850b9.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/src/components/gov-loading/skeleton/constants.ts","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.scss?tag=gov-skeleton","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.tsx"],"names":["SkeletonVariants","pick","Variants","SkeletonShapes","SkeletonAnimation","SkeletonClass","root","loader","govSkeletonCss","GovSkeleton","[object Object]","hostRef","this","items","h","govHost","host","newValue","validateProp","validateVariant","variant","validateShape","shape","validateAnimation","animation","init","canValidateWcagOnRender","delay","validateWcag","length","count","fill","style","dimenssionsStyles","width","height","Object","assign","Host","class","classes","map","_","index","key","circle","rect","progress","pulse","aria-busy","aria-valuemin","aria-valuemax","aria-valuetext","wcagLabel","role","tabindex","validateWcagLabel","undefined"],"mappings":"mUAIO,MAAMA,EAAmBC,EAAKC,EAAU,CAAC,UAAW,YAAa,UAAW,QAAS,YAG5F,IAAYC,GAAZ,SAAYA,GACXA,EAAA,UAAA,SACAA,EAAA,SAAA,OACAA,EAAA,QAAA,QAHD,CAAYA,IAAAA,EAAc,KAO1B,IAAYC,GAAZ,SAAYA,GACXA,EAAA,SAAA,QACAA,EAAA,YAAA,WACAA,EAAA,SAAA,SAHD,CAAYA,IAAAA,EAAiB,KAOtB,MAAMC,EAAgB,CAC5BC,KAAM,eACNC,OAAQ,wBCvBT,MAAMC,EAAiB,+qHCmBVC,EAAW,MAGvBC,YAAAC,aAkCAC,KAAAC,MAAkB,gBA1BgC,uBAIlC,aAIqB,kBAIb,iBAIC,oBAImB,oCA3B3CD,KAAKE,EAAIC,EAAQH,KAAKI,MAoCvBN,gBAAgBO,GACfC,EAAalB,EAAkBiB,EAAUZ,EAAcC,MAIxDI,cAAcO,GACbC,EAAaf,EAAgBc,EAAUZ,EAAcC,MAItDI,kBAAkBO,GACjBC,EAAad,EAAmBa,EAAUZ,EAAcC,MAGzDI,oBACCE,KAAKO,gBAAgBP,KAAKQ,SAC1BR,KAAKS,cAAcT,KAAKU,OACxBV,KAAKW,kBAAkBX,KAAKY,WAC5BZ,KAAKa,OAGNf,sBACCE,KAAKa,OAGNf,2BACC,GAAIgB,IAA2B,OACxBC,EAAM,WACNf,KAAKgB,gBAIblB,OACCE,KAAKC,MAAMgB,OAASjB,KAAKkB,MACzBlB,KAAKC,MAAMkB,KAAK,GAGjBC,YACC,MAAMC,EAGF,CACHC,MAAO,KACPC,OAAQ,MAET,GAAIvB,KAAKsB,MAAO,CACfD,EAAkBC,MAAQtB,KAAKsB,MAGhC,GAAItB,KAAKuB,OAAQ,CAChBF,EAAkBE,OAASvB,KAAKuB,OAGjC,OAAAC,OAAAC,OAAA,GAAYJ,GAGbvB,SACC,OACCI,EAACwB,EAAI,CAACC,MAAO3B,KAAKE,EAAE0B,QAAQnC,EAAcC,MAAOc,QAASR,KAAKQ,SAC7DR,KAAKC,MAAM4B,KAAI,CAACC,EAAGC,IAElB7B,EAAA,OAAA,CACC8B,IAAKD,EACLJ,MAAO,CACNM,OAAQjC,KAAKU,QAAU,SACvBwB,KAAMlC,KAAKU,QAAU,OACrByB,SAAUnC,KAAKY,YAAc,WAC7BwB,MAAOpC,KAAKY,YAAc,QAC1Bd,CAACL,EAAcE,QAAS,MACxB0C,YAES,OAAMC,gBACF,IAAGC,gBACH,MAAKC,iBACHxC,KAAKyC,UACrBC,KAAK,cACLC,SAAS,IACTvB,MAAOpB,KAAKoB,WAYlBtB,qBACC8C,EAAkB5C,KAAKyC,UAAWI,UAAWpD,EAAcC","sourcesContent":["import { pick } from \"../../../utils/utils\"\nimport { Variants } from \"../../../core/constants/variants\"\nimport { ValueOf } from \"../../../types/interfaces\"\n\nexport const SkeletonVariants = pick(Variants, [\"PRIMARY\", \"SECONDARY\", \"SUCCESS\", \"ERROR\", \"WARNING\"])\nexport type SkeletonVariantsType = `${ValueOf<typeof SkeletonVariants>}`\n\nexport enum SkeletonShapes {\n\tCIRCLE = 'circle',\n\tREACT = 'rect',\n\tTEXT = 'text'\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\tloader: 'gov-skeleton__loader',\n}\n","$class: \".gov-skeleton\";\n\n#{$class} {\n\t&__loader {\n\t\tposition: relative;\n\t\tdisplay: inline-block;\n\t\twidth: $skeleton-width;\n\t\theight: $skeleton-height;\n\t\tmargin-bottom: $skeleton-margin-bottom;\n\t\tborder-radius: $skeleton-border-radius;\n\t\toutline: none;\n\t\toverflow: hidden;\n\t\tbox-sizing: border-box;\n\t\twill-change: transform;\n\n\t\t&.circle {\n\t\t\twidth: $skeleton-circle-size;\n\t\t\theight: $skeleton-circle-size;\n\t\t\tmargin-bottom: $skeleton-margin-bottom;\n\t\t\tborder-radius: $skeleton-circle-radius;\n\t\t}\n\n\t\t&.rect {\n\t\t\tborder-radius: $skeleton-rect-radius;\n\t\t}\n\n\t\t&.progress {\n\t\t\tbackground-size: 200px 100%;\n\t\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\t}\n\n\t\t&.pulse {\n\t\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\t\tanimation-delay: 0.5s;\n\t\t}\n\n\t\t@media (prefers-reduced-motion: reduce) {\n\t\t\t&.pulse,\n\t\t\t&.progress {\n\t\t\t\tbackground-image: none;\n\t\t\t\tanimation: none;\n\t\t\t}\n\t\t}\n\t}\n\n\t@each $variant, $definitions in $skeleton-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t#{$class}__loader {\n\t\t\t\tbackground-color: get(\"background\", $definitions);\n\t\t\t\tbackground-repeat: no-repeat;\n\n\t\t\t\t&.progress {\n\t\t\t\t\tbackground-image: linear-gradient(90deg, get(\"background\", $definitions), get(\"foreground\", $definitions), get(\"background\", $definitions));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport {\n\tSkeletonAnimation,\n\tSkeletonAnimationType,\n\tSkeletonClass, SkeletonShapes,\n\tSkeletonShapesType, SkeletonVariants,\n\tSkeletonVariantsType,\n} from \"./constants\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govHost } from \"../../../helpers/Dom/template\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { validateWcagLabel } from \"../../../helpers/Validate/wcag\"\n\n@Component({\n\ttag: \"gov-skeleton\",\n\tstyleUrl: \"gov-skeleton.scss\",\n})\nexport class GovSkeleton {\n\th: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovSkeletonElement\n\t/**\n\t * Style variation of the skeleton.\n\t */\n\t@Prop() readonly variant?: SkeletonVariantsType = \"secondary\"\n\t/**\n\t * Number of rows of current skeleton type\n\t */\n\t@Prop() count = 1\n\t/**\n\t * Shape of the skeleton\n\t */\n\t@Prop() shape?: SkeletonShapesType = \"text\"\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\t/**\n\t * Adds accessible label for the skeleton that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\n\titems: number[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(SkeletonVariants, 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\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateShape(this.shape)\n\t\tthis.validateAnimation(this.animation)\n\t\tthis.init()\n\t}\n\n\tcomponentWillUpdate() {\n\t\tthis.init()\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tinit() {\n\t\tthis.items.length = this.count\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 class={this.h.classes(SkeletonClass.root)} variant={this.variant}>\n\t\t\t\t{this.items.map((_, index) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\tclass={{\n\t\t\t\t\t\t\t\tcircle: this.shape === \"circle\",\n\t\t\t\t\t\t\t\trect: this.shape === \"rect\",\n\t\t\t\t\t\t\t\tprogress: this.animation === \"progress\",\n\t\t\t\t\t\t\t\tpulse: this.animation === \"pulse\",\n\t\t\t\t\t\t\t\t[SkeletonClass.loader]: true,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-busy=\"true\"\n\t\t\t\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t\t\t\taria-valuemax=\"100\"\n\t\t\t\t\t\t\taria-valuetext={this.wcagLabel}\n\t\t\t\t\t\t\trole=\"progressbar\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\tstyle={this.style}\n\t\t\t\t\t\t></span>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, undefined, SkeletonClass.root)\n\t}\n}\n"]}
|