@gov-design-system-ce/components 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/gov-accordion-item.cjs.entry.js +12 -4
- package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-accordion.cjs.entry.js +0 -2
- package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-alert.cjs.entry.js +39 -7
- package/dist/cjs/gov-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-app.cjs.entry.js +8 -1
- package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-button.cjs.entry.js +1 -1
- package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-input.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-label.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-label.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-radio.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-select.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +1 -1
- package/dist/cjs/gov-layout-column.cjs.entry.js +1 -1
- package/dist/cjs/gov-layout-column.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-modal.cjs.entry.js +9 -11
- package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-prompt.cjs.entry.js +9 -11
- package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gov-accordion/gov-accordion-item.js +15 -7
- package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
- package/dist/collection/components/gov-accordion/gov-accordion.js +0 -2
- package/dist/collection/components/gov-accordion/gov-accordion.js.map +1 -1
- package/dist/collection/components/gov-alert/constants.js +1 -0
- package/dist/collection/components/gov-alert/constants.js.map +1 -1
- package/dist/collection/components/gov-alert/gov-alert.css +13 -0
- package/dist/collection/components/gov-alert/gov-alert.js +107 -16
- package/dist/collection/components/gov-alert/gov-alert.js.map +1 -1
- package/dist/collection/components/gov-alert/gov-alert.types.js +2 -0
- package/dist/collection/components/gov-alert/gov-alert.types.js.map +1 -0
- package/dist/collection/components/gov-button/gov-button.css +14 -11
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.css +1 -0
- package/dist/collection/components/gov-form/control/gov-form-control.css +2 -2
- package/dist/collection/components/gov-form/input/gov-form-input.css +1 -0
- package/dist/collection/components/gov-form/label/gov-form-label.css +0 -35
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +1 -0
- package/dist/collection/components/gov-form/radio/gov-form-radio.css +1 -0
- package/dist/collection/components/gov-form/select/gov-form-select.css +1 -0
- package/dist/collection/components/gov-icon/list.js +3 -0
- package/dist/collection/components/gov-icon/list.js.map +1 -1
- package/dist/collection/components/gov-layout/gov-layout-column.css +1 -0
- package/dist/collection/components/gov-modal/gov-modal.js +13 -20
- package/dist/collection/components/gov-modal/gov-modal.js.map +1 -1
- package/dist/collection/components/gov-promp/gov-prompt.js +13 -20
- package/dist/collection/components/gov-promp/gov-prompt.js.map +1 -1
- package/dist/collection/pages/Alert.js +8 -1
- package/dist/collection/pages/Alert.js.map +1 -1
- package/dist/components/gov-accordion-item.js +15 -7
- package/dist/components/gov-accordion-item.js.map +1 -1
- package/dist/components/gov-accordion.js +0 -2
- package/dist/components/gov-accordion.js.map +1 -1
- package/dist/components/gov-alert.js +45 -10
- package/dist/components/gov-alert.js.map +1 -1
- package/dist/components/gov-app.js +8 -1
- package/dist/components/gov-app.js.map +1 -1
- package/dist/components/gov-attachments2.js +1 -1
- package/dist/components/gov-button2.js +2 -2
- package/dist/components/gov-button2.js.map +1 -1
- package/dist/components/gov-form-checkbox.js +2 -2
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +1 -1
- package/dist/components/gov-form-control.js.map +1 -1
- package/dist/components/gov-form-file.js +1 -1
- package/dist/components/gov-form-input2.js +2 -2
- package/dist/components/gov-form-input2.js.map +1 -1
- package/dist/components/gov-form-label.js +1 -1
- package/dist/components/gov-form-label.js.map +1 -1
- package/dist/components/gov-form-multi-select.js +2 -2
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-radio.js +2 -2
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-select2.js +2 -2
- package/dist/components/gov-form-select2.js.map +1 -1
- package/dist/components/gov-form-switch.js +1 -1
- package/dist/components/gov-icon2.js +1 -1
- package/dist/components/gov-layout-column.js +1 -1
- package/dist/components/gov-layout-column.js.map +1 -1
- package/dist/components/gov-modal.js +12 -15
- package/dist/components/gov-modal.js.map +1 -1
- package/dist/components/gov-pagination.js +1 -1
- package/dist/components/gov-prompt.js +12 -15
- package/dist/components/gov-prompt.js.map +1 -1
- package/dist/components/gov-tabs.js +1 -1
- package/dist/components/wcag.js +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-26260897.entry.js → p-034c40ab.entry.js} +2 -2
- package/dist/core/p-0800095f.entry.js +2 -0
- package/dist/core/p-0800095f.entry.js.map +1 -0
- package/dist/core/{p-f0a4439e.entry.js → p-207ba616.entry.js} +2 -2
- package/dist/core/{p-429850b9.entry.js → p-3699c1b3.entry.js} +2 -2
- package/dist/core/{p-d79d0f7a.entry.js → p-3cd5b6cb.entry.js} +2 -2
- package/dist/core/p-3da88ddb.entry.js +2 -0
- package/dist/core/p-3da88ddb.entry.js.map +1 -0
- package/dist/core/{p-aba39622.entry.js → p-3e1a1bd4.entry.js} +2 -2
- package/dist/core/{p-5a1c8d48.entry.js → p-42db4603.entry.js} +2 -2
- package/dist/core/p-4ce15026.entry.js +2 -0
- package/dist/core/{p-8b2a6f87.entry.js.map → p-4ce15026.entry.js.map} +1 -1
- package/dist/core/{p-7bfa06b1.entry.js → p-50e94566.entry.js} +2 -2
- package/dist/core/p-50e94566.entry.js.map +1 -0
- package/dist/core/p-5176fad8.entry.js +2 -0
- package/dist/core/p-5176fad8.entry.js.map +1 -0
- package/dist/core/{p-540e79c4.entry.js → p-54b17f4d.entry.js} +2 -2
- package/dist/core/{p-ef393836.entry.js → p-5e865538.entry.js} +2 -2
- package/dist/core/{p-364b4792.js → p-670b4f93.js} +2 -2
- package/dist/core/{p-f73d482b.entry.js → p-742e37e4.entry.js} +2 -2
- package/dist/core/p-742e37e4.entry.js.map +1 -0
- package/dist/core/p-75a4c838.entry.js +2 -0
- package/dist/core/p-75a4c838.entry.js.map +1 -0
- package/dist/core/p-7b890c55.entry.js +2 -0
- package/dist/core/{p-3a50ac4c.entry.js.map → p-7b890c55.entry.js.map} +1 -1
- package/dist/core/p-7c55677b.entry.js +2 -0
- package/dist/core/{p-c970a479.entry.js.map → p-7c55677b.entry.js.map} +1 -1
- package/dist/core/{p-e51baf04.entry.js → p-8925ef42.entry.js} +2 -2
- package/dist/core/p-8925ef42.entry.js.map +1 -0
- package/dist/core/p-96a59983.entry.js +2 -0
- package/dist/core/p-96a59983.entry.js.map +1 -0
- package/dist/core/p-99f198b9.entry.js +2 -0
- package/dist/core/{p-8feb8960.entry.js.map → p-99f198b9.entry.js.map} +1 -1
- package/dist/core/p-a8b628ed.entry.js +2 -0
- package/dist/core/{p-b9b80796.entry.js.map → p-a8b628ed.entry.js.map} +1 -1
- package/dist/core/{p-724921e7.entry.js → p-a8ef7292.entry.js} +2 -2
- package/dist/core/{p-24877419.entry.js → p-a9c57f72.entry.js} +2 -2
- package/dist/core/{p-52f2f67c.entry.js → p-acfd00a2.entry.js} +2 -2
- package/dist/core/{p-a37ef1b2.entry.js → p-ccb44728.entry.js} +2 -2
- package/dist/core/p-d83b4bdc.entry.js +2 -0
- package/dist/core/p-d83b4bdc.entry.js.map +1 -0
- package/dist/core/{p-5e5e925d.entry.js → p-f555fce1.entry.js} +2 -2
- package/dist/core/p-f555fce1.entry.js.map +1 -0
- package/dist/core/{p-f6e2f2f0.entry.js → p-f7275b59.entry.js} +2 -2
- package/dist/custom-elements/index.js +1 -1
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/core.js +1 -1
- package/dist/esm/gov-accordion-item.entry.js +13 -5
- package/dist/esm/gov-accordion-item.entry.js.map +1 -1
- package/dist/esm/gov-accordion.entry.js +1 -3
- package/dist/esm/gov-accordion.entry.js.map +1 -1
- package/dist/esm/gov-alert.entry.js +41 -9
- package/dist/esm/gov-alert.entry.js.map +1 -1
- package/dist/esm/gov-app.entry.js +8 -1
- package/dist/esm/gov-app.entry.js.map +1 -1
- package/dist/esm/gov-attachments_3.entry.js +1 -1
- package/dist/esm/gov-backdrop.entry.js +1 -1
- package/dist/esm/gov-breadcrumbs.entry.js +1 -1
- package/dist/esm/gov-button.entry.js +2 -2
- package/dist/esm/gov-button.entry.js.map +1 -1
- package/dist/esm/gov-card.entry.js +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 +1 -1
- package/dist/esm/gov-form-control.entry.js.map +1 -1
- package/dist/esm/gov-form-file.entry.js +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 +1 -1
- 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-radio.entry.js +2 -2
- package/dist/esm/gov-form-radio.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 +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/esm/gov-layout-column.entry.js +1 -1
- package/dist/esm/gov-layout-column.entry.js.map +1 -1
- package/dist/esm/gov-modal.entry.js +10 -12
- package/dist/esm/gov-modal.entry.js.map +1 -1
- package/dist/esm/gov-nav.entry.js +1 -1
- package/dist/esm/gov-pagination.entry.js +1 -1
- package/dist/esm/gov-prompt.entry.js +10 -12
- package/dist/esm/gov-prompt.entry.js.map +1 -1
- package/dist/esm/gov-side-nav.entry.js +1 -1
- package/dist/esm/gov-skeleton.entry.js +1 -1
- package/dist/esm/gov-tabs.entry.js +1 -1
- package/dist/esm/gov-wizzard.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{wcag-3792d4bb.js → wcag-d588d144.js} +2 -2
- package/dist/esm/{wcag-3792d4bb.js.map → wcag-d588d144.js.map} +1 -1
- package/dist/hydrate/index.js +95 -56
- package/dist/stencil.config.js +0 -9
- package/dist/stencil.config.js.map +1 -1
- package/dist/types/components/gov-accordion/gov-accordion-item.d.ts +3 -2
- package/dist/types/components/gov-alert/constants.d.ts +1 -0
- package/dist/types/components/gov-alert/gov-alert.d.ts +21 -4
- package/dist/types/components/gov-alert/gov-alert.types.d.ts +4 -0
- package/dist/types/components/gov-modal/gov-modal.d.ts +3 -4
- package/dist/types/components/gov-promp/gov-prompt.d.ts +3 -4
- package/dist/types/components.d.ts +34 -13
- package/package.json +1 -1
- package/dist/core/p-3a50ac4c.entry.js +0 -2
- package/dist/core/p-3f92f3bf.entry.js +0 -2
- package/dist/core/p-3f92f3bf.entry.js.map +0 -1
- package/dist/core/p-5e5e925d.entry.js.map +0 -1
- package/dist/core/p-61103476.entry.js +0 -2
- package/dist/core/p-61103476.entry.js.map +0 -1
- package/dist/core/p-7bfa06b1.entry.js.map +0 -1
- package/dist/core/p-8b2a6f87.entry.js +0 -2
- package/dist/core/p-8feb8960.entry.js +0 -2
- package/dist/core/p-b2d1dd2a.entry.js +0 -2
- package/dist/core/p-b2d1dd2a.entry.js.map +0 -1
- package/dist/core/p-b9b80796.entry.js +0 -2
- package/dist/core/p-be799dfa.entry.js +0 -2
- package/dist/core/p-be799dfa.entry.js.map +0 -1
- package/dist/core/p-c970a479.entry.js +0 -2
- package/dist/core/p-cba27477.entry.js +0 -2
- package/dist/core/p-cba27477.entry.js.map +0 -1
- package/dist/core/p-d5c2db32.entry.js +0 -2
- package/dist/core/p-d5c2db32.entry.js.map +0 -1
- package/dist/core/p-e51baf04.entry.js.map +0 -1
- package/dist/core/p-f73d482b.entry.js.map +0 -1
- /package/dist/core/{p-26260897.entry.js.map → p-034c40ab.entry.js.map} +0 -0
- /package/dist/core/{p-f0a4439e.entry.js.map → p-207ba616.entry.js.map} +0 -0
- /package/dist/core/{p-429850b9.entry.js.map → p-3699c1b3.entry.js.map} +0 -0
- /package/dist/core/{p-d79d0f7a.entry.js.map → p-3cd5b6cb.entry.js.map} +0 -0
- /package/dist/core/{p-aba39622.entry.js.map → p-3e1a1bd4.entry.js.map} +0 -0
- /package/dist/core/{p-5a1c8d48.entry.js.map → p-42db4603.entry.js.map} +0 -0
- /package/dist/core/{p-540e79c4.entry.js.map → p-54b17f4d.entry.js.map} +0 -0
- /package/dist/core/{p-ef393836.entry.js.map → p-5e865538.entry.js.map} +0 -0
- /package/dist/core/{p-364b4792.js.map → p-670b4f93.js.map} +0 -0
- /package/dist/core/{p-724921e7.entry.js.map → p-a8ef7292.entry.js.map} +0 -0
- /package/dist/core/{p-24877419.entry.js.map → p-a9c57f72.entry.js.map} +0 -0
- /package/dist/core/{p-52f2f67c.entry.js.map → p-acfd00a2.entry.js.map} +0 -0
- /package/dist/core/{p-a37ef1b2.entry.js.map → p-ccb44728.entry.js.map} +0 -0
- /package/dist/core/{p-f6e2f2f0.entry.js.map → p-f7275b59.entry.js.map} +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { v as validateProp } from './props.js';
|
|
3
3
|
import { V as Variants } from './variants.js';
|
|
4
|
-
import { p as pick } from './utils.js';
|
|
5
|
-
import { g as govHost } from './template.js';
|
|
4
|
+
import { p as pick, d as delay } from './utils.js';
|
|
5
|
+
import { g as govHost, a as toBoolAttr } from './template.js';
|
|
6
|
+
import { F as Fragment } from './Fragment.js';
|
|
7
|
+
import { a as validateWcagProp } from './wcag.js';
|
|
8
|
+
import { c as canValidateWcagOnRender } from './win.js';
|
|
6
9
|
import { d as defineCustomElement$3 } from './gov-button2.js';
|
|
7
10
|
import { d as defineCustomElement$2 } from './gov-icon2.js';
|
|
8
11
|
|
|
@@ -12,20 +15,24 @@ const AlertClass = {
|
|
|
12
15
|
section: 'gov-alert__section',
|
|
13
16
|
icon: 'gov-alert__icon',
|
|
14
17
|
content: 'gov-alert__content',
|
|
18
|
+
headline: 'gov-alert__headline',
|
|
15
19
|
close: 'gov-alert__close',
|
|
16
20
|
};
|
|
17
21
|
|
|
18
|
-
const govAlertCss = ".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}}";
|
|
22
|
+
const govAlertCss = ".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__headline{display:flex;gap:1rem}.gov-alert__headline+div{margin-top:0.5rem}.gov-alert__headline p{margin-bottom:0}.gov-alert__headline gov-button{margin-top:-0.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}}";
|
|
19
23
|
|
|
20
24
|
const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
21
25
|
constructor() {
|
|
22
26
|
super();
|
|
23
27
|
this.__registerHost();
|
|
24
28
|
this.govClose = createEvent(this, "gov-close", 7);
|
|
25
|
-
this.
|
|
29
|
+
this.headline = undefined;
|
|
30
|
+
this.variant = "primary";
|
|
26
31
|
this.inverse = false;
|
|
27
32
|
this.wcagCloseLabel = undefined;
|
|
33
|
+
this.wcagToggleLabel = undefined;
|
|
28
34
|
this.closable = false;
|
|
35
|
+
this.toggleContent = false;
|
|
29
36
|
this.h = govHost(this.host);
|
|
30
37
|
}
|
|
31
38
|
validateVariant(newValue) {
|
|
@@ -34,15 +41,39 @@ const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
41
|
componentWillLoad() {
|
|
35
42
|
this.validateVariant(this.variant);
|
|
36
43
|
}
|
|
44
|
+
async componentDidRender() {
|
|
45
|
+
if (canValidateWcagOnRender()) {
|
|
46
|
+
await delay(500);
|
|
47
|
+
await this.validateWcag();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
render() {
|
|
38
51
|
let inverse = !this.inverse;
|
|
39
|
-
let variant = this.inverse ?
|
|
40
|
-
if (this.variant ==
|
|
52
|
+
let variant = this.inverse ? "secondary" : this.variant;
|
|
53
|
+
if (this.variant == "warning") {
|
|
41
54
|
inverse = false;
|
|
42
|
-
variant =
|
|
55
|
+
variant = "secondary";
|
|
56
|
+
}
|
|
57
|
+
const closeButton = (h("div", { class: AlertClass.close }, h("gov-button", { size: "s", "aria-label": this.wcagCloseLabel, type: "base", variant: variant, inverse: inverse, "on-gov-click": this.onCloseHandler.bind(this) }, h("gov-icon", { name: "x-lg" }))));
|
|
58
|
+
return (h(Host, { class: this.h.classes(AlertClass.root), variant: this.variant }, h("section", { class: AlertClass.section, role: "alert" }, this.h.hasSlot("icon") && (h("div", { class: AlertClass.icon }, h("slot", { name: "icon" }))), h("div", { class: AlertClass.content }, this.headline ? (h(Fragment, null, h("div", { class: AlertClass.headline }, h("p", null, this.headline), h("gov-button", { size: "s", "aria-label": this.wcagToggleLabel, type: "base", variant: variant, inverse: inverse, "on-gov-click": () => this.toggleContent = !this.toggleContent }, h("gov-icon", { name: this.toggleContent ? 'chevron-up' : 'chevron-down' }))), h("div", { hidden: !this.toggleContent, "aria-hidden": toBoolAttr(this.toggleContent) }, h("slot", null)))) : (h("slot", null)))), this.closable && closeButton));
|
|
59
|
+
}
|
|
60
|
+
onCloseHandler(e) {
|
|
61
|
+
this.govClose.emit({
|
|
62
|
+
component: AlertClass.root,
|
|
63
|
+
ref: this.host,
|
|
64
|
+
originalEvent: e,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validate the WCAG attributes of the component
|
|
69
|
+
*/
|
|
70
|
+
async validateWcag() {
|
|
71
|
+
if (this.closable) {
|
|
72
|
+
validateWcagProp(this.wcagCloseLabel, 'wcag-close-label', AlertClass.root);
|
|
73
|
+
}
|
|
74
|
+
if (this.headline) {
|
|
75
|
+
validateWcagProp(this.wcagToggleLabel, 'wcag-toggle-label', AlertClass.root);
|
|
43
76
|
}
|
|
44
|
-
const closeButton = (h("div", { class: AlertClass.close }, h("gov-button", { size: "s", "aria-label": this.wcagCloseLabel, type: "base", variant: variant, inverse: inverse, onClick: (e) => this.govClose.emit(e) }, h("gov-icon", { name: "x-lg" }))));
|
|
45
|
-
return (h(Host, { class: this.h.classes(AlertClass.root), variant: this.variant }, h("section", { class: AlertClass.section, role: "alert" }, this.h.hasSlot('icon') && (h("div", { class: AlertClass.icon }, h("slot", { name: "icon" }))), h("div", { class: AlertClass.content }, h("slot", null))), this.closable && closeButton));
|
|
46
77
|
}
|
|
47
78
|
get host() { return this; }
|
|
48
79
|
static get watchers() { return {
|
|
@@ -50,10 +81,14 @@ const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
50
81
|
}; }
|
|
51
82
|
static get style() { return govAlertCss; }
|
|
52
83
|
}, [4, "gov-alert", {
|
|
84
|
+
"headline": [1],
|
|
53
85
|
"variant": [1],
|
|
54
86
|
"inverse": [4],
|
|
55
87
|
"wcagCloseLabel": [1, "wcag-close-label"],
|
|
56
|
-
"
|
|
88
|
+
"wcagToggleLabel": [1, "wcag-toggle-label"],
|
|
89
|
+
"closable": [4],
|
|
90
|
+
"toggleContent": [32],
|
|
91
|
+
"validateWcag": [64]
|
|
57
92
|
}]);
|
|
58
93
|
function defineCustomElement$1() {
|
|
59
94
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-alert.js","mappings":"
|
|
1
|
+
{"file":"gov-alert.js","mappings":"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","names":["GovAlert"],"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"],"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\theadline: 'gov-alert__headline',\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&__headline {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\n\t\t+ div {\n\t\t\tmargin-top: rem-calc(8);\n\t\t}\n\n\t\tp {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\n\t\tgov-button {\n\t\t\tmargin-top: rem-calc(-4);\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, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport { AlertClass, AlertVariants, VariantType } from \"./constants\"\nimport { govHost, toBoolAttr } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport { AlertEvent } from \"./gov-alert.types\"\nimport { ButtonEvent } from \"../gov-button/gov-button.types\"\nimport Fragment from \"../../helpers/Fragment\"\nimport { validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\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 headline: string\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant: VariantType = \"primary\"\n\t/**\n\t * Determine if component should have inverse 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 * Aria label for the toggle button. It is mandatory if the alert has headline\n\t */\n\t@Prop({ attribute: \"wcag-toggle-label\" }) readonly wcagToggleLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: \"gov-close\" }) govClose: EventEmitter<AlertEvent>\n\t/**\n\t * Displays the option to close the alert\n\t */\n\t@Prop() readonly closable?: boolean = false\n\n\t@State() toggleContent = 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\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\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\ton-gov-click={this.onCloseHandler.bind(this)}\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\t\t\t\t\t<div class={AlertClass.content}>\n\t\t\t\t\t\t{this.headline ? (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<div class={AlertClass.headline}>\n\t\t\t\t\t\t\t\t\t<p>{this.headline}</p>\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\taria-label={this.wcagToggleLabel}\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\t\t\t\tinverse={inverse}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.toggleContent = !this.toggleContent}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name={this.toggleContent ? 'chevron-up' : 'chevron-down'}></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div hidden={!this.toggleContent} aria-hidden={toBoolAttr(this.toggleContent)}>\n\t\t\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t)}\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\tonCloseHandler(e: CustomEvent<ButtonEvent>) {\n\t\tthis.govClose.emit({\n\t\t\tcomponent: AlertClass.root,\n\t\t\tref: this.host,\n\t\t\toriginalEvent: e,\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.closable) {\n\t\t\tvalidateWcagProp(this.wcagCloseLabel, 'wcag-close-label', AlertClass.root)\n\t\t}\n\t\tif (this.headline) {\n\t\t\tvalidateWcagProp(this.wcagToggleLabel, 'wcag-toggle-label', AlertClass.root)\n\t\t}\n\t}\n}\n"],"version":3}
|
|
@@ -3253,7 +3253,14 @@ class AlertPage extends HTMLElement {
|
|
|
3253
3253
|
connectedCallback() {
|
|
3254
3254
|
this.innerHTML = `
|
|
3255
3255
|
<h2>Alert</h2>
|
|
3256
|
-
|
|
3256
|
+
|
|
3257
|
+
<gov-alert variant="secondary" headline="Tohle bude super nadpis pro všechno" closable>
|
|
3258
|
+
<gov-icon name="info" slot="icon"></gov-icon>
|
|
3259
|
+
<p>
|
|
3260
|
+
Secondary - Od 20. 12. 2020 do 14:00 h do 20. 12. 2020 do 15:00 h bude provedena plánovaná odstávka serverů. V uvedeném termínu bude nedostupné přihlášení k Portálu občana prostřednictvím datové schránky. Více informací <a href="#">zde</a>.
|
|
3261
|
+
</p>
|
|
3262
|
+
</gov-alert>
|
|
3263
|
+
<br>
|
|
3257
3264
|
<gov-alert variant="secondary" closable>
|
|
3258
3265
|
<gov-icon name="info" slot="icon"></gov-icon>
|
|
3259
3266
|
<p>
|