@warp-ds/elements 2.3.0-next.11 → 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 +135 -3
- package/dist/index.d.ts +19 -0
- 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/textfield/index.js +1 -1
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/web-types.json +35 -6
- package/package.json +1 -1
|
@@ -5522,6 +5522,24 @@
|
|
|
5522
5522
|
"attribute": "disabled",
|
|
5523
5523
|
"reflects": true
|
|
5524
5524
|
},
|
|
5525
|
+
{
|
|
5526
|
+
"kind": "field",
|
|
5527
|
+
"name": "invalid",
|
|
5528
|
+
"type": {
|
|
5529
|
+
"text": "boolean"
|
|
5530
|
+
},
|
|
5531
|
+
"attribute": "invalid",
|
|
5532
|
+
"reflects": true
|
|
5533
|
+
},
|
|
5534
|
+
{
|
|
5535
|
+
"kind": "field",
|
|
5536
|
+
"name": "allowValuesOutsideRange",
|
|
5537
|
+
"type": {
|
|
5538
|
+
"text": "boolean"
|
|
5539
|
+
},
|
|
5540
|
+
"default": "false",
|
|
5541
|
+
"description": "Set by `<w-slider>`"
|
|
5542
|
+
},
|
|
5525
5543
|
{
|
|
5526
5544
|
"kind": "field",
|
|
5527
5545
|
"name": "markers",
|
|
@@ -5574,7 +5592,7 @@
|
|
|
5574
5592
|
"kind": "field",
|
|
5575
5593
|
"name": "formatter",
|
|
5576
5594
|
"type": {
|
|
5577
|
-
"text": "(value: string) => string"
|
|
5595
|
+
"text": "(value: string, type: 'from' | 'to') => string"
|
|
5578
5596
|
},
|
|
5579
5597
|
"description": "JS hook to help you format the numeric value how you want."
|
|
5580
5598
|
},
|
|
@@ -5612,13 +5630,23 @@
|
|
|
5612
5630
|
}
|
|
5613
5631
|
}
|
|
5614
5632
|
},
|
|
5633
|
+
{
|
|
5634
|
+
"kind": "method",
|
|
5635
|
+
"name": "#syncRangeValue",
|
|
5636
|
+
"privacy": "private",
|
|
5637
|
+
"return": {
|
|
5638
|
+
"type": {
|
|
5639
|
+
"text": "void"
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
},
|
|
5615
5643
|
{
|
|
5616
5644
|
"kind": "method",
|
|
5617
5645
|
"name": "#onInput",
|
|
5618
5646
|
"privacy": "private",
|
|
5619
5647
|
"return": {
|
|
5620
5648
|
"type": {
|
|
5621
|
-
"text": "boolean"
|
|
5649
|
+
"text": "Promise<boolean>"
|
|
5622
5650
|
}
|
|
5623
5651
|
},
|
|
5624
5652
|
"parameters": [
|
|
@@ -5629,6 +5657,29 @@
|
|
|
5629
5657
|
}
|
|
5630
5658
|
}
|
|
5631
5659
|
]
|
|
5660
|
+
},
|
|
5661
|
+
{
|
|
5662
|
+
"kind": "field",
|
|
5663
|
+
"name": "boundaryValue",
|
|
5664
|
+
"type": {
|
|
5665
|
+
"text": "string"
|
|
5666
|
+
},
|
|
5667
|
+
"readonly": true
|
|
5668
|
+
},
|
|
5669
|
+
{
|
|
5670
|
+
"kind": "field",
|
|
5671
|
+
"name": "textFieldDisplayValue",
|
|
5672
|
+
"description": "Value to display in the textfield (shows boundary when focused on empty value)",
|
|
5673
|
+
"readonly": true
|
|
5674
|
+
},
|
|
5675
|
+
{
|
|
5676
|
+
"kind": "field",
|
|
5677
|
+
"name": "tooltipDisplayValue",
|
|
5678
|
+
"type": {
|
|
5679
|
+
"text": "string | number"
|
|
5680
|
+
},
|
|
5681
|
+
"description": "Value to display in the tooltip",
|
|
5682
|
+
"readonly": true
|
|
5632
5683
|
}
|
|
5633
5684
|
],
|
|
5634
5685
|
"events": [
|
|
@@ -5681,6 +5732,13 @@
|
|
|
5681
5732
|
"text": "boolean"
|
|
5682
5733
|
},
|
|
5683
5734
|
"fieldName": "disabled"
|
|
5735
|
+
},
|
|
5736
|
+
{
|
|
5737
|
+
"name": "invalid",
|
|
5738
|
+
"type": {
|
|
5739
|
+
"text": "boolean"
|
|
5740
|
+
},
|
|
5741
|
+
"fieldName": "invalid"
|
|
5684
5742
|
}
|
|
5685
5743
|
],
|
|
5686
5744
|
"mixins": [
|
|
@@ -5778,6 +5836,25 @@
|
|
|
5778
5836
|
"attribute": "disabled",
|
|
5779
5837
|
"reflects": true
|
|
5780
5838
|
},
|
|
5839
|
+
{
|
|
5840
|
+
"kind": "field",
|
|
5841
|
+
"name": "allowValuesOutsideRange",
|
|
5842
|
+
"type": {
|
|
5843
|
+
"text": "boolean"
|
|
5844
|
+
},
|
|
5845
|
+
"default": "false",
|
|
5846
|
+
"attribute": "allow-values-outside-range"
|
|
5847
|
+
},
|
|
5848
|
+
{
|
|
5849
|
+
"kind": "field",
|
|
5850
|
+
"name": "helpText",
|
|
5851
|
+
"type": {
|
|
5852
|
+
"text": "string"
|
|
5853
|
+
},
|
|
5854
|
+
"default": "''",
|
|
5855
|
+
"attribute": "helpText",
|
|
5856
|
+
"reflects": true
|
|
5857
|
+
},
|
|
5781
5858
|
{
|
|
5782
5859
|
"kind": "field",
|
|
5783
5860
|
"name": "invalid",
|
|
@@ -5850,7 +5927,7 @@
|
|
|
5850
5927
|
"kind": "field",
|
|
5851
5928
|
"name": "formatter",
|
|
5852
5929
|
"type": {
|
|
5853
|
-
"text": "(value: string) => string"
|
|
5930
|
+
"text": "(value: string, type: 'to' | 'from') => string"
|
|
5854
5931
|
},
|
|
5855
5932
|
"description": "Function to format the to- and from labels and value in the slider thumb tooltip."
|
|
5856
5933
|
},
|
|
@@ -5864,6 +5941,16 @@
|
|
|
5864
5941
|
}
|
|
5865
5942
|
}
|
|
5866
5943
|
},
|
|
5944
|
+
{
|
|
5945
|
+
"kind": "field",
|
|
5946
|
+
"name": "edgeMin",
|
|
5947
|
+
"readonly": true
|
|
5948
|
+
},
|
|
5949
|
+
{
|
|
5950
|
+
"kind": "field",
|
|
5951
|
+
"name": "edgeMax",
|
|
5952
|
+
"readonly": true
|
|
5953
|
+
},
|
|
5867
5954
|
{
|
|
5868
5955
|
"kind": "method",
|
|
5869
5956
|
"name": "#onInput",
|
|
@@ -5877,6 +5964,11 @@
|
|
|
5877
5964
|
}
|
|
5878
5965
|
]
|
|
5879
5966
|
},
|
|
5967
|
+
{
|
|
5968
|
+
"kind": "method",
|
|
5969
|
+
"name": "#doValidation",
|
|
5970
|
+
"privacy": "private"
|
|
5971
|
+
},
|
|
5880
5972
|
{
|
|
5881
5973
|
"kind": "method",
|
|
5882
5974
|
"name": "#onSliderValidity",
|
|
@@ -5890,6 +5982,30 @@
|
|
|
5890
5982
|
}
|
|
5891
5983
|
]
|
|
5892
5984
|
},
|
|
5985
|
+
{
|
|
5986
|
+
"kind": "method",
|
|
5987
|
+
"name": "#getEdgeValue",
|
|
5988
|
+
"privacy": "private",
|
|
5989
|
+
"return": {
|
|
5990
|
+
"type": {
|
|
5991
|
+
"text": "string"
|
|
5992
|
+
}
|
|
5993
|
+
},
|
|
5994
|
+
"parameters": [
|
|
5995
|
+
{
|
|
5996
|
+
"name": "boundary",
|
|
5997
|
+
"type": {
|
|
5998
|
+
"text": "string"
|
|
5999
|
+
}
|
|
6000
|
+
},
|
|
6001
|
+
{
|
|
6002
|
+
"name": "input",
|
|
6003
|
+
"type": {
|
|
6004
|
+
"text": "WarpSliderThumb"
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
]
|
|
6008
|
+
},
|
|
5893
6009
|
{
|
|
5894
6010
|
"kind": "method",
|
|
5895
6011
|
"name": "#updateActiveTrack",
|
|
@@ -5922,6 +6038,22 @@
|
|
|
5922
6038
|
"default": "false",
|
|
5923
6039
|
"fieldName": "disabled"
|
|
5924
6040
|
},
|
|
6041
|
+
{
|
|
6042
|
+
"name": "allow-values-outside-range",
|
|
6043
|
+
"type": {
|
|
6044
|
+
"text": "boolean"
|
|
6045
|
+
},
|
|
6046
|
+
"default": "false",
|
|
6047
|
+
"fieldName": "allowValuesOutsideRange"
|
|
6048
|
+
},
|
|
6049
|
+
{
|
|
6050
|
+
"name": "helpText",
|
|
6051
|
+
"type": {
|
|
6052
|
+
"text": "string"
|
|
6053
|
+
},
|
|
6054
|
+
"default": "''",
|
|
6055
|
+
"fieldName": "helpText"
|
|
6056
|
+
},
|
|
5925
6057
|
{
|
|
5926
6058
|
"name": "invalid",
|
|
5927
6059
|
"type": {
|
package/dist/index.d.ts
CHANGED
|
@@ -713,6 +713,10 @@ export type WarpSliderThumbProps = {
|
|
|
713
713
|
"value"?: WarpSliderThumb['value'];
|
|
714
714
|
/** */
|
|
715
715
|
"disabled"?: WarpSliderThumb['disabled'];
|
|
716
|
+
/** */
|
|
717
|
+
"invalid"?: WarpSliderThumb['invalid'];
|
|
718
|
+
/** Set by `<w-slider>` */
|
|
719
|
+
"allowValuesOutsideRange"?: WarpSliderThumb['allowValuesOutsideRange'];
|
|
716
720
|
/** Set by `<w-slider>` */
|
|
717
721
|
"markers"?: WarpSliderThumb['markers'];
|
|
718
722
|
/** Set by `<w-slider>` */
|
|
@@ -745,6 +749,12 @@ If you need to display HTML, use the `label` slot instead. */
|
|
|
745
749
|
/** */
|
|
746
750
|
"disabled"?: WarpSlider['disabled'];
|
|
747
751
|
/** */
|
|
752
|
+
"allow-values-outside-range"?: WarpSlider['allowValuesOutsideRange'];
|
|
753
|
+
/** */
|
|
754
|
+
"allowValuesOutsideRange"?: WarpSlider['allowValuesOutsideRange'];
|
|
755
|
+
/** */
|
|
756
|
+
"helpText"?: WarpSlider['helpText'];
|
|
757
|
+
/** */
|
|
748
758
|
"invalid"?: WarpSlider['invalid'];
|
|
749
759
|
/** Ensures a child slider thumb has a value before allowing the containing form to submit. */
|
|
750
760
|
"required"?: WarpSlider['required'];
|
|
@@ -1463,6 +1473,8 @@ export type WarpTextareaProps = {
|
|
|
1463
1473
|
* - `name`: undefined
|
|
1464
1474
|
* - `value`: undefined
|
|
1465
1475
|
* - `disabled`: undefined
|
|
1476
|
+
* - `invalid`: undefined
|
|
1477
|
+
* - `allowValuesOutsideRange`: Set by `<w-slider>` (property only)
|
|
1466
1478
|
* - `markers`: Set by `<w-slider>` (property only)
|
|
1467
1479
|
* - `required`: Set by `<w-slider>` (property only)
|
|
1468
1480
|
* - `step`: Set by `<w-slider>` (property only)
|
|
@@ -1472,6 +1484,9 @@ export type WarpTextareaProps = {
|
|
|
1472
1484
|
* - `formatter`: JS hook to help you format the numeric value how you want. (property only)
|
|
1473
1485
|
* - `range`: undefined (property only)
|
|
1474
1486
|
* - `textfield`: undefined (property only)
|
|
1487
|
+
* - `boundaryValue`: undefined (property only) (readonly)
|
|
1488
|
+
* - `textFieldDisplayValue`: Value to display in the textfield (shows boundary when focused on empty value) (property only) (readonly)
|
|
1489
|
+
* - `tooltipDisplayValue`: Value to display in the tooltip (property only) (readonly)
|
|
1475
1490
|
*
|
|
1476
1491
|
* ## Events
|
|
1477
1492
|
*
|
|
@@ -1495,6 +1510,8 @@ export type WarpTextareaProps = {
|
|
|
1495
1510
|
*
|
|
1496
1511
|
* If you need to display HTML, use the `label` slot instead.
|
|
1497
1512
|
* - `disabled`: undefined
|
|
1513
|
+
* - `allow-values-outside-range`/`allowValuesOutsideRange`: undefined
|
|
1514
|
+
* - `helpText`: undefined
|
|
1498
1515
|
* - `invalid`: undefined
|
|
1499
1516
|
* - `required`: Ensures a child slider thumb has a value before allowing the containing form to submit.
|
|
1500
1517
|
* - `min`: undefined
|
|
@@ -1503,6 +1520,8 @@ export type WarpTextareaProps = {
|
|
|
1503
1520
|
* - `step`: undefined
|
|
1504
1521
|
* - `suffix`: Suffix used in text input fields and for the min and max values of the slider.
|
|
1505
1522
|
* - `formatter`: Function to format the to- and from labels and value in the slider thumb tooltip. (property only)
|
|
1523
|
+
* - `edgeMin`: undefined (property only) (readonly)
|
|
1524
|
+
* - `edgeMax`: undefined (property only) (readonly)
|
|
1506
1525
|
*
|
|
1507
1526
|
* ## Slots
|
|
1508
1527
|
*
|
|
@@ -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
|