@warp-ds/elements 2.2.0-next.27 → 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,5 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
2
  import '../affix/index.js';
3
+ import '../attention/index.js';
3
4
  import '../textfield/index.js';
4
5
  import './index.js';
5
6
  declare const meta: Meta;
@@ -1,6 +1,7 @@
1
1
  import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
2
2
  import { html } from 'lit';
3
3
  import '../affix/index.js';
4
+ import '../attention/index.js';
4
5
  import '../textfield/index.js';
5
6
  import './index.js';
6
7
  const { events: sliderEvents, args: sliderArgs, argTypes: sliderArgTypes, } = getStorybookHelpers('w-slider');
@@ -92,21 +93,14 @@ export const SuffixKilometers = {
92
93
  export const Marks = {
93
94
  args: {
94
95
  locale: 'nb',
95
- suffix: 'km',
96
- step: '25000',
97
- markers: '25000',
96
+ step: '5',
97
+ markers: '5',
98
98
  },
99
- render({ locale, suffix, markers, step }) {
99
+ render({ markers, step }) {
100
100
  return html `
101
- <w-slider label="Distance" markers="${markers}" step="${step}" min="0" max="250000" suffix="${suffix}" data-testid="markers">
102
- <w-slider-thumb slot="from" aria-label="From distance" name="from"></w-slider-thumb>
103
- <w-slider-thumb slot="to" aria-label="To distance" name="to"></w-slider-thumb>
101
+ <w-slider label="Single" min="0" max="100" step="${step}" markers="${markers}">
102
+ <w-slider-thumb name="value"></w-slider-thumb>
104
103
  </w-slider>
105
-
106
- <script type="module">
107
- const markersSlider = document.querySelector('w-slider[data-testid="markers"]');
108
- markersSlider.formatter = window.getNumberFormatter('${locale}').format;
109
- </script>
110
104
  `;
111
105
  },
112
106
  };
@@ -17,6 +17,7 @@ export const wSliderThumbStyles = css `
17
17
  background-color: transparent;
18
18
  grid-area: slider;
19
19
  height: 44px; /* touch target */
20
+ margin-left: 0;
20
21
  pointer-events: none; /* let clicks pass through for range slider where we place two inputs over each other */
21
22
  }
22
23
 
@@ -26,14 +27,6 @@ export const wSliderThumbStyles = css `
26
27
  height: var(--w-slider-track-height);
27
28
  }
28
29
 
29
- .w-slider-thumb__range:hover::-webkit-slider-thumb {
30
- background: var(--w-s-color-background-primary-hover);
31
- }
32
-
33
- .w-slider-thumb__range:hover::-moz-range-thumb {
34
- background: var(--w-s-color-background-primary-hover);
35
- }
36
-
37
30
  /*
38
31
  Use anchor positioning to place the tooltip target in relation to the slider thumb.
39
32
  We use a polyfill to bring support to older Safari, Firefox at time of writing.
@@ -42,11 +35,12 @@ export const wSliderThumbStyles = css `
42
35
  anchor-name: --thumb;
43
36
 
44
37
  appearance: none;
38
+ cursor: pointer;
45
39
  background: var(--w-s-color-background-primary);
46
40
  border-radius: 50%;
47
41
  height: var(--w-slider-thumb-size);
48
42
  margin-top: calc(-1 * calc(var(--w-slider-thumb-offset) - calc(var(--w-slider-track-height) / 2)));
49
- pointer-events: auto;
43
+ pointer-events: initial;
50
44
  width: var(--w-slider-thumb-size);
51
45
  z-index: 1;
52
46
  }
@@ -55,6 +49,7 @@ export const wSliderThumbStyles = css `
55
49
  anchor-name: --thumb;
56
50
 
57
51
  appearance: none;
52
+ cursor: pointer;
58
53
  background: var(--w-s-color-background-primary);
59
54
  border-radius: 50%;
60
55
  border-color: transparent;
@@ -63,32 +58,54 @@ export const wSliderThumbStyles = css `
63
58
  pointer-events: initial;
64
59
  width: var(--w-slider-thumb-size);
65
60
  z-index: 1;
61
+
62
+ box-shadow: none;
66
63
  }
67
64
 
68
- .w-slider-thumb__tooltip {
69
- display: none;
70
- position: absolute;
65
+ .w-slider-thumb__range:active::-webkit-slider-thumb,
66
+ .w-slider-thumb__range:hover::-webkit-slider-thumb {
67
+ background: var(--w-s-color-background-primary-hover);
68
+ box-shadow: var(--w-shadow-slider-handle-hover);
69
+ }
71
70
 
72
- background-color: var(--w-s-color-background-inverted);
73
- color: var(--w-s-color-text-inverted-static);
74
- border-color: var(--w-s-color-background-inverted);
71
+ .w-slider-thumb__range:focus,
72
+ .w-slider-thumb__range:focus-visible {
73
+ outline: none;
74
+ }
75
75
 
76
- padding: 4px 8px;
77
- border-radius: 4px;
78
- font-size: 12px;
79
- white-space: nowrap;
80
- z-index: 1;
76
+ .w-slider-thumb__range:focus-visible::-webkit-slider-thumb {
77
+ outline: 2px solid var(--w-s-color-border-focus);
78
+ outline-offset: var(--w-outline-offset, 1px);
79
+ box-shadow: none;
80
+ }
81
81
 
82
- position-anchor: --thumb;
82
+ .w-slider-thumb__range:active::-moz-range-thumb,
83
+ .w-slider-thumb__range:hover::-moz-range-thumb {
84
+ background: var(--w-s-color-background-primary-hover);
85
+ box-shadow: var(--w-shadow-slider-handle-hover);
86
+ }
83
87
 
84
- bottom: calc(anchor(top) + 5px);
85
- justify-self: anchor-center;
88
+ .w-slider-thumb__range:focus-visible::-moz-range-thumb {
89
+ outline: 2px solid var(--w-s-color-border-focus);
90
+ outline-offset: var(--w-outline-offset, 1px);
91
+ box-shadow: none;
86
92
  }
87
93
 
88
- .w-slider-thumb__tooltip--visible {
94
+ .w-slider-thumb__tooltip-target {
89
95
  display: block;
96
+ pointer-events: none;
97
+ position: absolute;
98
+ border: 2px solid transparent;
99
+ border-radius: 20px;
100
+ width: 8px;
101
+ height: 8px;
102
+ position-anchor: --thumb;
103
+ position-area: center; /* Position the tooltip target right on the range thumb */
90
104
  }
