@momentum-design/components 0.129.42 → 0.129.44

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 (61) hide show
  1. package/dist/browser/index.js +386 -386
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/accordionbutton/accordionbutton.component.d.ts +1 -1
  4. package/dist/components/accordionbutton/accordionbutton.component.js +4 -3
  5. package/dist/components/buttonsimple/buttonsimple.component.d.ts +1 -1
  6. package/dist/components/buttonsimple/buttonsimple.component.js +8 -6
  7. package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +1 -1
  8. package/dist/components/cardcheckbox/cardcheckbox.component.js +7 -5
  9. package/dist/components/cardradio/cardradio.component.d.ts +1 -1
  10. package/dist/components/cardradio/cardradio.component.js +8 -7
  11. package/dist/components/checkbox/checkbox.component.d.ts +2 -1
  12. package/dist/components/checkbox/checkbox.component.js +7 -4
  13. package/dist/components/coachmark/coachmark.component.d.ts +14 -1
  14. package/dist/components/coachmark/coachmark.component.js +14 -1
  15. package/dist/components/coachmark/index.d.ts +0 -1
  16. package/dist/components/coachmark/index.js +0 -1
  17. package/dist/components/combobox/combobox.component.d.ts +1 -1
  18. package/dist/components/combobox/combobox.component.js +11 -11
  19. package/dist/components/input/input.component.d.ts +1 -1
  20. package/dist/components/input/input.component.js +3 -3
  21. package/dist/components/list/list.component.d.ts +1 -1
  22. package/dist/components/listbox/listbox.component.d.ts +1 -1
  23. package/dist/components/listitem/listitem.component.d.ts +1 -1
  24. package/dist/components/listitem/listitem.component.js +11 -5
  25. package/dist/components/menubar/menubar.component.d.ts +2 -2
  26. package/dist/components/menubar/menubar.component.js +10 -20
  27. package/dist/components/menuitem/menuitem.component.js +3 -3
  28. package/dist/components/menupopover/menupopover.component.d.ts +0 -10
  29. package/dist/components/menupopover/menupopover.component.js +15 -36
  30. package/dist/components/popover/popover.component.d.ts +26 -13
  31. package/dist/components/popover/popover.component.js +26 -12
  32. package/dist/components/popover/popover.constants.d.ts +5 -1
  33. package/dist/components/popover/popover.constants.js +6 -2
  34. package/dist/components/popover/popover.types.d.ts +3 -2
  35. package/dist/components/radio/radio.component.d.ts +1 -1
  36. package/dist/components/radio/radio.component.js +8 -7
  37. package/dist/components/searchfield/searchfield.component.d.ts +3 -0
  38. package/dist/components/searchfield/searchfield.component.js +18 -5
  39. package/dist/components/searchpopover/searchpopover.component.js +3 -4
  40. package/dist/components/select/select.component.d.ts +1 -1
  41. package/dist/components/select/select.component.js +9 -8
  42. package/dist/components/slider/slider.component.d.ts +2 -1
  43. package/dist/components/slider/slider.component.js +4 -3
  44. package/dist/components/stepperitem/stepperitem.component.d.ts +1 -1
  45. package/dist/components/stepperitem/stepperitem.component.js +8 -6
  46. package/dist/components/textarea/textarea.component.d.ts +1 -1
  47. package/dist/components/textarea/textarea.component.js +5 -4
  48. package/dist/components/toggle/toggle.component.d.ts +1 -1
  49. package/dist/components/toggle/toggle.component.js +5 -4
  50. package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +1 -1
  51. package/dist/components/virtualizedlist/virtualizedlist.component.js +7 -6
  52. package/dist/custom-elements.json +1417 -1020
  53. package/dist/react/checkbox/index.d.ts +1 -0
  54. package/dist/react/checkbox/index.js +1 -0
  55. package/dist/react/coachmark/index.d.ts +14 -1
  56. package/dist/react/coachmark/index.js +14 -1
  57. package/dist/utils/mixins/KeyToActionMixin.d.ts +69 -0
  58. package/dist/utils/mixins/KeyToActionMixin.js +92 -0
  59. package/dist/utils/mixins/ListNavigationMixin.d.ts +2 -1
  60. package/dist/utils/mixins/ListNavigationMixin.js +10 -33
  61. package/package.json +1 -1
