@warp-ds/elements 2.4.0-next.1 → 2.4.0-next.3

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.
@@ -28,7 +28,7 @@ export const Single = {
28
28
  export const Range = {
29
29
  render() {
30
30
  return html `
31
- <w-slider label="Range" min="0" max="100">
31
+ <w-slider label="Range" min="0" max="100" step="25">
32
32
  <w-slider-thumb
33
33
  slot="from"
34
34
  aria-label="From value"
@@ -298,13 +298,13 @@ export const TestCase = {
298
298
  return html `
299
299
  <form id="overunder" style="margin-bottom: 16px" lang="nb">
300
300
  <w-slider
301
- label="Hestekrefter"
302
- suffix="hk"
303
- min="50"
304
- max="500"
301
+ label="Bredde"
302
+ suffix="cm"
303
+ min="200"
304
+ max="350"
305
305
  data-testid="overunder"
306
306
  allow-values-outside-range
307
- step="10"
307
+ step="50"
308
308
  >
309
309
  <w-slider-thumb
310
310
  slot="from"
@@ -341,10 +341,10 @@ export const TestCase = {
341
341
  );
342
342
  overunderSlider.formatter = function (value, type) {
343
343
  if (value === "" && type === "from") {
344
- return "Under 50";
344
+ return "Under 200";
345
345
  }
346
346
  if (value === "" && type === "to") {
347
- return "Over 500";
347
+ return "Over 350";
348
348
  }
349
349
  return value;
350
350
  };
@@ -26,42 +26,6 @@ export const wSliderStyles = css `
26
26
  --w-slider-thumb-offset: calc(var(--w-slider-thumb-size) / 2);
27
27
  --w-slider-marker-color: var(--w-s-color-border);
28
28
 
29
- /* Math corner to calculate the fill of the slider and placement of markers. */
30
-
31
- /* The --min value can be non-zero, f. ex. choosing a year from 1950 to 2025. Normalize the values so we start at 0 and run to max - min. */
32
- --_value-range: calc(var(--max) - var(--min));
33
-
34
- /** Round up to the nearest --step, which defaults to 1 (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/range#step) */
35
- --_from-in-range: round(
36
- up,
37
- max(calc(var(--from) - var(--min)), 0),
38
- var(--step, 1)
39
- );
40
-
41
- /* limit to maximum value in range so typing a value larger than max doesn't explode layouts */
42
- --_to-in-range: round(
43
- up,
44
- min(calc(var(--to) - var(--min)), var(--_value-range)),
45
- var(--step, 1)
46
- );
47
-
48
- /* Position the starting point of the fill in the case of a non-zero --from value in a range slider.
49
- * In other words, given a width of 100% how many percent should be left unfilled/blank
50
- * at the beginning of the range slider (dashes in this ASCII-range-slider: |---O******O|) */
51
- --_from-as-percent-of-max: calc(
52
- var(--_from-in-range) / var(--_value-range) * 100
53
- );
54
- --_blank-values-before: var(--_from-as-percent-of-max);
55
-
56
- /* Set the width of the fill as a percentage.
57
- * In other words, given a width of 100% how many percent should be left unfilled/blank
58
- * at the end of the slider (dashes in this ASCII-slider: |******O---|) */
59
- --_to-as-percent-of-max: calc(
60
- var(--_to-in-range) / var(--_value-range) * 100
61
- );
62
- --_filled-values: calc(
63
- var(--_to-as-percent-of-max) - var(--_blank-values-before)
64
- );
65
29
 
66
30
  /* Vertical position of range and markers */
67
31
  --_range-top: calc(
@@ -112,16 +76,19 @@ export const wSliderStyles = css `
112
76
  border-start-start-radius: var(--active-range-border-radius, 0);
113
77
  border-end-start-radius: var(--active-range-border-radius, 0);
114
78
 
115
- margin-left: calc(
116
- calc(var(--_blank-values-before) * 1%) - var(
117
- --active-range-inline-start-padding,
118
- 0px
119
- )
120
- );
121
- width: calc(
122
- calc(var(--_filled-values) * 1%) +
123
- var(--active-range-inline-end-padding, 0px)
124
- );
79
+ /* takes over-under into the calculation if set, as this makes the ranges longer in reality */
80
+ --max-with-offset: calc(var(--max) + var(--over-under-offset, 0));
81
+
82
+ /* calculate the offset for the "from" thumb in percentage to move the range visualisation from the left edge, using max() to avoid going off screen */
83
+ --offset-percentage: calc(calc(var(--from) - var(--min)) / calc(var(--max-with-offset) - var(--min)) * 100);
84
+ margin-left: calc(max(var(--offset-percentage) * 1%, 0px) - 1px);
85
+
86
+ /* calculate the width of the selected range in percentage, clamped between min/max */
87
+ --value-range: calc(var(--max-with-offset) - var(--min));
88
+ --range-span-percentage: calc(calc(min(var(--to), var(--max-with-offset)) - max(var(--min), var(--from))) / var(--value-range) * 100 );
89
+ width: calc(var(--range-span-percentage) * 1% + 1px);
90
+
91
+
125
92
  z-index: 1;
126
93
  }
127
94
 
@@ -33,6 +33,7 @@ declare class WarpTextField extends WarpTextField_base {
33
33
  value: string;
34
34
  name: string;
35
35
  step: number;
36
+ autocomplete?: string;
36
37
  /**
37
38
  * Function to format value when the input field.
38
39
  *
@@ -1,4 +1,4 @@
1
- var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{throw TypeError(a)};var d=(a,e,r,o)=>{for(var l=o>1?void 0:o?ae(e,r):e,g=a.length-1,w;g>=0;g--)(w=a[g])&&(l=(o?w(e,r,l):w(l))||l);return o&&l&&te(e,r,l),l};var U=(a,e,r)=>e.has(a)||R("Cannot "+r);var H=(a,e,r)=>(U(a,e,"read from private field"),r?r.call(a):e.get(a)),D=(a,e,r)=>e.has(a)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,r),G=(a,e,r,o)=>(U(a,e,"write to private field"),o?o.call(a,r):e.set(a,r),r);var j=function(){for(var a=[],e=arguments.length;e--;)a[e]=arguments[e];return a.reduce(function(r,o){return r.concat(typeof o=="string"?o:Array.isArray(o)?j.apply(void 0,o):typeof o=="object"&&o?Object.keys(o).map(function(l){return o[l]?l:""}):"")},[]).join(" ")};var n=function(a,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!o:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(a):o?o.value:e.get(a)},h=function(a,e,r,o,l){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!l)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!l:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?l.call(a,r):l?l.value=r:e.set(a,r),r};function T(a){var e,r,o,l,g,w,k,re,_,F,A,L,E,z,Y,f,X,O,Z;class oe extends a{constructor(...t){var i,b,p;super(...t),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),o.set(this,!1),l.set(this,!1),g.set(this,void 0),w.set(this,void 0),k.set(this,!0),_.set(this,""),F.set(this,()=>{h(this,l,!0,"f"),h(this,r,!0,"f"),n(this,e,"m",f).call(this)}),A.set(this,()=>{h(this,r,!1,"f"),n(this,e,"m",X).call(this,this.shouldFormValueUpdate()?n(this,_,"f"):""),!this.validity.valid&&n(this,l,"f")&&h(this,o,!0,"f");let m=n(this,e,"m",f).call(this);this.validationMessageCallback&&this.validationMessageCallback(m?this.internals.validationMessage:"")}),L.set(this,()=>{var m;n(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,k,!1,"f")),h(this,l,!0,"f"),h(this,o,!0,"f"),n(this,e,"m",f).call(this),(m=this===null||this===void 0?void 0:this.validationMessageCallback)===null||m===void 0||m.call(this,this.showError?this.internals.validationMessage:"")}),E.set(this,void 0),z.set(this,!1),Y.set(this,Promise.resolve()),(i=this.addEventListener)===null||i===void 0||i.call(this,"focus",n(this,F,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",n(this,A,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",n(this,L,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(p=>p.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 b;if(i.attribute===t||!((b=i.attribute)===null||b===void 0)&&b.includes(t))return!0})}get form(){return this.internals.form}get showError(){return n(this,e,"m",f).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,i,b){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,t,i,b);let $=this.constructor.getValidators(t);$!=null&&$.length&&this.validationTarget&&this.setValue(n(this,_,"f"))}setValue(t){var i;h(this,o,!1,"f"),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,""),h(this,_,t,"f");let p=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(p),n(this,e,"m",X).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),n(this,e,"m",f).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(n(this,Y,"f")))}formResetCallback(){var t,i;h(this,l,!1,"f"),h(this,o,!1,"f"),n(this,e,"m",f).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,n(this,e,"m",f).call(this)?this.validationMessage:"")}}return r=new WeakMap,o=new WeakMap,l=new WeakMap,g=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,F=new WeakMap,A=new WeakMap,L=new WeakMap,E=new WeakMap,z=new WeakMap,Y=new WeakMap,e=new WeakSet,re=function(){let t=this.getRootNode(),i=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(i)},f=function(){if(this.hasAttribute("disabled"))return!1;let t=n(this,o,"f")||n(this,l,"f")&&!this.validity.valid&&!n(this,r,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},X=function(t){let i=this.constructor,b={},p=i.validators,m=[],$=p.some(u=>u.isValid instanceof Promise);n(this,z,"f")||(h(this,Y,new Promise(u=>{h(this,E,u,"f")}),"f"),h(this,z,!0,"f")),n(this,g,"f")&&(n(this,g,"f").abort(),h(this,w,n(this,g,"f"),"f"));let M=new AbortController;h(this,g,M,"f");let S,B=!1;p.length&&(p.forEach(u=>{let N=u.key||"customError",y=u.isValid(this,t,M.signal);y instanceof Promise?(m.push(y),y.then(I=>{I!=null&&(b[N]=!I,S=n(this,e,"m",Z).call(this,u,t),n(this,e,"m",O).call(this,b,S))})):(b[N]=!y,this.validity[N]!==!y&&(B=!0),!y&&!S&&(S=n(this,e,"m",Z).call(this,u,t)))}),Promise.allSettled(m).then(()=>{var u;M!=null&&M.signal.aborted||(h(this,z,!1,"f"),(u=n(this,E,"f"))===null||u===void 0||u.call(this))}),(B||!$)&&n(this,e,"m",O).call(this,b,S))},O=function(t,i){if(this.validationTarget)this.internals.setValidity(t,i,this.validationTarget),h(this,k,!1,"f");else{if(this.internals.setValidity(t,i),this.internals.validity.valid)return;h(this,k,!0,"f")}},Z=function(t,i){if(this.validityCallback){let b=this.validityCallback(t.key||"customError");if(b)return b}return t.message instanceof Function?t.message(this,i):t.message},oe}import{html as P,LitElement as ee,nothing as se}from"lit";import{property as c,query as le}from"lit/decorators.js";import{classMap as de}from"lit/directives/class-map.js";import{ifDefined as v}from"lit/directives/if-defined.js";import{css as J}from"lit";var K=J`
1
+ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{throw TypeError(a)};var d=(a,e,r,o)=>{for(var l=o>1?void 0:o?ae(e,r):e,u=a.length-1,w;u>=0;u--)(w=a[u])&&(l=(o?w(e,r,l):w(l))||l);return o&&l&&te(e,r,l),l};var U=(a,e,r)=>e.has(a)||R("Cannot "+r);var H=(a,e,r)=>(U(a,e,"read from private field"),r?r.call(a):e.get(a)),D=(a,e,r)=>e.has(a)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,r),G=(a,e,r,o)=>(U(a,e,"write to private field"),o?o.call(a,r):e.set(a,r),r);var j=function(){for(var a=[],e=arguments.length;e--;)a[e]=arguments[e];return a.reduce(function(r,o){return r.concat(typeof o=="string"?o:Array.isArray(o)?j.apply(void 0,o):typeof o=="object"&&o?Object.keys(o).map(function(l){return o[l]?l:""}):"")},[]).join(" ")};var n=function(a,e,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!o:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(a):o?o.value:e.get(a)},h=function(a,e,r,o,l){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!l)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!l:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?l.call(a,r):l?l.value=r:e.set(a,r),r};function J(a){var e,r,o,l,u,w,k,re,_,A,F,L,E,z,Y,f,X,O,Z;class oe extends a{constructor(...t){var i,b,p;super(...t),e.add(this),this.internals=this.attachInternals(),r.set(this,!1),o.set(this,!1),l.set(this,!1),u.set(this,void 0),w.set(this,void 0),k.set(this,!0),_.set(this,""),A.set(this,()=>{h(this,l,!0,"f"),h(this,r,!0,"f"),n(this,e,"m",f).call(this)}),F.set(this,()=>{h(this,r,!1,"f"),n(this,e,"m",X).call(this,this.shouldFormValueUpdate()?n(this,_,"f"):""),!this.validity.valid&&n(this,l,"f")&&h(this,o,!0,"f");let m=n(this,e,"m",f).call(this);this.validationMessageCallback&&this.validationMessageCallback(m?this.internals.validationMessage:"")}),L.set(this,()=>{var m;n(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),h(this,k,!1,"f")),h(this,l,!0,"f"),h(this,o,!0,"f"),n(this,e,"m",f).call(this),(m=this===null||this===void 0?void 0:this.validationMessageCallback)===null||m===void 0||m.call(this,this.showError?this.internals.validationMessage:"")}),E.set(this,void 0),z.set(this,!1),Y.set(this,Promise.resolve()),(i=this.addEventListener)===null||i===void 0||i.call(this,"focus",n(this,A,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",n(this,F,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",n(this,L,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let t=this.validators.map(p=>p.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 b;if(i.attribute===t||!((b=i.attribute)===null||b===void 0)&&b.includes(t))return!0})}get form(){return this.internals.form}get showError(){return n(this,e,"m",f).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(t,i,b){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,t,i,b);let $=this.constructor.getValidators(t);$!=null&&$.length&&this.validationTarget&&this.setValue(n(this,_,"f"))}setValue(t){var i;h(this,o,!1,"f"),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,""),h(this,_,t,"f");let p=this.shouldFormValueUpdate()?t:null;this.internals.setFormValue(p),n(this,e,"m",X).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),n(this,e,"m",f).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(t=>t(n(this,Y,"f")))}formResetCallback(){var t,i;h(this,l,!1,"f"),h(this,o,!1,"f"),n(this,e,"m",f).call(this),(t=this.resetFormControl)===null||t===void 0||t.call(this),(i=this.validationMessageCallback)===null||i===void 0||i.call(this,n(this,e,"m",f).call(this)?this.validationMessage:"")}}return r=new WeakMap,o=new WeakMap,l=new WeakMap,u=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,A=new WeakMap,F=new WeakMap,L=new WeakMap,E=new WeakMap,z=new WeakMap,Y=new WeakMap,e=new WeakSet,re=function(){let t=this.getRootNode(),i=`${this.localName}[name="${this.getAttribute("name")}"]`;return t.querySelectorAll(i)},f=function(){if(this.hasAttribute("disabled"))return!1;let t=n(this,o,"f")||n(this,l,"f")&&!this.validity.valid&&!n(this,r,"f");return t&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),t},X=function(t){let i=this.constructor,b={},p=i.validators,m=[],$=p.some(v=>v.isValid instanceof Promise);n(this,z,"f")||(h(this,Y,new Promise(v=>{h(this,E,v,"f")}),"f"),h(this,z,!0,"f")),n(this,u,"f")&&(n(this,u,"f").abort(),h(this,w,n(this,u,"f"),"f"));let M=new AbortController;h(this,u,M,"f");let S,B=!1;p.length&&(p.forEach(v=>{let N=v.key||"customError",y=v.isValid(this,t,M.signal);y instanceof Promise?(m.push(y),y.then(I=>{I!=null&&(b[N]=!I,S=n(this,e,"m",Z).call(this,v,t),n(this,e,"m",O).call(this,b,S))})):(b[N]=!y,this.validity[N]!==!y&&(B=!0),!y&&!S&&(S=n(this,e,"m",Z).call(this,v,t)))}),Promise.allSettled(m).then(()=>{var v;M!=null&&M.signal.aborted||(h(this,z,!1,"f"),(v=n(this,E,"f"))===null||v===void 0||v.call(this))}),(B||!$)&&n(this,e,"m",O).call(this,b,S))},O=function(t,i){if(this.validationTarget)this.internals.setValidity(t,i,this.validationTarget),h(this,k,!1,"f");else{if(this.internals.setValidity(t,i),this.internals.validity.valid)return;h(this,k,!0,"f")}},Z=function(t,i){if(this.validityCallback){let b=this.validityCallback(t.key||"customError");if(b)return b}return t.message instanceof Function?t.message(this,i):t.message},oe}import{html as P,LitElement as ee,nothing as se}from"lit";import{property as c,query as le}from"lit/decorators.js";import{classMap as de}from"lit/directives/class-map.js";import{ifDefined as g}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 te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
271
271
  svg {
272
272
  pointer-events: none;
273
273
  }
274
- `,ve=J`*, :before, :after {
274
+ `,ve=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 te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
2437
2437
  display: none
2438
2438
  }
2439
2439
  }
2440
- `;import{css as ie}from"lit";var Q=ie`
2440
+ `;import{css as ie}from"lit";var T=ie`
2441
2441
  .w-textfield {
2442
2442
  --_input-padding-top: 12px;
2443
2443
  --_input-padding-left: 8px;
@@ -2489,7 +2489,7 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
2489
2489
  text-overflow: ellipsis;
2490
2490
  z-index: 1;
2491
2491
  }
2492
- `;import{css as ne}from"lit";var W=ne`*,: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}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.block{display:block}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.relative{position:relative}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.placeholder\\:s-text-placeholder::placeholder{color:var(--w-s-color-text-placeholder)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-selected:active{border-color:var(--w-s-color-border-selected)}.w-full{width:100%}.min-h-\\[42\\]{min-height:4.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.px-8{padding-left:.8rem;padding-right:.8rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-40{padding-right:4rem}.pl-\\[var\\(--w-prefix-width\\,_40px\\)\\]{padding-left:var(--w-prefix-width,40px)}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none{pointer-events:none}.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}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-m{line-height:var(--w-line-height-m)}@media (min-width:480px){.sm\\:min-h-\\[45\\]{min-height:4.5rem}}`;var x={base:"block text-m leading-m mb-0 px-8 py-12 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] caret-current",default:"border-1 s-text s-bg s-border-strong hover:s-border-strong-hover active:s-border-selected",disabled:"border-1 s-text-disabled s-bg-disabled-subtle s-border-disabled pointer-events-none",invalid:"border-1 s-text-negative s-bg s-border-negative hover:s-border-negative-hover outline-[--w-s-color-border-negative]!",readOnly:"pl-0 bg-transparent pointer-events-none",placeholder:"placeholder:s-text-placeholder",suffix:"pr-40",prefix:"pl-[var(--w-prefix-width,_40px)]",textArea:"min-h-[42] sm:min-h-[45]"},ce={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",optional:"pl-8 font-normal text-s s-text-subtle"},q={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},V,s=class extends T(ee){constructor(){super(...arguments);this.type="text";this._hasPrefix=!1;this._hasSuffix=!1;D(this,V,null)}updated(r){r.has("value")&&(this.setValue(this.value),this.formatter&&(this.mask.innerText=this.formatter(this.value)))}firstUpdated(r){G(this,V,this.value)}resetFormControl(){this.value=H(this,V)}get _inputstyles(){return j([x.base,this._hasSuffix&&x.suffix,this._hasPrefix&&x.prefix,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.default,this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.invalid,!this.invalid&&this.disabled&&!(this.readonly||this.readOnly)&&x.disabled,!this.invalid&&!this.disabled&&(this.readonly||this.readOnly)&&x.readOnly])}get _helptextstyles(){return j([q.base,this.invalid?q.colorInvalid:q.color])}get _label(){if(this.label)return P`<label for="${this._id}" class=${ce.base}>${this.label}</label>`}get _helpId(){if(this.helpText)return`${this._id}__hint`}get _id(){return"textfield"}get _error(){if(this.invalid&&this._helpId)return this._helpId}handler(r){let{name:o,value:l}=r.currentTarget;this.value=l;let g=new CustomEvent(r.type,{detail:{name:o,value:l,target:r.target}});this.dispatchEvent(g)}prefixSlotChange(){this.renderRoot.querySelector("slot[name=prefix]").assignedElements().length&&(this._hasPrefix=!0)}suffixSlotChange(){this.renderRoot.querySelector("slot[name=suffix]").assignedElements().length&&(this._hasSuffix=!0)}render(){return P`
2492
+ `;import{css as ne}from"lit";var W=ne`*,: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}.focus\\:\\[--w-outline-offset\\:-2px\\]:focus{--w-outline-offset:-2px}.bg-transparent{background-color:#0000}.border-1{border-width:1px}.rounded-4{border-radius:4px}.caret-current{caret-color:currentColor}.block{display:block}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.outline-\\[--w-s-color-border-negative\\]\\!{outline-color:var(--w-s-color-border-negative)!important}.relative{position:relative}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled-subtle{background-color:var(--w-s-color-background-disabled-subtle)}.s-text{color:var(--w-s-color-text)}.s-text-disabled{color:var(--w-s-color-text-disabled)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-text-subtle{color:var(--w-s-color-text-subtle)}.placeholder\\:s-text-placeholder::placeholder{color:var(--w-s-color-text-placeholder)}.s-border-disabled{border-color:var(--w-s-color-border-disabled)}.s-border-negative{border-color:var(--w-s-color-border-negative)}.s-border-strong{border-color:var(--w-s-color-border-strong)}.hover\\:s-border-negative-hover:hover{border-color:var(--w-s-color-border-negative-hover)}.hover\\:s-border-strong-hover:hover{border-color:var(--w-s-color-border-strong-hover)}.active\\:s-border-selected:active{border-color:var(--w-s-color-border-selected)}.w-full{width:100%}.min-h-\\[42\\]{min-height:4.2rem}.mb-0{margin-bottom:0}.mt-4{margin-top:.4rem}.px-8{padding-left:.8rem;padding-right:.8rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.pb-4{padding-bottom:.4rem}.pl-0{padding-left:0}.pl-8{padding-left:.8rem}.pr-40{padding-right:4rem}.pl-\\[var\\(--w-prefix-width\\,_40px\\)\\]{padding-left:var(--w-prefix-width,40px)}.cursor-pointer{cursor:pointer}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:grayscale}.font-bold{font-weight:700}.font-normal{font-weight:400}.pointer-events-none{pointer-events:none}.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}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-s{font-size:var(--w-font-size-s);line-height:var(--w-line-height-s)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-m{line-height:var(--w-line-height-m)}@media (min-width:480px){.sm\\:min-h-\\[45\\]{min-height:4.5rem}}`;var x={base:"block text-m leading-m mb-0 px-8 py-12 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] caret-current",default:"border-1 s-text s-bg s-border-strong hover:s-border-strong-hover active:s-border-selected",disabled:"border-1 s-text-disabled s-bg-disabled-subtle s-border-disabled pointer-events-none",invalid:"border-1 s-text-negative s-bg s-border-negative hover:s-border-negative-hover outline-[--w-s-color-border-negative]!",readOnly:"pl-0 bg-transparent pointer-events-none",placeholder:"placeholder:s-text-placeholder",suffix:"pr-40",prefix:"pl-[var(--w-prefix-width,_40px)]",textArea:"min-h-[42] sm:min-h-[45]"},ce={base:"antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",optional:"pl-8 font-normal text-s s-text-subtle"},q={base:"text-xs mt-4 block",color:"s-text-subtle",colorInvalid:"s-text-negative"},V,s=class extends J(ee){constructor(){super(...arguments);this.type="text";this._hasPrefix=!1;this._hasSuffix=!1;D(this,V,null)}updated(r){r.has("value")&&(this.setValue(this.value),this.formatter&&(this.mask.innerText=this.formatter(this.value)))}firstUpdated(r){G(this,V,this.value)}resetFormControl(){this.value=H(this,V)}get _inputstyles(){return j([x.base,this._hasSuffix&&x.suffix,this._hasPrefix&&x.prefix,!this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.default,this.invalid&&!this.disabled&&!(this.readonly||this.readOnly)&&x.invalid,!this.invalid&&this.disabled&&!(this.readonly||this.readOnly)&&x.disabled,!this.invalid&&!this.disabled&&(this.readonly||this.readOnly)&&x.readOnly])}get _helptextstyles(){return j([q.base,this.invalid?q.colorInvalid:q.color])}get _label(){if(this.label)return P`<label for="${this._id}" class=${ce.base}>${this.label}</label>`}get _helpId(){if(this.helpText)return`${this._id}__hint`}get _id(){return"textfield"}get _error(){if(this.invalid&&this._helpId)return this._helpId}handler(r){let{name:o,value:l}=r.currentTarget;this.value=l;let u=new CustomEvent(r.type,{detail:{name:o,value:l,target:r.target}});this.dispatchEvent(u)}prefixSlotChange(){this.renderRoot.querySelector("slot[name=prefix]").assignedElements().length&&(this._hasPrefix=!0)}suffixSlotChange(){this.renderRoot.querySelector("slot[name=suffix]").assignedElements().length&&(this._hasSuffix=!0)}render(){return P`
2493
2493
  ${this._label}
2494
2494
  <div
2495
2495
  class="${de({"w-textfield":!0,"w-textfield--has-prefix":this._hasPrefix,"w-textfield--has-suffix":this._hasSuffix})}">
@@ -2499,23 +2499,24 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
2499
2499
  <input
2500
2500
  class="${this._inputstyles}"
2501
2501
  type="${this.type}"
2502
- min="${v(this.min)}"
2503
- max="${v(this.max)}"
2504
- size="${v(this.size)}"
2505
- minlength="${v(this.minLength)}"
2506
- maxlength="${v(this.maxLength)}"
2507
- name="${v(this.name)}"
2508
- pattern="${v(this.pattern)}"
2509
- placeholder="${v(this.placeholder)}"
2502
+ min="${g(this.min)}"
2503
+ max="${g(this.max)}"
2504
+ size="${g(this.size)}"
2505
+ minlength="${g(this.minLength)}"
2506
+ maxlength="${g(this.maxLength)}"
2507
+ name="${g(this.name)}"
2508
+ pattern="${g(this.pattern)}"
2509
+ placeholder="${g(this.placeholder)}"
2510
2510
  .value="${this.value||""}"
2511
- aria-describedby="${v(this._helpId||(this.ariaDescription?"aria-description":void 0))}"
2512
- aria-errormessage="${v(this._error)}"
2513
- aria-invalid="${v(this.invalid)}"
2511
+ aria-describedby="${g(this._helpId||(this.ariaDescription?"aria-description":void 0))}"
2512
+ aria-errormessage="${g(this._error)}"
2513
+ aria-invalid="${g(this.invalid)}"
2514
2514
  id="${this._id}"
2515
2515
  ?disabled="${this.disabled}"
2516
2516
  ?readonly="${this.readonly||this.readOnly}"
2517
2517
  ?required="${this.required}"
2518
- step="${v(this.step)}"
2518
+ autocomplete="${g(this.autocomplete)}"
2519
+ step="${g(this.step)}"
2519
2520
  @blur="${this.handler}"
2520
2521
  @change="${this.handler}"
2521
2522
  @input="${this.handler}"
@@ -2525,5 +2526,5 @@ var te=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var R=a=>{th
2525
2526
  </div>
2526
2527
  <span class="sr-only" id="aria-description">${this.ariaDescription}</span>
2527
2528
  ${this.helpText&&P`<div class="${this._helptextstyles}" id="${this._helpId}">${this.helpText}</div>`}
2528
- `}};V=new WeakMap,s.shadowRootOptions={...ee.shadowRootOptions,delegatesFocus:!0},s.styles=[K,W,Q],d([c({type:Boolean,reflect:!0})],s.prototype,"disabled",2),d([c({type:Boolean,reflect:!0})],s.prototype,"invalid",2),d([c({type:String,reflect:!0})],s.prototype,"id",2),d([c({type:String,reflect:!0})],s.prototype,"label",2),d([c({type:String,reflect:!0,attribute:"help-text"})],s.prototype,"helpText",2),d([c({type:String,reflect:!0})],s.prototype,"size",2),d([c({type:Number,reflect:!0})],s.prototype,"max",2),d([c({type:Number,reflect:!0})],s.prototype,"min",2),d([c({type:Number,reflect:!0,attribute:"min-length"})],s.prototype,"minLength",2),d([c({type:Number,reflect:!0,attribute:"max-length"})],s.prototype,"maxLength",2),d([c({type:String,reflect:!0})],s.prototype,"pattern",2),d([c({type:String,reflect:!0})],s.prototype,"placeholder",2),d([c({type:Boolean,reflect:!0,attribute:"read-only"})],s.prototype,"readOnly",2),d([c({type:Boolean,reflect:!0})],s.prototype,"readonly",2),d([c({type:Boolean,reflect:!0})],s.prototype,"required",2),d([c({type:String,reflect:!0})],s.prototype,"type",2),d([c({type:String,reflect:!0})],s.prototype,"value",2),d([c({type:String,reflect:!0})],s.prototype,"name",2),d([c({type:Number,reflect:!0})],s.prototype,"step",2),d([c({attribute:!1})],s.prototype,"formatter",2),d([le(".w-textfield__mask")],s.prototype,"mask",2),d([c({type:Boolean})],s.prototype,"_hasPrefix",2),d([c({type:Boolean})],s.prototype,"_hasSuffix",2);customElements.get("w-textfield")||customElements.define("w-textfield",s);export{s as WarpTextField};
2529
+ `}};V=new WeakMap,s.shadowRootOptions={...ee.shadowRootOptions,delegatesFocus:!0},s.styles=[Q,W,T],d([c({type:Boolean,reflect:!0})],s.prototype,"disabled",2),d([c({type:Boolean,reflect:!0})],s.prototype,"invalid",2),d([c({type:String,reflect:!0})],s.prototype,"id",2),d([c({type:String,reflect:!0})],s.prototype,"label",2),d([c({type:String,reflect:!0,attribute:"help-text"})],s.prototype,"helpText",2),d([c({type:String,reflect:!0})],s.prototype,"size",2),d([c({type:Number,reflect:!0})],s.prototype,"max",2),d([c({type:Number,reflect:!0})],s.prototype,"min",2),d([c({type:Number,reflect:!0,attribute:"min-length"})],s.prototype,"minLength",2),d([c({type:Number,reflect:!0,attribute:"max-length"})],s.prototype,"maxLength",2),d([c({type:String,reflect:!0})],s.prototype,"pattern",2),d([c({type:String,reflect:!0})],s.prototype,"placeholder",2),d([c({type:Boolean,reflect:!0,attribute:"read-only"})],s.prototype,"readOnly",2),d([c({type:Boolean,reflect:!0})],s.prototype,"readonly",2),d([c({type:Boolean,reflect:!0})],s.prototype,"required",2),d([c({type:String,reflect:!0})],s.prototype,"type",2),d([c({type:String,reflect:!0})],s.prototype,"value",2),d([c({type:String,reflect:!0})],s.prototype,"name",2),d([c({type:Number,reflect:!0})],s.prototype,"step",2),d([c({type:String,reflect:!0})],s.prototype,"autocomplete",2),d([c({attribute:!1})],s.prototype,"formatter",2),d([le(".w-textfield__mask")],s.prototype,"mask",2),d([c({type:Boolean})],s.prototype,"_hasPrefix",2),d([c({type:Boolean})],s.prototype,"_hasSuffix",2);customElements.get("w-textfield")||customElements.define("w-textfield",s);export{s as WarpTextField};
2529
2530
  //# sourceMappingURL=index.js.map