91
105
 
106
+ /* Uncomment this to debug the invisible anchor target */
107
+ /* .w-slider-thumb__tooltip-target { border-color: lime; } */
108
+
92
109
  .w-slider-thumb__from-marker,
93
110
  .w-slider-thumb__to-marker {
94
111
  margin-inline: 2px; /* visual alignment with input border, slider thumb */
@@ -117,8 +134,21 @@ export const wSliderThumbStyles = css `
117
134
  grid-column: 1 / 2; /* Range sliders should leave the gap empty. */
118
135
  }
119
136
 
120
- :host([name='from']) .w-slider-thumb__range::-webkit-slider-thumb {
121
- margin-left: calc(-1px * var(--thumb-offset) / 2);
137
+ :host([name='from']) .w-slider-thumb__range {
138
+ margin-left: var(--w-slider-thumb-size);
139
+ }
140
+
141
+ :host([name='to']) .w-slider-thumb__range {
142
+ margin-right: var(--w-slider-thumb-size);
143
+ }
144
+
145
+ :host([name='from']) .w-slider-thumb__range::-webkit-slider-thumb,
146
+ :host([name='from']) .w-slider-thumb__tooltip-target {
147
+ transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
148
+ }
149
+
150
+ :host([name='from']) .w-slider-thumb__range::-moz-range-thumb {
151
+ transform: translateX(calc(-1 * var(--w-slider-thumb-size) - 1px));
122
152
  }
123
153
 
124
154
  :host([name='to']) .w-slider-thumb__textfield {
@@ -126,7 +156,12 @@ export const wSliderThumbStyles = css `
126
156
  grid-column: 3 / 4;
127
157
  }
