@aurodesignsystem/auro-formkit 3.2.0-beta.1 → 3.2.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +5 -3
  2. package/components/checkbox/README.md +1 -1
  3. package/components/checkbox/demo/readme.md +1 -1
  4. package/components/combobox/README.md +1 -1
  5. package/components/combobox/demo/api.md +1 -1
  6. package/components/combobox/demo/api.min.js +10 -26
  7. package/components/combobox/demo/index.min.js +10 -26
  8. package/components/combobox/demo/readme.md +1 -1
  9. package/components/combobox/dist/auro-combobox.d.ts +2 -5
  10. package/components/combobox/dist/index.js +9 -26
  11. package/components/combobox/dist/registered.js +9 -26
  12. package/components/counter/README.md +1 -1
  13. package/components/counter/demo/api.md +1 -1
  14. package/components/counter/demo/api.min.js +5 -26
  15. package/components/counter/demo/index.min.js +5 -26
  16. package/components/counter/demo/readme.md +1 -1
  17. package/components/counter/dist/auro-counter-group.d.ts +2 -5
  18. package/components/counter/dist/index.js +5 -26
  19. package/components/counter/dist/registered.js +5 -26
  20. package/components/datepicker/README.md +1 -1
  21. package/components/datepicker/demo/api.md +0 -1
  22. package/components/datepicker/demo/api.min.js +4 -36
  23. package/components/datepicker/demo/index.min.js +4 -36
  24. package/components/datepicker/demo/readme.md +1 -1
  25. package/components/datepicker/dist/auro-datepicker.d.ts +0 -13
  26. package/components/datepicker/dist/index.js +4 -36
  27. package/components/datepicker/dist/registered.js +4 -36
  28. package/components/dropdown/README.md +1 -1
  29. package/components/dropdown/demo/api.md +1 -1
  30. package/components/dropdown/demo/api.min.js +3 -21
  31. package/components/dropdown/demo/index.md +0 -83
  32. package/components/dropdown/demo/index.min.js +3 -21
  33. package/components/dropdown/demo/readme.md +1 -1
  34. package/components/dropdown/dist/auro-dropdown.d.ts +1 -12
  35. package/components/dropdown/dist/index.js +3 -21
  36. package/components/dropdown/dist/registered.js +3 -21
  37. package/components/form/README.md +1 -1
  38. package/components/form/demo/readme.md +1 -1
  39. package/components/input/README.md +1 -1
  40. package/components/input/demo/readme.md +1 -1
  41. package/components/menu/README.md +1 -1
  42. package/components/menu/demo/api.min.js +1 -0
  43. package/components/menu/demo/index.min.js +1 -0
  44. package/components/menu/demo/readme.md +1 -1
  45. package/components/menu/dist/index.js +1 -0
  46. package/components/menu/dist/registered.js +1 -0
  47. package/components/radio/README.md +1 -1
  48. package/components/radio/demo/readme.md +1 -1
  49. package/components/select/README.md +1 -1
  50. package/components/select/demo/api.md +6 -5
  51. package/components/select/demo/api.min.js +56 -26
  52. package/components/select/demo/index.md +1 -46
  53. package/components/select/demo/index.min.js +56 -26
  54. package/components/select/demo/readme.md +1 -1
  55. package/components/select/dist/auro-select.d.ts +5 -5
  56. package/components/select/dist/index.js +55 -26
  57. package/components/select/dist/registered.js +55 -26
  58. package/package.json +1 -1
  59. package/components/form/demo/autocomplete.html +0 -15
