@aurodesignsystem-dev/auro-formkit 0.0.0-pr1619.0 → 0.0.0-pr1624.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/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 +30 -6
- package/components/combobox/demo/getting-started.min.js +30 -6
- package/components/combobox/demo/index.min.js +30 -6
- package/components/combobox/dist/index.js +30 -6
- package/components/combobox/dist/registered.js +30 -6
- package/components/counter/demo/api.md +4 -4
- package/components/counter/demo/customize.md +4 -4
- package/components/counter/demo/customize.min.js +86 -59
- package/components/counter/demo/getting-started.min.js +86 -59
- package/components/counter/demo/index.min.js +86 -59
- package/components/counter/dist/auro-counter-group.d.ts +11 -15
- package/components/counter/dist/index.js +86 -59
- package/components/counter/dist/registered.js +86 -59
- package/components/datepicker/demo/customize.min.js +30 -6
- package/components/datepicker/demo/getting-started.min.js +30 -6
- package/components/datepicker/demo/index.min.js +30 -6
- package/components/datepicker/dist/index.js +30 -6
- package/components/datepicker/dist/registered.js +30 -6
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +29 -5
- 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 +179 -80
- package/components/form/demo/getting-started.min.js +179 -80
- package/components/form/demo/index.min.js +179 -80
- package/components/form/demo/registerDemoDeps.min.js +179 -80
- package/components/input/demo/customize.min.js +28 -4
- package/components/input/demo/getting-started.min.js +28 -4
- package/components/input/demo/index.min.js +28 -4
- package/components/input/dist/auro-input.d.ts +14 -0
- package/components/input/dist/index.js +28 -4
- package/components/input/dist/registered.js +28 -4
- 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 +3 -3
- package/components/select/demo/getting-started.min.js +3 -3
- package/components/select/demo/index.min.js +3 -3
- package/components/select/dist/index.js +3 -3
- package/components/select/dist/registered.js +3 -3
- package/custom-elements.json +42 -38
- package/package.json +1 -1
|
@@ -1127,7 +1127,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$2 {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
|
-
var formkitVersion$1 = '
|
|
1130
|
+
var formkitVersion$1 = '202610051839';
|
|
1131
1131
|
|
|
1132
1132
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1133
1133
|
// See LICENSE in the project root for license information.
|
|
@@ -5487,7 +5487,7 @@ class AuroHelpText extends i$2 {
|
|
|
5487
5487
|
}
|
|
5488
5488
|
}
|
|
5489
5489
|
|
|
5490
|
-
var formkitVersion = '
|
|
5490
|
+
var formkitVersion = '202610051839';
|
|
5491
5491
|
|
|
5492
5492
|
/**
|
|
5493
5493
|
* AuroElement is the shared base class for layout-aware Auro form components.
|
|
@@ -7883,6 +7883,7 @@ const counterGroupKeyboardStrategy = {
|
|
|
7883
7883
|
* @csspart dropdown - The dropdown element rendered when `isDropdown` is true.
|
|
7884
7884
|
* @csspart helpText - The help text and error message container.
|
|
7885
7885
|
*
|
|
7886
|
+
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
7886
7887
|
* @event input - Notifies that the counter group's value has changed.
|
|
7887
7888
|
*/
|
|
7888
7889
|
class AuroCounterGroup extends AuroElement {
|
|
@@ -8004,14 +8005,6 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8004
8005
|
reflect: true
|
|
8005
8006
|
},
|
|
8006
8007
|
|
|
8007
|
-
/**
|
|
8008
|
-
* The current error message to display when the component is invalid.
|
|
8009
|
-
*/
|
|
8010
|
-
error: {
|
|
8011
|
-
type: String,
|
|
8012
|
-
reflect: false
|
|
8013
|
-
},
|
|
8014
|
-
|
|
8015
8008
|
/**
|
|
8016
8009
|
* The current error message to display when the component is invalid.
|
|
8017
8010
|
* This is set by validation and is not available to consumers.
|
|
@@ -8233,21 +8226,6 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8233
8226
|
this.updateValidity();
|
|
8234
8227
|
}
|
|
8235
8228
|
|
|
8236
|
-
/**
|
|
8237
|
-
* Renders help text error messages.
|
|
8238
|
-
* @param {Array<string>} messages - The error messages to render.
|
|
8239
|
-
* @returns {TemplateResult[]} - The rendered error messages rendered in a TemplateResult.
|
|
8240
|
-
* @private
|
|
8241
|
-
*/
|
|
8242
|
-
renderHelpTextErrors(messages) {
|
|
8243
|
-
|
|
8244
|
-
// Return empty template if no messages are provided
|
|
8245
|
-
if (!messages || messages.length === 0) return u$5``;
|
|
8246
|
-
|
|
8247
|
-
// Return messages as a TemplateResult
|
|
8248
|
-
return messages.map(message => u$5`<p>${message}</p>`);
|
|
8249
|
-
}
|
|
8250
|
-
|
|
8251
8229
|
/**
|
|
8252
8230
|
* Gets and returns an array of counters in an invalid state.
|
|
8253
8231
|
* @returns {Array<HTMLElement>} - Returns an array of invalid counters.
|
|
@@ -8271,55 +8249,70 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8271
8249
|
};
|
|
8272
8250
|
|
|
8273
8251
|
/**
|
|
8274
|
-
*
|
|
8275
|
-
*
|
|
8276
|
-
*
|
|
8252
|
+
* Synchronously recomputes this.validity/this.errorMessage from the current
|
|
8253
|
+
* validity of the child counters. Extracted from updateValidity() so that
|
|
8254
|
+
* validate() can re-apply this aggregation immediately after the shared
|
|
8255
|
+
* validation engine runs, instead of waiting on a deferred timer.
|
|
8277
8256
|
* @returns {void}
|
|
8278
8257
|
* @private
|
|
8279
8258
|
*/
|
|
8280
|
-
|
|
8259
|
+
computeValidityFromCounters() {
|
|
8281
8260
|
|
|
8282
8261
|
// We don't need to do anything if there are no counters
|
|
8283
8262
|
if (!this.counters) return;
|
|
8284
8263
|
|
|
8285
|
-
//
|
|
8286
|
-
|
|
8287
|
-
setTimeout(() => {
|
|
8264
|
+
// Get any invalid counters
|
|
8265
|
+
const invalidCounters = this.getInvalidCounters(this.counters);
|
|
8288
8266
|
|
|
8289
|
-
|
|
8290
|
-
|
|
8267
|
+
// Determine if we are in an invalid state based on the presence of invalid counters
|
|
8268
|
+
const isInvalid = invalidCounters.length > 0;
|
|
8291
8269
|
|
|
8292
|
-
|
|
8293
|
-
|
|
8270
|
+
// If we are in an invalid state
|
|
8271
|
+
if (isInvalid) {
|
|
8294
8272
|
|
|
8295
|
-
//
|
|
8296
|
-
|
|
8273
|
+
// Generate the error messages as plain text, joined with sentence-ending
|
|
8274
|
+
// punctuation so multiple messages don't run together into one clause.
|
|
8275
|
+
const errorMessages = this.getErrorMessages(invalidCounters);
|
|
8276
|
+
const joinedMessage = errorMessages.join('. ');
|
|
8297
8277
|
|
|
8298
|
-
|
|
8299
|
-
|
|
8278
|
+
// Set the validity and error message
|
|
8279
|
+
// This needs to allow for the initial validation to come through
|
|
8280
|
+
this.validity =
|
|
8281
|
+
invalidCounters[0].validity || // The first invalid counter's validity
|
|
8282
|
+
this.validity || // incoming validity from validation
|
|
8283
|
+
undefined; // fallback
|
|
8300
8284
|
|
|
8301
|
-
|
|
8285
|
+
// Always reflect the current invalid counters' messages, even when that
|
|
8286
|
+
// means clearing to undefined -- falling back to the previous
|
|
8287
|
+
// this.errorMessage here would let a stale message from a prior,
|
|
8288
|
+
// different invalid cause survive a transition into a cause with no
|
|
8289
|
+
// message of its own (e.g. customError -> rangeOverflow).
|
|
8290
|
+
this.errorMessage = joinedMessage || undefined;
|
|
8291
|
+
}
|
|
8302
8292
|
|
|
8303
|
-
|
|
8304
|
-
// This needs to allow for the initial validation to come through
|
|
8305
|
-
this.validity =
|
|
8306
|
-
invalidCounters[0].validity || // The first invalid counter's validity
|
|
8307
|
-
this.validity || // incoming validity from validation
|
|
8308
|
-
undefined; // fallback
|
|
8293
|
+
if (!isInvalid && this.validity !== 'valid') {
|
|
8309
8294
|
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8295
|
+
// If there are no invalid counters, reset validity and error message
|
|
8296
|
+
this.validity = 'valid';
|
|
8297
|
+
this.errorMessage = undefined;
|
|
8298
|
+
}
|
|
8299
|
+
}
|
|
8315
8300
|
|
|
8316
|
-
|
|
8301
|
+
/**
|
|
8302
|
+
* Updates the validity of the counter group based on the validity of its counters.
|
|
8303
|
+
* This method checks all counters within the group, determines if any are invalid, and updates the group's validity state and error message accordingly.
|
|
8304
|
+
* If any counter is invalid, it generates a combined error message from all invalid counters.
|
|
8305
|
+
* @returns {void}
|
|
8306
|
+
* @private
|
|
8307
|
+
*/
|
|
8308
|
+
updateValidity () {
|
|
8317
8309
|
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8310
|
+
// We don't need to do anything if there are no counters
|
|
8311
|
+
if (!this.counters) return;
|
|
8312
|
+
|
|
8313
|
+
// Wait for initial validation to complete before updating validity and error message
|
|
8314
|
+
// This is necessary because we need the initial validation to know when to reset the validity and error message
|
|
8315
|
+
setTimeout(() => this.computeValidityFromCounters());
|
|
8323
8316
|
}
|
|
8324
8317
|
|
|
8325
8318
|
/**
|
|
@@ -8487,6 +8480,40 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8487
8480
|
*/
|
|
8488
8481
|
validate(force = false) {
|
|
8489
8482
|
this.validation.validate(this, force);
|
|
8483
|
+
|
|
8484
|
+
// AuroFormValidation doesn't know how to derive validity from our object-valued
|
|
8485
|
+
// `value`, so it always resolves an otherwise-error-free group to 'valid' -- even
|
|
8486
|
+
// while a child counter is still invalid. Re-derive from the children's current
|
|
8487
|
+
// state immediately afterward so that invalid state survives forced validation,
|
|
8488
|
+
// and re-dispatch the validated event when the correction changes the outcome so
|
|
8489
|
+
// listeners like auro-form's submit path see the corrected result.
|
|
8490
|
+
//
|
|
8491
|
+
// This intentionally also runs for unforced calls (every child value change),
|
|
8492
|
+
// even though updateValidity()'s deferred, listener-driven aggregation computes
|
|
8493
|
+
// the same result a tick later: that deferred path only updates this.validity/
|
|
8494
|
+
// this.errorMessage, it never re-dispatches the event, so auro-form's formState
|
|
8495
|
+
// (and therefore the submit button's disabled state) would otherwise only ever
|
|
8496
|
+
// learn about a child-derived invalid state at the next forced validation --
|
|
8497
|
+
// not at initial load or on ordinary interaction. See docs/post-mortem/1642340.md,
|
|
8498
|
+
// "Iterations That Didn't Work", for the attempt to scope this to `force` and
|
|
8499
|
+
// why it broke that behavior.
|
|
8500
|
+
if (this.counters) {
|
|
8501
|
+
const previousValidity = this.validity;
|
|
8502
|
+
const previousMessage = this.errorMessage;
|
|
8503
|
+
|
|
8504
|
+
this.computeValidityFromCounters();
|
|
8505
|
+
|
|
8506
|
+
if (this.validity !== previousValidity || this.errorMessage !== previousMessage) {
|
|
8507
|
+
this.dispatchEvent(new CustomEvent('auroFormElement-validated', {
|
|
8508
|
+
bubbles: true,
|
|
8509
|
+
composed: true,
|
|
8510
|
+
detail: {
|
|
8511
|
+
validity: this.validity,
|
|
8512
|
+
message: this.errorMessage
|
|
8513
|
+
}
|
|
8514
|
+
}));
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8490
8517
|
}
|
|
8491
8518
|
|
|
8492
8519
|
/**
|
|
@@ -8581,7 +8608,7 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8581
8608
|
<div slot="helpText">
|
|
8582
8609
|
<${this.helpTextTag} error appearance="${this.onDark ? 'inverse' : this.appearance}">
|
|
8583
8610
|
<p id="${this.uniqueId}" part="helpText" role="alert" aria-live="assertive">
|
|
8584
|
-
${this.
|
|
8611
|
+
${this.errorMessage}
|
|
8585
8612
|
</p>
|
|
8586
8613
|
</${this.helpTextTag}>
|
|
8587
8614
|
</div>
|
|
@@ -1127,7 +1127,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$2 {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
|
-
var formkitVersion$1 = '
|
|
1130
|
+
var formkitVersion$1 = '202610051839';
|
|
1131
1131
|
|
|
1132
1132
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1133
1133
|
// See LICENSE in the project root for license information.
|
|
@@ -5487,7 +5487,7 @@ class AuroHelpText extends i$2 {
|
|
|
5487
5487
|
}
|
|
5488
5488
|
}
|
|
5489
5489
|
|
|
5490
|
-
var formkitVersion = '
|
|
5490
|
+
var formkitVersion = '202610051839';
|
|
5491
5491
|
|
|
5492
5492
|
/**
|
|
5493
5493
|
* AuroElement is the shared base class for layout-aware Auro form components.
|
|
@@ -7883,6 +7883,7 @@ const counterGroupKeyboardStrategy = {
|
|
|
7883
7883
|
* @csspart dropdown - The dropdown element rendered when `isDropdown` is true.
|
|
7884
7884
|
* @csspart helpText - The help text and error message container.
|
|
7885
7885
|
*
|
|
7886
|
+
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
7886
7887
|
* @event input - Notifies that the counter group's value has changed.
|
|
7887
7888
|
*/
|
|
7888
7889
|
class AuroCounterGroup extends AuroElement {
|
|
@@ -8004,14 +8005,6 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8004
8005
|
reflect: true
|
|
8005
8006
|
},
|
|
8006
8007
|
|
|
8007
|
-
/**
|
|
8008
|
-
* The current error message to display when the component is invalid.
|
|
8009
|
-
*/
|
|
8010
|
-
error: {
|
|
8011
|
-
type: String,
|
|
8012
|
-
reflect: false
|
|
8013
|
-
},
|
|
8014
|
-
|
|
8015
8008
|
/**
|
|
8016
8009
|
* The current error message to display when the component is invalid.
|
|
8017
8010
|
* This is set by validation and is not available to consumers.
|
|
@@ -8233,21 +8226,6 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8233
8226
|
this.updateValidity();
|
|
8234
8227
|
}
|
|
8235
8228
|
|
|
8236
|
-
/**
|
|
8237
|
-
* Renders help text error messages.
|
|
8238
|
-
* @param {Array<string>} messages - The error messages to render.
|
|
8239
|
-
* @returns {TemplateResult[]} - The rendered error messages rendered in a TemplateResult.
|
|
8240
|
-
* @private
|
|
8241
|
-
*/
|
|
8242
|
-
renderHelpTextErrors(messages) {
|
|
8243
|
-
|
|
8244
|
-
// Return empty template if no messages are provided
|
|
8245
|
-
if (!messages || messages.length === 0) return u$5``;
|
|
8246
|
-
|
|
8247
|
-
// Return messages as a TemplateResult
|
|
8248
|
-
return messages.map(message => u$5`<p>${message}</p>`);
|
|
8249
|
-
}
|
|
8250
|
-
|
|
8251
8229
|
/**
|
|
8252
8230
|
* Gets and returns an array of counters in an invalid state.
|
|
8253
8231
|
* @returns {Array<HTMLElement>} - Returns an array of invalid counters.
|
|
@@ -8271,55 +8249,70 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8271
8249
|
};
|
|
8272
8250
|
|
|
8273
8251
|
/**
|
|
8274
|
-
*
|
|
8275
|
-
*
|
|
8276
|
-
*
|
|
8252
|
+
* Synchronously recomputes this.validity/this.errorMessage from the current
|
|
8253
|
+
* validity of the child counters. Extracted from updateValidity() so that
|
|
8254
|
+
* validate() can re-apply this aggregation immediately after the shared
|
|
8255
|
+
* validation engine runs, instead of waiting on a deferred timer.
|
|
8277
8256
|
* @returns {void}
|
|
8278
8257
|
* @private
|
|
8279
8258
|
*/
|
|
8280
|
-
|
|
8259
|
+
computeValidityFromCounters() {
|
|
8281
8260
|
|
|
8282
8261
|
// We don't need to do anything if there are no counters
|
|
8283
8262
|
if (!this.counters) return;
|
|
8284
8263
|
|
|
8285
|
-
//
|
|
8286
|
-
|
|
8287
|
-
setTimeout(() => {
|
|
8264
|
+
// Get any invalid counters
|
|
8265
|
+
const invalidCounters = this.getInvalidCounters(this.counters);
|
|
8288
8266
|
|
|
8289
|
-
|
|
8290
|
-
|
|
8267
|
+
// Determine if we are in an invalid state based on the presence of invalid counters
|
|
8268
|
+
const isInvalid = invalidCounters.length > 0;
|
|
8291
8269
|
|
|
8292
|
-
|
|
8293
|
-
|
|
8270
|
+
// If we are in an invalid state
|
|
8271
|
+
if (isInvalid) {
|
|
8294
8272
|
|
|
8295
|
-
//
|
|
8296
|
-
|
|
8273
|
+
// Generate the error messages as plain text, joined with sentence-ending
|
|
8274
|
+
// punctuation so multiple messages don't run together into one clause.
|
|
8275
|
+
const errorMessages = this.getErrorMessages(invalidCounters);
|
|
8276
|
+
const joinedMessage = errorMessages.join('. ');
|
|
8297
8277
|
|
|
8298
|
-
|
|
8299
|
-
|
|
8278
|
+
// Set the validity and error message
|
|
8279
|
+
// This needs to allow for the initial validation to come through
|
|
8280
|
+
this.validity =
|
|
8281
|
+
invalidCounters[0].validity || // The first invalid counter's validity
|
|
8282
|
+
this.validity || // incoming validity from validation
|
|
8283
|
+
undefined; // fallback
|
|
8300
8284
|
|
|
8301
|
-
|
|
8285
|
+
// Always reflect the current invalid counters' messages, even when that
|
|
8286
|
+
// means clearing to undefined -- falling back to the previous
|
|
8287
|
+
// this.errorMessage here would let a stale message from a prior,
|
|
8288
|
+
// different invalid cause survive a transition into a cause with no
|
|
8289
|
+
// message of its own (e.g. customError -> rangeOverflow).
|
|
8290
|
+
this.errorMessage = joinedMessage || undefined;
|
|
8291
|
+
}
|
|
8302
8292
|
|
|
8303
|
-
|
|
8304
|
-
// This needs to allow for the initial validation to come through
|
|
8305
|
-
this.validity =
|
|
8306
|
-
invalidCounters[0].validity || // The first invalid counter's validity
|
|
8307
|
-
this.validity || // incoming validity from validation
|
|
8308
|
-
undefined; // fallback
|
|
8293
|
+
if (!isInvalid && this.validity !== 'valid') {
|
|
8309
8294
|
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8295
|
+
// If there are no invalid counters, reset validity and error message
|
|
8296
|
+
this.validity = 'valid';
|
|
8297
|
+
this.errorMessage = undefined;
|
|
8298
|
+
}
|
|
8299
|
+
}
|
|
8315
8300
|
|
|
8316
|
-
|
|
8301
|
+
/**
|
|
8302
|
+
* Updates the validity of the counter group based on the validity of its counters.
|
|
8303
|
+
* This method checks all counters within the group, determines if any are invalid, and updates the group's validity state and error message accordingly.
|
|
8304
|
+
* If any counter is invalid, it generates a combined error message from all invalid counters.
|
|
8305
|
+
* @returns {void}
|
|
8306
|
+
* @private
|
|
8307
|
+
*/
|
|
8308
|
+
updateValidity () {
|
|
8317
8309
|
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8310
|
+
// We don't need to do anything if there are no counters
|
|
8311
|
+
if (!this.counters) return;
|
|
8312
|
+
|
|
8313
|
+
// Wait for initial validation to complete before updating validity and error message
|
|
8314
|
+
// This is necessary because we need the initial validation to know when to reset the validity and error message
|
|
8315
|
+
setTimeout(() => this.computeValidityFromCounters());
|
|
8323
8316
|
}
|
|
8324
8317
|
|
|
8325
8318
|
/**
|
|
@@ -8487,6 +8480,40 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8487
8480
|
*/
|
|
8488
8481
|
validate(force = false) {
|
|
8489
8482
|
this.validation.validate(this, force);
|
|
8483
|
+
|
|
8484
|
+
// AuroFormValidation doesn't know how to derive validity from our object-valued
|
|
8485
|
+
// `value`, so it always resolves an otherwise-error-free group to 'valid' -- even
|
|
8486
|
+
// while a child counter is still invalid. Re-derive from the children's current
|
|
8487
|
+
// state immediately afterward so that invalid state survives forced validation,
|
|
8488
|
+
// and re-dispatch the validated event when the correction changes the outcome so
|
|
8489
|
+
// listeners like auro-form's submit path see the corrected result.
|
|
8490
|
+
//
|
|
8491
|
+
// This intentionally also runs for unforced calls (every child value change),
|
|
8492
|
+
// even though updateValidity()'s deferred, listener-driven aggregation computes
|
|
8493
|
+
// the same result a tick later: that deferred path only updates this.validity/
|
|
8494
|
+
// this.errorMessage, it never re-dispatches the event, so auro-form's formState
|
|
8495
|
+
// (and therefore the submit button's disabled state) would otherwise only ever
|
|
8496
|
+
// learn about a child-derived invalid state at the next forced validation --
|
|
8497
|
+
// not at initial load or on ordinary interaction. See docs/post-mortem/1642340.md,
|
|
8498
|
+
// "Iterations That Didn't Work", for the attempt to scope this to `force` and
|
|
8499
|
+
// why it broke that behavior.
|
|
8500
|
+
if (this.counters) {
|
|
8501
|
+
const previousValidity = this.validity;
|
|
8502
|
+
const previousMessage = this.errorMessage;
|
|
8503
|
+
|
|
8504
|
+
this.computeValidityFromCounters();
|
|
8505
|
+
|
|
8506
|
+
if (this.validity !== previousValidity || this.errorMessage !== previousMessage) {
|
|
8507
|
+
this.dispatchEvent(new CustomEvent('auroFormElement-validated', {
|
|
8508
|
+
bubbles: true,
|
|
8509
|
+
composed: true,
|
|
8510
|
+
detail: {
|
|
8511
|
+
validity: this.validity,
|
|
8512
|
+
message: this.errorMessage
|
|
8513
|
+
}
|
|
8514
|
+
}));
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8490
8517
|
}
|
|
8491
8518
|
|
|
8492
8519
|
/**
|
|
@@ -8581,7 +8608,7 @@ class AuroCounterGroup extends AuroElement {
|
|
|
8581
8608
|
<div slot="helpText">
|
|
8582
8609
|
<${this.helpTextTag} error appearance="${this.onDark ? 'inverse' : this.appearance}">
|
|
8583
8610
|
<p id="${this.uniqueId}" part="helpText" role="alert" aria-live="assertive">
|
|
8584
|
-
${this.
|
|
8611
|
+
${this.errorMessage}
|
|
8585
8612
|
</p>
|
|
8586
8613
|
</${this.helpTextTag}>
|
|
8587
8614
|
</div>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @csspart dropdown - The dropdown element rendered when `isDropdown` is true.
|
|
14
14
|
* @csspart helpText - The help text and error message container.
|
|
15
15
|
*
|
|
16
|
+
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
16
17
|
* @event input - Notifies that the counter group's value has changed.
|
|
17
18
|
*/
|
|
18
19
|
export class AuroCounterGroup extends AuroElement {
|
|
@@ -33,13 +34,6 @@ export class AuroCounterGroup extends AuroElement {
|
|
|
33
34
|
attribute: string;
|
|
34
35
|
reflect: boolean;
|
|
35
36
|
};
|
|
36
|
-
/**
|
|
37
|
-
* The current error message to display when the component is invalid.
|
|
38
|
-
*/
|
|
39
|
-
error: {
|
|
40
|
-
type: StringConstructor;
|
|
41
|
-
reflect: boolean;
|
|
42
|
-
};
|
|
43
37
|
/**
|
|
44
38
|
* The current error message to display when the component is invalid.
|
|
45
39
|
* This is set by validation and is not available to consumers.
|
|
@@ -277,13 +271,6 @@ export class AuroCounterGroup extends AuroElement {
|
|
|
277
271
|
* @private
|
|
278
272
|
*/
|
|
279
273
|
private configureCounters;
|
|
280
|
-
/**
|
|
281
|
-
* Renders help text error messages.
|
|
282
|
-
* @param {Array<string>} messages - The error messages to render.
|
|
283
|
-
* @returns {TemplateResult[]} - The rendered error messages rendered in a TemplateResult.
|
|
284
|
-
* @private
|
|
285
|
-
*/
|
|
286
|
-
private renderHelpTextErrors;
|
|
287
274
|
/**
|
|
288
275
|
* Gets and returns an array of counters in an invalid state.
|
|
289
276
|
* @returns {Array<HTMLElement>} - Returns an array of invalid counters.
|
|
@@ -298,7 +285,16 @@ export class AuroCounterGroup extends AuroElement {
|
|
|
298
285
|
* @private
|
|
299
286
|
*/
|
|
300
287
|
private getErrorMessages;
|
|
301
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Synchronously recomputes this.validity/this.errorMessage from the current
|
|
290
|
+
* validity of the child counters. Extracted from updateValidity() so that
|
|
291
|
+
* validate() can re-apply this aggregation immediately after the shared
|
|
292
|
+
* validation engine runs, instead of waiting on a deferred timer.
|
|
293
|
+
* @returns {void}
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
private computeValidityFromCounters;
|
|
297
|
+
errorMessage: string | undefined;
|
|
302
298
|
/**
|
|
303
299
|
* Hides the dropdown bib if its open.
|
|
304
300
|
* @returns {void}
|