@aurodesignsystem-dev/auro-formkit 0.0.0-pr1483.0 → 0.0.0-pr1483.10
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/components/checkbox/demo/customize.min.js +2 -233
- package/components/checkbox/demo/getting-started.min.js +2 -233
- package/components/checkbox/demo/index.min.js +2 -233
- package/components/checkbox/dist/index.js +2 -233
- package/components/checkbox/dist/registered.js +2 -233
- package/components/combobox/demo/customize.min.js +7 -238
- package/components/combobox/demo/getting-started.min.js +7 -238
- package/components/combobox/demo/index.min.js +7 -238
- package/components/combobox/demo/keyboard-behavior.md +68 -8
- package/components/combobox/dist/index.js +7 -238
- package/components/combobox/dist/registered.js +7 -238
- package/components/counter/demo/customize.min.js +3 -234
- package/components/counter/demo/index.min.js +3 -234
- package/components/counter/dist/index.js +2 -233
- package/components/counter/dist/registered.js +2 -233
- package/components/datepicker/demo/api.md +52 -51
- package/components/datepicker/demo/customize.md +52 -15
- package/components/datepicker/demo/index.md +23 -0
- package/components/datepicker/demo/index.min.js +5069 -1044
- package/components/datepicker/dist/index.js +4587 -562
- package/components/datepicker/dist/registered.js +4587 -562
- package/components/datepicker/dist/src/auro-calendar-cell.d.ts +3 -1
- package/components/datepicker/dist/src/auro-calendar-month.d.ts +23 -0
- package/components/datepicker/dist/src/auro-calendar.d.ts +15 -0
- package/components/datepicker/dist/src/auro-datepicker.d.ts +27 -13
- package/components/datepicker/dist/src/utilities.d.ts +0 -20
- package/components/datepicker/dist/src/utilitiesCalendar.d.ts +0 -1
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/dist/registered.js +1 -1
- package/components/form/demo/customize.min.js +5294 -2422
- package/components/form/demo/getting-started.min.js +5294 -2422
- package/components/form/demo/index.min.js +5294 -2422
- package/components/form/demo/registerDemoDeps.min.js +5294 -2422
- package/components/input/demo/customize.min.js +2 -2
- package/components/input/demo/getting-started.min.js +2 -2
- package/components/input/demo/index.min.js +2 -2
- package/components/input/dist/index.js +2 -2
- package/components/input/dist/registered.js +2 -2
- package/components/radio/demo/index.min.js +2 -233
- package/components/radio/dist/index.js +2 -233
- package/components/radio/dist/registered.js +2 -233
- package/components/select/demo/customize.min.js +21 -250
- package/components/select/demo/getting-started.min.js +21 -250
- package/components/select/demo/index.min.js +21 -250
- package/components/select/demo/keyboard-behavior.md +54 -8
- package/components/select/dist/index.js +21 -250
- package/components/select/dist/registered.js +21 -250
- package/custom-elements.json +1597 -1582
- package/package.json +3 -3
|
@@ -130,237 +130,6 @@ let AuroLibraryRuntimeUtils$4 = class AuroLibraryRuntimeUtils {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* @description Splits a date string into its parts according to the provided format. Does NOT validate that the result is a real calendar date — use `parseDate` when validation is required.
|
|
135
|
-
* @param {string} dateStr - Date string to parse.
|
|
136
|
-
* @param {string} format - Date format to parse.
|
|
137
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
138
|
-
*/
|
|
139
|
-
function getDateParts$1(dateStr, format) {
|
|
140
|
-
if (!dateStr) {
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const formatSeparatorMatch = format.match(/[/.-]/);
|
|
145
|
-
let valueParts;
|
|
146
|
-
let formatParts;
|
|
147
|
-
|
|
148
|
-
if (formatSeparatorMatch) {
|
|
149
|
-
const separator = formatSeparatorMatch[0];
|
|
150
|
-
valueParts = dateStr.split(separator);
|
|
151
|
-
formatParts = format.split(separator);
|
|
152
|
-
} else {
|
|
153
|
-
if (dateStr.match(/[/.-]/)) {
|
|
154
|
-
throw new Error(
|
|
155
|
-
"AuroDatepickerUtilities | parseDate: Date string has no separators",
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (dateStr.length !== format.length) {
|
|
160
|
-
throw new Error(
|
|
161
|
-
"AuroDatepickerUtilities | parseDate: Date string and format length do not match",
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
valueParts = [dateStr];
|
|
166
|
-
formatParts = [format];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (valueParts.length !== formatParts.length) {
|
|
170
|
-
throw new Error(
|
|
171
|
-
`AuroDatepickerUtilities | parseDate: Date string and format do not match : ${dateStr} vs ${format}`,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const result = formatParts.reduce((acc, part, index) => {
|
|
176
|
-
const value = valueParts[index];
|
|
177
|
-
|
|
178
|
-
if (/m/iu.test(part) && part.length === value.length) {
|
|
179
|
-
acc.month = value;
|
|
180
|
-
} else if (/d/iu.test(part) && part.length === value.length) {
|
|
181
|
-
acc.day = value;
|
|
182
|
-
} else if (/y/iu.test(part) && part.length === value.length) {
|
|
183
|
-
acc.year = value;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return acc;
|
|
187
|
-
}, {});
|
|
188
|
-
|
|
189
|
-
if (!result.month && !result.day && !result.year) {
|
|
190
|
-
throw new Error(
|
|
191
|
-
"AuroDatepickerUtilities | parseDate: Unable to parse date string",
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return result;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function isCalendarDate$1(year, month, day) {
|
|
199
|
-
let yearNumber = Number(year);
|
|
200
|
-
const monthNumber = Number(month);
|
|
201
|
-
const dayNumber = Number(day);
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
!Number.isInteger(yearNumber) ||
|
|
205
|
-
!Number.isInteger(monthNumber) ||
|
|
206
|
-
!Number.isInteger(dayNumber)
|
|
207
|
-
) {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Handle 2-digit years by converting them to 4-digit years based on a cutoff. This allows for parsing of 2-digit year formats while still validating the resulting date.
|
|
212
|
-
if (yearNumber < 100 && yearNumber >= 50) {
|
|
213
|
-
yearNumber += 1900;
|
|
214
|
-
} else if (yearNumber < 50) {
|
|
215
|
-
yearNumber += 2000;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const stringified = `${String(yearNumber).padStart(4, "0")}-${String(monthNumber).padStart(2, "0")}-${String(dayNumber).padStart(2, "0")}`;
|
|
219
|
-
const date = new Date(stringified.replace(/[.-]/g, "/"));
|
|
220
|
-
|
|
221
|
-
return (
|
|
222
|
-
!Number.isNaN(date.getTime()) && toISOFormatString$1(date) === stringified
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @description Parses a date string into its components and validates that the result is a real calendar date. Use `getDateParts` instead when raw splitting without validation is needed (e.g. for in-progress input).
|
|
228
|
-
*
|
|
229
|
-
* Partial formats are supported: components absent from `format` default to `year → "0"`,
|
|
230
|
-
* `month → "01"`, `day → "01"` for calendar validation only. The returned object contains
|
|
231
|
-
* only the fields actually present in the format string — missing fields are never injected.
|
|
232
|
-
* @param {string} dateStr - Date string to parse.
|
|
233
|
-
* @param {string} format - Date format to parse.
|
|
234
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
235
|
-
* @throws {Error} Throws when the parsed result does not represent a valid calendar date.
|
|
236
|
-
*/
|
|
237
|
-
function parseDate$1(dateStr, format = "mm/dd/yyyy") {
|
|
238
|
-
if (!dateStr || !format) {
|
|
239
|
-
return undefined;
|
|
240
|
-
}
|
|
241
|
-
const result = getDateParts$1(dateStr.trim(), format);
|
|
242
|
-
|
|
243
|
-
if (!result) {
|
|
244
|
-
return undefined;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const lowerFormat = format.toLowerCase();
|
|
248
|
-
const year = lowerFormat.includes("yy") ? result.year : "0";
|
|
249
|
-
const month = lowerFormat.includes("mm") ? result.month : "01";
|
|
250
|
-
const day = lowerFormat.includes("dd") ? result.day : "01";
|
|
251
|
-
|
|
252
|
-
if (isCalendarDate$1(year, month, day)) {
|
|
253
|
-
return result;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
throw new Error(
|
|
257
|
-
`AuroDatepickerUtilities | parseDate: Date string is not a valid date ${JSON.stringify(result)} with format ${format}`,
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Convert a date object to string format.
|
|
263
|
-
* @param {Object} date - Date to convert to string.
|
|
264
|
-
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
265
|
-
* @returns {String} Returns the date as a string.
|
|
266
|
-
*/
|
|
267
|
-
function getDateAsString$1(date, locale = undefined) {
|
|
268
|
-
return date.toLocaleDateString(locale, {
|
|
269
|
-
year: "numeric",
|
|
270
|
-
month: "2-digit",
|
|
271
|
-
day: "2-digit",
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Converts a date string to a North American date format.
|
|
277
|
-
* @param {String} dateStr - Date to validate.
|
|
278
|
-
* @param {String} format - Date format to validate against.
|
|
279
|
-
* @returns {String}
|
|
280
|
-
*/
|
|
281
|
-
function toNorthAmericanFormat$1(dateStr, format) {
|
|
282
|
-
if (format === "mm/dd/yyyy") {
|
|
283
|
-
return dateStr;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const parsedDate = parseDate$1(dateStr, format);
|
|
287
|
-
|
|
288
|
-
if (!parsedDate) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
"AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string",
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
const { month, day, year } = parsedDate;
|
|
295
|
-
|
|
296
|
-
return [month, day, year].filter(Boolean).join("/");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Validates that a date string matches the provided format and represents a real calendar date.
|
|
301
|
-
*
|
|
302
|
-
* @param {string} dateStr - Date string to validate.
|
|
303
|
-
* @param {string} [format="yyyy-mm-dd"] - Format of the date string.
|
|
304
|
-
* @returns {boolean} True when the date string is valid for the provided format, otherwise false.
|
|
305
|
-
*/
|
|
306
|
-
function isValidDate$1(dateStr, format = "yyyy-mm-dd") {
|
|
307
|
-
try {
|
|
308
|
-
if (typeof dateStr !== "string" || !dateStr || format?.length < 8) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (parseDate$1(dateStr, format)) {
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
} catch (error) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Converts a JavaScript Date instance to a simple ISO-like date string. This returns only the calendar date portion without any time or timezone information.
|
|
323
|
-
*
|
|
324
|
-
* @param {Date} date - Date instance to convert to an ISO-like string.
|
|
325
|
-
* @returns {string} A string in the format "yyyy-mm-dd" representing the provided date.
|
|
326
|
-
* @throws {Error} Throws an error when the input is not a valid Date instance.
|
|
327
|
-
*/
|
|
328
|
-
function toISOFormatString$1(date) {
|
|
329
|
-
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
330
|
-
throw new Error(
|
|
331
|
-
"AuroDatepickerUtilities | toISOFormatString: Input must be a valid Date instance",
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Converts a date string into a JavaScript Date instance. This method supports ISO formatted strings and other formats that can be parsed by the formatter.
|
|
339
|
-
*
|
|
340
|
-
* @param {String} dateStr - Date string to convert into a Date object.
|
|
341
|
-
* @param {String} format - Date format used to parse the string when it is not in ISO format.
|
|
342
|
-
* @returns {Date|null} Returns a Date instance for valid input or null for non-string input.
|
|
343
|
-
* @throws {Error} Throws when parsing fails for non-ISO string input.
|
|
344
|
-
*/
|
|
345
|
-
function stringToDateInstance$1(dateStr, format = "yyyy-mm-dd") {
|
|
346
|
-
if (typeof dateStr !== "string") {
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const { month, day, year } = parseDate$1(dateStr, format);
|
|
351
|
-
return new Date(`${year}/${month}/${day}`);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const dateFormatter$1 = {
|
|
355
|
-
parseDate: parseDate$1,
|
|
356
|
-
getDateParts: getDateParts$1,
|
|
357
|
-
getDateAsString: getDateAsString$1,
|
|
358
|
-
toNorthAmericanFormat: toNorthAmericanFormat$1,
|
|
359
|
-
isValidDate: isValidDate$1,
|
|
360
|
-
toISOFormatString: toISOFormatString$1,
|
|
361
|
-
stringToDateInstance: stringToDateInstance$1,
|
|
362
|
-
};
|
|
363
|
-
|
|
364
133
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
365
134
|
// See LICENSE in the project root for license information.
|
|
366
135
|
|
|
@@ -582,7 +351,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
582
351
|
}
|
|
583
352
|
|
|
584
353
|
// Validate that the date passed was the correct format and is a valid date
|
|
585
|
-
if (elem.value && !
|
|
354
|
+
if (elem.value && !elem.valueObject) {
|
|
586
355
|
elem.validity = 'patternMismatch';
|
|
587
356
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
588
357
|
return;
|
|
@@ -1041,7 +810,7 @@ const comboboxKeyboardStrategy = {
|
|
|
1041
810
|
|
|
1042
811
|
// navigate if bib is open otherwise open it
|
|
1043
812
|
if (component.dropdown.isPopoverVisible) {
|
|
1044
|
-
if (evt.altKey || evt.metaKey) {
|
|
813
|
+
if (evt.altKey || evt.ctrlKey || evt.metaKey) {
|
|
1045
814
|
component.activateLastEnabledAvailableOption();
|
|
1046
815
|
} else {
|
|
1047
816
|
navigateArrow(component, 'down');
|
|
@@ -1064,7 +833,7 @@ const comboboxKeyboardStrategy = {
|
|
|
1064
833
|
|
|
1065
834
|
// navigate if bib is open otherwise open it
|
|
1066
835
|
if (component.dropdown.isPopoverVisible) {
|
|
1067
|
-
if (evt.altKey || evt.metaKey) {
|
|
836
|
+
if (evt.altKey || evt.ctrlKey || evt.metaKey) {
|
|
1068
837
|
component.activateFirstEnabledAvailableOption();
|
|
1069
838
|
} else {
|
|
1070
839
|
navigateArrow(component, 'up');
|
|
@@ -5020,7 +4789,7 @@ let AuroHelpText$2 = class AuroHelpText extends LitElement {
|
|
|
5020
4789
|
}
|
|
5021
4790
|
};
|
|
5022
4791
|
|
|
5023
|
-
var formkitVersion$2 = '
|
|
4792
|
+
var formkitVersion$2 = '202606051610';
|
|
5024
4793
|
|
|
5025
4794
|
let AuroElement$2 = class AuroElement extends LitElement {
|
|
5026
4795
|
static get properties() {
|
|
@@ -10437,7 +10206,7 @@ class AuroFormValidation {
|
|
|
10437
10206
|
}
|
|
10438
10207
|
|
|
10439
10208
|
// Validate that the date passed was the correct format and is a valid date
|
|
10440
|
-
if (elem.value && !
|
|
10209
|
+
if (elem.value && !elem.valueObject) {
|
|
10441
10210
|
elem.validity = 'patternMismatch';
|
|
10442
10211
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
10443
10212
|
return;
|
|
@@ -18271,7 +18040,7 @@ let AuroHelpText$1 = class AuroHelpText extends LitElement {
|
|
|
18271
18040
|
}
|
|
18272
18041
|
};
|
|
18273
18042
|
|
|
18274
|
-
var formkitVersion$1 = '
|
|
18043
|
+
var formkitVersion$1 = '202606051610';
|
|
18275
18044
|
|
|
18276
18045
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
18277
18046
|
// See LICENSE in the project root for license information.
|
|
@@ -19388,7 +19157,7 @@ class AuroBibtemplate extends LitElement {
|
|
|
19388
19157
|
}
|
|
19389
19158
|
}
|
|
19390
19159
|
|
|
19391
|
-
var formkitVersion = '
|
|
19160
|
+
var formkitVersion = '202606051610';
|
|
19392
19161
|
|
|
19393
19162
|
var styleCss$1 = css`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
|
|
19394
19163
|
|
|
@@ -302,237 +302,6 @@ let p$3 = class p{registerComponent(t,a){customElements.get(t)||customElements.d
|
|
|
302
302
|
|
|
303
303
|
var iconVersion$2 = '9.1.2';
|
|
304
304
|
|
|
305
|
-
/**
|
|
306
|
-
* @description Splits a date string into its parts according to the provided format. Does NOT validate that the result is a real calendar date — use `parseDate` when validation is required.
|
|
307
|
-
* @param {string} dateStr - Date string to parse.
|
|
308
|
-
* @param {string} format - Date format to parse.
|
|
309
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
310
|
-
*/
|
|
311
|
-
function getDateParts(dateStr, format) {
|
|
312
|
-
if (!dateStr) {
|
|
313
|
-
return undefined;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const formatSeparatorMatch = format.match(/[/.-]/);
|
|
317
|
-
let valueParts;
|
|
318
|
-
let formatParts;
|
|
319
|
-
|
|
320
|
-
if (formatSeparatorMatch) {
|
|
321
|
-
const separator = formatSeparatorMatch[0];
|
|
322
|
-
valueParts = dateStr.split(separator);
|
|
323
|
-
formatParts = format.split(separator);
|
|
324
|
-
} else {
|
|
325
|
-
if (dateStr.match(/[/.-]/)) {
|
|
326
|
-
throw new Error(
|
|
327
|
-
"AuroDatepickerUtilities | parseDate: Date string has no separators",
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (dateStr.length !== format.length) {
|
|
332
|
-
throw new Error(
|
|
333
|
-
"AuroDatepickerUtilities | parseDate: Date string and format length do not match",
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
valueParts = [dateStr];
|
|
338
|
-
formatParts = [format];
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (valueParts.length !== formatParts.length) {
|
|
342
|
-
throw new Error(
|
|
343
|
-
`AuroDatepickerUtilities | parseDate: Date string and format do not match : ${dateStr} vs ${format}`,
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
const result = formatParts.reduce((acc, part, index) => {
|
|
348
|
-
const value = valueParts[index];
|
|
349
|
-
|
|
350
|
-
if (/m/iu.test(part) && part.length === value.length) {
|
|
351
|
-
acc.month = value;
|
|
352
|
-
} else if (/d/iu.test(part) && part.length === value.length) {
|
|
353
|
-
acc.day = value;
|
|
354
|
-
} else if (/y/iu.test(part) && part.length === value.length) {
|
|
355
|
-
acc.year = value;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return acc;
|
|
359
|
-
}, {});
|
|
360
|
-
|
|
361
|
-
if (!result.month && !result.day && !result.year) {
|
|
362
|
-
throw new Error(
|
|
363
|
-
"AuroDatepickerUtilities | parseDate: Unable to parse date string",
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return result;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function isCalendarDate(year, month, day) {
|
|
371
|
-
let yearNumber = Number(year);
|
|
372
|
-
const monthNumber = Number(month);
|
|
373
|
-
const dayNumber = Number(day);
|
|
374
|
-
|
|
375
|
-
if (
|
|
376
|
-
!Number.isInteger(yearNumber) ||
|
|
377
|
-
!Number.isInteger(monthNumber) ||
|
|
378
|
-
!Number.isInteger(dayNumber)
|
|
379
|
-
) {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Handle 2-digit years by converting them to 4-digit years based on a cutoff. This allows for parsing of 2-digit year formats while still validating the resulting date.
|
|
384
|
-
if (yearNumber < 100 && yearNumber >= 50) {
|
|
385
|
-
yearNumber += 1900;
|
|
386
|
-
} else if (yearNumber < 50) {
|
|
387
|
-
yearNumber += 2000;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const stringified = `${String(yearNumber).padStart(4, "0")}-${String(monthNumber).padStart(2, "0")}-${String(dayNumber).padStart(2, "0")}`;
|
|
391
|
-
const date = new Date(stringified.replace(/[.-]/g, "/"));
|
|
392
|
-
|
|
393
|
-
return (
|
|
394
|
-
!Number.isNaN(date.getTime()) && toISOFormatString(date) === stringified
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* @description Parses a date string into its components and validates that the result is a real calendar date. Use `getDateParts` instead when raw splitting without validation is needed (e.g. for in-progress input).
|
|
400
|
-
*
|
|
401
|
-
* Partial formats are supported: components absent from `format` default to `year → "0"`,
|
|
402
|
-
* `month → "01"`, `day → "01"` for calendar validation only. The returned object contains
|
|
403
|
-
* only the fields actually present in the format string — missing fields are never injected.
|
|
404
|
-
* @param {string} dateStr - Date string to parse.
|
|
405
|
-
* @param {string} format - Date format to parse.
|
|
406
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
407
|
-
* @throws {Error} Throws when the parsed result does not represent a valid calendar date.
|
|
408
|
-
*/
|
|
409
|
-
function parseDate(dateStr, format = "mm/dd/yyyy") {
|
|
410
|
-
if (!dateStr || !format) {
|
|
411
|
-
return undefined;
|
|
412
|
-
}
|
|
413
|
-
const result = getDateParts(dateStr.trim(), format);
|
|
414
|
-
|
|
415
|
-
if (!result) {
|
|
416
|
-
return undefined;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
const lowerFormat = format.toLowerCase();
|
|
420
|
-
const year = lowerFormat.includes("yy") ? result.year : "0";
|
|
421
|
-
const month = lowerFormat.includes("mm") ? result.month : "01";
|
|
422
|
-
const day = lowerFormat.includes("dd") ? result.day : "01";
|
|
423
|
-
|
|
424
|
-
if (isCalendarDate(year, month, day)) {
|
|
425
|
-
return result;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
throw new Error(
|
|
429
|
-
`AuroDatepickerUtilities | parseDate: Date string is not a valid date ${JSON.stringify(result)} with format ${format}`,
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Convert a date object to string format.
|
|
435
|
-
* @param {Object} date - Date to convert to string.
|
|
436
|
-
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
437
|
-
* @returns {String} Returns the date as a string.
|
|
438
|
-
*/
|
|
439
|
-
function getDateAsString(date, locale = undefined) {
|
|
440
|
-
return date.toLocaleDateString(locale, {
|
|
441
|
-
year: "numeric",
|
|
442
|
-
month: "2-digit",
|
|
443
|
-
day: "2-digit",
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Converts a date string to a North American date format.
|
|
449
|
-
* @param {String} dateStr - Date to validate.
|
|
450
|
-
* @param {String} format - Date format to validate against.
|
|
451
|
-
* @returns {String}
|
|
452
|
-
*/
|
|
453
|
-
function toNorthAmericanFormat(dateStr, format) {
|
|
454
|
-
if (format === "mm/dd/yyyy") {
|
|
455
|
-
return dateStr;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const parsedDate = parseDate(dateStr, format);
|
|
459
|
-
|
|
460
|
-
if (!parsedDate) {
|
|
461
|
-
throw new Error(
|
|
462
|
-
"AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string",
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const { month, day, year } = parsedDate;
|
|
467
|
-
|
|
468
|
-
return [month, day, year].filter(Boolean).join("/");
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Validates that a date string matches the provided format and represents a real calendar date.
|
|
473
|
-
*
|
|
474
|
-
* @param {string} dateStr - Date string to validate.
|
|
475
|
-
* @param {string} [format="yyyy-mm-dd"] - Format of the date string.
|
|
476
|
-
* @returns {boolean} True when the date string is valid for the provided format, otherwise false.
|
|
477
|
-
*/
|
|
478
|
-
function isValidDate(dateStr, format = "yyyy-mm-dd") {
|
|
479
|
-
try {
|
|
480
|
-
if (typeof dateStr !== "string" || !dateStr || format?.length < 8) {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (parseDate(dateStr, format)) {
|
|
485
|
-
return true;
|
|
486
|
-
}
|
|
487
|
-
} catch (error) {
|
|
488
|
-
return false;
|
|
489
|
-
}
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Converts a JavaScript Date instance to a simple ISO-like date string. This returns only the calendar date portion without any time or timezone information.
|
|
495
|
-
*
|
|
496
|
-
* @param {Date} date - Date instance to convert to an ISO-like string.
|
|
497
|
-
* @returns {string} A string in the format "yyyy-mm-dd" representing the provided date.
|
|
498
|
-
* @throws {Error} Throws an error when the input is not a valid Date instance.
|
|
499
|
-
*/
|
|
500
|
-
function toISOFormatString(date) {
|
|
501
|
-
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
502
|
-
throw new Error(
|
|
503
|
-
"AuroDatepickerUtilities | toISOFormatString: Input must be a valid Date instance",
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Converts a date string into a JavaScript Date instance. This method supports ISO formatted strings and other formats that can be parsed by the formatter.
|
|
511
|
-
*
|
|
512
|
-
* @param {String} dateStr - Date string to convert into a Date object.
|
|
513
|
-
* @param {String} format - Date format used to parse the string when it is not in ISO format.
|
|
514
|
-
* @returns {Date|null} Returns a Date instance for valid input or null for non-string input.
|
|
515
|
-
* @throws {Error} Throws when parsing fails for non-ISO string input.
|
|
516
|
-
*/
|
|
517
|
-
function stringToDateInstance(dateStr, format = "yyyy-mm-dd") {
|
|
518
|
-
if (typeof dateStr !== "string") {
|
|
519
|
-
return null;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
const { month, day, year } = parseDate(dateStr, format);
|
|
523
|
-
return new Date(`${year}/${month}/${day}`);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const dateFormatter = {
|
|
527
|
-
parseDate,
|
|
528
|
-
getDateParts,
|
|
529
|
-
getDateAsString,
|
|
530
|
-
toNorthAmericanFormat,
|
|
531
|
-
isValidDate,
|
|
532
|
-
toISOFormatString,
|
|
533
|
-
stringToDateInstance,
|
|
534
|
-
};
|
|
535
|
-
|
|
536
305
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
537
306
|
// See LICENSE in the project root for license information.
|
|
538
307
|
|
|
@@ -754,7 +523,7 @@ class AuroFormValidation {
|
|
|
754
523
|
}
|
|
755
524
|
|
|
756
525
|
// Validate that the date passed was the correct format and is a valid date
|
|
757
|
-
if (elem.value && !
|
|
526
|
+
if (elem.value && !elem.valueObject) {
|
|
758
527
|
elem.validity = 'patternMismatch';
|
|
759
528
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
760
529
|
return;
|
|
@@ -1330,7 +1099,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$2 {
|
|
|
1330
1099
|
}
|
|
1331
1100
|
};
|
|
1332
1101
|
|
|
1333
|
-
var formkitVersion$1 = '
|
|
1102
|
+
var formkitVersion$1 = '202606051610';
|
|
1334
1103
|
|
|
1335
1104
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1336
1105
|
// See LICENSE in the project root for license information.
|
|
@@ -5676,7 +5445,7 @@ class AuroHelpText extends i$2 {
|
|
|
5676
5445
|
}
|
|
5677
5446
|
}
|
|
5678
5447
|
|
|
5679
|
-
var formkitVersion = '
|
|
5448
|
+
var formkitVersion = '202606051610';
|
|
5680
5449
|
|
|
5681
5450
|
let AuroElement$1 = class AuroElement extends i$2 {
|
|
5682
5451
|
static get properties() {
|