@aurodesignsystem-dev/auro-formkit 0.0.0-pr1492.4 → 0.0.0-pr1493.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.
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +7 -0
- package/components/bibtemplate/dist/index.js +9 -1
- package/components/bibtemplate/dist/registered.js +9 -1
- package/components/checkbox/demo/css-only.html +57 -0
- package/components/checkbox/demo/css-only.md +146 -0
- package/components/checkbox/demo/customize.min.js +2 -2
- package/components/checkbox/demo/getting-started.min.js +2 -2
- package/components/checkbox/demo/index.min.js +2 -2
- package/components/checkbox/demo/pages.json +1 -1
- package/components/checkbox/demo/styles.min.css +1 -1
- package/components/checkbox/demo/why-checkbox.html +57 -0
- package/components/checkbox/demo/why-checkbox.md +86 -0
- package/components/checkbox/dist/index.js +2 -2
- package/components/checkbox/dist/registered.js +2 -2
- package/components/combobox/demo/css-only.html +57 -0
- package/components/combobox/demo/css-only.md +209 -0
- package/components/combobox/demo/customize.md +7 -3
- package/components/combobox/demo/customize.min.js +1846 -1804
- package/components/combobox/demo/getting-started.min.js +1846 -1804
- package/components/combobox/demo/index.min.js +1846 -1804
- package/components/combobox/demo/pages.json +1 -1
- package/components/combobox/demo/styles.min.css +1 -1
- package/components/combobox/demo/why-combobox.html +57 -0
- package/components/combobox/demo/why-combobox.md +113 -0
- package/components/combobox/dist/auro-combobox.d.ts +5 -0
- package/components/combobox/dist/index.js +796 -179
- package/components/combobox/dist/registered.js +796 -179
- package/components/counter/demo/css-only.html +57 -0
- package/components/counter/demo/css-only.md +184 -0
- package/components/counter/demo/customize.min.js +276 -16
- package/components/counter/demo/index.min.js +276 -16
- package/components/counter/demo/keyboard-behavior.md +1 -0
- package/components/counter/demo/pages.json +1 -1
- package/components/counter/demo/styles.min.css +1 -1
- package/components/counter/demo/why-counter.html +57 -0
- package/components/counter/demo/why-counter.md +108 -0
- package/components/counter/dist/index.js +5457 -193
- package/components/counter/dist/registered.js +5457 -193
- package/components/datepicker/demo/accessibility.md +54 -3
- package/components/datepicker/demo/api.md +65 -55
- package/components/datepicker/demo/css-only.html +57 -0
- package/components/datepicker/demo/css-only.md +151 -0
- package/components/datepicker/demo/customize.html +2 -0
- package/components/datepicker/demo/customize.js +19 -0
- package/components/datepicker/demo/customize.md +474 -298
- package/components/datepicker/demo/customize.min.js +36243 -0
- package/components/datepicker/demo/design.md +5 -3
- package/components/datepicker/demo/getting-started.md +6 -6
- package/components/datepicker/demo/index.js +5 -1
- package/components/datepicker/demo/index.md +113 -16
- package/components/datepicker/demo/index.min.js +2736 -398
- package/components/datepicker/demo/keyboard-behavior.md +201 -2
- package/components/datepicker/demo/pages.json +1 -1
- package/components/datepicker/demo/styles.min.css +1 -1
- package/components/datepicker/demo/voiceover.md +21 -12
- package/components/datepicker/demo/why-datepicker.html +57 -0
- package/components/datepicker/demo/why-datepicker.md +133 -0
- package/components/datepicker/dist/index.js +2650 -399
- package/components/datepicker/dist/registered.js +2650 -399
- package/components/datepicker/dist/src/auro-calendar-cell.d.ts +116 -14
- package/components/datepicker/dist/src/auro-calendar-month.d.ts +54 -1
- package/components/datepicker/dist/src/auro-calendar.d.ts +264 -0
- package/components/datepicker/dist/src/auro-datepicker.d.ts +189 -53
- package/components/datepicker/dist/src/datepickerKeyboardStrategy.d.ts +5 -3
- package/components/datepicker/dist/src/utilities.d.ts +0 -14
- package/components/dropdown/demo/accessibility.md +11 -0
- package/components/dropdown/demo/api.md +1 -0
- package/components/dropdown/demo/css-only.html +57 -0
- package/components/dropdown/demo/css-only.md +219 -0
- package/components/dropdown/demo/customize.md +3 -0
- package/components/dropdown/demo/customize.min.js +265 -13
- package/components/dropdown/demo/getting-started.min.js +265 -13
- package/components/dropdown/demo/index.min.js +265 -13
- package/components/dropdown/demo/keyboard-behavior.md +1 -0
- package/components/dropdown/demo/pages.json +1 -1
- package/components/dropdown/demo/styles.min.css +1 -1
- package/components/dropdown/demo/why-dropdown.html +57 -0
- package/components/dropdown/demo/why-dropdown.md +97 -0
- package/components/dropdown/dist/auro-dropdown.d.ts +36 -1
- package/components/dropdown/dist/index.js +265 -13
- package/components/dropdown/dist/registered.js +265 -13
- package/components/form/demo/css-only.html +57 -0
- package/components/form/demo/css-only.md +156 -0
- package/components/form/demo/customize.min.js +11085 -8074
- package/components/form/demo/getting-started.min.js +11085 -8074
- package/components/form/demo/index.min.js +11085 -8074
- package/components/form/demo/pages.json +1 -1
- package/components/form/demo/registerDemoDeps.min.js +11084 -8073
- package/components/form/demo/styles.min.css +1 -1
- package/components/form/demo/why-form.html +57 -0
- package/components/form/demo/why-form.md +101 -0
- package/components/input/demo/css-only.html +57 -0
- package/components/input/demo/css-only.md +199 -0
- package/components/input/demo/customize.md +625 -636
- package/components/input/demo/customize.min.js +150 -75
- package/components/input/demo/getting-started.md +16 -6
- package/components/input/demo/getting-started.min.js +150 -75
- package/components/input/demo/index.min.js +150 -75
- package/components/input/demo/pages.json +1 -1
- package/components/input/demo/styles.min.css +1 -1
- package/components/input/demo/why-input.html +57 -0
- package/components/input/demo/why-input.md +121 -0
- package/components/input/dist/auro-input-util.d.ts +1 -1
- package/components/input/dist/base-input.d.ts +16 -0
- package/components/input/dist/index.js +150 -75
- package/components/input/dist/registered.js +150 -75
- package/components/input/dist/utilities.d.ts +1 -2
- package/components/menu/demo/api.md +41 -45
- package/components/menu/demo/css-only.html +57 -0
- package/components/menu/demo/css-only.md +166 -0
- package/components/menu/demo/customize.md +0 -28
- package/components/menu/demo/index.min.js +779 -1354
- package/components/menu/demo/pages.json +1 -1
- package/components/menu/demo/styles.min.css +1 -1
- package/components/menu/demo/why-menu.html +57 -0
- package/components/menu/demo/why-menu.md +104 -0
- package/components/menu/dist/auro-menu.d.ts +95 -110
- package/components/menu/dist/auro-menuoption.d.ts +32 -138
- package/components/menu/dist/index.js +753 -1308
- package/components/menu/dist/registered.js +765 -1308
- package/components/radio/demo/css-only.html +57 -0
- package/components/radio/demo/css-only.md +151 -0
- package/components/radio/demo/customize.min.js +1764 -0
- package/components/radio/demo/demo-support.min.js +55807 -0
- package/components/radio/demo/getting-started.js +1 -1
- package/components/radio/demo/getting-started.md +1 -1
- package/components/radio/demo/getting-started.min.js +1783 -0
- package/components/radio/demo/index.min.js +2 -2
- package/components/radio/demo/pages.json +1 -1
- package/components/radio/demo/styles.min.css +1 -1
- package/components/radio/demo/why-radio.html +57 -0
- package/components/radio/demo/why-radio.md +92 -0
- package/components/radio/dist/index.js +2 -2
- package/components/radio/dist/registered.js +2 -2
- package/components/select/demo/api.md +1 -0
- package/components/select/demo/css-only.html +57 -0
- package/components/select/demo/css-only.md +203 -0
- package/components/select/demo/customize.md +78 -3
- package/components/select/demo/customize.min.js +1341 -1533
- package/components/select/demo/getting-started.min.js +1341 -1533
- package/components/select/demo/index.min.js +1341 -1533
- package/components/select/demo/keyboard-behavior.md +19 -0
- package/components/select/demo/pages.json +1 -1
- package/components/select/demo/styles.min.css +1 -1
- package/components/select/demo/why-select.html +57 -0
- package/components/select/demo/why-select.md +128 -0
- package/components/select/dist/auro-select.d.ts +38 -2
- package/components/select/dist/index.js +435 -52
- package/components/select/dist/registered.js +435 -52
- package/components/select/dist/selectUtils.d.ts +12 -0
- package/custom-elements.json +3051 -2553
- package/package.json +8 -8
- package/components/menu/dist/auro-menu.context.d.ts +0 -238
|
@@ -4548,7 +4548,7 @@ class AuroFormValidation {
|
|
|
4548
4548
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input') && elem.errorMessage === '') {
|
|
4549
4549
|
const input = elem.renderRoot.querySelector('input');
|
|
4550
4550
|
|
|
4551
|
-
if (input.validationMessage.length > 0) {
|
|
4551
|
+
if (input && input.validationMessage.length > 0) {
|
|
4552
4552
|
elem.errorMessage = input.validationMessage;
|
|
4553
4553
|
}
|
|
4554
4554
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
@@ -10220,7 +10220,11 @@ class AuroInputUtilities {
|
|
|
10220
10220
|
return part.value;
|
|
10221
10221
|
}
|
|
10222
10222
|
})
|
|
10223
|
-
.join("")
|
|
10223
|
+
.join("")
|
|
10224
|
+
// Remove whitespace and leading/trailing special characters for IMask compatibility
|
|
10225
|
+
// for example, ko-KR's format is `YYYY. MM. DD.` which causes issues with IMask if we don't remove the trailing period.
|
|
10226
|
+
.replace(/\s/gu, '')
|
|
10227
|
+
.replace(/^[^A-Z0-9]+|[^A-Z0-9]+$/gu, '');
|
|
10224
10228
|
}
|
|
10225
10229
|
|
|
10226
10230
|
/**
|
|
@@ -10376,27 +10380,16 @@ class AuroInputUtilities {
|
|
|
10376
10380
|
* Converts a model value to a display value for the input element.
|
|
10377
10381
|
* For full date formats, converts an ISO model value to the configured display format.
|
|
10378
10382
|
* @private
|
|
10379
|
-
* @param {string} value - The model value (ISO string for date types).
|
|
10380
10383
|
* @param {Date|undefined} valueObject - Date object representation of value.
|
|
10381
10384
|
* @param {string} format - The date format string.
|
|
10382
|
-
* @returns {string}
|
|
10385
|
+
* @returns {string | undefined}
|
|
10383
10386
|
*/
|
|
10384
|
-
toFormattedValue(
|
|
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
|
-
|
|
10387
|
+
toFormattedValue(valueObject, format) {
|
|
10395
10388
|
const normalizedFormat = format.toLowerCase();
|
|
10396
10389
|
const maskOptions = this.getMaskOptions('date', normalizedFormat);
|
|
10397
10390
|
|
|
10398
10391
|
if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
|
|
10399
|
-
return
|
|
10392
|
+
return undefined;
|
|
10400
10393
|
}
|
|
10401
10394
|
|
|
10402
10395
|
return maskOptions.format(valueObject);
|
|
@@ -11098,7 +11091,7 @@ class BaseInput extends AuroElement {
|
|
|
11098
11091
|
* @returns {Date|undefined}
|
|
11099
11092
|
*/
|
|
11100
11093
|
get valueObject() {
|
|
11101
|
-
return this._valueObject;
|
|
11094
|
+
return this._valueObject || this._computeDateObjectFallback(this.value);
|
|
11102
11095
|
}
|
|
11103
11096
|
|
|
11104
11097
|
/**
|
|
@@ -11106,7 +11099,7 @@ class BaseInput extends AuroElement {
|
|
|
11106
11099
|
* @returns {Date|undefined}
|
|
11107
11100
|
*/
|
|
11108
11101
|
get minObject() {
|
|
11109
|
-
return this._minObject;
|
|
11102
|
+
return this._minObject || this._computeDateObjectFallback(this.min);
|
|
11110
11103
|
}
|
|
11111
11104
|
|
|
11112
11105
|
/**
|
|
@@ -11114,7 +11107,31 @@ class BaseInput extends AuroElement {
|
|
|
11114
11107
|
* @returns {Date|undefined}
|
|
11115
11108
|
*/
|
|
11116
11109
|
get maxObject() {
|
|
11117
|
-
return this._maxObject;
|
|
11110
|
+
return this._maxObject || this._computeDateObjectFallback(this.max);
|
|
11111
|
+
}
|
|
11112
|
+
|
|
11113
|
+
/**
|
|
11114
|
+
* Parses a date string into a Date object when the corresponding `_*Object`
|
|
11115
|
+
* field hasn't been synced yet by `updated()`. Returns undefined when the
|
|
11116
|
+
* input type/format isn't a full date or the string is not a valid date.
|
|
11117
|
+
*
|
|
11118
|
+
* Why this exists: a parent (datepicker) can call `inputN.validate()` from
|
|
11119
|
+
* inside its own `updated()` before this input's `updated()` has run
|
|
11120
|
+
* `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
|
|
11121
|
+
* and range checks would otherwise silently no-op (flipping the result to
|
|
11122
|
+
* `valid` or `patternMismatch`).
|
|
11123
|
+
* @private
|
|
11124
|
+
* @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
|
|
11125
|
+
* @returns {Date|undefined}
|
|
11126
|
+
*/
|
|
11127
|
+
_computeDateObjectFallback(dateStr) {
|
|
11128
|
+
if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
|
|
11129
|
+
return undefined;
|
|
11130
|
+
}
|
|
11131
|
+
if (!dateFormatter.isValidDate(dateStr)) {
|
|
11132
|
+
return undefined;
|
|
11133
|
+
}
|
|
11134
|
+
return dateFormatter.stringToDateInstance(dateStr);
|
|
11118
11135
|
}
|
|
11119
11136
|
|
|
11120
11137
|
/**
|
|
@@ -11139,8 +11156,30 @@ class BaseInput extends AuroElement {
|
|
|
11139
11156
|
connectedCallback() {
|
|
11140
11157
|
super.connectedCallback();
|
|
11141
11158
|
|
|
11159
|
+
// Mark for query selectors when registered under a versioned tag (e.g. inside
|
|
11160
|
+
// a datepicker/combobox). Must run before parent components call validate() on
|
|
11161
|
+
// their inner inputs — the validation framework matches via tag-or-attribute,
|
|
11162
|
+
// and parents trigger validation during their own updated() cycle, which can
|
|
11163
|
+
// precede this input's firstUpdated().
|
|
11164
|
+
if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
|
|
11165
|
+
this.setAttribute('auro-input', '');
|
|
11166
|
+
}
|
|
11167
|
+
|
|
11142
11168
|
this.locale = this.domHandler.getLocale(this);
|
|
11143
11169
|
notifyOnLangChange(this);
|
|
11170
|
+
|
|
11171
|
+
// Pre-compute lengthForType and date-object fields so a parent (e.g. datepicker)
|
|
11172
|
+
// calling our validate() synchronously during its own updated() cycle sees
|
|
11173
|
+
// populated values. Without this, range validation silently no-ops because
|
|
11174
|
+
// `max.length === lengthForType` fails when lengthForType is still undefined.
|
|
11175
|
+
// Rebuild util here (constructor seeded with en-US default) so configureDataForType's
|
|
11176
|
+
// locale-derived format lookup uses the actual locale just resolved above.
|
|
11177
|
+
this.util = new AuroInputUtilities({
|
|
11178
|
+
locale: this.locale,
|
|
11179
|
+
format: this.format
|
|
11180
|
+
});
|
|
11181
|
+
this.configureDataForType();
|
|
11182
|
+
this.syncDateValues();
|
|
11144
11183
|
}
|
|
11145
11184
|
|
|
11146
11185
|
disconnectedCallback() {
|
|
@@ -11161,8 +11200,8 @@ class BaseInput extends AuroElement {
|
|
|
11161
11200
|
}
|
|
11162
11201
|
|
|
11163
11202
|
// add attribute for query selectors when auro-input is registered under a custom name
|
|
11164
|
-
if (this.tagName.toLowerCase() !== 'auro-input') {
|
|
11165
|
-
this.setAttribute('auro-input',
|
|
11203
|
+
if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
|
|
11204
|
+
this.setAttribute('auro-input', '');
|
|
11166
11205
|
}
|
|
11167
11206
|
this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
|
|
11168
11207
|
|
|
@@ -11210,6 +11249,12 @@ class BaseInput extends AuroElement {
|
|
|
11210
11249
|
return;
|
|
11211
11250
|
}
|
|
11212
11251
|
|
|
11252
|
+
// While configureAutoFormatting is running, imask's internal updateControl
|
|
11253
|
+
// writes el.value to align display with the masked value. A synthetic input
|
|
11254
|
+
// event from that write would re-enter handleInput → processCreditCard mid-setup
|
|
11255
|
+
// and clobber a Lit value that was just pushed by the parent combobox.
|
|
11256
|
+
if (component._configuringMask) return;
|
|
11257
|
+
|
|
11213
11258
|
// If all guard clauses are passed, dispatch the event
|
|
11214
11259
|
const inputEvent = new InputEvent('input', {
|
|
11215
11260
|
bubbles: true,
|
|
@@ -11314,11 +11359,30 @@ class BaseInput extends AuroElement {
|
|
|
11314
11359
|
this.hasValue = false;
|
|
11315
11360
|
}
|
|
11316
11361
|
|
|
11317
|
-
|
|
11362
|
+
let formattedValue = this.value;
|
|
11363
|
+
if (this.type === 'date') {
|
|
11364
|
+
const formattedDate = this.util.toFormattedValue(this.valueObject, this.format);
|
|
11365
|
+
if (!formattedDate) {
|
|
11366
|
+
// if user entered unrecognized date format that cannot be parsed into a Date object,
|
|
11367
|
+
// keep the raw value in the input so they can edit it instead of overwriting with an empty string
|
|
11368
|
+
formattedValue = this.value;
|
|
11369
|
+
} else {
|
|
11370
|
+
formattedValue = formattedDate;
|
|
11371
|
+
}
|
|
11372
|
+
}
|
|
11318
11373
|
|
|
11319
11374
|
if (formattedValue !== this.inputElement.value) {
|
|
11320
11375
|
this.skipNextProgrammaticInputEvent = true;
|
|
11321
|
-
if (
|
|
11376
|
+
if (this.maskInstance && this.type === 'credit-card') {
|
|
11377
|
+
// Route through the mask so its _value and el.value stay in lock-step
|
|
11378
|
+
// (set value calls updateControl which writes el.value = displayValue).
|
|
11379
|
+
// Writing el.value directly leaves the mask thinking displayValue is
|
|
11380
|
+
// stale; _saveSelection on the next focus/click then warns. Scoped to
|
|
11381
|
+
// credit-card so date's own formattedValue (raw ISO when calendar-invalid)
|
|
11382
|
+
// isn't re-masked through the mm/dd/yyyy mask, which would truncate it
|
|
11383
|
+
// and flip validity from patternMismatch to tooShort.
|
|
11384
|
+
this.maskInstance.value = formattedValue || '';
|
|
11385
|
+
} else if (formattedValue) {
|
|
11322
11386
|
this.inputElement.value = formattedValue;
|
|
11323
11387
|
} else {
|
|
11324
11388
|
this.inputElement.value = '';
|
|
@@ -11427,58 +11491,73 @@ class BaseInput extends AuroElement {
|
|
|
11427
11491
|
* @returns {void}
|
|
11428
11492
|
*/
|
|
11429
11493
|
configureAutoFormatting() {
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
this.
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
if (this.inputElement && maskOptions.mask) {
|
|
11440
|
-
|
|
11441
|
-
// Stash and clear any existing value before IMask init.
|
|
11442
|
-
// IMask's constructor processes the current input value which requires
|
|
11443
|
-
// selection state — clearing first avoids that scenario entirely.
|
|
11444
|
-
// When the format changes (e.g. locale switch) and we have a valid ISO
|
|
11445
|
-
// model value, compute the display string for the NEW format instead of
|
|
11446
|
-
// re-using the old display string, which may be invalid in the new mask.
|
|
11447
|
-
let existingValue = this.inputElement.value;
|
|
11448
|
-
if (
|
|
11449
|
-
this.util.isFullDateFormat(this.type, this.format) &&
|
|
11450
|
-
this.value &&
|
|
11451
|
-
dateFormatter.isValidDate(this.value) &&
|
|
11452
|
-
this.valueObject instanceof Date &&
|
|
11453
|
-
!Number.isNaN(this.valueObject.getTime()) &&
|
|
11454
|
-
typeof maskOptions.format === 'function'
|
|
11455
|
-
) {
|
|
11456
|
-
existingValue = maskOptions.format(this.valueObject);
|
|
11494
|
+
// Re-entrancy guard. The patched-setter's synthetic input event (suppressed
|
|
11495
|
+
// by _configuringMask above) could otherwise trigger handleInput →
|
|
11496
|
+
// processCreditCard → configureAutoFormatting before the outer call's
|
|
11497
|
+
// set value has finished its alignCursor pass.
|
|
11498
|
+
if (this._configuringMask) return;
|
|
11499
|
+
this._configuringMask = true;
|
|
11500
|
+
try {
|
|
11501
|
+
if (this.maskInstance) {
|
|
11502
|
+
this.maskInstance.destroy();
|
|
11457
11503
|
}
|
|
11458
11504
|
|
|
11459
|
-
|
|
11460
|
-
this.
|
|
11461
|
-
|
|
11462
|
-
this.maskInstance = IMask(this.inputElement, maskOptions);
|
|
11505
|
+
// Pass new format to util
|
|
11506
|
+
this.util.updateFormat(this.format);
|
|
11463
11507
|
|
|
11464
|
-
this.
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11508
|
+
const maskOptions = this.util.getMaskOptions(this.type, this.format);
|
|
11509
|
+
|
|
11510
|
+
if (this.inputElement && maskOptions.mask) {
|
|
11511
|
+
|
|
11512
|
+
// Stash and clear any existing value before IMask init.
|
|
11513
|
+
// IMask's constructor processes the current input value which requires
|
|
11514
|
+
// selection state — clearing first avoids that scenario entirely.
|
|
11515
|
+
// When the format changes (e.g. locale switch) and we have a valid ISO
|
|
11516
|
+
// model value, compute the display string for the NEW format instead of
|
|
11517
|
+
// re-using the old display string, which may be invalid in the new mask.
|
|
11518
|
+
let existingValue = this.inputElement.value;
|
|
11519
|
+
if (
|
|
11520
|
+
this.util.isFullDateFormat(this.type, this.format) &&
|
|
11521
|
+
this.value &&
|
|
11522
|
+
dateFormatter.isValidDate(this.value) &&
|
|
11523
|
+
this.valueObject instanceof Date &&
|
|
11524
|
+
!Number.isNaN(this.valueObject.getTime()) &&
|
|
11525
|
+
typeof maskOptions.format === 'function'
|
|
11526
|
+
) {
|
|
11527
|
+
existingValue = maskOptions.format(this.valueObject);
|
|
11468
11528
|
}
|
|
11469
|
-
});
|
|
11470
11529
|
|
|
11471
|
-
|
|
11472
|
-
this.value =
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11530
|
+
this.skipNextProgrammaticInputEvent = true;
|
|
11531
|
+
this.inputElement.value = '';
|
|
11532
|
+
|
|
11533
|
+
this.maskInstance = IMask(this.inputElement, maskOptions);
|
|
11534
|
+
|
|
11535
|
+
this.maskInstance.on('accept', () => {
|
|
11536
|
+
// Suppress propagation during configureAutoFormatting's own value-restoration
|
|
11537
|
+
// (line below) — the mask emits 'accept' on every value-set, including ours,
|
|
11538
|
+
// and we don't want to overwrite a value the parent just pushed.
|
|
11539
|
+
if (this._configuringMask) return;
|
|
11540
|
+
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
11541
|
+
if (this.type === "date") {
|
|
11542
|
+
this._rawMaskValue = this.maskInstance.value;
|
|
11543
|
+
}
|
|
11544
|
+
});
|
|
11477
11545
|
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11546
|
+
this.maskInstance.on('complete', () => {
|
|
11547
|
+
if (this._configuringMask) return;
|
|
11548
|
+
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
11549
|
+
if (this.type === "date") {
|
|
11550
|
+
this._rawMaskValue = this.maskInstance.value;
|
|
11551
|
+
}
|
|
11552
|
+
});
|
|
11553
|
+
|
|
11554
|
+
// Restore the stashed value through IMask so it's properly masked
|
|
11555
|
+
if (existingValue) {
|
|
11556
|
+
this.maskInstance.value = existingValue;
|
|
11557
|
+
}
|
|
11481
11558
|
}
|
|
11559
|
+
} finally {
|
|
11560
|
+
this._configuringMask = false;
|
|
11482
11561
|
}
|
|
11483
11562
|
}
|
|
11484
11563
|
|
|
@@ -11765,10 +11844,10 @@ class BaseInput extends AuroElement {
|
|
|
11765
11844
|
},
|
|
11766
11845
|
{
|
|
11767
11846
|
name: 'Diners club',
|
|
11768
|
-
regex: /^(?<num>36|38)\d{0}/u,
|
|
11847
|
+
regex: /^(?<num>30[0-5]|36|38)\d{0}/u,
|
|
11769
11848
|
formatLength: 16,
|
|
11770
11849
|
errorMessage: CreditCardValidationMessage,
|
|
11771
|
-
cardIcon: '
|
|
11850
|
+
cardIcon: 'cc-dinersclub',
|
|
11772
11851
|
maskFormat: "0000 000000 0000"
|
|
11773
11852
|
},
|
|
11774
11853
|
{
|
|
@@ -12178,7 +12257,7 @@ class AuroHelpText extends i$3 {
|
|
|
12178
12257
|
}
|
|
12179
12258
|
}
|
|
12180
12259
|
|
|
12181
|
-
var formkitVersion = '
|
|
12260
|
+
var formkitVersion = '202606181613';
|
|
12182
12261
|
|
|
12183
12262
|
/**
|
|
12184
12263
|
* @license
|
|
@@ -12528,10 +12607,6 @@ class AuroInput extends BaseInput {
|
|
|
12528
12607
|
return i18n(this.lang, this.type);
|
|
12529
12608
|
}
|
|
12530
12609
|
|
|
12531
|
-
if (this.type === 'date') {
|
|
12532
|
-
return i18n(this.lang, this.dateFormatMap[this.format] || 'dateMMDDYYYY');
|
|
12533
|
-
}
|
|
12534
|
-
|
|
12535
12610
|
return '';
|
|
12536
12611
|
}
|
|
12537
12612
|
|
|
@@ -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="
|
|
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="
|
|
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
|
-
<
|
|
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>
|