@warp-ds/elements 2.2.0-next.26 → 2.2.0-next.28

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.
@@ -1,4 +1,4 @@
1
- var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{throw TypeError(s)};var d=(s,e,o,t)=>{for(var a=t>1?void 0:t?ne(e,o):e,b=s.length-1,m;b>=0;b--)(m=s[b])&&(a=(t?m(e,o,a):m(a))||a);return t&&a&&ie(e,o,a),a};var se=(s,e,o)=>e.has(s)||G("Cannot "+o);var B=(s,e,o)=>e.has(s)?G("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,o);var x=(s,e,o)=>(se(s,e,"access private method"),o);var n=function(s,e,o,t){if(o==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!t:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o==="m"?t:o==="a"?t.call(s):t?t.value:e.get(s)},h=function(s,e,o,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!a:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(s,o):a?a.value=o:e.set(s,o),o};function W(s){var e,o,t,a,b,m,k,F,y,w,X,T,Y,E,j,_,A,S,Z;class ae extends s{constructor(...r){var i,c,p;super(...r),e.add(this),this.internals=this.attachInternals(),o.set(this,!1),t.set(this,!1),a.set(this,!1),b.set(this,void 0),m.set(this,void 0),k.set(this,!0),y.set(this,""),w.set(this,()=>{h(this,a,!0,"f"),h(this,o,!0,"f"),n(this,e,"m",_).call(this)}),X.set(this,()=>{h(this,o,!1,"f"),n(this,e,"m",A).call(this,this.shouldFormValueUpdate()?n(this,y,"f"):""),!this.validity.valid&&n(this,a,"f")&&h(this,t,!0,"f");let f=n(this,e,"m",_).call(this);this.validationMessageCallback&&this.validationMessageCallback(f?this.internals.validationMessage:"")}),T.set(this,()=>{var f;n(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,k,!1,"f")),h(this,a,!0,"f"),h(this,t,!0,"f"),n(this,e,"m",_).call(this),(f=this===null||this===void 0?void 0:this.validationMessageCallback)===null||f===void 0||f.call(this,this.showError?this.internals.validationMessage:"")}),Y.set(this,void 0),E.set(this,!1),j.set(this,Promise.resolve()),(i=this.addEventListener)===null||i===void 0||i.call(this,"focus",n(this,w,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"blur",n(this,X,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",n(this,T,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let r=this.validators.map(p=>p.attribute).flat(),i=super.observedAttributes||[];return[...new Set([...i,...r])]}static getValidator(r){return this.validators.find(i=>i.attribute===r)||null}static getValidators(r){return this.validators.filter(i=>{var c;if(i.attribute===r||!((c=i.attribute)===null||c===void 0)&&c.includes(r))return!0})}get form(){return this.internals.form}get showError(){return n(this,e,"m",_).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(r,i,c){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,r,i,c);let V=this.constructor.getValidators(r);V!=null&&V.length&&this.validationTarget&&this.setValue(n(this,y,"f"))}setValue(r){var i;h(this,t,!1,"f"),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,""),h(this,y,r,"f");let p=this.shouldFormValueUpdate()?r:null;this.internals.setFormValue(p),n(this,e,"m",A).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),n(this,e,"m",_).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(r=>r(n(this,j,"f")))}formResetCallback(){var r,i;h(this,a,!1,"f"),h(this,t,!1,"f"),n(this,e,"m",_).call(this),(r=this.resetFormControl)===null||r===void 0||r.call(this),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,n(this,e,"m",_).call(this)?this.validationMessage:"")}}return o=new WeakMap,t=new WeakMap,a=new WeakMap,b=new WeakMap,m=new WeakMap,k=new WeakMap,y=new WeakMap,w=new WeakMap,X=new WeakMap,T=new WeakMap,Y=new WeakMap,E=new WeakMap,j=new WeakMap,e=new WeakSet,F=function(){let r=this.getRootNode(),i=`${this.localName}[name="${this.getAttribute("name")}"]`;return r.querySelectorAll(i)},_=function(){if(this.hasAttribute("disabled"))return!1;let r=n(this,t,"f")||n(this,a,"f")&&!this.validity.valid&&!n(this,o,"f");return r&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),r},A=function(r){let i=this.constructor,c={},p=i.validators,f=[],V=p.some(g=>g.isValid instanceof Promise);n(this,E,"f")||(h(this,j,new Promise(g=>{h(this,Y,g,"f")}),"f"),h(this,E,!0,"f")),n(this,b,"f")&&(n(this,b,"f").abort(),h(this,m,n(this,b,"f"),"f"));let M=new AbortController;h(this,b,M,"f");let P,H=!1;p.length&&(p.forEach(g=>{let R=g.key||"customError",z=g.isValid(this,r,M.signal);z instanceof Promise?(f.push(z),z.then(D=>{D!=null&&(c[R]=!D,P=n(this,e,"m",Z).call(this,g,r),n(this,e,"m",S).call(this,c,P))})):(c[R]=!z,this.validity[R]!==!z&&(H=!0),!z&&!P&&(P=n(this,e,"m",Z).call(this,g,r)))}),Promise.allSettled(f).then(()=>{var g;M!=null&&M.signal.aborted||(h(this,E,!1,"f"),(g=n(this,Y,"f"))===null||g===void 0||g.call(this))}),(H||!V)&&n(this,e,"m",S).call(this,c,P))},S=function(r,i){if(this.validationTarget)this.internals.setValidity(r,i,this.validationTarget),h(this,k,!1,"f");else{if(this.internals.setValidity(r,i),this.internals.validity.valid)return;h(this,k,!0,"f")}},Z=function(r,i){if(this.validityCallback){let c=this.validityCallback(r.key||"customError");if(c)return c}return r.message instanceof Function?r.message(this,i):r.message},ae}import{html as I,LitElement as re,nothing as U}from"lit";import{property as C,query as oe,state as v}from"lit/decorators.js";import{classMap as ce}from"lit/directives/class-map.js";import{ifDefined as q}from"lit/directives/if-defined.js";import{css as J}from"lit";var K=J`
1
+ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var H=s=>{throw TypeError(s)};var d=(s,e,o,n)=>{for(var t=n>1?void 0:n?ne(e,o):e,b=s.length-1,m;b>=0;b--)(m=s[b])&&(t=(n?m(e,o,t):m(t))||t);return n&&t&&ie(e,o,t),t};var se=(s,e,o)=>e.has(s)||H("Cannot "+o);var B=(s,e,o)=>e.has(s)?H("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,o);var f=(s,e,o)=>(se(s,e,"access private method"),o);var i=function(s,e,o,n){if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o==="m"?n:o==="a"?n.call(s):n?n.value:e.get(s)},h=function(s,e,o,n,t){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!t)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!t:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?t.call(s,o):t?t.value=o:e.set(s,o),o};function W(s){var e,o,n,t,b,m,x,E,k,_,z,L,j,$,I,y,S,T,Z;class ae extends s{constructor(...r){var a,c,p;super(...r),e.add(this),this.internals=this.attachInternals(),o.set(this,!1),n.set(this,!1),t.set(this,!1),b.set(this,void 0),m.set(this,void 0),x.set(this,!0),k.set(this,""),_.set(this,()=>{h(this,t,!0,"f"),h(this,o,!0,"f"),i(this,e,"m",y).call(this)}),z.set(this,()=>{h(this,o,!1,"f"),i(this,e,"m",S).call(this,this.shouldFormValueUpdate()?i(this,k,"f"):""),!this.validity.valid&&i(this,t,"f")&&h(this,n,!0,"f");let w=i(this,e,"m",y).call(this);this.validationMessageCallback&&this.validationMessageCallback(w?this.internals.validationMessage:"")}),L.set(this,()=>{var w;i(this,x,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,x,!1,"f")),h(this,t,!0,"f"),h(this,n,!0,"f"),i(this,e,"m",y).call(this),(w=this===null||this===void 0?void 0:this.validationMessageCallback)===null||w===void 0||w.call(this,this.showError?this.internals.validationMessage:"")}),j.set(this,void 0),$.set(this,!1),I.set(this,Promise.resolve()),(a=this.addEventListener)===null||a===void 0||a.call(this,"focus",i(this,_,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"blur",i(this,z,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",i(this,L,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let r=this.validators.map(p=>p.attribute).flat(),a=super.observedAttributes||[];return[...new Set([...a,...r])]}static getValidator(r){return this.validators.find(a=>a.attribute===r)||null}static getValidators(r){return this.validators.filter(a=>{var c;if(a.attribute===r||!((c=a.attribute)===null||c===void 0)&&c.includes(r))return!0})}get form(){return this.internals.form}get showError(){return i(this,e,"m",y).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(r,a,c){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,r,a,c);let M=this.constructor.getValidators(r);M!=null&&M.length&&this.validationTarget&&this.setValue(i(this,k,"f"))}setValue(r){var a;h(this,n,!1,"f"),(a=this.validationMessageCallback)===null||a===void 0||a.call(this,""),h(this,k,r,"f");let p=this.shouldFormValueUpdate()?r:null;this.internals.setFormValue(p),i(this,e,"m",S).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),i(this,e,"m",y).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(r=>r(i(this,I,"f")))}formResetCallback(){var r,a;h(this,t,!1,"f"),h(this,n,!1,"f"),i(this,e,"m",y).call(this),(r=this.resetFormControl)===null||r===void 0||r.call(this),(a=this.validationMessageCallback)===null||a===void 0||a.call(this,i(this,e,"m",y).call(this)?this.validationMessage:"")}}return o=new WeakMap,n=new WeakMap,t=new WeakMap,b=new WeakMap,m=new WeakMap,x=new WeakMap,k=new WeakMap,_=new WeakMap,z=new WeakMap,L=new WeakMap,j=new WeakMap,$=new WeakMap,I=new WeakMap,e=new WeakSet,E=function(){let r=this.getRootNode(),a=`${this.localName}[name="${this.getAttribute("name")}"]`;return r.querySelectorAll(a)},y=function(){if(this.hasAttribute("disabled"))return!1;let r=i(this,n,"f")||i(this,t,"f")&&!this.validity.valid&&!i(this,o,"f");return r&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),r},S=function(r){let a=this.constructor,c={},p=a.validators,w=[],M=p.some(u=>u.isValid instanceof Promise);i(this,$,"f")||(h(this,I,new Promise(u=>{h(this,j,u,"f")}),"f"),h(this,$,!0,"f")),i(this,b,"f")&&(i(this,b,"f").abort(),h(this,m,i(this,b,"f"),"f"));let Y=new AbortController;h(this,b,Y,"f");let P,G=!1;p.length&&(p.forEach(u=>{let D=u.key||"customError",C=u.isValid(this,r,Y.signal);C instanceof Promise?(w.push(C),C.then(R=>{R!=null&&(c[D]=!R,P=i(this,e,"m",Z).call(this,u,r),i(this,e,"m",T).call(this,c,P))})):(c[D]=!C,this.validity[D]!==!C&&(G=!0),!C&&!P&&(P=i(this,e,"m",Z).call(this,u,r)))}),Promise.allSettled(w).then(()=>{var u;Y!=null&&Y.signal.aborted||(h(this,$,!1,"f"),(u=i(this,j,"f"))===null||u===void 0||u.call(this))}),(G||!M)&&i(this,e,"m",T).call(this,c,P))},T=function(r,a){if(this.validationTarget)this.internals.setValidity(r,a,this.validationTarget),h(this,x,!1,"f");else{if(this.internals.setValidity(r,a),this.internals.validity.valid)return;h(this,x,!0,"f")}},Z=function(r,a){if(this.validityCallback){let c=this.validityCallback(r.key||"customError");if(c)return c}return r.message instanceof Function?r.message(this,a):r.message},ae}import{html as X,LitElement as re,nothing as U}from"lit";import{property as F,query as oe,state as v}from"lit/decorators.js";import{ifDefined as q}from"lit/directives/if-defined.js";import{css as J}from"lit";var K=J`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -2454,6 +2454,7 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2454
2454
  background-color: transparent;
