forms-reactive
Version:
Reactive Form Web Component
8 lines • 8.6 kB
JavaScript
import{d as n}from"./p-3647f076.js";import{m as e,d as t,j as o,k as i,g as s}from"./p-c1432a35.js";import{OVERLAY_BACK_BUTTON_PRIORITY as r,shouldUseCloseWatcher as d}from"./p-955d90ef.js";import{g as a,c,a as l}from"./p-9c83f640.js";import{C as u}from"./p-f9482dbc.js";import{B as f}from"./p-c7ee7cfe.js";import{p as m}from"./p-8613551a.js";
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/const p='[tabindex]:not([tabindex^="-"]):not([hidden]):not([disabled]), input:not([type=hidden]):not([tabindex^="-"]):not([hidden]):not([disabled]), textarea:not([tabindex^="-"]):not([hidden]):not([disabled]), button:not([tabindex^="-"]):not([hidden]):not([disabled]), select:not([tabindex^="-"]):not([hidden]):not([disabled]), ion-checkbox:not([tabindex^="-"]):not([hidden]):not([disabled]), ion-radio:not([tabindex^="-"]):not([hidden]):not([disabled]), .ion-focusable:not([tabindex^="-"]):not([hidden]):not([disabled]), .ion-focusable[disabled="false"]:not([tabindex^="-"]):not([hidden])';const v=(n,e)=>{const t=n.querySelector(p);b(t,e!==null&&e!==void 0?e:n)};const h=(n,e)=>{const t=Array.from(n.querySelectorAll(p));const o=t.length>0?t[t.length-1]:null;b(o,e!==null&&e!==void 0?e:n)};const b=(n,t)=>{let o=n;const i=n===null||n===void 0?void 0:n.shadowRoot;if(i){o=i.querySelector(p)||n}if(o){const n=o.closest("ion-radio-group");if(n){n.setFocus()}else{e(o)}}else{t.focus()}};
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/let y=0;let w=0;const g=new WeakMap;const O=n=>({create(e){return N(n,e)},dismiss(e,t,o){return P(document,e,t,n,o)},async getTop(){return F(document,n)}});const T=O("ion-alert");const k=O("ion-action-sheet");const x=O("ion-modal");const j=O("ion-popover");const A=n=>{if(typeof document!=="undefined"){B(document)}const e=y++;n.overlayIndex=e};const I=n=>{if(!n.hasAttribute("id")){n.id=`ion-overlay-${++w}`}return n.id};const N=(n,e)=>{if(typeof window!=="undefined"&&typeof window.customElements!=="undefined"){return window.customElements.whenDefined(n).then((()=>{const o=document.createElement(n);o.classList.add("overlay-hidden");Object.assign(o,Object.assign(Object.assign({},e),{hasController:true}));z(document).appendChild(o);return new Promise((n=>t(o,n)))}))}return Promise.resolve()};const S=n=>n.classList.contains("overlay-hidden");const C=(n,t)=>{let o=n;const i=n===null||n===void 0?void 0:n.shadowRoot;if(i){o=i.querySelector(p)||n}if(o){e(o)}else{t.focus()}};const D=(n,e)=>{const t=F(e,"ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker-legacy,ion-popover");const o=n.target;if(!t||!o){return}if(t.classList.contains(tn)){return}const i=()=>{if(t===o){t.lastFocus=undefined}else if(o.tagName==="ION-TOAST"){C(t.lastFocus,t)}else{const n=s(t);if(!n.contains(o)){return}const i=n.querySelector(".ion-overlay-wrapper");if(!i){return}if(i.contains(o)||o===n.querySelector("ion-backdrop")){t.lastFocus=o}else{const n=t.lastFocus;v(i,t);if(n===e.activeElement){h(i,t)}t.lastFocus=e.activeElement}}};const r=()=>{if(t.contains(o)){t.lastFocus=o}else if(o.tagName==="ION-TOAST"){C(t.lastFocus,t)}else{const n=t.lastFocus;v(t);if(n===e.activeElement){h(t)}t.lastFocus=e.activeElement}};if(t.shadowRoot){r()}else{i()}};const B=n=>{if(y===0){y=1;n.addEventListener("focus",(e=>{D(e,n)}),true);n.addEventListener("ionBackButton",(e=>{const t=F(n);if(t===null||t===void 0?void 0:t.backdropDismiss){e.detail.register(r,(()=>{t.dismiss(undefined,Q)}))}}));if(!d()){n.addEventListener("keydown",(e=>{if(e.key==="Escape"){const e=F(n);if(e===null||e===void 0?void 0:e.backdropDismiss){e.dismiss(undefined,Q)}}}))}}};const P=(n,e,t,o,i)=>{const s=F(n,o,i);if(!s){return Promise.reject("overlay does not exist")}return s.dismiss(e,t)};const M=(n,e)=>{if(e===undefined){e="ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker-legacy,ion-popover,ion-toast"}return Array.from(n.querySelectorAll(e)).filter((n=>n.overlayIndex>0))};const E=(n,e)=>M(n,e).filter((n=>!S(n)));const F=(n,e,t)=>{const o=E(n,e);return t===undefined?o[o.length-1]:o.find((n=>n.id===t))};const G=(n=false)=>{const e=z(document);const t=e.querySelector("ion-router-outlet, ion-nav, #ion-view-container-root");if(!t){return}if(n){t.setAttribute("aria-hidden","true")}else{t.removeAttribute("aria-hidden")}};const L=async(n,e,t,o,i)=>{var s,r;if(n.presented){return}if(n.el.tagName!=="ION-TOAST"){G(true)}document.body.classList.add(f);nn(n.el);Z(n.el);n.presented=true;n.willPresent.emit();(s=n.willPresentShorthand)===null||s===void 0?void 0:s.emit();const d=a(n);const l=n.enterAnimation?n.enterAnimation:c.get(e,d==="ios"?t:o);const u=await W(n,l,n.el,i);if(u){n.didPresent.emit();(r=n.didPresentShorthand)===null||r===void 0?void 0:r.emit()}if(n.el.tagName!=="ION-TOAST"){V(n.el)}if(n.keyboardClose&&(document.activeElement===null||!n.el.contains(document.activeElement))){n.el.focus()}n.el.removeAttribute("aria-hidden")};const V=async n=>{let e=document.activeElement;if(!e){return}const t=e===null||e===void 0?void 0:e.shadowRoot;if(t){e=t.querySelector(p)||e}await n.onDidDismiss();if(document.activeElement===null||document.activeElement===document.body){e.focus()}};const $=async(e,t,o,i,s,r,d)=>{var l,u;if(!e.presented){return false}const m=n!==undefined?E(n).filter((n=>n.tagName!=="ION-TOAST")):[];const p=m.length===1&&m[0].id===e.el.id;if(p){G(false);document.body.classList.remove(f)}e.presented=false;try{Z(e.el);e.el.style.setProperty("pointer-events","none");e.willDismiss.emit({data:t,role:o});(l=e.willDismissShorthand)===null||l===void 0?void 0:l.emit({data:t,role:o});const n=a(e);const f=e.leaveAnimation?e.leaveAnimation:c.get(i,n==="ios"?s:r);if(o!==R){await W(e,f,e.el,d)}e.didDismiss.emit({data:t,role:o});(u=e.didDismissShorthand)===null||u===void 0?void 0:u.emit({data:t,role:o});const m=g.get(e)||[];m.forEach((n=>n.destroy()));g.delete(e);e.el.classList.add("overlay-hidden");e.el.style.removeProperty("pointer-events");if(e.el.lastFocus!==undefined){e.el.lastFocus=undefined}}catch(n){console.error(n)}e.el.remove();en();return true};const z=n=>n.querySelector("ion-app")||n.body;const W=async(n,e,t,o)=>{t.classList.remove("overlay-hidden");const i=n.el;const s=e(i,o);if(!n.animated||!c.getBoolean("animated",true)){s.duration(0)}if(n.keyboardClose){s.beforeAddWrite((()=>{const n=t.ownerDocument.activeElement;if(n===null||n===void 0?void 0:n.matches("input,ion-input, ion-textarea")){n.blur()}}))}const r=g.get(n)||[];g.set(n,[...r,s]);await s.play();return true};const _=(n,e)=>{let t;const o=new Promise((n=>t=n));q(n,e,(n=>{t(n.detail)}));return o};const q=(n,e,t)=>{const s=o=>{i(n,e,s);t(o)};o(n,e,s)};const H=n=>n==="cancel"||n===Q;const J=n=>n();const K=(n,e)=>{if(typeof n==="function"){const t=c.get("_zoneGate",J);return t((()=>{try{return n(e)}catch(n){throw n}}))}return undefined};const Q="backdrop";const R="gesture";const U=39;const X=n=>{let e=false;let t;const o=u();const i=(i=false)=>{if(t&&!i){return{delegate:t,inline:e}}const{el:s,hasController:r,delegate:d}=n;const a=s.parentNode;e=a!==null&&!r;t=e?d||o:d;return{inline:e,delegate:t}};const s=async e=>{const{delegate:t}=i(true);if(t){return await t.attachViewToDom(n.el,e)}const{hasController:o}=n;if(o&&e!==undefined){throw new Error("framework delegate is missing")}return null};const r=()=>{const{delegate:e}=i();if(e&&n.el!==undefined){e.removeViewFromDom(n.el.parentElement,n.el)}};return{attachViewToDom:s,removeViewFromDom:r}};const Y=()=>{let n;const e=()=>{if(n){n();n=undefined}};const t=(t,o)=>{e();const i=o!==undefined?document.getElementById(o):null;if(!i){m(`A trigger element with the ID "${o}" was not found in the DOM. The trigger element must be in the DOM when the "trigger" property is set on an overlay component.`,t);return}const s=(n,e)=>{const t=()=>{e.present()};n.addEventListener("click",t);return()=>{n.removeEventListener("click",t)}};n=s(i,t)};return{addClickListener:t,removeClickListener:e}};const Z=e=>{if(n===undefined)return;if(l("android")){e.setAttribute("aria-hidden","true")}};const nn=e=>{var t;if(n===undefined)return;const o=E(n);for(let n=o.length-1;n>=0;n--){const i=o[n];const s=(t=o[n+1])!==null&&t!==void 0?t:e;if(s.hasAttribute("aria-hidden")||s.tagName!=="ION-TOAST"){i.setAttribute("aria-hidden","true")}}};const en=()=>{if(n===undefined)return;const e=E(n);for(let n=e.length-1;n>=0;n--){const t=e[n];t.removeAttribute("aria-hidden");if(t.tagName!=="ION-TOAST"){break}}};const tn="ion-disable-focus-trap";export{Q as B,tn as F,R as G,U as O,Y as a,A as b,X as c,$ as d,_ as e,I as f,v as g,j as h,H as i,k as j,T as k,F as l,x as m,h as n,L as p,K as s};
//# sourceMappingURL=p-80f56a8c.js.map