@aurodesignsystem/auro-formkit 3.1.0-beta.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 (49) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/components/checkbox/demo/api.min.js +468 -25
  3. package/components/checkbox/demo/index.min.js +468 -25
  4. package/components/checkbox/dist/index.js +468 -25
  5. package/components/checkbox/dist/registered.js +468 -25
  6. package/components/combobox/demo/api.md +1 -1
  7. package/components/combobox/demo/api.min.js +1265 -235
  8. package/components/combobox/demo/index.min.js +1265 -235
  9. package/components/combobox/dist/auro-combobox.d.ts +32 -5
  10. package/components/combobox/dist/index.js +1130 -100
  11. package/components/combobox/dist/registered.js +1130 -100
  12. package/components/counter/demo/api.md +1 -1
  13. package/components/counter/demo/api.min.js +575 -71
  14. package/components/counter/demo/index.min.js +575 -71
  15. package/components/counter/dist/auro-counter-group.d.ts +2 -5
  16. package/components/counter/dist/index.js +575 -71
  17. package/components/counter/dist/registered.js +575 -71
  18. package/components/datepicker/demo/api.md +0 -1
  19. package/components/datepicker/demo/api.min.js +1077 -106
  20. package/components/datepicker/demo/index.min.js +1077 -106
  21. package/components/datepicker/dist/auro-datepicker.d.ts +0 -13
  22. package/components/datepicker/dist/index.js +1077 -106
  23. package/components/datepicker/dist/registered.js +1077 -106
  24. package/components/dropdown/demo/api.md +9 -6
  25. package/components/dropdown/demo/api.min.js +107 -43
  26. package/components/dropdown/demo/index.md +0 -83
  27. package/components/dropdown/demo/index.min.js +107 -43
  28. package/components/dropdown/dist/auro-dropdown.d.ts +30 -12
  29. package/components/dropdown/dist/index.js +107 -43
  30. package/components/dropdown/dist/registered.js +107 -43
  31. package/components/input/demo/api.md +4 -1
  32. package/components/input/demo/api.min.js +503 -25
  33. package/components/input/demo/index.min.js +503 -25
  34. package/components/input/dist/base-input.d.ts +24 -0
  35. package/components/input/dist/index.js +503 -25
  36. package/components/input/dist/registered.js +503 -25
  37. package/components/radio/demo/api.min.js +468 -25
  38. package/components/radio/demo/index.min.js +468 -25
  39. package/components/radio/dist/index.js +468 -25
  40. package/components/radio/dist/registered.js +468 -25
  41. package/components/select/demo/api.md +1 -1
  42. package/components/select/demo/api.min.js +575 -71
  43. package/components/select/demo/index.md +1 -46
  44. package/components/select/demo/index.min.js +575 -71
  45. package/components/select/dist/auro-select.d.ts +2 -5
  46. package/components/select/dist/index.js +575 -71
  47. package/components/select/dist/registered.js +575 -71
  48. package/package.json +2 -2
  49. package/components/form/demo/autocomplete.html +0 -15
@@ -4124,6 +4124,414 @@ class AuroInputUtilities {
4124
4124
  }
4125
4125
  }
4126
4126
 