2455
2455
  grid-area: slider;
2456
2456
  height: 44px; /* touch target */
2457
+ margin-left: 0;
2457
2458
  pointer-events: none; /* let clicks pass through for range slider where we place two inputs over each other */
2458
2459
  }
2459
2460
 
@@ -2463,14 +2464,6 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2463
2464
  height: var(--w-slider-track-height);
2464
2465
  }
2465
2466
 
2466
- .w-slider-thumb__range:hover::-webkit-slider-thumb {
2467
- background: var(--w-s-color-background-primary-hover);
2468
- }
2469
-
2470
- .w-slider-thumb__range:hover::-moz-range-thumb {
2471
- background: var(--w-s-color-background-primary-hover);
2472
- }
2473
-
2474
2467
  /*
2475
2468
  Use anchor positioning to place the tooltip target in relation to the slider thumb.
2476
2469
  We use a polyfill to bring support to older Safari, Firefox at time of writing.
@@ -2479,11 +2472,12 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2479
2472
  anchor-name: --thumb;
2480
2473
 
2481
2474
  appearance: none;
2475
+ cursor: pointer;
2482
2476
  background: var(--w-s-color-background-primary);
2483
2477
  border-radius: 50%;
2484
2478
  height: var(--w-slider-thumb-size);
2485
2479
  margin-top: calc(-1 * calc(var(--w-slider-thumb-offset) - calc(var(--w-slider-track-height) / 2)));
2486
- pointer-events: auto;
2480
+ pointer-events: initial;
2487
2481
  width: var(--w-slider-thumb-size);
2488
2482
  z-index: 1;
2489
2483
  }
@@ -2492,6 +2486,7 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2492
2486
  anchor-name: --thumb;
2493
2487
 
2494
2488
  appearance: none;
2489
+ cursor: pointer;
2495
2490
  background: var(--w-s-color-background-primary);
2496
2491
  border-radius: 50%;
2497
2492
  border-color: transparent;
@@ -2500,32 +2495,54 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2500
2495
  pointer-events: initial;
2501
2496
  width: var(--w-slider-thumb-size);
2502
2497
  z-index: 1;
2498
+
2499
+ box-shadow: none;
2503
2500
  }
2504
2501
 
2505
- .w-slider-thumb__tooltip {
2506
- display: none;
2507
- position: absolute;
2502
+ .w-slider-thumb__range:active::-webkit-slider-thumb,
2503
+ .w-slider-thumb__range:hover::-webkit-slider-thumb {
2504
+ background: var(--w-s-color-background-primary-hover);
2505
+ box-shadow: var(--w-shadow-slider-handle-hover);
2506
+ }
2508
2507
 
2509
- background-color: var(--w-s-color-background-inverted);
2510
- color: var(--w-s-color-text-inverted-static);
2511
- border-color: var(--w-s-color-background-inverted);
2508
+ .w-slider-thumb__range:focus,
2509
+ .w-slider-thumb__range:focus-visible {
2510
+ outline: none;
2511
+ }
2512
2512
 
2513
- padding: 4px 8px;
2514
- border-radius: 4px;
2515
- font-size: 12px;
2516
- white-space: nowrap;
2517
- z-index: 1;
2513
+ .w-slider-thumb__range:focus-visible::-webkit-slider-thumb {
2514
+ outline: 2px solid var(--w-s-color-border-focus);
2515
+ outline-offset: var(--w-outline-offset, 1px);
2516
+ box-shadow: none;
2517
+ }
2518
2518
 
2519
- position-anchor: --thumb;
2519
+ .w-slider-thumb__range:active::-moz-range-thumb,
2520
+ .w-slider-thumb__range:hover::-moz-range-thumb {
2521
+ background: var(--w-s-color-background-primary-hover);
2522
+ box-shadow: var(--w-shadow-slider-handle-hover);
2523
+ }
2520
2524
 
2521
- bottom: calc(anchor(top) + 5px);
2522
- justify-self: anchor-center;
2525
+ .w-slider-thumb__range:focus-visible::-moz-range-thumb {
2526
+ outline: 2px solid var(--w-s-color-border-focus);
2527
+ outline-offset: var(--w-outline-offset, 1px);
2528
+ box-shadow: none;
2523
2529
  }
2524
2530
 
2525
- .w-slider-thumb__tooltip--visible {
2531
+ .w-slider-thumb__tooltip-target {
2526
2532
  display: block;
2533
+ pointer-events: none;
2534
+ position: absolute;
2535
+ border: 2px solid transparent;
2536
+ border-radius: 20px;
2537
+ width: 8px;
2538
+ height: 8px;
2539
+ position-anchor: --thumb;
2540
+ position-area: center; /* Position the tooltip target right on the range thumb */
2527
2541
  }
