@watermarkinsights/ripple 3.12.0 → 3.13.0-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chartFunctions-44ae2eee.js → chartFunctions-34fdd3ce.js} +1 -1
- package/dist/cjs/{functions-1a67b971.js → functions-120449cf.js} +245 -32
- package/dist/cjs/{global-122fc638.js → global-1d1d0ab3.js} +7 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
- package/dist/cjs/priv-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-button.cjs.entry.js +50 -38
- package/dist/cjs/wm-chart.cjs.entry.js +2 -2
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-input.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal-footer.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal-header.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-network-uploader.cjs.entry.js +6 -4
- package/dist/cjs/wm-option_2.cjs.entry.js +345 -122
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +1 -1
- package/dist/cjs/wm-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +1 -1
- package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-toggletip.cjs.entry.js +4 -4
- package/dist/cjs/wm-uploader.cjs.entry.js +9 -11
- package/dist/collection/components/wm-button/wm-button.css +1 -0
- package/dist/collection/components/wm-button/wm-button.js +50 -40
- package/dist/collection/components/wm-modal/wm-modal-footer.js +1 -1
- package/dist/collection/components/wm-option/wm-option.css +12 -0
- package/dist/collection/components/wm-option/wm-option.js +34 -29
- package/dist/collection/components/wm-select/wm-select.css +76 -23
- package/dist/collection/components/wm-select/wm-select.js +385 -125
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +5 -5
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +0 -3
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +4 -2
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -5
- package/dist/collection/components/wm-uploader/wm-uploader.js +7 -9
- package/dist/collection/global/__mocks__/functions.js +9 -0
- package/dist/collection/global/functions.js +1 -28
- package/dist/collection/global/global.js +6 -4
- package/dist/esm/{chartFunctions-8fa800a6.js → chartFunctions-20f05eb5.js} +1 -1
- package/dist/esm/{functions-61c7bb1f.js → functions-036af8dc.js} +245 -32
- package/dist/esm/{global-5902ef31.js → global-590c515d.js} +7 -5
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +51 -39
- package/dist/esm/wm-chart.entry.js +2 -2
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-input.entry.js +1 -1
- package/dist/esm/wm-modal-footer.entry.js +1 -1
- package/dist/esm/wm-modal-header.entry.js +1 -1
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +1 -1
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-network-uploader.entry.js +6 -4
- package/dist/esm/wm-option_2.entry.js +345 -122
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +1 -1
- package/dist/esm/wm-snackbar.entry.js +1 -1
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +1 -1
- package/dist/esm/wm-timepicker.entry.js +1 -1
- package/dist/esm/wm-toggletip.entry.js +4 -4
- package/dist/esm/wm-uploader.entry.js +9 -11
- package/dist/esm-es5/{chartFunctions-8fa800a6.js → chartFunctions-20f05eb5.js} +1 -1
- package/dist/esm-es5/{functions-61c7bb1f.js → functions-036af8dc.js} +2 -2
- package/dist/esm-es5/global-590c515d.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-28bf6a2e.system.js → p-04d8b674.system.js} +1 -1
- package/dist/ripple/{p-d3ed8b65.system.entry.js → p-04e44b30.system.entry.js} +1 -1
- package/dist/ripple/{p-fdc4a599.system.entry.js → p-0556279c.system.entry.js} +1 -1
- package/dist/ripple/{p-1242752c.system.entry.js → p-06adbeb9.system.entry.js} +1 -1
- package/dist/ripple/{p-42aa51fe.system.entry.js → p-0e9ccc6f.system.entry.js} +1 -1
- package/dist/ripple/{p-520b0f54.entry.js → p-17ceb8c1.entry.js} +1 -1
- package/dist/ripple/{p-8caae464.entry.js → p-1887286e.entry.js} +1 -1
- package/dist/ripple/{p-c873b490.system.entry.js → p-1ccd994d.system.entry.js} +1 -1
- package/dist/ripple/p-1d795f42.entry.js +1 -0
- package/dist/ripple/p-2996bfe6.entry.js +1 -0
- package/dist/ripple/{p-30745db6.entry.js → p-2f860b24.entry.js} +1 -1
- package/dist/ripple/p-3489b502.js +1 -0
- package/dist/ripple/{p-cd4fda75.entry.js → p-3680b55d.entry.js} +1 -1
- package/dist/ripple/p-3745c620.system.js +1 -0
- package/dist/ripple/{p-f12a510f.entry.js → p-3a1d6fc4.entry.js} +1 -1
- package/dist/ripple/p-42337590.entry.js +1 -0
- package/dist/ripple/{p-68155230.system.entry.js → p-49fd7ede.system.entry.js} +1 -1
- package/dist/ripple/{p-8aa9f811.js → p-4ecd3430.js} +1 -1
- package/dist/ripple/{p-5471864e.system.entry.js → p-62eac2d6.system.entry.js} +1 -1
- package/dist/ripple/{p-5e041c35.entry.js → p-6aa6a818.entry.js} +1 -1
- package/dist/ripple/{p-487f7419.system.entry.js → p-6bf5cbf4.system.entry.js} +1 -1
- package/dist/ripple/{p-e180001c.system.entry.js → p-7173b0a7.system.entry.js} +1 -1
- package/dist/ripple/p-726c979a.system.js +15 -0
- package/dist/ripple/{p-eacd33cc.system.entry.js → p-752da0fb.system.entry.js} +1 -1
- package/dist/ripple/{p-f36b74bf.entry.js → p-7ae1a630.entry.js} +1 -1
- package/dist/ripple/{p-8d347cd5.entry.js → p-7ecbf258.entry.js} +1 -1
- package/dist/ripple/{p-75ef731b.system.entry.js → p-7ef6a7cf.system.entry.js} +1 -1
- package/dist/ripple/p-8612829b.system.entry.js +1 -0
- package/dist/ripple/{p-398b2486.system.entry.js → p-895f5ec5.system.entry.js} +1 -1
- package/dist/ripple/{p-d3603def.entry.js → p-8de546e8.entry.js} +1 -1
- package/dist/ripple/{p-35cfcf9f.entry.js → p-93dee724.entry.js} +1 -1
- package/dist/ripple/{p-0f33461d.entry.js → p-97c2b06f.entry.js} +1 -1
- package/dist/ripple/{p-9f12284b.system.entry.js → p-995ba16f.system.entry.js} +1 -1
- package/dist/ripple/p-9c92c93f.entry.js +1 -0
- package/dist/ripple/p-9e09d7a1.entry.js +1 -0
- package/dist/ripple/{p-f0656464.entry.js → p-a04ba6c8.entry.js} +1 -1
- package/dist/ripple/{p-44035b02.system.entry.js → p-af3ce4fc.system.entry.js} +1 -1
- package/dist/ripple/p-bbcafbd6.system.entry.js +1 -0
- package/dist/ripple/{p-eee347b4.system.entry.js → p-c1443a0e.system.entry.js} +1 -1
- package/dist/ripple/{p-212aac05.system.entry.js → p-ca383a43.system.entry.js} +1 -1
- package/dist/ripple/{p-ca2fbd1b.system.js → p-cc247ee1.system.js} +1 -1
- package/dist/ripple/{p-73d66b0a.system.entry.js → p-cd3d74d1.system.entry.js} +1 -1
- package/dist/ripple/p-d1ac96e1.system.entry.js +1 -0
- package/dist/ripple/{p-3f1d8211.system.entry.js → p-d48c56c7.system.entry.js} +1 -1
- package/dist/ripple/{p-15b1c11b.js → p-de3367ee.js} +2 -2
- package/dist/ripple/{p-e748e22b.entry.js → p-e083fca6.entry.js} +1 -1
- package/dist/ripple/{p-3e6498ea.system.entry.js → p-e4439bc3.system.entry.js} +1 -1
- package/dist/ripple/{p-e49b9a96.entry.js → p-e524d462.entry.js} +1 -1
- package/dist/ripple/{p-92226595.entry.js → p-e8d39f68.entry.js} +1 -1
- package/dist/ripple/{p-00fa3d4b.entry.js → p-ed91be1a.entry.js} +1 -1
- package/dist/ripple/{p-d81a4e7c.system.entry.js → p-f23b3986.system.entry.js} +1 -1
- package/dist/ripple/{p-e75e75e0.entry.js → p-fda61e7e.entry.js} +1 -1
- package/dist/ripple/p-fe952112.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-button/wm-button.d.ts +4 -4
- package/dist/types/components/wm-option/wm-option.d.ts +5 -2
- package/dist/types/components/wm-select/wm-select.d.ts +39 -12
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +2 -2
- package/dist/types/components.d.ts +10 -6
- package/dist/types/global/__mocks__/functions.d.ts +1 -0
- package/dist/types/global/functions.d.ts +2 -2
- package/dist/types/global/interfaces.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/global-5902ef31.js +0 -1
- package/dist/ripple/p-1b058a44.entry.js +0 -1
- package/dist/ripple/p-2077203e.system.js +0 -1
- package/dist/ripple/p-379b125b.entry.js +0 -1
- package/dist/ripple/p-49bf0b81.js +0 -1
- package/dist/ripple/p-584fef7f.system.entry.js +0 -1
- package/dist/ripple/p-72eb5064.system.entry.js +0 -1
- package/dist/ripple/p-76ca7498.system.js +0 -15
- package/dist/ripple/p-9fe64cec.entry.js +0 -1
- package/dist/ripple/p-a82d37d8.entry.js +0 -1
- package/dist/ripple/p-ac2485a6.system.entry.js +0 -1
- package/dist/ripple/p-ba168596.entry.js +0 -1
- package/dist/ripple/p-ed657559.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as r,h as t,H as i,g as o}from"./p-b3c71506.js";import{i as s,g as a,l as n,e as p}from"./p-15b1c11b.js";let l=class{constructor(t){e(this,t),this.wmTimepickerNewValidValue=r(this,"wmTimepickerNewValidValue",7),this.wmTimepickerOnChange=r(this,"wmTimepickerOnChange",7),this.disabled=!1,this.value="",this.label="",this.labelPosition="top",this.requiredField=!1,this.isExpanded=!1,this.isTabbing=!1,this.twelveHrValid=/^(0?[0-9]|1[0-2])\s*:?\s*([0-5][0-9])?\s?(a|p|am|pm)?$/i,this.twentyFourHrValid=/^(0?[0-9]|1[0-9]|2[0-4])\s*:?\s*([0-5][0-9])?$/,this.uid="",this.timeFormat="hh:mm",this.times=[],this.openUp=!1,this.buttonAriaLabel=s.formatMessage({id:"time.selectTime",defaultMessage:"Select time",description:"Button text for screen readers."})}toggleTabbingOn(){this.isTabbing=!0}toggleTabbingOff(){this.isTabbing=!1}handleKey(e){switch(e.key){case"ArrowDown":e.preventDefault(),!1===this.isExpanded?this.open("next"):this.moveDown(this.selectedOption);break;case"ArrowUp":e.preventDefault(),!1===this.isExpanded?this.open("previous"):this.moveUp(this.selectedOption);break;case"Enter":case" ":this.isExpanded&&(e.preventDefault(),this.handleOptionClick(this.selectedOption.textContent));break;case"Escape":e.preventDefault(),this.isExpanded&&(e.stopPropagation(),this.close());break;case"Tab":this.isExpanded&&this.close(!1);break;case"Home":e.preventDefault(),this.isExpanded&&(this.focusOption(this.optionsList[0]),this.setDropdownPosition("first"));break;case"End":e.preventDefault(),this.isExpanded&&(this.focusOption(this.optionsList[this.optionsList.length-1]),this.setDropdownPosition("last"))}}updateErrorState(){this.displayedErrorMessage=this.errorMessage}componentWillLoad(){""===this.label&&console.error("You must include a label prop for the timepicker (for accessibility reasons), even if the label position is none."),this.el.focus=function(){this.disabled||this.shadowRoot.querySelector("input").focus()},this.uid=this.el.id?this.el.id:a(),this.updateErrorState(),this.timeFormat=s.formatMessage({id:"time.timeFormat",defaultMessage:"hh:mm"}),this.times=this.generateTimes()}componentDidLoad(){this.optionsEl.classList.add("hidden"),this.optionsList=Array.from(this.optionsEl.querySelectorAll("li")),this.value&&this.processInput()}isValidTime(e){return this.twelveHrValid.test(e)||this.twentyFourHrValid.test(e)}generateTimes(){let e=[],r=0;for(let t=0;r<1440;t++){const i=Math.floor(r/60).toString().padStart(2,"0"),o=(r%60).toString().padStart(2,"0");e[t]=`${i}:${o}`,r+=15}return e}findNearestTimeInterval(e){let r=this.formatToStorage(e);const t=parseInt(r.slice(3,5));if(t%15!=0){const i=parseInt(r.slice(0,2));let o=(15*Math.round(t/15)).toString().padStart(2,"0");if("60"===o){o="00";let e=i+1;24===e&&(e=0),r=r.replace(`${i.toString().padStart(2,"0")}:`,`${e.toString().padStart(2,"0")}:`)}parseInt(o)<8&&(o="00"),e=r.replace(`:${t.toString().padStart(2,"0")}`,`:${o}`)}return e}handleListSelection(e){e=this.findNearestTimeInterval(e);const r=this.optionsList.filter((r=>r.textContent==this.formatToDisplay(e)))[0];r&&this.focusOption(r)}setValue(e){const r=this.value;this.inputEl.value=this.formatToDisplay(e),this.value=this.formatToStorage(e),this.handleListSelection(e),r!==this.value&&this.wmTimepickerNewValidValue.emit({value:this.value}),this.wmTimepickerOnChange.emit({value:this.value,isValid:!!this.displayedErrorMessage})}processInput(){this.isValidTime(this.value)&&this.setValue(this.value);const e=this.determineErrorMessage();this.displayedErrorMessage=e}determineErrorMessage(){let e=this.errorMessage;const r=s.formatMessage({id:"time.requiredError",defaultMessage:"A time is required."}),t=s.formatMessage({id:"time.invalidTime",defaultMessage:"Please enter a valid time."}),i=this.isValidTime(this.value);return i&&!this.errorMessage?e=null:i||this.errorMessage||(e=this.requiredField&&!this.value?r:this.value?t:null),e}splitTime(e){const r=this.twelveHrValid.exec(e)||this.twentyFourHrValid.exec(e);let t=parseInt(r[1]),i=r[2]||"00",o=r?r[3]:void 0;return 0===t&&(null==o?void 0:o.toUpperCase().includes("P"))&&(o="AM"),[t,i,o]}formatToDisplay(e){let[r,t,i]=this.splitTime(e);return 12!==r||i||(i="PM"),0!==r&&24!==r||(r=12),r>12&&(r-=12,i="PM"),i=i&&i.toUpperCase().includes("P")?"PM":"AM",`${r.toString().padStart(2,"0")}:${t} ${i}`}formatToStorage(e){let[r,t,i]=this.splitTime(e);return 24===r&&(r=0),12===r&&i&&i.toUpperCase().includes("A")&&(r-=12),i&&i.toUpperCase().includes("P")&&12!==r&&(r+=12),`${r.toString().padStart(2,"0")}:${t}`}open(e){this.openUp=n(this.el,this.optionsEl),this.isExpanded=!0,this.optionsEl.classList.remove("hidden"),!this.errorMessage&&this.value||this.handleListSelection("09:00"),this.setDropdownPosition("center",this.selectedOption),this.focusOption(this.selectedOption),window.requestAnimationFrame((()=>{"next"===e?this.moveDown(this.selectedOption):"previous"===e&&this.moveUp(this.selectedOption)}))}close(e=!0){this.isExpanded=!1,window.setTimeout((()=>{this.optionsEl.classList.add("hidden"),e&&this.buttonEl.focus()}),150)}focusOption(e){this.optionsList.forEach((e=>{e.tabIndex=-1})),e.tabIndex=0,this.selectedOption=e,e.focus()}setDropdownPosition(e,r){switch(e){case"top":this.optionsEl.scrollTop=(null==r?void 0:r.previousElementSibling).getBoundingClientRect().top-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop;break;case"bottom":this.optionsEl.scrollTop=(null==r?void 0:r.nextElementSibling).getBoundingClientRect().bottom-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop-this.optionsEl.offsetHeight;break;case"center":this.optionsEl.scrollTop=(this.optionsList.findIndex((e=>e.textContent===(null==r?void 0:r.textContent)))-2)*r.offsetHeight;break;case"first":this.optionsEl.scrollTop=0;break;case"last":this.optionsEl.scrollTop=this.optionsList[0].clientHeight*this.optionsList.length}}moveUp(e){const r=e.previousElementSibling;r?(r.getBoundingClientRect().top<this.optionsEl.getBoundingClientRect().top&&this.setDropdownPosition("top",e),this.focusOption(r)):(this.focusOption(this.optionsList[this.optionsList.length-1]),this.setDropdownPosition("last"))}moveDown(e){const r=e.nextElementSibling;r?(r.getBoundingClientRect().bottom>this.optionsEl.getBoundingClientRect().bottom&&this.setDropdownPosition("bottom",e),this.focusOption(r)):(this.focusOption(this.optionsList[0]),this.setDropdownPosition("first"))}handleOptionClick(e){this.close(),this.setValue(e),this.processInput()}handleInput(){this.value=this.inputEl.value,this.isValidTime(this.value)&&(this.handleListSelection(this.findNearestTimeInterval(this.value)),this.setDropdownPosition("center",this.selectedOption))}handleInputBlur(e){this.preventValidation&&p(e,this.preventValidation)||this.processInput(),this.tpWrapper.classList.remove("focus")}renderOptions(){return this.times.map(((e,r)=>t("li",{id:`option${r+1}`,role:"option",onClick:()=>this.handleOptionClick(e)},this.formatToDisplay(e))))}render(){return t(i,{id:this.uid,invalid:this.displayedErrorMessage?"true":null,onBlur:()=>this.close(!1)},t("div",{class:`wrapper label-${this.labelPosition} ${this.displayedErrorMessage?"invalid":""}`,ref:e=>this.tpWrapper=e},t("div",{class:"label-wrapper"},"none"!==this.labelPosition&&t("label",{id:`label-${this.uid}`,class:"label",htmlFor:`time-input-${this.uid}`},this.label,this.requiredField&&t("span",{class:"required","aria-hidden":"true"},"*"))),t("div",null,t("div",{class:"inner-wrapper"},t("input",{id:`time-input-${this.uid}`,"aria-label":this.label,"aria-describedby":`error-${this.uid}`,ref:e=>this.inputEl=e,onBlur:e=>this.handleInputBlur(e),onInput:()=>this.handleInput(),disabled:this.disabled,required:this.requiredField,placeholder:this.timeFormat,autocomplete:"off",onFocus:()=>this.tpWrapper.classList.add("focus")}),t("button",{id:`btn-${this.uid}`,class:this.isTabbing?"user-is-tabbing":"",ref:e=>this.buttonEl=e,disabled:this.disabled,"aria-controls":`list-${this.uid}`,"aria-expanded":this.isExpanded?"true":"false","aria-label":this.buttonAriaLabel,"aria-describedby":`time-input-${this.uid}`,onClick:()=>this.isExpanded?this.close():this.open(),onMouseDown:e=>{e.preventDefault(),this.buttonEl.focus()}},t("span",{class:"clock"})),t("ul",{class:`options ${this.isExpanded?"open":""} ${this.openUp?"upwards":""}`,id:`list-${this.uid}`,role:"listbox","aria-labelledby":`label-${this.uid}`,"aria-describedby":this.isExpanded?"collapsed":null,tabindex:-1,ref:e=>this.optionsEl=e},this.renderOptions())),t("div",{id:`error-${this.uid}`,class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayedErrorMessage))))}get el(){return o(this)}static get watchers(){return{errorMessage:["updateErrorState"]}}};l.style=':host,wm-timepicker{font-family:inherit}:host *,wm-timepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .sr-only,wm-timepicker .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper,wm-timepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-timepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-timepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-timepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-timepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-timepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-timepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-timepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-timepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-timepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-timepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-timepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper input,wm-timepicker .wrapper .inner-wrapper input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;font-family:inherit}:host .wrapper .inner-wrapper input:disabled,wm-timepicker .wrapper .inner-wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper input:focus,wm-timepicker .wrapper .inner-wrapper input:focus{outline:none}:host .wrapper .inner-wrapper button,wm-timepicker .wrapper .inner-wrapper button{all:unset;cursor:pointer;padding:0 0.375rem;height:2.375rem;background-color:#fff;border:none;-moz-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-moz-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-top-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;-moz-border-bottom-left-radius:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button .clock::after,wm-timepicker .wrapper .inner-wrapper button .clock::after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f150";color:#575195;font-size:1.5rem;padding:0;line-height:2.5rem}:host .wrapper .inner-wrapper button:hover,wm-timepicker .wrapper .inner-wrapper button:hover{background:#e6e6e6;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled,wm-timepicker .wrapper .inner-wrapper button:disabled{background-color:rgba(74, 74, 74, 0.05);pointer-events:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled .clock::after,wm-timepicker .wrapper .inner-wrapper button:disabled .clock::after{color:#7b7b7b}[dir=RTL] :host .wrapper .inner-wrapper button,[dir=RTL] wm-timepicker .wrapper .inner-wrapper button{right:auto;left:0}:host .wrapper .inner-wrapper button:focus,wm-timepicker .wrapper .inner-wrapper button:focus{outline:none}:host .wrapper .inner-wrapper button.user-is-tabbing:focus,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}:host .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper button::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper .options,wm-timepicker .wrapper .inner-wrapper .options{margin:0;padding:0;-webkit-overflow-scrolling:touch;overflow:auto;max-height:19.0625rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:2.5rem;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .wrapper .inner-wrapper .options.upwards,wm-timepicker .wrapper .inner-wrapper .options.upwards{top:unset;bottom:2.5rem;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .wrapper .inner-wrapper .options.hidden,wm-timepicker .wrapper .inner-wrapper .options.hidden{visibility:hidden}:host .wrapper .inner-wrapper .options [role=option],wm-timepicker .wrapper .inner-wrapper .options [role=option]{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a}:host .wrapper .inner-wrapper .options [role=option]:hover,wm-timepicker .wrapper .inner-wrapper .options [role=option]:hover{background:#f4f4f4;outline:none}:host .wrapper .inner-wrapper .options [role=option]:focus,wm-timepicker .wrapper .inner-wrapper .options [role=option]:focus{outline:none;background:#f4f4f4}:host .wrapper .inner-wrapper .options [role=option]:not(:last-child),wm-timepicker .wrapper .inner-wrapper .options [role=option]:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .wrapper .inner-wrapper .options.open,wm-timepicker .wrapper .inner-wrapper .options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper.invalid .inner-wrapper,wm-timepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-timepicker .wrapper.invalid .error{color:#c0392b;margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic}:host .wrapper:focus .inner-wrapper,:host .wrapper.focus .inner-wrapper,wm-timepicker .wrapper:focus .inner-wrapper,wm-timepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}';export{l as wm_timepicker}
|
|
1
|
+
import{r as e,c as r,h as t,H as i,g as o}from"./p-b3c71506.js";import{i as s,g as a,l as n,e as p}from"./p-de3367ee.js";let l=class{constructor(t){e(this,t),this.wmTimepickerNewValidValue=r(this,"wmTimepickerNewValidValue",7),this.wmTimepickerOnChange=r(this,"wmTimepickerOnChange",7),this.disabled=!1,this.value="",this.label="",this.labelPosition="top",this.requiredField=!1,this.isExpanded=!1,this.isTabbing=!1,this.twelveHrValid=/^(0?[0-9]|1[0-2])\s*:?\s*([0-5][0-9])?\s?(a|p|am|pm)?$/i,this.twentyFourHrValid=/^(0?[0-9]|1[0-9]|2[0-4])\s*:?\s*([0-5][0-9])?$/,this.uid="",this.timeFormat="hh:mm",this.times=[],this.openUp=!1,this.buttonAriaLabel=s.formatMessage({id:"time.selectTime",defaultMessage:"Select time",description:"Button text for screen readers."})}toggleTabbingOn(){this.isTabbing=!0}toggleTabbingOff(){this.isTabbing=!1}handleKey(e){switch(e.key){case"ArrowDown":e.preventDefault(),!1===this.isExpanded?this.open("next"):this.moveDown(this.selectedOption);break;case"ArrowUp":e.preventDefault(),!1===this.isExpanded?this.open("previous"):this.moveUp(this.selectedOption);break;case"Enter":case" ":this.isExpanded&&(e.preventDefault(),this.handleOptionClick(this.selectedOption.textContent));break;case"Escape":e.preventDefault(),this.isExpanded&&(e.stopPropagation(),this.close());break;case"Tab":this.isExpanded&&this.close(!1);break;case"Home":e.preventDefault(),this.isExpanded&&(this.focusOption(this.optionsList[0]),this.setDropdownPosition("first"));break;case"End":e.preventDefault(),this.isExpanded&&(this.focusOption(this.optionsList[this.optionsList.length-1]),this.setDropdownPosition("last"))}}updateErrorState(){this.displayedErrorMessage=this.errorMessage}componentWillLoad(){""===this.label&&console.error("You must include a label prop for the timepicker (for accessibility reasons), even if the label position is none."),this.el.focus=function(){this.disabled||this.shadowRoot.querySelector("input").focus()},this.uid=this.el.id?this.el.id:a(),this.updateErrorState(),this.timeFormat=s.formatMessage({id:"time.timeFormat",defaultMessage:"hh:mm"}),this.times=this.generateTimes()}componentDidLoad(){this.optionsEl.classList.add("hidden"),this.optionsList=Array.from(this.optionsEl.querySelectorAll("li")),this.value&&this.processInput()}isValidTime(e){return this.twelveHrValid.test(e)||this.twentyFourHrValid.test(e)}generateTimes(){let e=[],r=0;for(let t=0;r<1440;t++){const i=Math.floor(r/60).toString().padStart(2,"0"),o=(r%60).toString().padStart(2,"0");e[t]=`${i}:${o}`,r+=15}return e}findNearestTimeInterval(e){let r=this.formatToStorage(e);const t=parseInt(r.slice(3,5));if(t%15!=0){const i=parseInt(r.slice(0,2));let o=(15*Math.round(t/15)).toString().padStart(2,"0");if("60"===o){o="00";let e=i+1;24===e&&(e=0),r=r.replace(`${i.toString().padStart(2,"0")}:`,`${e.toString().padStart(2,"0")}:`)}parseInt(o)<8&&(o="00"),e=r.replace(`:${t.toString().padStart(2,"0")}`,`:${o}`)}return e}handleListSelection(e){e=this.findNearestTimeInterval(e);const r=this.optionsList.filter((r=>r.textContent==this.formatToDisplay(e)))[0];r&&this.focusOption(r)}setValue(e){const r=this.value;this.inputEl.value=this.formatToDisplay(e),this.value=this.formatToStorage(e),this.handleListSelection(e),r!==this.value&&this.wmTimepickerNewValidValue.emit({value:this.value}),this.wmTimepickerOnChange.emit({value:this.value,isValid:!!this.displayedErrorMessage})}processInput(){this.isValidTime(this.value)&&this.setValue(this.value);const e=this.determineErrorMessage();this.displayedErrorMessage=e}determineErrorMessage(){let e=this.errorMessage;const r=s.formatMessage({id:"time.requiredError",defaultMessage:"A time is required."}),t=s.formatMessage({id:"time.invalidTime",defaultMessage:"Please enter a valid time."}),i=this.isValidTime(this.value);return i&&!this.errorMessage?e=null:i||this.errorMessage||(e=this.requiredField&&!this.value?r:this.value?t:null),e}splitTime(e){const r=this.twelveHrValid.exec(e)||this.twentyFourHrValid.exec(e);let t=parseInt(r[1]),i=r[2]||"00",o=r?r[3]:void 0;return 0===t&&(null==o?void 0:o.toUpperCase().includes("P"))&&(o="AM"),[t,i,o]}formatToDisplay(e){let[r,t,i]=this.splitTime(e);return 12!==r||i||(i="PM"),0!==r&&24!==r||(r=12),r>12&&(r-=12,i="PM"),i=i&&i.toUpperCase().includes("P")?"PM":"AM",`${r.toString().padStart(2,"0")}:${t} ${i}`}formatToStorage(e){let[r,t,i]=this.splitTime(e);return 24===r&&(r=0),12===r&&i&&i.toUpperCase().includes("A")&&(r-=12),i&&i.toUpperCase().includes("P")&&12!==r&&(r+=12),`${r.toString().padStart(2,"0")}:${t}`}open(e){this.openUp=n(this.el,this.optionsEl),this.isExpanded=!0,this.optionsEl.classList.remove("hidden"),!this.errorMessage&&this.value||this.handleListSelection("09:00"),this.setDropdownPosition("center",this.selectedOption),this.focusOption(this.selectedOption),window.requestAnimationFrame((()=>{"next"===e?this.moveDown(this.selectedOption):"previous"===e&&this.moveUp(this.selectedOption)}))}close(e=!0){this.isExpanded=!1,window.setTimeout((()=>{this.optionsEl.classList.add("hidden"),e&&this.buttonEl.focus()}),150)}focusOption(e){this.optionsList.forEach((e=>{e.tabIndex=-1})),e.tabIndex=0,this.selectedOption=e,e.focus()}setDropdownPosition(e,r){switch(e){case"top":this.optionsEl.scrollTop=(null==r?void 0:r.previousElementSibling).getBoundingClientRect().top-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop;break;case"bottom":this.optionsEl.scrollTop=(null==r?void 0:r.nextElementSibling).getBoundingClientRect().bottom-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop-this.optionsEl.offsetHeight;break;case"center":this.optionsEl.scrollTop=(this.optionsList.findIndex((e=>e.textContent===(null==r?void 0:r.textContent)))-2)*r.offsetHeight;break;case"first":this.optionsEl.scrollTop=0;break;case"last":this.optionsEl.scrollTop=this.optionsList[0].clientHeight*this.optionsList.length}}moveUp(e){const r=e.previousElementSibling;r?(r.getBoundingClientRect().top<this.optionsEl.getBoundingClientRect().top&&this.setDropdownPosition("top",e),this.focusOption(r)):(this.focusOption(this.optionsList[this.optionsList.length-1]),this.setDropdownPosition("last"))}moveDown(e){const r=e.nextElementSibling;r?(r.getBoundingClientRect().bottom>this.optionsEl.getBoundingClientRect().bottom&&this.setDropdownPosition("bottom",e),this.focusOption(r)):(this.focusOption(this.optionsList[0]),this.setDropdownPosition("first"))}handleOptionClick(e){this.close(),this.setValue(e),this.processInput()}handleInput(){this.value=this.inputEl.value,this.isValidTime(this.value)&&(this.handleListSelection(this.findNearestTimeInterval(this.value)),this.setDropdownPosition("center",this.selectedOption))}handleInputBlur(e){this.preventValidation&&p(e,this.preventValidation)||this.processInput(),this.tpWrapper.classList.remove("focus")}renderOptions(){return this.times.map(((e,r)=>t("li",{id:`option${r+1}`,role:"option",onClick:()=>this.handleOptionClick(e)},this.formatToDisplay(e))))}render(){return t(i,{id:this.uid,invalid:this.displayedErrorMessage?"true":null,onBlur:()=>this.close(!1)},t("div",{class:`wrapper label-${this.labelPosition} ${this.displayedErrorMessage?"invalid":""}`,ref:e=>this.tpWrapper=e},t("div",{class:"label-wrapper"},"none"!==this.labelPosition&&t("label",{id:`label-${this.uid}`,class:"label",htmlFor:`time-input-${this.uid}`},this.label,this.requiredField&&t("span",{class:"required","aria-hidden":"true"},"*"))),t("div",null,t("div",{class:"inner-wrapper"},t("input",{id:`time-input-${this.uid}`,"aria-label":this.label,"aria-describedby":`error-${this.uid}`,ref:e=>this.inputEl=e,onBlur:e=>this.handleInputBlur(e),onInput:()=>this.handleInput(),disabled:this.disabled,required:this.requiredField,placeholder:this.timeFormat,autocomplete:"off",onFocus:()=>this.tpWrapper.classList.add("focus")}),t("button",{id:`btn-${this.uid}`,class:this.isTabbing?"user-is-tabbing":"",ref:e=>this.buttonEl=e,disabled:this.disabled,"aria-controls":`list-${this.uid}`,"aria-expanded":this.isExpanded?"true":"false","aria-label":this.buttonAriaLabel,"aria-describedby":`time-input-${this.uid}`,onClick:()=>this.isExpanded?this.close():this.open(),onMouseDown:e=>{e.preventDefault(),this.buttonEl.focus()}},t("span",{class:"clock"})),t("ul",{class:`options ${this.isExpanded?"open":""} ${this.openUp?"upwards":""}`,id:`list-${this.uid}`,role:"listbox","aria-labelledby":`label-${this.uid}`,"aria-describedby":this.isExpanded?"collapsed":null,tabindex:-1,ref:e=>this.optionsEl=e},this.renderOptions())),t("div",{id:`error-${this.uid}`,class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayedErrorMessage))))}get el(){return o(this)}static get watchers(){return{errorMessage:["updateErrorState"]}}};l.style=':host,wm-timepicker{font-family:inherit}:host *,wm-timepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .sr-only,wm-timepicker .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper,wm-timepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-timepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-timepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-timepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-timepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-timepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-timepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-timepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-timepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-timepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-timepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-timepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper input,wm-timepicker .wrapper .inner-wrapper input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;font-family:inherit}:host .wrapper .inner-wrapper input:disabled,wm-timepicker .wrapper .inner-wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper input:focus,wm-timepicker .wrapper .inner-wrapper input:focus{outline:none}:host .wrapper .inner-wrapper button,wm-timepicker .wrapper .inner-wrapper button{all:unset;cursor:pointer;padding:0 0.375rem;height:2.375rem;background-color:#fff;border:none;-moz-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-moz-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-top-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;-moz-border-bottom-left-radius:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button .clock::after,wm-timepicker .wrapper .inner-wrapper button .clock::after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f150";color:#575195;font-size:1.5rem;padding:0;line-height:2.5rem}:host .wrapper .inner-wrapper button:hover,wm-timepicker .wrapper .inner-wrapper button:hover{background:#e6e6e6;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled,wm-timepicker .wrapper .inner-wrapper button:disabled{background-color:rgba(74, 74, 74, 0.05);pointer-events:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled .clock::after,wm-timepicker .wrapper .inner-wrapper button:disabled .clock::after{color:#7b7b7b}[dir=RTL] :host .wrapper .inner-wrapper button,[dir=RTL] wm-timepicker .wrapper .inner-wrapper button{right:auto;left:0}:host .wrapper .inner-wrapper button:focus,wm-timepicker .wrapper .inner-wrapper button:focus{outline:none}:host .wrapper .inner-wrapper button.user-is-tabbing:focus,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}:host .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper button::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper .options,wm-timepicker .wrapper .inner-wrapper .options{margin:0;padding:0;-webkit-overflow-scrolling:touch;overflow:auto;max-height:19.0625rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:2.5rem;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .wrapper .inner-wrapper .options.upwards,wm-timepicker .wrapper .inner-wrapper .options.upwards{top:unset;bottom:2.5rem;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .wrapper .inner-wrapper .options.hidden,wm-timepicker .wrapper .inner-wrapper .options.hidden{visibility:hidden}:host .wrapper .inner-wrapper .options [role=option],wm-timepicker .wrapper .inner-wrapper .options [role=option]{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a}:host .wrapper .inner-wrapper .options [role=option]:hover,wm-timepicker .wrapper .inner-wrapper .options [role=option]:hover{background:#f4f4f4;outline:none}:host .wrapper .inner-wrapper .options [role=option]:focus,wm-timepicker .wrapper .inner-wrapper .options [role=option]:focus{outline:none;background:#f4f4f4}:host .wrapper .inner-wrapper .options [role=option]:not(:last-child),wm-timepicker .wrapper .inner-wrapper .options [role=option]:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .wrapper .inner-wrapper .options.open,wm-timepicker .wrapper .inner-wrapper .options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper.invalid .inner-wrapper,wm-timepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-timepicker .wrapper.invalid .error{color:#c0392b;margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic}:host .wrapper:focus .inner-wrapper,:host .wrapper.focus .inner-wrapper,wm-timepicker .wrapper:focus .inner-wrapper,wm-timepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}';export{l as wm_timepicker}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register([],(function(){"use strict";return{execute:function(){var e="3.13.0-9";if(window.navigator.plugins.length>0){console.log("Ripple component library",e)}function t(e){if(e.key=="Tab"){var t=new Event("wmUserIsTabbing");window.dispatchEvent(t);document.querySelector("body").classList.add("wmcl-user-is-tabbing")}if(e.key=="ArrowLeft"||e.key=="ArrowUp"||e.key=="ArrowRight"||e.key=="ArrowDown"){var t=new Event("wmUserIsKeying");window.dispatchEvent(t);document.querySelector("body").classList.add("wmcl-user-is-keying")}}function n(){var e=new Event("wmUserIsNotTabbing");window.dispatchEvent(e);document.querySelector("body").classList.remove("wmcl-user-is-tabbing");document.querySelector("body").classList.remove("wmcl-user-is-keying")}window.addEventListener("keydown",t);window.addEventListener("mousedown",n);var o=document.createElement("div");o.id="wm-tooltip-container";var i=document.createElement("div");i.id="wm-tooltip";i.setAttribute("aria-hidden","true");i.style.position="fixed";i.style.overflow="hidden";i.style.pointerEvents="none";i.style.lineHeight="normal";i.style.fontFamily="inherit";i.style.fontSize="0.875rem";i.style.textTransform="none";i.style.fontWeight="normal";i.style.background="black";i.style.color="#fff";i.style.zIndex="999999";i.style.maxWidth="13.75rem";i.style.marginRight="1.5rem";i.style.padding="0.375rem";i.style.transitionProperty="opacity";i.style.transitionDelay="opacity";i.style.opacity="0";i.style.top="0";i.style.left="0";i.style.transform="translateZ(0)";i.style.willChange="transform";i.style.transform="translate(var(--wmTooltipLeft), var(--wmTooltipTop))";o.appendChild(i);var r=document.querySelector("body");r.appendChild(o)}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as o,h as i,H as e,g as r}from"./p-b3c71506.js";import{i as n}from"./p-
|
|
1
|
+
import{r as t,c as o,h as i,H as e,g as r}from"./p-b3c71506.js";import{i as n}from"./p-de3367ee.js";let s=class{constructor(i){t(this,i),this.wmChartPopoverButtonTriggered=o(this,"wmChartPopoverButtonTriggered",7),this.wmProgressIndicatorButtonTriggered=o(this,"wmProgressIndicatorButtonTriggered",7),this.chartEl=this.el.parentElement.getRootNode().host,this.open=!1,this.coords={},this.popoverWidth=168,this.popoverClicked=!1}get eventToEmit(){return"WM-CHART"===this.chartEl.nodeName?this.wmChartPopoverButtonTriggered:this.wmProgressIndicatorButtonTriggered}handleClickOnDocument(){this.open=this.popoverClicked,this.popoverClicked=!1}handleClick(t){let o=!1;this.btnEl&&(o=t.target===this.btnEl||this.btnEl.contains(t.target)),this.popoverClicked=!o&&(t.target===this.el||this.el.contains(t.target))}handleButtonClick(){this.sliceRef&&(this.sliceRef.click(),this.eventToEmit.emit(this.sliceRef)),this.open=!1}renderLiveRegion(){if(this.liveRegion){this.liveRegion.innerHTML="";const t=document.createElement("div"),o=document.createElement("span");o.innerHTML=this.popoverTitle+" "||"",t.appendChild(o);const i=document.createElement("span");if(i.innerHTML=this.popoverText+" "||"",t.appendChild(i),this.buttonText){const o=document.createElement("span");o.innerHTML=this.buttonText+" "+n.formatMessage({id:"chart.infoButton",defaultMessage:"Button. Click for more information."}),t.appendChild(o)}this.liveRegion.appendChild(t)}}positionPopover(){this.el.style.top=this.coords.y+"px",this.el.style.left=window.innerWidth-this.coords.x>=this.popoverWidth+10?this.coords.x+"px":this.coords.x-this.popoverWidth+"px"}render(){return i(e,null,this.open?i("div",{"aria-hidden":"true",class:"popover"},i("h1",{class:"title"},this.popoverTitle),i("p",{class:"text"},this.popoverText),this.buttonText?i("button",{tabindex:"-1",focusable:"false",ref:t=>this.btnEl=t,class:"popover-button",onClick:()=>this.handleButtonClick()},i("svg",{class:"btn-icon",height:"9",width:"9"},i("path",{fill:"#575195",d:"M0 3.38v2.25h9V3.38H0zM0 0v2.25h4.5V0H0zm6.19 6.75H0V9h6.19V6.75z"})),i("span",{class:"button-text"},this.buttonText)):""):"",i("div",{ref:t=>this.liveRegion=t,class:"live-region sr-only","aria-live":"polite","aria-atomic":"true"},this.open&&this.renderLiveRegion()))}get el(){return r(this)}static get watchers(){return{coords:["positionPopover"]}}};s.style="priv-chart-popover{position:fixed;z-index:10;border-radius:0.1875rem;-webkit-box-shadow:0 11px 15px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.12);-moz-box-shadow:0 11px 15px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.12);box-shadow:0 11px 15px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.12);background-color:#fff;font-size:0.875rem;text-align:left}priv-chart-popover.user-is-tabbing .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, #3862e9), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.popover{width:10.5rem;padding:0.625rem 0.9375rem;-webkit-box-sizing:border-box;box-sizing:border-box}.popover h1.title{font-size:1em;font-weight:500;margin:0;padding-top:0;padding-left:0;padding-bottom:0.25rem}.popover .text{margin:0;margin-bottom:0.5rem}.popover .popover-button{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;position:relative;display:inline-block;margin-left:1rem;padding-left:0;padding-right:0;height:auto;border:none;background:transparent;cursor:pointer;text-decoration:none;letter-spacing:0;text-transform:none;text-align:initial;font-size:0.875rem;font-weight:700;color:#575195;line-height:normal}.popover .popover-button .btn-icon{position:absolute;top:0.1875rem;left:-1rem}.popover .popover-button:focus{outline:none}.popover .popover-button::-moz-focus-inner{border:0;outline:none}.popover .popover-button:hover{text-decoration:none;background:none;color:#454077}.popover .popover-button:hover span{text-decoration:underline}";export{s as priv_chart_popover}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as r,f as o}from"./p-b3c71506.js";import{i as n,d as a,g as l,l as h,q as p}from"./p-de3367ee.js";let d=class{constructor(i){t(this,i),this.wmOptionSelected=e(this,"wmOptionSelected",7),this.wmKeyUpPressed=e(this,"wmKeyUpPressed",7),this.wmKeyDownPressed=e(this,"wmKeyDownPressed",7),this.wmEscKeyPressed=e(this,"wmEscKeyPressed",7),this.wmHomeKeyPressed=e(this,"wmHomeKeyPressed",7),this.wmEndKeyPressed=e(this,"wmEndKeyPressed",7),this.wmEnterKeyPressed=e(this,"wmEnterKeyPressed",7),this.wmLetterPressed=e(this,"wmLetterPressed",7),this.wmOptionBlurred=e(this,"wmOptionBlurred",7),this.subinfo=void 0,this.disabled=!1,this.selected=!1,this.focused=!1,this.searchTerm=""}get hostClasses(){let t=[];return this.subinfo&&t.push("hassubinfo"),this.parentSelectEl.multiple&&t.push("multi-option"),this.el.textContent.toLowerCase().includes(this.searchTerm)||t.push("filtered-out"),t.join(" ")}get parentSelectEl(){var t;return"WM-SELECT"!==(null===(t=this.el.parentElement)||void 0===t?void 0:t.nodeName)?this.el.getRootNode().host:this.el.parentElement}handleKeydown(t){switch(t.key){case"ArrowUp":t.preventDefault(),this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":t.preventDefault(),this.wmKeyDownPressed.emit(this.el);break;case"Enter":t.preventDefault(),this.disabled||(this.el.click(),this.wmEnterKeyPressed.emit(this.el));break;case" ":t.preventDefault(),this.el.click();break;case"Escape":t.preventDefault(),t.stopPropagation(),this.wmEscKeyPressed.emit();break;case"Home":t.preventDefault(),this.wmHomeKeyPressed.emit();break;case"End":t.preventDefault(),this.wmEndKeyPressed.emit();break;default:this.wmLetterPressed.emit(t.key)}}handleSelection(){this.disabled||this.wmOptionSelected.emit(this.el)}handleBlur(t){this.wmOptionBlurred.emit({relatedTarget:t.relatedTarget})}syncAriaSelected(){this.selected?this.el.setAttribute("aria-selected","true"):this.el.removeAttribute("aria-selected")}syncAriaDisabled(){this.disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")}focusHandler(t){t&&this.el.focus()}updateDisabledOnClick(){this.disabled&&this.el.onclick?(this.onClickFunc=this.el.onclick,this.el.onclick=null):!this.disabled&&this.onClickFunc&&(this.el.onclick=this.onClickFunc)}handleSearch(t){this.searchTerm=t.detail.searchTerm.toLowerCase();const e=new RegExp(`${this.searchTerm}`,"gi"),i=this.el.textContent.replace(e,(t=>`<b>${t}</b>`));this.textEl.innerHTML=`<span>${i}</span>`}componentWillLoad(){this.syncAriaSelected(),this.syncAriaDisabled(),this.updateDisabledOnClick(),this.parentSelectEl.addEventListener("wmSelectSearchChanged",(t=>this.handleSearch(t)))}render(){return i(s,{role:"option",tabindex:this.focused?0:-1,class:this.hostClasses},i("div",{class:"option-wrapper "+(this.parentSelectEl.multiple?"checkbox":""),ref:t=>this.textEl=t},i("slot",null)),i("div",{class:"subinfo"},this.subinfo))}get el(){return r(this)}static get watchers(){return{selected:["syncAriaSelected"],disabled:["syncAriaDisabled","updateDisabledOnClick"],focused:["focusHandler"]}}};d.style=':host(:not(:last-child)),wm-option:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host,wm-option{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus,wm-option:focus,wm-option.focus{outline:none;background:#f4f4f4}:host.icon,wm-option.icon{color:#575195}.checkbox:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f131";display:inline;margin-right:0.25rem;color:#575195}:host([aria-selected=true]),wm-option[aria-selected=true]{background:rgba(46, 27, 70, 0.05);font-weight:500}:host([aria-selected=true]) .checkbox:before,wm-option[aria-selected=true] .checkbox:before{content:"\\f132"}:host([aria-disabled=true]),wm-option[aria-disabled=true]{font-style:italic;color:#6b6b6b;cursor:default}:host([aria-disabled=true]) .checkbox:before,wm-option[aria-disabled=true] .checkbox:before{color:#6b6b6b}:host(.multi-option),wm-option.multi-option{background:unset}:host(.hidden),wm-option.hidden,:host(.filtered-out),wm-option.filtered-out{display:none}:host(.duplicate.last),wm-option.duplicate.last{border-bottom:12px solid rgba(46, 27, 70, 0.05)}:host(.hassubinfo),wm-option.hassubinfo{display:-ms-flexbox;display:flex}:host(.hassubinfo) .option-wrapper,wm-option.hassubinfo .option-wrapper{-ms-flex:1;flex:1}:host(.hassubinfo) .subinfo,wm-option.hassubinfo .subinfo{-ms-flex:none;flex:none}.subinfo{font-style:italic}.option-wrapper{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-option:focus{outline:none;background:#f4f4f4}:host(:hover){background:#f4f4f4;outline:none}';let c=class{constructor(i){t(this,i),this.wmSelectDidLoad=e(this,"wmSelectDidLoad",7),this.wmSelectBlurred=e(this,"wmSelectBlurred",7),this.wmComponentBlurred=e(this,"wmComponentBlurred",7),this.wmSelectSearchChanged=e(this,"wmSelectSearchChanged",7),this.disabled=!1,this.invalid=!1,this.labelPosition="top",this.requiredField=!1,this.errorMessage="",this.multiple=!1,this.search=!1,this.placeholder=n.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text. Use imperative"}),this.searchPlaceholder=n.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"}),this.allSelectedMessage=n.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"}),this.requiredMessage=n.formatMessage({id:"global.requiredField",defaultMessage:"required field"}),this.isTabbing=!1,this.isExpanded=!1,this.announcement="",this.keysSoFar="",this.searchIndex=0,this.keyClear=null,this.openUp=!1,this.overflowCount=0,this.displayedOptions=[],this.debouncedSearch=a((()=>{this.wmSelectSearchChanged.emit({searchTerm:this.searchTerm}),this.announce(this.filteredOptions.length?this.resultsFoundMessage:this.noResultsFoundMessage)}),150)}get childOptions(){return Array.from(this.el.querySelectorAll("wm-option"))}get duplicateOptions(){return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"))}get allOptionEls(){return this.duplicateOptions.concat(this.childOptions)}get visibleOptionEls(){return this.allOptionEls.filter((t=>!t.classList.contains("hidden")&&!t.classList.contains("filtered-out")))}get searchTerm(){return this.searchFieldEl?this.searchFieldEl.value:""}get filteredOptions(){return this.childOptions.filter((t=>{var e;return null===(e=t.textContent)||void 0===e?void 0:e.toLowerCase().includes(this.searchTerm)}))}get selectedOptions(){return Array.from(this.el.querySelectorAll("wm-option")).filter((t=>t.selected))}get allSelected(){return this.childOptions.filter((t=>t.selected)).length===this.childOptions.length}get resultsFoundMessage(){return n.formatMessage({id:"select.searchResultsFound",defaultMessage:"{numResults, plural, one {1 option found} other {# options found}}",description:"The message read by the screen reader, indicating how many results a search returned"},{numResults:this.filteredOptions.length})}get noResultsFoundMessage(){return n.formatMessage({id:"select.noSearchResults",defaultMessage:"No results found. Please try your search again.",description:"The message displayed when no options pass the search filter"})}toggleTabbingOn(){this.isTabbing=!0}toggleTabbingOff(){this.isTabbing=!1}handleOptionSelection(t){this.multiple||this.childOptions.forEach((e=>e.selected=e===t.detail)),this.focusOption(t.detail),this.selectOption(t.detail),this.multiple||this.close()}handleChildEnter(){this.close()}handleChildUp(t){this.moveUp(t.detail)}handleChildDown(t){this.moveDown(t.detail)}moveToFirstOption(){this.focusOption(this.visibleOptionEls[0])}moveToLastOption(){this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1])}closePopupOnEscape(){this.close()}handleOptionBlur(t){if(!this.isElOrChild(t.detail.relatedTarget)){const e=new CustomEvent("blur");e.relatedTarget=t.detail.relatedTarget,this.el.dispatchEvent(e)}}handleClick(t){this.isElOrChild(t.target)||this.close()}handleButtonBlur(t){this.isElOrChild(t.relatedTarget)&&t.stopPropagation()}handleSearchFieldBlur(t){this.searchFieldWrapperEl.classList.remove("focus"),this.isElOrChild(t.relatedTarget)&&t.stopPropagation()}handleKey(t){switch(t.key){case"ArrowDown":!1===this.isExpanded&&(t.preventDefault(),this.open("next"));break;case"ArrowUp":!1===this.isExpanded&&(t.preventDefault(),this.open("previous"))}}componentWillLoad(){this.label||console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`)."),this.el.focus=function(){this.disabled||this.shadowRoot.querySelector("button").focus()},this.uid=this.el.id?this.el.id:l(),document.body.classList.contains("wmcl-user-is-tabbing")&&this.toggleTabbingOn(),this.selectedOptions.length>0?this.selectedOptions.forEach((t=>{this.displayedOptions.push(t)})):this.multiple||this.selectOption(this.allOptionEls[0])}componentDidLoad(){if(this.wmSelectDidLoad.emit(),this.multiple&&this.allOptionEls.filter((t=>t.subinfo)).length>0)throw new Error("wm-select with the multiple prop cannot have subinfo options");if(this.multiple&&!this.placeholder)throw new Error("wm-select with the multiple prop needs to also use the placeholder prop.");this.dropdownEl.classList.add("hidden"),o(this.el),this.maxHeight&&(this.dropdownEl.style.maxHeight=this.maxHeight),new MutationObserver((()=>this.handleSelectedMutation())).observe(this.el,{attributes:!0,attributeFilter:["selected"],subtree:!0}),this.multiple&&this.updateOptionVisibility(),this.setButtonText()}componentWillUpdate(){if(this.multiple){const t=this.visibleOptionEls.filter((t=>t.classList.contains("duplicate")));t.forEach(((e,i)=>{i===t.length-1?e.classList.add("last"):e.classList.remove("last")}))}}handleSelectedMutation(){const t=new CustomEvent("change");this.el.dispatchEvent(t)}moveUp(t){const e=this.visibleOptionEls[this.visibleOptionEls.indexOf(t)-1];e?(e.getBoundingClientRect().top<this.dropdownEl.getBoundingClientRect().top&&this.scrollOptionToTop(e),this.focusOption(e)):this.search?this.searchFieldEl.focus():this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1])}moveDown(t){const e=this.visibleOptionEls[this.visibleOptionEls.indexOf(t)+1];e?(e.getBoundingClientRect().bottom>this.dropdownEl.getBoundingClientRect().bottom&&this.scrollOptionToBottom(e),this.focusOption(e)):this.focusOption(this.visibleOptionEls[0])}scrollOptionToTop(t){this.dropdownEl.scrollTop=t.getBoundingClientRect().top-this.dropdownEl.getBoundingClientRect().top+this.dropdownEl.scrollTop}scrollOptionToBottom(t){this.dropdownEl.scrollTop=t.getBoundingClientRect().bottom-this.dropdownEl.getBoundingClientRect().top+this.dropdownEl.scrollTop-this.dropdownEl.offsetHeight}open(t){this.disabled||(this.openUp=h(this.el,this.dropdownEl,this.el.clientHeight,this.buttonEl.clientHeight),this.isExpanded=!0,this.dropdownEl.classList.remove("hidden"),window.requestAnimationFrame((()=>{switch(t){case"next":this.search?(this.searchFieldEl.focus(),this.dropdownEl.scrollTop=0):this.moveDown(this.visibleOptionEls.filter((t=>t.selected)).slice(-1)[0]);break;case"previous":this.search?this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1]):this.moveUp(this.visibleOptionEls.filter((t=>t.selected))[0]);break;default:this.search?(this.searchFieldEl.focus(),this.dropdownEl.scrollTop=0):this.focusOption(this.selectedOptions.length>0?this.visibleOptionEls.filter((t=>t.selected))[0]:this.visibleOptionEls[0])}})))}close(t=!0){this.isExpanded&&(this.isExpanded=!1,this.allOptionEls.map((t=>t.focused=!1)),window.setTimeout((()=>{this.dropdownEl.classList.add("hidden"),this.multiple&&this.updateOptionVisibility(),this.search&&(this.searchFieldEl.value="",this.wmSelectSearchChanged.emit({searchTerm:this.searchTerm})),t&&this.el.focus()}),150))}updateOptionVisibility(){this.childOptions.forEach(((t,e)=>{const i=this.duplicateOptions[e];t.selected?(t.classList.add("hidden"),i.classList.remove("hidden")):(t.classList.remove("hidden"),i.classList.add("hidden"))}))}focusOption(t){this.allOptionEls.forEach((e=>e.focused=e===t)),t.focus()}selectOption(t){if(t.classList.contains("duplicate")){const e=this.findCorrespondingOption(t);e.selected=!e.selected,o(this.el)}else this.multiple?t.selected=!t.selected:this.allOptionEls.forEach((e=>e.selected=e===t));this.setButtonText()}findAndFocusOption(t){const e=t.detail.toUpperCase();if(!this.keysSoFar)for(var i=0;i<this.allOptionEls.length;i++)this.allOptionEls[i].focused&&(this.searchIndex=i);this.keysSoFar+=e,this.clearKeysSoFarAfterDelay();var s=this.findMatchInRange(this.allOptionEls,this.searchIndex+1,this.allOptionEls.length);s||(s=this.findMatchInRange(this.allOptionEls,0,this.searchIndex)),s&&this.focusOption(s)}clearKeysSoFarAfterDelay(){this.keyClear&&(window.clearTimeout(this.keyClear),this.keyClear=null),this.keyClear=window.setTimeout(function(){this.keysSoFar="",this.keyClear=null}.bind(this),500)}findMatchInRange(t,e,i){for(var s=e;s<i;s++){var r=t[s].textContent;if(r&&0===r.toUpperCase().indexOf(this.keysSoFar))return t[s]}return null}findCorrespondingOption(t){return t.classList.contains("duplicate")?this.childOptions[this.duplicateOptions.indexOf(t)]:this.duplicateOptions[this.childOptions.indexOf(t)]}isElOrChild(t){var e;return t===this.el||this.el.contains(t)||(null===(e=this.el.shadowRoot)||void 0===e?void 0:e.contains(t))}exposeErrors(){const t=l();this.errorContainer.id=`wm-errors-${t}`,this.buttonEl.setAttribute("aria-describedby",`wm-errors-${t}`)}renderErrorContainer(){return i("div",{id:"wm-errors",class:this.errorMessage?"error-message":"",ref:t=>this.errorContainer=t,"aria-live":"assertive","aria-atomic":"true"},this.errorMessage)}handleComponentBlur(t){this.el.contains(t.relatedTarget)||(this.close(!1),this.wmSelectBlurred.emit(),this.wmComponentBlurred.emit())}handleSearchFieldKeyDown(t){switch(t.key){case"ArrowDown":t.preventDefault(),this.visibleOptionEls.length&&this.focusOption(this.visibleOptionEls[0]);break;case"ArrowUp":t.preventDefault(),this.visibleOptionEls.length&&this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length-1]);break;case"Escape":t.preventDefault(),this.close()}}setButtonText(){if(this.displayedOptions=this.childOptions.filter((t=>t.selected)).map((t=>t.classList.contains("hidden")?this.findCorrespondingOption(t):t)),this.multiple){const t=38,e=window.getComputedStyle(this.buttonEl),i=parseInt(e.getPropertyValue("padding-left").slice(0,-2)),s=parseInt(e.getPropertyValue("padding-right").slice(0,-2)),r=this.buttonEl.clientWidth-i-s-t;let o=this.displayedOptions.map((t=>t.shadowRoot.querySelector(".option-wrapper").clientWidth)),n=o.reduce(((t,e)=>t+e),0);for(this.overflowCount=0;n>r&&this.displayedOptions.length>1;)this.overflowCount++,n-=o[o.length-1],o.pop(),this.displayedOptions.pop()}}announce(t){this.liveRegionEl.textContent===t&&(t+=" "),this.announcement=t}renderButtonText(){return this.multiple&&this.displayedOptions.length<1?i("span",null,this.placeholder):this.multiple&&this.allSelected&&this.overflowCount>0?this.allSelectedMessage:this.displayedOptions.map(((t,e)=>i("span",null,e>0?", ":"",t.textContent)))}renderSubinfo(){if(!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].subinfo)return i("span",{class:"subinfo"},this.selectedOptions[0].subinfo)}renderOverflowCount(){if(this.overflowCount>0&&!this.allSelected)return i("span",null,i("span",{class:"overflow-counter"},"+",this.overflowCount))}renderSearchField(){return i("div",{class:"search"},i("div",{class:"searchfield-wrapper",ref:t=>this.searchFieldWrapperEl=t},i("div",{class:"icon"}),i("input",{ref:t=>this.searchFieldEl=t,class:"searchfield",role:"combobox","aria-controls":`list-${this.uid}`,"aria-expanded":this.isExpanded?"true":"false",onKeyDown:t=>this.handleSearchFieldKeyDown(t),onFocus:()=>this.searchFieldWrapperEl.classList.add("focus"),onBlur:t=>this.handleSearchFieldBlur(t),onInput:()=>this.debouncedSearch(),placeholder:this.searchPlaceholder})))}renderSearchFailedMessage(){return i("div",{class:"search-results-message"},this.noResultsFoundMessage)}renderDuplicateOptions(){return Array.from(this.el.children).map((t=>i("wm-option",{class:"duplicate",selected:t.selected},t.textContent)))}render(){const t={id:`selectbtn-${this.uid}`,disabled:this.disabled,"aria-controls":`list-${this.uid}`,"aria-labelledby":`label-${this.uid} selectbtn-${this.uid}`,"aria-describedby":"wm-errors","aria-expanded":this.isExpanded?"true":"false",onClick:()=>this.isExpanded?this.close():this.open()};return i(s,{onBlur:t=>this.handleComponentBlur(t)},i("div",{class:`wrapper ${p()} label-${this.labelPosition} ${this.invalid||this.errorMessage?"invalid":""}`},i("div",{class:"label-wrapper"},i("label",{class:"label",id:`label-${this.uid}`,htmlFor:`selectbtn-${this.uid}`},this.label,this.requiredField?i("span",{class:"required"},i("span",{class:"sr-only"},this.requiredMessage),i("span",{"aria-hidden":"true"},"*")):"")),i("div",{class:"button-wrapper"},i("button",Object.assign({},t,{class:"displayedoption "+(this.isTabbing?"user-is-tabbing":""),ref:t=>this.buttonEl=t,onBlur:t=>this.handleButtonBlur(t),onFocus:()=>this.close()}),i("span",{class:this.selectedOptions.length>0&&this.selectedOptions.filter((t=>t.subinfo)).length>0?"overflowcontrol hassubinfo":"overflowcontrol"},i("span",{class:"button-text"},this.renderButtonText()),this.renderSubinfo()),this.renderOverflowCount()),i("div",{class:`dropdown ${this.isExpanded?"open":""} ${this.openUp?"upwards":""}`,ref:t=>this.dropdownEl=t},this.search&&this.renderSearchField(),i("div",{id:`list-${this.uid}`,tabindex:-1,role:"listbox","aria-multiselectable":this.multiple?"true":null,"aria-labelledby":`label-${this.uid}`},this.search&&0===this.filteredOptions.length&&this.renderSearchFailedMessage(),this.multiple&&this.renderDuplicateOptions(),i("slot",null))),this.renderErrorContainer(),i("div",{"aria-live":"polite",class:"sr-only",ref:t=>this.liveRegionEl=t},this.announcement))))}get el(){return r(this)}static get watchers(){return{errorMessage:["exposeErrors"]}}};c.style=':host{position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:#c0392b}.wrapper.label-left{-ms-flex-direction:row;flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:#c0392b}.wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:#575195;min-width:8.75rem}.wrapper .button-wrapper .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;background:transparent;width:100%;border:solid 1px rgba(35, 35, 35, 0.6);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:#575195;font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .displayedoption:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f140";position:absolute;right:0.5625rem;pointer-events:none}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:transparent;text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}.wrapper .button-wrapper .displayedoption.user-is-tabbing:focus::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}.wrapper .error-message{color:#c0392b;font-size:0.875rem;margin-top:0.25rem;margin-bottom:0.25rem;display:block;top:100%;left:0;font-style:italic}.search{-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:2px solid rgba(46, 27, 70, 0.05);padding:1.25rem}.search .searchfield-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.75rem;width:100%;padding:0 0.75rem;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:1px solid #4a4a4a}.search .searchfield-wrapper:focus,.search .searchfield-wrapper.focus{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}.search .searchfield{width:100%;border:none;outline:none;font-family:inherit;font-size:0.875rem;margin-left:0.25rem}.search .icon:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f349";color:#6b6b6b;font-size:0.875rem}.search-results-message{padding:1.25rem;color:#4a4a4a;font-size:0.875rem;font-style:italic}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}';export{d as wm_option,c as wm_select}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,s,i){function r(e){return e instanceof s?e:new s((function(t){t(e)}))}return new(s||(s=Promise))((function(s,n){function o(e){try{l(i.next(e))}catch(e){n(e)}}function a(e){try{l(i["throw"](e))}catch(e){n(e)}}function l(e){e.done?s(e.value):r(e.value).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(o){if(i)throw new TypeError("Generator is already executing.");while(s)try{if(i=1,r&&(n=o[0]&2?r["return"]:o[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;if(r=0,n)o=[o[0]&2,n.value];switch(o[0]){case 0:case 1:n=o;break;case 4:s.label++;return{value:o[1],done:false};case 5:s.label++;r=o[1];o=[0];continue;case 7:o=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){s=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(o[0]===6&&s.label<n[1]){s.label=n[1];n=o;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(o);break}if(n[2])s.ops.pop();s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e];r=0}finally{i=n=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-a0c3ef16.system.js","./p-76ca7498.system.js"],(function(e){"use strict";var t,s,i,r,n,o;return{setters:[function(e){t=e.r;s=e.c;i=e.h;r=e.H;n=e.g},function(e){o=e.i}],execute:function(){var a=':host,wm-search{width:100%;font-size:0.875rem}:host *,wm-search *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wm-search-wrapper,wm-search .wm-search-wrapper{border-radius:3px;position:relative;border:1px solid rgba(35, 35, 35, 0.6);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .wm-search-wrapper .search-icon,wm-search .wm-search-wrapper .search-icon{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1.0625rem;position:absolute;left:0.4375rem}:host .wm-search-wrapper input,wm-search .wm-search-wrapper input{border:none;height:40px;padding:0 1.75rem;background:transparent;overflow:visible;width:100%;-ms-flex:1;flex:1;font-family:inherit}:host .wm-search-wrapper input:focus,wm-search .wm-search-wrapper input:focus{outline:none}:host .wm-search-wrapper.focus,wm-search .wm-search-wrapper.focus{-webkit-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;border-color:#20cbd4;border-radius:3px}:host .find,wm-search .find{min-height:3rem}:host .find input,wm-search .find input{padding:16px 8px 16px 28px}:host .find .wm-find-elements,wm-search .find .wm-find-elements{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start;padding-right:16px}:host .find .wm-find-elements wm-button+wm-button,wm-search .find .wm-find-elements wm-button+wm-button{margin-left:0.25rem}:host .find .wm-find-elements .results,wm-search .find .wm-find-elements .results{margin-right:0.5rem;font-style:italic}:host .sr-only,wm-search .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .show-for-tabbers,wm-search .show-for-tabbers{all:unset;color:#575195;text-decoration:none;font-weight:500;font-size:0.875rem;margin:10px 0}:host .show-for-tabbers:hover,wm-search .show-for-tabbers:hover{background:-webkit-gradient(linear, left top, left bottom, from(#575195), to(#575195)) no-repeat;background:linear-gradient(#575195, #575195) no-repeat;background-size:100% 1px;background-position:0 1.2em;padding-bottom:0.2em}:host .show-for-tabbers:focus,wm-search .show-for-tabbers:focus{outline:none;background:-webkit-gradient(linear, left top, right top, color-stop(66%, #3862e9), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1.2em;padding-bottom:0.2em}';var l=e("wm_search",function(){function e(e){t(this,e);this.wmSearchBrowseResults=s(this,"wmSearchBrowseResults",7);this.wmBrowseSearchResults=s(this,"wmBrowseSearchResults",7);this.wmSearchValueChanged=s(this,"wmSearchValueChanged",7);this.searchType="basic";this.disabled=false;this.placeholder="";this.label="";this.numResults=0;this.value="";this.isTabbing=false;this.highlightedId="";this.highlightedName=null;this.highlightedNum=0;this.previousBlurredValue="";this.resultsLiveRegion=null;this.wrapperEl=null;this.linkEl=null}e.prototype.toggleTabbingOn=function(){this.isTabbing=true;this.linkEl&&this.linkEl.classList.remove("sr-only");this.linkEl&&this.linkEl.classList.add("show-for-tabbers")};e.prototype.toggleTabbingOff=function(){this.isTabbing=false;this.linkEl&&this.linkEl.classList.add("sr-only");this.linkEl&&this.linkEl.classList.remove("show-for-tabbers")};e.prototype.componentWillLoad=function(){this.el.focus=function(){if(!this.disabled){this.shadowRoot.querySelector("#wm-search-input").focus();this.shadowRoot.querySelector("#wm-search-wrapper").classList.add("focus")}};if(this.placeholder===""){console.error("You must set the placeholder property for the wm-search component.")}if(this.label===""){console.error("You must set the label property for the wm-search component.")}this.hookToModal()};e.prototype.hookToModal=function(){var e=this;var t=this.el;while(!!t){if(t.tagName==="WM-MODAL"){this.parentModal=t}t=t.parentElement}if(this.parentModal){var s=["wmCloseTriggered","wmPrimaryTriggered","wmSecondaryTriggered"];s.map((function(t){e.parentModal.addEventListener(t,(function(){e.updateValue("")}))}))}};e.prototype.updateValue=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.value=e;this.resetHighlightCountToStart();return[2]}))}))};e.prototype.resetHighlightCountToStart=function(){if(this.searchType==="find"){if(this.numResults){this.highlightedNum=1}else{this.highlightedNum=0}}};e.prototype.componentDidRender=function(){this.announceChanges()};e.prototype.announceChanges=function(){var e=this;var t=this.getResultsMessage();if(this.searchType==="find"&&this.highlightedName){t+=", ".concat(this.highlightedName)}this.resultsLiveRegion&&(this.resultsLiveRegion.innerHTML="");window.requestAnimationFrame((function(){return e.resultsLiveRegion&&(e.resultsLiveRegion.innerHTML=t)}))};e.prototype.getResultsMessage=function(){if(this.value){if(this.searchType==="basic"){return o.formatMessage({id:"search.resultsFound",defaultMessage:"{numResults, plural, =0 {No results} one {1 result} other {# results}} found"},{numResults:this.numResults})}else{return o.formatMessage({id:"search.xOfYResults",defaultMessage:"{numResults, plural, =0 {No results found} other {{current} of {numResults} results}}"},{numResults:this.numResults,current:this.highlightedNum})}}else{return""}};e.prototype.changeHighlightedNum=function(e){if(this.numResults){if(e<1){this.highlightedNum=this.numResults}else if(e>this.numResults){this.highlightedNum=1}else{this.highlightedNum=e}this.wmSearchBrowseResults.emit({position:this.highlightedNum});this.wmBrowseSearchResults.emit({position:this.highlightedNum})}};e.prototype.addFocusStyle=function(){if(this.wrapperEl){this.wrapperEl.classList.add("focus")}};e.prototype.removeFocusStyle=function(){if(this.wrapperEl){this.wrapperEl.classList.remove("focus")}};e.prototype.handleBlur=function(){this.removeFocusStyle();if(this.previousBlurredValue!==this.value){this.wmSearchValueChanged.emit({value:this.value})}this.previousBlurredValue=this.value};e.prototype.renderResultsAndBrowseButtons=function(){var e=this;return i("div",{class:"wm-find-elements"},i("div",{id:"results-display",class:"results"},this.getResultsMessage()),i("div",{class:"wm-button-collection"},i("wm-button",{"button-type":"icononly",icon:"f05d",tooltip:o.formatMessage({id:"global.previous",description:"button text",defaultMessage:"previous"}),"tooltip-position":"bottom",onClick:function(){return e.changeHighlightedNum(e.highlightedNum-1)},disabled:this.disabled||this.numResults<2,"label-for-identical-buttons":o.formatMessage({id:"search.previousResult",defaultMessage:"Press to hear previous matching result"})}),i("wm-button",{"button-type":"icononly",icon:"f045",tooltip:o.formatMessage({id:"global.next",description:"button text",defaultMessage:"next"}),"tooltip-position":"bottom",onClick:function(){return e.changeHighlightedNum(e.highlightedNum+1)},disabled:this.disabled||this.numResults<2,"label-for-identical-buttons":o.formatMessage({id:"search.nextResult",defaultMessage:"Press to hear next matching result"})})))};e.prototype.renderJumpToLink=function(){var e=this;if(this.numResults&&this.highlightedId){return i("a",{ref:function(t){return e.linkEl=t},href:"#".concat(this.highlightedId),class:"sr-only"},o.formatMessage({id:"search.jumpToResult",defaultMessage:"Jump to search result in list"}))}else{return null}};e.prototype.render=function(){var e=this;return i(r,null,i("div",{id:"wm-search-wrapper",class:"wm-search-wrapper ".concat(this.searchType),ref:function(t){return e.wrapperEl=t}},i("input",{disabled:this.disabled,id:"wm-search-input",placeholder:this.placeholder,"aria-label":"".concat(this.label?this.label+". ":"").concat(o.formatMessage({id:"search.typeToFilterResults",defaultMessage:"Type to filter the results"})),onInput:function(t){return e.updateValue(t.target.value)},onFocus:function(){return e.addFocusStyle()},onBlur:function(){return e.handleBlur()},"aria-autocomplete":"none",autocomplete:"off",value:this.value}),i("span",{class:"mdi search-icon"},String.fromCodePoint(parseInt("0xf349"))),this.searchType==="find"&&this.renderResultsAndBrowseButtons(),i("div",{id:"wm-search-live",class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(t){return e.resultsLiveRegion=t}})),this.searchType==="find"&&this.renderJumpToLink())};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{numResults:["resetHighlightCountToStart"]}},enumerable:false,configurable:true});return e}());l.style=a}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,s,i){function r(e){return e instanceof s?e:new s((function(t){t(e)}))}return new(s||(s=Promise))((function(s,n){function o(e){try{l(i.next(e))}catch(e){n(e)}}function a(e){try{l(i["throw"](e))}catch(e){n(e)}}function l(e){e.done?s(e.value):r(e.value).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(o){if(i)throw new TypeError("Generator is already executing.");while(s)try{if(i=1,r&&(n=o[0]&2?r["return"]:o[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;if(r=0,n)o=[o[0]&2,n.value];switch(o[0]){case 0:case 1:n=o;break;case 4:s.label++;return{value:o[1],done:false};case 5:s.label++;r=o[1];o=[0];continue;case 7:o=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){s=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(o[0]===6&&s.label<n[1]){s.label=n[1];n=o;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(o);break}if(n[2])s.ops.pop();s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e];r=0}finally{i=n=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-a0c3ef16.system.js","./p-726c979a.system.js"],(function(e){"use strict";var t,s,i,r,n,o;return{setters:[function(e){t=e.r;s=e.c;i=e.h;r=e.H;n=e.g},function(e){o=e.i}],execute:function(){var a=':host,wm-search{width:100%;font-size:0.875rem}:host *,wm-search *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wm-search-wrapper,wm-search .wm-search-wrapper{border-radius:3px;position:relative;border:1px solid rgba(35, 35, 35, 0.6);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .wm-search-wrapper .search-icon,wm-search .wm-search-wrapper .search-icon{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1.0625rem;position:absolute;left:0.4375rem}:host .wm-search-wrapper input,wm-search .wm-search-wrapper input{border:none;height:40px;padding:0 1.75rem;background:transparent;overflow:visible;width:100%;-ms-flex:1;flex:1;font-family:inherit}:host .wm-search-wrapper input:focus,wm-search .wm-search-wrapper input:focus{outline:none}:host .wm-search-wrapper.focus,wm-search .wm-search-wrapper.focus{-webkit-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;border-color:#20cbd4;border-radius:3px}:host .find,wm-search .find{min-height:3rem}:host .find input,wm-search .find input{padding:16px 8px 16px 28px}:host .find .wm-find-elements,wm-search .find .wm-find-elements{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start;padding-right:16px}:host .find .wm-find-elements wm-button+wm-button,wm-search .find .wm-find-elements wm-button+wm-button{margin-left:0.25rem}:host .find .wm-find-elements .results,wm-search .find .wm-find-elements .results{margin-right:0.5rem;font-style:italic}:host .sr-only,wm-search .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .show-for-tabbers,wm-search .show-for-tabbers{all:unset;color:#575195;text-decoration:none;font-weight:500;font-size:0.875rem;margin:10px 0}:host .show-for-tabbers:hover,wm-search .show-for-tabbers:hover{background:-webkit-gradient(linear, left top, left bottom, from(#575195), to(#575195)) no-repeat;background:linear-gradient(#575195, #575195) no-repeat;background-size:100% 1px;background-position:0 1.2em;padding-bottom:0.2em}:host .show-for-tabbers:focus,wm-search .show-for-tabbers:focus{outline:none;background:-webkit-gradient(linear, left top, right top, color-stop(66%, #3862e9), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, #3862e9 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1.2em;padding-bottom:0.2em}';var l=e("wm_search",function(){function e(e){t(this,e);this.wmSearchBrowseResults=s(this,"wmSearchBrowseResults",7);this.wmBrowseSearchResults=s(this,"wmBrowseSearchResults",7);this.wmSearchValueChanged=s(this,"wmSearchValueChanged",7);this.searchType="basic";this.disabled=false;this.placeholder="";this.label="";this.numResults=0;this.value="";this.isTabbing=false;this.highlightedId="";this.highlightedName=null;this.highlightedNum=0;this.previousBlurredValue="";this.resultsLiveRegion=null;this.wrapperEl=null;this.linkEl=null}e.prototype.toggleTabbingOn=function(){this.isTabbing=true;this.linkEl&&this.linkEl.classList.remove("sr-only");this.linkEl&&this.linkEl.classList.add("show-for-tabbers")};e.prototype.toggleTabbingOff=function(){this.isTabbing=false;this.linkEl&&this.linkEl.classList.add("sr-only");this.linkEl&&this.linkEl.classList.remove("show-for-tabbers")};e.prototype.componentWillLoad=function(){this.el.focus=function(){if(!this.disabled){this.shadowRoot.querySelector("#wm-search-input").focus();this.shadowRoot.querySelector("#wm-search-wrapper").classList.add("focus")}};if(this.placeholder===""){console.error("You must set the placeholder property for the wm-search component.")}if(this.label===""){console.error("You must set the label property for the wm-search component.")}this.hookToModal()};e.prototype.hookToModal=function(){var e=this;var t=this.el;while(!!t){if(t.tagName==="WM-MODAL"){this.parentModal=t}t=t.parentElement}if(this.parentModal){var s=["wmCloseTriggered","wmPrimaryTriggered","wmSecondaryTriggered"];s.map((function(t){e.parentModal.addEventListener(t,(function(){e.updateValue("")}))}))}};e.prototype.updateValue=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.value=e;this.resetHighlightCountToStart();return[2]}))}))};e.prototype.resetHighlightCountToStart=function(){if(this.searchType==="find"){if(this.numResults){this.highlightedNum=1}else{this.highlightedNum=0}}};e.prototype.componentDidRender=function(){this.announceChanges()};e.prototype.announceChanges=function(){var e=this;var t=this.getResultsMessage();if(this.searchType==="find"&&this.highlightedName){t+=", ".concat(this.highlightedName)}this.resultsLiveRegion&&(this.resultsLiveRegion.innerHTML="");window.requestAnimationFrame((function(){return e.resultsLiveRegion&&(e.resultsLiveRegion.innerHTML=t)}))};e.prototype.getResultsMessage=function(){if(this.value){if(this.searchType==="basic"){return o.formatMessage({id:"search.resultsFound",defaultMessage:"{numResults, plural, =0 {No results} one {1 result} other {# results}} found"},{numResults:this.numResults})}else{return o.formatMessage({id:"search.xOfYResults",defaultMessage:"{numResults, plural, =0 {No results found} other {{current} of {numResults} results}}"},{numResults:this.numResults,current:this.highlightedNum})}}else{return""}};e.prototype.changeHighlightedNum=function(e){if(this.numResults){if(e<1){this.highlightedNum=this.numResults}else if(e>this.numResults){this.highlightedNum=1}else{this.highlightedNum=e}this.wmSearchBrowseResults.emit({position:this.highlightedNum});this.wmBrowseSearchResults.emit({position:this.highlightedNum})}};e.prototype.addFocusStyle=function(){if(this.wrapperEl){this.wrapperEl.classList.add("focus")}};e.prototype.removeFocusStyle=function(){if(this.wrapperEl){this.wrapperEl.classList.remove("focus")}};e.prototype.handleBlur=function(){this.removeFocusStyle();if(this.previousBlurredValue!==this.value){this.wmSearchValueChanged.emit({value:this.value})}this.previousBlurredValue=this.value};e.prototype.renderResultsAndBrowseButtons=function(){var e=this;return i("div",{class:"wm-find-elements"},i("div",{id:"results-display",class:"results"},this.getResultsMessage()),i("div",{class:"wm-button-collection"},i("wm-button",{"button-type":"icononly",icon:"f05d",tooltip:o.formatMessage({id:"global.previous",description:"button text",defaultMessage:"previous"}),"tooltip-position":"bottom",onClick:function(){return e.changeHighlightedNum(e.highlightedNum-1)},disabled:this.disabled||this.numResults<2,"label-for-identical-buttons":o.formatMessage({id:"search.previousResult",defaultMessage:"Press to hear previous matching result"})}),i("wm-button",{"button-type":"icononly",icon:"f045",tooltip:o.formatMessage({id:"global.next",description:"button text",defaultMessage:"next"}),"tooltip-position":"bottom",onClick:function(){return e.changeHighlightedNum(e.highlightedNum+1)},disabled:this.disabled||this.numResults<2,"label-for-identical-buttons":o.formatMessage({id:"search.nextResult",defaultMessage:"Press to hear next matching result"})})))};e.prototype.renderJumpToLink=function(){var e=this;if(this.numResults&&this.highlightedId){return i("a",{ref:function(t){return e.linkEl=t},href:"#".concat(this.highlightedId),class:"sr-only"},o.formatMessage({id:"search.jumpToResult",defaultMessage:"Jump to search result in list"}))}else{return null}};e.prototype.render=function(){var e=this;return i(r,null,i("div",{id:"wm-search-wrapper",class:"wm-search-wrapper ".concat(this.searchType),ref:function(t){return e.wrapperEl=t}},i("input",{disabled:this.disabled,id:"wm-search-input",placeholder:this.placeholder,"aria-label":"".concat(this.label?this.label+". ":"").concat(o.formatMessage({id:"search.typeToFilterResults",defaultMessage:"Type to filter the results"})),onInput:function(t){return e.updateValue(t.target.value)},onFocus:function(){return e.addFocusStyle()},onBlur:function(){return e.handleBlur()},"aria-autocomplete":"none",autocomplete:"off",value:this.value}),i("span",{class:"mdi search-icon"},String.fromCodePoint(parseInt("0xf349"))),this.searchType==="find"&&this.renderResultsAndBrowseButtons(),i("div",{id:"wm-search-live",class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(t){return e.resultsLiveRegion=t}})),this.searchType==="find"&&this.renderJumpToLink())};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{numResults:["resetHighlightCountToStart"]}},enumerable:false,configurable:true});return e}());l.style=a}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t}from"./p-b3c71506.js";import{c as s,i,b as e,f as n,d as a}from"./p-
|
|
1
|
+
import{h as t}from"./p-b3c71506.js";import{c as s,i,b as e,f as n,d as a}from"./p-de3367ee.js";const o={doughnut:{size:155,colors:["#088000","#bfbfbf"],thickness:.73,padding:25,isBar:!1},doughnut0:{size:155,colors:["#088000","#bfbfbf"],thickness:.73,padding:25,isBar:!1},doughnut1:{size:130,colors:["#8b86ca","#2e1b46","#d4d4d4"],thickness:.5,padding:90,isBar:!1},doughnut2:{size:130,colors:["#19a1a9","#ff5f4e","#d4d4d4"],thickness:.5,padding:90,isBar:!1},doughnut3:{size:130,colors:["#8b86ca","#2e1b46","#919834","#c177cf","#c16e00","#029af2","#2a6993"],thickness:.5,padding:90,isBar:!1},bar:{size:350,colors:["#088000","#bfbfbf"],padding:0,isBar:!0},bar1:{size:350,colors:["#088000","#bfbfbf"],padding:0,isBar:!0},bar2:{size:400,colors:["#d4d4d4","#7f97ad","#19a1a9","#ff5f4e"],padding:0,isBar:!0},bar3:{size:300,colors:["#0d696e","#19a1a9","#8e4129","#ff5f4e"],padding:0,isBar:!0},bar4:{size:400,colors:["#d4d4d4","#7f97ad","#33a919"],padding:0,isBar:!0},bar5:{size:400,colors:["#d4d4d4","#8b86ca","#2e1b46","#919834","#c177cf","#c16e00","#029af2","#2a6993"],padding:0,isBar:!0}};function r(t,s,i){return i?Math.round(100*t/s):Math.round(1e4*t/s)/100}function h(t,s){return 360*t/s}function c(t){return parseFloat((Math.floor(100*t)/100).toFixed(2))}function d(t,s,i,e){var n=c(t+t*s*Math.cos(Math.PI*i/180)),a=c(t+t*s*Math.sin(Math.PI*i/180));return void 0!==e?{x1:n,y1:a,x2:c(t+t*s*Math.cos(Math.PI*e/180)),y2:c(t+t*s*Math.sin(Math.PI*e/180))}:{x:n,y:a}}function l(t,s,i,e,n){var a=c(n/2*t);return`A ${a}, ${a} 0 ${s} ${c(i)}, ${c(e)}`}function u(t){if(this.popoverEl&&this.popoverEl.open&&"Enter"===t.key){const t=this.popoverEl.querySelector("button");t&&t.click()}}function f(t,s){this.popoverEl&&!this.isTabbing&&(s.coords={x:t.clientX,y:t.clientY},b.call(this,s))}function p(t,s){this.popoverEl&&this.isTabbing&&(s.coords=e(t.target),b.call(this,s))}function g(t){switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),this.isTabbing=!0,w.call(this);break;case"ArrowRight":case"ArrowDown":t.preventDefault(),this.isTabbing=!0,m.call(this);break;case"Tab":x.call(this);break;case"Escape":this.popoverEl.open=!1,this.userIsNavigating=!1}}function b(t){if(this.popoverEl&&t.title&&t.text){this.popoverEl.popoverTitle=t.title,this.popoverEl.popoverText=t.text,this.popoverEl.buttonText=t.buttonText,this.popoverEl.coords=t.coords,this.popoverEl.sliceRef=t.sliceRef,window.setTimeout((()=>{this.popoverEl&&(this.popoverEl.open=!0)}),30);const s=a((async()=>{this.popoverEl.open=!1}),10);document.addEventListener("scroll",(()=>{s()}));const i=n(this.el);i&&i.addEventListener("scroll",(()=>{s()}))}}function m(){const t=s(document.activeElement),i=(this.sliceEls.indexOf(t)+1)%this.sliceEls.length;v.call(this,i)}function w(){if(this.sliceEls){const t=s(document.activeElement);let i=this.sliceEls.indexOf(t);-1===i?i=0:0===i?i=this.sliceEls.length-1:i-=1,v.call(this,i)}}function v(t){this.sliceEls&&this.el&&(this.userIsNavigating=!0,this.popoverEl&&(this.popoverEl.open=!1),this.el.tabIndex=-1,this.el.focusable=!1,this.sliceEls.map((t=>{t.tabIndex=-1,t.focusable=!1})),this.sliceEls[t].tabIndex=0,this.sliceEls[t].focusable=!0,this.sliceEls[t].focus(),window.setTimeout((()=>{this.popoverEl&&(this.popoverEl.open=!0)}),10))}function x(){this.sliceEls&&this.sliceEls.map((t=>{t.tabIndex=-1,t.focusable=!1})),this.userIsNavigating=!1,window.setTimeout((()=>{this.el&&(this.el.tabIndex=0,this.el.focusable=!0,this.popoverEl&&(this.popoverEl.open=!1))}),100)}async function $(t){this.slicesData=[];let s=0;const i=Array.from(this.el.children);this.total=i.reduce(((t,s)=>t+parseInt(s.getAttribute("amount")||"0")),0),i.forEach(((e,n)=>{const a=parseInt(e.getAttribute("amount")||"0"),h=r(a,this.total,!0),c=r(parseInt(i[0===n?i.length-1:n-1].getAttribute("amount")||"0"),this.total,!0),d=r(parseInt(i[n===i.length-1?0:n+1].getAttribute("amount")||"0"),this.total,!0);let l=h<4&&(c<5||d<5);0===h&&a>0&&(d<8||c<8)&&(l=!0);const u=o[t].colors["bar5"===t?this.notStartedColor?n:n+1:n],f={amount:a,perc:h,legend:e.getAttribute("legend"),color:u||"#d4d4d4",offset:s,id:`${this.uid}-${n+1}`,title:e.getAttribute("popover-title"),text:e.getAttribute("popover-text"),buttonText:e.getAttribute("popover-button-text"),sliceRef:e,inSmallCluster:l};s+=a,this.slicesData.push(f)}))}function M(t,s,i){const e=h(s,this.total)-90,n=t/this.total*360;let a=e+n;const o=n>180?"1 1":"0 1",r=n>180?"1 0":"0 0",c=this.chartData.size/2,u=this.chartData.thickness,f="doughnut0"===i||"doughnut"===i?2.25:3;360===n&&(a-=.01);const p=d(c,1,e+1.5,a),g=d(c,u,e+f,a);return`M ${p.x1}, ${p.y1} `+l(1,o,p.x2,p.y2,this.chartData.size)+` L ${g.x2}, ${g.y2} `+l(u,r,g.x1,g.y1,this.chartData.size)+" z"}function y(s){const i=this.chartData.size+this.chartData.padding,e="doughnut0"===s||"doughnut"===s;return t("div",{class:"chart-wrapper doughnut-wrapper"},t("svg",{width:i+"px",height:i+"px",id:`graphic-${this.uid}`,class:"doughnut-svg"},t("defs",null,t("filter",{id:"wmHoverDropShadow"},t("feGaussianBlur",{stdDeviation:"3"}),t("feOffset",{result:"offsetblur"}),t("feFlood",{"flood-color":"#333"}),t("feComposite",{operator:"in",in2:"offsetblur"}),t("feMerge",null,t("feMergeNode",null),t("feMergeNode",{in:"SourceGraphic"})))),this.slicesData.map((t=>k.call(this,t,s))),e?t("text",{class:"value",x:"50%",y:"50%","font-size":"1.5rem","font-weight":"500","text-anchor":"middle","dominant-baseline":"middle"},r(this.slicesData[0].amount,this.total,!0)+"%"):t("g",{transform:`translate(${this.chartData.padding/2}, ${this.chartData.padding/2})`,"text-anchor":"middle","dominant-baseline":"middle"},this.slicesData.map((t=>t.amount>0?z.call(this,t):"")))))}function k(s,i){return t("g",{transform:`translate(${this.chartData.padding/2}, ${this.chartData.padding/2})`},t("path",{id:s.id,class:"segment doughnut-segment",fill:s.amount?s.color:"transparent",d:M.call(this,s.amount,s.offset,i),onClick:t=>f.call(this,t,s),onFocus:t=>p.call(this,t,s),onKeyDown:t=>u.call(this,t),role:"img","aria-label":s.legend}))}function z(s){if(!s.inSmallCluster){const i=h(s.offset+s.amount/2,this.total);let{x:e,y:n}=d(this.chartData.size/2,1.4,i-90);return t("text",{class:"value",x:e+"px",y:n+"px"},`${s.perc>0?s.perc:"<1"}%`)}}function B(s){const i="bar1"===s||"bar"===s;return t("div",{class:"chart-wrapper bar-wrapper"},i?t("div",{class:"single-perc"},r(this.slicesData[0].amount,this.total,!0)+"%"):"","bar3"===this.chartType&&this.drawAxis(),t("div",{class:{"inner-bar-wrapper":!0,"show-values":"percentage"===this.tempValueFormat||"amount"===this.tempValueFormat}},i?"":t("div",{class:"values"},this.slicesData.map(((t,s)=>t.perc>0?this.renderBarText(t,s):""))),t("div",{class:"bar-segments-wrapper"},this.slicesData.map(((t,s)=>A.call(this,t,s)))),i?D.call(this):""))}function A(s,i){const e=i!==this.slicesData.length-1,n=`calc(${r(s.amount,this.total,!1)}%${e?" - 2px":""})`;return t("div",{class:"segment bar-segment "+(0===r(s.amount,this.total,!1)?"zero":""),style:{backgroundColor:s.color,width:n},onClick:t=>f.call(this,t,s),onFocus:t=>p.call(this,t,s),onKeyDown:t=>u.call(this,t)},t("span",{class:"sr-only"},s.legend))}function C(){if(this.showLegend){const s=this.slicesData.reduce(((t,s)=>!!s.inSmallCluster||t),!1);return t("div",{class:"legend-wrapper"},t("div",{class:"legend "+("bar"===this.mode?"--top":"--bottom"),"aria-hidden":"true"},this.total>0?this.slicesData.map((s=>{if(s.amount||s.legend)return t("div",{class:"legend-item"},t("div",{class:"legend-color",style:{"background-color":s.color}}),t("div",{class:"legend-text"},s.legend))})):""),!this.chartData.isBar&&s?t("div",{class:"cluster-warning"},i.formatMessage({id:"chart.hiddenPercentages",defaultMessage:"Percentages smaller than 5% are not shown when too close to each other."}),t("br",null),i.formatMessage({id:"chart.clickToSeeDetails",defaultMessage:"Click or use arrow keys to see details."})):"")}}function D(){if(this.completionMessage)return t("div",{class:"completion-message"},this.completionMessage)}export{B as a,y as b,D as c,r as d,x as e,$ as g,g as h,C as r,o as t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./p-a0c3ef16.system.js","./p-76ca7498.system.js"],(function(e){"use strict";var t,i,r,o,n,s,a,p,l;return{setters:[function(e){t=e.r;i=e.c;r=e.h;o=e.H;n=e.g},function(e){s=e.i;a=e.g;p=e.l;l=e.e}],execute:function(){var d=':host,wm-timepicker{font-family:inherit}:host *,wm-timepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .sr-only,wm-timepicker .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper,wm-timepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-timepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-timepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-timepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-timepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-timepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-timepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-timepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-timepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-timepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-timepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-timepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper input,wm-timepicker .wrapper .inner-wrapper input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;font-family:inherit}:host .wrapper .inner-wrapper input:disabled,wm-timepicker .wrapper .inner-wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper input:focus,wm-timepicker .wrapper .inner-wrapper input:focus{outline:none}:host .wrapper .inner-wrapper button,wm-timepicker .wrapper .inner-wrapper button{all:unset;cursor:pointer;padding:0 0.375rem;height:2.375rem;background-color:#fff;border:none;-moz-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-moz-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-top-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;-moz-border-bottom-left-radius:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button .clock::after,wm-timepicker .wrapper .inner-wrapper button .clock::after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f150";color:#575195;font-size:1.5rem;padding:0;line-height:2.5rem}:host .wrapper .inner-wrapper button:hover,wm-timepicker .wrapper .inner-wrapper button:hover{background:#e6e6e6;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled,wm-timepicker .wrapper .inner-wrapper button:disabled{background-color:rgba(74, 74, 74, 0.05);pointer-events:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled .clock::after,wm-timepicker .wrapper .inner-wrapper button:disabled .clock::after{color:#7b7b7b}[dir=RTL] :host .wrapper .inner-wrapper button,[dir=RTL] wm-timepicker .wrapper .inner-wrapper button{right:auto;left:0}:host .wrapper .inner-wrapper button:focus,wm-timepicker .wrapper .inner-wrapper button:focus{outline:none}:host .wrapper .inner-wrapper button.user-is-tabbing:focus,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}:host .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper button::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper .options,wm-timepicker .wrapper .inner-wrapper .options{margin:0;padding:0;-webkit-overflow-scrolling:touch;overflow:auto;max-height:19.0625rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:2.5rem;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .wrapper .inner-wrapper .options.upwards,wm-timepicker .wrapper .inner-wrapper .options.upwards{top:unset;bottom:2.5rem;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .wrapper .inner-wrapper .options.hidden,wm-timepicker .wrapper .inner-wrapper .options.hidden{visibility:hidden}:host .wrapper .inner-wrapper .options [role=option],wm-timepicker .wrapper .inner-wrapper .options [role=option]{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a}:host .wrapper .inner-wrapper .options [role=option]:hover,wm-timepicker .wrapper .inner-wrapper .options [role=option]:hover{background:#f4f4f4;outline:none}:host .wrapper .inner-wrapper .options [role=option]:focus,wm-timepicker .wrapper .inner-wrapper .options [role=option]:focus{outline:none;background:#f4f4f4}:host .wrapper .inner-wrapper .options [role=option]:not(:last-child),wm-timepicker .wrapper .inner-wrapper .options [role=option]:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .wrapper .inner-wrapper .options.open,wm-timepicker .wrapper .inner-wrapper .options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper.invalid .inner-wrapper,wm-timepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-timepicker .wrapper.invalid .error{color:#c0392b;margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic}:host .wrapper:focus .inner-wrapper,:host .wrapper.focus .inner-wrapper,wm-timepicker .wrapper:focus .inner-wrapper,wm-timepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}';var c=e("wm_timepicker",function(){function e(e){t(this,e);this.wmTimepickerNewValidValue=i(this,"wmTimepickerNewValidValue",7);this.wmTimepickerOnChange=i(this,"wmTimepickerOnChange",7);this.disabled=false;this.value="";this.label="";this.labelPosition="top";this.requiredField=false;this.isExpanded=false;this.isTabbing=false;this.twelveHrValid=/^(0?[0-9]|1[0-2])\s*:?\s*([0-5][0-9])?\s?(a|p|am|pm)?$/i;this.twentyFourHrValid=/^(0?[0-9]|1[0-9]|2[0-4])\s*:?\s*([0-5][0-9])?$/;this.uid="";this.timeFormat="hh:mm";this.times=[];this.openUp=false;this.buttonAriaLabel=s.formatMessage({id:"time.selectTime",defaultMessage:"Select time",description:"Button text for screen readers."})}e.prototype.toggleTabbingOn=function(){this.isTabbing=true};e.prototype.toggleTabbingOff=function(){this.isTabbing=false};e.prototype.handleKey=function(e){switch(e.key){case"ArrowDown":e.preventDefault();if(this.isExpanded===false){this.open("next")}else{this.moveDown(this.selectedOption)}break;case"ArrowUp":e.preventDefault();if(this.isExpanded===false){this.open("previous")}else{this.moveUp(this.selectedOption)}break;case"Enter":case" ":if(this.isExpanded){e.preventDefault();this.handleOptionClick(this.selectedOption.textContent)}break;case"Escape":e.preventDefault();if(this.isExpanded){e.stopPropagation();this.close()}break;case"Tab":if(this.isExpanded){this.close(false)}break;case"Home":e.preventDefault();if(this.isExpanded){this.focusOption(this.optionsList[0]);this.setDropdownPosition("first")}break;case"End":e.preventDefault();if(this.isExpanded){this.focusOption(this.optionsList[this.optionsList.length-1]);this.setDropdownPosition("last")}break}};e.prototype.updateErrorState=function(){this.displayedErrorMessage=this.errorMessage};e.prototype.componentWillLoad=function(){if(this.label===""){console.error("You must include a label prop for the timepicker (for accessibility reasons), even if the label position is none.")}this.el.focus=function(){if(!this.disabled){this.shadowRoot.querySelector("input").focus()}};this.uid=this.el.id?this.el.id:a();this.updateErrorState();this.timeFormat=s.formatMessage({id:"time.timeFormat",defaultMessage:"hh:mm"});this.times=this.generateTimes()};e.prototype.componentDidLoad=function(){this.optionsEl.classList.add("hidden");this.optionsList=Array.from(this.optionsEl.querySelectorAll("li"));if(this.value){this.processInput()}};e.prototype.isValidTime=function(e){return this.twelveHrValid.test(e)||this.twentyFourHrValid.test(e)};e.prototype.generateTimes=function(){var e=[];var t=0;for(var i=0;t<24*60;i++){var r=Math.floor(t/60);var o=r.toString().padStart(2,"0");var n=(t%60).toString();var s=n.padStart(2,"0");e[i]="".concat(o,":").concat(s);t=t+15}return e};e.prototype.findNearestTimeInterval=function(e){var t=this.formatToStorage(e);var i=parseInt(t.slice(3,5));if(i%15!==0){var r=parseInt(t.slice(0,2));var o=(Math.round(i/15)*15).toString().padStart(2,"0");if(o==="60"){o="00";var n=r+1;if(n===24){n=0}t=t.replace("".concat(r.toString().padStart(2,"0"),":"),"".concat(n.toString().padStart(2,"0"),":"))}if(parseInt(o)<8){o="00"}e=t.replace(":".concat(i.toString().padStart(2,"0")),":".concat(o))}return e};e.prototype.handleListSelection=function(e){var t=this;e=this.findNearestTimeInterval(e);var i=this.optionsList.filter((function(i){return i.textContent==t.formatToDisplay(e)}))[0];i&&this.focusOption(i)};e.prototype.setValue=function(e){var t=this.value;this.inputEl.value=this.formatToDisplay(e);this.value=this.formatToStorage(e);this.handleListSelection(e);if(t!==this.value){this.wmTimepickerNewValidValue.emit({value:this.value})}this.wmTimepickerOnChange.emit({value:this.value,isValid:!!this.displayedErrorMessage})};e.prototype.processInput=function(){if(this.isValidTime(this.value)){this.setValue(this.value)}var e=this.determineErrorMessage();this.displayedErrorMessage=e};e.prototype.determineErrorMessage=function(){var e=this.errorMessage;var t=s.formatMessage({id:"time.requiredError",defaultMessage:"A time is required."});var i=s.formatMessage({id:"time.invalidTime",defaultMessage:"Please enter a valid time."});var r=this.isValidTime(this.value);if(r&&!this.errorMessage){e=null}else if(!r&&!this.errorMessage){if(this.requiredField&&!this.value){e=t}else if(this.value){e=i}else{e=null}}return e};e.prototype.splitTime=function(e){var t=this.twelveHrValid.exec(e)||this.twentyFourHrValid.exec(e);var i=parseInt(t[1]);var r=t[2]||"00";var o=t?t[3]:undefined;if(i===0&&(o===null||o===void 0?void 0:o.toUpperCase().includes("P"))){o="AM"}return[i,r,o]};e.prototype.formatToDisplay=function(e){var t=this.splitTime(e),i=t[0],r=t[1],o=t[2];if(i===12&&!o){o="PM"}if(i===0||i===24){i=12}if(i>12){i-=12;o="PM"}if(o&&o.toUpperCase().includes("P")){o="PM"}else{o="AM"}return"".concat(i.toString().padStart(2,"0"),":").concat(r," ").concat(o)};e.prototype.formatToStorage=function(e){var t=this.splitTime(e),i=t[0],r=t[1],o=t[2];if(i===24){i=0}if(i===12&&o&&o.toUpperCase().includes("A")){i-=12}if(o&&o.toUpperCase().includes("P")&&i!==12){i+=12}return"".concat(i.toString().padStart(2,"0"),":").concat(r)};e.prototype.open=function(e){var t=this;this.openUp=p(this.el,this.optionsEl);this.isExpanded=true;this.optionsEl.classList.remove("hidden");if(this.errorMessage||!this.value){this.handleListSelection("09:00")}this.setDropdownPosition("center",this.selectedOption);this.focusOption(this.selectedOption);window.requestAnimationFrame((function(){if(e==="next"){t.moveDown(t.selectedOption)}else if(e==="previous"){t.moveUp(t.selectedOption)}}))};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}this.isExpanded=false;window.setTimeout((function(){t.optionsEl.classList.add("hidden");if(e){t.buttonEl.focus()}}),150)};e.prototype.focusOption=function(e){this.optionsList.forEach((function(e){e.tabIndex=-1}));e.tabIndex=0;this.selectedOption=e;e.focus()};e.prototype.setDropdownPosition=function(e,t){switch(e){case"top":var i=t===null||t===void 0?void 0:t.previousElementSibling;this.optionsEl.scrollTop=i.getBoundingClientRect().top-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop;break;case"bottom":var r=t===null||t===void 0?void 0:t.nextElementSibling;this.optionsEl.scrollTop=r.getBoundingClientRect().bottom-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop-this.optionsEl.offsetHeight;break;case"center":this.optionsEl.scrollTop=(this.optionsList.findIndex((function(e){return e.textContent===(t===null||t===void 0?void 0:t.textContent)}))-2)*t.offsetHeight;break;case"first":this.optionsEl.scrollTop=0;break;case"last":this.optionsEl.scrollTop=this.optionsList[0].clientHeight*this.optionsList.length;break}};e.prototype.moveUp=function(e){var t=e.previousElementSibling;if(t){if(t.getBoundingClientRect().top<this.optionsEl.getBoundingClientRect().top){this.setDropdownPosition("top",e)}this.focusOption(t)}else{this.focusOption(this.optionsList[this.optionsList.length-1]);this.setDropdownPosition("last")}};e.prototype.moveDown=function(e){var t=e.nextElementSibling;if(t){if(t.getBoundingClientRect().bottom>this.optionsEl.getBoundingClientRect().bottom){this.setDropdownPosition("bottom",e)}this.focusOption(t)}else{this.focusOption(this.optionsList[0]);this.setDropdownPosition("first")}};e.prototype.handleOptionClick=function(e){this.close();this.setValue(e);this.processInput()};e.prototype.handleInput=function(){this.value=this.inputEl.value;if(this.isValidTime(this.value)){this.handleListSelection(this.findNearestTimeInterval(this.value));this.setDropdownPosition("center",this.selectedOption)}};e.prototype.handleInputBlur=function(e){var t=this.preventValidation&&l(e,this.preventValidation);if(!t){this.processInput()}this.tpWrapper.classList.remove("focus")};e.prototype.renderOptions=function(){var e=this;return this.times.map((function(t,i){return r("li",{id:"option".concat(i+1),role:"option",onClick:function(){return e.handleOptionClick(t)}},e.formatToDisplay(t))}))};e.prototype.render=function(){var e=this;return r(o,{id:this.uid,invalid:!!this.displayedErrorMessage?"true":null,onBlur:function(){return e.close(false)}},r("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(!!this.displayedErrorMessage?"invalid":""),ref:function(t){return e.tpWrapper=t}},r("div",{class:"label-wrapper"},this.labelPosition!=="none"&&r("label",{id:"label-".concat(this.uid),class:"label",htmlFor:"time-input-".concat(this.uid)},this.label,this.requiredField&&r("span",{class:"required","aria-hidden":"true"},"*"))),r("div",null,r("div",{class:"inner-wrapper"},r("input",{id:"time-input-".concat(this.uid),"aria-label":this.label,"aria-describedby":"error-".concat(this.uid),ref:function(t){return e.inputEl=t},onBlur:function(t){return e.handleInputBlur(t)},onInput:function(){return e.handleInput()},disabled:this.disabled,required:this.requiredField,placeholder:this.timeFormat,autocomplete:"off",onFocus:function(){return e.tpWrapper.classList.add("focus")}}),r("button",{id:"btn-".concat(this.uid),class:this.isTabbing?"user-is-tabbing":"",ref:function(t){return e.buttonEl=t},disabled:this.disabled,"aria-controls":"list-".concat(this.uid),"aria-expanded":this.isExpanded?"true":"false","aria-label":this.buttonAriaLabel,"aria-describedby":"time-input-".concat(this.uid),onClick:function(){return e.isExpanded?e.close():e.open()},onMouseDown:function(t){t.preventDefault();e.buttonEl.focus()}},r("span",{class:"clock"})),r("ul",{class:"options ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),id:"list-".concat(this.uid),role:"listbox","aria-labelledby":"label-".concat(this.uid),"aria-describedby":this.isExpanded?"collapsed":null,tabindex:-1,ref:function(t){return e.optionsEl=t}},this.renderOptions())),r("div",{id:"error-".concat(this.uid),class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayedErrorMessage))))};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["updateErrorState"]}},enumerable:false,configurable:true});return e}());c.style=d}}}));
|
|
1
|
+
System.register(["./p-a0c3ef16.system.js","./p-726c979a.system.js"],(function(e){"use strict";var t,i,r,o,n,s,a,p,l;return{setters:[function(e){t=e.r;i=e.c;r=e.h;o=e.H;n=e.g},function(e){s=e.i;a=e.g;p=e.l;l=e.e}],execute:function(){var d=':host,wm-timepicker{font-family:inherit}:host *,wm-timepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .sr-only,wm-timepicker .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper,wm-timepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-timepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-timepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-timepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-timepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-timepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-timepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-timepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-timepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-timepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-timepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-timepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper input,wm-timepicker .wrapper .inner-wrapper input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;font-family:inherit}:host .wrapper .inner-wrapper input:disabled,wm-timepicker .wrapper .inner-wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper input:focus,wm-timepicker .wrapper .inner-wrapper input:focus{outline:none}:host .wrapper .inner-wrapper button,wm-timepicker .wrapper .inner-wrapper button{all:unset;cursor:pointer;padding:0 0.375rem;height:2.375rem;background-color:#fff;border:none;-moz-border-top-right-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-moz-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-top-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;-moz-border-bottom-left-radius:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button .clock::after,wm-timepicker .wrapper .inner-wrapper button .clock::after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f150";color:#575195;font-size:1.5rem;padding:0;line-height:2.5rem}:host .wrapper .inner-wrapper button:hover,wm-timepicker .wrapper .inner-wrapper button:hover{background:#e6e6e6;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled,wm-timepicker .wrapper .inner-wrapper button:disabled{background-color:rgba(74, 74, 74, 0.05);pointer-events:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .wrapper .inner-wrapper button:disabled .clock::after,wm-timepicker .wrapper .inner-wrapper button:disabled .clock::after{color:#7b7b7b}[dir=RTL] :host .wrapper .inner-wrapper button,[dir=RTL] wm-timepicker .wrapper .inner-wrapper button{right:auto;left:0}:host .wrapper .inner-wrapper button:focus,wm-timepicker .wrapper .inner-wrapper button:focus{outline:none}:host .wrapper .inner-wrapper button.user-is-tabbing:focus,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}:host .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button.user-is-tabbing:focus::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper button::-moz-focus-inner,wm-timepicker .wrapper .inner-wrapper button::-moz-focus-inner{border:0}:host .wrapper .inner-wrapper .options,wm-timepicker .wrapper .inner-wrapper .options{margin:0;padding:0;-webkit-overflow-scrolling:touch;overflow:auto;max-height:19.0625rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:2.5rem;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .wrapper .inner-wrapper .options.upwards,wm-timepicker .wrapper .inner-wrapper .options.upwards{top:unset;bottom:2.5rem;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .wrapper .inner-wrapper .options.hidden,wm-timepicker .wrapper .inner-wrapper .options.hidden{visibility:hidden}:host .wrapper .inner-wrapper .options [role=option],wm-timepicker .wrapper .inner-wrapper .options [role=option]{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a}:host .wrapper .inner-wrapper .options [role=option]:hover,wm-timepicker .wrapper .inner-wrapper .options [role=option]:hover{background:#f4f4f4;outline:none}:host .wrapper .inner-wrapper .options [role=option]:focus,wm-timepicker .wrapper .inner-wrapper .options [role=option]:focus{outline:none;background:#f4f4f4}:host .wrapper .inner-wrapper .options [role=option]:not(:last-child),wm-timepicker .wrapper .inner-wrapper .options [role=option]:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .wrapper .inner-wrapper .options.open,wm-timepicker .wrapper .inner-wrapper .options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper.invalid .inner-wrapper,wm-timepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-timepicker .wrapper.invalid .error{color:#c0392b;margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic}:host .wrapper:focus .inner-wrapper,:host .wrapper.focus .inner-wrapper,wm-timepicker .wrapper:focus .inner-wrapper,wm-timepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}';var c=e("wm_timepicker",function(){function e(e){t(this,e);this.wmTimepickerNewValidValue=i(this,"wmTimepickerNewValidValue",7);this.wmTimepickerOnChange=i(this,"wmTimepickerOnChange",7);this.disabled=false;this.value="";this.label="";this.labelPosition="top";this.requiredField=false;this.isExpanded=false;this.isTabbing=false;this.twelveHrValid=/^(0?[0-9]|1[0-2])\s*:?\s*([0-5][0-9])?\s?(a|p|am|pm)?$/i;this.twentyFourHrValid=/^(0?[0-9]|1[0-9]|2[0-4])\s*:?\s*([0-5][0-9])?$/;this.uid="";this.timeFormat="hh:mm";this.times=[];this.openUp=false;this.buttonAriaLabel=s.formatMessage({id:"time.selectTime",defaultMessage:"Select time",description:"Button text for screen readers."})}e.prototype.toggleTabbingOn=function(){this.isTabbing=true};e.prototype.toggleTabbingOff=function(){this.isTabbing=false};e.prototype.handleKey=function(e){switch(e.key){case"ArrowDown":e.preventDefault();if(this.isExpanded===false){this.open("next")}else{this.moveDown(this.selectedOption)}break;case"ArrowUp":e.preventDefault();if(this.isExpanded===false){this.open("previous")}else{this.moveUp(this.selectedOption)}break;case"Enter":case" ":if(this.isExpanded){e.preventDefault();this.handleOptionClick(this.selectedOption.textContent)}break;case"Escape":e.preventDefault();if(this.isExpanded){e.stopPropagation();this.close()}break;case"Tab":if(this.isExpanded){this.close(false)}break;case"Home":e.preventDefault();if(this.isExpanded){this.focusOption(this.optionsList[0]);this.setDropdownPosition("first")}break;case"End":e.preventDefault();if(this.isExpanded){this.focusOption(this.optionsList[this.optionsList.length-1]);this.setDropdownPosition("last")}break}};e.prototype.updateErrorState=function(){this.displayedErrorMessage=this.errorMessage};e.prototype.componentWillLoad=function(){if(this.label===""){console.error("You must include a label prop for the timepicker (for accessibility reasons), even if the label position is none.")}this.el.focus=function(){if(!this.disabled){this.shadowRoot.querySelector("input").focus()}};this.uid=this.el.id?this.el.id:a();this.updateErrorState();this.timeFormat=s.formatMessage({id:"time.timeFormat",defaultMessage:"hh:mm"});this.times=this.generateTimes()};e.prototype.componentDidLoad=function(){this.optionsEl.classList.add("hidden");this.optionsList=Array.from(this.optionsEl.querySelectorAll("li"));if(this.value){this.processInput()}};e.prototype.isValidTime=function(e){return this.twelveHrValid.test(e)||this.twentyFourHrValid.test(e)};e.prototype.generateTimes=function(){var e=[];var t=0;for(var i=0;t<24*60;i++){var r=Math.floor(t/60);var o=r.toString().padStart(2,"0");var n=(t%60).toString();var s=n.padStart(2,"0");e[i]="".concat(o,":").concat(s);t=t+15}return e};e.prototype.findNearestTimeInterval=function(e){var t=this.formatToStorage(e);var i=parseInt(t.slice(3,5));if(i%15!==0){var r=parseInt(t.slice(0,2));var o=(Math.round(i/15)*15).toString().padStart(2,"0");if(o==="60"){o="00";var n=r+1;if(n===24){n=0}t=t.replace("".concat(r.toString().padStart(2,"0"),":"),"".concat(n.toString().padStart(2,"0"),":"))}if(parseInt(o)<8){o="00"}e=t.replace(":".concat(i.toString().padStart(2,"0")),":".concat(o))}return e};e.prototype.handleListSelection=function(e){var t=this;e=this.findNearestTimeInterval(e);var i=this.optionsList.filter((function(i){return i.textContent==t.formatToDisplay(e)}))[0];i&&this.focusOption(i)};e.prototype.setValue=function(e){var t=this.value;this.inputEl.value=this.formatToDisplay(e);this.value=this.formatToStorage(e);this.handleListSelection(e);if(t!==this.value){this.wmTimepickerNewValidValue.emit({value:this.value})}this.wmTimepickerOnChange.emit({value:this.value,isValid:!!this.displayedErrorMessage})};e.prototype.processInput=function(){if(this.isValidTime(this.value)){this.setValue(this.value)}var e=this.determineErrorMessage();this.displayedErrorMessage=e};e.prototype.determineErrorMessage=function(){var e=this.errorMessage;var t=s.formatMessage({id:"time.requiredError",defaultMessage:"A time is required."});var i=s.formatMessage({id:"time.invalidTime",defaultMessage:"Please enter a valid time."});var r=this.isValidTime(this.value);if(r&&!this.errorMessage){e=null}else if(!r&&!this.errorMessage){if(this.requiredField&&!this.value){e=t}else if(this.value){e=i}else{e=null}}return e};e.prototype.splitTime=function(e){var t=this.twelveHrValid.exec(e)||this.twentyFourHrValid.exec(e);var i=parseInt(t[1]);var r=t[2]||"00";var o=t?t[3]:undefined;if(i===0&&(o===null||o===void 0?void 0:o.toUpperCase().includes("P"))){o="AM"}return[i,r,o]};e.prototype.formatToDisplay=function(e){var t=this.splitTime(e),i=t[0],r=t[1],o=t[2];if(i===12&&!o){o="PM"}if(i===0||i===24){i=12}if(i>12){i-=12;o="PM"}if(o&&o.toUpperCase().includes("P")){o="PM"}else{o="AM"}return"".concat(i.toString().padStart(2,"0"),":").concat(r," ").concat(o)};e.prototype.formatToStorage=function(e){var t=this.splitTime(e),i=t[0],r=t[1],o=t[2];if(i===24){i=0}if(i===12&&o&&o.toUpperCase().includes("A")){i-=12}if(o&&o.toUpperCase().includes("P")&&i!==12){i+=12}return"".concat(i.toString().padStart(2,"0"),":").concat(r)};e.prototype.open=function(e){var t=this;this.openUp=p(this.el,this.optionsEl);this.isExpanded=true;this.optionsEl.classList.remove("hidden");if(this.errorMessage||!this.value){this.handleListSelection("09:00")}this.setDropdownPosition("center",this.selectedOption);this.focusOption(this.selectedOption);window.requestAnimationFrame((function(){if(e==="next"){t.moveDown(t.selectedOption)}else if(e==="previous"){t.moveUp(t.selectedOption)}}))};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}this.isExpanded=false;window.setTimeout((function(){t.optionsEl.classList.add("hidden");if(e){t.buttonEl.focus()}}),150)};e.prototype.focusOption=function(e){this.optionsList.forEach((function(e){e.tabIndex=-1}));e.tabIndex=0;this.selectedOption=e;e.focus()};e.prototype.setDropdownPosition=function(e,t){switch(e){case"top":var i=t===null||t===void 0?void 0:t.previousElementSibling;this.optionsEl.scrollTop=i.getBoundingClientRect().top-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop;break;case"bottom":var r=t===null||t===void 0?void 0:t.nextElementSibling;this.optionsEl.scrollTop=r.getBoundingClientRect().bottom-this.optionsEl.getBoundingClientRect().top+this.optionsEl.scrollTop-this.optionsEl.offsetHeight;break;case"center":this.optionsEl.scrollTop=(this.optionsList.findIndex((function(e){return e.textContent===(t===null||t===void 0?void 0:t.textContent)}))-2)*t.offsetHeight;break;case"first":this.optionsEl.scrollTop=0;break;case"last":this.optionsEl.scrollTop=this.optionsList[0].clientHeight*this.optionsList.length;break}};e.prototype.moveUp=function(e){var t=e.previousElementSibling;if(t){if(t.getBoundingClientRect().top<this.optionsEl.getBoundingClientRect().top){this.setDropdownPosition("top",e)}this.focusOption(t)}else{this.focusOption(this.optionsList[this.optionsList.length-1]);this.setDropdownPosition("last")}};e.prototype.moveDown=function(e){var t=e.nextElementSibling;if(t){if(t.getBoundingClientRect().bottom>this.optionsEl.getBoundingClientRect().bottom){this.setDropdownPosition("bottom",e)}this.focusOption(t)}else{this.focusOption(this.optionsList[0]);this.setDropdownPosition("first")}};e.prototype.handleOptionClick=function(e){this.close();this.setValue(e);this.processInput()};e.prototype.handleInput=function(){this.value=this.inputEl.value;if(this.isValidTime(this.value)){this.handleListSelection(this.findNearestTimeInterval(this.value));this.setDropdownPosition("center",this.selectedOption)}};e.prototype.handleInputBlur=function(e){var t=this.preventValidation&&l(e,this.preventValidation);if(!t){this.processInput()}this.tpWrapper.classList.remove("focus")};e.prototype.renderOptions=function(){var e=this;return this.times.map((function(t,i){return r("li",{id:"option".concat(i+1),role:"option",onClick:function(){return e.handleOptionClick(t)}},e.formatToDisplay(t))}))};e.prototype.render=function(){var e=this;return r(o,{id:this.uid,invalid:!!this.displayedErrorMessage?"true":null,onBlur:function(){return e.close(false)}},r("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(!!this.displayedErrorMessage?"invalid":""),ref:function(t){return e.tpWrapper=t}},r("div",{class:"label-wrapper"},this.labelPosition!=="none"&&r("label",{id:"label-".concat(this.uid),class:"label",htmlFor:"time-input-".concat(this.uid)},this.label,this.requiredField&&r("span",{class:"required","aria-hidden":"true"},"*"))),r("div",null,r("div",{class:"inner-wrapper"},r("input",{id:"time-input-".concat(this.uid),"aria-label":this.label,"aria-describedby":"error-".concat(this.uid),ref:function(t){return e.inputEl=t},onBlur:function(t){return e.handleInputBlur(t)},onInput:function(){return e.handleInput()},disabled:this.disabled,required:this.requiredField,placeholder:this.timeFormat,autocomplete:"off",onFocus:function(){return e.tpWrapper.classList.add("focus")}}),r("button",{id:"btn-".concat(this.uid),class:this.isTabbing?"user-is-tabbing":"",ref:function(t){return e.buttonEl=t},disabled:this.disabled,"aria-controls":"list-".concat(this.uid),"aria-expanded":this.isExpanded?"true":"false","aria-label":this.buttonAriaLabel,"aria-describedby":"time-input-".concat(this.uid),onClick:function(){return e.isExpanded?e.close():e.open()},onMouseDown:function(t){t.preventDefault();e.buttonEl.focus()}},r("span",{class:"clock"})),r("ul",{class:"options ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),id:"list-".concat(this.uid),role:"listbox","aria-labelledby":"label-".concat(this.uid),"aria-describedby":this.isExpanded?"collapsed":null,tabindex:-1,ref:function(t){return e.optionsEl=t}},this.renderOptions())),r("div",{id:"error-".concat(this.uid),class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayedErrorMessage))))};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["updateErrorState"]}},enumerable:false,configurable:true});return e}());c.style=d}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as r,g as a}from"./p-b3c71506.js";import{i as s,e as p,h as o,g as l}from"./p-15b1c11b.js";let n=class{constructor(i){e(this,i),this.wmDatepickerNewValidValue=t(this,"wmDatepickerNewValidValue",7),this.value="",this.disabled=!1,this.dateFormat="US",this.errorMessage="",this.labelPosition="top",this.label="",this.requiredField=!1,this.displayError="",this.lastCommittedValue=this.value,this.parsableEntry=/^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/,this.isoEntry=/^\d\d\d\d[-]\d\d[-]\d\d$/,this.eightDigitsEntry=/^\d{8}$/,this.dateFormats={US:s.formatMessage({id:"date.formatUS",defaultMessage:"mm/dd/yyyy"}),INT:s.formatMessage({id:"date.formatINT",defaultMessage:"dd/mm/yyyy"}),ISO:s.formatMessage({id:"date.formatISO",defaultMessage:"yyyy/mm/dd"})}}handleTabbingOn(){this.dpWrapper&&this.dpWrapper.classList.add("user-is-tabbing")}handleTabbingOff(){this.dpWrapper&&this.dpWrapper.classList.remove("user-is-tabbing")}handleError(){this.errorMessage?this.generateError():(this.clearError(),this.processInput())}handleInput(e){this.value=e.target.value}handleBlur(e){this.preventValidation&&p(e,this.preventValidation)||this.processInput(),this.dpWrapper.classList.remove("focus")}focusHandler(){this.dpWrapper.classList.add("focus")}handlePopupBlurred(e){if(e.detail.relatedTarget!==this.el){const t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget,this.el.dispatchEvent(t)}}getActiveElement(){return o(document.activeElement)}handleCellTriggered(e){let t=e.detail,i=t.getAttribute("data-year")+"-"+t.getAttribute("data-month")+"-"+t.textContent;this.inputEl.value=this.reformatDate(this.dateFormat,i),this.processInput();const r=new CustomEvent("input");this.el.dispatchEvent(r)}processInput(e){const t=!e&&this.requiredField;let i=this.inputEl.value;if(this.eightDigitsEntry.test(this.inputEl.value)&&(this.inputEl.value=this.addSlashes(this.inputEl.value)),this.parsableEntry.test(this.inputEl.value)?(i=this.reformatDate("ISO",this.inputEl.value),this.inputEl.value=this.reformatDate(this.dateFormat,i),this.isValidDate(i)?this.errorMessage?this.generateError():this.clearError():this.inputEl.value.length&&this.generateError()):this.inputEl.value.length||t||this.errorMessage?this.generateError():this.inputEl.value.length||t||this.clearError(),i!==this.lastCommittedValue){this.value=i;const e=new CustomEvent("change");this.el.dispatchEvent(e),this.lastCommittedValue=this.value}this.isValidDate(i)&&i!==this.lastValidValue&&(this.wmDatepickerNewValidValue.emit(),this.lastValidValue=i)}reformatDate(e,t){if(!t)return"";if(!this.parsableEntry.test(t))return t;{let i=t.replace(/[\-\.]/gi,"/").split("/");switch(e){case"US":case this.dateFormats.US:return i[1].padStart(2,"0")+"/"+i[2].padStart(2,"0")+"/"+i[0].padStart(4,"20");case"INT":case this.dateFormats.INT:return i[2].padStart(2,"0")+"/"+i[1].padStart(2,"0")+"/"+i[0].padStart(4,"20");case"ISO":case this.dateFormats.ISO:if("US"===this.dateFormat||this.dateFormat===this.dateFormats.US)return i[2].padStart(4,"20")+"-"+i[0].padStart(2,"0")+"-"+i[1].padStart(2,"0");if("INT"===this.dateFormat||this.dateFormat===this.dateFormats.INT)return i[2].padStart(4,"20")+"-"+i[1].padStart(2,"0")+"-"+i[0].padStart(2,"0");if("ISO"===this.dateFormat||this.dateFormat===this.dateFormats.ISO)return i[0].padStart(4,"20")+"-"+i[1].padStart(2,"0")+"-"+i[2].padStart(2,"0");default:return i.join("/")}}}isValidDate(e){if(e&&this.isoEntry.test(e)){let t=e.split("-"),i=parseInt(t[2],10),r=parseInt(t[1],10),a=parseInt(t[0],10);if(a<1e3||a>3e3||0==r||r>12)return!1;let s=[31,28,31,30,31,30,31,31,30,31,30,31];return(a%400==0||a%100!=0&&a%4==0)&&(s[1]=29),i>0&&i<=s[r-1]}return!1}generateError(){const e=s.formatMessage({id:"date.requiredDateError",defaultMessage:"A date is required."}),t=s.formatMessage({id:"date.invalidDate",defaultMessage:"Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}."},{dateFormat:this.dateFormat.toLowerCase()});this.errorMessage?this.displayError=this.errorMessage:this.inputEl.value.length?this.displayError=t:!this.inputEl.value.length&&this.requiredField&&(this.displayError=e)}clearError(){this.displayError=""}addSlashes(e){return"ISO"===this.dateFormat||this.dateFormat===this.dateFormats.ISO?e.substring(0,4)+"/"+e.substring(4,6)+"/"+e.substring(6):e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4)}componentWillLoad(){this.el.focus=function(){this.disabled||this.shadowRoot.querySelector("input").focus()},""===this.label&&console.error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none."),this.errorMessage&&this.generateError(),this.uid=this.el.id?this.el.id:l(),this.value&&this.isValidDate(this.value)&&(this.lastValidValue=this.value)}componentDidLoad(){this.inputEl.value=this.reformatDate(this.dateFormat,this.value),this.processInput(!0)}render(){const e=s.formatMessage({id:"date.format",defaultMessage:"{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}"},{dateFormat:this.dateFormat.toLowerCase()});return i(r,{id:this.uid,"aria-busy":"false",class:this.displayError?"invalid":"",invalid:this.displayError?"true":null},i("div",{ref:e=>this.dpWrapper=e,class:`wrapper label-${this.labelPosition} ${this.displayError?"invalid":""}`},i("div",{class:"label-wrapper"},"none"!==this.labelPosition&&i("label",{id:`datepickerLabel-${this.uid}`,htmlFor:`date-input-${this.uid}`,class:"label",title:`${this.label} (${e})`},this.label,this.requiredField&&i("span",{"aria-hidden":"true",class:"required"},"*"))),i("div",null,i("div",{class:"inner-wrapper"},i("input",{disabled:this.disabled,type:"text",id:`date-input-${this.uid}`,class:"date-input",name:"date",placeholder:e,onFocus:this.focusHandler.bind(this),onInput:e=>this.handleInput(e),onBlur:e=>this.handleBlur(e),ref:e=>this.inputEl=e,"aria-describedby":`error-${this.uid}`,"aria-controls":`popup-${this.uid}`,"aria-label":this.label,required:this.requiredField}),i("priv-datepicker",{disabled:this.disabled,date:this.lastValidValue?new Date(this.lastValidValue):new Date,parentId:this.uid})),i("div",{id:`error-${this.uid}`,class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayError))))}get el(){return a(this)}static get watchers(){return{errorMessage:["handleError"]}}};n.style=':host,wm-datepicker{font-family:inherit}:host *,wm-datepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper,wm-datepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-datepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-datepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-datepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-datepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-datepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-datepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-datepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-datepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-datepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-datepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-datepicker .wrapper{position:relative}:host .wrapper .required,wm-datepicker .wrapper .required{color:#c4431c}:host .wrapper .inner-wrapper,wm-datepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid;border-color:rgba(35, 35, 35, 0.6);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input,wm-datepicker .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0}:host .wrapper .inner-wrapper .date-input:disabled,wm-datepicker .wrapper .inner-wrapper .date-input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper .date-input:focus,wm-datepicker .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper,wm-datepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-datepicker .wrapper.invalid .error{margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic;font-size:0.875rem;color:#c0392b}:host .wrapper.focus .inner-wrapper,wm-datepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .user-is-tabbing .toggle:focus:not(:active),wm-datepicker .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}';export{n as wm_datepicker}
|
|
1
|
+
import{r as e,c as t,h as i,H as r,g as a}from"./p-b3c71506.js";import{i as s,e as p,h as o,g as l}from"./p-de3367ee.js";let n=class{constructor(i){e(this,i),this.wmDatepickerNewValidValue=t(this,"wmDatepickerNewValidValue",7),this.value="",this.disabled=!1,this.dateFormat="US",this.errorMessage="",this.labelPosition="top",this.label="",this.requiredField=!1,this.displayError="",this.lastCommittedValue=this.value,this.parsableEntry=/^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/,this.isoEntry=/^\d\d\d\d[-]\d\d[-]\d\d$/,this.eightDigitsEntry=/^\d{8}$/,this.dateFormats={US:s.formatMessage({id:"date.formatUS",defaultMessage:"mm/dd/yyyy"}),INT:s.formatMessage({id:"date.formatINT",defaultMessage:"dd/mm/yyyy"}),ISO:s.formatMessage({id:"date.formatISO",defaultMessage:"yyyy/mm/dd"})}}handleTabbingOn(){this.dpWrapper&&this.dpWrapper.classList.add("user-is-tabbing")}handleTabbingOff(){this.dpWrapper&&this.dpWrapper.classList.remove("user-is-tabbing")}handleError(){this.errorMessage?this.generateError():(this.clearError(),this.processInput())}handleInput(e){this.value=e.target.value}handleBlur(e){this.preventValidation&&p(e,this.preventValidation)||this.processInput(),this.dpWrapper.classList.remove("focus")}focusHandler(){this.dpWrapper.classList.add("focus")}handlePopupBlurred(e){if(e.detail.relatedTarget!==this.el){const t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget,this.el.dispatchEvent(t)}}getActiveElement(){return o(document.activeElement)}handleCellTriggered(e){let t=e.detail,i=t.getAttribute("data-year")+"-"+t.getAttribute("data-month")+"-"+t.textContent;this.inputEl.value=this.reformatDate(this.dateFormat,i),this.processInput();const r=new CustomEvent("input");this.el.dispatchEvent(r)}processInput(e){const t=!e&&this.requiredField;let i=this.inputEl.value;if(this.eightDigitsEntry.test(this.inputEl.value)&&(this.inputEl.value=this.addSlashes(this.inputEl.value)),this.parsableEntry.test(this.inputEl.value)?(i=this.reformatDate("ISO",this.inputEl.value),this.inputEl.value=this.reformatDate(this.dateFormat,i),this.isValidDate(i)?this.errorMessage?this.generateError():this.clearError():this.inputEl.value.length&&this.generateError()):this.inputEl.value.length||t||this.errorMessage?this.generateError():this.inputEl.value.length||t||this.clearError(),i!==this.lastCommittedValue){this.value=i;const e=new CustomEvent("change");this.el.dispatchEvent(e),this.lastCommittedValue=this.value}this.isValidDate(i)&&i!==this.lastValidValue&&(this.wmDatepickerNewValidValue.emit(),this.lastValidValue=i)}reformatDate(e,t){if(!t)return"";if(!this.parsableEntry.test(t))return t;{let i=t.replace(/[\-\.]/gi,"/").split("/");switch(e){case"US":case this.dateFormats.US:return i[1].padStart(2,"0")+"/"+i[2].padStart(2,"0")+"/"+i[0].padStart(4,"20");case"INT":case this.dateFormats.INT:return i[2].padStart(2,"0")+"/"+i[1].padStart(2,"0")+"/"+i[0].padStart(4,"20");case"ISO":case this.dateFormats.ISO:if("US"===this.dateFormat||this.dateFormat===this.dateFormats.US)return i[2].padStart(4,"20")+"-"+i[0].padStart(2,"0")+"-"+i[1].padStart(2,"0");if("INT"===this.dateFormat||this.dateFormat===this.dateFormats.INT)return i[2].padStart(4,"20")+"-"+i[1].padStart(2,"0")+"-"+i[0].padStart(2,"0");if("ISO"===this.dateFormat||this.dateFormat===this.dateFormats.ISO)return i[0].padStart(4,"20")+"-"+i[1].padStart(2,"0")+"-"+i[2].padStart(2,"0");default:return i.join("/")}}}isValidDate(e){if(e&&this.isoEntry.test(e)){let t=e.split("-"),i=parseInt(t[2],10),r=parseInt(t[1],10),a=parseInt(t[0],10);if(a<1e3||a>3e3||0==r||r>12)return!1;let s=[31,28,31,30,31,30,31,31,30,31,30,31];return(a%400==0||a%100!=0&&a%4==0)&&(s[1]=29),i>0&&i<=s[r-1]}return!1}generateError(){const e=s.formatMessage({id:"date.requiredDateError",defaultMessage:"A date is required."}),t=s.formatMessage({id:"date.invalidDate",defaultMessage:"Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}."},{dateFormat:this.dateFormat.toLowerCase()});this.errorMessage?this.displayError=this.errorMessage:this.inputEl.value.length?this.displayError=t:!this.inputEl.value.length&&this.requiredField&&(this.displayError=e)}clearError(){this.displayError=""}addSlashes(e){return"ISO"===this.dateFormat||this.dateFormat===this.dateFormats.ISO?e.substring(0,4)+"/"+e.substring(4,6)+"/"+e.substring(6):e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4)}componentWillLoad(){this.el.focus=function(){this.disabled||this.shadowRoot.querySelector("input").focus()},""===this.label&&console.error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none."),this.errorMessage&&this.generateError(),this.uid=this.el.id?this.el.id:l(),this.value&&this.isValidDate(this.value)&&(this.lastValidValue=this.value)}componentDidLoad(){this.inputEl.value=this.reformatDate(this.dateFormat,this.value),this.processInput(!0)}render(){const e=s.formatMessage({id:"date.format",defaultMessage:"{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}"},{dateFormat:this.dateFormat.toLowerCase()});return i(r,{id:this.uid,"aria-busy":"false",class:this.displayError?"invalid":"",invalid:this.displayError?"true":null},i("div",{ref:e=>this.dpWrapper=e,class:`wrapper label-${this.labelPosition} ${this.displayError?"invalid":""}`},i("div",{class:"label-wrapper"},"none"!==this.labelPosition&&i("label",{id:`datepickerLabel-${this.uid}`,htmlFor:`date-input-${this.uid}`,class:"label",title:`${this.label} (${e})`},this.label,this.requiredField&&i("span",{"aria-hidden":"true",class:"required"},"*"))),i("div",null,i("div",{class:"inner-wrapper"},i("input",{disabled:this.disabled,type:"text",id:`date-input-${this.uid}`,class:"date-input",name:"date",placeholder:e,onFocus:this.focusHandler.bind(this),onInput:e=>this.handleInput(e),onBlur:e=>this.handleBlur(e),ref:e=>this.inputEl=e,"aria-describedby":`error-${this.uid}`,"aria-controls":`popup-${this.uid}`,"aria-label":this.label,required:this.requiredField}),i("priv-datepicker",{disabled:this.disabled,date:this.lastValidValue?new Date(this.lastValidValue):new Date,parentId:this.uid})),i("div",{id:`error-${this.uid}`,class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayError))))}get el(){return a(this)}static get watchers(){return{errorMessage:["handleError"]}}};n.style=':host,wm-datepicker{font-family:inherit}:host *,wm-datepicker *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper,wm-datepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-datepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-datepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-datepicker .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-datepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-datepicker .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-datepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-datepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-datepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-datepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-datepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-datepicker .wrapper{position:relative}:host .wrapper .required,wm-datepicker .wrapper .required{color:#c4431c}:host .wrapper .inner-wrapper,wm-datepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid;border-color:rgba(35, 35, 35, 0.6);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input,wm-datepicker .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0}:host .wrapper .inner-wrapper .date-input:disabled,wm-datepicker .wrapper .inner-wrapper .date-input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper .date-input:focus,wm-datepicker .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper,wm-datepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-datepicker .wrapper.invalid .error{margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic;font-size:0.875rem;color:#c0392b}:host .wrapper.focus .inner-wrapper,wm-datepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .user-is-tabbing .toggle:focus:not(:active),wm-datepicker .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}';export{n as wm_datepicker}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./p-a0c3ef16.system.js","./p-76ca7498.system.js","./p-f5df5903.system.js"],(function(t){"use strict";var e,i,n,o,s,r,a,c,l,h;return{setters:[function(t){e=t.r;i=t.c;n=t.h;o=t.H;s=t.g},function(t){r=t.n;a=t.g;c=t.l;l=t.q},function(t){h=t.g}],execute:function(){var m=":host{position:relative;display:inline-block;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;color:#575195;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host(:focus){outline:none}wm-action-menu:focus{outline:none}.dropdown{position:absolute;padding:0;margin:0.25rem 0;border-radius:3px 3px 3px 3px;min-width:11.4375rem;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;visibility:hidden;-webkit-box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);background:#fff;z-index:10;text-align:left;white-space:nowrap}.dropdown:focus{outline:none}.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1);visibility:visible}.dropdown.open-up{bottom:2.5rem;top:auto;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.dropdown.right{left:0}.dropdown.left{right:0}";var d=t("wm_action_menu",function(){function t(t){e(this,t);this.wmActionMenuLoaded=i(this,"wmActionMenuLoaded",7);this.menuLoaded=i(this,"menuLoaded",7);this.openUp=false;this.isExpanded=false;this.actionMenuType=null;this.buttonType=null;this.disabled=false;this.keysSoFar="";this.searchIndex=0;this.keyClear=null}Object.defineProperty(t.prototype,"horizontalPosition",{get:function(){return!!this.el&&!!this.itemsEl&&r(this.el,this.itemsEl)?"right":"left"},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"childItems",{get:function(){return Array.from(this.el.querySelectorAll("wm-menuitem"))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"tempActionMenuType",{get:function(){return this.actionMenuType||this.buttonType||"icon"},enumerable:false,configurable:true});t.prototype.handleClickedItem=function(){this.close()};t.prototype.handleKeyUp=function(t){this.moveUp(t.target)};t.prototype.handleKeyDown=function(t){this.moveDown(t.detail)};t.prototype.handleHomeKey=function(){this.focusFirstItem()};t.prototype.handleEndKey=function(){this.focusLastItem()};t.prototype.handleTabKey=function(){if(this.isExpanded){this.close()}};t.prototype.handleEscKey=function(){this.close();this.wmButtonEl.focus()};t.prototype.handleKey=function(t){var e=this;switch(t.key){case"ArrowDown":if(!this.isExpanded){t.preventDefault();this.open();window.requestAnimationFrame((function(){return e.focusFirstItem()}))}break;case"ArrowUp":if(!this.isExpanded){t.preventDefault();this.open();window.requestAnimationFrame((function(){return e.focusLastItem()}))}break}};t.prototype.handleMenuitemBlur=function(t){var e=t.detail.relatedTarget===this.el||this.el.contains(t.detail.relatedTarget);if(!e){var i=new CustomEvent("blur");i.relatedTarget=t.detail.relatedTarget;this.el.dispatchEvent(i)}};t.prototype.handleButtonBlur=function(t){var e=t.relatedTarget===this.el||this.el.contains(t.relatedTarget);if(e){t.stopPropagation()}};t.prototype.componentWillLoad=function(){this.uid=this.el.id?this.el.id:a();this.el.focus=function(){if(!this.disabled){var t=this.shadowRoot.querySelector("wm-button");t&&t.focus()}};if(this.buttonType){console.warn("wm-action-menu: button-type has been deprecated as of v3.1.0. Please use action-menu-type instead.")}};t.prototype.componentDidLoad=function(){if(this.childItems.length===0){console.error("wm-action-menu should have wm-menuitem elements as children")}else{this.focusFirstItem()}if(this.tempActionMenuType!=="icon"&&!this.buttonText){console.error("wm-action-menu should have a valid button-text property when action-menu-type is set to 'text' or 'selector'")}if(this.tempActionMenuType==="icon"&&!this.tooltip){console.error("wm-action-menu should have a valid tooltip when action-menu-type is set to 'icon'")}this.wmActionMenuLoaded.emit();this.menuLoaded.emit()};t.prototype.moveUp=function(t){var e=this.childItems.indexOf(t);if(e===0){this.focusLastItem()}else{this.focusItem(this.childItems[e-1])}};t.prototype.moveDown=function(t){var e=this.childItems.indexOf(t);if(e===this.childItems.length-1){this.focusFirstItem()}else{this.focusItem(this.childItems[e+1])}};t.prototype.open=function(){var t=this;if(!this.disabled){this.openUp=c(this.el,this.itemsEl);this.isExpanded=true;this.itemsEl.classList.remove("hidden");window.requestAnimationFrame((function(){return t.focusFirstItem()}))}};t.prototype.close=function(t){var e=this;if(t===void 0){t=true}this.isExpanded=false;this.childItems.forEach((function(t){return t.focused=false}));window.setTimeout((function(){e.itemsEl.classList.add("hidden")}),150);window.setTimeout((function(){if(t&&(document.activeElement.tagName==="BODY"||document.activeElement.tagName==="WM-MENUITEM")){e.wmButtonEl.focus()}}),250)};t.prototype.focusItem=function(t){this.childItems.map((function(e){return e.focused=e===t}));t.focus&&t.focus()};t.prototype.focusFirstItem=function(){this.focusItem(this.childItems[0])};t.prototype.focusLastItem=function(){this.focusItem(this.childItems[this.childItems.length-1])};t.prototype.findAndFocusItem=function(t){var e=t.detail.toUpperCase();this.focusFirstItem();if(!this.keysSoFar){for(var i=0;i<this.childItems.length;i++){if(this.childItems[i]===document.activeElement){this.searchIndex=i}}}this.keysSoFar+=e;this.clearKeysSoFarAfterDelay();var n=this.findMatchInRange(this.childItems,this.searchIndex+1,this.childItems.length);if(!n){n=this.findMatchInRange(this.childItems,0,this.searchIndex)}if(n){this.focusItem(n)}};t.prototype.clearKeysSoFarAfterDelay=function(){if(this.keyClear){window.clearTimeout(this.keyClear);this.keyClear=null}this.keyClear=window.setTimeout(function(){this.keysSoFar="";this.keyClear=null}.bind(this),500)};t.prototype.findMatchInRange=function(t,e,i){for(var n=e;n<i;n++){var o=t[n].innerText;if(o&&o.toUpperCase().indexOf(this.keysSoFar)===0){return t[n]}}return null};t.prototype.render=function(){var t=this;return n(o,{onBlur:function(){return t.close(false)}},n("div",{class:l()},n("wm-button",{"button-type":"".concat(this.tempActionMenuType,"only"),tooltip:this.tooltip,"label-for-identical-buttons":this.labelForIdenticalButtons,icon:this.tempActionMenuType==="icon"?"f1d9":"",id:"menubtn-".concat(this.uid),onClick:function(){return t.isExpanded?t.close():t.open()},onBlur:function(e){return t.handleButtonBlur(e)},disabled:this.disabled,ref:function(e){return t.wmButtonEl=e},"tooltip-position":this.tooltipPosition||this.horizontalPosition,"aria-haspopup":"true","aria-expanded":this.isExpanded?"true":"false","aria-controls":"menu-".concat(this.uid)},this.buttonText),n("div",{class:"dropdown ".concat(this.openUp?"open-up":""," ").concat(this.horizontalPosition," ").concat(this.isExpanded?"open":""," hidden"),id:"menu-".concat(this.uid),tabindex:-1,role:"menu",ref:function(e){return t.itemsEl=e}},n("slot",null))))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());d.style=m;var u=':host,wm-menuitem{contain:content;font-family:inherit}:host .wrapper,wm-menuitem .wrapper{display:block;min-width:8.75rem;cursor:pointer;padding:1.25rem;border-radius:0px 0px 0px 0px;background:#fff;font-family:inherit;font-weight:500;list-style:none;border-bottom:2px solid rgba(46, 27, 70, 0.05);color:#575195;font-weight:700}:host .wrapper:focus,:host .wrapper.focus,wm-menuitem .wrapper:focus,wm-menuitem .wrapper.focus{outline:none;background:#f4f3f6}:host .wrapper:hover,wm-menuitem .wrapper:hover{background:#f4f3f6;outline:none}:host .wrapper .description,wm-menuitem .wrapper .description{color:#4a4a4a;font-size:0.875rem;padding-top:0.5rem;white-space:normal;font-weight:400}:host .wrapper[aria-disabled=true],wm-menuitem .wrapper[aria-disabled=true]{font-style:italic;color:#6b6b6b}:host .wrapper:not(:last-child),wm-menuitem .wrapper:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host ::slotted,wm-menuitem ::slotted{font-family:inherit}:host .mdi,wm-menuitem .mdi{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-menuitem:focus{outline:none;background:#f4f3f6}:host([aria-disabled=true]),wm-menuitem[aria-disabled=true]{pointer-events:none}';var p=t("wm_menuitem",function(){function t(t){e(this,t);this.wmMenuitemClicked=i(this,"wmMenuitemClicked",7);this.wmKeyUpPressed=i(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=i(this,"wmKeyDownPressed",7);this.wmEscKeyPressed=i(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=i(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=i(this,"wmEndKeyPressed",7);this.wmPageDownItems=i(this,"wmPageDownItems",7);this.wmPageUpItems=i(this,"wmPageUpItems",7);this.wmTabKeyPressed=i(this,"wmTabKeyPressed",7);this.wmLetterPressed=i(this,"wmLetterPressed",7);this.wmMenuitemBlurred=i(this,"wmMenuitemBlurred",7);this.disabled=false;this.focused=false;this.icon=undefined;this.description=undefined;this.descriptionCharLimit=100;this.isKeying=false}t.prototype.toggleKeyingOn=function(){this.isKeying=true};t.prototype.toggleKeyingOff=function(){this.isKeying=false};t.prototype.handleKeydown=function(t){var e=t.altKey||t.ctrlKey||t.metaKey;var i=/^.$/.test(t.key);var n=i&&!e;switch(t.key){case"ArrowUp":t.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":t.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":t.preventDefault();if(!this.disabled){this.el.click()}break;case"Escape":t.preventDefault();t.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":t.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":t.preventDefault();this.wmEndKeyPressed.emit();break;case"Tab":this.wmTabKeyPressed.emit();break;default:if(n){t.preventDefault();this.wmLetterPressed.emit(t.key)}}};t.prototype.handleClick=function(){if(!this.disabled){this.wmMenuitemClicked.emit()}};t.prototype.handleBlur=function(t){this.wmMenuitemBlurred.emit({relatedTarget:t.relatedTarget})};t.prototype.setOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};t.prototype.componentWillLoad=function(){if(this.icon){this.icon=h(this.icon)}if(this.description){if(this.description.length>this.descriptionCharLimit){console.error("wm-menuitem description is above the character limit of ".concat(this.descriptionCharLimit))}if(this.icon){console.error("wm-menuitems with descriptions do not support the use of icons")}}this.setOnClick()};t.prototype.componentDidLoad=function(){if(this.icon){this.iconEl.classList.add("mdi");this.iconEl.innerHTML="&#x".concat(this.icon,";")}};t.prototype.render=function(){var t=this;return n(o,{tabindex:-1,role:"menuitem","aria-disabled":this.disabled?"true":null},n("div",{class:"wrapper ".concat(this.focused&&this.isKeying?"focus":""),"aria-disabled":this.disabled?"true":null},n("span",{ref:function(e){return t.iconEl=e}}),n("slot",null),this.description?n("div",{class:"description"},this.description):""))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{disabled:["setOnClick"]}},enumerable:false,configurable:true});return t}());p.style=u}}}));
|
|
1
|
+
System.register(["./p-a0c3ef16.system.js","./p-726c979a.system.js","./p-f5df5903.system.js"],(function(t){"use strict";var e,i,n,o,s,r,a,c,l,h;return{setters:[function(t){e=t.r;i=t.c;n=t.h;o=t.H;s=t.g},function(t){r=t.n;a=t.g;c=t.l;l=t.q},function(t){h=t.g}],execute:function(){var m=":host{position:relative;display:inline-block;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;color:#575195;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host(:focus){outline:none}wm-action-menu:focus{outline:none}.dropdown{position:absolute;padding:0;margin:0.25rem 0;border-radius:3px 3px 3px 3px;min-width:11.4375rem;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;visibility:hidden;-webkit-box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 3px 14px 3px rgba(5, 3, 3, 0.12), 0 4px 15px 0 rgba(0, 0, 0, 0.2);background:#fff;z-index:10;text-align:left;white-space:nowrap}.dropdown:focus{outline:none}.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1);visibility:visible}.dropdown.open-up{bottom:2.5rem;top:auto;-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.dropdown.right{left:0}.dropdown.left{right:0}";var d=t("wm_action_menu",function(){function t(t){e(this,t);this.wmActionMenuLoaded=i(this,"wmActionMenuLoaded",7);this.menuLoaded=i(this,"menuLoaded",7);this.openUp=false;this.isExpanded=false;this.actionMenuType=null;this.buttonType=null;this.disabled=false;this.keysSoFar="";this.searchIndex=0;this.keyClear=null}Object.defineProperty(t.prototype,"horizontalPosition",{get:function(){return!!this.el&&!!this.itemsEl&&r(this.el,this.itemsEl)?"right":"left"},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"childItems",{get:function(){return Array.from(this.el.querySelectorAll("wm-menuitem"))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"tempActionMenuType",{get:function(){return this.actionMenuType||this.buttonType||"icon"},enumerable:false,configurable:true});t.prototype.handleClickedItem=function(){this.close()};t.prototype.handleKeyUp=function(t){this.moveUp(t.target)};t.prototype.handleKeyDown=function(t){this.moveDown(t.detail)};t.prototype.handleHomeKey=function(){this.focusFirstItem()};t.prototype.handleEndKey=function(){this.focusLastItem()};t.prototype.handleTabKey=function(){if(this.isExpanded){this.close()}};t.prototype.handleEscKey=function(){this.close();this.wmButtonEl.focus()};t.prototype.handleKey=function(t){var e=this;switch(t.key){case"ArrowDown":if(!this.isExpanded){t.preventDefault();this.open();window.requestAnimationFrame((function(){return e.focusFirstItem()}))}break;case"ArrowUp":if(!this.isExpanded){t.preventDefault();this.open();window.requestAnimationFrame((function(){return e.focusLastItem()}))}break}};t.prototype.handleMenuitemBlur=function(t){var e=t.detail.relatedTarget===this.el||this.el.contains(t.detail.relatedTarget);if(!e){var i=new CustomEvent("blur");i.relatedTarget=t.detail.relatedTarget;this.el.dispatchEvent(i)}};t.prototype.handleButtonBlur=function(t){var e=t.relatedTarget===this.el||this.el.contains(t.relatedTarget);if(e){t.stopPropagation()}};t.prototype.componentWillLoad=function(){this.uid=this.el.id?this.el.id:a();this.el.focus=function(){if(!this.disabled){var t=this.shadowRoot.querySelector("wm-button");t&&t.focus()}};if(this.buttonType){console.warn("wm-action-menu: button-type has been deprecated as of v3.1.0. Please use action-menu-type instead.")}};t.prototype.componentDidLoad=function(){if(this.childItems.length===0){console.error("wm-action-menu should have wm-menuitem elements as children")}else{this.focusFirstItem()}if(this.tempActionMenuType!=="icon"&&!this.buttonText){console.error("wm-action-menu should have a valid button-text property when action-menu-type is set to 'text' or 'selector'")}if(this.tempActionMenuType==="icon"&&!this.tooltip){console.error("wm-action-menu should have a valid tooltip when action-menu-type is set to 'icon'")}this.wmActionMenuLoaded.emit();this.menuLoaded.emit()};t.prototype.moveUp=function(t){var e=this.childItems.indexOf(t);if(e===0){this.focusLastItem()}else{this.focusItem(this.childItems[e-1])}};t.prototype.moveDown=function(t){var e=this.childItems.indexOf(t);if(e===this.childItems.length-1){this.focusFirstItem()}else{this.focusItem(this.childItems[e+1])}};t.prototype.open=function(){var t=this;if(!this.disabled){this.openUp=c(this.el,this.itemsEl);this.isExpanded=true;this.itemsEl.classList.remove("hidden");window.requestAnimationFrame((function(){return t.focusFirstItem()}))}};t.prototype.close=function(t){var e=this;if(t===void 0){t=true}this.isExpanded=false;this.childItems.forEach((function(t){return t.focused=false}));window.setTimeout((function(){e.itemsEl.classList.add("hidden")}),150);window.setTimeout((function(){if(t&&(document.activeElement.tagName==="BODY"||document.activeElement.tagName==="WM-MENUITEM")){e.wmButtonEl.focus()}}),250)};t.prototype.focusItem=function(t){this.childItems.map((function(e){return e.focused=e===t}));t.focus&&t.focus()};t.prototype.focusFirstItem=function(){this.focusItem(this.childItems[0])};t.prototype.focusLastItem=function(){this.focusItem(this.childItems[this.childItems.length-1])};t.prototype.findAndFocusItem=function(t){var e=t.detail.toUpperCase();this.focusFirstItem();if(!this.keysSoFar){for(var i=0;i<this.childItems.length;i++){if(this.childItems[i]===document.activeElement){this.searchIndex=i}}}this.keysSoFar+=e;this.clearKeysSoFarAfterDelay();var n=this.findMatchInRange(this.childItems,this.searchIndex+1,this.childItems.length);if(!n){n=this.findMatchInRange(this.childItems,0,this.searchIndex)}if(n){this.focusItem(n)}};t.prototype.clearKeysSoFarAfterDelay=function(){if(this.keyClear){window.clearTimeout(this.keyClear);this.keyClear=null}this.keyClear=window.setTimeout(function(){this.keysSoFar="";this.keyClear=null}.bind(this),500)};t.prototype.findMatchInRange=function(t,e,i){for(var n=e;n<i;n++){var o=t[n].innerText;if(o&&o.toUpperCase().indexOf(this.keysSoFar)===0){return t[n]}}return null};t.prototype.render=function(){var t=this;return n(o,{onBlur:function(){return t.close(false)}},n("div",{class:l()},n("wm-button",{"button-type":"".concat(this.tempActionMenuType,"only"),tooltip:this.tooltip,"label-for-identical-buttons":this.labelForIdenticalButtons,icon:this.tempActionMenuType==="icon"?"f1d9":"",id:"menubtn-".concat(this.uid),onClick:function(){return t.isExpanded?t.close():t.open()},onBlur:function(e){return t.handleButtonBlur(e)},disabled:this.disabled,ref:function(e){return t.wmButtonEl=e},"tooltip-position":this.tooltipPosition||this.horizontalPosition,"aria-haspopup":"true","aria-expanded":this.isExpanded?"true":"false","aria-controls":"menu-".concat(this.uid)},this.buttonText),n("div",{class:"dropdown ".concat(this.openUp?"open-up":""," ").concat(this.horizontalPosition," ").concat(this.isExpanded?"open":""," hidden"),id:"menu-".concat(this.uid),tabindex:-1,role:"menu",ref:function(e){return t.itemsEl=e}},n("slot",null))))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());d.style=m;var u=':host,wm-menuitem{contain:content;font-family:inherit}:host .wrapper,wm-menuitem .wrapper{display:block;min-width:8.75rem;cursor:pointer;padding:1.25rem;border-radius:0px 0px 0px 0px;background:#fff;font-family:inherit;font-weight:500;list-style:none;border-bottom:2px solid rgba(46, 27, 70, 0.05);color:#575195;font-weight:700}:host .wrapper:focus,:host .wrapper.focus,wm-menuitem .wrapper:focus,wm-menuitem .wrapper.focus{outline:none;background:#f4f3f6}:host .wrapper:hover,wm-menuitem .wrapper:hover{background:#f4f3f6;outline:none}:host .wrapper .description,wm-menuitem .wrapper .description{color:#4a4a4a;font-size:0.875rem;padding-top:0.5rem;white-space:normal;font-weight:400}:host .wrapper[aria-disabled=true],wm-menuitem .wrapper[aria-disabled=true]{font-style:italic;color:#6b6b6b}:host .wrapper:not(:last-child),wm-menuitem .wrapper:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host ::slotted,wm-menuitem ::slotted{font-family:inherit}:host .mdi,wm-menuitem .mdi{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-menuitem:focus{outline:none;background:#f4f3f6}:host([aria-disabled=true]),wm-menuitem[aria-disabled=true]{pointer-events:none}';var p=t("wm_menuitem",function(){function t(t){e(this,t);this.wmMenuitemClicked=i(this,"wmMenuitemClicked",7);this.wmKeyUpPressed=i(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=i(this,"wmKeyDownPressed",7);this.wmEscKeyPressed=i(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=i(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=i(this,"wmEndKeyPressed",7);this.wmPageDownItems=i(this,"wmPageDownItems",7);this.wmPageUpItems=i(this,"wmPageUpItems",7);this.wmTabKeyPressed=i(this,"wmTabKeyPressed",7);this.wmLetterPressed=i(this,"wmLetterPressed",7);this.wmMenuitemBlurred=i(this,"wmMenuitemBlurred",7);this.disabled=false;this.focused=false;this.icon=undefined;this.description=undefined;this.descriptionCharLimit=100;this.isKeying=false}t.prototype.toggleKeyingOn=function(){this.isKeying=true};t.prototype.toggleKeyingOff=function(){this.isKeying=false};t.prototype.handleKeydown=function(t){var e=t.altKey||t.ctrlKey||t.metaKey;var i=/^.$/.test(t.key);var n=i&&!e;switch(t.key){case"ArrowUp":t.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":t.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":t.preventDefault();if(!this.disabled){this.el.click()}break;case"Escape":t.preventDefault();t.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":t.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":t.preventDefault();this.wmEndKeyPressed.emit();break;case"Tab":this.wmTabKeyPressed.emit();break;default:if(n){t.preventDefault();this.wmLetterPressed.emit(t.key)}}};t.prototype.handleClick=function(){if(!this.disabled){this.wmMenuitemClicked.emit()}};t.prototype.handleBlur=function(t){this.wmMenuitemBlurred.emit({relatedTarget:t.relatedTarget})};t.prototype.setOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};t.prototype.componentWillLoad=function(){if(this.icon){this.icon=h(this.icon)}if(this.description){if(this.description.length>this.descriptionCharLimit){console.error("wm-menuitem description is above the character limit of ".concat(this.descriptionCharLimit))}if(this.icon){console.error("wm-menuitems with descriptions do not support the use of icons")}}this.setOnClick()};t.prototype.componentDidLoad=function(){if(this.icon){this.iconEl.classList.add("mdi");this.iconEl.innerHTML="&#x".concat(this.icon,";")}};t.prototype.render=function(){var t=this;return n(o,{tabindex:-1,role:"menuitem","aria-disabled":this.disabled?"true":null},n("div",{class:"wrapper ".concat(this.focused&&this.isKeying?"focus":""),"aria-disabled":this.disabled?"true":null},n("span",{ref:function(e){return t.iconEl=e}}),n("slot",null),this.description?n("div",{class:"description"},this.description):""))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{disabled:["setOnClick"]}},enumerable:false,configurable:true});return t}());p.style=u}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,o,n){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,r){function a(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n["throw"](e))}catch(e){r(e)}}function l(e){e.done?o(e.value):i(e.value).then(a,s)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;i=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(r=o.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(a[0]===6&&o.label<r[1]){o.label=r[1];r=a;break}if(r&&o.label<r[2]){o.label=r[2];o.ops.push(a);break}if(r[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];i=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-a0c3ef16.system.js","./p-76ca7498.system.js"],(function(e){"use strict";var t,o,n,i,r,a,s,l;return{setters:[function(e){t=e.r;o=e.c;n=e.h;i=e.H;r=e.g},function(e){a=e.g;s=e.j;l=e.c}],execute:function(){var d="wm-modal{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;position:fixed;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);z-index:2001;width:80vw;max-width:750px;max-height:80vh;-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}wm-modal>*{width:80vw;max-width:750px;background:#fff}wm-modal>*:focus{outline:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem}wm-modal wm-modal-header{z-index:2003}wm-modal wm-modal-footer{z-index:2003}wm-modal>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px);z-index:2002}wm-modal.wm-modal wm-modal-header{border-bottom:1px solid #f4f3f6}wm-modal.wm-modal wm-modal-footer{border-top:1px solid #f4f3f6}@media only screen and (max-width: 768px){wm-modal.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal.wm-modal>*{max-width:none;width:100vw}wm-modal.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal.wm-dialog>:not(wm-modal-header):not(wm-modal-footer){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal .overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:-1;bottom:1;left:-1;right:1;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out;z-index:2000}wm-modal.hide{visibility:hidden}wm-modal .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important;top:0;left:0}";var m=e("wm_modal",function(){function e(e){var n=this;t(this,e);this.focusLastElement=o(this,"focusLastElement",3);this.focusFirstElement=o(this,"focusFirstElement",3);this.wmModalCloseTriggered=o(this,"wmModalCloseTriggered",3);this.wmCloseTriggered=o(this,"wmCloseTriggered",7);this.wmModalPrimaryTriggered=o(this,"wmModalPrimaryTriggered",7);this.wmPrimaryTriggered=o(this,"wmPrimaryTriggered",7);this.wmModalSecondaryTriggered=o(this,"wmModalSecondaryTriggered",7);this.wmSecondaryTriggered=o(this,"wmSecondaryTriggered",7);this.open=false;this.isOpen=false;this.elementToFocus="";this.modalType=null;this.isTypeDialog=null;this.bodyFocusListener=function(){return n.redirectFocusFromBody()}}Object.defineProperty(e.prototype,"tempOpen",{get:function(){return this.open||this.isOpen},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"tempModalType",{get:function(){return this.modalType?this.modalType:this.isTypeDialog?"dialog":"modal"},enumerable:false,configurable:true});e.prototype.toggleModal=function(){this.tempOpen?this.showModal():this.hideModal()};e.prototype.handleClick=function(e){this.tempOpen&&e.target===this.overlayEl&&this.focusOnOpen.focus()};e.prototype.closeModalOnEscape=function(e){if(e.key==="Escape"){e.stopPropagation();this.wmModalCloseTriggered.emit();this.wmCloseTriggered.emit();this.open=false}};e.prototype.showModal=function(){var e=this;this.setElToFocusOnClose();document.body.style.overflow="hidden";document.body.tabIndex=0;document.body.removeEventListener("focus",this.bodyFocusListener,true);document.body.addEventListener("focus",this.bodyFocusListener,true);window.requestAnimationFrame((function(){e.setElToFocusOnOpen();window.requestAnimationFrame((function(){return e.focusOnOpen.focus()}))}))};e.prototype.hideModal=function(){var e=this;document.body.style.overflow="visible";document.body.tabIndex=-1;document.body.removeEventListener("focus",this.bodyFocusListener,true);window.requestAnimationFrame((function(){return e.focusOnClose.focus()}))};e.prototype.componentWillLoad=function(){if(this.isOpen){console.warn("wm-modal: is-open has been deprecated as of v3.1.0. Please use open instead.")}if(this.isTypeDialog){console.warn("wm-modal: is-type-dialog has been deprecated as of v3.1.0. Please use modal-type instead.")}if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){if(!this.el.id){console.error("You are telling the modal to focus an element in the footer when it opens. That's fine! But when you do that, you also need to give the wm-modal-wrapper an ID and set the ID of the modal body to 'content-[id of wm-modal-wrapper]. This is for accessibility purposes.")}}this.uid=this.el.id?this.el.id:a()};e.prototype.componentDidLoad=function(){if(this.tempOpen){this.showModal()}};e.prototype.emitCloseEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalCloseTriggered.emit();this.wmCloseTriggered.emit();return[2]}))}))};e.prototype.emitPrimaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalPrimaryTriggered.emit();this.wmPrimaryTriggered.emit();return[2]}))}))};e.prototype.emitSecondaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalSecondaryTriggered.emit();this.wmSecondaryTriggered.emit();return[2]}))}))};e.prototype.setElToFocusOnOpen=function(){var e=s(this.el.querySelector("#wm-modal-close-".concat(this.uid)));if(this.elementToFocus){if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){this.setAriaDescribedbyOnModal();this.elementToFocus="wm-".concat(this.elementToFocus,"-").concat(this.uid)}var t=this.el.querySelector("#".concat(this.elementToFocus));if(t){var o=s(t);if(o){this.focusOnOpen=o}else{console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");this.focusOnOpen=e}}else{console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");this.focusOnOpen=e}}else{this.focusOnOpen=e}};e.prototype.setAriaDescribedbyOnModal=function(){var e=document.getElementById("content-".concat(this.uid));if(!e){console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.")}else{this.el.setAttribute("aria-describedby","wm-modal-heading-text-".concat(this.uid," content-").concat(this.uid))}};e.prototype.setElToFocusOnClose=function(){var e=document.activeElement;if(e.tagName==="WM-MENUITEM"){this.focusOnClose=e.parentElement}else{this.focusOnClose=l(e)}};e.prototype.redirectFocusFromBody=function(){if(document.activeElement.tagName==="BODY"){this.setElToFocusOnOpen();this.focusOnOpen.focus()}};e.prototype.render=function(){var e=this;return n(i,{class:"".concat(this.tempOpen?"":"hide ").concat("wm-"+this.tempModalType),role:"dialog","aria-describedby":"wm-modal-heading-text-".concat(this.uid),"aria-modal":"true",tabindex:this.tempOpen?0:null,onFocus:function(){e.focusLastElement.emit()}},n("div",{class:"overlay",ref:function(t){return e.overlayEl=t}}),n("div",{class:"sr-only",tabIndex:0,onFocus:function(){e.focusFirstElement.emit()}}))};Object.defineProperty(e.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{open:["toggleModal"],isOpen:["toggleModal"]}},enumerable:false,configurable:true});return e}());m.style=d}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,o,n){function i(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,r){function a(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n["throw"](e))}catch(e){r(e)}}function l(e){e.done?o(e.value):i(e.value).then(a,s)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;i=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(r=o.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(a[0]===6&&o.label<r[1]){o.label=r[1];r=a;break}if(r&&o.label<r[2]){o.label=r[2];o.ops.push(a);break}if(r[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];i=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-a0c3ef16.system.js","./p-726c979a.system.js"],(function(e){"use strict";var t,o,n,i,r,a,s,l;return{setters:[function(e){t=e.r;o=e.c;n=e.h;i=e.H;r=e.g},function(e){a=e.g;s=e.j;l=e.c}],execute:function(){var d="wm-modal{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;position:fixed;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);z-index:2001;width:80vw;max-width:750px;max-height:80vh;-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}wm-modal>*{width:80vw;max-width:750px;background:#fff}wm-modal>*:focus{outline:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem}wm-modal wm-modal-header{z-index:2003}wm-modal wm-modal-footer{z-index:2003}wm-modal>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px);z-index:2002}wm-modal.wm-modal wm-modal-header{border-bottom:1px solid #f4f3f6}wm-modal.wm-modal wm-modal-footer{border-top:1px solid #f4f3f6}@media only screen and (max-width: 768px){wm-modal.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal.wm-modal>*{max-width:none;width:100vw}wm-modal.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal.wm-dialog>:not(wm-modal-header):not(wm-modal-footer){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal .overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:-1;bottom:1;left:-1;right:1;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out;z-index:2000}wm-modal.hide{visibility:hidden}wm-modal .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important;top:0;left:0}";var m=e("wm_modal",function(){function e(e){var n=this;t(this,e);this.focusLastElement=o(this,"focusLastElement",3);this.focusFirstElement=o(this,"focusFirstElement",3);this.wmModalCloseTriggered=o(this,"wmModalCloseTriggered",3);this.wmCloseTriggered=o(this,"wmCloseTriggered",7);this.wmModalPrimaryTriggered=o(this,"wmModalPrimaryTriggered",7);this.wmPrimaryTriggered=o(this,"wmPrimaryTriggered",7);this.wmModalSecondaryTriggered=o(this,"wmModalSecondaryTriggered",7);this.wmSecondaryTriggered=o(this,"wmSecondaryTriggered",7);this.open=false;this.isOpen=false;this.elementToFocus="";this.modalType=null;this.isTypeDialog=null;this.bodyFocusListener=function(){return n.redirectFocusFromBody()}}Object.defineProperty(e.prototype,"tempOpen",{get:function(){return this.open||this.isOpen},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"tempModalType",{get:function(){return this.modalType?this.modalType:this.isTypeDialog?"dialog":"modal"},enumerable:false,configurable:true});e.prototype.toggleModal=function(){this.tempOpen?this.showModal():this.hideModal()};e.prototype.handleClick=function(e){this.tempOpen&&e.target===this.overlayEl&&this.focusOnOpen.focus()};e.prototype.closeModalOnEscape=function(e){if(e.key==="Escape"){e.stopPropagation();this.wmModalCloseTriggered.emit();this.wmCloseTriggered.emit();this.open=false}};e.prototype.showModal=function(){var e=this;this.setElToFocusOnClose();document.body.style.overflow="hidden";document.body.tabIndex=0;document.body.removeEventListener("focus",this.bodyFocusListener,true);document.body.addEventListener("focus",this.bodyFocusListener,true);window.requestAnimationFrame((function(){e.setElToFocusOnOpen();window.requestAnimationFrame((function(){return e.focusOnOpen.focus()}))}))};e.prototype.hideModal=function(){var e=this;document.body.style.overflow="visible";document.body.tabIndex=-1;document.body.removeEventListener("focus",this.bodyFocusListener,true);window.requestAnimationFrame((function(){return e.focusOnClose.focus()}))};e.prototype.componentWillLoad=function(){if(this.isOpen){console.warn("wm-modal: is-open has been deprecated as of v3.1.0. Please use open instead.")}if(this.isTypeDialog){console.warn("wm-modal: is-type-dialog has been deprecated as of v3.1.0. Please use modal-type instead.")}if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){if(!this.el.id){console.error("You are telling the modal to focus an element in the footer when it opens. That's fine! But when you do that, you also need to give the wm-modal-wrapper an ID and set the ID of the modal body to 'content-[id of wm-modal-wrapper]. This is for accessibility purposes.")}}this.uid=this.el.id?this.el.id:a()};e.prototype.componentDidLoad=function(){if(this.tempOpen){this.showModal()}};e.prototype.emitCloseEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalCloseTriggered.emit();this.wmCloseTriggered.emit();return[2]}))}))};e.prototype.emitPrimaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalPrimaryTriggered.emit();this.wmPrimaryTriggered.emit();return[2]}))}))};e.prototype.emitSecondaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.wmModalSecondaryTriggered.emit();this.wmSecondaryTriggered.emit();return[2]}))}))};e.prototype.setElToFocusOnOpen=function(){var e=s(this.el.querySelector("#wm-modal-close-".concat(this.uid)));if(this.elementToFocus){if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){this.setAriaDescribedbyOnModal();this.elementToFocus="wm-".concat(this.elementToFocus,"-").concat(this.uid)}var t=this.el.querySelector("#".concat(this.elementToFocus));if(t){var o=s(t);if(o){this.focusOnOpen=o}else{console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");this.focusOnOpen=e}}else{console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");this.focusOnOpen=e}}else{this.focusOnOpen=e}};e.prototype.setAriaDescribedbyOnModal=function(){var e=document.getElementById("content-".concat(this.uid));if(!e){console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.")}else{this.el.setAttribute("aria-describedby","wm-modal-heading-text-".concat(this.uid," content-").concat(this.uid))}};e.prototype.setElToFocusOnClose=function(){var e=document.activeElement;if(e.tagName==="WM-MENUITEM"){this.focusOnClose=e.parentElement}else{this.focusOnClose=l(e)}};e.prototype.redirectFocusFromBody=function(){if(document.activeElement.tagName==="BODY"){this.setElToFocusOnOpen();this.focusOnOpen.focus()}};e.prototype.render=function(){var e=this;return n(i,{class:"".concat(this.tempOpen?"":"hide ").concat("wm-"+this.tempModalType),role:"dialog","aria-describedby":"wm-modal-heading-text-".concat(this.uid),"aria-modal":"true",tabindex:this.tempOpen?0:null,onFocus:function(){e.focusLastElement.emit()}},n("div",{class:"overlay",ref:function(t){return e.overlayEl=t}}),n("div",{class:"sr-only",tabIndex:0,onFocus:function(){e.focusFirstElement.emit()}}))};Object.defineProperty(e.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{open:["toggleModal"],isOpen:["toggleModal"]}},enumerable:false,configurable:true});return e}());m.style=d}}}));
|