@gov-design-system-ce/components 4.0.8-rc23 → 4.0.8-rc24
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-file.cjs.entry.js +6 -1
- package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +1 -1
- package/dist/collection/components/gov-form/file/gov-form-file.js +6 -1
- package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
- package/dist/components/gov-accordion-item.js +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-file.js.map +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-select.js +1 -1
- package/dist/components/gov-grid.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-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-tabs.js +1 -1
- package/dist/components/gov-tag.js +1 -1
- package/dist/components/gov-tile.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/{p-b6dd95ba.js → p-1c288519.js} +2 -2
- package/dist/components/{p-2f537b87.js → p-3072ede5.js} +2 -2
- package/dist/components/{p-9d5a8ed9.js → p-414a45bb.js} +2 -2
- package/dist/components/p-880743a5.js.map +1 -1
- package/dist/components/{p-8cf6d23c.js → p-8ba0b435.js} +2 -2
- package/dist/components/{p-2594e525.js → p-b9450157.js} +2 -2
- package/dist/components/{p-11418445.js → p-d8e853ed.js} +2 -2
- package/dist/components/{p-74915621.js → p-f518bc1c.js} +2 -2
- package/dist/core/core.esm.js +1 -1
- package/dist/core/{p-fe8bd4cf.entry.js → p-1005135a.entry.js} +2 -2
- package/dist/core/p-1005135a.entry.js.map +1 -0
- package/dist/core/{p-a3cff495.entry.js → p-14a87c92.entry.js} +2 -2
- package/dist/core/p-5c3a0b02.entry.js.map +1 -1
- package/dist/core/p-880743a5.js.map +1 -1
- package/dist/esm/gov-form-file.entry.js +6 -1
- package/dist/esm/gov-form-file.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/hydrate/index.js +6 -1
- package/dist/hydrate/index.mjs +6 -1
- package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -0
- package/package.json +1 -1
- package/dist/core/p-fe8bd4cf.entry.js.map +0 -1
- /package/dist/components/{p-b6dd95ba.js.map → p-1c288519.js.map} +0 -0
- /package/dist/components/{p-2f537b87.js.map → p-3072ede5.js.map} +0 -0
- /package/dist/components/{p-9d5a8ed9.js.map → p-414a45bb.js.map} +0 -0
- /package/dist/components/{p-8cf6d23c.js.map → p-8ba0b435.js.map} +0 -0
- /package/dist/components/{p-2594e525.js.map → p-b9450157.js.map} +0 -0
- /package/dist/components/{p-11418445.js.map → p-d8e853ed.js.map} +0 -0
- /package/dist/components/{p-74915621.js.map → p-f518bc1c.js.map} +0 -0
- /package/dist/core/{p-a3cff495.entry.js.map → p-14a87c92.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as t,H as e,c as i,h as s,d as o}from"./p-5262b9ce.js";import{a}from"./p-d687df8f.js";import{v as n}from"./p-344c72d7.js";import{c as r}from"./p-cd6c2938.js";import{d as h,t as l,h as c}from"./p-e0e2e9c1.js";import{F as m,a as d,b as p}from"./p-77a6e3be.js";import{p as u}from"./p-3f704a40.js";import{d as g}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as t,H as e,c as i,h as s,d as o}from"./p-5262b9ce.js";import{a}from"./p-d687df8f.js";import{v as n}from"./p-344c72d7.js";import{c as r}from"./p-cd6c2938.js";import{d as h,t as l,h as c}from"./p-e0e2e9c1.js";import{F as m,a as d,b as p}from"./p-77a6e3be.js";import{p as u}from"./p-3f704a40.js";import{d as g}from"./p-3072ede5.js";import{d as f}from"./p-b9450157.js";const v='.gov-form-autocomplete__list{margin:0;padding:0}.gov-form-autocomplete__list>.gov-form-autocomplete__item{margin:0;padding:0;background:none}.gov-form-autocomplete__list>.gov-form-autocomplete__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-autocomplete{position:relative;display:block;width:100%}.gov-form-autocomplete__list{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);position:absolute;top:100%;right:0;left:0;z-index:5;max-height:14.0625rem;margin-top:0.5rem;border:var(--gov-autocomplete-item-hover, 0.0625rem solid var(--gov-color-secondary-500));border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-autocomplete-bg, var(--gov-color-neutral-white));overflow-x:hidden;overflow-y:auto;overscroll-behavior:none}.gov-form-autocomplete__list>.gov-form-autocomplete__item{padding:0.75rem 0.5rem;cursor:pointer}.gov-form-autocomplete__item--empty,.gov-form-autocomplete__item--loading{padding:0.75rem 0.5rem;color:var(--gov-autocomplete-item-disable-color, var(--gov-color-secondary-600))}.gov-form-autocomplete__item--empty .gov-icon,.gov-form-autocomplete__item--empty .gov-spin-animation,.gov-form-autocomplete__item--loading .gov-icon,.gov-form-autocomplete__item--loading .gov-spin-animation{width:12px;height:12px}.gov-form-autocomplete__list:empty{display:none}.gov-form-autocomplete__item[aria-selected=""],.gov-form-autocomplete__item[aria-selected=true i],.gov-form-autocomplete__item[aria-selected="1"]{background:var(--gov-autocomplete-item-select, var(--gov-color-secondary-400))}@media not all and (pointer: coarse){.gov-form-autocomplete__item:hover{background:var(--gov-autocomplete-item-hover, var(--gov-color-primary-100))}}';const y=v;const b=t(class t extends e{constructor(){super();this.__registerHost();this.govFocus=i(this,"gov-focus",7);this.govBlur=i(this,"gov-blur",7);this.govInput=i(this,"gov-input",7);this.govSelect=i(this,"gov-select",7);this.templateResolver=t=>t[this.nameKey];this.value="";this.options=undefined;this.identifier=undefined;this.variant=undefined;this.success=undefined;this.size="m";this.nameKey="name";this.name=undefined;this.required=false;this.disabled=false;this.placeholder=undefined;this.readonly=undefined;this.invalid=undefined;this.minlength=3;this.maxlength=undefined;this.throttleTime=200;this.messageEmpty="Nebyly nalezeny žádné výsledky";this.messageLoading="Načítám...";this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.processing=false;this.arrowCounter=-1;this.list=[];this.listBoxId=r("GovListBox")}validateVariant(t){n(d,t,m.root)}validateSize(t){n(p,t,m.root)}watchOptions(t){this.setOptions(u(t)).catch()}onArrowUp(){if(this.arrowCounter>0){this.arrowCounter=this.arrowCounter-1;this.moveToView().finally()}}onArrowDown(){if(this.arrowCounter<this.list.length-1){this.arrowCounter=this.arrowCounter+1;this.moveToView().finally()}}async moveToView(){await h(200);const t=this.listRef.offsetHeight;const e=this.listRef.querySelector('li[aria-selected="true"]');if(e&&t){const t=e.offsetTop;this.listRef.scrollTo({top:t,behavior:"smooth"})}}doSearch(){if(Number.isInteger(this.minlength)&&this.isValueAccepted===false&&this.minlength){this.list=[];this.arrowCounter=-1;this.processing=false;return}if(this.searchCallback){this.processing=true;this.searchCallback(this.value).then((t=>this.list=t)).catch((()=>this.list=[])).finally((()=>{this.arrowCounter=-1;this.processing=false}))}}clearList(){const t=u(this.options);if(t.length===0){this.list=[]}}get isValueAccepted(){if(typeof this.value==="string"){return this.value.length>=this.minlength}else{return false}}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size)}render(){return s(o,{key:"3ade1a0f94261a8530ce85af0a67f0ce5ed067d3",class:m.root,size:this.size,variant:this.variant},s("gov-form-input",{key:"ac6392ffdb77783b45b774dbb00edca83de7370e",placeholder:this.placeholder,name:this.name,disabled:this.disabled,readonly:this.readonly,autocomplete:false,size:this.size,variant:this.variant,required:this.required,invalid:this.invalid,success:this.success,role:"searchbox",value:this.value,minlength:this.minlength,maxlength:this.maxlength,"on-gov-input":l(this.onInputHandler.bind(this),this.throttleTime),"on-gov-keyup":this.onKeyUpHandler.bind(this),"on-gov-keydown":this.onKeyDownHandler.bind(this),"on-gov-focus":this.onFocusHandler.bind(this),"on-gov-blur":this.onBlurHandler.bind(this),wcagAutocomplete:"list",wcagDescribedBy:this.wcagDescribedBy,wcagLabelledBy:this.wcagLabelledBy,wcagOwns:[this.listBoxId,this.wcagOwns].join(" "),wcagExpanded:this.list.length&&this.focused,ref:t=>this.inputRef=t},s("slot",{key:"adb1c0a349ac9f12e0fb7d2790516a1e7a4cf437",slot:"right-icon",name:"right-icon"})),s("ul",{key:"9d11566e2fda522c662d8af6973cd5f4d155c1ad",class:m.list,role:"listbox","aria-hidden":a(!this.focused),hidden:!this.focused,id:this.listBoxId,ref:t=>this.listRef=t},this.focused&&this.list.length===0&&this.processing===false&&this.isValueAccepted&&this.messageEmpty?s("li",{class:m.empty},this.messageEmpty):null,this.focused&&this.processing===true&&this.isValueAccepted?s("li",{class:m.loading},s("gov-icon",{name:"loader",class:"gov-spin-animation"})," ",this.messageLoading):null,this.focused?this.list.map(((t,e)=>{const i=this.arrowCounter===e;return s("li",{class:m.item,innerHTML:this.templateResolver(t,i),role:"option","aria-posinset":e,tabindex:i?0:-1,"aria-setsize":this.list.length,onTouchStart:t=>this.onSelectHandler(t,e),onMouseDown:t=>this.onSelectHandler(t,e),"aria-selected":a(i)})})):null))}onFocusHandler(t){this.focused=true;this.arrowCounter=-1;if(this.isValueAccepted&&this.searchCallback){this.doSearch()}t.stopPropagation();this.govFocus.emit({originalEvent:t,component:m.root,value:this.value,selected:null})}onBlurHandler(t){this.focused=false;this.clearList();this.arrowCounter=-1;t.stopPropagation();this.govBlur.emit({originalEvent:t,component:m.root,value:this.value,selected:null})}onInputHandler(t){this.value=t.target.value;t.stopPropagation();this.govInput.emit({originalEvent:t,component:m.root,value:this.value,selected:null});this.doSearch()}onSelectHandler(t,e=-1){let i=null;if(e>-1){i=this.list[e]}else if(c(this.arrowCounter,this.list)){i=this.list[this.arrowCounter]}if(i){this.govSelect.emit({component:m.root,value:this.value,selected:i,originalEvent:t});this.clearList();if(c(this.nameKey,i)&&typeof i[this.nameKey]==="string"){this.value=i[this.nameKey]}}}onKeyUpHandler(t){const e=t.detail.originalEvent;t.stopPropagation();e.stopPropagation();if(e.keyCode===38)this.onArrowUp();else if(e.keyCode===40)this.onArrowDown();else if(e.keyCode===13){t.preventDefault();e.preventDefault();this.onSelectHandler(t)}}onKeyDownHandler(t){const e=t.detail.originalEvent;t.stopPropagation();e.stopPropagation();if(e.keyCode===13){t.preventDefault();e.preventDefault()}}async setFocus(t){return this.inputRef.focus(t)}async setBlur(){return this.inputRef.blur()}async setOptions(t){this.list=Array.isArray(t)?t:[];this.arrowCounter=-1}async clearValue(){this.value="";this.inputRef.value="";await this.inputRef.clearValue()}async setProcessing(t){this.processing=t}async setSearchCallback(t){this.searchCallback=t}async setTemplateResolver(t){this.templateResolver=t}get host(){return this}static get watchers(){return{variant:["validateVariant"],size:["validateSize"],options:["watchOptions"]}}static get style(){return y}},[4,"gov-form-autocomplete",{value:[1537],options:[1537],identifier:[1],variant:[1],success:[4],size:[1],nameKey:[1,"name-key"],name:[1],required:[4],disabled:[4],placeholder:[1],readonly:[4],invalid:[4],minlength:[2],maxlength:[2],throttleTime:[2,"throttle-time"],messageEmpty:[1,"message-empty"],messageLoading:[1,"message-loading"],wcagDescribedBy:[1,"wcag-described-by"],wcagLabelledBy:[1,"wcag-labelled-by"],wcagOwns:[1,"wcag-owns"],focused:[32],processing:[32],arrowCounter:[32],list:[32],setFocus:[64],setBlur:[64],setOptions:[64],clearValue:[64],setProcessing:[64],setSearchCallback:[64],setTemplateResolver:[64]},undefined,{variant:["validateVariant"],size:["validateSize"],options:["watchOptions"]}]);function _(){if(typeof customElements==="undefined"){return}const t=["gov-form-autocomplete","gov-form-input","gov-icon"];t.forEach((t=>{switch(t){case"gov-form-autocomplete":if(!customElements.get(t)){customElements.define(t,b)}break;case"gov-form-input":if(!customElements.get(t)){g()}break;case"gov-icon":if(!customElements.get(t)){f()}break}}))}_();export{b as G,_ as d};
|
|
2
|
+
//# sourceMappingURL=p-f518bc1c.js.map
|
package/dist/core/core.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as a,b as l}from"./p-240659bb.js";export{s as setNonce}from"./p-240659bb.js";import{g as i}from"./p-e1255160.js";var t=()=>{{c(a.prototype)}const l=import.meta.url;const i={};if(l!==""){i.resourcesUrl=new URL(".",l).href}return e(i)};var c=e=>{const a=e.cloneNode;e.cloneNode=function(e){if(this.nodeName==="TEMPLATE"){return a.call(this,e)}const l=a.call(this,false);const i=this.childNodes;if(e){for(let e=0;e<i.length;e++){if(i[e].nodeType!==2){l.appendChild(i[e].cloneNode(true))}}}return l}};t().then((async e=>{await i();return l(JSON.parse('[["p-fe8bd4cf",[[4,"gov-form-file",{"expanded":[4],"required":[4],"disabled":[4],"resetAfterPick":[4,"reset-after-pick"],"ignoreFileDuplicationCheck":[4,"ignore-file-duplication-check"],"displayAttachments":[4,"display-attachments"],"name":[1],"accept":[1],"multiple":[4],"maxFileSize":[2,"max-file-size"],"identifier":[1],"invalid":[4],"errorSize":[1,"error-size"],"errorAccept":[1,"error-accept"],"attachmentsLabel":[1,"attachments-label"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagRemoveLabel":[1,"wcag-remove-label"],"wcagAttachmentsLabel":[1,"wcag-attachments-label"],"files":[32],"getRef":[64],"getAreaRef":[64],"reset":[64],"validateWcag":[64]},null,{"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-3b8fb675",[[4,"gov-form-multi-select",{"value":[1537],"options":[1537],"identifier":[1],"placeholder":[1],"variant":[1],"size":[1],"name":[1],"hideSelectedList":[4,"hide-selected-list"],"required":[4],"disabled":[4],"invalid":[4],"success":[4],"messageEmpty":[1,"message-empty"],"messageLoading":[1,"message-loading"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"valueState":[32],"selectedOptionsState":[32],"optionsState":[32],"setFocus":[64],"setValue":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"options":["watchOptions"],"value":["watchValue"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"]}]]],["p-cc83b8cb",[[4,"gov-modal",{"open":[1028],"blockClose":[4,"block-close"],"blockBackdropClose":[4,"block-backdrop-close"],"blockButtonClose":[4,"block-button-close"],"label":[1],"role":[1],"labelTag":[1,"label-tag"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagCloseLabel":[1,"wcag-close-label"],"wcagCloseLabelledBy":[1,"wcag-close-labelled-by"],"show":[64],"hide":[64],"validateWcag":[64]},null,{"labelTag":["validateLabelTag"],"open":["watchOpen"]}]]],["p-87b7b469",[[0,"gov-pagination",{"type":[1],"current":[2],"total":[2],"inverse":[4],"selectIdentifier":[1,"select-identifier"],"size":[1],"variant":[1],"pageSize":[2,"page-size"],"maxPages":[2,"max-pages"],"link":[1],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagSelectLabel":[1,"wcag-select-label"],"wcagPageLabel":[1,"wcag-page-label"],"labelPrev":[1,"label-prev"],"labelStart":[1,"label-start"],"labelNext":[1,"label-next"],"labelEnd":[1,"label-end"],"pagination":[32],"validateWcag":[64]},null,{"type":["validateType"],"size":["validateSize"],"variant":["validateVariant"],"current":["recalculate"],"total":["recalculate"],"pageSize":["recalculate"],"maxPages":["recalculate"]}]]],["p-20ae3168",[[4,"gov-prompt",{"open":[1028],"label":[1],"role":[1],"labelTag":[1,"label-tag"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagCloseLabel":[1,"wcag-close-label"],"wcagCloseLabelledBy":[1,"wcag-close-labelled-by"],"show":[64],"hide":[64],"validateWcag":[64]},null,{"labelTag":["validateLabelTag"],"open":["watchOpen"]}]]],["p-1b3143a8",[[4,"gov-tabs",{"type":[1],"variant":[1],"orientation":[1],"wcagLabel":[1,"wcag-label"],"wcagSelectLabel":[1,"wcag-select-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"controllers":[32],"focusIndex":[32],"compactControls":[32],"refresh":[64],"currentTab":[64],"setActiveTab":[64],"rerender":[64],"validateWcag":[64]},null,{"type":["validateType"],"variant":["validateVariant"]}]]],["p-208c99c8",[[4,"gov-breadcrumbs",{"collapsible":[4],"isExpanded":[4,"is-expanded"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labeled-by"],"wcagToggleLabel":[1,"wcag-toggle-label"],"collapsed":[32],"toggleOption":[32],"validateWcag":[64]}]]],["p-cdaeb7d8",[[4,"gov-infobar",{"headline":[1],"variant":[1],"role":[1],"inverse":[4],"wcagCloseLabel":[1,"wcag-close-label"],"wcagToggleLabel":[1,"wcag-toggle-label"],"closable":[4],"toggleContent":[32],"validateWcag":[64]},null,{"variant":["validateVariant"]}]]],["p-828e8bce",[[4,"gov-loading"]]],["p-e9bcadf1",[[4,"gov-side-nav-item",{"inverse":[4],"compact":[4],"identifier":[1],"count":[4],"label":[1],"disabled":[4],"href":[1],"isExpanded":[4,"is-expanded"],"isExpandedState":[32],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"label":["validateLabel"]}]]],["p-34d7c203",[[4,"gov-toast",{"variant":[1],"gravity":[1],"position":[1],"type":[1],"time":[2],"closeLabel":[1,"close-label"],"wcagCloseLabel":[1,"wcag-close-label"],"destroy":[64]},null,{"variant":["validateVariant"]}]]],["p-6d894ec7",[[4,"gov-tooltip-content",{"variant":[1],"size":[1],"persist":[4],"isVisible":[1028,"is-visible"],"parentId":[1,"parent-id"]},null,{"isVisible":["visibleContent"]}]]],["p-4ed064db",[[4,"gov-accordion-item",{"variant":[1],"identifier":[1],"size":[1],"disabled":[4],"isExpanded":[1028,"is-expanded"],"isExpandedState":[32],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"size":["validateSize"],"variant":["validateVariant"]}]]],["p-bcdf6cfc",[[4,"gov-card",{"promotion":[4],"label":[1],"collapsible":[4],"expanded":[4],"headlineTag":[1,"headline-tag"],"wcagTriggerLabel":[1,"wcag-trigger-label"],"wcagTriggerLabelledBy":[1,"wcag-trigger-labelled-by"],"isExpanded":[32],"open":[64],"close":[64],"validateWcag":[64]},null,{"headlineTag":["validateHeadlineTag"]}]]],["p-4f77a766",[[4,"gov-form-checkbox",{"value":[1],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"noLabel":[4,"no-label"],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-810f0d0c",[[4,"gov-tag",{"inverse":[4],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"size":[513],"variant":[513]},null,{"variant":["validateVariant"],"size":["validateSize"]}]]],["p-1bdc04bb",[[4,"gov-tile",{"href":[513],"target":[1],"getTriggerRef":[64]}]]],["p-2186fcd5",[[4,"gov-wizard-item",{"variant":[1],"size":[1],"identifier":[1],"collapsible":[4],"annotation":[1],"label":[1],"disabled":[4],"isExpanded":[1028,"is-expanded"],"labelTag":[1,"label-tag"],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"label":["validateLabel"],"labelTag":["validateTriggerTag"],"variant":["validateVariant"]}]]],["p-6789b9d0",[[4,"gov-accordion",{"size":[1],"variant":[1],"noBorder":[4,"no-border"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]},null,{"size":["validateSize"],"variant":["validateVariant"]}]]],["p-b2b254b6",[[4,"gov-container",{"slottedChildren":[64]}]]],["p-ae4321ea",[[4,"gov-control-group",{"variant":[1],"noBorder":[4,"no-border"]},null,{"variant":["validateVariant"]}]]],["p-64353313",[[4,"gov-cookiebar"]]],["p-092b0437",[[4,"gov-dropdown",{"identifier":[1],"open":[1028],"position":[1],"getState":[64],"setOpen":[64]}]]],["p-3309aed9",[[4,"gov-empty"]]],["p-802909c5",[[4,"gov-error-code"]]],["p-4700508c",[[4,"gov-form-checkbox-group",{"gap":[1],"orientation":[1],"value":[1025]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-f9de3c09",[[4,"gov-form-control",{"identifier":[1],"invalid":[516],"disabled":[516],"success":[516],"fieldset":[4],"size":[1]}]]],["p-6a82c6a1",[[4,"gov-form-group",{"gap":[1],"orientation":[1]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-06e9e93b",[[4,"gov-form-label",{"identifier":[1],"size":[1],"required":[4],"legend":[4]}]]],["p-f2edcca7",[[4,"gov-form-password-power",{"power":[514]}]]],["p-3e041d63",[[4,"gov-form-radio",{"value":[1],"noLabel":[4,"no-label"],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-74233183",[[4,"gov-form-radio-group",{"gap":[1],"orientation":[1],"value":[1025]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-3ccab2ba",[[4,"gov-form-search",{"variant":[513]}]]],["p-2e881577",[[4,"gov-form-switch",{"value":[1],"noLabel":[4,"no-label"],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchDisabled"],"disabled":["watchDisabled"],"invalid":["watchDisabled"]}]]],["p-5c3a0b02",[[4,"gov-grid",{"alignX":[1,"align-x"],"alignY":[1,"align-y"]}]]],["p-107a6a5c",[[4,"gov-grid-item",{"size":[1],"sizeSm":[1,"size-sm"],"sizeMd":[1,"size-md"],"sizeLg":[1,"size-lg"],"sizeXl":[1,"size-xl"]}]]],["p-f16f9116",[[4,"gov-layout",{"type":[1],"variant":[1],"inverse":[4]}]]],["p-d4b50bcd",[[4,"gov-layout-column"]]],["p-7e43f440",[[0,"gov-lifecycle"]]],["p-8fb45e7c",[[4,"gov-message",{"variant":[1]},null,{"variant":["validateVariant"]}]]],["p-55cd3fee",[[4,"gov-nav",{"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-55abc7bc",[[4,"gov-nav-item",{"href":[1],"isExpandedState":[32]},null,{"href":["validateHref"]}]]],["p-6dfde487",[[4,"gov-side-nav",{"inverse":[4],"compact":[4],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-551c9f44",[[0,"gov-skeleton",{"variant":[1],"count":[2],"shape":[1],"width":[1],"height":[1],"animation":[1],"wcagLabel":[1,"wcag-label"],"validateWcag":[64]},null,{"variant":["validateVariant"],"shape":["validateShape"],"animation":["validateAnimation"]}]]],["p-348165e2",[[0,"gov-spacer",{"size":[1],"breakpoint":[1]},null,{"size":["validateSize"],"breakpoint":["validateBreakpoint"]}]]],["p-7d011c4b",[[4,"gov-statsbar",{"iconPosition":[1,"icon-position"],"variant":[1]},null,{"iconPosition":["validateIconPosition"],"variant":["validateVariant"]}]]],["p-489f5c82",[[4,"gov-statsbar-item",{"iconPosition":[1,"icon-position"]},null,{"iconPosition":["validateIconPosition"]}]]],["p-13ced376",[[4,"gov-stepper",{"size":[1]},null,{"size":["validateSize"]}]]],["p-7ba4ae8d",[[4,"gov-stepper-item",{"variant":[1],"size":[1],"identifier":[1],"label":[1],"annotation":[1],"triggerTag":[1,"trigger-tag"],"isExpandedState":[32],"currentState":[64]},null,{"label":["validateLabel"],"triggerTag":["validateTriggerTag"],"variant":["validateVariant"]}]]],["p-7a896683",[[4,"gov-tabs-item",{"identifier":[1],"triggerIdentifier":[1,"trigger-identifier"],"label":[513],"disabled":[516],"default":[4],"isActive":[32],"getIdentifier":[64],"getTriggerIdentifier":[64],"getDisableState":[64],"setActiveStatus":[64]},null,{"label":["rerenderParent"],"disabled":["rerenderParent"]}]]],["p-13520b30",[[4,"gov-tiles",{"columns":[2],"noBorder":[4,"no-border"]}]]],["p-f6a98765",[[4,"gov-tooltip",{"variant":[1],"size":[1],"position":[1025],"message":[1],"identifier":[1],"icon":[516],"persist":[32],"show":[64],"hide":[64]},null,{"variant":["validateVariant"],"size":["validateSize"],"position":["validatePosition"],"message":["rerenderMessage"]}]]],["p-1011ca26",[[4,"gov-wizard",{"size":[1],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]},null,{"size":["validateSize"]}]]],["p-a3cff495",[[0,"gov-icon",{"name":[1],"type":[1],"iconData":[32],"visible":[32],"error":[32]},null,{"name":["loadIconPathData"]}]]],["p-6c33492a",[[4,"gov-form-input",{"value":[1537],"identifier":[1],"variant":[1],"success":[516],"size":[1],"name":[1],"multiline":[4],"rows":[2],"cols":[2],"required":[516],"disabled":[516],"placeholder":[1],"readonly":[4],"minlength":[2],"maxlength":[2],"min":[8],"max":[8],"autocomplete":[4],"autocorrect":[4],"spellcheck":[4],"inputLang":[1,"input-lang"],"type":[1],"inputType":[1,"input-type"],"role":[1],"invalid":[516],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"wcagAutocomplete":[1,"wcag-autocomplete"],"wcagExpanded":[4,"wcag-expanded"],"focused":[32],"setFocus":[64],"setValue":[64],"clearValue":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"]}]]],["p-3832de64",[[4,"gov-form-autocomplete",{"value":[1537],"options":[1537],"identifier":[1],"variant":[1],"success":[4],"size":[1],"nameKey":[1,"name-key"],"name":[1],"required":[4],"disabled":[4],"placeholder":[1],"readonly":[4],"invalid":[4],"minlength":[2],"maxlength":[2],"throttleTime":[2,"throttle-time"],"messageEmpty":[1,"message-empty"],"messageLoading":[1,"message-loading"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"processing":[32],"arrowCounter":[32],"list":[32],"setFocus":[64],"setBlur":[64],"setOptions":[64],"clearValue":[64],"setProcessing":[64],"setSearchCallback":[64],"setTemplateResolver":[64]},null,{"variant":["validateVariant"],"size":["validateSize"],"options":["watchOptions"]}]]],["p-2c3697cf",[[4,"gov-chip",{"inverse":[4],"disabled":[4],"href":[1],"target":[1],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"size":[1],"tag":[1],"variant":[1],"focusable":[4],"identifier":[1],"wcagLabel":[1,"wcag-label"],"wcagControls":[1,"wcag-controls"],"wcagSelected":[4,"wcag-selected"],"getTriggerRef":[64],"getTriggerIdentifier":[64],"setFocus":[64]},null,{"variant":["validateVariant"],"size":["validateSize"]}]]],["p-d4f2d6f9",[[4,"gov-form-select",{"value":[1537],"options":[1537],"identifier":[1],"variant":[1],"size":[1],"name":[1],"required":[4],"success":[4],"disabled":[4],"invalid":[4],"wcagActiveDescendant":[1,"wcag-active-descendant"],"wcagControls":[1,"wcag-controls"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"optionsState":[32],"setFocus":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"options":["watchOptions"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"],"value":["watchValue"]}]]],["p-4694b4b6",[[4,"gov-attachments-item",{"wcagRemoveLabel":[1,"wcag-remove-label"],"wcagRemoveLabelledBy":[1,"wcag-remove-labelled-by"],"validateWcag":[64]}],[4,"gov-attachments",{"label":[1],"wcagLabel":[1,"wcag-label"],"validateWcag":[64]}],[4,"gov-form-message",{"variant":[1],"identifier":[64]},null,{"variant":["validateVariant"]}]]],["p-114a4d0b",[[0,"gov-backdrop",{"inverse":[4],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-77892071",[[4,"gov-button",{"variant":[513],"size":[513],"type":[513],"expanded":[516],"inverse":[516],"name":[1],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"disabled":[516],"nativeType":[1,"native-type"],"href":[1],"target":[1],"download":[4],"hreflang":[1],"referrerpolicy":[1],"rel":[1],"loading":[1],"focusable":[4],"identifier":[1],"wcagActiveDescendant":[1,"wcag-active-descendant"],"wcagControls":[1,"wcag-controls"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagDescription":[1,"wcag-description"],"wcagDetails":[1,"wcag-details"],"wcagExpanded":[4,"wcag-expanded"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"wcagHasPopup":[1,"wcag-has-popup"],"wcagPressed":[4,"wcag-pressed"],"wcagCurrent":[1,"wcag-current"],"setFocus":[64],"getTriggerRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"type":["validateType"],"size":["validateSize"],"nativeType":["validateNativeType"]}]]]]'),e)}));
|
|
1
|
+
import{p as e,H as a,b as l}from"./p-240659bb.js";export{s as setNonce}from"./p-240659bb.js";import{g as i}from"./p-e1255160.js";var t=()=>{{c(a.prototype)}const l=import.meta.url;const i={};if(l!==""){i.resourcesUrl=new URL(".",l).href}return e(i)};var c=e=>{const a=e.cloneNode;e.cloneNode=function(e){if(this.nodeName==="TEMPLATE"){return a.call(this,e)}const l=a.call(this,false);const i=this.childNodes;if(e){for(let e=0;e<i.length;e++){if(i[e].nodeType!==2){l.appendChild(i[e].cloneNode(true))}}}return l}};t().then((async e=>{await i();return l(JSON.parse('[["p-1005135a",[[4,"gov-form-file",{"expanded":[4],"required":[4],"disabled":[4],"resetAfterPick":[4,"reset-after-pick"],"ignoreFileDuplicationCheck":[4,"ignore-file-duplication-check"],"displayAttachments":[4,"display-attachments"],"name":[1],"accept":[1],"multiple":[4],"maxFileSize":[2,"max-file-size"],"identifier":[1],"invalid":[4],"errorSize":[1,"error-size"],"errorAccept":[1,"error-accept"],"attachmentsLabel":[1,"attachments-label"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagRemoveLabel":[1,"wcag-remove-label"],"wcagAttachmentsLabel":[1,"wcag-attachments-label"],"files":[32],"getRef":[64],"getAreaRef":[64],"reset":[64],"validateWcag":[64]},null,{"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-3b8fb675",[[4,"gov-form-multi-select",{"value":[1537],"options":[1537],"identifier":[1],"placeholder":[1],"variant":[1],"size":[1],"name":[1],"hideSelectedList":[4,"hide-selected-list"],"required":[4],"disabled":[4],"invalid":[4],"success":[4],"messageEmpty":[1,"message-empty"],"messageLoading":[1,"message-loading"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"valueState":[32],"selectedOptionsState":[32],"optionsState":[32],"setFocus":[64],"setValue":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"options":["watchOptions"],"value":["watchValue"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"]}]]],["p-cc83b8cb",[[4,"gov-modal",{"open":[1028],"blockClose":[4,"block-close"],"blockBackdropClose":[4,"block-backdrop-close"],"blockButtonClose":[4,"block-button-close"],"label":[1],"role":[1],"labelTag":[1,"label-tag"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagCloseLabel":[1,"wcag-close-label"],"wcagCloseLabelledBy":[1,"wcag-close-labelled-by"],"show":[64],"hide":[64],"validateWcag":[64]},null,{"labelTag":["validateLabelTag"],"open":["watchOpen"]}]]],["p-87b7b469",[[0,"gov-pagination",{"type":[1],"current":[2],"total":[2],"inverse":[4],"selectIdentifier":[1,"select-identifier"],"size":[1],"variant":[1],"pageSize":[2,"page-size"],"maxPages":[2,"max-pages"],"link":[1],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagSelectLabel":[1,"wcag-select-label"],"wcagPageLabel":[1,"wcag-page-label"],"labelPrev":[1,"label-prev"],"labelStart":[1,"label-start"],"labelNext":[1,"label-next"],"labelEnd":[1,"label-end"],"pagination":[32],"validateWcag":[64]},null,{"type":["validateType"],"size":["validateSize"],"variant":["validateVariant"],"current":["recalculate"],"total":["recalculate"],"pageSize":["recalculate"],"maxPages":["recalculate"]}]]],["p-20ae3168",[[4,"gov-prompt",{"open":[1028],"label":[1],"role":[1],"labelTag":[1,"label-tag"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagCloseLabel":[1,"wcag-close-label"],"wcagCloseLabelledBy":[1,"wcag-close-labelled-by"],"show":[64],"hide":[64],"validateWcag":[64]},null,{"labelTag":["validateLabelTag"],"open":["watchOpen"]}]]],["p-1b3143a8",[[4,"gov-tabs",{"type":[1],"variant":[1],"orientation":[1],"wcagLabel":[1,"wcag-label"],"wcagSelectLabel":[1,"wcag-select-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"controllers":[32],"focusIndex":[32],"compactControls":[32],"refresh":[64],"currentTab":[64],"setActiveTab":[64],"rerender":[64],"validateWcag":[64]},null,{"type":["validateType"],"variant":["validateVariant"]}]]],["p-208c99c8",[[4,"gov-breadcrumbs",{"collapsible":[4],"isExpanded":[4,"is-expanded"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labeled-by"],"wcagToggleLabel":[1,"wcag-toggle-label"],"collapsed":[32],"toggleOption":[32],"validateWcag":[64]}]]],["p-cdaeb7d8",[[4,"gov-infobar",{"headline":[1],"variant":[1],"role":[1],"inverse":[4],"wcagCloseLabel":[1,"wcag-close-label"],"wcagToggleLabel":[1,"wcag-toggle-label"],"closable":[4],"toggleContent":[32],"validateWcag":[64]},null,{"variant":["validateVariant"]}]]],["p-828e8bce",[[4,"gov-loading"]]],["p-e9bcadf1",[[4,"gov-side-nav-item",{"inverse":[4],"compact":[4],"identifier":[1],"count":[4],"label":[1],"disabled":[4],"href":[1],"isExpanded":[4,"is-expanded"],"isExpandedState":[32],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"label":["validateLabel"]}]]],["p-34d7c203",[[4,"gov-toast",{"variant":[1],"gravity":[1],"position":[1],"type":[1],"time":[2],"closeLabel":[1,"close-label"],"wcagCloseLabel":[1,"wcag-close-label"],"destroy":[64]},null,{"variant":["validateVariant"]}]]],["p-6d894ec7",[[4,"gov-tooltip-content",{"variant":[1],"size":[1],"persist":[4],"isVisible":[1028,"is-visible"],"parentId":[1,"parent-id"]},null,{"isVisible":["visibleContent"]}]]],["p-4ed064db",[[4,"gov-accordion-item",{"variant":[1],"identifier":[1],"size":[1],"disabled":[4],"isExpanded":[1028,"is-expanded"],"isExpandedState":[32],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"size":["validateSize"],"variant":["validateVariant"]}]]],["p-bcdf6cfc",[[4,"gov-card",{"promotion":[4],"label":[1],"collapsible":[4],"expanded":[4],"headlineTag":[1,"headline-tag"],"wcagTriggerLabel":[1,"wcag-trigger-label"],"wcagTriggerLabelledBy":[1,"wcag-trigger-labelled-by"],"isExpanded":[32],"open":[64],"close":[64],"validateWcag":[64]},null,{"headlineTag":["validateHeadlineTag"]}]]],["p-4f77a766",[[4,"gov-form-checkbox",{"value":[1],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"noLabel":[4,"no-label"],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-810f0d0c",[[4,"gov-tag",{"inverse":[4],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"size":[513],"variant":[513]},null,{"variant":["validateVariant"],"size":["validateSize"]}]]],["p-1bdc04bb",[[4,"gov-tile",{"href":[513],"target":[1],"getTriggerRef":[64]}]]],["p-2186fcd5",[[4,"gov-wizard-item",{"variant":[1],"size":[1],"identifier":[1],"collapsible":[4],"annotation":[1],"label":[1],"disabled":[4],"isExpanded":[1028,"is-expanded"],"labelTag":[1,"label-tag"],"open":[64],"close":[64],"toggle":[64],"currentState":[64]},null,{"label":["validateLabel"],"labelTag":["validateTriggerTag"],"variant":["validateVariant"]}]]],["p-6789b9d0",[[4,"gov-accordion",{"size":[1],"variant":[1],"noBorder":[4,"no-border"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]},null,{"size":["validateSize"],"variant":["validateVariant"]}]]],["p-b2b254b6",[[4,"gov-container",{"slottedChildren":[64]}]]],["p-ae4321ea",[[4,"gov-control-group",{"variant":[1],"noBorder":[4,"no-border"]},null,{"variant":["validateVariant"]}]]],["p-64353313",[[4,"gov-cookiebar"]]],["p-092b0437",[[4,"gov-dropdown",{"identifier":[1],"open":[1028],"position":[1],"getState":[64],"setOpen":[64]}]]],["p-3309aed9",[[4,"gov-empty"]]],["p-802909c5",[[4,"gov-error-code"]]],["p-4700508c",[[4,"gov-form-checkbox-group",{"gap":[1],"orientation":[1],"value":[1025]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-f9de3c09",[[4,"gov-form-control",{"identifier":[1],"invalid":[516],"disabled":[516],"success":[516],"fieldset":[4],"size":[1]}]]],["p-6a82c6a1",[[4,"gov-form-group",{"gap":[1],"orientation":[1]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-06e9e93b",[[4,"gov-form-label",{"identifier":[1],"size":[1],"required":[4],"legend":[4]}]]],["p-f2edcca7",[[4,"gov-form-password-power",{"power":[514]}]]],["p-3e041d63",[[4,"gov-form-radio",{"value":[1],"noLabel":[4,"no-label"],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"]}]]],["p-74233183",[[4,"gov-form-radio-group",{"gap":[1],"orientation":[1],"value":[1025]},null,{"gap":["validateGap"],"orientation":["validateOrientation"]}]]],["p-3ccab2ba",[[4,"gov-form-search",{"variant":[513]}]]],["p-2e881577",[[4,"gov-form-switch",{"value":[1],"noLabel":[4,"no-label"],"checked":[1540],"required":[4],"disabled":[4],"name":[1],"size":[1],"identifier":[1],"invalid":[4],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"getRef":[64],"validateWcag":[64]},null,{"size":["validateSize","watchDisabled"],"disabled":["watchDisabled"],"invalid":["watchDisabled"]}]]],["p-5c3a0b02",[[4,"gov-grid",{"alignX":[1,"align-x"],"alignY":[1,"align-y"]}]]],["p-107a6a5c",[[4,"gov-grid-item",{"size":[1],"sizeSm":[1,"size-sm"],"sizeMd":[1,"size-md"],"sizeLg":[1,"size-lg"],"sizeXl":[1,"size-xl"]}]]],["p-f16f9116",[[4,"gov-layout",{"type":[1],"variant":[1],"inverse":[4]}]]],["p-d4b50bcd",[[4,"gov-layout-column"]]],["p-7e43f440",[[0,"gov-lifecycle"]]],["p-8fb45e7c",[[4,"gov-message",{"variant":[1]},null,{"variant":["validateVariant"]}]]],["p-55cd3fee",[[4,"gov-nav",{"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-55abc7bc",[[4,"gov-nav-item",{"href":[1],"isExpandedState":[32]},null,{"href":["validateHref"]}]]],["p-6dfde487",[[4,"gov-side-nav",{"inverse":[4],"compact":[4],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-551c9f44",[[0,"gov-skeleton",{"variant":[1],"count":[2],"shape":[1],"width":[1],"height":[1],"animation":[1],"wcagLabel":[1,"wcag-label"],"validateWcag":[64]},null,{"variant":["validateVariant"],"shape":["validateShape"],"animation":["validateAnimation"]}]]],["p-348165e2",[[0,"gov-spacer",{"size":[1],"breakpoint":[1]},null,{"size":["validateSize"],"breakpoint":["validateBreakpoint"]}]]],["p-7d011c4b",[[4,"gov-statsbar",{"iconPosition":[1,"icon-position"],"variant":[1]},null,{"iconPosition":["validateIconPosition"],"variant":["validateVariant"]}]]],["p-489f5c82",[[4,"gov-statsbar-item",{"iconPosition":[1,"icon-position"]},null,{"iconPosition":["validateIconPosition"]}]]],["p-13ced376",[[4,"gov-stepper",{"size":[1]},null,{"size":["validateSize"]}]]],["p-7ba4ae8d",[[4,"gov-stepper-item",{"variant":[1],"size":[1],"identifier":[1],"label":[1],"annotation":[1],"triggerTag":[1,"trigger-tag"],"isExpandedState":[32],"currentState":[64]},null,{"label":["validateLabel"],"triggerTag":["validateTriggerTag"],"variant":["validateVariant"]}]]],["p-7a896683",[[4,"gov-tabs-item",{"identifier":[1],"triggerIdentifier":[1,"trigger-identifier"],"label":[513],"disabled":[516],"default":[4],"isActive":[32],"getIdentifier":[64],"getTriggerIdentifier":[64],"getDisableState":[64],"setActiveStatus":[64]},null,{"label":["rerenderParent"],"disabled":["rerenderParent"]}]]],["p-13520b30",[[4,"gov-tiles",{"columns":[2],"noBorder":[4,"no-border"]}]]],["p-f6a98765",[[4,"gov-tooltip",{"variant":[1],"size":[1],"position":[1025],"message":[1],"identifier":[1],"icon":[516],"persist":[32],"show":[64],"hide":[64]},null,{"variant":["validateVariant"],"size":["validateSize"],"position":["validatePosition"],"message":["rerenderMessage"]}]]],["p-1011ca26",[[4,"gov-wizard",{"size":[1],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]},null,{"size":["validateSize"]}]]],["p-14a87c92",[[0,"gov-icon",{"name":[1],"type":[1],"iconData":[32],"visible":[32],"error":[32]},null,{"name":["loadIconPathData"]}]]],["p-6c33492a",[[4,"gov-form-input",{"value":[1537],"identifier":[1],"variant":[1],"success":[516],"size":[1],"name":[1],"multiline":[4],"rows":[2],"cols":[2],"required":[516],"disabled":[516],"placeholder":[1],"readonly":[4],"minlength":[2],"maxlength":[2],"min":[8],"max":[8],"autocomplete":[4],"autocorrect":[4],"spellcheck":[4],"inputLang":[1,"input-lang"],"type":[1],"inputType":[1,"input-type"],"role":[1],"invalid":[516],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"wcagAutocomplete":[1,"wcag-autocomplete"],"wcagExpanded":[4,"wcag-expanded"],"focused":[32],"setFocus":[64],"setValue":[64],"clearValue":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"]}]]],["p-3832de64",[[4,"gov-form-autocomplete",{"value":[1537],"options":[1537],"identifier":[1],"variant":[1],"success":[4],"size":[1],"nameKey":[1,"name-key"],"name":[1],"required":[4],"disabled":[4],"placeholder":[1],"readonly":[4],"invalid":[4],"minlength":[2],"maxlength":[2],"throttleTime":[2,"throttle-time"],"messageEmpty":[1,"message-empty"],"messageLoading":[1,"message-loading"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"processing":[32],"arrowCounter":[32],"list":[32],"setFocus":[64],"setBlur":[64],"setOptions":[64],"clearValue":[64],"setProcessing":[64],"setSearchCallback":[64],"setTemplateResolver":[64]},null,{"variant":["validateVariant"],"size":["validateSize"],"options":["watchOptions"]}]]],["p-2c3697cf",[[4,"gov-chip",{"inverse":[4],"disabled":[4],"href":[1],"target":[1],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"size":[1],"tag":[1],"variant":[1],"focusable":[4],"identifier":[1],"wcagLabel":[1,"wcag-label"],"wcagControls":[1,"wcag-controls"],"wcagSelected":[4,"wcag-selected"],"getTriggerRef":[64],"getTriggerIdentifier":[64],"setFocus":[64]},null,{"variant":["validateVariant"],"size":["validateSize"]}]]],["p-d4f2d6f9",[[4,"gov-form-select",{"value":[1537],"options":[1537],"identifier":[1],"variant":[1],"size":[1],"name":[1],"required":[4],"success":[4],"disabled":[4],"invalid":[4],"wcagActiveDescendant":[1,"wcag-active-descendant"],"wcagControls":[1,"wcag-controls"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"focused":[32],"optionsState":[32],"setFocus":[64],"getRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"size":["validateSize","watchControlAttrs"],"options":["watchOptions"],"disabled":["watchControlAttrs"],"invalid":["watchControlAttrs"],"success":["watchControlAttrs"],"value":["watchValue"]}]]],["p-4694b4b6",[[4,"gov-attachments-item",{"wcagRemoveLabel":[1,"wcag-remove-label"],"wcagRemoveLabelledBy":[1,"wcag-remove-labelled-by"],"validateWcag":[64]}],[4,"gov-attachments",{"label":[1],"wcagLabel":[1,"wcag-label"],"validateWcag":[64]}],[4,"gov-form-message",{"variant":[1],"identifier":[64]},null,{"variant":["validateVariant"]}]]],["p-114a4d0b",[[0,"gov-backdrop",{"inverse":[4],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"validateWcag":[64]}]]],["p-77892071",[[4,"gov-button",{"variant":[513],"size":[513],"type":[513],"expanded":[516],"inverse":[516],"name":[1],"iconLeft":[1,"icon-left"],"iconRight":[1,"icon-right"],"disabled":[516],"nativeType":[1,"native-type"],"href":[1],"target":[1],"download":[4],"hreflang":[1],"referrerpolicy":[1],"rel":[1],"loading":[1],"focusable":[4],"identifier":[1],"wcagActiveDescendant":[1,"wcag-active-descendant"],"wcagControls":[1,"wcag-controls"],"wcagDescribedBy":[1,"wcag-described-by"],"wcagDescription":[1,"wcag-description"],"wcagDetails":[1,"wcag-details"],"wcagExpanded":[4,"wcag-expanded"],"wcagLabel":[1,"wcag-label"],"wcagLabelledBy":[1,"wcag-labelled-by"],"wcagOwns":[1,"wcag-owns"],"wcagHasPopup":[1,"wcag-has-popup"],"wcagPressed":[4,"wcag-pressed"],"wcagCurrent":[1,"wcag-current"],"setFocus":[64],"getTriggerRef":[64],"validateWcag":[64]},null,{"variant":["validateVariant"],"type":["validateType"],"size":["validateSize"],"nativeType":["validateNativeType"]}]]]]'),e)}));
|
|
2
2
|
//# sourceMappingURL=core.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as o,h as i,a as l,g as a}from"./p-240659bb.js";import{c as r}from"./p-cd6c2938.js";import{g as t,a as f,t as s}from"./p-4191acf2.js";import{a as n,b as d}from"./p-ab9aff3c.js";import{c as m}from"./p-e618f1cb.js";import{d as v}from"./p-e0e2e9c1.js";import{g}from"./p-c98fe646.js";import"./p-e296ca83.js";import"./p-92f420cb.js";import"./p-03dbb8b1.js";import"./p-f0d542f2.js";import"./p-45b869ae.js";import"./p-7ba4daf4.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 c(e,o){const i=Math.round(e.size);return i<=o}const p='.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=p;const x=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)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",f(this.invalid));this.f.passAttrToControl("disabled",f(this.disabled));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?c(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()}}async componentDidRender(){this.f.passAttrToLabel("required",String(this.required));this.passControlAttrs();if(m()){await v(500);await this.validateWcag()}this.registerListeners()}render(){return i(l,{key:"f4ff2f49ca750b8025ebacdafea5330c3e681b8e",class:this.h.classes([h.root]),invalid:s(this.invalid),expanded:s(this.expanded)},i("div",{key:"6c1811dcdca85ebe64141ee0af5f2b9e351e3da0",class:h.area,ref:e=>this.areaRef=e},i("slot",{key:"86be170e7f1527dbc0b8b891a130a8b743808702"}),i("input",{key:"95b877b4639343f6dfc5715255e75e82cf18d733",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":s(this.required),"aria-invalid":s(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-disabled":s(this.disabled)})),this.h.hasSlot("attachments")?i("div",{class: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:["watchControlAttrs"],invalid:["watchControlAttrs"]}}};x.style=u;export{x as gov_form_file};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as o,h as i,a as l,g as a}from"./p-240659bb.js";import{c as r}from"./p-cd6c2938.js";import{g as t,a as s,t as f}from"./p-4191acf2.js";import{a as n,b as d}from"./p-ab9aff3c.js";import{c as m}from"./p-e618f1cb.js";import{d as v}from"./p-e0e2e9c1.js";import{g}from"./p-c98fe646.js";import"./p-e296ca83.js";import"./p-92f420cb.js";import"./p-03dbb8b1.js";import"./p-f0d542f2.js";import"./p-45b869ae.js";import"./p-7ba4daf4.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 c(e,o){const i=Math.round(e.size);return i<=o}const p='.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=p;const x=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.eventsRegistered=false;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)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",s(this.invalid));this.f.passAttrToControl("disabled",s(this.disabled));this.f.passAttrToControl("type","File")}registerListeners(){if(this.eventsRegistered){return}this.eventsRegistered=true;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?c(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()}}async componentDidRender(){this.f.passAttrToLabel("required",String(this.required));this.passControlAttrs();if(m()){await v(500);await this.validateWcag()}this.registerListeners()}render(){return i(l,{key:"aa5c283da9eba03799821960eb24cb33ccb09970",class:this.h.classes([h.root]),invalid:f(this.invalid),expanded:f(this.expanded)},i("div",{key:"009e6045d710930eabd1dd9a6b4c8b863f1d7966",class:h.area,ref:e=>this.areaRef=e},i("slot",{key:"c41093ae90e265a077a5a18366dcd3951ca1797b"}),i("input",{key:"9e5813b8a306b65a646ee5754aafb897e92a0c8a",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:["watchControlAttrs"],invalid:["watchControlAttrs"]}}};x.style=u;export{x as gov_form_file};
|
|
2
|
+
//# sourceMappingURL=p-1005135a.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","GovFormFileStyle0","GovFormFile","constructor","hostRef","this","eventsRegistered","fileId","createID","h","govHost","host","f","govForm","watchControlAttrs","passControlAttrs","passAttrToControl","toBoolAttr","invalid","disabled","registerListeners","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","resetAfterPick","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","filesBuffer","Array","from","isFile","find","name","ignoreFileDuplicationCheck","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","displayAttachments","govAddFile","emit","component","govFiles","reset","finally","componentDidRender","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","render","Host","key","class","classes","toBoolAttrIfDefined","ref","el","identifier","multiple","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","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\tprivate eventsRegistered = false\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() 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\twatchControlAttrs(): 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(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tif (this.eventsRegistered) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventsRegistered = true\n\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"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\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)}\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 validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"],"mappings":"wbAAO,MAAMA,EAAgB,CAC5BC,KAAM,gBACNC,KAAM,sBACNC,MAAO,uBACPC,M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,QAAM,IAAGxH,EAAYF,EAAKU,KAAKc,MAAK,UAKhD,K,CAKC,mBAAAgG,CAAoB9G,GAC3B,MAAMoH,EAAQhG,KAAK2B,MAAMsE,WAAU/H,GAAQA,EAAKmF,KAAOzE,EAAKyE,KAC5D,GAAI2C,KAAW,EAAG,CACjB,MAAMrE,EAAQ3B,KAAK2B,MACnB,MAAMuE,EAAalG,KAAK2B,MAAMqE,GAC9BrE,EAAMwE,OAAOH,EAAO,GACpBhG,KAAK2B,MAAQ,IAAIA,GACjB3B,KAAKoG,cAAc1C,KAAK,CACvBC,UAAW/F,EAAcC,KACzBe,KAAMsH,IAEPlG,KAAK4D,SAASF,KAAK,CAClBC,UAAW/F,EAAcC,KACzB8D,S,EAKK,cAAAwD,CAAe3D,GACtBA,EAAEE,kBACF1B,KAAKqG,SAAS3C,KAAK,CAClBC,UAAW/F,EAAcC,KACzByI,cAAe9E,G,CAIT,aAAA6D,CAAc7D,GACrBA,EAAEE,kBACF1B,KAAKuG,QAAQ7C,KAAK,CACjBC,UAAW/F,EAAcC,KACzByI,cAAe9E,G,CAIT,eAAAyD,CAAgBzD,GACvBA,EAAEE,iB,CAOH,YAAM8E,GACL,OAAOxG,KAAKsB,Q,CAOb,gBAAMmF,GACL,OAAOzG,KAAKiB,O,CAOb,WAAM4C,GACL7D,KAAK2B,MAAQ,GACb3B,KAAKsB,SAASoF,MAAQ,E,CAOvB,kBAAMrC,GACLsC,EAAgB3G,KAAKsF,gBAAiB,oBAAqB1H,EAAcC,MACzE8I,EAAgB3G,KAAKuF,eAAgB,mBAAoB3H,EAAcC,MACvE+I,EAAqB5G,KAAK8E,YAAc9E,KAAKE,OAAQF,KAAKuF,eAAgB3H,EAAcC,K","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as t,r as i,h as s,a as n,g as e}from"./p-240659bb.js";import{i as o,e as a}from"./p-e618f1cb.js";import{g as r}from"./p-4191acf2.js";import"./p-e0e2e9c1.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-240659bb.js";import{i as o,e as a}from"./p-e618f1cb.js";import{g as r}from"./p-4191acf2.js";import"./p-e0e2e9c1.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-rc24";const p=()=>l;const f={};const d={};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(f[s]){return f[s]}if(!d[s]){d[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 d[s];f[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=y;const w=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"]}}};w.style=v;export{w as gov_icon};
|
|
2
|
+
//# sourceMappingURL=p-14a87c92.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["govGridCss","GovGridStyle0","GovGrid","constructor","hostRef","this","h","govHost","host","render","Host","key","class","classes","
|
|
1
|
+
{"version":3,"names":["govGridCss","GovGridStyle0","GovGrid","constructor","hostRef","this","h","govHost","host","render","Host","key","class","classes","FlexClass","root","alignX","alignY","role"],"sources":["../../../packages/core/src/components/gov-grid/gov-grid.scss?tag=gov-grid","../../../packages/core/src/components/gov-grid/gov-grid.tsx"],"sourcesContent":["/*\n * Grid\n */\n\n$class: \".gov-grid\";\n\n#{$class} {\n\t@include base(flex);\n\tflex-wrap: wrap;\n\n\t// VARIANTS\n\t&[align-x=\"middle\"] {\n\t\talign-items: center;\n\t}\n\t&[align-x=\"bottom\"] {\n\t\talign-items: flex-end;\n\t}\n\t&[align-y=\"center\"] {\n\t\tjustify-content: center;\n\t}\n\t&[align-y=\"right\"] {\n\t\tjustify-content: flex-end;\n\t}\n\t&[align-y=\"space-between\"] {\n\t\tjustify-content: space-between;\n\t}\n\t&[align-y=\"space-around\"] {\n\t\tjustify-content: space-around;\n\t}\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core'\nimport { FlexClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-grid',\n\tstyleUrl: 'gov-grid.scss',\n})\nexport class GovGrid {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovGridElement\n\t/**\n\t * Horizontal align of cells\n\t */\n\t@Prop({ attribute: 'align-x' }) readonly alignX: string\n\n\t/**\n\t * Vertical align of cells\n\t */\n\t@Prop({ attribute: 'align-y' }) readonly alignY: string\n\n\t// vertical / horizontal align\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(FlexClass.root)} align-x={this.alignX} align-y={this.alignY} role=\"list\">\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"],"mappings":"iIAAA,MAAMA,EAAa,utBACnB,MAAAC,EAAeD,E,MCQFE,EAAO,MAGnB,WAAAC,CAAAC,G,sDACCC,KAAKC,EAAIC,EAAQF,KAAKG,K,CAgBvB,MAAAC,GACC,OACCH,EAACI,EAAI,CAAAC,IAAA,2CAACC,MAAOP,KAAKC,EAAEO,QAAQC,EAAUC,MAAK,UAAWV,KAAKW,OAAM,UAAWX,KAAKY,OAAQC,KAAK,QAC7FZ,EAAA,QAAAK,IAAA,6C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["FlexClass","root","GridItemClass"],"sources":["../../../packages/core/src/components/gov-grid/constants.ts"],"sourcesContent":["export const FlexClass = {\n\troot: 'gov-grid',\n}\n\nexport const GridItemClass = {\n\troot: 'gov-grid-item',\n}\n"],"mappings":"MAAaA,EAAY,CACxBC,KAAM,Y,MAGMC,EAAgB,CAC5BD,KAAM,wB","ignoreList":[]}
|
|
@@ -59,6 +59,7 @@ const GovFormFile = class {
|
|
|
59
59
|
this.govFiles = createEvent(this, "gov-files", 7);
|
|
60
60
|
this.govAddFile = createEvent(this, "gov-add-file", 7);
|
|
61
61
|
this.govRemoveFile = createEvent(this, "gov-remove-file", 7);
|
|
62
|
+
this.eventsRegistered = false;
|
|
62
63
|
this.expanded = false;
|
|
63
64
|
this.required = false;
|
|
64
65
|
this.disabled = false;
|
|
@@ -92,6 +93,10 @@ const GovFormFile = class {
|
|
|
92
93
|
this.f.passAttrToControl("type", "File");
|
|
93
94
|
}
|
|
94
95
|
registerListeners() {
|
|
96
|
+
if (this.eventsRegistered) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.eventsRegistered = true;
|
|
95
100
|
function highlight() {
|
|
96
101
|
this.areaRef.classList.add("highlight");
|
|
97
102
|
}
|
|
@@ -172,7 +177,7 @@ const GovFormFile = class {
|
|
|
172
177
|
this.registerListeners();
|
|
173
178
|
}
|
|
174
179
|
render() {
|
|
175
|
-
return (h(Host, { key: '
|
|
180
|
+
return (h(Host, { key: 'aa5c283da9eba03799821960eb24cb33ccb09970', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, h("div", { key: '009e6045d710930eabd1dd9a6b4c8b863f1d7966', class: FormFileClass.area, ref: el => (this.areaRef = el) }, h("slot", { key: 'c41093ae90e265a077a5a18366dcd3951ca1797b' }), h("input", { key: '9e5813b8a306b65a646ee5754aafb897e92a0c8a', class: FormFileClass.input, ref: el => (this.inputRef = el), 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": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) })), this.h.hasSlot("attachments") ? (h("div", { class: FormFileClass.attachments }, h("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (h("div", { class: FormFileClass.attachments }, h("gov-attachments", { label: this.wcagAttachmentsLabel, "wcag-label": this.wcagAttachmentsLabel }, this.files.map(item => (h("gov-attachments-item", { "wcag-remove-labelled-by": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, h("span", { class: "sr-only", id: item.id }, this.wcagRemoveLabel.replace("{FILE_NAME}", item.file.name)), item.file.name, item.acceptValid === false ? (h("gov-form-message", { slot: "message", variant: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (h("gov-form-message", { slot: "message", variant: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, h("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
|
|
176
181
|
}
|
|
177
182
|
onRemoveFileHandler(file) {
|
|
178
183
|
const index = this.files.findIndex(item => item.id === file.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-form-file.entry.js","mappings":";;;;;;;;;;;;;;AAAO,MAAM,aAAa,GAAG;IAC5B,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,sBAAsB;IAC7B,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,4BAA4B;CACzC;;SCRe,WAAW,CAAC,KAAU;IACrC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/E,IAAI,CAAC,GAAG,CAAC,EACR,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;IAE7B,OAAO,C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CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,aAAa,CAAC,IAAI;YAC7B,aAAa,EAAE,CAAC;SAChB,CAAC,CAAA;KACF;IAEO,eAAe,CAAC,CAAQ;QAC/B,CAAC,CAAC,eAAe,EAAE,CAAA;KACnB;;;;IAMD,MAAM,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAA;KACpB;;;;IAMD,MAAM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAA;KACnB;;;;IAMD,MAAM,KAAK;QACV,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;KACzB;;;;IAMD,MAAM,YAAY;QACjB,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;QAC9E,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;QAC5E,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;KAC7F;;;;;;;;;;;","names":[],"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\twatchControlAttrs(): 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(\"disabled\", toBoolAttr(this.disabled))\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\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)}\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 validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"],"version":3}
|
|
1
|
+
{"file":"gov-form-file.entry.js","mappings":";;;;;;;;;;;;;;AAAO,MAAM,aAAa,GAAG;IAC5B,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,q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AC,CAAA;QAC5E,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;KAC7F;;;;;;;;;;;","names":[],"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\tprivate eventsRegistered = false\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() 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\twatchControlAttrs(): 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(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tif (this.eventsRegistered) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventsRegistered = true\n\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"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\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)}\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 validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"],"version":3}
|
package/dist/hydrate/index.js
CHANGED
|
@@ -4542,6 +4542,7 @@ class GovFormFile {
|
|
|
4542
4542
|
this.govFiles = createEvent(this, "gov-files", 7);
|
|
4543
4543
|
this.govAddFile = createEvent(this, "gov-add-file", 7);
|
|
4544
4544
|
this.govRemoveFile = createEvent(this, "gov-remove-file", 7);
|
|
4545
|
+
this.eventsRegistered = false;
|
|
4545
4546
|
this.expanded = false;
|
|
4546
4547
|
this.required = false;
|
|
4547
4548
|
this.disabled = false;
|
|
@@ -4575,6 +4576,10 @@ class GovFormFile {
|
|
|
4575
4576
|
this.f.passAttrToControl("type", "File");
|
|
4576
4577
|
}
|
|
4577
4578
|
registerListeners() {
|
|
4579
|
+
if (this.eventsRegistered) {
|
|
4580
|
+
return;
|
|
4581
|
+
}
|
|
4582
|
+
this.eventsRegistered = true;
|
|
4578
4583
|
function highlight() {
|
|
4579
4584
|
this.areaRef.classList.add("highlight");
|
|
4580
4585
|
}
|
|
@@ -4655,7 +4660,7 @@ class GovFormFile {
|
|
|
4655
4660
|
this.registerListeners();
|
|
4656
4661
|
}
|
|
4657
4662
|
render() {
|
|
4658
|
-
return (hAsync(Host, { key: '
|
|
4663
|
+
return (hAsync(Host, { key: 'aa5c283da9eba03799821960eb24cb33ccb09970', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, hAsync("div", { key: '009e6045d710930eabd1dd9a6b4c8b863f1d7966', class: FormFileClass.area, ref: el => (this.areaRef = el) }, hAsync("slot", { key: 'c41093ae90e265a077a5a18366dcd3951ca1797b' }), hAsync("input", { key: '9e5813b8a306b65a646ee5754aafb897e92a0c8a', class: FormFileClass.input, ref: el => (this.inputRef = el), 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": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) })), this.h.hasSlot("attachments") ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("gov-attachments", { label: this.wcagAttachmentsLabel, "wcag-label": this.wcagAttachmentsLabel }, this.files.map(item => (hAsync("gov-attachments-item", { "wcag-remove-labelled-by": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, hAsync("span", { class: "sr-only", id: item.id }, this.wcagRemoveLabel.replace("{FILE_NAME}", item.file.name)), item.file.name, item.acceptValid === false ? (hAsync("gov-form-message", { slot: "message", variant: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (hAsync("gov-form-message", { slot: "message", variant: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, hAsync("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
|
|
4659
4664
|
}
|
|
4660
4665
|
onRemoveFileHandler(file) {
|
|
4661
4666
|
const index = this.files.findIndex(item => item.id === file.id);
|