2528
2542
 
2543
+ /* Uncomment this to debug the invisible anchor target */
2544
+ /* .w-slider-thumb__tooltip-target { border-color: lime; } */
2545
+
2529
2546
  .w-slider-thumb__from-marker,
2530
2547
  .w-slider-thumb__to-marker {
2531
2548
  margin-inline: 2px; /* visual alignment with input border, slider thumb */
@@ -2554,8 +2571,21 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2554
2571
  grid-column: 1 / 2; /* Range sliders should leave the gap empty. */
2555
2572
  }
2556
2573
 
2557
- :host([name='from']) .w-slider-thumb__range::-webkit-slider-thumb {
2558
- margin-left: calc(-1px * var(--thumb-offset) / 2);
2574
+ :host([name='from']) .w-slider-thumb__range {
2575
+ margin-left: var(--w-slider-thumb-size);
2576
+ }
2577
+
2578
+ :host([name='to']) .w-slider-thumb__range {
2579
+ margin-right: var(--w-slider-thumb-size);
2580
+ }
2581
+
2582
+ :host([name='from']) .w-slider-thumb__range::-webkit-slider-thumb,
2583
+ :host([name='from']) .w-slider-thumb__tooltip-target {
2584
+ transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
2585
+ }
2586
+
2587
+ :host([name='from']) .w-slider-thumb__range::-moz-range-thumb {
2588
+ transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
2559
2589
  }
2560
2590
 
2561
2591
  :host([name='to']) .w-slider-thumb__textfield {
@@ -2563,58 +2593,67 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2563
2593
  grid-column: 3 / 4;
2564
2594
  }
2565
2595
 
2596
+ :host([name='to']) .w-slider-thumb__tooltip-target,
2566
2597
  :host([name='to']) .w-slider-thumb__range::-webkit-slider-thumb {
2567
- margin-left: calc(1px * var(--thumb-offset) / 2);
2598
+ transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
2568
2599
  }
2569
- `;import{css as de}from"lit";var ee=de`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.hidden{display:none}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}`;var te={};var u,N,L,O,l=class extends W(re){constructor(){super(...arguments);B(this,u);this._invalid=!1;this._showTooltip=!1;this.anchorPositioningStyleElement=null}async connectedCallback(){var o;if(super.connectedCallback(),"anchorName"in document.documentElement.style)await this.updateComplete;else{let t=te.url.substring(0,te.url.lastIndexOf("/"));try{let[{default:a}]=await Promise.all([import(`${t}/oddbird-css-anchor-positioning.js`),this.updateComplete]);this.anchorPositioningStyleElement||(this.anchorPositioningStyleElement=document.createElement("style"),this.shadowRoot.prepend(this.anchorPositioningStyleElement)),this.anchorPositioningStyleElement.textContent=`
2600
+
2601
+ :host([name='to']) .w-slider-thumb__range::-moz-range-thumb {
2602
+ transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
2603
+ }
2604
+ `;import{css as de}from"lit";var ee=de`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.hidden{display:none}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}`;var te={};var g,N,A,O,l=class extends W(re){constructor(){super(...arguments);B(this,g);this._invalid=!1;this._showTooltip=!1;this.anchorPositioningStyleElement=null}async connectedCallback(){var o;if(super.connectedCallback(),"anchorName"in document.documentElement.style)await this.updateComplete;else{let n=te.url.substring(0,te.url.lastIndexOf("/"));try{let[{default:t}]=await Promise.all([import(`${n}/oddbird-css-anchor-positioning.js`),this.updateComplete]);this.anchorPositioningStyleElement||(this.anchorPositioningStyleElement=document.createElement("style"),this.shadowRoot.prepend(this.anchorPositioningStyleElement)),this.anchorPositioningStyleElement.textContent=`
2570
2605
  /*
2571
- * The polyfill can only anchor to ::before and ::after pseudo elements.
2606
+ * The polyfill can only anchor to ::before and ::after pseudo elements, not the pseudo element slider thumb.
2572
2607
  * We work around that by recreating a transparent version of the active range
2573
2608
  * so that we can position relative to that, without crossing the shadow root boundary.
2574
2609
  */
