@esri/calcite-components 5.2.0-next.66 → 5.2.0-next.67
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/cdn/{NQ2UNC27.js → 22LDUK4O.js} +1 -1
- package/dist/cdn/{Z3OKBA7K.js → 23OA75GR.js} +1 -1
- package/dist/cdn/{VOYQGXRR.js → 24LKTCES.js} +1 -1
- package/dist/cdn/{VRLYRYTO.js → 2A25MM6M.js} +1 -1
- package/dist/cdn/2CC34UKL.js +2 -0
- package/dist/cdn/{Z3VBHGHE.js → 2DXAX53K.js} +1 -1
- package/dist/cdn/{VIA6J3XE.js → 2GSRH5DM.js} +1 -1
- package/dist/cdn/{YDYZ3RKW.js → 2LTCN4AS.js} +1 -1
- package/dist/cdn/{GY2CYQI6.js → 2P4TML4G.js} +1 -1
- package/dist/cdn/{HPIZGCCW.js → 2UYETTP2.js} +1 -1
- package/dist/cdn/{HTESGM54.js → 3CWCK5PU.js} +1 -1
- package/dist/cdn/3MIARSOY.js +2 -0
- package/dist/cdn/{2VVL4TXM.js → 3RFXBFR6.js} +1 -1
- package/dist/cdn/{AKNVPJP5.js → 44356XFJ.js} +1 -1
- package/dist/cdn/{QSZ6MSOE.js → 44RHPQCA.js} +1 -1
- package/dist/cdn/{QVV2WPNX.js → 4EFSYE7P.js} +1 -1
- package/dist/cdn/{UFJG6NMJ.js → 4LG6IYYU.js} +1 -1
- package/dist/cdn/{DWYSF2HX.js → 4MC7DSYJ.js} +1 -1
- package/dist/cdn/{6IZVU4TS.js → 4TBDCNVB.js} +1 -1
- package/dist/cdn/{KR2UWOYO.js → 5FWKH67V.js} +1 -1
- package/dist/cdn/{GU6WGD2R.js → 65Y4LJIT.js} +1 -1
- package/dist/cdn/{S3GAV6IT.js → 6GXN5AYW.js} +1 -1
- package/dist/cdn/{4ZA7AVVV.js → 6LXRTZOO.js} +1 -1
- package/dist/cdn/{7CZAWSPN.js → 6NCMX7DB.js} +1 -1
- package/dist/cdn/{D2HMIETU.js → 6NFI5SYH.js} +1 -1
- package/dist/cdn/{E5ZJR273.js → 7EQBGM5Q.js} +1 -1
- package/dist/cdn/{LUYE5XKR.js → 7IO2UJZF.js} +1 -1
- package/dist/cdn/{ZKZJCFKM.js → 7ZMS5NQU.js} +1 -1
- package/dist/cdn/ABIRUUSH.js +2 -0
- package/dist/cdn/{INY2G6X6.js → ADILARBD.js} +1 -1
- package/dist/cdn/AJJSPLET.js +2 -0
- package/dist/cdn/{XAUVHNDA.js → AQXRYL3W.js} +1 -1
- package/dist/cdn/{UKS5NIPZ.js → AUT7UKFU.js} +1 -1
- package/dist/cdn/{TNS7HXP7.js → AXYEXUZB.js} +1 -1
- package/dist/cdn/{XZLDXTHK.js → AXYYKNW3.js} +1 -1
- package/dist/cdn/{3HAGJ23L.js → B4HDFIJJ.js} +1 -1
- package/dist/cdn/{G4S55KX5.js → BF765X5L.js} +1 -1
- package/dist/cdn/{7WAURHJU.js → BMPL7P6K.js} +1 -1
- package/dist/cdn/{I3ROWCUH.js → C4W46EYM.js} +1 -1
- package/dist/cdn/{PETPVR47.js → C6O67YVB.js} +1 -1
- package/dist/cdn/{FGHKM52J.js → CEHI75Q5.js} +1 -1
- package/dist/cdn/CTNH7GEV.js +2 -0
- package/dist/cdn/{XKIKN6ZZ.js → D63IPQBR.js} +1 -1
- package/dist/cdn/{UCHFNT6G.js → D674QPUM.js} +1 -1
- package/dist/cdn/{XQ3NFFAT.js → D6EESESK.js} +1 -1
- package/dist/cdn/{HD6KFRWO.js → D7WCRWSA.js} +1 -1
- package/dist/cdn/{F6RENHT5.js → DKTQYM66.js} +1 -1
- package/dist/cdn/{RIJQIWPS.js → DTZ2ONEH.js} +1 -1
- package/dist/cdn/{BY4ZVGX5.js → E6D5ST6T.js} +1 -1
- package/dist/cdn/{PHMYUCV4.js → EKPMAQZL.js} +1 -1
- package/dist/cdn/{QMB7DTDX.js → EY4TGNKH.js} +1 -1
- package/dist/cdn/{DMLTRFJF.js → EYG74BAU.js} +1 -1
- package/dist/cdn/{5MIMTX7C.js → F22WQNYM.js} +1 -1
- package/dist/cdn/F2VPBX6P.js +2 -0
- package/dist/cdn/{TNQFT7A4.js → FGIBA6EF.js} +1 -1
- package/dist/cdn/{CR4MU73D.js → FNMEFJMB.js} +1 -1
- package/dist/cdn/{63OSRUIO.js → FRLWYGCQ.js} +1 -1
- package/dist/cdn/{QTV63JPF.js → FSFQKKEY.js} +1 -1
- package/dist/cdn/{JNO6KD4V.js → G5B3JJHX.js} +1 -1
- package/dist/cdn/{7R2OHTUX.js → GA6KRSSM.js} +1 -1
- package/dist/cdn/{4O2IYMDZ.js → GEQIQTN5.js} +1 -1
- package/dist/cdn/{NQG4BB2P.js → GPFQA733.js} +1 -1
- package/dist/cdn/{GDCFFQ53.js → GPZNT46Y.js} +1 -1
- package/dist/cdn/{PDWWAB3O.js → H3IXDZI7.js} +1 -1
- package/dist/cdn/{66YYHVLE.js → HBK4F26V.js} +1 -1
- package/dist/cdn/{WWUVMFZI.js → HFRBMQLB.js} +1 -1
- package/dist/cdn/{JY6TT2QB.js → HGIRVP4H.js} +1 -1
- package/dist/cdn/{ZWCCUVYR.js → HJFIIT7D.js} +1 -1
- package/dist/cdn/{AMPDBO7O.js → HJOU6OFP.js} +1 -1
- package/dist/cdn/{ZZ7IVCCX.js → INXDPD5O.js} +1 -1
- package/dist/cdn/{JAFUSV6D.js → ISTAKCL2.js} +1 -1
- package/dist/cdn/{CDPGQU2Z.js → IV5JALI4.js} +1 -1
- package/dist/cdn/{MR53EU6T.js → J4JKD33K.js} +1 -1
- package/dist/cdn/{ON3WDKBS.js → J72U6HVJ.js} +1 -1
- package/dist/cdn/{U5HO3HFE.js → J7WXH7AJ.js} +1 -1
- package/dist/cdn/{6Y2IG3NI.js → JHSEIK5X.js} +1 -1
- package/dist/cdn/{JJG2JBPE.js → K25XXWWF.js} +1 -1
- package/dist/cdn/{JO5DQIH3.js → K6GLNJ32.js} +1 -1
- package/dist/cdn/{WUAMMMHP.js → K7FF7AGO.js} +1 -1
- package/dist/cdn/{YDMMUJRI.js → KG7XN2UZ.js} +1 -1
- package/dist/cdn/{W72MKNDC.js → KIDNC2DH.js} +1 -1
- package/dist/cdn/{6HZQUGCI.js → KMNQJ5WW.js} +1 -1
- package/dist/cdn/{OOVH4ZPV.js → KOAPZD6M.js} +1 -1
- package/dist/cdn/{32Q6FDMA.js → KQG4WUKB.js} +1 -1
- package/dist/cdn/{5VUXKB4L.js → KTY65CUE.js} +1 -1
- package/dist/cdn/{3POIZWGT.js → KZ4HDSQJ.js} +1 -1
- package/dist/cdn/{YBY6CWZ2.js → L7IR4UEX.js} +1 -1
- package/dist/cdn/{MQZ2PM2C.js → LUQ2QMMG.js} +1 -1
- package/dist/cdn/{BZVSGRJO.js → M5M2YH7K.js} +1 -1
- package/dist/cdn/M6Y3HVY7.js +2 -0
- package/dist/cdn/{TNNCPRM2.js → M7XWBRKW.js} +1 -1
- package/dist/cdn/{UVFMFP7C.js → MATNSAWZ.js} +1 -1
- package/dist/cdn/{VO4AAUFX.js → MHEKMC66.js} +1 -1
- package/dist/cdn/{MK6IYIPB.js → MHMNUQK3.js} +1 -1
- package/dist/cdn/{MPGPUF5W.js → MHU2W6BJ.js} +1 -1
- package/dist/cdn/{HCOFTOGW.js → MKQO7B5R.js} +1 -1
- package/dist/cdn/{E65DBDRP.js → MQKSRI7E.js} +1 -1
- package/dist/cdn/{KMR2344E.js → MQWL7QVM.js} +1 -1
- package/dist/cdn/{E4AYJ7XB.js → MRLAAOTJ.js} +1 -1
- package/dist/cdn/{FRKWX3IA.js → NHG7AY6Z.js} +1 -1
- package/dist/cdn/{ZYWFPCA4.js → NYGX7JFT.js} +1 -1
- package/dist/cdn/{D3JB5ZKH.js → NYNZHDCM.js} +1 -1
- package/dist/cdn/{JTUMCWAV.js → OK5Y4G3U.js} +1 -1
- package/dist/cdn/{Q52T2KQK.js → OOOKUGWE.js} +1 -1
- package/dist/cdn/{JP7NIXEK.js → OUFTD2XH.js} +1 -1
- package/dist/cdn/{V2WRQ7I7.js → P3OXFFNK.js} +1 -1
- package/dist/cdn/{5QHAM5VD.js → PEKWSZIB.js} +1 -1
- package/dist/cdn/{ZJQEDR4H.js → Q5FATF7P.js} +1 -1
- package/dist/cdn/{IDY2PICV.js → Q5Y5R727.js} +1 -1
- package/dist/cdn/{VY5SKCYT.js → QBVBKUXP.js} +1 -1
- package/dist/cdn/{BUYQKHFH.js → QRL26KH2.js} +1 -1
- package/dist/cdn/{X55IVJUV.js → QSJYIRTY.js} +1 -1
- package/dist/cdn/{V6RYR4C4.js → R43NUVTL.js} +1 -1
- package/dist/cdn/{3HB55P26.js → RQIUYKPU.js} +1 -1
- package/dist/cdn/{DOJHZPXV.js → RVVDJUQW.js} +1 -1
- package/dist/cdn/{QLDZJ743.js → S3LNTOXZ.js} +1 -1
- package/dist/cdn/{WLJKHWJN.js → S7XJD4Z7.js} +1 -1
- package/dist/cdn/{USS3ZBUQ.js → SBHWOCSV.js} +1 -1
- package/dist/cdn/{HVL4J27L.js → SVWR4VY2.js} +1 -1
- package/dist/cdn/{ZWT2RKT4.js → SWQC2R65.js} +1 -1
- package/dist/cdn/{LHAMW73W.js → T4YJNHS6.js} +1 -1
- package/dist/cdn/{QZVOJPHR.js → TCOCCX5S.js} +1 -1
- package/dist/cdn/{KHPY4I4U.js → TFEFPMH4.js} +1 -1
- package/dist/cdn/TTYAA7KM.js +2 -0
- package/dist/cdn/{IIL3YGHZ.js → UCNJ3HTL.js} +1 -1
- package/dist/cdn/{AEXTS4GI.js → ULSY5MBF.js} +1 -1
- package/dist/cdn/VKC5ZSJ3.js +2 -0
- package/dist/cdn/{A3IDZ4HP.js → VKOYN66F.js} +1 -1
- package/dist/cdn/{57E2LMC2.js → VTN623AZ.js} +1 -1
- package/dist/cdn/{WQSPSYCB.js → VZ32CDBE.js} +1 -1
- package/dist/cdn/{JLMQXO4G.js → WJP63KGJ.js} +1 -1
- package/dist/cdn/{HF57X6NI.js → WJVIFBLZ.js} +1 -1
- package/dist/cdn/{CIPMZLSD.js → WKOHQVBM.js} +1 -1
- package/dist/cdn/{BKQBLUE7.js → X5JUCLT4.js} +1 -1
- package/dist/cdn/{OHVQ3GZQ.js → XF3SSJQS.js} +1 -1
- package/dist/cdn/{5OYEWLEF.js → XJGCO3IP.js} +1 -1
- package/dist/cdn/{WWBDVDAS.js → XUIQIYQE.js} +1 -1
- package/dist/cdn/{6G7HK3DF.js → XW7EUSA6.js} +1 -1
- package/dist/cdn/{IJG4KS5P.js → Y4JUJVYQ.js} +1 -1
- package/dist/cdn/{56Z5KUY7.js → YL2SB2SE.js} +1 -1
- package/dist/cdn/{YZML4DG4.js → YV3LRITX.js} +1 -1
- package/dist/cdn/{RLWBL52I.js → Z7SIGLTH.js} +1 -1
- package/dist/cdn/{36PQFONO.js → Z7ZXU3WD.js} +1 -1
- package/dist/cdn/{GWWCCH7I.js → ZID5WLN3.js} +1 -1
- package/dist/cdn/assets/icon/columnGroup16.json +1 -0
- package/dist/cdn/assets/icon/columnGroup24.json +1 -0
- package/dist/cdn/assets/icon/columnGroup32.json +1 -0
- package/dist/cdn/assets/icon/columnRemove16.json +1 -0
- package/dist/cdn/assets/icon/columnRemove24.json +1 -0
- package/dist/cdn/assets/icon/columnRemove32.json +1 -0
- package/dist/cdn/assets/icon/columnUngroup16.json +1 -0
- package/dist/cdn/assets/icon/columnUngroup24.json +1 -0
- package/dist/cdn/assets/icon/columnUngroup32.json +1 -0
- package/dist/cdn/assets/icon/envelopeOpen16.json +1 -0
- package/dist/cdn/assets/icon/envelopeOpen24.json +1 -0
- package/dist/cdn/assets/icon/envelopeOpen32.json +1 -0
- package/dist/cdn/assets/icon/handDraw16.json +1 -0
- package/dist/cdn/assets/icon/handDraw24.json +1 -0
- package/dist/cdn/assets/icon/handDraw32.json +1 -0
- package/dist/cdn/assets/icon/monitorShare16.json +1 -0
- package/dist/cdn/assets/icon/monitorShare24.json +1 -0
- package/dist/cdn/assets/icon/monitorShare32.json +1 -0
- package/dist/cdn/assets/icon/pi16.json +1 -0
- package/dist/cdn/assets/icon/pi24.json +1 -0
- package/dist/cdn/assets/icon/pi32.json +1 -0
- package/dist/cdn/assets/icon/rowGroup16.json +1 -0
- package/dist/cdn/assets/icon/rowGroup24.json +1 -0
- package/dist/cdn/assets/icon/rowGroup32.json +1 -0
- package/dist/cdn/assets/icon/rowRemove16.json +1 -0
- package/dist/cdn/assets/icon/rowRemove24.json +1 -0
- package/dist/cdn/assets/icon/rowRemove32.json +1 -0
- package/dist/cdn/assets/icon/rowUngroup16.json +1 -0
- package/dist/cdn/assets/icon/rowUngroup24.json +1 -0
- package/dist/cdn/assets/icon/rowUngroup32.json +1 -0
- package/dist/cdn/assets/icon/sdCard16.json +1 -0
- package/dist/cdn/assets/icon/sdCard24.json +1 -0
- package/dist/cdn/assets/icon/sdCard32.json +1 -0
- package/dist/cdn/assets/icon/swatchPalette16.json +1 -0
- package/dist/cdn/assets/icon/swatchPalette24.json +1 -0
- package/dist/cdn/assets/icon/swatchPalette32.json +1 -0
- package/dist/cdn/assets/icon/thermometer16.json +1 -0
- package/dist/cdn/assets/icon/thermometer24.json +1 -0
- package/dist/cdn/assets/icon/thermometer32.json +1 -0
- package/dist/cdn/assets/icon/webCamera16.json +1 -0
- package/dist/cdn/assets/icon/webCamera24.json +1 -0
- package/dist/cdn/assets/icon/webCamera32.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/openCloseComponent.js +5 -5
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/text.js +0 -4
- package/dist/chunks/useForm.js +14 -2
- package/dist/chunks/useTime.js +6 -2
- package/dist/components/calcite-action/customElement.js +2 -2
- package/dist/components/calcite-button/customElement.js +1 -1
- package/dist/components/calcite-color-picker/customElement.js +38 -13
- package/dist/components/calcite-input-time-zone/customElement.js +6 -2
- package/dist/components/calcite-slider/customElement.js +70 -44
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +3 -3
- package/dist/cdn/26T43QVU.js +0 -2
- package/dist/cdn/26YAYKO6.js +0 -2
- package/dist/cdn/3K5UHJ22.js +0 -2
- package/dist/cdn/N5GBL74D.js +0 -2
- package/dist/cdn/NBE3AKGO.js +0 -2
- package/dist/cdn/QXIOI3UW.js +0 -2
- package/dist/cdn/SAWC22RJ.js +0 -2
- package/dist/cdn/UHJJXMEK.js +0 -2
- package/dist/cdn/UHXV6JXZ.js +0 -2
|
@@ -17,6 +17,7 @@ import { u as useT9n } from "../../chunks/useT9n.js";
|
|
|
17
17
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
18
18
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
19
19
|
import { u as useForm } from "../../chunks/useForm.js";
|
|
20
|
+
import { isEqual } from "es-toolkit";
|
|
20
21
|
const CSS = {
|
|
21
22
|
container: "container",
|
|
22
23
|
containerRange: "container--range",
|
|
@@ -66,7 +67,7 @@ class Slider extends LitElement {
|
|
|
66
67
|
}
|
|
67
68
|
this.removeDragListeners();
|
|
68
69
|
this.focusActiveHandle(event.clientX);
|
|
69
|
-
if (this.dragProp && this.lastDragPropValue
|
|
70
|
+
if (this.dragProp && !isEqual(this.lastDragPropValue, this.getDragPropValue(this.dragProp))) {
|
|
70
71
|
this.emitChange();
|
|
71
72
|
}
|
|
72
73
|
this.dragProp = void 0;
|
|
@@ -97,11 +98,11 @@ class Slider extends LitElement {
|
|
|
97
98
|
this.maxValueDragRange = this.maxValue - value;
|
|
98
99
|
this.minMaxValueRange = this.maxValue - this.minValue;
|
|
99
100
|
}
|
|
100
|
-
} else if (isRange(this.value) && isRange(this.previousEmittedValue) && this.dragProp === "maxValue") {
|
|
101
|
+
} else if (isRange(this.value) && this.previousEmittedValue !== void 0 && isRange(this.previousEmittedValue) && this.dragProp === "maxValue") {
|
|
101
102
|
const [previousEmittedMinValue, previousEmittedMaxValue] = this.previousEmittedValue;
|
|
102
103
|
if (previousEmittedMinValue === previousEmittedMaxValue && value < previousEmittedMinValue) {
|
|
103
104
|
this.dragProp = "minValue";
|
|
104
|
-
this.
|
|
105
|
+
this.minHandleRef.value.focus();
|
|
105
106
|
} else {
|
|
106
107
|
this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
|
|
107
108
|
}
|
|
@@ -122,7 +123,21 @@ class Slider extends LitElement {
|
|
|
122
123
|
inputType: "range"
|
|
123
124
|
})(this);
|
|
124
125
|
this.guid = IDS.host(guid());
|
|
126
|
+
this.maxHandleRef = createRef();
|
|
127
|
+
this.maxValueLabelRefs = {
|
|
128
|
+
label: createRef(),
|
|
129
|
+
static: createRef(),
|
|
130
|
+
transformed: createRef()
|
|
131
|
+
};
|
|
132
|
+
this.maxTickLabelRef = createRef();
|
|
125
133
|
this.messages = useT9n({ blocking: true });
|
|
134
|
+
this.minHandleRef = createRef();
|
|
135
|
+
this.minValueLabelRefs = {
|
|
136
|
+
label: createRef(),
|
|
137
|
+
static: createRef(),
|
|
138
|
+
transformed: createRef()
|
|
139
|
+
};
|
|
140
|
+
this.minTickLabelRef = createRef();
|
|
126
141
|
this.pointerUpDragEnd = (event) => {
|
|
127
142
|
if (this.disabled || !isPrimaryPointerButton(event)) {
|
|
128
143
|
return;
|
|
@@ -187,7 +202,7 @@ class Slider extends LitElement {
|
|
|
187
202
|
this._value = Array.isArray(this._value) ? [this.minValue, this.maxValue] : defaultValue;
|
|
188
203
|
}
|
|
189
204
|
async setFocus(options) {
|
|
190
|
-
return this.focusSetter(() => this.
|
|
205
|
+
return this.focusSetter(() => this.minHandleRef.value || this.maxHandleRef.value, options);
|
|
191
206
|
}
|
|
192
207
|
connectedCallback() {
|
|
193
208
|
super.connectedCallback();
|
|
@@ -213,6 +228,9 @@ class Slider extends LitElement {
|
|
|
213
228
|
}
|
|
214
229
|
}
|
|
215
230
|
updated() {
|
|
231
|
+
if (!this.isConnected) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
216
234
|
if (this.labelHandles) {
|
|
217
235
|
this.adjustHostObscuredHandleLabel("value");
|
|
218
236
|
if (isRange(this.value)) {
|
|
@@ -287,9 +305,10 @@ class Slider extends LitElement {
|
|
|
287
305
|
prop = closerToMax || position >= this.maxValue ? "maxValue" : "minValue";
|
|
288
306
|
}
|
|
289
307
|
}
|
|
290
|
-
this.lastDragPropValue = this
|
|
308
|
+
this.lastDragPropValue = this.getDragPropValue(prop);
|
|
291
309
|
this.dragStart(prop);
|
|
292
|
-
const
|
|
310
|
+
const eventPath = event.composedPath();
|
|
311
|
+
const isThumbActive = [this.minHandleRef.value, this.maxHandleRef.value].some((handle) => handle && eventPath.includes(handle));
|
|
293
312
|
if (!isThumbActive) {
|
|
294
313
|
this.setValue({ [prop]: this.clamp(position, prop) });
|
|
295
314
|
}
|
|
@@ -386,11 +405,14 @@ class Slider extends LitElement {
|
|
|
386
405
|
window.addEventListener("pointerup", this.pointerUpDragEnd);
|
|
387
406
|
window.addEventListener("pointercancel", this.dragEnd);
|
|
388
407
|
}
|
|
408
|
+
getDragPropValue(prop) {
|
|
409
|
+
return prop === "minMaxValue" ? this.value : this[prop];
|
|
410
|
+
}
|
|
389
411
|
focusActiveHandle(valueX) {
|
|
390
412
|
if (this.dragProp === "minValue") {
|
|
391
|
-
this.
|
|
413
|
+
this.minHandleRef.value.focus();
|
|
392
414
|
} else if (this.dragProp === "maxValue" || this.dragProp === "value") {
|
|
393
|
-
this.
|
|
415
|
+
this.maxHandleRef.value.focus();
|
|
394
416
|
} else if (this.dragProp === "minMaxValue") {
|
|
395
417
|
this.getClosestHandle(valueX).focus();
|
|
396
418
|
}
|
|
@@ -408,6 +430,9 @@ class Slider extends LitElement {
|
|
|
408
430
|
let valueChanged = false;
|
|
409
431
|
Object.keys(values).forEach((propName) => {
|
|
410
432
|
const newValue = values[propName];
|
|
433
|
+
if (newValue === void 0) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
411
436
|
if (!valueChanged) {
|
|
412
437
|
const oldValue = this[propName];
|
|
413
438
|
valueChanged = oldValue !== newValue;
|
|
@@ -426,17 +451,6 @@ class Slider extends LitElement {
|
|
|
426
451
|
}
|
|
427
452
|
this.calciteSliderInput.emit();
|
|
428
453
|
}
|
|
429
|
-
setThumbEl(el) {
|
|
430
|
-
if (!el) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const valueProp = el.getAttribute("data-value-prop");
|
|
434
|
-
if (valueProp === "minValue") {
|
|
435
|
-
this.minHandle = el;
|
|
436
|
-
} else {
|
|
437
|
-
this.maxHandle = el;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
454
|
clamp(value, prop) {
|
|
441
455
|
value = clamp(value, this.min, this.max);
|
|
442
456
|
if (prop === "maxValue") {
|
|
@@ -466,7 +480,9 @@ class Slider extends LitElement {
|
|
|
466
480
|
return snappedValue;
|
|
467
481
|
}
|
|
468
482
|
getClosestHandle(valueX) {
|
|
469
|
-
|
|
483
|
+
const minHandle = this.minHandleRef.value;
|
|
484
|
+
const maxHandle = this.maxHandleRef.value;
|
|
485
|
+
return this.getDistanceX(maxHandle, valueX) > this.getDistanceX(minHandle, valueX) ? minHandle : maxHandle;
|
|
470
486
|
}
|
|
471
487
|
getDistanceX(el, valueX) {
|
|
472
488
|
return Math.abs(el.getBoundingClientRect().left - valueX);
|
|
@@ -480,27 +496,26 @@ class Slider extends LitElement {
|
|
|
480
496
|
return (num - this.min) / range;
|
|
481
497
|
}
|
|
482
498
|
adjustHostObscuredHandleLabel(name) {
|
|
483
|
-
const
|
|
484
|
-
const label =
|
|
485
|
-
const labelStatic =
|
|
486
|
-
const labelTransformed =
|
|
499
|
+
const labelRefs = name === "minValue" ? this.minValueLabelRefs : this.maxValueLabelRefs;
|
|
500
|
+
const label = labelRefs.label.value;
|
|
501
|
+
const labelStatic = labelRefs.static.value;
|
|
502
|
+
const labelTransformed = labelRefs.transformed.value;
|
|
487
503
|
const labelStaticBounds = labelStatic.getBoundingClientRect();
|
|
488
504
|
const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
|
|
489
505
|
label.style.transform = `translateX(${labelStaticOffset}px)`;
|
|
490
506
|
labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
|
|
491
507
|
}
|
|
492
508
|
hyphenateCollidingRangeHandleLabels() {
|
|
493
|
-
const shadowRoot = this.el.shadowRoot;
|
|
494
509
|
const mirror = this.shouldMirror();
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
const leftValueLabel =
|
|
498
|
-
const leftValueLabelStatic =
|
|
499
|
-
const leftValueLabelTransformed =
|
|
510
|
+
const leftValueLabelRefs = mirror ? this.maxValueLabelRefs : this.minValueLabelRefs;
|
|
511
|
+
const rightValueLabelRefs = mirror ? this.minValueLabelRefs : this.maxValueLabelRefs;
|
|
512
|
+
const leftValueLabel = leftValueLabelRefs.label.value;
|
|
513
|
+
const leftValueLabelStatic = leftValueLabelRefs.static.value;
|
|
514
|
+
const leftValueLabelTransformed = leftValueLabelRefs.transformed.value;
|
|
500
515
|
const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
|
|
501
|
-
const rightValueLabel =
|
|
502
|
-
const rightValueLabelStatic =
|
|
503
|
-
const rightValueLabelTransformed =
|
|
516
|
+
const rightValueLabel = rightValueLabelRefs.label.value;
|
|
517
|
+
const rightValueLabelStatic = rightValueLabelRefs.static.value;
|
|
518
|
+
const rightValueLabelTransformed = rightValueLabelRefs.transformed.value;
|
|
504
519
|
const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
|
|
505
520
|
const labelFontSize = this.getFontSizeForElement(leftValueLabel);
|
|
506
521
|
const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
|
|
@@ -564,11 +579,10 @@ class Slider extends LitElement {
|
|
|
564
579
|
if (this.hasHistogram && !this.precise && !this.labelHandles) {
|
|
565
580
|
return;
|
|
566
581
|
}
|
|
567
|
-
const
|
|
568
|
-
const
|
|
569
|
-
const
|
|
570
|
-
const
|
|
571
|
-
const maxTickLabel = shadowRoot.querySelector(`.${CSS.tickMax}`);
|
|
582
|
+
const minHandle = this.minHandleRef.value;
|
|
583
|
+
const maxHandle = this.maxHandleRef.value;
|
|
584
|
+
const minTickLabel = this.minTickLabelRef.value;
|
|
585
|
+
const maxTickLabel = this.maxTickLabelRef.value;
|
|
572
586
|
if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
|
|
573
587
|
minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
|
|
574
588
|
maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
|
|
@@ -697,10 +711,11 @@ class Slider extends LitElement {
|
|
|
697
711
|
const displayedValue = valueProp === "minValue" ? this.internalLabelFormatter(this.minValue, "min") : valueProp === "maxValue" ? this.internalLabelFormatter(this.maxValue, "max") : this.internalLabelFormatter(value, "value");
|
|
698
712
|
const thumbStyle = isMinThumb ? { left: `${mirror ? 100 - minInterval : minInterval}%` } : { right: `${mirror ? maxInterval : 100 - maxInterval}%` };
|
|
699
713
|
const thumbLabelClasses = `${CSS.handleLabel} ${isMinThumb ? CSS.handleLabelMinValue : CSS.handleLabelValue}`;
|
|
714
|
+
const labelRefs = isMinThumb ? this.minValueLabelRefs : this.maxValueLabelRefs;
|
|
700
715
|
const labels = isLabeled ? [
|
|
701
|
-
html`<span aria-hidden=true class=${safeClassMap(thumbLabelClasses)}>${displayedValue}</span>`,
|
|
702
|
-
html`<span aria-hidden=true class=${`${thumbLabelClasses} ${CSS.static}`}>${displayedValue}</span>`,
|
|
703
|
-
html`<span aria-hidden=true class=${`${thumbLabelClasses} ${CSS.transformed}`}>${displayedValue}</span>`
|
|
716
|
+
html`<span aria-hidden=true class=${safeClassMap(thumbLabelClasses)} ${ref(labelRefs.label)}>${displayedValue}</span>`,
|
|
717
|
+
html`<span aria-hidden=true class=${`${thumbLabelClasses} ${CSS.static}`} ${ref(labelRefs.static)}>${displayedValue}</span>`,
|
|
718
|
+
html`<span aria-hidden=true class=${`${thumbLabelClasses} ${CSS.transformed}`} ${ref(labelRefs.transformed)}>${displayedValue}</span>`
|
|
704
719
|
] : [];
|
|
705
720
|
const thumbContent = [
|
|
706
721
|
...labels,
|
|
@@ -716,7 +731,7 @@ class Slider extends LitElement {
|
|
|
716
731
|
[CSS.thumbActive]: this.lastDragProp !== "minMaxValue" && this.dragProp === valueProp,
|
|
717
732
|
[CSS.thumbPrecise]: isPrecise,
|
|
718
733
|
[CSS.thumbMinValue]: isMinThumb
|
|
719
|
-
})} data-value-prop=${valueProp ?? nothing} @blur=${this.onThumbBlur} @focus=${this.onThumbFocus} @pointerdown=${this.onThumbPointerDown} role=slider style=${safeStyleMap(thumbStyle)} tabindex=0 ${ref(this.
|
|
734
|
+
})} data-value-prop=${valueProp ?? nothing} @blur=${this.onThumbBlur} @focus=${this.onThumbFocus} @pointerdown=${this.onThumbPointerDown} role=slider style=${safeStyleMap(thumbStyle)} tabindex=0 ${ref(isMinThumb ? this.minHandleRef : this.maxHandleRef)}>${thumbContent}</div>`);
|
|
720
735
|
}
|
|
721
736
|
renderGraph() {
|
|
722
737
|
return this.histogram ? html`<calcite-graph class=${safeClassMap(CSS.graph)} .colorStops=${this.histogramStops} .data=${this.histogram} .highlightMax=${isRange(this.value) ? this.maxValue : this.value} .highlightMin=${isRange(this.value) ? this.minValue : this.min} .max=${this.max} .min=${this.min}></calcite-graph>` : null;
|
|
@@ -728,11 +743,22 @@ class Slider extends LitElement {
|
|
|
728
743
|
const isMaxTickLabel = tick === max;
|
|
729
744
|
const isAtEdge = isMinTickLabel || isMaxTickLabel;
|
|
730
745
|
const shouldDisplayLabel = labelTicks && (!hasHistogram && (isAtEdge || !precise || !valueIsRange) || hasHistogram && (isAtEdge || !precise && !labelHandles));
|
|
731
|
-
|
|
746
|
+
if (!shouldDisplayLabel) {
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
const tickLabelClasses = {
|
|
732
750
|
[CSS.tickLabel]: true,
|
|
733
751
|
[CSS.tickMin]: isMinTickLabel,
|
|
734
752
|
[CSS.tickMax]: isMaxTickLabel
|
|
735
|
-
}
|
|
753
|
+
};
|
|
754
|
+
const tickLabel = this.internalLabelFormatter(tick, "tick");
|
|
755
|
+
if (isMinTickLabel) {
|
|
756
|
+
return html`<span class=${safeClassMap(tickLabelClasses)} ${ref(this.minTickLabelRef)}>${tickLabel}</span>`;
|
|
757
|
+
}
|
|
758
|
+
if (isMaxTickLabel) {
|
|
759
|
+
return html`<span class=${safeClassMap(tickLabelClasses)} ${ref(this.maxTickLabelRef)}>${tickLabel}</span>`;
|
|
760
|
+
}
|
|
761
|
+
return html`<span class=${safeClassMap(tickLabelClasses)}>${tickLabel}</span>`;
|
|
736
762
|
}
|
|
737
763
|
}
|
|
738
764
|
customElement("calcite-slider", Slider);
|