@aurodesignsystem/auro-formkit 3.0.1 → 3.1.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 (59) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components/checkbox/README.md +1 -1
  3. package/components/checkbox/demo/api.min.js +468 -25
  4. package/components/checkbox/demo/index.min.js +468 -25
  5. package/components/checkbox/demo/readme.md +1 -1
  6. package/components/checkbox/dist/index.js +468 -25
  7. package/components/checkbox/dist/registered.js +468 -25
  8. package/components/combobox/README.md +1 -1
  9. package/components/combobox/demo/api.min.js +1125 -74
  10. package/components/combobox/demo/index.min.js +1125 -74
  11. package/components/combobox/demo/readme.md +1 -1
  12. package/components/combobox/dist/auro-combobox.d.ts +30 -0
  13. package/components/combobox/dist/index.js +1125 -74
  14. package/components/combobox/dist/registered.js +1125 -74
  15. package/components/counter/README.md +1 -1
  16. package/components/counter/demo/api.min.js +570 -45
  17. package/components/counter/demo/index.min.js +570 -45
  18. package/components/counter/demo/readme.md +1 -1
  19. package/components/counter/dist/index.js +570 -45
  20. package/components/counter/dist/registered.js +570 -45
  21. package/components/datepicker/README.md +1 -1
  22. package/components/datepicker/demo/api.min.js +1073 -70
  23. package/components/datepicker/demo/index.min.js +1073 -70
  24. package/components/datepicker/demo/readme.md +1 -1
  25. package/components/datepicker/dist/index.js +1073 -70
  26. package/components/datepicker/dist/registered.js +1073 -70
  27. package/components/dropdown/README.md +1 -1
  28. package/components/dropdown/demo/api.md +8 -5
  29. package/components/dropdown/demo/api.min.js +104 -22
  30. package/components/dropdown/demo/index.min.js +104 -22
  31. package/components/dropdown/demo/readme.md +1 -1
  32. package/components/dropdown/dist/auro-dropdown.d.ts +29 -0
  33. package/components/dropdown/dist/index.js +104 -22
  34. package/components/dropdown/dist/registered.js +104 -22
  35. package/components/form/README.md +1 -1
  36. package/components/form/demo/readme.md +1 -1
  37. package/components/input/README.md +1 -1
  38. package/components/input/demo/api.md +4 -1
  39. package/components/input/demo/api.min.js +503 -25
  40. package/components/input/demo/index.min.js +503 -25
  41. package/components/input/demo/readme.md +1 -1
  42. package/components/input/dist/base-input.d.ts +24 -0
  43. package/components/input/dist/index.js +503 -25
  44. package/components/input/dist/registered.js +503 -25
  45. package/components/menu/README.md +1 -1
  46. package/components/menu/demo/readme.md +1 -1
  47. package/components/radio/README.md +1 -1
  48. package/components/radio/demo/api.min.js +468 -25
  49. package/components/radio/demo/index.min.js +468 -25
  50. package/components/radio/demo/readme.md +1 -1
  51. package/components/radio/dist/index.js +468 -25
  52. package/components/radio/dist/registered.js +468 -25
  53. package/components/select/README.md +1 -1
  54. package/components/select/demo/api.min.js +570 -45
  55. package/components/select/demo/index.min.js +570 -45
  56. package/components/select/demo/readme.md +1 -1
  57. package/components/select/dist/index.js +570 -45
  58. package/components/select/dist/registered.js +570 -45
  59. package/package.json +2 -2
@@ -4049,6 +4049,414 @@ class AuroInputUtilities {
4049
4049
  }
4050
4050
  }
4051
4051
 