2575
- #anchor {
2576
- anchor-name: --polyfilled-thumb;
2577
-
2578
- /* We have to compensate for the width of the thumb inside the track to find its center. */
2579
- --_value: var(--_to-as-percent-of-max);
2580
- --_offset-origin: 50; /* at this point the offset is zero */
2581
- --_thumb-offset-percent: calc(var(--_value) - var(--_offset-origin));
2582
- --_thumb-offset-pixels: calc(var(--w-slider-thumb-size) * calc(var(--_thumb-offset-percent) / 100));
2583
-
2610
+ .polyfill-range {
2584
2611
  align-self: center;
2585
2612
  background: transparent;
2613
+ height: var(--w-slider-track-active-height);
2586
2614
  position: absolute;
2615
+ padding-inline-start: var(--active-range-inline-start-padding, 0);
2616
+ padding-inline-end: var(--active-range-inline-end-padding, 0);
2587
2617
  top: var(--_range-top);
2588
- height: var(--w-slider-track-active-height);
2589
2618
  left: 0;
2590
2619
  right: 0;
2591
2620
  grid-area: slider;
2592
- margin-left: calc(var(--_blank-values-before) * 1%);
2593
- width: calc(calc(var(--_filled-values) * 1%) - var(--_thumb-offset-pixels));
2594
2621
  }
