@esri/calcite-components 5.2.0-next.7 → 5.2.0-next.8
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/{5BBXVTVC.js → 2KDUUXIU.js} +1 -1
- package/dist/cdn/{2X6QZRGI.js → 2T6RYQXQ.js} +1 -1
- package/dist/cdn/{67HJME4D.js → 2ZYEFS4R.js} +1 -1
- package/dist/cdn/{DU34ZRAK.js → 33OATGR4.js} +1 -1
- package/dist/cdn/{EM2QRJCP.js → 3CUP2E34.js} +1 -1
- package/dist/cdn/{GQSSPVYH.js → 3DMOTAL5.js} +1 -1
- package/dist/cdn/{SU7BYFW3.js → 3DROCAQL.js} +1 -1
- package/dist/cdn/{MWHL3FGX.js → 3EX6TDIA.js} +1 -1
- package/dist/cdn/{NRYSWYNK.js → 3I6N73T4.js} +1 -1
- package/dist/cdn/{KV4UMXMD.js → 3XDG5DCZ.js} +1 -1
- package/dist/cdn/{NFDSCUC7.js → 42E3K5AW.js} +1 -1
- package/dist/cdn/{DHCG4KMO.js → 4CCOEFEW.js} +1 -1
- package/dist/cdn/{RYR7RCAB.js → 4DE452CJ.js} +1 -1
- package/dist/cdn/{4SXYANKI.js → 4ECLQBZQ.js} +1 -1
- package/dist/cdn/{SRGRHGJ5.js → 4P77ZRBH.js} +1 -1
- package/dist/cdn/{37C2BTJH.js → 4TSJDMSV.js} +1 -1
- package/dist/cdn/{KCL3KOWK.js → 5CLXCL6Y.js} +1 -1
- package/dist/cdn/{WEXOUBDS.js → 5IJAADUF.js} +1 -1
- package/dist/cdn/{YZHTEJRH.js → 5J2GB4J3.js} +1 -1
- package/dist/cdn/{BDRBFTUJ.js → 5TJ7WWVN.js} +1 -1
- package/dist/cdn/{PQLUXN7R.js → 5YNXBNGP.js} +1 -1
- package/dist/cdn/{ZMVMH3BK.js → 5ZOELRWO.js} +1 -1
- package/dist/cdn/{5L75WHPS.js → 6CAVVJCP.js} +1 -1
- package/dist/cdn/{PQK6ETUC.js → 6DGJHUQO.js} +1 -1
- package/dist/cdn/{GGJZTKGX.js → 6ENPRCZM.js} +1 -1
- package/dist/cdn/{FL5AI52A.js → 6ML3NLFM.js} +1 -1
- package/dist/cdn/{JI2XHUUM.js → 74XLK3K6.js} +1 -1
- package/dist/cdn/{DS5VHI4Z.js → 7IQUA4JE.js} +1 -1
- package/dist/cdn/{IHPU7EWA.js → 7L4VVXSZ.js} +1 -1
- package/dist/cdn/{BE7SWPCI.js → 7LURFLRF.js} +1 -1
- package/dist/cdn/{XZJNARMG.js → 7TYCYK5P.js} +1 -1
- package/dist/cdn/{JPRBZLNY.js → 7UCARA53.js} +1 -1
- package/dist/cdn/AEY5LOCA.js +2 -0
- package/dist/cdn/{AEUGG6UI.js → ALA7HODM.js} +1 -1
- package/dist/cdn/{RDBTAJCH.js → ASWTAH37.js} +1 -1
- package/dist/cdn/{M5GCKYUY.js → B3CPEQLG.js} +1 -1
- package/dist/cdn/{5HP5FZAB.js → BA36JDIJ.js} +1 -1
- package/dist/cdn/{WF6BMZT7.js → BHHO3CNQ.js} +1 -1
- package/dist/cdn/{NFHPGWE3.js → BQVG3O3G.js} +1 -1
- package/dist/cdn/{F5S74A6J.js → C2UEEF3A.js} +1 -1
- package/dist/cdn/{S5YU36AW.js → C77YFIM3.js} +1 -1
- package/dist/cdn/{J7FC6ZPY.js → CARSBC7E.js} +1 -1
- package/dist/cdn/{2ZLARVHZ.js → CASTSWDV.js} +1 -1
- package/dist/cdn/{IJAMTOKN.js → CDLARAP5.js} +1 -1
- package/dist/cdn/{NCAFX2IU.js → CFCMJTYI.js} +1 -1
- package/dist/cdn/{4HQGPAC7.js → CMIBFZZC.js} +1 -1
- package/dist/cdn/{ORKUIIJK.js → CNH2PL3A.js} +1 -1
- package/dist/cdn/CU6HZ2JJ.js +2 -0
- package/dist/cdn/{6A6DR3VH.js → CUPW3OIR.js} +1 -1
- package/dist/cdn/{XJ36MZLC.js → DHEWQOY4.js} +1 -1
- package/dist/cdn/{MO5PWDHH.js → DYNFXWTT.js} +1 -1
- package/dist/cdn/{CJMUF6Z7.js → E24OWARN.js} +1 -1
- package/dist/cdn/{B5M6XZPQ.js → E7ZDN5OH.js} +1 -1
- package/dist/cdn/{MEPDW4WV.js → EEOFGKLI.js} +2 -2
- package/dist/cdn/{5W44MDZE.js → EKF6NDL7.js} +1 -1
- package/dist/cdn/{RBSWNTNU.js → ELOBOGQS.js} +1 -1
- package/dist/cdn/{744TBMM3.js → EPTZEF22.js} +1 -1
- package/dist/cdn/ERTTZ4RP.js +2 -0
- package/dist/cdn/{FHFQFLLV.js → EUTRDXQ2.js} +1 -1
- package/dist/cdn/{3ND6JJU2.js → F4P2BGQV.js} +1 -1
- package/dist/cdn/{22N7ARV7.js → FATNGVNJ.js} +1 -1
- package/dist/cdn/{AQOHIR7I.js → FI6GRZKY.js} +1 -1
- package/dist/cdn/{6C54IW5E.js → FLGJFEF4.js} +1 -1
- package/dist/cdn/{WYOJIAFW.js → FMPVR6AO.js} +1 -1
- package/dist/cdn/{BZR7SCVQ.js → FOQ2SUKE.js} +1 -1
- package/dist/cdn/FT2HA2I4.js +2 -0
- package/dist/cdn/{WYAVJAPT.js → FUD2VGGV.js} +1 -1
- package/dist/cdn/{FQU67QYY.js → G3YGGBDQ.js} +1 -1
- package/dist/cdn/{YHD7HKDX.js → GHDKS4TD.js} +1 -1
- package/dist/cdn/{3FM74CVY.js → GWELZXFR.js} +1 -1
- package/dist/cdn/{AFLT7NPW.js → HFY4WMNW.js} +1 -1
- package/dist/cdn/{HBLG43FI.js → HI7DACWU.js} +1 -1
- package/dist/cdn/{D3VMRWYN.js → HMPOVZAJ.js} +1 -1
- package/dist/cdn/{6TCERT23.js → HOOPFOCA.js} +1 -1
- package/dist/cdn/{FQGP2TF4.js → HPZXWDPU.js} +1 -1
- package/dist/cdn/{QENJY6C7.js → HWJ2CJFG.js} +1 -1
- package/dist/cdn/{UES5LGVM.js → HX4CFRKW.js} +1 -1
- package/dist/cdn/{QJF5YGPY.js → IAN2VNLX.js} +1 -1
- package/dist/cdn/{HXT7NOOV.js → IHGF5524.js} +1 -1
- package/dist/cdn/{4RYFAF65.js → IOLHNYZE.js} +1 -1
- package/dist/cdn/{CA6ESPGD.js → J4ESNVXW.js} +1 -1
- package/dist/cdn/{WSZFROTG.js → JCJV4TYS.js} +1 -1
- package/dist/cdn/{45ZL6S2L.js → K3G7QFLF.js} +1 -1
- package/dist/cdn/{NU72X3HS.js → KVR23OAX.js} +1 -1
- package/dist/cdn/{SVJV6P4P.js → KVWFFO2Y.js} +1 -1
- package/dist/cdn/{6VGI37NE.js → L6OWYBBH.js} +1 -1
- package/dist/cdn/{X37OGDUE.js → LTE7JJUZ.js} +1 -1
- package/dist/cdn/{JQA4RU76.js → MZDNIBCQ.js} +1 -1
- package/dist/cdn/{ZEDBMSXG.js → NA5OLGIY.js} +1 -1
- package/dist/cdn/NR6V5HZB.js +2 -0
- package/dist/cdn/{JCW6IR2I.js → NTAEYRY6.js} +1 -1
- package/dist/cdn/{Z3UI7HPY.js → NTL7LSIZ.js} +1 -1
- package/dist/cdn/{BM7PKEQF.js → NUZKOPX6.js} +1 -1
- package/dist/cdn/OIO5CL6R.js +2 -0
- package/dist/cdn/{HEIJ72GT.js → OJE22IGP.js} +1 -1
- package/dist/cdn/OKM5SS4B.js +2 -0
- package/dist/cdn/{MDMDAT7S.js → OPL23FR7.js} +1 -1
- package/dist/cdn/{I5C2XC5I.js → P5E4K2YU.js} +1 -1
- package/dist/cdn/{C5A7GGD4.js → PE3YZIAT.js} +1 -1
- package/dist/cdn/{JB4DSSHG.js → PGMLUFVU.js} +1 -1
- package/dist/cdn/{AE4FA7FY.js → QBSYK3AR.js} +1 -1
- package/dist/cdn/{EIG5UNV3.js → QEWYVOHX.js} +1 -1
- package/dist/cdn/{ET5QQ6ZE.js → QFZURAGK.js} +1 -1
- package/dist/cdn/{HMXCTTUK.js → QI4FGO3G.js} +1 -1
- package/dist/cdn/{C3EMHXIX.js → QKWOCRRV.js} +1 -1
- package/dist/cdn/QQDQTFWB.js +2 -0
- package/dist/cdn/{7BIEHNBN.js → QW24VHLN.js} +1 -1
- package/dist/cdn/QWPCCTSZ.js +2 -0
- package/dist/cdn/{TOJCGSWL.js → QZ6BJ2XH.js} +1 -1
- package/dist/cdn/{2W5AIJ3P.js → RGZBMAMP.js} +1 -1
- package/dist/cdn/{7KVOA3RG.js → RHYXRYOQ.js} +1 -1
- package/dist/cdn/RPL7QQKV.js +2 -0
- package/dist/cdn/{Q5CRHYT4.js → RVEQPYHY.js} +1 -1
- package/dist/cdn/{3DZCTGTX.js → S3YOKYLX.js} +1 -1
- package/dist/cdn/{TSXOSLFT.js → S7MAO6Y3.js} +1 -1
- package/dist/cdn/{N2LGKOPB.js → SHL4XOS5.js} +1 -1
- package/dist/cdn/{EHGKLR2I.js → SI5TAY2P.js} +1 -1
- package/dist/cdn/{OFDHYKQN.js → SPQMG5CJ.js} +1 -1
- package/dist/cdn/{ZPQZYGS3.js → SRWGOEGR.js} +1 -1
- package/dist/cdn/{UOHGU4YY.js → TCVD3ABC.js} +1 -1
- package/dist/cdn/{EEHC75BT.js → TUGQ2UBU.js} +1 -1
- package/dist/cdn/{NEBN6Q6V.js → U4ZE6G4R.js} +1 -1
- package/dist/cdn/{ZHL36WFZ.js → U6LERXLN.js} +1 -1
- package/dist/cdn/{HCQ73WZV.js → UBEY6AST.js} +1 -1
- package/dist/cdn/{6MJP7OIJ.js → UBXZOZUZ.js} +1 -1
- package/dist/cdn/{2B5SK2B4.js → UFIIF52W.js} +1 -1
- package/dist/cdn/{YXRKYXM3.js → USJ4RTSF.js} +1 -1
- package/dist/cdn/{D4HPNC3L.js → UUHMF2K7.js} +1 -1
- package/dist/cdn/{2DVSDS5W.js → V7GKBVT6.js} +1 -1
- package/dist/cdn/{H7UZS446.js → VB76CA5U.js} +1 -1
- package/dist/cdn/{N3XTOHD4.js → VB7LMUSD.js} +1 -1
- package/dist/cdn/{NXUFQ4YS.js → VJOLRX4C.js} +1 -1
- package/dist/cdn/{R35E6X4J.js → VOLJQKCP.js} +1 -1
- package/dist/cdn/{GZNLRM76.js → VV6PH6JX.js} +1 -1
- package/dist/cdn/{3IMK322V.js → WA6QWQ6S.js} +1 -1
- package/dist/cdn/{4ZQOFYGA.js → WDI6DIHP.js} +1 -1
- package/dist/cdn/{OINOBLBC.js → WOETTTEU.js} +1 -1
- package/dist/cdn/{O2QQXYDW.js → WTMSZNJL.js} +1 -1
- package/dist/cdn/{UJRRKIO7.js → WVYYQ7DV.js} +1 -1
- package/dist/cdn/{SBWEXBSU.js → Y4TGZ522.js} +1 -1
- package/dist/cdn/{U5NEBHS5.js → YFQY77OM.js} +1 -1
- package/dist/cdn/YJPIZ6DX.js +2 -0
- package/dist/cdn/{Q67TFS2A.js → YK77UYHI.js} +1 -1
- package/dist/cdn/{VPVCIXE2.js → YMH4S3VW.js} +1 -1
- package/dist/cdn/{MLDTAC4V.js → YZNE3ZW6.js} +1 -1
- package/dist/cdn/{QLNBJ3D2.js → Z34FSXQJ.js} +1 -1
- package/dist/cdn/Z5A5DESW.js +2 -0
- package/dist/cdn/{GMEB4FUQ.js → ZEBRIFPJ.js} +1 -1
- package/dist/cdn/{FJWV33EJ.js → ZRWXJ4YA.js} +1 -1
- package/dist/cdn/{V6FHFWKX.js → ZT3EZZRB.js} +1 -1
- package/dist/cdn/assets/icon/userSave16.json +1 -0
- package/dist/cdn/assets/icon/userSave24.json +1 -0
- package/dist/cdn/assets/icon/userSave32.json +1 -0
- package/dist/cdn/assets/icon/weatherRadar16.json +1 -0
- package/dist/cdn/assets/icon/weatherRadar24.json +1 -0
- package/dist/cdn/assets/icon/weatherRadar32.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/date.js +9 -6
- package/dist/chunks/dom.js +3 -2
- package/dist/chunks/math.js +1 -1
- package/dist/chunks/responsive.js +1 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useTime.js +24 -24
- package/dist/chunks/utils.js +3 -3
- package/dist/chunks/utils3.js +1 -1
- package/dist/components/calcite-carousel/customElement.js +1 -1
- package/dist/components/calcite-combobox/customElement.js +6 -6
- package/dist/components/calcite-date-picker/customElement.d.ts +10 -10
- package/dist/components/calcite-date-picker/customElement.js +18 -18
- package/dist/components/calcite-date-picker-day/customElement.js +2 -2
- package/dist/components/calcite-date-picker-month/customElement.d.ts +4 -4
- package/dist/components/calcite-date-picker-month/customElement.js +19 -14
- package/dist/components/calcite-date-picker-month-header/customElement.js +14 -9
- package/dist/components/calcite-dialog/customElement.d.ts +8 -8
- package/dist/components/calcite-dialog/customElement.js +5 -6
- package/dist/components/calcite-dropdown/customElement.d.ts +3 -3
- package/dist/components/calcite-dropdown/customElement.js +9 -6
- package/dist/components/calcite-dropdown-group/customElement.d.ts +1 -1
- package/dist/components/calcite-dropdown-group/customElement.js +1 -1
- package/dist/components/calcite-dropdown-item/customElement.d.ts +7 -7
- package/dist/components/calcite-dropdown-item/customElement.js +3 -3
- package/dist/components/calcite-input-date-picker/customElement.js +16 -16
- package/dist/components/calcite-input-time-picker/customElement.js +4 -4
- package/dist/components/calcite-input-time-zone/customElement.js +2 -2
- package/dist/components/calcite-pagination/customElement.js +1 -1
- package/dist/components/calcite-tab-nav/customElement.js +1 -1
- package/dist/components/calcite-time-picker/customElement.js +4 -4
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/utils/date.d.ts +2 -2
- package/package.json +3 -3
- package/dist/cdn/255CJNBQ.js +0 -2
- package/dist/cdn/7HMML2DR.js +0 -2
- package/dist/cdn/7QSFRDV5.js +0 -2
- package/dist/cdn/GZTMMGCJ.js +0 -2
- package/dist/cdn/HKIP6O5B.js +0 -2
- package/dist/cdn/LKEGNPWV.js +0 -2
- package/dist/cdn/NMBCJCCO.js +0 -2
- package/dist/cdn/OR55DZMS.js +0 -2
- package/dist/cdn/QVYX2WRU.js +0 -2
- package/dist/cdn/SEHJ4RKZ.js +0 -2
- package/dist/cdn/UL7L5FJO.js +0 -2
- package/dist/cdn/XG27KSRC.js +0 -2
package/dist/chunks/useTime.js
CHANGED
|
@@ -57,7 +57,7 @@ function formatTimePart(number, minLength) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
function fractionalSecondPartToMilliseconds(fractionalSecondPart) {
|
|
60
|
-
return parseInt((parseFloat(`0.${fractionalSecondPart}`) / 1e-3).toFixed(3));
|
|
60
|
+
return parseInt((parseFloat(`0.${fractionalSecondPart}`) / 1e-3).toFixed(3), 10);
|
|
61
61
|
}
|
|
62
62
|
function getLocaleHourFormat(locale) {
|
|
63
63
|
const options = { locale };
|
|
@@ -166,7 +166,7 @@ function getMeridiem(hour) {
|
|
|
166
166
|
if (!isValidNumber(hour)) {
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
|
-
const hourAsNumber = parseInt(hour);
|
|
169
|
+
const hourAsNumber = parseInt(hour, 10);
|
|
170
170
|
return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
|
|
171
171
|
}
|
|
172
172
|
function getMeridiemOrder(locale) {
|
|
@@ -195,9 +195,9 @@ function isValidTime(value) {
|
|
|
195
195
|
if (!hour || !minute) {
|
|
196
196
|
return false;
|
|
197
197
|
}
|
|
198
|
-
const hourAsNumber = parseInt(hour);
|
|
199
|
-
const minuteAsNumber = parseInt(minute);
|
|
200
|
-
const secondAsNumber = parseInt(second ?? "");
|
|
198
|
+
const hourAsNumber = parseInt(hour, 10);
|
|
199
|
+
const minuteAsNumber = parseInt(minute, 10);
|
|
200
|
+
const secondAsNumber = parseInt(second ?? "", 10);
|
|
201
201
|
const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
|
|
202
202
|
const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
|
|
203
203
|
const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
|
|
@@ -243,7 +243,7 @@ function localizeTimePart({
|
|
|
243
243
|
numberingSystem
|
|
244
244
|
};
|
|
245
245
|
const localizedZero = numberStringFormatter.localize("0");
|
|
246
|
-
if (parseInt(value) === 0) {
|
|
246
|
+
if (parseInt(value, 10) === 0) {
|
|
247
247
|
localizedFractionalSecond = "".padStart(value.length, localizedZero);
|
|
248
248
|
} else {
|
|
249
249
|
localizedFractionalSecond = numberStringFormatter.localize(`0.${value}`).replace(`${localizedZero}${localizedDecimalSeparator}`, "");
|
|
@@ -254,7 +254,7 @@ function localizeTimePart({
|
|
|
254
254
|
}
|
|
255
255
|
return localizedFractionalSecond;
|
|
256
256
|
}
|
|
257
|
-
const valueAsNumber = parseInt(value);
|
|
257
|
+
const valueAsNumber = parseInt(value, 10);
|
|
258
258
|
const date = new Date(
|
|
259
259
|
Date.UTC(
|
|
260
260
|
0,
|
|
@@ -291,9 +291,9 @@ function localizeTimeString({
|
|
|
291
291
|
0,
|
|
292
292
|
0,
|
|
293
293
|
0,
|
|
294
|
-
parseInt(hour),
|
|
295
|
-
parseInt(minute),
|
|
296
|
-
includeSeconds && typeof second === "string" ? parseInt(second) : 0,
|
|
294
|
+
parseInt(hour, 10),
|
|
295
|
+
parseInt(minute, 10),
|
|
296
|
+
includeSeconds && typeof second === "string" ? parseInt(second, 10) : 0,
|
|
297
297
|
includeSeconds && fractionalSecond ? fractionalSecondPartToMilliseconds(fractionalSecond) : 0
|
|
298
298
|
)
|
|
299
299
|
);
|
|
@@ -381,9 +381,9 @@ function toISOTimeString(value, step = 60) {
|
|
|
381
381
|
fractionalSecond = value.fractionalSecond;
|
|
382
382
|
}
|
|
383
383
|
if (hour && minute) {
|
|
384
|
-
isoTimeString = `${formatTimePart(parseInt(hour))}:${formatTimePart(parseInt(minute))}`;
|
|
384
|
+
isoTimeString = `${formatTimePart(parseInt(hour, 10))}:${formatTimePart(parseInt(minute, 10))}`;
|
|
385
385
|
if (step < 60) {
|
|
386
|
-
isoTimeString += `:${formatTimePart(parseInt(second || "0"))}`;
|
|
386
|
+
isoTimeString += `:${formatTimePart(parseInt(second || "0", 10))}`;
|
|
387
387
|
if (step < 1) {
|
|
388
388
|
isoTimeString += `.${formatFractionalSecond(fractionalSecond || "0", step)}`;
|
|
389
389
|
}
|
|
@@ -399,7 +399,7 @@ class TimeController extends GenericController {
|
|
|
399
399
|
this.handleHourKeyDownEvent = (event) => {
|
|
400
400
|
const key = event.key;
|
|
401
401
|
if (numberKeys.includes(key)) {
|
|
402
|
-
const keyAsNumber = parseInt(key);
|
|
402
|
+
const keyAsNumber = parseInt(key, 10);
|
|
403
403
|
let newHour;
|
|
404
404
|
if (isValidNumber(this.hour)) {
|
|
405
405
|
switch (this.hourFormat) {
|
|
@@ -445,10 +445,10 @@ class TimeController extends GenericController {
|
|
|
445
445
|
this.handleMinuteKeyDownEvent = (event) => {
|
|
446
446
|
const key = event.key;
|
|
447
447
|
if (numberKeys.includes(key)) {
|
|
448
|
-
const keyAsNumber = parseInt(key);
|
|
448
|
+
const keyAsNumber = parseInt(key, 10);
|
|
449
449
|
let newMinute;
|
|
450
450
|
if (typeof this.minute === "string" && isValidNumber(this.minute) && this.minute.startsWith("0")) {
|
|
451
|
-
const minuteAsNumber = parseInt(this.minute);
|
|
451
|
+
const minuteAsNumber = parseInt(this.minute, 10);
|
|
452
452
|
newMinute = minuteAsNumber > maxTenthForMinuteAndSecond ? keyAsNumber : `${minuteAsNumber}${keyAsNumber}`;
|
|
453
453
|
} else {
|
|
454
454
|
newMinute = keyAsNumber;
|
|
@@ -479,10 +479,10 @@ class TimeController extends GenericController {
|
|
|
479
479
|
this.handleSecondKeyDownEvent = (event) => {
|
|
480
480
|
const key = event.key;
|
|
481
481
|
if (numberKeys.includes(key)) {
|
|
482
|
-
const keyAsNumber = parseInt(key);
|
|
482
|
+
const keyAsNumber = parseInt(key, 10);
|
|
483
483
|
let newSecond;
|
|
484
484
|
if (typeof this.second === "string" && isValidNumber(this.second) && this.second.startsWith("0")) {
|
|
485
|
-
const secondAsNumber = parseInt(this.second);
|
|
485
|
+
const secondAsNumber = parseInt(this.second, 10);
|
|
486
486
|
newSecond = secondAsNumber > maxTenthForMinuteAndSecond ? keyAsNumber : `${secondAsNumber}${keyAsNumber}`;
|
|
487
487
|
} else {
|
|
488
488
|
newSecond = keyAsNumber;
|
|
@@ -514,7 +514,7 @@ class TimeController extends GenericController {
|
|
|
514
514
|
const { key } = event;
|
|
515
515
|
if (numberKeys.includes(key)) {
|
|
516
516
|
const stepPrecision = decimalPlaces(this.component.step);
|
|
517
|
-
const fractionalSecondAsInteger = parseInt(this.fractionalSecond);
|
|
517
|
+
const fractionalSecondAsInteger = parseInt(this.fractionalSecond, 10);
|
|
518
518
|
const fractionalSecondAsIntegerLength = fractionalSecondAsInteger.toString().length;
|
|
519
519
|
let newFractionalSecondAsIntegerString;
|
|
520
520
|
if (fractionalSecondAsIntegerLength >= stepPrecision) {
|
|
@@ -579,7 +579,7 @@ class TimeController extends GenericController {
|
|
|
579
579
|
//#endregion
|
|
580
580
|
//#region Public Methods
|
|
581
581
|
decrementHour() {
|
|
582
|
-
const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
|
|
582
|
+
const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour, 10) - 1;
|
|
583
583
|
this.setValuePart("hour", newHour);
|
|
584
584
|
}
|
|
585
585
|
decrementMinute() {
|
|
@@ -589,7 +589,7 @@ class TimeController extends GenericController {
|
|
|
589
589
|
this.decrementMinuteOrSecond("second");
|
|
590
590
|
}
|
|
591
591
|
incrementHour() {
|
|
592
|
-
const newHour = typeof this.hour === "string" && isValidNumber(this.hour) ? this.hour === "23" ? 0 : parseInt(this.hour) + 1 : 1;
|
|
592
|
+
const newHour = typeof this.hour === "string" && isValidNumber(this.hour) ? this.hour === "23" ? 0 : parseInt(this.hour, 10) + 1 : 1;
|
|
593
593
|
this.setValuePart("hour", newHour);
|
|
594
594
|
}
|
|
595
595
|
incrementMinute() {
|
|
@@ -601,7 +601,7 @@ class TimeController extends GenericController {
|
|
|
601
601
|
nudgeFractionalSecond(direction) {
|
|
602
602
|
const stepDecimal = getDecimals(this.component.step);
|
|
603
603
|
const stepPrecision = decimalPlaces(this.component.step);
|
|
604
|
-
const fractionalSecondAsInteger = parseInt(this.fractionalSecond);
|
|
604
|
+
const fractionalSecondAsInteger = parseInt(this.fractionalSecond, 10);
|
|
605
605
|
const fractionalSecondAsFloat = parseFloat(`0.${this.fractionalSecond}`);
|
|
606
606
|
let nudgedValue;
|
|
607
607
|
let nudgedValueRounded;
|
|
@@ -674,7 +674,7 @@ class TimeController extends GenericController {
|
|
|
674
674
|
decrementMinuteOrSecond(key) {
|
|
675
675
|
let newValue;
|
|
676
676
|
if (isValidNumber(this[key])) {
|
|
677
|
-
const valueAsNumber = parseInt(this[key]);
|
|
677
|
+
const valueAsNumber = parseInt(this[key], 10);
|
|
678
678
|
newValue = valueAsNumber === 0 ? 59 : valueAsNumber - 1;
|
|
679
679
|
} else {
|
|
680
680
|
newValue = 59;
|
|
@@ -682,7 +682,7 @@ class TimeController extends GenericController {
|
|
|
682
682
|
this.setValuePart(key, newValue);
|
|
683
683
|
}
|
|
684
684
|
incrementMinuteOrSecond(key) {
|
|
685
|
-
const newValue = isValidNumber(this[key]) ? this[key] === "59" ? 0 : parseInt(this[key]) + 1 : 0;
|
|
685
|
+
const newValue = isValidNumber(this[key]) ? this[key] === "59" ? 0 : parseInt(this[key], 10) + 1 : 0;
|
|
686
686
|
this.setValuePart(key, newValue);
|
|
687
687
|
}
|
|
688
688
|
setHourFormat() {
|
|
@@ -778,7 +778,7 @@ class TimeController extends GenericController {
|
|
|
778
778
|
value: this.meridiem
|
|
779
779
|
});
|
|
780
780
|
if (isValidNumber(this.hour)) {
|
|
781
|
-
const hourAsNumber = parseInt(this.hour);
|
|
781
|
+
const hourAsNumber = parseInt(this.hour, 10);
|
|
782
782
|
switch (value) {
|
|
783
783
|
case "AM":
|
|
784
784
|
if (hourAsNumber >= 12) {
|
package/dist/chunks/utils.js
CHANGED
|
@@ -53,7 +53,7 @@ const OPACITY_LIMITS = {
|
|
|
53
53
|
};
|
|
54
54
|
const STATIC_DIMENSIONS = {
|
|
55
55
|
s: {
|
|
56
|
-
gap: parseInt(calciteSpacingFixedSm),
|
|
56
|
+
gap: parseInt(calciteSpacingFixedSm, 10),
|
|
57
57
|
slider: {
|
|
58
58
|
height: 12
|
|
59
59
|
},
|
|
@@ -66,7 +66,7 @@ const STATIC_DIMENSIONS = {
|
|
|
66
66
|
minWidth: 200
|
|
67
67
|
},
|
|
68
68
|
m: {
|
|
69
|
-
gap: parseInt(calciteSpacingFixedMd),
|
|
69
|
+
gap: parseInt(calciteSpacingFixedMd, 10),
|
|
70
70
|
slider: {
|
|
71
71
|
height: 12
|
|
72
72
|
},
|
|
@@ -79,7 +79,7 @@ const STATIC_DIMENSIONS = {
|
|
|
79
79
|
minWidth: 240
|
|
80
80
|
},
|
|
81
81
|
l: {
|
|
82
|
-
gap: parseInt(calciteSpacingFixedXl),
|
|
82
|
+
gap: parseInt(calciteSpacingFixedXl, 10),
|
|
83
83
|
slider: {
|
|
84
84
|
height: 12
|
|
85
85
|
},
|
package/dist/chunks/utils3.js
CHANGED
|
@@ -62,7 +62,7 @@ function getSource(changes, stringProp, dateProp) {
|
|
|
62
62
|
if (datePropChanged && !stringPropChanged) {
|
|
63
63
|
return dateProp;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return void 0;
|
|
66
66
|
}
|
|
67
67
|
function getMinMaxSource(changes, type) {
|
|
68
68
|
return type === "min" ? getSource(changes, "min", "minAsDate") : getSource(changes, "max", "maxAsDate");
|
|
@@ -287,7 +287,7 @@ class Carousel extends LitElement {
|
|
|
287
287
|
}
|
|
288
288
|
handleItemSelection(event) {
|
|
289
289
|
const item = event.currentTarget;
|
|
290
|
-
const requestedPosition = parseInt(item.dataset.index);
|
|
290
|
+
const requestedPosition = parseInt(item.dataset.index, 10);
|
|
291
291
|
if (requestedPosition === this.selectedIndex) {
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
@@ -736,13 +736,13 @@ class Combobox extends LitElement {
|
|
|
736
736
|
this.refreshingSelectionDisplay = false;
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
739
|
-
const chipContainerElGap = parseInt(getComputedStyle(chipContainerEl).gap);
|
|
739
|
+
const chipContainerElGap = parseInt(getComputedStyle(chipContainerEl).gap, 10);
|
|
740
740
|
const chipContainerElWidth = getElementWidth(chipContainerEl);
|
|
741
741
|
const { fontSize, fontFamily, minInlineSize } = getComputedStyle(textInputRef.value);
|
|
742
742
|
const placeholderWidthMultiplier = 0.55;
|
|
743
|
-
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48);
|
|
743
|
+
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48, 10);
|
|
744
744
|
const measuredPlaceholderWidth = getTextWidth(placeholder, `${fontSize} ${fontFamily}`);
|
|
745
|
-
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48)) * placeholderWidthMultiplier));
|
|
745
|
+
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48, 10)) * placeholderWidthMultiplier));
|
|
746
746
|
const fitInputWidth = Math.max(inputMinWidth, placeholderWidth);
|
|
747
747
|
const inputWidth = (selectionDisplay === "fit" ? fitInputWidth : placeholderWidth) + chipContainerElGap;
|
|
748
748
|
const allSelectedIndicatorChipElWidth = getElementWidth(allSelectedIndicatorChipRef.value);
|
|
@@ -1233,13 +1233,13 @@ class Combobox extends LitElement {
|
|
|
1233
1233
|
const { allSelectedIndicatorChipRef, compactSelectionDisplay, scale, selectedVisibleChipsCount } = this;
|
|
1234
1234
|
let useFitCompactLabel = false;
|
|
1235
1235
|
if (this.selectionDisplay === "fit" && this.textInputRef.value && this.chipContainerEl) {
|
|
1236
|
-
const chipContainerElGap = parseInt(getComputedStyle(this.chipContainerEl).gap);
|
|
1236
|
+
const chipContainerElGap = parseInt(getComputedStyle(this.chipContainerEl).gap, 10);
|
|
1237
1237
|
const chipContainerElWidth = getElementWidth(this.chipContainerEl);
|
|
1238
1238
|
const { fontSize, fontFamily, minInlineSize } = getComputedStyle(this.textInputRef.value);
|
|
1239
1239
|
const placeholderWidthMultiplier = 0.55;
|
|
1240
|
-
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48);
|
|
1240
|
+
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48, 10);
|
|
1241
1241
|
const measuredPlaceholderWidth = getTextWidth(this.placeholder, `${fontSize} ${fontFamily}`);
|
|
1242
|
-
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((this.placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48)) * placeholderWidthMultiplier));
|
|
1242
|
+
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((this.placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48, 10)) * placeholderWidthMultiplier));
|
|
1243
1243
|
const selectedIndicatorChipElWidth = getElementWidth(this.selectedIndicatorChipRef.value);
|
|
1244
1244
|
useFitCompactLabel = this.getFitCompactDisplayState({
|
|
1245
1245
|
chipContainerElGap,
|
|
@@ -32,9 +32,9 @@ import type { HeadingLevel } from "../functional/Heading.js";
|
|
|
32
32
|
*/
|
|
33
33
|
export abstract class DatePicker extends LitElement {
|
|
34
34
|
/** Specifies the component's active date. */
|
|
35
|
-
accessor activeDate: Date;
|
|
35
|
+
accessor activeDate: Date | undefined;
|
|
36
36
|
/** When `range` is `true`, specifies the active `range`. Where `"start"` specifies the starting range date and `"end"` the ending range date. */
|
|
37
|
-
accessor activeRange: "start" | "end";
|
|
37
|
+
accessor activeRange: "start" | "end" | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* When `range` is `true`, specifies the number of calendars displayed.
|
|
40
40
|
*
|
|
@@ -42,7 +42,7 @@ export abstract class DatePicker extends LitElement {
|
|
|
42
42
|
*/
|
|
43
43
|
accessor calendars: 1 | 2;
|
|
44
44
|
/** Specifies the heading level number of the component's `heading` for proper document structure, without affecting visual styling. */
|
|
45
|
-
accessor headingLevel: HeadingLevel;
|
|
45
|
+
accessor headingLevel: HeadingLevel | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* Defines the component's layout.
|
|
48
48
|
*
|
|
@@ -53,9 +53,9 @@ export abstract class DatePicker extends LitElement {
|
|
|
53
53
|
* When the component resides in a form,
|
|
54
54
|
* specifies the latest allowed date (`"yyyy-mm-dd"`).
|
|
55
55
|
*/
|
|
56
|
-
accessor max: string;
|
|
56
|
+
accessor max: string | undefined;
|
|
57
57
|
/** Specifies the latest allowed date as a full date object (`new Date("yyyy-mm-dd")`). */
|
|
58
|
-
accessor maxAsDate: Date;
|
|
58
|
+
accessor maxAsDate: Date | undefined;
|
|
59
59
|
/** Overrides individual strings used by the component. */
|
|
60
60
|
accessor messageOverrides: {
|
|
61
61
|
nextMonth?: string;
|
|
@@ -68,9 +68,9 @@ export abstract class DatePicker extends LitElement {
|
|
|
68
68
|
* When the component resides in a form,
|
|
69
69
|
* specifies the earliest allowed date (`"yyyy-mm-dd"`).
|
|
70
70
|
*/
|
|
71
|
-
accessor min: string;
|
|
71
|
+
accessor min: string | undefined;
|
|
72
72
|
/** Specifies the earliest allowed date as a full date object (`new Date("yyyy-mm-dd")`). */
|
|
73
|
-
accessor minAsDate: Date;
|
|
73
|
+
accessor minAsDate: Date | undefined;
|
|
74
74
|
/**
|
|
75
75
|
* Specifies the component's month style.
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ export abstract class DatePicker extends LitElement {
|
|
|
78
78
|
*/
|
|
79
79
|
accessor monthStyle: "abbreviated" | "wide";
|
|
80
80
|
/** Specifies the Unicode numeral system used by the component for localization. This property cannot be dynamically changed. */
|
|
81
|
-
accessor numberingSystem: NumberingSystem;
|
|
81
|
+
accessor numberingSystem: NumberingSystem | undefined;
|
|
82
82
|
/**
|
|
83
83
|
* When `true`, disables the default behavior on the third click of narrowing or extending the range and instead starts a new range.
|
|
84
84
|
*
|
|
@@ -98,9 +98,9 @@ export abstract class DatePicker extends LitElement {
|
|
|
98
98
|
*/
|
|
99
99
|
accessor scale: "s" | "m" | "l";
|
|
100
100
|
/** Specifies the selected date as a string (`"yyyy-mm-dd"`), or an array of strings for `range` values (`["yyyy-mm-dd", "yyyy-mm-dd"]`). */
|
|
101
|
-
accessor value: string | string[];
|
|
101
|
+
accessor value: string | string[] | undefined;
|
|
102
102
|
/** Specifies the selected date as a full date object (`new Date("yyyy-mm-dd")`), or an array containing full date objects (`[new Date("yyyy-mm-dd"), new Date("yyyy-mm-dd")]`). */
|
|
103
|
-
accessor valueAsDate: Date | Date[];
|
|
103
|
+
accessor valueAsDate: Date | Date[] | undefined;
|
|
104
104
|
/**
|
|
105
105
|
* Sets focus on the component's first focusable element.
|
|
106
106
|
*
|
|
@@ -55,12 +55,12 @@ class DatePicker extends LitElement {
|
|
|
55
55
|
const minSource = getMinMaxSource(changes, "min");
|
|
56
56
|
const maxSource = getMinMaxSource(changes, "max");
|
|
57
57
|
if (minSource === "min") {
|
|
58
|
-
this.minAsDate = dateFromISO(this.min);
|
|
58
|
+
this.minAsDate = this.min ? dateFromISO(this.min) : void 0;
|
|
59
59
|
} else if (minSource === "minAsDate") {
|
|
60
60
|
this.minAsDate = dateFromISO(dateToISO(this.minAsDate));
|
|
61
61
|
}
|
|
62
62
|
if (maxSource === "max") {
|
|
63
|
-
this.maxAsDate = dateFromISO(this.max);
|
|
63
|
+
this.maxAsDate = this.max ? dateFromISO(this.max) : void 0;
|
|
64
64
|
} else if (maxSource === "maxAsDate") {
|
|
65
65
|
this.maxAsDate = dateFromISO(dateToISO(this.maxAsDate));
|
|
66
66
|
}
|
|
@@ -142,7 +142,7 @@ class DatePicker extends LitElement {
|
|
|
142
142
|
this.activeDate = date;
|
|
143
143
|
} else {
|
|
144
144
|
const month = date.getMonth();
|
|
145
|
-
const isDateOutOfCurrentRange = month !== this.activeStartDate
|
|
145
|
+
const isDateOutOfCurrentRange = month !== this.activeStartDate?.getMonth() && (this.calendars === 1 || (this.activeStartDate ? month !== nextMonth(this.activeStartDate).getMonth() : false));
|
|
146
146
|
if (this.activeRange === "end") {
|
|
147
147
|
if (!this.activeEndDate || this.activeStartDate && isDateOutOfCurrentRange) {
|
|
148
148
|
this.activeEndDate = date;
|
|
@@ -163,8 +163,8 @@ class DatePicker extends LitElement {
|
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
const { valueAsDate } = this;
|
|
166
|
-
const start = Array.isArray(valueAsDate)
|
|
167
|
-
const end = Array.isArray(valueAsDate)
|
|
166
|
+
const start = Array.isArray(valueAsDate) ? valueAsDate[0] : void 0;
|
|
167
|
+
const end = Array.isArray(valueAsDate) ? valueAsDate[1] : void 0;
|
|
168
168
|
const date = new Date(event.detail);
|
|
169
169
|
this.hoverRange = {
|
|
170
170
|
focused: this.activeRange || "start",
|
|
@@ -172,10 +172,10 @@ class DatePicker extends LitElement {
|
|
|
172
172
|
end
|
|
173
173
|
};
|
|
174
174
|
if (this.proximitySelectionDisabled) {
|
|
175
|
-
if (end && start || !end && date >= start) {
|
|
175
|
+
if (end && start || !end && start && date >= start) {
|
|
176
176
|
this.hoverRange.focused = "end";
|
|
177
177
|
this.hoverRange.end = date;
|
|
178
|
-
} else if (!end && date < start) {
|
|
178
|
+
} else if (!end && start && date < start) {
|
|
179
179
|
this.hoverRange = {
|
|
180
180
|
focused: "start",
|
|
181
181
|
start: date,
|
|
@@ -185,7 +185,7 @@ class DatePicker extends LitElement {
|
|
|
185
185
|
this.hoverRange = void 0;
|
|
186
186
|
}
|
|
187
187
|
} else {
|
|
188
|
-
if (this.activeRange) {
|
|
188
|
+
if (this.activeRange && this.hoverRange) {
|
|
189
189
|
if (this.activeRange === "end") {
|
|
190
190
|
this.hoverRange.end = date;
|
|
191
191
|
this.hoverRange.focused = "end";
|
|
@@ -262,7 +262,7 @@ class DatePicker extends LitElement {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
getStartDate() {
|
|
265
|
-
return Array.isArray(this.valueAsDate) && this.valueAsDate[0];
|
|
265
|
+
return Array.isArray(this.valueAsDate) && this.valueAsDate[0] || void 0;
|
|
266
266
|
}
|
|
267
267
|
setStartDate(date, emit = true) {
|
|
268
268
|
const endDate = this.getEndDate();
|
|
@@ -281,8 +281,8 @@ class DatePicker extends LitElement {
|
|
|
281
281
|
}
|
|
282
282
|
if (!this.range) {
|
|
283
283
|
this.value = isoDate || "";
|
|
284
|
-
this.valueAsDate = date ||
|
|
285
|
-
this.activeDate = date ||
|
|
284
|
+
this.valueAsDate = date || void 0;
|
|
285
|
+
this.activeDate = date || void 0;
|
|
286
286
|
this.calciteDatePickerChange.emit();
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
@@ -302,7 +302,7 @@ class DatePicker extends LitElement {
|
|
|
302
302
|
} else {
|
|
303
303
|
if (this.proximitySelectionDisabled) {
|
|
304
304
|
this.setStartDate(date, false);
|
|
305
|
-
this.setEndDate(
|
|
305
|
+
this.setEndDate(void 0, false);
|
|
306
306
|
this.calciteDatePickerRangeChange.emit();
|
|
307
307
|
} else {
|
|
308
308
|
if (this.activeRange) {
|
|
@@ -310,8 +310,8 @@ class DatePicker extends LitElement {
|
|
|
310
310
|
this.setEndDate(date);
|
|
311
311
|
} else {
|
|
312
312
|
if (date > end) {
|
|
313
|
-
this.setEndDate(
|
|
314
|
-
this.activeEndDate =
|
|
313
|
+
this.setEndDate(void 0, false);
|
|
314
|
+
this.activeEndDate = void 0;
|
|
315
315
|
}
|
|
316
316
|
this.setStartDate(date);
|
|
317
317
|
}
|
|
@@ -343,12 +343,12 @@ class DatePicker extends LitElement {
|
|
|
343
343
|
setActiveStartAndEndDates() {
|
|
344
344
|
if (this.range) {
|
|
345
345
|
const startDate = dateFromRange(Array.isArray(this.valueAsDate) ? this.valueAsDate[0] : this.valueAsDate, this.minAsDate, this.maxAsDate);
|
|
346
|
-
const endDate = dateFromRange(Array.isArray(this.valueAsDate) ? this.valueAsDate[1] :
|
|
346
|
+
const endDate = dateFromRange(Array.isArray(this.valueAsDate) ? this.valueAsDate[1] : void 0, this.minAsDate, this.maxAsDate);
|
|
347
347
|
this.activeStartDate = this.getActiveDate(startDate, this.minAsDate, this.maxAsDate);
|
|
348
348
|
this.activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
|
|
349
349
|
if (sameDate(this.activeStartDate, this.activeEndDate)) {
|
|
350
|
-
const previousMonthActiveDate = getFirstValidDateInMonth(prevMonth(this.activeEndDate), this.minAsDate, this.maxAsDate);
|
|
351
|
-
const nextMonthActiveDate = nextMonth(this.activeEndDate);
|
|
350
|
+
const previousMonthActiveDate = getFirstValidDateInMonth(this.activeEndDate ? prevMonth(this.activeEndDate) : void 0, this.minAsDate, this.maxAsDate);
|
|
351
|
+
const nextMonthActiveDate = this.activeEndDate ? nextMonth(this.activeEndDate) : void 0;
|
|
352
352
|
if (inRange(previousMonthActiveDate, this.minAsDate, this.maxAsDate)) {
|
|
353
353
|
this.activeStartDate = previousMonthActiveDate;
|
|
354
354
|
} else if (inRange(nextMonthActiveDate, this.minAsDate, this.maxAsDate)) {
|
|
@@ -360,7 +360,7 @@ class DatePicker extends LitElement {
|
|
|
360
360
|
render() {
|
|
361
361
|
const date = dateFromRange(this.range && Array.isArray(this.valueAsDate) ? this.valueAsDate[0] : this.valueAsDate, this.minAsDate, this.maxAsDate);
|
|
362
362
|
const activeDate = this.getActiveDate(date, this.minAsDate, this.maxAsDate);
|
|
363
|
-
const endDate = this.range && Array.isArray(this.valueAsDate) ? dateFromRange(this.valueAsDate[1], this.minAsDate, this.maxAsDate) :
|
|
363
|
+
const endDate = this.range && Array.isArray(this.valueAsDate) ? dateFromRange(this.valueAsDate[1], this.minAsDate, this.maxAsDate) : void 0;
|
|
364
364
|
const minDate = this.range && this.activeRange ? this.activeRange === "start" ? this.minAsDate : date : this.minAsDate;
|
|
365
365
|
const startCalendarActiveDate = this.range ? this.activeStartDate : activeDate;
|
|
366
366
|
return html`<div aria-hidden class=${safeClassMap(CSS.container)} tabindex=-1>${this.renderMonth(startCalendarActiveDate, this.maxAsDate, minDate, date, endDate)}</div>`;
|
|
@@ -45,7 +45,7 @@ class DatePickerDay extends LitElement {
|
|
|
45
45
|
return this.focusSetter(() => this.el, options);
|
|
46
46
|
}
|
|
47
47
|
load() {
|
|
48
|
-
this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
|
|
48
|
+
this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker") ?? void 0;
|
|
49
49
|
}
|
|
50
50
|
onClick() {
|
|
51
51
|
if (this.disabled) {
|
|
@@ -78,7 +78,7 @@ class DatePickerDay extends LitElement {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
const formattedDay = numberStringFormatter.localize(String(this.day));
|
|
81
|
-
const dayLabel = this.dateTimeFormat.format(this.value);
|
|
81
|
+
const dayLabel = this.dateTimeFormat.format(this.value) ?? null;
|
|
82
82
|
this.el.ariaLabel = dayLabel;
|
|
83
83
|
this.el.ariaSelected = toAriaBoolean(this.active);
|
|
84
84
|
setAttribute(this.el, "id", dayId);
|
|
@@ -18,11 +18,11 @@ export abstract class DatePickerMonth extends LitElement {
|
|
|
18
18
|
/** Specifies the heading level number of the component's `heading` for proper document structure, without affecting visual styling. */
|
|
19
19
|
accessor headingLevel: HeadingLevel;
|
|
20
20
|
/** The range of dates currently being hovered. */
|
|
21
|
-
accessor hoverRange: HoverRange;
|
|
21
|
+
accessor hoverRange: HoverRange | undefined;
|
|
22
22
|
/** Specifies the latest allowed date (`"yyyy-mm-dd"`). */
|
|
23
|
-
accessor max: Date;
|
|
23
|
+
accessor max: Date | undefined;
|
|
24
24
|
/** Specifies the earliest allowed date (`"yyyy-mm-dd"`). */
|
|
25
|
-
accessor min: Date;
|
|
25
|
+
accessor min: Date | undefined;
|
|
26
26
|
/** Specifies the monthStyle used by the component. */
|
|
27
27
|
accessor monthStyle: "abbreviated" | "wide";
|
|
28
28
|
/**
|
|
@@ -34,7 +34,7 @@ export abstract class DatePickerMonth extends LitElement {
|
|
|
34
34
|
/** Specifies the size of the component. */
|
|
35
35
|
accessor scale: Scale;
|
|
36
36
|
/** Already selected date. */
|
|
37
|
-
accessor selectedDate: Date;
|
|
37
|
+
accessor selectedDate: Date | undefined;
|
|
38
38
|
/** Start date currently active. */
|
|
39
39
|
accessor startDate: Date | undefined;
|
|
40
40
|
}
|
|
@@ -24,6 +24,7 @@ const NUM_DAYS_TO_DISPLAY = 42;
|
|
|
24
24
|
class DatePickerMonth extends LitElement {
|
|
25
25
|
constructor() {
|
|
26
26
|
super();
|
|
27
|
+
this.activeFocus = false;
|
|
27
28
|
this.storeDayRef = (el) => {
|
|
28
29
|
if (el?.active && this.activeFocus) {
|
|
29
30
|
el.setFocus();
|
|
@@ -204,13 +205,13 @@ class DatePickerMonth extends LitElement {
|
|
|
204
205
|
}
|
|
205
206
|
const { start, end } = this.hoverRange;
|
|
206
207
|
const isStartFocused = this.isFocusedOnStart();
|
|
207
|
-
const isEndAfterStart = this.startDate && end > this.startDate;
|
|
208
|
-
const isEndBeforeEnd = this.endDate && end < this.endDate;
|
|
209
|
-
const isStartAfterStart = this.startDate && start > this.startDate;
|
|
210
|
-
const isStartBeforeEnd = this.endDate && start < this.endDate;
|
|
208
|
+
const isEndAfterStart = this.startDate && end && end > this.startDate;
|
|
209
|
+
const isEndBeforeEnd = this.endDate && end && end < this.endDate;
|
|
210
|
+
const isStartAfterStart = this.startDate && start && start > this.startDate;
|
|
211
|
+
const isStartBeforeEnd = this.endDate && start && start < this.endDate;
|
|
211
212
|
const isEndDateAfterStartAndBeforeEnd = !isStartFocused && this.startDate && isEndAfterStart && (!this.endDate || isEndBeforeEnd);
|
|
212
213
|
const isStartDateBeforeEndAndAfterStart = isStartFocused && this.startDate && isStartAfterStart && isStartBeforeEnd;
|
|
213
|
-
return isEndDateAfterStartAndBeforeEnd || isStartDateBeforeEndAndAfterStart;
|
|
214
|
+
return !!(isEndDateAfterStartAndBeforeEnd || isStartDateBeforeEndAndAfterStart);
|
|
214
215
|
}
|
|
215
216
|
isRangeHover(date) {
|
|
216
217
|
if (!this.hoverRange) {
|
|
@@ -219,16 +220,16 @@ class DatePickerMonth extends LitElement {
|
|
|
219
220
|
const { start, end } = this.hoverRange;
|
|
220
221
|
const isStartFocused = this.isFocusedOnStart();
|
|
221
222
|
const insideRange = this.isHoverInRange();
|
|
222
|
-
const isDateBeforeStartDateAndAfterStart = date > start && date < this.startDate;
|
|
223
|
-
const isDateAfterEndDateAndBeforeEnd = date < end && date > this.endDate;
|
|
224
|
-
const isDateBeforeEndDateAndAfterEnd = date > end && date < this.endDate;
|
|
225
|
-
const isDateAfterStartDateAndBeforeStart = date < start && date > this.startDate;
|
|
226
|
-
const isDateAfterStartDateAndBeforeEnd = date < end && date > this.startDate;
|
|
227
|
-
const isDateBeforeEndDateAndAfterStart = date > start && date < this.endDate;
|
|
223
|
+
const isDateBeforeStartDateAndAfterStart = !!(start && date > start && this.startDate && date < this.startDate);
|
|
224
|
+
const isDateAfterEndDateAndBeforeEnd = !!(end && date < end && this.endDate && date > this.endDate);
|
|
225
|
+
const isDateBeforeEndDateAndAfterEnd = !!(end && date > end && this.endDate && date < this.endDate);
|
|
226
|
+
const isDateAfterStartDateAndBeforeStart = !!(start && date < start && this.startDate && date > this.startDate);
|
|
227
|
+
const isDateAfterStartDateAndBeforeEnd = !!(end && date < end && this.startDate && date > this.startDate);
|
|
228
|
+
const isDateBeforeEndDateAndAfterStart = !!(start && date > start && this.endDate && date < this.endDate);
|
|
228
229
|
const hasBothStartAndEndDate = this.startDate && this.endDate;
|
|
229
230
|
if (insideRange) {
|
|
230
231
|
if (hasBothStartAndEndDate) {
|
|
231
|
-
return isStartFocused ? date < this.endDate && (isDateAfterStartDateAndBeforeStart || isDateBeforeStartDateAndAfterStart) : isDateBeforeEndDateAndAfterEnd || isDateAfterEndDateAndBeforeEnd;
|
|
232
|
+
return isStartFocused ? !!(this.endDate && date < this.endDate) && (isDateAfterStartDateAndBeforeStart || isDateBeforeStartDateAndAfterStart) : isDateBeforeEndDateAndAfterEnd || isDateAfterEndDateAndBeforeEnd;
|
|
232
233
|
} else if (this.startDate && !this.endDate) {
|
|
233
234
|
return isStartFocused ? isDateBeforeStartDateAndAfterStart : isDateAfterStartDateAndBeforeEnd;
|
|
234
235
|
} else if (!this.startDate && this.endDate) {
|
|
@@ -239,6 +240,7 @@ class DatePickerMonth extends LitElement {
|
|
|
239
240
|
return isStartFocused ? isDateBeforeStartDateAndAfterStart : isDateAfterEndDateAndBeforeEnd;
|
|
240
241
|
}
|
|
241
242
|
}
|
|
243
|
+
return false;
|
|
242
244
|
}
|
|
243
245
|
getDays(prevMonthDays, currMonthDays, nextMonthDays, position = "start") {
|
|
244
246
|
let month = this.activeDate.getMonth();
|
|
@@ -300,7 +302,10 @@ class DatePickerMonth extends LitElement {
|
|
|
300
302
|
const startOfWeek = this.localeData.weekStart % 7;
|
|
301
303
|
const { abbreviated, short, narrow } = this.localeData.days;
|
|
302
304
|
const weekDays = this.scale === "s" ? narrow || short || abbreviated : short || abbreviated || narrow;
|
|
303
|
-
const adjustedWeekDays = [
|
|
305
|
+
const adjustedWeekDays = [
|
|
306
|
+
...weekDays.slice(startOfWeek, 7),
|
|
307
|
+
...weekDays.slice(0, startOfWeek)
|
|
308
|
+
];
|
|
304
309
|
const curMonDays = this.getCurrentMonthDays(month, year);
|
|
305
310
|
const prevMonDays = this.getPreviousMonthDays(month, year, startOfWeek);
|
|
306
311
|
const nextMonDays = this.getNextMonthDays(month, year, startOfWeek);
|
|
@@ -330,7 +335,7 @@ class DatePickerMonth extends LitElement {
|
|
|
330
335
|
return html`<div class=${safeClassMap({
|
|
331
336
|
[CSS.calendar]: true,
|
|
332
337
|
[CSS.calendarStart]: !isEndCalendar
|
|
333
|
-
})}><calcite-date-picker-month-header .activeDate=${isEndCalendar ? nextMonth(this.activeDate) : this.activeDate} .headingLevel=${this.headingLevel} .localeData=${this.localeData} .max=${this.max} .messages=${this.messages} .min=${this.min} .monthStyle=${this.monthStyle} @calciteInternalDatePickerMonthHeaderSelectChange=${this.monthHeaderSelectChange} .position=${isEndCalendar ? "end" : this.range && this.calendars === 2 ? "start" :
|
|
338
|
+
})}><calcite-date-picker-month-header .activeDate=${isEndCalendar ? nextMonth(this.activeDate) : this.activeDate} .headingLevel=${this.headingLevel} .localeData=${this.localeData} .max=${this.max} .messages=${this.messages} .min=${this.min} .monthStyle=${this.monthStyle} @calciteInternalDatePickerMonthHeaderSelectChange=${this.monthHeaderSelectChange} .position=${isEndCalendar ? "end" : this.range && this.calendars === 2 ? "start" : void 0} .scale=${this.scale} .selectedDate=${this.selectedDate}></calcite-date-picker-month-header>${this.renderMonthCalendar(weekDays, days, isEndCalendar)}</div>`;
|
|
334
339
|
}
|
|
335
340
|
renderMonthCalendar(weekDays, days, isEndCalendar = false) {
|
|
336
341
|
const endCalendarStartIndex = 50;
|
|
@@ -46,7 +46,7 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
46
46
|
this.setNextPrevMonthDates();
|
|
47
47
|
}
|
|
48
48
|
load() {
|
|
49
|
-
this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
|
|
49
|
+
this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker") ?? void 0;
|
|
50
50
|
}
|
|
51
51
|
willUpdate(changes) {
|
|
52
52
|
if (this.hasUpdated && (changes.has("activeDate") || changes.has("localeData"))) {
|
|
@@ -100,7 +100,9 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
prevMonthClick(event) {
|
|
103
|
-
|
|
103
|
+
if (this.prevMonthDate) {
|
|
104
|
+
this.handleArrowClick(event, this.prevMonthDate);
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
prevMonthKeydown(event) {
|
|
106
108
|
if (isActivationKey(event.key)) {
|
|
@@ -108,7 +110,9 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
nextMonthClick(event) {
|
|
111
|
-
|
|
113
|
+
if (this.nextMonthDate) {
|
|
114
|
+
this.handleArrowClick(event, this.nextMonthDate);
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
nextMonthKeydown(event) {
|
|
114
118
|
if (isActivationKey(event.key)) {
|
|
@@ -143,6 +147,7 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
143
147
|
nextDate.setFullYear(year);
|
|
144
148
|
return dateFromRange(nextDate, min, max);
|
|
145
149
|
}
|
|
150
|
+
return void 0;
|
|
146
151
|
}
|
|
147
152
|
setYear({ localizedYear, commit = true, offset = 0 }) {
|
|
148
153
|
const { yearInputRef, activeDate } = this;
|
|
@@ -150,12 +155,12 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
150
155
|
if (inRangeDate) {
|
|
151
156
|
this.calciteInternalDatePickerMonthHeaderSelectChange.emit(inRangeDate);
|
|
152
157
|
}
|
|
153
|
-
if (commit) {
|
|
158
|
+
if (commit && yearInputRef.value) {
|
|
154
159
|
yearInputRef.value.value = this.formatCalendarYear((inRangeDate || activeDate).getFullYear());
|
|
155
160
|
}
|
|
156
161
|
}
|
|
157
162
|
setYearSelectWidthOffset() {
|
|
158
|
-
this.yearSelectWidthOffset = ICON_WIDTH_M + 3 * parseInt(this.getYearSelectPadding());
|
|
163
|
+
this.yearSelectWidthOffset = ICON_WIDTH_M + 3 * parseInt(this.getYearSelectPadding(), 10);
|
|
159
164
|
this.setYearSelectMenuWidth();
|
|
160
165
|
}
|
|
161
166
|
setYearSelectMenuWidth() {
|
|
@@ -177,19 +182,19 @@ class DatePickerMonthHeader extends LitElement {
|
|
|
177
182
|
if (!this.min && !this.max || inRange(newActiveDate, this.min, this.max)) {
|
|
178
183
|
return true;
|
|
179
184
|
}
|
|
180
|
-
return hasSameMonthAndYear(newActiveDate, this.max) || hasSameMonthAndYear(newActiveDate, this.min);
|
|
185
|
+
return !!(this.max && hasSameMonthAndYear(newActiveDate, this.max) || this.min && hasSameMonthAndYear(newActiveDate, this.min));
|
|
181
186
|
}
|
|
182
187
|
async handlePenultimateValidMonth(event) {
|
|
183
188
|
const target = event.target;
|
|
184
189
|
const direction = target.getAttribute("data-direction");
|
|
185
190
|
const isDirectionLeft = direction === "left";
|
|
186
|
-
let isTargetLastValidMonth;
|
|
191
|
+
let isTargetLastValidMonth = false;
|
|
187
192
|
if (isDirectionLeft && this.min) {
|
|
188
193
|
const prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
|
|
189
|
-
isTargetLastValidMonth = hasSameMonthAndYear(prevMonthDate, this.min);
|
|
194
|
+
isTargetLastValidMonth = prevMonthDate ? hasSameMonthAndYear(prevMonthDate, this.min) : false;
|
|
190
195
|
} else if (this.max) {
|
|
191
196
|
const nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
|
|
192
|
-
isTargetLastValidMonth = hasSameMonthAndYear(nextMonthDate, this.max);
|
|
197
|
+
isTargetLastValidMonth = nextMonthDate ? hasSameMonthAndYear(nextMonthDate, this.max) : false;
|
|
193
198
|
}
|
|
194
199
|
if (isTargetLastValidMonth) {
|
|
195
200
|
if (!this.position) {
|