@vanelsas/baredom 2.7.0 → 2.9.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/CHANGELOG.md +50 -0
- package/custom-elements.json +822 -16
- package/dist/baredom.d.ts +9 -0
- package/dist/base.js +455 -428
- package/dist/integrity.json +102 -93
- package/dist/x-alert.js +17 -18
- package/dist/x-avatar-group.js +9 -10
- package/dist/x-avatar.js +15 -15
- package/dist/x-badge.js +9 -10
- package/dist/x-bento-grid.js +5 -5
- package/dist/x-bento-item.js +4 -4
- package/dist/x-breadcrumbs.js +13 -14
- package/dist/x-button.js +17 -18
- package/dist/x-cancel-dialogue.js +13 -17
- package/dist/x-card.js +7 -7
- package/dist/x-carousel.js +33 -34
- package/dist/x-chart.d.ts +26 -0
- package/dist/x-chart.js +47 -46
- package/dist/x-checkbox.js +11 -10
- package/dist/x-chip.js +1 -9
- package/dist/x-collapse.js +10 -10
- package/dist/x-color-picker.js +45 -44
- package/dist/x-combobox.js +26 -26
- package/dist/x-command-palette.js +26 -26
- package/dist/x-confetti.d.ts +50 -0
- package/dist/x-confetti.js +23 -0
- package/dist/x-container.js +4 -4
- package/dist/x-context-menu.d.ts +31 -2
- package/dist/x-context-menu.js +20 -18
- package/dist/x-copy.js +20 -23
- package/dist/x-currency-field.js +23 -23
- package/dist/x-date-picker.d.ts +27 -0
- package/dist/x-date-picker.js +42 -41
- package/dist/x-divider.js +9 -9
- package/dist/x-drawer.js +10 -11
- package/dist/x-dropdown.js +11 -10
- package/dist/x-fieldset.js +5 -6
- package/dist/x-file-download.js +7 -7
- package/dist/x-file-upload.js +21 -21
- package/dist/x-form-field.js +15 -15
- package/dist/x-form.js +9 -8
- package/dist/x-gaussian-blur.js +13 -19
- package/dist/x-grid.js +6 -6
- package/dist/x-i18n-provider.d.ts +43 -0
- package/dist/x-i18n-provider.js +8 -0
- package/dist/x-i18n.d.ts +14 -0
- package/dist/x-i18n.js +5 -0
- package/dist/x-icon.js +6 -7
- package/dist/x-image.js +18 -19
- package/dist/x-kbd.d.ts +17 -0
- package/dist/x-kbd.js +17 -0
- package/dist/x-kinetic-canvas.d.ts +18 -0
- package/dist/x-kinetic-canvas.js +26 -0
- package/dist/x-kinetic-font.js +27 -28
- package/dist/x-kinetic-typography.js +33 -39
- package/dist/x-liquid-dock.js +38 -39
- package/dist/x-liquid-fill.js +45 -45
- package/dist/x-liquid-glass.js +47 -47
- package/dist/x-menu-item.js +8 -9
- package/dist/x-menu.js +10 -11
- package/dist/x-metaball-cursor.js +26 -27
- package/dist/x-modal.js +11 -12
- package/dist/x-morph-stack.js +37 -38
- package/dist/x-multi-combobox.d.ts +50 -0
- package/dist/x-multi-combobox.js +37 -0
- package/dist/x-navbar.js +12 -12
- package/dist/x-neural-glow.js +33 -33
- package/dist/x-notification-center.js +9 -9
- package/dist/x-organic-divider.js +17 -18
- package/dist/x-organic-progress.js +38 -38
- package/dist/x-organic-shape.js +13 -13
- package/dist/x-otp-input.d.ts +55 -0
- package/dist/x-otp-input.js +23 -0
- package/dist/x-pagination.js +15 -16
- package/dist/x-particle-button.js +51 -51
- package/dist/x-popover.js +26 -24
- package/dist/x-progress-circle.js +9 -10
- package/dist/x-progress.js +10 -11
- package/dist/x-proximity-list.d.ts +43 -0
- package/dist/x-proximity-list.js +20 -0
- package/dist/x-radio.js +11 -10
- package/dist/x-ripple-effect.js +11 -12
- package/dist/x-scroll-parallax.js +18 -19
- package/dist/x-scroll-stack.js +17 -18
- package/dist/x-scroll-story.js +34 -36
- package/dist/x-scroll-timeline.js +45 -46
- package/dist/x-scroll.js +40 -41
- package/dist/x-search-field.js +15 -15
- package/dist/x-select.js +10 -9
- package/dist/x-sidebar.js +17 -17
- package/dist/x-skeleton-group.js +12 -12
- package/dist/x-skeleton.js +1 -1
- package/dist/x-slider.js +15 -16
- package/dist/x-soft-body.js +22 -22
- package/dist/x-spacer.js +4 -5
- package/dist/x-spinner.js +4 -5
- package/dist/x-splash.js +12 -13
- package/dist/x-spotlight-card.d.ts +19 -0
- package/dist/x-spotlight-card.js +13 -0
- package/dist/x-stat.js +10 -12
- package/dist/x-stepper.js +14 -15
- package/dist/x-switch.js +10 -9
- package/dist/x-tab.js +7 -8
- package/dist/x-table-cell.js +20 -24
- package/dist/x-table-row.js +8 -9
- package/dist/x-table.js +12 -15
- package/dist/x-tabs.js +11 -11
- package/dist/x-text-area.js +18 -18
- package/dist/x-theme.js +25 -25
- package/dist/x-timeline-item.js +21 -23
- package/dist/x-timeline.js +8 -9
- package/dist/x-toast.js +22 -24
- package/dist/x-toaster.js +8 -8
- package/dist/x-tooltip.js +12 -11
- package/dist/x-typography.js +9 -11
- package/dist/x-welcome-tour.js +60 -64
- package/package.json +47 -2
package/dist/x-context-menu.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
l=$APP.
|
|
4
|
-
2,[$APP.
|
|
5
|
-
$APP.
|
|
6
|
-
e)?e:"bottom-start";return new $APP.
|
|
7
|
-
b);b=document.createElement("div");b.setAttribute("part","panel");b.setAttribute("role","menu");b.setAttribute("tabindex","-1");a.shadowRoot.appendChild(b);return a},
|
|
8
|
-
e+=1}else if(a=$APP.t(a))c=a,$APP.
|
|
9
|
-
"keyboard"):$APP.B.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
2
|
+
var $8=function(a){return $APP.n(a)?a.shadowRoot.querySelector("[part\x3dpanel]"):null},a9=function(a,b){return typeof a==="string"?(a=parseInt(a,10),$APP.p(isNaN(a))&&a>0?a:b):b},Bfa=function(a){return $APP.B.j(a,"bottom-start")?"top-start":$APP.B.j(a,"bottom-end")?"top-end":$APP.B.j(a,"top-start")?"bottom-start":$APP.B.j(a,"top-end")?"bottom-end":$APP.B.j(a,"right-start")?"left-start":$APP.B.j(a,"left-start")?"right-start":a},Cfa=function(a,b,c,d){var e=$APP.H(c);c=$APP.C(e,$APP.kn);var f=$APP.C(e,
|
|
3
|
+
$APP.jn),h=$APP.C(e,$APP.ji);e=$APP.C(e,$APP.ki);var l=$APP.H(d);d=$APP.C(l,$APP.ji);l=$APP.C(l,$APP.ki);switch(a){case "bottom-start":return new $APP.P(null,2,[$APP.kn,c,$APP.jn,f+e+b],null);case "bottom-end":return new $APP.P(null,2,[$APP.kn,c+h-d,$APP.jn,f+e+b],null);case "top-start":return new $APP.P(null,2,[$APP.kn,c,$APP.jn,f-l-b],null);case "top-end":return new $APP.P(null,2,[$APP.kn,c+h-d,$APP.jn,f-l-b],null);case "right-start":return new $APP.P(null,2,[$APP.kn,c+h+b,$APP.jn,f],null);case "left-start":return new $APP.P(null,
|
|
4
|
+
2,[$APP.kn,c-d-b,$APP.jn,f],null);default:return new $APP.P(null,2,[$APP.kn,c,$APP.jn,f+e+b],null)}},b9=function(a,b,c,d,e){function f(w){var y=Cfa(w,b,c,d);y=$APP.H(y);var A=$APP.C(y,$APP.kn),D=$APP.C(y,$APP.jn);y=A>=8&&A+m<=h-8;var G=D>=8&&D+q<=l-8;A=$APP.Di.j($APP.Ci.j(A,8),h-m-8);D=$APP.Di.j($APP.Ci.j(D,8),l-q-8);return new $APP.P(null,5,[$APP.kn,A,$APP.jn,D,$APP.Hj,w,$APP.En,y&&G,$APP.Xl,$APP.Ci.j(40,l-D-8)],null)}e=$APP.H(e);var h=$APP.C(e,$APP.ji),l=$APP.C(e,$APP.ki);e=$APP.H(d);var m=$APP.C(e,
|
|
5
|
+
$APP.ji),q=$APP.C(e,$APP.ki),r=f(a),v=f(Bfa(a));return $APP.n(function(){var w=$APP.En.i(r);return $APP.n(w)?w:$APP.p($APP.En.i(v))}())?r:v},f9=function(a){a=new $APP.P(null,5,[$APP.Sj,$APP.n(a.hasAttribute("open"))?a.getAttribute("open"):null,$APP.Eh,$APP.n(a.hasAttribute("disabled"))?a.getAttribute("disabled"):null,$APP.Oo,a.getAttribute("placement"),c9,a.getAttribute("offset"),d9,a.getAttribute("z-index")],null);var b=$APP.H(a),c=$APP.C(b,$APP.Sj),d=$APP.C(b,$APP.Eh),e=$APP.C(b,$APP.Oo);a=$APP.C(b,
|
|
6
|
+
c9);b=$APP.C(b,d9);c=$APP.rh(c);d=$APP.rh(d);e=typeof e==="string"&&$APP.Vc(Dfa,e)?e:"bottom-start";return new $APP.P(null,5,[$APP.to,c,$APP.Y,d,$APP.gl,e,$APP.Ej,a9(a,8),e9,a9(b,1E3)],null)},g9=function(a){return $APP.xc(a.querySelectorAll("[role\x3dmenuitem]:not([disabled]):not([aria-disabled\x3dtrue])"))},h9=function(a){return $APP.n(a)?a.focus():null},i9=function(a,b){a=$APP.yh(a,":host{color-scheme:light dark;--x-context-menu-bg:var(--x-color-bg,rgba(255,255,255,0.97));--x-context-menu-border:var(--x-color-border,rgba(0,0,0,0.1));--x-context-menu-shadow:var(--x-shadow-lg,0 8px 32px rgba(0,0,0,0.14),0 2px 8px rgba(0,0,0,0.08));--x-context-menu-radius:var(--x-radius-md,10px);--x-context-menu-item-hover:rgba(0,0,0,0.05);--x-context-menu-item-active:rgba(0,0,0,0.09);--x-context-menu-item-fg:var(--x-color-text,rgba(0,0,0,0.87));--x-context-menu-separator:var(--x-color-border,rgba(0,0,0,0.1));}@media(prefers-color-scheme:dark){:host{--x-context-menu-bg:var(--x-color-bg,#1e293b);--x-context-menu-border:var(--x-color-border,rgba(255,255,255,0.12));--x-context-menu-shadow:var(--x-shadow-lg,0 8px 32px rgba(0,0,0,0.7),0 2px 8px rgba(0,0,0,0.4));--x-context-menu-item-hover:rgba(255,255,255,0.08);--x-context-menu-item-active:rgba(255,255,255,0.14);--x-context-menu-item-fg:var(--x-color-text,rgba(255,255,255,0.9));--x-context-menu-separator:var(--x-color-border,rgba(255,255,255,0.12));}}[part\x3dpanel]{position:absolute;min-width:160px;max-width:calc(100vw - 1rem);border-radius:var(--x-context-menu-radius);background:var(--x-context-menu-bg);border:1px solid var(--x-context-menu-border);box-shadow:var(--x-context-menu-shadow);padding:4px 0;overflow:auto;pointer-events:auto;outline:none;@media(prefers-reduced-motion:no-preference){transition:opacity 120ms ease,transform 120ms ease;}}[role\x3dmenuitem]{color:var(--x-context-menu-item-fg);}[role\x3dmenuitem]:hover{background:var(--x-context-menu-item-hover);}",
|
|
7
|
+
b);b=document.createElement("div");b.setAttribute("part","panel");b.setAttribute("role","menu");b.setAttribute("tabindex","-1");a.shadowRoot.appendChild(b);return a},j9=function(a,b,c,d){var e=$APP.H(d);d=$APP.C(e,e9);e=$APP.C(e,$APP.Xl);a.style.zIndex=""+$APP.R.i(d);a=$8(a);$APP.n(a)&&(a.style.left=""+$APP.R.i(b)+"px",a.style.top=""+$APP.R.i(c)+"px",a.style.maxHeight=""+$APP.R.i(e)+"px")},k9=function(a,b){a=$APP.t($APP.xc(a.children));for(var c=null,d=0,e=0;;)if(e<d){var f=c.G(null,e);b.appendChild(f.cloneNode(!0));
|
|
8
|
+
e+=1}else if(a=$APP.t(a))c=a,$APP.Rc(c)?(a=$APP.yb(c),d=$APP.zb(c),c=a,f=$APP.z(a),a=d,d=f):(f=$APP.u(c),b.appendChild(f.cloneNode(!0)),a=$APP.x(c),c=null,d=0),e=0;else break},m9=function(a,b){function c(e){e.stopPropagation();e=e.target.closest("[role\x3dmenuitem]");return $APP.n(e)?($APP.ah(a,"x-context-menu-select",{item:e}),l9.j?l9.j(a,"select"):l9.call(null,a,"select")):null}var d=$8(b);$APP.zh(b,b,"keydown",function(e){var f=e.key,h=b.shadowRoot.activeElement;return $APP.B.j(f,"Tab")?l9.j?l9.j(a,
|
|
9
|
+
"keyboard"):l9.call(null,a,"keyboard"):$APP.B.j(f,"ArrowDown")?(e.preventDefault(),$APP.n(h)?(e=g9(d),h=$APP.Yc(e).indexOf(h),h=$APP.Dc(e,$APP.jd(h+1,$APP.z(e)),null),h=h9(h)):h=h9($APP.u(g9(d))),h):$APP.B.j(f,"ArrowUp")?(e.preventDefault(),$APP.n(h)?(e=g9(d),f=$APP.z(e),h=$APP.Yc(e).indexOf(h),h=$APP.Dc(e,$APP.jd(h+(f-1),f),null),h=h9(h)):h=h9($APP.u(g9(d))),h):($APP.B.j(f,"Enter")||$APP.B.j(f," "))&&$APP.n(h)?(e.preventDefault(),h.click()):null},!0);$APP.n(d)&&$APP.zh(b,d,"click",c,!1)},n9=function(a){function b(d){var e=
|
|
10
|
+
$APP.k(a,"__xContextMenuLayer");if($APP.n(e)){var f=$8(e);d=d.composedPath();d=$APP.Yd(function(h){return h===f},$APP.xc(d));return $APP.n($APP.n(f)?$APP.p(d):f)?l9.j?l9.j(a,"backdrop"):l9.call(null,a,"backdrop"):null}return null}function c(d){return $APP.B.j(d.key,"Escape")?(d.preventDefault(),l9.j?l9.j(a,"keyboard"):l9.call(null,a,"keyboard")):null}setTimeout(function(){if($APP.n(a.hasAttribute("open")))document.addEventListener("keydown",c),document.addEventListener("click",b),a.__xContextMenuDocH=
|
|
11
|
+
{keydown:c,click:b};else return null},0)},l9=function(a,b){if($APP.n(a.hasAttribute("open"))&&$APP.bh(a,"x-context-menu-close-request",{reason:b})){var c=$APP.k(a,"__xContextMenuDocH");$APP.n(c)&&(document.removeEventListener("keydown",$APP.k(c,"keydown")),document.removeEventListener("click",$APP.k(c,"click")),a.__xContextMenuDocH=null);a.removeAttribute("open");$APP.Ah($APP.k(a,"__xContextMenuLayer"));a.__xContextMenuLayer=null;return $APP.ah(a,"x-context-menu-close",{reason:b})}return null},o9=
|
|
12
|
+
function(a,b,c,d){if($APP.n(a.hasAttribute("disabled")))return null;if($APP.bh(a,"x-context-menu-open-request",{reason:d})){var e=f9(a);e=$APP.H(e);var f=$APP.C(e,$APP.gl),h=$APP.C(e,$APP.Ej),l=$APP.C(e,e9),m=window.innerWidth,q=window.innerHeight,r=new $APP.P(null,4,[$APP.kn,b,$APP.jn,c,$APP.ji,1,$APP.ki,1],null);b=b9(f,h,r,new $APP.P(null,2,[$APP.ji,200,$APP.ki,300],null),new $APP.P(null,2,[$APP.ji,m,$APP.ki,q],null));var v=i9(a,l);k9(a,$8(v));m9(a,v);j9(v,$APP.kn.i(b),$APP.jn.i(b),$APP.Ai.m(b,
|
|
13
|
+
e9,l));a.setAttribute("open","");a.__xContextMenuLayer=v;n9(a);requestAnimationFrame(function(){var w=$8(v);if($APP.n(w)){var y=b9(f,h,r,new $APP.P(null,2,[$APP.ji,w.offsetWidth,$APP.ki,w.offsetHeight],null),new $APP.P(null,2,[$APP.ji,m,$APP.ki,q],null));j9(v,$APP.kn.i(y),$APP.jn.i(y),$APP.Ai.m(y,e9,l));return h9($APP.u(g9(w)))}return null});return $APP.ah(a,"x-context-menu-open",{reason:d})}return null},Efa=function(a,b){if($APP.n(a.hasAttribute("disabled")))return null;b=b.getBoundingClientRect();
|
|
14
|
+
var c=f9(a);c=$APP.H(c);var d=$APP.C(c,$APP.gl),e=$APP.C(c,$APP.Ej),f=$APP.C(c,e9),h=window.innerWidth,l=window.innerHeight,m=new $APP.P(null,4,[$APP.kn,b.left,$APP.jn,b.top,$APP.ji,b.width,$APP.ki,b.height],null);if($APP.bh(a,"x-context-menu-open-request",{reason:"programmatic"})){b=b9(d,e,m,new $APP.P(null,2,[$APP.ji,200,$APP.ki,300],null),new $APP.P(null,2,[$APP.ji,h,$APP.ki,l],null));var q=i9(a,f);k9(a,$8(q));m9(a,q);j9(q,$APP.kn.i(b),$APP.jn.i(b),$APP.Ai.m(b,e9,f));a.setAttribute("open","");
|
|
15
|
+
a.__xContextMenuLayer=q;n9(a);requestAnimationFrame(function(){var r=$8(q);if($APP.n(r)){var v=b9(d,e,m,new $APP.P(null,2,[$APP.ji,r.offsetWidth,$APP.ki,r.offsetHeight],null),new $APP.P(null,2,[$APP.ji,h,$APP.ki,l],null));j9(q,$APP.kn.i(v),$APP.jn.i(v),$APP.Ai.m(v,e9,f));return h9($APP.u(g9(r)))}return null});return $APP.ah(a,"x-context-menu-open",{reason:"programmatic"})}return null},Ffa=function(a){if(!$APP.n($APP.k(a,"__xContextMenuRefs"))){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),
|
|
16
|
+
d=document.createElement("slot");c.textContent=":host{display:contents;}slot{display:none;}";b.appendChild(c);b.appendChild(d);c={};c.root=b;c.slot=d;a.__xContextMenuRefs=c}return $APP.n(a.hasAttribute("open"))?a.removeAttribute("open"):null},Gfa=function(a){var b=$APP.k(a,"__xContextMenuLayer");if($APP.n(b))$APP.Ah(b),a.__xContextMenuLayer=null;else return null},Hfa=function(a,b){if($APP.B.j(b,"open")){if($APP.n(a.hasAttribute("open")))return null;b=$APP.k(a,"__xContextMenuLayer");if($APP.n(b)){$APP.Ah(b);
|
|
17
|
+
a.__xContextMenuLayer=null;return}}return null},Ifa=function(a){a.openAt=function(b,c){return o9(this,b,c,"programmatic")};a.toggleAt=function(b,c){return $APP.n(this.hasAttribute("open"))?l9(this,"toggle"):o9(this,b,c,"toggle")};a.openForElement=function(b){return Efa(this,b)};return a.close=function(){return l9(this,"programmatic")}},Kfa=function(a){$APP.ih(a,Jfa);return Ifa(a)},p9=function(){return $APP.Wg("x-context-menu",new $APP.P(null,5,[$APP.Mg,Lfa,$APP.Ng,Ffa,$APP.Og,Gfa,$APP.Qg,Hfa,$APP.Ug,
|
|
18
|
+
Kfa],null))},d9=new $APP.F(null,"z-index-raw","z-index-raw",-1179679257),e9=new $APP.F(null,"z-index","z-index",1892827090),c9=new $APP.F(null,"offset-raw","offset-raw",-1418404095);var Lfa=["open","disabled","placement","offset","z-index"],Dfa=new $APP.Q(null,new $APP.P(null,6,["right-start",null,"bottom-start",null,"bottom-end",null,"top-end",null,"top-start",null,"left-start",null],null),null),Jfa=new $APP.P(null,5,[$APP.Qn,new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"open"],null),$APP.fl,new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"disabled"],null),$APP.gl,new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"placement"],null),$APP.Ej,new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"offset"],null),new $APP.F(null,
|
|
19
|
+
"zIndex","zIndex",-1588341609),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"z-index"],null)],null);
|
|
20
|
+
$APP.Ud(["x-context-menu-open-request",new $APP.P(null,2,[$APP.Un,!0,$APP.Z,new $APP.P(null,1,[$APP.bk,$APP.V],null)],null),"x-context-menu-open",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,1,[$APP.bk,$APP.V],null)],null),"x-context-menu-close-request",new $APP.P(null,2,[$APP.Un,!0,$APP.Z,new $APP.P(null,1,[$APP.bk,$APP.V],null)],null),"x-context-menu-close",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,1,[$APP.bk,$APP.V],null)],null),"x-context-menu-select",new $APP.P(null,2,[$APP.Un,
|
|
21
|
+
!1,$APP.Z,new $APP.P(null,1,[$APP.Kl,$APP.Im],null)],null)]);$APP.da("baredom.exports.x_context_menu.init",p9);export const init=p9;
|
package/dist/x-copy.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
$APP.
|
|
4
|
-
$APP.
|
|
2
|
+
var QI=function(a){return a==null?!0:$APP.B.j(a,"false")?!1:$APP.B.j(a,"0")?!1:!0},RI=function(a){return typeof a==="string"&&$APP.M(a,"")?(a=parseInt(a,10),$APP.p(isNaN(a))&&a>0?a:1200):1200},SI=function(a){return Math.min(1E4,Math.max(100,a))},fJ=function(a){var b=$APP.H(a);a=$APP.C(b,TI);var c=$APP.C(b,UI),d=$APP.C(b,VI),e=$APP.C(b,$APP.$i),f=$APP.C(b,$APP.Wm),h=$APP.C(b,WI),l=$APP.C(b,XI),m=$APP.C(b,$APP.Eh),q=$APP.C(b,YI);b=$APP.C(b,ZI);return $APP.Hf([$I,$APP.Kk,aJ,bJ,cJ,$APP.mj,dJ,$APP.Y,eJ,
|
|
3
|
+
$APP.an],[QI(b),$APP.B.j(f,"html")?"html":"text",typeof l==="string"&&$APP.M(l.trim(),"")?l.trim():null,typeof a==="string"&&$APP.M(a.trim(),"")?a.trim():null,SI(RI(c)),typeof d==="string"&&$APP.M(d.trim(),"")?d.trim():null,function(){var r;if(r=typeof h==="string")r=(r=$APP.M(h,""))?h:r;return $APP.n(r)?r:"Copy failed"}(),$APP.E(m),function(){var r;if(r=typeof q==="string")r=(r=$APP.M(q,""))?q:r;return $APP.n(r)?r:"Copied"}(),typeof e==="string"&&$APP.M(e.trim(),"")?e.trim():null])},gJ=function(a){var b=
|
|
4
|
+
$APP.H(a);a=$APP.C(b,$APP.an);var c=$APP.C(b,$APP.mj),d=$APP.C(b,aJ);b=$APP.C(b,$APP.Kk);return{text:$APP.n(a)?a:"",mode:$APP.n(b)?b:"text",from:$APP.n(c)?c:null,fromAttr:$APP.n(d)?d:null}},hJ=function(a){var b=$APP.k(a,"__xCopyRefs");if($APP.n(b))return b;b=a.attachShadow({mode:"open"});var c=document.createElement("style"),d=document.createElement("span"),e=document.createElement("button"),f=document.createElement("slot"),h=document.createElement("span"),l=document.createElement("slot"),m=document.createElement("span");
|
|
5
5
|
c.textContent=":host{display:inline-block;position:relative;color-scheme:light dark;--x-copy-tooltip-bg:var(--x-color-bg,#1e293b);--x-copy-tooltip-fg:var(--x-color-text,#f8fafc);--x-copy-tooltip-success-bg:var(--x-color-primary,#15803d);--x-copy-tooltip-success-fg:#ffffff;--x-copy-tooltip-error-bg:var(--x-color-danger,#b91c1c);--x-copy-tooltip-error-fg:#fef2f2;--x-copy-tooltip-radius:var(--x-radius-md,6px);--x-copy-tooltip-padding:4px 8px;--x-copy-tooltip-font-size:var(--x-font-size-sm,0.8125rem);--x-copy-tooltip-z:100;}@media (prefers-color-scheme:dark){:host{--x-copy-tooltip-bg:var(--x-color-bg,#0f172a);--x-copy-tooltip-fg:var(--x-color-text,#e2e8f0);--x-copy-tooltip-success-bg:var(--x-color-primary,#166534);--x-copy-tooltip-success-fg:#ffffff;--x-copy-tooltip-error-bg:var(--x-color-danger,#991b1b);--x-copy-tooltip-error-fg:#fee2e2;}}[part\x3dwrap]{display:inline-flex;align-items:center;justify-content:center;}[part\x3dtrigger]{all:unset;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;box-sizing:border-box;}[part\x3dtrigger]:focus-visible{outline:2px solid currentColor;outline-offset:2px;}:host([disabled]) [part\x3dtrigger]{opacity:0.55;pointer-events:none;cursor:default;}[part\x3dtooltip]{display:none;position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);white-space:nowrap;background:var(--x-copy-tooltip-bg);color:var(--x-copy-tooltip-fg);border-radius:var(--x-copy-tooltip-radius);padding:var(--x-copy-tooltip-padding);font-size:var(--x-copy-tooltip-font-size);z-index:var(--x-copy-tooltip-z);pointer-events:none;}:host([data-tooltip-open]) [part\x3dtooltip]{display:block;}:host([data-tooltip-kind\x3dsuccess]) [part\x3dtooltip]{background:var(--x-copy-tooltip-success-bg);color:var(--x-copy-tooltip-success-fg);}:host([data-tooltip-kind\x3derror]) [part\x3dtooltip]{background:var(--x-copy-tooltip-error-bg);color:var(--x-copy-tooltip-error-fg);}@media (prefers-reduced-motion:reduce){[part\x3dtrigger]{transition:none;}}";
|
|
6
|
-
d.setAttribute("part","wrap");e.setAttribute("part","trigger");e.setAttribute("type","button");e.appendChild(
|
|
7
|
-
$APP
|
|
8
|
-
return typeof b==="string"&&$APP.
|
|
9
|
-
1,5,$APP.
|
|
10
|
-
d.
|
|
11
|
-
$APP.k(a,"__xCopyRefs");if($APP.n(e)){var
|
|
12
|
-
var b=
|
|
13
|
-
"ctrl")},c)),e=$APP.
|
|
14
|
-
c);document.addEventListener("keydown",b);$APP.
|
|
15
|
-
$APP.k(b,"trigger").disabled=$APP.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
$APP.zf([new $APP.K(null,"errorMessage","errorMessage",982744869),$APP.kk,new $APP.K(null,"textValue","textValue",-598870870),$APP.Oj,rG,new $APP.K(null,"tooltipMs","tooltipMs",1056463375),WF,$APP.qi,new $APP.K(null,"showTooltip","showTooltip",482349691),new $APP.K(null,"successMessage","successMessage",-789572803),$APP.Ul],[new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"error-message"],null),new $APP.Q(null,2,[$APP.Z,$APP.uk,$APP.$k,"disabled"],null),new $APP.Q(null,3,[$APP.Z,$APP.Y,$APP.$k,null,new $APP.K(null,
|
|
24
|
-
"note","note",1426297904),"property-only override"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"mode"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"from-attr"],null),new $APP.Q(null,2,[$APP.Z,$APP.W,$APP.$k,"tooltip-ms"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"hotkey"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"from"],null),new $APP.Q(null,2,[$APP.Z,$APP.uk,$APP.$k,"show-tooltip"],null),new $APP.Q(null,2,[$APP.Z,$APP.Y,$APP.$k,"success-message"],null),new $APP.Q(null,2,[$APP.Z,
|
|
25
|
-
$APP.Y,$APP.$k,"text"],null)]);$APP.Pd(["x-copy-request",new $APP.Q(null,2,[$APP.Km,!0,$APP.V,new $APP.Q(null,4,[$APP.Ul,$APP.Y,$APP.Oj,$APP.Y,$APP.qi,$APP.Y,rG,$APP.Y],null)],null),"x-copy-success",new $APP.Q(null,2,[$APP.Km,!1,$APP.V,new $APP.Q(null,1,[$APP.Ul,$APP.Y],null)],null),"x-copy-error",new $APP.Q(null,2,[$APP.Km,!1,$APP.V,new $APP.Q(null,1,[$APP.Wi,$APP.Y],null)],null)]);$APP.ha("baredom.exports.x_copy.init",qG);export const init=qG;
|
|
6
|
+
d.setAttribute("part","wrap");e.setAttribute("part","trigger");e.setAttribute("type","button");e.appendChild(f);h.setAttribute("part","tooltip");h.setAttribute("role","status");h.setAttribute("aria-live","polite");l.setAttribute("name","tooltip");m.setAttribute("part","tooltip-text");h.appendChild(l);h.appendChild(m);d.appendChild(e);d.appendChild(h);b.appendChild(c);b.appendChild(d);a.__xCopyRefs={root:b,wrap:d,trigger:e,tooltip:h,tooltipSlot:l,tooltipText:m};return $APP.k(a,"__xCopyRefs")},iJ=function(a){return fJ($APP.Hf([VI,
|
|
7
|
+
$APP.$i,$APP.Wm,WI,XI,$APP.Eh,YI,ZI,TI,UI],[a.getAttribute("from"),a.getAttribute("text"),a.getAttribute("mode"),a.getAttribute("error-message"),a.getAttribute("from-attr"),a.hasAttribute("disabled"),a.getAttribute("success-message"),a.getAttribute("show-tooltip"),a.getAttribute("hotkey"),a.getAttribute("tooltip-ms")]))},jJ=function(a){var b=$APP.k(a,"__xCopyTextValue");if(typeof b==="string")return b;b=a.getAttribute("text");if(typeof b==="string"&&$APP.M(b,""))return b;b=a.getAttribute("from");
|
|
8
|
+
return typeof b==="string"&&$APP.M(b,"")&&(b=document.querySelector(b),$APP.n(b))?(a=a.getAttribute("from-attr"),a=typeof a==="string"&&$APP.M(a,"")?b.getAttribute(a):b.textContent,$APP.n(a)?a:""):""},kJ=function(a){var b=jJ(a),c=function(){var d=a.getAttribute("mode");return $APP.n(d)?d:"text"}();return new Promise(function(d,e){if($APP.B.j(c,"html")){if($APP.n(function(){var h=navigator.clipboard;return $APP.n(h)?window.ClipboardItem:h}()))return navigator.clipboard.write($APP.Wi(new $APP.N(null,
|
|
9
|
+
1,5,$APP.O,[new ClipboardItem({"text/html":new Blob([b],{type:"text/html"}),"text/plain":new Blob([b],{type:"text/plain"})})],null))).then(function(){return d.i?d.i(b):d.call(null,b)}).catch(function(h){return e.i?e.i(h):e.call(null,h)});try{var f=document.createElement("textarea");f.value=b;document.body.appendChild(f);f.select();document.execCommand("copy");f.remove();return d.i?d.i(b):d.call(null,b)}catch(h){if(h instanceof Error)return f=h,e.i?e.i(f):e.call(null,f);throw h;}}else{if($APP.n(navigator.clipboard))return navigator.clipboard.writeText(b).then(function(){return d.i?
|
|
10
|
+
d.i(b):d.call(null,b)}).catch(function(h){try{return document.execCommand("copy"),d.i?d.i(b):d.call(null,b)}catch(l){if(l instanceof Error)return e.i?e.i(h):e.call(null,h);throw l;}});try{return f=document.createElement("textarea"),f.value=b,f.style.position="fixed",f.style.opacity="0",document.body.appendChild(f),f.select(),document.execCommand("copy"),f.remove(),d.i?d.i(b):d.call(null,b)}catch(h){if(h instanceof Error)return f=h,e.i?e.i(f):e.call(null,f);throw h;}}})},lJ=function(a,b,c,d){var e=
|
|
11
|
+
$APP.k(a,"__xCopyRefs");if($APP.n(e)){var f=$APP.k(a,"__xCopyTid");$APP.n(f)&&(clearTimeout(f),a.__xCopyTid=null);a.setAttribute("data-tooltip-open","");a.setAttribute("data-tooltip-kind",b);$APP.k(e,"tooltipText").textContent=c;$APP.fa(a,"__xCopyTid",setTimeout(function(){a.__xCopyTid=null;a.removeAttribute("data-tooltip-open");a.removeAttribute("data-tooltip-kind");var h=$APP.k(a,"__xCopyRefs");$APP.n(h)&&($APP.k(h,"tooltipText").textContent="");return null},d))}},mJ=function(a){if($APP.n(a.hasAttribute("disabled")))return Promise.resolve(null);
|
|
12
|
+
var b=iJ(a),c=gJ(b);return $APP.bh(a,"x-copy-request",c)?kJ(a).then(function(d){$APP.ah(a,"x-copy-success",{text:$APP.n(d)?d:""});$APP.n($I.i(b))&&lJ(a,"success",eJ.i(b),cJ.i(b));return d}).catch(function(d){$APP.ah(a,"x-copy-error",{error:""+$APP.R.i(d)});$APP.n($I.i(b))&&lJ(a,"error",dJ.i(b),cJ.i(b));return Promise.reject(d)}):Promise.resolve(null)},nJ=function(a,b){if(typeof b==="string"&&$APP.M(b,"")){var c=b.toLowerCase().split("+");b=$APP.Ac(c);var d=$APP.E($APP.Yd(function(h){return $APP.B.j(h,
|
|
13
|
+
"ctrl")},c)),e=$APP.E($APP.Yd(function(h){return $APP.B.j(h,"shift")},c)),f=$APP.E($APP.Yd(function(h){return $APP.B.j(h,"alt")},c));c=$APP.E($APP.Yd(function(h){return $APP.B.j(h,"meta")},c));return $APP.B.j(a.key.toLowerCase(),b)&&$APP.B.j(d,a.ctrlKey)&&$APP.B.j(e,a.shiftKey)&&$APP.B.j(f,a.altKey)&&$APP.B.j(c,a.metaKey)}return null},oJ=function(a){function b(e){var f=a.getAttribute("hotkey");return $APP.n(nJ(e,f))?(e.preventDefault(),mJ(a)):null}function c(){return mJ(a)}var d=hJ(a);$APP.k(d,"trigger").addEventListener("click",
|
|
14
|
+
c);document.addEventListener("keydown",b);$APP.fa(a,"__xCopyHandlers",{click:c,keydown:b})},pJ=function(a){var b=$APP.k(a,"__xCopyTid");$APP.n(b)&&(clearTimeout(b),a.__xCopyTid=null);b=$APP.k(a,"__xCopyHandlers");var c=$APP.k(a,"__xCopyRefs");if($APP.n($APP.n(b)?c:b)){c=$APP.k(c,"trigger");var d=$APP.k(b,"click");b=$APP.k(b,"keydown");$APP.n(d)&&c.removeEventListener("click",d);$APP.n(b)&&document.removeEventListener("keydown",b)}a.__xCopyHandlers=null},qJ=function(a){var b=hJ(a),c=a.hasAttribute("disabled");
|
|
15
|
+
$APP.k(b,"trigger").disabled=$APP.E(c);$APP.n(c)?a.setAttribute("aria-disabled","true"):a.removeAttribute("aria-disabled")},rJ=function(a){hJ(a);pJ(a);oJ(a);qJ(a);return null},sJ=function(a){pJ(a);return null},tJ=function(a,b,c,d){$APP.M(c,d)&&qJ(a);return null},uJ=function(a){$APP.eh(a,"text","text");$APP.eh(a,"from","from");$APP.eh(a,"fromAttr","from-attr");$APP.eh(a,"mode","mode");$APP.eh(a,"successMessage","success-message");$APP.eh(a,"errorMessage","error-message");$APP.eh(a,"hotkey","hotkey");
|
|
16
|
+
$APP.ch(a,"disabled","disabled");Object.defineProperty(a,"showTooltip",{get:function(){return QI(this.getAttribute("show-tooltip"))},set:function(b){return $APP.n(b)?this.setAttribute("show-tooltip","true"):this.setAttribute("show-tooltip","false")},enumerable:!0,configurable:!0});Object.defineProperty(a,"tooltipMs",{get:function(){return RI(this.getAttribute("tooltip-ms"))},set:function(b){return b==null?this.removeAttribute("tooltip-ms"):this.setAttribute("tooltip-ms",""+$APP.R.i(b|0))},enumerable:!0,
|
|
17
|
+
configurable:!0});Object.defineProperty(a,"textValue",{get:function(){return $APP.k(this,"__xCopyTextValue")},set:function(b){this.__xCopyTextValue=typeof b==="string"?b:void 0},enumerable:!0,configurable:!0});return Object.defineProperty(a,"copy",{value:function(){return mJ(this)},enumerable:!0,configurable:!0,writable:!0})},wJ=function(){return $APP.Wg("x-copy",new $APP.P(null,5,[$APP.Mg,vJ,$APP.Ng,rJ,$APP.Og,sJ,$APP.Qg,tJ,$APP.Ug,uJ],null))},$I=new $APP.F(null,"show-tooltip?","show-tooltip?",-1214081087),
|
|
18
|
+
UI=new $APP.F(null,"tooltip-ms-raw","tooltip-ms-raw",-1973326401),eJ=new $APP.F(null,"success-message","success-message",-96541601),WI=new $APP.F(null,"error-message-raw","error-message-raw",1910536231),bJ=new $APP.F(null,"hotkey","hotkey",-329017295),dJ=new $APP.F(null,"error-message","error-message",1756021561),xJ=new $APP.F(null,"fromAttr","fromAttr",-1768252533),XI=new $APP.F(null,"from-attr-raw","from-attr-raw",761657416),cJ=new $APP.F(null,"tooltip-ms","tooltip-ms",1062450417),YI=new $APP.F(null,
|
|
19
|
+
"success-message-raw","success-message-raw",388691116),VI=new $APP.F(null,"from-raw","from-raw",-44462428),aJ=new $APP.F(null,"from-attr","from-attr",1217901743),TI=new $APP.F(null,"hotkey-raw","hotkey-raw",1972404222),ZI=new $APP.F(null,"show-tooltip-raw","show-tooltip-raw",453600717);var vJ="text from from-attr mode disabled show-tooltip tooltip-ms success-message error-message hotkey".split(" ");
|
|
20
|
+
$APP.Hf([new $APP.F(null,"errorMessage","errorMessage",982744869),$APP.fl,new $APP.F(null,"textValue","textValue",-598870870),$APP.Kk,xJ,new $APP.F(null,"tooltipMs","tooltipMs",1056463375),bJ,$APP.mj,new $APP.F(null,"showTooltip","showTooltip",482349691),new $APP.F(null,"successMessage","successMessage",-789572803),$APP.an],[new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"error-message"],null),new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"disabled"],null),new $APP.P(null,3,[$APP.S,$APP.V,$APP.T,null,new $APP.F(null,
|
|
21
|
+
"note","note",1426297904),"property-only override"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"mode"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"from-attr"],null),new $APP.P(null,2,[$APP.S,$APP.W,$APP.T,"tooltip-ms"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"hotkey"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"from"],null),new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"show-tooltip"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"success-message"],null),new $APP.P(null,2,[$APP.S,$APP.V,
|
|
22
|
+
$APP.T,"text"],null)]);$APP.Ud(["x-copy-request",new $APP.P(null,2,[$APP.Un,!0,$APP.Z,new $APP.P(null,4,[$APP.an,$APP.V,$APP.Kk,$APP.V,$APP.mj,$APP.V,xJ,$APP.V],null)],null),"x-copy-success",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,1,[$APP.an,$APP.V],null)],null),"x-copy-error",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,1,[$APP.Qj,$APP.V],null)],null)]);$APP.da("baredom.exports.x_copy.init",wJ);export const init=wJ;
|
package/dist/x-currency-field.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { $APP, shadow$provide } from "./base.js";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
d.setAttribute("part","field");e.setAttribute("part","label");e.setAttribute("id","label");e.setAttribute("for","input");
|
|
5
|
-
"error");
|
|
6
|
-
$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 l=$APP.
|
|
9
|
-
$APP.
|
|
10
|
-
"")?parseFloat(r):null,
|
|
11
|
-
|
|
12
|
-
c.classList.add("label-hidden");
|
|
13
|
-
a.getAttribute("value");return b.value=$APP.n(c)?c:""}return null}},
|
|
14
|
-
"x-currency-field-input",{name:e,value:c})):b.value=d}return null}},
|
|
15
|
-
"__xCurrencyFieldInternals"),$APP.n(e)&&(e.setFormValue(c)
|
|
16
|
-
if($APP.n(c)){b=$APP.k(b,"input");b.removeEventListener("focus",$APP.k(c,"focus"));b.removeEventListener("input",$APP.k(c,"input"));b.removeEventListener("change",$APP.k(c,"change"));a.__xCurrencyFieldHandlers=null;return}}return null},
|
|
17
|
-
|
|
18
|
-
e:""}());
|
|
19
|
-
b!=null&&$APP.
|
|
20
|
-
"placeholder","placeholder","");$APP.
|
|
21
|
-
new $APP.
|
|
22
|
-
$APP.
|
|
23
|
-
|
|
24
|
-
$APP.
|
|
2
|
+
var GX=function(a){a=(""+$APP.R.i($APP.n(a)?a:"")).trim().toUpperCase();return $APP.B.j(a,"")?"USD":a},HX=function(a,b){try{var c=(new Intl.NumberFormat($APP.B.j(b,"")?"en-US":b,{style:"currency",currency:a})).formatToParts(0),d=$APP.Yd(function(e){return $APP.B.j("currency",e.type)?e.value:null},$APP.xc(c));return $APP.n(d)?d:a}catch(e){return a}},IX=function(a,b){var c=parseFloat(a);if($APP.n(isNaN(c)))return a;try{return(new Intl.NumberFormat($APP.B.j(b,"")?void 0:b,{minimumFractionDigits:2,maximumFractionDigits:2})).format(c)}catch(d){return a}},
|
|
3
|
+
JX=function(a){var b=a.attachShadow({mode:"open"}),c=document.createElement("style"),d=document.createElement("div"),e=document.createElement("label"),f=document.createElement("div"),h=document.createElement("span"),l=document.createElement("input"),m=document.createElement("span"),q=document.createElement("span");c.textContent=":host{display:block;color-scheme:light dark;--x-currency-field-bg:var(--x-color-surface,#ffffff);--x-currency-field-color:var(--x-color-text,#111827);--x-currency-field-border:1px solid var(--x-color-border,#d1d5db);--x-currency-field-border-radius:var(--x-radius-md,6px);--x-currency-field-focus-ring-color:var(--x-color-primary,#2563eb);--x-currency-field-symbol-color:var(--x-color-text-muted,#6b7280);--x-currency-field-label-color:var(--x-color-text-muted,#374151);--x-currency-field-hint-color:var(--x-color-text-muted,#6b7280);--x-currency-field-error-color:var(--x-color-danger,#dc2626);--x-currency-field-disabled-opacity:0.45;}@media (prefers-color-scheme:dark){:host{--x-currency-field-bg:var(--x-color-surface-hover,#1f2937);--x-currency-field-color:var(--x-color-text,#f9fafb);--x-currency-field-border:1px solid var(--x-color-border,#4b5563);--x-currency-field-focus-ring-color:var(--x-color-primary,#3b82f6);--x-currency-field-symbol-color:var(--x-color-text-muted,#9ca3af);--x-currency-field-label-color:var(--x-color-text-muted,#d1d5db);--x-currency-field-hint-color:var(--x-color-text-muted,#9ca3af);--x-currency-field-error-color:var(--x-color-danger,#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
|
+
d.setAttribute("part","field");e.setAttribute("part","label");e.setAttribute("id","label");e.setAttribute("for","input");f.setAttribute("part","input-wrapper");h.setAttribute("part","symbol");h.setAttribute("aria-hidden","true");l.setAttribute("part","input");l.setAttribute("id","input");l.setAttribute("inputmode","decimal");l.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");f.appendChild(h);f.appendChild(l);d.appendChild(e);d.appendChild(f);d.appendChild(m);d.appendChild(q);b.appendChild(c);b.appendChild(d);a.__xCurrencyFieldRefs={field:d,label:e,wrapper:f,symbol:h,input:l,hint:m,error:q}},KX=function(a,b,c,d){var e=a.hasAttribute("error");var f=a.getAttribute("error");f=$APP.n(f)?f:"";var h=a.hasAttribute("required"),l=a.getAttribute("min"),m=a.getAttribute("max");a=parseFloat(d);var q=
|
|
6
|
+
$APP.p(isNaN(a));l=$APP.n(l)?parseFloat(l):null;m=$APP.n(m)?parseFloat(m):null;return $APP.n(e)?b.setValidity({customError:!0},f,c):$APP.n($APP.n(h)?$APP.B.j(d,""):h)?b.setValidity({valueMissing:!0},"Please fill in this field.",c):$APP.M(d,"")&&!q?b.setValidity({badInput:!0},"Please enter a valid number.",c):$APP.n(q?$APP.n(l)?$APP.p(isNaN(l))&&a<l:l:q)?b.setValidity({rangeUnderflow:!0},"Value must be at least "+$APP.R.i(l)+".",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.R.i(m)+".",c):b.setValidity({},"",c)},PX=function(a){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){var c=$APP.k(b,"label"),d=$APP.k(b,"symbol"),e=$APP.k(b,"input"),f=$APP.k(b,"hint");b=$APP.k(b,"error");var h=$APP.Hf([$APP.Bh,LX,$APP.Zm,$APP.Uj,$APP.lk,$APP.Eh,MX,$APP.dj,$APP.vm,$APP.al,$APP.Ch,NX,$APP.ak],[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 l=$APP.H(h);h=$APP.C(l,$APP.ak);var m=$APP.C(l,$APP.Bh),q=$APP.C(l,LX),r=$APP.C(l,$APP.Zm),v=$APP.C(l,$APP.Uj),w=$APP.C(l,$APP.lk),y=$APP.C(l,$APP.Eh),A=$APP.C(l,MX),D=$APP.C(l,$APP.dj),G=$APP.C(l,$APP.vm),I=$APP.C(l,$APP.al),J=$APP.C(l,$APP.Ch);l=$APP.C(l,NX);var K=$APP.n(v)?v:"",ba=$APP.n(w)?w:"",ia=$APP.n(m)?m:"";h=$APP.Hf([$APP.yl,$APP.zj,
|
|
9
|
+
$APP.Ko,$APP.bo,$APP.Gj,$APP.Jo,$APP.Ok,$APP.Fh,$APP.bn,$APP.wm,$APP.Gn,OX,$APP.qm,$APP.X,$APP.Qj,$APP.Y],[$APP.n(A)?A:"",$APP.E(D),$APP.E(I),$APP.n(h)?h:"",typeof w==="string"&&$APP.M(w,""),$APP.n(l)?l:"",$APP.n(r)?r:"",$APP.n(J)?J:"",typeof m==="string"&&$APP.M(m,""),typeof v==="string"&&$APP.M(v,""),ba,GX(q),$APP.n(G)?G:"",ia,K,$APP.E(y)]);m=$APP.wm.i(h);$APP.n(m)?q=null:(v=$APP.H(h),q=$APP.C(v,$APP.Fh),r=$APP.C(v,$APP.yl),v=$APP.C(v,$APP.qm),w=parseFloat(q),y=$APP.M(q,"")&&$APP.p(isNaN(w)),A=
|
|
10
|
+
$APP.M(r,"")?parseFloat(r):null,D=$APP.M(v,"")?parseFloat(v):null,q=$APP.M(q,"")&&!y?"Please enter a valid number.":$APP.n(y?$APP.n(A)?$APP.p(isNaN(A))&&w<A:A:y)?"Value must be at least "+$APP.R.i(r)+".":$APP.n(y?$APP.n(D)?$APP.p(isNaN(D))&&w>D:D:y)?"Value must be at most "+$APP.R.i(v)+".":"");r=q;q=$APP.n(m)?m:$APP.M($APP.n(r)?r:"","");m=$APP.n(m)?$APP.Qj.i(h):$APP.n(r)?r:"";r=$APP.Gj.i(h);v=$APP.bn.i(h);y=OX.i(h);w=$APP.Jo.i(h);d.textContent=HX(y,w);e.name=$APP.Ok.i(h);e.placeholder=$APP.bo.i(h);
|
|
11
|
+
e.disabled=$APP.Y.i(h);e.readOnly=$APP.Ko.i(h);e.required=$APP.zj.i(h);$APP.Zg(e,"aria-required",$APP.n($APP.zj.i(h))?"true":"false");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.B.j(e,a.shadowRoot.activeElement)||(d=$APP.Fh.i(h),e.value=$APP.B.j(d,"")?"":IX(d,w));c.textContent=$APP.X.i(h);$APP.n(v)?c.classList.remove("label-hidden"):
|
|
12
|
+
c.classList.add("label-hidden");f.textContent=$APP.Gn.i(h);$APP.n(r)?f.classList.remove("hint-hidden"):f.classList.add("hint-hidden");b.textContent=m;$APP.n(q)?b.classList.remove("error-hidden"):b.classList.add("error-hidden");$APP.$g(a,"data-invalid",q);c=$APP.k(a,"__xCurrencyFieldInternals");$APP.n(c)?(f=a.getAttribute("value"),a=KX(a,c,e,$APP.n(f)?f:"")):a=null;return a}return null},QX=function(a){return function(){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=
|
|
13
|
+
a.getAttribute("value");return b.value=$APP.n(c)?c:""}return null}},RX=function(a){return function(){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=b.value,d=function(){var f=a.getAttribute("value");return $APP.n(f)?f:""}(),e=function(){var f=a.getAttribute("name");return $APP.n(f)?f:""}();return $APP.bh(a,"x-currency-field-change-request",{name:e,value:c,previousValue:d})?(d=$APP.k(a,"__xCurrencyFieldInternals"),$APP.n(d)&&(d.setFormValue(c),KX(a,d,b,c)),$APP.ah(a,
|
|
14
|
+
"x-currency-field-input",{name:e,value:c})):b.value=d}return null}},SX=function(a){return function(){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=b.value,d=parseFloat(c);c=$APP.n(isNaN(d))?c:""+$APP.R.i(d);var e=function(){var f=a.getAttribute("value");return $APP.n(f)?f:""}();d=function(){var f=a.getAttribute("name");return $APP.n(f)?f:""}();return $APP.bh(a,"x-currency-field-change-request",{name:d,value:c,previousValue:e})?(a.setAttribute("value",c),e=$APP.k(a,
|
|
15
|
+
"__xCurrencyFieldInternals"),$APP.n(e)&&(e.setFormValue(c),KX(a,e,b,c)),$APP.ah(a,"x-currency-field-change",{name:d,value:c})):b.value=e}return null}},TX=function(a){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=QX(a),d=RX(a),e=SX(a);b.addEventListener("focus",c);b.addEventListener("input",d);b.addEventListener("change",e);a.__xCurrencyFieldHandlers={focus:c,input:d,change:e}}},UX=function(a){var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){var c=$APP.k(a,"__xCurrencyFieldHandlers");
|
|
16
|
+
if($APP.n(c)){b=$APP.k(b,"input");b.removeEventListener("focus",$APP.k(c,"focus"));b.removeEventListener("input",$APP.k(c,"input"));b.removeEventListener("change",$APP.k(c,"change"));a.__xCurrencyFieldHandlers=null;return}}return null},VX=function(a,b){$APP.$g(a,"disabled",$APP.E(b));return PX(a)},WX=function(a){a.removeAttribute("value");var b=$APP.k(a,"__xCurrencyFieldRefs");$APP.n(b)&&($APP.k(b,"input").value="");b=$APP.k(a,"__xCurrencyFieldInternals");$APP.n(b)&&b.setFormValue("");return PX(a)},
|
|
17
|
+
XX=function(a){$APP.n($APP.k(a,"__xCurrencyFieldRefs"))||(JX(a),$APP.n(a.attachInternals)&&$APP.fa(a,"__xCurrencyFieldInternals",a.attachInternals()));UX(a);var b=$APP.k(a,"__xCurrencyFieldRefs");if($APP.n(b)){b=$APP.k(b,"input");var c=a.getAttribute("value");GX(a.getAttribute("currency"));var d=function(){var e=a.getAttribute("locale");return $APP.n(e)?e:""}();$APP.n(c)&&(b.value=IX(c,d))}b=$APP.k(a,"__xCurrencyFieldInternals");$APP.n(b)&&b.setFormValue(function(){var e=a.getAttribute("value");return $APP.n(e)?
|
|
18
|
+
e:""}());TX(a);return PX(a)},YX=function(a){return UX(a)},ZX=function(a,b,c,d){$APP.B.j(b,"value")&&(b=$APP.k(a,"__xCurrencyFieldRefs"),$APP.n(b)&&(b=$APP.k(b,"input"),$APP.B.j(b,a.shadowRoot.activeElement)||(GX(a.getAttribute("currency")),c=a.getAttribute("locale"),c=$APP.n(c)?c:"",b.value=d==null||$APP.B.j(d,"")?"":IX(d,c))));return PX(a)},$X=function(a){Object.defineProperty(a,"value",{configurable:!0,enumerable:!0,get:function(){var b=this.getAttribute("value");return $APP.n(b)?b:""},set:function(b){b=
|
|
19
|
+
b!=null&&$APP.M(b)?""+$APP.R.i(b):"";this.setAttribute("value",b);var c=$APP.k(this,"__xCurrencyFieldRefs");if($APP.n(c)){c=$APP.k(c,"input");GX(this.getAttribute("currency"));var d=this.getAttribute("locale");d=$APP.n(d)?d:"";return $APP.B.j(c,this.shadowRoot.activeElement)?null:c.value=$APP.B.j(b,"")?"":IX(b,d)}return null}})},aY=function(a){$X(a);$APP.dh(a,"name","name","");$APP.dh(a,"currency","currency","");$APP.dh(a,"locale","locale","");$APP.dh(a,"min","min","");$APP.dh(a,"max","max","");$APP.dh(a,
|
|
20
|
+
"placeholder","placeholder","");$APP.dh(a,"label","label","");$APP.dh(a,"hint","hint","");$APP.dh(a,"error","error","");$APP.ch(a,"disabled","disabled");$APP.ch(a,"readOnly","readonly");$APP.ch(a,"required","required");a.checkValidity=function(){var b=$APP.k(this,"__xCurrencyFieldInternals");return $APP.n(b)?b.checkValidity():!0};return a.reportValidity=function(){var b=$APP.k(this,"__xCurrencyFieldInternals");return $APP.n(b)?b.reportValidity():!0}},cY=function(){return $APP.Wg("x-currency-field",
|
|
21
|
+
new $APP.P(null,8,[$APP.Mg,bY,$APP.Ng,XX,$APP.Og,YX,$APP.Qg,ZX,$APP.Rg,!0,$APP.Sg,VX,$APP.Tg,WX,$APP.Ug,aY],null))},MX=new $APP.F(null,"min-raw","min-raw",183137548),OX=new $APP.F(null,"currency","currency",-898327568),NX=new $APP.F(null,"locale-raw","locale-raw",385401846),LX=new $APP.F(null,"currency-raw","currency-raw",1169887491);var bY="name value currency locale min max placeholder label hint error disabled required readonly".split(" ");
|
|
22
|
+
$APP.Hf([$APP.yl,$APP.bo,$APP.fl,$APP.Jo,$APP.Ok,$APP.Fh,$APP.Gn,OX,$APP.Wn,$APP.qm,$APP.X,$APP.Qj,$APP.Wl],[new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"min"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"placeholder"],null),new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"disabled"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"locale"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"name"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"value"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"hint"],null),new $APP.P(null,
|
|
23
|
+
2,[$APP.S,$APP.V,$APP.T,"currency"],null),new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"readonly"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"max"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"label"],null),new $APP.P(null,2,[$APP.S,$APP.V,$APP.T,"error"],null),new $APP.P(null,2,[$APP.S,$APP.U,$APP.T,"required"],null)]);
|
|
24
|
+
$APP.Ud(["x-currency-field-change-request",new $APP.P(null,2,[$APP.Un,!0,$APP.Z,new $APP.P(null,3,[$APP.Ok,$APP.V,$APP.Fh,$APP.V,$APP.mm,$APP.V],null)],null),"x-currency-field-input",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,2,[$APP.Ok,$APP.V,$APP.Fh,$APP.V],null)],null),"x-currency-field-change",new $APP.P(null,2,[$APP.Un,!1,$APP.Z,new $APP.P(null,2,[$APP.Ok,$APP.V,$APP.Fh,$APP.V],null)],null)]);$APP.da("baredom.exports.x_currency_field.init",cY);export const init=cY;
|
package/dist/x-date-picker.d.ts
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
export function init(): void;
|
|
4
4
|
|
|
5
|
+
export interface XDatePickerEventMap {
|
|
6
|
+
"x-date-picker-input": CustomEvent<{ value: string; mode: string }>;
|
|
7
|
+
"x-date-picker-change-request": CustomEvent<{ value: string; mode: string; reason: string }>;
|
|
8
|
+
"x-date-picker-change": CustomEvent<{ value: string; mode: string; reason: string }>;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export interface XDatePicker extends HTMLElement {
|
|
6
12
|
mode: string;
|
|
7
13
|
value: string;
|
|
@@ -11,6 +17,27 @@ export interface XDatePicker extends HTMLElement {
|
|
|
11
17
|
readOnly: boolean;
|
|
12
18
|
required: boolean;
|
|
13
19
|
open: boolean;
|
|
20
|
+
|
|
21
|
+
addEventListener<K extends keyof XDatePickerEventMap>(
|
|
22
|
+
type: K,
|
|
23
|
+
listener: (this: XDatePicker, ev: XDatePickerEventMap[K]) => any,
|
|
24
|
+
options?: boolean | AddEventListenerOptions
|
|
25
|
+
): void;
|
|
26
|
+
addEventListener(
|
|
27
|
+
type: string,
|
|
28
|
+
listener: EventListenerOrEventListenerObject,
|
|
29
|
+
options?: boolean | AddEventListenerOptions
|
|
30
|
+
): void;
|
|
31
|
+
removeEventListener<K extends keyof XDatePickerEventMap>(
|
|
32
|
+
type: K,
|
|
33
|
+
listener: (this: XDatePicker, ev: XDatePickerEventMap[K]) => any,
|
|
34
|
+
options?: boolean | EventListenerOptions
|
|
35
|
+
): void;
|
|
36
|
+
removeEventListener(
|
|
37
|
+
type: string,
|
|
38
|
+
listener: EventListenerOrEventListenerObject,
|
|
39
|
+
options?: boolean | EventListenerOptions
|
|
40
|
+
): void;
|
|
14
41
|
}
|
|
15
42
|
|
|
16
43
|
declare global {
|