128
158
 
159
+ :host([name='to']) .w-slider-thumb__tooltip-target,
129
160
  :host([name='to']) .w-slider-thumb__range::-webkit-slider-thumb {
130
- margin-left: calc(1px * var(--thumb-offset) / 2);
161
+ transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
162
+ }
163
+
164
+ :host([name='to']) .w-slider-thumb__range::-moz-range-thumb {
165
+ transform: translateX(calc(var(--w-slider-thumb-size) - 1px));
131
166
  }
132
167
  `;
@@ -27,10 +27,12 @@ export const wSliderStyles = css `
27
27
 
28
28
  /* 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. */
29
29
  --_value-range: calc(var(--max) - var(--min));
30
- --_from-in-range: max(calc(var(--from) - var(--min)), 0);
30
+
31
+ /** Round up to the nearest --step, which defaults to 1 (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/range#step) */
32
+ --_from-in-range: round(up, max(calc(var(--from) - var(--min)), 0), var(--step, 1));
31
33
 
32
34
  /* limit to maximum value in range so typing a value larger than max doesn't explode layouts */
33
- --_to-in-range: min(calc(var(--to) - var(--min)), var(--_value-range));
35
+ --_to-in-range: round(up, min(calc(var(--to) - var(--min)), var(--_value-range)), var(--step, 1));
34
36
 
35
37
  /* Position the starting point of the fill in the case of a non-zero --from value in a range slider.
36
38
  * In other words, given a width of 100% how many percent should be left unfilled/blank
@@ -63,17 +65,36 @@ export const wSliderStyles = css `
63
65
  grid-area: description;
64
66
  }
65
67
 
66
- .w-slider__active-range {
68
+ .w-slider__range {
67
69
  align-self: center;
68
70
  background: var(--w-slider-track-background);
69
71
  border-radius: 4px;
72
+ height: var(--w-slider-track-active-height);
70
73
  position: absolute;
74
+ /* For range sliders to avoid overlapping the slider thumbs we transform them to
75
+ be visually to the left and right of their respective input[type="range"]. This
76
+ padding is here so the active-range element is the same width as the input fields. */
77
+ padding-inline-start: var(--active-range-inline-start-padding, 0);
78
+ padding-inline-end: var(--active-range-inline-end-padding, 0);
71
79
  top: var(--_range-top);
72
80
  left: 0;
73
81
  right: 0;
74
82
  grid-area: slider;
75
83
  }
76
84
 