4127
+ class DateFormatter {
4128
+
4129
+ constructor() {
4130
+
4131
+ /**
4132
+ * @description Parses a date string into its components.
4133
+ * @param {string} dateStr - Date string to parse.
4134
+ * @param {string} format - Date format to parse.
4135
+ * @returns {Object<key["month" | "day" | "year"]: number>|undefined}
4136
+ */
4137
+ this.parseDate = (dateStr, format = 'mm/dd/yyyy') => {
4138
+
4139
+ // Guard Clause: Date string is defined
4140
+ if (!dateStr) {
4141
+ return undefined;
4142
+ }
4143
+
4144
+ // Assume the separator is a "/" a defined in our code base
4145
+ const separator = '/';
4146
+
4147
+ // Get the parts of the date and format
4148
+ const valueParts = dateStr.split(separator);
4149
+ const formatParts = format.split(separator);
4150
+
4151
+ // Check if the value and format have the correct number of parts
4152
+ if (valueParts.length !== formatParts.length) {
4153
+ throw new Error('AuroDatepickerUtilities | parseDate: Date string and format length do not match');
4154
+ }
4155
+
4156
+ // Holds the result to be returned
4157
+ const result = formatParts.reduce((acc, part, index) => {
4158
+ const value = valueParts[index];
4159
+
4160
+ if ((/m/iu).test(part)) {
4161
+ acc.month = value;
4162
+ } else if ((/d/iu).test(part)) {
4163
+ acc.day = value;
4164
+ } else if ((/y/iu).test(part)) {
4165
+ acc.year = value;
4166
+ }
4167
+
4168
+ return acc;
4169
+ }, {});
4170
+
4171
+ // If we found all the parts, return the result
4172
+ if (result.month && result.year) {
4173
+ return result;
4174
+ }
4175
+
4176
+ // Throw an error to let the dev know we were unable to parse the date string
4177
+ throw new Error('AuroDatepickerUtilities | parseDate: Unable to parse date string');
4178
+ };
4179
+
4180
+ /**
4181
+ * Convert a date object to string format.
4182
+ * @param {Object} date - Date to convert to string.
4183
+ * @returns {Object} Returns the date as a string.
4184
+ */
4185
+ this.getDateAsString = (date) => date.toLocaleDateString(undefined, {
4186
+ year: "numeric",
4187
+ month: "2-digit",
4188
+ day: "2-digit",
4189
+ });
4190
+
4191
+ /**
4192
+ * Converts a date string to a North American date format.
4193
+ * @param {String} dateStr - Date to validate.
4194
+ * @param {String} format - Date format to validate against.
4195
+ * @returns {Boolean}
4196
+ */
4197
+ this.toNorthAmericanFormat = (dateStr, format) => {
4198
+
4199
+ if (format === 'mm/dd/yyyy') {
4200
+ return dateStr;
4201
+ }
4202
+
4203
+ const parsedDate = this.parseDate(dateStr, format);
4204
+
4205
+ if (!parsedDate) {
4206
+ throw new Error('AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string');
4207
+ }
4208
+
4209
+ const { month, day, year } = parsedDate;
4210
+
4211
+ const dateParts = [];
4212
+ if (month) {
4213
+ dateParts.push(month);
4214
+ }
4215
+
4216
+ if (day) {
4217
+ dateParts.push(day);
4218
+ }
4219
+
4220
+ if (year) {
4221
+ dateParts.push(year);
4222
+ }
4223
+
4224
+ return dateParts.join('/');
4225
+ };
4226
+ }
4227
+ }
4228
+ const dateFormatter = new DateFormatter();
4229
+
4230
+ // filepath: dateConstraints.mjs
4231
+ const DATE_UTIL_CONSTRAINTS = {
4232
+ maxDay: 31,
4233
+ maxMonth: 12,
4234
+ maxYear: 2400,
4235
+ minDay: 1,
4236
+ minMonth: 1,
4237
+ minYear: 1900,
4238
+ };
4239
+
4240
+ class AuroDateUtilitiesBase {
4241
+
4242
+ /**
4243
+ * @description The maximum day value allowed by the various utilities in this class.
4244
+ * @readonly
4245
+ * @type {Number}
4246
+ */
4247
+ get maxDay() {
4248
+ return DATE_UTIL_CONSTRAINTS.maxDay;
4249
+ }
4250
+
4251
+ /**
4252
+ * @description The maximum month value allowed by the various utilities in this class.
4253
+ * @readonly
4254
+ * @type {Number}
4255
+ */
4256
+ get maxMonth() {
4257
+ return DATE_UTIL_CONSTRAINTS.maxMonth;
4258
+ }
4259
+
4260
+ /**
4261
+ * @description The maximum year value allowed by the various utilities in this class.
4262
+ * @readonly
4263
+ * @type {Number}
4264
+ */
4265
+ get maxYear() {
4266
+ return DATE_UTIL_CONSTRAINTS.maxYear;
4267
+ }
4268
+
4269
+ /**
4270
+ * @description The minimum day value allowed by the various utilities in this class.
4271
+ * @readonly
4272
+ * @type {Number}
4273
+ */
4274
+ get minDay() {
4275
+ return DATE_UTIL_CONSTRAINTS.minDay;
4276
+ }
4277
+
4278
+ /**
4279
+ * @description The minimum month value allowed by the various utilities in this class.
4280
+ * @readonly
4281
+ * @type {Number}
4282
+ */
4283
+ get minMonth() {
4284
+ return DATE_UTIL_CONSTRAINTS.minMonth;
4285
+ }
4286
+
4287
+ /**
4288
+ * @description The minimum year value allowed by the various utilities in this class.
4289
+ * @readonly
4290
+ * @type {Number}
4291
+ */
4292
+ get minYear() {
4293
+ return DATE_UTIL_CONSTRAINTS.minYear;
4294
+ }
4295
+ }
4296
+
4297
+ /* eslint-disable no-magic-numbers */
4298
+
4299
+ class AuroDateUtilities extends AuroDateUtilitiesBase {
4300
+
4301
+ /**
4302
+ * Returns the current century.
4303
+ * @returns {String} The current century.
4304
+ */
4305
+ getCentury () {
4306
+ return String(new Date().getFullYear()).slice(0, 2);
4307
+ }
4308
+
4309
+ /**
4310
+ * Returns a four digit year.
4311
+ * @param {String} year - The year to convert to four digits.
4312
+ * @returns {String} The four digit year.
4313
+ */
4314
+ getFourDigitYear (year) {
4315
+
4316
+ const strYear = String(year).trim();
4317
+ return strYear.length <= 2 ? this.getCentury() + strYear : strYear;
4318
+ }
4319
+
4320
+ constructor() {
4321
+
4322
+ super();
4323
+
4324
+ /**
4325
+ * Compares two dates to see if they match.
4326
+ * @param {Object} date1 - First date to compare.
4327
+ * @param {Object} date2 - Second date to compare.
4328
+ * @returns {Boolean} Returns true if the dates match.
4329
+ */
4330
+ this.datesMatch = (date1, date2) => new Date(date1).getTime() === new Date(date2).getTime();
4331
+
4332
+ /**
4333
+ * Returns true if value passed in is a valid date.
4334
+ * @param {String} date - Date to validate.
4335
+ * @param {String} format - Date format to validate against.
4336
+ * @returns {Boolean}
4337
+ */
4338
+ this.validDateStr = (date, format) => {
4339
+
4340
+ // The length we expect the date string to be
4341
+ const dateStrLength = format.length;
4342
+
4343
+ // Guard Clause: Date and format are defined
4344
+ if (typeof date === "undefined" || typeof format === "undefined") {
4345
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date and format are required');
4346
+ }
4347
+
4348
+ // Guard Clause: Date should be of type string
4349
+ if (typeof date !== "string") {
4350
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Date must be a string');
4351
+ }
4352
+
4353
+ // Guard Clause: Format should be of type string
4354
+ if (typeof format !== "string") {
4355
+ throw new Error('AuroDatepickerUtilities | validateDateStr: Format must be a string');
4356
+ }
4357
+
4358
+ // Guard Clause: Length is what we expect it to be
4359
+ if (date.length !== dateStrLength) {
4360
+ return false;
4361
+ }
4362
+ // Get a formatted date string and parse it
4363
+ const dateParts = dateFormatter.parseDate(date, format);
4364
+
4365
+ // Guard Clause: Date parse succeeded
4366
+ if (!dateParts) {
4367
+ return false;
4368
+ }
4369
+
4370
+ // Create the expected date string based on the date parts
4371
+ const expectedDateStr = `${dateParts.month}/${dateParts.day || "01"}/${this.getFourDigitYear(dateParts.year)}`;
4372
+
4373
+ // Generate a date object that we will extract a string date from to compare to the passed in date string
4374
+ const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
4375
+
4376
+ // Get the date string of the date object we created from the string date
4377
+ const actualDateStr = dateFormatter.getDateAsString(dateObj);
4378
+
4379
+ // Guard Clause: Generated date matches date string input
4380
+ if (expectedDateStr !== actualDateStr) {
4381
+ return false;
4382
+ }
4383
+
4384
+ // If we passed all other checks, we can assume the date is valid
4385
+ return true;
4386
+ };
4387
+
4388
+ /**
4389
+ * Determines if a string date value matches the format provided.
4390
+ * @param {string} value = The date string value.
4391
+ * @param { string} format = The date format to match against.
4392
+ * @returns {boolean}
4393
+ */
4394
+ this.dateAndFormatMatch = (value, format) => {
4395
+
4396
+ // Ensure we have both values we need to do the comparison
4397
+ if (!value || !format) {
4398
+ throw new Error('AuroFormValidation | dateFormatMatch: value and format are required');
4399
+ }
4400
+
4401
+ // If the lengths are different, they cannot match
4402
+ if (value.length !== format.length) {
4403
+ return false;
4404
+ }
4405
+
4406
+ // Get the parts of the date
4407
+ const dateParts = dateFormatter.parseDate(value, format);
4408
+
4409
+ // Validator for day
4410
+ const dayValueIsValid = (day) => {
4411
+
4412
+ // Guard clause: if there is no day in the dateParts, we can ignore this check.
4413
+ if (!dateParts.day) {
4414
+ return true;
4415
+ }
4416
+
4417
+ // Guard clause: ensure day exists.
4418
+ if (!day) {
4419
+ return false;
4420
+ }
4421
+
4422
+ // Convert day to number
4423
+ const numDay = Number.parseInt(day, 10);
4424
+
4425
+ // Guard clause: ensure day is a valid integer
4426
+ if (Number.isNaN(numDay)) {
4427
+ throw new Error('AuroDatepickerUtilities | dayValueIsValid: Unable to parse day value integer');
4428
+ }
4429
+
4430
+ // Guard clause: ensure day is within the valid range
4431
+ if (numDay < this.minDay || numDay > this.maxDay) {
4432
+ return false;
4433
+ }
4434
+
4435
+ // Default return
4436
+ return true;
4437
+ };
4438
+
4439
+ // Validator for month
4440
+ const monthValueIsValid = (month) => {
4441
+
4442
+ // Guard clause: ensure month exists.
4443
+ if (!month) {
4444
+ return false;
4445
+ }
4446
+
4447
+ // Convert month to number
4448
+ const numMonth = Number.parseInt(month, 10);
4449
+
4450
+ // Guard clause: ensure month is a valid integer
4451
+ if (Number.isNaN(numMonth)) {
4452
+ throw new Error('AuroDatepickerUtilities | monthValueIsValid: Unable to parse month value integer');
4453
+ }
4454
+
4455
+ // Guard clause: ensure month is within the valid range
4456
+ if (numMonth < this.minMonth || numMonth > this.maxMonth) {
4457
+ return false;
4458
+ }
4459
+
4460
+ // Default return
4461
+ return true;
4462
+ };
4463
+
4464
+ // Validator for year
4465
+ const yearIsValid = (_year) => {
4466
+
4467
+ // Guard clause: ensure year exists.
4468
+ if (!_year) {
4469
+ return false;
4470
+ }
4471
+
4472
+ // Get the full year
4473
+ const year = this.getFourDigitYear(_year);
4474
+
4475
+ // Convert year to number
4476
+ const numYear = Number.parseInt(year, 10);
4477
+
4478
+ // Guard clause: ensure year is a valid integer
4479
+ if (Number.isNaN(numYear)) {
4480
+ throw new Error('AuroDatepickerUtilities | yearValueIsValid: Unable to parse year value integer');
4481
+ }
4482
+
4483
+ // Guard clause: ensure year is within the valid range
4484
+ if (numYear < this.minYear || numYear > this.maxYear) {
4485
+ return false;
4486
+ }
4487
+
4488
+ // Default return
4489
+ return true;
4490
+ };
4491
+
4492
+ // Self-contained checks for month, day, and year
4493
+ const checks = [
4494
+ monthValueIsValid(dateParts.month),
4495
+ dayValueIsValid(dateParts.day),
4496
+ yearIsValid(dateParts.year)
4497
+ ];
4498
+
4499
+ // If any of the checks failed, the date format does not match and the result is invalid
4500
+ const isValid = checks.every((check) => check === true);
4501
+
4502
+ // If the check is invalid, return false
4503
+ if (!isValid) {
4504
+ return false;
4505
+ }
4506
+
4507
+ // Default case
4508
+ return true;
4509
+ };
4510
+ }
4511
+ }
4512
+
4513
+ // Export a class instance
4514
+ const dateUtilities = new AuroDateUtilities();
4515
+
4516
+ // Export the class instance methods individually
4517
+ const {
4518
+ datesMatch,
4519
+ validDateStr,
4520
+ dateAndFormatMatch,
4521
+ minDay,
4522
+ minMonth,
4523
+ minYear,
4524
+ maxDay,
4525
+ maxMonth,
4526
+ maxYear
4527
+ } = dateUtilities;
4528
+
4529
+ const {
4530
+ toNorthAmericanFormat,
4531
+ parseDate,
4532
+ getDateAsString
4533
+ } = dateFormatter;
4534
+
4127
4535
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
4128
4536
  // See LICENSE in the project root for license information.
