@aurodesignsystem-dev/auro-formkit 0.0.0-pr1508.0 → 0.0.0-pr1509.1
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 +1 -1
- package/components/checkbox/demo/getting-started.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/customize.min.js +279 -142
- package/components/combobox/demo/getting-started.min.js +279 -142
- package/components/combobox/demo/index.min.js +279 -142
- package/components/combobox/dist/auro-combobox.d.ts +0 -9
- package/components/combobox/dist/index.js +279 -142
- package/components/combobox/dist/registered.js +279 -142
- package/components/counter/demo/customize.min.js +2 -2
- package/components/counter/demo/index.min.js +2 -2
- package/components/counter/dist/index.js +2 -2
- package/components/counter/dist/registered.js +2 -2
- package/components/datepicker/demo/customize.min.js +153 -45
- package/components/datepicker/demo/index.min.js +153 -45
- package/components/datepicker/dist/index.js +153 -45
- package/components/datepicker/dist/registered.js +153 -45
- 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 +589 -235
- package/components/form/demo/getting-started.min.js +589 -235
- package/components/form/demo/index.min.js +589 -235
- package/components/form/demo/registerDemoDeps.min.js +589 -235
- package/components/input/demo/customize.min.js +151 -42
- package/components/input/demo/getting-started.min.js +151 -42
- package/components/input/demo/index.min.js +151 -42
- package/components/input/dist/base-input.d.ts +49 -1
- package/components/input/dist/index.js +151 -42
- package/components/input/dist/registered.js +151 -42
- package/components/radio/demo/customize.min.js +1 -1
- package/components/radio/demo/getting-started.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/customize.min.js +2 -2
- package/components/select/demo/getting-started.min.js +2 -2
- package/components/select/demo/index.min.js +2 -2
- package/components/select/dist/index.js +2 -2
- package/components/select/dist/registered.js +2 -2
- package/custom-elements.json +264 -20
- package/package.json +1 -1
|
@@ -10331,7 +10331,6 @@ class AuroInputUtilities {
|
|
|
10331
10331
|
const maskOptions = this.getMaskOptions('date', normalizedFormat);
|
|
10332
10332
|
|
|
10333
10333
|
if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
|
|
10334
|
-
console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
|
|
10335
10334
|
return undefined;
|
|
10336
10335
|
}
|
|
10337
10336
|
|
|
@@ -10483,8 +10482,10 @@ class BaseInput extends AuroElement {
|
|
|
10483
10482
|
this.layout = 'classic';
|
|
10484
10483
|
this.locale = 'en-US';
|
|
10485
10484
|
this.max = undefined;
|
|
10485
|
+
this._maxObject = undefined;
|
|
10486
10486
|
this.maxLength = undefined;
|
|
10487
10487
|
this.min = undefined;
|
|
10488
|
+
this._minObject = undefined;
|
|
10488
10489
|
this.minLength = undefined;
|
|
10489
10490
|
this.required = false;
|
|
10490
10491
|
this.onDark = false;
|
|
@@ -10492,6 +10493,7 @@ class BaseInput extends AuroElement {
|
|
|
10492
10493
|
this.size = 'lg';
|
|
10493
10494
|
this.shape = 'classic';
|
|
10494
10495
|
this.value = undefined;
|
|
10496
|
+
this._valueObject = undefined;
|
|
10495
10497
|
|
|
10496
10498
|
this._initializePrivateDefaults();
|
|
10497
10499
|
}
|
|
@@ -11031,7 +11033,7 @@ class BaseInput extends AuroElement {
|
|
|
11031
11033
|
* @returns {Date|undefined}
|
|
11032
11034
|
*/
|
|
11033
11035
|
get valueObject() {
|
|
11034
|
-
return this.
|
|
11036
|
+
return this._valueObject || this._computeDateObjectFallback(this.value);
|
|
11035
11037
|
}
|
|
11036
11038
|
|
|
11037
11039
|
/**
|
|
@@ -11039,7 +11041,7 @@ class BaseInput extends AuroElement {
|
|
|
11039
11041
|
* @returns {Date|undefined}
|
|
11040
11042
|
*/
|
|
11041
11043
|
get minObject() {
|
|
11042
|
-
return this.
|
|
11044
|
+
return this._minObject || this._computeDateObjectFallback(this.min);
|
|
11043
11045
|
}
|
|
11044
11046
|
|
|
11045
11047
|
/**
|
|
@@ -11047,7 +11049,50 @@ class BaseInput extends AuroElement {
|
|
|
11047
11049
|
* @returns {Date|undefined}
|
|
11048
11050
|
*/
|
|
11049
11051
|
get maxObject() {
|
|
11050
|
-
return this.
|
|
11052
|
+
return this._maxObject || this._computeDateObjectFallback(this.max);
|
|
11053
|
+
}
|
|
11054
|
+
|
|
11055
|
+
/**
|
|
11056
|
+
* Parses a date string into a Date object when the corresponding `_*Object`
|
|
11057
|
+
* field hasn't been synced yet by `updated()`. Returns undefined when the
|
|
11058
|
+
* input type/format isn't a full date or the string is not a valid date.
|
|
11059
|
+
*
|
|
11060
|
+
* Why this exists: a parent (datepicker) can call `inputN.validate()` from
|
|
11061
|
+
* inside its own `updated()` before this input's `updated()` has run
|
|
11062
|
+
* `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
|
|
11063
|
+
* and range checks would otherwise silently no-op (flipping the result to
|
|
11064
|
+
* `valid` or `patternMismatch`).
|
|
11065
|
+
* @private
|
|
11066
|
+
* @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
|
|
11067
|
+
* @returns {Date|undefined}
|
|
11068
|
+
*/
|
|
11069
|
+
_computeDateObjectFallback(dateStr) {
|
|
11070
|
+
if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
|
|
11071
|
+
return undefined;
|
|
11072
|
+
}
|
|
11073
|
+
if (!dateFormatter.isValidDate(dateStr)) {
|
|
11074
|
+
return undefined;
|
|
11075
|
+
}
|
|
11076
|
+
return dateFormatter.stringToDateInstance(dateStr);
|
|
11077
|
+
}
|
|
11078
|
+
|
|
11079
|
+
/**
|
|
11080
|
+
* Internal setter for readonly date object properties.
|
|
11081
|
+
* @private
|
|
11082
|
+
* @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
|
|
11083
|
+
* @param {Date|undefined} propertyValue - Value to assign.
|
|
11084
|
+
* @returns {void}
|
|
11085
|
+
*/
|
|
11086
|
+
setDateObjectProperty(propertyName, propertyValue) {
|
|
11087
|
+
const internalPropertyName = `_${propertyName}`;
|
|
11088
|
+
const previousValue = this[internalPropertyName];
|
|
11089
|
+
|
|
11090
|
+
if (previousValue === propertyValue) {
|
|
11091
|
+
return;
|
|
11092
|
+
}
|
|
11093
|
+
|
|
11094
|
+
this[internalPropertyName] = propertyValue;
|
|
11095
|
+
this.requestUpdate(propertyName, previousValue);
|
|
11051
11096
|
}
|
|
11052
11097
|
|
|
11053
11098
|
connectedCallback() {
|
|
@@ -11076,6 +11121,7 @@ class BaseInput extends AuroElement {
|
|
|
11076
11121
|
format: this.format
|
|
11077
11122
|
});
|
|
11078
11123
|
this.configureDataForType();
|
|
11124
|
+
this.syncDateValues();
|
|
11079
11125
|
}
|
|
11080
11126
|
|
|
11081
11127
|
disconnectedCallback() {
|
|
@@ -11105,6 +11151,7 @@ class BaseInput extends AuroElement {
|
|
|
11105
11151
|
this.setCustomHelpTextMessage();
|
|
11106
11152
|
this.configureAutoFormatting();
|
|
11107
11153
|
this.configureDataForType();
|
|
11154
|
+
this.syncDateValues();
|
|
11108
11155
|
}
|
|
11109
11156
|
|
|
11110
11157
|
/**
|
|
@@ -11180,6 +11227,13 @@ class BaseInput extends AuroElement {
|
|
|
11180
11227
|
|
|
11181
11228
|
if (typeToI18n.includes(this.type)) {
|
|
11182
11229
|
this.setCustomValidityForType = i18n(this.lang, this.type);
|
|
11230
|
+
// COVERAGE: this `else if` branch is unreachable in WTR. connectedCallback
|
|
11231
|
+
// (L682) calls configureDataForType, which at L1266-1268 assigns
|
|
11232
|
+
// `this.format = this.util.getDateMaskFromLocale().toLowerCase()` for any
|
|
11233
|
+
// type=date input whose `format` attribute is unset. That runs before
|
|
11234
|
+
// firstUpdated invokes setCustomHelpTextMessage, so `!this.format` is
|
|
11235
|
+
// always false here. Retained as a defensive fallback; the whole function
|
|
11236
|
+
// is @deprecated per AB#1557296 and slated for removal.
|
|
11183
11237
|
} else if (!this.format && this.type === 'date') {
|
|
11184
11238
|
this.setCustomValidityForType = i18n(this.lang, 'dateMMDDYYYY');
|
|
11185
11239
|
} else if (this.dateFormatMap[this.format]) {
|
|
@@ -11241,6 +11295,8 @@ class BaseInput extends AuroElement {
|
|
|
11241
11295
|
this.configureDataForType();
|
|
11242
11296
|
}
|
|
11243
11297
|
|
|
11298
|
+
this.syncDateValues(changedProperties);
|
|
11299
|
+
|
|
11244
11300
|
if (changedProperties.has('value')) {
|
|
11245
11301
|
if (this.value && this.value.length > 0) {
|
|
11246
11302
|
this.hasValue = true;
|
|
@@ -11262,14 +11318,14 @@ class BaseInput extends AuroElement {
|
|
|
11262
11318
|
|
|
11263
11319
|
if (formattedValue !== this.inputElement.value) {
|
|
11264
11320
|
this.skipNextProgrammaticInputEvent = true;
|
|
11265
|
-
if (this.maskInstance && this.type
|
|
11321
|
+
if (this.maskInstance && this.type === 'credit-card') {
|
|
11266
11322
|
// Route through the mask so its _value and el.value stay in lock-step
|
|
11267
11323
|
// (set value calls updateControl which writes el.value = displayValue).
|
|
11268
11324
|
// Writing el.value directly leaves the mask thinking displayValue is
|
|
11269
|
-
// stale; _saveSelection on the next focus/click then warns.
|
|
11270
|
-
//
|
|
11271
|
-
//
|
|
11272
|
-
// flip validity from patternMismatch to tooShort.
|
|
11325
|
+
// stale; _saveSelection on the next focus/click then warns. Scoped to
|
|
11326
|
+
// credit-card so date's own formattedValue (raw ISO when calendar-invalid)
|
|
11327
|
+
// isn't re-masked through the mm/dd/yyyy mask, which would truncate it
|
|
11328
|
+
// and flip validity from patternMismatch to tooShort.
|
|
11273
11329
|
this.maskInstance.value = formattedValue || '';
|
|
11274
11330
|
} else if (formattedValue) {
|
|
11275
11331
|
this.inputElement.value = formattedValue;
|
|
@@ -11311,65 +11367,120 @@ class BaseInput extends AuroElement {
|
|
|
11311
11367
|
}));
|
|
11312
11368
|
}
|
|
11313
11369
|
|
|
11370
|
+
|
|
11371
|
+
/**
|
|
11372
|
+
* Synchronizes the ISO string values and Date object representations for date-related properties.
|
|
11373
|
+
* This keeps the model and display values aligned when either side changes.
|
|
11374
|
+
*
|
|
11375
|
+
* When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
|
|
11376
|
+
* Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
|
|
11377
|
+
* represents a full year/month/day date format.
|
|
11378
|
+
*
|
|
11379
|
+
* @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
|
|
11380
|
+
* @returns {void}
|
|
11381
|
+
* @private
|
|
11382
|
+
*/
|
|
11383
|
+
syncDateValues(changedProperties = undefined) {
|
|
11384
|
+
if (!this.util.isFullDateFormat(this.type, this.format)) {
|
|
11385
|
+
return;
|
|
11386
|
+
}
|
|
11387
|
+
|
|
11388
|
+
this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
|
|
11389
|
+
this.syncSingleDateValue(changedProperties, 'minObject', 'min');
|
|
11390
|
+
this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
|
|
11391
|
+
}
|
|
11392
|
+
|
|
11393
|
+
/**
|
|
11394
|
+
* Synchronizes one date object/string property pair.
|
|
11395
|
+
* @private
|
|
11396
|
+
* @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
|
|
11397
|
+
* @param {string} objectProperty - Date object property name.
|
|
11398
|
+
* @param {string} valueProperty - ISO string property name.
|
|
11399
|
+
* @returns {void}
|
|
11400
|
+
*/
|
|
11401
|
+
syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
|
|
11402
|
+
const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
|
|
11403
|
+
|
|
11404
|
+
// objectProperty wins over valueProperty when both changed
|
|
11405
|
+
if (objectPropertyChanged && this[objectProperty]) {
|
|
11406
|
+
this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
|
|
11407
|
+
return;
|
|
11408
|
+
}
|
|
11409
|
+
|
|
11410
|
+
const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
|
|
11411
|
+
if (!valuePropertyChanged) {
|
|
11412
|
+
return;
|
|
11413
|
+
}
|
|
11414
|
+
|
|
11415
|
+
// when value is newly set to the same ISO string that corresponds to the existing Date object, do not clear the Date object (avoid unnecessary updates)
|
|
11416
|
+
if (
|
|
11417
|
+
changedProperties &&
|
|
11418
|
+
valueProperty === 'value' &&
|
|
11419
|
+
changedProperties.get('value') === undefined &&
|
|
11420
|
+
this[objectProperty] instanceof Date &&
|
|
11421
|
+
this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
|
|
11422
|
+
) {
|
|
11423
|
+
return;
|
|
11424
|
+
}
|
|
11425
|
+
|
|
11426
|
+
if (dateFormatter.isValidDate(this[valueProperty])) {
|
|
11427
|
+
this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
|
|
11428
|
+
} else {
|
|
11429
|
+
this.setDateObjectProperty(objectProperty, undefined);
|
|
11430
|
+
}
|
|
11431
|
+
}
|
|
11432
|
+
|
|
11314
11433
|
/**
|
|
11315
11434
|
* Sets up IMasks and logic based on auto-formatting requirements.
|
|
11316
11435
|
* @private
|
|
11317
11436
|
* @returns {void}
|
|
11318
11437
|
*/
|
|
11319
11438
|
configureAutoFormatting() {
|
|
11320
|
-
//
|
|
11321
|
-
//
|
|
11322
|
-
//
|
|
11323
|
-
//
|
|
11439
|
+
// Re-entrancy guard. The patched-setter's synthetic input event (suppressed
|
|
11440
|
+
// by _configuringMask above) could otherwise trigger handleInput →
|
|
11441
|
+
// processCreditCard → configureAutoFormatting before the outer call's
|
|
11442
|
+
// set value has finished its alignCursor pass.
|
|
11324
11443
|
if (this._configuringMask) return;
|
|
11325
11444
|
this._configuringMask = true;
|
|
11326
11445
|
try {
|
|
11327
|
-
// Destroy any prior mask so IMask can attach fresh under the new format.
|
|
11328
|
-
// Null the reference too — if the new maskOptions.mask is falsy (e.g.
|
|
11329
|
-
// type switched from credit-card to text) the IMask() reassignment
|
|
11330
|
-
// below is skipped, and downstream writes at line ~823 would otherwise
|
|
11331
|
-
// route through the destroyed instance.
|
|
11332
11446
|
if (this.maskInstance) {
|
|
11333
11447
|
this.maskInstance.destroy();
|
|
11334
|
-
this.maskInstance = null;
|
|
11335
11448
|
}
|
|
11336
11449
|
|
|
11450
|
+
// Pass new format to util
|
|
11337
11451
|
this.util.updateFormat(this.format);
|
|
11338
11452
|
|
|
11339
11453
|
const maskOptions = this.util.getMaskOptions(this.type, this.format);
|
|
11340
11454
|
|
|
11341
11455
|
if (this.inputElement && maskOptions.mask) {
|
|
11342
|
-
// Capture the current display so it can be re-applied after IMask
|
|
11343
|
-
// attaches. The restore at the bottom goes through maskInstance.value
|
|
11344
|
-
// (not inputElement.value directly) so the mask's internal state and
|
|
11345
|
-
// the input's displayed text stay in lock-step.
|
|
11346
|
-
let existingValue = this.inputElement.value;
|
|
11347
11456
|
|
|
11348
|
-
//
|
|
11349
|
-
//
|
|
11350
|
-
//
|
|
11351
|
-
//
|
|
11457
|
+
// Stash and clear any existing value before IMask init.
|
|
11458
|
+
// IMask's constructor processes the current input value which requires
|
|
11459
|
+
// selection state — clearing first avoids that scenario entirely.
|
|
11460
|
+
// When the format changes (e.g. locale switch) and we have a valid ISO
|
|
11461
|
+
// model value, compute the display string for the NEW format instead of
|
|
11462
|
+
// re-using the old display string, which may be invalid in the new mask.
|
|
11463
|
+
let existingValue = this.inputElement.value;
|
|
11352
11464
|
if (
|
|
11353
11465
|
this.util.isFullDateFormat(this.type, this.format) &&
|
|
11354
11466
|
this.value &&
|
|
11355
|
-
this.
|
|
11467
|
+
dateFormatter.isValidDate(this.value) &&
|
|
11468
|
+
this.valueObject instanceof Date &&
|
|
11469
|
+
!Number.isNaN(this.valueObject.getTime()) &&
|
|
11356
11470
|
typeof maskOptions.format === 'function'
|
|
11357
11471
|
) {
|
|
11358
11472
|
existingValue = maskOptions.format(this.valueObject);
|
|
11359
11473
|
}
|
|
11360
11474
|
|
|
11361
|
-
// Clear before IMask attaches so the constructor seeds an empty
|
|
11362
|
-
// internal value. Otherwise IMask reads the stale unmasked string
|
|
11363
|
-
// and emits a spurious 'accept' before the restore below runs.
|
|
11364
11475
|
this.skipNextProgrammaticInputEvent = true;
|
|
11365
11476
|
this.inputElement.value = '';
|
|
11366
11477
|
|
|
11367
11478
|
this.maskInstance = IMask(this.inputElement, maskOptions);
|
|
11368
11479
|
|
|
11369
|
-
// Mask fires 'accept' on every value change, including the restore
|
|
11370
|
-
// step below. Skip events fired during configureAutoFormatting so
|
|
11371
|
-
// we don't overwrite a value the parent just pushed.
|
|
11372
11480
|
this.maskInstance.on('accept', () => {
|
|
11481
|
+
// Suppress propagation during configureAutoFormatting's own value-restoration
|
|
11482
|
+
// (line below) — the mask emits 'accept' on every value-set, including ours,
|
|
11483
|
+
// and we don't want to overwrite a value the parent just pushed.
|
|
11373
11484
|
if (this._configuringMask) return;
|
|
11374
11485
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
11375
11486
|
if (this.type === "date") {
|
|
@@ -11377,8 +11488,6 @@ class BaseInput extends AuroElement {
|
|
|
11377
11488
|
}
|
|
11378
11489
|
});
|
|
11379
11490
|
|
|
11380
|
-
// Mask fires 'complete' on the restore step below for any value that
|
|
11381
|
-
// happens to be a complete match. Same setup-suppression as 'accept'.
|
|
11382
11491
|
this.maskInstance.on('complete', () => {
|
|
11383
11492
|
if (this._configuringMask) return;
|
|
11384
11493
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
@@ -11387,9 +11496,7 @@ class BaseInput extends AuroElement {
|
|
|
11387
11496
|
}
|
|
11388
11497
|
});
|
|
11389
11498
|
|
|
11390
|
-
//
|
|
11391
|
-
// the mask reformats it under the new rules and keeps its internal
|
|
11392
|
-
// _value aligned with the input's displayed text.
|
|
11499
|
+
// Restore the stashed value through IMask so it's properly masked
|
|
11393
11500
|
if (existingValue) {
|
|
11394
11501
|
this.maskInstance.value = existingValue;
|
|
11395
11502
|
}
|
|
@@ -11557,6 +11664,7 @@ class BaseInput extends AuroElement {
|
|
|
11557
11664
|
*/
|
|
11558
11665
|
reset() {
|
|
11559
11666
|
this.value = undefined;
|
|
11667
|
+
this.setDateObjectProperty('valueObject', undefined);
|
|
11560
11668
|
this.validation.reset(this);
|
|
11561
11669
|
}
|
|
11562
11670
|
|
|
@@ -11565,6 +11673,7 @@ class BaseInput extends AuroElement {
|
|
|
11565
11673
|
*/
|
|
11566
11674
|
clear() {
|
|
11567
11675
|
this.value = undefined;
|
|
11676
|
+
this.setDateObjectProperty('valueObject', undefined);
|
|
11568
11677
|
}
|
|
11569
11678
|
|
|
11570
11679
|
/**
|
|
@@ -11602,7 +11711,7 @@ class BaseInput extends AuroElement {
|
|
|
11602
11711
|
*/
|
|
11603
11712
|
get placeholderStr() {
|
|
11604
11713
|
if (!this.placeholder && this.type === 'date') {
|
|
11605
|
-
return this.format
|
|
11714
|
+
return this.format.toUpperCase();
|
|
11606
11715
|
}
|
|
11607
11716
|
return this.placeholder || "";
|
|
11608
11717
|
}
|
|
@@ -12093,7 +12202,7 @@ class AuroHelpText extends LitElement {
|
|
|
12093
12202
|
}
|
|
12094
12203
|
}
|
|
12095
12204
|
|
|
12096
|
-
var formkitVersion = '
|
|
12205
|
+
var formkitVersion = '202606241801';
|
|
12097
12206
|
|
|
12098
12207
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
12099
12208
|
// See LICENSE in the project root for license information.
|