2595
2622
 
2596
- #target {
2597
- position: absolute;
2623
+ .polyfill-active-range {
2624
+ anchor-name: --polyfilled-thumb;
2598
2625
 
2599
- position-anchor: --polyfilled-thumb;
2600
- bottom: calc(anchor(top) + 16px);
2601
- left: anchor(--polyfilled-thumb right);
2626
+ box-sizing: content-box;
2627
+ background: transparent;
2628
+ height: var(--w-slider-track-active-height);
2629
+
2630
+ border-start-start-radius: var(--active-range-border-radius, 0);
2631
+ border-end-start-radius: var(--active-range-border-radius, 0);
2632
+
2633
+ margin-left: calc(calc(var(--_blank-values-before) * 1%) - var(--active-range-inline-start-padding, 0px));
2634
+ width: calc(calc(var(--_filled-values) * 1%) + var(--active-range-inline-end-padding, 0px));
2602
2635
  }
2603
2636
 
2604
- :host([name='from']) #anchor {
2605
- --_value: var(--_from-as-percent-of-max);
2637
+ #target {
2638
+ position: absolute;
2639
+ top: anchor(--polyfilled-thumb top);
2640
+ right: anchor(--polyfilled-thumb right);
2641
+ margin-right: 12px;
2642
+ }
2606
2643
 
