@momentum-design/components 0.129.43 → 0.129.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +394 -394
- package/dist/browser/index.js.map +4 -4
- package/dist/components/accordionbutton/accordionbutton.component.d.ts +1 -1
- package/dist/components/accordionbutton/accordionbutton.component.js +4 -3
- package/dist/components/buttonsimple/buttonsimple.component.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.component.js +8 -6
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.js +7 -5
- package/dist/components/cardradio/cardradio.component.d.ts +1 -1
- package/dist/components/cardradio/cardradio.component.js +8 -7
- package/dist/components/checkbox/checkbox.component.d.ts +2 -1
- package/dist/components/checkbox/checkbox.component.js +7 -4
- package/dist/components/combobox/combobox.component.d.ts +1 -1
- package/dist/components/combobox/combobox.component.js +11 -11
- package/dist/components/dialog/dialog.component.d.ts +1 -1
- package/dist/components/dialog/dialog.component.js +1 -1
- package/dist/components/input/input.component.d.ts +1 -1
- package/dist/components/input/input.component.js +3 -3
- package/dist/components/list/list.component.d.ts +1 -1
- package/dist/components/listbox/listbox.component.d.ts +1 -1
- package/dist/components/listitem/listitem.component.d.ts +1 -1
- package/dist/components/listitem/listitem.component.js +11 -5
- package/dist/components/menubar/menubar.component.d.ts +2 -2
- package/dist/components/menubar/menubar.component.js +10 -20
- package/dist/components/menuitem/menuitem.component.js +3 -3
- package/dist/components/menupopover/menupopover.component.d.ts +0 -10
- package/dist/components/menupopover/menupopover.component.js +15 -36
- package/dist/components/popover/popover.component.d.ts +1 -1
- package/dist/components/popover/popover.component.js +4 -3
- package/dist/components/radio/radio.component.d.ts +1 -1
- package/dist/components/radio/radio.component.js +8 -7
- package/dist/components/searchfield/searchfield.component.d.ts +3 -0
- package/dist/components/searchfield/searchfield.component.js +18 -5
- package/dist/components/searchpopover/searchpopover.component.js +3 -4
- package/dist/components/select/select.component.d.ts +1 -1
- package/dist/components/select/select.component.js +9 -8
- package/dist/components/slider/slider.component.d.ts +2 -1
- package/dist/components/slider/slider.component.js +4 -3
- package/dist/components/stepperitem/stepperitem.component.d.ts +1 -1
- package/dist/components/stepperitem/stepperitem.component.js +8 -6
- package/dist/components/textarea/textarea.component.d.ts +1 -1
- package/dist/components/textarea/textarea.component.js +5 -4
- package/dist/components/toggle/toggle.component.d.ts +1 -1
- package/dist/components/toggle/toggle.component.js +5 -4
- package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.component.js +7 -6
- package/dist/custom-elements.json +1276 -4245
- package/dist/react/checkbox/index.d.ts +1 -0
- package/dist/react/checkbox/index.js +1 -0
- package/dist/utils/dom.d.ts +83 -0
- package/dist/utils/dom.js +164 -0
- package/dist/utils/mixins/KeyToActionMixin.d.ts +69 -0
- package/dist/utils/mixins/KeyToActionMixin.js +92 -0
- package/dist/utils/mixins/ListNavigationMixin.d.ts +2 -1
- package/dist/utils/mixins/ListNavigationMixin.js +10 -33
- package/dist/utils/mixins/{FocusTrapMixin.d.ts → focus/FocusTrapMixin.d.ts} +2 -2
- package/dist/utils/mixins/focus/FocusTrapMixin.js +190 -0
- package/dist/utils/mixins/focus/FocusTrapStack.d.ts +32 -0
- package/dist/utils/mixins/focus/FocusTrapStack.js +69 -0
- package/package.json +1 -1
- package/dist/utils/mixins/FocusTrapMixin.js +0 -418
|
@@ -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 {
|
|
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
|
-
|
|
382
|
+
const action = this.getActionForKeyEvent(event);
|
|
383
|
+
if (action === ACTIONS.UP) {
|
|
383
384
|
newRows = Math.max(1, currentRows - 1);
|
|
384
385
|
}
|
|
385
|
-
else if (
|
|
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
|
-
|
|
176
|
+
const action = this.getActionForKeyEvent(event);
|
|
177
|
+
if ((this.readonly || this.softDisabled) && action === ACTIONS.SPACE) {
|
|
177
178
|
event.preventDefault();
|
|
178
179
|
}
|
|
179
|
-
if (
|
|
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
|
-
|
|
552
|
-
|
|
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
|
|
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
|
|
566
|
+
case ACTIONS.UP: {
|
|
566
567
|
this.atBottom = 're-evaluate';
|
|
567
568
|
break;
|
|
568
569
|
}
|