@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.
- package/dist/custom-elements.json +205 -11
- package/dist/index.d.ts +41 -11
- package/dist/packages/combobox/combobox.react.stories.d.ts +1 -1
- package/dist/packages/select/index.d.ts +25 -5
- package/dist/packages/select/index.js +14 -13
- package/dist/packages/select/index.js.map +2 -2
- package/dist/packages/select/select.react.stories.d.ts +1 -1
- package/dist/packages/select/select.stories.d.ts +1 -1
- package/dist/packages/select/select.stories.js +3 -4
- package/dist/packages/slider/slider-thumb.d.ts +11 -7
- package/dist/packages/slider/slider-thumb.js +57 -33
- package/dist/packages/slider/slider-thumb.js.map +3 -3
- package/dist/packages/slider/slider.d.ts +5 -1
- package/dist/packages/slider/slider.js +37 -13
- package/dist/packages/slider/slider.js.map +3 -3
- package/dist/packages/slider/slider.stories.js +134 -39
- package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
- package/dist/packages/textfield/index.js +1 -1
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
- package/dist/web-types.json +71 -12
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
32
|
+
export const HelpText = {
|
|
33
33
|
args: {
|
|
34
34
|
label: 'Berries',
|
|
35
|
-
|
|
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
|
-
|
|
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
|
|
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=
|
|
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
|
|
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
|
|
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
|
|
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?
|
|
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="${
|
|
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
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
@
|
|
2670
|
-
@
|
|
2671
|
-
@
|
|
2672
|
-
@
|
|
2673
|
-
@
|
|
2674
|
-
@
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
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="${
|
|
2691
|
+
aria-description="${U(this.ariaDescription)}"
|
|
2683
2692
|
class="w-slider-thumb__textfield"
|
|
2684
2693
|
type="number"
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
?invalid="${this.
|
|
2690
|
-
@input="${
|
|
2691
|
-
|
|
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
|
|
2695
|
-
|
|
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.
|
|
2719
|
+
${this.tooltipDisplayValue}${this.suffix?M` ${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"
|
|
2724
|
+
<span class="sr-only" id="aria-description"
|
|
2725
|
+
>${this.ariaDescription}</span
|
|
2726
|
+
>
|
|
2703
2727
|
</div>
|
|
2704
|
-
`}};
|
|
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
|