@aurodesignsystem-dev/auro-formkit 0.0.0-pr1494.5 → 0.0.0-pr1497.0

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 (49) hide show
  1. package/components/checkbox/demo/customize.min.js +1 -1
  2. package/components/checkbox/demo/getting-started.min.js +1 -1
  3. package/components/checkbox/demo/index.min.js +1 -1
  4. package/components/checkbox/dist/index.js +1 -1
  5. package/components/checkbox/dist/registered.js +1 -1
  6. package/components/combobox/demo/customize.min.js +18 -18
  7. package/components/combobox/demo/getting-started.min.js +18 -18
  8. package/components/combobox/demo/index.min.js +18 -18
  9. package/components/combobox/dist/index.js +18 -18
  10. package/components/combobox/dist/registered.js +18 -18
  11. package/components/counter/demo/customize.min.js +2 -2
  12. package/components/counter/demo/index.min.js +2 -2
  13. package/components/counter/dist/index.js +1 -1
  14. package/components/counter/dist/registered.js +1 -1
  15. package/components/datepicker/demo/api.md +9 -9
  16. package/components/datepicker/demo/customize.md +46 -19
  17. package/components/datepicker/demo/index.min.js +64 -79
  18. package/components/datepicker/dist/index.js +64 -79
  19. package/components/datepicker/dist/registered.js +64 -79
  20. package/components/datepicker/dist/src/auro-datepicker.d.ts +36 -8
  21. package/components/datepicker/dist/src/utilities.d.ts +0 -14
  22. package/components/dropdown/demo/customize.min.js +1 -1
  23. package/components/dropdown/demo/getting-started.min.js +1 -1
  24. package/components/dropdown/demo/index.min.js +1 -1
  25. package/components/dropdown/dist/index.js +1 -1
  26. package/components/dropdown/dist/registered.js +1 -1
  27. package/components/form/demo/customize.min.js +104 -119
  28. package/components/form/demo/getting-started.min.js +104 -119
  29. package/components/form/demo/index.min.js +104 -119
  30. package/components/form/demo/registerDemoDeps.min.js +104 -119
  31. package/components/input/demo/customize.md +29 -107
  32. package/components/input/demo/customize.min.js +16 -16
  33. package/components/input/demo/getting-started.md +16 -6
  34. package/components/input/demo/getting-started.min.js +16 -16
  35. package/components/input/demo/index.min.js +16 -16
  36. package/components/input/dist/auro-input-util.d.ts +1 -1
  37. package/components/input/dist/index.js +16 -16
  38. package/components/input/dist/registered.js +16 -16
  39. package/components/input/dist/utilities.d.ts +1 -2
  40. package/components/radio/demo/index.min.js +1 -1
  41. package/components/radio/dist/index.js +1 -1
  42. package/components/radio/dist/registered.js +1 -1
  43. package/components/select/demo/customize.min.js +2 -2
  44. package/components/select/demo/getting-started.min.js +2 -2
  45. package/components/select/demo/index.min.js +2 -2
  46. package/components/select/dist/index.js +2 -2
  47. package/components/select/dist/registered.js +2 -2
  48. package/custom-elements.json +15 -55
  49. package/package.json +1 -1
@@ -22,8 +22,8 @@
22
22
  <auro-anchorlink fluid href="#disabled" class="level2 body-xs">Disabled</auro-anchorlink>
23
23
  <auro-anchorlink fluid href="#error" class="level2 body-xs">Error</auro-anchorlink>
24
24
  <auro-anchorlink fluid href="#format" class="level2 body-xs">Format</auro-anchorlink>
25
- <auro-anchorlink fluid href="#regionalDateFormat" class="level2 body-xs">Regional Date</auro-anchorlink>
26
25
  <auro-anchorlink fluid href="#inputMode" class="level2 body-xs">Input Mode</auro-anchorlink>
26
+ <auro-anchorlink fluid href="#localization" class="level2 body-xs">Localization</auro-anchorlink>
27
27
  <auro-anchorlink fluid href="#max" class="level2 body-xs">Max</auro-anchorlink>
28
28
  <auro-anchorlink fluid href="#maxLength" class="level2 body-xs">Max Length</auro-anchorlink>
29
29
  <auro-anchorlink fluid href="#min" class="level2 body-xs">Min</auro-anchorlink>
@@ -37,9 +37,6 @@
37
37
  <auro-anchorlink fluid href="#type" class="level2 body-xs">Type</auro-anchorlink>
38
38
  <auro-anchorlink fluid href="#validateOnInput" class="level2 body-xs">Validate on Input</auro-anchorlink>
39
39
  <auro-anchorlink fluid href="#value" class="level2 body-xs">Value</auro-anchorlink>
40
- <auro-anchorlink fluid href="#auroInputUtil">AuroInputUtil</auro-anchorlink>
41
- <auro-anchorlink fluid href="#auroInputUtilFormatIso" class="level2 body-xs">Format ISO value</auro-anchorlink>
42
- <auro-anchorlink fluid href="#auroInputUtilToIso" class="level2 body-xs">Date to ISO</auro-anchorlink>
43
40
  </auro-nav>
44
41
  </nav>