85
+ .w-slider__active-range {
86
+ box-sizing: content-box;
87
+ background: var(--w-slider-track-active-background);
88
+ height: var(--w-slider-track-active-height);
89
+
90
+ border-start-start-radius: var(--active-range-border-radius, 0);
91
+ border-end-start-radius: var(--active-range-border-radius, 0);
92
+
93
+ margin-left: calc(calc(var(--_blank-values-before) * 1%) - var(--active-range-inline-start-padding, 0px));
94
+ width: calc(calc(var(--_filled-values) * 1%) + var(--active-range-inline-end-padding, 0px));
95
+ z-index: 1;
96
+ }
97
+
77
98
  .w-slider__markers {
78
99
  --_marker-height: 7px;
79
100
  --_marker-width: 1px;
@@ -83,9 +104,14 @@ export const wSliderStyles = css `
83
104
  /* Creates a linear gradient with --_marker-width wide markers
84
105
  followed by enough transparent that we can repeat the gradient
85
106
  along the X axis and have markers visible where we want them. */
86
- background: linear-gradient(to right, var(--w-slider-marker-color) var(--_marker-width), rgba(0, 0, 0, 0) 1px) repeat-x;
107
+ background: linear-gradient(
108
+ to right,
109
+ var(--w-slider-marker-color) var(--_marker-width),
110
+ rgba(0, 0, 0, 0) 1px calc(100% - 1px),
111
+ var(--w-slider-marker-color) 100%
112
+ ) repeat-x;
87
113
  --_step-width-as-percent: calc(var(--markers) / var(--_value-range) * 100);
88
- background-size: calc(var(--_step-width-as-percent) * 1% - 0.1%) var(--_marker-height);
114
+ background-size: calc(var(--_step-width-as-percent) * 1%) var(--_marker-height);
89
115
 
90
116
  background-position: bottom 0 left 8px right 8px;
91
117
  position: absolute;
@@ -94,17 +120,7 @@ export const wSliderStyles = css `
94
120
  right: 1px;
95
121
  grid-area: slider;
96
122
  height: var(--_marker-height);
97
- }
98
-
99
- .w-slider__active-range::before {
100
- background: var(--w-slider-track-active-background);
101
- border-radius: 4px;
102
- content: '';
103
- display: block;
104
- height: var(--w-slider-track-active-height);
105
-
106
- margin-left: calc(var(--_blank-values-before) * 1%);
107
- width: calc(var(--_filled-values) * 1%);
123
+ margin-inline: var(--w-slider-thumb-offset);
108
124
  }
109
125
 
