@momentum-design/components 0.92.1 → 0.92.3
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 +303 -297
- package/dist/browser/index.js.map +4 -4
- package/dist/components/menubar/menubar.component.d.ts +2 -1
- package/dist/components/menubar/menubar.component.js +23 -2
- package/dist/components/menusection/menusection.component.d.ts +9 -0
- package/dist/components/menusection/menusection.component.js +15 -1
- package/dist/components/menusection/menusection.constants.d.ts +4 -1
- package/dist/components/menusection/menusection.constants.js +4 -1
- package/dist/components/popover/popover.component.d.ts +35 -4
- package/dist/components/popover/popover.component.js +50 -5
- package/dist/components/popover/popover.constants.d.ts +3 -1
- package/dist/components/popover/popover.constants.js +3 -1
- package/dist/components/popover/popover.events.d.ts +12 -0
- package/dist/components/popover/popover.events.js +16 -0
- package/dist/components/popover/popover.utils.js +1 -1
- package/dist/components/select/select.component.d.ts +32 -37
- package/dist/components/select/select.component.js +132 -148
- package/dist/components/select/select.constants.d.ts +2 -1
- package/dist/components/select/select.constants.js +2 -1
- package/dist/components/select/select.styles.js +20 -17
- package/dist/components/select/select.types.d.ts +3 -1
- package/dist/components/selectlistbox/index.d.ts +7 -0
- package/dist/components/selectlistbox/index.js +4 -0
- package/dist/components/selectlistbox/selectlistbox.component.d.ts +18 -0
- package/dist/components/selectlistbox/selectlistbox.component.js +24 -0
- package/dist/components/selectlistbox/selectlistbox.constants.d.ts +2 -0
- package/dist/components/selectlistbox/selectlistbox.constants.js +3 -0
- package/dist/components/selectlistbox/selectlistbox.types.d.ts +3 -0
- package/dist/components/selectlistbox/selectlistbox.types.js +1 -0
- package/dist/custom-elements.json +1323 -1009
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/select/index.d.ts +2 -0
- package/dist/react/select/index.js +2 -0
- package/dist/react/selectlistbox/index.d.ts +15 -0
- package/dist/react/selectlistbox/index.js +24 -0
- package/package.json +1 -1
@@ -24,8 +24,9 @@ import { Component } from '../../models';
|
|
24
24
|
* @slot default - Contains the menu items and their associated popovers
|
25
25
|
*/
|
26
26
|
declare class MenuBar extends Component {
|
27
|
+
menusections: Array<HTMLElement>;
|
27
28
|
constructor();
|
28
|
-
connectedCallback(): void
|
29
|
+
connectedCallback(): Promise<void>;
|
29
30
|
/**
|
30
31
|
* Returns all menuitem elements, including those nested inside menusection.
|
31
32
|
*/
|
@@ -1,4 +1,14 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
1
10
|
import { html } from 'lit';
|
11
|
+
import { queryAssignedElements } from 'lit/decorators.js';
|
2
12
|
import { Component } from '../../models';
|
3
13
|
import { ROLE } from '../../utils/roles';
|
4
14
|
import { POPOVER_PLACEMENT } from '../popover/popover.constants';
|
@@ -37,10 +47,16 @@ class MenuBar extends Component {
|
|
37
47
|
super();
|
38
48
|
this.addEventListener('keydown', this.handleKeyDown);
|
39
49
|
}
|
40
|
-
connectedCallback() {
|
50
|
+
async connectedCallback() {
|
51
|
+
var _a;
|
41
52
|
super.connectedCallback();
|
42
53
|
this.role = ROLE.MENUBAR;
|
43
54
|
this.ariaOrientation = DEFAULTS.ORIENTATION;
|
55
|
+
await this.updateComplete;
|
56
|
+
// to make sure menusection dividers have the correct divider variant
|
57
|
+
(_a = this.menusections) === null || _a === void 0 ? void 0 : _a.forEach(section => {
|
58
|
+
section.setAttribute('divider-variant', 'gradient');
|
59
|
+
});
|
44
60
|
}
|
45
61
|
/**
|
46
62
|
* Returns all menuitem elements, including those nested inside menusection.
|
@@ -178,7 +194,8 @@ class MenuBar extends Component {
|
|
178
194
|
const grandParentTag = (_a = parent.parentElement) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase();
|
179
195
|
if (parentTag === MENUBAR_TAGNAME || parentTag === SIDENAV_TAGNAME)
|
180
196
|
return true;
|
181
|
-
if (parentTag === MENUSECTION_TAGNAME &&
|
197
|
+
if (parentTag === MENUSECTION_TAGNAME &&
|
198
|
+
(grandParentTag === MENUBAR_TAGNAME || grandParentTag === SIDENAV_TAGNAME)) {
|
182
199
|
return true;
|
183
200
|
}
|
184
201
|
return false;
|
@@ -280,4 +297,8 @@ class MenuBar extends Component {
|
|
280
297
|
}
|
281
298
|
}
|
282
299
|
MenuBar.styles = [...Component.styles, ...styles];
|
300
|
+
__decorate([
|
301
|
+
queryAssignedElements({ selector: 'mdc-menusection', flatten: true }),
|
302
|
+
__metadata("design:type", Array)
|
303
|
+
], MenuBar.prototype, "menusections", void 0);
|
283
304
|
export default MenuBar;
|
@@ -39,6 +39,15 @@ declare class MenuSection extends Component {
|
|
39
39
|
* This is useful for visually separating sections in the menu.
|
40
40
|
*/
|
41
41
|
showDivider: boolean;
|
42
|
+
/**
|
43
|
+
* The variant of the divider.
|
44
|
+
* Can be set to 'solid' or 'gradient'.
|
45
|
+
*
|
46
|
+
* Keep 'solid' if used in MenuPopovers, as it is the default style.
|
47
|
+
*
|
48
|
+
* @default 'solid'
|
49
|
+
*/
|
50
|
+
dividerVariant: "solid";
|
42
51
|
/**
|
43
52
|
* Shows or hides the section headers based on the expanded state of the side navigation.
|
44
53
|
*
|
@@ -15,6 +15,7 @@ import providerUtils from '../../utils/provider';
|
|
15
15
|
import { ROLE } from '../../utils/roles';
|
16
16
|
import SideNavigation from '../sidenavigation/sidenavigation.component';
|
17
17
|
import styles from './menusection.styles';
|
18
|
+
import { DEFAULTS } from './menusection.constants';
|
18
19
|
/**
|
19
20
|
* `mdc-menusection` is a container element used to group a set of menu items.
|
20
21
|
*
|
@@ -49,6 +50,15 @@ class MenuSection extends Component {
|
|
49
50
|
* This is useful for visually separating sections in the menu.
|
50
51
|
*/
|
51
52
|
this.showDivider = false;
|
53
|
+
/**
|
54
|
+
* The variant of the divider.
|
55
|
+
* Can be set to 'solid' or 'gradient'.
|
56
|
+
*
|
57
|
+
* Keep 'solid' if used in MenuPopovers, as it is the default style.
|
58
|
+
*
|
59
|
+
* @default 'solid'
|
60
|
+
*/
|
61
|
+
this.dividerVariant = DEFAULTS.DIVIDER_VARIANT;
|
52
62
|
/**
|
53
63
|
* Shows or hides the section headers based on the expanded state of the side navigation.
|
54
64
|
*
|
@@ -97,7 +107,7 @@ class MenuSection extends Component {
|
|
97
107
|
return html `
|
98
108
|
${!this.hideHeaderText ? this.renderHeader() : null}
|
99
109
|
<slot></slot>
|
100
|
-
${this.showDivider ? html `<mdc-divider variant="
|
110
|
+
${this.showDivider ? html `<mdc-divider variant="${this.dividerVariant}" part="divider"></mdc-divider>` : null}
|
101
111
|
`;
|
102
112
|
}
|
103
113
|
}
|
@@ -118,6 +128,10 @@ __decorate([
|
|
118
128
|
property({ type: Boolean, reflect: true, attribute: 'show-divider' }),
|
119
129
|
__metadata("design:type", Object)
|
120
130
|
], MenuSection.prototype, "showDivider", void 0);
|
131
|
+
__decorate([
|
132
|
+
property({ type: String, reflect: true, attribute: 'divider-variant' }),
|
133
|
+
__metadata("design:type", Object)
|
134
|
+
], MenuSection.prototype, "dividerVariant", void 0);
|
121
135
|
__decorate([
|
122
136
|
property({ type: Boolean, reflect: true, attribute: 'hide-header-text' }),
|
123
137
|
__metadata("design:type", Object)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
|
-
import { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
|
3
|
+
import type { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
|
4
4
|
declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & typeof Component;
|
5
5
|
/**
|
6
6
|
* Popover component is a lightweight floating UI element that displays additional content when triggered.
|
@@ -88,10 +88,41 @@ declare class Popover extends Popover_base {
|
|
88
88
|
*/
|
89
89
|
offset: number;
|
90
90
|
/**
|
91
|
-
*
|
92
|
-
*
|
91
|
+
* This describes the clipping element(s) or area that overflow will be checked relative to.
|
92
|
+
* The default is 'clippingAncestors', which are the overflow ancestors which will cause the
|
93
|
+
* element to be clipped.
|
94
|
+
*
|
95
|
+
* Possible values:
|
96
|
+
* - 'clippingAncestors'
|
97
|
+
* - any css selector
|
98
|
+
*
|
99
|
+
* @default 'clippingAncestors'
|
100
|
+
*
|
101
|
+
* @see [Floating UI - boundary](https://floating-ui.com/docs/detectOverflow#boundary)
|
102
|
+
*/
|
103
|
+
boundary: 'clippingAncestors' | string;
|
104
|
+
/**
|
105
|
+
* This describes the root boundary that the element will be checked for overflow relative to.
|
106
|
+
* The default is 'viewport', which is the area of the page the user can see on the screen.
|
107
|
+
*
|
108
|
+
* The other string option is 'document', which is the entire page outside the viewport.
|
109
|
+
*
|
110
|
+
* @default 'viewport'
|
111
|
+
*
|
112
|
+
* @see [Floating UI - rootBoundary](https://floating-ui.com/docs/detectOverflow#rootboundary)
|
113
|
+
*/
|
114
|
+
boundaryRoot: 'viewport' | 'document';
|
115
|
+
/**
|
116
|
+
* Virtual padding around the boundary to check for overflow.
|
117
|
+
* So the popover will not be placed on top of the edge of the boundary.
|
118
|
+
*
|
119
|
+
* Default works well for most cases, but you can set this to customise it when necessary.
|
120
|
+
*
|
121
|
+
* @default undefined
|
122
|
+
*
|
123
|
+
* @see [Floating UI - padding](https://floating-ui.com/docs/detectOverflow#padding)
|
93
124
|
*/
|
94
|
-
boundaryPadding: number;
|
125
|
+
boundaryPadding: undefined | number;
|
95
126
|
/**
|
96
127
|
* Determines whether the focus trap is enabled.
|
97
128
|
* If true, focus will be restricted to the content within this component.
|
@@ -107,10 +107,30 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
107
107
|
*/
|
108
108
|
this.offset = DEFAULTS.OFFSET;
|
109
109
|
/**
|
110
|
-
*
|
111
|
-
*
|
110
|
+
* This describes the clipping element(s) or area that overflow will be checked relative to.
|
111
|
+
* The default is 'clippingAncestors', which are the overflow ancestors which will cause the
|
112
|
+
* element to be clipped.
|
113
|
+
*
|
114
|
+
* Possible values:
|
115
|
+
* - 'clippingAncestors'
|
116
|
+
* - any css selector
|
117
|
+
*
|
118
|
+
* @default 'clippingAncestors'
|
119
|
+
*
|
120
|
+
* @see [Floating UI - boundary](https://floating-ui.com/docs/detectOverflow#boundary)
|
121
|
+
*/
|
122
|
+
this.boundary = DEFAULTS.BOUNDARY;
|
123
|
+
/**
|
124
|
+
* This describes the root boundary that the element will be checked for overflow relative to.
|
125
|
+
* The default is 'viewport', which is the area of the page the user can see on the screen.
|
126
|
+
*
|
127
|
+
* The other string option is 'document', which is the entire page outside the viewport.
|
128
|
+
*
|
129
|
+
* @default 'viewport'
|
130
|
+
*
|
131
|
+
* @see [Floating UI - rootBoundary](https://floating-ui.com/docs/detectOverflow#rootboundary)
|
112
132
|
*/
|
113
|
-
this.
|
133
|
+
this.boundaryRoot = DEFAULTS.BOUNDARY_ROOT;
|
114
134
|
/**
|
115
135
|
* Determines whether the focus trap is enabled.
|
116
136
|
* If true, focus will be restricted to the content within this component.
|
@@ -262,6 +282,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
262
282
|
const clickedOnBackdrop = this.backdropElement ? path.includes(this.backdropElement) : false;
|
263
283
|
if (!insidePopoverClick || clickedOnBackdrop) {
|
264
284
|
this.hidePopover();
|
285
|
+
PopoverEventManager.onClickOutside(this);
|
265
286
|
}
|
266
287
|
};
|
267
288
|
/**
|
@@ -281,6 +302,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
281
302
|
}
|
282
303
|
event.preventDefault();
|
283
304
|
this.hidePopover();
|
305
|
+
PopoverEventManager.onEscapeKeyPressed(this);
|
284
306
|
};
|
285
307
|
/**
|
286
308
|
* Handles the popover focus out event.
|
@@ -472,6 +494,13 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
472
494
|
}
|
473
495
|
async updated(changedProperties) {
|
474
496
|
super.updated(changedProperties);
|
497
|
+
// If the role is changed to an empty string, set it to null
|
498
|
+
// to avoid setting an invalid role on the popover element.
|
499
|
+
if (changedProperties.has('role')) {
|
500
|
+
if (this.role === '') {
|
501
|
+
this.role = null;
|
502
|
+
}
|
503
|
+
}
|
475
504
|
if (changedProperties.has('visible')) {
|
476
505
|
const oldValue = changedProperties.get('visible') || false;
|
477
506
|
await this.isOpenUpdated(oldValue, this.visible);
|
@@ -622,7 +651,15 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
622
651
|
positionPopover() {
|
623
652
|
if (!this.triggerElement)
|
624
653
|
return;
|
625
|
-
const middleware = [
|
654
|
+
const middleware = [
|
655
|
+
shift({
|
656
|
+
boundary: !this.boundary || this.boundary === 'clippingAncestors'
|
657
|
+
? 'clippingAncestors'
|
658
|
+
: Array.from(document.querySelectorAll(this.boundary)),
|
659
|
+
rootBoundary: this.boundaryRoot,
|
660
|
+
padding: this.boundaryPadding,
|
661
|
+
}),
|
662
|
+
];
|
626
663
|
let popoverOffset = this.offset;
|
627
664
|
if (this.flip) {
|
628
665
|
middleware.push(flip());
|
@@ -730,9 +767,17 @@ __decorate([
|
|
730
767
|
property({ type: Number, reflect: true }),
|
731
768
|
__metadata("design:type", Number)
|
732
769
|
], Popover.prototype, "offset", void 0);
|
770
|
+
__decorate([
|
771
|
+
property({ type: String, reflect: true, attribute: 'boundary' }),
|
772
|
+
__metadata("design:type", String)
|
773
|
+
], Popover.prototype, "boundary", void 0);
|
774
|
+
__decorate([
|
775
|
+
property({ type: String, reflect: true, attribute: 'boundary-root' }),
|
776
|
+
__metadata("design:type", String)
|
777
|
+
], Popover.prototype, "boundaryRoot", void 0);
|
733
778
|
__decorate([
|
734
779
|
property({ type: Number, reflect: true, attribute: 'boundary-padding' }),
|
735
|
-
__metadata("design:type",
|
780
|
+
__metadata("design:type", Object)
|
736
781
|
], Popover.prototype, "boundaryPadding", void 0);
|
737
782
|
__decorate([
|
738
783
|
property({ type: Boolean, reflect: true, attribute: 'focus-trap' }),
|
@@ -28,7 +28,9 @@ declare const DEFAULTS: {
|
|
28
28
|
readonly TRIGGER: "click";
|
29
29
|
readonly COLOR: "tonal";
|
30
30
|
readonly OFFSET: 4;
|
31
|
-
readonly
|
31
|
+
readonly BOUNDARY: "clippingAncestors";
|
32
|
+
readonly BOUNDARY_ROOT: "viewport";
|
33
|
+
readonly BOUNDARY_PADDING: 0;
|
32
34
|
readonly VISIBLE: false;
|
33
35
|
readonly ARROW: false;
|
34
36
|
readonly CLOSE_BUTTON: false;
|
@@ -31,4 +31,16 @@ export declare class PopoverEventManager {
|
|
31
31
|
* @param instance - The popover instance.
|
32
32
|
*/
|
33
33
|
static onDestroyedPopover(instance: Popover): void;
|
34
|
+
/**
|
35
|
+
* Custom event that is fired when the popover is closed by pressing the Escape key.
|
36
|
+
*
|
37
|
+
* @param instance - The popover instance.
|
38
|
+
*/
|
39
|
+
static onEscapeKeyPressed(instance: Popover): void;
|
40
|
+
/**
|
41
|
+
* Custom event that is fired when the popover is closed by clicking outside of it.
|
42
|
+
*
|
43
|
+
* @param instance - The popover instance.
|
44
|
+
*/
|
45
|
+
static onClickOutside(instance: Popover): void;
|
34
46
|
}
|
@@ -44,4 +44,20 @@ export class PopoverEventManager {
|
|
44
44
|
static onDestroyedPopover(instance) {
|
45
45
|
this.dispatchPopoverEvent('destroyed', instance);
|
46
46
|
}
|
47
|
+
/**
|
48
|
+
* Custom event that is fired when the popover is closed by pressing the Escape key.
|
49
|
+
*
|
50
|
+
* @param instance - The popover instance.
|
51
|
+
*/
|
52
|
+
static onEscapeKeyPressed(instance) {
|
53
|
+
this.dispatchPopoverEvent('closebyescape', instance);
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Custom event that is fired when the popover is closed by clicking outside of it.
|
57
|
+
*
|
58
|
+
* @param instance - The popover instance.
|
59
|
+
*/
|
60
|
+
static onClickOutside(instance) {
|
61
|
+
this.dispatchPopoverEvent('closebyoutsideclick', instance);
|
62
|
+
}
|
47
63
|
}
|
@@ -96,7 +96,7 @@ export class PopoverUtils {
|
|
96
96
|
else {
|
97
97
|
this.popover.removeAttribute('aria-modal');
|
98
98
|
}
|
99
|
-
if (this.popover.interactive) {
|
99
|
+
if (this.popover.interactive && this.popover.role) {
|
100
100
|
if (!this.popover.ariaLabel) {
|
101
101
|
this.popover.ariaLabel =
|
102
102
|
((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel) || ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent) || '';
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import type { PropertyValues
|
1
|
+
import type { PropertyValues } from 'lit';
|
2
2
|
import { CSSResult } from 'lit';
|
3
3
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
4
4
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
5
5
|
import type { IconNames } from '../icon/icon.types';
|
6
|
+
import type { Placement } from './select.types';
|
6
7
|
declare const Select_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
7
8
|
/**
|
8
9
|
* The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
|
@@ -12,6 +13,8 @@ declare const Select_base: import("../../utils/mixins/index.types").Constructor<
|
|
12
13
|
*
|
13
14
|
* To set a default option, use the `selected` attribute on the `mdc-option` element.
|
14
15
|
*
|
16
|
+
* **Note:** Make sure to add `mdc-selectlistbox` as a child of `mdc-select` and wrap options/optgroup in it to ensure proper accessibility functionality. Read more about it in SelectListBox documentation.
|
17
|
+
*
|
15
18
|
* @dependency mdc-button
|
16
19
|
* @dependency mdc-icon
|
17
20
|
* @dependency mdc-popover
|
@@ -44,8 +47,20 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
44
47
|
* @default auto
|
45
48
|
*/
|
46
49
|
height: string;
|
50
|
+
/**
|
51
|
+
* The placeholder text which will be shown on the text if provided.
|
52
|
+
*/
|
53
|
+
placement: Placement;
|
54
|
+
/**
|
55
|
+
* Indicates whether the select is soft disabled.
|
56
|
+
* When set to `true`, the select appears visually disabled but still allows
|
57
|
+
* focus.
|
58
|
+
*
|
59
|
+
* @default undefined
|
60
|
+
*/
|
61
|
+
softDisabled?: boolean;
|
47
62
|
/** @internal */
|
48
|
-
|
63
|
+
slottedListboxes: Array<HTMLElement>;
|
49
64
|
/** @internal */
|
50
65
|
private baseIconName;
|
51
66
|
/** @internal */
|
@@ -56,21 +71,26 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
56
71
|
selectedValue: string;
|
57
72
|
/** @internal */
|
58
73
|
displayPopover: boolean;
|
59
|
-
/** @internal */
|
60
|
-
activeDescendant: string;
|
61
74
|
/**
|
62
75
|
* @internal
|
63
76
|
* The native select element
|
64
77
|
*/
|
65
78
|
inputElement: HTMLInputElement;
|
66
79
|
/**
|
67
|
-
*
|
80
|
+
* Modifies the listbox wrapper to ensure it has the correct attributes
|
81
|
+
* and IDs for accessibility.
|
82
|
+
*
|
83
|
+
* Once [ariaOwnsElements](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/ariaOwnsElements) is supported in browsers,
|
84
|
+
* this an be removed and mdc-option can be used directly in the select component with a listbox in a different
|
85
|
+
* shadow root and aria-owns attribute to connect them.
|
86
|
+
*/
|
87
|
+
private modifyListBoxWrapper;
|
88
|
+
/**
|
89
|
+
* A helper function which returns a flattened array of all valid options from within the slotted listbox.
|
68
90
|
* It takes care of the edge cases where the option is either a direct child or a
|
69
91
|
* child of an option group.
|
70
92
|
*/
|
71
93
|
private getAllValidOptions;
|
72
|
-
private handlePopoverOpen;
|
73
|
-
private handlePopoverClose;
|
74
94
|
/**
|
75
95
|
* Updates the tabindex and selected attribute of the options.
|
76
96
|
* If selectedOption is provided, it will be set as the selected option.
|
@@ -119,6 +139,7 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
119
139
|
* @param event - The keyboard event.
|
120
140
|
*/
|
121
141
|
private handlePopoverOnOpen;
|
142
|
+
private handleClickCombobox;
|
122
143
|
/**
|
123
144
|
* Handles the keydown event on the select element when the popover is closed.
|
124
145
|
* The options are as follows:
|
@@ -128,7 +149,7 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
128
149
|
* - END: Opens the popover and sets focus and tabindex on the last option.
|
129
150
|
* @param event - The keyboard event.
|
130
151
|
*/
|
131
|
-
private
|
152
|
+
private handleKeydownCombobox;
|
132
153
|
/**
|
133
154
|
* Handles the navigation of options when the user presses
|
134
155
|
* ArrowUp, ArrowDown, PageUp, or PageDown keys.
|
@@ -149,8 +170,6 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
149
170
|
* @returns The new index to focus on, or -1 if no movement is possible.
|
150
171
|
*/
|
151
172
|
private getNewIndexBasedOnKey;
|
152
|
-
private updateActivedescendant;
|
153
|
-
private resetActivedescendant;
|
154
173
|
private setFocusAndTabIndex;
|
155
174
|
private openPopover;
|
156
175
|
private closePopover;
|
@@ -159,34 +178,10 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
159
178
|
* If an option is selected, use that as the value.
|
160
179
|
* If not, use the placeholder if it exists, otherwise use the first option.
|
161
180
|
*/
|
162
|
-
firstUpdated(): void
|
163
|
-
/**
|
164
|
-
* Generates the native select element.
|
165
|
-
* The native select element is not rendered directly and is not visible on the UI.
|
166
|
-
* It's rendered only on the DOM for accessibility purposes.
|
167
|
-
* Instead, the overlay uses the native select element to generate the list of options.
|
168
|
-
* @returns A TemplateResult representing the native select element.
|
169
|
-
*/
|
170
|
-
private getNativeSelect;
|
171
|
-
/**
|
172
|
-
* This method maps over all valid options and constructs their corresponding
|
173
|
-
* HTML `<option>` elements. The attributes such as `value`, `label`, `disabled`,
|
174
|
-
* and `selected` are extracted from the respective option elements.
|
175
|
-
* If the attribute is not present, a default value or fallback is used.
|
176
|
-
* The content of each `<option>` is set to the text content of the option element.
|
177
|
-
* @returns An array of `TemplateResult` representing the option elements.
|
178
|
-
*/
|
179
|
-
private getOptionsContentFromSlot;
|
180
|
-
/**
|
181
|
-
* Generates the content for the popover associated with the select component.
|
182
|
-
* If the component is disabled or readonly, returns `nothing`.
|
183
|
-
* Otherwise, returns a `TemplateResult` that renders a popover with various configurations
|
184
|
-
* such as visibility, interaction, and event handlers.
|
185
|
-
* The popover acts as a dropdown list with options, allowing user interaction.
|
186
|
-
*/
|
187
|
-
private getPopoverContent;
|
181
|
+
firstUpdated(): Promise<void>;
|
188
182
|
updated(changedProperties: PropertyValues): void;
|
189
|
-
|
183
|
+
private handleOnChange;
|
184
|
+
render(): import("lit-html").TemplateResult<1>;
|
190
185
|
static styles: Array<CSSResult>;
|
191
186
|
}
|
192
187
|
export default Select;
|