2607
- margin-left: calc(calc(var(--_blank-values-before) * 1%) - var(--_thumb-offset-pixels));
2608
- width: calc(calc(var(--_filled-values) * 1%) - var(--w-slider-thumb-size));
2644
+ :host([name='from']) .polyfill-active-range {
2645
+ margin-left: calc(calc(var(--_blank-values-before) * 1%) - var(--active-range-inline-start-padding, 0px));
2646
+ width: calc(calc(var(--_filled-values) * 1%) + var(--active-range-inline-end-padding, 0px));
2609
2647
  }
2610
2648
 
2611
2649
  :host([name='from']) #target {
2612
2650
  left: anchor(--polyfilled-thumb left);
2651
+ margin-left: 38px;
2613
2652
  }
2614
- `,await a({roots:[this.shadowRoot],elements:[this.anchorPositioningStyleElement]})}catch(a){console.error(new Error("Error registering the CSS anchor positioning polyfill. The UI will look broken.",{cause:a}))}}this.range.value=(o=this.value)!=null?o:this.max}updated(o){if(o.has("value")&&(this.setValue(this.value),!("anchorName"in document.documentElement.style))){let t=this.shadowRoot.querySelector("#target"),a=getComputedStyle(t).getPropertyValue("width"),b=Number.parseFloat(a.replace("px",""))/2;t.style.setProperty("margin-left",`-${b}px`)}o.has("_invalid")&&this.dispatchEvent(new CustomEvent("slidervalidity",{bubbles:!0,detail:{invalid:this._invalid}}))}render(){return I`
2653
+ `,await t({roots:[this.shadowRoot],elements:[this.anchorPositioningStyleElement]})}catch(t){console.error(new Error("Error registering the CSS anchor positioning polyfill. The UI will look broken.",{cause:t}))}}this.range.value=(o=this.value)!=null?o:this.max}updated(o){o.has("value")&&this.setValue(this.value),o.has("_invalid")&&this.dispatchEvent(new CustomEvent("slidervalidity",{bubbles:!0,detail:{invalid:this._invalid}}))}render(){return X`
2615
2654
  <div class="w-slider-thumb">