45
42
  <div class="mainContent">
@@ -531,33 +528,40 @@
531
528
  &lt;/auro-input&gt;</code></pre>
532
529
  <!-- AURO-GENERATED-CONTENT:END -->
533
530
  </auro-accordion>
534
- <auro-header level="3" id="regionalDateFormat">Regional Date Format Support</auro-header>
531
+ <auro-header level="3" id="localization">Localization</auro-header>
535
532
  <p>When <code>type="date"</code> is used with the <code>locale</code> attribute, the component automatically derives the correct date format for that region — no need to set <code>format</code> manually. For example, <code>locale="en-US"</code> produces <code>mm/dd/yyyy</code>, <code>locale="de-DE"</code> produces <code>dd.mm.yyyy</code>, and <code>locale="ja-JP"</code> produces <code>yyyy/mm/dd</code>.</p>
536
533
  <p>If <code>format</code> is explicitly set alongside <code>locale</code>, <code>format</code> always wins. Use this when a specific format is required regardless of region.</p>
537
534
  <div class="exampleWrapper">
538
535
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/locale.html) -->
539
536
  <!-- The below content is automatically added from ../apiExamples/locale.html -->
540
537
  <div data-locale="de-DE">
538
+ <auro-header level="4">en-GB Example</auro-header>
541
539
  <auro-input type="date" locale="en-GB">
542
540
  <span slot="ariaLabel.clear">Clear All</span>
543
541
  <span slot="label">en-GB Date</span>
544
542
  <span slot="helpText">Help Text</span>
545
543
  </auro-input>
544
+ <auro-header level="4">en-US Example</auro-header>
546
545
  <auro-input type="date" locale="en-US">
547
546
  <span slot="ariaLabel.clear">Clear All</span>
548
547
  <span slot="label">en-US Date</span>
549
548
  <span slot="helpText">Help Text</span>
550
549
  </auro-input>
550
+ <auro-header level="4">zh-CN Example</auro-header>
551
551
  <auro-input type="date" locale="zh-CN">
552
- <span slot="ariaLabel.clear">Clear All</span>
553
- <span slot="label">zh-CN Date</span>
554
- <span slot="helpText">Help Text</span>
552
+ <span slot="ariaLabel.clear">全部清除</span>
553
+ <span slot="label">中文日期</span>
554
+ <span slot="helpText">帮助文本</span>
555
+ <span slot="optionalLabel">(可选)</span>
555
556
  </auro-input>
557
+ <auro-header level="4">Inherited de-DE date-locale Example</auro-header>
556
558
  <auro-input type="date">
557
- <span slot="ariaLabel.clear">Clear All</span>
558
- <span slot="label">Nearest `data-locale` attribute format (`de-DE` in this case)</span>
559
- <span slot="helpText">Help Text</span>
559
+ <span slot="ariaLabel.clear">Alles löschen</span>
560
+ <span slot="label">Nächstes `data-locale`-Attributformat (`de-DE` in diesem Fall)</span>
561
+ <span slot="helpText">Hilfetext</span>
562
+ <span slot="optionalLabel">(freiwillig)</span>
560
563
  </auro-input>
564
+ <auro-header level="4">en-US with `yyyy.mm.dd` format Example</auro-header>
561
565
  <auro-input type="date" locale="en-US" format="yyyy.mm.dd">
562
566
  <span slot="ariaLabel.clear">Clear All</span>
563
567
  <span slot="label">en-US with yyyy.mm.dd format</span>
@@ -570,26 +574,33 @@
570
574
  <!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/locale.html) -->
571
575
  <!-- The below code snippet is automatically added from ../apiExamples/locale.html -->
572
576
  <pre class="language-html"><code class="language-html">&lt;div data-locale="de-DE"&gt;
577
+ &lt;auro-header level="4"&gt;en-GB Example&lt;/auro-header&gt;
573
578
  &lt;auro-input type="date" locale="en-GB"&gt;
574
579
  &lt;span slot="ariaLabel.clear"&gt;Clear All&lt;/span&gt;
575
580
  &lt;span slot="label"&gt;en-GB Date&lt;/span&gt;
576
581
  &lt;span slot="helpText"&gt;Help Text&lt;/span&gt;
577
582
  &lt;/auro-input&gt;
583
+ &lt;auro-header level="4"&gt;en-US Example&lt;/auro-header&gt;
578
584
  &lt;auro-input type="date" locale="en-US"&gt;
579
585
  &lt;span slot="ariaLabel.clear"&gt;Clear All&lt;/span&gt;
580
586
  &lt;span slot="label"&gt;en-US Date&lt;/span&gt;
581
587
  &lt;span slot="helpText"&gt;Help Text&lt;/span&gt;
582
588
  &lt;/auro-input&gt;
589
+ &lt;auro-header level="4"&gt;zh-CN Example&lt;/auro-header&gt;
583
590
  &lt;auro-input type="date" locale="zh-CN"&gt;
