@department-of-veterans-affairs/component-library 51.2.0 → 51.3.0
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/0.app.bundle.js +1 -1
- package/dist/12.app.bundle.js +1 -1
- package/dist/1966.app.bundle.js +1 -1
- package/dist/2205.app.bundle.js +1 -1
- package/dist/2236.app.bundle.js +1 -1
- package/dist/272.app.bundle.js +1 -1
- package/dist/2923.app.bundle.js +2 -0
- package/dist/3305.app.bundle.js +1 -1
- package/dist/3589.app.bundle.js +1 -1
- package/dist/3600.app.bundle.js +1 -1
- package/dist/4400.app.bundle.js +1 -1
- package/dist/4432.app.bundle.js +1 -1
- package/dist/4475.app.bundle.js +1 -1
- package/dist/4780.app.bundle.js +1 -1
- package/dist/4996.app.bundle.js +2 -0
- package/dist/4996.app.bundle.js.LICENSE.txt +5 -0
- package/dist/5119.app.bundle.js +1 -1
- package/dist/5341.app.bundle.js +2 -0
- package/dist/5341.app.bundle.js.LICENSE.txt +5 -0
- package/dist/5663.app.bundle.js +1 -1
- package/dist/5689.app.bundle.js +1 -1
- package/dist/5845.app.bundle.js +1 -1
- package/dist/5938.app.bundle.js +2 -0
- package/dist/5938.app.bundle.js.LICENSE.txt +5 -0
- package/dist/5990.app.bundle.js +1 -1
- package/dist/606.app.bundle.js +1 -0
- package/dist/6095.app.bundle.js +1 -1
- package/dist/6308.app.bundle.js +1 -1
- package/dist/6555.app.bundle.js +1 -1
- package/dist/6650.app.bundle.js +1 -1
- package/dist/6718.app.bundle.js +1 -1
- package/dist/6849.app.bundle.js +1 -1
- package/dist/6850.app.bundle.js +1 -0
- package/dist/7166.app.bundle.js +1 -1
- package/dist/7307.app.bundle.js +1 -1
- package/dist/7372.app.bundle.js +1 -1
- package/dist/7481.app.bundle.js +1 -1
- package/dist/7734.app.bundle.js +1 -1
- package/dist/8255.app.bundle.js +1 -1
- package/dist/8463.app.bundle.js +1 -1
- package/dist/8913.app.bundle.js +1 -1
- package/dist/9186.app.bundle.js +1 -1
- package/dist/9376.app.bundle.js +1 -1
- package/dist/9496.app.bundle.js +1 -1
- package/dist/960.app.bundle.js +1 -1
- package/dist/9851.app.bundle.js +1 -1
- package/dist/app.bundle.js +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -1
- package/dist/components/parsePhoneNumber_.js +1 -0
- package/dist/components/types/components.d.ts +203 -2
- package/dist/components/va-accordion-item2.js +1 -1
- package/dist/components/va-accordion2.js +1 -1
- package/dist/components/va-additional-info.js +1 -1
- package/dist/components/va-alert-expandable.js +1 -1
- package/dist/components/va-alert2.js +1 -1
- package/dist/components/va-back-to-top.js +1 -1
- package/dist/components/va-breadcrumbs.js +1 -1
- package/dist/components/va-button-icon2.js +1 -1
- package/dist/components/va-button-segmented.js +1 -1
- package/dist/components/va-button2.js +1 -1
- package/dist/components/va-checkbox-group2.js +1 -1
- package/dist/components/va-checkbox2.js +1 -1
- package/dist/components/va-combo-box2.js +1 -1
- package/dist/components/va-crisis-line-modal2.js +1 -1
- package/dist/components/va-file-input-multiple.js +1 -1
- package/dist/components/va-file-input2.js +1 -1
- package/dist/components/va-link-action.js +1 -1
- package/dist/components/va-link2.js +1 -1
- package/dist/components/va-maintenance-banner.js +1 -1
- package/dist/components/va-memorable-date.js +1 -1
- package/dist/components/va-minimal-footer.js +1 -1
- package/dist/components/va-modal2.js +1 -1
- package/dist/components/va-on-this-page.js +1 -1
- package/dist/components/va-pagination.js +1 -1
- package/dist/components/va-privacy-agreement.js +1 -1
- package/dist/components/va-promo-banner.js +1 -1
- package/dist/components/va-radio.js +1 -1
- package/dist/components/va-search-input.js +1 -1
- package/dist/components/va-segmented-progress-bar.js +1 -1
- package/dist/components/va-select2.js +1 -1
- package/dist/components/va-service-list-item.js +1 -1
- package/dist/components/va-sidenav-item.d.ts +11 -0
- package/dist/components/va-sidenav-item.js +1 -0
- package/dist/components/va-sidenav-submenu.d.ts +11 -0
- package/dist/components/va-sidenav-submenu.js +1 -0
- package/dist/components/va-sidenav.d.ts +11 -0
- package/dist/components/va-sidenav.js +1 -0
- package/dist/components/va-statement-of-truth.js +1 -1
- package/dist/components/va-summary-box.js +1 -1
- package/dist/components/va-table-inner2.js +1 -1
- package/dist/components/va-table-row.js +1 -1
- package/dist/components/va-table.js +1 -1
- package/dist/components/va-telephone-input.js +1 -1
- package/dist/components/va-telephone2.js +1 -1
- package/dist/components/va-text-input2.js +1 -1
- package/dist/components/va-textarea.js +1 -1
- package/dist/img/sprite.svg +4 -2
- package/dist/react-bindings/index.d.ts +3 -0
- package/dist/react-bindings/index.js +1 -1
- package/dist/react-bindings/index.js.map +1 -1
- package/dist/react-bindings/index.ts +3 -0
- package/package.json +2 -2
- package/dist/9474.app.bundle.js +0 -2
- /package/dist/{9474.app.bundle.js.LICENSE.txt → 2923.app.bundle.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,h,Host}from"@stencil/core/internal/client";import{C as CONTACTS}from"./contacts.js";import{d as defineCustomElement$4}from"./va-button2.js";import{d as defineCustomElement$3}from"./va-icon2.js";import{d as defineCustomElement$2}from"./va-modal2.js";import{d as defineCustomElement$1}from"./va-telephone2.js";const vaCrisisLineModalCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}.va-crisis-line-container{position:relative;margin:auto;background-color:var(--vads-color-secondary-dark)}@media (min-width: 1008px){.va-crisis-line-container{max-width:60.938rem;background-color:transparent}}a{color:var(--vads-color-link)}button.va-crisis-line{cursor:pointer;background-color:var(--vads-color-secondary-darkest);display:block;border-radius:0;color:var(--vads-button-color-text-primary-alt-on-light);font-family:var(--font-source-sans);font-size:16px;font-weight:normal;text-decoration:none;padding:0;margin:0;width:100%;border:0;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:background-color;transition-property:background-color}button.va-crisis-line:focus{outline-offset:-2px}button.va-crisis-line:hover,button.va-crisis-line:active{background-color:#8b0a03}@media (min-width: 1008px){button.va-crisis-line:hover .va-crisis-line-icon,button.va-crisis-line:active .va-crisis-line-icon{background-color:#b51d09}}@media (min-width: 1008px){button.va-crisis-line{width:auto;border-radius:0 0 2.3px 2.3px;-webkit-box-shadow:0 2px 5px var(--vads-color-base);box-shadow:0 2px 5px var(--vads-color-base)}}.va-crisis-line-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;margin:auto}@media (min-width: 1008px){.va-crisis-line-inner{text-align:left;-ms-flex-pack:justify;justify-content:space-between}}.va-crisis-line-icon{content:"";background:url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 96 60%22 width%3D%2296px%22 height%3D%2260px%22%3E%3Cpath d%3D%22M58 14c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 30c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 46c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm-48 2L32 60h-2V48H4c-2.20914 0-4-1.79086-4-4V4c0-2.20914 1.79086-4 4-4h40c2.20914 0 4 1.79086 4 4v40c0 2.20914-1.79086 4-4 4h-2zM24 31.72174L33.86667 39l-3.73334-11.86087L40 20.13043H28L24 8l-4 12.13043H8l9.86667 7.0087L14.13333 39 24 31.72174z%22 fill%3D%22%23FFF%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E") no-repeat right 29%;background-size:30px auto;background-position:8px 8px;width:40px;height:36px;padding-right:3px;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:background-color;transition-property:background-color}@media (max-width: 480px){.va-crisis-line-icon{display:none}}@media (min-width: 1008px){.va-crisis-line-icon{border-bottom-left-radius:3.2px}}.va-crisis-line-text{padding:8px}.va-icon__right-arrow{position:relative;top:2px}.va-clm__icon{position:relative;top:15px;margin-right:23px}.va-crisis-panel{color:var(--vads-color-base)}.va-crisis-panel-body{max-height:100%}.va-crisis-panel-title{color:var(--vads-color-base);padding-left:41px;background-image:url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 96 60%22 width%3D%2296px%22 height%3D%2260px%22%3E%3Cpath d%3D%22M58 14c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 30c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 46c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm-48 2L32 60h-2V48H4c-2.20914 0-4-1.79086-4-4V4c0-2.20914 1.79086-4 4-4h40c2.20914 0 4 1.79086 4 4v40c0 2.20914-1.79086 4-4 4h-2zM24 31.72174L33.86667 39l-3.73334-11.86087L40 20.13043H28L24 8l-4 12.13043H8l9.86667 7.0087L14.13333 39 24 31.72174z%22 fill%3D%22%23FFF%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E") no-repeat left;background-position:left 5px;background-size:32px auto}.va-crisis-panel-list{list-style:none;padding:0}.va-crisis-panel-list>li{display:-ms-flexbox;display:flex;min-height:56px;margin-bottom:0;border-top:1px solid var(--vads-color-base-light)}.va-crisis-panel-list>li:last-child{border-bottom:1px solid var(--vads-color-base-light)}.va-crisis-panel-list>li>a,.va-crisis-panel-list>li>span{padding:8px 0;-ms-flex-item-align:center;align-self:center}',VaCrisisLineModalStyle0=vaCrisisLineModalCss,VACrisisLineModal=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.isOpen=!1,this.shifted=!1}setVisible(){this.isOpen=!0}setNotVisible(){this.isOpen=!1}trackShiftKey(e){this.shifted=e.shiftKey}trapFocus(){var e;const i=null===(e=this.el)||void 0===e?void 0:e.shadowRoot.querySelector("va-modal"),a=null==i?void 0:i.getAttribute("visible");if(null!==a&&"false"!==a){let e;const a=this.shifted?".last-focusable-child":'[role="document"]';e=this.shifted?null==i?void 0:i.querySelector(a):null==i?void 0:i.shadowRoot.querySelector(a),null==e||e.focus()}}render(){return h(Host,{key:"9abdb650f83b1ebaf8d6c47897caa5d20fd13e06"},h("div",{key:"96618055c7c7a11d1180c5870eae1298d7c67867",class:"va-crisis-line-container"},h("button",{key:"ca66ad606aa88a5837686eafbdbdaa74d3b5f4a1",onClick:()=>this.setVisible(),onFocusin:()=>this.trapFocus(),"data-show":"#modal-crisisline",class:"va-crisis-line va-overlay-trigger",part:"button"},h("div",{key:"8f07f3ff5edd14ec01a216c8cf1849e21642bbef",class:"va-crisis-line-inner"},h("span",{key:"ff2cf54c5ff807679e0820b4607a810f77fab3cd",class:"va-crisis-line-icon","aria-hidden":"true"}),h("span",{key:"01ccfb67535e3fe4fd0873d3d86f7b1b9340ba4b",class:"va-crisis-line-text"},"Talk to the ",h("strong",{key:"240691554fa7b48ba9510382dc3f1214cc633469"},"Veterans Crisis Line")," now"),h("va-icon",{key:"657c49341568c2c6cecfa0c57bce6d216fc3b3a4",class:"va-icon__right-arrow",icon:"navigate_next",size:3})))),h("va-modal",{key:"8a8646b05be73d32edb10a951606ed377bb6f3df",modalTitle:"We’re here anytime, day or night – 24/7",onPrimaryButtonClick:()=>this.setNotVisible(),onCloseEvent:()=>this.setNotVisible(),visible:this.isOpen,large:!0},h("p",{key:"0aa6c308c9e92d3221b8776e47a20854936caac6"},"If you are a Veteran in crisis or concerned about one, connect with our caring, qualified responders for confidential help. Many of them are Veterans themselves."),h("ul",{key:"895c26d0e826ae7953704c7eefbae3ad6bc329e8",class:"va-crisis-panel-list"},h("li",{key:"8cf6852edb3a84e5c0fba7c49e2f550971c28b9d"},h("va-icon",{key:"50ae8afa383e9140bd8cd195e518725c01eb1bb0",class:"va-clm__icon",icon:"phone",size:3}),h("span",{key:"183f56dca2957a3bf8a40a7618839fd2b314b776"},"Call"," ",h("strong",{key:"a36c35b6920e48ae4ce464362651a8a3a07a28c4"},h("va-telephone",{key:"d262dab146969d6e01966f539875dec8e28ef3b7",contact:"988"})," and select 1"))),h("li",{key:"fb001af22341fbdda8827fba41fe024f264a52f6"},h("va-icon",{key:"4d922bac42139ac20f1fc1417ed62064d20e719a",icon:"phone_iphone",class:"va-clm__icon",size:3}),h("span",{key:"486842b866cee9715eeeafcb19a16919fb71e83f"},"Text ",h("strong",{key:"6a2016562c1279c05606ddd748ba78166720a567"},h("va-telephone",{key:"e6bd065e2d3381254020f612fc3680366e13a6c3",sms:!0,contact:"838255"})))),h("li",{key:"969edac9d2ba76ba55662ad6351845e07864b851"},h("va-icon",{key:"3a5e4a39e56e235913317259ee48c4eea4788b32",icon:"chat",class:"va-clm__icon",size:3}),h("a",{key:"d4722da3256da6da43cd8bd51460491dead644c0",class:"no-external-icon",href:"https://www.veteranscrisisline.net/get-help-now/chat/"},"Start a confidential chat")),h("li",{key:"73f16a72346b8b889b0de617d207875ca022a3c8"},h("va-icon",{key:"6b85e8d63cad91435de0764c2e2e6560152d7a09",icon:"tty",class:"va-clm__icon",size:3}),h("p",{key:"aee5ec33cce7164ce0227c443b2325651d9a48dd"},"Call TTY if you have hearing loss"," ",h("strong",{key:"c901785e83e3ebe67908ebfc7cd205b95b751db9"},h("va-telephone",{key:"2d6a7c2cd00fc660514a1cba9b6014261ff3e10d",tty:!0,contact:CONTACTS.CRISIS_TTY}))))),h("p",{key:"4ba3381cb65d93ee35edbf205fd3e0f86ed31066"},"Get more resources at"," ",h("a",{key:"be70893a771ebdead2aff28b6889257d05668945",class:"no-external-icon",href:"https://www.veteranscrisisline.net/"},"VeteransCrisisLine.net"))))}get el(){return this}static get style(){return VaCrisisLineModalStyle0}},[1,"va-crisis-line-modal",{isOpen:[32],shifted:[32]},[[8,"keydown","trackShiftKey"]]]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-crisis-line-modal","va-button","va-icon","va-modal","va-telephone"].forEach((e=>{switch(e){case"va-crisis-line-modal":customElements.get(e)||customElements.define(e,VACrisisLineModal);break;case"va-button":customElements.get(e)||defineCustomElement$4();break;case"va-icon":customElements.get(e)||defineCustomElement$3();break;case"va-modal":customElements.get(e)||defineCustomElement$2();break;case"va-telephone":customElements.get(e)||defineCustomElement$1()}}))}export{VACrisisLineModal as V,defineCustomElement as d};
|
|
1
|
+
import{proxyCustomElement,HTMLElement,h,Host}from"@stencil/core/internal/client";import{C as CONTACTS}from"./contacts.js";import{d as defineCustomElement$4}from"./va-button2.js";import{d as defineCustomElement$3}from"./va-icon2.js";import{d as defineCustomElement$2}from"./va-modal2.js";import{d as defineCustomElement$1}from"./va-telephone2.js";const vaCrisisLineModalCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}.va-crisis-line-container{position:relative;margin:auto;background-color:var(--vads-color-secondary-dark)}@media (min-width: 1008px){.va-crisis-line-container{max-width:60.938rem;background-color:transparent}}a{color:var(--vads-color-link)}button.va-crisis-line{cursor:pointer;background-color:var(--vads-color-secondary-darkest);display:block;border-radius:0;color:var(--vads-button-color-text-primary-alt-on-light);font-family:var(--font-source-sans);font-size:16px;font-weight:normal;text-decoration:none;padding:0;margin:0;width:100%;border:0;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:background-color;transition-property:background-color}button.va-crisis-line:focus{outline-offset:-2px}button.va-crisis-line:hover,button.va-crisis-line:active{background-color:#8b0a03}@media (min-width: 1008px){button.va-crisis-line:hover .va-crisis-line-icon,button.va-crisis-line:active .va-crisis-line-icon{background-color:#b51d09}}@media (min-width: 1008px){button.va-crisis-line{width:auto;border-radius:0 0 2.3px 2.3px;-webkit-box-shadow:0 2px 5px var(--vads-color-base);box-shadow:0 2px 5px var(--vads-color-base)}}.va-crisis-line-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;margin:auto}@media (min-width: 1008px){.va-crisis-line-inner{text-align:left;-ms-flex-pack:justify;justify-content:space-between}}.va-crisis-line-icon{content:"";background:url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 96 60%22 width%3D%2296px%22 height%3D%2260px%22%3E%3Cpath d%3D%22M58 14c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 30c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 46c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm-48 2L32 60h-2V48H4c-2.20914 0-4-1.79086-4-4V4c0-2.20914 1.79086-4 4-4h40c2.20914 0 4 1.79086 4 4v40c0 2.20914-1.79086 4-4 4h-2zM24 31.72174L33.86667 39l-3.73334-11.86087L40 20.13043H28L24 8l-4 12.13043H8l9.86667 7.0087L14.13333 39 24 31.72174z%22 fill%3D%22%23FFF%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E") no-repeat right 29%;background-size:30px auto;background-position:8px 8px;width:40px;height:36px;padding-right:3px;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:background-color;transition-property:background-color}@media (max-width: 480px){.va-crisis-line-icon{display:none}}@media (min-width: 1008px){.va-crisis-line-icon{border-bottom-left-radius:3.2px}}.va-crisis-line-text{padding:8px}.va-icon__right-arrow{position:relative;top:2px}.va-clm__icon{position:relative;top:15px;margin-right:23px}.va-crisis-panel{color:var(--vads-color-base)}.va-crisis-panel-body{max-height:100%}.va-crisis-panel-title{color:var(--vads-color-base);padding-left:41px;background-image:url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 96 60%22 width%3D%2296px%22 height%3D%2260px%22%3E%3Cpath d%3D%22M58 14c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 30c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zM58 46c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm16 0c-3.3137 0-6-2.6863-6-6s2.6863-6 6-6 6 2.6863 6 6-2.6863 6-6 6zm-48 2L32 60h-2V48H4c-2.20914 0-4-1.79086-4-4V4c0-2.20914 1.79086-4 4-4h40c2.20914 0 4 1.79086 4 4v40c0 2.20914-1.79086 4-4 4h-2zM24 31.72174L33.86667 39l-3.73334-11.86087L40 20.13043H28L24 8l-4 12.13043H8l9.86667 7.0087L14.13333 39 24 31.72174z%22 fill%3D%22%23FFF%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E") no-repeat left;background-position:left 5px;background-size:32px auto}.va-crisis-panel-list{list-style:none;padding:0}.va-crisis-panel-list>li{display:-ms-flexbox;display:flex;min-height:56px;margin-bottom:0;border-top:1px solid var(--vads-color-base-light)}.va-crisis-panel-list>li:last-child{border-bottom:1px solid var(--vads-color-base-light)}.va-crisis-panel-list>li>a,.va-crisis-panel-list>li>span{padding:8px 0;-ms-flex-item-align:center;align-self:center}',VaCrisisLineModalStyle0=vaCrisisLineModalCss,VACrisisLineModal=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.isOpen=!1,this.shifted=!1}setVisible(){this.isOpen=!0}setNotVisible(){this.isOpen=!1}trackShiftKey(e){this.shifted=e.shiftKey}trapFocus(){var e;const i=null===(e=this.el)||void 0===e?void 0:e.shadowRoot.querySelector("va-modal"),a=null==i?void 0:i.getAttribute("visible");if(null!==a&&"false"!==a){let e;const a=this.shifted?".last-focusable-child":'[role="document"]';e=this.shifted?null==i?void 0:i.querySelector(a):null==i?void 0:i.shadowRoot.querySelector(a),null==e||e.focus()}}render(){return h(Host,{key:"9abdb650f83b1ebaf8d6c47897caa5d20fd13e06"},h("div",{key:"96618055c7c7a11d1180c5870eae1298d7c67867",class:"va-crisis-line-container"},h("button",{key:"ca66ad606aa88a5837686eafbdbdaa74d3b5f4a1",onClick:()=>this.setVisible(),onFocusin:()=>this.trapFocus(),"data-show":"#modal-crisisline",class:"va-crisis-line va-overlay-trigger",part:"button"},h("div",{key:"8f07f3ff5edd14ec01a216c8cf1849e21642bbef",class:"va-crisis-line-inner"},h("span",{key:"ff2cf54c5ff807679e0820b4607a810f77fab3cd",class:"va-crisis-line-icon","aria-hidden":"true"}),h("span",{key:"01ccfb67535e3fe4fd0873d3d86f7b1b9340ba4b",class:"va-crisis-line-text"},"Talk to the ",h("strong",{key:"240691554fa7b48ba9510382dc3f1214cc633469"},"Veterans Crisis Line")," now"),h("va-icon",{key:"657c49341568c2c6cecfa0c57bce6d216fc3b3a4",class:"va-icon__right-arrow",icon:"navigate_next",size:3})))),h("va-modal",{key:"8a8646b05be73d32edb10a951606ed377bb6f3df",modalTitle:"We’re here anytime, day or night – 24/7",onPrimaryButtonClick:()=>this.setNotVisible(),onCloseEvent:()=>this.setNotVisible(),visible:this.isOpen,large:!0},h("p",{key:"0aa6c308c9e92d3221b8776e47a20854936caac6"},"If you are a Veteran in crisis or concerned about one, connect with our caring, qualified responders for confidential help. Many of them are Veterans themselves."),h("ul",{key:"895c26d0e826ae7953704c7eefbae3ad6bc329e8",class:"va-crisis-panel-list"},h("li",{key:"8cf6852edb3a84e5c0fba7c49e2f550971c28b9d"},h("va-icon",{key:"50ae8afa383e9140bd8cd195e518725c01eb1bb0",class:"va-clm__icon",icon:"phone",size:3}),h("span",{key:"183f56dca2957a3bf8a40a7618839fd2b314b776"},"Call"," ",h("strong",{key:"a36c35b6920e48ae4ce464362651a8a3a07a28c4"},h("va-telephone",{key:"d262dab146969d6e01966f539875dec8e28ef3b7",contact:"988"})," and select 1"))),h("li",{key:"fb001af22341fbdda8827fba41fe024f264a52f6"},h("va-icon",{key:"4d922bac42139ac20f1fc1417ed62064d20e719a",icon:"phone_iphone",class:"va-clm__icon",size:3}),h("span",{key:"486842b866cee9715eeeafcb19a16919fb71e83f"},"Text ",h("strong",{key:"6a2016562c1279c05606ddd748ba78166720a567"},h("va-telephone",{key:"e6bd065e2d3381254020f612fc3680366e13a6c3",sms:!0,contact:"838255"})))),h("li",{key:"969edac9d2ba76ba55662ad6351845e07864b851"},h("va-icon",{key:"3a5e4a39e56e235913317259ee48c4eea4788b32",icon:"chat",class:"va-clm__icon",size:3}),h("a",{key:"d4722da3256da6da43cd8bd51460491dead644c0",class:"no-external-icon",href:"https://www.veteranscrisisline.net/get-help-now/chat/"},"Start a confidential chat")),h("li",{key:"73f16a72346b8b889b0de617d207875ca022a3c8"},h("va-icon",{key:"6b85e8d63cad91435de0764c2e2e6560152d7a09",icon:"tty",class:"va-clm__icon",size:3}),h("p",{key:"aee5ec33cce7164ce0227c443b2325651d9a48dd"},"Call TTY if you have hearing loss"," ",h("strong",{key:"c901785e83e3ebe67908ebfc7cd205b95b751db9"},h("va-telephone",{key:"2d6a7c2cd00fc660514a1cba9b6014261ff3e10d",tty:!0,contact:CONTACTS.CRISIS_TTY}))))),h("p",{key:"4ba3381cb65d93ee35edbf205fd3e0f86ed31066"},"Get more resources at"," ",h("a",{key:"be70893a771ebdead2aff28b6889257d05668945",class:"no-external-icon",href:"https://www.veteranscrisisline.net/"},"VeteransCrisisLine.net"))))}get el(){return this}static get style(){return VaCrisisLineModalStyle0}},[1,"va-crisis-line-modal",{isOpen:[32],shifted:[32]},[[8,"keydown","trackShiftKey"]]]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-crisis-line-modal","va-button","va-icon","va-modal","va-telephone"].forEach((e=>{switch(e){case"va-crisis-line-modal":customElements.get(e)||customElements.define(e,VACrisisLineModal);break;case"va-button":customElements.get(e)||defineCustomElement$4();break;case"va-icon":customElements.get(e)||defineCustomElement$3();break;case"va-modal":customElements.get(e)||defineCustomElement$2();break;case"va-telephone":customElements.get(e)||defineCustomElement$1()}}))}export{VACrisisLineModal as V,defineCustomElement as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import"./i18n-setup.js";import"./contacts.js";import{d as defineCustomElement$9}from"./va-button2.js";import{d as defineCustomElement$8}from"./va-button-icon2.js";import{d as defineCustomElement$7}from"./va-card2.js";import{d as defineCustomElement$6}from"./va-file-input2.js";import{d as defineCustomElement$5}from"./va-icon2.js";import{d as defineCustomElement$4}from"./va-modal2.js";import{d as defineCustomElement$3}from"./va-progress-bar2.js";import{d as defineCustomElement$2}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const vaFileInputMultipleCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}@import \'~@department-of-veterans-affairs/css-library/dist/stylesheets/base/headings.css\';:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}[hidden]{display:none}:host{display:block;font-family:var(--font-source-sans);font-size:16.96px;}:host .label-header{color:var(--vads-color-base);font-weight:var(--font-weight-normal)}:host .label-header-tag{margin:0;display:inline-block}:host .file-input-wrapper{display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host .file-input{cursor:pointer;height:100%;width:100%;max-width:none;top:0;left:0;z-index:1;margin:0;position:absolute;text-indent:-999em;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target{border:1px dashed var(--vads-color-action-border-base-active-on-dark);display:block;margin-top:0.3125rem;position:relative;text-align:center;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target.file-input-target-error{border:2px dashed var(--vads-color-secondary-dark)}:host .file-input-box{background:var(--vads-color-white);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:2}:host .file-input-instructions{font-size:1.06rem;padding:1.25rem 0.625rem;pointer-events:none;position:relative;z-index:3}:host .file-input-choose-text{color:var(--vads-color-link);text-decoration:underline;font-weight:var(--font-weight-normal)}:host .file-icon{color:var(--vads-color-primary-alt-darkest)}:host .selected-files-wrapper{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light)}:host .selected-files-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;border-bottom:1px solid var(--vads-color-white);margin-bottom:8px;padding:8px}:host .va-card{margin:8px}:host .file-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;padding:0 8px;display:block;width:100%;word-wrap:break-word;word-break:break-word;overflow:hidden}:host #input-error-message{padding:0 8px;width:100%}:host .file-size-label,:host .file-status-label{color:var(--vads-color-base-dark);font-weight:var(--font-weight-normal);font-size:1.06rem;padding:0 8px;display:block}:host .file-status-label{font-style:italic}:host .file-info-section{padding:0 8px 8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .file-button-section{margin-top:8px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:row;flex-direction:row}:host .file-button-section>va-button-icon{font-size:1.06rem}@media screen and (max-width: 320px){:host .file-button-section{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}:host .separator{border:0;border-top:1px solid var(--vads-color-base-lighter);margin:0}:host .vads-u-line-height--2{line-height:1.15}:host .thumbnail-container{height:40px;width:40px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .thumbnail-preview{max-width:40px;width:auto;max-height:40px;height:auto}:host .thumbnail-error{color:#b21d38}:host va-progress-bar{font-size:var(--vads-font-size-root);display:block;margin-left:16px}:host .uploading-status{font-style:var(--font-style-italic)}:host(.has-error){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host(.has-error){margin-left:-0.9rem}}.required{color:var(--vads-color-secondary-dark);margin-left:0.25rem}h1 .required,h2 .required,h3 .required,h4 .required,h5 .required,h6 .required{font-family:var(--font-source-sans);font-size:initial;font-weight:initial}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}:host.has-error{border-left:0.25rem solid #b50909;padding-left:1rem}:host .outer-wrap{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light);display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host va-file-input.no-file{margin:0 8px}:host va-file-input:not(:last-child){border-bottom:1px solid var(--vads-color-white)}:host va-file-input.has-error{border-left:none;padding-left:0}@media screen and (min-width: 1008px){:host va-file-input.has-error{margin-left:0}}',VaFileInputMultipleStyle0=vaFileInputMultipleCss,VaFileInputMultiple$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.vaMultipleChange=createEvent(this,"vaMultipleChange",7),this.fileKeyCounter=0,this.additionalSlot=null,this.additionalFileUploadMessage=h("span",null,"Drag an additional file here or"," ",h("span",{class:"file-input-choose-text"},"choose from folder")),this.renderLabelOrHeader=(e,t,i)=>{const o=t?h("span",{class:"required"}," ",instance.t("required")):null;return i&&i>=1&&i<=6?h("div",{class:"label-header"},h(`h${i}`,{htmlFor:"fileInputField",part:"label",class:"label-header-tag"},e,o)):h("div",{class:"label-header"},h("span",{part:"label",class:"usa-label"},e),o)},this.addValueFiles=async()=>(this.files.shift(),this.value.forEach((e=>{this.files.push({file:e,key:this.fileKeyCounter,content:this.getAdditionalContent()||null}),this.fileKeyCounter++})),this.readOnly||this.files.push({file:null,key:this.fileKeyCounter,content:null}),this.valueAdded=!0,Promise.resolve()),this.hasErrors=()=>this.errors.some((e=>!!e)),this.label=void 0,this.name=void 0,this.required=!1,this.accept=void 0,this.errors=[],this.encrypted=[],this.hint=void 0,this.enableAnalytics=!1,this.headerSize=void 0,this.value=void 0,this.readOnly=!1,this.slotFieldIndexes=null,this.files=[{key:0,file:null,content:null}],this.valueAdded=!1}findFileByKey(e){return this.files.find((t=>t.key===e))}findIndexByKey(e){return this.files.indexOf(this.files.find((t=>t.key===e)))}isEmpty(){return null===this.files[0].file}setSlotContent(){const e=this.el.shadowRoot.querySelector("slot");this.additionalSlot||(this.additionalSlot=e?e.assignedElements({flatten:!0}):[]),null==e||e.remove()}getAdditionalContent(){return this.additionalSlot&&this.additionalSlot.map((e=>e.cloneNode(!0)))}handleChange(e,t,i){const o=e.detail.files[0];let s,r,a;if(o){const e=this.findFileByKey(t);e.file?(r="FILE_UPDATED",a=o,e.file=o):(r="FILE_ADDED",a=o,e.file=o,e.content=this.getAdditionalContent(),this.fileKeyCounter++,this.files.push({file:null,key:this.fileKeyCounter,content:null})),s=this.buildFilesArray(this.files,!1,this.findIndexByKey(t))}else{r="FILE_REMOVED",a=this.files[i].file,this.files.splice(i,1);const e=this.el.shadowRoot.querySelector("#statusMessage");e.textContent="",setTimeout((()=>{e.textContent="File removed."}),1e3),s=this.buildFilesArray(this.files,!0)}const n={action:r,file:a,state:s};this.vaMultipleChange.emit(n),this.files=Array.of(...this.files)}handlePasswordChange(e,t){const i=this.findFileByKey(t);i.password=e.detail.password;const o=this.buildFilesArray(this.files,!1,this.findIndexByKey(t)),s={action:"PASSWORD_UPDATE",file:i.file,state:o};this.vaMultipleChange.emit(s)}buildFilesArray(e,t,i){let o=e.filter((e=>!!e.file)).map((e=>({file:e.file,changed:!1,password:e.password})));return!t&&o[i]&&(o[i].changed=!0),o}componentDidRender(){const e=this.el.shadowRoot.querySelectorAll("va-file-input");return this.setSlotContent(),e.forEach(((e,t)=>{!this.files[t].content||this.slotFieldIndexes&&!this.slotFieldIndexes.includes(t)||this.files[t].content.forEach((t=>e.append(t)))})),this.value&&this.value.length&&!this.valueAdded?this.addValueFiles():Promise.resolve()}render(){const{label:e,required:t,headerSize:i,hint:o,files:s,name:r,accept:a,errors:n,encrypted:l,enableAnalytics:d,readOnly:m}=this,f=this.isEmpty()?"":"outer-wrap",p=this.hasErrors()?"has-error":"";return h(Host,{key:"0156ba46fb8380ea7a1f31a936eed8c07816b05b",class:p},e&&!m&&this.renderLabelOrHeader(e,t,i),o&&!m&&h("div",{key:"74964bef97bbb0efa13429c3828b09b0f4387068",class:"usa-hint",id:"input-hint-message"},o),h("div",{key:"71854dad83b75dd540d8e938a8b16b8f4f822139",class:f},h("div",{key:"d51b60a006dedbd083ddb7bc6605f7b274321cb5",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),!this.isEmpty()&&h("div",{key:"dec914be713c5aca6887b071285a82d48124864e",class:"selected-files-label"},m?"Files you uploaded":"Selected files"),s.map(((i,s)=>h("va-file-input",Object.assign({key:i.key,headless:!0,label:e,hint:o,name:`${r}-${i.key}`,accept:a,required:t},s>0?{uploadMessage:this.additionalFileUploadMessage}:{},{error:n[s],encrypted:l[s],onVaChange:e=>this.handleChange(e,i.key,s),onVaPasswordChange:e=>this.handlePasswordChange(e,i.key),"enable-analytics":d,value:i.file,readOnly:m,class:i.file?"has-file":"no-file"}))))),h("slot",{key:"c1265273819fa699a082158a09f854c4a10ceac7"}))}get el(){return this}static get style(){return VaFileInputMultipleStyle0}},[1,"va-file-input-multiple",{label:[1],name:[1],required:[4],accept:[1],errors:[16],encrypted:[16],hint:[1],enableAnalytics:[4,"enable-analytics"],headerSize:[2,"header-size"],value:[16],readOnly:[4,"read-only"],slotFieldIndexes:[16],files:[32],valueAdded:[32]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-file-input-multiple","va-button","va-button-icon","va-card","va-file-input","va-icon","va-modal","va-progress-bar","va-text-input"].forEach((e=>{switch(e){case"va-file-input-multiple":customElements.get(e)||customElements.define(e,VaFileInputMultiple$1);break;case"va-button":customElements.get(e)||defineCustomElement$9();break;case"va-button-icon":customElements.get(e)||defineCustomElement$8();break;case"va-card":customElements.get(e)||defineCustomElement$7();break;case"va-file-input":customElements.get(e)||defineCustomElement$6();break;case"va-icon":customElements.get(e)||defineCustomElement$5();break;case"va-modal":customElements.get(e)||defineCustomElement$4();break;case"va-progress-bar":customElements.get(e)||defineCustomElement$3();break;case"va-text-input":customElements.get(e)||defineCustomElement$2()}}))}const VaFileInputMultiple=VaFileInputMultiple$1,defineCustomElement=defineCustomElement$1;export{VaFileInputMultiple,defineCustomElement};
|
|
1
|
+
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import"./i18n-setup.js";import"./contacts.js";import{d as defineCustomElement$9}from"./va-button2.js";import{d as defineCustomElement$8}from"./va-button-icon2.js";import{d as defineCustomElement$7}from"./va-card2.js";import{d as defineCustomElement$6}from"./va-file-input2.js";import{d as defineCustomElement$5}from"./va-icon2.js";import{d as defineCustomElement$4}from"./va-modal2.js";import{d as defineCustomElement$3}from"./va-progress-bar2.js";import{d as defineCustomElement$2}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const vaFileInputMultipleCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}@import \'~@department-of-veterans-affairs/css-library/dist/stylesheets/base/headings.css\';:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}[hidden]{display:none}:host{display:block;font-family:var(--font-source-sans);font-size:16.96px;}:host .label-header{color:var(--vads-color-base);font-weight:var(--font-weight-normal)}:host .label-header-tag{margin:0;display:inline-block}:host .file-input-wrapper{display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host .file-input{cursor:pointer;height:100%;width:100%;max-width:none;top:0;left:0;z-index:1;margin:0;position:absolute;text-indent:-999em;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target{border:1px dashed var(--vads-color-action-border-base-active-on-dark);display:block;margin-top:0.3125rem;position:relative;text-align:center;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target.file-input-target-error{border:2px dashed var(--vads-color-secondary-dark)}:host .file-input-box{background:var(--vads-color-white);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:2}:host .file-input-instructions{font-size:1.06rem;padding:1.25rem 0.625rem;pointer-events:none;position:relative;z-index:3}:host .file-input-choose-text{color:var(--vads-color-link);text-decoration:underline;font-weight:var(--font-weight-normal)}:host .file-icon{color:var(--vads-color-primary-alt-darkest)}:host .selected-files-wrapper{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light)}:host .selected-files-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;border-bottom:1px solid var(--vads-color-white);margin-bottom:8px;padding:8px}:host .va-card{margin:8px}:host .file-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;padding:0 8px;display:block;width:100%;word-wrap:break-word;word-break:break-word;overflow:hidden}:host #input-error-message{padding:0 8px;width:100%}:host .file-size-label,:host .file-status-label{color:var(--vads-color-base-dark);font-weight:var(--font-weight-normal);font-size:1.06rem;padding:0 8px;display:block}:host .file-status-label{font-style:italic}:host .file-info-section{padding:0 8px 8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .file-button-section{margin-top:8px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:row;flex-direction:row}:host .file-button-section>va-button-icon{font-size:1.06rem}@media screen and (max-width: 320px){:host .file-button-section{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}:host .separator{border:0;border-top:1px solid var(--vads-color-base-lighter);margin:0}:host .vads-u-line-height--2{line-height:1.15}:host .thumbnail-container{height:40px;width:40px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .thumbnail-preview{max-width:40px;width:auto;max-height:40px;height:auto}:host .thumbnail-error{color:#b21d38}:host va-progress-bar{font-size:var(--vads-font-size-root);display:block;margin-left:16px}:host .uploading-status{font-style:var(--font-style-italic)}:host(.has-error){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host(.has-error){margin-left:-0.9rem}}.required{color:var(--vads-color-secondary-dark);margin-left:0.25rem}h1 .required,h2 .required,h3 .required,h4 .required,h5 .required,h6 .required{font-family:var(--font-source-sans);font-size:initial;font-weight:initial}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}:host.has-error{border-left:0.25rem solid #b50909;padding-left:1rem}:host .outer-wrap{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light);display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host va-file-input.no-file{margin:0 8px}:host va-file-input:not(:last-child){border-bottom:1px solid var(--vads-color-white)}:host va-file-input.has-error{border-left:none;padding-left:0}@media screen and (min-width: 1008px){:host va-file-input.has-error{margin-left:0}}',VaFileInputMultipleStyle0=vaFileInputMultipleCss,VaFileInputMultiple$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.vaMultipleChange=createEvent(this,"vaMultipleChange",7),this.fileKeyCounter=0,this.additionalSlot=null,this.additionalFileUploadMessage=h("span",null,"Drag an additional file here or"," ",h("span",{class:"file-input-choose-text"},"choose from folder")),this.renderLabelOrHeader=(e,t,i)=>{const o=t?h("span",{class:"required"}," ",instance.t("required")):null;return i&&i>=1&&i<=6?h("div",{class:"label-header"},h(`h${i}`,{htmlFor:"fileInputField",part:"label",class:"label-header-tag"},e,o)):h("div",{class:"label-header"},h("span",{part:"label",class:"usa-label"},e),o)},this.addValueFiles=async()=>(this.files.shift(),this.value.forEach((e=>{this.files.push({file:e,key:this.fileKeyCounter,content:this.getAdditionalContent()||null}),this.fileKeyCounter++})),this.readOnly||this.files.push({file:null,key:this.fileKeyCounter,content:null}),this.valueAdded=!0,Promise.resolve()),this.hasErrors=()=>this.errors.some((e=>!!e)),this.label=void 0,this.name=void 0,this.required=!1,this.accept=void 0,this.errors=[],this.encrypted=[],this.hint=void 0,this.enableAnalytics=!1,this.headerSize=void 0,this.value=void 0,this.readOnly=!1,this.slotFieldIndexes=null,this.files=[{key:0,file:null,content:null}],this.valueAdded=!1}findFileByKey(e){return this.files.find((t=>t.key===e))}findIndexByKey(e){return this.files.indexOf(this.files.find((t=>t.key===e)))}isEmpty(){return null===this.files[0].file}setSlotContent(){const e=this.el.shadowRoot.querySelector("slot");this.additionalSlot||(this.additionalSlot=e?e.assignedElements({flatten:!0}):[]),null==e||e.remove()}getAdditionalContent(){return this.additionalSlot&&this.additionalSlot.map((e=>e.cloneNode(!0)))}handleChange(e,t,i){const o=e.detail.files[0];let s,r,a;if(o){const e=this.findFileByKey(t);e.file?(r="FILE_UPDATED",a=o,e.file=o):(r="FILE_ADDED",a=o,e.file=o,e.content=this.getAdditionalContent(),this.fileKeyCounter++,this.files.push({file:null,key:this.fileKeyCounter,content:null})),s=this.buildFilesArray(this.files,!1,this.findIndexByKey(t))}else{r="FILE_REMOVED",a=this.files[i].file,this.files.splice(i,1);const e=this.el.shadowRoot.querySelector("#statusMessage");e.textContent="",setTimeout((()=>{e.textContent="File removed."}),1e3),s=this.buildFilesArray(this.files,!0)}const n={action:r,file:a,state:s};this.vaMultipleChange.emit(n),this.files=Array.of(...this.files)}handlePasswordChange(e,t){const i=this.findFileByKey(t);i.password=e.detail.password;const o=this.buildFilesArray(this.files,!1,this.findIndexByKey(t)),s={action:"PASSWORD_UPDATE",file:i.file,state:o};this.vaMultipleChange.emit(s)}buildFilesArray(e,t,i){let o=e.filter((e=>!!e.file)).map((e=>({file:e.file,changed:!1,password:e.password})));return!t&&o[i]&&(o[i].changed=!0),o}componentDidRender(){const e=this.el.shadowRoot.querySelectorAll("va-file-input");return this.setSlotContent(),e.forEach(((e,t)=>{!this.files[t].content||this.slotFieldIndexes&&!this.slotFieldIndexes.includes(t)||this.files[t].content.forEach((t=>e.append(t)))})),this.value&&this.value.length&&!this.valueAdded?this.addValueFiles():Promise.resolve()}render(){const{label:e,required:t,headerSize:i,hint:o,files:s,name:r,accept:a,errors:n,encrypted:l,enableAnalytics:d,readOnly:m}=this,f=this.isEmpty()?"":"outer-wrap",u=this.hasErrors()?"has-error":"";return h(Host,{key:"0156ba46fb8380ea7a1f31a936eed8c07816b05b",class:u},e&&!m&&this.renderLabelOrHeader(e,t,i),o&&!m&&h("div",{key:"74964bef97bbb0efa13429c3828b09b0f4387068",class:"usa-hint",id:"input-hint-message"},o),h("div",{key:"71854dad83b75dd540d8e938a8b16b8f4f822139",class:f},h("div",{key:"d51b60a006dedbd083ddb7bc6605f7b274321cb5",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),!this.isEmpty()&&h("div",{key:"dec914be713c5aca6887b071285a82d48124864e",class:"selected-files-label"},m?"Files you uploaded":"Selected files"),s.map(((i,s)=>h("va-file-input",Object.assign({key:i.key,headless:!0,label:e,hint:o,name:`${r}-${i.key}`,accept:a,required:t},s>0?{uploadMessage:this.additionalFileUploadMessage}:{},{error:n[s],encrypted:l[s],onVaChange:e=>this.handleChange(e,i.key,s),onVaPasswordChange:e=>this.handlePasswordChange(e,i.key),"enable-analytics":d,value:i.file,readOnly:m,class:i.file?"has-file":"no-file"}))))),h("slot",{key:"c1265273819fa699a082158a09f854c4a10ceac7"}))}get el(){return this}static get style(){return VaFileInputMultipleStyle0}},[1,"va-file-input-multiple",{label:[1],name:[1],required:[4],accept:[1],errors:[16],encrypted:[16],hint:[1],enableAnalytics:[4,"enable-analytics"],headerSize:[2,"header-size"],value:[16],readOnly:[4,"read-only"],slotFieldIndexes:[16],files:[32],valueAdded:[32]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-file-input-multiple","va-button","va-button-icon","va-card","va-file-input","va-icon","va-modal","va-progress-bar","va-text-input"].forEach((e=>{switch(e){case"va-file-input-multiple":customElements.get(e)||customElements.define(e,VaFileInputMultiple$1);break;case"va-button":customElements.get(e)||defineCustomElement$9();break;case"va-button-icon":customElements.get(e)||defineCustomElement$8();break;case"va-card":customElements.get(e)||defineCustomElement$7();break;case"va-file-input":customElements.get(e)||defineCustomElement$6();break;case"va-icon":customElements.get(e)||defineCustomElement$5();break;case"va-modal":customElements.get(e)||defineCustomElement$4();break;case"va-progress-bar":customElements.get(e)||defineCustomElement$3();break;case"va-text-input":customElements.get(e)||defineCustomElement$2()}}))}const VaFileInputMultiple=VaFileInputMultiple$1,defineCustomElement=defineCustomElement$1;export{VaFileInputMultiple,defineCustomElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,createEvent,h,forceUpdate,Host,Fragment}from"@stencil/core/internal/client";import"./i18n-setup.js";import"./contacts.js";import{s as selectOrMatches,S as Sanitizer}from"./utils.js";import{d as defineCustomElement$7}from"./va-button2.js";import{d as defineCustomElement$6}from"./va-button-icon2.js";import{d as defineCustomElement$5}from"./va-card2.js";import{d as defineCustomElement$4}from"./va-icon2.js";import{d as defineCustomElement$3}from"./va-modal2.js";import{d as defineCustomElement$2}from"./va-progress-bar2.js";import{d as defineCustomElement$1}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const PREFIX="usa",DROPZONE_CLASS="usa-file-input",DROPZONE=`.${DROPZONE_CLASS}`,INPUT_CLASS="usa-file-input__input",TARGET_CLASS="usa-file-input__target",INPUT=`.${INPUT_CLASS}`,BOX_CLASS="usa-file-input__box",INSTRUCTIONS_CLASS="usa-file-input__instructions",PREVIEW_CLASS="usa-file-input__preview",PREVIEW_HEADING_CLASS="usa-file-input__preview-heading",DISABLED_CLASS="usa-file-input--disabled",CHOOSE_CLASS="usa-file-input__choose",ACCEPTED_FILE_MESSAGE_CLASS="usa-file-input__accepted-files-message",DRAG_TEXT_CLASS="usa-file-input__drag-text",DRAG_CLASS="usa-file-input--drag",LOADING_CLASS="is-loading",INVALID_FILE_CLASS="has-invalid-file",GENERIC_PREVIEW_CLASS_NAME="usa-file-input__preview-image",GENERIC_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--generic`,PDF_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--pdf`,WORD_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--word`,VIDEO_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--video`,EXCEL_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--excel`,SR_ONLY_CLASS="usa-sr-only",SPACER_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";let TYPE_IS_VALID=Boolean(!0),DEFAULT_ARIA_LABEL_TEXT="",DEFAULT_FILE_STATUS_TEXT="";const getFileInputContext=e=>{const t=e.closest(DROPZONE);if(!t)throw new Error(`Element is missing outer ${DROPZONE}`);const a=t.querySelector(INPUT);return{dropZoneEl:t,inputEl:a}},disable=e=>{const{dropZoneEl:t,inputEl:a}=getFileInputContext(e);a.disabled=!0,t.classList.add(DISABLED_CLASS)},ariaDisable=e=>{const{dropZoneEl:t}=getFileInputContext(e);t.classList.add(DISABLED_CLASS)},enable=e=>{const{dropZoneEl:t,inputEl:a}=getFileInputContext(e);a.disabled=!1,t.classList.remove(DISABLED_CLASS),t.removeAttribute("aria-disabled")},replaceName=e=>{const t=e.charCodeAt(0);return 32===t?"-":t>=65&&t<=90?`img_${e.toLowerCase()}`:`__000${t.toString(16).slice(-4)}`},makeSafeForID=e=>e.replace(/[^a-z0-9]/g,replaceName),createUniqueID=e=>`${e}-${Math.floor(Date.now()/1e3)}`,getItemsLabel=e=>e.hasAttribute("multiple")?"files":"file",createTargetArea=e=>{const t=document.createElement("div"),a=document.createElement("div"),i=document.createElement("div");return e.classList.remove(DROPZONE_CLASS),e.classList.add(INPUT_CLASS),t.classList.add(DROPZONE_CLASS),i.classList.add(BOX_CLASS),a.classList.add(TARGET_CLASS),a.prepend(i),e.parentNode.insertBefore(a,e),e.parentNode.insertBefore(t,a),a.appendChild(e),t.appendChild(a),a},createVisibleInstructions=e=>{const t=e.closest(DROPZONE),a=getItemsLabel(e),i=document.createElement("div"),s=`Drag ${a} here or`,r="choose from folder";return DEFAULT_ARIA_LABEL_TEXT=`${s} ${r}`,i.classList.add(INSTRUCTIONS_CLASS),i.setAttribute("aria-hidden","true"),e.setAttribute("aria-label",DEFAULT_ARIA_LABEL_TEXT),i.innerHTML=Sanitizer.escapeHTML(`<span class="${DRAG_TEXT_CLASS}">${s}</span> <span class="${CHOOSE_CLASS}">${r}</span>`),e.parentNode.insertBefore(i,e),(/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.querySelector(`.${DRAG_TEXT_CLASS}`).outerHTML=""),i},createSROnlyStatus=e=>{const t=document.createElement("div"),a=getItemsLabel(e),i=e.closest(DROPZONE),s=e.closest(`.${TARGET_CLASS}`);DEFAULT_FILE_STATUS_TEXT=`No ${a} selected.`,t.classList.add("usa-sr-only"),t.setAttribute("aria-live","polite"),t.textContent=DEFAULT_FILE_STATUS_TEXT,i.insertBefore(t,s)},enhanceFileInput=e=>{const t=e.hasAttribute("aria-disabled")||e.hasAttribute("disabled"),a=createTargetArea(e),i=createVisibleInstructions(e),{dropZoneEl:s}=getFileInputContext(e);return t?s.classList.add(DISABLED_CLASS):createSROnlyStatus(e),{instructions:i,dropTarget:a}},removeOldPreviews=(e,t)=>{const a=e.querySelectorAll(`.${PREVIEW_CLASS}`),i=e.querySelector(`.${PREVIEW_HEADING_CLASS}`),s=e.querySelector(`.${ACCEPTED_FILE_MESSAGE_CLASS}`);i&&(i.outerHTML=""),s&&(s.outerHTML="",e.classList.remove("has-invalid-file")),null!==a&&(t&&t.removeAttribute("hidden"),Array.prototype.forEach.call(a,(e=>{e.parentNode.removeChild(e)})))},updateStatusMessage=(e,t,a)=>{const i=e;let s=DEFAULT_FILE_STATUS_TEXT;1===t.length?s=`You have selected the file: ${a}`:t.length>1&&(s=`You have selected ${t.length} files: ${a.join(", ")}`),setTimeout((()=>{i.textContent=s}),1e3)},addPreviewHeading=(e,t)=>{const a=document.createElement("div"),i=e.closest(`.${TARGET_CLASS}`),s=i.querySelector(`.${INSTRUCTIONS_CLASS}`);let r="Change file",o="";1===t.length?o=Sanitizer.escapeHTML(`Selected file <span class="usa-file-input__choose">${r}</span>`):t.length>1&&(r="Change files",o=Sanitizer.escapeHTML(`${t.length} files selected <span class="usa-file-input__choose">${r}</span>`)),s.setAttribute("hidden","true"),a.classList.add(PREVIEW_HEADING_CLASS),a.innerHTML=o,i.insertBefore(a,s),e.setAttribute("aria-label",r)},handleChange=(e,t,a,i)=>{const s=t.getAttribute("multiple")?e.target.files:[e.target.files[0]],r=i.closest(`.${DROPZONE_CLASS}`).querySelector(".usa-sr-only"),o=[];removeOldPreviews(i,a);for(let e=0;e<s.length;e+=1){const t=new FileReader,r=s[e].name;let n;o.push(r),t.onloadstart=function(){n=createUniqueID(makeSafeForID(r)),a.insertAdjacentHTML("afterend",Sanitizer.escapeHTML(`<div class="${PREVIEW_CLASS}" aria-hidden="true">\n <img id="${n}" src="${SPACER_GIF}" alt="" class="${GENERIC_PREVIEW_CLASS_NAME} is-loading"/>${r}\n <div>`))},t.onloadend=function(){const e=i.querySelector(`#${n}`);r.indexOf(".pdf")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${PDF_PREVIEW_CLASS}")`):r.indexOf(".doc")>0||r.indexOf(".pages")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${WORD_PREVIEW_CLASS}")`):r.indexOf(".xls")>0||r.indexOf(".numbers")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${EXCEL_PREVIEW_CLASS}")`):r.indexOf(".mov")>0||r.indexOf(".mp4")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${VIDEO_PREVIEW_CLASS}")`):e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${GENERIC_PREVIEW_CLASS}")`),e.classList.remove("is-loading"),e.src=t.result},s[e]&&t.readAsDataURL(s[e])}0===s.length?t.setAttribute("aria-label",DEFAULT_ARIA_LABEL_TEXT):addPreviewHeading(t,s),updateStatusMessage(r,s,o)},preventInvalidFiles=(e,t,a,i)=>{const s=t.getAttribute("accept");i.classList.remove("has-invalid-file");const r=(e,t)=>{let a=!1;return e.indexOf(t)>=0&&(a=!0),a};if(s){const o=s.split(","),n=document.createElement("div");let l=!0;const d=e.target.files||e.dataTransfer.files;for(let e=0;e<d.length;e+=1){const t=d[e];if(!l)break;for(let e=0;e<o.length;e+=1){const a=o[e];if(l=t.name.indexOf(a)>0||r(t.type,a.replace(/\*/g,"")),l){TYPE_IS_VALID=!0;break}}}l||(removeOldPreviews(i,a),t.value="",i.insertBefore(n,t),n.textContent=t.dataset.errormessage||"This is not a valid file type.",n.classList.add(ACCEPTED_FILE_MESSAGE_CLASS),i.classList.add("has-invalid-file"),TYPE_IS_VALID=!1,e.preventDefault(),e.stopPropagation())}},handleUpload=(e,t,a,i)=>{preventInvalidFiles(e,t,a,i),!0===TYPE_IS_VALID&&handleChange(e,t,a,i)},fileInput={init(e){selectOrMatches(DROPZONE,e).forEach((e=>{const{instructions:t,dropTarget:a}=enhanceFileInput(e);a.addEventListener("dragover",(function(){this.classList.add(DRAG_CLASS)}),!1),a.addEventListener("dragleave",(function(){this.classList.remove(DRAG_CLASS)}),!1),a.addEventListener("drop",(function(i){i.preventDefault(),this.classList.remove(DRAG_CLASS);const s=i.dataTransfer;if(i.target.files=s.files,s.files.length>1)return;handleUpload(i,e,t,a);const r=new CustomEvent("change",{detail:{files:s.files}});e.dispatchEvent(r)}),!1),e.addEventListener("input",(i=>handleUpload(i,e,t,a)),!1)}))},teardown(e){selectOrMatches(INPUT,e).forEach((e=>{const t=e.parentElement.parentElement;t.parentElement.replaceChild(e,t),e.className=DROPZONE_CLASS}))},getFileInputContext:getFileInputContext,disable:disable,ariaDisable:ariaDisable,enable:enable},extensionToMimeType={".txt":"text/plain",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".odt":"application/vnd.oasis.opendocument.text",".rtf":"application/rtf",".csv":"text/csv",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".bmp":"image/bmp",".webp":"image/webp",".tif":"image/tiff",".tiff":"image/tiff",".svg":"image/svg+xml",".mp3":"audio/mpeg",".wav":"audio/wav",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".flv":"video/x-flv",".mkv":"video/x-matroska",".webm":"video/webm",".zip":"application/zip",".rar":"application/x-rar-compressed",".7z":"application/x-7z-compressed",".tar":"application/x-tar",".gz":"application/gzip",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript"},vaFileInputCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}[hidden]{display:none}:host{display:block;font-family:var(--font-source-sans);font-size:16.96px;}:host .label-header{color:var(--vads-color-base);font-weight:var(--font-weight-normal)}:host .label-header-tag{margin:0;display:inline-block}:host .file-input-wrapper{display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host .file-input{cursor:pointer;height:100%;width:100%;max-width:none;top:0;left:0;z-index:1;margin:0;position:absolute;text-indent:-999em;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target{border:1px dashed var(--vads-color-action-border-base-active-on-dark);display:block;margin-top:0.3125rem;position:relative;text-align:center;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target.file-input-target-error{border:2px dashed var(--vads-color-secondary-dark)}:host .file-input-box{background:var(--vads-color-white);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:2}:host .file-input-instructions{font-size:1.06rem;padding:1.25rem 0.625rem;pointer-events:none;position:relative;z-index:3}:host .file-input-choose-text{color:var(--vads-color-link);text-decoration:underline;font-weight:var(--font-weight-normal)}:host .file-icon{color:var(--vads-color-primary-alt-darkest)}:host .selected-files-wrapper{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light)}:host .selected-files-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;border-bottom:1px solid var(--vads-color-white);margin-bottom:8px;padding:8px}:host .va-card{margin:8px}:host .file-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;padding:0 8px;display:block;width:100%;word-wrap:break-word;word-break:break-word;overflow:hidden}:host #input-error-message{padding:0 8px;width:100%}:host .file-size-label,:host .file-status-label{color:var(--vads-color-base-dark);font-weight:var(--font-weight-normal);font-size:1.06rem;padding:0 8px;display:block}:host .file-status-label{font-style:italic}:host .file-info-section{padding:0 8px 8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .file-button-section{margin-top:8px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:row;flex-direction:row}:host .file-button-section>va-button-icon{font-size:1.06rem}@media screen and (max-width: 320px){:host .file-button-section{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}:host .separator{border:0;border-top:1px solid var(--vads-color-base-lighter);margin:0}:host .vads-u-line-height--2{line-height:1.15}:host .thumbnail-container{height:40px;width:40px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .thumbnail-preview{max-width:40px;width:auto;max-height:40px;height:auto}:host .thumbnail-error{color:#b21d38}:host va-progress-bar{font-size:var(--vads-font-size-root);display:block;margin-left:16px}:host .uploading-status{font-style:var(--font-style-italic)}:host(.has-error){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host(.has-error){margin-left:-0.9rem}}.required{color:var(--vads-color-secondary-dark);margin-left:0.25rem}h1 .required,h2 .required,h3 .required,h4 .required,h5 .required,h6 .required{font-family:var(--font-source-sans);font-size:initial;font-weight:initial}',VaFileInputStyle0=vaFileInputCss,VaFileInput=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.vaChange=createEvent(this,"vaChange",7),this.vaPasswordChange=createEvent(this,"vaPasswordChange",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.uploadStatus="idle",this.chooseFileString="choose from folder",this.dragFileString="Drag a file here or ",this.handleChange=e=>{this.resetVisualState=!1;const t=e.target;t.files&&t.files.length>0&&this.handleFile(t.files[0]),t.value=""},this.handleDrop=e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer.files;t.length>0&&this.handleFile(t[0])},this.handleFile=(e,t=!0)=>{if(this.accept){const t=this.normalizeAcceptProp(this.accept);if(!this.isAcceptedFileType(e.type,t))return this.removeFile(!1),void(this.internalError="This is not a valid file type.")}if(e.size>this.maxFileSize)return this.internalError=`\n We can't upload your file because it's too big. Files must be less than ${this.formatFileSize(this.maxFileSize)}.`,this.fileContents=null,void(this.uploadStatus="idle");this.uploadedFile=null,this.file=e,t&&this.vaChange.emit({files:[this.file]}),this.uploadStatus="success",this.internalError=null,this.generateFileContents(this.file),this.updateStatusMessage(`You have selected the file: ${this.file.name}`),this.el.focus(),this.enableAnalytics&&this.componentLibraryAnalytics.emit({componentName:"va-file-input",action:"change",details:{label:this.label}})},this.removeFile=(e=!0)=>{this.closeModal(),this.uploadStatus="idle",this.internalError=null,e&&this.vaChange.emit({files:[]}),this.file=null,this.uploadedFile=null,this.updateStatusMessage("File removed. No file selected."),this.el.focus()},this.openModal=()=>{this.el.shadowRoot.querySelector("va-modal").setAttribute("status","warning"),this.showModal=!0},this.closeModal=()=>{this.showModal=!1,setTimeout((()=>{this.fileInputRef.focus()}),0)},this.changeFile=()=>{this.fileInputRef&&this.fileInputRef.click()},this.formatFileSize=e=>{const t=["B","KB","MB","GB","TB"];if(0===e)return"0 B";const a=Math.floor(Math.log(e)/Math.log(1024));return 0===a?`${e} ${t[a]}`:`${(e/Math.pow(1024,a)).toFixed(a<2?0:1)} ${t[a]}`},this.normalizeAcceptProp=e=>e.split(",").map((e=>(e=e.trim()).startsWith(".")?extensionToMimeType[e]:e)),this.isAcceptedFileType=(e,t)=>{for(const a of t){if(a===e)return!0;if(a.endsWith("/*")&&e.startsWith(a.slice(0,-1)))return!0}return!1},this.renderLabelOrHeader=(e,t,a)=>{const i=t?h("span",{class:"required"}," ",instance.t("required")):null;return h("div",{class:"label-header"},a&&a>=1&&a<=6?h(`h${a}`,{htmlFor:"fileInputField",part:"label",class:"label-header-tag"},e,i):h("label",{htmlFor:"fileInputField",part:"label",class:"usa-label"},e,i))},this.file=void 0,this.fileContents=void 0,this.internalError=void 0,this.showModal=!1,this.showSeparator=!0,this.label=void 0,this.name=void 0,this.buttonText=void 0,this.value=void 0,this.required=!1,this.accept=void 0,this.error=void 0,this.hint=void 0,this.statusText=void 0,this.uploadMessage=null,this.enableAnalytics=!1,this.headerSize=void 0,this.headless=!1,this.readOnly=!1,this.encrypted=!1,this.uploadedFile=void 0,this.maxFileSize=1/0,this.percentUploaded=null,this.passwordError=void 0,this.resetVisualState=!1}handleValueChange(e){setTimeout((()=>{this.updateStatusMessage(e)}))}percentHandler(e){e>=100&&this.resetState()}handleError(e){e&&this.resetState()}resetState(){this.fileContents=null,this.uploadStatus="idle",this.percentUploaded=null,forceUpdate(this.el)}updateStatusMessage(e){setTimeout((()=>{const t=this.el.shadowRoot.querySelector("#statusMessage");t&&(t.textContent=e)}),1e3)}generateFileContents(e){if(!e)return;const t=new FileReader;this.fileType=e.type,t.onloadend=()=>{this.fileContents=t.result},this.fileType&&("application/pdf"===this.fileType||this.fileType.startsWith("image/"))&&t.readAsDataURL(e)}componentWillRender(){const e=!!this.el.querySelector(":scope > *"),t=!(!this.value&&!this.file||this.readOnly);this.showSeparator=e||t}componentDidLoad(){fileInput.init(this.el)}connectedCallback(){this.el.addEventListener("change",this.handleChange)}disconnectedCallback(){this.el.removeEventListener("change",this.handleChange)}getDefaultUploadMessage(){return h("span",null,this.dragFileString,h("span",{class:"file-input-choose-text"},this.chooseFileString))}handlePasswordChange(e){this.vaPasswordChange.emit({password:e.target.value})}render(){const{label:e,name:t,required:a,accept:i,error:s,hint:r,file:o,uploadStatus:n,dragFileString:l,chooseFileString:d,uploadMessage:c,headerSize:p,fileContents:f,fileType:u,headless:m,value:b,readOnly:g,encrypted:v,statusText:S,uploadedFile:E,percentUploaded:A,passwordError:C,resetVisualState:_}=this;b&&!this.file&&this.handleFile(b,!1);const x=s||this.internalError,y=`${r?"input-hint-message":""} ${x?"input-error-message":""}`.trim()||null,L=("file-input-target "+(x?"file-input-target-error":"")).trim();let w=h("div",{key:"53a79bdafa997eff9f88b266d757b2f341d1d7d5",class:"thumbnail-container"},h("svg",{key:"b928660298751158bc09645da1bc58cd6fde63db",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"#07648d",width:"40px",height:"40px"},h("path",{key:"89a659b6922543b557bf963361d2311eb2ca4d92",d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"})));s?w=h("div",{key:"52909e339e01e7e3e91a3fc819e416ab9b096b30",class:"thumbnail-container"},h("va-icon",{key:"46bd4685280ac5a20f3972e4ba2fd63479d0da4e",icon:"error",size:3,class:"thumbnail-preview thumbnail-error"})):f&&(u.startsWith("image/")?w=h("div",{key:"f3d0682fffcc8645f41403d106f5fad66fafcfd2",class:"thumbnail-container","aria-hidden":"true"},h("img",{key:"6375a7ce3b42a70cbd208754522796e6d5609ba6",class:"thumbnail-preview",src:f,alt:"image"})):"application/pdf"===u&&(w=h("div",{key:"5ec20758a6565d78d69bf435dd2e40df8fca7778",class:"thumbnail-container","aria-hidden":"true"},h("object",{key:"80477aee2978919a46956e0d0885aeabc64a6189",class:"thumbnail-preview",data:f,type:"application/pdf"}))));let T=m?"headless-selected-files-wrapper":"selected-files-wrapper";const I="usa-hint"+(m?" usa-sr-only":""),R=null!==A&&A<100;let F="file-status-label";return R&&(F=`${F} uploading-status`),h(Host,{key:"8c2583b4b1c929a80905218663eebdeb3418235e",class:{"has-error":!!x}},!g&&h("span",{key:"276cbc15642f1f449c74d5143e70a97606766b90",class:{"usa-sr-only":!!m}},e&&this.renderLabelOrHeader(e,a,p)),r&&!g&&h("div",{key:"f404434b12e0eb1a531194adb91a2d37cd07939b",class:I,id:"input-hint-message"},r),h("div",{key:"0a4794667319ac9e7e620d292a0af476725de7e2",class:"file-input-wrapper",onDrop:this.handleDrop},h("input",{key:"14dbb417f448e3d6d19897abf2cf6aa584b03529",id:"fileInputField",class:"file-input","aria-label":`${e}${a?" "+instance.t("required"):""}. ${l}${d}`,style:{visibility:"success"===this.uploadStatus||E?"hidden":"unset"},type:"file",ref:e=>this.fileInputRef=e,name:t,accept:i,"aria-describedby":y,onChange:this.handleChange}),"idle"===n&&(!E||_)&&h("div",{key:"8cb9873e85db8c87fb1fdc57025e9008cfe34045"},h("span",{key:"653da3b81d9890d146a23a6caea299ba5a91a177",id:"file-input-error-alert",role:"alert"},x&&h(Fragment,{key:"6039b0e92253a68af7842d1d31f2b89eae2b10fc"},h("span",{key:"3277ea3bfef43067ceb4145e7bd3cde5efead155",class:"usa-sr-only"},instance.t("error")),h("span",{key:"d884a2be6d46ffc65375f8578b4114a8dbb4182d",class:"usa-error-message"},x))),h("div",{key:"eb1839fe9dc8c6cf86c84e1d502574309f900a1c",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),h("div",{key:"792f905650577e6ecb79f5af24085cfa1503ae6c",class:L},h("div",{key:"473985ba6ccb053070379463bd62ecde353c6167",class:"file-input-box"}),h("div",{key:"6a68c2a80f912defb459ad81ab8e5ebf625a20ae",class:"file-input-instructions"},c||this.getDefaultUploadMessage()))),!_&&("idle"!==n||E)&&h("div",{key:"b230da1f10d04febd6d2105b3547dd3ac863b51b",class:T},!m&&h("div",{key:"8b1ee14de184f900ebeea749118fe04dd7b9ecf1",class:"selected-files-label"},g?"Files you uploaded":"Selected files"),h("div",{key:"9065b6d54a047bfe710501238b608f415812b12b",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),h("va-card",{key:"4281756e43b82ebe4040a49403c766a99d66daa1",class:"va-card"},h("div",{key:"0d0c0f0f4d3ac469e9f6ef38fa385bd3ad0075cc",class:"file-info-section"},w,h("div",{key:"1421bf02a06c532a755f71f1c09813d9ba4638ba",class:"file-info-group vads-u-line-height--2"},h("span",{key:"9a14d6ed1b93bfa832bdb49a070d13bda7c71ec4",class:"file-label"},o?o.name:E.name),x&&h("span",{key:"df20ad43b92863a75015c451ed342b0a3c6fa1c5",id:"input-error-message",role:"alert"},h("span",{key:"04bc84bc7dcbd95daca3c0692c4c12da7a665226",class:"usa-sr-only"},instance.t("error")),h("span",{key:"58f56bbf30fee89b2dbfe4cc295b099544b839ca","aria-live":"polite",class:"usa-error-message"},x)),!R&&h("span",{key:"506590a78d2e893374d49fbf4ef6804577bcb84a",class:"file-size-label"},this.formatFileSize(o?o.size:E.size)),h("span",{key:"ad91249a927c29d03310ff3118420b6a0c49588b",class:F,"aria-live":"polite"},R?"Uploading...":S))),(o||b||E)&&h("div",{key:"c2e60ac5986e655c6246bddda02786390907ae65"},this.showSeparator&&h("hr",{key:"65655bb6f00c3fac24e15b61aee8c50baddfb84f",class:"separator"}),v&&h("va-text-input",{key:"af58d080a3c3efe7accb7d6689e789a213a1ac31",onInput:e=>{this.handlePasswordChange(e)},label:"File password",required:!0,error:C}),h("div",{key:"d600303f38cc0f6b7844648e63104d7600d16bd7",class:"additional-info-slot"},h("slot",{key:"fb34e4ea9c66622cfaff923d46f28458bf2eb29b"})),g?null:R?h(Fragment,null,h("va-progress-bar",{percent:A}),h("va-button-icon",{buttonType:"cancel",onClick:this.resetState.bind(this)})):h(Fragment,null,h("div",{class:"file-button-section"},h("va-button-icon",{buttonType:"change-file",onClick:this.changeFile,label:"Change file","aria-label":`change file ${o?o.name:E.name}`}),h("va-button-icon",{buttonType:"delete",onClick:this.openModal,"aria-label":`delete file ${o?o.name:E.name}`,label:"Delete"})),h("va-modal",{modalTitle:"Delete this file?",visible:this.showModal,primaryButtonText:"Yes, remove this",secondaryButtonText:"No, keep this",onCloseEvent:this.closeModal,onPrimaryButtonClick:()=>this.removeFile(!0),onSecondaryButtonClick:this.closeModal},"We'll delete the uploaded file"," ",h("span",{class:"file-label"},o?o.name:E.name))))))))}get el(){return this}static get watchers(){return{statusText:["handleValueChange"],percentUploaded:["percentHandler"],resetVisualState:["handleError"]}}static get style(){return VaFileInputStyle0}},[1,"va-file-input",{label:[1],name:[1],buttonText:[1,"button-text"],value:[16],required:[4],accept:[1],error:[1],hint:[1],statusText:[1,"status-text"],uploadMessage:[16],enableAnalytics:[4,"enable-analytics"],headerSize:[2,"header-size"],headless:[4],readOnly:[4,"read-only"],encrypted:[4],uploadedFile:[16],maxFileSize:[2,"max-file-size"],percentUploaded:[1026,"percent-uploaded"],passwordError:[1,"password-error"],resetVisualState:[1028,"reset-visual-state"],file:[32],fileContents:[32],internalError:[32],showModal:[32],showSeparator:[32]},void 0,{statusText:["handleValueChange"],percentUploaded:["percentHandler"],resetVisualState:["handleError"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-file-input","va-button","va-button-icon","va-card","va-icon","va-modal","va-progress-bar","va-text-input"].forEach((e=>{switch(e){case"va-file-input":customElements.get(e)||customElements.define(e,VaFileInput);break;case"va-button":customElements.get(e)||defineCustomElement$7();break;case"va-button-icon":customElements.get(e)||defineCustomElement$6();break;case"va-card":customElements.get(e)||defineCustomElement$5();break;case"va-icon":customElements.get(e)||defineCustomElement$4();break;case"va-modal":customElements.get(e)||defineCustomElement$3();break;case"va-progress-bar":customElements.get(e)||defineCustomElement$2();break;case"va-text-input":customElements.get(e)||defineCustomElement$1()}}))}export{VaFileInput as V,defineCustomElement as d};
|
|
1
|
+
import{proxyCustomElement,HTMLElement,createEvent,h,forceUpdate,Host,Fragment}from"@stencil/core/internal/client";import"./i18n-setup.js";import"./contacts.js";import{s as selectOrMatches,S as Sanitizer}from"./utils.js";import{d as defineCustomElement$7}from"./va-button2.js";import{d as defineCustomElement$6}from"./va-button-icon2.js";import{d as defineCustomElement$5}from"./va-card2.js";import{d as defineCustomElement$4}from"./va-icon2.js";import{d as defineCustomElement$3}from"./va-modal2.js";import{d as defineCustomElement$2}from"./va-progress-bar2.js";import{d as defineCustomElement$1}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const PREFIX="usa",DROPZONE_CLASS="usa-file-input",DROPZONE=`.${DROPZONE_CLASS}`,INPUT_CLASS="usa-file-input__input",TARGET_CLASS="usa-file-input__target",INPUT=`.${INPUT_CLASS}`,BOX_CLASS="usa-file-input__box",INSTRUCTIONS_CLASS="usa-file-input__instructions",PREVIEW_CLASS="usa-file-input__preview",PREVIEW_HEADING_CLASS="usa-file-input__preview-heading",DISABLED_CLASS="usa-file-input--disabled",CHOOSE_CLASS="usa-file-input__choose",ACCEPTED_FILE_MESSAGE_CLASS="usa-file-input__accepted-files-message",DRAG_TEXT_CLASS="usa-file-input__drag-text",DRAG_CLASS="usa-file-input--drag",LOADING_CLASS="is-loading",INVALID_FILE_CLASS="has-invalid-file",GENERIC_PREVIEW_CLASS_NAME="usa-file-input__preview-image",GENERIC_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--generic`,PDF_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--pdf`,WORD_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--word`,VIDEO_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--video`,EXCEL_PREVIEW_CLASS=`${GENERIC_PREVIEW_CLASS_NAME}--excel`,SR_ONLY_CLASS="usa-sr-only",SPACER_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";let TYPE_IS_VALID=Boolean(!0),DEFAULT_ARIA_LABEL_TEXT="",DEFAULT_FILE_STATUS_TEXT="";const getFileInputContext=e=>{const t=e.closest(DROPZONE);if(!t)throw new Error(`Element is missing outer ${DROPZONE}`);const i=t.querySelector(INPUT);return{dropZoneEl:t,inputEl:i}},disable=e=>{const{dropZoneEl:t,inputEl:i}=getFileInputContext(e);i.disabled=!0,t.classList.add(DISABLED_CLASS)},ariaDisable=e=>{const{dropZoneEl:t}=getFileInputContext(e);t.classList.add(DISABLED_CLASS)},enable=e=>{const{dropZoneEl:t,inputEl:i}=getFileInputContext(e);i.disabled=!1,t.classList.remove(DISABLED_CLASS),t.removeAttribute("aria-disabled")},replaceName=e=>{const t=e.charCodeAt(0);return 32===t?"-":t>=65&&t<=90?`img_${e.toLowerCase()}`:`__000${t.toString(16).slice(-4)}`},makeSafeForID=e=>e.replace(/[^a-z0-9]/g,replaceName),createUniqueID=e=>`${e}-${Math.floor(Date.now()/1e3)}`,getItemsLabel=e=>e.hasAttribute("multiple")?"files":"file",createTargetArea=e=>{const t=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div");return e.classList.remove(DROPZONE_CLASS),e.classList.add(INPUT_CLASS),t.classList.add(DROPZONE_CLASS),a.classList.add(BOX_CLASS),i.classList.add(TARGET_CLASS),i.prepend(a),e.parentNode.insertBefore(i,e),e.parentNode.insertBefore(t,i),i.appendChild(e),t.appendChild(i),i},createVisibleInstructions=e=>{const t=e.closest(DROPZONE),i=getItemsLabel(e),a=document.createElement("div"),s=`Drag ${i} here or`,r="choose from folder";return DEFAULT_ARIA_LABEL_TEXT=`${s} ${r}`,a.classList.add(INSTRUCTIONS_CLASS),a.setAttribute("aria-hidden","true"),e.setAttribute("aria-label",DEFAULT_ARIA_LABEL_TEXT),a.innerHTML=Sanitizer.escapeHTML(`<span class="${DRAG_TEXT_CLASS}">${s}</span> <span class="${CHOOSE_CLASS}">${r}</span>`),e.parentNode.insertBefore(a,e),(/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.querySelector(`.${DRAG_TEXT_CLASS}`).outerHTML=""),a},createSROnlyStatus=e=>{const t=document.createElement("div"),i=getItemsLabel(e),a=e.closest(DROPZONE),s=e.closest(`.${TARGET_CLASS}`);DEFAULT_FILE_STATUS_TEXT=`No ${i} selected.`,t.classList.add("usa-sr-only"),t.setAttribute("aria-live","polite"),t.textContent=DEFAULT_FILE_STATUS_TEXT,a.insertBefore(t,s)},enhanceFileInput=e=>{const t=e.hasAttribute("aria-disabled")||e.hasAttribute("disabled"),i=createTargetArea(e),a=createVisibleInstructions(e),{dropZoneEl:s}=getFileInputContext(e);return t?s.classList.add(DISABLED_CLASS):createSROnlyStatus(e),{instructions:a,dropTarget:i}},removeOldPreviews=(e,t)=>{const i=e.querySelectorAll(`.${PREVIEW_CLASS}`),a=e.querySelector(`.${PREVIEW_HEADING_CLASS}`),s=e.querySelector(`.${ACCEPTED_FILE_MESSAGE_CLASS}`);a&&(a.outerHTML=""),s&&(s.outerHTML="",e.classList.remove("has-invalid-file")),null!==i&&(t&&t.removeAttribute("hidden"),Array.prototype.forEach.call(i,(e=>{e.parentNode.removeChild(e)})))},updateStatusMessage=(e,t,i)=>{const a=e;let s=DEFAULT_FILE_STATUS_TEXT;1===t.length?s=`You have selected the file: ${i}`:t.length>1&&(s=`You have selected ${t.length} files: ${i.join(", ")}`),setTimeout((()=>{a.textContent=s}),1e3)},addPreviewHeading=(e,t)=>{const i=document.createElement("div"),a=e.closest(`.${TARGET_CLASS}`),s=a.querySelector(`.${INSTRUCTIONS_CLASS}`);let r="Change file",o="";1===t.length?o=Sanitizer.escapeHTML(`Selected file <span class="usa-file-input__choose">${r}</span>`):t.length>1&&(r="Change files",o=Sanitizer.escapeHTML(`${t.length} files selected <span class="usa-file-input__choose">${r}</span>`)),s.setAttribute("hidden","true"),i.classList.add(PREVIEW_HEADING_CLASS),i.innerHTML=o,a.insertBefore(i,s),e.setAttribute("aria-label",r)},handleChange=(e,t,i,a)=>{const s=t.getAttribute("multiple")?e.target.files:[e.target.files[0]],r=a.closest(`.${DROPZONE_CLASS}`).querySelector(".usa-sr-only"),o=[];removeOldPreviews(a,i);for(let e=0;e<s.length;e+=1){const t=new FileReader,r=s[e].name;let n;o.push(r),t.onloadstart=function(){n=createUniqueID(makeSafeForID(r)),i.insertAdjacentHTML("afterend",Sanitizer.escapeHTML(`<div class="${PREVIEW_CLASS}" aria-hidden="true">\n <img id="${n}" src="${SPACER_GIF}" alt="" class="${GENERIC_PREVIEW_CLASS_NAME} is-loading"/>${r}\n <div>`))},t.onloadend=function(){const e=a.querySelector(`#${n}`);r.indexOf(".pdf")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${PDF_PREVIEW_CLASS}")`):r.indexOf(".doc")>0||r.indexOf(".pages")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${WORD_PREVIEW_CLASS}")`):r.indexOf(".xls")>0||r.indexOf(".numbers")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${EXCEL_PREVIEW_CLASS}")`):r.indexOf(".mov")>0||r.indexOf(".mp4")>0?e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${VIDEO_PREVIEW_CLASS}")`):e.setAttribute("onerror",`this.onerror=null;this.src="${SPACER_GIF}"; this.classList.add("${GENERIC_PREVIEW_CLASS}")`),e.classList.remove("is-loading"),e.src=t.result},s[e]&&t.readAsDataURL(s[e])}0===s.length?t.setAttribute("aria-label",DEFAULT_ARIA_LABEL_TEXT):addPreviewHeading(t,s),updateStatusMessage(r,s,o)},preventInvalidFiles=(e,t,i,a)=>{const s=t.getAttribute("accept");a.classList.remove("has-invalid-file");const r=(e,t)=>{let i=!1;return e.indexOf(t)>=0&&(i=!0),i};if(s){const o=s.split(","),n=document.createElement("div");let l=!0;const d=e.target.files||e.dataTransfer.files;for(let e=0;e<d.length;e+=1){const t=d[e];if(!l)break;for(let e=0;e<o.length;e+=1){const i=o[e];if(l=t.name.indexOf(i)>0||r(t.type,i.replace(/\*/g,"")),l){TYPE_IS_VALID=!0;break}}}l||(removeOldPreviews(a,i),t.value="",a.insertBefore(n,t),n.textContent=t.dataset.errormessage||"This is not a valid file type.",n.classList.add(ACCEPTED_FILE_MESSAGE_CLASS),a.classList.add("has-invalid-file"),TYPE_IS_VALID=!1,e.preventDefault(),e.stopPropagation())}},handleUpload=(e,t,i,a)=>{preventInvalidFiles(e,t,i,a),!0===TYPE_IS_VALID&&handleChange(e,t,i,a)},fileInput={init(e){selectOrMatches(DROPZONE,e).forEach((e=>{const{instructions:t,dropTarget:i}=enhanceFileInput(e);i.addEventListener("dragover",(function(){this.classList.add(DRAG_CLASS)}),!1),i.addEventListener("dragleave",(function(){this.classList.remove(DRAG_CLASS)}),!1),i.addEventListener("drop",(function(a){a.preventDefault(),this.classList.remove(DRAG_CLASS);const s=a.dataTransfer;if(a.target.files=s.files,s.files.length>1)return;handleUpload(a,e,t,i);const r=new CustomEvent("change",{detail:{files:s.files}});e.dispatchEvent(r)}),!1),e.addEventListener("input",(a=>handleUpload(a,e,t,i)),!1)}))},teardown(e){selectOrMatches(INPUT,e).forEach((e=>{const t=e.parentElement.parentElement;t.parentElement.replaceChild(e,t),e.className=DROPZONE_CLASS}))},getFileInputContext:getFileInputContext,disable:disable,ariaDisable:ariaDisable,enable:enable},extensionToMimeType={".txt":"text/plain",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".odt":"application/vnd.oasis.opendocument.text",".rtf":"application/rtf",".csv":"text/csv",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".bmp":"image/bmp",".webp":"image/webp",".tif":"image/tiff",".tiff":"image/tiff",".svg":"image/svg+xml",".mp3":"audio/mpeg",".wav":"audio/wav",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".flv":"video/x-flv",".mkv":"video/x-matroska",".webm":"video/webm",".zip":"application/zip",".rar":"application/x-rar-compressed",".7z":"application/x-7z-compressed",".tar":"application/x-tar",".gz":"application/gzip",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript"},vaFileInputCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}[hidden]{display:none}:host{display:block;font-family:var(--font-source-sans);font-size:16.96px;}:host .label-header{color:var(--vads-color-base);font-weight:var(--font-weight-normal)}:host .label-header-tag{margin:0;display:inline-block}:host .file-input-wrapper{display:block;max-width:30rem;width:100%;position:relative;margin:8px 0}:host .file-input{cursor:pointer;height:100%;width:100%;max-width:none;top:0;left:0;z-index:1;margin:0;position:absolute;text-indent:-999em;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target{border:1px dashed var(--vads-color-action-border-base-active-on-dark);display:block;margin-top:0.3125rem;position:relative;text-align:center;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}:host .file-input-target.file-input-target-error{border:2px dashed var(--vads-color-secondary-dark)}:host .file-input-box{background:var(--vads-color-white);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:2}:host .file-input-instructions{font-size:1.06rem;padding:1.25rem 0.625rem;pointer-events:none;position:relative;z-index:3}:host .file-input-choose-text{color:var(--vads-color-link);text-decoration:underline;font-weight:var(--font-weight-normal)}:host .file-icon{color:var(--vads-color-primary-alt-darkest)}:host .selected-files-wrapper{background-color:var(--vads-color-primary-lighter);border:1px solid var(--vads-color-base-light)}:host .selected-files-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;border-bottom:1px solid var(--vads-color-white);margin-bottom:8px;padding:8px}:host .va-card{margin:8px}:host .file-label{color:var(--vads-color-base);font-weight:var(--font-weight-bold);font-size:1.06rem;padding:0 8px;display:block;width:100%;word-wrap:break-word;word-break:break-word;overflow:hidden}:host #input-error-message{padding:0 8px;width:100%}:host .file-size-label,:host .file-status-label{color:var(--vads-color-base-dark);font-weight:var(--font-weight-normal);font-size:1.06rem;padding:0 8px;display:block}:host .file-status-label{font-style:italic}:host .file-info-section{padding:0 8px 8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .file-button-section{margin-top:8px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-direction:row;flex-direction:row}:host .file-button-section>va-button-icon{font-size:1.06rem}@media screen and (max-width: 320px){:host .file-button-section{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}:host .separator{border:0;border-top:1px solid var(--vads-color-base-lighter);margin:0}:host .vads-u-line-height--2{line-height:1.15}:host .thumbnail-container{height:40px;width:40px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .thumbnail-preview{max-width:40px;width:auto;max-height:40px;height:auto}:host .thumbnail-error{color:#b21d38}:host va-progress-bar{font-size:var(--vads-font-size-root);display:block;margin-left:16px}:host .uploading-status{font-style:var(--font-style-italic)}:host(.has-error){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host(.has-error){margin-left:-0.9rem}}.required{color:var(--vads-color-secondary-dark);margin-left:0.25rem}h1 .required,h2 .required,h3 .required,h4 .required,h5 .required,h6 .required{font-family:var(--font-source-sans);font-size:initial;font-weight:initial}',VaFileInputStyle0=vaFileInputCss,VaFileInput=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.vaChange=createEvent(this,"vaChange",7),this.vaPasswordChange=createEvent(this,"vaPasswordChange",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.uploadStatus="idle",this.chooseFileString="choose from folder",this.dragFileString="Drag a file here or ",this.handleChange=e=>{this.resetVisualState=!1;const t=e.target;t.files&&t.files.length>0&&this.handleFile(t.files[0]),t.value=""},this.handleDrop=e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer.files;t.length>0&&this.handleFile(t[0])},this.handleFile=(e,t=!0)=>{if(this.accept){const t=this.normalizeAcceptProp(this.accept);if(!this.isAcceptedFileType(e.type,t))return this.removeFile(!1),void(this.internalError="This is not a valid file type.")}return 0===e.size?(this.internalError="The file you selected is empty. Files must be larger than 0B.",void this.resetState()):e.size>this.maxFileSize?(this.internalError=`\n We can't upload your file because it's too big. Files must be less than ${this.formatFileSize(this.maxFileSize)}.`,void this.resetState()):e.size<this.minFileSize?(this.internalError=`We can't upload your file because it's too small. Files must be at least ${this.formatFileSize(this.minFileSize)}.`,void this.resetState()):(this.uploadedFile=null,this.file=e,t&&this.vaChange.emit({files:[this.file]}),this.uploadStatus="success",this.internalError=null,this.generateFileContents(this.file),this.updateStatusMessage(`You have selected the file: ${this.file.name}`),this.el.focus(),void(this.enableAnalytics&&this.componentLibraryAnalytics.emit({componentName:"va-file-input",action:"change",details:{label:this.label}})))},this.removeFile=(e=!0)=>{this.closeModal(),this.uploadStatus="idle",this.internalError=null,e&&this.vaChange.emit({files:[]}),this.file=null,this.uploadedFile=null,this.updateStatusMessage("File removed. No file selected."),this.el.focus()},this.openModal=()=>{this.el.shadowRoot.querySelector("va-modal").setAttribute("status","warning"),this.showModal=!0},this.closeModal=()=>{this.showModal=!1,setTimeout((()=>{this.fileInputRef.focus()}),0)},this.changeFile=()=>{this.fileInputRef&&this.fileInputRef.click()},this.formatFileSize=e=>{const t=["B","KB","MB","GB","TB"];if(0===e)return"0 B";const i=Math.floor(Math.log(e)/Math.log(1024));return 0===i?`${e} ${t[i]}`:`${(e/Math.pow(1024,i)).toFixed(i<2?0:1)} ${t[i]}`},this.normalizeAcceptProp=e=>e.split(",").map((e=>(e=e.trim()).startsWith(".")?extensionToMimeType[e]:e)),this.isAcceptedFileType=(e,t)=>{for(const i of t){if(i===e)return!0;if(i.endsWith("/*")&&e.startsWith(i.slice(0,-1)))return!0}return!1},this.renderLabelOrHeader=(e,t,i)=>{const a=t?h("span",{class:"required"}," ",instance.t("required")):null;return h("div",{class:"label-header"},i&&i>=1&&i<=6?h(`h${i}`,{htmlFor:"fileInputField",part:"label",class:"label-header-tag"},e,a):h("label",{htmlFor:"fileInputField",part:"label",class:"usa-label"},e,a))},this.file=void 0,this.fileContents=void 0,this.internalError=void 0,this.showModal=!1,this.showSeparator=!0,this.label=void 0,this.name=void 0,this.buttonText=void 0,this.value=void 0,this.required=!1,this.accept=void 0,this.error=void 0,this.hint=void 0,this.statusText=void 0,this.uploadMessage=null,this.enableAnalytics=!1,this.headerSize=void 0,this.headless=!1,this.readOnly=!1,this.encrypted=!1,this.uploadedFile=void 0,this.maxFileSize=1/0,this.minFileSize=0,this.percentUploaded=null,this.passwordError=void 0,this.resetVisualState=!1}handleValueChange(e){setTimeout((()=>{this.updateStatusMessage(e)}))}percentHandler(e){e>=100&&this.resetState()}handleError(e){e&&this.resetState()}resetState(){this.fileContents=null,this.uploadStatus="idle",this.percentUploaded=null,forceUpdate(this.el)}updateStatusMessage(e){setTimeout((()=>{const t=this.el.shadowRoot.querySelector("#statusMessage");t&&(t.textContent=e)}),1e3)}generateFileContents(e){if(!e)return;const t=new FileReader;this.fileType=e.type,t.onloadend=()=>{this.fileContents=t.result},this.fileType&&("application/pdf"===this.fileType||this.fileType.startsWith("image/"))&&t.readAsDataURL(e)}componentWillRender(){const e=!!this.el.querySelector(":scope > *"),t=!(!this.value&&!this.file||this.readOnly);this.showSeparator=e||t}componentDidLoad(){fileInput.init(this.el)}connectedCallback(){this.el.addEventListener("change",this.handleChange)}disconnectedCallback(){this.el.removeEventListener("change",this.handleChange)}getDefaultUploadMessage(){return h("span",null,this.dragFileString,h("span",{class:"file-input-choose-text"},this.chooseFileString))}handlePasswordChange(e){this.vaPasswordChange.emit({password:e.target.value})}render(){const{label:e,name:t,required:i,accept:a,error:s,hint:r,file:o,uploadStatus:n,dragFileString:l,chooseFileString:d,uploadMessage:c,headerSize:f,fileContents:p,fileType:u,headless:m,value:b,readOnly:g,encrypted:v,statusText:S,uploadedFile:E,percentUploaded:A,passwordError:C,resetVisualState:_}=this;b&&!this.file&&this.handleFile(b,!1);const x=s||this.internalError,y=`${r?"input-hint-message":""} ${x?"input-error-message":""}`.trim()||null,L=("file-input-target "+(x?"file-input-target-error":"")).trim();let w=h("div",{key:"0ba4f1b07bf71702d3c009a564c31a0cbda42d00",class:"thumbnail-container"},h("svg",{key:"17f77585c4980081c3b50d20fa64ab3ec5d31d69",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"#07648d",width:"40px",height:"40px"},h("path",{key:"7d51920b90ca18ac6dcde81c854dd955e3436060",d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"})));s?w=h("div",{key:"2448d7fdce3bc76b49ceaa72a33fddf2322f5cab",class:"thumbnail-container"},h("va-icon",{key:"d07fc7841535c7e5859aec7974d5f9cdf7607825",icon:"error",size:3,class:"thumbnail-preview thumbnail-error"})):p&&(u.startsWith("image/")?w=h("div",{key:"8f490b7395bbf487269d055ff2bb9da70b8e426d",class:"thumbnail-container","aria-hidden":"true"},h("img",{key:"af93e9a4d390bc2fe7f8ee79e87b2ba12c233c8f",class:"thumbnail-preview",src:p,alt:"image"})):"application/pdf"===u&&(w=h("div",{key:"22014a42479666e381aa4f64e6d12567e7c19bd8",class:"thumbnail-container","aria-hidden":"true"},h("object",{key:"e462949648a918fe00762ad165acb888ffd2ece9",class:"thumbnail-preview",data:p,type:"application/pdf"}))));let T=m?"headless-selected-files-wrapper":"selected-files-wrapper";const I="usa-hint"+(m?" usa-sr-only":""),F=null!==A&&A<100;let R="file-status-label";return F&&(R=`${R} uploading-status`),h(Host,{key:"7d253c4ad42da6875edf8ef049645a1a3b49eebf",class:{"has-error":!!x}},!g&&h("span",{key:"7021e55cd2bbedf6af02d1f513f3c2701884e55c",class:{"usa-sr-only":!!m}},e&&this.renderLabelOrHeader(e,i,f)),r&&!g&&h("div",{key:"6622aac52e6b1be43030b4876cf49f2f066d4164",class:I,id:"input-hint-message"},r),h("div",{key:"bcf5e22ead3af8eb8f22447f1d3445595ee4e2e0",class:"file-input-wrapper",onDrop:this.handleDrop},h("input",{key:"83009dec11a4c8e473d2b640a8f656dae0c4ba67",id:"fileInputField",class:"file-input","aria-label":`${e}${i?" "+instance.t("required"):""}. ${l}${d}`,style:{visibility:"success"===this.uploadStatus||E?"hidden":"unset"},type:"file",ref:e=>this.fileInputRef=e,name:t,accept:a,"aria-describedby":y,onChange:this.handleChange}),"idle"===n&&(!E||_)&&h("div",{key:"a78108c5d97259840b1552a7398dd3e021604901"},h("span",{key:"575ef5a846fcf1e452172f34c1c2ece5ed627364",id:"file-input-error-alert",role:"alert"},x&&h(Fragment,{key:"789e7490933fe0ba0ca8176edeb0d149e4fd3935"},h("span",{key:"5509b84567e638a6db301371cc372e7c9907c714",class:"usa-sr-only"},instance.t("error")),h("span",{key:"084096c61f148d3e556c920c0c5a00db7531952f",class:"usa-error-message"},x))),h("div",{key:"1723caf5827884c35e654093a246ae75071ed17e",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),h("div",{key:"a0be5187a9ecae0445449e60185d2f2c19d32526",class:L},h("div",{key:"d9eab9e1bb721a1f520ad473ed5c9b963fa597fe",class:"file-input-box"}),h("div",{key:"068b66442b3923be0733022f3b3d473041a5a15b",class:"file-input-instructions"},c||this.getDefaultUploadMessage()))),!_&&("idle"!==n||E)&&h("div",{key:"05017f4217ce8eb4429d88abd531dc07f6b361e4",class:T},!m&&h("div",{key:"e91ef46b351a709aaac7817980153bf6ad1814f9",class:"selected-files-label"},g?"Files you uploaded":"Selected files"),h("div",{key:"48fd42f25102184a12cfdfcaee500a3aade78528",class:"usa-sr-only","aria-live":"polite",id:"statusMessage"}),h("va-card",{key:"4bf0435ce687700831d1330db3b40e910b76a197",class:"va-card"},h("div",{key:"86a10d691a6bdfe591bc8f1674b5f4c32867b4c1",class:"file-info-section"},w,h("div",{key:"f494b9130126b0059fd53deb7dbb70ec8f1203d5",class:"file-info-group vads-u-line-height--2"},h("span",{key:"10fa6909381cc27da81bf1ae53b193ee19352b6e",class:"file-label"},o?o.name:E.name),x&&h("span",{key:"68e20992dc2c0531f7aec0bc380a27b871df11ac",id:"input-error-message",role:"alert"},h("span",{key:"bc8a416d10786b6c9ef0f8bc4dbc1f5262abe359",class:"usa-sr-only"},instance.t("error")),h("span",{key:"75bafd31d1187d576021e2bcf1d3b34748f15a8f","aria-live":"polite",class:"usa-error-message"},x)),!F&&h("span",{key:"2210e1e49afeabefe7a7e026a934a7774281def2",class:"file-size-label"},this.formatFileSize(o?o.size:E.size)),h("span",{key:"2ac795ef2250f06cf7f154fdcdcf873ec4c1678b",class:R,"aria-live":"polite"},F?"Uploading...":S))),(o||b||E)&&h("div",{key:"eb8e7d6ca1e7111239c4351219b2f608219bc866"},this.showSeparator&&h("hr",{key:"2577220314f9cbd9e80f1881175cd5d8ce417885",class:"separator"}),v&&h("va-text-input",{key:"eddfce5dac7dfd7ceb5f07af044f9d01464db246",onInput:e=>{this.handlePasswordChange(e)},label:"File password",required:!0,error:C}),h("div",{key:"62b0ba0d836c390c6100d0afbd13c0146bc4f65e",class:"additional-info-slot"},h("slot",{key:"89c2a3dcb4b37e292a72009d460bd605cb10f642"})),g?null:F?h(Fragment,null,h("va-progress-bar",{percent:A}),h("va-button-icon",{buttonType:"cancel",onClick:this.resetState.bind(this)})):h(Fragment,null,h("div",{class:"file-button-section"},h("va-button-icon",{buttonType:"change-file",onClick:this.changeFile,label:"Change file","aria-label":`change file ${o?o.name:E.name}`}),h("va-button-icon",{buttonType:"delete",onClick:this.openModal,"aria-label":`delete file ${o?o.name:E.name}`,label:"Delete"})),h("va-modal",{modalTitle:"Delete this file?",visible:this.showModal,primaryButtonText:"Yes, remove this",secondaryButtonText:"No, keep this",onCloseEvent:this.closeModal,onPrimaryButtonClick:()=>this.removeFile(!0),onSecondaryButtonClick:this.closeModal},"We'll delete the uploaded file"," ",h("span",{class:"file-label"},o?o.name:E.name))))))))}get el(){return this}static get watchers(){return{statusText:["handleValueChange"],percentUploaded:["percentHandler"],resetVisualState:["handleError"]}}static get style(){return VaFileInputStyle0}},[1,"va-file-input",{label:[1],name:[1],buttonText:[1,"button-text"],value:[16],required:[4],accept:[1],error:[1],hint:[1],statusText:[1,"status-text"],uploadMessage:[16],enableAnalytics:[4,"enable-analytics"],headerSize:[2,"header-size"],headless:[4],readOnly:[4,"read-only"],encrypted:[4],uploadedFile:[16],maxFileSize:[2,"max-file-size"],minFileSize:[2,"min-file-size"],percentUploaded:[1026,"percent-uploaded"],passwordError:[1,"password-error"],resetVisualState:[1028,"reset-visual-state"],file:[32],fileContents:[32],internalError:[32],showModal:[32],showSeparator:[32]},void 0,{statusText:["handleValueChange"],percentUploaded:["percentHandler"],resetVisualState:["handleError"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-file-input","va-button","va-button-icon","va-card","va-icon","va-modal","va-progress-bar","va-text-input"].forEach((e=>{switch(e){case"va-file-input":customElements.get(e)||customElements.define(e,VaFileInput);break;case"va-button":customElements.get(e)||defineCustomElement$7();break;case"va-button-icon":customElements.get(e)||defineCustomElement$6();break;case"va-card":customElements.get(e)||defineCustomElement$5();break;case"va-icon":customElements.get(e)||defineCustomElement$4();break;case"va-modal":customElements.get(e)||defineCustomElement$3();break;case"va-progress-bar":customElements.get(e)||defineCustomElement$2();break;case"va-text-input":customElements.get(e)||defineCustomElement$1()}}))}export{VaFileInput as V,defineCustomElement as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{i as isMessageSet}from"./utils.js";import{d as defineCustomElement$2}from"./va-icon2.js";const vaLinkActionCss="button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role='option']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}a{text-decoration:none;color:var(--vads-color-link);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}a:hover{background-color:rgba(0, 0, 0, 0.05);color:inherit}a:visited{color:var(--vads-color-link-visited)}.sr-only{border:0;clip:rect(0, 0, 0, 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute !important;width:1px;word-wrap:normal !important}:host{display:-ms-inline-flexbox;display:inline-flex}:host a{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:start;align-items:flex-start;cursor:pointer;text-decoration:underline;font-weight:700;font-size:1.06rem;padding:0.5rem 0}:host a:active{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}:host a.va-link--primary:hover,:host a.va-link--primary:active,:host a.va-link--secondary:hover,:host a.va-link--secondary:active{color:var(--vads-color-link) !important}:host a.va-link--reverse{color:var(--vads-color-white)}:host a.va-link--reverse:hover,:host a.va-link--reverse:active{color:var(--vads-color-action-focus-on-light);background-color:transparent}:host a.va-link--reverse va-icon:hover,:host a.va-link--reverse va-icon:active{background-color:var(--vads-color-action-focus-on-light)}.link-icon--left{margin-right:8px;vertical-align:baseline;position:relative}.link-icon{border-radius:50%;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:white;print-color-adjust:exact;-webkit-print-color-adjust:exact}.va-link--primary va-icon{background-color:var(--vads-color-success-dark)}.va-link--secondary va-icon{background-color:var(--vads-color-primary)}.link-icon--reverse{background-color:var(--vads-color-white);color:var(--vads-color-black)}:host a.va-link--reverse:hover va-icon,:host a.va-link--reverse:active va-icon{background-color:var(--vads-color-action-focus-on-light) !important}.link-text{display:inline-block;vertical-align:top;max-width:calc(100% - 24px);white-space:pre-wrap}:host(.host--primary-entry){width:100%}:host a.va-link--primary-entry{position:relative;display:inline-block;background-color:var(--vads-color-primary);color:var(--vads-color-white);text-decoration:none;padding:15px 15px 15px 45px;margin:0 1.5rem 0 0;-webkit-clip-path:polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);clip-path:polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;width:95%;line-height:1.4;min-height:24px;max-width:var(--vads-size-line-length-5);}@media (min-width: 768px){:host a.va-link--primary-entry{width:75%}}:host a.va-link--primary-entry va-icon.link-icon{position:absolute;left:12px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:var(--vads-color-primary);background-color:var(--vads-color-white)}:host a.va-link--primary-entry .link-text{font-weight:bold;display:inline-block;vertical-align:middle}:host a.va-link--primary-entry:hover:not(:focus){text-decoration:none}:host a.va-link--primary-entry:hover:not(:focus) va-icon.link-icon{background-color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:hover:not(:focus) .link-text{color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus,:host a.va-link--primary-entry:active{background-color:var(--vads-color-action-focus-on-light);text-decoration:none;outline:none;-webkit-transition:none;transition:none}:host a.va-link--primary-entry:focus va-icon.link-icon,:host a.va-link--primary-entry:active va-icon.link-icon{background-color:var(--vads-color-black);color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus .link-text,:host a.va-link--primary-entry:active .link-text{color:var(--vads-color-black)}:host a.va-link--primary-entry:focus:hover{background-color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus:hover va-icon.link-icon,:host a.va-link--primary-entry:focus:hover .link-text{text-decoration:underline;-webkit-text-decoration-color:var(--vads-color-black);text-decoration-color:var(--vads-color-black);text-decoration-thickness:2px;text-underline-offset:4px}",VaLinkActionStyle0=vaLinkActionCss,VaLinkAction$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.handleClick=i=>{if(!this.disableAnalytics){const i={componentName:"va-link-action",action:"click",details:{label:this.text,destination:this.href,origin:window.location.href}};this.componentLibraryAnalytics.emit(i)}},this.disableAnalytics=!1,this.href=void 0,this.text=void 0,this.messageAriaDescribedby=void 0,this.type="primary",this.label=void 0,this.isSingleLine=!0}componentWillLoad(){this.checkTextLines()}checkTextLines(){if(this.linkRef){const i=getComputedStyle(this.linkRef),o=parseFloat(i.lineHeight),e=this.linkRef.clientHeight;this.isSingleLine=e<=o}}render(){const{handleClick:i,href:o,text:e,messageAriaDescribedby:t,type:a,label:n}=this,r=classnames({"host--primary-entry":"primary-entry"===a}),s=classnames({"va-link--reverse":"reverse"===a,"va-link--primary":"primary"===a,"va-link--secondary":"secondary"===a,"va-link--primary-entry":"primary-entry"===a}),l=classnames("link-icon--left","link-icon",{"link-icon--reverse":"reverse"===a});return h(Host,{key:"741ceb11f745e5367efda82b7bdd1375a6dbc912",class:r},h("a",{key:"1a9798908f569c4b416af1c45763e2233c074606",href:o,class:s,"aria-label":n,"aria-describedby":t?"link-description":null,onClick:i,ref:i=>this.linkRef=i},h("va-icon",{key:"fa1300d06b5b29a56147bad20f9f7c7428fd3c19",class:l,icon:"chevron_right",size:3}),h("span",{key:"5dfba4f71c2b4a9615ca61ba1ee4bdf2ab9f9b1d",class:"link-text"},e)),isMessageSet(t)&&h("span",{key:"2f5e9a8f564921d4dd68950e6f53c7b3843eaf97",id:"link-description",class:"sr-only"},t))}static get watchers(){return{text:["checkTextLines"]}}static get style(){return VaLinkActionStyle0}},[1,"va-link-action",{disableAnalytics:[4,"disable-analytics"],href:[1],text:[1],messageAriaDescribedby:[1,"message-aria-describedby"],type:[1],label:[1],isSingleLine:[32]},void 0,{text:["checkTextLines"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-link-action","va-icon"].forEach((i=>{switch(i){case"va-link-action":customElements.get(i)||customElements.define(i,VaLinkAction$1);break;case"va-icon":customElements.get(i)||defineCustomElement$2()}}))}const VaLinkAction=VaLinkAction$1,defineCustomElement=defineCustomElement$1;export{VaLinkAction,defineCustomElement};
|
|
1
|
+
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{i as isMessageSet}from"./utils.js";import{d as defineCustomElement$2}from"./va-icon2.js";const vaLinkActionCss="button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role='option']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}a{text-decoration:none;color:var(--vads-color-link);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}a:hover{background-color:rgba(0, 0, 0, 0.05);color:inherit}a:visited{color:var(--vads-color-link-visited)}.sr-only{border:0;clip:rect(0, 0, 0, 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute !important;width:1px;word-wrap:normal !important}:host{display:-ms-inline-flexbox;display:inline-flex}:host a{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:start;align-items:flex-start;cursor:pointer;text-decoration:underline;font-weight:700;font-size:1.06rem;padding:0.5rem 0}:host a:active{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}:host a.va-link--primary:hover,:host a.va-link--primary:active,:host a.va-link--secondary:hover,:host a.va-link--secondary:active{color:var(--vads-color-link) !important}:host a.va-link--reverse{color:var(--vads-color-white)}:host a.va-link--reverse:hover,:host a.va-link--reverse:active{color:var(--vads-color-action-focus-on-light);background-color:transparent}:host a.va-link--reverse va-icon:hover,:host a.va-link--reverse va-icon:active{background-color:var(--vads-color-action-focus-on-light)}.link-icon--left{margin-right:8px;vertical-align:baseline;position:relative}.link-icon{border-radius:50%;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:white;print-color-adjust:exact;-webkit-print-color-adjust:exact}.va-link--primary va-icon{background-color:var(--vads-color-success-dark)}.va-link--secondary va-icon{background-color:var(--vads-color-primary)}.link-icon--reverse{background-color:var(--vads-color-white);color:var(--vads-color-black)}:host a.va-link--reverse:hover va-icon,:host a.va-link--reverse:active va-icon{background-color:var(--vads-color-action-focus-on-light) !important}.link-text{display:inline-block;vertical-align:top;max-width:calc(100% - 24px);white-space:pre-wrap}:host(.host--primary-entry){width:100%}:host a.va-link--primary-entry{position:relative;display:inline-block;background-color:var(--vads-color-primary);color:var(--vads-color-white);text-decoration:none;padding:15px 15px 15px 45px;margin:0 1.5rem 0 0;-webkit-clip-path:polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);clip-path:polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;width:95%;line-height:1.4;min-height:24px;max-width:var(--vads-size-line-length-5);}@media (min-width: 768px){:host a.va-link--primary-entry{width:75%}}:host a.va-link--primary-entry va-icon.link-icon{position:absolute;left:12px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:var(--vads-color-primary);background-color:var(--vads-color-white)}:host a.va-link--primary-entry .link-text{font-weight:bold;display:inline-block;vertical-align:middle}:host a.va-link--primary-entry:hover:not(:focus){text-decoration:none}:host a.va-link--primary-entry:hover:not(:focus) va-icon.link-icon{background-color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:hover:not(:focus) .link-text{color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus,:host a.va-link--primary-entry:active{background-color:var(--vads-color-action-focus-on-light);text-decoration:none;outline:none;-webkit-transition:none;transition:none}:host a.va-link--primary-entry:focus va-icon.link-icon,:host a.va-link--primary-entry:active va-icon.link-icon{background-color:var(--vads-color-black);color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus .link-text,:host a.va-link--primary-entry:active .link-text{color:var(--vads-color-black)}:host a.va-link--primary-entry:focus:hover{background-color:var(--vads-color-action-focus-on-light)}:host a.va-link--primary-entry:focus:hover va-icon.link-icon,:host a.va-link--primary-entry:focus:hover .link-text{text-decoration:underline;-webkit-text-decoration-color:var(--vads-color-black);text-decoration-color:var(--vads-color-black);text-decoration-thickness:2px;text-underline-offset:4px}",VaLinkActionStyle0=vaLinkActionCss,VaLinkAction$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.handleClick=i=>{if(!this.disableAnalytics){const i={componentName:"va-link-action",action:"click",details:{label:this.text,destination:this.href,origin:window.location.href}};this.componentLibraryAnalytics.emit(i)}},this.disableAnalytics=!1,this.href=void 0,this.text=void 0,this.messageAriaDescribedby=void 0,this.type="primary",this.label=void 0,this.isSingleLine=!0}componentWillLoad(){this.checkTextLines()}checkTextLines(){if(this.linkRef){const i=getComputedStyle(this.linkRef),o=parseFloat(i.lineHeight),e=this.linkRef.clientHeight;this.isSingleLine=e<=o}}render(){const{handleClick:i,href:o,text:e,messageAriaDescribedby:t,type:a,label:n}=this,r=classnames({"host--primary-entry":"primary-entry"===a}),s=classnames({"va-link--reverse":"reverse"===a,"va-link--primary":"primary"===a,"va-link--secondary":"secondary"===a,"va-link--primary-entry":"primary-entry"===a}),l=classnames("link-icon--left","link-icon",{"link-icon--reverse":"reverse"===a});return h(Host,{key:"741ceb11f745e5367efda82b7bdd1375a6dbc912",class:r},h("a",{key:"1a9798908f569c4b416af1c45763e2233c074606",href:o,class:s,"aria-label":n,"aria-describedby":t?"link-description":null,onClick:i,ref:i=>this.linkRef=i},h("va-icon",{key:"fa1300d06b5b29a56147bad20f9f7c7428fd3c19",class:l,icon:"chevron_right",size:3}),h("span",{key:"5dfba4f71c2b4a9615ca61ba1ee4bdf2ab9f9b1d",class:"link-text"},e)),isMessageSet(t)&&h("span",{key:"2f5e9a8f564921d4dd68950e6f53c7b3843eaf97",id:"link-description",class:"sr-only"},t))}static get watchers(){return{text:["checkTextLines"]}}static get style(){return VaLinkActionStyle0}},[1,"va-link-action",{disableAnalytics:[4,"disable-analytics"],href:[1],text:[1],messageAriaDescribedby:[1,"message-aria-describedby"],type:[1],label:[1],isSingleLine:[32]},void 0,{text:["checkTextLines"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-link-action","va-icon"].forEach((i=>{switch(i){case"va-link-action":customElements.get(i)||customElements.define(i,VaLinkAction$1);break;case"va-icon":customElements.get(i)||defineCustomElement$2()}}))}const VaLinkAction=VaLinkAction$1,defineCustomElement=defineCustomElement$1;export{VaLinkAction,defineCustomElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{d as defineCustomElement$1}from"./va-icon2.js";const vaLinkCss='p,a,ol,ul,li,dl,dt,dd,form,label,button{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.5}button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}a{text-decoration:none;color:var(--vads-color-link);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}a:hover{background-color:rgba(0, 0, 0, 0.05);color:inherit}a:visited{color:var(--vads-color-link-visited)}.usa-sr-only{position:absolute;left:-999em;right:auto}:host{display:inline}:host([href]:focus){outline:none !important}:host a{cursor:pointer;text-decoration:underline;font:inherit}:host a.va-link--reverse,:host a.va-link--reverse .link-icon--back{color:var(--vads-color-white)}:host a.va-link--reverse:hover,:host a.va-link--reverse:active,:host a.va-link--reverse:hover .link-icon--back,:host a.va-link--reverse:active .link-icon--back,:host a.va-link--reverse .link-icon--back:hover,:host a.va-link--reverse .link-icon--back:active,:host a.va-link--reverse .link-icon--back:hover .link-icon--back,:host a.va-link--reverse .link-icon--back:active .link-icon--back{color:var(--vads-color-action-focus-on-light);background-color:transparent}:host([active]:not([active=false])) a{font-weight:700}:host([icon-name]) va-icon{margin-right:4px}.link-icon--active{vertical-align:baseline;position:relative;top:3px}.link-icon--left{margin-right:4px;vertical-align:baseline;position:relative;top:3px}.link-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.link-icon--back{color:var(--vads-color-gray-medium);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}.link--center{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}dfn{font-style:normal}abbr{text-decoration:none}.external-link-icon{margin-left:4px}@media print{.screen-only{display:none}}',VaLinkStyle0=vaLinkCss,VaLink=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.handleClick=e=>{if(!this.disableAnalytics){const e={componentName:"va-link",action:"click",details:{label:this.text,destination:this.href,origin:window.location.href}};this.componentLibraryAnalytics.emit(e)}},this.getAbbreviationTitle=()=>{const{abbrTitle:e,filetype:i}=this;return"PDF"===i?"Portable Document Format":e},this.abbrTitle=void 0,this.active=!1,this.back=!1,this.calendar=!1,this.channel=!1,this.disableAnalytics=!1,this.download=!1,this.href=void 0,this.filename=void 0,this.filetype=void 0,this.pages=void 0,this.text=void 0,this.video=!1,this.reverse=!1,this.external=!1,this.label=null,this.iconName=null,this.iconSize=3,this.language=void 0}render(){const{active:e,back:i,calendar:n,channel:o,download:t,filetype:a,filename:l,getAbbreviationTitle:r,handleClick:s,href:c,pages:d,text:u,video:v,reverse:b,external:k,iconName:f,iconSize:m,language:p,label:g}=this,y=classnames({"va-link--reverse":b,"link--center":f});if(e)return h(Host,null,h("a",{href:c,class:y,onClick:s,"aria-label":g},u,h("va-icon",{class:"link-icon--active",icon:"chevron_right"})));if(i){const e=h("va-icon",{icon:"arrow_back",class:"link-icon--left link-icon--back"});return h(Host,null,h("div",{class:"link-container"},e,h("a",{href:c,class:y,onClick:s,"aria-label":g},u)))}if(o||v)return h(Host,null,h("a",{href:c,class:y,"aria-label":g,onClick:s,rel:"noopener",target:"_blank"},h("va-icon",{class:"link-icon--left",icon:o?"youtube":"play_circle"}),u," ",h("dfn",null,o?"YouTube":"on YouTube")));if(n)return h(Host,null,h("a",{href:c,class:y,download:l,"aria-label":g,onClick:s},h("va-icon",{class:"link-icon--left",icon:"calendar_today"}),u));if(t)return h(Host,null,h("a",{href:c,class:y,download:l,"aria-label":g,onClick:s},h("va-icon",{class:"link-icon--left",icon:"file_download"}),u," ",a&&h("dfn",null,"(",h("abbr",{title:r()},a),d&&`, ${d} pages`,")")));if(f)return h(Host,null,h("a",{href:c,class:y,"aria-label":g,onClick:s},h("va-icon",{icon:f,size:m,part:"icon"}),u));if(k)return h(Host,null,h("a",{href:c,rel:"noreferrer",class:y,onClick:s,"aria-label":g,target:"_blank"},u," ",h("span",{class:"screen-only"},"(opens in a new tab)")));const x=p||null;return h(Host,null,h("a",{href:c,class:y,onClick:s,"aria-label":g,part:"anchor",lang:x,hrefLang:x},u))}static get style(){return VaLinkStyle0}},[1,"va-link",{abbrTitle:[1,"abbr-title"],active:[516],back:[4],calendar:[4],channel:[4],disableAnalytics:[4,"disable-analytics"],download:[4],href:[1],filename:[1],filetype:[1],pages:[2],text:[1],video:[4],reverse:[4],external:[4],label:[1],iconName:[1,"icon-name"],iconSize:[2,"icon-size"],language:[1]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-link","va-icon"].forEach((e=>{switch(e){case"va-link":customElements.get(e)||customElements.define(e,VaLink);break;case"va-icon":customElements.get(e)||defineCustomElement$1()}}))}export{VaLink as V,defineCustomElement as d};
|
|
1
|
+
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{d as defineCustomElement$1}from"./va-icon2.js";const vaLinkCss='p,a,ol,ul,li,dl,dt,dd,form,label,button{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.5}button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}a{text-decoration:none;color:var(--vads-color-link);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}a:hover{background-color:rgba(0, 0, 0, 0.05);color:inherit}a:visited{color:var(--vads-color-link-visited)}.usa-sr-only{position:absolute;left:-999em;right:auto}:host{display:inline}:host([href]:focus){outline:none !important}:host a{cursor:pointer;text-decoration:underline;font:inherit}:host a.va-link--reverse,:host a.va-link--reverse .link-icon--back{color:var(--vads-color-white)}:host a.va-link--reverse:hover,:host a.va-link--reverse:active,:host a.va-link--reverse:hover .link-icon--back,:host a.va-link--reverse:active .link-icon--back,:host a.va-link--reverse .link-icon--back:hover,:host a.va-link--reverse .link-icon--back:active,:host a.va-link--reverse .link-icon--back:hover .link-icon--back,:host a.va-link--reverse .link-icon--back:active .link-icon--back{color:var(--vads-color-action-focus-on-light);background-color:transparent}:host([active]:not([active=false])) a{font-weight:700}:host([icon-name]) va-icon{margin-right:4px}.link-icon--active{vertical-align:baseline;position:relative;top:3px}.link-icon--left{margin-right:4px;vertical-align:baseline;position:relative;top:3px}.link-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.link-icon--back{color:var(--vads-color-gray-medium);-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-property:color, background-color, border-color;transition-property:color, background-color, border-color}.link--center{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}dfn{font-style:normal}abbr{text-decoration:none}.external-link-icon{margin-left:4px}@media print{.screen-only{display:none}}',VaLinkStyle0=vaLinkCss,VaLink=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.handleClick=e=>{if(!this.disableAnalytics){const e={componentName:"va-link",action:"click",details:{label:this.text,destination:this.href,origin:window.location.href}};this.componentLibraryAnalytics.emit(e)}},this.getAbbreviationTitle=()=>{const{abbrTitle:e,filetype:i}=this;return"PDF"===i?"Portable Document Format":e},this.abbrTitle=void 0,this.active=!1,this.back=!1,this.calendar=!1,this.channel=!1,this.disableAnalytics=!1,this.download=!1,this.href=void 0,this.filename=void 0,this.filetype=void 0,this.pages=void 0,this.text=void 0,this.video=!1,this.reverse=!1,this.external=!1,this.label=null,this.iconName=null,this.iconSize=3,this.language=void 0}render(){const{active:e,back:i,calendar:n,channel:o,download:t,filetype:a,filename:l,getAbbreviationTitle:r,handleClick:s,href:c,pages:d,text:u,video:v,reverse:b,external:k,iconName:f,iconSize:m,language:p,label:g}=this,y=classnames({"va-link--reverse":b,"link--center":f});if(e)return h(Host,null,h("a",{href:c,class:y,onClick:s,"aria-label":g},u,h("va-icon",{class:"link-icon--active",icon:"chevron_right"})));if(i){const e=h("va-icon",{icon:"arrow_back",class:"link-icon--left link-icon--back"});return h(Host,null,h("div",{class:"link-container"},e,h("a",{href:c,class:y,onClick:s,"aria-label":g},u)))}if(o||v)return h(Host,null,h("a",{href:c,class:y,"aria-label":g,onClick:s,rel:"noopener",target:"_blank"},h("va-icon",{class:"link-icon--left",icon:o?"youtube":"play_circle"}),u," ",h("dfn",null,o?"YouTube":"on YouTube")));if(n)return h(Host,null,h("a",{href:c,class:y,download:l,"aria-label":g,onClick:s},h("va-icon",{class:"link-icon--left",icon:"calendar_today"}),u));if(t)return h(Host,null,h("a",{href:c,class:y,download:l,"aria-label":g,onClick:s},h("va-icon",{class:"link-icon--left",icon:"file_download"}),u," ",a&&h("dfn",null,"(",h("abbr",{title:r()},a),d&&`, ${d} pages`,")")));if(f)return h(Host,null,h("a",{href:c,class:y,"aria-label":g,onClick:s},h("va-icon",{icon:f,size:m,part:"icon"}),u));if(k)return h(Host,null,h("a",{href:c,rel:"noreferrer",class:y,onClick:s,"aria-label":g,target:"_blank"},u," ",h("span",{class:"screen-only"},"(opens in a new tab)")));const x=p||null;return h(Host,null,h("a",{href:c,class:y,onClick:s,"aria-label":g,part:"anchor",lang:x,hrefLang:x},u))}static get style(){return VaLinkStyle0}},[1,"va-link",{abbrTitle:[1,"abbr-title"],active:[516],back:[4],calendar:[4],channel:[4],disableAnalytics:[4,"disable-analytics"],download:[4],href:[1],filename:[1],filetype:[1],pages:[2],text:[1],video:[4],reverse:[4],external:[4],label:[1],iconName:[1,"icon-name"],iconSize:[2,"icon-size"],language:[1]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["va-link","va-icon"].forEach((e=>{switch(e){case"va-link":customElements.get(e)||customElements.define(e,VaLink);break;case"va-icon":customElements.get(e)||defineCustomElement$1()}}))}export{VaLink as V,defineCustomElement as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{i as isDateSameDay,f as formatDate,a as isDateBefore,b as isDateAfter}from"./date-utils.js";import{d as defineCustomElement$2}from"./va-icon2.js";const vaMaintenanceBannerCss='p,a,ol,ul,li,dl,dt,dd,form,label,button{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.5}button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-radius:5px;color:var(--vads-button-color-text-primary-alt-on-light);cursor:pointer;display:inline-block;font-family:var(--font-source-sans);font-size:1rem;font-weight:700;line-height:1;padding:0.625rem 1.25rem;text-align:center;text-decoration:none}.maintenance-banner{border-top:8px solid;background-color:var(--vads-color-base-lightest);position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.maintenance-banner__content{font-size:1.06rem}.maintenance-banner p{-webkit-margin-before:1em;margin-block-start:1em;-webkit-margin-after:1em;margin-block-end:1em}.maintenance-banner--warning{border-color:var(--vads-color-warning)}.maintenance-banner--error{border-color:var(--vads-color-secondary-dark)}.maintenance-banner__icon{position:absolute;top:18px;left:18px}.maintenance-banner--error .maintenance-banner__icon{color:var(--vads-color-secondary-dark)}.maintenance-banner__title{font-family:var(--font-serif);margin:0 0 8px;font-size:20px}.maintenance-banner__body{padding:16px 56px;position:relative;max-width:1000px;margin:0px auto}.maintenance-banner__close{-ms-flex-item-align:start;align-self:flex-start;color:var(--vads-color-base);margin-top:8px}.maintenance-banner__close:hover{color:var(--vads-color-base)}',VaMaintenanceBannerStyle0=vaMaintenanceBannerCss,VaMaintenanceBanner$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.closeEvent=createEvent(this,"closeEvent",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.derivePostContent=(e,n)=>{let
|
|
1
|
+
import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{i as isDateSameDay,f as formatDate,a as isDateBefore,b as isDateAfter}from"./date-utils.js";import{d as defineCustomElement$2}from"./va-icon2.js";const vaMaintenanceBannerCss='p,a,ol,ul,li,dl,dt,dd,form,label,button{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.5}button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-radius:5px;color:var(--vads-button-color-text-primary-alt-on-light);cursor:pointer;display:inline-block;font-family:var(--font-source-sans);font-size:1rem;font-weight:700;line-height:1;padding:0.625rem 1.25rem;text-align:center;text-decoration:none}.maintenance-banner{border-top:8px solid;background-color:var(--vads-color-base-lightest);position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.maintenance-banner__content{font-size:1.06rem}.maintenance-banner p{-webkit-margin-before:1em;margin-block-start:1em;-webkit-margin-after:1em;margin-block-end:1em}.maintenance-banner--warning{border-color:var(--vads-color-warning)}.maintenance-banner--error{border-color:var(--vads-color-secondary-dark)}.maintenance-banner__icon{position:absolute;top:18px;left:18px}.maintenance-banner--error .maintenance-banner__icon{color:var(--vads-color-secondary-dark)}.maintenance-banner__title{font-family:var(--font-serif);margin:0 0 8px;font-size:20px}.maintenance-banner__body{padding:16px 56px;position:relative;max-width:1000px;margin:0px auto}.maintenance-banner__close{-ms-flex-item-align:start;align-self:flex-start;color:var(--vads-color-base);margin-top:8px}.maintenance-banner__close:hover{color:var(--vads-color-base)}',VaMaintenanceBannerStyle0=vaMaintenanceBannerCss,VaMaintenanceBanner$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.closeEvent=createEvent(this,"closeEvent",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.derivePostContent=(e,n)=>{let a=n.getTime()-e.getTime();const t=Math.floor(a/36e5),i=60*(a/36e5-t),o=`${t>0?t+" hours ":""} ${i>0?i+" minutes":""}`;return isDateSameDay(e,n),h("div",null,h("p",null,h("strong",null,"Date:")," ",formatDate(e,{dateStyle:"full"})),h("p",null,h("strong",null,"Time:")," ",formatDate(e,{hour:"numeric",minute:"numeric",timeZoneName:"short"})),h("p",null,h("strong",null,"Duration:")," ",o))},this.onCloseAlert=()=>{if(this.closeEvent.emit(),window.localStorage.setItem("MAINTENANCE_BANNER",this.bannerId),this.maintenanceBannerEl.remove(),!this.disableAnalytics){const e={componentName:"va-maintenance-banner",action:"close",details:{header:isDateBefore(new Date,new Date(this.maintenanceStartDateTime))?this.upcomingWarnTitle:this.maintenanceTitle,upcomingWarnStartDateTime:this.upcomingWarnStartDateTime,maintenanceStartDateTime:this.maintenanceStartDateTime,maintenanceEndDateTime:this.maintenanceEndDateTime,displayedContent:this.maintenanceBannerContent.innerText}};this.componentLibraryAnalytics.emit(e)}},this.disableAnalytics=!1,this.bannerId=void 0,this.maintenanceStartDateTime=void 0,this.maintenanceEndDateTime=void 0,this.maintenanceTitle=void 0,this.upcomingWarnStartDateTime=void 0,this.upcomingWarnTitle=void 0,this.isError=void 0}render(){const{upcomingWarnStartDateTime:e,maintenanceEndDateTime:n,isError:a}=this,t=new Date;if(isDateBefore(t,new Date(e)))return null;if(isDateAfter(t,new Date(n)))return null;if(window.localStorage.getItem("MAINTENANCE_BANNER")!==this.bannerId){const{upcomingWarnTitle:e,maintenanceStartDateTime:i,maintenanceTitle:o}=this,r=isDateBefore(t,new Date(i))&&!a,s=classnames({"maintenance-banner":!0,"maintenance-banner--warning":r,"maintenance-banner--error":!r});return h(Host,null,h("div",{class:s,ref:e=>this.maintenanceBannerEl=e},h("va-icon",{class:"maintenance-banner__icon",icon:a?"error":"warning",size:4}),h("div",{class:"maintenance-banner__body"},h("h4",{class:"maintenance-banner__title"},r?e:o),h("div",{class:"maintenance-banner__content",ref:e=>this.maintenanceBannerContent=e},h("slot",r?{name:"warn-content"}:{name:"maintenance-content"})),h("div",{class:"maintenance-banner__derived-content"},this.derivePostContent(new Date(i),new Date(n)))),h("button",{"aria-label":"Close notification",class:"maintenance-banner__close",onClick:this.onCloseAlert,type:"button"},h("va-icon",{icon:"close",size:4}))))}return null}static get style(){return VaMaintenanceBannerStyle0}},[1,"va-maintenance-banner",{disableAnalytics:[4,"disable-analytics"],bannerId:[1,"banner-id"],maintenanceStartDateTime:[1,"maintenance-start-date-time"],maintenanceEndDateTime:[1,"maintenance-end-date-time"],maintenanceTitle:[1,"maintenance-title"],upcomingWarnStartDateTime:[1,"upcoming-warn-start-date-time"],upcomingWarnTitle:[1,"upcoming-warn-title"],isError:[4,"is-error"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-maintenance-banner","va-icon"].forEach((e=>{switch(e){case"va-maintenance-banner":customElements.get(e)||customElements.define(e,VaMaintenanceBanner$1);break;case"va-icon":customElements.get(e)||defineCustomElement$2()}}))}const VaMaintenanceBanner=VaMaintenanceBanner$1,defineCustomElement=defineCustomElement$1;export{VaMaintenanceBanner,defineCustomElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Build,proxyCustomElement,HTMLElement,createEvent,forceUpdate,h,Fragment,Host}from"@stencil/core/internal/client";import{v as validate,z as zeroPadStart,g as getErrorParameters,m as months}from"./date-utils.js";import{g as getHeaderLevel}from"./utils.js";import"./i18n-setup.js";import"./contacts.js";import{c as classnames}from"./index2.js";import{d as defineCustomElement$4}from"./va-icon2.js";import{d as defineCustomElement$3}from"./va-select2.js";import{d as defineCustomElement$2}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const vaMemorableDateCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}#error-message{margin-bottom:0.75rem}#error-message,#input-error-message{color:var(--vads-color-secondary-dark);display:block;font-weight:700;font-size:1.06rem}:host([error]:not([error=\'\'])){border-left:0.3rem solid var(--vads-color-secondary-dark);padding-left:1.25rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=\'\'])){margin-left:-1.4375rem;}}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint,.usa-fieldset{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-form{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}@media all and (min-width: 30em){.usa-form{max-width:20rem}}.usa-form abbr[title=required]{text-decoration:none}.usa-form .usa-input,.usa-form .usa-range,.usa-form .usa-select,.usa-form .usa-textarea{max-width:none}.usa-form .usa-input--2xs,.usa-form .usa-input-group--2xs{max-width:5ex}.usa-form .usa-input--xs,.usa-form .usa-input-group--xs{max-width:9ex}.usa-form .usa-input--sm,.usa-form .usa-input--small,.usa-form .usa-input-group--sm,.usa-form .usa-input-group--small{max-width:13ex}.usa-form .usa-input--md,.usa-form .usa-input--medium,.usa-form .usa-input-group--md,.usa-form .usa-input-group--medium{max-width:20ex}.usa-form .usa-input--lg,.usa-form .usa-input-group--lg{max-width:30ex}.usa-form .usa-input--xl,.usa-form .usa-input-group--xl{max-width:40ex}.usa-form .usa-input--2xl,.usa-form .usa-input-group--2xl{max-width:50ex}.usa-form .usa-button{margin-top:0.5rem}@media all and (min-width: 30em){.usa-form .usa-button{margin-top:1.5rem}}.usa-form a:where(:not(.usa-button)){color:#005ea2;text-decoration:underline}.usa-form a:where(:not(.usa-button)):visited{color:#54278f}.usa-form a:where(:not(.usa-button)):hover{color:#1a4480}.usa-form a:where(:not(.usa-button)):active{color:#162e51}.usa-form a:where(:not(.usa-button)):focus{outline:0.25rem solid #2491ff;outline-offset:0rem}@media all and (min-width: 30em){.usa-form--large{max-width:30rem}}.usa-show-password{color:#005ea2;text-decoration:underline;background-color:transparent;border:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none;font-weight:normal;-ms-flex-pack:normal;justify-content:normal;text-align:left;margin:0;padding:0;width:auto;cursor:pointer}.usa-show-password:visited{color:#54278f}.usa-show-password:hover{color:#1a4480}.usa-show-password:active{color:#162e51}.usa-show-password:focus{outline:0.25rem solid #2491ff;outline-offset:0rem}.usa-show-password:hover,.usa-show-password.usa-button--hover,.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password:disabled.usa-button--hover,.usa-show-password[aria-disabled=true].usa-button--hover,.usa-show-password:active,.usa-show-password.usa-button--active,.usa-show-password:disabled:active,.usa-show-password[aria-disabled=true]:active,.usa-show-password:disabled.usa-button--active,.usa-show-password[aria-disabled=true].usa-button--active,.usa-show-password:disabled:focus,.usa-show-password[aria-disabled=true]:focus,.usa-show-password:disabled.usa-focus,.usa-show-password[aria-disabled=true].usa-focus,.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password.usa-button--disabled{background-color:transparent;-webkit-box-shadow:none;box-shadow:none;text-decoration:underline}.usa-show-password.usa-button--hover{color:#1a4480}.usa-show-password.usa-button--active{color:#162e51}.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password[aria-disabled=true]:focus{color:#757575}@media (forced-colors: active){.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password[aria-disabled=true]:focus{color:GrayText}}.usa-form__note,.usa-show-password{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:0.93rem;line-height:1.3;float:right;margin:0.25rem 0 1rem}.usa-fieldset{border:none;margin:0;padding:0}.usa-legend{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-legend--large{font-size:2.13rem;font-weight:700;margin-top:1rem}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-form-group{margin-top:1.5rem}.usa-form-group .usa-label:first-child{margin-top:0}.usa-form-group--error{border-left-width:0.25rem;border-left-color:#b50909;border-left-style:solid;padding-left:1rem;position:relative}@media all and (min-width: 64em){.usa-form-group--error{margin-left:-1.25rem}}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-memorable-date{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.usa-memorable-date [type=number]{-moz-appearance:textfield}.usa-memorable-date [type=number]::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none}.usa-memorable-date [type=number]::-webkit-contacts-auto-fill-button{visibility:hidden;display:none !important;pointer-events:none;height:0;width:0;margin:0}.usa-memorable-date .usa-form-group{margin-top:1rem}.usa-form-group--day,.usa-form-group--month,.usa-form-group--year{-ms-flex:0 1 auto;flex:0 1 auto;margin-right:1rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.usa-form-group--day input,.usa-form-group--month input{width:3rem}.usa-form-group--month select{width:15rem}.usa-form-group--year input{width:4.5rem}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}:host{display:block;font-family:var(--font-source-sans);margin-top:24px}#error-message{margin-bottom:0}.usa-hint{display:block}slot:not([name])::slotted(*){margin-bottom:0.5rem}va-select::part(label),va-text-input::part(label){margin-top:0;margin-bottom:12px}va-text-input::part(validation){display:none}.usa-memorable-date{margin-top:16px;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.usa-memorable-date .usa-form-group{margin-top:0px}.usa-form-group--month{margin-right:16px}.usa-form-group--month-input{width:48px}.usa-form-group--month-select{width:15rem}.usa-form-group--day-input{width:3rem}.usa-form-group--year-input{width:4.5rem}@media (max-width: 480px){.usa-form-group--month-select{width:100%}.usa-form-group--select{-ms-flex:0 1 50%;flex:0 1 50%;width:50%}}',VaMemorableDateStyle0=vaMemorableDateCss;Build.isTesting&&instance.init({lng:"cimode"});const VaMemorableDate$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.dateChange=createEvent(this,"dateChange",7),this.dateBlur=createEvent(this,"dateBlur",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.dayTouched=!1,this.monthTouched=!1,this.yearTouched=!1,this.handleDateBlur=e=>{let a;const{currentYear:t,currentMonth:r,currentDay:o}=this,s=Number(t||a),i=Number(r||a),n=Number(o||a);if(validate({component:this,year:s,month:i,day:n,yearTouched:this.yearTouched,monthTouched:this.monthTouched,dayTouched:this.dayTouched,monthSelect:this.monthSelect}),!this.error&&(this.value=t||r||o?[t,r?zeroPadStart(i):"",o?zeroPadStart(n):""].join("-"):"",this.dateBlur.emit(e),this.enableAnalytics)){const e={componentName:"va-memorable-date",action:"blur",details:{label:this.label,year:s,month:i,day:n}};this.componentLibraryAnalytics.emit(e)}},this.handleMonthChange=e=>{const a=e.target;this.currentMonth=a.value,this.handleDateChange(e)},this.handleDayChange=e=>{const a=e.target;this.currentDay=a.value,this.handleDateChange(e)},this.handleYearChange=e=>{const a=e.target;this.currentYear=a.value,this.handleDateChange(e)},this.handleDateChange=e=>{const{currentYear:a,currentMonth:t,currentDay:r}=this;this.value=a||t||r?[a||"",t||"",r||""].join("-"):"",this.dateChange.emit(e)},this.handleMonthBlur=()=>{this.monthTouched=!0},this.handleDayBlur=()=>{this.dayTouched=!0},this.handleYearBlur=()=>{this.yearTouched=!0},this.required=!1,this.useFormsPattern=void 0,this.formHeadingLevel=3,this.formHeading=void 0,this.monthSelect=!1,this.label=void 0,this.name=void 0,this.hint=void 0,this.error=void 0,this.value=void 0,this.customDayErrorMessage=void 0,this.customMonthErrorMessage=void 0,this.customYearErrorMessage=void 0,this.invalidDay=!1,this.invalidMonth=!1,this.invalidYear=!1,this.enableAnalytics=!1}connectedCallback(){instance.on("languageChanged",(()=>{forceUpdate(this.el)}))}disconnectedCallback(){instance.off("languageChanged")}componentWillLoad(){const[e,a,t]=(this.value||"").split("-");this.currentYear=e,this.currentMonth=a,this.currentDay=t}render(){const{required:e,label:a,name:t,hint:r,error:o,handleDateBlur:s,monthSelect:i,useFormsPattern:n,formHeadingLevel:l,formHeading:u}=this,{currentYear:m,currentMonth:d,currentDay:p}=this,c=["dateHint",r?"hint":""].filter(Boolean).join(" "),f=i?instance.t("date-hint-with-select"):instance.t("date-hint"),g=e=>instance.t(e,(e=>{const a=parseInt(m,10),t=parseInt(d,10);return getErrorParameters(e,a,t)})(e)),b=`${n&&u?"form-question":""} ${n?"form-description":""} ${n&&a?"input-label":""}`.trim()||null;let w=null;if("single"===n||"multiple"===n){const e=getHeaderLevel(l);w=h(Fragment,null,u&&h(e,{id:"form-question",part:"form-header"},u),h("div",{id:"form-description"},h("slot",{name:"form-description"})))}const v=i?h("div",{class:"usa-form-group usa-form-group--month usa-form-group--select"},h("va-select",{label:instance.t("month"),name:t?`${t}Month`:"Month","aria-describedby":c,"aria-labelledby":b,invalid:this.invalidMonth,onVaSelect:this.handleMonthChange,onBlur:this.handleMonthBlur,class:"usa-form-group--month-select",reflectInputError:"month-range"===o,value:d?String(parseInt(d,10)):d,error:this.invalidMonth?g(o):null,showError:!1},months&&months.map((e=>h("option",{value:e.value,selected:e.value===parseInt(d,10)},e.label))))):h("div",{class:"usa-form-group usa-form-group--month"},h("va-text-input",{label:instance.t("month"),name:t?`${t}Month`:"Month",maxlength:2,pattern:"[0-9]*","aria-describedby":c,"aria-labelledby":b,invalid:this.invalidMonth,value:null==d?void 0:d.toString(),onInput:this.handleMonthChange,onBlur:this.handleMonthBlur,class:"usa-form-group--month-input memorable-date-input",reflectInputError:"month-range"===o,inputmode:"numeric",type:"text",error:this.invalidMonth?g(o):null,"show-input-error":"false"})),y=classnames({"usa-legend":!0,"usa-label--error":o});return h(Host,{onBlur:s},w,h("div",{class:"input-wrap"},h("fieldset",{class:"usa-form usa-fieldset"},h("legend",{class:y,id:"input-label",part:"legend"},a,e&&h("span",{class:"usa-label--required"}," ",instance.t("required")),r&&h("div",{class:"usa-hint",id:"hint"},r),h("span",{class:"usa-hint",id:"dateHint"},f)),h("span",{id:"error-message",role:"alert"},o&&h(Fragment,null,h("span",{class:"usa-sr-only"},instance.t("error")),h("span",{class:"usa-error-message"},(e=>{let a="";return this.invalidDay?a=this.customDayErrorMessage:this.invalidMonth?a=this.customMonthErrorMessage:this.invalidYear&&(a=this.customYearErrorMessage),a||g(e)})(o)))),h("slot",null),h("div",{class:"usa-memorable-date"},v,h("div",{class:"usa-form-group usa-form-group--day"},h("va-text-input",{label:instance.t("day"),name:t?`${t}Day`:"Day",maxlength:2,pattern:"[0-9]*","aria-describedby":c,invalid:this.invalidDay,value:null==p?void 0:p.toString(),onInput:this.handleDayChange,onBlur:this.handleDayBlur,class:"usa-form-group--day-input memorable-date-input",reflectInputError:"day-range"===o,inputmode:"numeric",type:"text",error:this.invalidDay?g(o):null,"show-input-error":"false"})),h("div",{class:"usa-form-group usa-form-group--year"},h("va-text-input",{label:instance.t("year"),name:t?`${t}Year`:"Year",maxlength:4,pattern:"[0-9]*","aria-describedby":c,invalid:this.invalidYear,value:null==m?void 0:m.toString(),onInput:this.handleYearChange,onBlur:this.handleYearBlur,class:"usa-form-group--year-input memorable-date-input",reflectInputError:"year-range"===o,inputmode:"numeric",type:"text",error:this.invalidYear?g(o):null,"show-input-error":"false"}))))))}get el(){return this}static get style(){return VaMemorableDateStyle0}},[1,"va-memorable-date",{required:[4],useFormsPattern:[1,"use-forms-pattern"],formHeadingLevel:[2,"form-heading-level"],formHeading:[1,"form-heading"],monthSelect:[4,"month-select"],label:[1],name:[1],hint:[1],error:[1537],value:[1537],customDayErrorMessage:[1,"custom-day-error-message"],customMonthErrorMessage:[1,"custom-month-error-message"],customYearErrorMessage:[1,"custom-year-error-message"],invalidDay:[1028,"invalid-day"],invalidMonth:[1028,"invalid-month"],invalidYear:[1028,"invalid-year"],enableAnalytics:[4,"enable-analytics"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-memorable-date","va-icon","va-select","va-text-input"].forEach((e=>{switch(e){case"va-memorable-date":customElements.get(e)||customElements.define(e,VaMemorableDate$1);break;case"va-icon":customElements.get(e)||defineCustomElement$4();break;case"va-select":customElements.get(e)||defineCustomElement$3();break;case"va-text-input":customElements.get(e)||defineCustomElement$2()}}))}const VaMemorableDate=VaMemorableDate$1,defineCustomElement=defineCustomElement$1;export{VaMemorableDate,defineCustomElement};
|
|
1
|
+
import{Build,proxyCustomElement,HTMLElement,createEvent,forceUpdate,h,Fragment,Host}from"@stencil/core/internal/client";import{v as validate,z as zeroPadStart,g as getErrorParameters,m as months}from"./date-utils.js";import{g as getHeaderLevel}from"./utils.js";import"./i18n-setup.js";import"./contacts.js";import{c as classnames}from"./index2.js";import{d as defineCustomElement$4}from"./va-icon2.js";import{d as defineCustomElement$3}from"./va-select2.js";import{d as defineCustomElement$2}from"./va-text-input2.js";import{i as instance}from"./i18next.js";const vaMemorableDateCss='button:not([disabled]):focus,select:not([disabled]):focus,a:not([disabled]):focus,h1:focus,input:not([disabled]):focus,textarea:not([disabled]):focus,#form-question [role=\'option\']:focus,*[tabindex]:focus,a.va-sidenav-submenu__link:focus{outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px;z-index:2}#error-message{margin-bottom:0.75rem}#error-message,#input-error-message{color:var(--vads-color-secondary-dark);display:block;font-weight:700;font-size:1.06rem}:host([error]:not([error=\'\'])){border-left:0.3rem solid var(--vads-color-secondary-dark);padding-left:1.25rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=\'\'])){margin-left:-1.4375rem;}}h1{margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:0;margin-top:0;clear:both}*+h1,*+h2,*+h3,*+h4,*+h5,*+h6{margin-top:1.5em}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:1em}h1{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:2.44rem;line-height:1.2;font-weight:700}h2{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.95rem;line-height:1.2;font-weight:700}h3{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:1.34rem;line-height:1.2;font-weight:700}h4{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.98rem;line-height:1.2;font-weight:700}h5{font-family:Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;font-size:0.91rem;line-height:1.2;font-weight:700}h6{font-family:Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;font-size:0.87rem;line-height:1.1;font-weight:normal;letter-spacing:0.025em;text-transform:uppercase}h1,h2,h3,h4,h5{font-family:Bitter, Georgia, Cambria, "Times New Roman", Times, serif;font-weight:700}h6{font-family:"Source Sans Pro Web", "Source Sans Pro", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;font-weight:700}h1{margin-top:0;font-size:2.5rem}h2{font-size:1.875rem}h3{font-size:1.25rem}h4{font-size:1.0625rem}h5{font-size:0.9375rem}h6{font-size:0.9375rem}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}@media (max-width: 481px){h1{font-size:30px}h2{font-size:24px}}h6{margin:0.5em 0 0;text-transform:none;font-weight:700}:host legend :is(h1,h2,h3,h4,h5,h6),:host label :is(h1,h2,h3,h4,h5,h6){display:inline;margin:0px}:host legend :is(h1,h2,h3,h4,h5),:host label :is(h1,h2,h3,h4,h5){font-family:var(--font-serif)}:host h1+*,:host h2+*,:host h3+*,:host h4+*,:host h5+*,:host h6+*{margin-top:unset}:host #form-question{margin-bottom:1rem}.usa-hint,.usa-fieldset{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}.usa-sr-only{position:absolute;left:-999em;right:auto}.usa-form{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3}@media all and (min-width: 30em){.usa-form{max-width:20rem}}.usa-form abbr[title=required]{text-decoration:none}.usa-form .usa-input,.usa-form .usa-range,.usa-form .usa-select,.usa-form .usa-textarea{max-width:none}.usa-form .usa-input--2xs,.usa-form .usa-input-group--2xs{max-width:5ex}.usa-form .usa-input--xs,.usa-form .usa-input-group--xs{max-width:9ex}.usa-form .usa-input--sm,.usa-form .usa-input--small,.usa-form .usa-input-group--sm,.usa-form .usa-input-group--small{max-width:13ex}.usa-form .usa-input--md,.usa-form .usa-input--medium,.usa-form .usa-input-group--md,.usa-form .usa-input-group--medium{max-width:20ex}.usa-form .usa-input--lg,.usa-form .usa-input-group--lg{max-width:30ex}.usa-form .usa-input--xl,.usa-form .usa-input-group--xl{max-width:40ex}.usa-form .usa-input--2xl,.usa-form .usa-input-group--2xl{max-width:50ex}.usa-form .usa-button{margin-top:0.5rem}@media all and (min-width: 30em){.usa-form .usa-button{margin-top:1.5rem}}.usa-form a:where(:not(.usa-button)){color:#005ea2;text-decoration:underline}.usa-form a:where(:not(.usa-button)):visited{color:#54278f}.usa-form a:where(:not(.usa-button)):hover{color:#1a4480}.usa-form a:where(:not(.usa-button)):active{color:#162e51}.usa-form a:where(:not(.usa-button)):focus{outline:0.25rem solid #2491ff;outline-offset:0rem}@media all and (min-width: 30em){.usa-form--large{max-width:30rem}}.usa-show-password{color:#005ea2;text-decoration:underline;background-color:transparent;border:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none;font-weight:normal;-ms-flex-pack:normal;justify-content:normal;text-align:left;margin:0;padding:0;width:auto;cursor:pointer}.usa-show-password:visited{color:#54278f}.usa-show-password:hover{color:#1a4480}.usa-show-password:active{color:#162e51}.usa-show-password:focus{outline:0.25rem solid #2491ff;outline-offset:0rem}.usa-show-password:hover,.usa-show-password.usa-button--hover,.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password:disabled.usa-button--hover,.usa-show-password[aria-disabled=true].usa-button--hover,.usa-show-password:active,.usa-show-password.usa-button--active,.usa-show-password:disabled:active,.usa-show-password[aria-disabled=true]:active,.usa-show-password:disabled.usa-button--active,.usa-show-password[aria-disabled=true].usa-button--active,.usa-show-password:disabled:focus,.usa-show-password[aria-disabled=true]:focus,.usa-show-password:disabled.usa-focus,.usa-show-password[aria-disabled=true].usa-focus,.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password.usa-button--disabled{background-color:transparent;-webkit-box-shadow:none;box-shadow:none;text-decoration:underline}.usa-show-password.usa-button--hover{color:#1a4480}.usa-show-password.usa-button--active{color:#162e51}.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password[aria-disabled=true]:focus{color:#757575}@media (forced-colors: active){.usa-show-password:disabled,.usa-show-password[aria-disabled=true],.usa-show-password:disabled:hover,.usa-show-password[aria-disabled=true]:hover,.usa-show-password[aria-disabled=true]:focus{color:GrayText}}.usa-form__note,.usa-show-password{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:0.93rem;line-height:1.3;float:right;margin:0.25rem 0 1rem}.usa-fieldset{border:none;margin:0;padding:0}.usa-legend{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-legend--large{font-size:2.13rem;font-weight:700;margin-top:1rem}.usa-label{font-family:Source Sans Pro Web, "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans;font-size:1.06rem;line-height:1.3;display:block;font-weight:normal;margin-top:1.5rem;max-width:30rem}.usa-label--error{font-weight:700;margin-top:0}.usa-label--required{color:#b50909}.usa-hint{color:#71767a}.usa-hint--required{color:#b50909}.usa-form-group{margin-top:1.5rem}.usa-form-group .usa-label:first-child{margin-top:0}.usa-form-group--error{border-left-width:0.25rem;border-left-color:#b50909;border-left-style:solid;padding-left:1rem;position:relative}@media all and (min-width: 64em){.usa-form-group--error{margin-left:-1.25rem}}.usa-error-message{padding-bottom:0.25rem;padding-top:0.25rem;color:#b50909;display:block;font-weight:700}.usa-memorable-date{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.usa-memorable-date [type=number]{-moz-appearance:textfield}.usa-memorable-date [type=number]::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none}.usa-memorable-date [type=number]::-webkit-contacts-auto-fill-button{visibility:hidden;display:none !important;pointer-events:none;height:0;width:0;margin:0}.usa-memorable-date .usa-form-group{margin-top:1rem}.usa-form-group--day,.usa-form-group--month,.usa-form-group--year{-ms-flex:0 1 auto;flex:0 1 auto;margin-right:1rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.usa-form-group--day input,.usa-form-group--month input{width:3rem}.usa-form-group--month select{width:15rem}.usa-form-group--year input{width:4.5rem}.usa-error-message{font-size:1.06rem}:host([error]:not([error=""])){border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}:host([error]:not([error=""])[use-forms-pattern=multiple]){border-left:none}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{border-left:0.25rem solid #b50909;padding-left:1rem;position:relative}@media screen and (min-width: 1008px){:host([error]:not([error=""])){margin-left:-0.9rem}:host([error]:not([error=""])[use-forms-pattern=multiple]) .input-wrap{margin-left:-0.9rem}}@media screen and (max-width: 1008px){:host([error]:not([error=""])[use-forms-pattern=multiple]){padding-left:0}}:host{display:block;font-family:var(--font-source-sans);margin-top:24px}#error-message{margin-bottom:0}.usa-hint{display:block}slot:not([name])::slotted(*){margin-bottom:0.5rem}va-select::part(label),va-text-input::part(label){margin-top:0;margin-bottom:12px}va-text-input::part(validation){display:none}.usa-memorable-date{margin-top:16px;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.usa-memorable-date .usa-form-group{margin-top:0px}.usa-form-group--month{margin-right:16px}.usa-form-group--month-input{width:48px}.usa-form-group--month-select{width:15rem}.usa-form-group--day-input{width:3rem}.usa-form-group--year-input{width:4.5rem}@media (max-width: 480px){.usa-form-group--month-select{width:100%}.usa-form-group--select{-ms-flex:0 1 50%;flex:0 1 50%;width:50%}}',VaMemorableDateStyle0=vaMemorableDateCss;Build.isTesting&&instance.init({lng:"cimode"});const VaMemorableDate$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.dateChange=createEvent(this,"dateChange",7),this.dateBlur=createEvent(this,"dateBlur",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.dayTouched=!1,this.monthTouched=!1,this.yearTouched=!1,this.handleDateBlur=e=>{let a;const{currentYear:t,currentMonth:r,currentDay:o}=this,s=Number(t||a),i=Number(r||a),n=Number(o||a);if(validate({component:this,year:s,month:i,day:n,yearTouched:this.yearTouched,monthTouched:this.monthTouched,dayTouched:this.dayTouched,monthSelect:this.monthSelect}),!this.error&&(this.value=t||r||o?[t,r?zeroPadStart(i):"",o?zeroPadStart(n):""].join("-"):"",this.dateBlur.emit(e),this.enableAnalytics)){const e={componentName:"va-memorable-date",action:"blur",details:{label:this.label,year:s,month:i,day:n}};this.componentLibraryAnalytics.emit(e)}},this.handleMonthChange=e=>{const a=e.target;this.currentMonth=a.value,this.handleDateChange(e)},this.handleDayChange=e=>{const a=e.target;this.currentDay=a.value,this.handleDateChange(e)},this.handleYearChange=e=>{const a=e.target;this.currentYear=a.value,this.handleDateChange(e)},this.handleDateChange=e=>{const{currentYear:a,currentMonth:t,currentDay:r}=this;this.value=a||t||r?[a||"",t||"",r||""].join("-"):"",this.dateChange.emit(e)},this.handleMonthBlur=()=>{this.monthTouched=!0},this.handleDayBlur=()=>{this.dayTouched=!0},this.handleYearBlur=()=>{this.yearTouched=!0},this.required=!1,this.useFormsPattern=void 0,this.formHeadingLevel=3,this.formHeading=void 0,this.monthSelect=!1,this.label=void 0,this.name=void 0,this.hint=void 0,this.error=void 0,this.value=void 0,this.customDayErrorMessage=void 0,this.customMonthErrorMessage=void 0,this.customYearErrorMessage=void 0,this.invalidDay=!1,this.invalidMonth=!1,this.invalidYear=!1,this.enableAnalytics=!1}connectedCallback(){instance.on("languageChanged",(()=>{forceUpdate(this.el)}))}disconnectedCallback(){instance.off("languageChanged")}componentWillLoad(){const[e,a,t]=(this.value||"").split("-");this.currentYear=e,this.currentMonth=a,this.currentDay=t}render(){const{required:e,label:a,name:t,hint:r,error:o,handleDateBlur:s,monthSelect:i,useFormsPattern:n,formHeadingLevel:l,formHeading:u}=this,{currentYear:m,currentMonth:d,currentDay:p}=this,c=["dateHint",r?"hint":""].filter(Boolean).join(" "),f=i?instance.t("date-hint-with-select"):instance.t("date-hint"),g=e=>instance.t(e,(e=>{const a=parseInt(m,10),t=parseInt(d,10);return getErrorParameters(e,a,t)})(e)),b=`${n&&u?"form-question":""} ${n?"form-description":""} ${n&&a?"input-label":""}`.trim()||null;let w=null;if("single"===n||"multiple"===n){const e=getHeaderLevel(l);w=h(Fragment,null,u&&h(e,{id:"form-question",part:"form-header"},u),h("div",{id:"form-description"},h("slot",{name:"form-description"})))}const v=i?h("div",{class:"usa-form-group usa-form-group--month usa-form-group--select"},h("va-select",{label:instance.t("month"),name:t?`${t}Month`:"Month","aria-describedby":c,"aria-labelledby":b,invalid:this.invalidMonth,onVaSelect:this.handleMonthChange,onBlur:this.handleMonthBlur,class:"usa-form-group--month-select",reflectInputError:"month-range"===o,value:d?String(parseInt(d,10)):d,error:this.invalidMonth?g(o):null,showError:!1},months&&months.map((e=>h("option",{value:e.value,selected:e.value===parseInt(d,10)},e.label))))):h("div",{class:"usa-form-group usa-form-group--month"},h("va-text-input",{label:instance.t("month"),name:t?`${t}Month`:"Month",maxlength:2,pattern:"[0-9]*","aria-describedby":c,"aria-labelledby":b,invalid:this.invalidMonth,value:null==d?void 0:d.toString(),onInput:this.handleMonthChange,onBlur:this.handleMonthBlur,class:"usa-form-group--month-input memorable-date-input",reflectInputError:"month-range"===o,inputmode:"numeric",type:"text",error:this.invalidMonth?g(o):null,"show-input-error":"false"})),y=classnames({"usa-legend":!0,"usa-label--error":o});return h(Host,{onBlur:s},w,h("div",{class:"input-wrap"},h("fieldset",{class:"usa-form usa-fieldset"},h("legend",{class:y,id:"input-label",part:"legend"},a,e&&h("span",{class:"usa-label--required"}," ",instance.t("required")),r&&h("div",{class:"usa-hint",id:"hint"},r),h("span",{class:"usa-hint",id:"dateHint"},f)),h("span",{id:"error-message",role:"alert"},o&&h(Fragment,null,h("span",{class:"usa-sr-only"},instance.t("error")),h("span",{class:"usa-error-message"},(e=>{let a="";return this.invalidDay?a=this.customDayErrorMessage:this.invalidMonth?a=this.customMonthErrorMessage:this.invalidYear&&(a=this.customYearErrorMessage),a||g(e)})(o)))),h("slot",null),h("div",{class:"usa-memorable-date"},v,h("div",{class:"usa-form-group usa-form-group--day"},h("va-text-input",{label:instance.t("day"),name:t?`${t}Day`:"Day",maxlength:2,pattern:"[0-9]*","aria-describedby":c,invalid:this.invalidDay,value:null==p?void 0:p.toString(),onInput:this.handleDayChange,onBlur:this.handleDayBlur,class:"usa-form-group--day-input memorable-date-input",reflectInputError:"day-range"===o,inputmode:"numeric",type:"text",error:this.invalidDay?g(o):null,"show-input-error":"false"})),h("div",{class:"usa-form-group usa-form-group--year"},h("va-text-input",{label:instance.t("year"),name:t?`${t}Year`:"Year",maxlength:4,pattern:"[0-9]*","aria-describedby":c,invalid:this.invalidYear,value:null==m?void 0:m.toString(),onInput:this.handleYearChange,onBlur:this.handleYearBlur,class:"usa-form-group--year-input memorable-date-input",reflectInputError:"year-range"===o,inputmode:"numeric",type:"text",error:this.invalidYear?g(o):null,"show-input-error":"false"}))))))}get el(){return this}static get style(){return VaMemorableDateStyle0}},[1,"va-memorable-date",{required:[4],useFormsPattern:[1,"use-forms-pattern"],formHeadingLevel:[2,"form-heading-level"],formHeading:[1,"form-heading"],monthSelect:[4,"month-select"],label:[1],name:[1],hint:[1],error:[1537],value:[1537],customDayErrorMessage:[1,"custom-day-error-message"],customMonthErrorMessage:[1,"custom-month-error-message"],customYearErrorMessage:[1,"custom-year-error-message"],invalidDay:[1028,"invalid-day"],invalidMonth:[1028,"invalid-month"],invalidYear:[1028,"invalid-year"],enableAnalytics:[4,"enable-analytics"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-memorable-date","va-icon","va-select","va-text-input"].forEach((e=>{switch(e){case"va-memorable-date":customElements.get(e)||customElements.define(e,VaMemorableDate$1);break;case"va-icon":customElements.get(e)||defineCustomElement$4();break;case"va-select":customElements.get(e)||defineCustomElement$3();break;case"va-text-input":customElements.get(e)||defineCustomElement$2()}}))}const VaMemorableDate=VaMemorableDate$1,defineCustomElement=defineCustomElement$1;export{VaMemorableDate,defineCustomElement};
|