4052
+ class DateFormatter {
4053
+
4054
+ constructor() {
4055
+
4056
+ /**
4057
+ * @description Parses a date string into its components.
4058
+ * @param {string} dateStr - Date string to parse.
4059
+ * @param {string} format - Date format to parse.
4060
+ * @returns {Object<key["month" | "day" | "year"]: number>|undefined}
4061
+ */
4062
+ this.parseDate = (dateStr, format = 'mm/dd/yyyy') => {
4063
+
4064
+ // Guard Clause: Date string is defined
4065
+ if (!dateStr) {
4066
+ return undefined;
4067
+ }
4068
+
4069
+ // Assume the separator is a "/" a defined in our code base
4070
+ const separator = '/';
4071
+
4072
+ // Get the parts of the date and format
4073
+ const valueParts = dateStr.split(separator);
4074
+ const formatParts = format.split(separator);
4075
+
4076
+ // Check if the value and format have the correct number of parts
4077
+ if (valueParts.length !== formatParts.length) {
4078
+ throw new Error('AuroDatepickerUtilities | parseDate: Date string and format length do not match');
4079
+ }
4080
+
4081
+ // Holds the result to be returned
4082
+ const result = formatParts.reduce((acc, part, index) => {
4083
+ const value = valueParts[index];
4084
+
4085
+ if ((/m/iu).test(part)) {
4086
+ acc.month = value;
4087
+ } else if ((/d/iu).test(part)) {
4088
+ acc.day = value;
4089
+ } else if ((/y/iu).test(part)) {
4090
+ acc.year = value;
4091
+ }
4092
+
4093
+ return acc;
4094
+ }, {});
4095
+
4096
+ // If we found all the parts, return the result
4097
+ if (result.month && result.year) {
4098
+ return result;
4099
+ }
4100
+
4101
+ // Throw an error to let the dev know we were unable to parse the date string
4102
+ throw new Error('AuroDatepickerUtilities | parseDate: Unable to parse date string');
4103
+ };
4104
+
4105
+ /**
4106
+ * Convert a date object to string format.
4107
+ * @param {Object} date - Date to convert to string.
4108
+ * @returns {Object} Returns the date as a string.
4109
+ */
4110
+ this.getDateAsString = (date) => date.toLocaleDateString(undefined, {
4111
+ year: "numeric",
4112
+ month: "2-digit",
4113
+ day: "2-digit",
4114
+ });
4115
+
4116
+ /**
4117
+ * Converts a date string to a North American date format.
4118
+ * @param {String} dateStr - Date to validate.
4119
+ * @param {String} format - Date format to validate against.
4120
+ * @returns {Boolean}
4121
+ */
4122
+ this.toNorthAmericanFormat = (dateStr, format) => {
4123
+
4124
+ if (format === 'mm/dd/yyyy') {
4125
+ return dateStr;
4126
+ }
4127
+
4128
+ const parsedDate = this.parseDate(dateStr, format);
4129
+
4130
+ if (!parsedDate) {
4131
+ throw new Error('AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string');
4132
+ }
4133
+
4134
+ const { month, day, year } = parsedDate;
4135
+
4136
+ const dateParts = [];
4137
+ if (month) {
4138
+ dateParts.push(month);
4139
+ }
4140
+
4141
+ if (day) {
4142
+ dateParts.push(day);
4143
+ }
4144
+
4145
+ if (year) {
4146
+ dateParts.push(year);
4147
+ }
4148
+
4149
+ return dateParts.join('/');
4150
+ };
4151
+ }
4152
+ }
4153
+ const dateFormatter = new DateFormatter();
4154
+
4155
+ // filepath: dateConstraints.mjs
4156
+ const DATE_UTIL_CONSTRAINTS = {
4157
+ maxDay: 31,
4158
+ maxMonth: 12,
4159
+ maxYear: 2400,
4160
+ minDay: 1,
4161
+ minMonth: 1,
4162
+ minYear: 1900,
4163
+ };
4164
+
4165
+ class AuroDateUtilitiesBase {
4166
+
4167
+ /**
4168
+ * @description The maximum day value allowed by the various utilities in this class.
4169
+ * @readonly
4170
+ * @type {Number}
4171
+ */
4172
+ get maxDay() {
4173
+ return DATE_UTIL_CONSTRAINTS.maxDay;
4174
+ }
4175
+
4176
+ /**
4177
+ * @description The maximum month value allowed by the various utilities in this class.
4178
+ * @readonly
4179
+ * @type {Number}
4180
+ */
4181
+ get maxMonth() {
4182
+ return DATE_UTIL_CONSTRAINTS.maxMonth;
4183
+ }
4184
+
4185
+ /**
4186
+ * @description The maximum year value allowed by the various utilities in this class.
4187
+ * @readonly
4188
+ * @type {Number}
4189
+ */
4190
+ get maxYear() {
4191
+ return DATE_UTIL_CONSTRAINTS.maxYear;
4192
+ }
4193
+
4194
+ /**
4195
+ * @description The minimum day value allowed by the various utilities in this class.
4196
+ * @readonly
4197
+ * @type {Number}
4198
+ */
4199
+ get minDay() {
4200
+ return DATE_UTIL_CONSTRAINTS.minDay;
4201
+ }
4202
+
4203
+ /**
4204
+ * @description The minimum month value allowed by the various utilities in this class.
4205
+ * @readonly
4206
+ * @type {Number}
4207
+ */
4208
+ get minMonth() {
4209
+ return DATE_UTIL_CONSTRAINTS.minMonth;
4210
+ }
4211
+
4212
+ /**
4213
+ * @description The minimum year value allowed by the various utilities in this class.
4214
+ * @readonly
4215
+ * @type {Number}
4216
+ */
4217
+ get minYear() {
4218
+ return DATE_UTIL_CONSTRAINTS.minYear;
4219
+ }
4220
+ }
4221
+
4222
+ /* eslint-disable no-magic-numbers */
4223
+
4224
+ class AuroDateUtilities extends AuroDateUtilitiesBase {
4225
+
4226
+ /**
4227
+ * Returns the current century.
4228
+ * @returns {String} The current century.
4229
+ */
4230
+ getCentury () {
4231
+ return String(new Date().getFullYear()).slice(0, 2);
4232
+ }
4233
+
4234
+ /**
4235
+ * Returns a four digit year.
4236
+ * @param {String} year - The year to convert to four digits.
4237
+ * @returns {String} The four digit year.
4238
+ */
4239
+ getFourDigitYear (year) {
4240
+
4241
+ const strYear = String(year).trim();
4242
+ return strYear.length <= 2 ? this.getCentury() + strYear : strYear;
4243
+ }
4244
+
4245
+ constructor() {
4246
+
4247
+ super();
4248
+
4249
+ /**
4250
+ * Compares two dates to see if they match.
4251
+ * @param {Object} date1 - First date to compare.
4252
+ * @param {Object} date2 - Second date to compare.
4253
+ * @returns {Boolean} Returns true if the dates match.
4254
+ */
4255
+ this.datesMatch = (date1, date2) => new Date(date1).getTime() === new Date(date2).getTime();
4256
+
4257
+ /**
4258
+ * Returns true if value passed in is a valid date.
4259
+ * @param {String} date - Date to validate.
4260
+ * @param {String} format - Date format to validate against.
4261
+ * @returns {Boolean}
4262
+ */
4263
+ this.validDateStr = (date, format) => {
4264
+
4265
+ // The length we expect the date string to be
4266
+ const dateStrLength = format.length;
4267
+
4268
+ // Guard Clause: Date and format are defined
4269
+ if (typeof date === "undefined" || typeof format === "undefined") {
4270
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date and format are required');
4271
+ }
4272
+
4273
+ // Guard Clause: Date should be of type string
4274
+ if (typeof date !== "string") {
4275
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date must be a string');
4276
+ }
4277
+
4278
+ // Guard Clause: Format should be of type string
4279
+ if (typeof format !== "string") {
4280
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Format must be a string');
4281
+ }
4282
+
4283
+ // Guard Clause: Length is what we expect it to be
4284
+ if (date.length !== dateStrLength) {
4285
+ return false;
4286
+ }
4287
+ // Get a formatted date string and parse it
4288
+ const dateParts = dateFormatter.parseDate(date, format);
4289
+
4290
+ // Guard Clause: Date parse succeeded
4291
+ if (!dateParts) {
4292
+ return false;
4293
+ }
4294
+
4295
+ // Create the expected date string based on the date parts
4296
+ const expectedDateStr = `${dateParts.month}/${dateParts.day || "01"}/${this.getFourDigitYear(dateParts.year)}`;
4297
+
4298
+ // Generate a date object that we will extract a string date from to compare to the passed in date string
4299
+ const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
4300
+
4301
+ // Get the date string of the date object we created from the string date
4302
+ const actualDateStr = dateFormatter.getDateAsString(dateObj);
4303
+
4304
+ // Guard Clause: Generated date matches date string input
4305
+ if (expectedDateStr !== actualDateStr) {
4306
+ return false;
4307
+ }
4308
+
4309
+ // If we passed all other checks, we can assume the date is valid
4310
+ return true;
4311
+ };
4312
+
4313
+ /**
4314
+ * Determines if a string date value matches the format provided.
4315
+ * @param {string} value = The date string value.
4316
+ * @param { string} format = The date format to match against.
4317
+ * @returns {boolean}
4318
+ */
4319
+ this.dateAndFormatMatch = (value, format) => {
4320
+
4321
+ // Ensure we have both values we need to do the comparison
4322
+ if (!value || !format) {
4323
+ throw new Error('AuroFormValidation | dateFormatMatch: value and format are required');
4324
+ }
4325
+
4326
+ // If the lengths are different, they cannot match
4327
+ if (value.length !== format.length) {
4328
+ return false;
4329
+ }
4330
+
4331
+ // Get the parts of the date
4332
+ const dateParts = dateFormatter.parseDate(value, format);
4333
+
4334
+ // Validator for day
4335
+ const dayValueIsValid = (day) => {
4336
+
4337
+ // Guard clause: if there is no day in the dateParts, we can ignore this check.
4338
+ if (!dateParts.day) {
4339
+ return true;
4340
+ }
4341
+
4342
+ // Guard clause: ensure day exists.
4343
+ if (!day) {
4344
+ return false;
4345
+ }
4346
+
4347
+ // Convert day to number
4348
+ const numDay = Number.parseInt(day, 10);
4349
+
4350
+ // Guard clause: ensure day is a valid integer
4351
+ if (Number.isNaN(numDay)) {
4352
+ throw new Error('AuroDatepickerUtilities | dayValueIsValid: Unable to parse day value integer');
4353
+ }
4354
+
4355
+ // Guard clause: ensure day is within the valid range
4356
+ if (numDay < this.minDay || numDay > this.maxDay) {
4357
+ return false;
4358
+ }
4359
+
4360
+ // Default return
4361
+ return true;
4362
+ };
4363
+
4364
+ // Validator for month
4365
+ const monthValueIsValid = (month) => {
4366
+
4367
+ // Guard clause: ensure month exists.
4368
+ if (!month) {
4369
+ return false;
4370
+ }
4371
+
4372
+ // Convert month to number
4373
+ const numMonth = Number.parseInt(month, 10);
4374
+
4375
+ // Guard clause: ensure month is a valid integer
4376
+ if (Number.isNaN(numMonth)) {
4377
+ throw new Error('AuroDatepickerUtilities | monthValueIsValid: Unable to parse month value integer');
4378
+ }
4379
+
4380
+ // Guard clause: ensure month is within the valid range
4381
+ if (numMonth < this.minMonth || numMonth > this.maxMonth) {
4382
+ return false;
4383
+ }
4384
+
4385
+ // Default return
4386
+ return true;
4387
+ };
4388
+
4389
+ // Validator for year
4390
+ const yearIsValid = (_year) => {
4391
+
4392
+ // Guard clause: ensure year exists.
4393
+ if (!_year) {
4394
+ return false;
4395
+ }
4396
+
4397
+ // Get the full year
4398
+ const year = this.getFourDigitYear(_year);
4399
+
4400
+ // Convert year to number
4401
+ const numYear = Number.parseInt(year, 10);
4402
+
4403
+ // Guard clause: ensure year is a valid integer
4404
+ if (Number.isNaN(numYear)) {
4405
+ throw new Error('AuroDatepickerUtilities | yearValueIsValid: Unable to parse year value integer');
4406
+ }
4407
+
4408
+ // Guard clause: ensure year is within the valid range
4409
+ if (numYear < this.minYear || numYear > this.maxYear) {
4410
+ return false;
4411
+ }
4412
+
4413
+ // Default return
4414
+ return true;
4415
+ };
4416
+
4417
+ // Self-contained checks for month, day, and year
4418
+ const checks = [
4419
+ monthValueIsValid(dateParts.month),
4420
+ dayValueIsValid(dateParts.day),
4421
+ yearIsValid(dateParts.year)
4422
+ ];
4423
+
4424
+ // If any of the checks failed, the date format does not match and the result is invalid
4425
+ const isValid = checks.every((check) => check === true);
4426
+
4427
+ // If the check is invalid, return false
4428
+ if (!isValid) {
4429
+ return false;
4430
+ }
4431
+
4432
+ // Default case
4433
+ return true;
4434
+ };
4435
+ }
4436
+ }
4437
+
4438
+ // Export a class instance
4439
+ const dateUtilities = new AuroDateUtilities();
4440
+
4441
+ // Export the class instance methods individually
4442
+ const {
4443
+ datesMatch,
4444
+ validDateStr,
4445
+ dateAndFormatMatch,
4446
+ minDay,
4447
+ minMonth,
4448
+ minYear,
4449
+ maxDay,
4450
+ maxMonth,
4451
+ maxYear
4452
+ } = dateUtilities;
4453
+
4454
+ const {
4455
+ toNorthAmericanFormat,
4456
+ parseDate,
4457
+ getDateAsString
4458
+ } = dateFormatter;
4459
+
4052
4460
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
4053
4461
  // See LICENSE in the project root for license information.
