@gov-design-system-ce/components 0.0.19 → 0.0.21
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-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-icon.cjs.entry.js +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-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-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-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 +1 -1
- package/dist/components/gov-form-checkbox.js +1 -1
- package/dist/components/gov-form-file.js +1 -1
- package/dist/components/gov-form-input2.js +1 -1
- package/dist/components/gov-form-multi-select.js +1 -1
- package/dist/components/gov-form-radio.js +1 -1
- package/dist/components/gov-form-select2.js +1 -1
- package/dist/components/gov-form-switch.js +1 -1
- package/dist/components/gov-icon2.js +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/critial.css +484 -0
- 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-85404e69.entry.js → p-3da88ddb.entry.js} +2 -2
- 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-07a2c755.entry.js → p-4ce15026.entry.js} +2 -2
- 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-8bb1ad43.entry.js.map → p-7b890c55.entry.js.map} +1 -1
- package/dist/core/{p-a929f64e.entry.js → p-7c55677b.entry.js} +2 -2
- package/dist/core/{p-e409d788.entry.js → p-8925ef42.entry.js} +2 -2
- package/dist/core/{p-3ad9cc54.entry.js → p-99f198b9.entry.js} +2 -2
- package/dist/core/{p-d8ef1d7a.entry.js → p-a8b628ed.entry.js} +2 -2
- 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-299f3d3c.entry.js → p-ccb44728.entry.js} +2 -2
- 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.entry.js +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 +1 -1
- package/dist/esm/gov-card.entry.js +1 -1
- package/dist/esm/gov-form-checkbox.entry.js +1 -1
- package/dist/esm/gov-form-file.entry.js +1 -1
- package/dist/esm/gov-form-input.entry.js +1 -1
- package/dist/esm/gov-form-multi-select.entry.js +1 -1
- package/dist/esm/gov-form-radio.entry.js +1 -1
- package/dist/esm/gov-form-select.entry.js +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-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 +72 -39
- 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-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-8bb1ad43.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-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-85404e69.entry.js.map → p-3da88ddb.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-07a2c755.entry.js.map → p-4ce15026.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-a929f64e.entry.js.map → p-7c55677b.entry.js.map} +0 -0
- /package/dist/core/{p-e409d788.entry.js.map → p-8925ef42.entry.js.map} +0 -0
- /package/dist/core/{p-3ad9cc54.entry.js.map → p-99f198b9.entry.js.map} +0 -0
- /package/dist/core/{p-d8ef1d7a.entry.js.map → p-a8b628ed.entry.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-299f3d3c.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gov-alert.js","sourceRoot":"","sources":["../../../../../../src/components/gov-alert/gov-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"gov-alert.js","sourceRoot":"","sources":["../../../../../../src/components/gov-alert/gov-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,e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eAAQ,CACH,CACI,CACX,CAAC,CAAC,CAAC,CACH,eAAQ,CACR,CACI,CACG;MACT,IAAI,CAAC,QAAQ,IAAI,WAAW,CACvB,CACP,CAAA;EACF,CAAC;EAED,cAAc,CAAC,CAA2B;IACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;MAClB,SAAS,EAAE,UAAU,CAAC,IAAI;MAC1B,GAAG,EAAE,IAAI,CAAC,IAAI;MACd,aAAa,EAAE,CAAC;KAChB,CAAC,CAAA;EACH,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,IAAI,IAAI,CAAC,QAAQ,EAAE;MAClB,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;KAC1E;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE;MAClB,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;KAC5E;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gov-alert.types.js","sourceRoot":"","sources":["../../../../../../src/components/gov-alert/gov-alert.types.ts"],"names":[],"mappings":"","sourcesContent":["import { GovBaseEvent } from \"../../types/event.types\"\n\nexport interface AlertEvent extends GovBaseEvent {\n\tref: HTMLGovAlertElement\n}\n\n"]}
|
|
@@ -13,11 +13,10 @@ export class GovModal {
|
|
|
13
13
|
this.label = undefined;
|
|
14
14
|
this.role = "dialog";
|
|
15
15
|
this.labelTag = "h2";
|
|
16
|
-
this.
|
|
16
|
+
this.wcagLabelledBy = undefined;
|
|
17
17
|
this.wcagDescribedBy = undefined;
|
|
18
18
|
this.wcagCloseLabel = undefined;
|
|
19
19
|
this.wcagCloseLabelledBy = undefined;
|
|
20
|
-
this.modalVisible = false;
|
|
21
20
|
this.h = govHost(this.host);
|
|
22
21
|
this.labelId = createID("GovModalLabel");
|
|
23
22
|
this.contentId = createID("GovModalContent");
|
|
@@ -31,18 +30,18 @@ export class GovModal {
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
watchOpen(newValue) {
|
|
34
|
-
this.
|
|
33
|
+
this.open = newValue;
|
|
35
34
|
}
|
|
36
35
|
showModal() {
|
|
37
|
-
this.
|
|
36
|
+
this.open = true;
|
|
38
37
|
document.body.classList.add(ModalClass.bodyFix);
|
|
39
38
|
}
|
|
40
39
|
hideModal() {
|
|
41
|
-
this.
|
|
40
|
+
this.open = false;
|
|
42
41
|
document.body.classList.remove(ModalClass.bodyFix);
|
|
43
42
|
}
|
|
44
43
|
async componentWillRender() {
|
|
45
|
-
if (this.
|
|
44
|
+
if (this.open) {
|
|
46
45
|
this.showModal();
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
@@ -50,7 +49,6 @@ export class GovModal {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
async componentDidRender() {
|
|
53
|
-
this.modalVisible = this.open;
|
|
54
52
|
if (canValidateWcagOnRender()) {
|
|
55
53
|
await delay(500);
|
|
56
54
|
await this.validateWcag();
|
|
@@ -58,7 +56,7 @@ export class GovModal {
|
|
|
58
56
|
}
|
|
59
57
|
render() {
|
|
60
58
|
const LabelTag = this.labelTag;
|
|
61
|
-
return (h(Host, { class: this.h.classes(ModalClass.root), open: this.
|
|
59
|
+
return (h(Host, { class: this.h.classes(ModalClass.root), open: this.open }, h("dialog", { class: ModalClass.dialog, hidden: !this.open, tabindex: "-1", open: this.open, "aria-modal": "true", "aria-hidden": toBoolAttr(!this.open), "aria-labelledby": this.wcagLabelledBy || this.labelId, "aria-describedby": this.wcagDescribedBy || this.contentId, role: this.role }, h("div", { class: ModalClass.inner }, h("div", { class: ModalClass.header }, this.h.hasSlot("icon") && (h("div", { class: ModalClass.icon }, h("slot", { name: "icon" }))), this.label && (h(LabelTag, { class: ModalClass.title, id: this.labelId }, this.label)), h("gov-button", { class: ModalClass.close, variant: "primary", wcagLabel: this.wcagCloseLabel, wcagLabelledBy: this.wcagCloseLabelledBy, type: "base", "on-gov-click": this.onCloseHandler.bind(this) }, h("gov-icon", { name: "x-lg" }))), h("div", { class: ModalClass.content, id: this.contentId }, h("slot", null)))), this.open ? (h("gov-backdrop", { "wcag-label": this.wcagCloseLabel, "wcag-labelled-by": this.wcagCloseLabelledBy, "on-gov-click": this.onCloseHandler.bind(this) })) : null));
|
|
62
60
|
}
|
|
63
61
|
onCloseHandler(e) {
|
|
64
62
|
e.stopPropagation();
|
|
@@ -72,7 +70,7 @@ export class GovModal {
|
|
|
72
70
|
this.showModal();
|
|
73
71
|
}
|
|
74
72
|
/**
|
|
75
|
-
*
|
|
73
|
+
* Hiding the modal
|
|
76
74
|
*/
|
|
77
75
|
async hide() {
|
|
78
76
|
this.hideModal();
|
|
@@ -81,8 +79,8 @@ export class GovModal {
|
|
|
81
79
|
* Validate the WCAG attributes of the component
|
|
82
80
|
*/
|
|
83
81
|
async validateWcag() {
|
|
84
|
-
validateWcagRef(this.
|
|
85
|
-
validateWcagRef(this.wcagDescribedBy, "
|
|
82
|
+
validateWcagRef(this.wcagLabelledBy, "wcag-labelled-by", ModalClass.root);
|
|
83
|
+
validateWcagRef(this.wcagDescribedBy, "wcag-described-by", ModalClass.root);
|
|
86
84
|
}
|
|
87
85
|
static get is() { return "gov-modal"; }
|
|
88
86
|
static get originalStyleUrls() {
|
|
@@ -99,7 +97,7 @@ export class GovModal {
|
|
|
99
97
|
return {
|
|
100
98
|
"open": {
|
|
101
99
|
"type": "boolean",
|
|
102
|
-
"mutable":
|
|
100
|
+
"mutable": true,
|
|
103
101
|
"complexType": {
|
|
104
102
|
"original": "boolean",
|
|
105
103
|
"resolved": "boolean",
|
|
@@ -162,13 +160,13 @@ export class GovModal {
|
|
|
162
160
|
"optional": false,
|
|
163
161
|
"docs": {
|
|
164
162
|
"tags": [],
|
|
165
|
-
"text": "Used to change the
|
|
163
|
+
"text": "Used to change the HTML tag in the modal label for correct semantic structure"
|
|
166
164
|
},
|
|
167
165
|
"attribute": "label-tag",
|
|
168
166
|
"reflect": false,
|
|
169
167
|
"defaultValue": "\"h2\""
|
|
170
168
|
},
|
|
171
|
-
"
|
|
169
|
+
"wcagLabelledBy": {
|
|
172
170
|
"type": "string",
|
|
173
171
|
"mutable": false,
|
|
174
172
|
"complexType": {
|
|
@@ -238,11 +236,6 @@ export class GovModal {
|
|
|
238
236
|
}
|
|
239
237
|
};
|
|
240
238
|
}
|
|
241
|
-
static get states() {
|
|
242
|
-
return {
|
|
243
|
-
"modalVisible": {}
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
239
|
static get events() {
|
|
247
240
|
return [{
|
|
248
241
|
"method": "govClose",
|
|
@@ -295,7 +288,7 @@ export class GovModal {
|
|
|
295
288
|
"return": "Promise<void>"
|
|
296
289
|
},
|
|
297
290
|
"docs": {
|
|
298
|
-
"text": "
|
|
291
|
+
"text": "Hiding the modal",
|
|
299
292
|
"tags": []
|
|
300
293
|
}
|
|
301
294
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gov-modal.js","sourceRoot":"","sources":["../../../../../../src/components/gov-modal/gov-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"gov-modal.js","sourceRoot":"","sources":["../../../../../../src/components/gov-modal/gov-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Event, Element, EventEmitter, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport { createID } from \"../../utils/string.utils\"\nimport { validateWcagRef } from \"../../helpers/Validate/wcag\"\nimport { ModalClass } from \"./constants\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { toBoolAttr } from \"../../helpers/Dom/template\"\nimport { govHost } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport { govErrorLog } from \"../../helpers/Log/gov.log\"\n\n@Component({\n\ttag: \"gov-modal\",\n\tstyleUrl: \"gov-modal.scss\",\n})\nexport class GovModal {\n\tprivate h: GovHost\n\tprivate readonly labelId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.labelId = createID(\"GovModalLabel\")\n\t\tthis.contentId = createID(\"GovModalContent\")\n\t}\n\n\t@Element() host: HTMLGovModalElement\n\n\t/**\n\t * Attribute for modal window display\n\t */\n\t@Prop({mutable: true}) open = false\n\t/**\n\t * Title of modal window\n\t */\n\t@Prop() label: string\n\t/**\n\t * Role of modal\n\t */\n\t@Prop({ attribute: \"role\" }) role = \"dialog\"\n\t/**\n\t * Used to change the HTML tag in the modal label for correct semantic structure\n\t */\n\t@Prop({ attribute: \"label-tag\" }) readonly labelTag: string = \"h2\"\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the modal.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) wcagDescribedBy: string\n\t/**\n\t * Adds accessible label for the modal close button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-close-label\" }) wcagCloseLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for closing the modal window\n\t */\n\t@Prop({ attribute: \"wcag-close-labelled-by\" }) wcagCloseLabelledBy: string\n\t/**\n\t * Emitted when modal window closes.\n\t */\n\t@Event({ eventName: \"gov-close\" }) govClose: EventEmitter<PointerEvent>\n\n\t@Watch(\"labelTag\")\n\tvalidateLabelTag(newValue: string): void {\n\t\tconst validTags = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${ModalClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch(\"open\")\n\twatchOpen(newValue: boolean): void {\n\t\tthis.open = newValue\n\t}\n\n\tprivate showModal() {\n\t\tthis.open = true\n\t\tdocument.body.classList.add(ModalClass.bodyFix)\n\t}\n\n\tprivate hideModal() {\n\t\tthis.open = false\n\t\tdocument.body.classList.remove(ModalClass.bodyFix)\n\t}\n\n\tasync componentWillRender() {\n\t\tif (this.open) {\n\t\t\tthis.showModal()\n\t\t} else {\n\t\t\tthis.hideModal()\n\t\t}\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\tconst LabelTag = this.labelTag\n\t\treturn (\n\t\t\t<Host class={this.h.classes(ModalClass.root)} open={this.open}>\n\t\t\t\t<dialog\n\t\t\t\t\tclass={ModalClass.dialog}\n\t\t\t\t\thidden={!this.open}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\topen={this.open}\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-hidden={toBoolAttr(!this.open)}\n\t\t\t\t\taria-labelledby={this.wcagLabelledBy || this.labelId}\n\t\t\t\t\taria-describedby={this.wcagDescribedBy || this.contentId}\n\t\t\t\t\trole={this.role}\n\t\t\t\t>\n\t\t\t\t\t<div class={ModalClass.inner}>\n\t\t\t\t\t\t<div class={ModalClass.header}>\n\t\t\t\t\t\t\t{this.h.hasSlot(\"icon\") && (\n\t\t\t\t\t\t\t\t<div class={ModalClass.icon}>\n\t\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{this.label && (\n\t\t\t\t\t\t\t\t<LabelTag class={ModalClass.title} id={this.labelId}>\n\t\t\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t\t\t</LabelTag>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\tclass={ModalClass.close}\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\twcagLabel={this.wcagCloseLabel}\n\t\t\t\t\t\t\t\twcagLabelledBy={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\" />\n\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.content} id={this.contentId}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</dialog>\n\n\t\t\t\t{this.open ? (\n\t\t\t\t\t<gov-backdrop\n\t\t\t\t\t\twcag-label={this.wcagCloseLabel}\n\t\t\t\t\t\twcag-labelled-by={this.wcagCloseLabelledBy}\n\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t\tthis.hideModal()\n\t\tthis.govClose.emit(e)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showModal()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideModal()\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.wcagLabelledBy, \"wcag-labelled-by\", ModalClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", ModalClass.root)\n\t}\n}\n"]}
|
|
@@ -13,11 +13,10 @@ export class GovPrompt {
|
|
|
13
13
|
this.label = undefined;
|
|
14
14
|
this.role = "dialog";
|
|
15
15
|
this.labelTag = "h2";
|
|
16
|
-
this.
|
|
16
|
+
this.wcagLabelledBy = undefined;
|
|
17
17
|
this.wcagDescribedBy = undefined;
|
|
18
18
|
this.wcagCloseLabel = undefined;
|
|
19
19
|
this.wcagCloseLabelledBy = undefined;
|
|
20
|
-
this.modalVisible = false;
|
|
21
20
|
this.h = govHost(this.host);
|
|
22
21
|
this.labelId = createID("GovPromptLabel");
|
|
23
22
|
this.contentId = createID("GovPromptContent");
|
|
@@ -31,18 +30,18 @@ export class GovPrompt {
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
watchOpen(newValue) {
|
|
34
|
-
this.
|
|
33
|
+
this.open = newValue;
|
|
35
34
|
}
|
|
36
35
|
showModal() {
|
|
37
|
-
this.
|
|
36
|
+
this.open = true;
|
|
38
37
|
document.body.classList.add(ModalClass.bodyFix);
|
|
39
38
|
}
|
|
40
39
|
hideModal() {
|
|
41
|
-
this.
|
|
40
|
+
this.open = false;
|
|
42
41
|
document.body.classList.remove(ModalClass.bodyFix);
|
|
43
42
|
}
|
|
44
43
|
async componentWillRender() {
|
|
45
|
-
if (this.
|
|
44
|
+
if (this.open) {
|
|
46
45
|
this.showModal();
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
@@ -50,7 +49,6 @@ export class GovPrompt {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
async componentDidRender() {
|
|
53
|
-
this.modalVisible = this.open;
|
|
54
52
|
if (canValidateWcagOnRender()) {
|
|
55
53
|
await delay(500);
|
|
56
54
|
await this.validateWcag();
|
|
@@ -58,7 +56,7 @@ export class GovPrompt {
|
|
|
58
56
|
}
|
|
59
57
|
render() {
|
|
60
58
|
const LabelTag = this.labelTag;
|
|
61
|
-
return (h(Host, { class: this.h.classes(ModalClass.rootPrompt), open: this.
|
|
59
|
+
return (h(Host, { class: this.h.classes(ModalClass.rootPrompt), open: this.open }, h("dialog", { class: ModalClass.dialog, hidden: !this.open, tabindex: "-1", open: this.open, "aria-modal": "true", "aria-hidden": toBoolAttr(!this.open), "aria-labelledby": this.wcagLabelledBy || this.labelId, "aria-describedby": this.wcagDescribedBy || this.contentId, role: this.role }, h("div", { class: ModalClass.inner }, h("div", { class: ModalClass.header }, this.h.hasSlot("icon") && (h("div", { class: ModalClass.icon }, h("slot", { name: "icon" }))), this.label && (h(LabelTag, { class: ModalClass.title, id: this.labelId }, this.label)), h("gov-button", { class: ModalClass.close, variant: "primary", wcagLabel: this.wcagCloseLabel, wcagLabelledBy: this.wcagCloseLabelledBy, type: "base", "on-gov-click": this.onCloseHandler.bind(this) }, h("gov-icon", { name: "x-lg" }))), h("div", { class: ModalClass.content, id: this.contentId }, h("slot", null)), h("div", { class: ModalClass.actions }, h("slot", { name: "actions" })))), this.open ? (h("gov-backdrop", { "wcag-label": this.wcagCloseLabel, "wcag-labelled-by": this.wcagCloseLabelledBy, "on-gov-click": this.onCloseHandler.bind(this) })) : null));
|
|
62
60
|
}
|
|
63
61
|
onCloseHandler(e) {
|
|
64
62
|
e.stopPropagation();
|
|
@@ -72,7 +70,7 @@ export class GovPrompt {
|
|
|
72
70
|
this.showModal();
|
|
73
71
|
}
|
|
74
72
|
/**
|
|
75
|
-
*
|
|
73
|
+
* Hiding the modal
|
|
76
74
|
*/
|
|
77
75
|
async hide() {
|
|
78
76
|
this.hideModal();
|
|
@@ -81,8 +79,8 @@ export class GovPrompt {
|
|
|
81
79
|
* Validate the WCAG attributes of the component
|
|
82
80
|
*/
|
|
83
81
|
async validateWcag() {
|
|
84
|
-
validateWcagRef(this.
|
|
85
|
-
validateWcagRef(this.wcagDescribedBy, "
|
|
82
|
+
validateWcagRef(this.wcagLabelledBy, "wcag-labelled-by", ModalClass.root);
|
|
83
|
+
validateWcagRef(this.wcagDescribedBy, "wcag-described-by", ModalClass.root);
|
|
86
84
|
}
|
|
87
85
|
static get is() { return "gov-prompt"; }
|
|
88
86
|
static get originalStyleUrls() {
|
|
@@ -99,7 +97,7 @@ export class GovPrompt {
|
|
|
99
97
|
return {
|
|
100
98
|
"open": {
|
|
101
99
|
"type": "boolean",
|
|
102
|
-
"mutable":
|
|
100
|
+
"mutable": true,
|
|
103
101
|
"complexType": {
|
|
104
102
|
"original": "boolean",
|
|
105
103
|
"resolved": "boolean",
|
|
@@ -162,13 +160,13 @@ export class GovPrompt {
|
|
|
162
160
|
"optional": false,
|
|
163
161
|
"docs": {
|
|
164
162
|
"tags": [],
|
|
165
|
-
"text": "Used to change the
|
|
163
|
+
"text": "Used to change the HTML tag in the modal label for correct semantic structure"
|
|
166
164
|
},
|
|
167
165
|
"attribute": "label-tag",
|
|
168
166
|
"reflect": false,
|
|
169
167
|
"defaultValue": "\"h2\""
|
|
170
168
|
},
|
|
171
|
-
"
|
|
169
|
+
"wcagLabelledBy": {
|
|
172
170
|
"type": "string",
|
|
173
171
|
"mutable": false,
|
|
174
172
|
"complexType": {
|
|
@@ -238,11 +236,6 @@ export class GovPrompt {
|
|
|
238
236
|
}
|
|
239
237
|
};
|
|
240
238
|
}
|
|
241
|
-
static get states() {
|
|
242
|
-
return {
|
|
243
|
-
"modalVisible": {}
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
239
|
static get events() {
|
|
247
240
|
return [{
|
|
248
241
|
"method": "govClose",
|
|
@@ -295,7 +288,7 @@ export class GovPrompt {
|
|
|
295
288
|
"return": "Promise<void>"
|
|
296
289
|
},
|
|
297
290
|
"docs": {
|
|
298
|
-
"text": "
|
|
291
|
+
"text": "Hiding the modal",
|
|
299
292
|
"tags": []
|
|
300
293
|
}
|
|
301
294
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gov-prompt.js","sourceRoot":"","sources":["../../../../../../src/components/gov-promp/gov-prompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"gov-prompt.js","sourceRoot":"","sources":["../../../../../../src/components/gov-promp/gov-prompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAMvD,MAAM,OAAO,SAAS;EAKrB;gBAU8B,KAAK;;gBAQC,QAAQ;oBAIkB,IAAI;;;;;IArBjE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAA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EAAC,SAAS,GAAG,CAClB,CACD,CACE;MAER,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACZ,kCACa,IAAI,CAAC,cAAc,sBACb,IAAI,CAAC,mBAAmB,kBAC5B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAC3C,CACF,CAAC,CAAC,CAAC,IAAI,CACF,CACP,CAAA;EACF,CAAC;EAEO,cAAc,CAAC,CAAe;IACrC,CAAC,CAAC,eAAe,EAAE,CAAA;IACnB,IAAI,CAAC,SAAS,EAAE,CAAA;IAChB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;EACtB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,IAAI;IACT,IAAI,CAAC,SAAS,EAAE,CAAA;EACjB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,IAAI;IACT,IAAI,CAAC,SAAS,EAAE,CAAA;EACjB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IACzE,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;EAC5E,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Event, Element, EventEmitter, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport { createID } from \"../../utils/string.utils\"\nimport { validateWcagRef } from \"../../helpers/Validate/wcag\"\nimport { ModalClass } from \"../gov-modal/constants\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { toBoolAttr } from \"../../helpers/Dom/template\"\nimport { govHost } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport { govErrorLog } from \"../../helpers/Log/gov.log\"\n\n@Component({\n\ttag: \"gov-prompt\",\n\tstyleUrl: \"gov-prompt.scss\",\n})\nexport class GovPrompt {\n\tprivate h: GovHost\n\tprivate readonly labelId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.labelId = createID(\"GovPromptLabel\")\n\t\tthis.contentId = createID(\"GovPromptContent\")\n\t}\n\n\t@Element() host: HTMLGovPromptElement\n\t/**\n\t * Attribute for modal window display\n\t */\n\t@Prop({mutable: true}) open = false\n\t/**\n\t * Title of modal window\n\t */\n\t@Prop() label: string\n\t/**\n\t * Role of modal\n\t */\n\t@Prop({ attribute: \"role\" }) role = \"dialog\"\n\t/**\n\t * Used to change the HTML tag in the modal label for correct semantic structure\n\t */\n\t@Prop({ attribute: \"label-tag\" }) readonly labelTag: string = \"h2\"\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the modal.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) wcagDescribedBy: string\n\t/**\n\t * Adds accessible label for the modal close button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-close-label\" }) wcagCloseLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for closing the modal window\n\t */\n\t@Prop({ attribute: \"wcag-close-labelled-by\" }) wcagCloseLabelledBy: string\n\t/**\n\t * Emitted when modal window closes.\n\t */\n\t@Event({ eventName: \"gov-close\" }) govClose: EventEmitter<PointerEvent>\n\n\t@Watch(\"labelTag\")\n\tvalidateLabelTag(newValue: string): void {\n\t\tconst validTags = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${ModalClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch(\"open\")\n\twatchOpen(newValue: boolean): void {\n\t\tthis.open = newValue\n\t}\n\n\tprivate showModal() {\n\t\tthis.open = true\n\t\tdocument.body.classList.add(ModalClass.bodyFix)\n\t}\n\n\tprivate hideModal() {\n\t\tthis.open = false\n\t\tdocument.body.classList.remove(ModalClass.bodyFix)\n\t}\n\n\tasync componentWillRender() {\n\t\tif (this.open) {\n\t\t\tthis.showModal()\n\t\t} else {\n\t\t\tthis.hideModal()\n\t\t}\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\tconst LabelTag = this.labelTag\n\t\treturn (\n\t\t\t<Host class={this.h.classes(ModalClass.rootPrompt)} open={this.open}>\n\t\t\t\t<dialog\n\t\t\t\t\tclass={ModalClass.dialog}\n\t\t\t\t\thidden={!this.open}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\topen={this.open}\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-hidden={toBoolAttr(!this.open)}\n\t\t\t\t\taria-labelledby={this.wcagLabelledBy || this.labelId}\n\t\t\t\t\taria-describedby={this.wcagDescribedBy || this.contentId}\n\t\t\t\t\trole={this.role}\n\t\t\t\t>\n\t\t\t\t\t<div class={ModalClass.inner}>\n\t\t\t\t\t\t<div class={ModalClass.header}>\n\t\t\t\t\t\t\t{this.h.hasSlot(\"icon\") && (\n\t\t\t\t\t\t\t\t<div class={ModalClass.icon}>\n\t\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{this.label && (\n\t\t\t\t\t\t\t\t<LabelTag class={ModalClass.title} id={this.labelId}>\n\t\t\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t\t\t</LabelTag>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\tclass={ModalClass.close}\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\twcagLabel={this.wcagCloseLabel}\n\t\t\t\t\t\t\t\twcagLabelledBy={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\" />\n\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.content} id={this.contentId}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.actions}>\n\t\t\t\t\t\t\t<slot name=\"actions\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</dialog>\n\n\t\t\t\t{this.open ? (\n\t\t\t\t\t<gov-backdrop\n\t\t\t\t\t\twcag-label={this.wcagCloseLabel}\n\t\t\t\t\t\twcag-labelled-by={this.wcagCloseLabelledBy}\n\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t\tthis.hideModal()\n\t\tthis.govClose.emit(e)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showModal()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideModal()\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.wcagLabelledBy, \"wcag-labelled-by\", ModalClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", ModalClass.root)\n\t}\n}\n"]}
|
|
@@ -2,7 +2,14 @@ class AlertPage extends HTMLElement {
|
|
|
2
2
|
connectedCallback() {
|
|
3
3
|
this.innerHTML = `
|
|
4
4
|
<h2>Alert</h2>
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
<gov-alert variant="secondary" headline="Tohle bude super nadpis pro všechno" closable>
|
|
7
|
+
<gov-icon name="info" slot="icon"></gov-icon>
|
|
8
|
+
<p>
|
|
9
|
+
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>.
|
|
10
|
+
</p>
|
|
11
|
+
</gov-alert>
|
|
12
|
+
<br>
|
|
6
13
|
<gov-alert variant="secondary" closable>
|
|
7
14
|
<gov-icon name="info" slot="icon"></gov-icon>
|
|
8
15
|
<p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../../src/pages/Alert.ts"],"names":[],"mappings":"AAAA,MAAM,SAAU,SAAQ,WAAW;EAClC,iBAAiB;IAChB,IAAI,CAAC,SAAS,GAAG
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../../src/pages/Alert.ts"],"names":[],"mappings":"AAAA,MAAM,SAAU,SAAQ,WAAW;EAClC,iBAAiB;IAChB,IAAI,CAAC,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFhB,CAAA;EACF,CAAC;CACD;AAED,IAAI,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE;EACnD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;CAC9C","sourcesContent":["class AlertPage extends HTMLElement {\n\tconnectedCallback() {\n\t\tthis.innerHTML = `\n\t\t<h2>Alert</h2>\n\t\t\n\t\t<gov-alert variant=\"secondary\" headline=\"Tohle bude super nadpis pro všechno\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tSecondary - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert variant=\"secondary\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tSecondary - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert variant=\"warning\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tWarning - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert variant=\"error\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert variant=\"success\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert variant=\"primary\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\n\t\t<h3>Inverse</h3>\n\t\t<br>\n\t\t<gov-alert inverse=\"TRUE\" variant=\"secondary\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tSecondary - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert inverse=\"True\" variant=\"warning\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tWarning - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert inverse=\"1\" variant=\"error\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert inverse=\"true\" variant=\"success\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t<br>\n\t\t<gov-alert inverse=\"true\" variant=\"primary\" closable>\n\t\t\t<gov-icon name=\"info\" slot=\"icon\"></gov-icon>\n\t\t\t<p>\n\t\t\t\tError - 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>.\n\t\t\t</p>\n\t\t</gov-alert>\n\t\t`\n\t}\n}\n\nif (customElements.get('alert-page') === undefined) {\n\tcustomElements.define('alert-page', AlertPage)\n}\n"]}
|
|
@@ -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") {
|