110
126
  slot::slotted(w-slider-thumb) {
@@ -1,4 +1,4 @@
1
- var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var l=(h,o,i,r)=>{for(var n=r>1?void 0:r?Q(o,i):o,g=h.length-1,w;g>=0;g--)(w=h[g])&&(n=(r?w(o,i,n):w(n))||n);return r&&n&&K(o,i,n),n};var Y=function(){for(var h=[],o=arguments.length;o--;)h[o]=arguments[o];return h.reduce(function(i,r){return i.concat(typeof r=="string"?r:Array.isArray(r)?Y.apply(void 0,r):typeof r=="object"&&r?Object.keys(r).map(function(n){return r[n]?n:""}):"")},[]).join(" ")};var a=function(h,o,i,r){if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?h!==o||!r:!o.has(h))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?r:i==="a"?r.call(h):r?r.value:o.get(h)},b=function(h,o,i,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof o=="function"?h!==o||!n:!o.has(h))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(h,i):n?n.value=i:o.set(h,i),i};function R(h){var o,i,r,n,g,w,k,T,_,P,F,A,V,z,E,f,L,X,O;class J extends h{constructor(...e){var t,c,p;super(...e),o.add(this),this.internals=this.attachInternals(),i.set(this,!1),r.set(this,!1),n.set(this,!1),g.set(this,void 0),w.set(this,void 0),k.set(this,!0),_.set(this,""),P.set(this,()=>{b(this,n,!0,"f"),b(this,i,!0,"f"),a(this,o,"m",f).call(this)}),F.set(this,()=>{b(this,i,!1,"f"),a(this,o,"m",L).call(this,this.shouldFormValueUpdate()?a(this,_,"f"):""),!this.validity.valid&&a(this,n,"f")&&b(this,r,!0,"f");let m=a(this,o,"m",f).call(this);this.validationMessageCallback&&this.validationMessageCallback(m?this.internals.validationMessage:"")}),A.set(this,()=>{var m;a(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),b(this,k,!1,"f")),b(this,n,!0,"f"),b(this,r,!0,"f"),a(this,o,"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:"")}),V.set(this,void 0),z.set(this,!1),E.set(this,Promise.resolve()),(t=this.addEventListener)===null||t===void 0||t.call(this,"focus",a(this,P,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"blur",a(this,F,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",a(this,A,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let e=this.validators.map(p=>p.attribute).flat(),t=super.observedAttributes||[];return[...new Set([...t,...e])]}static getValidator(e){return this.validators.find(t=>t.attribute===e)||null}static getValidators(e){return this.validators.filter(t=>{var c;if(t.attribute===e||!((c=t.attribute)===null||c===void 0)&&c.includes(e))return!0})}get form(){return this.internals.form}get showError(){return a(this,o,"m",f).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(e,t,c){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,e,t,c);let $=this.constructor.getValidators(e);$!=null&&$.length&&this.validationTarget&&this.setValue(a(this,_,"f"))}setValue(e){var t;b(this,r,!1,"f"),(t=this.validationMessageCallback)===null||t===void 0||t.call(this,""),b(this,_,e,"f");let p=this.shouldFormValueUpdate()?e:null;this.internals.setFormValue(p),a(this,o,"m",L).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),a(this,o,"m",f).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(e=>e(a(this,E,"f")))}formResetCallback(){var e,t;b(this,n,!1,"f"),b(this,r,!1,"f"),a(this,o,"m",f).call(this),(e=this.resetFormControl)===null||e===void 0||e.call(this),(t=this.validationMessageCallback)===null||t===void 0||t.call(this,a(this,o,"m",f).call(this)?this.validationMessage:"")}}return i=new WeakMap,r=new WeakMap,n=new WeakMap,g=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,P=new WeakMap,F=new WeakMap,A=new WeakMap,V=new WeakMap,z=new WeakMap,E=new WeakMap,o=new WeakSet,T=function(){let e=this.getRootNode(),t=`${this.localName}[name="${this.getAttribute("name")}"]`;return e.querySelectorAll(t)},f=function(){if(this.hasAttribute("disabled"))return!1;let e=a(this,r,"f")||a(this,n,"f")&&!this.validity.valid&&!a(this,i,"f");return e&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),e},L=function(e){let t=this.constructor,c={},p=t.validators,m=[],$=p.some(v=>v.isValid instanceof Promise);a(this,z,"f")||(b(this,E,new Promise(v=>{b(this,V,v,"f")}),"f"),b(this,z,!0,"f")),a(this,g,"f")&&(a(this,g,"f").abort(),b(this,w,a(this,g,"f"),"f"));let M=new AbortController;b(this,g,M,"f");let S,q=!1;p.length&&(p.forEach(v=>{let Z=v.key||"customError",y=v.isValid(this,e,M.signal);y instanceof Promise?(m.push(y),y.then(I=>{I!=null&&(c[Z]=!I,S=a(this,o,"m",O).call(this,v,e),a(this,o,"m",X).call(this,c,S))})):(c[Z]=!y,this.validity[Z]!==!y&&(q=!0),!y&&!S&&(S=a(this,o,"m",O).call(this,v,e)))}),Promise.allSettled(m).then(()=>{var v;M!=null&&M.signal.aborted||(b(this,z,!1,"f"),(v=a(this,V,"f"))===null||v===void 0||v.call(this))}),(q||!$)&&a(this,o,"m",X).call(this,c,S))},X=function(e,t){if(this.validationTarget)this.internals.setValidity(e,t,this.validationTarget),b(this,k,!1,"f");else{if(this.internals.setValidity(e,t),this.internals.validity.valid)return;b(this,k,!0,"f")}},O=function(e,t){if(this.validityCallback){let c=this.validityCallback(e.key||"customError");if(c)return c}return e.message instanceof Function?e.message(this,t):e.message},J}import{html as j,LitElement as G,nothing as re}from"lit";import{property as d,query as oe}from"lit/decorators.js";import{classMap as te}from"lit/directives/class-map.js";import{ifDefined as u}from"lit/directives/if-defined.js";import{css as B}from"lit";var U=B`
1
+ var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var l=(h,o,i,r)=>{for(var n=r>1?void 0:r?Q(o,i):o,g=h.length-1,w;g>=0;g--)(w=h[g])&&(n=(r?w(o,i,n):w(n))||n);return r&&n&&K(o,i,n),n};var Y=function(){for(var h=[],o=arguments.length;o--;)h[o]=arguments[o];return h.reduce(function(i,r){return i.concat(typeof r=="string"?r:Array.isArray(r)?Y.apply(void 0,r):typeof r=="object"&&r?Object.keys(r).map(function(n){return r[n]?n:""}):"")},[]).join(" ")};var a=function(h,o,i,r){if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?h!==o||!r:!o.has(h))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?r:i==="a"?r.call(h):r?r.value:o.get(h)},b=function(h,o,i,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof o=="function"?h!==o||!n:!o.has(h))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(h,i):n?n.value=i:o.set(h,i),i};function R(h){var o,i,r,n,g,w,k,T,_,P,F,A,V,z,E,f,L,X,O;class J extends h{constructor(...e){var t,c,p;super(...e),o.add(this),this.internals=this.attachInternals(),i.set(this,!1),r.set(this,!1),n.set(this,!1),g.set(this,void 0),w.set(this,void 0),k.set(this,!0),_.set(this,""),P.set(this,()=>{b(this,n,!0,"f"),b(this,i,!0,"f"),a(this,o,"m",f).call(this)}),F.set(this,()=>{b(this,i,!1,"f"),a(this,o,"m",L).call(this,this.shouldFormValueUpdate()?a(this,_,"f"):""),!this.validity.valid&&a(this,n,"f")&&b(this,r,!0,"f");let m=a(this,o,"m",f).call(this);this.validationMessageCallback&&this.validationMessageCallback(m?this.internals.validationMessage:"")}),A.set(this,()=>{var m;a(this,k,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),b(this,k,!1,"f")),b(this,n,!0,"f"),b(this,r,!0,"f"),a(this,o,"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:"")}),V.set(this,void 0),z.set(this,!1),E.set(this,Promise.resolve()),(t=this.addEventListener)===null||t===void 0||t.call(this,"focus",a(this,P,"f")),(c=this.addEventListener)===null||c===void 0||c.call(this,"blur",a(this,F,"f")),(p=this.addEventListener)===null||p===void 0||p.call(this,"invalid",a(this,A,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let e=this.validators.map(p=>p.attribute).flat(),t=super.observedAttributes||[];return[...new Set([...t,...e])]}static getValidator(e){return this.validators.find(t=>t.attribute===e)||null}static getValidators(e){return this.validators.filter(t=>{var c;if(t.attribute===e||!((c=t.attribute)===null||c===void 0)&&c.includes(e))return!0})}get form(){return this.internals.form}get showError(){return a(this,o,"m",f).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(e,t,c){var p;(p=super.attributeChangedCallback)===null||p===void 0||p.call(this,e,t,c);let $=this.constructor.getValidators(e);$!=null&&$.length&&this.validationTarget&&this.setValue(a(this,_,"f"))}setValue(e){var t;b(this,r,!1,"f"),(t=this.validationMessageCallback)===null||t===void 0||t.call(this,""),b(this,_,e,"f");let p=this.shouldFormValueUpdate()?e:null;this.internals.setFormValue(p),a(this,o,"m",L).call(this,p),this.valueChangedCallback&&this.valueChangedCallback(p),a(this,o,"m",f).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(e=>e(a(this,E,"f")))}formResetCallback(){var e,t;b(this,n,!1,"f"),b(this,r,!1,"f"),a(this,o,"m",f).call(this),(e=this.resetFormControl)===null||e===void 0||e.call(this),(t=this.validationMessageCallback)===null||t===void 0||t.call(this,a(this,o,"m",f).call(this)?this.validationMessage:"")}}return i=new WeakMap,r=new WeakMap,n=new WeakMap,g=new WeakMap,w=new WeakMap,k=new WeakMap,_=new WeakMap,P=new WeakMap,F=new WeakMap,A=new WeakMap,V=new WeakMap,z=new WeakMap,E=new WeakMap,o=new WeakSet,T=function(){let e=this.getRootNode(),t=`${this.localName}[name="${this.getAttribute("name")}"]`;return e.querySelectorAll(t)},f=function(){if(this.hasAttribute("disabled"))return!1;let e=a(this,r,"f")||a(this,n,"f")&&!this.validity.valid&&!a(this,i,"f");return e&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),e},L=function(e){let t=this.constructor,c={},p=t.validators,m=[],$=p.some(v=>v.isValid instanceof Promise);a(this,z,"f")||(b(this,E,new Promise(v=>{b(this,V,v,"f")}),"f"),b(this,z,!0,"f")),a(this,g,"f")&&(a(this,g,"f").abort(),b(this,w,a(this,g,"f"),"f"));let M=new AbortController;b(this,g,M,"f");let S,q=!1;p.length&&(p.forEach(v=>{let Z=v.key||"customError",y=v.isValid(this,e,M.signal);y instanceof Promise?(m.push(y),y.then(I=>{I!=null&&(c[Z]=!I,S=a(this,o,"m",O).call(this,v,e),a(this,o,"m",X).call(this,c,S))})):(c[Z]=!y,this.validity[Z]!==!y&&(q=!0),!y&&!S&&(S=a(this,o,"m",O).call(this,v,e)))}),Promise.allSettled(m).then(()=>{var v;M!=null&&M.signal.aborted||(b(this,z,!1,"f"),(v=a(this,V,"f"))===null||v===void 0||v.call(this))}),(q||!$)&&a(this,o,"m",X).call(this,c,S))},X=function(e,t){if(this.validationTarget)this.internals.setValidity(e,t,this.validationTarget),b(this,k,!1,"f");else{if(this.internals.setValidity(e,t),this.internals.validity.valid)return;b(this,k,!0,"f")}},O=function(e,t){if(this.validityCallback){let c=this.validityCallback(e.key||"customError");if(c)return c}return e.message instanceof Function?e.message(this,t):e.message},J}import{html as j,LitElement as G,nothing as re}from"lit";import{property as d,query as oe}from"lit/decorators.js";import{classMap as te}from"lit/directives/class-map.js";import{ifDefined as u}from"lit/directives/if-defined.js";import{css as B}from"lit";var H=B`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -2437,7 +2437,7 @@ var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var l=(h,o,i,r
2437
2437
  display: none
2438
2438
  }
2439
2439
  }
