@aurodesignsystem-dev/auro-formkit 0.0.0-pr1483.0 → 0.0.0-pr1483.2

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.
Files changed (41) hide show
  1. package/components/checkbox/demo/customize.min.js +2 -233
  2. package/components/checkbox/demo/getting-started.min.js +2 -233
  3. package/components/checkbox/demo/index.min.js +2 -233
  4. package/components/checkbox/dist/index.js +2 -233
  5. package/components/checkbox/dist/registered.js +2 -233
  6. package/components/combobox/demo/customize.min.js +5 -236
  7. package/components/combobox/demo/getting-started.min.js +5 -236
  8. package/components/combobox/demo/index.min.js +5 -236
  9. package/components/combobox/dist/index.js +5 -236
  10. package/components/combobox/dist/registered.js +5 -236
  11. package/components/counter/demo/customize.min.js +3 -234
  12. package/components/counter/demo/index.min.js +3 -234
  13. package/components/counter/dist/index.js +2 -233
  14. package/components/counter/dist/registered.js +2 -233
  15. package/components/datepicker/demo/index.min.js +8 -7
  16. package/components/datepicker/dist/index.js +8 -7
  17. package/components/datepicker/dist/registered.js +8 -7
  18. package/components/dropdown/demo/customize.min.js +1 -1
  19. package/components/dropdown/demo/getting-started.min.js +1 -1
  20. package/components/dropdown/demo/index.min.js +1 -1
  21. package/components/dropdown/dist/index.js +1 -1
  22. package/components/dropdown/dist/registered.js +1 -1
  23. package/components/form/demo/customize.min.js +170 -1324
  24. package/components/form/demo/getting-started.min.js +170 -1324
  25. package/components/form/demo/index.min.js +170 -1324
  26. package/components/form/demo/registerDemoDeps.min.js +170 -1324
  27. package/components/input/demo/customize.min.js +2 -2
  28. package/components/input/demo/getting-started.min.js +2 -2
  29. package/components/input/demo/index.min.js +2 -2
  30. package/components/input/dist/index.js +2 -2
  31. package/components/input/dist/registered.js +2 -2
  32. package/components/radio/demo/index.min.js +2 -233
  33. package/components/radio/dist/index.js +2 -233
  34. package/components/radio/dist/registered.js +2 -233
  35. package/components/select/demo/customize.min.js +3 -234
  36. package/components/select/demo/getting-started.min.js +3 -234
  37. package/components/select/demo/index.min.js +3 -234
  38. package/components/select/dist/index.js +3 -234
  39. package/components/select/dist/registered.js +3 -234
  40. package/custom-elements.json +1444 -1444
  41. package/package.json +1 -1
@@ -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 && !dateFormatter.isValidDate(elem.inputElement.value, elem.format)) {
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 = '202605271728';
1102
+ var formkitVersion$1 = '202605271836';
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 = '202605271728';
5448
+ var formkitVersion = '202605271836';
5680
5449
 
5681
5450
  let AuroElement$1 = class AuroElement extends i$2 {
5682
5451
  static get properties() {
@@ -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 && !dateFormatter.isValidDate(elem.inputElement.value, elem.format)) {
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 = '202605271728';
1102
+ var formkitVersion$1 = '202605271836';
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 = '202605271728';
5448
+ var formkitVersion = '202605271836';
5680
5449
 
5681
5450
  let AuroElement$1 = class AuroElement extends i$2 {
5682
5451
  static get properties() {