@@ -3445,7 +3445,6 @@ var tokensCss$1 = css`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-
3445
3445
 
3446
3446
  const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
3447
3447
  const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
3448
- 'xl',
3449
3448
  'lg',
3450
3449
  'md',
3451
3450
  'sm',
@@ -3517,7 +3516,6 @@ class AuroDropdownBib extends LitElement {
3517
3516
 
3518
3517
  set mobileFullscreenBreakpoint(value) {
3519
3518
  // verify the defined breakpoint is valid and exit out if not
3520
- // 'disabled' is a design token breakpoint so it acts as our "undefined" value
3521
3519
  const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
3522
3520
  if (!validatedValue) {
3523
3521
  this._mobileBreakpointValue = undefined;
@@ -4043,12 +4041,7 @@ class AuroDropdown extends LitElement {
4043
4041
  },
4044
4042
 
4045
4043
  /**
4046
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
4047
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
4048
- *
4049
- * When expanded, the dropdown will automatically display in fullscreen mode
4050
- * if the screen size is equal to or smaller than the selected breakpoint.
4051
- * @default sm
4044
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
4052
4045
  */
4053
4046
  fullscreenBreakpoint: {
4054
4047
  type: String,
@@ -4188,15 +4181,6 @@ class AuroDropdown extends LitElement {
4188
4181
  AuroLibraryRuntimeUtils$1$1.prototype.registerComponent(name, AuroDropdown);
4189
4182
  }
4190
4183
 
4191
- /**
4192
- * Accessor for reusing the focusable entity query string.
4193
- * @private
4194
- * @returns {string}
4195
- */
4196
- get focusableEntityQuery () {
4197
- return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
4198
- }
4199
-
4200
4184
  connectedCallback() {
4201
4185
  super.connectedCallback();
4202
4186
  }
@@ -4210,8 +4194,6 @@ class AuroDropdown extends LitElement {
4210
4194
  updated(changedProperties) {
4211
4195
  this.floater.handleUpdate(changedProperties);
4212
4196
 
4213
- // Note: `disabled` is not a breakpoint (it is not a screen size),
4214
- // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
4215
4197
  if (changedProperties.has('fullscreenBreakpoint')) {
4216
4198
  this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
4217
4199
  }
@@ -4362,7 +4344,7 @@ class AuroDropdown extends LitElement {
4362
4344
 
4363
4345
  this.triggerContentSlot.forEach((node) => {
4364
4346
  if (node.querySelectorAll) {
4365
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4347
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
4366
4348
  auroElements.forEach((auroEl) => {
4367
4349
  auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
4368
4350
  auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
@@ -4383,7 +4365,7 @@ class AuroDropdown extends LitElement {
4383
4365
 
4384
4366
  this.triggerContentSlot.forEach((node) => {
4385
4367
  if (node.querySelectorAll) {
4386
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4368
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
4387
4369
  auroElements.forEach((auroEl) => {
4388
4370
  auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
4389
4371
  auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
@@ -5607,11 +5589,8 @@ class AuroSelect extends LitElement {
5607
5589
  },
5608
5590
 
5609
5591
  /**
5610
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
5611
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
5612
- *
5613
- * When expanded, the dropdown will automatically display in fullscreen mode
5614
- * if the screen size is equal to or smaller than the selected breakpoint.
5592
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile.
5593
+ * When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
5615
5594
  * @default sm
5616
5595
  */
5617
5596
  fullscreenBreakpoint: {
@@ -5913,6 +5892,8 @@ class AuroSelect extends LitElement {
5913
5892
  if (this.dropdown.isPopoverVisible) {
5914
5893
  this.menu.navigateOptions('up');
5915
5894
  }
5895
+
5896
+ return;
5916
5897
  }
5917
5898
 
5918
5899
  if (evt.key === 'ArrowDown') {
@@ -5923,6 +5904,8 @@ class AuroSelect extends LitElement {
5923
5904
  if (this.dropdown.isPopoverVisible) {
5924
5905
  this.menu.navigateOptions('down');
5925
5906
  }
5907
+
5908
+ return;
5926
5909
  }
5927
5910
 
5928
5911
  if (evt.key === 'Enter') {
@@ -5930,6 +5913,8 @@ class AuroSelect extends LitElement {
5930
5913
  evt.preventDefault();
5931
5914
  this.menu.makeSelection();
5932
5915
  }
5916
+
5917
+ return;
5933
5918
  }
5934
5919
 
5935
5920
  if (evt.key === 'Tab') {
@@ -5938,7 +5923,12 @@ class AuroSelect extends LitElement {
5938
5923
  } else {
5939
5924
  this.dropdown.hide();
5940
5925
  }
5926
+
5927
+ return;
5941
5928
  }
5929
+
5930
+ // Handle all other key presses by updating the active option based on the key pressed
5931
+ this.updateActiveOptionBasedOnKey(evt.key);
5942
5932
  });
5943
5933
 
5944
5934
  this.addEventListener('focusin', this.handleFocusin);
@@ -5948,6 +5938,45 @@ class AuroSelect extends LitElement {
5948
5938
  });
5949
5939
  }
5950
5940
 
5941
+ updateActiveOptionBasedOnKey(_key) {
5942
+
5943
+ // Get a lowercase version of the key pressed
5944
+ const key = _key.toLowerCase();
5945
+
5946
+ // Calculate how many times the same letter has been pressed
5947
+ this.sameLetterTimes = key === this.lastLetter ? this.sameLetterTimes + 1 : 0;
5948
+
5949
+ // Set last letter for tracking
5950
+ this.lastLetter = key;
5951
+
5952
+ // Get all the options that start with the last letter pressed
5953
+ const letterOptions = this.options.filter((option) => {
5954
+ const optionText = option.value || '';
5955
+ return optionText.toLowerCase().startsWith(this.lastLetter);
5956
+ });
5957
+
5958
+ // If we have options that match the letter pressed
5959
+ if (letterOptions.length) {
5960
+
5961
+ // Show the dropdown if it is not already visible
5962
+ this.dropdown.show();
5963
+
5964
+ // Get the index we're after based on how many times the letter has been pressed and the length of the letterOptions array
5965
+ const index = this.sameLetterTimes < letterOptions.length ? this.sameLetterTimes : this.sameLetterTimes % letterOptions.length;
5966
+
5967
+ // Select the new option in the menu
5968
+ const newOption = letterOptions[index];
5969
+ const newOptionIndex = this.options.indexOf(newOption);
5970
+ this.menu.updateActiveOption(newOptionIndex);
5971
+
5972
+ newOption.scrollIntoView({
5973
+ alignToTop: false,
5974
+ block: "nearest",
5975
+ behavior: "smooth"
5976
+ });
5977
+ }
5978
+ }
5979
+
5951
5980
  /**
5952
5981
  * Manages the visibility of the dropdown based on loading state changes.
5953
5982
  *
@@ -3445,7 +3445,6 @@ var tokensCss$1 = css`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-
3445
3445
 
