@material/web 2.2.1-nightly.e217185.0 → 2.3.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/button.d.ts +6 -0
- package/button/internal/button.js +10 -0
- package/button/internal/button.js.map +1 -1
- package/chips/internal/assist-chip.d.ts +6 -0
- package/chips/internal/assist-chip.js +10 -0
- package/chips/internal/assist-chip.js.map +1 -1
- package/dialog/internal/dialog.js +1 -1
- package/dialog/internal/dialog.js.map +1 -1
- package/iconbutton/internal/_shared.scss +2 -0
- package/iconbutton/internal/icon-button.d.ts +6 -0
- package/iconbutton/internal/icon-button.js +14 -3
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/iconbutton/internal/shared-styles.css +1 -1
- package/iconbutton/internal/shared-styles.css.map +1 -1
- package/iconbutton/internal/shared-styles.js +1 -1
- package/iconbutton/internal/shared-styles.js.map +1 -1
- package/labs/behaviors/custom-state-set.d.ts +107 -0
- package/labs/behaviors/custom-state-set.js +121 -0
- package/labs/behaviors/custom-state-set.js.map +1 -0
- package/list/internal/listitem/list-item.d.ts +1 -0
- package/list/internal/listitem/list-item.js +10 -0
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/_menu.scss +2 -1
- package/menu/internal/menu-styles.css +1 -1
- package/menu/internal/menu-styles.css.map +1 -1
- package/menu/internal/menu-styles.js +1 -1
- package/menu/internal/menu-styles.js.map +1 -1
- package/menu/menu.d.ts +1 -1
- package/menu/menu.js +1 -1
- package/menu/menu.js.map +1 -1
- package/package.json +2 -2
- package/textfield/internal/text-field.d.ts +9 -0
- package/textfield/internal/text-field.js +15 -0
- package/textfield/internal/text-field.js.map +1 -1
- package/tokens/_md-comp-menu.scss +7 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
import { WithElementInternals } from './element-internals.js';
|
|
8
|
+
import { MixinBase, MixinReturn } from './mixin.js';
|
|
9
|
+
/**
|
|
10
|
+
* A unique symbol used to check if an element's `CustomStateSet` has a state.
|
|
11
|
+
*
|
|
12
|
+
* Provides compatibility with legacy dashed identifier syntax (`:--state`) used
|
|
13
|
+
* by the element-internals-polyfill for Chrome extension support.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
18
|
+
*
|
|
19
|
+
* class MyElement extends baseClass {
|
|
20
|
+
* get checked() {
|
|
21
|
+
* return this[hasState]('checked');
|
|
22
|
+
* }
|
|
23
|
+
* set checked(value: boolean) {
|
|
24
|
+
* this[toggleState]('checked', value);
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const hasState: unique symbol;
|
|
30
|
+
/**
|
|
31
|
+
* A unique symbol used to add or delete a state from an element's
|
|
32
|
+
* `CustomStateSet`.
|
|
33
|
+
*
|
|
34
|
+
* Provides compatibility with legacy dashed identifier syntax (`:--state`) used
|
|
35
|
+
* by the element-internals-polyfill for Chrome extension support.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
40
|
+
*
|
|
41
|
+
* class MyElement extends baseClass {
|
|
42
|
+
* get checked() {
|
|
43
|
+
* return this[hasState]('checked');
|
|
44
|
+
* }
|
|
45
|
+
* set checked(value: boolean) {
|
|
46
|
+
* this[toggleState]('checked', value);
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const toggleState: unique symbol;
|
|
52
|
+
/**
|
|
53
|
+
* An instance with `[hasState]()` and `[toggleState]()` symbol functions that
|
|
54
|
+
* provide compatibility with `CustomStateSet` legacy dashed identifier syntax,
|
|
55
|
+
* used by the element-internals-polyfill and needed for Chrome extension
|
|
56
|
+
* compatibility.
|
|
57
|
+
*/
|
|
58
|
+
export interface WithCustomStateSet {
|
|
59
|
+
/**
|
|
60
|
+
* Checks if the state is active, returning true if the element matches
|
|
61
|
+
* `:state(customstate)`.
|
|
62
|
+
*
|
|
63
|
+
* @param customState the `CustomStateSet` state to check. Do not use the
|
|
64
|
+
* `--customstate` dashed identifier syntax.
|
|
65
|
+
* @return true if the custom state is active, or false if not.
|
|
66
|
+
*/
|
|
67
|
+
[hasState](customState: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Toggles the state to be active or inactive based on the provided value.
|
|
70
|
+
* When active, the element matches `:state(customstate)`.
|
|
71
|
+
*
|
|
72
|
+
* @param customState the `CustomStateSet` state to check. Do not use the
|
|
73
|
+
* `--customstate` dashed identifier syntax.
|
|
74
|
+
* @param isActive true to add the state, or false to delete it.
|
|
75
|
+
*/
|
|
76
|
+
[toggleState](customState: string, isActive: boolean): void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Mixes in compatibility functions for access to an element's `CustomStateSet`.
|
|
80
|
+
*
|
|
81
|
+
* Use this mixin's `[hasState]()` and `[toggleState]()` symbol functions for
|
|
82
|
+
* compatibility with `CustomStateSet` legacy dashed identifier syntax.
|
|
83
|
+
*
|
|
84
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax.
|
|
85
|
+
*
|
|
86
|
+
* The dashed identifier syntax is needed for element-internals-polyfill, a
|
|
87
|
+
* requirement for Chome extension compatibility.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
92
|
+
*
|
|
93
|
+
* class MyElement extends baseClass {
|
|
94
|
+
* get checked() {
|
|
95
|
+
* return this[hasState]('checked');
|
|
96
|
+
* }
|
|
97
|
+
* set checked(value: boolean) {
|
|
98
|
+
* this[toggleState]('checked', value);
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @param base The class to mix functionality into.
|
|
104
|
+
* @return The provided class with `[hasState]()` and `[toggleState]()`
|
|
105
|
+
* functions mixed in.
|
|
106
|
+
*/
|
|
107
|
+
export declare function mixinCustomStateSet<T extends MixinBase<LitElement & WithElementInternals>>(base: T): MixinReturn<T, WithCustomStateSet>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { internals } from './element-internals.js';
|
|
7
|
+
/**
|
|
8
|
+
* A unique symbol used to check if an element's `CustomStateSet` has a state.
|
|
9
|
+
*
|
|
10
|
+
* Provides compatibility with legacy dashed identifier syntax (`:--state`) used
|
|
11
|
+
* by the element-internals-polyfill for Chrome extension support.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
16
|
+
*
|
|
17
|
+
* class MyElement extends baseClass {
|
|
18
|
+
* get checked() {
|
|
19
|
+
* return this[hasState]('checked');
|
|
20
|
+
* }
|
|
21
|
+
* set checked(value: boolean) {
|
|
22
|
+
* this[toggleState]('checked', value);
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const hasState = Symbol('hasState');
|
|
28
|
+
/**
|
|
29
|
+
* A unique symbol used to add or delete a state from an element's
|
|
30
|
+
* `CustomStateSet`.
|
|
31
|
+
*
|
|
32
|
+
* Provides compatibility with legacy dashed identifier syntax (`:--state`) used
|
|
33
|
+
* by the element-internals-polyfill for Chrome extension support.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
38
|
+
*
|
|
39
|
+
* class MyElement extends baseClass {
|
|
40
|
+
* get checked() {
|
|
41
|
+
* return this[hasState]('checked');
|
|
42
|
+
* }
|
|
43
|
+
* set checked(value: boolean) {
|
|
44
|
+
* this[toggleState]('checked', value);
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const toggleState = Symbol('toggleState');
|
|
50
|
+
// Private symbols
|
|
51
|
+
const privateUseDashedIdentifier = Symbol('privateUseDashedIdentifier');
|
|
52
|
+
const privateGetStateIdentifier = Symbol('privateGetStateIdentifier');
|
|
53
|
+
/**
|
|
54
|
+
* Mixes in compatibility functions for access to an element's `CustomStateSet`.
|
|
55
|
+
*
|
|
56
|
+
* Use this mixin's `[hasState]()` and `[toggleState]()` symbol functions for
|
|
57
|
+
* compatibility with `CustomStateSet` legacy dashed identifier syntax.
|
|
58
|
+
*
|
|
59
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax.
|
|
60
|
+
*
|
|
61
|
+
* The dashed identifier syntax is needed for element-internals-polyfill, a
|
|
62
|
+
* requirement for Chome extension compatibility.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));
|
|
67
|
+
*
|
|
68
|
+
* class MyElement extends baseClass {
|
|
69
|
+
* get checked() {
|
|
70
|
+
* return this[hasState]('checked');
|
|
71
|
+
* }
|
|
72
|
+
* set checked(value: boolean) {
|
|
73
|
+
* this[toggleState]('checked', value);
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @param base The class to mix functionality into.
|
|
79
|
+
* @return The provided class with `[hasState]()` and `[toggleState]()`
|
|
80
|
+
* functions mixed in.
|
|
81
|
+
*/
|
|
82
|
+
export function mixinCustomStateSet(base) {
|
|
83
|
+
var _a;
|
|
84
|
+
class WithCustomStateSetElement extends base {
|
|
85
|
+
constructor() {
|
|
86
|
+
super(...arguments);
|
|
87
|
+
this[_a] = null;
|
|
88
|
+
}
|
|
89
|
+
[hasState](state) {
|
|
90
|
+
state = this[privateGetStateIdentifier](state);
|
|
91
|
+
return this[internals].states.has(state);
|
|
92
|
+
}
|
|
93
|
+
[toggleState](state, isActive) {
|
|
94
|
+
state = this[privateGetStateIdentifier](state);
|
|
95
|
+
if (isActive) {
|
|
96
|
+
this[internals].states.add(state);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this[internals].states.delete(state);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
[(_a = privateUseDashedIdentifier, privateGetStateIdentifier)](state) {
|
|
103
|
+
if (this[privateUseDashedIdentifier] === null) {
|
|
104
|
+
// Check if `--state-string` needs to be used. See
|
|
105
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax
|
|
106
|
+
try {
|
|
107
|
+
const testState = '_test';
|
|
108
|
+
this[internals].states.add(testState);
|
|
109
|
+
this[internals].states.delete(testState);
|
|
110
|
+
this[privateUseDashedIdentifier] = false;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
this[privateUseDashedIdentifier] = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return this[privateUseDashedIdentifier] ? `--${state}` : state;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return WithCustomStateSetElement;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=custom-state-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-state-set.js","sourceRoot":"","sources":["custom-state-set.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,SAAS,EAAuB,MAAM,wBAAwB,CA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AI,CAAC;oBACH,MAAM,SAAS,GAAG,OAAO,CAAC;oBAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;oBACtC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACzC,IAAI,CAAC,0BAA0B,CAAC,GAAG,KAAK,CAAC;gBAC3C,CAAC;gBAAC,MAAM,CAAC;oBACP,IAAI,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAAC;gBAC1C,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACjE,CAAC;KACF;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {internals, WithElementInternals} from './element-internals.js';\nimport {MixinBase, MixinReturn} from './mixin.js';\n\n/**\n * A unique symbol used to check if an element's `CustomStateSet` has a state.\n *\n * Provides compatibility with legacy dashed identifier syntax (`:--state`) used\n * by the element-internals-polyfill for Chrome extension support.\n *\n * @example\n * ```ts\n * const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));\n *\n * class MyElement extends baseClass {\n * get checked() {\n * return this[hasState]('checked');\n * }\n * set checked(value: boolean) {\n * this[toggleState]('checked', value);\n * }\n * }\n * ```\n */\nexport const hasState = Symbol('hasState');\n\n/**\n * A unique symbol used to add or delete a state from an element's\n * `CustomStateSet`.\n *\n * Provides compatibility with legacy dashed identifier syntax (`:--state`) used\n * by the element-internals-polyfill for Chrome extension support.\n *\n * @example\n * ```ts\n * const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));\n *\n * class MyElement extends baseClass {\n * get checked() {\n * return this[hasState]('checked');\n * }\n * set checked(value: boolean) {\n * this[toggleState]('checked', value);\n * }\n * }\n * ```\n */\nexport const toggleState = Symbol('toggleState');\n\n/**\n * An instance with `[hasState]()` and `[toggleState]()` symbol functions that\n * provide compatibility with `CustomStateSet` legacy dashed identifier syntax,\n * used by the element-internals-polyfill and needed for Chrome extension\n * compatibility.\n */\nexport interface WithCustomStateSet {\n /**\n * Checks if the state is active, returning true if the element matches\n * `:state(customstate)`.\n *\n * @param customState the `CustomStateSet` state to check. Do not use the\n * `--customstate` dashed identifier syntax.\n * @return true if the custom state is active, or false if not.\n */\n [hasState](customState: string): boolean;\n\n /**\n * Toggles the state to be active or inactive based on the provided value.\n * When active, the element matches `:state(customstate)`.\n *\n * @param customState the `CustomStateSet` state to check. Do not use the\n * `--customstate` dashed identifier syntax.\n * @param isActive true to add the state, or false to delete it.\n */\n [toggleState](customState: string, isActive: boolean): void;\n}\n\n// Private symbols\nconst privateUseDashedIdentifier = Symbol('privateUseDashedIdentifier');\nconst privateGetStateIdentifier = Symbol('privateGetStateIdentifier');\n\n/**\n * Mixes in compatibility functions for access to an element's `CustomStateSet`.\n *\n * Use this mixin's `[hasState]()` and `[toggleState]()` symbol functions for\n * compatibility with `CustomStateSet` legacy dashed identifier syntax.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax.\n *\n * The dashed identifier syntax is needed for element-internals-polyfill, a\n * requirement for Chome extension compatibility.\n *\n * @example\n * ```ts\n * const baseClass = mixinCustomStateSet(mixinElementInternals(LitElement));\n *\n * class MyElement extends baseClass {\n * get checked() {\n * return this[hasState]('checked');\n * }\n * set checked(value: boolean) {\n * this[toggleState]('checked', value);\n * }\n * }\n * ```\n *\n * @param base The class to mix functionality into.\n * @return The provided class with `[hasState]()` and `[toggleState]()`\n * functions mixed in.\n */\nexport function mixinCustomStateSet<\n T extends MixinBase<LitElement & WithElementInternals>,\n>(base: T): MixinReturn<T, WithCustomStateSet> {\n abstract class WithCustomStateSetElement\n extends base\n implements WithCustomStateSet\n {\n [hasState](state: string) {\n state = this[privateGetStateIdentifier](state);\n return this[internals].states.has(state);\n }\n\n [toggleState](state: string, isActive: boolean) {\n state = this[privateGetStateIdentifier](state);\n if (isActive) {\n this[internals].states.add(state);\n } else {\n this[internals].states.delete(state);\n }\n }\n\n [privateUseDashedIdentifier]: boolean | null = null;\n\n [privateGetStateIdentifier](state: string) {\n if (this[privateUseDashedIdentifier] === null) {\n // Check if `--state-string` needs to be used. See\n // https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax\n try {\n const testState = '_test';\n this[internals].states.add(testState);\n this[internals].states.delete(testState);\n this[privateUseDashedIdentifier] = false;\n } catch {\n this[privateUseDashedIdentifier] = true;\n }\n }\n\n return this[privateUseDashedIdentifier] ? `--${state}` : state;\n }\n }\n\n return WithCustomStateSetElement;\n}\n"]}
|
|
@@ -165,6 +165,16 @@ export class ListItemEl extends listItemBaseClass {
|
|
|
165
165
|
// work programmatically like in FF and select-option
|
|
166
166
|
this.listItemRoot?.focus();
|
|
167
167
|
}
|
|
168
|
+
click() {
|
|
169
|
+
if (!this.listItemRoot) {
|
|
170
|
+
// If the element has not finished rendering, call super to ensure click
|
|
171
|
+
// events are dispatched.
|
|
172
|
+
super.click();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
// Forward click to the element to ensure link <a>.click() works correctly.
|
|
176
|
+
this.listItemRoot.click();
|
|
177
|
+
}
|
|
168
178
|
}
|
|
169
179
|
/** @nocollapse */
|
|
170
180
|
ListItemEl.shadowRootOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OA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;IAED;;OAEG;IACO,UAAU;QAClB,OAAO,IAAI,CAAA;;;;;;;;KAQV,CAAC;IACJ,CAAC;IAES,OAAO;QACf,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEQ,KAAK;QACZ,wEAAwE;QACxE,qDAAqD;QACrD,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,wEAAwE;YACxE,yBAAyB;YACzB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,2EAA2E;QAC3E,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AArLD,kBAAkB;AACF,4BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n\n override click() {\n if (!this.listItemRoot) {\n // If the element has not finished rendering, call super to ensure click\n // events are dispatched.\n super.click();\n return;\n }\n\n // Forward click to the element to ensure link <a>.click() works correctly.\n this.listItemRoot.click();\n }\n}\n"]}
|
package/menu/internal/_menu.scss
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */
|
|
1
|
+
:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:var(--md-menu-top-space, 8px) var(--md-menu-bottom-space, 8px)}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["_menu.scss","../../elevation/internal/_elevation.scss","../../focus/internal/_focus-ring.scss"],"names":[],"mappings":"AAmCE,MCbI,iKDqBF,gBACA,YACA,iBAGF,cEzBI,mGFiCJ,MACE,0FACA,aACA,WACA,YACA,YACA,iBAEA,+BACA,cACA,UACA,WACA,kBACA,iBACA,mBACA,eACA,kBACA,kBACA,wBAGF,gBACE,aAGF,OACE,eAGF,OACE,cACA,qBACA,SACA,aACA,sBACA,gGACA,eACA,mBACA,cACA,kBACA,kBACA,sBACA,wBAGF,cACE,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["_menu.scss","../../elevation/internal/_elevation.scss","../../focus/internal/_focus-ring.scss"],"names":[],"mappings":"AAmCE,MCbI,iKDqBF,gBACA,YACA,iBAGF,cEzBI,mGFiCJ,MACE,0FACA,aACA,WACA,YACA,YACA,iBAEA,+BACA,cACA,UACA,WACA,kBACA,iBACA,mBACA,eACA,kBACA,kBACA,wBAGF,gBACE,aAGF,OACE,eAGF,OACE,cACA,qBACA,SACA,aACA,sBACA,gGACA,eACA,mBACA,cACA,kBACA,kBACA,sBACA,wBAGF,cACE,6EAIF,oCACE,iBAGF,iDAEE,gBAGF,+BAIE,oBAGF,sCACE,UAGF,KACE,cACA,eACA,mBAGF,4CACE,aAGF,8BACE,MACE,mBACA,wBACA","file":"menu-styles.css"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Generated stylesheet for ./menu/internal/menu-styles.css.
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
-
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}
|
|
8
|
+
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:var(--md-menu-top-space, 8px) var(--md-menu-bottom-space, 8px)}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}
|
|
9
9
|
`;
|
|
10
10
|
//# sourceMappingURL=menu-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-styles.js","sourceRoot":"","sources":["menu-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAA4D;AAC5D,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./menu/internal/menu-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"menu-styles.js","sourceRoot":"","sources":["menu-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAA4D;AAC5D,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./menu/internal/menu-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:var(--md-menu-top-space, 8px) var(--md-menu-bottom-space, 8px)}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}\n`;\n"]}
|
package/menu/menu.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { CSSResultOrNative } from 'lit';
|
|
|
7
7
|
import { Menu } from './internal/menu.js';
|
|
8
8
|
export { type ListItem } from '../list/internal/list-navigation-helpers.js';
|
|
9
9
|
export { type MenuItem } from './internal/controllers/menuItemController.js';
|
|
10
|
-
export { FocusState, type CloseMenuEvent, type Menu, } from './internal/controllers/shared.js';
|
|
10
|
+
export { CloseReason, FocusState, type CloseMenuEvent, type Menu, } from './internal/controllers/shared.js';
|
|
11
11
|
export { Corner } from './internal/menu.js';
|
|
12
12
|
declare global {
|
|
13
13
|
interface HTMLElementTagNameMap {
|
package/menu/menu.js
CHANGED
|
@@ -7,7 +7,7 @@ import { __decorate } from "tslib";
|
|
|
7
7
|
import { customElement } from 'lit/decorators.js';
|
|
8
8
|
import { Menu } from './internal/menu.js';
|
|
9
9
|
import { styles } from './internal/menu-styles.js';
|
|
10
|
-
export { FocusState, } from './internal/controllers/shared.js';
|
|
10
|
+
export { CloseReason, FocusState, } from './internal/controllers/shared.js';
|
|
11
11
|
export { Corner } from './internal/menu.js';
|
|
12
12
|
/**
|
|
13
13
|
* @summary Menus display a list of choices on a temporary surface.
|
package/menu/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAGH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAIjD,OAAO,EACL,UAAU,GAGX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAQ1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,IAAI;;AACd,aAAM,GAAwB,CAAC,MAAM,CAAC,AAAhC,CAAiC;AAD5C,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAElB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CSSResultOrNative} from 'lit';\nimport {customElement} from 'lit/decorators.js';\n\nimport {Menu} from './internal/menu.js';\nimport {styles} from './internal/menu-styles.js';\n\nexport {type ListItem} from '../list/internal/list-navigation-helpers.js';\nexport {type MenuItem} from './internal/controllers/menuItemController.js';\nexport {\n FocusState,\n type CloseMenuEvent,\n type Menu,\n} from './internal/controllers/shared.js';\nexport {Corner} from './internal/menu.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu': MdMenu;\n }\n}\n\n/**\n * @summary Menus display a list of choices on a temporary surface.\n *\n * @description\n * Menus appear when users interact with a button, action, or other control.\n *\n * They can be opened from a variety of elements, most commonly icon buttons,\n * buttons, and text fields.\n *\n * md-menu listens for the `close-menu` and `deselect-items` events.\n *\n * - `close-menu` closes the menu when dispatched from a child element.\n * - `deselect-items` deselects all of its immediate menu-item children.\n *\n * @example\n * ```html\n * <div style=\"position:relative;\">\n * <button\n * id=\"anchor\"\n * @click=${() => this.menuRef.value.show()}>\n * Click to open menu\n * </button>\n * <!--\n * `has-overflow` is required when using a submenu which overflows the\n * menu's contents.\n *\n * Additionally, `anchor` ingests an idref which do not pass through shadow\n * roots. You can also set `.anchorElement` to an element reference if\n * necessary.\n * -->\n * <md-menu anchor=\"anchor\" has-overflow ${ref(menuRef)}>\n * <md-menu-item headline=\"This is a headline\"></md-menu-item>\n * <md-sub-menu>\n * <md-menu-item\n * slot=\"item\"\n * headline=\"this is a submenu item\">\n * </md-menu-item>\n * <md-menu slot=\"menu\">\n * <md-menu-item headline=\"This is an item inside a submenu\">\n * </md-menu-item>\n * </md-menu>\n * </md-sub-menu>\n * </md-menu>\n * </div>\n * ```\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-menu')\nexport class MdMenu extends Menu {\n static override styles: CSSResultOrNative[] = [styles];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAGH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAIjD,OAAO,EACL,WAAW,EACX,UAAU,GAGX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAQ1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,IAAI;;AACd,aAAM,GAAwB,CAAC,MAAM,CAAC,AAAhC,CAAiC;AAD5C,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAElB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CSSResultOrNative} from 'lit';\nimport {customElement} from 'lit/decorators.js';\n\nimport {Menu} from './internal/menu.js';\nimport {styles} from './internal/menu-styles.js';\n\nexport {type ListItem} from '../list/internal/list-navigation-helpers.js';\nexport {type MenuItem} from './internal/controllers/menuItemController.js';\nexport {\n CloseReason,\n FocusState,\n type CloseMenuEvent,\n type Menu,\n} from './internal/controllers/shared.js';\nexport {Corner} from './internal/menu.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu': MdMenu;\n }\n}\n\n/**\n * @summary Menus display a list of choices on a temporary surface.\n *\n * @description\n * Menus appear when users interact with a button, action, or other control.\n *\n * They can be opened from a variety of elements, most commonly icon buttons,\n * buttons, and text fields.\n *\n * md-menu listens for the `close-menu` and `deselect-items` events.\n *\n * - `close-menu` closes the menu when dispatched from a child element.\n * - `deselect-items` deselects all of its immediate menu-item children.\n *\n * @example\n * ```html\n * <div style=\"position:relative;\">\n * <button\n * id=\"anchor\"\n * @click=${() => this.menuRef.value.show()}>\n * Click to open menu\n * </button>\n * <!--\n * `has-overflow` is required when using a submenu which overflows the\n * menu's contents.\n *\n * Additionally, `anchor` ingests an idref which do not pass through shadow\n * roots. You can also set `.anchorElement` to an element reference if\n * necessary.\n * -->\n * <md-menu anchor=\"anchor\" has-overflow ${ref(menuRef)}>\n * <md-menu-item headline=\"This is a headline\"></md-menu-item>\n * <md-sub-menu>\n * <md-menu-item\n * slot=\"item\"\n * headline=\"this is a submenu item\">\n * </md-menu-item>\n * <md-menu slot=\"menu\">\n * <md-menu-item headline=\"This is an item inside a submenu\">\n * </md-menu-item>\n * </md-menu>\n * </md-sub-menu>\n * </md-menu>\n * </div>\n * ```\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-menu')\nexport class MdMenu extends Menu {\n static override styles: CSSResultOrNative[] = [styles];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@material/web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"catalog"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"lit": "^2.
|
|
59
|
+
"lit": "^2.8.0 || ^3.0.0",
|
|
60
60
|
"tslib": "^2.4.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
@@ -282,6 +282,15 @@ export declare abstract class TextField extends textFieldBaseClass {
|
|
|
282
282
|
* @param direction The direction in which the selection is performed.
|
|
283
283
|
*/
|
|
284
284
|
setSelectionRange(start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none'): void;
|
|
285
|
+
/**
|
|
286
|
+
* Shows the browser picker for an input element of type "date", "time", etc.
|
|
287
|
+
*
|
|
288
|
+
* For a full list of supported types, see:
|
|
289
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker#browser_compatibility
|
|
290
|
+
*
|
|
291
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
|
|
292
|
+
*/
|
|
293
|
+
showPicker(): void;
|
|
285
294
|
/**
|
|
286
295
|
* Decrements the value of a numeric type text field by `step` or `n` `step`
|
|
287
296
|
* number of times.
|
|
@@ -320,6 +320,21 @@ export class TextField extends textFieldBaseClass {
|
|
|
320
320
|
setSelectionRange(start, end, direction) {
|
|
321
321
|
this.getInputOrTextarea().setSelectionRange(start, end, direction);
|
|
322
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Shows the browser picker for an input element of type "date", "time", etc.
|
|
325
|
+
*
|
|
326
|
+
* For a full list of supported types, see:
|
|
327
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker#browser_compatibility
|
|
328
|
+
*
|
|
329
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
|
|
330
|
+
*/
|
|
331
|
+
showPicker() {
|
|
332
|
+
const input = this.getInput();
|
|
333
|
+
if (!input) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
input.showPicker();
|
|
337
|
+
}
|
|
323
338
|
/**
|
|
324
339
|
* Decrements the value of a numeric type text field by `step` or `n` `step`
|
|
325
340
|
* number of times.
|