584
- &lt;span slot="ariaLabel.clear"&gt;Clear All&lt;/span&gt;
585
- &lt;span slot="label"&gt;zh-CN Date&lt;/span&gt;
586
- &lt;span slot="helpText"&gt;Help Text&lt;/span&gt;
591
+ &lt;span slot="ariaLabel.clear"&gt;全部清除&lt;/span&gt;
592
+ &lt;span slot="label"&gt;中文日期&lt;/span&gt;
593
+ &lt;span slot="helpText"&gt;帮助文本&lt;/span&gt;
594
+ &lt;span slot="optionalLabel"&gt;(可选)&lt;/span&gt;
587
595
  &lt;/auro-input&gt;
596
+ &lt;auro-header level="4"&gt;Inherited de-DE date-locale Example&lt;/auro-header&gt;
588
597
  &lt;auro-input type="date"&gt;
589
- &lt;span slot="ariaLabel.clear"&gt;Clear All&lt;/span&gt;
590
- &lt;span slot="label"&gt;Nearest `data-locale` attribute format (`de-DE` in this case)&lt;/span&gt;
591
- &lt;span slot="helpText"&gt;Help Text&lt;/span&gt;
598
+ &lt;span slot="ariaLabel.clear"&gt;Alles löschen&lt;/span&gt;
599
+ &lt;span slot="label"&gt;Nächstes `data-locale`-Attributformat (`de-DE` in diesem Fall)&lt;/span&gt;
600
+ &lt;span slot="helpText"&gt;Hilfetext&lt;/span&gt;
601
+ &lt;span slot="optionalLabel"&gt;(freiwillig)&lt;/span&gt;
592
602
  &lt;/auro-input&gt;
603
+ &lt;auro-header level="4"&gt;en-US with `yyyy.mm.dd` format Example&lt;/auro-header&gt;
593
604
  &lt;auro-input type="date" locale="en-US" format="yyyy.mm.dd"&gt;
594
605
  &lt;span slot="ariaLabel.clear"&gt;Clear All&lt;/span&gt;
595
606
  &lt;span slot="label"&gt;en-US with yyyy.mm.dd format&lt;/span&gt;
@@ -899,6 +910,7 @@
899
910
  <li><strong><code>setCustomValidityRangeUnderflow</code></strong> — Displayed when the value is below the <code>min</code> constraint.</li>
900
911
  <li><strong><code>setCustomValidityTooLong</code></strong> — Displayed when the value exceeds the <code>maxlength</code> constraint.</li>
901
912
  <li><strong><code>setCustomValidityTooShort</code></strong> — Displayed when the value is shorter than the <code>minlength</code> constraint.</li>
913
+ <li><strong><code>setCustomValidityPatternMismatch</code></strong> — Displayed when the value does not match the declared <code>pattern</code>, or when <code>type="date"</code> and the entered date is not a valid calendar date (e.g. month/day values out of range). Falls back to <code>"Invalid Date Format Entered"</code> if not set.</li>
902
914
  </ul>
903
915
  <p>The priority order for error messages is: state-specific property &gt; <code>setCustomValidity</code> &gt; default browser message.</p>
904
916
  <p class="note"><strong>Note:</strong> Custom strings are NOT localized. It is the responsibility of the element consumer to provide localized strings when using these properties.</p>
@@ -1437,96 +1449,6 @@
1437
1449
  <!-- AURO-GENERATED-CONTENT:END -->
1438
1450
  </auro-accordion>
1439
1451
  </section>