3446
3446
  const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
3447
3447
  const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
3448
- 'xl',
3449
3448
  'lg',
3450
3449
  'md',
3451
3450
  'sm',
@@ -3517,7 +3516,6 @@ class AuroDropdownBib extends LitElement {
3517
3516
 
3518
3517
  set mobileFullscreenBreakpoint(value) {
3519
3518
  // verify the defined breakpoint is valid and exit out if not
3520
- // 'disabled' is a design token breakpoint so it acts as our "undefined" value
3521
3519
  const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
3522
3520
  if (!validatedValue) {
3523
3521
  this._mobileBreakpointValue = undefined;
@@ -4043,12 +4041,7 @@ class AuroDropdown extends LitElement {
4043
4041
  },
4044
4042
 
4045
4043
  /**
4046
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
4047
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
4048
- *
4049
- * When expanded, the dropdown will automatically display in fullscreen mode
4050
- * if the screen size is equal to or smaller than the selected breakpoint.
4051
- * @default sm
4044
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
4052
4045
  */
4053
4046
  fullscreenBreakpoint: {
4054
4047
  type: String,
@@ -4188,15 +4181,6 @@ class AuroDropdown extends LitElement {
4188
4181
  AuroLibraryRuntimeUtils$1$1.prototype.registerComponent(name, AuroDropdown);
4189
4182
  }
4190
4183
 
4191
- /**
4192
- * Accessor for reusing the focusable entity query string.
4193
- * @private
4194
- * @returns {string}
4195
- */
4196
- get focusableEntityQuery () {
4197
- return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
4198
- }
4199
-
4200
4184
  connectedCallback() {
4201
4185
  super.connectedCallback();
4202
4186
  }
@@ -4210,8 +4194,6 @@ class AuroDropdown extends LitElement {
4210
4194
  updated(changedProperties) {
4211
4195
  this.floater.handleUpdate(changedProperties);
4212
4196
 
4213
- // Note: `disabled` is not a breakpoint (it is not a screen size),
4214
- // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
4215
4197
  if (changedProperties.has('fullscreenBreakpoint')) {
4216
4198
  this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
4217
4199
  }
@@ -4362,7 +4344,7 @@ class AuroDropdown extends LitElement {
4362
4344
 
4363
4345
  this.triggerContentSlot.forEach((node) => {
4364
4346
  if (node.querySelectorAll) {
4365
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4347
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
4366
4348
  auroElements.forEach((auroEl) => {
4367
4349
  auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
4368
4350
  auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
@@ -4383,7 +4365,7 @@ class AuroDropdown extends LitElement {
4383
4365
 
4384
4366
  this.triggerContentSlot.forEach((node) => {
4385
4367
  if (node.querySelectorAll) {
4386
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4368
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
4387
4369
  auroElements.forEach((auroEl) => {
4388
4370
  auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
4389
4371
  auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
@@ -5607,11 +5589,8 @@ class AuroSelect extends LitElement {
5607
5589
  },
5608
5590
 
5609
5591
  /**
5610
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
5611
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
5612
- *
5613
- * When expanded, the dropdown will automatically display in fullscreen mode
5614
- * if the screen size is equal to or smaller than the selected breakpoint.
5592
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile.
5593
+ * When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
5615
5594
  * @default sm
5616
5595
  */
5617
5596
  fullscreenBreakpoint: {
@@ -5913,6 +5892,8 @@ class AuroSelect extends LitElement {
5913
5892
  if (this.dropdown.isPopoverVisible) {
5914
5893
  this.menu.navigateOptions('up');
5915
5894
  }
5895
+
5896
+ return;
5916
5897
  }
5917
5898
 
5918
5899
  if (evt.key === 'ArrowDown') {
@@ -5923,6 +5904,8 @@ class AuroSelect extends LitElement {
5923
5904
  if (this.dropdown.isPopoverVisible) {
5924
5905
  this.menu.navigateOptions('down');
5925
5906
  }
5907
+
5908
+ return;
5926
5909
  }
5927
5910
 
5928
5911
  if (evt.key === 'Enter') {
@@ -5930,6 +5913,8 @@ class AuroSelect extends LitElement {
5930
5913
  evt.preventDefault();
5931
5914
  this.menu.makeSelection();
5932
5915
  }
5916
+
5917
+ return;
5933
5918
  }
5934
5919
 
5935
5920
  if (evt.key === 'Tab') {
@@ -5938,7 +5923,12 @@ class AuroSelect extends LitElement {
5938
5923
  } else {
5939
5924
  this.dropdown.hide();
5940
5925
  }
5926
+
5927
+ return;
5941
5928
  }
5929
+
5930
+ // Handle all other key presses by updating the active option based on the key pressed
5931
+ this.updateActiveOptionBasedOnKey(evt.key);
5942
5932
  });
5943
5933
 
5944
5934
  this.addEventListener('focusin', this.handleFocusin);
@@ -5948,6 +5938,45 @@ class AuroSelect extends LitElement {
5948
5938
  });
5949
5939
  }
5950
5940
 
5941
+ updateActiveOptionBasedOnKey(_key) {
5942
+
5943
+ // Get a lowercase version of the key pressed
5944
+ const key = _key.toLowerCase();
5945
+
5946
+ // Calculate how many times the same letter has been pressed
5947
+ this.sameLetterTimes = key === this.lastLetter ? this.sameLetterTimes + 1 : 0;
5948
+
5949
+ // Set last letter for tracking
5950
+ this.lastLetter = key;
5951
+
5952
+ // Get all the options that start with the last letter pressed
5953
+ const letterOptions = this.options.filter((option) => {
5954
+ const optionText = option.value || '';
5955
+ return optionText.toLowerCase().startsWith(this.lastLetter);
5956
+ });
5957
+
5958
+ // If we have options that match the letter pressed
5959
+ if (letterOptions.length) {
5960
+
5961
+ // Show the dropdown if it is not already visible
5962
+ this.dropdown.show();
5963
+
5964
+ // Get the index we're after based on how many times the letter has been pressed and the length of the letterOptions array
5965
+ const index = this.sameLetterTimes < letterOptions.length ? this.sameLetterTimes : this.sameLetterTimes % letterOptions.length;
5966
+
5967
+ // Select the new option in the menu
5968
+ const newOption = letterOptions[index];
5969
+ const newOptionIndex = this.options.indexOf(newOption);
5970
+ this.menu.updateActiveOption(newOptionIndex);
5971
+
5972
+ newOption.scrollIntoView({
5973
+ alignToTop: false,
5974
+ block: "nearest",
5975
+ behavior: "smooth"
5976
+ });
5977
+ }
5978
+ }
5979
+
5951
5980
  /**
5952
5981
  * Manages the visibility of the dropdown based on loading state changes.
5953
5982
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-formkit",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.1",
4
4
  "description": "A collection of web components used to build forms.",
5
5
  "homepage": "https://github.com/AlaskaAirlines/auro-formkit#readme",
6
6
  "bugs": {
@@ -1,15 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Demo page for auto-complete</title>
7
- </head>
8
- <body>
9
- <!-- EVERY AUTOCOMPLETE OPTION, auro inputs -->
10
-
11
- <!-- EVERY AUTOCOMPLETE OPTION, auro combobox -->
12
-
13
- <!-- LOGIN FORM -->
14
- </body>
15
- </html>