4129
4537
 
@@ -4199,6 +4607,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
4199
4607
 
4200
4608
 
4201
4609
  class AuroFormValidation {
4610
+
4202
4611
  constructor() {
4203
4612
  this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
4204
4613
  }
@@ -4290,17 +4699,17 @@ class AuroFormValidation {
4290
4699
  ]
4291
4700
  }
4292
4701
  };
4293
-
4702
+
4294
4703
  let elementType;
4295
4704
  if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
4296
4705
  elementType = 'input';
4297
4706
  } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
4298
4707
  elementType = 'counter';
4299
4708
  }
4300
-
4709
+
4301
4710
  if (elementType) {
4302
4711
  const rules = validationRules[elementType];
4303
-
4712
+
4304
4713
  if (rules) {
4305
4714
  Object.values(rules).flat().forEach(rule => {
4306
4715
  if (rule.check(elem)) {
@@ -4326,48 +4735,82 @@ class AuroFormValidation {
4326
4735
  if (!elem.value.match(emailRegex)) {
4327
4736
  elem.validity = 'patternMismatch';
4328
4737
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4738
+ return;
4329
4739
  }
4330
4740
  } else if (elem.type === 'credit-card') {
4331
4741
  if (elem.value.length > 0 && elem.value.length < elem.validationCCLength) {
4332
4742
  elem.validity = 'tooShort';
4333
4743
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4744
+ return;
4334
4745
  }
4335
4746
  } else if (elem.type === 'number') {
4336
4747
  if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
4337
4748
  elem.validity = 'rangeOverflow';
4338
4749
  elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4750
+ return;
4339
4751
  }
4340
4752
 
4341
4753
  if (elem.min !== undefined && elem.value?.length > 0 && Number(elem.min) > Number(elem.value)) {
4342
4754
  elem.validity = 'rangeUnderflow';
4343
4755
  elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4756
+ return;
4344
4757
  }
4345
- } else if (elem.type === 'date') {
4346
- if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
4758
+ } else if (elem.type === 'date' && elem.value?.length > 0) {
4759
+
4760
+ // Guard Clause: if the value is too short
4761
+ if (elem.value.length < elem.lengthForType) {
4762
+
4347
4763
  elem.validity = 'tooShort';
4348
4764
  elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4349
- } else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
4350
- const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
4351
- const valueDate = new Date(formattedValue.dateForComparison);
4765
+ return;
4766
+ }
4767
+
4768
+ // Guard Clause: If the value is too long for the type
4769
+ if (elem.value?.length > elem.lengthForType) {
4352
4770
 
4353
- // validate max
4354
- if (elem.max?.length === elem.lengthForType) {
4355
- const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
4771
+ elem.validity = 'tooLong';
4772
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
4773
+ return;
4774
+ }
4775
+
4776
+ // Validate that the date passed was the correct format
4777
+ if (!dateAndFormatMatch(elem.value, elem.format)) {
4778
+ elem.validity = 'patternMismatch';
4779
+ elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || 'Invalid Date Format Entered';
4780
+ return;
4781
+ }
4782
+
4783
+ // Validate that the date passed was a valid date
4784
+ if (!validDateStr(elem.value, elem.format)) {
4785
+ elem.validity = 'invalidDate';
4786
+ elem.errorMessage = elem.setCustomValidityInvalidDate || elem.setCustomValidity || 'Invalid Date Entered';
4787
+ return;
4788
+ }
4356
4789
 
4357
- if (valueDate > maxDate) {
4358
- elem.validity = 'rangeOverflow';
4359
- elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4360
- }
4790
+ // Perform the rest of the validation
4791
+ const formattedValue = toNorthAmericanFormat(elem.value, elem.format);
4792
+ const valueDate = new Date(formattedValue);
4793
+
4794
+ // // Validate max date
4795
+ if (elem.max?.length === elem.lengthForType) {
4796
+
4797
+ const maxDate = new Date(toNorthAmericanFormat(elem.max, elem.format));
4798
+
4799
+ if (valueDate > maxDate) {
4800
+ elem.validity = 'rangeOverflow';
4801
+ elem.errorMessage = elem.setCustomValidityRangeOverflow || elem.setCustomValidity || '';
4802
+ return;
4361
4803
  }
4804
+ }
4362
4805
 
4363
- // validate min
4364
- if (elem.min?.length === elem.lengthForType) {
4365
- const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
4806
+ // Validate min date
4807
+ if (elem.min?.length === elem.lengthForType) {
4808
+ const minDate = new Date(toNorthAmericanFormat(elem.min, elem.format));
4366
4809
 
4367
- if (valueDate < minDate) {
4368
- elem.validity = 'rangeUnderflow';
4369
- elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4370
- }
4810
+ if (valueDate < minDate) {
4811
+ elem.validity = 'rangeUnderflow';
4812
+ elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
4813
+ return;
4371
4814
  }
4372
4815
  }
4373
4816
  }
@@ -4486,7 +4929,7 @@ class AuroFormValidation {
4486
4929
  if (input.validationMessage.length > 0) {
4487
4930
  elem.errorMessage = input.validationMessage;
4488
4931
  }
4489
- } else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
4932
+ } else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
4490
4933
  const firstInput = this.inputElements[0];
4491
4934
 
4492
4935
  if (firstInput.validationMessage.length > 0) {
@@ -4608,6 +5051,33 @@ class BaseInput extends r {
4608
5051
  static get properties() {
4609
5052
  return {
4610
5053
 
5054
+ /**
5055
+ * The value for the role attribute.
5056
+ */
5057
+ a11yRole: {
5058
+ type: String,
5059
+ attribute: true,
5060
+ reflect: true
5061
+ },
5062
+
5063
+ /**
5064
+ * The value for the aria-expanded attribute.
5065
+ */
5066
+ a11yExpanded: {
5067
+ type: Boolean,
5068
+ attribute: true,
5069
+ reflect: true
5070
+ },
5071
+
5072
+ /**
5073
+ * The value for the aria-controls attribute.
5074
+ */
5075
+ a11yControls: {
5076
+ type: String,
5077
+ attribute: true,
5078
+ reflect: true
5079
+ },
5080
+
4611
5081
  /**
4612
5082
  * If set, the label will remain fixed in the active position.
4613
5083
  */
@@ -5249,6 +5719,10 @@ class BaseInput extends r {
5249
5719
  } else if (this.type === 'number') {
5250
5720
  this.inputMode = 'numeric';
5251
5721
  }
5722
+
5723
+ if (this.type === "date" && !this.format) {
5724
+ this.format = 'mm/dd/yyyy';
5725
+ }
5252
5726
  }
5253
5727
 
5254
5728
  /**
@@ -6492,6 +6966,7 @@ var helpTextVersion = '1.0.0';
6492
6966
 
6493
6967
  // build the component class
6494
6968
  class AuroInput extends BaseInput {
6969
+
6495
6970
  constructor() {
6496
6971
  super();
6497
6972
 
@@ -6604,7 +7079,7 @@ class AuroInput extends BaseInput {
6604
7079
  ?required="${this.required}"
6605
7080
  ?disabled="${this.disabled}"
6606
7081
  aria-describedby="${this.uniqueId}"
6607
- aria-invalid="${this.validity !== 'valid'}"
7082
+ ?aria-invalid="${this.validity !== 'valid'}"
6608
7083
  placeholder=${this.getPlaceholder()}
6609
7084
  lang="${o$2(this.lang)}"
6610
7085
  ?activeLabel="${this.activeLabel}"
@@ -6613,7 +7088,10 @@ class AuroInput extends BaseInput {
6613
7088
  autocapitalize="${o$2(this.autocapitalize ? this.autocapitalize : undefined)}"
6614
7089
  autocomplete="${o$2(this.autocomplete ? this.autocomplete : undefined)}"
6615
7090
  part="input"
6616
- />
7091
+ role="${o$2(this.a11yRole)}"
7092
+ aria-expanded="${o$2(this.a11yExpanded)}"
7093
+ aria-controls="${o$2(this.a11yControls)}"
7094
+ />
6617
7095
  </div>
6618
7096
  <div
6619
7097
  class="notificationIcons"