1440
- <section>
1441
- <auro-header level="2" id="auroInputUtil">AuroInputUtil</auro-header>
1442
- <p>When <code>type="date"</code> is used, the <code>.value</code> property always stores and returns the date in ISO format (<code>YYYY-MM-DD</code>) regardless of the displayed locale or <code>format</code> attribute. Use the <code>AuroInputUtil</code> helper to convert between ISO and any display format in your application code.</p>
1443
- <auro-header level="3" id="auroInputUtilFormatIso">formatISODate — ISO to display format</auro-header>
1444
- <p>Use <code>AuroInputUtil.formatISODate(isoStr, format)</code> to convert the ISO value read from the input into any display string. The format argument uses the same tokens as the <code>format</code> attribute (<code>mm</code>, <code>dd</code>, <code>yyyy</code>, <code>yy</code>).</p>
1445
- <p>Returns <code>undefined</code> when either argument is empty or the ISO string is not a valid date.</p>
1446
- <div class="exampleWrapper">
1447
- <!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/format-iso-value.html) -->
1448
- <!-- The below content is automatically added from ../apiExamples/format-iso-value.html -->
1449
- <auro-input id="formatIsoExample" type="date" locale="en-US" value="2024-01-15">
1450
- <span slot="label">Date</span>
1451
- <span slot="helpText">The <code>.value</code> property always stores the date as ISO (YYYY-MM-DD)</span>
1452
- </auro-input>
1453
- <br />
1454
- <table>
1455
- <thead>
1456
- <tr><th>Property / Method</th><th>Result</th></tr>
1457
- </thead>
1458
- <tbody>
1459
- <tr><td><code>.value</code> (ISO)</td><td><code id="isoVal">2024-01-15</code></td></tr>
1460
- <tr><td><code>formatISODate(value, 'mm/dd/yyyy')</code></td><td><code id="fmtUs">01/15/2024</code></td></tr>
1461
- <tr><td><code>formatISODate(value, 'dd/mm/yyyy')</code></td><td><code id="fmtGb">15/01/2024</code></td></tr>
1462
- <tr><td><code>formatISODate(value, 'yyyy/mm/dd')</code></td><td><code id="fmtIso">2024/01/15</code></td></tr>
1463
- </tbody>
1464
- </table>
1465
- <!-- AURO-GENERATED-CONTENT:END -->
1466
- </div>
1467
- <auro-accordion alignRight>
1468
- <span slot="trigger">See code</span>
1469
- <!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/format-iso-value.html) -->
1470
- <!-- The below code snippet is automatically added from ../apiExamples/format-iso-value.html -->
1471
- <pre class="language-html"><code class="language-html">&lt;auro-input id="formatIsoExample" type="date" locale="en-US" value="2024-01-15"&gt;
1472
- &lt;span slot="label"&gt;Date&lt;/span&gt;
1473
- &lt;span slot="helpText"&gt;The &lt;code&gt;.value&lt;/code&gt; property always stores the date as ISO (YYYY-MM-DD)&lt;/span&gt;
1474
- &lt;/auro-input&gt;
1475
- &lt;br /&gt;
1476
- &lt;table&gt;
1477
- &lt;thead&gt;
1478
- &lt;tr&gt;&lt;th&gt;Property / Method&lt;/th&gt;&lt;th&gt;Result&lt;/th&gt;&lt;/tr&gt;
1479
- &lt;/thead&gt;
1480
- &lt;tbody&gt;
1481
- &lt;tr&gt;&lt;td&gt;&lt;code&gt;.value&lt;/code&gt; (ISO)&lt;/td&gt;&lt;td&gt;&lt;code id="isoVal"&gt;2024-01-15&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
1482
- &lt;tr&gt;&lt;td&gt;&lt;code&gt;formatISODate(value, 'mm/dd/yyyy')&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code id="fmtUs"&gt;01/15/2024&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
1483
- &lt;tr&gt;&lt;td&gt;&lt;code&gt;formatISODate(value, 'dd/mm/yyyy')&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code id="fmtGb"&gt;15/01/2024&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
1484
- &lt;tr&gt;&lt;td&gt;&lt;code&gt;formatISODate(value, 'yyyy/mm/dd')&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code id="fmtIso"&gt;2024/01/15&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
1485
- &lt;/tbody&gt;
1486
- &lt;/table&gt;</code></pre>
1487
- <!-- AURO-GENERATED-CONTENT:END -->
1488
- <!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/auro-input-util-format-iso.js) -->
1489
- <!-- The below code snippet is automatically added from ../apiExamples/auro-input-util-format-iso.js -->
1490
- <pre class="language-js"><code class="language-js">import { AuroInputUtil } from '@aurodesignsystem/auro-formkit/input';
1491
-
1492
- const input = document.querySelector('auro-input');
1493
-
1494
- // .value is always ISO, regardless of locale or format attribute
1495
- const iso = input.value; // e.g. '2024-01-15'
1496
-
1497
- // Date string that's converted to user's locale and format.
1498
- AuroInputUtil.formatISODate(iso, input.format);
1499
-
1500
- // Examples with explicit format:
1501
- AuroInputUtil.formatISODate(iso, 'mm/dd/yyyy'); // → '01/15/2024'
1502
- AuroInputUtil.formatISODate(iso, 'dd/mm/yyyy'); // → '15/01/2024'
1503
- AuroInputUtil.formatISODate(iso, 'yyyy/mm/dd'); // → '2024/01/15'
1504
- AuroInputUtil.formatISODate(iso, 'dd.mm.yyyy'); // → '15.01.2024'
1505
-
1506
- // Returns undefined for empty or invalid input
1507
- AuroInputUtil.formatISODate(undefined, 'mm/dd/yyyy'); // → undefined
1508
- AuroInputUtil.formatISODate('not-a-date', 'mm/dd/yyyy'); // → undefined</code></pre>
1509
- <!-- AURO-GENERATED-CONTENT:END -->
1510
- </auro-accordion>
1511
- </section>
1512
- <section>
1513
- <auro-header level="3" id="auroInputUtilToIso">toISOFormatString — Date instance to ISO</auro-header>
1514
- <p>Use <code>AuroInputUtil.toISOFormatString(date)</code> to convert a JavaScript <code>Date</code> instance into an ISO string suitable for setting <code>input.value</code>.</p>
1515
- <p>Throws when the argument is not a valid <code>Date</code> instance.</p>
1516
- <!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/auro-input-util-to-iso.js) -->
1517
- <!-- The below code snippet is automatically added from ../apiExamples/auro-input-util-to-iso.js -->
1518
- <pre class="language-js"><code class="language-js">import { AuroInputUtil } from '@aurodesignsystem/auro-formkit/input';
1519
-
1520
- const input = document.querySelector('auro-input');
1521
-
1522
- // Convert a Date to ISO, then set it on the input
1523
- const today = new Date();
1524
- input.value = AuroInputUtil.toISOFormatString(today); // e.g. '2024-01-15'
1525
-
1526
- // Convert a specific date
1527
- AuroInputUtil.toISOFormatString(new Date(2024, 0, 15)); // → '2024-01-15'</code></pre>
1528
- <!-- AURO-GENERATED-CONTENT:END -->
1529
- </section>
1530
1452
  </div>