@@ -16,8 +16,8 @@ import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
16
16
  import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
17
17
  import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
18
18
  import { ROLE } from '../../utils/roles';
19
- import { KEYS } from '../../utils/keys';
20
19
  import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
20
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
21
21
  import styles from './radio.styles';
22
22
  /**
23
23
  * The Radio component allows users to select a single option from a group of mutually exclusive choices.
@@ -67,7 +67,7 @@ import styles from './radio.styles';
67
67
  * @csspart text-container - The container for the label and helper text elements.
68
68
  * @csspart static-radio - The staticradio that provides the visual radio appearance.
69
69
  */
70
- class Radio extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
70
+ class Radio extends KeyToActionMixin(AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)))) {
71
71
  constructor() {
72
72
  super(...arguments);
73
73
  /**
@@ -243,27 +243,28 @@ class Radio extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(
243
243
  var _a;
244
244
  if (this.disabled)
245
245
  return;
246
- if ((this.readonly || this.softDisabled) && event.key === KEYS.SPACE) {
246
+ const action = this.getActionForKeyEvent(event);
247
+ if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
247
248
  event.preventDefault();
248
249
  }
249
250
  const radios = this.getAllRadiosWithinSameGroup();
250
251
  const enabledRadios = radios.filter(radio => !radio.disabled);
251
252
  const currentIndex = enabledRadios.indexOf(this);
252
- if (['ArrowDown', 'ArrowRight'].includes(event.key)) {
253
+ if (action === ACTIONS.DOWN || action === ACTIONS.RIGHT) {
253
254
  // Move focus to the next radio
254
255
  const nextIndex = (currentIndex + 1) % enabledRadios.length;
255
256
  this.updateRadio(enabledRadios, nextIndex);
256
257
  }
257
- else if (['ArrowUp', 'ArrowLeft'].includes(event.key)) {
258
+ else if (action === ACTIONS.UP || action === ACTIONS.LEFT) {
258
259
  // Move focus to the previous radio
259
260
  const prevIndex = (currentIndex - 1 + enabledRadios.length) % enabledRadios.length;
260
261
  this.updateRadio(enabledRadios, prevIndex);
261
262
  }
262
- else if (event.key === KEYS.SPACE) {
263
+ else if (action === ACTIONS.SPACE) {
263
264
  this.updateRadio(enabledRadios, currentIndex);
264
265
  }
265
266
  this.updateTabIndex();
266
- if (event.key === KEYS.ENTER) {
267
+ if (action === ACTIONS.ENTER) {
267
268
  (_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
268
269
  }
269
270
  }
@@ -94,6 +94,9 @@ declare class Searchfield extends Input {
94
94
  */
95
95
  protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
96
96
  clearInputText(): void;
97
+ handleFilterContainerClick: () => void;
98
+ protected handleFilterContainerKeyDown: (e: KeyboardEvent) => void;
99
+ protected handleFilterContainerKeyUp: (e: KeyboardEvent) => void;
97
100
  render(): import("lit-html").TemplateResult<1>;
98
101
  static styles: Array<CSSResult>;
99
102
  }
@@ -11,7 +11,7 @@ import { html } from 'lit';
11
11
  import { queryAssignedElements, state } from 'lit/decorators.js';
12
12
  import { classMap } from 'lit-html/directives/class-map.js';
13
13
  import Input from '../input/input.component';
14
- import { KEYS } from '../../utils/keys';
14
+ import { ACTIONS } from '../../utils/mixins/KeyToActionMixin';
15
15
  import styles from './searchfield.styles';
16
16
  import { DEFAULTS } from './searchfield.constants';
17
17
  /**
@@ -88,6 +88,19 @@ class Searchfield extends Input {
88
88
  * @internal
89
89
  */
90
90
  this.hasInputChips = false;
91
+ this.handleFilterContainerClick = () => {
92
+ this.inputElement.focus();
93
+ };
94
+ this.handleFilterContainerKeyDown = (e) => {
95
+ if (this.getActionForKeyEvent(e) === ACTIONS.ENTER) {
96
+ this.handleFilterContainerClick();
97
+ }
98
+ };
99
+ this.handleFilterContainerKeyUp = (e) => {
100
+ if (this.getActionForKeyEvent(e) === ACTIONS.SPACE) {
101
+ this.handleFilterContainerClick();
102
+ }
103
+ };
91
104
  }
