@material/web 2.5.0 → 2.5.1-nightly.70e259d.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/custom-elements.json +20685 -18451
- package/labs/aria/query-associated.d.ts +23 -0
- package/labs/aria/query-associated.js +36 -0
- package/labs/aria/query-associated.js.map +1 -0
- package/labs/aria/tabs/md-aria-tab.d.ts +11 -0
- package/labs/aria/tabs/md-aria-tab.js +8 -0
- package/labs/aria/tabs/md-aria-tab.js.map +1 -0
- package/labs/aria/tabs/md-aria-tablist.d.ts +11 -0
- package/labs/aria/tabs/md-aria-tablist.js +8 -0
- package/labs/aria/tabs/md-aria-tablist.js.map +1 -0
- package/labs/aria/tabs/md-aria-tabpanel.d.ts +11 -0
- package/labs/aria/tabs/md-aria-tabpanel.js +8 -0
- package/labs/aria/tabs/md-aria-tabpanel.js.map +1 -0
- package/labs/aria/tabs/tab.d.ts +33 -0
- package/labs/aria/tabs/tab.js +88 -0
- package/labs/aria/tabs/tab.js.map +1 -0
- package/labs/aria/tabs/tablist.d.ts +67 -0
- package/labs/aria/tabs/tablist.js +271 -0
- package/labs/aria/tabs/tablist.js.map +1 -0
- package/labs/aria/tabs/tabpanel.d.ts +26 -0
- package/labs/aria/tabs/tabpanel.js +53 -0
- package/labs/aria/tabs/tabpanel.js.map +1 -0
- package/labs/gb/components/appbar/_app-bar-tokens.scss +136 -0
- package/labs/gb/components/appbar/app-bar-element.d.ts +53 -0
- package/labs/gb/components/appbar/app-bar-element.js +144 -0
- package/labs/gb/components/appbar/app-bar-element.js.map +1 -0
- package/labs/gb/components/appbar/app-bar.css +4 -0
- package/labs/gb/components/appbar/app-bar.css.map +1 -0
- package/labs/gb/components/appbar/app-bar.cssresult.d.ts +3 -0
- package/labs/gb/components/appbar/app-bar.cssresult.js +14 -0
- package/labs/gb/components/appbar/app-bar.cssresult.js.map +1 -0
- package/labs/gb/components/appbar/app-bar.d.ts +71 -0
- package/labs/gb/components/appbar/app-bar.js +96 -0
- package/labs/gb/components/appbar/app-bar.js.map +1 -0
- package/labs/gb/components/appbar/app-bar.scss +167 -0
- package/labs/gb/components/appbar/md-gb-app-bar.d.ts +12 -0
- package/labs/gb/components/appbar/md-gb-app-bar.js +8 -0
- package/labs/gb/components/appbar/md-gb-app-bar.js.map +1 -0
- package/labs/gb/components/chip/_chip-tokens.scss +167 -0
- package/labs/gb/components/chip/chip-element.d.ts +73 -0
- package/labs/gb/components/chip/chip-element.js +233 -0
- package/labs/gb/components/chip/chip-element.js.map +1 -0
- package/labs/gb/components/chip/chip.css +4 -0
- package/labs/gb/components/chip/chip.css.map +1 -0
- package/labs/gb/components/chip/chip.cssresult.d.ts +3 -0
- package/labs/gb/components/chip/chip.cssresult.js +14 -0
- package/labs/gb/components/chip/chip.cssresult.js.map +1 -0
- package/labs/gb/components/chip/chip.d.ts +77 -0
- package/labs/gb/components/chip/chip.js +99 -0
- package/labs/gb/components/chip/chip.js.map +1 -0
- package/labs/gb/components/chip/chip.scss +97 -0
- package/labs/gb/components/chip/md-gb-chip.d.ts +13 -0
- package/labs/gb/components/chip/md-gb-chip.js +9 -0
- package/labs/gb/components/chip/md-gb-chip.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
7
|
+
/** App Bar size configurations. */
|
|
8
|
+
export const APP_BAR_SIZES = {
|
|
9
|
+
sm: 'sm',
|
|
10
|
+
md: 'md',
|
|
11
|
+
lg: 'lg',
|
|
12
|
+
};
|
|
13
|
+
/** App Bar variant configurations. */
|
|
14
|
+
export const APP_BAR_VARIANTS = {
|
|
15
|
+
standard: 'standard',
|
|
16
|
+
search: 'search',
|
|
17
|
+
};
|
|
18
|
+
/** App Bar classes. */
|
|
19
|
+
export const APP_BAR_CLASSES = {
|
|
20
|
+
appBar: 'app-bar',
|
|
21
|
+
appBarSm: 'app-bar-sm',
|
|
22
|
+
appBarMd: 'app-bar-md',
|
|
23
|
+
appBarLg: 'app-bar-lg',
|
|
24
|
+
appBarWithSubtitle: 'app-bar-with-subtitle',
|
|
25
|
+
appBarSearch: 'app-bar-search',
|
|
26
|
+
appBarScrolled: 'app-bar-scrolled',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Returns the app bar classes to apply to an element based on the given state.
|
|
30
|
+
*
|
|
31
|
+
* @param state The state of the app bar.
|
|
32
|
+
* @return An object of class names and truthy values if they apply.
|
|
33
|
+
*/
|
|
34
|
+
export function appBarClasses({ size = 'sm', withSubtitle = false, variant = 'standard', scrolled = false, } = {}) {
|
|
35
|
+
return {
|
|
36
|
+
[APP_BAR_CLASSES.appBar]: true,
|
|
37
|
+
[APP_BAR_CLASSES.appBarSm]: size === APP_BAR_SIZES.sm || !size,
|
|
38
|
+
[APP_BAR_CLASSES.appBarMd]: size === APP_BAR_SIZES.md,
|
|
39
|
+
[APP_BAR_CLASSES.appBarLg]: size === APP_BAR_SIZES.lg,
|
|
40
|
+
[APP_BAR_CLASSES.appBarWithSubtitle]: withSubtitle,
|
|
41
|
+
[APP_BAR_CLASSES.appBarSearch]: variant === APP_BAR_VARIANTS.search,
|
|
42
|
+
[APP_BAR_CLASSES.appBarScrolled]: scrolled,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Sets up optional scroll target tracking for the given app bar element when an explicit `scrollTarget` is provided.
|
|
47
|
+
*
|
|
48
|
+
* @param appBar The element on which to set up app bar functionality.
|
|
49
|
+
* @param opts Setup options, containing an explicit `scrollTarget` and optional cleanup `signal`.
|
|
50
|
+
*/
|
|
51
|
+
export function setupAppBar(appBar, opts) {
|
|
52
|
+
if (!opts?.scrollTarget) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const target = opts.scrollTarget;
|
|
56
|
+
const signal = opts.signal;
|
|
57
|
+
const onScroll = () => {
|
|
58
|
+
if (signal?.aborted)
|
|
59
|
+
return;
|
|
60
|
+
let scrollTop = 0;
|
|
61
|
+
if (target instanceof Window) {
|
|
62
|
+
scrollTop = target.scrollY || target.document.documentElement.scrollTop;
|
|
63
|
+
}
|
|
64
|
+
else if (target instanceof HTMLElement) {
|
|
65
|
+
scrollTop = target.scrollTop;
|
|
66
|
+
}
|
|
67
|
+
const isScrolled = scrollTop > 0;
|
|
68
|
+
const wasScrolled = appBar.classList.contains(APP_BAR_CLASSES.appBarScrolled);
|
|
69
|
+
if (isScrolled !== wasScrolled) {
|
|
70
|
+
appBar.classList.toggle(APP_BAR_CLASSES.appBarScrolled, isScrolled);
|
|
71
|
+
appBar.dispatchEvent(new CustomEvent('scrollstatechange', {
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true,
|
|
74
|
+
detail: { scrolled: isScrolled },
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
target.addEventListener('scroll', onScroll, { passive: true, signal });
|
|
79
|
+
onScroll();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A Lit directive that adds app bar styling and optional scroll tracking functionality to its element.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* html`<div class="${appBar({size: 'md', scrolled: true})}">
|
|
87
|
+
* <div class="app-bar-top-row">...</div>
|
|
88
|
+
* <div class="app-bar-bottom-row">...</div>
|
|
89
|
+
* </div>`;
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export const appBar = createClassMapDirective({
|
|
93
|
+
getClasses: appBarClasses,
|
|
94
|
+
setupElement: setupAppBar,
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=app-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-bar.js","sourceRoot":"","sources":["app-bar.ts"],"names":[],"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;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,uBAAuB,CAAC;IAC5C,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,WAAW;CAC1B,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';\n\nimport {createClassMapDirective} from '../shared/directives.js';\n\n/** App Bar size configuration types. */\nexport type AppBarSize = 'sm' | 'md' | 'lg';\n\n/** App Bar size configurations. */\nexport const APP_BAR_SIZES = {\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n} as const;\n\n/** App Bar variant configuration types. */\nexport type AppBarVariant = 'standard' | 'search';\n\n/** App Bar variant configurations. */\nexport const APP_BAR_VARIANTS = {\n standard: 'standard',\n search: 'search',\n} as const;\n\n/** App Bar classes. */\nexport const APP_BAR_CLASSES = {\n appBar: 'app-bar',\n appBarSm: 'app-bar-sm',\n appBarMd: 'app-bar-md',\n appBarLg: 'app-bar-lg',\n appBarWithSubtitle: 'app-bar-with-subtitle',\n appBarSearch: 'app-bar-search',\n appBarScrolled: 'app-bar-scrolled',\n} as const;\n\n/** The state provided to the `appBarClasses()` function. */\nexport interface AppBarClassesState {\n /** The size of the app bar (`sm`, `md`, `lg`). */\n size?: AppBarSize;\n /** Whether the app bar has a subtitle. */\n withSubtitle?: boolean;\n /** The behavior variant (`standard` or `search`). */\n variant?: AppBarVariant;\n /** Whether the app bar is in a scrolled or docked state (`.app-bar-scrolled`). */\n scrolled?: boolean;\n}\n\n/**\n * Returns the app bar classes to apply to an element based on the given state.\n *\n * @param state The state of the app bar.\n * @return An object of class names and truthy values if they apply.\n */\nexport function appBarClasses({\n size = 'sm',\n withSubtitle = false,\n variant = 'standard',\n scrolled = false,\n}: AppBarClassesState = {}): ClassInfo {\n return {\n [APP_BAR_CLASSES.appBar]: true,\n [APP_BAR_CLASSES.appBarSm]: size === APP_BAR_SIZES.sm || !size,\n [APP_BAR_CLASSES.appBarMd]: size === APP_BAR_SIZES.md,\n [APP_BAR_CLASSES.appBarLg]: size === APP_BAR_SIZES.lg,\n [APP_BAR_CLASSES.appBarWithSubtitle]: withSubtitle,\n [APP_BAR_CLASSES.appBarSearch]: variant === APP_BAR_VARIANTS.search,\n [APP_BAR_CLASSES.appBarScrolled]: scrolled,\n };\n}\n\n/**\n * Sets up optional scroll target tracking for the given app bar element when an explicit `scrollTarget` is provided.\n *\n * @param appBar The element on which to set up app bar functionality.\n * @param opts Setup options, containing an explicit `scrollTarget` and optional cleanup `signal`.\n */\nexport function setupAppBar(\n appBar: HTMLElement,\n opts?: {signal?: AbortSignal; scrollTarget?: HTMLElement | Window},\n): void {\n if (!opts?.scrollTarget) {\n return;\n }\n const target = opts.scrollTarget;\n const signal = opts.signal;\n\n const onScroll = () => {\n if (signal?.aborted) return;\n let scrollTop = 0;\n if (target instanceof Window) {\n scrollTop = target.scrollY || target.document.documentElement.scrollTop;\n } else if (target instanceof HTMLElement) {\n scrollTop = target.scrollTop;\n }\n const isScrolled = scrollTop > 0;\n const wasScrolled = appBar.classList.contains(\n APP_BAR_CLASSES.appBarScrolled,\n );\n if (isScrolled !== wasScrolled) {\n appBar.classList.toggle(APP_BAR_CLASSES.appBarScrolled, isScrolled);\n appBar.dispatchEvent(\n new CustomEvent('scrollstatechange', {\n bubbles: true,\n composed: true,\n detail: {scrolled: isScrolled},\n }),\n );\n }\n };\n\n target.addEventListener('scroll', onScroll, {passive: true, signal});\n onScroll();\n}\n\n/**\n * A Lit directive that adds app bar styling and optional scroll tracking functionality to its element.\n *\n * @example\n * ```ts\n * html`<div class=\"${appBar({size: 'md', scrolled: true})}\">\n * <div class=\"app-bar-top-row\">...</div>\n * <div class=\"app-bar-bottom-row\">...</div>\n * </div>`;\n * ```\n */\nexport const appBar = createClassMapDirective({\n getClasses: appBarClasses,\n setupElement: setupAppBar,\n});\n"]}
|
|
@@ -0,0 +1,167 @@
|
|
|
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 'app-bar-tokens';
|
|
8
|
+
// go/keep-sorted end
|
|
9
|
+
|
|
10
|
+
@layer md.sys;
|
|
11
|
+
@layer md.comp.app-bar {
|
|
12
|
+
// Component tokens
|
|
13
|
+
.app-bar {
|
|
14
|
+
@include app-bar-tokens.root;
|
|
15
|
+
}
|
|
16
|
+
.app-bar-md {
|
|
17
|
+
@include app-bar-tokens.medium;
|
|
18
|
+
}
|
|
19
|
+
.app-bar-lg {
|
|
20
|
+
@include app-bar-tokens.large;
|
|
21
|
+
}
|
|
22
|
+
.app-bar-with-subtitle {
|
|
23
|
+
@include app-bar-tokens.with-subtitle;
|
|
24
|
+
}
|
|
25
|
+
.app-bar-with-subtitle.app-bar-lg {
|
|
26
|
+
@include app-bar-tokens.with-subtitle-large;
|
|
27
|
+
}
|
|
28
|
+
.app-bar-search {
|
|
29
|
+
@include app-bar-tokens.search;
|
|
30
|
+
}
|
|
31
|
+
.app-bar-scrolled {
|
|
32
|
+
@include app-bar-tokens.on-scroll;
|
|
33
|
+
}
|
|
34
|
+
.app-bar-scrolled.app-bar-search {
|
|
35
|
+
@include app-bar-tokens.on-scroll-search;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Component styles
|
|
39
|
+
.app-bar {
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
display: flex;
|
|
42
|
+
position: relative;
|
|
43
|
+
width: 100%;
|
|
44
|
+
min-height: var(--container-height);
|
|
45
|
+
background-color: var(--container-color);
|
|
46
|
+
border-radius: var(--container-shape);
|
|
47
|
+
box-shadow: var(--container-elevation);
|
|
48
|
+
color: var(--title-color);
|
|
49
|
+
transition:
|
|
50
|
+
background-color 200ms ease,
|
|
51
|
+
box-shadow 200ms ease,
|
|
52
|
+
min-height 200ms ease;
|
|
53
|
+
padding-inline: var(--leading-space) var(--trailing-space);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Small and Search layouts (single row)
|
|
57
|
+
.app-bar-sm,
|
|
58
|
+
.app-bar-search {
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Medium and Large layouts (two rows)
|
|
65
|
+
.app-bar-md,
|
|
66
|
+
.app-bar-lg {
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
align-items: stretch;
|
|
70
|
+
|
|
71
|
+
.app-bar-top-row {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: row;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
min-height: 64px;
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.app-bar-bottom-row {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
justify-content: flex-end;
|
|
84
|
+
padding-bottom: 24px;
|
|
85
|
+
padding-inline: 12px;
|
|
86
|
+
flex: 1 1 auto;
|
|
87
|
+
min-height: 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Slot containers
|
|
92
|
+
.app-bar-leading,
|
|
93
|
+
.app-bar-trailing {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--icon-button-space);
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.app-bar-leading {
|
|
101
|
+
color: var(--leading-icon-color);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.app-bar-trailing {
|
|
105
|
+
color: var(--trailing-icon-color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.app-bar-title-wrapper {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
flex: 1 1 auto;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.app-bar-sm .app-bar-title-wrapper {
|
|
118
|
+
margin-inline: 4px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.app-bar-title {
|
|
122
|
+
margin: 0;
|
|
123
|
+
font: var(--title);
|
|
124
|
+
font-variation-settings: var(--title-axes);
|
|
125
|
+
letter-spacing: var(--title-tracking);
|
|
126
|
+
color: var(--title-color);
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
|
|
131
|
+
::slotted(*) {
|
|
132
|
+
margin: 0;
|
|
133
|
+
font: inherit;
|
|
134
|
+
font-variation-settings: inherit;
|
|
135
|
+
letter-spacing: inherit;
|
|
136
|
+
color: inherit;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.app-bar-subtitle {
|
|
141
|
+
margin: 0;
|
|
142
|
+
margin-top: 2px;
|
|
143
|
+
font: var(--subtitle);
|
|
144
|
+
font-variation-settings: var(--subtitle-axes);
|
|
145
|
+
letter-spacing: var(--subtitle-tracking);
|
|
146
|
+
color: var(--subtitle-color);
|
|
147
|
+
white-space: nowrap;
|
|
148
|
+
overflow: hidden;
|
|
149
|
+
text-overflow: ellipsis;
|
|
150
|
+
|
|
151
|
+
::slotted(*) {
|
|
152
|
+
margin: 0;
|
|
153
|
+
font: inherit;
|
|
154
|
+
font-variation-settings: inherit;
|
|
155
|
+
letter-spacing: inherit;
|
|
156
|
+
color: inherit;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.app-bar-search-container {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex: 1 1 auto;
|
|
163
|
+
align-items: center;
|
|
164
|
+
min-width: 0;
|
|
165
|
+
margin-inline: 8px;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AppBarElement } from './app-bar-element.js';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
/** A Material Design app bar component. */
|
|
10
|
+
'md-gb-app-bar': AppBarElement;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md-gb-app-bar.js","sourceRoot":"","sources":["md-gb-app-bar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AASnD,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {AppBarElement} from './app-bar-element.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design app bar component. */\n 'md-gb-app-bar': AppBarElement;\n }\n}\n\ncustomElements.define('md-gb-app-bar', AppBarElement);\n"]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
// Auto-generated by cascade_tokens
|
|
7
|
+
// Add `// EDIT:` comments for manual adjustments.
|
|
8
|
+
//
|
|
9
|
+
// --prefix=md.comp.chip
|
|
10
|
+
// --states="hovered|focused|pressed|dragged,:unselected|selected,:filter|input,with-leading-icon|with-avatar,with-trailing-icon,disabled"
|
|
11
|
+
// --exclude=motion,state-layer,indicator
|
|
12
|
+
|
|
13
|
+
@mixin root {
|
|
14
|
+
// LINT.IfChange
|
|
15
|
+
--avatar-opacity: unset;
|
|
16
|
+
// md.comp.chip.avatar.shape
|
|
17
|
+
--avatar-shape: var(--md-sys-shape-corner-full);
|
|
18
|
+
// md.comp.chip.avatar.size
|
|
19
|
+
--avatar-size: 24px;
|
|
20
|
+
--container-color: unset;
|
|
21
|
+
// md.comp.chip.container.elevation
|
|
22
|
+
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
23
|
+
// --container-opacity: unset; // EDIT: unused
|
|
24
|
+
// md.comp.chip.gap.horizontal
|
|
25
|
+
--gap-horizontal: var(--md-sys-space-50);
|
|
26
|
+
// md.comp.chip.height
|
|
27
|
+
--height: 32px;
|
|
28
|
+
// md.comp.chip.label-text
|
|
29
|
+
--label-text: var(--md-sys-typescale-label-lg);
|
|
30
|
+
// ┌┄ md.comp.chip.label-text
|
|
31
|
+
--label-text-axes: var(--md-sys-typescale-label-lg-axes);
|
|
32
|
+
// md.comp.chip.unselected.label-text.color
|
|
33
|
+
--label-text-color: var(--md-sys-color-on-surface-variant);
|
|
34
|
+
// --label-text-opacity: unset; // EDIT: unused
|
|
35
|
+
// ┌┄ md.comp.chip.label-text
|
|
36
|
+
--label-text-tracking: var(--md-sys-typescale-label-lg-tracking);
|
|
37
|
+
// md.comp.chip.unselected.leading-icon.color
|
|
38
|
+
--leading-icon-color: var(--md-sys-color-on-surface-variant);
|
|
39
|
+
// --leading-icon-opacity: unset; // EDIT: unused
|
|
40
|
+
// md.comp.chip.leading-icon.size
|
|
41
|
+
--leading-icon-size: 18px;
|
|
42
|
+
// md.comp.chip.unselected.outline.color
|
|
43
|
+
--outline-color: var(--md-sys-color-outline-variant);
|
|
44
|
+
// --outline-opacity: unset; // EDIT: unused
|
|
45
|
+
// md.comp.chip.unselected.outline.width
|
|
46
|
+
--outline-width: 1px;
|
|
47
|
+
// md.comp.chip.padding.bottom
|
|
48
|
+
--padding-bottom: var(--md-sys-space-75);
|
|
49
|
+
// ┌ md.comp.chip.filter.padding.leading
|
|
50
|
+
--padding-leading: var(--md-sys-space-200);
|
|
51
|
+
// md.comp.chip.padding.top
|
|
52
|
+
--padding-top: var(--md-sys-space-75);
|
|
53
|
+
// ┌ md.comp.chip.filter.padding.trailing
|
|
54
|
+
--padding-trailing: var(--md-sys-space-200);
|
|
55
|
+
// md.comp.chip.unselected.shape
|
|
56
|
+
--shape: var(--md-sys-shape-corner-md);
|
|
57
|
+
// md.comp.chip.unselected.trailing-icon.color
|
|
58
|
+
--trailing-icon-color: var(--md-sys-color-on-surface-variant);
|
|
59
|
+
// --trailing-icon-opacity: unset; // EDIT: unused
|
|
60
|
+
// md.comp.chip.trailing-icon.size
|
|
61
|
+
--trailing-icon-size: 18px;
|
|
62
|
+
// LINT.ThenChange(md-gb-chip.ts) sync with `@cssprop` jsdoc tags
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@mixin pressed {
|
|
66
|
+
// md.comp.chip.pressed.shape
|
|
67
|
+
--shape: var(--md-sys-shape-corner-sm);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@mixin dragged {
|
|
71
|
+
// md.comp.chip.dragged.container.elevation
|
|
72
|
+
--container-elevation: var(--md-sys-elevation-shadow-4);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@mixin selected {
|
|
76
|
+
// md.comp.chip.selected.container.color
|
|
77
|
+
--container-color: var(--md-sys-color-secondary-container);
|
|
78
|
+
// md.comp.chip.selected.label-text.color
|
|
79
|
+
--label-text-color: var(--md-sys-color-on-secondary-container);
|
|
80
|
+
// md.comp.chip.selected.leading-icon.color
|
|
81
|
+
--leading-icon-color: var(--md-sys-color-on-secondary-container);
|
|
82
|
+
// md.comp.chip.selected.outline.width
|
|
83
|
+
--outline-width: 0px;
|
|
84
|
+
// md.comp.chip.selected.shape
|
|
85
|
+
--shape: var(--md-sys-shape-corner-full);
|
|
86
|
+
// md.comp.chip.selected.trailing-icon.color
|
|
87
|
+
--trailing-icon-color: var(--md-sys-color-on-secondary-container);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@mixin input {
|
|
91
|
+
// md.comp.chip.input.padding.leading
|
|
92
|
+
--padding-leading: var(--md-sys-space-150);
|
|
93
|
+
// md.comp.chip.input.padding.trailing
|
|
94
|
+
--padding-trailing: var(--md-sys-space-150);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@mixin with-leading-icon {
|
|
98
|
+
// md.comp.chip.with-leading-icon.padding.leading
|
|
99
|
+
--padding-leading: var(--md-sys-space-100);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@mixin with-avatar {
|
|
103
|
+
// md.comp.chip.with-avatar.padding.leading
|
|
104
|
+
--padding-leading: var(--md-sys-space-50);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@mixin with-trailing-icon {
|
|
108
|
+
// md.comp.chip.with-trailing-icon.padding.trailing
|
|
109
|
+
--padding-trailing: var(--md-sys-space-100);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@mixin disabled {
|
|
113
|
+
// md.comp.chip.disabled.avatar.opacity
|
|
114
|
+
--avatar-opacity: 0.38;
|
|
115
|
+
// ┌ md.comp.chip.disabled.label-text.opacity
|
|
116
|
+
// md.comp.chip.disabled.label-text.color
|
|
117
|
+
--label-text-color: hsl(from var(--md-sys-color-on-surface) h s l / 0.38);
|
|
118
|
+
// ┌ md.comp.chip.disabled.leading-icon.opacity
|
|
119
|
+
// md.comp.chip.disabled.leading-icon.color
|
|
120
|
+
--leading-icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 0.38);
|
|
121
|
+
// ┌ md.comp.chip.unselected.disabled.outline.opacity
|
|
122
|
+
// md.comp.chip.unselected.disabled.outline.color
|
|
123
|
+
--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 0.1);
|
|
124
|
+
// ┌ md.comp.chip.disabled.trailing-icon.opacity
|
|
125
|
+
// md.comp.chip.disabled.trailing-icon.color
|
|
126
|
+
--trailing-icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 0.38);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@mixin disabled-selected {
|
|
130
|
+
// ┌ md.comp.chip.selected.disabled.container.opacity
|
|
131
|
+
// md.comp.chip.selected.disabled.container.color
|
|
132
|
+
--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 0.12);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// EDIT: Manual adjustments
|
|
136
|
+
@mixin filter {
|
|
137
|
+
// Hoisted to root, so empty here to satisfy chip.scss mapping
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@mixin elevated {
|
|
141
|
+
--container-color: var(--md-sys-color-surface-container-low);
|
|
142
|
+
--container-elevation: var(--md-sys-elevation-shadow-1);
|
|
143
|
+
--label-text-color: var(--md-sys-color-on-surface);
|
|
144
|
+
--outline-width: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@mixin filled {
|
|
148
|
+
--container-color: var(--md-sys-color-surface-container);
|
|
149
|
+
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
150
|
+
--label-text-color: var(--md-sys-color-on-surface);
|
|
151
|
+
--outline-width: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@mixin tonal {
|
|
155
|
+
--container-color: var(--md-sys-color-secondary-container);
|
|
156
|
+
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
157
|
+
--label-text-color: var(--md-sys-color-on-secondary-container);
|
|
158
|
+
--outline-width: 0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@mixin outlined {
|
|
162
|
+
--container-color: transparent;
|
|
163
|
+
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
164
|
+
--label-text-color: var(--md-sys-color-on-surface);
|
|
165
|
+
--outline-color: var(--md-sys-color-outline);
|
|
166
|
+
--outline-width: 1px;
|
|
167
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
import { type ChipColor, type ChipType } from './chip.js';
|
|
8
|
+
/**
|
|
9
|
+
* A Material Design Expressive Chip component (`md-gb-chip`).
|
|
10
|
+
*
|
|
11
|
+
* @slot - Used to display the chip label text.
|
|
12
|
+
* @slot icon - Used to display an optional leading icon, checkmark, or avatar.
|
|
13
|
+
* @slot remove-icon - Used to display the trailing remove button icon when `removable="true"`.
|
|
14
|
+
* @fires {Event} remove - Fired when the remove action is triggered on a removable chip. --bubbles --composed
|
|
15
|
+
* @fires {Event} change - Fired when a filter/toggle chip's selection state changes. --bubbles
|
|
16
|
+
* @fires {InputEvent} input - Fired when a filter/toggle chip's selection state changes. --bubbles --composed
|
|
17
|
+
* @csspart chip - The root container element.
|
|
18
|
+
* @cssprop --avatar-opacity
|
|
19
|
+
* @cssprop --avatar-shape
|
|
20
|
+
* @cssprop --avatar-size
|
|
21
|
+
* @cssprop --container-color
|
|
22
|
+
* @cssprop --container-elevation
|
|
23
|
+
* @cssprop --container-opacity
|
|
24
|
+
* @cssprop --gap-horizontal
|
|
25
|
+
* @cssprop --height
|
|
26
|
+
* @cssprop --label-text
|
|
27
|
+
* @cssprop --label-text-color
|
|
28
|
+
* @cssprop --label-text-opacity
|
|
29
|
+
* @cssprop --leading-icon-color
|
|
30
|
+
* @cssprop --leading-icon-opacity
|
|
31
|
+
* @cssprop --leading-icon-size
|
|
32
|
+
* @cssprop --outline-color
|
|
33
|
+
* @cssprop --outline-opacity
|
|
34
|
+
* @cssprop --outline-width
|
|
35
|
+
* @cssprop --padding-bottom
|
|
36
|
+
* @cssprop --padding-leading
|
|
37
|
+
* @cssprop --padding-top
|
|
38
|
+
* @cssprop --padding-trailing
|
|
39
|
+
* @cssprop --shape
|
|
40
|
+
* @cssprop --trailing-icon-color
|
|
41
|
+
* @cssprop --trailing-icon-opacity
|
|
42
|
+
* @cssprop --trailing-icon-size
|
|
43
|
+
*/
|
|
44
|
+
export declare class ChipElement extends LitElement {
|
|
45
|
+
static styles: CSSResultOrNative[];
|
|
46
|
+
/** The color emphasis of the chip. Defaults to `outlined`. */
|
|
47
|
+
color: ChipColor;
|
|
48
|
+
/** The functional behavior type of the chip (`action`, `filter`, `toggle`, `link`). */
|
|
49
|
+
type: ChipType;
|
|
50
|
+
/** Whether the filter or toggle chip is selected. */
|
|
51
|
+
selected: boolean;
|
|
52
|
+
/** Whether the chip is removable. */
|
|
53
|
+
removable: boolean;
|
|
54
|
+
/** Whether the chip is disabled. */
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
/** Whether the chip is soft-disabled (`aria-disabled="true"` while preserving focusability). */
|
|
57
|
+
softDisabled: boolean;
|
|
58
|
+
/** The URL destination if `type="link"` or if `href` is set. */
|
|
59
|
+
href: string;
|
|
60
|
+
/** Where to display the linked `href` URL for a link chip. */
|
|
61
|
+
target: '_blank' | '_parent' | '_self' | '_top' | '';
|
|
62
|
+
private hasLeadingIcon;
|
|
63
|
+
private hasAvatar;
|
|
64
|
+
private hasRemoveIcon;
|
|
65
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
66
|
+
private renderContent;
|
|
67
|
+
private renderLeadingIcon;
|
|
68
|
+
private renderRemoveButton;
|
|
69
|
+
private handleIconSlotChange;
|
|
70
|
+
private handleRemoveIconSlotChange;
|
|
71
|
+
private handleChange;
|
|
72
|
+
private handleRemove;
|
|
73
|
+
}
|