1531
1453
  </div>
1532
1454
  </div>
@@ -10376,27 +10376,17 @@ class AuroInputUtilities {
10376
10376
  * Converts a model value to a display value for the input element.
10377
10377
  * For full date formats, converts an ISO model value to the configured display format.
10378
10378
  * @private
10379
- * @param {string} value - The model value (ISO string for date types).
10380
10379
  * @param {Date|undefined} valueObject - Date object representation of value.
10381
10380
  * @param {string} format - The date format string.
10382
- * @returns {string}
10381
+ * @returns {string | undefined}
10383
10382
  */
10384
- toFormattedValue(value, valueObject, format) {
10385
- if (!this.isFullDateFormat('date', format) || !value) {
10386
- return value;
10387
- }
10388
-
10389
- if (!dateFormatter.isValidDate(value)) {
10390
- // For ISO-pattern strings that fail range validation (e.g. '2024-99-99'),
10391
- // return '' so inputElement stays empty and format-based validation is not triggered.
10392
- return (/^\d{4}-\d{2}-\d{2}$/u).test(value) ? '' : value;
10393
- }
10394
-
10383
+ toFormattedValue(valueObject, format) {
10395
10384
  const normalizedFormat = format.toLowerCase();
10396
10385
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
10397
10386
 
10398
10387
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
10399
- return value;
10388
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
10389
+ return undefined;
10400
10390
  }
10401
10391
 
10402
10392
  return maskOptions.format(valueObject);
@@ -11314,7 +11304,17 @@ class BaseInput extends AuroElement {
11314
11304
  this.hasValue = false;
11315
11305
  }
11316
11306
 
11317
- const formattedValue = this.type === 'date' ? this.util.toFormattedValue(this.value, this.valueObject, this.format) : this.value;
11307
+ let formattedValue = this.value;
11308
+ if (this.type === 'date') {
11309
+ const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
11310
+ if (!formattedDate) {
11311
+ // if user entered unrecognized date format that cannot be parsed into a Date object,
11312
+ // keep the raw value in the input so they can edit it instead of overwriting with an empty string
11313
+ formattedValue = this.value;
11314
+ } else {
11315
+ formattedValue = formattedDate;
11316
+ }
11317
+ }
11318
11318
 
11319
11319
  if (formattedValue !== this.inputElement.value) {
11320
11320
  this.skipNextProgrammaticInputEvent = true;
@@ -12178,7 +12178,7 @@ class AuroHelpText extends i$3 {
12178
12178
  }
12179
12179
  }
12180
12180
 
12181
- var formkitVersion = '202606032113';
12181
+ var formkitVersion = '202606081518';
12182
12182
 
12183
12183
  /**
12184
12184
  * @license
@@ -30,9 +30,9 @@
30
30
  <auro-anchorlink fluid href="#focus" class="level2 body-xs">focus()</auro-anchorlink>
31
31
  <auro-anchorlink fluid href="#reset" class="level2 body-xs">reset()</auro-anchorlink>
32
32
  <auro-anchorlink fluid href="#validate" class="level2 body-xs">validate()</auro-anchorlink>
33
- <auro-anchorlink fluid href="#auroInputUtil">AuroInputUtil</auro-anchorlink>
34
33
  <auro-anchorlink fluid href="#auroInputUtilFormatIso" class="level2 body-xs">formatISODate()</auro-anchorlink>
35
34
  <auro-anchorlink fluid href="#auroInputUtilToIso" class="level2 body-xs">toISOFormatString()</auro-anchorlink>
35
+ <auro-anchorlink fluid href="#auroInputUtilToFormattedValue" class="level2 body-xs">toFormattedValue()</auro-anchorlink>
36
36
  </auro-nav>
37
37
  </nav>
38
38
  <div class="mainContent">
@@ -321,12 +321,22 @@ Ensure your `tsconfig.json` uses `"moduleResolution": "bundler"` so TypeScript c
321
321
  <p>Triggers validation on the component. Pass <code>true</code> to force validation even when <code>noValidate</code> is set.</p>
322
322
  </section>
323
323
  <section>
324
- <auro-header level="2" id="auroInputUtil">AuroInputUtil</auro-header>
325
- <p><code>AuroInputUtil</code> is a standalone utility exported from the package for working with date values. When <code>type="date"</code> is used, <code>.value</code> always stores the date as ISO (<code>YYYY-MM-DD</code>). Use these helpers to convert between ISO and any display format in your application.</p>
326
- <auro-header level="3" id="auroInputUtilFormatIso">formatISODate(isoStr, format)</auro-header>
327
- <p>Converts an ISO string from <code>.value</code> into a display format string (e.g. <code>'01/15/2024'</code>). Returns <code>undefined</code> for empty or invalid input. See <a href="customize">Customize</a> for full examples.</p>
328
- <auro-header level="3" id="auroInputUtilToIso">toISOFormatString(date)</auro-header>
324
+ <auro-header level="3" id="auroInputUtil">AuroInputUtil</auro-header>
325
+ <p><code>AuroInputUtil</code> is a standalone utility exported from the package for working with date values. When <code>type="date"</code> is used, <code>.value</code> always stores the date as ISO (<code>YYYY-MM-DD</code>). Use these helpers to convert between ISO and any display format in your application.</p>
326
+ <auro-header level="4" id="auroInputUtilFormatIso">formatISODate(isoStr, format)</auro-header>
327
+ <p>Converts an ISO string from <code>.value</code> into a display format string (e.g. <code>'01/15/2024'</code>). Returns <code>undefined</code> for empty or invalid input. See <a href="customize">Customize</a> for full examples.</p>
328
+ <pre class="language-js"><code class="language-js">AuroInputUtil.formatISODate('2024-01-15', 'dd/mm/yyyy'); // returns '15/01/2024</code></pre>
329
+ <auro-header level="4" id="auroInputUtilToIso">toISOFormatString(date)</auro-header>
329
330
  <p>Converts a <code>Date</code> instance to an ISO string suitable for setting <code>input.value</code> programmatically. Throws for invalid input. See <a href="customize">Customize</a> for full examples.</p>
331
+ <pre class="language-js"><code class="language-js">AuroInputUtil.toISOFormatString(new Date('2024/01/15')); // returns '2024-01-15</code></pre>
332
+ <auro-header level="4" id="auroInputUtilToFormattedValue">toFormattedValue(valueObject, format)</auro-header>
333
+ <p>Converts a date instance to a display-formatted string. For <code>type="date"</code> with a full date <code>format</code> (e.g. <code>mm/dd/yyyy</code>), it converts the ISO model value into the configured display format. Returns the value unchanged for non-date types or partial formats. Returns an empty string when the ISO value is structurally valid but contains an out-of-range date (e.g. month 99).</p>
334
+ <p>This function is helpful when the datepicker value needs to be used in an API that only supports a specific date format. Regardless of the locale date format the user types, the value can be extracted in the necessary format.</p>
335
+ <ul>
336
+ <li><strong>valueObject</strong> — Pre-computed <code>Date</code> instance for the value (use <code>input.valueObject</code>).</li>
337
+ <li><strong>format</strong> — The display format string (e.g. <code>'mm/dd/yyyy'</code>).</li>
338
+ </ul>
339
+ <pre class="language-js"><code class="language-js">AuroInputUtil.toFormattedValue(auroInput.valueObject, 'dd/mm/yyyy'); // returns '15/01/2024' for an ISO value of '2024-01-15'</code></pre>
330
340
  </section>
331
341
  </div>
332
342
  </div>
@@ -10376,27 +10376,17 @@ class AuroInputUtilities {
10376
10376
  * Converts a model value to a display value for the input element.
10377
10377
  * For full date formats, converts an ISO model value to the configured display format.
10378
10378
  * @private
10379
- * @param {string} value - The model value (ISO string for date types).
10380
10379
  * @param {Date|undefined} valueObject - Date object representation of value.
10381
10380
  * @param {string} format - The date format string.
10382
- * @returns {string}
10381
+ * @returns {string | undefined}
10383
10382
  */
10384
- toFormattedValue(value, valueObject, format) {
10385
- if (!this.isFullDateFormat('date', format) || !value) {
10386
- return value;
10387
- }
10388
-
10389
- if (!dateFormatter.isValidDate(value)) {
10390
- // For ISO-pattern strings that fail range validation (e.g. '2024-99-99'),
10391
- // return '' so inputElement stays empty and format-based validation is not triggered.
10392
- return (/^\d{4}-\d{2}-\d{2}$/u).test(value) ? '' : value;
10393
- }
10394
-
10383
+ toFormattedValue(valueObject, format) {
10395
10384
  const normalizedFormat = format.toLowerCase();
10396
10385
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
10397
10386
 
10398
10387
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
10399
- return value;
10388
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
10389
+ return undefined;
10400
10390
  }
10401
10391
 
10402
10392
  return maskOptions.format(valueObject);
@@ -11314,7 +11304,17 @@ class BaseInput extends AuroElement {
11314
11304
  this.hasValue = false;
11315
11305
  }
11316
11306
 
11317
- const formattedValue = this.type === 'date' ? this.util.toFormattedValue(this.value, this.valueObject, this.format) : this.value;
11307
+ let formattedValue = this.value;
11308
+ if (this.type === 'date') {
11309
+ const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
11310
+ if (!formattedDate) {
11311
+ // if user entered unrecognized date format that cannot be parsed into a Date object,
11312
+ // keep the raw value in the input so they can edit it instead of overwriting with an empty string
11313
+ formattedValue = this.value;
11314
+ } else {
11315
+ formattedValue = formattedDate;
11316
+ }
11317
+ }
11318
11318
 
11319
11319
  if (formattedValue !== this.inputElement.value) {
11320
11320
  this.skipNextProgrammaticInputEvent = true;
@@ -12178,7 +12178,7 @@ class AuroHelpText extends i$3 {
12178
12178
  }
12179
12179
  }
12180
12180
 
12181
- var formkitVersion = '202606032113';
12181
+ var formkitVersion = '202606081518';
12182
12182
 
12183
12183
  /**
12184
12184
  * @license
@@ -10376,27 +10376,17 @@ class AuroInputUtilities {
10376
10376
  * Converts a model value to a display value for the input element.
10377
10377
  * For full date formats, converts an ISO model value to the configured display format.
10378
10378
  * @private
10379
- * @param {string} value - The model value (ISO string for date types).
10380
10379
  * @param {Date|undefined} valueObject - Date object representation of value.
10381
10380
  * @param {string} format - The date format string.
10382
- * @returns {string}
10381
+ * @returns {string | undefined}
10383
10382
  */
10384
- toFormattedValue(value, valueObject, format) {
10385
- if (!this.isFullDateFormat('date', format) || !value) {
10386
- return value;
10387
- }
10388
-
10389
- if (!dateFormatter.isValidDate(value)) {
10390
- // For ISO-pattern strings that fail range validation (e.g. '2024-99-99'),
10391
- // return '' so inputElement stays empty and format-based validation is not triggered.
10392
- return (/^\d{4}-\d{2}-\d{2}$/u).test(value) ? '' : value;
10393
- }
10394
-
10383
+ toFormattedValue(valueObject, format) {
10395
10384
  const normalizedFormat = format.toLowerCase();
10396
10385
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
10397
10386
 
10398
10387
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
10399
- return value;
10388
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
10389
+ return undefined;
10400
10390
  }
10401
10391
 
10402
10392
  return maskOptions.format(valueObject);
@@ -11314,7 +11304,17 @@ class BaseInput extends AuroElement {
11314
11304
  this.hasValue = false;
11315
11305
  }
11316
11306
 
11317
- const formattedValue = this.type === 'date' ? this.util.toFormattedValue(this.value, this.valueObject, this.format) : this.value;
11307
+ let formattedValue = this.value;
11308
+ if (this.type === 'date') {
11309
+ const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
11310
+ if (!formattedDate) {
11311
+ // if user entered unrecognized date format that cannot be parsed into a Date object,
11312
+ // keep the raw value in the input so they can edit it instead of overwriting with an empty string
11313
+ formattedValue = this.value;
11314
+ } else {
11315
+ formattedValue = formattedDate;
11316
+ }
11317
+ }
11318
11318
 
11319
11319
  if (formattedValue !== this.inputElement.value) {
11320
11320
  this.skipNextProgrammaticInputEvent = true;
@@ -12178,7 +12178,7 @@ class AuroHelpText extends i$3 {
12178
12178
  }
12179
12179
  }
12180
12180
 
12181
- var formkitVersion = '202606032113';
12181
+ var formkitVersion = '202606081518';
12182
12182
 
12183
12183
  /**
12184
12184
  * @license
@@ -1,7 +1,7 @@
1
1
  export namespace AuroInputUtil {
2
2
  export let toISOFormatString: any;
3
3
  export { formatISODate };
4
- export let toFormattedValue: (value: string, valueObject: Date | undefined, format: string) => string;
4
+ export let toFormattedValue: (valueObject: Date | undefined, format: string) => string | undefined;
5
5
  }
6
6
  /**
7
7
  * Converts an ISO date string (yyyy-mm-dd) to a display string in the given format.
@@ -10318,27 +10318,17 @@ class AuroInputUtilities {
10318
10318
  * Converts a model value to a display value for the input element.
10319
10319
  * For full date formats, converts an ISO model value to the configured display format.
10320
10320
  * @private
10321
- * @param {string} value - The model value (ISO string for date types).
10322
10321
  * @param {Date|undefined} valueObject - Date object representation of value.
10323
10322
  * @param {string} format - The date format string.
10324
- * @returns {string}
10323
+ * @returns {string | undefined}
10325
10324
  */
10326
- toFormattedValue(value, valueObject, format) {
10327
- if (!this.isFullDateFormat('date', format) || !value) {
10328
- return value;
10329
- }
10330
-
10331
- if (!dateFormatter.isValidDate(value)) {
10332
- // For ISO-pattern strings that fail range validation (e.g. '2024-99-99'),
10333
- // return '' so inputElement stays empty and format-based validation is not triggered.
10334
- return (/^\d{4}-\d{2}-\d{2}$/u).test(value) ? '' : value;
10335
- }
10336
-
10325
+ toFormattedValue(valueObject, format) {
10337
10326
  const normalizedFormat = format.toLowerCase();
10338
10327
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
10339
10328
 
10340
10329
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
10341
- return value;
10330
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
10331
+ return undefined;
10342
10332
  }
10343
10333
 
10344
10334
  return maskOptions.format(valueObject);
@@ -11256,7 +11246,17 @@ class BaseInput extends AuroElement {
11256
11246
  this.hasValue = false;
11257
11247
  }
11258
11248
 
11259
- const formattedValue = this.type === 'date' ? this.util.toFormattedValue(this.value, this.valueObject, this.format) : this.value;
11249
+ let formattedValue = this.value;
11250
+ if (this.type === 'date') {
11251
+ const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
11252
+ if (!formattedDate) {
11253
+ // if user entered unrecognized date format that cannot be parsed into a Date object,
11254
+ // keep the raw value in the input so they can edit it instead of overwriting with an empty string
11255
+ formattedValue = this.value;
11256
+ } else {
11257
+ formattedValue = formattedDate;
11258
+ }
11259
+ }
11260
11260
 
11261
11261
  if (formattedValue !== this.inputElement.value) {
11262
11262
  this.skipNextProgrammaticInputEvent = true;
@@ -12120,7 +12120,7 @@ class AuroHelpText extends LitElement {
12120
12120
  }
12121
12121
  }
12122
12122
 
12123
- var formkitVersion = '202606032113';
12123
+ var formkitVersion = '202606081518';
12124
12124
 
12125
12125
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
12126
12126
  // See LICENSE in the project root for license information.
@@ -10318,27 +10318,17 @@ class AuroInputUtilities {
10318
10318
  * Converts a model value to a display value for the input element.
10319
10319
  * For full date formats, converts an ISO model value to the configured display format.
10320
10320
  * @private
10321
- * @param {string} value - The model value (ISO string for date types).
10322
10321
  * @param {Date|undefined} valueObject - Date object representation of value.
10323
10322
  * @param {string} format - The date format string.
10324
- * @returns {string}
10323
+ * @returns {string | undefined}
10325
10324
  */
10326
- toFormattedValue(value, valueObject, format) {
10327
- if (!this.isFullDateFormat('date', format) || !value) {
10328
- return value;
10329
- }
10330
-
10331
- if (!dateFormatter.isValidDate(value)) {
10332
- // For ISO-pattern strings that fail range validation (e.g. '2024-99-99'),
10333
- // return '' so inputElement stays empty and format-based validation is not triggered.
10334
- return (/^\d{4}-\d{2}-\d{2}$/u).test(value) ? '' : value;
10335
- }
10336
-
10325
+ toFormattedValue(valueObject, format) {
10337
10326
  const normalizedFormat = format.toLowerCase();
10338
10327
  const maskOptions = this.getMaskOptions('date', normalizedFormat);
10339
10328
 
10340
10329
  if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
10341
- return value;
10330
+ console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
10331
+ return undefined;
10342
10332
  }
10343
10333
 
10344
10334
  return maskOptions.format(valueObject);
@@ -11256,7 +11246,17 @@ class BaseInput extends AuroElement {
11256
11246
  this.hasValue = false;
11257
11247
  }
11258
11248
 
11259
- const formattedValue = this.type === 'date' ? this.util.toFormattedValue(this.value, this.valueObject, this.format) : this.value;
11249
+ let formattedValue = this.value;
11250
+ if (this.type === 'date') {
11251
+ const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
11252
+ if (!formattedDate) {
11253
+ // if user entered unrecognized date format that cannot be parsed into a Date object,
11254
+ // keep the raw value in the input so they can edit it instead of overwriting with an empty string
11255
+ formattedValue = this.value;
11256
+ } else {
11257
+ formattedValue = formattedDate;
11258
+ }
11259
+ }
11260
11260
 
11261
11261
  if (formattedValue !== this.inputElement.value) {
11262
11262
  this.skipNextProgrammaticInputEvent = true;
@@ -12120,7 +12120,7 @@ class AuroHelpText extends LitElement {
12120
12120
  }
12121
12121
  }
12122
12122
 
12123
- var formkitVersion = '202606032113';
12123
+ var formkitVersion = '202606081518';
12124
12124
 
12125
12125
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
12126
12126
  // See LICENSE in the project root for license information.
@@ -75,10 +75,9 @@ export class AuroInputUtilities {
75
75
  * Converts a model value to a display value for the input element.
76
76
  * For full date formats, converts an ISO model value to the configured display format.
77
77
  * @private
78
- * @param {string} value - The model value (ISO string for date types).
79
78
  * @param {Date|undefined} valueObject - Date object representation of value.
80
79
  * @param {string} format - The date format string.
81
- * @returns {string}
80
+ * @returns {string | undefined}
82
81
  */
83
82
  private toFormattedValue;
84
83
  }
@@ -1212,7 +1212,7 @@ class AuroHelpText extends i$2 {
1212
1212
  }
1213
1213
  }
1214
1214
 
1215
- var formkitVersion = '202606032113';
1215
+ var formkitVersion = '202606081518';
1216
1216
 
1217
1217
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1218
1218
  // See LICENSE in the project root for license information.
@@ -1151,7 +1151,7 @@ class AuroHelpText extends LitElement {
1151
1151
  }
1152
1152
  }
1153
1153
 
1154
- var formkitVersion = '202606032113';
1154
+ var formkitVersion = '202606081518';
1155
1155
 
1156
1156
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1157
1157
  // See LICENSE in the project root for license information.
@@ -1151,7 +1151,7 @@ class AuroHelpText extends LitElement {
1151
1151
  }
1152
1152
  }
1153
1153
 
1154
- var formkitVersion = '202606032113';
1154
+ var formkitVersion = '202606081518';
1155
1155
 
1156
1156
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1157
1157
  // See LICENSE in the project root for license information.