aptechka 0.54.7 → 0.55.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 +41 -41
- 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,
|
|
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,v,D,F;class oe{constructor(){i(this,a,new Map);i(this,v,[]);i(this,D,r=>{var s;const t=[...e(this,v)].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,v)].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,v)}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,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,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,v=new WeakMap,D=new WeakMap,F=new WeakMap;var d,$,T,f,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,d);i(this,$);i(this,T);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,u);i(this,x);i(this,M);i(this,H);i(this,O);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,u,new se.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!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,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,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)&&I.updateSearchParameter(this.id,t)}open(t){if(e(this,d))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,f).current&&e(this,L)&&history.pushState(history.state,"",e(this,S,_)),n(this,d,!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,d)&&(clearTimeout(e(this,T)),E.stack.remove(e(this,g).current,this),n(this,d,!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,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=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,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,T)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,S,j).call(this)}};d=new WeakMap,$=new WeakMap,T=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,u=new WeakMap,S=new WeakSet,_=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},j=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,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,p,w,K,z,W,B,G,Q;class ee extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,p,new b.CSSProperty(this,"--type","open"));i(this,z,()=>{e(this,p).current!=="close"&&this.classList.add("triggered")});i(this,W,()=>{e(this,p).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});i(this,B,()=>{e(this,p).current!=="close"&&this.classList.remove("opened")});i(this,G,()=>{e(this,p).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});X.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,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,p).current)}connectedCallback(){e(this,p).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,p).observe()}disconnectedCallback(){e(this,p).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),m(this,w,K).call(this)}}h=new WeakMap,p=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;
|
package/lib/popover/index.js
CHANGED
|
@@ -11,14 +11,14 @@ import { d as te } from "../function-C10DGppn.js";
|
|
|
11
11
|
import { g as se } from "../style-j2TwriJ_.js";
|
|
12
12
|
import { u as ie, p as re } from "../url-B6BNcw6_.js";
|
|
13
13
|
import { windowResizer as I } from "../window-resizer/index.js";
|
|
14
|
-
var l,
|
|
14
|
+
var l, v, j, F;
|
|
15
15
|
class oe {
|
|
16
16
|
constructor() {
|
|
17
17
|
i(this, l, /* @__PURE__ */ new Map());
|
|
18
|
-
i(this,
|
|
18
|
+
i(this, v, []);
|
|
19
19
|
i(this, j, (r) => {
|
|
20
20
|
var s;
|
|
21
|
-
const t = [...e(this,
|
|
21
|
+
const t = [...e(this, v)].reverse().find((o) => o.clickOutside.current);
|
|
22
22
|
if (t) {
|
|
23
23
|
const o = r.composedPath();
|
|
24
24
|
if (o.find(
|
|
@@ -31,7 +31,7 @@ class oe {
|
|
|
31
31
|
});
|
|
32
32
|
i(this, F, (r) => {
|
|
33
33
|
if (r.code === "Escape") {
|
|
34
|
-
const t = [...e(this,
|
|
34
|
+
const t = [...e(this, v)].reverse().find((s) => s.escape.current);
|
|
35
35
|
t && t.close();
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -41,7 +41,7 @@ class oe {
|
|
|
41
41
|
return e(this, l);
|
|
42
42
|
}
|
|
43
43
|
get stack() {
|
|
44
|
-
return e(this,
|
|
44
|
+
return e(this, v);
|
|
45
45
|
}
|
|
46
46
|
add(r, t) {
|
|
47
47
|
if (t.closeRest.current)
|
|
@@ -57,10 +57,10 @@ class oe {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
let s = e(this, l).get(r);
|
|
60
|
-
s != null && s.length || (s = [], e(this, l).set(r, s)), e(this,
|
|
60
|
+
s != null && s.length || (s = [], e(this, l).set(r, s)), e(this, v).push(t), s.push(t);
|
|
61
61
|
}
|
|
62
62
|
remove(r, t) {
|
|
63
|
-
if (h(this,
|
|
63
|
+
if (h(this, v, e(this, v).filter((s) => s !== t)), t.closeRest.current) {
|
|
64
64
|
let s = [];
|
|
65
65
|
e(this, l).forEach((o) => {
|
|
66
66
|
o.forEach((a) => s.push(a));
|
|
@@ -76,20 +76,20 @@ class oe {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
l = new WeakMap(),
|
|
80
|
-
var
|
|
79
|
+
l = new WeakMap(), v = new WeakMap(), j = new WeakMap(), F = new WeakMap();
|
|
80
|
+
var d, V, w, f, L, A, P, g, S, R, y, C, u, T, N, U, x, M, H, O;
|
|
81
81
|
const E = class E extends HTMLElement {
|
|
82
82
|
constructor() {
|
|
83
83
|
super();
|
|
84
84
|
i(this, T);
|
|
85
|
-
i(this,
|
|
85
|
+
i(this, d);
|
|
86
86
|
i(this, V);
|
|
87
87
|
i(this, w);
|
|
88
|
-
i(this,
|
|
88
|
+
i(this, f);
|
|
89
89
|
i(this, L);
|
|
90
90
|
i(this, A);
|
|
91
91
|
i(this, P);
|
|
92
|
-
i(this,
|
|
92
|
+
i(this, g);
|
|
93
93
|
i(this, S);
|
|
94
94
|
i(this, R);
|
|
95
95
|
i(this, y);
|
|
@@ -99,23 +99,23 @@ const E = class E extends HTMLElement {
|
|
|
99
99
|
i(this, M);
|
|
100
100
|
i(this, H);
|
|
101
101
|
i(this, O);
|
|
102
|
-
this.urlValue = "", h(this,
|
|
102
|
+
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
103
|
this,
|
|
104
104
|
"--close-rest-in-group",
|
|
105
105
|
!1
|
|
106
|
-
)), h(this,
|
|
106
|
+
)), h(this, g, new b(this, "--group", "")), h(this, S, new b(this, "--click-outside", !1)), h(this, R, new b(this, "--escape", !1)), h(this, y, !1), h(this, u, new ee(this, {
|
|
107
107
|
opened: !1,
|
|
108
108
|
closing: !1,
|
|
109
109
|
triggered: !1
|
|
110
110
|
})), h(this, x, () => {
|
|
111
|
-
h(this, y, !1), e(this,
|
|
111
|
+
h(this, y, !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, y, !0);
|
|
112
112
|
}), h(this, M, () => {
|
|
113
113
|
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, H).call(this);
|
|
114
114
|
}), h(this, H, te(() => {
|
|
115
115
|
e(this, O).call(this);
|
|
116
116
|
}, 10)), h(this, O, () => {
|
|
117
117
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
118
|
-
}), e(this,
|
|
118
|
+
}), e(this, g).subscribe((t) => {
|
|
119
119
|
t.previous && (E.stack.remove(t.previous, this), t.current || (document.documentElement.classList.remove(
|
|
120
120
|
`${this.group.previous}-closing`
|
|
121
121
|
), document.documentElement.classList.remove(
|
|
@@ -136,7 +136,7 @@ const E = class E extends HTMLElement {
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
get history() {
|
|
139
|
-
return e(this,
|
|
139
|
+
return e(this, f);
|
|
140
140
|
}
|
|
141
141
|
get restore() {
|
|
142
142
|
return e(this, L);
|
|
@@ -148,7 +148,7 @@ const E = class E extends HTMLElement {
|
|
|
148
148
|
return e(this, P);
|
|
149
149
|
}
|
|
150
150
|
get group() {
|
|
151
|
-
return e(this,
|
|
151
|
+
return e(this, g);
|
|
152
152
|
}
|
|
153
153
|
get clickOutside() {
|
|
154
154
|
return e(this, S);
|
|
@@ -157,7 +157,7 @@ const E = class E extends HTMLElement {
|
|
|
157
157
|
return e(this, R);
|
|
158
158
|
}
|
|
159
159
|
get opened() {
|
|
160
|
-
return e(this,
|
|
160
|
+
return e(this, d);
|
|
161
161
|
}
|
|
162
162
|
get lastTrigger() {
|
|
163
163
|
return e(this, C);
|
|
@@ -166,19 +166,19 @@ const E = class E extends HTMLElement {
|
|
|
166
166
|
return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
|
|
167
167
|
}
|
|
168
168
|
updateUrlValue(t) {
|
|
169
|
-
this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this,
|
|
169
|
+
this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, d) && ie(this.id, t);
|
|
170
170
|
}
|
|
171
171
|
open(t) {
|
|
172
|
-
if (e(this,
|
|
172
|
+
if (e(this, d))
|
|
173
173
|
return;
|
|
174
174
|
h(this, C, t == null ? void 0 : t.trigger), clearTimeout(e(this, V)), e(this, u).set("closing", !1), e(this, u).set("triggered", !0), B(this, "popoverTriggered", {
|
|
175
175
|
custom: !0,
|
|
176
176
|
detail: {
|
|
177
177
|
trigger: e(this, C)
|
|
178
178
|
}
|
|
179
|
-
}), e(this,
|
|
179
|
+
}), e(this, f).current && e(this, y) && history.pushState(history.state, "", e(this, T, N)), h(this, d, !0);
|
|
180
180
|
const s = () => {
|
|
181
|
-
E.stack.add(e(this,
|
|
181
|
+
E.stack.add(e(this, g).current, this), e(this, O).call(this), e(this, u).set("opened", !0), B(this, "popoverOpened", {
|
|
182
182
|
custom: !0,
|
|
183
183
|
detail: {
|
|
184
184
|
trigger: e(this, C)
|
|
@@ -188,7 +188,7 @@ const E = class E extends HTMLElement {
|
|
|
188
188
|
t != null && t.skipTransition ? s() : h(this, w, setTimeout(s, 10));
|
|
189
189
|
}
|
|
190
190
|
close() {
|
|
191
|
-
e(this,
|
|
191
|
+
e(this, d) && (clearTimeout(e(this, w)), E.stack.remove(e(this, g).current, this), h(this, d, !1), m(this, T, U).call(this), e(this, u).set("opened", !1), e(this, u).set("closing", !0), B(this, "popoverClosing", {
|
|
192
192
|
custom: !0
|
|
193
193
|
}), h(this, V, setTimeout(() => {
|
|
194
194
|
e(this, u).set("triggered", !1), e(this, u).set("closing", !1), B(this, "popoverClosed", {
|
|
@@ -197,46 +197,46 @@ const E = class E extends HTMLElement {
|
|
|
197
197
|
}, se(this) + 10)));
|
|
198
198
|
}
|
|
199
199
|
connectedCallback() {
|
|
200
|
-
e(this,
|
|
200
|
+
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, R).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", e(this, x)), setTimeout(() => {
|
|
201
201
|
e(this, L).current ? (this.urlValue = re(location.search)[this.id], e(this, x).call(this)) : (m(this, T, U).call(this), h(this, y, !0));
|
|
202
202
|
}, 0), I.subscribe(e(this, M));
|
|
203
203
|
}
|
|
204
204
|
disconnectedCallback() {
|
|
205
|
-
E.stack.remove(e(this,
|
|
205
|
+
E.stack.remove(e(this, g).current, this), I.unsubscribe(e(this, M)), e(this, u).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, R).close(), this.removeAttribute("role"), clearTimeout(e(this, V)), clearTimeout(e(this, w)), removeEventListener("popstate", e(this, x)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), m(this, T, U).call(this);
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
|
|
208
|
+
d = new WeakMap(), V = new WeakMap(), w = new WeakMap(), f = new WeakMap(), L = new WeakMap(), A = new WeakMap(), P = new WeakMap(), g = new WeakMap(), S = new WeakMap(), R = new WeakMap(), y = new WeakMap(), C = new WeakMap(), u = new WeakMap(), T = new WeakSet(), N = function() {
|
|
209
209
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
210
210
|
}, U = function() {
|
|
211
|
-
if (e(this,
|
|
211
|
+
if (e(this, f).current) {
|
|
212
212
|
const t = new URL(location.href);
|
|
213
213
|
t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
|
|
214
214
|
}
|
|
215
215
|
}, x = new WeakMap(), M = new WeakMap(), H = new WeakMap(), O = new WeakMap(), E.stack = new oe();
|
|
216
216
|
let D = E;
|
|
217
217
|
X && !customElements.get("e-popover") && customElements.define("e-popover", D);
|
|
218
|
-
var n,
|
|
218
|
+
var n, p, k, K, W, G, z, q, Q;
|
|
219
219
|
class he extends HTMLElement {
|
|
220
220
|
constructor() {
|
|
221
221
|
super();
|
|
222
222
|
i(this, k);
|
|
223
223
|
i(this, n);
|
|
224
|
-
i(this,
|
|
224
|
+
i(this, p, new b(this, "--type", "open"));
|
|
225
225
|
i(this, W, () => {
|
|
226
|
-
this.classList.add("triggered");
|
|
226
|
+
e(this, p).current !== "close" && this.classList.add("triggered");
|
|
227
227
|
});
|
|
228
228
|
i(this, G, () => {
|
|
229
|
-
this.classList.add("opened"), this.setAttribute("aria-expanded", "true");
|
|
229
|
+
e(this, p).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
230
230
|
});
|
|
231
231
|
i(this, z, () => {
|
|
232
|
-
this.classList.remove("opened");
|
|
232
|
+
e(this, p).current !== "close" && this.classList.remove("opened");
|
|
233
233
|
});
|
|
234
234
|
i(this, q, () => {
|
|
235
|
-
this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false");
|
|
235
|
+
e(this, p).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
|
|
236
236
|
});
|
|
237
237
|
X && (this.addEventListener("click", () => {
|
|
238
238
|
if (e(this, n)) {
|
|
239
|
-
const t = e(this,
|
|
239
|
+
const t = e(this, p).current;
|
|
240
240
|
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
241
|
}
|
|
242
242
|
}), this.addEventListener("keydown", (t) => {
|
|
@@ -244,7 +244,7 @@ class he extends HTMLElement {
|
|
|
244
244
|
}));
|
|
245
245
|
}
|
|
246
246
|
get type() {
|
|
247
|
-
return e(this,
|
|
247
|
+
return e(this, p);
|
|
248
248
|
}
|
|
249
249
|
get popoverElement() {
|
|
250
250
|
return e(this, n);
|
|
@@ -276,20 +276,20 @@ class he extends HTMLElement {
|
|
|
276
276
|
e(this, q)
|
|
277
277
|
)) : console.warn(this, `target ${t} not found`);
|
|
278
278
|
}
|
|
279
|
-
m(this, k, Q).call(this, e(this,
|
|
279
|
+
m(this, k, Q).call(this, e(this, p).current);
|
|
280
280
|
}
|
|
281
281
|
connectedCallback() {
|
|
282
|
-
e(this,
|
|
282
|
+
e(this, p).subscribe((s) => {
|
|
283
283
|
m(this, k, Q).call(this, s.current);
|
|
284
284
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
285
285
|
const t = this.getAttribute("target");
|
|
286
|
-
t && this.changePopover(t), this.isConnected && e(this,
|
|
286
|
+
t && this.changePopover(t), this.isConnected && e(this, p).observe();
|
|
287
287
|
}
|
|
288
288
|
disconnectedCallback() {
|
|
289
|
-
e(this,
|
|
289
|
+
e(this, p).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), m(this, k, K).call(this);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
n = new WeakMap(),
|
|
292
|
+
n = new WeakMap(), p = new WeakMap(), k = new WeakSet(), K = function() {
|
|
293
293
|
e(this, n) && (e(this, n).removeEventListener(
|
|
294
294
|
"popoverTriggered",
|
|
295
295
|
e(this, W)
|
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
|
};
|