4054
4462
 
@@ -4124,6 +4532,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
4124
4532
 
4125
4533
 
4126
4534
  class AuroFormValidation {
4535
+
4127
4536
  constructor() {
4128
4537
  this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
4129
4538
  }
@@ -4215,17 +4624,17 @@ class AuroFormValidation {
4215
4624
  ]
4216
4625
  }
4217
4626
  };
4218
-
4627
+
4219
4628
  let elementType;
4220
4629
  if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
4221
4630
  elementType = 'input';
4222
4631
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
4223
4632
  elementType = 'counter';
4224
4633
  }
4225
-
4634
+
4226
4635
  if (elementType) {
4227
4636
  const rules = validationRules[elementType];
4228
-
4637
+
4229
4638
  if (rules) {
4230
4639
  Object.values(rules).flat().forEach(rule => {
4231
4640
  if (rule.check(elem)) {
@@ -4251,48 +4660,82 @@ class AuroFormValidation {
4251
4660
  if (!elem.value.match(emailRegex)) {
4252
4661
  elem.validity = 'patternMismatch';
4253
4662
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4663
+ return;
4254
4664
  }
4255
4665
  } else if (elem.type === 'credit-card') {
4256
4666
  if (elem.value.length > 0 && elem.value.length < elem.validationCCLength) {
4257
4667
  elem.validity = 'tooShort';
4258
4668
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4669
+ return;
4259
4670
  }
4260
4671
  } else if (elem.type === 'number') {
4261
4672
  if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
4262
4673
  elem.validity = 'rangeOverflow';
4263
4674
  elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4675
+ return;
4264
4676
  }
4265
4677
 
4266
4678
  if (elem.min !== undefined && elem.value?.length > 0 && Number(elem.min) > Number(elem.value)) {
4267
4679
  elem.validity = 'rangeUnderflow';
4268
4680
  elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4681
+ return;
4269
4682
  }
4270
- } else if (elem.type === 'date') {
4271
- if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
4683
+ } else if (elem.type === 'date' && elem.value?.length > 0) {
4684
+
4685
+ // Guard Clause: if the value is too short
4686
+ if (elem.value.length < elem.lengthForType) {
4687
+
4272
4688
  elem.validity = 'tooShort';
4273
4689
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4274
- } else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
4275
- const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
4276
- const valueDate = new Date(formattedValue.dateForComparison);
4690
+ return;
4691
+ }
4692
+
4693
+ // Guard Clause: If the value is too long for the type
4694
+ if (elem.value?.length > elem.lengthForType) {
4277
4695
 
4278
- // validate max
4279
- if (elem.max?.length === elem.lengthForType) {
4280
- const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
4696
+ elem.validity = 'tooLong';
4697
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4698
+ return;
4699
+ }
4700
+
4701
+ // Validate that the date passed was the correct format
4702
+ if (!dateAndFormatMatch(elem.value, elem.format)) {
4703
+ elem.validity = 'patternMismatch';
4704
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || 'Invalid Date Format Entered';
4705
+ return;
4706
+ }
4707
+
4708
+ // Validate that the date passed was a valid date
4709
+ if (!validDateStr(elem.value, elem.format)) {
4710
+ elem.validity = 'invalidDate';
4711
+ elem.errorMessage = elem.setCustomValidityInvalidDate || elem.setCustomValidity || 'Invalid Date Entered';
4712
+ return;
4713
+ }
4281
4714
 
4282
- if (valueDate > maxDate) {
4283
- elem.validity = 'rangeOverflow';
4284
- elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4285
- }
4715
+ // Perform the rest of the validation
4716
+ const formattedValue = toNorthAmericanFormat(elem.value, elem.format);
4717
+ const valueDate = new Date(formattedValue);
4718
+
4719
+ // // Validate max date
4720
+ if (elem.max?.length === elem.lengthForType) {
4721
+
4722
+ const maxDate = new Date(toNorthAmericanFormat(elem.max, elem.format));
4723
+
4724
+ if (valueDate > maxDate) {
4725
+ elem.validity = 'rangeOverflow';
4726
+ elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4727
+ return;
4286
4728
  }
4729
+ }
4287
4730
 
4288
- // validate min
4289
- if (elem.min?.length === elem.lengthForType) {
4290
- const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
4731
+ // Validate min date
4732
+ if (elem.min?.length === elem.lengthForType) {
4733
+ const minDate = new Date(toNorthAmericanFormat(elem.min, elem.format));
4291
4734
 
4292
- if (valueDate < minDate) {
4293
- elem.validity = 'rangeUnderflow';
4294
- elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4295
- }
4735
+ if (valueDate < minDate) {
4736
+ elem.validity = 'rangeUnderflow';
4737
+ elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4738
+ return;
4296
4739
  }
4297
4740
  }
4298
4741
  }
@@ -4411,7 +4854,7 @@ class AuroFormValidation {
4411
4854
  if (input.validationMessage.length > 0) {
4412
4855
  elem.errorMessage = input.validationMessage;
4413
4856
  }
4414
- } else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
4857
+ } else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
4415
4858
  const firstInput = this.inputElements[0];
4416
4859
 
4417
4860
  if (firstInput.validationMessage.length > 0) {
@@ -4533,6 +4976,33 @@ class BaseInput extends r {
4533
4976
  static get properties() {
4534
4977
  return {
4535
4978
 
4979
+ /**
4980
+ * The value for the role attribute.
4981
+ */
4982
+ a11yRole: {
4983
+ type: String,
4984
+ attribute: true,
4985
+ reflect: true
4986
+ },
4987
+
4988
+ /**
4989
+ * The value for the aria-expanded attribute.
4990
+ */
4991
+ a11yExpanded: {
4992
+ type: Boolean,
4993
+ attribute: true,
4994
+ reflect: true
4995
+ },
4996
+
4997
+ /**
4998
+ * The value for the aria-controls attribute.
4999
+ */
5000
+ a11yControls: {
5001
+ type: String,
5002
+ attribute: true,
5003
+ reflect: true
5004
+ },
5005
+
4536
5006
  /**
4537
5007
  * If set, the label will remain fixed in the active position.
4538
5008
  */
@@ -5174,6 +5644,10 @@ class BaseInput extends r {
5174
5644
  } else if (this.type === 'number') {
5175
5645
  this.inputMode = 'numeric';
5176
5646
  }
5647
+
5648
+ if (this.type === "date" && !this.format) {
5649
+ this.format = 'mm/dd/yyyy';
5650
+ }
5177
5651
  }
5178
5652
 
5179
5653
  /**
@@ -6417,6 +6891,7 @@ var helpTextVersion = '1.0.0';
6417
6891
 
6418
6892
  // build the component class
6419
6893
  class AuroInput extends BaseInput {
6894
+
6420
6895
  constructor() {
6421
6896
  super();
6422
6897
 
@@ -6529,7 +7004,7 @@ class AuroInput extends BaseInput {
6529
7004
  ?required="${this.required}"
6530
7005
  ?disabled="${this.disabled}"
6531
7006
  aria-describedby="${this.uniqueId}"
6532
- aria-invalid="${this.validity !== 'valid'}"
7007
+ ?aria-invalid="${this.validity !== 'valid'}"
6533
7008
  placeholder=${this.getPlaceholder()}
6534
7009
  lang="${o$2(this.lang)}"
6535
7010
  ?activeLabel="${this.activeLabel}"
@@ -6538,7 +7013,10 @@ class AuroInput extends BaseInput {
6538
7013
  autocapitalize="${o$2(this.autocapitalize ? this.autocapitalize : undefined)}"
6539
7014
  autocomplete="${o$2(this.autocomplete ? this.autocomplete : undefined)}"
6540
7015
  part="input"
6541
- />
7016
+ role="${o$2(this.a11yRole)}"
7017
+ aria-expanded="${o$2(this.a11yExpanded)}"
7018
+ aria-controls="${o$2(this.a11yControls)}"
7019
+ />
6542
7020
  </div>
6543
7021
  <div
6544
7022
  class="notificationIcons"
@@ -99,7 +99,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
99
99
  In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
100
100
 
101
101
  ```html
102
- <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.0.0/auro-input/+esm"></script>
102
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.0.1/auro-input/+esm"></script>
103
103
  ```
104
104
  <!-- AURO-GENERATED-CONTENT:END -->
105
105
 
@@ -17,6 +17,30 @@
17
17
  */
18
18
  export default class BaseInput extends LitElement {
19
19
  static get properties(): {
20
+ /**
21
+ * The value for the role attribute.
22
+ */
23
+ a11yRole: {
24
+ type: StringConstructor;
25
+ attribute: boolean;
26
+ reflect: boolean;
27
+ };
28
+ /**
29
+ * The value for the aria-expanded attribute.
30
+ */
31
+ a11yExpanded: {
32
+ type: BooleanConstructor;
33
+ attribute: boolean;
34
+ reflect: boolean;
35
+ };
36
+ /**
37
+ * The value for the aria-controls attribute.
38
+ */
39
+ a11yControls: {
40
+ type: StringConstructor;
41
+ attribute: boolean;
42
+ reflect: boolean;
43
+ };
20
44
  /**
21
45
  * If set, the label will remain fixed in the active position.
22
46
  */