@vanelsas/baredom 0.2.2-alpha → 0.2.6-alpha
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/CHANGELOG.md +14 -0
- package/README.md +4 -4
- package/dist/base.js +207 -207
- package/dist/x-alert.js +19 -19
- package/dist/x-avatar-group.js +11 -11
- package/dist/x-avatar.js +17 -17
- package/dist/x-badge.js +11 -11
- package/dist/x-breadcrumbs.js +14 -14
- package/dist/x-button.js +15 -15
- package/dist/x-cancel-dialogue.js +16 -18
- package/dist/x-card.js +7 -7
- package/dist/x-chart.js +48 -44
- package/dist/x-checkbox.js +11 -11
- package/dist/x-chip.js +9 -9
- package/dist/x-collapse.js +12 -12
- package/dist/x-command-palette.js +31 -31
- package/dist/x-container.js +6 -6
- package/dist/x-context-menu.js +20 -19
- package/dist/x-copy.js +22 -23
- package/dist/x-currency-field.js +22 -20
- package/dist/x-date-picker.js +42 -36
- package/dist/x-divider.js +9 -9
- package/dist/x-drawer.js +11 -11
- package/dist/x-dropdown.js +9 -9
- package/dist/x-fieldset.js +6 -6
- package/dist/x-file-download.js +7 -7
- package/dist/x-form-field.js +15 -15
- package/dist/x-form.js +10 -10
- package/dist/x-grid.js +7 -7
- package/dist/x-menu-item.js +10 -10
- package/dist/x-menu.js +10 -10
- package/dist/x-modal.js +12 -12
- package/dist/x-navbar.js +12 -12
- package/dist/x-notification-center.js +9 -9
- package/dist/x-pagination.js +16 -16
- package/dist/x-popover.js +11 -11
- package/dist/x-progress-circle.js +9 -9
- package/dist/x-progress.js +9 -9
- package/dist/x-radio.js +11 -11
- package/dist/x-search-field.js +14 -14
- package/dist/x-select.js +9 -9
- package/dist/x-sidebar.js +25 -25
- package/dist/x-skeleton.js +6 -6
- package/dist/x-slider.js +16 -16
- package/dist/x-spacer.js +5 -5
- package/dist/x-spinner.js +5 -5
- package/dist/x-stat.js +9 -9
- package/dist/x-stepper.js +16 -16
- package/dist/x-switch.js +10 -10
- package/dist/x-tab.js +7 -7
- package/dist/x-table-cell.js +23 -23
- package/dist/x-table-row.js +10 -10
- package/dist/x-table.js +14 -14
- package/dist/x-tabs.js +11 -11
- package/dist/x-text-area.js +17 -17
- package/dist/x-timeline-item.js +23 -23
- package/dist/x-timeline.js +9 -9
- package/dist/x-toast.js +23 -23
- package/dist/x-toaster.js +8 -8
- package/package.json +1 -1
package/dist/x-currency-field.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
"")?void 0:b,{minimumFractionDigits:2,maximumFractionDigits:2})).format(c)}catch(d){return a}},
|
|
2
|
+
var ax=function(a){a=(""+$APP.T.g($APP.n(a)?a:"")).trim().toUpperCase();return $APP.C.h(a,"")?"USD":a},bx=function(a,b,c){return $APP.n(c)?a.setAttribute(b,""):a.removeAttribute(b)},cx=function(a,b){try{var c=(new Intl.NumberFormat($APP.C.h(b,"")?"en-US":b,{style:"currency",currency:a})).formatToParts(0),d=$APP.Ad(function(e){return $APP.C.h("currency",e.type)?e.value:null},$APP.gc(c));return $APP.n(d)?d:a}catch(e){return a}},dx=function(a,b){var c=parseFloat(a);if($APP.n(isNaN(c)))return a;try{return(new Intl.NumberFormat($APP.C.h(b,
|
|
3
|
+
"")?void 0:b,{minimumFractionDigits:2,maximumFractionDigits:2})).format(c)}catch(d){return a}},ex=function(a){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("label"),g=document.createElement("div"),h=document.createElement("span"),k=document.createElement("input"),m=document.createElement("span"),q=document.createElement("span");c.textContent=":host{display:block;color-scheme:light dark;--x-currency-field-bg:#ffffff;--x-currency-field-color:#111827;--x-currency-field-border:1px solid #d1d5db;--x-currency-field-border-radius:6px;--x-currency-field-focus-ring-color:#2563eb;--x-currency-field-symbol-color:#6b7280;--x-currency-field-label-color:#374151;--x-currency-field-hint-color:#6b7280;--x-currency-field-error-color:#dc2626;--x-currency-field-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-currency-field-bg:#1f2937;--x-currency-field-color:#f9fafb;--x-currency-field-border:1px solid #4b5563;--x-currency-field-focus-ring-color:#3b82f6;--x-currency-field-symbol-color:#9ca3af;--x-currency-field-label-color:#d1d5db;--x-currency-field-hint-color:#9ca3af;--x-currency-field-error-color:#f87171;}}[part\x3dfield]{display:flex;flex-direction:column;gap:0.25rem;}[part\x3dlabel]{display:block;font-size:0.875rem;font-weight:500;color:var(--x-currency-field-label-color);}.label-hidden{display:none;}[part\x3dinput-wrapper]{display:flex;align-items:center;background:var(--x-currency-field-bg);border:var(--x-currency-field-border);border-radius:var(--x-currency-field-border-radius);transition:border-color 120ms ease,box-shadow 120ms ease;}[part\x3dinput-wrapper]:focus-within{border-color:var(--x-currency-field-focus-ring-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--x-currency-field-focus-ring-color) 20%,transparent);}:host([data-invalid]) [part\x3dinput-wrapper]{border-color:var(--x-currency-field-error-color);}:host([data-invalid]) [part\x3dinput-wrapper]:focus-within{box-shadow:0 0 0 3px color-mix(in srgb,var(--x-currency-field-error-color) 20%,transparent);}[part\x3dsymbol]{flex-shrink:0;padding:0.5rem 0 0.5rem 0.75rem;font-size:1rem;color:var(--x-currency-field-symbol-color);user-select:none;pointer-events:none;}[part\x3dinput]{flex:1;min-width:0;padding:0.5rem 0.75rem;background:transparent;color:var(--x-currency-field-color);border:none;outline:none;font-size:1rem;line-height:1.5;font-family:inherit;}[part\x3dinput]:disabled{opacity:1;cursor:not-allowed;}:host([disabled]) [part\x3dinput-wrapper]{opacity:var(--x-currency-field-disabled-opacity);cursor:not-allowed;}[part\x3dhint]{display:block;font-size:0.8125rem;color:var(--x-currency-field-hint-color);}.hint-hidden{display:none;}[part\x3derror]{display:block;font-size:0.8125rem;color:var(--x-currency-field-error-color);}.error-hidden{display:none;}@media (prefers-reduced-motion:reduce){[part\x3dinput-wrapper]{transition:none;}}";
|
|
4
4
|
d.setAttribute("part","field");e.setAttribute("part","label");e.setAttribute("id","label");e.setAttribute("for","input");g.setAttribute("part","input-wrapper");h.setAttribute("part","symbol");h.setAttribute("aria-hidden","true");k.setAttribute("part","input");k.setAttribute("id","input");k.setAttribute("inputmode","decimal");k.setAttribute("aria-labelledby","label");m.setAttribute("part","hint");m.setAttribute("id","hint");m.setAttribute("aria-live","polite");q.setAttribute("part","error");q.setAttribute("id",
|
|
5
|
-
"error");q.setAttribute("role","alert");q.setAttribute("aria-live","assertive");g.appendChild(h);g.appendChild(k);d.appendChild(e);d.appendChild(g);d.appendChild(m);d.appendChild(q);b.appendChild(c);b.appendChild(d);a.__xCurrencyFieldRefs={field:d,label:e,wrapper:g,symbol:h,input:k,hint:m,error:q}},
|
|
6
|
-
$APP.p(isNaN(a));k=$APP.n(k)?parseFloat(k):null;m=$APP.n(m)?parseFloat(m):null;return $APP.n(e)?b.setValidity({customError:!0},g,c):$APP.n($APP.n(h)?$APP.
|
|
7
|
-
"Value must be at most "+$APP.
|
|
8
|
-
a.hasAttribute("required"),a.getAttribute("max"),a.hasAttribute("readonly"),a.getAttribute("value"),a.getAttribute("locale"),a.getAttribute("placeholder")]);var k=$APP.
|
|
9
|
-
$APP.
|
|
10
|
-
"")
|
|
11
|
-
$APP.
|
|
12
|
-
c.classList.add("label-hidden");g.textContent=$APP.
|
|
13
|
-
$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=a.getAttribute("value");return b.value=$APP.n(c)?c:""}return null}},
|
|
14
|
-
$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=b.value,d=parseFloat(c);c=$APP.n(isNaN(d))?c:""+$APP.
|
|
15
|
-
c);b.addEventListener("input",d);b.addEventListener("change",e);a.__xCurrencyFieldHandlers={focus:c,input:d,change:e}}},
|
|
16
|
-
(
|
|
17
|
-
b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.
|
|
18
|
-
this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
"error");q.setAttribute("role","alert");q.setAttribute("aria-live","assertive");g.appendChild(h);g.appendChild(k);d.appendChild(e);d.appendChild(g);d.appendChild(m);d.appendChild(q);b.appendChild(c);b.appendChild(d);a.__xCurrencyFieldRefs={field:d,label:e,wrapper:g,symbol:h,input:k,hint:m,error:q}},fx=function(a,b,c,d){var e=a.hasAttribute("error");var g=a.getAttribute("error");g=$APP.n(g)?g:"";var h=a.hasAttribute("required"),k=a.getAttribute("min"),m=a.getAttribute("max");a=parseFloat(d);var q=
|
|
6
|
+
$APP.p(isNaN(a));k=$APP.n(k)?parseFloat(k):null;m=$APP.n(m)?parseFloat(m):null;return $APP.n(e)?b.setValidity({customError:!0},g,c):$APP.n($APP.n(h)?$APP.C.h(d,""):h)?b.setValidity({valueMissing:!0},"Please fill in this field.",c):$APP.O(d,"")&&!q?b.setValidity({badInput:!0},"Please enter a valid number.",c):$APP.n(q?$APP.n(k)?$APP.p(isNaN(k))&&a<k:k:q)?b.setValidity({rangeUnderflow:!0},"Value must be at least "+$APP.T.g(k)+".",c):$APP.n(q?$APP.n(m)?$APP.p(isNaN(m))&&a>m:m:q)?b.setValidity({rangeOverflow:!0},
|
|
7
|
+
"Value must be at most "+$APP.T.g(m)+".",c):b.setValidity({},"",c)},kx=function(a){var b=$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){var c=$APP.l(b,"label"),d=$APP.l(b,"symbol"),e=$APP.l(b,"input"),g=$APP.l(b,"hint");b=$APP.l(b,"error");var h=$APP.cf([$APP.ch,gx,$APP.Jh,$APP.sh,$APP.Eh,$APP.Yh,hx,$APP.Cg,$APP.hh,$APP.ti,$APP.Ei,ix,$APP.vh],[a.getAttribute("label"),a.getAttribute("currency"),a.getAttribute("name"),a.getAttribute("error"),a.getAttribute("hint"),a.hasAttribute("disabled"),a.getAttribute("min"),
|
|
8
|
+
a.hasAttribute("required"),a.getAttribute("max"),a.hasAttribute("readonly"),a.getAttribute("value"),a.getAttribute("locale"),a.getAttribute("placeholder")]);var k=$APP.N(h);h=$APP.J(k,$APP.vh);var m=$APP.J(k,$APP.ch),q=$APP.J(k,gx),r=$APP.J(k,$APP.Jh),v=$APP.J(k,$APP.sh),w=$APP.J(k,$APP.Eh),z=$APP.J(k,$APP.Yh),A=$APP.J(k,hx),D=$APP.J(k,$APP.Cg),F=$APP.J(k,$APP.hh),I=$APP.J(k,$APP.ti),E=$APP.J(k,$APP.Ei);k=$APP.J(k,ix);var R=$APP.n(v)?v:"",ha=$APP.n(w)?w:"",wa=$APP.n(m)?m:"";h=$APP.cf([$APP.Ti,$APP.ah,
|
|
9
|
+
$APP.aj,$APP.Bi,$APP.fh,$APP.bj,$APP.gi,$APP.U,$APP.Mh,$APP.jh,$APP.ki,jx,$APP.eh,$APP.W,$APP.ph,$APP.V],[$APP.n(A)?A:"",$APP.K(D),$APP.K(I),$APP.n(h)?h:"",typeof w==="string"&&$APP.O(w,""),$APP.n(k)?k:"",$APP.n(r)?r:"",$APP.n(E)?E:"",typeof m==="string"&&$APP.O(m,""),typeof v==="string"&&$APP.O(v,""),ha,ax(q),$APP.n(F)?F:"",wa,R,$APP.K(z)]);m=$APP.jh.g(h);$APP.n(m)?q=null:(v=$APP.N(h),q=$APP.J(v,$APP.U),r=$APP.J(v,$APP.Ti),v=$APP.J(v,$APP.eh),w=parseFloat(q),z=$APP.O(q,"")&&$APP.p(isNaN(w)),A=$APP.O(r,
|
|
10
|
+
"")?parseFloat(r):null,D=$APP.O(v,"")?parseFloat(v):null,q=$APP.O(q,"")&&!z?"Please enter a valid number.":$APP.n(z?$APP.n(A)?$APP.p(isNaN(A))&&w<A:A:z)?"Value must be at least "+$APP.T.g(r)+".":$APP.n(z?$APP.n(D)?$APP.p(isNaN(D))&&w>D:D:z)?"Value must be at most "+$APP.T.g(v)+".":"");r=q;q=$APP.n(m)?m:$APP.O($APP.n(r)?r:"","");m=$APP.n(m)?$APP.ph.g(h):$APP.n(r)?r:"";r=$APP.fh.g(h);v=$APP.Mh.g(h);z=jx.g(h);w=$APP.bj.g(h);d.textContent=cx(z,w);e.name=$APP.gi.g(h);e.placeholder=$APP.Bi.g(h);e.disabled=
|
|
11
|
+
$APP.V.g(h);e.readOnly=$APP.aj.g(h);e.required=$APP.ah.g(h);d=$APP.n($APP.ah.g(h))?"true":"false";e.setAttribute("aria-required",d);e.setAttribute("aria-invalid",$APP.n(q)?"true":"false");d=$APP.n($APP.n(r)?q:r)?"hint error":$APP.n(r)?"hint":$APP.n(q)?"error":null;$APP.n(d)?e.setAttribute("aria-describedby",d):e.removeAttribute("aria-describedby");$APP.C.h(e,a.shadowRoot.activeElement)||(d=$APP.U.g(h),e.value=$APP.C.h(d,"")?"":dx(d,w));c.textContent=$APP.W.g(h);$APP.n(v)?c.classList.remove("label-hidden"):
|
|
12
|
+
c.classList.add("label-hidden");g.textContent=$APP.ki.g(h);$APP.n(r)?g.classList.remove("hint-hidden"):g.classList.add("hint-hidden");b.textContent=m;$APP.n(q)?b.classList.remove("error-hidden"):b.classList.add("error-hidden");bx(a,"data-invalid",q);c=$APP.l(a,"__xCurrencyFieldInternals");$APP.n(c)?(g=a.getAttribute("value"),a=fx(a,c,e,$APP.n(g)?g:"")):a=null;return a}return null},lx=function(a,b,c){return a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,composed:!0,cancelable:!1}))},mx=function(a){return function(){var b=
|
|
13
|
+
$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=a.getAttribute("value");return b.value=$APP.n(c)?c:""}return null}},nx=function(a){return function(){var b=$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=b.value;var d=a.getAttribute("name");d=$APP.n(d)?d:"";var e=$APP.l(a,"__xCurrencyFieldInternals");$APP.n(e)&&(e.setFormValue(c),fx(a,e,b,c));return lx(a,"x-currency-field-input",{name:d,value:c})}return null}},ox=function(a){return function(){var b=
|
|
14
|
+
$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=b.value,d=parseFloat(c);c=$APP.n(isNaN(d))?c:""+$APP.T.g(d);d=a.getAttribute("name");d=$APP.n(d)?d:"";a.setAttribute("value",c);var e=$APP.l(a,"__xCurrencyFieldInternals");$APP.n(e)&&(e.setFormValue(c),fx(a,e,b,c));return lx(a,"x-currency-field-change",{name:d,value:c})}return null}},px=function(a){var b=$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=mx(a),d=nx(a),e=ox(a);b.addEventListener("focus",
|
|
15
|
+
c);b.addEventListener("input",d);b.addEventListener("change",e);a.__xCurrencyFieldHandlers={focus:c,input:d,change:e}}},qx=function(a){var b=$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){var c=$APP.l(a,"__xCurrencyFieldHandlers");if($APP.n(c)){b=$APP.l(b,"input");b.removeEventListener("focus",$APP.l(c,"focus"));b.removeEventListener("input",$APP.l(c,"input"));b.removeEventListener("change",$APP.l(c,"change"));a.__xCurrencyFieldHandlers=null;return}}return null},rx=function(a){$APP.n($APP.l(a,"__xCurrencyFieldRefs"))||
|
|
16
|
+
(ex(a),$APP.n(a.attachInternals)&&$APP.ma(a,"__xCurrencyFieldInternals",a.attachInternals()));qx(a);var b=$APP.l(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.l(b,"input");var c=a.getAttribute("value");ax(a.getAttribute("currency"));var d=function(){var e=a.getAttribute("locale");return $APP.n(e)?e:""}();$APP.n(c)&&(b.value=dx(c,d))}b=$APP.l(a,"__xCurrencyFieldInternals");$APP.n(b)&&b.setFormValue(function(){var e=a.getAttribute("value");return $APP.n(e)?e:""}());px(a);return kx(a)},sx=function(a,
|
|
17
|
+
b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:""},set:function(d){d!=null&&$APP.O(d)?(d=""+$APP.T.g(d),d=this.setAttribute(c,d)):d=this.removeAttribute(c);return d}})},tx=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return bx(this,c,$APP.K(d))}})},ux=function(a){Object.defineProperty(a,"value",{configurable:!0,enumerable:!0,get:function(){var b=
|
|
18
|
+
this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=b!=null&&$APP.O(b)?""+$APP.T.g(b):"";this.setAttribute("value",b);var c=$APP.l(this,"__xCurrencyFieldRefs");if($APP.n(c)){c=$APP.l(c,"input");ax(this.getAttribute("currency"));var d=this.getAttribute("locale");d=$APP.n(d)?d:"";return $APP.C.h(c,this.shadowRoot.activeElement)?null:c.value=$APP.C.h(b,"")?"":dx(b,d)}return null}})},wx=function(){var a=class extends HTMLElement{},b=a.prototype;a.formAssociated=!0;a.observedAttributes=
|
|
19
|
+
vx;ux(b);sx(b,"name","name");sx(b,"currency","currency");sx(b,"locale","locale");sx(b,"min","min");sx(b,"max","max");sx(b,"placeholder","placeholder");sx(b,"label","label");sx(b,"hint","hint");sx(b,"error","error");tx(b,"disabled","disabled");tx(b,"readOnly","readonly");tx(b,"required","required");b.connectedCallback=function(){return rx(this)};b.disconnectedCallback=function(){return qx(this)};b.attributeChangedCallback=function(c,d,e){$APP.C.h(c,"value")&&(c=$APP.l(this,"__xCurrencyFieldRefs"),
|
|
20
|
+
$APP.n(c)&&(c=$APP.l(c,"input"),$APP.C.h(c,this.shadowRoot.activeElement)||(ax(this.getAttribute("currency")),d=this.getAttribute("locale"),d=$APP.n(d)?d:"",c.value=e==null||$APP.C.h(e,"")?"":dx(e,d))));return kx(this)};b.formDisabledCallback=function(c){bx(this,"disabled",$APP.K(c));return kx(this)};b.formResetCallback=function(){this.removeAttribute("value");var c=$APP.l(this,"__xCurrencyFieldRefs");$APP.n(c)&&($APP.l(c,"input").value="");c=$APP.l(this,"__xCurrencyFieldInternals");$APP.n(c)&&c.setFormValue("");
|
|
21
|
+
return kx(this)};b.checkValidity=function(){var c=$APP.l(this,"__xCurrencyFieldInternals");return $APP.n(c)?c.checkValidity():!0};b.reportValidity=function(){var c=$APP.l(this,"__xCurrencyFieldInternals");return $APP.n(c)?c.reportValidity():!0};return a},xx=function(){return $APP.n(customElements.get("x-currency-field"))?null:customElements.define("x-currency-field",wx())},hx=new $APP.M(null,"min-raw","min-raw",183137548),gx=new $APP.M(null,"currency-raw","currency-raw",1169887491),jx=new $APP.M(null,
|
|
22
|
+
"currency","currency",-898327568),ix=new $APP.M(null,"locale-raw","locale-raw",385401846);var vx="name value currency locale min max placeholder label hint error disabled required readonly".split(" ");
|
|
23
|
+
$APP.cf([$APP.Ti,$APP.Bi,$APP.wi,$APP.bj,$APP.gi,$APP.U,$APP.ki,jx,$APP.zi,$APP.eh,$APP.W,$APP.ph,$APP.Mg],[new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"min"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"placeholder"],null),new $APP.Q(null,2,[$APP.Z,$APP.Ji,$APP.Pg,"disabled"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"locale"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"name"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"value"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"hint"],
|
|
24
|
+
null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"currency"],null),new $APP.Q(null,2,[$APP.Z,$APP.Ji,$APP.Pg,"readonly"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"max"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"label"],null),new $APP.Q(null,2,[$APP.Z,$APP.X,$APP.Pg,"error"],null),new $APP.Q(null,2,[$APP.Z,$APP.Ji,$APP.Pg,"required"],null)]);$APP.ka("baredom.exports.x_currency_field.init",xx);export const init=xx;
|
package/dist/x-date-picker.js
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
a):null},
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"range");b=sC($APP.
|
|
8
|
-
2,[YB,e,$APP.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if($APP.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
r.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"start
|
|
37
|
-
|
|
2
|
+
var NB=function(a){return typeof a==="string"?(a=a.trim(),$APP.O(a,"")?a:null):null},OB=function(a){return a!=null&&$APP.O(a,"false")},PB=function(a){return a<10?"0"+$APP.T.g(a):""+$APP.T.g(a)},QB=function(a){return $APP.n(a)?""+$APP.T.g(a.getUTCFullYear())+"-"+$APP.T.g(PB(a.getUTCMonth()+1))+"-"+$APP.T.g(PB(a.getUTCDate())):null},RB=function(a){var b=(b=typeof a==="string")?$APP.Ef(/\d{4}-\d{2}-\d{2}/,a):b;return $APP.n(b)?(a=new Date(""+$APP.T.g(a)+"T00:00:00.000Z"),$APP.n(isNaN(a.getTime()))?null:
|
|
3
|
+
a):null},SB=function(a,b){if(a==null&&b==null)return 0;if(a==null)return-1;if(b==null)return 1;a=a.getTime();b=b.getTime();return a<b?-1:a>b?1:0},TB=function(a,b){return $APP.n(a)?new Date(a.getTime()+b*864E5):null},UB=function(a){return $APP.n(a)?new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1)):null},VB=function(a,b){if($APP.n(a)){var c=a.getUTCFullYear(),d=a.getUTCDate();a=a.getUTCMonth()+b;b=(new Date(Date.UTC(c,a+1,0))).getUTCDate();return new Date(Date.UTC(c,a,$APP.lg.h(d,b)))}return null},
|
|
4
|
+
WB=function(a,b,c){a=$APP.n($APP.n(b)?$APP.n(a)?SB(a,b)<0:a:b)?b:a;return $APP.n($APP.n(c)?$APP.n(a)?SB(a,c)>0:a:c)?c:a},XB=function(a,b,c){if($APP.n($APP.n(a)?$APP.n(b)?c:b:a)){var d=SB(b,c)<0?c:b;return!(SB(a,SB(b,c)<0?b:c)<0)&&!(SB(a,d)>0)}return null},$B=function(a,b){var c=$APP.N(b);b=$APP.J(c,YB);c=$APP.J(c,$APP.bj);return $APP.n(a)?$APP.C.h(b,ZB)?(new Intl.DateTimeFormat($APP.n(c)?c:"default",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"})).format(a):QB(a):null},cC=function(a){a=
|
|
5
|
+
NB(a);a=$APP.n(a)?RB(a):null;return new $APP.Q(null,2,[aC,a!=null,bC,a],null)},sC=function(a){var b=$APP.N(a),c=$APP.J(b,$APP.th),d=$APP.J(b,$APP.oh),e=$APP.J(b,$APP.Ti);a=$APP.J(b,YB);var g=$APP.J(b,$APP.bj),h=$APP.J(b,dC),k=$APP.J(b,$APP.U),m=$APP.J(b,$APP.di),q=$APP.J(b,$APP.xi),r=$APP.J(b,$APP.eh),v=$APP.J(b,eC);b=$APP.C.h(m,"range")?fC:gC;a=$APP.C.h(a,"localized")?ZB:hC;g=NB(g);m=function(){var A=NB(d);return $APP.n(A)?A:" - "}();e=RB(e);r=RB(r);v=$APP.K(v);h=$APP.K(h);if($APP.C.h(b,gC))return b=
|
|
6
|
+
RB(k),$APP.cf([YB,iC,$APP.bj,jC,$APP.di,kC,eC,lC,$APP.oh,mC,nC],[a,b,g,h,gC,r,v,b!=null,m,e,function(){var A=NB(k);return $APP.n(A)?A:""}()]);var w=RB(q),z=RB(c);b=w!=null&&z!=null;return $APP.cf([oC,YB,pC,$APP.bj,jC,$APP.di,kC,qC,rC,eC,lC,$APP.oh,mC],[function(){var A=NB(c);return $APP.n(A)?A:""}(),a,w,g,h,fC,r,function(){var A=NB(q);return $APP.n(A)?A:""}(),z,v,b,m,e])},uC=function(a){if($APP.n(a)){var b=UB(a),c=TB(b,-($APP.n(b)?b.getUTCDay():0));return $APP.Md(function(d){d=TB(c,d);var e=$APP.C.h(d.getUTCMonth(),
|
|
7
|
+
a.getUTCMonth());return new $APP.Q(null,2,[bC,d,tC,e],null)},$APP.Cf(0,42))}return null},vC=function(a){return document.createElement(a)},wC=function(a,b,c,d){b=new CustomEvent(b,{detail:d,bubbles:!0,composed:!0,cancelable:$APP.K(c)});a.dispatchEvent(b);return b},xC=function(a){var b=a.getAttribute("mode");$APP.C.h(b,"range");b=sC($APP.cf([$APP.Ti,YB,$APP.bj,dC,$APP.U,$APP.di,$APP.xi,$APP.eh,eC,$APP.th,$APP.oh],[a.getAttribute("min"),a.getAttribute("format"),a.getAttribute("locale"),OB(a.getAttribute("range-allow-same-day")),
|
|
8
|
+
a.getAttribute("value"),b,a.getAttribute("start"),a.getAttribute("max"),OB(a.getAttribute("auto-swap")),a.getAttribute("end"),a.getAttribute("separator")]));var c=new $APP.Q(null,2,[YB,YB.g(b),$APP.bj,$APP.bj.g(b)],null);var d=$APP.N(c);var e=$APP.J(d,YB);d=$APP.J(d,$APP.bj);e=new $APP.Q(null,2,[YB,e,$APP.bj,d],null);if($APP.C.h($APP.di.g(b),gC))e=$APP.n(iC.g(b))?$B(iC.g(b),e):"";else{d=$APP.oh.g(b);var g=pC.g(b);g=$APP.n(g)?rC.g(b):g;e=$APP.n(g)?""+$APP.T.g($B(pC.g(b),e))+$APP.T.g(d)+$APP.T.g($B(rC.g(b),
|
|
9
|
+
e)):$APP.n(pC.g(b))?$B(pC.g(b),e):""}d=$APP.l(a,"__xDatePickerState");d=$APP.n(d)?$APP.l(d,"month"):null;g=iC.g(b);$APP.n(g)||(g=pC.g(b),g=$APP.n(g)?g:new Date(Date.now()));d=$APP.n(d)?d:UB(g);a.__xDatePickerState={canon:b,cfg:c,disp:e,month:d}},yC=function(a,b){var c=mC.g(b);c=$APP.n(c)?SB(a,mC.g(b))<0:c;if($APP.n(c))return c;c=kC.g(b);return $APP.n(c)?SB(a,kC.g(b))>0:c},BC=function(a,b){if($APP.C.h($APP.di.g(b),gC))return new $APP.Q(null,3,[$APP.Ih,function(){var k=iC.g(b);return $APP.n(k)?$APP.C.h(0,
|
|
10
|
+
SB(a,iC.g(b))):k}(),zC,!1,AC,!1],null);var c=pC.g(b),d=rC.g(b),e=function(){var k=$APP.n(c)?$APP.C.h(0,SB(a,c)):c;return $APP.n(k)?k:$APP.n(d)?$APP.C.h(0,SB(a,d)):d}(),g=$APP.n(c)?$APP.n(d)?XB(a,c,d):d:c,h=function(){var k=$APP.n(c)?$APP.C.h(0,SB(a,c)):c;return $APP.n(k)?k:$APP.n(d)?$APP.C.h(0,SB(a,d)):d}();return new $APP.Q(null,3,[$APP.Ih,e,zC,g,AC,h],null)},CC=function(a,b){a.__xDatePickerGridFocus=b;a=$APP.l(a,"__xDatePickerRefs");a=$APP.n(a)?$APP.l(a,"grid"):null;if($APP.n(a)){var c=a.querySelector('[tabindex\x3d"0"]');
|
|
11
|
+
$APP.n(c)&&c.setAttribute("tabindex","-1");b=a.querySelector('[data-iso\x3d"'+$APP.T.g(b)+'"]');if($APP.n(b))return b.setAttribute("tabindex","0"),b.focus()}return null},DC=function(a){var b=$APP.l(a,"__xDatePickerRefs");if($APP.n(b)){var c=$APP.l(b,"month-label"),d=$APP.l(b,"grid"),e=$APP.l(b,"weekdays"),g=$APP.l(a,"__xDatePickerState");b=$APP.n(g)?$APP.l(g,"canon"):null;var h=$APP.n(g)?$APP.l(g,"month"):null;g=$APP.n(g)?$APP.l(g,"cfg"):null;g=$APP.n(g)?$APP.bj.g(g):null;$APP.n(c)&&(h=(new Intl.DateTimeFormat($APP.n(g)?
|
|
12
|
+
g:"default",{year:"numeric",month:"long",timeZone:"UTC"})).format(h),c.textContent=h);if(!$APP.n($APP.l(a,"__xDatePickerWeekdaysDone")))for(a.__xDatePickerWeekdaysDone=!0,c="Su Mo Tu We Th Fr Sa".split(" "),h=0;;)if(h<7)g=vC("div"),g.setAttribute("part","weekday"),g.setAttribute("aria-hidden","true"),g.textContent=c[h],e.appendChild(g),h+=1;else break;if($APP.n($APP.n(d)?b:d)){d.textContent="";e=$APP.l(a,"__xDatePickerState");e=uC($APP.n(e)?$APP.l(e,"month"):null);c=$APP.u(e);h=null;for(var k=g=0;;)if(k<
|
|
13
|
+
g){e=h.F(null,k);e=$APP.N(e);var m=$APP.J(e,bC);e=$APP.J(e,tC);var q=vC("button"),r=QB(m),v=m.getUTCDate(),w=yC(m,b);m=BC(m,b);var z=$APP.N(m);m=$APP.J(z,$APP.Ih);var A=$APP.J(z,zC);z=$APP.J(z,AC);q.setAttribute("part","day");q.setAttribute("type","button");q.setAttribute("role","gridcell");q.setAttribute("data-iso",r);q.setAttribute("data-outside",$APP.n(e)?"false":"true");q.setAttribute("data-disabled",$APP.n(w)?"true":"false");q.setAttribute("data-selected",$APP.n(m)?"true":"false");q.setAttribute("data-in-range",
|
|
14
|
+
$APP.n(A)?"true":"false");q.setAttribute("data-range-edge",$APP.n(z)?"true":"false");q.setAttribute("aria-selected",$APP.n(m)?"true":"false");q.setAttribute("aria-disabled",$APP.n(w)?"true":"false");q.setAttribute("tabindex","-1");q.textContent=""+$APP.T.g(v);d.appendChild(q);k+=1}else if(e=$APP.u(c))c=e,$APP.yc(c)?(h=$APP.ob(c),c=$APP.pb(c),e=h,g=$APP.B(h),h=e):(e=$APP.x(c),e=$APP.N(e),m=$APP.J(e,bC),e=$APP.J(e,tC),h=vC("button"),g=QB(m),k=m.getUTCDate(),q=yC(m,b),m=BC(m,b),v=$APP.N(m),m=$APP.J(v,
|
|
15
|
+
$APP.Ih),r=$APP.J(v,zC),v=$APP.J(v,AC),h.setAttribute("part","day"),h.setAttribute("type","button"),h.setAttribute("role","gridcell"),h.setAttribute("data-iso",g),h.setAttribute("data-outside",$APP.n(e)?"false":"true"),h.setAttribute("data-disabled",$APP.n(q)?"true":"false"),h.setAttribute("data-selected",$APP.n(m)?"true":"false"),h.setAttribute("data-in-range",$APP.n(r)?"true":"false"),h.setAttribute("data-range-edge",$APP.n(v)?"true":"false"),h.setAttribute("aria-selected",$APP.n(m)?"true":"false"),
|
|
16
|
+
h.setAttribute("aria-disabled",$APP.n(q)?"true":"false"),h.setAttribute("tabindex","-1"),h.textContent=""+$APP.T.g(k),d.appendChild(h),c=$APP.y(c),h=null,g=0),k=0;else break;d=$APP.l(a,"__xDatePickerGridFocus");a=$APP.l(a,"__xDatePickerRefs");a=$APP.n(a)?$APP.l(a,"grid"):null;$APP.n($APP.n(a)?d:a)?(a=a.querySelector('[data-iso\x3d"'+$APP.T.g(d)+'"]'),a=$APP.n(a)?a.setAttribute("tabindex","0"):null):a=null;return a}}return null},EC=function(a){var b=$APP.l(a,"__xDatePickerRefs");b=$APP.n(b)?$APP.l(b,
|
|
17
|
+
"input"):null;var c=$APP.l(a,"__xDatePickerState");c=$APP.n(c)?$APP.l(c,"disp"):null;a=$APP.l(a,"__xDatePickerFocused");return $APP.n($APP.n(b)?$APP.p(a):b)?b.value=$APP.n(c)?c:"":null},FC=function(a){var b=$APP.l(a,"__xDatePickerRefs");if($APP.n(b)){var c=$APP.l(b,"input");b=$APP.l(b,"btn");var d=a.hasAttribute("disabled"),e=a.hasAttribute("readonly"),g=a.getAttribute("placeholder"),h=a.getAttribute("aria-label"),k=a.getAttribute("aria-describedby"),m=a.hasAttribute("open");$APP.n(b)&&($APP.n(d)?
|
|
18
|
+
b.setAttribute("disabled",""):b.removeAttribute("disabled"));$APP.n($APP.n(d)?m:d)&&a.removeAttribute("open");$APP.n(c)&&(c.setAttribute("aria-expanded",$APP.n(m)?"true":"false"),$APP.n(d)?(c.setAttribute("disabled",""),c.setAttribute("aria-disabled","true")):(c.removeAttribute("disabled"),c.removeAttribute("aria-disabled")),$APP.n(e)&&c.setAttribute("readonly",""),$APP.n(e)||c.removeAttribute("readonly"),$APP.n(g)&&c.setAttribute("placeholder",g),$APP.n(h)&&c.setAttribute("aria-label",h),$APP.n(k)&&
|
|
19
|
+
c.setAttribute("aria-describedby",k));EC(a);return DC(a)}return null},GC=function(a,b){$APP.n(b)?a.setAttribute("value",QB(b)):a.removeAttribute("value")},HC=function(a,b,c){if($APP.n(a.hasAttribute("readonly")))return null;var d=$APP.l(a,"__xDatePickerState");d=$APP.n(d)?$APP.l(d,"canon"):null;var e=$APP.n(d)?$APP.di.g(d):null,g=$APP.C.h(e,fC)?"range":"single",h=$APP.C.h(e,gC)?{value:QB(b),mode:g,reason:c}:{date:QB(b),mode:g,reason:c};h=wC(a,"x-date-picker-change-request",!0,h);if($APP.n(h.defaultPrevented))return null;
|
|
20
|
+
if($APP.C.h(e,gC))return d=QB(b),GC(a,b),xC(a),FC(a),wC(a,"x-date-picker-change",!1,{value:d,mode:g,reason:c}),$APP.n(a.hasAttribute("close-on-select"))?(a.removeAttribute("open"),FC(a)):null;e=function(){var z=$APP.l(a,"__xDatePickerRangeStep");return $APP.n(z)?z:0}();h=pC.g(d);rC.g(d);if($APP.C.h(e,0))a.setAttribute("start",QB(b)),a.removeAttribute("end"),a.__xDatePickerRangeStep=1;else if($APP.C.h(e,1)){var k=jC.g(d),m=SB(b,h);if($APP.n(function(){var z=m>0;return z?z:$APP.n(k)?m===0:k}())){var q=
|
|
21
|
+
$APP.n(eC.g(d))?SB(h,b)<0?h:b:h,r=$APP.n(eC.g(d))?SB(h,b)>0?h:b:b;a.setAttribute("start",QB(q));a.setAttribute("end",QB(r));a.__xDatePickerRangeStep=0;$APP.n(function(){var z=a.hasAttribute("close-on-select");return $APP.n(z)?q!=null&&r!=null:z}())&&a.removeAttribute("open")}else a.setAttribute("start",QB(b)),a.removeAttribute("end"),a.__xDatePickerRangeStep=1}else a.setAttribute("start",QB(b)),a.removeAttribute("end"),a.__xDatePickerRangeStep=1;xC(a);FC(a);b=$APP.l(a,"__xDatePickerState");b=$APP.n(b)?
|
|
22
|
+
$APP.l(b,"canon"):null;var v=$APP.n(pC.g(b))?QB(pC.g(b)):null,w=$APP.n(rC.g(b))?QB(rC.g(b)):null;b=function(){var z={mode:g,reason:c};$APP.n(v)&&(z.start=v);$APP.n(w)&&(z.end=w);return z}();return wC(a,"x-date-picker-change",!1,b)},IC=function(a,b){var c=$APP.l(a,"__xDatePickerRefs");c=$APP.n(c)?$APP.l(c,"input"):null;var d=$APP.n(c)?c.value:null;c=$APP.l(a,"__xDatePickerState");var e=$APP.n(c)?$APP.l(c,"canon"):null,g=$APP.di.g(e);c=$APP.C.h(g,fC)?"range":"single";wC(a,"x-date-picker-input",!1,{value:d,
|
|
23
|
+
mode:c});if($APP.C.h(g,gC)){if(d=cC(d),e=$APP.N(d),d=$APP.J(e,aC),e=$APP.J(e,bC),$APP.n(d)){g=QB(e);d=wC(a,"x-date-picker-change-request",!0,{value:g,mode:c,reason:b});if($APP.n(d.defaultPrevented))return null;GC(a,e);xC(a);FC(a);return wC(a,"x-date-picker-change",!1,{value:g,mode:c,reason:b})}}else if(e=new $APP.Q(null,1,[$APP.oh,$APP.oh.g(e)],null),e=$APP.N(e),e=$APP.J(e,$APP.oh),e=typeof e==="string"&&e.length>0?e:" - ",d=NB(d),d==null?d=new $APP.Q(null,3,[aC,!1,$APP.xi,null,$APP.th,null],null):
|
|
24
|
+
(g=d.indexOf(e),g<0?(d=cC(d),e=$APP.N(d),d=$APP.J(e,aC),e=$APP.J(e,bC),d=new $APP.Q(null,3,[aC,d,$APP.xi,e,$APP.th,null],null)):(e=d.substring(g+e.length).trim(),d=RB(d.substring(0,g).trim()),e=RB(e),d=new $APP.Q(null,3,[aC,d!=null&&e!=null,$APP.xi,d,$APP.th,e],null))),g=$APP.N(d),d=$APP.J(g,aC),e=$APP.J(g,$APP.xi),g=$APP.J(g,$APP.th),$APP.n(d)){e=QB(e);g=QB(g);d=wC(a,"x-date-picker-change-request",!0,{start:e,end:g,mode:c,reason:b});if($APP.n(d.defaultPrevented))return null;a.setAttribute("start",
|
|
25
|
+
e);a.setAttribute("end",g);a.__xDatePickerRangeStep=0;xC(a);FC(a);return wC(a,"x-date-picker-change",!1,{start:e,end:g,mode:c,reason:b})}return null},KC=function(a,b){var c=$APP.l(a,"__xDatePickerState"),d=$APP.n(c)?$APP.l(c,"month"):null;if($APP.n(d)){var e=d.getUTCFullYear();d=d.getUTCMonth();b=$APP.C.h(b,JC)?new Date(Date.UTC(e,d+1,1)):new Date(Date.UTC(e,d-1,1));c.month=b;return DC(a)}return null},LC=function(a){return $APP.n(a.hasAttribute("open"))?a.removeAttribute("open"):null},NC=function(a,
|
|
26
|
+
b){if($APP.n(a.hasAttribute("disabled")))return null;b=b.currentTarget.getAttribute("data-nav");return $APP.C.h(b,"prev")?KC(a,MC):KC(a,JC)},OC=function(a,b){if($APP.n(a.hasAttribute("disabled")))return null;var c=b.key,d=$APP.l(a,"__xDatePickerGridFocus"),e=$APP.n(d)?RB(d):null;d=$APP.l(a,"__xDatePickerState");var g=$APP.n(d)?$APP.l(d,"canon"):null,h=$APP.n(d)?$APP.l(d,"month"):null,k=$APP.n(e)?function(){switch(c){case "ArrowLeft":return TB(e,-1);case "ArrowRight":return TB(e,1);case "ArrowUp":return TB(e,
|
|
27
|
+
-7);case "ArrowDown":return TB(e,7);case "PageUp":return VB(e,-1);case "PageDown":return VB(e,1);case "Home":return $APP.n(e)?TB(e,-($APP.n(e)?e.getUTCDay():0)):null;case "End":return $APP.n(e)?TB(e,6-($APP.n(e)?e.getUTCDay():0)):null;default:return null}}():null;return k!=null?(b.preventDefault(),b=WB(k,mC.g(g),kC.g(g)),g=QB(b),$APP.n($APP.n(h)?$APP.O(b.getUTCMonth(),h.getUTCMonth()):h)&&($APP.ma(d,"month",UB(b)),DC(a)),CC(a,g)):$APP.n(function(){var m=$APP.C.h(c,"Enter")||$APP.C.h(c," ");return m?
|
|
28
|
+
$APP.n(e)?$APP.p(a.hasAttribute("readonly")):e:m}())?(b.preventDefault(),$APP.n(yC(e,g))?null:HC(a,e,"keyboard")):$APP.C.h(c,"Escape")?(b.preventDefault(),LC(a),d=$APP.l(a,"__xDatePickerRefs"),d=$APP.n(d)?$APP.l(d,"input"):null,$APP.n(d)?d.focus():null):null},PC=function(a){function b(E){return $APP.n(a.hasAttribute("open"))?$APP.n(E.composedPath().some(function(R){return R===a}))?null:LC(a):null}function c(E){return E.preventDefault()}function d(E){return OC(a,E)}function e(E){var R=a.hasAttribute("disabled");
|
|
29
|
+
$APP.n($APP.n(R)?R:a.hasAttribute("readonly"))?E=null:(E=E.target.closest("button[data-iso]"),$APP.n($APP.n(E)?$APP.O("true",E.getAttribute("data-disabled")):E)?(E=E.getAttribute("data-iso"),E=RB(E),E=$APP.n(E)?HC(a,E,"click"):null):E=null);return E}function g(E){return NC(a,E)}function h(E){return NC(a,E)}function k(){if($APP.n(a.hasAttribute("disabled")))var E=null;else if($APP.n(a.hasAttribute("open")))E=LC(a);else if($APP.n(a.hasAttribute("open")))E=null;else{a.setAttribute("open","");E=$APP.l(a,
|
|
30
|
+
"__xDatePickerState");E=$APP.n(E)?$APP.l(E,"canon"):null;var R=iC.g(E);$APP.n(R)?E=R:(E=pC.g(E),E=$APP.n(E)?E:new Date(Date.now()));E=QB(E);E=CC(a,E)}return E}function m(){a.__xDatePickerFocused=!1;$APP.n(a.hasAttribute("disabled"))||IC(a,"blur");return EC(a)}function q(){a.__xDatePickerFocused=!0}function r(E){if($APP.n(a.hasAttribute("disabled")))E=null;else{var R=E.key;$APP.C.h(R,"Enter")?(E.preventDefault(),E=IC(a,"keyboard")):E=$APP.C.h(R,"Escape")?LC(a):null}return E}function v(){var E=$APP.l(a,
|
|
31
|
+
"__xDatePickerRefs");E=$APP.n(E)?$APP.l(E,"input"):null;var R=$APP.l(a,"__xDatePickerState");R=$APP.C.h($APP.di.g($APP.n(R)?$APP.l(R,"canon"):null),fC)?"range":"single";a.__xDatePickerDisplay=$APP.n(E)?E.value:null;return wC(a,"x-date-picker-input",!1,{value:$APP.n(E)?E.value:null,mode:R})}var w=$APP.l(a,"__xDatePickerRefs"),z=$APP.l(w,"input"),A=$APP.l(w,"btn"),D=$APP.l(w,"nav-prev"),F=$APP.l(w,"nav-next"),I=$APP.l(w,"grid");w=$APP.l(w,"popover");z.addEventListener("input",v);z.addEventListener("keydown",
|
|
32
|
+
r);z.addEventListener("focus",q);z.addEventListener("blur",m);A.addEventListener("click",k);D.addEventListener("click",h);F.addEventListener("click",g);I.addEventListener("click",e);I.addEventListener("keydown",d);w.addEventListener("mousedown",c);document.addEventListener("pointerdown",b,!0);$APP.ma(a,"__xDatePickerHandlers",{"pop-md":c,keydown:r,grid:e,"grid-kd":d,next:g,blur:m,prev:h,focus:q,input:v,btn:k,"doc-click":b})},QC=function(a){var b=$APP.l(a,"__xDatePickerRefs");a=$APP.l(a,"__xDatePickerHandlers");
|
|
33
|
+
if($APP.n($APP.n(b)?a:b)){var c=$APP.l(b,"input"),d=$APP.l(b,"btn"),e=$APP.l(b,"nav-prev"),g=$APP.l(b,"nav-next"),h=$APP.l(b,"grid");b=$APP.l(b,"popover");c.removeEventListener("input",$APP.l(a,"input"));c.removeEventListener("keydown",$APP.l(a,"keydown"));c.removeEventListener("focus",$APP.l(a,"focus"));c.removeEventListener("blur",$APP.l(a,"blur"));d.removeEventListener("click",$APP.l(a,"btn"));e.removeEventListener("click",$APP.l(a,"prev"));g.removeEventListener("click",$APP.l(a,"next"));h.removeEventListener("click",
|
|
34
|
+
$APP.l(a,"grid"));h.removeEventListener("keydown",$APP.l(a,"grid-kd"));b.removeEventListener("mousedown",$APP.l(a,"pop-md"));return document.removeEventListener("pointerdown",$APP.l(a,"doc-click"),!0)}return null},RC=function(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,get:function(){var d=this.getAttribute(c);return $APP.n(d)?d:null},set:function(d){return typeof d==="string"&&$APP.O(d,"")?this.setAttribute(c,d):this.removeAttribute(c)}})},SC=function(a,b,c){Object.defineProperty(a,
|
|
35
|
+
b,{configurable:!0,enumerable:!0,get:function(){return this.hasAttribute(c)},set:function(d){return $APP.n(d)?this.setAttribute(c,""):this.removeAttribute(c)}})},TC=function(a){a.focus=function(){var b=$APP.l(this,"__xDatePickerRefs");b=$APP.n(b)?$APP.l(b,"input"):null;return $APP.n(b)?b.focus():null};a.commit=function(){return IC(this,"programmatic")};a.clear=function(){var b=$APP.l(this,"__xDatePickerState");$APP.C.h($APP.di.g($APP.n(b)?$APP.l(b,"canon"):null),gC)?this.removeAttribute("value"):
|
|
36
|
+
(this.removeAttribute("start"),this.removeAttribute("end"));xC(this);return FC(this)}},VC=function(){var a=class extends HTMLElement{},b=a.prototype;a.observedAttributes=UC;b.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xDatePickerRefs"))){var c=this.attachShadow({mode:"open"}),d=vC("style"),e=vC("div"),g=vC("input"),h=vC("button"),k=vC("div"),m=vC("div"),q=vC("button"),r=vC("div"),v=vC("button"),w=vC("div"),z=vC("div"),A=vC("div");d.textContent=":host{display:block;color-scheme:light dark;}[part\x3dcontainer]{position:relative;display:flex;align-items:stretch;gap:8px;width:100%;}[part\x3dinput]{flex:1;min-width:0;appearance:none;box-sizing:border-box;border:1px solid var(--x-date-picker-border,#cbd5e1);border-radius:var(--x-date-picker-radius,8px);padding:8px 12px;font-size:0.9375rem;background:var(--x-date-picker-input-bg,#fff);color:var(--x-date-picker-text,inherit);outline:none;}[part\x3dinput]:focus{border-color:var(--x-date-picker-focus,#60a5fa);box-shadow:0 0 0 3px rgba(96,165,250,0.25);}[part\x3dinput][disabled]{opacity:0.5;cursor:default;}[part\x3dbtn][disabled]{opacity:0.5;cursor:default;pointer-events:none;}[part\x3dinput]::placeholder{color:var(--x-date-picker-placeholder,#94a3b8);}[part\x3dbtn]{all:unset;cursor:pointer;flex:0 0 auto;width:42px;height:42px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--x-date-picker-border,#cbd5e1);border-radius:var(--x-date-picker-radius,8px);background:var(--x-date-picker-btn-bg,#f8fafc);color:var(--x-date-picker-text,inherit);box-sizing:border-box;}[part\x3dbtn]:hover{background:var(--x-date-picker-btn-hover,#f1f5f9);}[part\x3dbtn]:focus-visible{outline:2px solid var(--x-date-picker-focus,#60a5fa);}[part\x3dpopover]{display:none;position:absolute;z-index:1000;top:calc(100% + 8px);left:0;background:var(--x-date-picker-popover-bg,#fff);border:1px solid var(--x-date-picker-border,#e2e8f0);border-radius:var(--x-date-picker-popover-radius,12px);box-shadow:0 8px 32px rgba(0,0,0,0.12),0 2px 8px rgba(0,0,0,0.06);padding:16px;width:var(--x-date-picker-popover-width,304px);box-sizing:border-box;}:host([open]) [part\x3dpopover]{display:block;}[part\x3dnav]{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;}[part\x3dnavbtn]{all:unset;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:6px;color:var(--x-date-picker-text,inherit);}[part\x3dnavbtn]:hover{background:var(--x-date-picker-nav-hover,#f1f5f9);}[part\x3dnavbtn]:focus-visible{outline:2px solid var(--x-date-picker-focus,#60a5fa);}[part\x3dmonthlabel]{font-weight:600;font-size:0.9375rem;}[part\x3dweekdays]{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-bottom:4px;}[part\x3dweekday]{text-align:center;font-size:0.75rem;font-weight:600;color:var(--x-date-picker-weekday,#94a3b8);padding:4px 0;}[part\x3dgrid]{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;}[part\x3dday]{all:unset;cursor:pointer;box-sizing:border-box;display:flex;align-items:center;justify-content:center;height:36px;border-radius:6px;font-size:0.875rem;color:var(--x-date-picker-day-text,inherit);}[part\x3dday]:hover:not([disabled]){background:var(--x-date-picker-day-hover,#f1f5f9);}[part\x3dday]:focus-visible{outline:2px solid var(--x-date-picker-focus,#60a5fa);}[part\x3dday][data-outside\x3dtrue]{opacity:0.4;}[part\x3dday][data-disabled\x3dtrue]{opacity:0.3;cursor:default;pointer-events:none;}[part\x3dday][data-selected\x3dtrue]{background:var(--x-date-picker-selected-bg,#2563eb);color:var(--x-date-picker-selected-text,#fff);font-weight:600;}[part\x3dday][data-in-range\x3dtrue]:not([data-range-edge\x3dtrue]){background:var(--x-date-picker-range-bg,#dbeafe);color:var(--x-date-picker-range-text,#1e40af);border-radius:0;}[part\x3dday][data-range-edge\x3dtrue]{background:var(--x-date-picker-selected-bg,#2563eb);color:var(--x-date-picker-selected-text,#fff);font-weight:600;}[part\x3dsr-status]{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;}@media (prefers-color-scheme:dark){:host{--x-date-picker-border:#334155;--x-date-picker-input-bg:#0f172a;--x-date-picker-btn-bg:#1e293b;--x-date-picker-btn-hover:#334155;--x-date-picker-popover-bg:#1e293b;--x-date-picker-day-hover:#334155;--x-date-picker-selected-bg:#3b82f6;--x-date-picker-range-bg:#1e3a8a;--x-date-picker-range-text:#93c5fd;--x-date-picker-nav-hover:#334155;}}@media (prefers-reduced-motion:reduce){[part\x3dpopover]{transition:none;}}";
|
|
37
|
+
e.setAttribute("part","container");g.setAttribute("part","input");g.setAttribute("type","text");g.setAttribute("inputmode","none");g.setAttribute("autocomplete","off");g.setAttribute("role","combobox");g.setAttribute("aria-haspopup","dialog");g.setAttribute("aria-expanded","false");h.setAttribute("part","btn");h.setAttribute("type","button");h.setAttribute("aria-label","Open calendar");h.textContent="\ud83d\udcc5";k.setAttribute("part","popover");k.setAttribute("role","dialog");k.setAttribute("aria-modal",
|
|
38
|
+
"true");k.setAttribute("aria-label","Calendar");m.setAttribute("part","nav");q.setAttribute("part","navbtn");q.setAttribute("data-nav","prev");q.setAttribute("type","button");q.setAttribute("aria-label","Previous month");q.textContent="‹";r.setAttribute("part","monthlabel");r.setAttribute("aria-live","polite");v.setAttribute("part","navbtn");v.setAttribute("data-nav","next");v.setAttribute("type","button");v.setAttribute("aria-label","Next month");v.textContent="›";w.setAttribute("part","weekdays");
|
|
39
|
+
w.setAttribute("aria-hidden","true");z.setAttribute("part","grid");z.setAttribute("role","grid");z.setAttribute("aria-label","Calendar grid");A.setAttribute("part","sr-status");A.setAttribute("aria-live","polite");A.setAttribute("aria-atomic","true");m.appendChild(q);m.appendChild(r);m.appendChild(v);k.appendChild(m);k.appendChild(w);k.appendChild(z);k.appendChild(A);e.appendChild(g);e.appendChild(h);e.appendChild(k);c.appendChild(d);c.appendChild(e);this.__xDatePickerRefs={weekdays:w,grid:z,popover:k,
|
|
40
|
+
"nav-next":v,"month-label":r,input:g,btn:h,sr:A,"nav-prev":q}}QC(this);PC(this);xC(this);return FC(this)};b.disconnectedCallback=function(){return QC(this)};b.attributeChangedCallback=function(){xC(this);return FC(this)};RC(b,"mode","mode");RC(b,"value","value");RC(b,"start","start");RC(b,"end","end");SC(b,"open","open");SC(b,"disabled","disabled");SC(b,"readOnly","readonly");SC(b,"required","required");TC(b);return a},WC=function(){return $APP.n(customElements.get("x-date-picker"))?null:customElements.define("x-date-picker",
|
|
41
|
+
VC())},pC=new $APP.M(null,"start-d","start-d",-1546785820),aC=new $APP.M(null,"ok?","ok?",447310304),bC=new $APP.M(null,"date","date",-1463434462),eC=new $APP.M(null,"auto-swap?","auto-swap?",-1675454411),oC=new $APP.M(null,"end-str","end-str",-558112319),ZB=new $APP.M(null,"localized","localized",1722109655),AC=new $APP.M(null,"edge?","edge?",203916303),nC=new $APP.M(null,"value-str","value-str",989198845),lC=new $APP.M(null,"complete?","complete?",-892991879),kC=new $APP.M(null,"max-d","max-d",
|
|
42
|
+
-814680979),gC=new $APP.M(null,"single","single",1551466437),qC=new $APP.M(null,"start-str","start-str",1077409677),fC=new $APP.M(null,"range","range",1639692286),hC=new $APP.M(null,"iso","iso",-1366207543),tC=new $APP.M(null,"in-month?","in-month?",-1630426251),mC=new $APP.M(null,"min-d","min-d",-1118792932),YB=new $APP.M(null,"format","format",-1306924766),iC=new $APP.M(null,"value-d","value-d",-1768534876),zC=new $APP.M(null,"in-range?","in-range?",-291779262),MC=new $APP.M(null,"prev","prev",
|
|
43
|
+
-1597069226),JC=new $APP.M(null,"next","next",-117701485),rC=new $APP.M(null,"end-d","end-d",-1316370898),jC=new $APP.M(null,"allow-same-day?","allow-same-day?",-1971558934),dC=new $APP.M(null,"range-allow-same-day?","range-allow-same-day?",-714516856);var UC="mode value start end min max format locale separator auto-swap range-allow-same-day close-on-select placeholder disabled readonly required name autocomplete aria-label aria-describedby open".split(" ");$APP.ka("baredom.exports.x_date_picker.init",WC);export const init=WC;
|
package/dist/x-divider.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
a.getAttribute("role")]),c=$APP.
|
|
4
|
-
$APP.
|
|
5
|
-
2,["none",null,"presentation",null],null),null),g)?a.setAttribute("role","presentation"):a.setAttribute("role","separator");$APP.
|
|
2
|
+
var eB=function(a,b,c){c=typeof c==="string"?c.trim().toLowerCase():null;return $APP.Cc(a,c)?c:b},fB=function(a){for(;;){var b=a.firstChild;if($APP.n(b))a.removeChild(b);else break}},rB=function(a){var b=$APP.cf([$APP.Dh,$APP.ch,$APP.Ch,gB,hB,iB,jB,$APP.ji,$APP.Ci,kB],[a.getAttribute("variant"),a.getAttribute("label"),a.getAttribute("align"),a.getAttribute("length"),a.getAttribute("thickness"),a.getAttribute("color"),a.getAttribute("inset"),a.getAttribute("orientation"),a.getAttribute("aria-label"),
|
|
3
|
+
a.getAttribute("role")]),c=$APP.N(b);b=$APP.J(c,$APP.Ci);var d=$APP.J(c,kB),e=$APP.J(c,$APP.ch);var g=$APP.J(c,$APP.Dh);var h=$APP.J(c,$APP.Ch),k=$APP.J(c,gB),m=$APP.J(c,hB),q=$APP.J(c,iB),r=$APP.J(c,jB);c=$APP.J(c,$APP.ji);g=$APP.cf([$APP.Xg,$APP.ci,lB,mB,$APP.vi,$APP.Vg,$APP.zh,$APP.W,nB,$APP.$h],[d,eB(oB,"center",h),m,r,q,eB(pB,"solid",g),eB(qB,"horizontal",c),e,k,b]);c=$APP.N(g);d=$APP.J(c,$APP.$h);h=$APP.J(c,$APP.ci);k=$APP.J(c,lB);m=$APP.J(c,mB);q=$APP.J(c,$APP.vi);r=$APP.J(c,$APP.Vg);e=$APP.J(c,
|
|
4
|
+
$APP.zh);b=$APP.J(c,$APP.W);var v=$APP.J(c,nB);c=typeof b==="string"&&b.trim().length>0;var w=a.style;a.setAttribute("data-orientation",e);a.setAttribute("data-variant",r);a.setAttribute("data-align",h);w.setProperty("--x-divider-thickness",$APP.n(k)?k:"1px");w.setProperty("--x-divider-inset",$APP.n(m)?m:"0px");w.setProperty("--x-divider-length",$APP.n(v)?v:"auto");$APP.n(q)?w.setProperty("--x-divider-color",q):w.removeProperty("--x-divider-color");g=$APP.Xg.g(g);$APP.Cc(new $APP.S(null,new $APP.Q(null,
|
|
5
|
+
2,["none",null,"presentation",null],null),null),g)?a.setAttribute("role","presentation"):a.setAttribute("role","separator");$APP.C.h(e,"vertical")?a.setAttribute("aria-orientation","vertical"):a.removeAttribute("aria-orientation");$APP.n($APP.n(d)?d.length>0:d)?a.setAttribute("aria-label",d):a.removeAttribute("aria-label");c?(d=$APP.l(a,"__xDividerRefs"),$APP.C.h($APP.l(d,"mode"),"no-label")&&(e=$APP.l(d,"container"),fB(e),g=document.createElement("div"),h=document.createElement("span"),k=document.createElement("slot"),
|
|
6
6
|
m=document.createElement("span"),q=document.createElement("div"),g.setAttribute("part","line-left"),h.setAttribute("part","label"),k.setAttribute("name","label"),m.setAttribute("part","label-text"),q.setAttribute("part","line-right"),h.appendChild(k),h.appendChild(m),e.appendChild(g),e.appendChild(h),e.appendChild(q),d["line-left"]=g,d["label-wrap"]=h,d["label-text"]=m,d["line-right"]=q,d.mode="label"),a=$APP.l($APP.l(a,"__xDividerRefs"),"label-text"),$APP.n(a)&&(a.textContent=b)):(a=$APP.l(a,"__xDividerRefs"),
|
|
7
|
-
$APP.
|
|
8
|
-
b,{get:function(){var d=this.getAttribute(b);return $APP.n(d)?d:c},set:function(d){return d!=null?this.setAttribute(b,""+$APP.
|
|
9
|
-
var a=Object.create(HTMLElement.prototype),b=
|
|
10
|
-
e.setAttribute("part","container");var g=document.createElement("div");g.setAttribute("part","line");e.appendChild(g);c.appendChild(d);c.appendChild(e);this.__xDividerRefs={root:c,container:e,mode:"no-label"}}return
|
|
11
|
-
|
|
7
|
+
$APP.C.h($APP.l(a,"mode"),"label")&&(b=$APP.l(a,"container"),fB(b),d=document.createElement("div"),d.setAttribute("part","line"),b.appendChild(d),a["line-left"]=null,a["label-wrap"]=null,a["label-text"]=null,a["line-right"]=null,a.mode="no-label"));return null},sB=function(a,b){Object.defineProperty(a,b,{get:function(){return this.getAttribute(b)},set:function(c){return c!=null?this.setAttribute(b,""+$APP.T.g(c)):this.removeAttribute(b)},enumerable:!0,configurable:!0})},tB=function(a,b,c){Object.defineProperty(a,
|
|
8
|
+
b,{get:function(){var d=this.getAttribute(b);return $APP.n(d)?d:c},set:function(d){return d!=null?this.setAttribute(b,""+$APP.T.g(d)):this.removeAttribute(b)},enumerable:!0,configurable:!0})},uB=function(a){tB(a,"orientation","horizontal");tB(a,"variant","solid");tB(a,"align","center");sB(a,"label");sB(a,"thickness");sB(a,"color");sB(a,"inset");sB(a,"length")},vB=function(){function a(){return Reflect.construct(HTMLElement,[],$APP.Ra(b))}var b=new $APP.Dd;$APP.Ed(b,a);return a},xB=function(){if($APP.n(customElements.get("x-divider")))return null;
|
|
9
|
+
var a=Object.create(HTMLElement.prototype),b=vB();Object.setPrototypeOf(b,HTMLElement);a.constructor=b;uB(a);a.connectedCallback=function(){if(!$APP.n($APP.l(this,"__xDividerRefs"))){var c=this.attachShadow({mode:"open"}),d=document.createElement("style"),e=document.createElement("div");d.textContent=":host{display:block;color-scheme:light dark;--x-divider-color:rgba(0,0,0,0.12);--x-divider-thickness:1px;--x-divider-inset:0px;--x-divider-length:auto;}@media (prefers-color-scheme:dark){:host{--x-divider-color:rgba(255,255,255,0.15);}}[part\x3dcontainer]{display:flex;align-items:center;width:var(--x-divider-length,auto);box-sizing:border-box;}:host([data-orientation\x3d'vertical']) [part\x3dcontainer]{flex-direction:column;height:var(--x-divider-length,auto);width:auto;}[part\x3dline],[part\x3dline-left],[part\x3dline-right]{flex:1;border:none;background:var(--x-divider-color,rgba(0,0,0,0.12));height:var(--x-divider-thickness,1px);margin:var(--x-divider-inset,0px) 0;}:host([data-orientation\x3d'vertical']) [part\x3dline],:host([data-orientation\x3d'vertical']) [part\x3dline-left],:host([data-orientation\x3d'vertical']) [part\x3dline-right]{width:var(--x-divider-thickness,1px);height:auto;margin:0 var(--x-divider-inset,0px);}:host([data-variant\x3d'dashed']) [part\x3dline],:host([data-variant\x3d'dashed']) [part\x3dline-left],:host([data-variant\x3d'dashed']) [part\x3dline-right]{background:none;height:0;border-top:var(--x-divider-thickness,1px) dashed var(--x-divider-color,rgba(0,0,0,0.12));}:host([data-orientation\x3d'vertical'][data-variant\x3d'dashed']) [part\x3dline],:host([data-orientation\x3d'vertical'][data-variant\x3d'dashed']) [part\x3dline-left],:host([data-orientation\x3d'vertical'][data-variant\x3d'dashed']) [part\x3dline-right]{border-top:none;border-left:var(--x-divider-thickness,1px) dashed var(--x-divider-color,rgba(0,0,0,0.12));width:0;height:auto;}:host([data-variant\x3d'dotted']) [part\x3dline],:host([data-variant\x3d'dotted']) [part\x3dline-left],:host([data-variant\x3d'dotted']) [part\x3dline-right]{background:none;height:0;border-top:var(--x-divider-thickness,1px) dotted var(--x-divider-color,rgba(0,0,0,0.12));}:host([data-orientation\x3d'vertical'][data-variant\x3d'dotted']) [part\x3dline],:host([data-orientation\x3d'vertical'][data-variant\x3d'dotted']) [part\x3dline-left],:host([data-orientation\x3d'vertical'][data-variant\x3d'dotted']) [part\x3dline-right]{border-top:none;border-left:var(--x-divider-thickness,1px) dotted var(--x-divider-color,rgba(0,0,0,0.12));width:0;height:auto;}[part\x3dlabel]{display:flex;align-items:center;flex-shrink:0;padding:0 0.75em;font-size:0.75rem;font-weight:500;color:var(--x-divider-color);white-space:nowrap;}:host([data-orientation\x3d'vertical']) [part\x3dlabel]{padding:0.75em 0;writing-mode:horizontal-tb;}[part\x3dlabel-text]{display:inline;}:host([data-align\x3d'start']) [part\x3dline-left]{flex:0 0 1rem;}:host([data-align\x3d'end']) [part\x3dline-right]{flex:0 0 1rem;}@media (prefers-reduced-motion:reduce){*{transition:none !important;animation:none !important;}}";
|
|
10
|
+
e.setAttribute("part","container");var g=document.createElement("div");g.setAttribute("part","line");e.appendChild(g);c.appendChild(d);c.appendChild(e);this.__xDividerRefs={root:c,container:e,mode:"no-label"}}return rB(this)};a.disconnectedCallback=function(){return null};a.attributeChangedCallback=function(c,d,e){return $APP.O(d,e)?$APP.n($APP.l(this,"__xDividerRefs"))?rB(this):null:null};b.observedAttributes=wB;b.prototype=a;return customElements.define("x-divider",b)},yB=function(){return xB()},
|
|
11
|
+
gB=new $APP.M(null,"length-raw","length-raw",-1832244116),jB=new $APP.M(null,"inset-raw","inset-raw",89351124),mB=new $APP.M(null,"inset","inset",-396367740),lB=new $APP.M(null,"thickness","thickness",-940175454),hB=new $APP.M(null,"thickness-raw","thickness-raw",1843812655),kB=new $APP.M(null,"role-raw","role-raw",777951354),nB=new $APP.M(null,"length","length",588987862),iB=new $APP.M(null,"color-raw","color-raw",1277647215);var wB="orientation variant thickness color inset length label align role aria-label".split(" "),qB=new $APP.S(null,new $APP.Q(null,2,["vertical",null,"horizontal",null],null),null),pB=new $APP.S(null,new $APP.Q(null,3,["dashed",null,"dotted",null,"solid",null],null),null),oB=new $APP.S(null,new $APP.Q(null,3,["center",null,"start",null,"end",null],null),null);$APP.ka("baredom.exports.x_divider.init",yB);export const init=yB;
|
package/dist/x-drawer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
2
|
+
var Ut=function(a){var b=$APP.l(a,"__xDrawerRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("div"),g=document.createElement("div"),h=document.createElement("slot"),k=document.createElement("div"),m=document.createElement("slot"),q=document.createElement("div"),r=document.createElement("slot");c.textContent=":host{display:contents;color-scheme:light dark;--x-drawer-size:20rem;--x-drawer-bg:Canvas;--x-drawer-fg:CanvasText;--x-drawer-backdrop:rgb(0 0 0/0.4);--x-drawer-shadow:0 8px 24px rgb(0 0 0/0.18);--x-drawer-duration:200ms;--x-drawer-easing:ease;--x-drawer-z:1000;--x-drawer-header-padding:1rem 1.25rem;--x-drawer-body-padding:1rem 1.25rem;--x-drawer-footer-padding:0.75rem 1.25rem;--x-drawer-border:color-mix(in srgb,currentColor 12%,transparent);}[part\x3dbackdrop]{display:none;position:fixed;inset:0;background:var(--x-drawer-backdrop);z-index:var(--x-drawer-z);}:host([data-open\x3dtrue]) [part\x3dbackdrop]{display:block;}[part\x3dpanel]{position:fixed;background:var(--x-drawer-bg);color:var(--x-drawer-fg);box-shadow:var(--x-drawer-shadow);display:flex;flex-direction:column;overflow:hidden;z-index:calc(var(--x-drawer-z) + 1);transition:transform var(--x-drawer-duration) var(--x-drawer-easing);}:host([data-placement\x3dleft]) [part\x3dpanel],:host([data-placement\x3dright]) [part\x3dpanel]{top:0;bottom:0;width:var(--x-drawer-size);max-width:100vw;}:host([data-placement\x3dleft]) [part\x3dpanel]{left:0;transform:translateX(-100%);}:host([data-placement\x3dright]) [part\x3dpanel]{right:0;transform:translateX(100%);}:host([data-placement\x3dtop]) [part\x3dpanel],:host([data-placement\x3dbottom]) [part\x3dpanel]{left:0;right:0;height:var(--x-drawer-size);max-height:100vh;}:host([data-placement\x3dtop]) [part\x3dpanel]{top:0;transform:translateY(-100%);}:host([data-placement\x3dbottom]) [part\x3dpanel]{bottom:0;transform:translateY(100%);}:host([data-open\x3dtrue]) [part\x3dpanel]{transform:none;}[part\x3dpanel]:focus{outline:none;}[part\x3dheader]{padding:var(--x-drawer-header-padding);border-bottom:1px solid var(--x-drawer-border);flex-shrink:0;}[part\x3dbody]{padding:var(--x-drawer-body-padding);overflow-y:auto;flex:1;}[part\x3dfooter]{padding:var(--x-drawer-footer-padding);border-top:1px solid var(--x-drawer-border);flex-shrink:0;}@media (prefers-reduced-motion:reduce){[part\x3dpanel]{transition:none;}}@media (prefers-color-scheme:dark){:host{--x-drawer-bg:#1c1d24;--x-drawer-fg:#e2e4ef;--x-drawer-border:rgb(255 255 255/0.08);--x-drawer-shadow:0 8px 40px rgb(0 0 0/0.55);--x-drawer-backdrop:rgb(0 0 0/0.55);}}";
|
|
3
3
|
d.setAttribute("part","backdrop");e.setAttribute("part","panel");e.setAttribute("role","dialog");e.setAttribute("aria-modal","true");g.setAttribute("part","header");h.setAttribute("name","header");k.setAttribute("part","body");q.setAttribute("part","footer");r.setAttribute("name","footer");g.appendChild(h);k.appendChild(m);q.appendChild(r);e.appendChild(g);e.appendChild(k);e.appendChild(q);b.appendChild(c);b.appendChild(d);b.appendChild(e);a.__xDrawerRefs={root:b,backdrop:d,panel:e,header:g,body:k,
|
|
4
|
-
footer:q};return $APP.l(a,"__xDrawerRefs")},
|
|
5
|
-
composed:!0,cancelable:!1}))},
|
|
6
|
-
$APP.l(a,"__xDrawerPanelTab")===!0;a.__xDrawerTabbables=null;a.__xDrawerRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xDrawerPanelTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()}
|
|
7
|
-
$APP.
|
|
8
|
-
$APP.xg(h):null;a.__xDrawerTabbables=k;$APP.u(h)?$APP.x(h).focus():$APP.n(g)&&($APP.n(g.hasAttribute("tabindex"))||(g.setAttribute("tabindex","-1"),a.__xDrawerPanelTab=!0),g.focus());return null},0):
|
|
9
|
-
$APP.n(k)&&k.focus();else{k=document.activeElement;var m=$APP.x(h);h=$APP.ic(h);var q=g.shiftKey;$APP.n($APP.n(q)?$APP.
|
|
10
|
-
if($APP.n($APP.n(b)?c:b)){var d=$APP.l(c,"backdrop");c=$APP.l(c,"panel");var e=$APP.l(b,"backdrop");b=$APP.l(b,"keydown");$APP.n(e)&&d.removeEventListener("click",e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xDrawerHandlers=null},
|
|
11
|
-
return $APP.n(b)?b:"right"},set:function(b){return b==null?this.removeAttribute("placement"):this.setAttribute("placement",""+$APP.
|
|
12
|
-
writable:!0});Object.defineProperty(a,"hide",{value:function(){return
|
|
13
|
-
function(){
|
|
4
|
+
footer:q};return $APP.l(a,"__xDrawerRefs")},Wt=function(a){a=new $APP.Q(null,3,[$APP.qh,a.hasAttribute("open"),$APP.dj,a.getAttribute("placement"),$APP.ch,a.getAttribute("label")],null);var b=$APP.N(a),c=$APP.J(b,$APP.qh);a=$APP.J(b,$APP.dj);b=$APP.J(b,$APP.ch);c=$APP.K(c);a=typeof a==="string"&&$APP.Cc(Vt,a)?a:"right";b=typeof b==="string"&&$APP.O(b,"")?b:"Drawer";return new $APP.Q(null,3,[$APP.Ni,c,$APP.yi,a,$APP.W,b],null)},Xt=function(a,b,c){a.dispatchEvent(new CustomEvent(b,{detail:c,bubbles:!0,
|
|
5
|
+
composed:!0,cancelable:!1}))},Yt=function(a){return $APP.be($APP.Kd(function(b){var c=window.getComputedStyle(b);return $APP.O("none",c.display)&&$APP.O("hidden",c.visibility)&&b.offsetWidth>0&&b.offsetHeight>0},$APP.gc(a.querySelectorAll("a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex\x3d'-1'])"))))},Zt=function(a){var b=$APP.l(a,"__xDrawerRefs");b=$APP.n(b)?$APP.l(b,"panel"):null;var c=$APP.l(a,"__xDrawerRestore"),d=
|
|
6
|
+
$APP.l(a,"__xDrawerPanelTab")===!0;a.__xDrawerTabbables=null;a.__xDrawerRestore=null;$APP.n($APP.n(b)?d:b)&&(b.removeAttribute("tabindex"),a.__xDrawerPanelTab=!1);$APP.n($APP.n(c)?c.isConnected:c)&&c.focus()},$t=function(a,b){Xt(a,"x-drawer-dismiss",{reason:b});a.removeAttribute("open");return null},au=function(a){$APP.n(a.hasAttribute("open"))||a.setAttribute("open","");return null},bu=function(a){a.removeAttribute("open");return null},cu=function(a){var b=Ut(a);b=$APP.l(b,"panel");var c=Wt(a),d=
|
|
7
|
+
$APP.Ni.g(c),e=$APP.l(a,"__xDrawerPrevOpen");a.setAttribute("data-open",$APP.n(d)?"true":"false");a.setAttribute("data-placement",$APP.yi.g(c));b.setAttribute("aria-label",$APP.W.g(c));$APP.n(d)?b.removeAttribute("aria-hidden"):b.setAttribute("aria-hidden","true");$APP.O(e,d)&&(a.__xDrawerPrevOpen=d,Xt(a,"x-drawer-toggle",{open:d}),$APP.n(d)?setTimeout(function(){var g=$APP.l(a,"__xDrawerRefs");g=$APP.n(g)?$APP.l(g,"panel"):null;var h=Yt(a);a.__xDrawerRestore=document.activeElement;var k=$APP.n(h)?
|
|
8
|
+
$APP.xg(h):null;a.__xDrawerTabbables=k;$APP.u(h)?$APP.x(h).focus():$APP.n(g)&&($APP.n(g.hasAttribute("tabindex"))||(g.setAttribute("tabindex","-1"),a.__xDrawerPanelTab=!0),g.focus());return null},0):Zt(a))},du=function(a){function b(g){var h=g.key;if($APP.C.h(h,"Escape"))g.preventDefault(),$t(a,"escape");else if($APP.C.h(h,"Tab")){h=$APP.l(a,"__xDrawerTabbables");h=$APP.n(h)?$APP.be($APP.gc(h)):$APP.Ld;var k=$APP.l(a,"__xDrawerRefs");k=$APP.n(k)?$APP.l(k,"panel"):null;if($APP.rc(h))g.preventDefault(),
|
|
9
|
+
$APP.n(k)&&k.focus();else{k=document.activeElement;var m=$APP.x(h);h=$APP.ic(h);var q=g.shiftKey;$APP.n($APP.n(q)?$APP.C.h(k,m):q)?(g.preventDefault(),h.focus()):$APP.p(q)&&$APP.C.h(k,h)&&(g.preventDefault(),m.focus())}}return null}function c(){return $t(a,"backdrop")}var d=Ut(a),e=$APP.l(d,"panel");$APP.l(d,"backdrop").addEventListener("click",c);e.addEventListener("keydown",b);$APP.ma(a,"__xDrawerHandlers",{backdrop:c,keydown:b})},eu=function(a){var b=$APP.l(a,"__xDrawerHandlers"),c=$APP.l(a,"__xDrawerRefs");
|
|
10
|
+
if($APP.n($APP.n(b)?c:b)){var d=$APP.l(c,"backdrop");c=$APP.l(c,"panel");var e=$APP.l(b,"backdrop");b=$APP.l(b,"keydown");$APP.n(e)&&d.removeEventListener("click",e);$APP.n(b)&&c.removeEventListener("keydown",b)}a.__xDrawerHandlers=null},fu=function(a){Object.defineProperty(a,"open",{get:function(){return this.hasAttribute("open")},set:function(b){return $APP.n(b)?au(this):bu(this)},enumerable:!0,configurable:!0});Object.defineProperty(a,"placement",{get:function(){var b=this.getAttribute("placement");
|
|
11
|
+
return $APP.n(b)?b:"right"},set:function(b){return b==null?this.removeAttribute("placement"):this.setAttribute("placement",""+$APP.T.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"label",{get:function(){var b=this.getAttribute("label");return $APP.n(b)?b:"Drawer"},set:function(b){return b==null?this.removeAttribute("label"):this.setAttribute("label",""+$APP.T.g(b))},enumerable:!0,configurable:!0});Object.defineProperty(a,"show",{value:function(){return au(this)},enumerable:!0,configurable:!0,
|
|
12
|
+
writable:!0});Object.defineProperty(a,"hide",{value:function(){return bu(this)},enumerable:!0,configurable:!0,writable:!0});Object.defineProperty(a,"toggle",{value:function(){$APP.n(this.hasAttribute("open"))?bu(this):au(this);return null},enumerable:!0,configurable:!0,writable:!0})},hu=function(){if(!$APP.n(customElements.get("x-drawer"))){var a=class extends HTMLElement{};a.observedAttributes=gu;a.prototype.connectedCallback=function(){Ut(this);eu(this);du(this);cu(this);return null};a.prototype.disconnectedCallback=
|
|
13
|
+
function(){eu(this);Zt(this);return null};a.prototype.attributeChangedCallback=function(b,c,d){$APP.O(c,d)&&cu(this);return null};fu(a.prototype);customElements.define("x-drawer",a)}return null},iu=function(){return hu()};var Vt=new $APP.S(null,new $APP.Q(null,4,["right",null,"top",null,"bottom",null,"left",null],null),null),gu=["open","placement","label"];$APP.wd(["x-drawer-toggle",new $APP.Q(null,2,[$APP.ui,!1,$APP.Y,new $APP.Q(null,1,[$APP.qi,$APP.Ji],null)],null),"x-drawer-dismiss",new $APP.Q(null,2,[$APP.ui,!1,$APP.Y,new $APP.Q(null,1,[$APP.wh,$APP.X],null)],null)]);$APP.ka("baredom.exports.x_drawer.init",iu);export const init=iu;
|