@material/web 2.4.2-nightly.2fe7e22.0 → 2.4.2-nightly.3758f46.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 +0 -4
- package/button/internal/button.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/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 +1 -1
- package/labs/gb/components/button/md-button.js +9 -9
- 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.js +6 -6
- 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 +250 -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 +2 -0
- package/menu/internal/menuitem/menu-item.d.ts +2 -0
- package/package.json +7 -3
- 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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type ClassInfo } from 'lit/directives/class-map.js';
|
|
7
|
+
/** List classes. */
|
|
8
|
+
export declare const LIST_CLASSES: {
|
|
9
|
+
readonly list: "list";
|
|
10
|
+
readonly listSegmented: "list-segmented";
|
|
11
|
+
};
|
|
12
|
+
/** The state provided to the `listClasses()` function. */
|
|
13
|
+
export interface ListClassesState {
|
|
14
|
+
/** Whether to render the list with segmented items. */
|
|
15
|
+
segmented?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the list classes to apply to an element based on the given state.
|
|
19
|
+
*
|
|
20
|
+
* @param state The state of the list.
|
|
21
|
+
* @return An object of class names and truthy values if they apply.
|
|
22
|
+
*/
|
|
23
|
+
export declare function listClasses({ segmented, }?: ListClassesState): ClassInfo;
|
|
24
|
+
/**
|
|
25
|
+
* A Lit directive that adds list styling and functionality to its element.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* html`
|
|
30
|
+
* <ul class="${list()}">
|
|
31
|
+
* <li><button class="${listItem()}">List item 1</button></li>
|
|
32
|
+
* <li><button class="${listItem()}">List item 2</button></li>
|
|
33
|
+
* <li><button class="${listItem()}">List item 3</button></li>
|
|
34
|
+
* </ul>
|
|
35
|
+
* `;
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const list: (state?: ListClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
39
|
+
/** List item classes. */
|
|
40
|
+
export declare const LIST_ITEM_CLASSES: {
|
|
41
|
+
readonly listItem: "list-item";
|
|
42
|
+
readonly listItemStatic: "list-item-static";
|
|
43
|
+
readonly listItemContent: "list-item-content";
|
|
44
|
+
readonly listItemLeading: "list-item-leading";
|
|
45
|
+
readonly listItemTrailing: "list-item-trailing";
|
|
46
|
+
readonly listItemOverline: "list-item-overline";
|
|
47
|
+
readonly listItemSupportingText: "list-item-supporting-text";
|
|
48
|
+
readonly listItemTrailingText: "list-item-trailing-text";
|
|
49
|
+
readonly listItemAvatar: "list-item-avatar";
|
|
50
|
+
readonly checked: string;
|
|
51
|
+
readonly hover: string;
|
|
52
|
+
readonly focus: string;
|
|
53
|
+
readonly active: string;
|
|
54
|
+
readonly disabled: string;
|
|
55
|
+
};
|
|
56
|
+
/** The state provided to the `listItemClasses()` function. */
|
|
57
|
+
export interface ListItemClassesState {
|
|
58
|
+
/** Whether the list item is non-interactive. */
|
|
59
|
+
static?: boolean;
|
|
60
|
+
/** Emulates `:checked`. */
|
|
61
|
+
checked?: boolean;
|
|
62
|
+
/** Emulates `:hover`. */
|
|
63
|
+
hover?: boolean;
|
|
64
|
+
/** Emulates `:focus`. */
|
|
65
|
+
focus?: boolean;
|
|
66
|
+
/** Emulates `:active`. */
|
|
67
|
+
active?: boolean;
|
|
68
|
+
/** Emulates `:disabled`. */
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the list item classes to apply to an element based on the given
|
|
73
|
+
* state.
|
|
74
|
+
*
|
|
75
|
+
* @param state The state of the list item.
|
|
76
|
+
* @return An object of class names and truthy values if they apply.
|
|
77
|
+
*/
|
|
78
|
+
export declare function listItemClasses({ static: staticItem, checked, hover, focus, active, disabled, }?: ListItemClassesState): ClassInfo;
|
|
79
|
+
/**
|
|
80
|
+
* Sets up list item functionality for the given element.
|
|
81
|
+
*
|
|
82
|
+
* @param listItem The element on which to set up list item functionality.
|
|
83
|
+
* @param opts Setup options, supports a cleanup `signal`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function setupListItem(listItem: HTMLElement, opts?: {
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* A Lit directive that adds list item styling and functionality to its element.
|
|
90
|
+
*
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* html`
|
|
95
|
+
* <ul class="${list()}">
|
|
96
|
+
* <li><button class="${listItem()}">List item 1</button></li>
|
|
97
|
+
* <li><button class="${listItem()}">List item 2</button></li>
|
|
98
|
+
* <li><button class="${listItem()}">List item 3</button></li>
|
|
99
|
+
* </ul>
|
|
100
|
+
* `;
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare const listItem: (state?: ListItemClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FOCUS_RING_CLASSES } from '../focus/focus-ring.js';
|
|
7
|
+
import { RIPPLE_CLASSES, setupRipple } from '../ripple/ripple.js';
|
|
8
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
9
|
+
import { PSEUDO_CLASSES } from '../shared/pseudo-classes.js';
|
|
10
|
+
/** List classes. */
|
|
11
|
+
export const LIST_CLASSES = {
|
|
12
|
+
list: 'list',
|
|
13
|
+
listSegmented: 'list-segmented',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Returns the list classes to apply to an element based on the given state.
|
|
17
|
+
*
|
|
18
|
+
* @param state The state of the list.
|
|
19
|
+
* @return An object of class names and truthy values if they apply.
|
|
20
|
+
*/
|
|
21
|
+
export function listClasses({ segmented = false, } = {}) {
|
|
22
|
+
return {
|
|
23
|
+
[LIST_CLASSES.list]: true,
|
|
24
|
+
[LIST_CLASSES.listSegmented]: segmented,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A Lit directive that adds list styling and functionality to its element.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* html`
|
|
33
|
+
* <ul class="${list()}">
|
|
34
|
+
* <li><button class="${listItem()}">List item 1</button></li>
|
|
35
|
+
* <li><button class="${listItem()}">List item 2</button></li>
|
|
36
|
+
* <li><button class="${listItem()}">List item 3</button></li>
|
|
37
|
+
* </ul>
|
|
38
|
+
* `;
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const list = createClassMapDirective({
|
|
42
|
+
getClasses: listClasses,
|
|
43
|
+
});
|
|
44
|
+
/** List item classes. */
|
|
45
|
+
export const LIST_ITEM_CLASSES = {
|
|
46
|
+
listItem: 'list-item',
|
|
47
|
+
listItemStatic: 'list-item-static',
|
|
48
|
+
listItemContent: 'list-item-content',
|
|
49
|
+
listItemLeading: 'list-item-leading',
|
|
50
|
+
listItemTrailing: 'list-item-trailing',
|
|
51
|
+
listItemOverline: 'list-item-overline',
|
|
52
|
+
listItemSupportingText: 'list-item-supporting-text',
|
|
53
|
+
listItemTrailingText: 'list-item-trailing-text',
|
|
54
|
+
listItemAvatar: 'list-item-avatar',
|
|
55
|
+
checked: PSEUDO_CLASSES.checked,
|
|
56
|
+
hover: PSEUDO_CLASSES.hover,
|
|
57
|
+
focus: PSEUDO_CLASSES.focus,
|
|
58
|
+
active: PSEUDO_CLASSES.active,
|
|
59
|
+
disabled: PSEUDO_CLASSES.disabled,
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Returns the list item classes to apply to an element based on the given
|
|
63
|
+
* state.
|
|
64
|
+
*
|
|
65
|
+
* @param state The state of the list item.
|
|
66
|
+
* @return An object of class names and truthy values if they apply.
|
|
67
|
+
*/
|
|
68
|
+
export function listItemClasses({ static: staticItem = false, checked = false, hover = false, focus = false, active = false, disabled = false, } = {}) {
|
|
69
|
+
return {
|
|
70
|
+
[RIPPLE_CLASSES.ripple]: !staticItem,
|
|
71
|
+
[FOCUS_RING_CLASSES.focusRingInner]: !staticItem,
|
|
72
|
+
[LIST_ITEM_CLASSES.listItem]: true,
|
|
73
|
+
[LIST_ITEM_CLASSES.listItemStatic]: staticItem,
|
|
74
|
+
[LIST_ITEM_CLASSES.checked]: checked,
|
|
75
|
+
[LIST_ITEM_CLASSES.hover]: hover,
|
|
76
|
+
[LIST_ITEM_CLASSES.focus]: focus,
|
|
77
|
+
[LIST_ITEM_CLASSES.active]: active,
|
|
78
|
+
[LIST_ITEM_CLASSES.disabled]: disabled,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets up list item functionality for the given element.
|
|
83
|
+
*
|
|
84
|
+
* @param listItem The element on which to set up list item functionality.
|
|
85
|
+
* @param opts Setup options, supports a cleanup `signal`.
|
|
86
|
+
*/
|
|
87
|
+
export function setupListItem(listItem, opts) {
|
|
88
|
+
setupRipple(listItem, opts);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A Lit directive that adds list item styling and functionality to its element.
|
|
92
|
+
*
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* html`
|
|
97
|
+
* <ul class="${list()}">
|
|
98
|
+
* <li><button class="${listItem()}">List item 1</button></li>
|
|
99
|
+
* <li><button class="${listItem()}">List item 2</button></li>
|
|
100
|
+
* <li><button class="${listItem()}">List item 3</button></li>
|
|
101
|
+
* </ul>
|
|
102
|
+
* `;
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export const listItem = createClassMapDirective({
|
|
106
|
+
getClasses: listItemClasses,
|
|
107
|
+
setupElement: setupListItem,
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAE3D,oBAAoB;AACpB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,gBAAgB;CACvB,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,SAAS,GAAG,KAAK,MACG,EAAE;IACtB,OAAO;QACL,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI;QACzB,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,SAAS;KACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAC;IAC1C,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC;AAEH,yBAAyB;AACzB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,gBAAgB,EAAE,oBAAoB;IACtC,gBAAgB,EAAE,oBAAoB;IACtC,sBAAsB,EAAE,2BAA2B;IACnD,oBAAoB,EAAE,yBAAyB;IAC/C,cAAc,EAAE,kBAAkB;IAClC,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,MAAM,EAAE,cAAc,CAAC,MAAM;IAC7B,QAAQ,EAAE,cAAc,CAAC,QAAQ;CACzB,CAAC;AAkBX;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EAAE,UAAU,GAAG,KAAK,EAC1B,OAAO,GAAG,KAAK,EACf,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,MAAM,GAAG,KAAK,EACd,QAAQ,GAAG,KAAK,MACQ,EAAE;IAC1B,OAAO;QACL,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU;QACpC,CAAC,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU;QAChD,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,IAAI;QAClC,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,UAAU;QAC9C,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO;QACpC,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK;QAChC,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK;QAChC,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM;QAClC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ;KACvC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAqB,EACrB,IAA6B;IAE7B,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,uBAAuB,CAAC;IAC9C,UAAU,EAAE,eAAe;IAC3B,YAAY,EAAE,aAAa;CAC5B,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {type ClassInfo} from 'lit/directives/class-map.js';\nimport {FOCUS_RING_CLASSES} from '../focus/focus-ring.js';\nimport {RIPPLE_CLASSES, setupRipple} from '../ripple/ripple.js';\nimport {createClassMapDirective} from '../shared/directives.js';\nimport {PSEUDO_CLASSES} from '../shared/pseudo-classes.js';\n\n/** List classes. */\nexport const LIST_CLASSES = {\n list: 'list',\n listSegmented: 'list-segmented',\n} as const;\n\n/** The state provided to the `listClasses()` function. */\nexport interface ListClassesState {\n /** Whether to render the list with segmented items. */\n segmented?: boolean;\n}\n\n/**\n * Returns the list classes to apply to an element based on the given state.\n *\n * @param state The state of the list.\n * @return An object of class names and truthy values if they apply.\n */\nexport function listClasses({\n segmented = false,\n}: ListClassesState = {}): ClassInfo {\n return {\n [LIST_CLASSES.list]: true,\n [LIST_CLASSES.listSegmented]: segmented,\n };\n}\n\n/**\n * A Lit directive that adds list styling and functionality to its element.\n *\n * @example\n * ```ts\n * html`\n * <ul class=\"${list()}\">\n * <li><button class=\"${listItem()}\">List item 1</button></li>\n * <li><button class=\"${listItem()}\">List item 2</button></li>\n * <li><button class=\"${listItem()}\">List item 3</button></li>\n * </ul>\n * `;\n * ```\n */\nexport const list = createClassMapDirective({\n getClasses: listClasses,\n});\n\n/** List item classes. */\nexport const LIST_ITEM_CLASSES = {\n listItem: 'list-item',\n listItemStatic: 'list-item-static',\n listItemContent: 'list-item-content',\n listItemLeading: 'list-item-leading',\n listItemTrailing: 'list-item-trailing',\n listItemOverline: 'list-item-overline',\n listItemSupportingText: 'list-item-supporting-text',\n listItemTrailingText: 'list-item-trailing-text',\n listItemAvatar: 'list-item-avatar',\n checked: PSEUDO_CLASSES.checked,\n hover: PSEUDO_CLASSES.hover,\n focus: PSEUDO_CLASSES.focus,\n active: PSEUDO_CLASSES.active,\n disabled: PSEUDO_CLASSES.disabled,\n} as const;\n\n/** The state provided to the `listItemClasses()` function. */\nexport interface ListItemClassesState {\n /** Whether the list item is non-interactive. */\n static?: boolean;\n /** Emulates `:checked`. */\n checked?: boolean;\n /** Emulates `:hover`. */\n hover?: boolean;\n /** Emulates `:focus`. */\n focus?: boolean;\n /** Emulates `:active`. */\n active?: boolean;\n /** Emulates `:disabled`. */\n disabled?: boolean;\n}\n\n/**\n * Returns the list item classes to apply to an element based on the given\n * state.\n *\n * @param state The state of the list item.\n * @return An object of class names and truthy values if they apply.\n */\nexport function listItemClasses({\n static: staticItem = false,\n checked = false,\n hover = false,\n focus = false,\n active = false,\n disabled = false,\n}: ListItemClassesState = {}): ClassInfo {\n return {\n [RIPPLE_CLASSES.ripple]: !staticItem,\n [FOCUS_RING_CLASSES.focusRingInner]: !staticItem,\n [LIST_ITEM_CLASSES.listItem]: true,\n [LIST_ITEM_CLASSES.listItemStatic]: staticItem,\n [LIST_ITEM_CLASSES.checked]: checked,\n [LIST_ITEM_CLASSES.hover]: hover,\n [LIST_ITEM_CLASSES.focus]: focus,\n [LIST_ITEM_CLASSES.active]: active,\n [LIST_ITEM_CLASSES.disabled]: disabled,\n };\n}\n\n/**\n * Sets up list item functionality for the given element.\n *\n * @param listItem The element on which to set up list item functionality.\n * @param opts Setup options, supports a cleanup `signal`.\n */\nexport function setupListItem(\n listItem: HTMLElement,\n opts?: {signal?: AbortSignal},\n): void {\n setupRipple(listItem, opts);\n}\n\n/**\n * A Lit directive that adds list item styling and functionality to its element.\n *\n *\n * @example\n * ```ts\n * html`\n * <ul class=\"${list()}\">\n * <li><button class=\"${listItem()}\">List item 1</button></li>\n * <li><button class=\"${listItem()}\">List item 2</button></li>\n * <li><button class=\"${listItem()}\">List item 3</button></li>\n * </ul>\n * `;\n * ```\n */\nexport const listItem = createClassMapDirective({\n getClasses: listItemClasses,\n setupElement: setupListItem,\n});\n"]}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
7
|
+
@use '../checkbox/checkbox-tokens';
|
|
8
|
+
@use '../radio/radio-tokens';
|
|
9
|
+
@use 'list-tokens';
|
|
10
|
+
// go/keep-sorted end
|
|
11
|
+
|
|
12
|
+
@layer md.sys, md.comp.ripple, md.comp.focus-ring, md.comp.checkbox, md.comp.radio;
|
|
13
|
+
@layer md.comp.list {
|
|
14
|
+
.list {
|
|
15
|
+
& {
|
|
16
|
+
@include list-tokens.root;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.list-segmented {
|
|
20
|
+
@include list-tokens.segmented;
|
|
21
|
+
--list-segmented: true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
& {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
margin: unset;
|
|
28
|
+
padding: unset;
|
|
29
|
+
list-style: none;
|
|
30
|
+
gap: var(--gap);
|
|
31
|
+
border-radius: var(--container-shape);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
> :first-child:not(slot),
|
|
35
|
+
::slotted(:first-child) {
|
|
36
|
+
border-start-start-radius: inherit;
|
|
37
|
+
border-start-end-radius: inherit;
|
|
38
|
+
--first-child: true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
> :last-child:not(slot),
|
|
42
|
+
::slotted(:last-child) {
|
|
43
|
+
border-end-start-radius: inherit;
|
|
44
|
+
border-end-end-radius: inherit;
|
|
45
|
+
--last-child: true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
slot {
|
|
49
|
+
border-radius: inherit;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.list-select {
|
|
54
|
+
&,
|
|
55
|
+
&::picker(select) {
|
|
56
|
+
// stylelint-disable-next-line scss/declaration-property-value-no-unknown --
|
|
57
|
+
// Uses customizable select
|
|
58
|
+
appearance: base-select;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
border: none;
|
|
62
|
+
background: none;
|
|
63
|
+
height: fit-content;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.list-item {
|
|
67
|
+
& {
|
|
68
|
+
@include list-tokens.item;
|
|
69
|
+
|
|
70
|
+
@container style(--list-segmented: true) {
|
|
71
|
+
@include list-tokens.item-segmented;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:where(:not(.list-item-static)) {
|
|
76
|
+
&:is(:hover, .hover) {
|
|
77
|
+
@include list-tokens.item-hovered;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:is(:focus-within, .focus) {
|
|
81
|
+
@include list-tokens.item-focused;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:is(:active, .active) {
|
|
85
|
+
@include list-tokens.item-pressed;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:is(:checked, .checked) {
|
|
90
|
+
@include list-tokens.item-selected;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:is(:disabled, .disabled) {
|
|
94
|
+
@include list-tokens.item-disabled;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
& {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: var(--between-space);
|
|
101
|
+
box-sizing: border-box;
|
|
102
|
+
min-height: var(--container-height);
|
|
103
|
+
border-radius: var(--container-shape);
|
|
104
|
+
background-color: var(--container-color);
|
|
105
|
+
padding-inline: var(--leading-space) var(--trailing-space);
|
|
106
|
+
padding-block: var(--top-space) var(--bottom-space);
|
|
107
|
+
color: var(--label-text-color);
|
|
108
|
+
font: var(--label-text);
|
|
109
|
+
letter-spacing: var(--label-text-tracking);
|
|
110
|
+
appearance: none;
|
|
111
|
+
border: none;
|
|
112
|
+
text-align: unset;
|
|
113
|
+
text-decoration: unset;
|
|
114
|
+
width: stretch;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@container style(--first-child: true) {
|
|
118
|
+
border-start-start-radius: inherit;
|
|
119
|
+
border-start-end-radius: inherit;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@container style(--last-child: true) {
|
|
123
|
+
border-end-start-radius: inherit;
|
|
124
|
+
border-end-end-radius: inherit;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:not(:disabled, .disabled, .list-item-static) {
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.list-item-content {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
flex: 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.list-item-leading,
|
|
138
|
+
.list-item-trailing {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 8px;
|
|
142
|
+
min-height: 28px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.list-item-leading {
|
|
146
|
+
--md-icon-color: var(--leading-icon-color);
|
|
147
|
+
--md-icon-size: var(--leading-icon-size);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.list-item-trailing {
|
|
151
|
+
--md-icon-color: var(--trailing-icon-color);
|
|
152
|
+
--md-icon-size: var(--trailing-icon-size);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.list-item-overline {
|
|
156
|
+
font: var(--overline);
|
|
157
|
+
letter-spacing: var(--overline-tracking);
|
|
158
|
+
color: var(--overline-color);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.list-item-supporting-text {
|
|
162
|
+
font: var(--supporting-text);
|
|
163
|
+
letter-spacing: var(--supporting-text-tracking);
|
|
164
|
+
color: var(--supporting-text-color);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.list-item-trailing-text {
|
|
168
|
+
font: var(--trailing-supporting-text);
|
|
169
|
+
letter-spacing: var(--trailing-supporting-text-tracking);
|
|
170
|
+
color: var(--trailing-supporting-text-color);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.list-item-avatar {
|
|
174
|
+
display: grid;
|
|
175
|
+
place-items: center;
|
|
176
|
+
background-color: var(--avatar-color);
|
|
177
|
+
border-radius: var(--avatar-shape);
|
|
178
|
+
aspect-ratio: 1;
|
|
179
|
+
width: var(--avatar-size);
|
|
180
|
+
font: var(--avatar-label);
|
|
181
|
+
letter-spacing: var(--avatar-label-tracking);
|
|
182
|
+
color: var(--avatar-label-color);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&::checkmark {
|
|
186
|
+
font: var(--leading-icon-size) var(--md-icon-font);
|
|
187
|
+
color: var(--leading-icon-color);
|
|
188
|
+
content: 'check';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&:has(.list-item-radio, .list-item-checkbox)::checkmark {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.list-item-radio,
|
|
196
|
+
.list-item-checkbox {
|
|
197
|
+
width: min-content;
|
|
198
|
+
height: min-content;
|
|
199
|
+
--ripple: none;
|
|
200
|
+
--focus-ring-outline: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&:is(:checked, .checked) .list-item-radio {
|
|
204
|
+
@include radio-tokens.selected;
|
|
205
|
+
--icon: 'radio_button_checked';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:is(:checked, .checked) .list-item-checkbox {
|
|
209
|
+
@include checkbox-tokens.selected;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 item component. */
|
|
10
|
+
'md-list-item': ListItem;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("@material/web/labs/behaviors/element-internals.js").WithElementInternals>>;
|
|
14
|
+
/**
|
|
15
|
+
* A Material Design list item component.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ListItem extends baseClass {
|
|
18
|
+
/** @nocollapse */
|
|
19
|
+
static shadowRootOptions: {
|
|
20
|
+
delegatesFocus: boolean;
|
|
21
|
+
clonable?: boolean;
|
|
22
|
+
customElementRegistry?: CustomElementRegistry;
|
|
23
|
+
mode: ShadowRootMode;
|
|
24
|
+
serializable?: boolean;
|
|
25
|
+
slotAssignment?: SlotAssignmentMode;
|
|
26
|
+
};
|
|
27
|
+
static styles: CSSResultOrNative[];
|
|
28
|
+
constructor();
|
|
29
|
+
/**
|
|
30
|
+
* Whether the list item is selected.
|
|
31
|
+
*/
|
|
32
|
+
checked: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the list item is disabled.
|
|
35
|
+
*/
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the list item is non-interactive.
|
|
39
|
+
*/
|
|
40
|
+
nonInteractive: boolean;
|
|
41
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
42
|
+
private renderContent;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -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 { mixinDelegatesAria } from '@material/web/internal/aria/delegate.js';
|
|
8
|
+
import { internals, mixinElementInternals, } from '@material/web/labs/behaviors/element-internals.js';
|
|
9
|
+
import { hasSlotted } from '@material/web/labs/gb/components/shared/has-slotted.js';
|
|
10
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
13
|
+
// import {styles as focusRingStyles} from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only
|
|
14
|
+
import rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with { type: 'css' }; // github-only
|
|
15
|
+
// import {styles as rippleStyles} from '@material/web/labs/gb/components/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;;AAGH,OAAO,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,wDAAwD,CAAC;AAClF,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,eAAe,MAAM,uDAAuD,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtH,4HAA4H;AAC5H,OAAO,YAAY,MAAM,oDAAoD,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AAChH,sHAAsH;AACtH,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 {ARIAMixinStrict} from '@material/web/internal/aria/aria.js';\nimport {mixinDelegatesAria} from '@material/web/internal/aria/delegate.js';\nimport {\n internals,\n mixinElementInternals,\n} from '@material/web/labs/behaviors/element-internals.js';\nimport {hasSlotted} from '@material/web/labs/gb/components/shared/has-slotted.js';\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\n\nimport focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with {type: 'css'}; // github-only\n// import {styles as focusRingStyles} from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with {type: 'css'}; // github-only\n// import {styles as rippleStyles} from '@material/web/labs/gb/components/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 {};
|