@warp-ds/elements 2.3.0-next.10 → 2.3.0-next.12

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.
@@ -3,7 +3,7 @@ import { StoryObj } from '@storybook/react';
3
3
  import { Select } from './react';
4
4
  declare const _default: {
5
5
  title: string;
6
- render(args: Omit<React.HTMLAttributes<import(".").WarpSelect>, "label" | "onchange" | "autoFocus" | "onChange" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "form" | "disabled" | "name" | "value" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "resetFormControl" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "invalid" | "always" | "hint" | "optional" | "readOnly" | "_options" | "_setValue" | "handleKeyDown"> & {
6
+ render(args: Omit<React.HTMLAttributes<import(".").WarpSelect>, "label" | "onchange" | "autoFocus" | "onChange" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "form" | "disabled" | "name" | "value" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "resetFormControl" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate" | "invalid" | "helpText" | "always" | "hint" | "optional" | "readOnly" | "readonly" | "_options" | "_setValue" | "handleKeyDown"> & {
7
7
  onChange?: (e: Event) => void;
8
8
  onchange?: (e: Event) => void;
9
9
  } & Partial<Omit<import(".").WarpSelect, keyof HTMLElement>> & React.RefAttributes<import(".").WarpSelect>): React.JSX.Element;
@@ -8,7 +8,7 @@ declare const meta: Meta<typeof args>;
8
8
  export default meta;
9
9
  type Story = StoryObj<typeof args>;
10
10
  export declare const Default: Story;
11
- export declare const Hint: Story;
11
+ export declare const HelpText: Story;
12
12
  export declare const Invalid: Story;
13
13
  export declare const Disabled: Story;
14
14
  export declare const ReadOnly: Story;
@@ -29,18 +29,17 @@ export const Default = {
29
29
  label: 'Berries',
30
30
  },
31
31
  };
32
- export const Hint = {
32
+ export const HelpText = {
33
33
  args: {
34
34
  label: 'Berries',
35
- always: true,
36
- hint: 'We assume this is your jam preference'
35
+ 'help-text': 'We assume this is your jam preference'
37
36
  },
38
37
  };
39
38
  export const Invalid = {
40
39
  args: {
41
40
  label: 'Berries',
42
41
  invalid: true,
43
- hint: 'Wrong choice'
42
+ 'help-text': 'Wrong choice'
44
43
  },
45
44
  };
46
45
  export const Disabled = {
@@ -21,6 +21,9 @@ declare class WarpSliderThumb extends WarpSliderThumb_base {
21
21
  name: string;
22
22
  value: string;
23
23
  disabled: boolean;
24
+ invalid: boolean;
25
+ /** Set by `<w-slider>` */
26
+ allowValuesOutsideRange: boolean;
24
27
  /** Set by `<w-slider>` */
25
28
  markers: string;
26
29
  /** Set by `<w-slider>` */
@@ -33,24 +36,25 @@ declare class WarpSliderThumb extends WarpSliderThumb_base {
33
36
  max: string;
34
37
  /** Set by `<w-slider>` */
35
38
  suffix: string;
36
- /** @internal */
37
- forceDisabled: boolean;
38
- /** @internal */
39
- forceInvalid: boolean;
40
39
  /** JS hook to help you format the numeric value how you want. */
41
- formatter: (value: string) => string;
40
+ formatter: (value: string, type: 'from' | 'to') => string;
42
41
  range: HTMLInputElement;
43
42
  textfield: WarpTextField;
44
43
  /** @internal */
45
- _invalid: boolean;
46
- /** @internal */
47
44
  _showTooltip: boolean;
45
+ /** @internal */
46
+ _inputHasFocus: boolean;
48
47
  /**
49
48
  * Reference to the anchor positioning style element used by the polyfill.
50
49
  * @internal
51
50
  */
52
51
  anchorPositioningStyleElement: HTMLStyleElement | null;
53
52
  connectedCallback(): Promise<void>;
53
+ get boundaryValue(): string;
54
+ /** Value to display in the textfield (shows boundary when focused on empty value) */
55
+ get textFieldDisplayValue(): string;
56
+ /** Value to display in the tooltip */
57
+ get tooltipDisplayValue(): string | number;
54
58
  updated(changedProperties: PropertyValues<this>): void;
55
59
  render(): import("lit").TemplateResult<1>;
56
60
  }
@@ -1,4 +1,4 @@
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`
1
+ var ne=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var G=s=>{throw TypeError(s)};var d=(s,r,e,o)=>{for(var a=o>1?void 0:o?se(r,e):r,p=s.length-1,m;p>=0;p--)(m=s[p])&&(a=(o?m(r,e,a):m(a))||a);return o&&a&&ne(r,e,a),a};var le=(s,r,e)=>r.has(s)||G("Cannot "+e);var W=(s,r,e)=>r.has(s)?G("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,e);var v=(s,r,e)=>(le(s,r,"access private method"),e);var n=function(s,r,e,o){if(e==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?s!==r||!o:!r.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?o:e==="a"?o.call(s):o?o.value:r.get(s)},h=function(s,r,e,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?s!==r||!a:!r.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(s,e):a?a.value=e:r.set(s,e),e};function J(s){var r,e,o,a,p,m,w,Y,x,V,F,E,f,P,A,_,O,D,L;class ie extends s{constructor(...t){var i,c,b;super(...t),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),o.set(this,!1),a.set(this,!1),p.set(this,void 0),m.set(this,void 0),w.set(this,!0),x.set(this,""),V.set(this,()=>{h(this,a,!0,"f"),h(this,e,!0,"f"),n(this,r,"m",_).call(this)}),F.set(this,()=>{h(this,e,!1,"f"),n(this,r,"m",O).call(this,this.shouldFormValueUpdate()?n(this,x,"f"):""),!this.validity.valid&&n(this,a,"f")&&h(this,o,!0,"f");let k=n(this,r,"m",_).call(this);this.validationMessageCallback&&this.validationMessageCallback(k?this.internals.validationMessage:"")}),E.set(this,()=>{var k;n(this,w,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,w,!1,"f")),h(this,a,!0,"f"),h(this,o,!0,"f"),n(this,r,"m",_).call(this),(k=this===null||this===void 0?void 0:this.validationMessageCallback)===null||k===void 0||k.call(this,this.showError?this.internals.validationMessage:"")}),f.set(this,void 0),P.set(this,!1),A.set(this,Promise.resolve()),(i=this.addEventListener)===null||i===void 0||i.call(this,"focus",n(this,V,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"blur",n(this,F,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"invalid",n(this,E,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(b=>b.attribute).flat(),i=super.observedAttributes||[];return[...new Set([...i,...t])]}static getValidator(t){return this.validators.find(i=>i.attribute===t)||null}static getValidators(t){return this.validators.filter(i=>{var c;if(i.attribute===t||!((c=i.attribute)===null||c===void 0)&&c.includes(t))return!0})}get form(){return this.internals.form}get showError(){return n(this,r,"m",_).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,i,c){var b;(b=super.attributeChangedCallback)===null||b===void 0||b.call(this,t,i,c);let j=this.constructor.getValidators(t);j!=null&&j.length&&this.validationTarget&&this.setValue(n(this,x,"f"))}setValue(t){var i;h(this,o,!1,"f"),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,""),h(this,x,t,"f");let b=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(b),n(this,r,"m",O).call(this,b),this.valueChangedCallback&&this.valueChangedCallback(b),n(this,r,"m",_).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(n(this,A,"f")))}formResetCallback(){var t,i;h(this,a,!1,"f"),h(this,o,!1,"f"),n(this,r,"m",_).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,n(this,r,"m",_).call(this)?this.validationMessage:"")}}return e=new WeakMap,o=new WeakMap,a=new WeakMap,p=new WeakMap,m=new WeakMap,w=new WeakMap,x=new WeakMap,V=new WeakMap,F=new WeakMap,E=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap,r=new WeakSet,Y=function(){let t=this.getRootNode(),i=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(i)},_=function(){if(this.hasAttribute("disabled"))return!1;let t=n(this,o,"f")||n(this,a,"f")&&!this.validity.valid&&!n(this,e,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},O=function(t){let i=this.constructor,c={},b=i.validators,k=[],j=b.some(g=>g.isValid instanceof Promise);n(this,P,"f")||(h(this,A,new Promise(g=>{h(this,f,g,"f")}),"f"),h(this,P,!0,"f")),n(this,p,"f")&&(n(this,p,"f").abort(),h(this,m,n(this,p,"f"),"f"));let X=new AbortController;h(this,p,X,"f");let N,B=!1;b.length&&(b.forEach(g=>{let T=g.key||"customError",$=g.isValid(this,t,X.signal);$ instanceof Promise?(k.push($),$.then(Z=>{Z!=null&&(c[T]=!Z,N=n(this,r,"m",L).call(this,g,t),n(this,r,"m",D).call(this,c,N))})):(c[T]=!$,this.validity[T]!==!$&&(B=!0),!$&&!N&&(N=n(this,r,"m",L).call(this,g,t)))}),Promise.allSettled(k).then(()=>{var g;X!=null&&X.signal.aborted||(h(this,P,!1,"f"),(g=n(this,f,"f"))===null||g===void 0||g.call(this))}),(B||!j)&&n(this,r,"m",D).call(this,c,N))},D=function(t,i){if(this.validationTarget)this.internals.setValidity(t,i,this.validationTarget),h(this,w,!1,"f");else{if(this.internals.setValidity(t,i),this.internals.validity.valid)return;h(this,w,!0,"f")}},L=function(t,i){if(this.validityCallback){let c=this.validityCallback(t.key||"customError");if(c)return c}return t.message instanceof Function?t.message(this,i):t.message},ie}import{html as M,LitElement as oe,nothing as z}from"lit";import{property as C,query as te,state as y}from"lit/decorators.js";import{ifDefined as U}from"lit/directives/if-defined.js";import{css as K}from"lit";var Q=K`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -271,7 +271,7 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var H=s=>{th
271
271
  svg {
272
272
  pointer-events: none;
273
273
  }
274
- `,ge=J`*, :before, :after {
274
+ `,ge=K`*, :before, :after {
275
275
  --w-rotate: 0;
276
276
  --w-rotate-x: 0;
277
277
  --w-rotate-y: 0;
@@ -2437,7 +2437,7 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var H=s=>{th
2437
2437
  display: none
2438
2438
  }
2439
2439
  }
2440
- `;import{css as le}from"lit";var Q=le`
2440
+ `;import{css as de}from"lit";var ee=de`
2441
2441
  .w-slider-thumb {
2442
2442
  position: relative;
2443
2443
  display: grid;
@@ -2601,7 +2601,7 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var H=s=>{th
2601
2601
  :host([name='to']) .w-slider-thumb__range::-moz-range-thumb {
2602
2602
  transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
2603
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=`
2604
+ `;import{css as ce}from"lit";var re=ce`*,: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 ae={};var u,S,I,q,H,l=class extends J(oe){constructor(){super(...arguments);W(this,u);this.allowValuesOutsideRange=!1;this._showTooltip=!1;this._inputHasFocus=!1;this.anchorPositioningStyleElement=null}async connectedCallback(){if(super.connectedCallback(),"anchorName"in document.documentElement.style)await this.updateComplete;else{let e=ae.url.substring(0,ae.url.lastIndexOf("/"));try{let[{default:o}]=await Promise.all([import(`${e}/oddbird-css-anchor-positioning.js`),this.updateComplete]);this.anchorPositioningStyleElement||(this.anchorPositioningStyleElement=document.createElement("style"),this.shadowRoot.prepend(this.anchorPositioningStyleElement)),this.anchorPositioningStyleElement.textContent=`
2605
2605
  /*
2606
2606
  * The polyfill can only anchor to ::before and ::after pseudo elements, not the pseudo element slider thumb.
2607
2607
  * We work around that by recreating a transparent version of the active range
@@ -2650,56 +2650,80 @@ var ie=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var H=s=>{th
2650
2650
  left: anchor(--polyfilled-thumb left);
2651
2651
  margin-left: 38px;
2652
2652
  }
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`
2653
+ `,await o({roots:[this.shadowRoot],elements:[this.anchorPositioningStyleElement]})}catch(o){console.error(new Error("Error registering the CSS anchor positioning polyfill. The UI will look broken.",{cause:o}))}}v(this,u,q).call(this)}get boundaryValue(){return this.slot==="from"?this.min:this.max}get textFieldDisplayValue(){var e,o;return this._inputHasFocus?this.value===""?(o=(e=this.range)==null?void 0:e.value)!=null?o:"":this.value:this.value}get tooltipDisplayValue(){var e,o;return this.formatter?this.formatter(this.value,this.slot):this.value===""?(o=(e=this.range)==null?void 0:e.value)!=null?o:this.boundaryValue:this.value||0}updated(e){e.has("value")&&(this.setValue(this.value),v(this,u,q).call(this)),e.has("invalid")&&this.dispatchEvent(new CustomEvent("slidervalidity",{bubbles:!0,detail:{invalid:this.invalid}}))}render(){return M`
2654
2654
  <div class="w-slider-thumb">
2655
2655
  <label for="range">${this.label}</label>
2656
- ${"anchorName"in document.documentElement.style?U:X`<div class="polyfill-range"><div class="polyfill-active-range"></div></div>`}
2656
+ ${"anchorName"in document.documentElement.style?z:M`<div class="polyfill-range">
2657
+ <div class="polyfill-active-range"></div>
2658
+ </div>`}
2657
2659
  <input
2658
2660
  id="range"
2659
2661
  aria-label="${this.ariaLabel}"
2660
- aria-describedby="${q(this.ariaDescription?"aria-description":void 0)}"
2662
+ aria-describedby="${U(this.ariaDescription?"aria-description":void 0)}"
2661
2663
  class="w-slider-thumb__range"
2662
2664
  type="range"
2663
2665
  .value="${this.value}"
2666
+ aria-valuetext="${this.tooltipDisplayValue}"
2664
2667
  min="${this.min}"
2665
2668
  max="${this.max}"
2666
- name="${this.name}"
2667
- step="${q(this.step?this.step:void 0)}"
2668
- ?disabled="${this.disabled||this.forceDisabled}"
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)}" />
2676
-
2677
- <span class="w-slider-thumb__from-marker">${this.formatter?this.formatter(this.min):this.min} ${this.suffix}</span>
2678
- <span class="w-slider-thumb__to-marker">${this.formatter?this.formatter(this.max):this.max} ${this.suffix}</span>
2669
+ step="${U(this.step?this.step:void 0)}"
2670
+ ?disabled="${this.disabled}"
2671
+ @mousedown="${v(this,u,S)}"
2672
+ @mouseup="${v(this,u,I)}"
2673
+ @touchstart="${v(this,u,S)}"
2674
+ @touchend="${v(this,u,I)}"
2675
+ @focus="${v(this,u,S)}"
2676
+ @blur="${v(this,u,I)}"
2677
+ @input="${v(this,u,H)}"
2678
+ />
2679
+
2680
+ ${this.slot==="from"?M`<span class="w-slider-thumb__from-marker"
2681
+ >${this.formatter?this.formatter(this.allowValuesOutsideRange?"":this.min,"from"):this.min}
2682
+ ${this.suffix}</span
2683
+ >`:z}
2684
+ ${this.slot==="to"?M`<span class="w-slider-thumb__to-marker"
2685
+ >${this.formatter?this.formatter(this.allowValuesOutsideRange?"":this.max,"to"):this.max}
2686
+ ${this.suffix}</span
2687
+ >`:z}
2679
2688
 
2680
2689
  <w-textfield
2681
2690
  aria-label="${this.ariaLabel}"
2682
- aria-description="${q(this.ariaDescription)}"
2691
+ aria-description="${U(this.ariaDescription)}"
2683
2692
  class="w-slider-thumb__textfield"
2684
2693
  type="number"
2685
- min="${this.min}"
2686
- max="${this.max}"
2687
- .formatter=${this.formatter}
2688
- .value="${this.value}"
2689
- ?invalid="${this.forceInvalid||this._invalid}"
2690
- @input="${f(this,g,O)}">
2691
- ${this.suffix?X`<w-affix slot="suffix" label="${this.suffix}"></w-affix>`:U}
2694
+ .formatter=${this.formatter?e=>this.formatter(e,this.slot):z}
2695
+ .value="${this.textFieldDisplayValue}"
2696
+ min="${this.allowValuesOutsideRange?z:this.min}"
2697
+ max="${this.allowValuesOutsideRange?z:this.max}"
2698
+ ?invalid="${this.invalid}"
2699
+ @input="${v(this,u,H)}"
2700
+ @focus="${()=>this._inputHasFocus=!0}"
2701
+ @blur="${()=>this._inputHasFocus=!1}"
2702
+ >
2703
+ ${this.suffix?M`<w-affix slot="suffix" label="${this.suffix}"></w-affix>`:z}
2692
2704
  </w-textfield>
2693
2705
 
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>
2706
+ <w-attention
2707
+ tooltip
2708
+ placement="top"
2709
+ flip
2710
+ distance="24"
2711
+ .show="${this._showTooltip}"
2712
+ >
2713
+ <output
2714
+ id="target"
2715
+ class="w-slider-thumb__tooltip-target"
2716
+ slot="target"
2717
+ ></output>
2696
2718
  <span slot="message">
2697
- ${this.value?this.formatter?this.formatter(this.value):this.value:0}${this.suffix?X`&nbsp;${this.suffix}`:U}
2719
+ ${this.tooltipDisplayValue}${this.suffix?M`&nbsp;${this.suffix}`:z}
2698
2720
  </span>
2699
2721
  </w-attention>
2700
2722
 
2701
2723
  <!-- aria-description is still not recommended for general use, so make a visually hidden element and refer to it with aria-describedby -->
2702
- <span class="sr-only" id="aria-description">${this.ariaDescription}</span>
2724
+ <span class="sr-only" id="aria-description"
2725
+ >${this.ariaDescription}</span
2726
+ >
2703
2727
  </div>
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};
2728
+ `}};u=new WeakSet,S=function(){this._showTooltip=!0,this.shadowRoot.querySelector("w-attention").handleDone()},I=function(){this._showTooltip=!1},q=function(){this.range&&(this.value===""?this.range.value=this.boundaryValue:this.value&&(this.range.value=this.value))},H=async function(e){let o=e.currentTarget.tagName==="W-TEXTFIELD";if(e instanceof CustomEvent)return;let a=e.currentTarget.value,p=Number.parseInt(a),m=Number.parseInt(this.max),w=Number.parseInt(this.min);if(!this.allowValuesOutsideRange&&(p>m||p<w))return this.invalid=!0,!1;if(a==="")return this.required&&(this.invalid=!0),!1;this.invalid&&(this.invalid=!1),this.value=a;let Y=a===this.max||a===this.min,x=!1;if(this.slot){let V=getComputedStyle(this),F=V.getPropertyValue("--to"),E=V.getPropertyValue("--from");if(this.slot==="from"){let f=Math.min(Number.parseInt(F),this.allowValuesOutsideRange?m-1:m);p>f&&(x=!0,this.allowValuesOutsideRange&&Y?this.value=String(f):this.value=F,o&&(this.invalid=!0,await this.updateComplete,this.textfield.value=a))}else{let f=Math.max(Number.parseInt(E),this.allowValuesOutsideRange?w+1:w);p<f&&(x=!0,this.allowValuesOutsideRange&&Y?this.value=String(f):this.value=E,o&&(this.invalid=!0,await this.updateComplete,this.textfield.value=a))}}return x?(e.preventDefault(),!1):(this.range.value=Math.min(Math.max(Number(a),Number(this.min)),Number(this.max)).toString(),this.value=this.allowValuesOutsideRange&&!o&&Y?"":a,this.shadowRoot.querySelector("w-attention").handleDone(),!0)},l.shadowRootOptions={...oe.shadowRootOptions,delegatesFocus:!0},l.styles=[Q,re,ee],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([C({type:Boolean,reflect:!0})],l.prototype,"invalid",2),d([C({attribute:!1,reflect:!1})],l.prototype,"allowValuesOutsideRange",2),d([y()],l.prototype,"markers",2),d([y()],l.prototype,"required",2),d([y()],l.prototype,"step",2),d([y()],l.prototype,"min",2),d([y()],l.prototype,"max",2),d([y()],l.prototype,"suffix",2),d([y()],l.prototype,"formatter",2),d([te('input[type="range"]')],l.prototype,"range",2),d([te("w-textfield")],l.prototype,"textfield",2),d([y()],l.prototype,"_showTooltip",2),d([y()],l.prototype,"_inputHasFocus",2);customElements.get("w-slider-thumb")||customElements.define("w-slider-thumb",l);export{l as WarpSliderThumb};
2705
2729
  //# sourceMappingURL=slider-thumb.js.map