2616
2655
  <label for="range">${this.label}</label>
2617
- ${"anchorName"in document.documentElement.style?U:I`<div id="anchor"></div>`}
2656
+ ${"anchorName"in document.documentElement.style?U:X`<div class="polyfill-range"><div class="polyfill-active-range"></div></div>`}
2618
2657
  <input
2619
2658
  id="range"
2620
2659
  aria-label="${this.ariaLabel}"
@@ -2627,13 +2666,13 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2627
2666
  name="${this.name}"
2628
2667
  step="${q(this.step?this.step:void 0)}"
2629
2668
  ?disabled="${this.disabled||this.forceDisabled}"
2630
- @mousedown="${x(this,u,N)}"
2631
- @mouseup="${x(this,u,L)}"
2632
- @touchstart="${x(this,u,N)}"
2633
- @touchend="${x(this,u,L)}"
2634
- @focus="${x(this,u,N)}"
2635
- @blur="${x(this,u,L)}"
2636
- @input="${x(this,u,O)}" />
2669
+ @mousedown="${f(this,g,N)}"
2670
+ @mouseup="${f(this,g,A)}"
2671
+ @touchstart="${f(this,g,N)}"
2672
+ @touchend="${f(this,g,A)}"
2673
+ @focus="${f(this,g,N)}"
2674
+ @blur="${f(this,g,A)}"
2675
+ @input="${f(this,g,O)}" />
2637
2676
 
2638
2677
  <span class="w-slider-thumb__from-marker">${this.formatter?this.formatter(this.min):this.min} ${this.suffix}</span>
2639
2678
  <span class="w-slider-thumb__to-marker">${this.formatter?this.formatter(this.max):this.max} ${this.suffix}</span>
