@material/web 2.4.2-nightly.fd6fe2a.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 +7148 -7166
- 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/badge/_badge-tokens.scss +18 -0
- package/labs/gb/components/badge/badge-element.d.ts +15 -0
- package/labs/gb/components/badge/badge-element.js +49 -0
- package/labs/gb/components/badge/badge-element.js.map +1 -0
- package/labs/gb/components/badge/badge.css +4 -0
- package/labs/gb/components/badge/badge.css.map +1 -0
- package/labs/gb/components/badge/badge.cssresult.d.ts +3 -0
- package/labs/gb/components/badge/badge.cssresult.js +14 -0
- package/labs/gb/components/badge/badge.cssresult.js.map +1 -0
- package/labs/gb/components/badge/badge.d.ts +32 -0
- package/labs/gb/components/badge/badge.js +35 -0
- package/labs/gb/components/badge/badge.js.map +1 -0
- package/labs/gb/components/badge/badge.scss +49 -0
- package/labs/gb/components/badge/md-gb-badge.d.ts +12 -0
- package/labs/gb/components/badge/md-gb-badge.js +8 -0
- package/labs/gb/components/badge/md-gb-badge.js.map +1 -0
- package/labs/gb/components/button/_button-tokens.scss +2 -0
- package/labs/gb/components/button/{md-button.d.ts → button-element.d.ts} +22 -7
- package/labs/gb/components/button/{md-button.js → button-element.js} +38 -20
- package/labs/gb/components/button/button-element.js.map +1 -0
- package/labs/gb/components/button/button.css.map +1 -1
- package/labs/gb/components/button/md-gb-button.d.ts +12 -0
- package/labs/gb/components/button/md-gb-button.js +8 -0
- package/labs/gb/components/button/md-gb-button.js.map +1 -0
- package/labs/gb/components/card/_card-tokens.scss +2 -0
- package/labs/gb/components/card/{md-card.d.ts → card-element.d.ts} +12 -7
- package/labs/gb/components/card/{md-card.js → card-element.js} +21 -14
- package/labs/gb/components/card/card-element.js.map +1 -0
- package/labs/gb/components/card/card.css.map +1 -1
- package/labs/gb/components/card/md-gb-card.d.ts +12 -0
- package/labs/gb/components/card/md-gb-card.js +8 -0
- package/labs/gb/components/card/md-gb-card.js.map +1 -0
- package/labs/gb/components/checkbox/_checkbox-tokens.scss +2 -0
- package/labs/gb/components/checkbox/{md-checkbox.d.ts → checkbox-element.d.ts} +15 -7
- package/labs/gb/components/checkbox/{md-checkbox.js → checkbox-element.js} +26 -16
- package/labs/gb/components/checkbox/checkbox-element.js.map +1 -0
- package/labs/gb/components/checkbox/checkbox.css.map +1 -1
- package/labs/gb/components/checkbox/md-gb-checkbox.d.ts +12 -0
- package/labs/gb/components/checkbox/md-gb-checkbox.js +8 -0
- package/labs/gb/components/checkbox/md-gb-checkbox.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/labs/gb/components/divider/_divider-tokens.scss +2 -0
- package/labs/gb/components/divider/{md-divider.d.ts → divider-element.d.ts} +5 -7
- package/labs/gb/components/divider/{md-divider.js → divider-element.js} +10 -10
- package/labs/gb/components/divider/divider-element.js.map +1 -0
- package/labs/gb/components/divider/divider.css.map +1 -1
- package/labs/gb/components/divider/md-gb-divider.d.ts +12 -0
- package/labs/gb/components/divider/md-gb-divider.js +8 -0
- package/labs/gb/components/divider/md-gb-divider.js.map +1 -0
- package/labs/gb/components/fab/_fab-tokens.scss +2 -0
- package/labs/gb/components/fab/fab-element.d.ts +31 -0
- package/labs/gb/components/fab/{md-fab.js → fab-element.js} +22 -11
- package/labs/gb/components/fab/fab-element.js.map +1 -0
- package/labs/gb/components/fab/fab.css.map +1 -1
- package/labs/gb/components/fab/md-gb-fab.d.ts +12 -0
- package/labs/gb/components/fab/md-gb-fab.js +8 -0
- package/labs/gb/components/fab/md-gb-fab.js.map +1 -0
- package/labs/gb/components/iconbutton/_icon-button-tokens.scss +2 -0
- package/labs/gb/components/iconbutton/{md-icon-button.d.ts → icon-button-element.d.ts} +15 -7
- package/labs/gb/components/iconbutton/{md-icon-button.js → icon-button-element.js} +30 -20
- package/labs/gb/components/iconbutton/icon-button-element.js.map +1 -0
- package/labs/gb/components/iconbutton/icon-button.css.map +1 -1
- package/labs/gb/components/iconbutton/md-gb-icon-button.d.ts +12 -0
- package/labs/gb/components/iconbutton/md-gb-icon-button.js +8 -0
- package/labs/gb/components/iconbutton/md-gb-icon-button.js.map +1 -0
- package/labs/gb/components/list/_list-tokens.scss +4 -0
- package/labs/gb/components/list/{md-list.d.ts → list-element.d.ts} +6 -7
- package/labs/gb/components/list/{md-list.js → list-element.js} +11 -10
- package/labs/gb/components/list/list-element.js.map +1 -0
- package/labs/gb/components/list/list-item-element.d.ts +77 -0
- package/labs/gb/components/list/{md-list-item.js → list-item-element.js} +48 -13
- package/labs/gb/components/list/list-item-element.js.map +1 -0
- package/labs/gb/components/list/list.css.map +1 -1
- package/labs/gb/components/list/md-gb-list-item.d.ts +12 -0
- package/labs/gb/components/list/md-gb-list-item.js +8 -0
- package/labs/gb/components/list/md-gb-list-item.js.map +1 -0
- package/labs/gb/components/list/md-gb-list.d.ts +12 -0
- package/labs/gb/components/list/md-gb-list.js +8 -0
- package/labs/gb/components/list/md-gb-list.js.map +1 -0
- package/labs/gb/components/menu/_menu-tokens.scss +4 -0
- package/labs/gb/components/menu/md-gb-menu-group.d.ts +12 -0
- package/labs/gb/components/menu/md-gb-menu-group.js +8 -0
- package/labs/gb/components/menu/md-gb-menu-group.js.map +1 -0
- package/labs/gb/components/menu/md-gb-menu-item.d.ts +12 -0
- package/labs/gb/components/menu/md-gb-menu-item.js +8 -0
- package/labs/gb/components/menu/md-gb-menu-item.js.map +1 -0
- package/labs/gb/components/menu/md-gb-menu.d.ts +12 -0
- package/labs/gb/components/menu/md-gb-menu.js +8 -0
- package/labs/gb/components/menu/md-gb-menu.js.map +1 -0
- package/labs/gb/components/menu/{md-menu.d.ts → menu-element.d.ts} +11 -7
- package/labs/gb/components/menu/{md-menu.js → menu-element.js} +16 -10
- package/labs/gb/components/menu/menu-element.js.map +1 -0
- package/labs/gb/components/menu/{md-menu-group.d.ts → menu-group-element.d.ts} +3 -6
- package/labs/gb/components/menu/{md-menu-group.js → menu-group-element.js} +11 -11
- package/labs/gb/components/menu/menu-group-element.js.map +1 -0
- package/labs/gb/components/menu/menu-item-element.d.ts +56 -0
- package/labs/gb/components/menu/{md-menu-item.js → menu-item-element.js} +41 -13
- package/labs/gb/components/menu/menu-item-element.js.map +1 -0
- package/labs/gb/components/menu/menu.css.map +1 -1
- package/labs/gb/components/menu/menu.js +1 -1
- package/labs/gb/components/menu/menu.js.map +1 -1
- package/labs/gb/components/radio/_radio-tokens.scss +2 -0
- package/labs/gb/components/radio/md-gb-radio.d.ts +12 -0
- package/labs/gb/components/radio/md-gb-radio.js +8 -0
- package/labs/gb/components/radio/md-gb-radio.js.map +1 -0
- package/labs/gb/components/radio/{md-radio.d.ts → radio-element.d.ts} +10 -7
- package/labs/gb/components/radio/{md-radio.js → radio-element.js} +19 -14
- package/labs/gb/components/radio/radio-element.js.map +1 -0
- package/labs/gb/components/radio/radio.css.map +1 -1
- package/labs/gb/components/splitbutton/_split-button-tokens.scss +4 -0
- package/labs/gb/components/splitbutton/md-gb-split-button.d.ts +12 -0
- package/labs/gb/components/splitbutton/md-gb-split-button.js +8 -0
- package/labs/gb/components/splitbutton/md-gb-split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button-element.d.ts +33 -0
- package/labs/gb/components/splitbutton/{md-split-button.js → split-button-element.js} +21 -12
- package/labs/gb/components/splitbutton/split-button-element.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.css.map +1 -1
- package/labs/gb/components/splitbutton/split-button.d.ts +4 -4
- package/labs/gb/components/splitbutton/split-button.js +4 -4
- package/labs/gb/components/splitbutton/split-button.js.map +1 -1
- package/labs/gb/components/switch/_switch-tokens.scss +2 -0
- package/labs/gb/components/switch/md-gb-switch.d.ts +12 -0
- package/labs/gb/components/switch/md-gb-switch.js +8 -0
- package/labs/gb/components/switch/md-gb-switch.js.map +1 -0
- package/labs/gb/components/switch/{md-switch.d.ts → switch-element.d.ts} +19 -7
- package/labs/gb/components/switch/{md-switch.js → switch-element.js} +28 -14
- package/labs/gb/components/switch/switch-element.js.map +1 -0
- package/labs/gb/components/switch/switch.css.map +1 -1
- package/labs/gb/styles/adopt-styles.js +6 -1
- package/labs/gb/styles/adopt-styles.js.map +1 -1
- package/labs/gb/styles/icon/{md-icon.d.ts → icon-element.d.ts} +1 -7
- package/labs/gb/styles/icon/{md-icon.js → icon-element.js} +8 -10
- package/labs/gb/styles/icon/icon-element.js.map +1 -0
- package/labs/gb/styles/icon/md-gb-icon.d.ts +12 -0
- package/labs/gb/styles/icon/md-gb-icon.js +8 -0
- package/labs/gb/styles/icon/md-gb-icon.js.map +1 -0
- package/package.json +3 -3
- package/labs/gb/components/button/md-button.js.map +0 -1
- package/labs/gb/components/card/md-card.js.map +0 -1
- package/labs/gb/components/checkbox/md-checkbox.js.map +0 -1
- package/labs/gb/components/divider/md-divider.js.map +0 -1
- package/labs/gb/components/fab/md-fab.d.ts +0 -22
- package/labs/gb/components/fab/md-fab.js.map +0 -1
- package/labs/gb/components/iconbutton/md-icon-button.js.map +0 -1
- package/labs/gb/components/list/md-list-item.d.ts +0 -44
- package/labs/gb/components/list/md-list-item.js.map +0 -1
- package/labs/gb/components/list/md-list.js.map +0 -1
- package/labs/gb/components/menu/md-menu-group.js.map +0 -1
- package/labs/gb/components/menu/md-menu-item.d.ts +0 -30
- package/labs/gb/components/menu/md-menu-item.js.map +0 -1
- package/labs/gb/components/menu/md-menu.js.map +0 -1
- package/labs/gb/components/radio/md-radio.js.map +0 -1
- package/labs/gb/components/splitbutton/md-split-button.d.ts +0 -26
- package/labs/gb/components/splitbutton/md-split-button.js.map +0 -1
- package/labs/gb/components/switch/md-switch.js.map +0 -1
- package/labs/gb/styles/icon/md-icon.js.map +0 -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":[],"mappings":"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","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,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
@mixin root {
|
|
7
|
+
--container-color: var(--md-sys-color-error);
|
|
8
|
+
--shape: var(--md-sys-shape-corner-full);
|
|
9
|
+
--size: 6px;
|
|
10
|
+
--label-text-color: var(--md-sys-color-on-error);
|
|
11
|
+
--label-text: var(--md-sys-typescale-label-sm);
|
|
12
|
+
--label-text-tracking: var(--md-sys-typescale-label-sm-tracking);
|
|
13
|
+
--label-text-axes: var(--md-sys-typescale-label-sm-axes);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@mixin large {
|
|
17
|
+
--size: 16px;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* A Material Design badge component.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BadgeElement extends LitElement {
|
|
11
|
+
static styles: CSSResultOrNative[];
|
|
12
|
+
private hasContent;
|
|
13
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
private handleSlotChange;
|
|
15
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { state } from 'lit/decorators.js';
|
|
9
|
+
import { badge } from './badge.js';
|
|
10
|
+
import { styles as badgeStyles } from './badge.cssresult.js';
|
|
11
|
+
/**
|
|
12
|
+
* A Material Design badge component.
|
|
13
|
+
*/
|
|
14
|
+
export class BadgeElement extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.hasContent = false;
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return html `<span part="badge" class="${badge({ large: this.hasContent })}">
|
|
21
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
22
|
+
</span>`;
|
|
23
|
+
}
|
|
24
|
+
handleSlotChange(e) {
|
|
25
|
+
const slot = e.target;
|
|
26
|
+
const nodes = slot.assignedNodes();
|
|
27
|
+
this.hasContent = nodes.some((node) => {
|
|
28
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
29
|
+
return (node.textContent ?? '').trim().length > 0;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
BadgeElement.styles = [
|
|
36
|
+
badgeStyles,
|
|
37
|
+
css `
|
|
38
|
+
:host {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
}
|
|
41
|
+
.badge {
|
|
42
|
+
flex: 1;
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
];
|
|
46
|
+
__decorate([
|
|
47
|
+
state()
|
|
48
|
+
], BadgeElement.prototype, "hasContent", void 0);
|
|
49
|
+
//# sourceMappingURL=badge-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge-element.js","sourceRoot":"","sources":["badge-element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,MAAM,IAAI,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IAA5C;;QAamB,eAAU,GAAG,KAAK,CAAC;IAkBtC,CAAC;IAhBoB,MAAM;QACvB,OAAO,IAAI,CAAA,6BAA6B,KAAK,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC;0BACjD,IAAI,CAAC,gBAAgB;YACnC,CAAC;IACX,CAAC;IAEO,gBAAgB,CAAC,CAAQ;QAC/B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAyB,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;;AA7Be,mBAAM,GAAwB;IAC5C,WAAW;IACX,GAAG,CAAA;;;;;;;KAOF;CACF,AAVqB,CAUpB;AAEe;IAAhB,KAAK,EAAE;gDAA4B","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultOrNative, html, LitElement} from 'lit';\nimport {state} from 'lit/decorators.js';\nimport {badge} from './badge.js';\nimport {styles as badgeStyles} from './badge.cssresult.js';\n\n/**\n * A Material Design badge component.\n */\nexport class BadgeElement extends LitElement {\n static override styles: CSSResultOrNative[] = [\n badgeStyles,\n css`\n :host {\n display: inline-flex;\n }\n .badge {\n flex: 1;\n }\n `,\n ];\n\n @state() private hasContent = false;\n\n protected override render() {\n return html`<span part=\"badge\" class=\"${badge({large: this.hasContent})}\">\n <slot @slotchange=${this.handleSlotChange}></slot>\n </span>`;\n }\n\n private handleSlotChange(e: Event) {\n const slot = e.target as HTMLSlotElement;\n const nodes = slot.assignedNodes();\n this.hasContent = nodes.some((node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').trim().length > 0;\n }\n return true;\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/@layer md.sys;@layer md.comp.badge{.badge{--container-color: var(--md-sys-color-error);--shape: var(--md-sys-shape-corner-full);--size: 6px;--label-text-color: var(--md-sys-color-on-error);--label-text: var(--md-sys-typescale-label-sm);--label-text-tracking: var(--md-sys-typescale-label-sm-tracking);--label-text-axes: var(--md-sys-typescale-label-sm-axes)}.badge{display:inline-flex;align-items:center;justify-content:center;background-color:var(--container-color);border-radius:var(--shape);height:var(--size);width:var(--size);box-sizing:border-box}.badge slot{display:none}.badge.badge-large{--size: 16px;width:auto;min-width:var(--size);padding:0 4px;color:var(--label-text-color);font:var(--label-text);letter-spacing:var(--label-text-tracking);font-variation-settings:var(--label-text-axes)}.badge.badge-large slot{display:contents}}/*# sourceMappingURL=badge.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["badge.scss","_badge-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,cACA,qBAEI,OCNF,6CACA,yCACA,YACA,iDACA,+CACA,iEACA,yDDIE,OACE,oBACA,mBACA,uBACA,wCACA,2BACA,mBACA,kBACA,sBAEA,YACE,aAKJ,mBChBF,aDkBI,WACA,sBACA,cAEA,8BACA,uBACA,0CACA,+CAEA,wBACE","file":"badge.css"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// Generated stylesheet for ./labs/gb/components/badge/badge.css.
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
export const styles = css `/*!
|
|
9
|
+
* Copyright 2026 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
*/@layer md.sys;@layer md.comp.badge{.badge{--container-color: var(--md-sys-color-error);--shape: var(--md-sys-shape-corner-full);--size: 6px;--label-text-color: var(--md-sys-color-on-error);--label-text: var(--md-sys-typescale-label-sm);--label-text-tracking: var(--md-sys-typescale-label-sm-tracking);--label-text-axes: var(--md-sys-typescale-label-sm-axes)}.badge{display:inline-flex;align-items:center;justify-content:center;background-color:var(--container-color);border-radius:var(--shape);height:var(--size);width:var(--size);box-sizing:border-box}.badge slot{display:none}.badge.badge-large{--size: 16px;width:auto;min-width:var(--size);padding:0 4px;color:var(--label-text-color);font:var(--label-text);letter-spacing:var(--label-text-tracking);font-variation-settings:var(--label-text-axes)}.badge.badge-large slot{display:contents}}
|
|
12
|
+
`;
|
|
13
|
+
export default styles.styleSheet;
|
|
14
|
+
//# sourceMappingURL=badge.cssresult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.cssresult.js","sourceRoot":"","sources":["badge.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iEAAiE;AACjE,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;CAIxB,CAAC;AACF,eAAe,MAAM,CAAC,UAAW,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./labs/gb/components/badge/badge.css.\nimport {css} from 'lit';\nexport const styles = css`/*!\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */@layer md.sys;@layer md.comp.badge{.badge{--container-color: var(--md-sys-color-error);--shape: var(--md-sys-shape-corner-full);--size: 6px;--label-text-color: var(--md-sys-color-on-error);--label-text: var(--md-sys-typescale-label-sm);--label-text-tracking: var(--md-sys-typescale-label-sm-tracking);--label-text-axes: var(--md-sys-typescale-label-sm-axes)}.badge{display:inline-flex;align-items:center;justify-content:center;background-color:var(--container-color);border-radius:var(--shape);height:var(--size);width:var(--size);box-sizing:border-box}.badge slot{display:none}.badge.badge-large{--size: 16px;width:auto;min-width:var(--size);padding:0 4px;color:var(--label-text-color);font:var(--label-text);letter-spacing:var(--label-text-tracking);font-variation-settings:var(--label-text-axes)}.badge.badge-large slot{display:contents}}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/** Badge classes. */
|
|
8
|
+
export declare const BADGE_CLASSES: {
|
|
9
|
+
readonly badge: "badge";
|
|
10
|
+
readonly badgeLarge: "badge-large";
|
|
11
|
+
};
|
|
12
|
+
/** The state provided to the `badgeClasses()` function. */
|
|
13
|
+
export interface BadgeClassesState {
|
|
14
|
+
/** Whether the badge is large. */
|
|
15
|
+
large?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the badge classes to apply to an element.
|
|
19
|
+
*
|
|
20
|
+
* @param state The state of the badge.
|
|
21
|
+
* @return An object of class names and truthy values if they apply.
|
|
22
|
+
*/
|
|
23
|
+
export declare function badgeClasses({ large, }?: BadgeClassesState): ClassInfo;
|
|
24
|
+
/**
|
|
25
|
+
* A Lit directive that adds badge styling to its element.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* html`<span class="${badge({large: true})}">1</span>`;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const badge: (state?: BadgeClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
7
|
+
/** Badge classes. */
|
|
8
|
+
export const BADGE_CLASSES = {
|
|
9
|
+
badge: 'badge',
|
|
10
|
+
badgeLarge: 'badge-large',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Returns the badge classes to apply to an element.
|
|
14
|
+
*
|
|
15
|
+
* @param state The state of the badge.
|
|
16
|
+
* @return An object of class names and truthy values if they apply.
|
|
17
|
+
*/
|
|
18
|
+
export function badgeClasses({ large = false, } = {}) {
|
|
19
|
+
return {
|
|
20
|
+
[BADGE_CLASSES.badge]: true,
|
|
21
|
+
[BADGE_CLASSES.badgeLarge]: large,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A Lit directive that adds badge styling to its element.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* html`<span class="${badge({large: true})}">1</span>`;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const badge = createClassMapDirective({
|
|
33
|
+
getClasses: badgeClasses,
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["badge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAEhE,qBAAqB;AACrB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,aAAa;CACjB,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,GAAG,KAAK,MACQ,EAAE;IACvB,OAAO;QACL,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI;QAC3B,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,KAAK;KAClC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,uBAAuB,CAAoB;IAC9D,UAAU,EAAE,YAAY;CACzB,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 {createClassMapDirective} from '../shared/directives.js';\n\n/** Badge classes. */\nexport const BADGE_CLASSES = {\n badge: 'badge',\n badgeLarge: 'badge-large',\n} as const;\n\n/** The state provided to the `badgeClasses()` function. */\nexport interface BadgeClassesState {\n /** Whether the badge is large. */\n large?: boolean;\n}\n\n/**\n * Returns the badge classes to apply to an element.\n *\n * @param state The state of the badge.\n * @return An object of class names and truthy values if they apply.\n */\nexport function badgeClasses({\n large = false,\n}: BadgeClassesState = {}): ClassInfo {\n return {\n [BADGE_CLASSES.badge]: true,\n [BADGE_CLASSES.badgeLarge]: large,\n };\n}\n\n/**\n * A Lit directive that adds badge styling to its element.\n *\n * @example\n * ```ts\n * html`<span class=\"${badge({large: true})}\">1</span>`;\n * ```\n */\nexport const badge = createClassMapDirective<BadgeClassesState>({\n getClasses: badgeClasses,\n});\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 'badge-tokens';
|
|
8
|
+
// go/keep-sorted end
|
|
9
|
+
|
|
10
|
+
@layer md.sys;
|
|
11
|
+
@layer md.comp.badge {
|
|
12
|
+
.badge {
|
|
13
|
+
& {
|
|
14
|
+
@include badge-tokens.root;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
& {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
background-color: var(--container-color);
|
|
22
|
+
border-radius: var(--shape);
|
|
23
|
+
height: var(--size);
|
|
24
|
+
width: var(--size);
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
|
|
27
|
+
slot {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Large badge (with text)
|
|
33
|
+
&.badge-large {
|
|
34
|
+
@include badge-tokens.large;
|
|
35
|
+
width: auto;
|
|
36
|
+
min-width: var(--size);
|
|
37
|
+
padding: 0 4px;
|
|
38
|
+
|
|
39
|
+
color: var(--label-text-color);
|
|
40
|
+
font: var(--label-text);
|
|
41
|
+
letter-spacing: var(--label-text-tracking);
|
|
42
|
+
font-variation-settings: var(--label-text-axes);
|
|
43
|
+
|
|
44
|
+
slot {
|
|
45
|
+
display: contents;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BadgeElement } from './badge-element.js';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
/** A Material Design badge component. */
|
|
10
|
+
'md-gb-badge': BadgeElement;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md-gb-badge.js","sourceRoot":"","sources":["md-gb-badge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAShD,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {BadgeElement} from './badge-element.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design badge component. */\n 'md-gb-badge': BadgeElement;\n }\n}\n\ncustomElements.define('md-gb-badge', BadgeElement);\n"]}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
|
|
6
6
|
@mixin root {
|
|
7
|
+
// LINT.IfChange
|
|
7
8
|
--container-color: transparent;
|
|
8
9
|
--container-height: auto;
|
|
9
10
|
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
--leading-space: 0;
|
|
20
21
|
--state-layer-color: transparent;
|
|
21
22
|
--trailing-space: 0;
|
|
23
|
+
// LINT.ThenChange(md-button.ts) keep in sync with `@cssprop` jsdoc tags
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
@mixin selected {
|
|
@@ -4,17 +4,32 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { CSSResultOrNative, LitElement, PropertyValues } from 'lit';
|
|
7
|
-
declare global {
|
|
8
|
-
interface HTMLElementTagNameMap {
|
|
9
|
-
/** A Material Design button. */
|
|
10
|
-
'md-button': Button;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
7
|
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<(abstract new (...args: any[]) => import("../../../behaviors/element-internals.js").WithElementInternals) & typeof LitElement & import("../../../behaviors/form-associated.js").FormAssociatedConstructor, import("../../../behaviors/form-associated.js").FormAssociated>, import("../../../behaviors/form-submitter.js").FormSubmitter>>;
|
|
14
8
|
/**
|
|
15
9
|
* A Material Design button.
|
|
10
|
+
*
|
|
11
|
+
* @slot - Used to display a label and optional icon.
|
|
12
|
+
* @slot container - Used to set a custom background container for the button.
|
|
13
|
+
* @fires {InputEvent} input - Fired when a toggle button is selected or unselected. --bubbles --composed
|
|
14
|
+
* @fires {Event} change - Fired when a toggle button is selected or unselected. --bubbles
|
|
15
|
+
* @csspart btn - The button's root element.
|
|
16
|
+
* @cssprop --container-color
|
|
17
|
+
* @cssprop --container-height
|
|
18
|
+
* @cssprop --container-elevation
|
|
19
|
+
* @cssprop --container-shape
|
|
20
|
+
* @cssprop --outline-width
|
|
21
|
+
* @cssprop --outline-color
|
|
22
|
+
* @cssprop --icon-label-space
|
|
23
|
+
* @cssprop --icon-color
|
|
24
|
+
* @cssprop --icon-size
|
|
25
|
+
* @cssprop --label-text
|
|
26
|
+
* @cssprop --label-text-tracking
|
|
27
|
+
* @cssprop --label-text-color
|
|
28
|
+
* @cssprop --leading-space
|
|
29
|
+
* @cssprop --state-layer-color
|
|
30
|
+
* @cssprop --trailing-space
|
|
16
31
|
*/
|
|
17
|
-
export declare class
|
|
32
|
+
export declare class ButtonElement extends baseClass {
|
|
18
33
|
/** @nocollapse */
|
|
19
34
|
static shadowRootOptions: ShadowRootInit;
|
|
20
35
|
static styles: CSSResultOrNative[];
|