92
105
  /**
93
106
  * Handles the keydown event of the search field.
@@ -97,7 +110,7 @@ class Searchfield extends Input {
97
110
  */
98
111
  handleKeyDown(event) {
99
112
  super.handleKeyDown(event);
100
- if (event.key === KEYS.ESCAPE) {
113
+ if (this.getActionForKeyEvent(event) === ACTIONS.ESCAPE) {
101
114
  this.clearInputText();
102
115
  }
103
116
  }
@@ -162,9 +175,9 @@ class Searchfield extends Input {
162
175
  <div part="scrollable-container" tabindex="-1">
163
176
  <div
164
177
  part="filters-container"
165
- @click=${() => this.inputElement.focus()}
166
- @keydown=${(e) => (e.key === KEYS.ENTER ? this.inputElement.focus() : null)}
167
- @keyup=${(e) => (e.key === KEYS.SPACE ? this.inputElement.focus() : null)}
178
+ @click=${this.handleFilterContainerClick}
179
+ @keydown=${this.handleFilterContainerKeyDown}
180
+ @keyup=${this.handleFilterContainerKeyUp}
168
181
  >
169
182
  <slot name="filters" @slotchange=${this.renderInputChips}></slot>
170
183
  </div>
@@ -13,7 +13,6 @@ import { property } from 'lit/decorators.js';
13
13
  import { ifDefined } from 'lit/directives/if-defined.js';
14
14
  import { live } from 'lit/directives/live.js';
15
15
  import Searchfield from '../searchfield/searchfield.component';
16
- import { KEYS } from '../../utils/keys';
17
16
  import { POPOVER_PLACEMENT, DEFAULTS as POPOVER_DEFAULTS } from '../popover/popover.constants';
18
17
  import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
19
18
  import { ROLE } from '../../utils/roles';
@@ -162,9 +161,9 @@ class Searchpopover extends Searchfield {
162
161
  <div part="scrollable-container" tabindex="-1">
163
162
  <div
164
163
  part="filters-container"
165
- @click=${() => this.inputElement.focus()}
166
- @keydown=${(e) => (e.key === KEYS.ENTER ? this.inputElement.focus() : null)}
167
- @keyup=${(e) => (e.key === KEYS.SPACE ? this.inputElement.focus() : null)}
164
+ @click=${this.handleFilterContainerClick}
165
+ @keydown=${this.handleFilterContainerKeyDown}
166
+ @keyup=${this.handleFilterContainerKeyUp}
168
167
  >
169
168
  <slot name="filters" @slotchange=${this.renderInputChips}></slot>
170
169
  </div>
@@ -5,7 +5,7 @@ import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
5
5
  import type Option from '../option/option.component';
6
6
  import type { PopoverStrategy } from '../popover/popover.types';
7
7
  import type { Placement } from './select.types';
8
- declare const Select_base: import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/ListNavigationMixin").ListNavigationMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/lifecycle/CaptureDestroyEventForChildElement").CaptureDestroyEventForChildElementInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
8
+ declare const Select_base: import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/ListNavigationMixin").ListNavigationMixinInterface & import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/lifecycle/CaptureDestroyEventForChildElement").CaptureDestroyEventForChildElementInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
9
9
  /**
10
10
  * The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
11
11
  * It is designed to work with `mdc-option` for individual options and `mdc-optgroup` for grouping related options.
@@ -11,7 +11,6 @@ import { html, nothing } from 'lit';
11
11
  import { property, query, state } from 'lit/decorators.js';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
13
  import { ElementStore } from '../../utils/controllers/ElementStore';
14
- import { KEYS } from '../../utils/keys';
15
14
  import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
16
15
  import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
17
16
  import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
@@ -25,6 +24,7 @@ import { TAG_NAME as OPTION_TAG_NAME } from '../option/option.constants';
25
24
  import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
26
25
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
27
26
  import { debounce } from '../../utils/debounce';
27
+ import { ACTIONS } from '../../utils/mixins/KeyToActionMixin';
28
28
  import { ARROW_ICON, DEFAULTS, LISTBOX_ID, TRIGGER_ID } from './select.constants';
29
29
  import styles from './select.styles';
30
30
  /**
@@ -553,23 +553,24 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
553
553
  if (this.disabled || this.softDisabled || this.readonly) {
554
554
  return;
555
555
  }
556
- switch (event.key) {
557
- case KEYS.ARROW_DOWN:
558
- case KEYS.ARROW_UP:
559
- case KEYS.ENTER:
560
- case KEYS.SPACE:
556
+ const action = this.getActionForKeyEvent(event);
557
+ switch (action) {
558
+ case ACTIONS.DOWN:
559
+ case ACTIONS.UP:
560
+ case ACTIONS.ENTER:
561
+ case ACTIONS.SPACE:
561
562
  this.displayPopover = true;
562
563
  event.preventDefault();
563
564
  event.stopPropagation();
564
565
  break;
565
- case KEYS.HOME: {
566
+ case ACTIONS.HOME: {
566
567
  this.displayPopover = true;
567
568
  this.resetTabIndexAndSetFocusAfterUpdate(0);
568
569
  event.preventDefault();
569
570
  event.stopPropagation();
570
571
  break;
571
572
  }
572
- case KEYS.END: {
573
+ case ACTIONS.END: {
573
574
  this.displayPopover = true;
574
575
  this.resetTabIndexAndSetFocusAfterUpdate(this.navItems.length - 1);
575
576
  event.preventDefault();
@@ -1,5 +1,6 @@
1
1
  import type { CSSResult, PropertyValueMap } from 'lit';
2
2
  import { Component } from '../../models';
3
+ declare const Slider_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & typeof Component;
3
4
  /**
4
5
  * Slider component is used to select a value or range of values from within a defined range.
5
6
  * It provides a visual representation of the current value(s) and allows users to adjust the value(s) by dragging the thumb(s) along the track.
@@ -33,7 +34,7 @@ import { Component } from '../../models';
33
34
  * @cssproperty --mdc-slider-tooltip-left - The left position of the slider tooltip
34
35
  * @cssproperty --mdc-slider-tick-left - The left position of the slider tick marks
35
36
  */
36
- declare class Slider extends Component {
37
+ declare class Slider extends Slider_base {
37
38
  /**
38
39
  * Internal state to track if the slider thumb is focused (single value)
39
40
  * @internal
@@ -11,7 +11,7 @@ import { html, nothing } from 'lit';
11
11
  import { property, queryAll, state } from 'lit/decorators.js';
12
12
  import { repeat } from 'lit/directives/repeat.js';
13
13
  import { Component } from '../../models';
14
- import { KEYS } from '../../utils/keys';
14
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
15
15
  import { DEFAULTS } from './slider.constants';
16
16
  import styles from './slider.styles';
17
17
  /**
@@ -47,7 +47,7 @@ import styles from './slider.styles';
47
47
  * @cssproperty --mdc-slider-tooltip-left - The left position of the slider tooltip
48
48
  * @cssproperty --mdc-slider-tick-left - The left position of the slider tick marks
49
49
  */
50
- class Slider extends Component {
50
+ class Slider extends KeyToActionMixin(Component) {
51
51
  constructor() {
52
52
  super();
53
53
  /**
@@ -109,7 +109,8 @@ class Slider extends Component {
109
109
  * @param e - The event to prevent.
110
110
  */
111
111
  preventChange(e) {
112
- if (this.softDisabled && ((e instanceof KeyboardEvent && e.key !== KEYS.TAB) || !(e instanceof KeyboardEvent))) {
112
+ if (this.softDisabled &&
113
+ ((e instanceof KeyboardEvent && this.getActionForKeyEvent(e) !== ACTIONS.TAB) || !(e instanceof KeyboardEvent))) {
113
114
  e.preventDefault();
114
115
  e.stopPropagation();
115
116
  }
@@ -1,7 +1,7 @@
1
1
  import { CSSResult } from 'lit';
2
2
  import { Component } from '../../models';
3
3
  import type { StatusType, VariantType } from './stepperitem.types';
4
- declare const StepperItem_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Component;
4
+ declare const StepperItem_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Component;
5
5
  /**
6
6
  * stepperitem component is used to represent a single step in a stepper component. It is used within a `mdc-stepper` component to indicate the current step in a process.
7
7
  * It can have different statuses such as `completed`, `current`, `incomplete`, `error-current`, and `error-incomplete`.
@@ -13,9 +13,9 @@ import { Component } from '../../models';
13
13
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
14
14
  import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
15
15
  import { ROLE } from '../../utils/roles';
16
- import { KEYS } from '../../utils/keys';
17
16
  import providerUtils from '../../utils/provider';
18
17
  import Stepper from '../stepper/stepper.component';
18
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
19
19
  import styles from './stepperitem.styles';
20
20
  import { DEFAULT, STATUS, STATUS_ICON } from './stepperitem.constants';
21
21
  /**
@@ -52,7 +52,7 @@ import { DEFAULT, STATUS, STATUS_ICON } from './stepperitem.constants';
52
52
  * @cssproperty --mdc-stepperitem-help-text-color - The color of the optional label text.
53
53
  * @cssproperty --mdc-stepperitem-label-container-background - The background color of the label container.
54
54
  */
55
- class StepperItem extends TabIndexMixin(Component) {
55
+ class StepperItem extends KeyToActionMixin(TabIndexMixin(Component)) {
56
56
  updated(changedProperties) {
57
57
  var _a;
58
58
  super.updated(changedProperties);
@@ -99,9 +99,10 @@ class StepperItem extends TabIndexMixin(Component) {
99
99
  * @param event - The keyboard event.
100
100
  */
101
101
  handleKeyDown(event) {
102
- if ([KEYS.ENTER, KEYS.SPACE].includes(event.key)) {
102
+ const action = this.getActionForKeyEvent(event);
103
+ if (action === ACTIONS.ENTER || action === ACTIONS.SPACE) {
103
104
  this.classList.add('pressed');
104
- if (event.key === KEYS.ENTER) {
105
+ if (action === ACTIONS.ENTER) {
105
106
  this.triggerClickEvent();
106
107
  }
107
108
  // Prevent default event behavior to avoid scrolling or double-triggering
@@ -127,9 +128,10 @@ class StepperItem extends TabIndexMixin(Component) {
127
128
  * @param event - The keyboard event.
128
129
  */
129
130
  handleKeyUp(event) {
130
- if ([KEYS.ENTER, KEYS.SPACE].includes(event.key)) {
131
+ const action = this.getActionForKeyEvent(event);
132
+ if (action === ACTIONS.ENTER || action === ACTIONS.SPACE) {
131
133
  this.classList.remove('pressed');
132
- if (event.key === KEYS.SPACE) {
134
+ if (action === ACTIONS.SPACE) {
133
135
  this.triggerClickEvent();
134
136
  }
135
137
  }
@@ -2,7 +2,7 @@ import { CSSResult, nothing, PropertyValueMap } from 'lit';
2
2
  import FormfieldWrapper from '../formfieldwrapper';
3
3
  import type { AutoCapitalizeType } from '../input/input.types';
4
4
  import type { WrapType, AutoCompleteType } from './textarea.types';
5
- declare const Textarea_base: import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
5
+ declare const Textarea_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
6
6
  /**
7
7
  * mdc-textarea component, which is used to get the multi-line text input from the user.
8
8
  * It contains:
@@ -16,7 +16,7 @@ import { AUTO_CAPITALIZE } from '../input/input.constants';
16
16
  import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
17
17
  import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
18
18
  import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
19
- import { KEYS } from '../../utils/keys';
19
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
20
20
  import { AUTO_COMPLETE, WRAP, DEFAULTS } from './textarea.constants';
21
21
  import styles from './textarea.styles';
22
22
  /**
@@ -104,7 +104,7 @@ import styles from './textarea.styles';
104
104
  * @cssproperty --mdc-textarea-text-line-height - Line height for the textarea field
105
105
  * @cssproperty --mdc-textarea-container-background-color - Background color for the textarea container
106
106
  */
107
- class Textarea extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
107
+ class Textarea extends KeyToActionMixin(AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)))) {
108
108
  constructor() {
109
109
  super(...arguments);
110
110
  /**
@@ -379,10 +379,11 @@ class Textarea extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
379
379
  }
380
380
  const currentRows = this.rows || DEFAULTS.ROWS;
381
381
  let newRows;
382
- if (event.key === KEYS.ARROW_UP) {
382
+ const action = this.getActionForKeyEvent(event);
383
+ if (action === ACTIONS.UP) {
383
384
  newRows = Math.max(1, currentRows - 1);
384
385
  }
385
- else if (event.key === KEYS.ARROW_DOWN) {
386
+ else if (action === ACTIONS.DOWN) {
386
387
  newRows = currentRows + 1;
387
388
  }
388
389
  if (newRows !== undefined) {
@@ -2,7 +2,7 @@ import { CSSResult, PropertyValueMap } from 'lit';
2
2
  import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
3
3
  import FormfieldWrapper from '../formfieldwrapper';
4
4
  import type { ToggleSize } from './toggle.types';
5
- declare const Toggle_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/ControlTypeMixin").ControlTypeMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
5
+ declare const Toggle_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/ControlTypeMixin").ControlTypeMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
6
6
  /**
7
7
  * The Toggle component is an interactive control used to switch between two mutually exclusive states,
8
8
  * such as On/Off or Active/Inactive. It is commonly used in settings panels, forms, and preference selections
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { html, nothing } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
- import { KEYS } from '../../utils/keys';
14
13
  import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
15
14
  import { ControlTypeMixin } from '../../utils/mixins/ControlTypeMixin';
16
15
  import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
@@ -18,6 +17,7 @@ import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
18
17
  import { ROLE } from '../../utils/roles';
19
18
  import FormfieldWrapper from '../formfieldwrapper';
20
19
  import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
20
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
21
21
  import { DEFAULTS, TOGGLE_SIZE } from './toggle.constants';
22
22
  import styles from './toggle.styles';
23
23
  /**
@@ -64,7 +64,7 @@ import styles from './toggle.styles';
64
64
  * @csspart static-toggle - The statictoggle that provides the visual toggle switch appearance.
65
65
  * @csspart toggle-input - The native input element with switch role that provides the interactive functionality.
66
66
  */
67
- class Toggle extends ControlTypeMixin(AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)))) {
67
+ class Toggle extends KeyToActionMixin(ControlTypeMixin(AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))))) {
68
68
  constructor() {
69
69
  super(...arguments);
70
70
  /**
@@ -173,10 +173,11 @@ class Toggle extends ControlTypeMixin(AutoFocusOnMountMixin(FormInternalsMixin(D
173
173
  */
174
174
  handleKeyDown(event) {
175
175
  var _a;
176
- if ((this.readonly || this.softDisabled) && event.key === KEYS.SPACE) {
176
+ const action = this.getActionForKeyEvent(event);
177
+ if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
177
178
  event.preventDefault();
178
179
  }
179
- if (event.key === KEYS.ENTER) {
180
+ if (action === ACTIONS.ENTER) {
180
181
  (_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
181
182
  }
182
183
  }
@@ -4,7 +4,7 @@ import List from '../list/list.component';
4
4
  import type { ElementStoreChangeTypes } from '../../utils/controllers/ElementStore';
5
5
  import { type BaseArray } from '../../utils/virtualIndexArray';
6
6
  import { VirtualizerProps, Virtualizer } from './virtualizedlist.types';
7
- declare const VirtualizedList_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof List;
7
+ declare const VirtualizedList_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof List;
8
8
  /**
9
9
  * `mdc-virtualizedlist` is an extension of the `mdc-list` component that adds virtualization capabilities using
10
10
  * the Tanstack Virtual library.
@@ -15,8 +15,8 @@ import List from '../list/list.component';
15
15
  import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
16
16
  import { Interval } from '../../utils/range';
17
17
  import { VirtualIndexArray } from '../../utils/virtualIndexArray';
18
- import { KEYS } from '../../utils/keys';
19
18
  import { LIFE_CYCLE_EVENTS } from '../../utils/mixins/lifecycle/lifecycle.contants';
19
+ import { ACTIONS, KeyToActionMixin } from '../../utils/mixins/KeyToActionMixin';
20
20
  import styles from './virtualizedlist.styles';
21
21
  import { DEFAULTS } from './virtualizedlist.constants';
22
22
  /**
@@ -86,7 +86,7 @@ import { DEFAULTS } from './virtualizedlist.constants';
86
86
  * @csspart container - The container of the virtualized list.
87
87
  * @csspart scroll - The scrollable area of the virtualized list.
88
88
  */
89
- class VirtualizedList extends DataAriaLabelMixin(List) {
89
+ class VirtualizedList extends KeyToActionMixin(DataAriaLabelMixin(List)) {
90
90
  /**
91
91
  * The current virtual items being rendered.
92
92
  */
@@ -548,21 +548,22 @@ class VirtualizedList extends DataAriaLabelMixin(List) {
548
548
  }
549
549
  handleNavigationKeyDown(event) {
550
550
  var _a, _b, _c, _d;
551
- switch (event.key) {
552
- case KEYS.HOME: {
551
+ const action = this.getActionForKeyEvent(event);
552
+ switch (action) {
553
+ case ACTIONS.HOME: {
553
554
  // Move focus to the first item
554
555
  (_b = (_a = this.virtualizer) === null || _a === void 0 ? void 0 : _a.scrollToIndex) === null || _b === void 0 ? void 0 : _b.call(_a, 0, { align: 'start' });
555
556
  this.endOfScrollQueue.push(() => this.resetTabIndexes(0));
556
557
  break;
557
558
  }
558
- case KEYS.END: {
559
+ case ACTIONS.END: {
559
560
  // Move focus to the last item
560
561
  const selectedItem = this.virtualizerProps.count - 1;
561
562
  (_d = (_c = this.virtualizer) === null || _c === void 0 ? void 0 : _c.scrollToIndex) === null || _d === void 0 ? void 0 : _d.call(_c, selectedItem, { align: 'end' });
562
563
  this.endOfScrollQueue.push(() => this.resetTabIndexes(selectedItem));
563
564
  break;
564
565
  }
565
- case KEYS.ARROW_UP: {
566
+ case ACTIONS.UP: {
566
567
  this.atBottom = 're-evaluate';
567
568
  break;
568
569
  }