Mike Phares 127634f5ab Delete self contained Thunder Tests
Back to .net8.0
api/v4/InfinityQS
ApiExplorerSettings
Wafer Counter
Color Sorting
2024-03-13 13:15:56 -07:00

2 lines
7.1 KiB
JavaScript

import{r as t,c as e,h as o,a as i,g as n}from"./p-5308bbce.js";function a(t,e,o,i=20,n=0){const s=[];if(n>=i){return s}const r=t=>{const s=t.assignedNodes().filter((t=>t.nodeType===1));if(s.length>0){const t=s[0].parentElement;return a(t,e,o,i,n+1)}return[]};const d=Array.from(t.children||[]);for(const t of d){if(e(t)){continue}if(o(t)){s.push(t)}if(t.shadowRoot!=null){s.push(...a(t.shadowRoot,e,o,i,n+1))}else if(t.tagName==="SLOT"){s.push(...r(t))}else{s.push(...a(t,e,o,i,n+1))}}return s}function s(t){return t.hasAttribute("hidden")||t.hasAttribute("aria-hidden")&&t.getAttribute("aria-hidden")!=="false"||t.style.display===`none`||t.style.opacity===`0`||t.style.visibility===`hidden`||t.style.visibility===`collapse`}function r(t){return t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&t.getAttribute("aria-disabled")!=="false"}function d(t){if(t.getAttribute("tabindex")==="-1"||s(t)||r(t)){return false}return t.hasAttribute("tabindex")||(t instanceof HTMLAnchorElement||t instanceof HTMLAreaElement)&&t.hasAttribute("href")||t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLIFrameElement}function l(t,e,o){const i=t.animate(e,Object.assign(Object.assign({},o),{fill:"both"}));i.addEventListener("finish",(()=>{i.commitStyles();i.cancel()}));return i}const c={easing:"cubic-bezier(0.390, 0.575, 0.565, 1.000)"};const h={fadeIn:[Object.assign(Object.assign({offset:0},c),{opacity:0}),Object.assign(Object.assign({offset:1},c),{opacity:1})],fadeOut:[Object.assign(Object.assign({offset:0},c),{opacity:1}),Object.assign(Object.assign({offset:1},c),{opacity:0})]};const f=':root{--ifx-font-family:"Source Sans 3";font-family:var(--ifx-font-family, sans-serif)}:host{display:block}.modal-container{display:none;position:fixed;top:0;left:0;width:100%;height:100%;z-index:1060;overflow-y:auto;font-family:var(--ifx-font-family)}.modal-container.open{display:block}.modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#1D1D1D;opacity:0.5;z-index:0}.modal-content-container{position:absolute;display:flex;justify-content:center;top:50%;left:50%;transform:translate(-50%, -50%);width:90%;min-height:218px;background-color:#fff;border-radius:0;box-shadow:0 2px 10px rgba(0, 0, 0, 0.1);overflow:hidden;box-sizing:border-box;align-items:stretch}@media screen and (min-width: 768px){.modal-content-container{width:540px;min-height:132px}}.modal-content{display:flex;flex-direction:column;width:100%;height:100%}.modal-icon-container{display:flex;align-items:center;justify-content:center;width:32px;background-color:#0A8276;align-self:stretch}.modal-icon-container.danger{background-color:#CD002F}.modal-icon-container ifx-icon{color:#FFFFFF}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:24px;height:76px;box-sizing:border-box;border-radius:1px 1px 0px 0px;border-bottom:1px solid #EEEDED}.modal-header h2{margin:0;font-weight:600;font-size:1.25rem;line-height:28px}.modal-header button{background:none;border:none;font-size:1.5em;padding:0;cursor:pointer}.modal-body{padding:16px 24px;min-height:56px;box-sizing:border-box;flex:1;max-height:70vh;overflow-y:auto}.modal-footer.buttons-present ::slotted(*){display:flex;justify-content:flex-end;gap:16px;padding:16px 24px 32px 16px}.modal-border{display:flex;align-items:center;justify-content:center;width:100%;font-size:1.5em;flex-grow:1}.modal-border.primary{background-color:#0A8276}.modal-border.secondary{background-color:#575352}.modal-border.danger{background-color:#CD002F}.modal-border.success{background-color:#4CA460}.modal-border.warning{background-color:#E16B25}.modal-border.orange{background-color:#E16B25}.modal-border.ocean{background-color:#0A8276}.modal-border.grey{background-color:#575352}.modal-border.grey-200{background-color:#EEEDED}.modal-border.red{background-color:#CD002F}.modal-border.green{background-color:#4CA460}.modal-border.berry{background-color:#9C216E}';const u=class{constructor(o){t(this,o);this.ifxModalOpen=e(this,"ifxModalOpen",7);this.ifxModalClose=e(this,"ifxModalClose",7);this.focusableElements=[];this.handleTopFocus=()=>{this.attemptFocus(this.getLastFocusableElement())};this.handleBottomFocus=()=>{this.attemptFocus(this.getFirstFocusableElement())};this.handleKeypress=t=>{if(!this.showModal){return}if(t.key==="Escape"){this.doBeforeClose("ESCAPE_KEY")}};this.opened=false;this.showModal=this.opened||false;this.caption="Modal Title";this.closeOnOverlayClick=true;this.variant="default";this.alertIcon="";this.okButtonLabel="OK";this.cancelButtonLabel="Cancel";this.slotButtonsPresent=false}componentDidLoad(){this.focusableElements=a(this.hostElement.shadowRoot,(t=>s(t)||t.matches("[data-focus-trap-edge]")),d)}getFirstFocusableElement(){return this.focusableElements[0]}getLastFocusableElement(){return this.focusableElements[this.focusableElements.length-1]}attemptFocus(t){if(t==null){setTimeout((()=>{this.closeButton.focus()}));return}setTimeout((()=>{t.focus()}),0)}open(){this.showModal=true;try{const t=l(this.modalContainer,h.fadeIn,{duration:200});t.addEventListener("finish",(()=>{this.attemptFocus(this.getFirstFocusableElement());this.ifxModalOpen.emit()}));this.hostElement.addEventListener("keydown",this.handleKeypress)}catch(t){this.ifxModalOpen.emit()}}close(){try{const t=l(this.modalContainer,h.fadeOut,{duration:200});t.addEventListener("finish",(()=>{this.showModal=false;this.ifxModalClose.emit()}));this.hostElement.removeEventListener("keydown",this.handleKeypress)}catch(t){this.showModal=false;this.ifxModalClose.emit()}}doBeforeClose(t){const e=[];e.push(t);const o=e.some((t=>t.defaultPrevented));if(!o){this.opened=false}}openedChanged(t){if(t===true){this.open()}else{this.close()}}handleOverlayClick(){if(this.closeOnOverlayClick){this.doBeforeClose("BACKDROP")}}handleButtonsSlotChange(t){var e;if(((e=t.currentTarget.assignedElements()[0])===null||e===void 0?void 0:e.childElementCount)>0){this.slotButtonsPresent=true}else{this.slotButtonsPresent=false}}render(){const t=this.variant!=="default";return o(i,null,o("div",{ref:t=>this.modalContainer=t,class:`modal-container ${this.showModal?"open":""}`},o("div",{class:"modal-overlay",onClick:()=>this.handleOverlayClick()}),o("div",{"data-focus-trap-edge":true,onFocus:this.handleTopFocus,tabindex:"0"}),o("div",{class:`modal-content-container`,role:"dialog","aria-modal":"true","aria-label":this.caption},t?o("div",{class:`modal-icon-container ${this.variant==="alert-brand"?"":"danger"}`},this.alertIcon?o("ifx-icon",{icon:this.alertIcon}):null):null,o("div",{class:"modal-content"},o("div",{class:"modal-header"},o("h2",null,this.caption),o("ifx-icon-button",{ref:t=>this.closeButton=t,icon:"cross-24",variant:"tertiary",onClick:()=>this.doBeforeClose("CLOSE_BUTTON")})),o("div",{class:"modal-body"},o("slot",{name:"content"})),o("div",{class:`modal-footer ${this.slotButtonsPresent?"buttons-present":""}`},o("slot",{name:"buttons",onSlotchange:t=>this.handleButtonsSlotChange(t)})))),o("div",{"data-focus-trap-edge":true,onFocus:this.handleBottomFocus,tabindex:"0"})))}get hostElement(){return n(this)}static get watchers(){return{opened:["openedChanged"]}}};u.style=f;export{u as ifx_modal};
//# sourceMappingURL=p-6f4bfe0e.entry.js.map