@@ -2648,16 +2687,19 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var G=s=>{th
2648
2687
  .formatter=${this.formatter}
2649
2688
  .value="${this.value}"
2650
2689
  ?invalid="${this.forceInvalid||this._invalid}"
2651
- @input="${x(this,u,O)}">
2652
- ${this.suffix?I`<w-affix slot="suffix" label="${this.suffix}"></w-affix>`:U}
2690
+ @input="${f(this,g,O)}">
2691
+ ${this.suffix?X`<w-affix slot="suffix" label="${this.suffix}"></w-affix>`:U}
2653
2692
  </w-textfield>
2654
2693
 
2655
- <div id="target" class="${ce({"w-slider-thumb__tooltip":!0,"w-slider-thumb__tooltip--visible":this._showTooltip})}">
2656
- ${this.value?this.formatter?this.formatter(this.value):this.value:0}${this.suffix?I`&nbsp;${this.suffix}`:U}
2657
- </div>
2694
+ <w-attention tooltip placement="top" flip distance="24" .show="${this._showTooltip}">
2695
+ <output id="target" class="w-slider-thumb__tooltip-target" slot="target"></output>
2696
+ <span slot="message">
2697
+ ${this.value?this.formatter?this.formatter(this.value):this.value:0}${this.suffix?X`&nbsp;${this.suffix}`:U}
2698
+ </span>
2699
+ </w-attention>
2658
2700
 
2659
2701
  <!-- aria-description is still not recommended for general use, so make a visually hidden element and refer to it with aria-describedby -->
2660
2702
  <span class="sr-only" id="aria-description">${this.ariaDescription}</span>
2661
2703
  </div>
2662
- `}};u=new WeakSet,N=function(){this._showTooltip=!0},L=function(){this._showTooltip=!1},O=function(o){let t=o.currentTarget.tagName==="W-TEXTFIELD";if(o instanceof CustomEvent)return;let a=o.currentTarget.value;if(a==="")return this.required&&(this._invalid=!0),!1;t&&this._invalid&&(this._invalid=!1);let b=Number.parseInt(a),m=Number.parseInt(this.max),k=Number.parseInt(this.min);(b>m||b<k)&&(this._invalid=!0);let F=!1;if(this.slot){let y=getComputedStyle(this);if(this.slot==="from"){let w=y.getPropertyValue("--to");if(b>Number.parseInt(w)){if(t)return this._invalid=!0,!1;F=!0,this.value=w}}else{let w=y.getPropertyValue("--from");if(b<Number.parseInt(w)){if(t)return this._invalid=!0,!1;F=!0,this.value=w}}}return F?(o.preventDefault(),this.range.value=this.value,!1):(this.value=a,!0)},l.shadowRootOptions={...re.shadowRootOptions,delegatesFocus:!0},l.styles=[K,ee,Q],d([C({attribute:"aria-label",reflect:!0})],l.prototype,"ariaLabel",2),d([C({attribute:"aria-description",reflect:!0})],l.prototype,"ariaDescription",2),d([C({reflect:!0})],l.prototype,"label",2),d([C({reflect:!0})],l.prototype,"name",2),d([C({reflect:!0})],l.prototype,"value",2),d([C({type:Boolean,reflect:!0})],l.prototype,"disabled",2),d([v()],l.prototype,"markers",2),d([v()],l.prototype,"required",2),d([v()],l.prototype,"step",2),d([v()],l.prototype,"min",2),d([v()],l.prototype,"max",2),d([v()],l.prototype,"suffix",2),d([v()],l.prototype,"forceDisabled",2),d([v()],l.prototype,"forceInvalid",2),d([v()],l.prototype,"formatter",2),d([oe('input[type="range"]')],l.prototype,"range",2),d([oe("w-textfield")],l.prototype,"textfield",2),d([v()],l.prototype,"_invalid",2),d([v()],l.prototype,"_showTooltip",2);customElements.get("w-slider-thumb")||customElements.define("w-slider-thumb",l);export{l as WarpSliderThumb};
2704
+ `}};g=new WeakSet,N=function(){this._showTooltip=!0,this.shadowRoot.querySelector("w-attention").handleDone()},A=function(){this._showTooltip=!1},O=function(o){let n=o.currentTarget.tagName==="W-TEXTFIELD";if(o instanceof CustomEvent)return;let t=o.currentTarget.value;if(t==="")return this.required&&(this._invalid=!0),!1;this._invalid&&(this._invalid=!1);let b=Number.parseInt(t),m=Number.parseInt(this.max),x=Number.parseInt(this.min);(b>m||b<x)&&(this._invalid=!0);let E=!1;if(this.slot){let k=getComputedStyle(this),_=k.getPropertyValue("--to"),z=k.getPropertyValue("--from");if(n&&(b>Number.parseInt(_)||b<Number.parseInt(z)))return this._invalid=!0,!1;this.slot==="from"?b>Number.parseInt(_)&&(E=!0,this.value=_):b<Number.parseInt(z)&&(E=!0,this.value=z)}return E?(o.preventDefault(),this.range.value=this.value,!1):(this.value=t,this.shadowRoot.querySelector("w-attention").handleDone(),!0)},l.shadowRootOptions={...re.shadowRootOptions,delegatesFocus:!0},l.styles=[K,ee,Q],d([F({attribute:"aria-label",reflect:!0})],l.prototype,"ariaLabel",2),d([F({attribute:"aria-description",reflect:!0})],l.prototype,"ariaDescription",2),d([F({reflect:!0})],l.prototype,"label",2),d([F({reflect:!0})],l.prototype,"name",2),d([F({reflect:!0})],l.prototype,"value",2),d([F({type:Boolean,reflect:!0})],l.prototype,"disabled",2),d([v()],l.prototype,"markers",2),d([v()],l.prototype,"required",2),d([v()],l.prototype,"step",2),d([v()],l.prototype,"min",2),d([v()],l.prototype,"max",2),d([v()],l.prototype,"suffix",2),d([v()],l.prototype,"forceDisabled",2),d([v()],l.prototype,"forceInvalid",2),d([v()],l.prototype,"formatter",2),d([oe('input[type="range"]')],l.prototype,"range",2),d([oe("w-textfield")],l.prototype,"textfield",2),d([v()],l.prototype,"_invalid",2),d([v()],l.prototype,"_showTooltip",2);customElements.get("w-slider-thumb")||customElements.define("w-slider-thumb",l);export{l as WarpSliderThumb};
2663
2705
  //# sourceMappingURL=slider-thumb.js.map