2440
- `;import{css as W}from"lit";var H=W`
2440
+ `;import{css as W}from"lit";var U=W`
2441
2441
  .w-textfield {
2442
2442
  --_input-padding-top: 12px;
2443
2443
  --_input-padding-left: 8px;
@@ -2462,6 +2462,15 @@ var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var l=(h,o,i,r
2462
2462
  display: none;
2463
2463
  }
2464
2464
 
2465
+ /* Hide the native browser controls */
2466
+ input[type="number"] {
2467
+ -moz-appearance:textfield;
2468
+ }
2469
+
2470
+ input[type="number"]::-webkit-inner-spin-button {
2471
+ display: none;
2472
+ }
2473
+
2465
2474
  /* Could also consider giving the input mask a background color instead of this */
2466
2475
  .w-textfield__input-wrapper:has(.w-textfield__mask):not(:focus-within) input {
2467
2476
  color: transparent;
@@ -2515,5 +2524,5 @@ var K=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var l=(h,o,i,r
2515
2524
  </div>
2516
2525
  <span class="sr-only" id="aria-description">${this.ariaDescription}</span>
2517
2526
  ${this.helpText&&j`<div class="${this._helptextstyles}" id="${this._helpId}">${this.helpText}</div>`}
2518
- `}};s.shadowRootOptions={...G.shadowRootOptions,delegatesFocus:!0},s.styles=[U,D,H],l([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),l([d({type:Boolean,reflect:!0})],s.prototype,"invalid",2),l([d({type:String,reflect:!0})],s.prototype,"id",2),l([d({type:String,reflect:!0})],s.prototype,"label",2),l([d({type:String,reflect:!0,attribute:"help-text"})],s.prototype,"helpText",2),l([d({type:String,reflect:!0})],s.prototype,"size",2),l([d({type:Number,reflect:!0})],s.prototype,"max",2),l([d({type:Number,reflect:!0})],s.prototype,"min",2),l([d({type:Number,reflect:!0,attribute:"min-length"})],s.prototype,"minLength",2),l([d({type:Number,reflect:!0,attribute:"max-length"})],s.prototype,"maxLength",2),l([d({type:String,reflect:!0})],s.prototype,"pattern",2),l([d({type:String,reflect:!0})],s.prototype,"placeholder",2),l([d({type:Boolean,reflect:!0,attribute:"read-only"})],s.prototype,"readOnly",2),l([d({type:Boolean,reflect:!0})],s.prototype,"required",2),l([d({type:String,reflect:!0})],s.prototype,"type",2),l([d({type:String,reflect:!0})],s.prototype,"value",2),l([d({type:String,reflect:!0})],s.prototype,"name",2),l([d({attribute:!1})],s.prototype,"formatter",2),l([oe(".w-textfield__mask")],s.prototype,"mask",2),l([d({type:Boolean})],s.prototype,"_hasPrefix",2),l([d({type:Boolean})],s.prototype,"_hasSuffix",2);customElements.get("w-textfield")||customElements.define("w-textfield",s);export{s as WarpTextField,N as ccHelpText,ae as ccLabel,x as ccinput};
2527
+ `}};s.shadowRootOptions={...G.shadowRootOptions,delegatesFocus:!0},s.styles=[H,D,U],l([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),l([d({type:Boolean,reflect:!0})],s.prototype,"invalid",2),l([d({type:String,reflect:!0})],s.prototype,"id",2),l([d({type:String,reflect:!0})],s.prototype,"label",2),l([d({type:String,reflect:!0,attribute:"help-text"})],s.prototype,"helpText",2),l([d({type:String,reflect:!0})],s.prototype,"size",2),l([d({type:Number,reflect:!0})],s.prototype,"max",2),l([d({type:Number,reflect:!0})],s.prototype,"min",2),l([d({type:Number,reflect:!0,attribute:"min-length"})],s.prototype,"minLength",2),l([d({type:Number,reflect:!0,attribute:"max-length"})],s.prototype,"maxLength",2),l([d({type:String,reflect:!0})],s.prototype,"pattern",2),l([d({type:String,reflect:!0})],s.prototype,"placeholder",2),l([d({type:Boolean,reflect:!0,attribute:"read-only"})],s.prototype,"readOnly",2),l([d({type:Boolean,reflect:!0})],s.prototype,"required",2),l([d({type:String,reflect:!0})],s.prototype,"type",2),l([d({type:String,reflect:!0})],s.prototype,"value",2),l([d({type:String,reflect:!0})],s.prototype,"name",2),l([d({attribute:!1})],s.prototype,"formatter",2),l([oe(".w-textfield__mask")],s.prototype,"mask",2),l([d({type:Boolean})],s.prototype,"_hasPrefix",2),l([d({type:Boolean})],s.prototype,"_hasSuffix",2);customElements.get("w-textfield")||customElements.define("w-textfield",s);export{s as WarpTextField,N as ccHelpText,ae as ccLabel,x as ccinput};
2519
2528
  //# sourceMappingURL=index.js.map