aptechka 0.54.7 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +127 -120
- package/lib/radio/index.cjs +1 -1
- package/lib/radio/index.js +39 -34
- package/package.json +1 -1
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=c=>{throw TypeError(c)};var J=(c,r,t)=>r.has(c)||Z("Cannot "+t);var e=(c,r,t)=>(J(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(J(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(J(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("../element-linked-store/index.cjs"),b=require("../css-property/index.cjs"),X=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),ie=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs"),I=require("../url-D1CgmwZ_.cjs"),N=require("../window-resizer/index.cjs");var a,f,D,F;class oe{constructor(){i(this,a,new Map);i(this,f,[]);i(this,D,r=>{var s;const t=[...e(this,f)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(Y=>Y instanceof HTMLElement&&Y.hasAttribute("data-popover-content")))return;const l=o[0],q=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),te=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!q||te)&&t.close()}});i(this,F,r=>{if(r.code==="Escape"){const t=[...e(this,f)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,D)),addEventListener("keydown",e(this,F))}get groups(){return e(this,a)}get stack(){return e(this,f)}add(r,t){if(t.closeRest.current)e(this,a).forEach(o=>{o.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let o=e(this,a).get(r);o==null||o.forEach(l=>{l.close()})}let s=e(this,a).get(r);s!=null&&s.length||(s=[],e(this,a).set(r,s)),e(this,f).push(t),s.push(t)}remove(r,t){if(n(this,f,e(this,f).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,a).forEach(o=>{o.forEach(l=>s.push(l))}),e(this,a).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,a).get(r);e(this,a).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,a).get(r);s&&(s=s.filter(o=>o!==t),e(this,a).set(r,s))}}}a=new WeakMap,f=new WeakMap,D=new WeakMap,F=new WeakMap;var p,$,T,d,y,P,k,g,C,A,L,R,u,S,_,j,x,M,H,O;const E=class E extends HTMLElement{constructor(){super();i(this,S);i(this,p);i(this,$);i(this,T);i(this,d);i(this,y);i(this,P);i(this,k);i(this,g);i(this,C);i(this,A);i(this,L);i(this,R);i(this,u);i(this,x);i(this,M);i(this,H);i(this,O);this.urlValue="",n(this,p,!1),n(this,d,new b.CSSProperty(this,"--history",!1)),n(this,y,new b.CSSProperty(this,"--restore",!1)),n(this,P,new b.CSSProperty(this,"--close-rest",!1)),n(this,k,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new b.CSSProperty(this,"--group","")),n(this,C,new b.CSSProperty(this,"--click-outside",!1)),n(this,A,new b.CSSProperty(this,"--escape",!1)),n(this,L,!1),n(this,u,new se.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1})),n(this,x,()=>{n(this,L,!1),e(this,p)&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,p)&&e(this,d).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,L,!0)}),n(this,M,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,H).call(this)}),n(this,H,ie.debounce(()=>{e(this,O).call(this)},10)),n(this,O,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),o=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,d)}get restore(){return e(this,y)}get closeRest(){return e(this,P)}get closeRestInGroup(){return e(this,k)}get group(){return e(this,g)}get clickOutside(){return e(this,C)}get escape(){return e(this,A)}get opened(){return e(this,p)}get lastTrigger(){return e(this,R)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,p)&&I.updateSearchParameter(this.id,t)}open(t){if(e(this,p))return;n(this,R,t==null?void 0:t.trigger),clearTimeout(e(this,$)),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),U.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,R)}}),e(this,d).current&&e(this,L)&&history.pushState(history.state,"",e(this,S,_)),n(this,p,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,O).call(this),e(this,u).set("opened",!0),U.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,R)}}),n(this,T,void 0)};t!=null&&t.skipTransition?s():n(this,T,setTimeout(s,10))}close(){e(this,p)&&(clearTimeout(e(this,T)),E.stack.remove(e(this,g).current,this),n(this,p,!1),m(this,S,j).call(this),e(this,u).set("opened",!1),e(this,u).set("closing",!0),U.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,$,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("closing",!1),U.dispatchEvent(this,"popoverClosed",{custom:!0})},re.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,d).observe(),e(this,y).observe(),e(this,P).observe(),e(this,k).observe(),e(this,g).observe(),e(this,C).observe(),e(this,A).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,x)),setTimeout(()=>{e(this,y).current?(this.urlValue=I.parseSearchParameters(location.search)[this.id],e(this,x).call(this)):(m(this,S,j).call(this),n(this,L,!0))},0),N.windowResizer.subscribe(e(this,M))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),N.windowResizer.unsubscribe(e(this,M)),e(this,u).close(),e(this,d).close(),e(this,y).close(),e(this,P).close(),e(this,k).close(),e(this,g).close(),e(this,C).close(),e(this,A).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,S,j).call(this)}};p=new WeakMap,$=new WeakMap,T=new WeakMap,d=new WeakMap,y=new WeakMap,P=new WeakMap,k=new WeakMap,g=new WeakMap,C=new WeakMap,A=new WeakMap,L=new WeakMap,R=new WeakMap,u=new WeakMap,S=new WeakSet,_=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},j=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},x=new WeakMap,M=new WeakMap,H=new WeakMap,O=new WeakMap,E.stack=new oe;let V=E;X.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",V);var h,v,w,K,z,W,B,G,Q;class ee extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,v,new b.CSSProperty(this,"--type","open"));i(this,z,()=>{this.classList.add("triggered")});i(this,W,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});i(this,B,()=>{this.classList.remove("opened")});i(this,G,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});X.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,v).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,v)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(m(this,w,K).call(this),t){let o=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)o=l;else{const q=this.getRootNode();q instanceof ShadowRoot?o=q.host.closest("[data-popover]"):q instanceof HTMLElement&&(o=q.closest("[data-popover]"))}}else t==="sibling"?o=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]"):(!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),o=document.querySelector(t)||this.getRootNode().querySelector(t));o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,z)),e(this,h).addEventListener("popoverOpened",e(this,W)),e(this,h).addEventListener("popoverClosing",e(this,B)),e(this,h).addEventListener("popoverClosed",e(this,G))):console.warn(this,`target ${t} not found`)}m(this,w,Q).call(this,e(this,v).current)}connectedCallback(){e(this,v).subscribe(s=>{m(this,w,Q).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,v).observe()}disconnectedCallback(){e(this,v).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),m(this,w,K).call(this)}}h=new WeakMap,v=new WeakMap,w=new WeakSet,K=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,z)),e(this,h).removeEventListener("popoverOpened",e(this,W)),e(this,h).removeEventListener("popoverClosing",e(this,B)),e(this,h).removeEventListener("popoverClosed",e(this,G)))},z=new WeakMap,W=new WeakMap,B=new WeakMap,G=new WeakMap,Q=function(t){e(this,h)instanceof V&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};X.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ee);exports.PopoverButtonElement=ee;exports.PopoverElement=V;
|
|
1
|
+
"use strict";var N=c=>{throw TypeError(c)};var K=(c,r,t)=>r.has(c)||N("Cannot "+t);var e=(c,r,t)=>(K(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?N("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(K(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(K(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../element-linked-store/index.cjs"),b=require("../css-property/index.cjs"),Y=require("../index-Cqw2NKev.cjs"),j=require("../events-KVanG9sR.cjs"),ne=require("../function-MthRj-GJ.cjs"),_=require("../style-At6aDoqG.cjs"),ee=require("../url-D1CgmwZ_.cjs"),te=require("../window-resizer/index.cjs");var u,v,F,J;class he{constructor(){i(this,u,new Map);i(this,v,[]);i(this,F,r=>{var s;const t=[...e(this,v)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(Z=>Z instanceof HTMLElement&&Z.hasAttribute("data-popover-content")))return;const l=o[0],q=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),re=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!q||re)&&t.close()}});i(this,J,r=>{if(r.code==="Escape"){const t=[...e(this,v)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,F)),addEventListener("keydown",e(this,J))}get groups(){return e(this,u)}get stack(){return e(this,v)}add(r,t){if(t.closeRest.current)e(this,u).forEach(o=>{o.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let o=e(this,u).get(r);o==null||o.forEach(l=>{l.close()})}let s=e(this,u).get(r);s!=null&&s.length||(s=[],e(this,u).set(r,s)),e(this,v).push(t),s.push(t)}remove(r,t){if(n(this,v,e(this,v).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(o=>{o.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(r);e(this,u).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,u).get(r);s&&(s=s.filter(o=>o!==t),e(this,u).set(r,s))}}}u=new WeakMap,v=new WeakMap,F=new WeakMap,J=new WeakMap;var d,$,M,w,O,f,y,P,k,g,C,A,L,R,a,T,se,I,x,V,W,H;const E=class E extends HTMLElement{constructor(){super();i(this,T);i(this,d);i(this,$);i(this,M);i(this,w);i(this,O);i(this,f);i(this,y);i(this,P);i(this,k);i(this,g);i(this,C);i(this,A);i(this,L);i(this,R);i(this,a);i(this,x);i(this,V);i(this,W);i(this,H);this.urlValue="",n(this,d,!1),n(this,f,new b.CSSProperty(this,"--history",!1)),n(this,y,new b.CSSProperty(this,"--restore",!1)),n(this,P,new b.CSSProperty(this,"--close-rest",!1)),n(this,k,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new b.CSSProperty(this,"--group","")),n(this,C,new b.CSSProperty(this,"--click-outside",!1)),n(this,A,new b.CSSProperty(this,"--escape",!1)),n(this,L,!1),n(this,a,new oe.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,x,()=>{n(this,L,!1),e(this,d)&&e(this,f).current&&!location.search.includes(this.id)?this.close():!e(this,d)&&e(this,f).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,L,!0)}),n(this,V,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,W).call(this)}),n(this,W,ne.debounce(()=>{e(this,H).call(this)},10)),n(this,H,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),o=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,f)}get restore(){return e(this,y)}get closeRest(){return e(this,P)}get closeRestInGroup(){return e(this,k)}get group(){return e(this,g)}get clickOutside(){return e(this,C)}get escape(){return e(this,A)}get opened(){return e(this,d)}get lastTrigger(){return e(this,R)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d)&&ee.updateSearchParameter(this.id,t)}open(t){if(e(this,d))return;n(this,R,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),j.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,R)}}),e(this,f).current&&e(this,L)&&history.pushState(history.state,"",e(this,T,se)),n(this,d,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,H).call(this),e(this,a).set("opened",!0),j.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,R)}}),n(this,w,void 0),n(this,O,setTimeout(()=>{e(this,a).set("transitionend",!0)},_.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,w,setTimeout(s,10))}close(){e(this,d)&&(clearTimeout(e(this,w)),clearTimeout(e(this,O)),E.stack.remove(e(this,g).current,this),n(this,d,!1),m(this,T,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),j.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),j.dispatchEvent(this,"popoverClosed",{custom:!0})},_.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,f).observe(),e(this,y).observe(),e(this,P).observe(),e(this,k).observe(),e(this,g).observe(),e(this,C).observe(),e(this,A).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,x)),setTimeout(()=>{e(this,y).current?(this.urlValue=ee.parseSearchParameters(location.search)[this.id],e(this,x).call(this)):(m(this,T,I).call(this),n(this,L,!0))},0),te.windowResizer.subscribe(e(this,V))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),te.windowResizer.unsubscribe(e(this,V)),e(this,a).close(),e(this,f).close(),e(this,y).close(),e(this,P).close(),e(this,k).close(),e(this,g).close(),e(this,C).close(),e(this,A).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,w)),clearTimeout(e(this,O)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,T,I).call(this)}};d=new WeakMap,$=new WeakMap,M=new WeakMap,w=new WeakMap,O=new WeakMap,f=new WeakMap,y=new WeakMap,P=new WeakMap,k=new WeakMap,g=new WeakMap,C=new WeakMap,A=new WeakMap,L=new WeakMap,R=new WeakMap,a=new WeakMap,T=new WeakSet,se=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,f).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},x=new WeakMap,V=new WeakMap,W=new WeakMap,H=new WeakMap,E.stack=new he;let z=E;Y.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,p,S,Q,B,G,D,U,X;class ie extends HTMLElement{constructor(){super();i(this,S);i(this,h);i(this,p,new b.CSSProperty(this,"--type","open"));i(this,B,()=>{e(this,p).current!=="close"&&this.classList.add("triggered")});i(this,G,()=>{e(this,p).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});i(this,D,()=>{e(this,p).current!=="close"&&this.classList.remove("opened")});i(this,U,()=>{e(this,p).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});Y.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,p).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,p)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(m(this,S,Q).call(this),t){let o=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)o=l;else{const q=this.getRootNode();q instanceof ShadowRoot?o=q.host.closest("[data-popover]"):q instanceof HTMLElement&&(o=q.closest("[data-popover]"))}}else t==="sibling"?o=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]"):(!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),o=document.querySelector(t)||this.getRootNode().querySelector(t));o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,B)),e(this,h).addEventListener("popoverOpened",e(this,G)),e(this,h).addEventListener("popoverClosing",e(this,D)),e(this,h).addEventListener("popoverClosed",e(this,U))):console.warn(this,`target ${t} not found`)}m(this,S,X).call(this,e(this,p).current)}connectedCallback(){e(this,p).subscribe(s=>{m(this,S,X).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,p).observe()}disconnectedCallback(){e(this,p).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),m(this,S,Q).call(this)}}h=new WeakMap,p=new WeakMap,S=new WeakSet,Q=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,B)),e(this,h).removeEventListener("popoverOpened",e(this,G)),e(this,h).removeEventListener("popoverClosing",e(this,D)),e(this,h).removeEventListener("popoverClosed",e(this,U)))},B=new WeakMap,G=new WeakMap,D=new WeakMap,U=new WeakMap,X=function(t){e(this,h)instanceof z&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};Y.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ie);exports.PopoverButtonElement=ie;exports.PopoverElement=z;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,127 +1,130 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N = (c) => {
|
|
2
2
|
throw TypeError(c);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (c, r, t) => (
|
|
6
|
-
import { ElementLinkedStore as
|
|
4
|
+
var K = (c, r, t) => r.has(c) || N("Cannot " + t);
|
|
5
|
+
var e = (c, r, t) => (K(c, r, "read from private field"), t ? t.call(c) : r.get(c)), i = (c, r, t) => r.has(c) ? N("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(c) : r.set(c, t), h = (c, r, t, s) => (K(c, r, "write to private field"), s ? s.call(c, t) : r.set(c, t), t), v = (c, r, t) => (K(c, r, "access private method"), t);
|
|
6
|
+
import { ElementLinkedStore as ie } from "../element-linked-store/index.js";
|
|
7
7
|
import { CSSProperty as b } from "../css-property/index.js";
|
|
8
|
-
import { i as
|
|
9
|
-
import { d as
|
|
10
|
-
import { d as
|
|
11
|
-
import { g as
|
|
12
|
-
import { u as
|
|
13
|
-
import { windowResizer as
|
|
14
|
-
var
|
|
15
|
-
class
|
|
8
|
+
import { i as Y } from "../index-euf5anj6.js";
|
|
9
|
+
import { d as D } from "../events-CsVF98U6.js";
|
|
10
|
+
import { d as re } from "../function-C10DGppn.js";
|
|
11
|
+
import { g as _ } from "../style-j2TwriJ_.js";
|
|
12
|
+
import { u as oe, p as he } from "../url-B6BNcw6_.js";
|
|
13
|
+
import { windowResizer as ee } from "../window-resizer/index.js";
|
|
14
|
+
var u, m, F, J;
|
|
15
|
+
class ne {
|
|
16
16
|
constructor() {
|
|
17
|
-
i(this,
|
|
18
|
-
i(this,
|
|
19
|
-
i(this,
|
|
17
|
+
i(this, u, /* @__PURE__ */ new Map());
|
|
18
|
+
i(this, m, []);
|
|
19
|
+
i(this, F, (r) => {
|
|
20
20
|
var s;
|
|
21
|
-
const t = [...e(this,
|
|
21
|
+
const t = [...e(this, m)].reverse().find((o) => o.clickOutside.current);
|
|
22
22
|
if (t) {
|
|
23
23
|
const o = r.composedPath();
|
|
24
24
|
if (o.find(
|
|
25
|
-
(
|
|
25
|
+
(Z) => Z instanceof HTMLElement && Z.hasAttribute("data-popover-content")
|
|
26
26
|
))
|
|
27
27
|
return;
|
|
28
|
-
const a = o[0], $ = a instanceof Node && (t.contains(a) || ((s = t.shadowRoot) == null ? void 0 : s.contains(a))),
|
|
29
|
-
(!$ ||
|
|
28
|
+
const a = o[0], $ = a instanceof Node && (t.contains(a) || ((s = t.shadowRoot) == null ? void 0 : s.contains(a))), se = a instanceof HTMLElement && a.hasAttribute("data-outside");
|
|
29
|
+
(!$ || se) && t.close();
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
i(this,
|
|
32
|
+
i(this, J, (r) => {
|
|
33
33
|
if (r.code === "Escape") {
|
|
34
|
-
const t = [...e(this,
|
|
34
|
+
const t = [...e(this, m)].reverse().find((s) => s.escape.current);
|
|
35
35
|
t && t.close();
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
addEventListener("click", e(this,
|
|
38
|
+
addEventListener("click", e(this, F)), addEventListener("keydown", e(this, J));
|
|
39
39
|
}
|
|
40
40
|
get groups() {
|
|
41
|
-
return e(this,
|
|
41
|
+
return e(this, u);
|
|
42
42
|
}
|
|
43
43
|
get stack() {
|
|
44
|
-
return e(this,
|
|
44
|
+
return e(this, m);
|
|
45
45
|
}
|
|
46
46
|
add(r, t) {
|
|
47
47
|
if (t.closeRest.current)
|
|
48
|
-
e(this,
|
|
48
|
+
e(this, u).forEach((o) => {
|
|
49
49
|
o.forEach((a) => {
|
|
50
50
|
a.close();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
else if (t.closeRestInGroup.current) {
|
|
54
|
-
let o = e(this,
|
|
54
|
+
let o = e(this, u).get(r);
|
|
55
55
|
o == null || o.forEach((a) => {
|
|
56
56
|
a.close();
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
let s = e(this,
|
|
60
|
-
s != null && s.length || (s = [], e(this,
|
|
59
|
+
let s = e(this, u).get(r);
|
|
60
|
+
s != null && s.length || (s = [], e(this, u).set(r, s)), e(this, m).push(t), s.push(t);
|
|
61
61
|
}
|
|
62
62
|
remove(r, t) {
|
|
63
|
-
if (h(this,
|
|
63
|
+
if (h(this, m, e(this, m).filter((s) => s !== t)), t.closeRest.current) {
|
|
64
64
|
let s = [];
|
|
65
|
-
e(this,
|
|
65
|
+
e(this, u).forEach((o) => {
|
|
66
66
|
o.forEach((a) => s.push(a));
|
|
67
|
-
}), e(this,
|
|
67
|
+
}), e(this, u).clear(), s.forEach((o) => o.close());
|
|
68
68
|
} else if (t.closeRestInGroup.current) {
|
|
69
|
-
const s = e(this,
|
|
70
|
-
e(this,
|
|
69
|
+
const s = e(this, u).get(r);
|
|
70
|
+
e(this, u).delete(r), s == null || s.forEach((o) => {
|
|
71
71
|
o.close();
|
|
72
72
|
});
|
|
73
73
|
} else {
|
|
74
|
-
let s = e(this,
|
|
75
|
-
s && (s = s.filter((o) => o !== t), e(this,
|
|
74
|
+
let s = e(this, u).get(r);
|
|
75
|
+
s && (s = s.filter((o) => o !== t), e(this, u).set(r, s));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
var
|
|
79
|
+
u = new WeakMap(), m = new WeakMap(), F = new WeakMap(), J = new WeakMap();
|
|
80
|
+
var d, V, M, w, O, f, L, A, P, g, S, C, T, R, l, y, te, I, x, H, G, W;
|
|
81
81
|
const E = class E extends HTMLElement {
|
|
82
82
|
constructor() {
|
|
83
83
|
super();
|
|
84
|
-
i(this,
|
|
85
|
-
i(this,
|
|
84
|
+
i(this, y);
|
|
85
|
+
i(this, d);
|
|
86
86
|
i(this, V);
|
|
87
|
+
i(this, M);
|
|
87
88
|
i(this, w);
|
|
88
|
-
i(this,
|
|
89
|
+
i(this, O);
|
|
90
|
+
i(this, f);
|
|
89
91
|
i(this, L);
|
|
90
92
|
i(this, A);
|
|
91
93
|
i(this, P);
|
|
92
|
-
i(this,
|
|
94
|
+
i(this, g);
|
|
93
95
|
i(this, S);
|
|
94
|
-
i(this, R);
|
|
95
|
-
i(this, y);
|
|
96
96
|
i(this, C);
|
|
97
|
-
i(this,
|
|
97
|
+
i(this, T);
|
|
98
|
+
i(this, R);
|
|
99
|
+
i(this, l);
|
|
98
100
|
i(this, x);
|
|
99
|
-
i(this, M);
|
|
100
101
|
i(this, H);
|
|
101
|
-
i(this,
|
|
102
|
-
|
|
102
|
+
i(this, G);
|
|
103
|
+
i(this, W);
|
|
104
|
+
this.urlValue = "", h(this, d, !1), h(this, f, new b(this, "--history", !1)), h(this, L, new b(this, "--restore", !1)), h(this, A, new b(this, "--close-rest", !1)), h(this, P, new b(
|
|
103
105
|
this,
|
|
104
106
|
"--close-rest-in-group",
|
|
105
107
|
!1
|
|
106
|
-
)), h(this,
|
|
108
|
+
)), h(this, g, new b(this, "--group", "")), h(this, S, new b(this, "--click-outside", !1)), h(this, C, new b(this, "--escape", !1)), h(this, T, !1), h(this, l, new ie(this, {
|
|
107
109
|
opened: !1,
|
|
108
110
|
closing: !1,
|
|
109
|
-
triggered: !1
|
|
111
|
+
triggered: !1,
|
|
112
|
+
transitionend: !1
|
|
110
113
|
})), h(this, x, () => {
|
|
111
|
-
h(this,
|
|
112
|
-
}), h(this,
|
|
113
|
-
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this,
|
|
114
|
-
}), h(this,
|
|
115
|
-
e(this,
|
|
116
|
-
}, 10)), h(this,
|
|
114
|
+
h(this, T, !1), e(this, d) && e(this, f).current && !location.search.includes(this.id) ? this.close() : !e(this, d) && e(this, f).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, T, !0);
|
|
115
|
+
}), h(this, H, () => {
|
|
116
|
+
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, G).call(this);
|
|
117
|
+
}), h(this, G, re(() => {
|
|
118
|
+
e(this, W).call(this);
|
|
119
|
+
}, 10)), h(this, W, () => {
|
|
117
120
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
118
|
-
}), e(this,
|
|
121
|
+
}), e(this, g).subscribe((t) => {
|
|
119
122
|
t.previous && (E.stack.remove(t.previous, this), t.current || (document.documentElement.classList.remove(
|
|
120
123
|
`${this.group.previous}-closing`
|
|
121
124
|
), document.documentElement.classList.remove(
|
|
122
125
|
`${this.group.previous}-opened`
|
|
123
126
|
)));
|
|
124
|
-
}), e(this,
|
|
127
|
+
}), e(this, l).subscribe((t) => {
|
|
125
128
|
if (this.group.current) {
|
|
126
129
|
document.documentElement.classList.toggle(
|
|
127
130
|
`${this.group.current}-closing`,
|
|
@@ -136,7 +139,7 @@ const E = class E extends HTMLElement {
|
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
get history() {
|
|
139
|
-
return e(this,
|
|
142
|
+
return e(this, f);
|
|
140
143
|
}
|
|
141
144
|
get restore() {
|
|
142
145
|
return e(this, L);
|
|
@@ -148,95 +151,99 @@ const E = class E extends HTMLElement {
|
|
|
148
151
|
return e(this, P);
|
|
149
152
|
}
|
|
150
153
|
get group() {
|
|
151
|
-
return e(this,
|
|
154
|
+
return e(this, g);
|
|
152
155
|
}
|
|
153
156
|
get clickOutside() {
|
|
154
157
|
return e(this, S);
|
|
155
158
|
}
|
|
156
159
|
get escape() {
|
|
157
|
-
return e(this,
|
|
160
|
+
return e(this, C);
|
|
158
161
|
}
|
|
159
162
|
get opened() {
|
|
160
|
-
return e(this,
|
|
163
|
+
return e(this, d);
|
|
161
164
|
}
|
|
162
165
|
get lastTrigger() {
|
|
163
|
-
return e(this,
|
|
166
|
+
return e(this, R);
|
|
164
167
|
}
|
|
165
168
|
get idWithValue() {
|
|
166
169
|
return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
|
|
167
170
|
}
|
|
168
171
|
updateUrlValue(t) {
|
|
169
|
-
this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this,
|
|
172
|
+
this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, d) && oe(this.id, t);
|
|
170
173
|
}
|
|
171
174
|
open(t) {
|
|
172
|
-
if (e(this,
|
|
175
|
+
if (e(this, d))
|
|
173
176
|
return;
|
|
174
|
-
h(this,
|
|
177
|
+
h(this, R, t == null ? void 0 : t.trigger), clearTimeout(e(this, V)), clearTimeout(e(this, M)), e(this, l).set("closing", !1), e(this, l).set("triggered", !0), D(this, "popoverTriggered", {
|
|
175
178
|
custom: !0,
|
|
176
179
|
detail: {
|
|
177
|
-
trigger: e(this,
|
|
180
|
+
trigger: e(this, R)
|
|
178
181
|
}
|
|
179
|
-
}), e(this,
|
|
182
|
+
}), e(this, f).current && e(this, T) && history.pushState(history.state, "", e(this, y, te)), h(this, d, !0);
|
|
180
183
|
const s = () => {
|
|
181
|
-
E.stack.add(e(this,
|
|
184
|
+
E.stack.add(e(this, g).current, this), e(this, W).call(this), e(this, l).set("opened", !0), D(this, "popoverOpened", {
|
|
182
185
|
custom: !0,
|
|
183
186
|
detail: {
|
|
184
|
-
trigger: e(this,
|
|
187
|
+
trigger: e(this, R)
|
|
185
188
|
}
|
|
186
|
-
}), h(this, w, void 0)
|
|
189
|
+
}), h(this, w, void 0), h(this, O, setTimeout(() => {
|
|
190
|
+
e(this, l).set("transitionend", !0);
|
|
191
|
+
}, _(this) + 10));
|
|
187
192
|
};
|
|
188
193
|
t != null && t.skipTransition ? s() : h(this, w, setTimeout(s, 10));
|
|
189
194
|
}
|
|
190
195
|
close() {
|
|
191
|
-
e(this,
|
|
192
|
-
|
|
193
|
-
}), h(this, V, setTimeout(() => {
|
|
194
|
-
e(this, u).set("triggered", !1), e(this, u).set("closing", !1), B(this, "popoverClosed", {
|
|
196
|
+
e(this, d) && (clearTimeout(e(this, w)), clearTimeout(e(this, O)), E.stack.remove(e(this, g).current, this), h(this, d, !1), v(this, y, I).call(this), e(this, l).set("transitionend", !1), h(this, V, setTimeout(() => {
|
|
197
|
+
e(this, l).set("opened", !1), e(this, l).set("closing", !0), D(this, "popoverClosing", {
|
|
195
198
|
custom: !0
|
|
196
|
-
})
|
|
197
|
-
|
|
199
|
+
}), h(this, M, setTimeout(() => {
|
|
200
|
+
e(this, l).set("triggered", !1), e(this, l).set("closing", !1), D(this, "popoverClosed", {
|
|
201
|
+
custom: !0
|
|
202
|
+
});
|
|
203
|
+
}, _(this) + 10));
|
|
204
|
+
}, 10)));
|
|
198
205
|
}
|
|
199
206
|
connectedCallback() {
|
|
200
|
-
e(this,
|
|
201
|
-
e(this, L).current ? (this.urlValue =
|
|
202
|
-
}, 0),
|
|
207
|
+
e(this, f).observe(), e(this, L).observe(), e(this, A).observe(), e(this, P).observe(), e(this, g).observe(), e(this, S).observe(), e(this, C).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", e(this, x)), setTimeout(() => {
|
|
208
|
+
e(this, L).current ? (this.urlValue = he(location.search)[this.id], e(this, x).call(this)) : (v(this, y, I).call(this), h(this, T, !0));
|
|
209
|
+
}, 0), ee.subscribe(e(this, H));
|
|
203
210
|
}
|
|
204
211
|
disconnectedCallback() {
|
|
205
|
-
E.stack.remove(e(this,
|
|
212
|
+
E.stack.remove(e(this, g).current, this), ee.unsubscribe(e(this, H)), e(this, l).close(), e(this, f).close(), e(this, L).close(), e(this, A).close(), e(this, P).close(), e(this, g).close(), e(this, S).close(), e(this, C).close(), this.removeAttribute("role"), clearTimeout(e(this, V)), clearTimeout(e(this, M)), clearTimeout(e(this, w)), clearTimeout(e(this, O)), removeEventListener("popstate", e(this, x)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), v(this, y, I).call(this);
|
|
206
213
|
}
|
|
207
214
|
};
|
|
208
|
-
|
|
215
|
+
d = new WeakMap(), V = new WeakMap(), M = new WeakMap(), w = new WeakMap(), O = new WeakMap(), f = new WeakMap(), L = new WeakMap(), A = new WeakMap(), P = new WeakMap(), g = new WeakMap(), S = new WeakMap(), C = new WeakMap(), T = new WeakMap(), R = new WeakMap(), l = new WeakMap(), y = new WeakSet(), te = function() {
|
|
209
216
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
210
|
-
},
|
|
211
|
-
if (e(this,
|
|
217
|
+
}, I = function() {
|
|
218
|
+
if (e(this, f).current) {
|
|
212
219
|
const t = new URL(location.href);
|
|
213
220
|
t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
|
|
214
221
|
}
|
|
215
|
-
}, x = new WeakMap(),
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
var n,
|
|
219
|
-
class
|
|
222
|
+
}, x = new WeakMap(), H = new WeakMap(), G = new WeakMap(), W = new WeakMap(), E.stack = new ne();
|
|
223
|
+
let j = E;
|
|
224
|
+
Y && !customElements.get("e-popover") && customElements.define("e-popover", j);
|
|
225
|
+
var n, p, k, Q, z, q, B, U, X;
|
|
226
|
+
class ce extends HTMLElement {
|
|
220
227
|
constructor() {
|
|
221
228
|
super();
|
|
222
229
|
i(this, k);
|
|
223
230
|
i(this, n);
|
|
224
|
-
i(this,
|
|
225
|
-
i(this, W, () => {
|
|
226
|
-
this.classList.add("triggered");
|
|
227
|
-
});
|
|
228
|
-
i(this, G, () => {
|
|
229
|
-
this.classList.add("opened"), this.setAttribute("aria-expanded", "true");
|
|
230
|
-
});
|
|
231
|
+
i(this, p, new b(this, "--type", "open"));
|
|
231
232
|
i(this, z, () => {
|
|
232
|
-
this.classList.
|
|
233
|
+
e(this, p).current !== "close" && this.classList.add("triggered");
|
|
233
234
|
});
|
|
234
235
|
i(this, q, () => {
|
|
235
|
-
this.classList.
|
|
236
|
+
e(this, p).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
237
|
+
});
|
|
238
|
+
i(this, B, () => {
|
|
239
|
+
e(this, p).current !== "close" && this.classList.remove("opened");
|
|
236
240
|
});
|
|
237
|
-
|
|
241
|
+
i(this, U, () => {
|
|
242
|
+
e(this, p).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
|
|
243
|
+
});
|
|
244
|
+
Y && (this.addEventListener("click", () => {
|
|
238
245
|
if (e(this, n)) {
|
|
239
|
-
const t = e(this,
|
|
246
|
+
const t = e(this, p).current;
|
|
240
247
|
t === "open" || t === "toggle" && !e(this, n).opened ? e(this, n).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, n).opened) && e(this, n).close();
|
|
241
248
|
}
|
|
242
249
|
}), this.addEventListener("keydown", (t) => {
|
|
@@ -244,14 +251,14 @@ class he extends HTMLElement {
|
|
|
244
251
|
}));
|
|
245
252
|
}
|
|
246
253
|
get type() {
|
|
247
|
-
return e(this,
|
|
254
|
+
return e(this, p);
|
|
248
255
|
}
|
|
249
256
|
get popoverElement() {
|
|
250
257
|
return e(this, n);
|
|
251
258
|
}
|
|
252
259
|
changePopover(t) {
|
|
253
260
|
var s;
|
|
254
|
-
if (
|
|
261
|
+
if (v(this, k, Q).call(this), t) {
|
|
255
262
|
let o = null;
|
|
256
263
|
if (t === "parent") {
|
|
257
264
|
const a = this.closest("[data-popover]");
|
|
@@ -264,53 +271,53 @@ class he extends HTMLElement {
|
|
|
264
271
|
} else t === "sibling" ? o = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]") : (!t.startsWith(".") && !t.startsWith("[") && (t = `#${t}`), o = document.querySelector(t) || this.getRootNode().querySelector(t));
|
|
265
272
|
o instanceof HTMLElement ? (h(this, n, o), e(this, n).addEventListener(
|
|
266
273
|
"popoverTriggered",
|
|
267
|
-
e(this,
|
|
274
|
+
e(this, z)
|
|
268
275
|
), e(this, n).addEventListener(
|
|
269
276
|
"popoverOpened",
|
|
270
|
-
e(this,
|
|
277
|
+
e(this, q)
|
|
271
278
|
), e(this, n).addEventListener(
|
|
272
279
|
"popoverClosing",
|
|
273
|
-
e(this,
|
|
280
|
+
e(this, B)
|
|
274
281
|
), e(this, n).addEventListener(
|
|
275
282
|
"popoverClosed",
|
|
276
|
-
e(this,
|
|
283
|
+
e(this, U)
|
|
277
284
|
)) : console.warn(this, `target ${t} not found`);
|
|
278
285
|
}
|
|
279
|
-
|
|
286
|
+
v(this, k, X).call(this, e(this, p).current);
|
|
280
287
|
}
|
|
281
288
|
connectedCallback() {
|
|
282
|
-
e(this,
|
|
283
|
-
|
|
289
|
+
e(this, p).subscribe((s) => {
|
|
290
|
+
v(this, k, X).call(this, s.current);
|
|
284
291
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
285
292
|
const t = this.getAttribute("target");
|
|
286
|
-
t && this.changePopover(t), this.isConnected && e(this,
|
|
293
|
+
t && this.changePopover(t), this.isConnected && e(this, p).observe();
|
|
287
294
|
}
|
|
288
295
|
disconnectedCallback() {
|
|
289
|
-
e(this,
|
|
296
|
+
e(this, p).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), v(this, k, Q).call(this);
|
|
290
297
|
}
|
|
291
298
|
}
|
|
292
|
-
n = new WeakMap(),
|
|
299
|
+
n = new WeakMap(), p = new WeakMap(), k = new WeakSet(), Q = function() {
|
|
293
300
|
e(this, n) && (e(this, n).removeEventListener(
|
|
294
301
|
"popoverTriggered",
|
|
295
|
-
e(this,
|
|
302
|
+
e(this, z)
|
|
296
303
|
), e(this, n).removeEventListener(
|
|
297
304
|
"popoverOpened",
|
|
298
|
-
e(this,
|
|
305
|
+
e(this, q)
|
|
299
306
|
), e(this, n).removeEventListener(
|
|
300
307
|
"popoverClosing",
|
|
301
|
-
e(this,
|
|
308
|
+
e(this, B)
|
|
302
309
|
), e(this, n).removeEventListener(
|
|
303
310
|
"popoverClosed",
|
|
304
|
-
e(this,
|
|
311
|
+
e(this, U)
|
|
305
312
|
));
|
|
306
|
-
},
|
|
307
|
-
e(this, n) instanceof
|
|
313
|
+
}, z = new WeakMap(), q = new WeakMap(), B = new WeakMap(), U = new WeakMap(), X = function(t) {
|
|
314
|
+
e(this, n) instanceof j && (t !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
308
315
|
"aria-expanded",
|
|
309
316
|
e(this, n).opened ? "true" : "false"
|
|
310
317
|
), this.setAttribute("aria-controls", e(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
311
318
|
};
|
|
312
|
-
|
|
319
|
+
Y && !customElements.get("e-popover-button") && customElements.define("e-popover-button", ce);
|
|
313
320
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
321
|
+
ce as PopoverButtonElement,
|
|
322
|
+
j as PopoverElement
|
|
316
323
|
};
|
package/lib/radio/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=i=>{throw TypeError(i)};var v=(i,a,t)=>a.has(i)||f("Cannot "+t);var e=(i,a,t)=>(v(i,a,"read from private field"),t?t.call(i):a.get(i)),r=(i,a,t)=>a.has(i)?f("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(i):a.set(i,t),d=(i,a,t,s)=>(v(i,a,"write to private field"),s?s.call(i,t):a.set(i,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("../events-KVanG9sR.cjs");require("../index-Cqw2NKev.cjs");var E,n,h,o,c,m,l,b;class g extends HTMLElement{constructor(){super(...arguments);r(this,E,[]);r(this,n,[]);r(this,h);r(this,o,null);r(this,c,!1);r(this,m,()=>{this.isConnected&&(document.documentElement.addEventListener("radioChange",e(this,b)),e(this,n).forEach(t=>{t.addEventListener("click",e(this,l)),t.hasAttribute("data-checked")&&this.setValue(t.getAttribute("data-value"))}))});r(this,l,t=>{if(!e(this,c)){const u=t.currentTarget.getAttribute("data-value");u&&this.setValue(u)}});r(this,b,t=>{const s=t.target;s!==this&&s.name===this.name&&this.setValue(t.detail)})}get value(){return e(this,h)}get name(){return this.getAttribute("name")}get currentButtonElement(){return e(this,o)}get disabled(){return e(this,c)}disable(){d(this,c,!0)}enable(){d(this,c,!1)}addButton(t){e(this,n).push(t),t.addEventListener("click",e(this,l))}removeButton(t){const s=e(this,n).find(u=>u===t);s&&(s.removeEventListener("click",e(this,l)),d(this,n,e(this,n).filter(u=>u!==t)))}setValue(t){t&&t!==e(this,h)&&(d(this,h,t),e(this,n).forEach(s=>{s.getAttribute("data-value")===e(this,h)?(s.setAttribute("data-checked",""),d(this,o,s)):s.removeAttribute("data-checked")}),e(this,o)&&e(this,E).forEach(s=>{s.innerHTML=e(this,o).getAttribute("data-name")||t}),L.dispatchEvent(this,"radioChange",{detail:e(this,h),bubbles:!0}))}connectedCallback(){d(this,E,[...this.querySelectorAll("[data-radio-listener]")]),d(this,n,[...this.querySelectorAll("[data-radio-button]")]),document.readyState==="complete"?e(this,m).call(this):addEventListener("load",e(this,m))}disconnectedCallback(){e(this,n).forEach(t=>{t.removeEventListener("click",e(this,l))}),removeEventListener("load",e(this,m)),document.documentElement.removeEventListener("radioChange",e(this,b))}}E=new WeakMap,n=new WeakMap,h=new WeakMap,o=new WeakMap,c=new WeakMap,m=new WeakMap,l=new WeakMap,b=new WeakMap;customElements.get("e-radio")||customElements.define("e-radio",g);exports.RadioElement=g;
|
package/lib/radio/index.js
CHANGED
|
@@ -1,86 +1,91 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (i, a, t) => (
|
|
6
|
-
import { d as
|
|
4
|
+
var v = (i, a, t) => a.has(i) || b("Cannot " + t);
|
|
5
|
+
var e = (i, a, t) => (v(i, a, "read from private field"), t ? t.call(i) : a.get(i)), r = (i, a, t) => a.has(i) ? b("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, t), d = (i, a, t, s) => (v(i, a, "write to private field"), s ? s.call(i, t) : a.set(i, t), t);
|
|
6
|
+
import { d as g } from "../events-CsVF98U6.js";
|
|
7
7
|
import "../index-euf5anj6.js";
|
|
8
|
-
var
|
|
9
|
-
class
|
|
8
|
+
var E, n, h, o, c, m, l, f;
|
|
9
|
+
class L extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
+
r(this, E, []);
|
|
12
13
|
r(this, n, []);
|
|
13
|
-
r(this,
|
|
14
|
-
r(this,
|
|
15
|
-
r(this,
|
|
16
|
-
r(this,
|
|
14
|
+
r(this, h);
|
|
15
|
+
r(this, o, null);
|
|
16
|
+
r(this, c, !1);
|
|
17
|
+
r(this, m, () => {
|
|
17
18
|
this.isConnected && (document.documentElement.addEventListener(
|
|
18
19
|
"radioChange",
|
|
19
|
-
e(this,
|
|
20
|
+
e(this, f)
|
|
20
21
|
), e(this, n).forEach((t) => {
|
|
21
|
-
t.addEventListener("click", e(this,
|
|
22
|
+
t.addEventListener("click", e(this, l)), t.hasAttribute("data-checked") && this.setValue(t.getAttribute("data-value"));
|
|
22
23
|
}));
|
|
23
24
|
});
|
|
24
|
-
r(this,
|
|
25
|
-
if (!e(this,
|
|
25
|
+
r(this, l, (t) => {
|
|
26
|
+
if (!e(this, c)) {
|
|
26
27
|
const u = t.currentTarget.getAttribute("data-value");
|
|
27
28
|
u && this.setValue(u);
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
r(this,
|
|
31
|
+
r(this, f, (t) => {
|
|
31
32
|
const s = t.target;
|
|
32
33
|
s !== this && s.name === this.name && this.setValue(t.detail);
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
get value() {
|
|
36
|
-
return e(this,
|
|
37
|
+
return e(this, h);
|
|
37
38
|
}
|
|
38
39
|
get name() {
|
|
39
40
|
return this.getAttribute("name");
|
|
40
41
|
}
|
|
41
42
|
get currentButtonElement() {
|
|
42
|
-
return e(this,
|
|
43
|
+
return e(this, o);
|
|
43
44
|
}
|
|
44
45
|
get disabled() {
|
|
45
|
-
return e(this,
|
|
46
|
+
return e(this, c);
|
|
46
47
|
}
|
|
47
48
|
disable() {
|
|
48
|
-
|
|
49
|
+
d(this, c, !0);
|
|
49
50
|
}
|
|
50
51
|
enable() {
|
|
51
|
-
|
|
52
|
+
d(this, c, !1);
|
|
52
53
|
}
|
|
53
54
|
addButton(t) {
|
|
54
|
-
e(this, n).push(t), t.addEventListener("click", e(this,
|
|
55
|
+
e(this, n).push(t), t.addEventListener("click", e(this, l));
|
|
55
56
|
}
|
|
56
57
|
removeButton(t) {
|
|
57
58
|
const s = e(this, n).find((u) => u === t);
|
|
58
|
-
s && (s.removeEventListener("click", e(this,
|
|
59
|
+
s && (s.removeEventListener("click", e(this, l)), d(this, n, e(this, n).filter((u) => u !== t)));
|
|
59
60
|
}
|
|
60
61
|
setValue(t) {
|
|
61
|
-
t && t !== e(this,
|
|
62
|
-
s.getAttribute("data-value") === e(this,
|
|
63
|
-
}),
|
|
64
|
-
|
|
62
|
+
t && t !== e(this, h) && (d(this, h, t), e(this, n).forEach((s) => {
|
|
63
|
+
s.getAttribute("data-value") === e(this, h) ? (s.setAttribute("data-checked", ""), d(this, o, s)) : s.removeAttribute("data-checked");
|
|
64
|
+
}), e(this, o) && e(this, E).forEach((s) => {
|
|
65
|
+
s.innerHTML = e(this, o).getAttribute("data-name") || t;
|
|
66
|
+
}), g(this, "radioChange", {
|
|
67
|
+
detail: e(this, h),
|
|
65
68
|
bubbles: !0
|
|
66
69
|
}));
|
|
67
70
|
}
|
|
68
71
|
connectedCallback() {
|
|
69
|
-
|
|
72
|
+
d(this, E, [
|
|
73
|
+
...this.querySelectorAll("[data-radio-listener]")
|
|
74
|
+
]), d(this, n, [
|
|
70
75
|
...this.querySelectorAll("[data-radio-button]")
|
|
71
|
-
]), document.readyState === "complete" ? e(this,
|
|
76
|
+
]), document.readyState === "complete" ? e(this, m).call(this) : addEventListener("load", e(this, m));
|
|
72
77
|
}
|
|
73
78
|
disconnectedCallback() {
|
|
74
79
|
e(this, n).forEach((t) => {
|
|
75
|
-
t.removeEventListener("click", e(this,
|
|
76
|
-
}), removeEventListener("load", e(this,
|
|
80
|
+
t.removeEventListener("click", e(this, l));
|
|
81
|
+
}), removeEventListener("load", e(this, m)), document.documentElement.removeEventListener(
|
|
77
82
|
"radioChange",
|
|
78
|
-
e(this,
|
|
83
|
+
e(this, f)
|
|
79
84
|
);
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
|
|
83
|
-
customElements.get("e-radio") || customElements.define("e-radio",
|
|
87
|
+
E = new WeakMap(), n = new WeakMap(), h = new WeakMap(), o = new WeakMap(), c = new WeakMap(), m = new WeakMap(), l = new WeakMap(), f = new WeakMap();
|
|
88
|
+
customElements.get("e-radio") || customElements.define("e-radio", L);
|
|
84
89
|
export {
|
|
85
|
-
|
|
90
|
+
L as RadioElement
|
|
86
91
|
};
|