@gov-design-system-ce/components 4.0.8-rc08 → 4.0.8-rc09
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/gov-form-autocomplete.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-icon.cjs.entry.js +1 -1
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +1 -1
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-accordion-item.js +1 -1
- package/dist/components/gov-accordion.js +2 -1
- package/dist/components/gov-accordion.js.map +1 -1
- package/dist/components/gov-attachments-item.js +1 -1
- package/dist/components/gov-breadcrumbs.js +1 -1
- package/dist/components/gov-button.js +1 -1
- package/dist/components/gov-card.js +1 -1
- package/dist/components/gov-chip.js +1 -1
- package/dist/components/gov-form-autocomplete.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-input.js +1 -1
- package/dist/components/gov-form-multi-select.js +1 -1
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-radio.js +2 -1
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-select.js +1 -1
- package/dist/components/gov-form-switch.js +2 -1
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-icon.js +1 -1
- package/dist/components/gov-infobar.js +1 -1
- package/dist/components/gov-loading.js +1 -1
- package/dist/components/gov-modal.js +1 -1
- package/dist/components/gov-nav.js +2 -1
- package/dist/components/gov-nav.js.map +1 -1
- package/dist/components/gov-pagination.js +1 -1
- package/dist/components/gov-prompt.js +1 -1
- package/dist/components/gov-side-nav-item.js +1 -1
- package/dist/components/gov-side-nav.js +2 -1
- package/dist/components/gov-side-nav.js.map +1 -1
- package/dist/components/gov-skeleton.js +2 -1
- package/dist/components/gov-skeleton.js.map +1 -1
- package/dist/components/gov-tabs.js +1 -1
- package/dist/components/gov-tag.js +1 -1
- package/dist/components/gov-toast.js +1 -1
- package/dist/components/gov-tooltip-content.js +1 -1
- package/dist/components/gov-wizard-item.js +1 -1
- package/dist/components/gov-wizard.js +2 -1
- package/dist/components/gov-wizard.js.map +1 -1
- package/dist/components/{p-56f32486.js → p-04691758.js} +2 -2
- package/dist/components/{p-20707bc4.js → p-0fa5ab52.js} +2 -2
- package/dist/components/{p-633ff182.js → p-1653073c.js} +2 -2
- package/dist/components/{p-92fcef42.js → p-16ce28bd.js} +2 -2
- package/dist/components/{p-6d114533.js → p-4f23b264.js} +2 -2
- package/dist/components/p-4ff831e3.js.map +1 -1
- package/dist/components/{p-f2b3753c.js → p-b8bb638e.js} +2 -2
- package/dist/components/p-b9ee51d6.js +2 -1
- package/dist/components/p-b9ee51d6.js.map +1 -1
- package/dist/components/{p-c5bac92c.js → p-e20bdd6e.js} +2 -2
- package/dist/components/p-e20bdd6e.js.map +1 -0
- package/dist/components/p-f8b7ea69.js +2 -1
- package/dist/components/p-f8b7ea69.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/{p-a49391e5.entry.js → p-0e53df52.entry.js} +3 -2
- package/dist/core/p-0e53df52.entry.js.map +1 -0
- package/dist/core/{p-4b4a270d.entry.js → p-0f4f02a6.entry.js} +3 -2
- package/dist/core/p-0f4f02a6.entry.js.map +1 -0
- package/dist/core/{p-0702b541.entry.js → p-148613fd.entry.js} +3 -2
- package/dist/core/p-148613fd.entry.js.map +1 -0
- package/dist/core/{p-ead75342.entry.js → p-1ebf3575.entry.js} +3 -2
- package/dist/core/p-1ebf3575.entry.js.map +1 -0
- package/dist/core/{p-0ab12526.entry.js → p-28a50f60.entry.js} +3 -2
- package/dist/core/p-28a50f60.entry.js.map +1 -0
- package/dist/core/{p-64c5748e.entry.js → p-2d15339f.entry.js} +3 -2
- package/dist/core/p-2d15339f.entry.js.map +1 -0
- package/dist/core/{p-be8eec3f.entry.js → p-43fc5c70.entry.js} +3 -2
- package/dist/core/p-43fc5c70.entry.js.map +1 -0
- package/dist/core/{p-c20ee863.entry.js → p-46467293.entry.js} +3 -2
- package/dist/core/p-46467293.entry.js.map +1 -0
- package/dist/core/{p-a09a8710.entry.js → p-4d7ff31f.entry.js} +2 -2
- package/dist/core/p-542ce647.entry.js.map +1 -1
- package/dist/core/{p-9c00b909.entry.js → p-715dccc0.entry.js} +3 -2
- package/dist/core/p-715dccc0.entry.js.map +1 -0
- package/dist/core/p-71ca4aee.entry.js +3 -0
- package/dist/core/p-71ca4aee.entry.js.map +1 -0
- package/dist/core/p-7724b535.js.map +1 -1
- package/dist/core/{p-e4f11ddf.entry.js → p-7abfd047.entry.js} +3 -2
- package/dist/core/p-7abfd047.entry.js.map +1 -0
- package/dist/core/{p-c6a4ca41.entry.js → p-7d921045.entry.js} +3 -2
- package/dist/core/p-7d921045.entry.js.map +1 -0
- package/dist/core/{p-0f525123.entry.js → p-973da3e6.entry.js} +2 -2
- package/dist/core/{p-0f525123.entry.js.map → p-973da3e6.entry.js.map} +1 -1
- package/dist/core/{p-3975851f.entry.js → p-ab1c25e7.entry.js} +3 -2
- package/dist/core/p-ab1c25e7.entry.js.map +1 -0
- package/dist/core/{p-f59b858f.entry.js → p-b88d732b.entry.js} +3 -2
- package/dist/core/p-b88d732b.entry.js.map +1 -0
- package/dist/core/{p-7f158b6f.entry.js → p-bdd4ee7c.entry.js} +3 -2
- package/dist/core/p-bdd4ee7c.entry.js.map +1 -0
- package/dist/core/{p-1cbd2c7c.entry.js → p-c67ddbd3.entry.js} +3 -2
- package/dist/core/p-c67ddbd3.entry.js.map +1 -0
- package/dist/core/{p-ed580ac7.entry.js → p-d6eed6df.entry.js} +3 -2
- package/dist/core/p-d6eed6df.entry.js.map +1 -0
- package/dist/core/{p-115f99f4.entry.js → p-f2f2c14a.entry.js} +3 -2
- package/dist/core/p-f2f2c14a.entry.js.map +1 -0
- package/dist/core/{p-f4f969d0.entry.js → p-f3967a1d.entry.js} +3 -2
- package/dist/core/p-f3967a1d.entry.js.map +1 -0
- package/dist/core/{p-39272558.entry.js → p-f6a4bf04.entry.js} +3 -2
- package/dist/core/p-f6a4bf04.entry.js.map +1 -0
- package/dist/core/{p-1fee1753.entry.js → p-ff3323bd.entry.js} +3 -2
- package/dist/core/p-ff3323bd.entry.js.map +1 -0
- package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
- package/dist/esm/gov-form-multi-select.entry.js +1 -1
- package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/hydrate/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-c5bac92c.js.map +0 -1
- package/dist/core/p-0702b541.entry.js.map +0 -1
- package/dist/core/p-0ab12526.entry.js.map +0 -1
- package/dist/core/p-115f99f4.entry.js.map +0 -1
- package/dist/core/p-1cbd2c7c.entry.js.map +0 -1
- package/dist/core/p-1fee1753.entry.js.map +0 -1
- package/dist/core/p-39272558.entry.js.map +0 -1
- package/dist/core/p-3975851f.entry.js.map +0 -1
- package/dist/core/p-4b4a270d.entry.js.map +0 -1
- package/dist/core/p-64c5748e.entry.js.map +0 -1
- package/dist/core/p-7f158b6f.entry.js.map +0 -1
- package/dist/core/p-984b36f7.entry.js +0 -2
- package/dist/core/p-984b36f7.entry.js.map +0 -1
- package/dist/core/p-9c00b909.entry.js.map +0 -1
- package/dist/core/p-a49391e5.entry.js.map +0 -1
- package/dist/core/p-be8eec3f.entry.js.map +0 -1
- package/dist/core/p-c20ee863.entry.js.map +0 -1
- package/dist/core/p-c6a4ca41.entry.js.map +0 -1
- package/dist/core/p-e4f11ddf.entry.js.map +0 -1
- package/dist/core/p-ead75342.entry.js.map +0 -1
- package/dist/core/p-ed580ac7.entry.js.map +0 -1
- package/dist/core/p-f4f969d0.entry.js.map +0 -1
- package/dist/core/p-f59b858f.entry.js.map +0 -1
- /package/dist/components/{p-56f32486.js.map → p-04691758.js.map} +0 -0
- /package/dist/components/{p-20707bc4.js.map → p-0fa5ab52.js.map} +0 -0
- /package/dist/components/{p-633ff182.js.map → p-1653073c.js.map} +0 -0
- /package/dist/components/{p-92fcef42.js.map → p-16ce28bd.js.map} +0 -0
- /package/dist/components/{p-6d114533.js.map → p-4f23b264.js.map} +0 -0
- /package/dist/components/{p-f2b3753c.js.map → p-b8bb638e.js.map} +0 -0
- /package/dist/core/{p-a09a8710.entry.js.map → p-4d7ff31f.entry.js.map} +0 -0
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as o,c as e,h as i,a as t,g as r}from"./p-5bc604a3.js";import{g as s,n as l,o as c,p as n}from"./p-61a2b12a.js";import{g as a,a as g,t as v}from"./p-5de606f8.js";import{c as m}from"./p-003e6cca.js";import{v as f}from"./p-dcb5fb35.js";import{a as d,b as h}from"./p-7724b535.js";import{c as p}from"./p-24636c53.js";import{d as u}from"./p-03990da5.js";import{p as z}from"./p-ab5a13ea.js";import{t as x}from"./p-8fcc8483.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-6278531b.js";import"./p-9dab01be.js";import"./p-3464136c.js";import"./p-7f2c9830.js";const w='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-select{position:relative;display:flex;width:100%;align-items:center}.gov-form-select .element{position:relative;display:flex;flex:1 1 auto}.gov-form-select input,.gov-form-select select,.gov-form-select textarea{width:100%;border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-select input:focus,.gov-form-select select:focus,.gov-form-select textarea:focus{outline:none}.gov-form-select input:focus-visible,.gov-form-select select:focus-visible,.gov-form-select textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-select input::-moz-placeholder,.gov-form-select select::-moz-placeholder,.gov-form-select textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select input::placeholder,.gov-form-select select::placeholder,.gov-form-select textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select textarea{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);padding:0.5rem 0.75rem;resize:none}.gov-form-select *[slot=left-icon],.gov-form-select *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;transform:translateY(-50%);pointer-events:none}.gov-form-select *[slot=left-icon]{left:0}.gov-form-select *[slot=right-icon]{right:0}.gov-form-select *[slot=prefix],.gov-form-select *[slot=sufix]{margin:0}[size=s].gov-form-select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);gap:0.5rem var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select input,[size=s].gov-form-select select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);height:var(--gov-form-input-core-s-height, 2rem);padding:var(--gov-form-input-core-s-padding, 0.25rem 0.75rem)}[size=s].gov-form-select *[slot=left-icon],[size=s].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-s-icon-size, 1rem);height:var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=s].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=right-icon]~input,[size=s].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=m].gov-form-select{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);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select input,[size=m].gov-form-select select{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);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-select *[slot=left-icon],[size=m].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=right-icon]~input,[size=m].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-select{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);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select input,[size=l].gov-form-select select{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);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-select *[slot=left-icon],[size=l].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=right-icon]~input,[size=l].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select input,[size=xl].gov-form-select select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-select *[slot=left-icon],[size=xl].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=right-icon]~input,[size=xl].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}[variant=primary].gov-form-select input,[variant=primary].gov-form-select select,[variant=primary].gov-form-select textarea{color:var(--gov-form-input-color-primary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-primary, 0.0625rem solid var(--gov-color-primary-600))}[variant=primary].gov-form-select *[slot=left-icon],[variant=primary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-primary, var(--gov-color-primary))}[variant=secondary].gov-form-select input,[variant=secondary].gov-form-select select,[variant=secondary].gov-form-select textarea{color:var(--gov-form-input-color-secondary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-secondary, 0.0625rem solid var(--gov-color-secondary-700))}[variant=secondary].gov-form-select *[slot=left-icon],[variant=secondary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-secondary, var(--gov-color-primary))}[disabled=""].gov-form-select,[disabled=true i].gov-form-select,[disabled="1"].gov-form-select{pointer-events:none}[disabled=""].gov-form-select input,[disabled=""].gov-form-select select,[disabled=""].gov-form-select textarea,[disabled=true i].gov-form-select input,[disabled=true i].gov-form-select select,[disabled=true i].gov-form-select textarea,[disabled="1"].gov-form-select input,[disabled="1"].gov-form-select select,[disabled="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-select *[slot=left-icon],[disabled=""].gov-form-select *[slot=right-icon],[disabled=true i].gov-form-select *[slot=left-icon],[disabled=true i].gov-form-select *[slot=right-icon],[disabled="1"].gov-form-select *[slot=left-icon],[disabled="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600)) !important}[invalid=""].gov-form-select input,[invalid=""].gov-form-select select,[invalid=""].gov-form-select textarea,[invalid=true i].gov-form-select input,[invalid=true i].gov-form-select select,[invalid=true i].gov-form-select textarea,[invalid="1"].gov-form-select input,[invalid="1"].gov-form-select select,[invalid="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-select input::-moz-placeholder,[invalid=""].gov-form-select select::-moz-placeholder,[invalid=""].gov-form-select textarea::-moz-placeholder,[invalid=true i].gov-form-select input::-moz-placeholder,[invalid=true i].gov-form-select select::-moz-placeholder,[invalid=true i].gov-form-select textarea::-moz-placeholder,[invalid="1"].gov-form-select input::-moz-placeholder,[invalid="1"].gov-form-select select::-moz-placeholder,[invalid="1"].gov-form-select textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select input::placeholder,[invalid=""].gov-form-select select::placeholder,[invalid=""].gov-form-select textarea::placeholder,[invalid=true i].gov-form-select input::placeholder,[invalid=true i].gov-form-select select::placeholder,[invalid=true i].gov-form-select textarea::placeholder,[invalid="1"].gov-form-select input::placeholder,[invalid="1"].gov-form-select select::placeholder,[invalid="1"].gov-form-select textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select *[slot=left-icon],[invalid=""].gov-form-select *[slot=right-icon],[invalid=true i].gov-form-select *[slot=left-icon],[invalid=true i].gov-form-select *[slot=right-icon],[invalid="1"].gov-form-select *[slot=left-icon],[invalid="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error)) !important}[invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[success=""].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[multiline=""].gov-form-select *[slot=left-icon],[multiline=""].gov-form-select *[slot=right-icon],[multiline=true i].gov-form-select *[slot=left-icon],[multiline=true i].gov-form-select *[slot=right-icon],[multiline="1"].gov-form-select *[slot=left-icon],[multiline="1"].gov-form-select *[slot=right-icon]{display:none}.gov-form-select{background:none}.gov-form-select select{-webkit-appearance:none;-moz-appearance:none}.gov-form-select select::-ms-expand{display:none}[size=s].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-s-arrow-right-position, 0.75rem);width:var(--gov-form-select-s-arrow-size, 0.75rem);height:var(--gov-form-select-s-arrow-size, 0.75rem)}[size=s][invalid=""].gov-form-select .icon-arrow,[size=s][invalid=true i].gov-form-select .icon-arrow,[size=s][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=s][success=""].gov-form-select .icon-arrow,[size=s][success=true i].gov-form-select .icon-arrow,[size=s][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=m].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-m-arrow-right-position, 1rem);width:var(--gov-form-select-m-arrow-size, 0.75rem);height:var(--gov-form-select-m-arrow-size, 0.75rem)}[size=m][invalid=""].gov-form-select .icon-arrow,[size=m][invalid=true i].gov-form-select .icon-arrow,[size=m][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=m][success=""].gov-form-select .icon-arrow,[size=m][success=true i].gov-form-select .icon-arrow,[size=m][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=l].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-l-arrow-right-position, 1rem);width:var(--gov-form-select-l-arrow-size, 1rem);height:var(--gov-form-select-l-arrow-size, 1rem)}[size=l][invalid=""].gov-form-select .icon-arrow,[size=l][invalid=true i].gov-form-select .icon-arrow,[size=l][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=l][success=""].gov-form-select .icon-arrow,[size=l][success=true i].gov-form-select .icon-arrow,[size=l][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=xl].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-xl-arrow-right-position, 1.3125rem);width:var(--gov-form-select-xl-arrow-size, 1rem);height:var(--gov-form-select-xl-arrow-size, 1rem)}[size=xl][invalid=""].gov-form-select .icon-arrow,[size=xl][invalid=true i].gov-form-select .icon-arrow,[size=xl][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=xl][success=""].gov-form-select .icon-arrow,[size=xl][success=true i].gov-form-select .icon-arrow,[size=xl][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=s][invalid=""].gov-form-select *[slot=right-icon]~select,[size=s][invalid=""].gov-form-select *[slot=right-icon]~input,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=s][success=""].gov-form-select *[slot=right-icon]~select,[size=s][success=""].gov-form-select *[slot=right-icon]~input,[size=s][success=true i].gov-form-select *[slot=right-icon]~select,[size=s][success=true i].gov-form-select *[slot=right-icon]~input,[size=s][success="1"].gov-form-select *[slot=right-icon]~select,[size=s][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=m][invalid=""].gov-form-select *[slot=right-icon]~select,[size=m][invalid=""].gov-form-select *[slot=right-icon]~input,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=m][success=""].gov-form-select *[slot=right-icon]~select,[size=m][success=""].gov-form-select *[slot=right-icon]~input,[size=m][success=true i].gov-form-select *[slot=right-icon]~select,[size=m][success=true i].gov-form-select *[slot=right-icon]~input,[size=m][success="1"].gov-form-select *[slot=right-icon]~select,[size=m][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=l][invalid=""].gov-form-select *[slot=right-icon]~select,[size=l][invalid=""].gov-form-select *[slot=right-icon]~input,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=l][success=""].gov-form-select *[slot=right-icon]~select,[size=l][success=""].gov-form-select *[slot=right-icon]~input,[size=l][success=true i].gov-form-select *[slot=right-icon]~select,[size=l][success=true i].gov-form-select *[slot=right-icon]~input,[size=l][success="1"].gov-form-select *[slot=right-icon]~select,[size=l][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=xl][invalid=""].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=""].gov-form-select *[slot=right-icon]~input,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}[size=xl][success=""].gov-form-select *[slot=right-icon]~select,[size=xl][success=""].gov-form-select *[slot=right-icon]~input,[size=xl][success=true i].gov-form-select *[slot=right-icon]~select,[size=xl][success=true i].gov-form-select *[slot=right-icon]~input,[size=xl][success="1"].gov-form-select *[slot=right-icon]~select,[size=xl][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}';const b=class{constructor(i){o(this,i);this.govFocus=e(this,"gov-focus",7);this.govBlur=e(this,"gov-blur",7);this.govChange=e(this,"gov-change",7);this.value=undefined;this.options=undefined;this.identifier=undefined;this.variant="secondary";this.size="m";this.name=undefined;this.required=false;this.success=undefined;this.disabled=false;this.invalid=undefined;this.wcagActiveDescendant=undefined;this.wcagControls=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.optionsState=[];this.h=a(this.host);this.f=s(this.h);this.selectId=p("GovSelect")}validateVariant(o){f(c,o,l.root)}validateSize(o){f(n,o,l.root)}watchOptions(o){this.optionsState=z(o)}watchDisabled(){this.passControlAttrs()}watchValue(){this.markSelectedValue()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",g(this.invalid));this.f.passAttrToControl("type","select")}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.markSelectedValue();this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required));this.optionsState=z(this.options)}async componentDidRender(){if(m()){await u(500);await this.validateWcag()}x((()=>this.markSelectedValue()))}markSelectedValue(){this.host.querySelectorAll("option").forEach((o=>{if(o.value===this.value){o.setAttribute("selected","selected")}else{o.removeAttribute("selected")}}))}render(){return i(t,{class:l.root,size:this.size,variant:this.variant},this.h.hasSlot("prefix")&&i("slot",{name:"prefix"}),i("span",{class:"element"},i("gov-icon",{slot:"right-icon",name:"chevron-down",class:"icon-arrow"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&i("slot",{name:"right-icon"}),this.success&&i("gov-icon",{slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&i("gov-icon",{slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),i("select",{id:this.identifier||this.selectId,onFocus:this.onFocusHandler.bind(this),onChange:this.onChangeHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,name:this.name,disabled:this.disabled,ref:o=>this.selectRef=o,"aria-disabled":v(this.disabled),"aria-activedescendant":this.wcagActiveDescendant,"aria-controls":this.wcagControls,"aria-required":v(this.required),"aria-invalid":v(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns},i("slot",null),Array.isArray(this.optionsState)&&this.optionsState.map((o=>{var e;return i("option",{value:o.value,selected:o.value===this.value,disabled:o===null||o===void 0?void 0:o.disabled},(e=o.label)!==null&&e!==void 0?e:o.value)})))),this.h.hasSlot("sufix")&&i("slot",{name:"sufix"}))}onFocusHandler(o){this.focused=true;this.govFocus.emit({component:l.root,originalEvent:o,value:this.value})}onBlurHandler(o){this.focused=false;this.govBlur.emit({component:l.root,originalEvent:o,value:this.value})}onChangeHandler(o){this.value=o.target.value;o.stopPropagation();this.govChange.emit({component:l.root,originalEvent:o,value:this.value})}async setFocus(o){return this.selectRef.focus(o)}async getRef(){return this.selectRef}async validateWcag(){d(this.wcagActiveDescendant,"wcag-active-descendant",l.root);d(this.wcagControls,"wcag-controls",l.root);d(this.wcagDescribedBy,"wcag-described-by",l.root);d(this.wcagOwns,"wcag-owns",l.root);h(this.identifier||this.selectId,this.wcagLabelledBy,l.root)}get host(){return r(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize","watchDisabled"],options:["watchOptions"],disabled:["watchDisabled"],invalid:["watchDisabled"],value:["watchValue"]}}};b.style=w;export{b as gov_form_select};
|
|
2
|
-
|
|
1
|
+
import{r as o,c as e,h as i,a as t,g as r}from"./p-5bc604a3.js";import{g as s,n as l,o as c,p as n}from"./p-61a2b12a.js";import{g as a,a as g,t as v}from"./p-5de606f8.js";import{c as m}from"./p-003e6cca.js";import{v as f}from"./p-dcb5fb35.js";import{a as d,b as h}from"./p-7724b535.js";import{c as p}from"./p-24636c53.js";import{d as u}from"./p-03990da5.js";import{p as z}from"./p-ab5a13ea.js";import{t as x}from"./p-8fcc8483.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-6278531b.js";import"./p-9dab01be.js";import"./p-3464136c.js";import"./p-7f2c9830.js";const w='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-select{position:relative;display:flex;width:100%;align-items:center}.gov-form-select .element{position:relative;display:flex;flex:1 1 auto}.gov-form-select input,.gov-form-select select,.gov-form-select textarea{width:100%;border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-select input:focus,.gov-form-select select:focus,.gov-form-select textarea:focus{outline:none}.gov-form-select input:focus-visible,.gov-form-select select:focus-visible,.gov-form-select textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-select input::-moz-placeholder,.gov-form-select select::-moz-placeholder,.gov-form-select textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select input::placeholder,.gov-form-select select::placeholder,.gov-form-select textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select textarea{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);padding:0.5rem 0.75rem;resize:none}.gov-form-select *[slot=left-icon],.gov-form-select *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;transform:translateY(-50%);pointer-events:none}.gov-form-select *[slot=left-icon]{left:0}.gov-form-select *[slot=right-icon]{right:0}.gov-form-select *[slot=prefix],.gov-form-select *[slot=sufix]{margin:0}[size=s].gov-form-select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);gap:0.5rem var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select input,[size=s].gov-form-select select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);height:var(--gov-form-input-core-s-height, 2rem);padding:var(--gov-form-input-core-s-padding, 0.25rem 0.75rem)}[size=s].gov-form-select *[slot=left-icon],[size=s].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-s-icon-size, 1rem);height:var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=s].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=right-icon]~input,[size=s].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=m].gov-form-select{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);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select input,[size=m].gov-form-select select{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);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-select *[slot=left-icon],[size=m].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=right-icon]~input,[size=m].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-select{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);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select input,[size=l].gov-form-select select{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);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-select *[slot=left-icon],[size=l].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=right-icon]~input,[size=l].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select input,[size=xl].gov-form-select select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-select *[slot=left-icon],[size=xl].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=right-icon]~input,[size=xl].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}[variant=primary].gov-form-select input,[variant=primary].gov-form-select select,[variant=primary].gov-form-select textarea{color:var(--gov-form-input-color-primary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-primary, 0.0625rem solid var(--gov-color-primary-600))}[variant=primary].gov-form-select *[slot=left-icon],[variant=primary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-primary, var(--gov-color-primary))}[variant=secondary].gov-form-select input,[variant=secondary].gov-form-select select,[variant=secondary].gov-form-select textarea{color:var(--gov-form-input-color-secondary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-secondary, 0.0625rem solid var(--gov-color-secondary-700))}[variant=secondary].gov-form-select *[slot=left-icon],[variant=secondary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-secondary, var(--gov-color-primary))}[disabled=""].gov-form-select,[disabled=true i].gov-form-select,[disabled="1"].gov-form-select{pointer-events:none}[disabled=""].gov-form-select input,[disabled=""].gov-form-select select,[disabled=""].gov-form-select textarea,[disabled=true i].gov-form-select input,[disabled=true i].gov-form-select select,[disabled=true i].gov-form-select textarea,[disabled="1"].gov-form-select input,[disabled="1"].gov-form-select select,[disabled="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-select *[slot=left-icon],[disabled=""].gov-form-select *[slot=right-icon],[disabled=true i].gov-form-select *[slot=left-icon],[disabled=true i].gov-form-select *[slot=right-icon],[disabled="1"].gov-form-select *[slot=left-icon],[disabled="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600)) !important}[invalid=""].gov-form-select input,[invalid=""].gov-form-select select,[invalid=""].gov-form-select textarea,[invalid=true i].gov-form-select input,[invalid=true i].gov-form-select select,[invalid=true i].gov-form-select textarea,[invalid="1"].gov-form-select input,[invalid="1"].gov-form-select select,[invalid="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-select input::-moz-placeholder,[invalid=""].gov-form-select select::-moz-placeholder,[invalid=""].gov-form-select textarea::-moz-placeholder,[invalid=true i].gov-form-select input::-moz-placeholder,[invalid=true i].gov-form-select select::-moz-placeholder,[invalid=true i].gov-form-select textarea::-moz-placeholder,[invalid="1"].gov-form-select input::-moz-placeholder,[invalid="1"].gov-form-select select::-moz-placeholder,[invalid="1"].gov-form-select textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select input::placeholder,[invalid=""].gov-form-select select::placeholder,[invalid=""].gov-form-select textarea::placeholder,[invalid=true i].gov-form-select input::placeholder,[invalid=true i].gov-form-select select::placeholder,[invalid=true i].gov-form-select textarea::placeholder,[invalid="1"].gov-form-select input::placeholder,[invalid="1"].gov-form-select select::placeholder,[invalid="1"].gov-form-select textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select *[slot=left-icon],[invalid=""].gov-form-select *[slot=right-icon],[invalid=true i].gov-form-select *[slot=left-icon],[invalid=true i].gov-form-select *[slot=right-icon],[invalid="1"].gov-form-select *[slot=left-icon],[invalid="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error)) !important}[invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[success=""].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[multiline=""].gov-form-select *[slot=left-icon],[multiline=""].gov-form-select *[slot=right-icon],[multiline=true i].gov-form-select *[slot=left-icon],[multiline=true i].gov-form-select *[slot=right-icon],[multiline="1"].gov-form-select *[slot=left-icon],[multiline="1"].gov-form-select *[slot=right-icon]{display:none}.gov-form-select{background:none}.gov-form-select select{-webkit-appearance:none;-moz-appearance:none}.gov-form-select select::-ms-expand{display:none}[size=s].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-s-arrow-right-position, 0.75rem);width:var(--gov-form-select-s-arrow-size, 0.75rem);height:var(--gov-form-select-s-arrow-size, 0.75rem)}[size=s][invalid=""].gov-form-select .icon-arrow,[size=s][invalid=true i].gov-form-select .icon-arrow,[size=s][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=s][success=""].gov-form-select .icon-arrow,[size=s][success=true i].gov-form-select .icon-arrow,[size=s][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=m].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-m-arrow-right-position, 1rem);width:var(--gov-form-select-m-arrow-size, 0.75rem);height:var(--gov-form-select-m-arrow-size, 0.75rem)}[size=m][invalid=""].gov-form-select .icon-arrow,[size=m][invalid=true i].gov-form-select .icon-arrow,[size=m][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=m][success=""].gov-form-select .icon-arrow,[size=m][success=true i].gov-form-select .icon-arrow,[size=m][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=l].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-l-arrow-right-position, 1rem);width:var(--gov-form-select-l-arrow-size, 1rem);height:var(--gov-form-select-l-arrow-size, 1rem)}[size=l][invalid=""].gov-form-select .icon-arrow,[size=l][invalid=true i].gov-form-select .icon-arrow,[size=l][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=l][success=""].gov-form-select .icon-arrow,[size=l][success=true i].gov-form-select .icon-arrow,[size=l][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=xl].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-xl-arrow-right-position, 1.3125rem);width:var(--gov-form-select-xl-arrow-size, 1rem);height:var(--gov-form-select-xl-arrow-size, 1rem)}[size=xl][invalid=""].gov-form-select .icon-arrow,[size=xl][invalid=true i].gov-form-select .icon-arrow,[size=xl][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=xl][success=""].gov-form-select .icon-arrow,[size=xl][success=true i].gov-form-select .icon-arrow,[size=xl][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=s][invalid=""].gov-form-select *[slot=right-icon]~select,[size=s][invalid=""].gov-form-select *[slot=right-icon]~input,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=s][success=""].gov-form-select *[slot=right-icon]~select,[size=s][success=""].gov-form-select *[slot=right-icon]~input,[size=s][success=true i].gov-form-select *[slot=right-icon]~select,[size=s][success=true i].gov-form-select *[slot=right-icon]~input,[size=s][success="1"].gov-form-select *[slot=right-icon]~select,[size=s][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=m][invalid=""].gov-form-select *[slot=right-icon]~select,[size=m][invalid=""].gov-form-select *[slot=right-icon]~input,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=m][success=""].gov-form-select *[slot=right-icon]~select,[size=m][success=""].gov-form-select *[slot=right-icon]~input,[size=m][success=true i].gov-form-select *[slot=right-icon]~select,[size=m][success=true i].gov-form-select *[slot=right-icon]~input,[size=m][success="1"].gov-form-select *[slot=right-icon]~select,[size=m][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=l][invalid=""].gov-form-select *[slot=right-icon]~select,[size=l][invalid=""].gov-form-select *[slot=right-icon]~input,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=l][success=""].gov-form-select *[slot=right-icon]~select,[size=l][success=""].gov-form-select *[slot=right-icon]~input,[size=l][success=true i].gov-form-select *[slot=right-icon]~select,[size=l][success=true i].gov-form-select *[slot=right-icon]~input,[size=l][success="1"].gov-form-select *[slot=right-icon]~select,[size=l][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=xl][invalid=""].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=""].gov-form-select *[slot=right-icon]~input,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}[size=xl][success=""].gov-form-select *[slot=right-icon]~select,[size=xl][success=""].gov-form-select *[slot=right-icon]~input,[size=xl][success=true i].gov-form-select *[slot=right-icon]~select,[size=xl][success=true i].gov-form-select *[slot=right-icon]~input,[size=xl][success="1"].gov-form-select *[slot=right-icon]~select,[size=xl][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}';const b=class{constructor(i){o(this,i);this.govFocus=e(this,"gov-focus",7);this.govBlur=e(this,"gov-blur",7);this.govChange=e(this,"gov-change",7);this.value=undefined;this.options=undefined;this.identifier=undefined;this.variant="secondary";this.size="m";this.name=undefined;this.required=false;this.success=undefined;this.disabled=false;this.invalid=undefined;this.wcagActiveDescendant=undefined;this.wcagControls=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.optionsState=[];this.h=a(this.host);this.f=s(this.h);this.selectId=p("GovSelect")}validateVariant(o){f(c,o,l.root)}validateSize(o){f(n,o,l.root)}watchOptions(o){this.optionsState=z(o)}watchDisabled(){this.passControlAttrs()}watchValue(){this.markSelectedValue()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",g(this.invalid));this.f.passAttrToControl("type","select")}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.markSelectedValue();this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required));this.optionsState=z(this.options)}async componentDidRender(){if(m()){await u(500);await this.validateAccessibility()}x((()=>this.markSelectedValue()))}markSelectedValue(){this.host.querySelectorAll("option").forEach((o=>{if(o.value===this.value){o.setAttribute("selected","selected")}else{o.removeAttribute("selected")}}))}render(){return i(t,{class:l.root,size:this.size,variant:this.variant},this.h.hasSlot("prefix")&&i("slot",{name:"prefix"}),i("span",{class:"element"},i("gov-icon",{slot:"right-icon",name:"chevron-down",class:"icon-arrow"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&i("slot",{name:"right-icon"}),this.success&&i("gov-icon",{slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&i("gov-icon",{slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),i("select",{id:this.identifier||this.selectId,onFocus:this.onFocusHandler.bind(this),onChange:this.onChangeHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,name:this.name,disabled:this.disabled,ref:o=>this.selectRef=o,"aria-disabled":v(this.disabled),"aria-activedescendant":this.wcagActiveDescendant,"aria-controls":this.wcagControls,"aria-required":v(this.required),"aria-invalid":v(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns},i("slot",null),Array.isArray(this.optionsState)&&this.optionsState.map((o=>{var e;return i("option",{value:o.value,selected:o.value===this.value,disabled:o===null||o===void 0?void 0:o.disabled},(e=o.label)!==null&&e!==void 0?e:o.value)})))),this.h.hasSlot("sufix")&&i("slot",{name:"sufix"}))}onFocusHandler(o){this.focused=true;this.govFocus.emit({component:l.root,originalEvent:o,value:this.value})}onBlurHandler(o){this.focused=false;this.govBlur.emit({component:l.root,originalEvent:o,value:this.value})}onChangeHandler(o){this.value=o.target.value;o.stopPropagation();this.govChange.emit({component:l.root,originalEvent:o,value:this.value})}async setFocus(o){return this.selectRef.focus(o)}async getRef(){return this.selectRef}async validateAccessibility(){d(this.wcagActiveDescendant,"wcag-active-descendant",l.root);d(this.wcagControls,"wcag-controls",l.root);d(this.wcagDescribedBy,"wcag-described-by",l.root);d(this.wcagOwns,"wcag-owns",l.root);h(this.identifier||this.selectId,this.wcagLabelledBy,l.root)}get host(){return r(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize","watchDisabled"],options:["watchOptions"],disabled:["watchDisabled"],invalid:["watchDisabled"],value:["watchValue"]}}};b.style=w;export{b as gov_form_select};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-1ebf3575.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["govFormSelectCss","GovFormSelect","constructor","hostRef","this","h","govHost","host","f","govForm","selectId","createID","validateVariant","newValue","validateProp","FormSelectVariants","FormSelectClass","root","validateSize","FormSelectSizes","watchOptions","optionsState","propsValueToArray","watchDisabled","passControlAttrs","watchValue","markSelectedValue","passAttrToControl","size","toBoolAttr","invalid","componentWillLoad","variant","passAttrToLabel","String","required","options","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","tick","querySelectorAll","forEach","option","value","setAttribute","removeAttribute","render","Host","class","hasSlot","name","slot","success","id","identifier","onFocus","onFocusHandler","bind","onChange","onChangeHandler","onBlur","onBlurHandler","disabled","ref","el","selectRef","toBoolAttrIfDefined","wcagActiveDescendant","wcagControls","wcagDescribedBy","wcagLabelledBy","wcagOwns","Array","isArray","map","selected","_a","label","e","focused","govFocus","emit","component","originalEvent","govBlur","target","stopPropagation","govChange","setFocus","focus","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/select/gov-form-select.scss?tag=gov-form-select","../../../packages/core/src/components/gov-form/select/gov-form-select.tsx"],"sourcesContent":["/*\n * Select\n */\n\n@import \"../select/gov-form-select-core.scss\";\n\n$class: \".gov-form-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {createID} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {\n\tFormSelectClass,\n\tFormSelectSizes,\n\tFormSelectSizesType,\n\tFormSelectVariants,\n\tFormSelectVariantType\n} from './constants'\nimport {FormSelectEvent, FormSelectOption} from './gov-form-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {tick} from \"../../../utils/stencil.utils\";\n\n@Component({\n\ttag: 'gov-form-select',\n\tstyleUrl: 'gov-form-select.scss',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\n\tprivate readonly selectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t\tthis.selectId = createID('GovSelect')\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of select\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string\n\t/**\n\t * Options of select\n\t */\n\t@Prop({reflect: true, mutable: true}) options?: string | FormSelectOption[]\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormSelectVariantType = 'secondary'\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormSelectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a related component’s visually focused element.\n\t */\n\t@Prop({attribute: 'wcag-active-descendant'}) readonly wcagActiveDescendant: string\n\t/**\n\t * Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component.\n\t */\n\t@Prop({attribute: 'wcag-controls'}) readonly wcagControls: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormSelectEvent>\n\t@State() focused: boolean\n\t@State() optionsState: FormSelectOption[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormSelectVariants, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSelectSizes, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('options')\n\twatchOptions(newValue: string | FormSelectOption[]): void {\n\t\tthis.optionsState = propsValueToArray(newValue)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@Watch('value')\n\twatchValue(): void {\n\t\tthis.markSelectedValue()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.markSelectedValue()\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateAccessibility()\n\t\t}\n\t\ttick(() => this.markSelectedValue())\n\t}\n\n\tprivate markSelectedValue() {\n\t\tthis.host.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.value === this.value) {\n\t\t\t\toption.setAttribute('selected', 'selected')\n\t\t\t} else {\n\t\t\t\toption.removeAttribute('selected')\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t<gov-icon slot=\"right-icon\" name=\"chevron-down\" class=\"icon-arrow\"></gov-icon>\n\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t<select\n\t\t\t\t\t\tid={this.identifier || this.selectId}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\taria-activedescendant={this.wcagActiveDescendant}\n\t\t\t\t\t\taria-controls={this.wcagControls}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t{Array.isArray(this.optionsState) && this.optionsState.map((option) => {\n\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.label ?? option.value}</option>)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</select>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateAccessibility(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormSelectClass.root)\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as o,h as r,a as e,g as a}from"./p-5bc604a3.js";import{p as s,d as n}from"./p-03990da5.js";import{V as t}from"./p-ff7365ae.js";import{g as i}from"./p-5de606f8.js";import{v as g}from"./p-dcb5fb35.js";import{c as l}from"./p-003e6cca.js";import{v}from"./p-7724b535.js";import"./p-7f2c9830.js";import"./p-24636c53.js";const c=s(t,["PRIMARY","SECONDARY","SUCCESS","ERROR","WARNING"]);var d;(function(o){o["CIRCLE"]="circle";o["REACT"]="rect";o["TEXT"]="text"})(d||(d={}));var k;(function(o){o["PULSE"]="pulse";o["PROGRESS"]="progress";o["FALSE"]="false"})(k||(k={}));const p={root:"gov-skeleton",loader:"gov-skeleton__loader"};const u=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-skeleton__loader{position:relative;display:inline-block;width:var(--gov-skeleton-width, 100%);height:var(--gov-skeleton-height, 20px);border-radius:var(--gov-skeleton-border-radius, var(--gov-border-radius, 0.1875rem));outline:none;overflow:hidden;box-sizing:border-box;will-change:transform}.gov-skeleton__loader+.gov-skeleton__loader{margin-top:var(--gov-skeleton-margin-top, 8px)}.gov-skeleton__loader.circle{width:var(--gov-skeleton-circle-size, 60px);height:var(--gov-skeleton-circle-size, 60px);border-radius:var(--gov-skeleton-circle-radius, 50%)}.gov-skeleton__loader.rect{border-radius:var(--gov-skeleton-rect-radius, 0)}.gov-skeleton__loader.progress{background-size:200px 100%;animation:progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite}.gov-skeleton__loader.pulse{animation:pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;animation-delay:0.5s}@media (prefers-reduced-motion: reduce){.gov-skeleton__loader.pulse,.gov-skeleton__loader.progress{background-image:none;animation:none}}.gov-skeleton[variant=warning] .gov-skeleton__loader{background-color:var(--gov-skeleton-warning-background, var(--gov-color-warning-100));background-repeat:no-repeat}.gov-skeleton[variant=warning] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-warning-background, var(--gov-color-warning-100)), var(--gov-skeleton-warning-foreground, var(--gov-color-warning-200)), var(--gov-skeleton-warning-background, var(--gov-color-warning-100)))}.gov-skeleton[variant=error] .gov-skeleton__loader{background-color:var(--gov-skeleton-error-background, var(--gov-color-error-100));background-repeat:no-repeat}.gov-skeleton[variant=error] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-error-background, var(--gov-color-error-100)), var(--gov-skeleton-error-foreground, var(--gov-color-error-200)), var(--gov-skeleton-error-background, var(--gov-color-error-100)))}.gov-skeleton[variant=secondary] .gov-skeleton__loader{background-color:var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300));background-repeat:no-repeat}.gov-skeleton[variant=secondary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)), var(--gov-skeleton-secondary-foreground, var(--gov-color-secondary-100)), var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)))}.gov-skeleton[variant=success] .gov-skeleton__loader{background-color:var(--gov-skeleton-success-background, var(--gov-color-success-100));background-repeat:no-repeat}.gov-skeleton[variant=success] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-success-background, var(--gov-color-success-100)), var(--gov-skeleton-success-foreground, var(--gov-color-success-200)), var(--gov-skeleton-success-background, var(--gov-color-success-100)))}.gov-skeleton[variant=primary] .gov-skeleton__loader{background-color:var(--gov-skeleton-primary-background, var(--gov-color-primary-100));background-repeat:no-repeat}.gov-skeleton[variant=primary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-primary-background, var(--gov-color-primary-100)), var(--gov-skeleton-primary-foreground, var(--gov-color-primary-200)), var(--gov-skeleton-primary-background, var(--gov-color-primary-100)))}";const m=class{constructor(r){o(this,r);this.items=[];this.variant="secondary";this.count=1;this.shape="text";this.width=null;this.height=null;this.animation="progress";this.wcagLabel=undefined;this.h=i(this.host)}validateVariant(o){g(c,o,p.root)}validateShape(o){g(d,o,p.root)}validateAnimation(o){g(k,o,p.root)}componentWillLoad(){this.validateVariant(this.variant);this.validateShape(this.shape);this.validateAnimation(this.animation);this.init()}componentWillUpdate(){this.init()}async componentDidRender(){if(l()){await n(500);await this.
|
|
2
|
-
|
|
1
|
+
import{r as o,h as r,a as e,g as a}from"./p-5bc604a3.js";import{p as s,d as n}from"./p-03990da5.js";import{V as t}from"./p-ff7365ae.js";import{g as i}from"./p-5de606f8.js";import{v as g}from"./p-dcb5fb35.js";import{c as l}from"./p-003e6cca.js";import{v}from"./p-7724b535.js";import"./p-7f2c9830.js";import"./p-24636c53.js";const c=s(t,["PRIMARY","SECONDARY","SUCCESS","ERROR","WARNING"]);var d;(function(o){o["CIRCLE"]="circle";o["REACT"]="rect";o["TEXT"]="text"})(d||(d={}));var k;(function(o){o["PULSE"]="pulse";o["PROGRESS"]="progress";o["FALSE"]="false"})(k||(k={}));const p={root:"gov-skeleton",loader:"gov-skeleton__loader"};const u=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-skeleton__loader{position:relative;display:inline-block;width:var(--gov-skeleton-width, 100%);height:var(--gov-skeleton-height, 20px);border-radius:var(--gov-skeleton-border-radius, var(--gov-border-radius, 0.1875rem));outline:none;overflow:hidden;box-sizing:border-box;will-change:transform}.gov-skeleton__loader+.gov-skeleton__loader{margin-top:var(--gov-skeleton-margin-top, 8px)}.gov-skeleton__loader.circle{width:var(--gov-skeleton-circle-size, 60px);height:var(--gov-skeleton-circle-size, 60px);border-radius:var(--gov-skeleton-circle-radius, 50%)}.gov-skeleton__loader.rect{border-radius:var(--gov-skeleton-rect-radius, 0)}.gov-skeleton__loader.progress{background-size:200px 100%;animation:progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite}.gov-skeleton__loader.pulse{animation:pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;animation-delay:0.5s}@media (prefers-reduced-motion: reduce){.gov-skeleton__loader.pulse,.gov-skeleton__loader.progress{background-image:none;animation:none}}.gov-skeleton[variant=warning] .gov-skeleton__loader{background-color:var(--gov-skeleton-warning-background, var(--gov-color-warning-100));background-repeat:no-repeat}.gov-skeleton[variant=warning] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-warning-background, var(--gov-color-warning-100)), var(--gov-skeleton-warning-foreground, var(--gov-color-warning-200)), var(--gov-skeleton-warning-background, var(--gov-color-warning-100)))}.gov-skeleton[variant=error] .gov-skeleton__loader{background-color:var(--gov-skeleton-error-background, var(--gov-color-error-100));background-repeat:no-repeat}.gov-skeleton[variant=error] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-error-background, var(--gov-color-error-100)), var(--gov-skeleton-error-foreground, var(--gov-color-error-200)), var(--gov-skeleton-error-background, var(--gov-color-error-100)))}.gov-skeleton[variant=secondary] .gov-skeleton__loader{background-color:var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300));background-repeat:no-repeat}.gov-skeleton[variant=secondary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)), var(--gov-skeleton-secondary-foreground, var(--gov-color-secondary-100)), var(--gov-skeleton-secondary-background, var(--gov-color-secondary-300)))}.gov-skeleton[variant=success] .gov-skeleton__loader{background-color:var(--gov-skeleton-success-background, var(--gov-color-success-100));background-repeat:no-repeat}.gov-skeleton[variant=success] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-success-background, var(--gov-color-success-100)), var(--gov-skeleton-success-foreground, var(--gov-color-success-200)), var(--gov-skeleton-success-background, var(--gov-color-success-100)))}.gov-skeleton[variant=primary] .gov-skeleton__loader{background-color:var(--gov-skeleton-primary-background, var(--gov-color-primary-100));background-repeat:no-repeat}.gov-skeleton[variant=primary] .gov-skeleton__loader.progress{background-image:linear-gradient(90deg, var(--gov-skeleton-primary-background, var(--gov-color-primary-100)), var(--gov-skeleton-primary-foreground, var(--gov-color-primary-200)), var(--gov-skeleton-primary-background, var(--gov-color-primary-100)))}";const m=class{constructor(r){o(this,r);this.items=[];this.variant="secondary";this.count=1;this.shape="text";this.width=null;this.height=null;this.animation="progress";this.wcagLabel=undefined;this.h=i(this.host)}validateVariant(o){g(c,o,p.root)}validateShape(o){g(d,o,p.root)}validateAnimation(o){g(k,o,p.root)}componentWillLoad(){this.validateVariant(this.variant);this.validateShape(this.shape);this.validateAnimation(this.animation);this.init()}componentWillUpdate(){this.init()}async componentDidRender(){if(l()){await n(500);await this.validateAccessibility()}}init(){this.items.length=this.count;this.items.fill(1)}get style(){const o={width:null,height:null};if(this.width){o.width=this.width}if(this.height){o.height=this.height}return Object.assign({},o)}render(){return r(e,{class:this.h.classes(p.root),variant:this.variant},this.items.map(((o,e)=>r("span",{key:e,class:{circle:this.shape==="circle",rect:this.shape==="rect",progress:this.animation==="progress",pulse:this.animation==="pulse",[p.loader]:true},"aria-busy":"true","aria-valuemin":"0","aria-valuemax":"100","aria-valuetext":this.wcagLabel,role:"progressbar",tabindex:"0",style:this.style}))))}async validateAccessibility(){v(this.wcagLabel,undefined,p.root)}get host(){return a(this)}static get watchers(){return{variant:["validateVariant"],shape:["validateShape"],animation:["validateAnimation"]}}};m.style=u;export{m as gov_skeleton};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-28a50f60.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SkeletonVariants","pick","Variants","SkeletonShapes","SkeletonAnimation","SkeletonClass","root","loader","govSkeletonCss","GovSkeleton","constructor","hostRef","this","items","h","govHost","host","validateVariant","newValue","validateProp","validateShape","validateAnimation","componentWillLoad","variant","shape","animation","init","componentWillUpdate","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","length","count","fill","style","dimenssionsStyles","width","height","Object","assign","render","Host","class","classes","map","_","index","key","circle","rect","progress","pulse","wcagLabel","role","tabindex","validateAccessibleLabel","undefined"],"sources":["../../../packages/core/src/components/gov-loading/skeleton/constants.ts","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.scss?tag=gov-skeleton","../../../packages/core/src/components/gov-loading/skeleton/gov-skeleton.tsx"],"sourcesContent":["import { pick } from \"../../../utils/utils\"\nimport { Variants } from \"../../../core/constants/variants\"\nimport { ValueOf } from \"../../../types/interfaces\"\n\nexport const SkeletonVariants = pick(Variants, [\"PRIMARY\", \"SECONDARY\", \"SUCCESS\", \"ERROR\", \"WARNING\"])\nexport type SkeletonVariantsType = `${ValueOf<typeof SkeletonVariants>}`\n\nexport enum SkeletonShapes {\n\tCIRCLE = 'circle',\n\tREACT = 'rect',\n\tTEXT = 'text'\n}\nexport type SkeletonShapesType = `${ValueOf<typeof SkeletonShapes>}`\n\nexport enum SkeletonAnimation {\n\tPULSE = 'pulse',\n\tPROGRESS = 'progress',\n\tFALSE = 'false'\n}\nexport type SkeletonAnimationType = `${ValueOf<typeof SkeletonAnimation>}`\n\nexport const SkeletonClass = {\n\troot: 'gov-skeleton',\n\tloader: 'gov-skeleton__loader',\n}\n","$class: \".gov-skeleton\";\n\n#{$class} {\n\t&__loader {\n\t\tposition: relative;\n\t\tdisplay: inline-block;\n\t\twidth: $skeleton-width;\n\t\theight: $skeleton-height;\n\t\tborder-radius: $skeleton-border-radius;\n\t\toutline: none;\n\t\toverflow: hidden;\n\t\tbox-sizing: border-box;\n\t\twill-change: transform;\n\n\t\t+ #{$class}__loader {\n\t\t\tmargin-top: $skeleton-margin-top;\n\t\t}\n\n\t\t&.circle {\n\t\t\twidth: $skeleton-circle-size;\n\t\t\theight: $skeleton-circle-size;\n\t\t\tborder-radius: $skeleton-circle-radius;\n\t\t}\n\n\t\t&.rect {\n\t\t\tborder-radius: $skeleton-rect-radius;\n\t\t}\n\n\t\t&.progress {\n\t\t\tbackground-size: 200px 100%;\n\t\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\t}\n\n\t\t&.pulse {\n\t\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\t\tanimation-delay: 0.5s;\n\t\t}\n\n\t\t@media (prefers-reduced-motion: reduce) {\n\t\t\t&.pulse,\n\t\t\t&.progress {\n\t\t\t\tbackground-image: none;\n\t\t\t\tanimation: none;\n\t\t\t}\n\t\t}\n\t}\n\n\t@each $variant, $definitions in $skeleton-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t#{$class}__loader {\n\t\t\t\tbackground-color: get(\"background\", $definitions);\n\t\t\t\tbackground-repeat: no-repeat;\n\n\t\t\t\t&.progress {\n\t\t\t\t\tbackground-image: linear-gradient(90deg, get(\"background\", $definitions), get(\"foreground\", $definitions), get(\"background\", $definitions));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport {\n\tSkeletonAnimation,\n\tSkeletonAnimationType,\n\tSkeletonClass, SkeletonShapes,\n\tSkeletonShapesType, SkeletonVariants,\n\tSkeletonVariantsType,\n} from \"./constants\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govHost } from \"../../../helpers/Dom/template\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { validateAccessibleLabel } from \"../../../helpers/Validate/wcag\"\n\n@Component({\n\ttag: \"gov-skeleton\",\n\tstyleUrl: \"gov-skeleton.scss\",\n})\nexport class GovSkeleton {\n\th: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovSkeletonElement\n\t/**\n\t * Style variation of the skeleton.\n\t */\n\t@Prop() readonly variant?: SkeletonVariantsType = \"secondary\"\n\t/**\n\t * Number of rows of current skeleton type\n\t */\n\t@Prop() count = 1\n\t/**\n\t * Shape of the skeleton\n\t */\n\t@Prop() shape?: SkeletonShapesType = \"text\"\n\t/**\n\t * Width of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() width: string = null\n\t/**\n\t * Height of the skeleton ex. 100px, 100%, auto etc.\n\t */\n\t@Prop() height: string = null\n\t/**\n\t * Animation type\n\t */\n\t@Prop() animation?: SkeletonAnimationType = \"progress\"\n\t/**\n\t * Adds accessible label for the skeleton that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\n\titems: number[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(SkeletonVariants, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('shape')\n\tvalidateShape(newValue: string): void {\n\t\tvalidateProp(SkeletonShapes, newValue, SkeletonClass.root)\n\t}\n\n\t@Watch('animation')\n\tvalidateAnimation(newValue: string): void {\n\t\tvalidateProp(SkeletonAnimation, newValue, SkeletonClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateShape(this.shape)\n\t\tthis.validateAnimation(this.animation)\n\t\tthis.init()\n\t}\n\n\tcomponentWillUpdate() {\n\t\tthis.init()\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateAccessibility()\n\t\t}\n\t}\n\n\tinit() {\n\t\tthis.items.length = this.count\n\t\tthis.items.fill(1)\n\t}\n\n\tget style() {\n\t\tconst dimenssionsStyles: {\n\t\t\twidth?: string,\n\t\t\theight?: string,\n\t\t} = {\n\t\t\twidth: null,\n\t\t\theight: null,\n\t\t}\n\t\tif (this.width) {\n\t\t\tdimenssionsStyles.width = this.width\n\t\t}\n\n\t\tif (this.height) {\n\t\t\tdimenssionsStyles.height = this.height\n\t\t}\n\n\t\treturn { ...dimenssionsStyles }\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(SkeletonClass.root)} variant={this.variant}>\n\t\t\t\t{this.items.map((_, index) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\tclass={{\n\t\t\t\t\t\t\t\tcircle: this.shape === \"circle\",\n\t\t\t\t\t\t\t\trect: this.shape === \"rect\",\n\t\t\t\t\t\t\t\tprogress: this.animation === \"progress\",\n\t\t\t\t\t\t\t\tpulse: this.animation === \"pulse\",\n\t\t\t\t\t\t\t\t[SkeletonClass.loader]: true,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-busy=\"true\"\n\t\t\t\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t\t\t\taria-valuemax=\"100\"\n\t\t\t\t\t\t\taria-valuetext={this.wcagLabel}\n\t\t\t\t\t\t\trole=\"progressbar\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\tstyle={this.style}\n\t\t\t\t\t\t></span>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateAccessibility(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, undefined, SkeletonClass.root)\n\t}\n}\n"],"mappings":"mUAIO,MAAMA,EAAmBC,EAAKC,EAAU,CAAC,UAAW,YAAa,UAAW,QAAS,YAG5F,IAAYC,GAAZ,SAAYA,GACXA,EAAA,mBACAA,EAAA,gBACAA,EAAA,cACA,EAJD,CAAYA,MAAc,KAO1B,IAAYC,GAAZ,SAAYA,GACXA,EAAA,iBACAA,EAAA,uBACAA,EAAA,gBACA,EAJD,CAAYA,MAAiB,KAOtB,MAAMC,EAAgB,CAC5BC,KAAM,eACNC,OAAQ,wBCvBT,MAAMC,EAAiB,0pH,MCmBVC,EAAW,MAGvB,WAAAC,CAAAC,G,UAkCAC,KAAAC,MAAkB,G,aA1BgC,Y,WAIlC,E,WAIqB,O,WAIb,K,YAIC,K,eAImB,W,yBA3B3CD,KAAKE,EAAIC,EAAQH,KAAKI,K,CAoCvB,eAAAC,CAAgBC,GACfC,EAAanB,EAAkBkB,EAAUb,EAAcC,K,CAIxD,aAAAc,CAAcF,GACbC,EAAahB,EAAgBe,EAAUb,EAAcC,K,CAItD,iBAAAe,CAAkBH,GACjBC,EAAaf,EAAmBc,EAAUb,EAAcC,K,CAGzD,iBAAAgB,GACCV,KAAKK,gBAAgBL,KAAKW,SAC1BX,KAAKQ,cAAcR,KAAKY,OACxBZ,KAAKS,kBAAkBT,KAAKa,WAC5Bb,KAAKc,M,CAGN,mBAAAC,GACCf,KAAKc,M,CAGN,wBAAME,GACL,GAAIC,IAA2B,OACxBC,EAAM,WACNlB,KAAKmB,c,EAIb,IAAAL,GACCd,KAAKC,MAAMmB,OAASpB,KAAKqB,MACzBrB,KAAKC,MAAMqB,KAAK,E,CAGjB,SAAIC,GACH,MAAMC,EAGF,CACHC,MAAO,KACPC,OAAQ,MAET,GAAI1B,KAAKyB,MAAO,CACfD,EAAkBC,MAAQzB,KAAKyB,K,CAGhC,GAAIzB,KAAK0B,OAAQ,CAChBF,EAAkBE,OAAS1B,KAAK0B,M,CAGjC,OAAAC,OAAAC,OAAA,GAAYJ,E,CAGb,MAAAK,GACC,OACC3B,EAAC4B,EAAI,CAACC,MAAO/B,KAAKE,EAAE8B,QAAQvC,EAAcC,MAAOiB,QAASX,KAAKW,SAC7DX,KAAKC,MAAMgC,KAAI,CAACC,EAAGC,IAElBjC,EAAA,QACCkC,IAAKD,EACLJ,MAAO,CACNM,OAAQrC,KAAKY,QAAU,SACvB0B,KAAMtC,KAAKY,QAAU,OACrB2B,SAAUvC,KAAKa,YAAc,WAC7B2B,MAAOxC,KAAKa,YAAc,QAC1B,CAACpB,EAAcE,QAAS,MACxB,YAES,OAAM,gBACF,IAAG,gBACH,MAAK,iBACHK,KAAKyC,UACrBC,KAAK,cACLC,SAAS,IACTpB,MAAOvB,KAAKuB,U,CAYlB,kBAAMJ,GACLyB,EAAkB5C,KAAKyC,UAAWI,UAAWpD,EAAcC,K"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as o,c as a,h as e,a as t,g as i}from"./p-5bc604a3.js";import{g as r,a as s}from"./p-5de606f8.js";import{c as d}from"./p-003e6cca.js";import{a as l}from"./p-7f2c9830.js";import{a as n}from"./p-7724b535.js";import{c as m}from"./p-24636c53.js";import{d as g}from"./p-03990da5.js";import{M as c}from"./p-be4aab0e.js";const h='.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-modal{display:none}.gov-modal__dialog{z-index:101;position:fixed;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:100%;max-width:var(--gov-modal-max-width, 52.5rem);height:100%;padding:0.5rem;border:none;background:transparent;transform:translate(-50%, -50%);pointer-events:none}.gov-modal__inner{position:relative;display:flex;flex-direction:column;width:100%;max-height:100%;border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-modal-bg, var(--gov-color-neutral-white));overflow:hidden;pointer-events:auto;box-shadow:0 0 1.5rem rgba(var(--gov-color-secondary-800-rgb), 0.24)}.gov-modal__header{display:flex;gap:1rem;align-items:flex-start;padding:1.5rem 1rem;border-bottom:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__icon{flex:0 0 auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 1.5rem) / 2)}.gov-modal__icon>*{width:1.5rem;height:1.5rem}.gov-modal__title{font-weight:var(--gov-text-3xl-font-weight);font-size:var(--gov-text-3xl-font-size);line-height:var(--gov-text-3xl-line-height);letter-spacing:var(--gov-text-3xl-letter-spacing);margin:0}.gov-modal__close{flex:0 0 auto;margin-left:auto}.gov-modal__content{height:100%;padding:1.5rem 1rem;color:var(--gov-modal-text-color, var(--gov-color-secondary-700));overflow:auto}.gov-modal__content>*:last-child{margin-bottom:0}.gov-modal__footer,.gov-modal__actions{padding:1.5rem 1rem;border-top:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__actions{display:flex;gap:0.5rem 1rem;flex-wrap:wrap;justify-content:flex-end}.gov-modal__dialog:focus .gov-modal__inner{outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base)}.gov-modal[open=""],.gov-modal[open=true i],.gov-modal[open="1"]{display:block}@media (min-width: 30em){.gov-modal__dialog{max-width:calc(var(--gov-modal-max-width, 52.5rem) + 3rem);padding:1.5rem}.gov-modal__dialog:focus{outline-offset:-1.5rem}.gov-modal__inner{box-shadow:0 0 2rem rgba(var(--gov-color-secondary-800-rgb), 0.32)}.gov-modal--prompt .gov-modal__dialog{max-width:calc(var(--gov-modal-prompt-max-width, 33.125rem) + 3rem)}}@media (min-width: 48em){.gov-modal__header{gap:1.25rem;padding:2rem 2.5rem 2rem 3rem}.gov-modal__content{padding:2rem 3rem}.gov-modal__footer{padding:1rem 3rem}.gov-modal--prompt .gov-modal__header,.gov-modal--prompt .gov-modal__content,.gov-modal--prompt .gov-modal__footer,.gov-modal--prompt .gov-modal__actions{padding:1.5rem}}';const v=class{constructor(e){o(this,e);this.govClose=a(this,"gov-close",7);this.open=false;this.label=undefined;this.role="dialog";this.labelTag="h2";this.wcagLabelledBy=undefined;this.wcagDescribedBy=undefined;this.wcagCloseLabel="Zavřít okno";this.wcagCloseLabelledBy=undefined;this.h=r(this.host);this.labelId=m("GovPromptLabel");this.contentId=m("GovPromptContent")}validateLabelTag(o){const a=["h1","h2","h3","h4","h5","h6"];if(o){if(!a.includes(o)){l(`[${c.root}]: Tag ${o} is not allowed.`)}}}watchOpen(o){this.open=o;if(o&&this.closeCtaRef){this.closeCtaRef.setFocus().catch()}}showModal(){this.open=true;document.body.classList.add(c.bodyFix)}hideModal(){this.open=false;document.body.classList.remove(c.bodyFix)}async componentWillRender(){if(this.open){this.showModal()}else{this.hideModal()}}async componentDidRender(){if(d()){await g(500);await this.
|
|
2
|
-
|
|
1
|
+
import{r as o,c as a,h as e,a as t,g as i}from"./p-5bc604a3.js";import{g as r,a as s}from"./p-5de606f8.js";import{c as d}from"./p-003e6cca.js";import{a as l}from"./p-7f2c9830.js";import{a as n}from"./p-7724b535.js";import{c as m}from"./p-24636c53.js";import{d as g}from"./p-03990da5.js";import{M as c}from"./p-be4aab0e.js";const h='.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-modal{display:none}.gov-modal__dialog{z-index:101;position:fixed;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:100%;max-width:var(--gov-modal-max-width, 52.5rem);height:100%;padding:0.5rem;border:none;background:transparent;transform:translate(-50%, -50%);pointer-events:none}.gov-modal__inner{position:relative;display:flex;flex-direction:column;width:100%;max-height:100%;border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-modal-bg, var(--gov-color-neutral-white));overflow:hidden;pointer-events:auto;box-shadow:0 0 1.5rem rgba(var(--gov-color-secondary-800-rgb), 0.24)}.gov-modal__header{display:flex;gap:1rem;align-items:flex-start;padding:1.5rem 1rem;border-bottom:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__icon{flex:0 0 auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 1.5rem) / 2)}.gov-modal__icon>*{width:1.5rem;height:1.5rem}.gov-modal__title{font-weight:var(--gov-text-3xl-font-weight);font-size:var(--gov-text-3xl-font-size);line-height:var(--gov-text-3xl-line-height);letter-spacing:var(--gov-text-3xl-letter-spacing);margin:0}.gov-modal__close{flex:0 0 auto;margin-left:auto}.gov-modal__content{height:100%;padding:1.5rem 1rem;color:var(--gov-modal-text-color, var(--gov-color-secondary-700));overflow:auto}.gov-modal__content>*:last-child{margin-bottom:0}.gov-modal__footer,.gov-modal__actions{padding:1.5rem 1rem;border-top:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__actions{display:flex;gap:0.5rem 1rem;flex-wrap:wrap;justify-content:flex-end}.gov-modal__dialog:focus .gov-modal__inner{outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base)}.gov-modal[open=""],.gov-modal[open=true i],.gov-modal[open="1"]{display:block}@media (min-width: 30em){.gov-modal__dialog{max-width:calc(var(--gov-modal-max-width, 52.5rem) + 3rem);padding:1.5rem}.gov-modal__dialog:focus{outline-offset:-1.5rem}.gov-modal__inner{box-shadow:0 0 2rem rgba(var(--gov-color-secondary-800-rgb), 0.32)}.gov-modal--prompt .gov-modal__dialog{max-width:calc(var(--gov-modal-prompt-max-width, 33.125rem) + 3rem)}}@media (min-width: 48em){.gov-modal__header{gap:1.25rem;padding:2rem 2.5rem 2rem 3rem}.gov-modal__content{padding:2rem 3rem}.gov-modal__footer{padding:1rem 3rem}.gov-modal--prompt .gov-modal__header,.gov-modal--prompt .gov-modal__content,.gov-modal--prompt .gov-modal__footer,.gov-modal--prompt .gov-modal__actions{padding:1.5rem}}';const v=class{constructor(e){o(this,e);this.govClose=a(this,"gov-close",7);this.open=false;this.label=undefined;this.role="dialog";this.labelTag="h2";this.wcagLabelledBy=undefined;this.wcagDescribedBy=undefined;this.wcagCloseLabel="Zavřít okno";this.wcagCloseLabelledBy=undefined;this.h=r(this.host);this.labelId=m("GovPromptLabel");this.contentId=m("GovPromptContent")}validateLabelTag(o){const a=["h1","h2","h3","h4","h5","h6"];if(o){if(!a.includes(o)){l(`[${c.root}]: Tag ${o} is not allowed.`)}}}watchOpen(o){this.open=o;if(o&&this.closeCtaRef){this.closeCtaRef.setFocus().catch()}}showModal(){this.open=true;document.body.classList.add(c.bodyFix)}hideModal(){this.open=false;document.body.classList.remove(c.bodyFix)}async componentWillRender(){if(this.open){this.showModal()}else{this.hideModal()}}async componentDidRender(){if(d()){await g(500);await this.validateAccessibility()}}render(){const o=this.labelTag;return e(t,{class:this.h.classes(c.rootPrompt),open:this.open},e("dialog",{class:c.dialog,hidden:!this.open,tabindex:"-1",open:this.open,"aria-modal":"true","aria-hidden":s(!this.open),"aria-labelledby":this.wcagLabelledBy||this.labelId,"aria-describedby":this.wcagDescribedBy||this.contentId,role:this.role},e("div",{class:c.inner},e("div",{class:c.header},this.h.hasSlot("icon")&&e("div",{class:c.icon},e("slot",{name:"icon"})),this.label&&e(o,{class:c.title,id:this.labelId},this.label),e("gov-button",{class:c.close,variant:"primary",wcagLabel:this.wcagCloseLabel,wcagLabelledBy:this.wcagCloseLabelledBy,type:"base",ref:o=>this.closeCtaRef=o,"on-gov-click":this.onCloseHandler.bind(this)},e("gov-icon",{name:"x-lg"}))),e("div",{class:c.content,id:this.contentId},e("slot",null)),e("div",{class:c.actions},e("slot",{name:"actions"})))),this.open?e("gov-backdrop",{"wcag-label":this.wcagCloseLabel,"wcag-labelled-by":this.wcagCloseLabelledBy,"on-gov-click":this.onCloseHandler.bind(this)}):null)}onCloseHandler(o){o.stopPropagation();this.hideModal();this.govClose.emit(o)}async show(){this.showModal()}async hide(){this.hideModal()}async validateAccessibility(){n(this.wcagLabelledBy,"wcag-labelled-by",c.root);n(this.wcagDescribedBy,"wcag-described-by",c.root)}get host(){return i(this)}static get watchers(){return{labelTag:["validateLabelTag"],open:["watchOpen"]}}};v.style=h;export{v as gov_prompt};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-2d15339f.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["govPromptCss","GovPrompt","constructor","hostRef","this","h","govHost","host","labelId","createID","contentId","validateLabelTag","newValue","validTags","includes","govErrorLog","ModalClass","root","watchOpen","open","closeCtaRef","setFocus","catch","showModal","document","body","classList","add","bodyFix","hideModal","remove","componentWillRender","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","render","LabelTag","labelTag","Host","class","classes","rootPrompt","dialog","hidden","tabindex","toBoolAttr","wcagLabelledBy","wcagDescribedBy","role","inner","header","hasSlot","icon","name","label","title","id","close","variant","wcagLabel","wcagCloseLabel","wcagCloseLabelledBy","type","ref","el","onCloseHandler","bind","content","actions","e","stopPropagation","govClose","emit","show","hide","validateWcagRef"],"sources":["../../../packages/core/src/components/gov-promp/gov-prompt.scss?tag=gov-prompt","../../../packages/core/src/components/gov-promp/gov-prompt.tsx"],"sourcesContent":["/*\n * Prompt\n */\n\n// $class: \".gov-prompt\";\n@import \"../gov-modal/gov-modal.scss\";\n\n// #{$class} {\n// \t//\n// }\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch} from '@stencil/core'\nimport {govHost, toBoolAttr} from '../../helpers/Dom/template'\nimport {GovHost} from '../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../helpers/Dom/win'\nimport {govErrorLog} from '../../helpers/Log/gov.log'\nimport {validateWcagRef} from '../../helpers/Validate/wcag'\nimport {Nullable} from '../../types/interfaces'\nimport {createID} from '../../utils/string.utils'\nimport {delay} from '../../utils/utils'\nimport {ModalClass} from '../gov-modal/constants'\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\tprivate closeCtaRef?: HTMLGovButtonElement\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: Nullable<string> = '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'}) readonly wcagCloseLabel: string = 'Zavřít okno'\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\tif (newValue && this.closeCtaRef) {\n\t\t\tthis.closeCtaRef.setFocus().catch()\n\t\t}\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.validateAccessibility()\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\tref={el => (this.closeCtaRef = el)}\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 wcag-label={this.wcagCloseLabel} wcag-labelled-by={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}/>\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 validateAccessibility(): 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"],"mappings":"mUAAA,MAAMA,EAAe,wyF,MCeRC,EAAS,MAMrB,WAAAC,CAAAC,G,wDAU8B,M,+BAQsB,S,cAIQ,K,iFAYa,c,mCAjCxEC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,QAAUC,EAAS,kBACxBL,KAAKM,UAAYD,EAAS,mB,CA0C3B,gBAAAE,CAAiBC,GAChB,MAAMC,EAAY,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,MACjD,GAAID,EAAU,CACb,IAAKC,EAAUC,SAASF,GAAW,CAClCG,EAAY,IAAIC,EAAWC,cAAcL,oB,GAM5C,SAAAM,CAAUN,GACTR,KAAKe,KAAOP,EACZ,GAAIA,GAAYR,KAAKgB,YAAa,CACjChB,KAAKgB,YAAYC,WAAWC,O,EAItB,SAAAC,GACPnB,KAAKe,KAAO,KACZK,SAASC,KAAKC,UAAUC,IAAIX,EAAWY,Q,CAGhC,SAAAC,GACPzB,KAAKe,KAAO,MACZK,SAASC,KAAKC,UAAUI,OAAOd,EAAWY,Q,CAG3C,yBAAMG,GACL,GAAI3B,KAAKe,KAAM,CACdf,KAAKmB,W,KACC,CACNnB,KAAKyB,W,EAIP,wBAAMG,GACL,GAAIC,IAA2B,OACxBC,EAAM,WACN9B,KAAK+B,c,EAIb,MAAAC,GACC,MAAMC,EAAWjC,KAAKkC,SACtB,OACCjC,EAACkC,EAAI,CAACC,MAAOpC,KAAKC,EAAEoC,QAAQzB,EAAW0B,YAAavB,KAAMf,KAAKe,MAC9Dd,EAAA,UACCmC,MAAOxB,EAAW2B,OAClBC,QAASxC,KAAKe,KACd0B,SAAS,KACT1B,KAAMf,KAAKe,KAAI,aACJ,OAAM,cACJ2B,GAAY1C,KAAKe,MAAK,kBAClBf,KAAK2C,gBAAkB3C,KAAKI,QAAO,mBAClCJ,KAAK4C,iBAAmB5C,KAAKM,UAC/CuC,KAAM7C,KAAK6C,MAEX5C,EAAA,OAAKmC,MAAOxB,EAAWkC,OACtB7C,EAAA,OAAKmC,MAAOxB,EAAWmC,QACrB/C,KAAKC,EAAE+C,QAAQ,SACf/C,EAAA,OAAKmC,MAAOxB,EAAWqC,MACtBhD,EAAA,QAAMiD,KAAK,UAGZlD,KAAKmD,OACLlD,EAACgC,EAAQ,CAACG,MAAOxB,EAAWwC,MAAOC,GAAIrD,KAAKI,SAC1CJ,KAAKmD,OAGRlD,EAAA,cACCmC,MAAOxB,EAAW0C,MAClBC,QAAQ,UACRC,UAAWxD,KAAKyD,eAChBd,eAAgB3C,KAAK0D,oBACrBC,KAAK,OACLC,IAAKC,GAAO7D,KAAKgB,YAAc6C,EAAG,eACpB7D,KAAK8D,eAAeC,KAAK/D,OAEvCC,EAAA,YAAUiD,KAAK,WAGjBjD,EAAA,OAAKmC,MAAOxB,EAAWoD,QAASX,GAAIrD,KAAKM,WACxCL,EAAA,cAEDA,EAAA,OAAKmC,MAAOxB,EAAWqD,SACtBhE,EAAA,QAAMiD,KAAK,eAKblD,KAAKe,KACLd,EAAA,6BAA0BD,KAAKyD,eAAc,mBAAoBzD,KAAK0D,oBAAmB,eACpE1D,KAAK8D,eAAeC,KAAK/D,QAC3C,K,CAKC,cAAA8D,CAAeI,GACtBA,EAAEC,kBACFnE,KAAKyB,YACLzB,KAAKoE,SAASC,KAAKH,E,CAOpB,UAAMI,GACLtE,KAAKmB,W,CAON,UAAMoD,GACLvE,KAAKyB,W,CAON,kBAAMM,GACLyC,EAAgBxE,KAAK2C,eAAgB,mBAAoB/B,EAAWC,MACpE2D,EAAgBxE,KAAK4C,gBAAiB,oBAAqBhC,EAAWC,K"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as o,c as a,h as r,a as e,g as i}from"./p-5bc604a3.js";import{g as d,b as t}from"./p-5de606f8.js";import{c}from"./p-24636c53.js";import{a as s}from"./p-7f2c9830.js";import{v as n}from"./p-7724b535.js";import{c as l}from"./p-003e6cca.js";import{d as g}from"./p-03990da5.js";const v={root:"gov-card",header:"gov-card__header",title:"gov-card__title",inner:"gov-card__inner",img:"gov-card__img",main:"gov-card__main",content:"gov-card__content",icon:"gov-card__icon",btns:"gov-card__btns",footer:"gov-card__footer",arrow:"gov-card__arrow"};const h='.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-card{position:relative;display:flex;width:100%;flex-direction:column;border:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500));border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-card-bg, var(--gov-color-neutral-white));overflow:hidden}.gov-card__header{gap:1.75rem;width:100%;padding:1.5rem;border-bottom:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500));border-radius:0;text-align:left;text-transform:none;transition:background-color 150ms ease-in-out}.gov-card__arrow{flex:0 0 auto;width:1rem;height:1rem;color:var(--gov-card-arrow-color, var(--gov-color-primary))}.gov-card__title{margin:0;padding:0;font-family:var(--gov-font-family, "Roboto", sans-serif);font-weight:400;box-sizing:border-box;font-weight:var(--gov-text-xl-font-weight);font-size:var(--gov-text-xl-font-size);line-height:var(--gov-text-xl-line-height);letter-spacing:var(--gov-text-xl-letter-spacing);color:var(--gov-card-title-color, var(--gov-color-secondary-800));font-weight:700}.gov-card__img{width:100%;margin:0;line-height:1}.gov-card__img img{width:100%;height:auto}.gov-card__inner{display:flex;flex:1 1 auto;flex-direction:column}.gov-card__inner[aria-hidden=""],.gov-card__inner[aria-hidden=true i],.gov-card__inner[aria-hidden="1"]{display:none}.gov-card__main{display:flex;gap:16px 24px;flex:1 1 auto;flex-direction:column;padding:1.5rem}.gov-card__icon{flex:0 0 auto;width:2.5rem;height:2.5rem;color:var(--gov-card-icon-color, var(--gov-color-primary))}.gov-card__btns{display:flex;gap:1rem;flex:0 0 auto;flex-wrap:wrap}.gov-card__content>*:last-child{margin-bottom:0}.gov-card__footer{padding:1rem 1.5rem;background:var(--gov-card-footer-bg, var(--gov-color-primary-100))}.gov-card__footer>*:last-child{margin-bottom:0}.gov-card__footer p{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing)}.gov-card[is-expanded=""],.gov-card[is-expanded=true i],.gov-card[is-expanded="1"]{height:100%}.gov-card[collapsible=""] .gov-card__header,.gov-card[collapsible=true i] .gov-card__header,.gov-card[collapsible="1"] .gov-card__header{display:inline-flex;vertical-align:middle;justify-content:center;align-items:center;border:0;background-color:transparent;text-align:center;text-decoration:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;justify-content:space-between;text-align:left}.gov-card[collapsible=""] .gov-card__header:focus,.gov-card[collapsible=true i] .gov-card__header:focus,.gov-card[collapsible="1"] .gov-card__header:focus{outline:none}.gov-card[collapsible=""] .gov-card__header:focus,.gov-card[collapsible=true i] .gov-card__header:focus,.gov-card[collapsible="1"] .gov-card__header:focus{outline:none}.gov-card[collapsible=""] .gov-card__header:focus-visible,.gov-card[collapsible=true i] .gov-card__header:focus-visible,.gov-card[collapsible="1"] .gov-card__header:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:-0.125rem}@media not all and (pointer: coarse){.gov-card[collapsible=""] .gov-card__header:hover,.gov-card[collapsible=true i] .gov-card__header:hover,.gov-card[collapsible="1"] .gov-card__header:hover{background:var(--gov-card-header-hover-bg, var(--gov-color-primary-100))}}.gov-card[collapsible=""][is-expanded=""] .gov-card__header,.gov-card[collapsible=""][is-expanded=true i] .gov-card__header,.gov-card[collapsible=""][is-expanded="1"] .gov-card__header,.gov-card[collapsible=true i][is-expanded=""] .gov-card__header,.gov-card[collapsible=true i][is-expanded=true i] .gov-card__header,.gov-card[collapsible=true i][is-expanded="1"] .gov-card__header,.gov-card[collapsible="1"][is-expanded=""] .gov-card__header,.gov-card[collapsible="1"][is-expanded=true i] .gov-card__header,.gov-card[collapsible="1"][is-expanded="1"] .gov-card__header{border-bottom:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-card[collapsible=""][is-expanded=""] .gov-card__arrow,.gov-card[collapsible=""][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible=""][is-expanded="1"] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded=""] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded="1"] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded=""] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded="1"] .gov-card__arrow{transform:scale(-1)}@media (min-width: 30em){.gov-card[promotion=""] .gov-card__main,.gov-card[promotion=true i] .gov-card__main,.gov-card[promotion="1"] .gov-card__main{flex-direction:row;padding:2rem}.gov-card[promotion=""] .gov-card__icon,.gov-card[promotion=true i] .gov-card__icon,.gov-card[promotion="1"] .gov-card__icon{width:3rem;height:3rem}.gov-card[promotion=""] .gov-card__btns,.gov-card[promotion=true i] .gov-card__btns,.gov-card[promotion="1"] .gov-card__btns{flex-direction:column}}';const p=class{constructor(r){o(this,r);this.govToggle=a(this,"gov-toggle",7);this.promotion=false;this.label=undefined;this.collapsible=false;this.expanded=false;this.headlineTag="h3";this.wcagTriggerLabel=undefined;this.wcagTriggerLabelledBy=undefined;this.isExpanded=undefined;this.h=d(this.host);this.headlineId=c("GovCardHeadline");this.contentId=c("GovCardContent")}validateHeadlineTag(o){const a=["h1","h2","h3","h4","h5","h6","span"];if(o){if(!a.includes(o)){s(`[${v.root}]: Tag ${o} is not allowed.`)}}}componentWillLoad(){this.isExpanded=this.label?this.expanded:true;this.validateHeadlineTag(this.headlineTag)}async componentDidRender(){if(l()){await g(500);await this.
|
|
2
|
-
|
|
1
|
+
import{r as o,c as a,h as r,a as e,g as i}from"./p-5bc604a3.js";import{g as d,b as t}from"./p-5de606f8.js";import{c}from"./p-24636c53.js";import{a as s}from"./p-7f2c9830.js";import{v as n}from"./p-7724b535.js";import{c as l}from"./p-003e6cca.js";import{d as g}from"./p-03990da5.js";const v={root:"gov-card",header:"gov-card__header",title:"gov-card__title",inner:"gov-card__inner",img:"gov-card__img",main:"gov-card__main",content:"gov-card__content",icon:"gov-card__icon",btns:"gov-card__btns",footer:"gov-card__footer",arrow:"gov-card__arrow"};const h='.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-card{position:relative;display:flex;width:100%;flex-direction:column;border:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500));border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-card-bg, var(--gov-color-neutral-white));overflow:hidden}.gov-card__header{gap:1.75rem;width:100%;padding:1.5rem;border-bottom:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500));border-radius:0;text-align:left;text-transform:none;transition:background-color 150ms ease-in-out}.gov-card__arrow{flex:0 0 auto;width:1rem;height:1rem;color:var(--gov-card-arrow-color, var(--gov-color-primary))}.gov-card__title{margin:0;padding:0;font-family:var(--gov-font-family, "Roboto", sans-serif);font-weight:400;box-sizing:border-box;font-weight:var(--gov-text-xl-font-weight);font-size:var(--gov-text-xl-font-size);line-height:var(--gov-text-xl-line-height);letter-spacing:var(--gov-text-xl-letter-spacing);color:var(--gov-card-title-color, var(--gov-color-secondary-800));font-weight:700}.gov-card__img{width:100%;margin:0;line-height:1}.gov-card__img img{width:100%;height:auto}.gov-card__inner{display:flex;flex:1 1 auto;flex-direction:column}.gov-card__inner[aria-hidden=""],.gov-card__inner[aria-hidden=true i],.gov-card__inner[aria-hidden="1"]{display:none}.gov-card__main{display:flex;gap:16px 24px;flex:1 1 auto;flex-direction:column;padding:1.5rem}.gov-card__icon{flex:0 0 auto;width:2.5rem;height:2.5rem;color:var(--gov-card-icon-color, var(--gov-color-primary))}.gov-card__btns{display:flex;gap:1rem;flex:0 0 auto;flex-wrap:wrap}.gov-card__content>*:last-child{margin-bottom:0}.gov-card__footer{padding:1rem 1.5rem;background:var(--gov-card-footer-bg, var(--gov-color-primary-100))}.gov-card__footer>*:last-child{margin-bottom:0}.gov-card__footer p{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing)}.gov-card[is-expanded=""],.gov-card[is-expanded=true i],.gov-card[is-expanded="1"]{height:100%}.gov-card[collapsible=""] .gov-card__header,.gov-card[collapsible=true i] .gov-card__header,.gov-card[collapsible="1"] .gov-card__header{display:inline-flex;vertical-align:middle;justify-content:center;align-items:center;border:0;background-color:transparent;text-align:center;text-decoration:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;justify-content:space-between;text-align:left}.gov-card[collapsible=""] .gov-card__header:focus,.gov-card[collapsible=true i] .gov-card__header:focus,.gov-card[collapsible="1"] .gov-card__header:focus{outline:none}.gov-card[collapsible=""] .gov-card__header:focus,.gov-card[collapsible=true i] .gov-card__header:focus,.gov-card[collapsible="1"] .gov-card__header:focus{outline:none}.gov-card[collapsible=""] .gov-card__header:focus-visible,.gov-card[collapsible=true i] .gov-card__header:focus-visible,.gov-card[collapsible="1"] .gov-card__header:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:-0.125rem}@media not all and (pointer: coarse){.gov-card[collapsible=""] .gov-card__header:hover,.gov-card[collapsible=true i] .gov-card__header:hover,.gov-card[collapsible="1"] .gov-card__header:hover{background:var(--gov-card-header-hover-bg, var(--gov-color-primary-100))}}.gov-card[collapsible=""][is-expanded=""] .gov-card__header,.gov-card[collapsible=""][is-expanded=true i] .gov-card__header,.gov-card[collapsible=""][is-expanded="1"] .gov-card__header,.gov-card[collapsible=true i][is-expanded=""] .gov-card__header,.gov-card[collapsible=true i][is-expanded=true i] .gov-card__header,.gov-card[collapsible=true i][is-expanded="1"] .gov-card__header,.gov-card[collapsible="1"][is-expanded=""] .gov-card__header,.gov-card[collapsible="1"][is-expanded=true i] .gov-card__header,.gov-card[collapsible="1"][is-expanded="1"] .gov-card__header{border-bottom:var(--gov-card-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-card[collapsible=""][is-expanded=""] .gov-card__arrow,.gov-card[collapsible=""][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible=""][is-expanded="1"] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded=""] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible=true i][is-expanded="1"] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded=""] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded=true i] .gov-card__arrow,.gov-card[collapsible="1"][is-expanded="1"] .gov-card__arrow{transform:scale(-1)}@media (min-width: 30em){.gov-card[promotion=""] .gov-card__main,.gov-card[promotion=true i] .gov-card__main,.gov-card[promotion="1"] .gov-card__main{flex-direction:row;padding:2rem}.gov-card[promotion=""] .gov-card__icon,.gov-card[promotion=true i] .gov-card__icon,.gov-card[promotion="1"] .gov-card__icon{width:3rem;height:3rem}.gov-card[promotion=""] .gov-card__btns,.gov-card[promotion=true i] .gov-card__btns,.gov-card[promotion="1"] .gov-card__btns{flex-direction:column}}';const p=class{constructor(r){o(this,r);this.govToggle=a(this,"gov-toggle",7);this.promotion=false;this.label=undefined;this.collapsible=false;this.expanded=false;this.headlineTag="h3";this.wcagTriggerLabel=undefined;this.wcagTriggerLabelledBy=undefined;this.isExpanded=undefined;this.h=d(this.host);this.headlineId=c("GovCardHeadline");this.contentId=c("GovCardContent")}validateHeadlineTag(o){const a=["h1","h2","h3","h4","h5","h6","span"];if(o){if(!a.includes(o)){s(`[${v.root}]: Tag ${o} is not allowed.`)}}}componentWillLoad(){this.isExpanded=this.label?this.expanded:true;this.validateHeadlineTag(this.headlineTag)}async componentDidRender(){if(l()){await g(500);await this.validateAccessibility()}}emmitChange(){this.govToggle.emit({open:this.isExpanded,element:this.host})}render(){const o=this.headlineTag;return r(e,{class:this.h.classes(v.root),"is-expanded":this.isExpanded,collapsible:t(this.collapsible),promotion:this.promotion},this.label&&this.collapsible?r("button",{id:this.headlineId,class:v.header,"aria-label":this.wcagTriggerLabel,"aria-labelledby":this.wcagTriggerLabelledBy,"aria-expanded":t(this.isExpanded),"aria-controls":this.contentId,onClick:this.onClickHandler.bind(this)},r(o,{class:v.title},this.label),r("gov-icon",{class:v.arrow,name:"chevron-down"})):null,this.label&&!this.collapsible?r("div",{class:v.header},r(o,{class:v.title},this.label)):null,r("div",{class:v.inner,id:this.contentId,"aria-hidden":this.collapsible?t(!this.isExpanded):undefined,hidden:this.collapsible?!this.isExpanded:undefined,"aria-labelledby":this.collapsible?this.headlineId:undefined},this.h.hasSlot("img")&&r("p",{class:v.img},r("slot",{name:"img"})),r("div",{class:v.main},this.h.hasSlot("icon")&&this.promotion&&r("div",{class:v.icon},r("slot",{name:"icon"})),r("div",{class:v.content},r("slot",null)),this.h.hasSlot("btn")&&this.promotion&&r("div",{class:v.btns},r("slot",{name:"btn"}))),this.h.hasSlot("footer")&&r("div",{class:v.footer},r("slot",{name:"footer"}))))}onClickHandler(o){o.stopPropagation();if(this.collapsible){this.isExpanded=!this.isExpanded;this.emmitChange()}}async open(){if(this.collapsible){this.isExpanded=true;this.emmitChange()}}async close(){if(this.collapsible){this.isExpanded=false;this.emmitChange()}}async validateAccessibility(){if(this.collapsible){n(this.wcagTriggerLabel,this.wcagTriggerLabelledBy,v.root)}}get host(){return i(this)}static get watchers(){return{headlineTag:["validateHeadlineTag"]}}};p.style=h;export{p as gov_card};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-43fc5c70.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardClass","root","header","title","inner","img","main","content","icon","btns","footer","arrow","govCardCss","GovCard","constructor","hostRef","this","h","govHost","host","headlineId","createID","contentId","validateHeadlineTag","newValue","validTags","includes","govErrorLog","componentWillLoad","isExpanded","label","expanded","headlineTag","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","emmitChange","govToggle","emit","open","element","render","HeadlineTag","Host","class","classes","collapsible","booleanString","promotion","id","wcagTriggerLabel","wcagTriggerLabelledBy","onClick","onClickHandler","bind","name","undefined","hidden","hasSlot","e","stopPropagation","close","validateAccessibleLabel"],"sources":["../../../packages/core/src/components/gov-card/constants.ts","../../../packages/core/src/components/gov-card/gov-card.scss?tag=gov-card","../../../packages/core/src/components/gov-card/gov-card.tsx"],"sourcesContent":["export const CardClass = {\n\troot: 'gov-card',\n\theader: 'gov-card__header',\n\ttitle: 'gov-card__title',\n\tinner: 'gov-card__inner',\n\timg: 'gov-card__img',\n\tmain: 'gov-card__main',\n\tcontent: 'gov-card__content',\n\ticon: 'gov-card__icon',\n\tbtns: 'gov-card__btns',\n\tfooter: 'gov-card__footer',\n\tarrow: 'gov-card__arrow',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-card\";\n\n#{$class} {\n\t@include base(flex);\n\tflex-direction: column;\n\tborder: $card-border;\n\tborder-radius: $border-radius;\n\tbackground: $card-bg;\n\toverflow: hidden;\n\t&__header {\n\t\tgap: rem-calc(28);\n\t\twidth: 100%;\n\t\tpadding: rem-calc(24);\n\t\tborder-bottom: $card-border;\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttext-transform: none;\n\t\ttransition: background-color $t ease-in-out;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(16);\n\t\theight: rem-calc(16);\n\t\tcolor: $card-arrow-color;\n\t}\n\t&__title {\n\t\t@include general;\n\t\t@include typography($font-size-xl);\n\t\tcolor: $card-title-color;\n\t\tfont-weight: 700;\n\t}\n\t&__img {\n\t\twidth: 100%;\n\t\tmargin: 0;\n\t\tline-height: 1;\n\t\timg {\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\t@include parameter(\"aria-hidden\") {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\t&__main {\n\t\tdisplay: flex;\n\t\tgap: 16px 24px;\n\t\tflex: 1 1 auto;\n\t\tflex-direction: column;\n\t\tpadding: rem-calc(24);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(40);\n\t\theight: rem-calc(40);\n\t\tcolor: $card-icon-color;\n\t}\n\t&__btns {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tflex: 0 0 auto;\n\t\tflex-wrap: wrap;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t}\n\t&__footer {\n\t\t@include reset-last-margin();\n\t\tpadding: rem-calc(16 24);\n\t\tbackground: $card-footer-bg;\n\t\tp {\n\t\t\t@include typography($font-size-s);\n\t\t}\n\t}\n\n\t// STATES\n\t@include parameter(\"is-expanded\") {\n\t\theight: 100%;\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"collapsible\") {\n\t\t#{$class} {\n\t\t\t&__header {\n\t\t\t\t@include button-core();\n\t\t\t\t@include focus-outline($border-radius, rem-calc(-2));\n\t\t\t\tjustify-content: space-between;\n\t\t\t\ttext-align: left;\n\t\t\t\t@include hover() {\n\t\t\t\t\tbackground: $card-header-hover-bg;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"is-expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__header {\n\t\t\t\t\tborder-bottom: $card-border;\n\t\t\t\t}\n\t\t\t\t&__arrow {\n\t\t\t\t\ttransform: scale(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\t#{$class} {\n\t\t\t\t&__main {\n\t\t\t\t\tflex-direction: row;\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t\t&__icon {\n\t\t\t\t\twidth: rem-calc(48);\n\t\t\t\t\theight: rem-calc(48);\n\t\t\t\t}\n\t\t\t\t&__btns {\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch, State, Method, Event, EventEmitter } from '@stencil/core'\nimport { CardClass } from './constants'\nimport { govHost, booleanString } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { createID } from '../../utils/string.utils'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateAccessibleLabel } from '../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay } from '../../utils/utils'\nimport { GovCardChangeEvent } from './interfaces'\n\n@Component({\n\ttag: 'gov-card',\n\tstyleUrl: 'gov-card.scss',\n})\nexport class GovCard {\n\tprivate h: GovHost\n\tprivate readonly headlineId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.headlineId = createID('GovCardHeadline')\n\t\tthis.contentId = createID('GovCardContent')\n\t}\n\n\t@Element() host: HTMLGovCardElement\n\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Item label of the card\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Defines wether the card can be collapsible\n\t */\n\t@Prop() readonly collapsible: boolean = false\n\t/**\n\t * Defines whether the card is open or closed by button\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Used to change the HMTL tag in the card headline for correct semantic structure\n\t */\n\t@Prop({ attribute: 'headline-tag' }) readonly headlineTag: string = 'h3'\n\t/**\n\t * Adds accessible label for the collapsible button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-trigger-label' }) wcagTriggerLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for collapsible card\n\t */\n\t@Prop({ attribute: 'wcag-trigger-labelled-by' }) wcagTriggerLabelledBy: string\n\t/**\n\t * Called when the card toggle state changes\n\t */\n\t@Event({ eventName: 'gov-toggle' }) govToggle: EventEmitter<GovCardChangeEvent>\n\t@State() isExpanded: boolean\n\n\t@Watch('headlineTag')\n\tvalidateHeadlineTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${CardClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpanded = this.label ? this.expanded : true\n\t\tthis.validateHeadlineTag(this.headlineTag)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateAccessibility()\n\t\t}\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govToggle.emit({ open: this.isExpanded, element: this.host })\n\t}\n\n\trender() {\n\t\tconst HeadlineTag = this.headlineTag\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(CardClass.root)} is-expanded={this.isExpanded} collapsible={booleanString(this.collapsible)} promotion={this.promotion}>\n\t\t\t\t{this.label && this.collapsible ? (\n\t\t\t\t\t<button\n\t\t\t\t\t\tid={this.headlineId}\n\t\t\t\t\t\tclass={CardClass.header}\n\t\t\t\t\t\taria-label={this.wcagTriggerLabel}\n\t\t\t\t\t\taria-labelledby={this.wcagTriggerLabelledBy}\n\t\t\t\t\t\taria-expanded={booleanString(this.isExpanded)}\n\t\t\t\t\t\taria-controls={this.contentId}\n\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\n\t\t\t\t\t\t<gov-icon class={CardClass.arrow} name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t</button>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.label && !this.collapsible ? (\n\t\t\t\t\t<div class={CardClass.header}>\n\t\t\t\t\t\t<HeadlineTag class={CardClass.title}>{this.label}</HeadlineTag>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t<div\n\t\t\t\t\tclass={CardClass.inner}\n\t\t\t\t\tid={this.contentId}\n\t\t\t\t\taria-hidden={this.collapsible ? booleanString(!this.isExpanded) : undefined}\n\t\t\t\t\thidden={this.collapsible ? !this.isExpanded : undefined}\n\t\t\t\t\taria-labelledby={this.collapsible ? this.headlineId : undefined}\n\t\t\t\t>\n\t\t\t\t\t{this.h.hasSlot('img') && (\n\t\t\t\t\t\t<p class={CardClass.img}>\n\t\t\t\t\t\t\t<slot name=\"img\" />\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<div class={CardClass.main}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<div class={CardClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{this.h.hasSlot('btn') && this.promotion && (\n\t\t\t\t\t\t\t<div class={CardClass.btns}>\n\t\t\t\t\t\t\t\t<slot name=\"btn\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{this.h.hasSlot('footer') && (\n\t\t\t\t\t\t<div class={CardClass.footer}>\n\t\t\t\t\t\t\t<slot name=\"footer\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e) {\n\t\te.stopPropagation()\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = !this.isExpanded\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Open the card if it is collapsible\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = true\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Close the card if it is collapsible\n\t */\n\t@Method()\n\tasync close(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tthis.isExpanded = false\n\t\t\tthis.emmitChange()\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateAccessibility(): Promise<void> {\n\t\tif (this.collapsible) {\n\t\t\tvalidateWcagLabel(this.wcagTriggerLabel, this.wcagTriggerLabelledBy, CardClass.root)\n\t\t}\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as e,c as o,h as i,a as l,g as a}from"./p-5bc604a3.js";import{c as r}from"./p-24636c53.js";import{g as t,a as s,t as f}from"./p-5de606f8.js";import{a as n,b as d}from"./p-7724b535.js";import{c as m}from"./p-003e6cca.js";import{d as v}from"./p-03990da5.js";import{g}from"./p-61a2b12a.js";import"./p-7f2c9830.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-6278531b.js";import"./p-9dab01be.js";import"./p-3464136c.js";const h={root:"gov-form-file",area:"gov-form-file__area",label:"gov-form-file__label",input:"gov-form-file__input",list:"gov-form-file__list",item:"gov-form-file__item",attachments:"gov-form-file__attachments"};function _(e){const o=["bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let i=0,l=parseInt(e,10)||0;while(l>=1024&&++i){l=l/1024}return l.toFixed(l<10&&i>0?1:0)+" "+o[i]}function b(e,o){if(typeof o==="string"&&o.length){return o.replace(/\s/g,"").split(",").filter((o=>new RegExp(o.replace("*",".*")).test(e.type))).length>0}else{return true}}function p(e,o){const i=Math.round(e.size);return i<=o}const c='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-file{position:relative;display:block;width:100%}.gov-form-file__label .gov-form-label__label>*:last-child{margin-bottom:0}.gov-form-file__input{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:0.0001;cursor:pointer}.gov-form-file__attachments{margin-top:1rem 0rem 0rem}.gov-form-file__item{display:flex;gap:1rem;align-items:center}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label{pointer-events:none}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label *{color:var(--gov-form-file-disabled-color, var(--gov-color-secondary-600))}.gov-form-file[expanded=""] .gov-form-file__area,.gov-form-file[expanded=true i] .gov-form-file__area,.gov-form-file[expanded="1"] .gov-form-file__area{position:relative;width:100%;padding:2rem 1.375rem 1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center;transition:background-color 150ms ease-in-out;will-change:background-color}.gov-form-file[expanded=""] .gov-form-file__area.highlight,.gov-form-file[expanded=true i] .gov-form-file__area.highlight,.gov-form-file[expanded="1"] .gov-form-file__area.highlight{background-color:var(--gov-color-primary-200)}.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{width:100%;padding:1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center}.gov-form-file[expanded=""] .gov-form-file__attachments,.gov-form-file[expanded=true i] .gov-form-file__attachments,.gov-form-file[expanded="1"] .gov-form-file__attachments{margin:1.5rem 0rem 0rem}.gov-form-file[expanded=""][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid="1"] .gov-form-file__label .gov-form-label__label{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-file[expanded=""][invalid=""] .gov-form-file__area,.gov-form-file[expanded=""][invalid=true i] .gov-form-file__area,.gov-form-file[expanded=""][invalid="1"] .gov-form-file__area,.gov-form-file[expanded=true i][invalid=""] .gov-form-file__area,.gov-form-file[expanded=true i][invalid=true i] .gov-form-file__area,.gov-form-file[expanded=true i][invalid="1"] .gov-form-file__area,.gov-form-file[expanded="1"][invalid=""] .gov-form-file__area,.gov-form-file[expanded="1"][invalid=true i] .gov-form-file__area,.gov-form-file[expanded="1"][invalid="1"] .gov-form-file__area{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-file[expanded=""][disabled=""] .gov-form-file__area,.gov-form-file[expanded=""][disabled=true i] .gov-form-file__area,.gov-form-file[expanded=""][disabled="1"] .gov-form-file__area,.gov-form-file[expanded=true i][disabled=""] .gov-form-file__area,.gov-form-file[expanded=true i][disabled=true i] .gov-form-file__area,.gov-form-file[expanded=true i][disabled="1"] .gov-form-file__area,.gov-form-file[expanded="1"][disabled=""] .gov-form-file__area,.gov-form-file[expanded="1"][disabled=true i] .gov-form-file__area,.gov-form-file[expanded="1"][disabled="1"] .gov-form-file__area{pointer-events:none;color:var(--gov-form-file-disabled-color, var(--gov-color-secondary-600))}@media (min-width: 30em){.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{padding:2rem}}';const u=class{constructor(i){e(this,i);this.govFocus=o(this,"gov-focus",7);this.govBlur=o(this,"gov-blur",7);this.govFiles=o(this,"gov-files",7);this.govAddFile=o(this,"gov-add-file",7);this.govRemoveFile=o(this,"gov-remove-file",7);this.expanded=false;this.required=false;this.disabled=false;this.resetAfterPick=true;this.ignoreFileDuplicationCheck=false;this.displayAttachments=true;this.name=undefined;this.accept=undefined;this.multiple=false;this.maxFileSize=-1;this.identifier=undefined;this.invalid=undefined;this.errorSize="Soubor je větší než povolená velikost {FILE_SIZE}";this.errorAccept="Soubor tohoto typu není povolen";this.attachmentsLabel="Přílohy";this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagRemoveLabel="Odebrat soubor {FILE_NAME}";this.wcagAttachmentsLabel="Přílohy";this.files=[];this.fileId=r("GovInputFile");this.h=t(this.host);this.f=g(this.h)}watchDisabled(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",s(this.invalid));this.f.passAttrToControl("type","File")}registerListeners(){function e(){this.areaRef.classList.add("highlight")}function o(){this.areaRef.classList.remove("highlight")}this.inputRef.addEventListener("change",(e=>{e.preventDefault();e.stopPropagation();const o=e.target.files;if(this.resetAfterPick){if(o.length){this.validateFiles(o)}}else{this.validateFiles(o)}}),false);if(this.expanded){const i=["dragover","dragleave"];const l=["dragenter","dragover","mouseenter"];const a=["dragleave","drop","mouseleave"];i.map((e=>this.inputRef.addEventListener(e,this.preventDefaults.bind(this),false)));l.map((o=>this.inputRef.addEventListener(o,e.bind(this),false)));a.forEach((e=>this.inputRef.addEventListener(e,o.bind(this),false)));this.areaRef.addEventListener("drop",this.handleDrop.bind(this),false)}}preventDefaults(e){e.preventDefault();e.stopPropagation()}handleDrop(e){const o=e.dataTransfer;this.validateFiles(o.files)}validateFiles(e){let o=[];Array.from(e).map((e=>{const i=this.files.find((o=>o.file.name===e.name&&o.file.size===e.size))||null;if(i===null||this.ignoreFileDuplicationCheck){const i=typeof this.maxFileSize==="number"&&this.maxFileSize>0?p(e,this.maxFileSize):true;const l=b(e,this.accept);const a={id:r("GovFormFile"),file:e,acceptValid:l,sizeValid:i};if(this.displayAttachments){this.files=[...this.files,a]}else{o=[...o,a]}this.govAddFile.emit({component:h.root,file:a})}}));this.govFiles.emit({component:h.root,files:o.length?o:this.files});if(this.resetAfterPick){this.reset().finally()}}componentWillLoad(){this.f.passAttrToLabel("required",String(this.required));this.watchDisabled()}async componentDidRender(){if(m()){await v(500);await this.validateWcag()}this.registerListeners()}render(){return i(l,{class:this.h.classes([h.root]),invalid:f(this.invalid),expanded:f(this.expanded)},i("div",{class:h.area,ref:e=>this.areaRef=e},i("slot",null),i("input",{class:h.input,ref:e=>this.inputRef=e,id:this.identifier||this.fileId,type:"file",name:this.name,accept:this.accept,multiple:this.multiple,onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,disabled:this.disabled,"aria-required":f(this.required),"aria-invalid":f(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-disabled":f(this.disabled)})),this.h.hasSlot("attachments")?i("div",{class:h.attachments},i("slot",{name:"attachments"})):null,this.files.length&&this.displayAttachments?i("div",{class:h.attachments},i("gov-attachments",{label:this.wcagAttachmentsLabel,"wcag-label":this.wcagAttachmentsLabel},this.files.map((e=>i("gov-attachments-item",{"wcag-remove-labelled-by":e.id,"on-gov-remove":()=>this.onRemoveFileHandler(e)},i("span",{class:"sr-only",id:e.id},this.wcagRemoveLabel.replace("{FILE_NAME}",e.file.name)),e.file.name,e.acceptValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),e.acceptValid===false?this.errorAccept:null):null,e.sizeValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),this.errorSize.replace("{FILE_SIZE}",_(this.maxFileSize))):null,i("span",{slot:"info"},"(",_(e.file.size),")")))))):null)}onRemoveFileHandler(e){const o=this.files.findIndex((o=>o.id===e.id));if(o!==-1){const e=this.files;const i=this.files[o];e.splice(o,1);this.files=[...e];this.govRemoveFile.emit({component:h.root,file:i});this.govFiles.emit({component:h.root,files:e})}}onFocusHandler(e){e.stopPropagation();this.govFocus.emit({component:h.root,originalEvent:e})}onBlurHandler(e){e.stopPropagation();this.govBlur.emit({component:h.root,originalEvent:e})}onChangeHandler(e){e.stopPropagation()}async getRef(){return this.inputRef}async getAreaRef(){return this.areaRef}async reset(){this.files=[];this.inputRef.value=""}async validateWcag(){n(this.wcagDescribedBy,"wcag-described-by",h.root);n(this.wcagLabelledBy,"wcag-labelled-by",h.root);d(this.identifier||this.fileId,this.wcagLabelledBy,h.root)}get host(){return a(this)}static get watchers(){return{disabled:["watchDisabled"],invalid:["watchDisabled"]}}};u.style=c;export{u as gov_form_file};
|
|
2
|
-
|
|
1
|
+
import{r as e,c as o,h as i,a as l,g as a}from"./p-5bc604a3.js";import{c as r}from"./p-24636c53.js";import{g as t,a as s,t as f}from"./p-5de606f8.js";import{a as n,b as d}from"./p-7724b535.js";import{c as m}from"./p-003e6cca.js";import{d as v}from"./p-03990da5.js";import{g}from"./p-61a2b12a.js";import"./p-7f2c9830.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-6278531b.js";import"./p-9dab01be.js";import"./p-3464136c.js";const h={root:"gov-form-file",area:"gov-form-file__area",label:"gov-form-file__label",input:"gov-form-file__input",list:"gov-form-file__list",item:"gov-form-file__item",attachments:"gov-form-file__attachments"};function _(e){const o=["bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let i=0,l=parseInt(e,10)||0;while(l>=1024&&++i){l=l/1024}return l.toFixed(l<10&&i>0?1:0)+" "+o[i]}function b(e,o){if(typeof o==="string"&&o.length){return o.replace(/\s/g,"").split(",").filter((o=>new RegExp(o.replace("*",".*")).test(e.type))).length>0}else{return true}}function p(e,o){const i=Math.round(e.size);return i<=o}const c='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-file{position:relative;display:block;width:100%}.gov-form-file__label .gov-form-label__label>*:last-child{margin-bottom:0}.gov-form-file__input{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:0.0001;cursor:pointer}.gov-form-file__attachments{margin-top:1rem 0rem 0rem}.gov-form-file__item{display:flex;gap:1rem;align-items:center}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label{pointer-events:none}.gov-form-file[disabled=""] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled=true i] .gov-form-file__label .gov-form-label__label *,.gov-form-file[disabled="1"] .gov-form-file__label .gov-form-label__label *{color:var(--gov-form-file-disabled-color, var(--gov-color-secondary-600))}.gov-form-file[expanded=""] .gov-form-file__area,.gov-form-file[expanded=true i] .gov-form-file__area,.gov-form-file[expanded="1"] .gov-form-file__area{position:relative;width:100%;padding:2rem 1.375rem 1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center;transition:background-color 150ms ease-in-out;will-change:background-color}.gov-form-file[expanded=""] .gov-form-file__area.highlight,.gov-form-file[expanded=true i] .gov-form-file__area.highlight,.gov-form-file[expanded="1"] .gov-form-file__area.highlight{background-color:var(--gov-color-primary-200)}.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{width:100%;padding:1.375rem;border:var(--gov-form-file-border, 0.0625rem dashed var(--gov-color-secondary-500));text-align:center}.gov-form-file[expanded=""] .gov-form-file__attachments,.gov-form-file[expanded=true i] .gov-form-file__attachments,.gov-form-file[expanded="1"] .gov-form-file__attachments{margin:1.5rem 0rem 0rem}.gov-form-file[expanded=""][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=""][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i][invalid="1"] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"][invalid="1"] .gov-form-file__label .gov-form-label__label{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-file[expanded=""][invalid=""] .gov-form-file__area,.gov-form-file[expanded=""][invalid=true i] .gov-form-file__area,.gov-form-file[expanded=""][invalid="1"] .gov-form-file__area,.gov-form-file[expanded=true i][invalid=""] .gov-form-file__area,.gov-form-file[expanded=true i][invalid=true i] .gov-form-file__area,.gov-form-file[expanded=true i][invalid="1"] .gov-form-file__area,.gov-form-file[expanded="1"][invalid=""] .gov-form-file__area,.gov-form-file[expanded="1"][invalid=true i] .gov-form-file__area,.gov-form-file[expanded="1"][invalid="1"] .gov-form-file__area{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-file[expanded=""][disabled=""] .gov-form-file__area,.gov-form-file[expanded=""][disabled=true i] .gov-form-file__area,.gov-form-file[expanded=""][disabled="1"] .gov-form-file__area,.gov-form-file[expanded=true i][disabled=""] .gov-form-file__area,.gov-form-file[expanded=true i][disabled=true i] .gov-form-file__area,.gov-form-file[expanded=true i][disabled="1"] .gov-form-file__area,.gov-form-file[expanded="1"][disabled=""] .gov-form-file__area,.gov-form-file[expanded="1"][disabled=true i] .gov-form-file__area,.gov-form-file[expanded="1"][disabled="1"] .gov-form-file__area{pointer-events:none;color:var(--gov-form-file-disabled-color, var(--gov-color-secondary-600))}@media (min-width: 30em){.gov-form-file[expanded=""] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded=true i] .gov-form-file__label .gov-form-label__label,.gov-form-file[expanded="1"] .gov-form-file__label .gov-form-label__label{padding:2rem}}';const u=class{constructor(i){e(this,i);this.govFocus=o(this,"gov-focus",7);this.govBlur=o(this,"gov-blur",7);this.govFiles=o(this,"gov-files",7);this.govAddFile=o(this,"gov-add-file",7);this.govRemoveFile=o(this,"gov-remove-file",7);this.expanded=false;this.required=false;this.disabled=false;this.resetAfterPick=true;this.ignoreFileDuplicationCheck=false;this.displayAttachments=true;this.name=undefined;this.accept=undefined;this.multiple=false;this.maxFileSize=-1;this.identifier=undefined;this.invalid=undefined;this.errorSize="Soubor je větší než povolená velikost {FILE_SIZE}";this.errorAccept="Soubor tohoto typu není povolen";this.attachmentsLabel="Přílohy";this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagRemoveLabel="Odebrat soubor {FILE_NAME}";this.wcagAttachmentsLabel="Přílohy";this.files=[];this.fileId=r("GovInputFile");this.h=t(this.host);this.f=g(this.h)}watchDisabled(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",s(this.invalid));this.f.passAttrToControl("type","File")}registerListeners(){function e(){this.areaRef.classList.add("highlight")}function o(){this.areaRef.classList.remove("highlight")}this.inputRef.addEventListener("change",(e=>{e.preventDefault();e.stopPropagation();const o=e.target.files;if(this.resetAfterPick){if(o.length){this.validateFiles(o)}}else{this.validateFiles(o)}}),false);if(this.expanded){const i=["dragover","dragleave"];const l=["dragenter","dragover","mouseenter"];const a=["dragleave","drop","mouseleave"];i.map((e=>this.inputRef.addEventListener(e,this.preventDefaults.bind(this),false)));l.map((o=>this.inputRef.addEventListener(o,e.bind(this),false)));a.forEach((e=>this.inputRef.addEventListener(e,o.bind(this),false)));this.areaRef.addEventListener("drop",this.handleDrop.bind(this),false)}}preventDefaults(e){e.preventDefault();e.stopPropagation()}handleDrop(e){const o=e.dataTransfer;this.validateFiles(o.files)}validateFiles(e){let o=[];Array.from(e).map((e=>{const i=this.files.find((o=>o.file.name===e.name&&o.file.size===e.size))||null;if(i===null||this.ignoreFileDuplicationCheck){const i=typeof this.maxFileSize==="number"&&this.maxFileSize>0?p(e,this.maxFileSize):true;const l=b(e,this.accept);const a={id:r("GovFormFile"),file:e,acceptValid:l,sizeValid:i};if(this.displayAttachments){this.files=[...this.files,a]}else{o=[...o,a]}this.govAddFile.emit({component:h.root,file:a})}}));this.govFiles.emit({component:h.root,files:o.length?o:this.files});if(this.resetAfterPick){this.reset().finally()}}componentWillLoad(){this.f.passAttrToLabel("required",String(this.required));this.watchDisabled()}async componentDidRender(){if(m()){await v(500);await this.validateAccessibility()}this.registerListeners()}render(){return i(l,{class:this.h.classes([h.root]),invalid:f(this.invalid),expanded:f(this.expanded)},i("div",{class:h.area,ref:e=>this.areaRef=e},i("slot",null),i("input",{class:h.input,ref:e=>this.inputRef=e,id:this.identifier||this.fileId,type:"file",name:this.name,accept:this.accept,multiple:this.multiple,onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,disabled:this.disabled,"aria-required":f(this.required),"aria-invalid":f(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-disabled":f(this.disabled)})),this.h.hasSlot("attachments")?i("div",{class:h.attachments},i("slot",{name:"attachments"})):null,this.files.length&&this.displayAttachments?i("div",{class:h.attachments},i("gov-attachments",{label:this.wcagAttachmentsLabel,"wcag-label":this.wcagAttachmentsLabel},this.files.map((e=>i("gov-attachments-item",{"wcag-remove-labelled-by":e.id,"on-gov-remove":()=>this.onRemoveFileHandler(e)},i("span",{class:"sr-only",id:e.id},this.wcagRemoveLabel.replace("{FILE_NAME}",e.file.name)),e.file.name,e.acceptValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),e.acceptValid===false?this.errorAccept:null):null,e.sizeValid===false?i("gov-form-message",{slot:"message",variant:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill"}),this.errorSize.replace("{FILE_SIZE}",_(this.maxFileSize))):null,i("span",{slot:"info"},"(",_(e.file.size),")")))))):null)}onRemoveFileHandler(e){const o=this.files.findIndex((o=>o.id===e.id));if(o!==-1){const e=this.files;const i=this.files[o];e.splice(o,1);this.files=[...e];this.govRemoveFile.emit({component:h.root,file:i});this.govFiles.emit({component:h.root,files:e})}}onFocusHandler(e){e.stopPropagation();this.govFocus.emit({component:h.root,originalEvent:e})}onBlurHandler(e){e.stopPropagation();this.govBlur.emit({component:h.root,originalEvent:e})}onChangeHandler(e){e.stopPropagation()}async getRef(){return this.inputRef}async getAreaRef(){return this.areaRef}async reset(){this.files=[];this.inputRef.value=""}async validateAccessibility(){n(this.wcagDescribedBy,"wcag-described-by",h.root);n(this.wcagLabelledBy,"wcag-labelled-by",h.root);d(this.identifier||this.fileId,this.wcagLabelledBy,h.root)}get host(){return a(this)}static get watchers(){return{disabled:["watchDisabled"],invalid:["watchDisabled"]}}};u.style=c;export{u as gov_form_file};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-46467293.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFile","constructor","hostRef","this","fileId","createID","h","govHost","host","f","govForm","watchDisabled","passControlAttrs","passAttrToControl","toBoolAttr","invalid","registerListeners","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","resetAfterPick","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","filesBuffer","Array","from","isFile","find","name","ignoreFileDuplicationCheck","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","displayAttachments","govAddFile","emit","component","govFiles","reset","finally","componentWillLoad","passAttrToLabel","String","required","componentDidRender","canValidateWcagOnRender","delay","validateAccessibility","render","Host","class","classes","toBoolAttrIfDefined","ref","el","identifier","multiple","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","wcagDescribedBy","wcagLabelledBy","hasSlot","wcagAttachmentsLabel","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemoveFile","govFocus","originalEvent","govBlur","getRef","getAreaRef","value","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept === 'string' && accept.length) {\n\t\treturn (\n\t\t\taccept\n\t\t\t\t.replace(/\\s/g, '')\n\t\t\t\t.split(',')\n\t\t\t\t.filter(accept => {\n\t\t\t\t\treturn new RegExp(accept.replace('*', '.*')).test(file.type)\n\t\t\t\t}).length > 0\n\t\t)\n\t} else {\n\t\treturn true\n\t}\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t\t&__area {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@include parameter(\"disabled\") {\n\t\t\t#{$class} {\n\t\t\t\t&__area {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormFileClass} from \"./constants\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {validateWcagLabelFor, validateWcagRef} from \"../../../helpers/Validate/wcag\"\nimport {canValidateWcagOnRender} from \"../../../helpers/Dom/win\"\nimport {fileAcceptValidation, fileSizeValidation, formatBytes} from \"../../../utils/file.utils\"\nimport {delay} from \"../../../utils/utils\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovFormFileEvent, GovFormFileItem} from \"./gov-form-file.types\"\n\n@Component({\n\ttag: \"gov-form-file\",\n\tstyleUrl: \"gov-form-file.scss\",\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * After selecting the files, the main input element will be reset.\n\t * The propagation of the event with the selected files will not be affected.\n\t */\n\t@Prop({attribute: \"reset-after-pick\"}) readonly resetAfterPick: boolean = true\n\t/**\n\t * Selected files will not be checked for duplicates based on name and size.\n\t */\n\t@Prop({attribute: \"ignore-file-duplication-check\"}) readonly ignoreFileDuplicationCheck: boolean = false\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({attribute: \"display-attachments\"}) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple\n\t */\n\t@Prop() readonly multiple: boolean = false\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({attribute: \"max-file-size\"}) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({attribute: \"error-size\"}) readonly errorSize: string = \"Soubor je větší než povolená velikost {FILE_SIZE}\"\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({attribute: \"error-accept\"}) readonly errorAccept: string = \"Soubor tohoto typu není povolen\"\n\t/**\n\t * Description of the list of attachments\n\t */\n\t@Prop({attribute: \"attachments-label\"}) readonly attachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: \"wcag-described-by\"}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: \"wcag-labelled-by\"}) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({attribute: \"wcag-remove-label\"}) readonly wcagRemoveLabel: string = \"Odebrat soubor {FILE_NAME}\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({attribute: \"wcag-attachments-label\"}) readonly wcagAttachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({eventName: \"gov-files\"}) govFiles: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({eventName: \"gov-add-file\"}) govAddFile: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({eventName: \"gov-remove-file\"}) govRemoveFile: EventEmitter<GovFormFileEvent>\n\n\t@State() files: GovFormFileItem[] = []\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"drop\", \"mouseleave\"]\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\n\t\t\tthis.areaRef.addEventListener(\"drop\", this.handleDrop.bind(this), false)\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tlet filesBuffer: GovFormFileItem[] = []\n\t\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null || this.ignoreFileDuplicationCheck) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === \"number\" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID(\"GovFormFile\"),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tif (this.displayAttachments) {\n\t\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\t} else {\n\t\t\t\t\tfilesBuffer = [...filesBuffer, newFile]\n\t\t\t\t}\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: filesBuffer.length ? filesBuffer : this.files,\n\t\t})\n\n\t\tif (this.resetAfterPick) {\n\t\t\tthis.reset().finally()\n\t\t}\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.watchDisabled()\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateAccessibility()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\texpanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot/>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\n\t\t\t\t\t\tmultiple={this.multiple}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot(\"attachments\") ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={\"attachments\"}/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t<span class={\"sr-only\"} id={item.id}>\n\t\t\t\t\t\t\t\t\t\t{this.wcagRemoveLabel.replace(\"{FILE_NAME}\", item.file.name)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Remove all files from component state\n\t */\n\t@Method()\n\tasync reset(): Promise<void> {\n\t\tthis.files = []\n\t\tthis.inputRef.value = '';\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateAccessibility(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as t,r as i,h as s,a as n,g as e}from"./p-5bc604a3.js";import{i as o,e as a}from"./p-003e6cca.js";import{g as r}from"./p-5de606f8.js";import"./p-03990da5.js";var c;(function(t){t["BASIC"]="basic";t["COMPLEX"]="complex";t["COLORED"]="colored"})(c||(c={}));const h={root:"gov-icon",holder:"gov-icon__holder"};const l="4.0.8-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{d as t,r as i,h as s,a as n,g as e}from"./p-5bc604a3.js";import{i as o,e as a}from"./p-003e6cca.js";import{g as r}from"./p-5de606f8.js";import"./p-03990da5.js";var c;(function(t){t["BASIC"]="basic";t["COMPLEX"]="complex";t["COLORED"]="colored"})(c||(c={}));const h={root:"gov-icon",holder:"gov-icon__holder"};const l="4.0.8-rc09";const p=()=>l;const d={};const f={};const u=t=>t.startsWith("http://")||t.startsWith("https://");const g=(i,s,n)=>{if(u(i)){return`${i}/${n}/${s}.svg?v=${p()}`}return t(`${i}/${n}/${s}.svg`)+`?v=${p()}`};async function m({name:t,type:i}){const s=i+"-"+t;if(d[s]){return d[s]}if(!f[s]){f[s]=fetch(g(o(),t,i)).then((t=>{if(t.status===200){return t.text()}else{throw new Error("Gov Icon doesn't exists")}}))}const n=await f[s];d[s]=n;return n}const y=".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-icon{display:inline-flex}.gov-icon__holder{display:inline-flex;width:100%;height:100%}.gov-icon__holder+.gov-icon__holder{display:none !important}.gov-icon svg{display:inline-flex;width:100%;height:100%;max-width:100%;max-height:100%}";const v=class{constructor(t){i(this,t);this.name=null;this.type="basic";this.iconData=undefined;this.visible=false;this.error=false;this.h=r(this.host)}async loadIconPathData(){const{name:t,visible:i,type:s}=this;if(!t||!i){return}try{this.iconData=await m({name:t,type:s})}catch(t){this.error=true}}connectedCallback(){if(a()){this.visible=true;this.loadIconPathData().finally()}else{this.waitUntilVisible((async()=>{this.visible=true;await this.loadIconPathData()}))}}disconnectedCallback(){if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=null}}async componentWillLoad(){await this.loadIconPathData()}waitUntilVisible(t){if(typeof window==="undefined"||!window.IntersectionObserver){t();return}this.intersectionObserver=new IntersectionObserver((i=>{i.forEach((i=>{if(i.isIntersecting){if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=null}t()}}))}),{rootMargin:"50px"});this.intersectionObserver.observe(this.host)}render(){if(this.error){return null}return s(n,{class:this.h.classes(h.root)},s("span",{class:h.holder,innerHTML:this.iconData}))}static get assetsDirs(){return["assets"]}get host(){return e(this)}static get watchers(){return{name:["loadIconPathData"]}}};v.style=y;export{v as gov_icon};
|
|
2
|
+
//# sourceMappingURL=p-4d7ff31f.entry.js.map
|