@material/web 2.4.2-nightly.2fe7e22.0 → 2.4.2-nightly.5088d91.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.
- package/button/internal/_touch-target.scss +1 -1
- package/button/internal/button.d.ts +0 -4
- package/button/internal/button.js.map +1 -1
- package/button/internal/shared-styles.css +1 -1
- package/button/internal/shared-styles.css.map +1 -1
- package/button/internal/shared-styles.cssresult.js +1 -1
- package/button/internal/shared-styles.cssresult.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +2 -2
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/internal/chip.d.ts +2 -0
- package/custom-elements.json +41872 -0
- package/icon/internal/icon.d.ts +1 -1
- package/icon/internal/icon.js +1 -1
- package/icon/internal/icon.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +0 -4
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/internal/aria/aria.d.ts +1 -1
- package/internal/events/dispatch-hooks.js +31 -35
- package/internal/events/dispatch-hooks.js.map +1 -1
- package/labs/behaviors/form-associated.d.ts +0 -22
- package/labs/behaviors/form-associated.js +0 -11
- package/labs/behaviors/form-associated.js.map +1 -1
- package/labs/gb/components/button/_button-tokens.scss +30 -30
- package/labs/gb/components/button/button.css +1 -1
- package/labs/gb/components/button/button.css.map +1 -1
- package/labs/gb/components/button/button.cssresult.js +1 -1
- package/labs/gb/components/button/button.cssresult.js.map +1 -1
- package/labs/gb/components/button/button.d.ts +1 -16
- package/labs/gb/components/button/button.js +10 -33
- package/labs/gb/components/button/button.js.map +1 -1
- package/labs/gb/components/button/button.scss +25 -25
- package/labs/gb/components/button/md-button.d.ts +10 -2
- package/labs/gb/components/button/md-button.js +92 -11
- package/labs/gb/components/button/md-button.js.map +1 -1
- package/labs/gb/components/card/card.d.ts +1 -11
- package/labs/gb/components/card/card.js +6 -13
- package/labs/gb/components/card/card.js.map +1 -1
- package/labs/gb/components/card/md-card.d.ts +9 -1
- package/labs/gb/components/card/md-card.js +85 -8
- package/labs/gb/components/card/md-card.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.css +1 -1
- package/labs/gb/components/checkbox/checkbox.css.map +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.d.ts +1 -16
- package/labs/gb/components/checkbox/checkbox.js +8 -31
- package/labs/gb/components/checkbox/checkbox.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.scss +13 -13
- package/labs/gb/components/checkbox/md-checkbox.d.ts +4 -4
- package/labs/gb/components/checkbox/md-checkbox.js +10 -10
- package/labs/gb/components/checkbox/md-checkbox.js.map +1 -1
- package/labs/gb/components/divider/divider.d.ts +1 -11
- package/labs/gb/components/divider/divider.js +4 -11
- package/labs/gb/components/divider/divider.js.map +1 -1
- package/labs/gb/components/fab/fab.d.ts +1 -16
- package/labs/gb/components/fab/fab.js +8 -31
- package/labs/gb/components/fab/fab.js.map +1 -1
- package/labs/gb/components/fab/md-fab.js +4 -4
- package/labs/gb/components/fab/md-fab.js.map +1 -1
- package/labs/gb/components/focus/focus-ring.js +1 -1
- package/labs/gb/components/focus/focus-ring.js.map +1 -1
- package/labs/gb/components/iconbutton/_icon-button-tokens.scss +202 -0
- package/labs/gb/components/iconbutton/icon-button.css +4 -0
- package/labs/gb/components/iconbutton/icon-button.css.map +1 -0
- package/labs/gb/components/iconbutton/icon-button.cssresult.d.ts +3 -0
- package/labs/gb/components/iconbutton/icon-button.cssresult.js +14 -0
- package/labs/gb/components/iconbutton/icon-button.cssresult.js.map +1 -0
- package/labs/gb/components/iconbutton/icon-button.d.ts +97 -0
- package/labs/gb/components/iconbutton/icon-button.js +122 -0
- package/labs/gb/components/iconbutton/icon-button.js.map +1 -0
- package/labs/gb/components/iconbutton/icon-button.scss +153 -0
- package/labs/gb/components/iconbutton/md-icon-button.d.ts +73 -0
- package/labs/gb/components/iconbutton/md-icon-button.js +176 -0
- package/labs/gb/components/iconbutton/md-icon-button.js.map +1 -0
- package/labs/gb/components/list/_list-tokens.scss +102 -0
- package/labs/gb/components/list/list.css +4 -0
- package/labs/gb/components/list/list.css.map +1 -0
- package/labs/gb/components/list/list.cssresult.d.ts +3 -0
- package/labs/gb/components/list/list.cssresult.js +14 -0
- package/labs/gb/components/list/list.cssresult.js.map +1 -0
- package/labs/gb/components/list/list.d.ts +103 -0
- package/labs/gb/components/list/list.js +109 -0
- package/labs/gb/components/list/list.js.map +1 -0
- package/labs/gb/components/list/list.scss +212 -0
- package/labs/gb/components/list/md-list-item.d.ts +44 -0
- package/labs/gb/components/list/md-list-item.js +122 -0
- package/labs/gb/components/list/md-list-item.js.map +1 -0
- package/labs/gb/components/list/md-list.d.ts +26 -0
- package/labs/gb/components/list/md-list.js +51 -0
- package/labs/gb/components/list/md-list.js.map +1 -0
- package/labs/gb/components/menu/_menu-tokens.scss +128 -0
- package/labs/gb/components/menu/md-menu-group.d.ts +26 -0
- package/labs/gb/components/menu/md-menu-group.js +65 -0
- package/labs/gb/components/menu/md-menu-group.js.map +1 -0
- package/labs/gb/components/menu/md-menu-item.d.ts +30 -0
- package/labs/gb/components/menu/md-menu-item.js +165 -0
- package/labs/gb/components/menu/md-menu-item.js.map +1 -0
- package/labs/gb/components/menu/md-menu.d.ts +28 -0
- package/labs/gb/components/menu/md-menu.js +141 -0
- package/labs/gb/components/menu/md-menu.js.map +1 -0
- package/labs/gb/components/menu/menu.css +4 -0
- package/labs/gb/components/menu/menu.css.map +1 -0
- package/labs/gb/components/menu/menu.cssresult.d.ts +3 -0
- package/labs/gb/components/menu/menu.cssresult.js +14 -0
- package/labs/gb/components/menu/menu.cssresult.js.map +1 -0
- package/labs/gb/components/menu/menu.d.ts +117 -0
- package/labs/gb/components/menu/menu.js +107 -0
- package/labs/gb/components/menu/menu.js.map +1 -0
- package/labs/gb/components/menu/menu.scss +171 -0
- package/labs/gb/components/radio/md-radio.d.ts +4 -4
- package/labs/gb/components/radio/md-radio.js +11 -11
- package/labs/gb/components/radio/md-radio.js.map +1 -1
- package/labs/gb/components/radio/radio.css +1 -1
- package/labs/gb/components/radio/radio.css.map +1 -1
- package/labs/gb/components/radio/radio.cssresult.js +1 -1
- package/labs/gb/components/radio/radio.cssresult.js.map +1 -1
- package/labs/gb/components/radio/radio.d.ts +1 -14
- package/labs/gb/components/radio/radio.js +8 -23
- package/labs/gb/components/radio/radio.js.map +1 -1
- package/labs/gb/components/radio/radio.scss +4 -5
- package/labs/gb/components/ripple/ripple.d.ts +1 -10
- package/labs/gb/components/ripple/ripple.js +28 -32
- package/labs/gb/components/ripple/ripple.js.map +1 -1
- package/labs/gb/components/shared/directives.d.ts +93 -0
- package/labs/gb/components/shared/directives.js +111 -0
- package/labs/gb/components/shared/directives.js.map +1 -0
- package/labs/gb/components/shared/has-slotted.d.ts +10 -0
- package/labs/gb/components/shared/has-slotted.js +19 -0
- package/labs/gb/components/shared/has-slotted.js.map +1 -0
- package/labs/gb/components/shared/pseudo-classes.d.ts +7 -0
- package/labs/gb/components/shared/pseudo-classes.js +9 -0
- package/labs/gb/components/shared/pseudo-classes.js.map +1 -1
- package/labs/gb/components/splitbutton/_split-button-tokens.scss +135 -0
- package/labs/gb/components/splitbutton/md-split-button.d.ts +26 -0
- package/labs/gb/components/splitbutton/md-split-button.js +119 -0
- package/labs/gb/components/splitbutton/md-split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.css +4 -0
- package/labs/gb/components/splitbutton/split-button.css.map +1 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.d.ts +3 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js +14 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.d.ts +47 -0
- package/labs/gb/components/splitbutton/split-button.js +46 -0
- package/labs/gb/components/splitbutton/split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.scss +164 -0
- package/labs/gb/components/switch/_switch-tokens.scss +56 -0
- package/labs/gb/components/switch/md-switch.d.ts +66 -0
- package/labs/gb/components/switch/md-switch.js +162 -0
- package/labs/gb/components/switch/md-switch.js.map +1 -0
- package/labs/gb/components/switch/switch.css +4 -0
- package/labs/gb/components/switch/switch.css.map +1 -0
- package/labs/gb/components/switch/switch.cssresult.d.ts +3 -0
- package/labs/gb/components/switch/switch.cssresult.js +14 -0
- package/labs/gb/components/switch/switch.cssresult.js.map +1 -0
- package/labs/gb/components/switch/switch.d.ts +54 -0
- package/labs/gb/components/switch/switch.js +85 -0
- package/labs/gb/components/switch/switch.js.map +1 -0
- package/labs/gb/components/switch/switch.scss +109 -0
- package/labs/gb/styles/icon/md-icon.css +1 -1
- package/labs/gb/styles/icon/md-icon.css.map +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js.map +1 -1
- package/labs/gb/styles/icon/md-icon.d.ts +20 -0
- package/labs/gb/styles/icon/md-icon.js +24 -0
- package/labs/gb/styles/icon/md-icon.js.map +1 -0
- package/labs/gb/styles/icon/md-icon.scss +2 -1
- package/labs/gb/styles/m3.css +5 -2
- package/labs/gb/styles/m3.css.map +1 -1
- package/labs/gb/styles/m3.cssresult.js +5 -2
- package/labs/gb/styles/m3.cssresult.js.map +1 -1
- package/labs/gb/styles/m3.scss +1 -0
- package/labs/gb/styles/space/md-space-tokens.css +4 -0
- package/labs/gb/styles/space/md-space-tokens.css.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.d.ts +3 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js +14 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.scss +28 -0
- package/labs/gb/styles/tailwind.css +4 -0
- package/labs/gb/styles/tailwind.css.map +1 -0
- package/labs/gb/styles/tailwind.cssresult.d.ts +3 -0
- package/labs/gb/styles/tailwind.cssresult.js +14 -0
- package/labs/gb/styles/tailwind.cssresult.js.map +1 -0
- package/labs/gb/styles/tailwind.scss +349 -0
- package/labs/gb/styles/typography/internal/_typography-tokens.scss +85 -16
- package/labs/gb/styles/typography/md-typography-tokens.css +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.css.map +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +6 -1
- package/list/internal/listitem/list-item.js +4 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +2 -0
- package/menu/internal/submenu/sub-menu.d.ts +5 -1
- package/menu/internal/submenu/sub-menu.js +5 -1
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/package.json +26 -4
- package/radio/internal/radio.d.ts +0 -2
- package/radio/internal/radio.js.map +1 -1
- package/select/internal/select.d.ts +2 -2
- package/select/internal/select.js.map +1 -1
- package/select/internal/selectoption/select-option.d.ts +2 -0
- package/slider/internal/slider.d.ts +0 -2
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/_switch.scss +1 -0
- package/switch/internal/switch-styles.css +1 -1
- package/switch/internal/switch-styles.css.map +1 -1
- package/switch/internal/switch-styles.cssresult.js +1 -1
- package/switch/internal/switch-styles.cssresult.js.map +1 -1
- package/switch/internal/switch.d.ts +0 -2
- package/switch/internal/switch.js.map +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { mixinDelegatesAria } from '../../../../internal/aria/delegate.js';
|
|
10
|
+
import { internals, mixinElementInternals, } from '../../../behaviors/element-internals.js';
|
|
11
|
+
import { hasSlotted } from '../shared/has-slotted.js';
|
|
12
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
13
|
+
// import {styles as focusRingStyles} from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
14
|
+
import rippleStyles from '../ripple/ripple.css' with { type: 'css' }; // github-only
|
|
15
|
+
// import {styles as rippleStyles} from '../ripple/ripple.cssresult.js'; // google3-only
|
|
16
|
+
import listStyles from './list.css' with { type: 'css' }; // github-only
|
|
17
|
+
// import {styles as listStyles} from './list.cssresult.js'; // google3-only
|
|
18
|
+
import { listItem } from './list.js';
|
|
19
|
+
// Separate variable needed for closure.
|
|
20
|
+
const baseClass = mixinDelegatesAria(mixinElementInternals(LitElement));
|
|
21
|
+
/**
|
|
22
|
+
* A Material Design list item component.
|
|
23
|
+
*/
|
|
24
|
+
let ListItem = class ListItem extends baseClass {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
/**
|
|
28
|
+
* Whether the list item is selected.
|
|
29
|
+
*/
|
|
30
|
+
this.checked = false;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the list item is disabled.
|
|
33
|
+
*/
|
|
34
|
+
this.disabled = false;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the list item is non-interactive.
|
|
37
|
+
*/
|
|
38
|
+
this.nonInteractive = false;
|
|
39
|
+
this[internals].role = 'listitem';
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const state = {
|
|
43
|
+
checked: this.checked,
|
|
44
|
+
disabled: this.disabled,
|
|
45
|
+
static: this.nonInteractive,
|
|
46
|
+
};
|
|
47
|
+
if (this.nonInteractive) {
|
|
48
|
+
return html `<div part="list-item" class="${listItem(state)}"
|
|
49
|
+
>${this.renderContent()}</div
|
|
50
|
+
>`;
|
|
51
|
+
}
|
|
52
|
+
// Needed for closure conformance
|
|
53
|
+
const { ariaLabel } = this;
|
|
54
|
+
return html `<button
|
|
55
|
+
part="list-item"
|
|
56
|
+
class="${listItem(state)}"
|
|
57
|
+
?disabled=${this.disabled}
|
|
58
|
+
aria-label=${ariaLabel || nothing}>
|
|
59
|
+
${this.renderContent()}
|
|
60
|
+
</button>`;
|
|
61
|
+
}
|
|
62
|
+
renderContent() {
|
|
63
|
+
return html `
|
|
64
|
+
<span class="list-item-leading">
|
|
65
|
+
<slot name="avatar" class="list-item-avatar" ${hasSlotted()}></slot>
|
|
66
|
+
<slot name="leading" ${hasSlotted()}></slot>
|
|
67
|
+
</span>
|
|
68
|
+
<span class="list-item-content">
|
|
69
|
+
<slot name="overline" class="list-item-overline"></slot>
|
|
70
|
+
<slot></slot>
|
|
71
|
+
<slot name="supporting-text" class="list-item-supporting-text"></slot>
|
|
72
|
+
</span>
|
|
73
|
+
<span class="list-item-trailing">
|
|
74
|
+
<slot
|
|
75
|
+
name="trailing-text"
|
|
76
|
+
class="list-item-trailing-text"
|
|
77
|
+
${hasSlotted()}></slot>
|
|
78
|
+
<slot name="trailing" ${hasSlotted()}></slot>
|
|
79
|
+
</span>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/** @nocollapse */
|
|
84
|
+
ListItem.shadowRootOptions = {
|
|
85
|
+
...LitElement.shadowRootOptions,
|
|
86
|
+
delegatesFocus: true,
|
|
87
|
+
};
|
|
88
|
+
ListItem.styles = [
|
|
89
|
+
focusRingStyles,
|
|
90
|
+
rippleStyles,
|
|
91
|
+
listStyles,
|
|
92
|
+
css `
|
|
93
|
+
:host {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
}
|
|
97
|
+
.list-item {
|
|
98
|
+
flex: 1;
|
|
99
|
+
align-items: inherit;
|
|
100
|
+
}
|
|
101
|
+
:is(.list-item-leading, .list-item-trailing):not(:has(.has-slotted)) {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
slot:not(.has-slotted) {
|
|
105
|
+
display: contents;
|
|
106
|
+
}
|
|
107
|
+
`,
|
|
108
|
+
];
|
|
109
|
+
__decorate([
|
|
110
|
+
property({ type: Boolean })
|
|
111
|
+
], ListItem.prototype, "checked", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property({ type: Boolean })
|
|
114
|
+
], ListItem.prototype, "disabled", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: Boolean, reflect: true, attribute: 'static' })
|
|
117
|
+
], ListItem.prototype, "nonInteractive", void 0);
|
|
118
|
+
ListItem = __decorate([
|
|
119
|
+
customElement('md-list-item')
|
|
120
|
+
], ListItem);
|
|
121
|
+
export { ListItem };
|
|
122
|
+
//# sourceMappingURL=md-list-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md-list-item.js","sourceRoot":"","sources":["md-list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,eAAe,MAAM,yBAAyB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACxF,8FAA8F;AAC9F,OAAO,YAAY,MAAM,sBAAsB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AAClF,wFAAwF;AACxF,OAAO,UAAU,MAAM,YAAY,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtE,4EAA4E;AAE5E,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AASnC,wCAAwC;AACxC,MAAM,SAAS,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;AAExE;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS;IA6BrC;QACE,KAAK,EAAE,CAAC;QAIV;;WAEG;QACwB,YAAO,GAAG,KAAK,CAAC;QAE3C;;WAEG;QACwB,aAAQ,GAAG,KAAK,CAAC;QAE5C;;WAEG;QAEH,mBAAc,GAAG,KAAK,CAAC;QAjBrB,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC;IACpC,CAAC;IAkBkB,MAAM;QACvB,MAAM,KAAK,GAAG;YACZ,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,cAAc;SAC5B,CAAC;QACF,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAA,gCAAgC,QAAQ,CAAC,KAAK,CAAC;WACrD,IAAI,CAAC,aAAa,EAAE;QACvB,CAAC;QACL,CAAC;QAED,iCAAiC;QACjC,MAAM,EAAC,SAAS,EAAC,GAAG,IAAuB,CAAC;QAC5C,OAAO,IAAI,CAAA;;eAEA,QAAQ,CAAC,KAAK,CAAC;kBACZ,IAAI,CAAC,QAAQ;mBACZ,SAAS,IAAI,OAAO;QAC/B,IAAI,CAAC,aAAa,EAAE;cACd,CAAC;IACb,CAAC;IAEO,aAAa;QACnB,OAAO,IAAI,CAAA;;uDAEwC,UAAU,EAAE;+BACpC,UAAU,EAAE;;;;;;;;;;;YAW/B,UAAU,EAAE;gCACQ,UAAU,EAAE;;KAEvC,CAAC;IACJ,CAAC;;AA3FD,kBAAkB;AACF,0BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAEc,eAAM,GAAwB;IAC5C,eAAe;IACf,YAAY;IACZ,UAAU;IACV,GAAG,CAAA;;;;;;;;;;;;;;;KAeF;CACF,AApBqB,CAoBpB;AAUyB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAiB;AAKhB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;0CAAkB;AAM5C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,CAAC;gDACvC;AAhDZ,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CA6FpB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {ARIAMixinStrict} from '../../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../../internal/aria/delegate.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../../behaviors/element-internals.js';\nimport {hasSlotted} from '../shared/has-slotted.js';\n\nimport focusRingStyles from '../focus/focus-ring.css' with {type: 'css'}; // github-only\n// import {styles as focusRingStyles} from '../focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '../ripple/ripple.css' with {type: 'css'}; // github-only\n// import {styles as rippleStyles} from '../ripple/ripple.cssresult.js'; // google3-only\nimport listStyles from './list.css' with {type: 'css'}; // github-only\n// import {styles as listStyles} from './list.cssresult.js'; // google3-only\n\nimport {listItem} from './list.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design list item component. */\n 'md-list-item': ListItem;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinDelegatesAria(mixinElementInternals(LitElement));\n\n/**\n * A Material Design list item component.\n */\n@customElement('md-list-item')\nexport class ListItem extends baseClass {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n static override styles: CSSResultOrNative[] = [\n focusRingStyles,\n rippleStyles,\n listStyles,\n css`\n :host {\n display: flex;\n align-items: center;\n }\n .list-item {\n flex: 1;\n align-items: inherit;\n }\n :is(.list-item-leading, .list-item-trailing):not(:has(.has-slotted)) {\n display: none;\n }\n slot:not(.has-slotted) {\n display: contents;\n }\n `,\n ];\n\n constructor() {\n super();\n this[internals].role = 'listitem';\n }\n\n /**\n * Whether the list item is selected.\n */\n @property({type: Boolean}) checked = false;\n\n /**\n * Whether the list item is disabled.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * Whether the list item is non-interactive.\n */\n @property({type: Boolean, reflect: true, attribute: 'static'})\n nonInteractive = false;\n\n protected override render() {\n const state = {\n checked: this.checked,\n disabled: this.disabled,\n static: this.nonInteractive,\n };\n if (this.nonInteractive) {\n return html`<div part=\"list-item\" class=\"${listItem(state)}\"\n >${this.renderContent()}</div\n >`;\n }\n\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`<button\n part=\"list-item\"\n class=\"${listItem(state)}\"\n ?disabled=${this.disabled}\n aria-label=${ariaLabel || nothing}>\n ${this.renderContent()}\n </button>`;\n }\n\n private renderContent() {\n return html`\n <span class=\"list-item-leading\">\n <slot name=\"avatar\" class=\"list-item-avatar\" ${hasSlotted()}></slot>\n <slot name=\"leading\" ${hasSlotted()}></slot>\n </span>\n <span class=\"list-item-content\">\n <slot name=\"overline\" class=\"list-item-overline\"></slot>\n <slot></slot>\n <slot name=\"supporting-text\" class=\"list-item-supporting-text\"></slot>\n </span>\n <span class=\"list-item-trailing\">\n <slot\n name=\"trailing-text\"\n class=\"list-item-trailing-text\"\n ${hasSlotted()}></slot>\n <slot name=\"trailing\" ${hasSlotted()}></slot>\n </span>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
/** A Material Design list component. */
|
|
10
|
+
'md-list': List;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../../behaviors/element-internals.js").WithElementInternals>;
|
|
14
|
+
/**
|
|
15
|
+
* A Material Design list component.
|
|
16
|
+
*/
|
|
17
|
+
export declare class List extends baseClass {
|
|
18
|
+
static styles: CSSResultOrNative[];
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Whether to render the list with segmented items.
|
|
22
|
+
*/
|
|
23
|
+
segmented: boolean;
|
|
24
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { internals, mixinElementInternals, } from '../../../behaviors/element-internals.js';
|
|
10
|
+
import listStyles from './list.css' with { type: 'css' }; // github-only
|
|
11
|
+
// import {styles as listStyles} from './list.cssresult.js'; // google3-only
|
|
12
|
+
import { list } from './list.js';
|
|
13
|
+
// Separate variable needed for closure.
|
|
14
|
+
const baseClass = mixinElementInternals(LitElement);
|
|
15
|
+
/**
|
|
16
|
+
* A Material Design list component.
|
|
17
|
+
*/
|
|
18
|
+
let List = class List extends baseClass {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
/**
|
|
22
|
+
* Whether to render the list with segmented items.
|
|
23
|
+
*/
|
|
24
|
+
this.segmented = false;
|
|
25
|
+
this[internals].role = 'list';
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html `<div part="list" class="${list(this)}">
|
|
29
|
+
<slot></slot>
|
|
30
|
+
</div>`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
List.styles = [
|
|
34
|
+
listStyles,
|
|
35
|
+
css `
|
|
36
|
+
:host {
|
|
37
|
+
display: flex;
|
|
38
|
+
}
|
|
39
|
+
.list {
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
];
|
|
44
|
+
__decorate([
|
|
45
|
+
property({ type: Boolean })
|
|
46
|
+
], List.prototype, "segmented", void 0);
|
|
47
|
+
List = __decorate([
|
|
48
|
+
customElement('md-list')
|
|
49
|
+
], List);
|
|
50
|
+
export { List };
|
|
51
|
+
//# sourceMappingURL=md-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md-list.js","sourceRoot":"","sources":["md-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,UAAU,MAAM,YAAY,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtE,4EAA4E;AAE5E,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAS/B,wCAAwC;AACxC,MAAM,SAAS,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAEpD;;GAEG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,SAAS;IAajC;QACE,KAAK,EAAE,CAAC;QAIV;;WAEG;QACwB,cAAS,GAAG,KAAK,CAAC;QAN3C,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;IAChC,CAAC;IAOkB,MAAM;QACvB,OAAO,IAAI,CAAA,2BAA2B,IAAI,CAAC,IAAI,CAAC;;WAEzC,CAAC;IACV,CAAC;;AA1Be,WAAM,GAAwB;IAC5C,UAAU;IACV,GAAG,CAAA;;;;;;;KAOF;CACF,AAVqB,CAUpB;AAUyB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAmB;AArBlC,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CA4BhB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultOrNative, html, LitElement} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../../behaviors/element-internals.js';\n\nimport listStyles from './list.css' with {type: 'css'}; // github-only\n// import {styles as listStyles} from './list.cssresult.js'; // google3-only\n\nimport {list} from './list.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design list component. */\n 'md-list': List;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinElementInternals(LitElement);\n\n/**\n * A Material Design list component.\n */\n@customElement('md-list')\nexport class List extends baseClass {\n static override styles: CSSResultOrNative[] = [\n listStyles,\n css`\n :host {\n display: flex;\n }\n .list {\n flex: 1;\n }\n `,\n ];\n\n constructor() {\n super();\n this[internals].role = 'list';\n }\n\n /**\n * Whether to render the list with segmented items.\n */\n @property({type: Boolean}) segmented = false;\n\n protected override render() {\n return html`<div part=\"list\" class=\"${list(this)}\">\n <slot></slot>\n </div>`;\n }\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
@mixin root {
|
|
7
|
+
--container-color: var(--md-sys-color-surface-container-low);
|
|
8
|
+
--container-elevation: var(--md-sys-elevation-shadow-2);
|
|
9
|
+
--container-shape: var(--md-sys-shape-corner-lg);
|
|
10
|
+
--gap: 2px;
|
|
11
|
+
--group-padding: 2px;
|
|
12
|
+
--group-shape: var(--md-sys-shape-corner-sm);
|
|
13
|
+
--section-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@mixin inactive {
|
|
17
|
+
--container-shape: var(--md-sys-shape-corner-sm);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@mixin active {
|
|
21
|
+
--container-shape: var(--md-sys-shape-corner-md);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@mixin vibrant {
|
|
25
|
+
--container-color: var(--md-sys-color-tertiary-container);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@mixin item {
|
|
29
|
+
--between-space: 12px;
|
|
30
|
+
--bottom-space: 8px;
|
|
31
|
+
--container-color: transparent;
|
|
32
|
+
--height: 44px;
|
|
33
|
+
--inner-corner-corner-size: none;
|
|
34
|
+
--label-text-color: var(--md-sys-color-on-surface);
|
|
35
|
+
--label-text: var(--md-sys-typescale-label-lg);
|
|
36
|
+
--label-text-tracking: var(--md-sys-typescale-label-lg-tracking);
|
|
37
|
+
--leading-icon-color: var(--md-sys-color-on-surface-variant);
|
|
38
|
+
--leading-icon-size: 20px;
|
|
39
|
+
--leading-space: 16px;
|
|
40
|
+
--shape: var(--md-sys-shape-corner-xs);
|
|
41
|
+
--supporting-text-color: var(--md-sys-color-on-surface-variant);
|
|
42
|
+
--supporting-text: var(--md-sys-typescale-body-sm);
|
|
43
|
+
--supporting-text-tracking: var(--md-sys-typescale-body-sm-tracking);
|
|
44
|
+
--top-space: 8px;
|
|
45
|
+
--trailing-icon-color: var(--md-sys-color-on-surface-variant);
|
|
46
|
+
--trailing-icon-size: 20px;
|
|
47
|
+
--trailing-space: 16px;
|
|
48
|
+
--trailing-supporting-text-color: var(--md-sys-color-on-surface-variant);
|
|
49
|
+
--trailing-supporting-text: var(--md-sys-typescale-label-lg);
|
|
50
|
+
--trailing-supporting-text-tracking: var(--md-sys-typescale-label-lg-tracking);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@mixin item-first-child {
|
|
54
|
+
--inner-corner-corner-size: var(--md-sys-shape-corner-xs);
|
|
55
|
+
--shape: var(--md-sys-shape-corner-md);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@mixin item-last-child {
|
|
59
|
+
--inner-corner-corner-size: var(--md-sys-shape-corner-xs);
|
|
60
|
+
--shape: var(--md-sys-shape-corner-md);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@mixin item-vibrant {
|
|
64
|
+
--label-text-color: var(--md-sys-color-on-tertiary-container);
|
|
65
|
+
--leading-icon-color: var(--md-sys-color-on-tertiary-container);
|
|
66
|
+
--supporting-text-color: var(--md-sys-color-on-tertiary-container);
|
|
67
|
+
--trailing-icon-color: var(--md-sys-color-on-tertiary-container);
|
|
68
|
+
--trailing-supporting-text-color: var(--md-sys-color-on-tertiary-container);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@mixin item-vibrant-hovered {
|
|
72
|
+
--leading-icon-color: var(--md-sys-color-tertiary);
|
|
73
|
+
--trailing-icon-color: var(--md-sys-color-tertiary);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@mixin item-vibrant-focused {
|
|
77
|
+
--leading-icon-color: var(--md-sys-color-tertiary);
|
|
78
|
+
--trailing-icon-color: var(--md-sys-color-tertiary);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@mixin item-vibrant-pressed {
|
|
82
|
+
--leading-icon-color: var(--md-sys-color-tertiary);
|
|
83
|
+
--trailing-icon-color: var(--md-sys-color-tertiary);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@mixin item-selected {
|
|
87
|
+
--container-color: var(--md-sys-color-tertiary-container);
|
|
88
|
+
--label-text-color: var(--md-sys-color-on-tertiary-container);
|
|
89
|
+
--leading-icon-color: var(--md-sys-color-on-tertiary-container);
|
|
90
|
+
--shape: var(--md-sys-shape-corner-md);
|
|
91
|
+
--supporting-text-color: var(--md-sys-color-on-tertiary-container);
|
|
92
|
+
--trailing-icon-color: var(--md-sys-color-on-tertiary-container);
|
|
93
|
+
--trailing-supporting-text-color: var(--md-sys-color-on-tertiary-container);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@mixin item-selected-vibrant {
|
|
97
|
+
--container-color: var(--md-sys-color-tertiary);
|
|
98
|
+
--label-text-color: var(--md-sys-color-on-tertiary);
|
|
99
|
+
--leading-icon-color: var(--md-sys-color-on-tertiary);
|
|
100
|
+
--supporting-text-color: var(--md-sys-color-on-tertiary);
|
|
101
|
+
--trailing-icon-color: var(--md-sys-color-on-tertiary);
|
|
102
|
+
--trailing-supporting-text-color: var(--md-sys-color-on-tertiary);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@mixin item-disabled {
|
|
106
|
+
--label-text-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);
|
|
107
|
+
--leading-icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);
|
|
108
|
+
--supporting-text-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);
|
|
109
|
+
--trailing-icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);
|
|
110
|
+
--trailing-supporting-text-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@mixin item-disabled-vibrant {
|
|
114
|
+
--label-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
115
|
+
--leading-icon-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
116
|
+
--supporting-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
117
|
+
--trailing-icon-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
118
|
+
--trailing-supporting-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@mixin item-disabled-selected {
|
|
122
|
+
--container-color: hsl(from var(--md-sys-color-tertiary-container) h s l / 38%);
|
|
123
|
+
--label-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
124
|
+
--leading-icon-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
125
|
+
--supporting-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
126
|
+
--trailing-icon-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
127
|
+
--trailing-supporting-text-color: hsl(from var(--md-sys-color-on-tertiary-container) h s l / 38%);
|
|
128
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
import { type MenuItemCheckable } from './menu.js';
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'md-menu-group': MenuGroup;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../../behaviors/element-internals.js").WithElementInternals>;
|
|
14
|
+
/**
|
|
15
|
+
* A Material Design menu group component.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MenuGroup extends baseClass {
|
|
18
|
+
static styles: CSSResultOrNative[];
|
|
19
|
+
checkable: MenuItemCheckable | null;
|
|
20
|
+
get menu(): HTMLElement | null;
|
|
21
|
+
get items(): HTMLElement[];
|
|
22
|
+
private readonly menuContext;
|
|
23
|
+
constructor();
|
|
24
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { consume, provide } from '@lit/context';
|
|
8
|
+
import { css, html, LitElement } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
import { internals, mixinElementInternals, } from '../../../behaviors/element-internals.js';
|
|
11
|
+
import { menuContext, menuItemCheckable, } from './menu.js';
|
|
12
|
+
// Separate variable needed for closure.
|
|
13
|
+
const baseClass = mixinElementInternals(LitElement);
|
|
14
|
+
/**
|
|
15
|
+
* A Material Design menu group component.
|
|
16
|
+
*/
|
|
17
|
+
let MenuGroup = class MenuGroup extends baseClass {
|
|
18
|
+
// TODO: add optional section label
|
|
19
|
+
get menu() {
|
|
20
|
+
return this.menuContext?.menu || null;
|
|
21
|
+
}
|
|
22
|
+
get items() {
|
|
23
|
+
return (this.menuContext?.getItems?.() || []).filter((item) => this.compareDocumentPosition(item) &
|
|
24
|
+
Node.DOCUMENT_POSITION_CONTAINED_BY);
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.checkable = null;
|
|
29
|
+
this.menuContext = null;
|
|
30
|
+
this[internals].role = 'none';
|
|
31
|
+
this.addEventListener('change', (event) => {
|
|
32
|
+
if (this.checkable === 'single') {
|
|
33
|
+
const composedPath = event.composedPath();
|
|
34
|
+
const items = this.items;
|
|
35
|
+
for (const item of items) {
|
|
36
|
+
if (!composedPath.includes(item) && item.checked) {
|
|
37
|
+
item.checked = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return html `<slot></slot>`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
MenuGroup.styles = [
|
|
48
|
+
css `
|
|
49
|
+
:host {
|
|
50
|
+
display: contents;
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
];
|
|
54
|
+
__decorate([
|
|
55
|
+
provide({ context: menuItemCheckable }),
|
|
56
|
+
property({ reflect: true })
|
|
57
|
+
], MenuGroup.prototype, "checkable", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
consume({ context: menuContext, subscribe: true })
|
|
60
|
+
], MenuGroup.prototype, "menuContext", void 0);
|
|
61
|
+
MenuGroup = __decorate([
|
|
62
|
+
customElement('md-menu-group')
|
|
63
|
+
], MenuGroup);
|
|
64
|
+
export { MenuGroup };
|
|
65
|
+
//# sourceMappingURL=md-menu-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md-menu-group.js","sourceRoot":"","sources":["md-menu-group.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,WAAW,EACX,iBAAiB,GAGlB,MAAM,WAAW,CAAC;AAQnB,wCAAwC;AACxC,MAAM,SAAS,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAEpD;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,SAAS;IAatC,mCAAmC;IAEnC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC;IACxC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAClD,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC;YAClC,IAAI,CAAC,8BAA8B,CACtC,CAAC;IACJ,CAAC;IAKD;QACE,KAAK,EAAE,CAAC;QApBV,cAAS,GAA6B,IAAI,CAAC;QAiB1B,gBAAW,GAAuB,IAAI,CAAC;QAItD,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAY,EAAE,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAChC,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAiD,CAAC;gBACrE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;wBACjD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACvB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AA/Ce,gBAAM,GAAwB;IAC5C,GAAG,CAAA;;;;KAIF;CACF,AANqB,CAMpB;AAIF;IAFC,OAAO,CAAC,EAAC,OAAO,EAAE,iBAAiB,EAAC,CAAC;IACrC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;4CACiB;AAiB1B;IADhB,OAAO,CAAC,EAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC;8CACO;AA5B7C,SAAS;IADrB,aAAa,CAAC,eAAe,CAAC;GAClB,SAAS,CAiDrB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {consume, provide} from '@lit/context';\nimport {css, CSSResultOrNative, html, LitElement} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../../behaviors/element-internals.js';\n\nimport {\n menuContext,\n menuItemCheckable,\n type MenuContext,\n type MenuItemCheckable,\n} from './menu.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu-group': MenuGroup;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinElementInternals(LitElement);\n\n/**\n * A Material Design menu group component.\n */\n@customElement('md-menu-group')\nexport class MenuGroup extends baseClass {\n static override styles: CSSResultOrNative[] = [\n css`\n :host {\n display: contents;\n }\n `,\n ];\n\n @provide({context: menuItemCheckable})\n @property({reflect: true})\n checkable: MenuItemCheckable | null = null;\n\n // TODO: add optional section label\n\n get menu(): HTMLElement | null {\n return this.menuContext?.menu || null;\n }\n\n get items(): HTMLElement[] {\n return (this.menuContext?.getItems?.() || []).filter(\n (item) =>\n this.compareDocumentPosition(item) &\n Node.DOCUMENT_POSITION_CONTAINED_BY,\n );\n }\n\n @consume({context: menuContext, subscribe: true})\n private readonly menuContext: MenuContext | null = null;\n\n constructor() {\n super();\n this[internals].role = 'none';\n this.addEventListener('change', (event: Event) => {\n if (this.checkable === 'single') {\n const composedPath = event.composedPath();\n const items = this.items as Array<HTMLElement & {checked?: boolean}>;\n for (const item of items) {\n if (!composedPath.includes(item) && item.checked) {\n item.checked = false;\n }\n }\n }\n });\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'md-menu-item': MenuItem;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../../behaviors/focusable.js").Focusable>, import("../../../behaviors/element-internals.js").WithElementInternals>;
|
|
13
|
+
/**
|
|
14
|
+
* A Material Design menu item component.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MenuItem extends baseClass {
|
|
17
|
+
static styles: CSSResultOrNative[];
|
|
18
|
+
checked: boolean;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
get menu(): HTMLElement | null;
|
|
21
|
+
private readonly menuContext?;
|
|
22
|
+
private readonly checkable?;
|
|
23
|
+
constructor();
|
|
24
|
+
connectedCallback(): void;
|
|
25
|
+
disconnectedCallback(): void;
|
|
26
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
private renderContent;
|
|
28
|
+
protected updated(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { consume } from '@lit/context';
|
|
8
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
10
|
+
import { afterDispatch, setupDispatchHooks, } from '../../../../internal/events/dispatch-hooks.js';
|
|
11
|
+
import { internals, mixinElementInternals, } from '../../../behaviors/element-internals.js';
|
|
12
|
+
import { isFocusable, mixinFocusable } from '../../../behaviors/focusable.js';
|
|
13
|
+
import { hasSlotted } from '../shared/has-slotted.js';
|
|
14
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
15
|
+
// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
16
|
+
import rippleStyles from '../ripple/ripple.css' with { type: 'css' }; // github-only
|
|
17
|
+
// import rippleStyles from '../ripple/ripple.cssresult.js'; // google3-only
|
|
18
|
+
import menuStyles from './menu.css' with { type: 'css' }; // github-only
|
|
19
|
+
// import {styles as menuStyles} from './menu.cssresult.js'; // google3-only
|
|
20
|
+
import { menuContext, menuItem, menuItemCheckable, } from './menu.js';
|
|
21
|
+
// Separate variable needed for closure.
|
|
22
|
+
const baseClass = mixinElementInternals(mixinFocusable(LitElement));
|
|
23
|
+
/**
|
|
24
|
+
* A Material Design menu item component.
|
|
25
|
+
*/
|
|
26
|
+
let MenuItem = class MenuItem extends baseClass {
|
|
27
|
+
get menu() {
|
|
28
|
+
return this.menuContext?.menu || null;
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.checked = false;
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
this[internals].role = 'menuitem';
|
|
35
|
+
setupDispatchHooks(this, 'click');
|
|
36
|
+
this.addEventListener('click', (e) => {
|
|
37
|
+
if (this.disabled) {
|
|
38
|
+
e.stopImmediatePropagation();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const wasChecked = this.checked;
|
|
42
|
+
afterDispatch(e, () => {
|
|
43
|
+
if (e.defaultPrevented)
|
|
44
|
+
return;
|
|
45
|
+
if (this.checkable) {
|
|
46
|
+
this.checked = !wasChecked;
|
|
47
|
+
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
48
|
+
this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
49
|
+
}
|
|
50
|
+
if (this.checkable !== 'multiple') {
|
|
51
|
+
this.menu?.hidePopover();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
this.addEventListener('keydown', (e) => {
|
|
56
|
+
if (this.disabled)
|
|
57
|
+
return;
|
|
58
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
this.click();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
super.connectedCallback();
|
|
66
|
+
this.menuContext?.itemConnected(this);
|
|
67
|
+
}
|
|
68
|
+
disconnectedCallback() {
|
|
69
|
+
super.disconnectedCallback();
|
|
70
|
+
this.menuContext?.itemDisconnected(this);
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return html `<div
|
|
74
|
+
part="menu-item"
|
|
75
|
+
class="${menuItem({
|
|
76
|
+
checked: this.checked,
|
|
77
|
+
disabled: this.disabled,
|
|
78
|
+
})} ripple-host focus-ring-host">
|
|
79
|
+
${this.renderContent()}
|
|
80
|
+
</div>`;
|
|
81
|
+
}
|
|
82
|
+
renderContent() {
|
|
83
|
+
return html `
|
|
84
|
+
<span class="menu-item-leading">
|
|
85
|
+
<slot name="leading" ${hasSlotted()}>
|
|
86
|
+
${this.checked ? html `<span class="checkmark">check</span>` : nothing}
|
|
87
|
+
</slot>
|
|
88
|
+
</span>
|
|
89
|
+
<span class="menu-item-content">
|
|
90
|
+
<slot></slot>
|
|
91
|
+
<slot name="supporting-text" class="menu-item-supporting-text"></slot>
|
|
92
|
+
</span>
|
|
93
|
+
<span class="menu-item-trailing">
|
|
94
|
+
<slot
|
|
95
|
+
name="trailing-text"
|
|
96
|
+
class="menu-item-trailing-text"
|
|
97
|
+
${hasSlotted()}></slot>
|
|
98
|
+
<slot name="trailing" ${hasSlotted()}></slot>
|
|
99
|
+
</span>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
updated() {
|
|
103
|
+
if (this.checkable === 'single') {
|
|
104
|
+
this[internals].role = 'menuitemradio';
|
|
105
|
+
}
|
|
106
|
+
else if (this.checkable === 'multiple') {
|
|
107
|
+
this[internals].role = 'menuitemcheckbox';
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this[internals].role = 'menuitem';
|
|
111
|
+
}
|
|
112
|
+
if (this.checkable) {
|
|
113
|
+
this[internals].ariaChecked = String(this.checked);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this[internals].ariaChecked = null;
|
|
117
|
+
}
|
|
118
|
+
this[internals].ariaDisabled = String(this.disabled);
|
|
119
|
+
this[isFocusable] = !this.disabled;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
MenuItem.styles = [
|
|
123
|
+
focusRingStyles,
|
|
124
|
+
rippleStyles,
|
|
125
|
+
menuStyles,
|
|
126
|
+
css `
|
|
127
|
+
:host {
|
|
128
|
+
display: flex;
|
|
129
|
+
outline: none;
|
|
130
|
+
}
|
|
131
|
+
.menu-item {
|
|
132
|
+
flex: 1;
|
|
133
|
+
}
|
|
134
|
+
:is(.menu-item-leading, .menu-item-trailing):not(
|
|
135
|
+
:has(.has-slotted, .checkmark)
|
|
136
|
+
) {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
slot:not(.has-slotted) {
|
|
140
|
+
display: contents;
|
|
141
|
+
}
|
|
142
|
+
.checkmark {
|
|
143
|
+
display: flex;
|
|
144
|
+
font: var(--md-icon-size) var(--md-icon-font);
|
|
145
|
+
}
|
|
146
|
+
`,
|
|
147
|
+
];
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: Boolean, reflect: true })
|
|
150
|
+
], MenuItem.prototype, "checked", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: Boolean, reflect: true })
|
|
153
|
+
], MenuItem.prototype, "disabled", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
consume({ context: menuContext, subscribe: true })
|
|
156
|
+
], MenuItem.prototype, "menuContext", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
state(),
|
|
159
|
+
consume({ context: menuItemCheckable, subscribe: true })
|
|
160
|
+
], MenuItem.prototype, "checkable", void 0);
|
|
161
|
+
MenuItem = __decorate([
|
|
162
|
+
customElement('md-menu-item')
|
|
163
|
+
], MenuItem);
|
|
164
|
+
export { MenuItem };
|
|
165
|
+
//# sourceMappingURL=md-menu-item.js.map
|