@material/web 2.5.1-nightly.cbd34a8.0 → 2.5.1-nightly.de5470f.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 +8248 -1222
- package/labs/aria/buttons/keyboard_click_handler.d.ts +25 -0
- package/labs/aria/buttons/keyboard_click_handler.js +74 -0
- package/labs/aria/buttons/keyboard_click_handler.js.map +1 -0
- package/labs/aria/buttons/md-aria-toggle.d.ts +29 -0
- package/labs/aria/buttons/md-aria-toggle.js +67 -0
- package/labs/aria/buttons/md-aria-toggle.js.map +1 -0
- package/labs/aria/buttons/toggle.d.ts +40 -0
- package/labs/aria/buttons/toggle.js +100 -0
- package/labs/aria/buttons/toggle.js.map +1 -0
- package/labs/aria/menu/md-aria-menubar.d.ts +11 -0
- package/labs/aria/menu/md-aria-menubar.js +8 -0
- package/labs/aria/menu/md-aria-menubar.js.map +1 -0
- package/labs/aria/menu/menubar.d.ts +15 -0
- package/labs/aria/menu/menubar.js +45 -0
- package/labs/aria/menu/menubar.js.map +1 -0
- package/labs/aria/menu/menulist.d.ts +2 -2
- package/labs/aria/menu/menulist.js +6 -4
- package/labs/aria/menu/menulist.js.map +1 -1
- package/labs/aria/pseudo-classes.d.ts +19 -0
- package/labs/aria/pseudo-classes.js +22 -0
- package/labs/aria/pseudo-classes.js.map +1 -0
- package/labs/gb/components/all.d.ts +72 -0
- package/labs/gb/components/all.js +81 -0
- package/labs/gb/components/all.js.map +1 -0
- package/labs/gb/components/button/button-element.d.ts +1 -9
- package/labs/gb/components/button/button-element.js +6 -65
- package/labs/gb/components/button/button-element.js.map +1 -1
- 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.scss +10 -3
- package/labs/gb/components/buttongroup/_button-group-tokens.scss +123 -0
- package/labs/gb/components/buttongroup/button-group-element.d.ts +65 -0
- package/labs/gb/components/buttongroup/button-group-element.js +277 -0
- package/labs/gb/components/buttongroup/button-group-element.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.css +5 -0
- package/labs/gb/components/buttongroup/button-group.css.map +1 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.d.ts +3 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.js +15 -0
- package/labs/gb/components/buttongroup/button-group.cssresult.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.d.ts +96 -0
- package/labs/gb/components/buttongroup/button-group.js +105 -0
- package/labs/gb/components/buttongroup/button-group.js.map +1 -0
- package/labs/gb/components/buttongroup/button-group.scss +282 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.d.ts +12 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.js +8 -0
- package/labs/gb/components/buttongroup/md-gb-button-group.js.map +1 -0
- package/labs/gb/components/card/card-element.d.ts +1 -9
- package/labs/gb/components/card/card-element.js +4 -59
- package/labs/gb/components/card/card-element.js.map +1 -1
- package/labs/gb/components/card/card.css +1 -1
- package/labs/gb/components/card/card.css.map +1 -1
- package/labs/gb/components/card/card.cssresult.js +1 -1
- package/labs/gb/components/card/card.cssresult.js.map +1 -1
- package/labs/gb/components/card/card.scss +18 -5
- 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.scss +1 -0
- package/labs/gb/components/chip/chip.css +1 -1
- package/labs/gb/components/chip/chip.css.map +1 -1
- package/labs/gb/components/chip/chip.cssresult.js +1 -1
- package/labs/gb/components/chip/chip.cssresult.js.map +1 -1
- package/labs/gb/components/chip/chip.scss +1 -0
- package/labs/gb/components/iconbutton/icon-button-element.js +1 -1
- package/labs/gb/components/iconbutton/icon-button-element.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.css +1 -1
- package/labs/gb/components/iconbutton/icon-button.css.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.cssresult.js +1 -1
- package/labs/gb/components/iconbutton/icon-button.cssresult.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.scss +6 -3
- package/labs/gb/components/list/list.css +1 -1
- package/labs/gb/components/list/list.css.map +1 -1
- package/labs/gb/components/list/list.cssresult.js +1 -1
- package/labs/gb/components/list/list.cssresult.js.map +1 -1
- package/labs/gb/components/list/list.scss +1 -0
- package/labs/gb/components/menu/menu.css +1 -1
- package/labs/gb/components/menu/menu.css.map +1 -1
- package/labs/gb/components/menu/menu.cssresult.js +1 -1
- package/labs/gb/components/menu/menu.cssresult.js.map +1 -1
- package/labs/gb/components/menu/menu.scss +1 -0
- package/labs/gb/components/navbar/_nav-bar-tokens.scss +53 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.d.ts +12 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.js +10 -0
- package/labs/gb/components/navbar/md-gb-nav-bar-item.js.map +1 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.d.ts +12 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.js +10 -0
- package/labs/gb/components/navbar/md-gb-nav-bar.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar-element.d.ts +58 -0
- package/labs/gb/components/navbar/nav-bar-element.js +116 -0
- package/labs/gb/components/navbar/nav-bar-element.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar-item-element.d.ts +41 -0
- package/labs/gb/components/navbar/nav-bar-item-element.js +146 -0
- package/labs/gb/components/navbar/nav-bar-item-element.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.css +4 -0
- package/labs/gb/components/navbar/nav-bar.css.map +1 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.d.ts +3 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.js +14 -0
- package/labs/gb/components/navbar/nav-bar.cssresult.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.d.ts +86 -0
- package/labs/gb/components/navbar/nav-bar.js +92 -0
- package/labs/gb/components/navbar/nav-bar.js.map +1 -0
- package/labs/gb/components/navbar/nav-bar.scss +296 -0
- package/labs/gb/components/navrail/_nav-rail-tokens.scss +123 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.d.ts +12 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.js +10 -0
- package/labs/gb/components/navrail/md-gb-nav-rail-item.js.map +1 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.d.ts +12 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.js +10 -0
- package/labs/gb/components/navrail/md-gb-nav-rail.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail-element.d.ts +120 -0
- package/labs/gb/components/navrail/nav-rail-element.js +366 -0
- package/labs/gb/components/navrail/nav-rail-element.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail-item-element.d.ts +44 -0
- package/labs/gb/components/navrail/nav-rail-item-element.js +178 -0
- package/labs/gb/components/navrail/nav-rail-item-element.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.css +4 -0
- package/labs/gb/components/navrail/nav-rail.css.map +1 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.d.ts +3 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.js +14 -0
- package/labs/gb/components/navrail/nav-rail.cssresult.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.d.ts +108 -0
- package/labs/gb/components/navrail/nav-rail.js +115 -0
- package/labs/gb/components/navrail/nav-rail.js.map +1 -0
- package/labs/gb/components/navrail/nav-rail.scss +419 -0
- 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.scss +1 -0
- package/labs/gb/components/shared/fx.d.ts +63 -0
- package/labs/gb/components/shared/fx.js +102 -0
- package/labs/gb/components/shared/fx.js.map +1 -0
- package/labs/gb/components/shared/pseudo-classes.d.ts +1 -7
- package/labs/gb/components/shared/pseudo-classes.js +1 -9
- package/labs/gb/components/shared/pseudo-classes.js.map +1 -1
- package/labs/gb/components/slider/_slider-tokens.scss +86 -0
- package/labs/gb/components/slider/md-gb-slider.d.ts +12 -0
- package/labs/gb/components/slider/md-gb-slider.js +8 -0
- package/labs/gb/components/slider/md-gb-slider.js.map +1 -0
- package/labs/gb/components/slider/slider-element.d.ts +147 -0
- package/labs/gb/components/slider/slider-element.js +978 -0
- package/labs/gb/components/slider/slider-element.js.map +1 -0
- package/labs/gb/components/slider/slider.css +1 -0
- package/labs/gb/components/slider/slider.css.map +1 -0
- package/labs/gb/components/slider/slider.cssresult.d.ts +3 -0
- package/labs/gb/components/slider/slider.cssresult.js +11 -0
- package/labs/gb/components/slider/slider.cssresult.js.map +1 -0
- package/labs/gb/components/slider/slider.d.ts +173 -0
- package/labs/gb/components/slider/slider.js +502 -0
- package/labs/gb/components/slider/slider.js.map +1 -0
- package/labs/gb/components/slider/slider.scss +689 -0
- package/labs/gb/components/snackbar/_snackbar-tokens.scss +86 -0
- package/labs/gb/components/snackbar/harness.d.ts +32 -0
- package/labs/gb/components/snackbar/harness.js +64 -0
- package/labs/gb/components/snackbar/harness.js.map +1 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.d.ts +12 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.js +8 -0
- package/labs/gb/components/snackbar/md-gb-snackbar.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar-element.d.ts +123 -0
- package/labs/gb/components/snackbar/snackbar-element.js +448 -0
- package/labs/gb/components/snackbar/snackbar-element.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.css +5 -0
- package/labs/gb/components/snackbar/snackbar.css.map +1 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.d.ts +3 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.js +15 -0
- package/labs/gb/components/snackbar/snackbar.cssresult.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.d.ts +54 -0
- package/labs/gb/components/snackbar/snackbar.js +72 -0
- package/labs/gb/components/snackbar/snackbar.js.map +1 -0
- package/labs/gb/components/snackbar/snackbar.scss +384 -0
- package/labs/gb/components/switch/switch.css +1 -1
- package/labs/gb/components/switch/switch.css.map +1 -1
- package/labs/gb/components/switch/switch.cssresult.js +1 -1
- package/labs/gb/components/switch/switch.cssresult.js.map +1 -1
- package/labs/gb/components/switch/switch.scss +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
7
|
+
/**
|
|
8
|
+
* Standard reasons for closing a snackbar.
|
|
9
|
+
*/
|
|
10
|
+
export const CLOSE_REASONS = {
|
|
11
|
+
ACTION: 'action',
|
|
12
|
+
DISMISS: 'dismiss',
|
|
13
|
+
TIMEOUT: 'timeout',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Snackbar CSS classes.
|
|
17
|
+
*/
|
|
18
|
+
export const SNACKBAR_CLASSES = {
|
|
19
|
+
snackbar: 'snackbar',
|
|
20
|
+
open: 'snackbar-open',
|
|
21
|
+
opening: 'snackbar-opening',
|
|
22
|
+
closing: 'snackbar-closing',
|
|
23
|
+
fixed: 'snackbar-fixed',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns the class map object for the snackbar based on given state.
|
|
27
|
+
*/
|
|
28
|
+
export function snackbarClasses({ open = false, opening = false, closing = false, fixed = false, } = {}) {
|
|
29
|
+
return {
|
|
30
|
+
[SNACKBAR_CLASSES.snackbar]: true,
|
|
31
|
+
[SNACKBAR_CLASSES.open]: open,
|
|
32
|
+
[SNACKBAR_CLASSES.opening]: opening,
|
|
33
|
+
[SNACKBAR_CLASSES.closing]: closing,
|
|
34
|
+
[SNACKBAR_CLASSES.fixed]: fixed,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sets up snackbar accessibility and keydown behavior on an element.
|
|
39
|
+
*
|
|
40
|
+
* @param snackbar The snackbar root element.
|
|
41
|
+
* @param opts Options, supports AbortSignal for cleanup.
|
|
42
|
+
*/
|
|
43
|
+
export function setupSnackbar(snackbar, opts) {
|
|
44
|
+
const handleKeyDown = (event) => {
|
|
45
|
+
if (event.key === 'Escape') {
|
|
46
|
+
const el = snackbar;
|
|
47
|
+
if (el.open === false) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
if (typeof el.close === 'function') {
|
|
52
|
+
el.close(CLOSE_REASONS.DISMISS);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
snackbar.dispatchEvent(new CustomEvent('close', {
|
|
56
|
+
bubbles: true,
|
|
57
|
+
cancelable: true,
|
|
58
|
+
detail: { reason: CLOSE_REASONS.DISMISS },
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
snackbar.addEventListener('keydown', handleKeyDown, opts);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A Lit directive that adds snackbar classes and setup logic to an element.
|
|
67
|
+
*/
|
|
68
|
+
export const snackbar = createClassMapDirective({
|
|
69
|
+
getClasses: snackbarClasses,
|
|
70
|
+
setupElement: setupSnackbar,
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=snackbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snackbar.js","sourceRoot":"","sources":["snackbar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AASX;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,gBAAgB;CACf,CAAC;AAYX;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,KAAK,GAAG,KAAK,MACW,EAAE;IAC1B,OAAO;QACL,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI;QACjC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,IAAI;QAC7B,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO;QACnC,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO;QACnC,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK;KAChC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAqB,EACrB,IAA6B;IAE7B,MAAM,aAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;QAC7C,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,EAAE,GAAG,QAGV,CAAC;YACF,IAAI,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YACD,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBACnC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,OAAO,EAAE;oBACvB,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,IAAI;oBAChB,MAAM,EAAE,EAAC,MAAM,EAAE,aAAa,CAAC,OAAO,EAAC;iBACxC,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;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 {createClassMapDirective} from '../shared/directives.js';\n\n/**\n * Standard reasons for closing a snackbar.\n */\nexport const CLOSE_REASONS = {\n ACTION: 'action',\n DISMISS: 'dismiss',\n TIMEOUT: 'timeout',\n} as const;\n\n/**\n * Close reason type.\n */\nexport type CloseReason =\n | (typeof CLOSE_REASONS)[keyof typeof CLOSE_REASONS]\n | string;\n\n/**\n * Snackbar CSS classes.\n */\nexport const SNACKBAR_CLASSES = {\n snackbar: 'snackbar',\n open: 'snackbar-open',\n opening: 'snackbar-opening',\n closing: 'snackbar-closing',\n fixed: 'snackbar-fixed',\n} as const;\n\n/**\n * State provided to `snackbarClasses()`.\n */\nexport interface SnackbarClassesState {\n open?: boolean;\n opening?: boolean;\n closing?: boolean;\n fixed?: boolean;\n}\n\n/**\n * Returns the class map object for the snackbar based on given state.\n */\nexport function snackbarClasses({\n open = false,\n opening = false,\n closing = false,\n fixed = false,\n}: SnackbarClassesState = {}): ClassInfo {\n return {\n [SNACKBAR_CLASSES.snackbar]: true,\n [SNACKBAR_CLASSES.open]: open,\n [SNACKBAR_CLASSES.opening]: opening,\n [SNACKBAR_CLASSES.closing]: closing,\n [SNACKBAR_CLASSES.fixed]: fixed,\n };\n}\n\n/**\n * Sets up snackbar accessibility and keydown behavior on an element.\n *\n * @param snackbar The snackbar root element.\n * @param opts Options, supports AbortSignal for cleanup.\n */\nexport function setupSnackbar(\n snackbar: HTMLElement,\n opts?: {signal?: AbortSignal},\n): void {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n const el = snackbar as HTMLElement & {\n open?: boolean;\n close?: (reason?: string) => void;\n };\n if (el.open === false) {\n return;\n }\n event.preventDefault();\n if (typeof el.close === 'function') {\n el.close(CLOSE_REASONS.DISMISS);\n } else {\n snackbar.dispatchEvent(\n new CustomEvent('close', {\n bubbles: true,\n cancelable: true,\n detail: {reason: CLOSE_REASONS.DISMISS},\n }),\n );\n }\n }\n };\n\n snackbar.addEventListener('keydown', handleKeyDown, opts);\n}\n\n/**\n * A Lit directive that adds snackbar classes and setup logic to an element.\n */\nexport const snackbar = createClassMapDirective({\n getClasses: snackbarClasses,\n setupElement: setupSnackbar,\n});\n"]}
|
|
@@ -0,0 +1,384 @@
|
|
|
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 'sass:math';
|
|
8
|
+
@use '../../../../tokens/versions/latest/sass/md-sys-state';
|
|
9
|
+
@use '../../../../tokens/versions/latest/sass/md-sys-state-focus-indicator';
|
|
10
|
+
@use 'snackbar-tokens';
|
|
11
|
+
// go/keep-sorted end
|
|
12
|
+
|
|
13
|
+
// Margin around the 40px close `.icon-btn` that fills the 48px close slot.
|
|
14
|
+
$close-touch-margin: 4px;
|
|
15
|
+
|
|
16
|
+
// Figma 44:43679 layout dimensions.
|
|
17
|
+
$content-padding-inline: 16px;
|
|
18
|
+
$action-only-padding-inline-end: 8px;
|
|
19
|
+
$action-gap: 4px;
|
|
20
|
+
$close-slot-size: 48px;
|
|
21
|
+
|
|
22
|
+
// Action / close presence on the row. An action is either slotted or the
|
|
23
|
+
// built-in `.snackbar-action` fallback, which doesn't set `has-slotted` on
|
|
24
|
+
// its slot; likewise for the close button.
|
|
25
|
+
$has-action: ":has(slot[name='action'].has-slotted), :has(.snackbar-action)";
|
|
26
|
+
$has-close: ":has(slot[name='dismiss'].has-slotted), :has(.snackbar-dismiss)";
|
|
27
|
+
|
|
28
|
+
// Figma 44:43654: the action text button has 12px horizontal padding.
|
|
29
|
+
$action-padding-inline: 12px;
|
|
30
|
+
|
|
31
|
+
// GM3 state layer opacities. Figma 44:43651 draws no focus state layer, only
|
|
32
|
+
// the focus ring.
|
|
33
|
+
$hover-opacity: math.percentage(md-sys-state.$hover-state-layer-opacity);
|
|
34
|
+
$pressed-opacity: math.percentage(md-sys-state.$pressed-state-layer-opacity);
|
|
35
|
+
|
|
36
|
+
// Cascade layer order follows first declaration. Declaring the shared layers
|
|
37
|
+
// here pins `md.comp.snackbar` above them, whatever order the element's
|
|
38
|
+
// `styles` array uses, so snackbar overrides beat the button and icon-button
|
|
39
|
+
// defaults.
|
|
40
|
+
@layer md.sys, md.comp.ripple, md.comp.focus-ring, md.comp.icon-btn,
|
|
41
|
+
md.comp.button;
|
|
42
|
+
@layer md.comp.snackbar {
|
|
43
|
+
// The token and positioning root: the `md-gb-snackbar` host, or a
|
|
44
|
+
// `.snackbar` used in Light DOM without the element.
|
|
45
|
+
:host,
|
|
46
|
+
.snackbar {
|
|
47
|
+
@include snackbar-tokens.root;
|
|
48
|
+
// `.icon-btn` redefines `--icon-color` and `--icon-size` on the close
|
|
49
|
+
// button. Forward the public values through private names so consumer
|
|
50
|
+
// overrides still reach the close icon.
|
|
51
|
+
--_close-icon-color: var(--icon-color);
|
|
52
|
+
--_close-icon-size: var(--icon-size);
|
|
53
|
+
position: var(--position);
|
|
54
|
+
inset-block-end: var(--bottom-offset);
|
|
55
|
+
inset-inline: 0;
|
|
56
|
+
inline-size: 100%;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
z-index: var(--z-index);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([fixed]),
|
|
63
|
+
.snackbar.snackbar-fixed {
|
|
64
|
+
position: fixed;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// The container queries below resolve against `.snackbar`, which fills the
|
|
68
|
+
// host inside the element.
|
|
69
|
+
.snackbar {
|
|
70
|
+
container: snackbar / inline-size;
|
|
71
|
+
display: none;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Inside the element, the host is the token and positioning root. The inner
|
|
77
|
+
// `.snackbar` inherits the host's tokens, so values set on the host element
|
|
78
|
+
// still apply, and stays in normal flow. This must follow
|
|
79
|
+
// `.snackbar.snackbar-fixed`, which has the same specificity.
|
|
80
|
+
:host > .snackbar {
|
|
81
|
+
@include snackbar-tokens.inherit;
|
|
82
|
+
position: static;
|
|
83
|
+
z-index: auto;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.snackbar.snackbar-opening,
|
|
87
|
+
.snackbar.snackbar-open,
|
|
88
|
+
.snackbar.snackbar-closing {
|
|
89
|
+
display: flex;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.snackbar-surface {
|
|
93
|
+
position: relative;
|
|
94
|
+
background-color: var(--container-color);
|
|
95
|
+
box-shadow: var(--container-elevation);
|
|
96
|
+
border-radius: var(--container-shape);
|
|
97
|
+
min-block-size: var(--min-height);
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: space-between;
|
|
102
|
+
opacity: 0;
|
|
103
|
+
// Enter scales vertically, growing out of the surface's bottom edge.
|
|
104
|
+
transform: scaleY(0);
|
|
105
|
+
transform-origin: center bottom;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
transition:
|
|
108
|
+
opacity 75ms cubic-bezier(0.4, 0, 1, 1),
|
|
109
|
+
transform 75ms cubic-bezier(0.4, 0, 1, 1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.snackbar.snackbar-open .snackbar-surface {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
transform: none;
|
|
115
|
+
pointer-events: auto;
|
|
116
|
+
transition:
|
|
117
|
+
opacity 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
118
|
+
transform 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// `.snackbar` leaves `display: none` in the same render that adds
|
|
122
|
+
// `-open`, so there is no prior style to transition from. Start the enter
|
|
123
|
+
// transition from the collapsed state.
|
|
124
|
+
@starting-style {
|
|
125
|
+
.snackbar.snackbar-open .snackbar-surface {
|
|
126
|
+
opacity: 0;
|
|
127
|
+
transform: scaleY(0);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Exit is a fade only, at full size.
|
|
132
|
+
.snackbar.snackbar-closing .snackbar-surface {
|
|
133
|
+
opacity: 0;
|
|
134
|
+
transform: none;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
transition: opacity 75ms cubic-bezier(0.4, 0, 1, 1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media (prefers-reduced-motion: reduce) {
|
|
140
|
+
.snackbar-surface {
|
|
141
|
+
transition-duration: 0.001ms;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// The wrapping flex row: content box W = surface - 32px (312px at a 344px compact surface).
|
|
146
|
+
// Row padding-block is 0 4px per the Figma 44:43679 vertical metrics.
|
|
147
|
+
.snackbar-content {
|
|
148
|
+
--_actions-chrome: 0px;
|
|
149
|
+
flex: 1 1 auto;
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-wrap: wrap;
|
|
152
|
+
align-items: center;
|
|
153
|
+
row-gap: 0;
|
|
154
|
+
padding-inline: $content-padding-inline;
|
|
155
|
+
padding-block: 0 4px;
|
|
156
|
+
inline-size: 100%;
|
|
157
|
+
box-sizing: border-box;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Detect action / close presence on the row to configure padding-inline-end
|
|
161
|
+
// and --_actions-chrome (the inline space the actions group adds beyond the
|
|
162
|
+
// label's row share: the action gap plus the close slot).
|
|
163
|
+
// 1) Action present, no close: 8px end padding and 4px action gap.
|
|
164
|
+
.snackbar-content:is(#{$has-action}):not(#{$has-close}) {
|
|
165
|
+
--_actions-chrome: #{$action-gap};
|
|
166
|
+
padding-inline-end: $action-only-padding-inline-end;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 2) Close present: 0 end padding so the close slot aligns flush with the
|
|
170
|
+
// surface end.
|
|
171
|
+
.snackbar-content:is(#{$has-close}) {
|
|
172
|
+
padding-inline-end: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 3) Action present with close: 4px gap + 48px close slot - 4px end margin =
|
|
176
|
+
// 48px.
|
|
177
|
+
.snackbar-content:is(#{$has-action}):is(#{$has-close}) {
|
|
178
|
+
--_actions-chrome: #{$action-gap + $close-slot-size - $close-touch-margin};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Label: 14px padding-block with -4px bottom margin per the Figma 44:43679
|
|
182
|
+
// vertical metrics. In compact mode, wraps if action exceeds 30% of W.
|
|
183
|
+
.snackbar-label {
|
|
184
|
+
color: var(--supporting-text-color);
|
|
185
|
+
font: var(--supporting-text);
|
|
186
|
+
letter-spacing: var(--supporting-text-tracking);
|
|
187
|
+
font-variation-settings: var(--supporting-text-axes);
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
padding-block: 14px;
|
|
190
|
+
margin: 0;
|
|
191
|
+
margin-block-end: -4px;
|
|
192
|
+
overflow-wrap: anywhere;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.snackbar-actions {
|
|
196
|
+
flex: none;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: 0;
|
|
200
|
+
margin-inline-start: auto;
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Action present, no close: +4px top margin for 40px height alignment.
|
|
205
|
+
.snackbar-actions:is(#{$has-action}):not(#{$has-close}) {
|
|
206
|
+
margin-block-start: 4px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Close present: -4px bottom and end margin for 48px height and 12px icon
|
|
210
|
+
// alignment.
|
|
211
|
+
.snackbar-actions:is(#{$has-close}) {
|
|
212
|
+
margin-block-end: -4px;
|
|
213
|
+
margin-inline-end: -$close-touch-margin;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Empty actions group contributes 0 inline size
|
|
217
|
+
.snackbar-actions:not(#{$has-action}, #{$has-close}) {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@container snackbar (inline-size < 600px) {
|
|
222
|
+
.snackbar-surface {
|
|
223
|
+
inline-size: calc(100% - 32px);
|
|
224
|
+
margin-inline: 16px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.snackbar-label {
|
|
228
|
+
flex: 1 1 0;
|
|
229
|
+
min-inline-size: calc(70% - var(--_actions-chrome));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@container snackbar (inline-size >= 600px) {
|
|
234
|
+
.snackbar-surface {
|
|
235
|
+
inline-size: fit-content;
|
|
236
|
+
min-inline-size: var(--min-width);
|
|
237
|
+
max-inline-size: min(var(--max-width), calc(100% - 32px));
|
|
238
|
+
margin-inline: auto;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// The label reserves the lesser of its text width and 70% of the widest
|
|
242
|
+
// surface's content box (~448px at the 672px default), so a long action
|
|
243
|
+
// wraps to its own line instead of squeezing the message. Unlike compact,
|
|
244
|
+
// this is measured against the max width through `cqi` rather than `%`:
|
|
245
|
+
// the fit-content surface's width includes the action, so a percentage
|
|
246
|
+
// would size the label from the action it's meant to limit. Capping at
|
|
247
|
+
// `max-content` keeps short messages from widening the surface.
|
|
248
|
+
.snackbar-label {
|
|
249
|
+
flex: 1 1
|
|
250
|
+
calc(
|
|
251
|
+
0.7 *
|
|
252
|
+
(
|
|
253
|
+
min(var(--max-width), 100cqi - 32px) - #{$content-padding-inline *
|
|
254
|
+
2}
|
|
255
|
+
) - var(--_actions-chrome)
|
|
256
|
+
);
|
|
257
|
+
max-inline-size: max-content;
|
|
258
|
+
min-inline-size: 0;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.snackbar-actions ::slotted([slot='action']) {
|
|
263
|
+
margin-inline-start: $action-gap;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Built-in action: a text `.btn` rendered from `action-label`. The shared
|
|
267
|
+
// button, ripple and focus-ring styles draw the container, state layers and
|
|
268
|
+
// focus ring; point the button's component tokens at the action tokens.
|
|
269
|
+
.snackbar-action {
|
|
270
|
+
--leading-space: #{$action-padding-inline};
|
|
271
|
+
--trailing-space: #{$action-padding-inline};
|
|
272
|
+
// The text button's outline is transparent. Drop its width so the 12px
|
|
273
|
+
// padding measures from the container edge.
|
|
274
|
+
--outline-width: 0;
|
|
275
|
+
--label-text-color: var(--action-label-text-color);
|
|
276
|
+
--icon-color: var(--action-label-text-color);
|
|
277
|
+
--label-text: var(--action-label-text);
|
|
278
|
+
--label-text-axes: var(--action-label-text-axes);
|
|
279
|
+
--label-text-tracking: var(--action-label-text-tracking);
|
|
280
|
+
margin-inline-start: $action-gap;
|
|
281
|
+
white-space: nowrap;
|
|
282
|
+
-webkit-tap-highlight-color: transparent;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Figma 44:43660 / 44:43675: pressed keeps the pill / circle shape, instead
|
|
286
|
+
// of the shared buttons' pressed shape morph.
|
|
287
|
+
.snackbar-action:is(:active, .active),
|
|
288
|
+
.snackbar-dismiss:is(:active, .active) {
|
|
289
|
+
--container-shape: calc(var(--container-height) / 2);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Slotted text `<md-gb-button>`: best effort. Its shadow DOM owns the
|
|
293
|
+
// container, ripple and focus ring, and it redefines `--container-*` and
|
|
294
|
+
// `--icon-*` on its inner button, so the snackbar's values don't leak in,
|
|
295
|
+
// and its padding and pressed shape can't be set from here. The text
|
|
296
|
+
// variant colors its label, icon and state layer with
|
|
297
|
+
// `--md-sys-color-primary` and uses the label-lg typescale; point those at
|
|
298
|
+
// the snackbar's action tokens.
|
|
299
|
+
.snackbar-actions ::slotted(md-gb-button[slot='action']) {
|
|
300
|
+
--md-sys-color-primary: var(--action-label-text-color);
|
|
301
|
+
--md-sys-typescale-label-lg: var(--action-label-text);
|
|
302
|
+
--md-sys-typescale-label-lg-axes: var(--action-label-text-axes);
|
|
303
|
+
--md-sys-typescale-label-lg-tracking: var(--action-label-text-tracking);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Slotted plain element such as `<button>`. It is light DOM, so it can't
|
|
307
|
+
// use the shared ripple or focus ring; draw the Figma states here.
|
|
308
|
+
.snackbar-actions ::slotted([slot='action']:not(md-gb-button)) {
|
|
309
|
+
color: var(--action-label-text-color);
|
|
310
|
+
background: transparent;
|
|
311
|
+
border: none;
|
|
312
|
+
font: var(--action-label-text);
|
|
313
|
+
letter-spacing: var(--action-label-text-tracking);
|
|
314
|
+
font-variation-settings: var(--action-label-text-axes);
|
|
315
|
+
cursor: pointer;
|
|
316
|
+
padding-inline: $action-padding-inline;
|
|
317
|
+
block-size: 40px;
|
|
318
|
+
border-radius: 100px;
|
|
319
|
+
display: inline-flex;
|
|
320
|
+
align-items: center;
|
|
321
|
+
justify-content: center;
|
|
322
|
+
box-sizing: border-box;
|
|
323
|
+
text-transform: none;
|
|
324
|
+
outline: none;
|
|
325
|
+
white-space: nowrap;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.snackbar-actions ::slotted([slot='action']:not(md-gb-button):disabled) {
|
|
329
|
+
cursor: default;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.snackbar-actions
|
|
333
|
+
::slotted([slot='action']:not(md-gb-button):not(:disabled):hover) {
|
|
334
|
+
background-color: hsl(
|
|
335
|
+
from var(--action-label-text-color) h s l / #{$hover-opacity}
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Figma 44:43651 draws a focus ring and no focus state layer. Matches the
|
|
340
|
+
// shared `.focus-ring-outer` color and geometry.
|
|
341
|
+
.snackbar-actions ::slotted([slot='action']:not(md-gb-button):focus-visible) {
|
|
342
|
+
outline: md-sys-state-focus-indicator.$thickness solid
|
|
343
|
+
var(--md-sys-color-secondary);
|
|
344
|
+
outline-offset: md-sys-state-focus-indicator.$outer-offset;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.snackbar-actions
|
|
348
|
+
::slotted([slot='action']:not(md-gb-button):not(:disabled):active) {
|
|
349
|
+
background-color: hsl(
|
|
350
|
+
from var(--action-label-text-color) h s l / #{$pressed-opacity}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Close button: a 40px standard `.icon-btn` whose margin fills the 48px
|
|
355
|
+
// close slot flush with the surface end. The shared icon-button, ripple and
|
|
356
|
+
// focus-ring styles draw the container, state layers and focus ring.
|
|
357
|
+
.snackbar-dismiss {
|
|
358
|
+
--icon-color: var(--_close-icon-color);
|
|
359
|
+
--icon-size: var(--_close-icon-size);
|
|
360
|
+
// The standard icon button's outline is transparent. Drop its width so
|
|
361
|
+
// the touch target inset below measures from the 40px border box.
|
|
362
|
+
--outline-width: 0;
|
|
363
|
+
position: relative;
|
|
364
|
+
flex-shrink: 0;
|
|
365
|
+
box-sizing: border-box;
|
|
366
|
+
margin: $close-touch-margin;
|
|
367
|
+
padding: 0;
|
|
368
|
+
-webkit-tap-highlight-color: transparent;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// Extends the touch target to the full 48px close slot, like
|
|
372
|
+
// md-icon-button's touch target.
|
|
373
|
+
.snackbar-dismiss::after {
|
|
374
|
+
content: '';
|
|
375
|
+
position: absolute;
|
|
376
|
+
inset: -$close-touch-margin;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.snackbar-dismiss svg {
|
|
380
|
+
inline-size: var(--icon-size);
|
|
381
|
+
block-size: var(--icon-size);
|
|
382
|
+
fill: currentColor;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2026 Google LLC
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% )}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:". handle ." 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: ""}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: ""): var(--handle-size); else: max(var(--handle-size), var(--with-icon-handle-size)); );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:"";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: " "}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}/*# sourceMappingURL=switch.css.map */
|
|
4
|
+
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% );--disabled: true}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:". handle ." 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: ""}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: ""): var(--handle-size) ; else: max(var(--handle-size), var(--with-icon-handle-size)) ; );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:"";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: " "}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}/*# sourceMappingURL=switch.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["switch.scss","_switch-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,kDACA,sBAEI,QCLF,4CACA,oBACA,8BACA,4DACA,kBACA,oDACA,yBACA,6DACA,qBACA,mDACA,2BACA,oBDHE,0BCQF,uDDLE,kDCSF,2CACA,mCACA,+CACA,oBACA,uDACA,iDDZI,uECgBJ,sDDZE,6DCgBF,oBDbE,gCCiBF,qEACA,qFAGA,8EDnBI,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["switch.scss","_switch-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,kDACA,sBAEI,QCLF,4CACA,oBACA,8BACA,4DACA,kBACA,oDACA,yBACA,6DACA,qBACA,mDACA,2BACA,oBDHE,0BCQF,uDDLE,kDCSF,2CACA,mCACA,+CACA,oBACA,uDACA,iDDZI,uECgBJ,sDDZE,6DCgBF,oBDbE,gCCiBF,qEACA,qFAGA,8EDnBI,iBAEA,6ECuBJ,4CACA,mEACA,oEDpBE,QACE,oBACA,mDACA,mBACA,gBACA,8BACA,mEACA,0CACA,yBACA,2BACA,SACA,UACA,mEACA,kBACA,kBACA,wBACA,iCACA,WAEA,kDACE,0CAGF,gBACE,4HAIA,oBACA,6CACA,aACA,mBACA,WACA,iBACA,eACA,YACA,gDACA,uDACA,kBACA,+BAGF,eACE,WACA,WACA,kBACA,iBACA,+BACA,eACA,8BACA,kBACA,+BACA,oCACA,kCAIJ,qEACE,YAKA,8IAEE,iBAIJ,sIAEE","file":"switch.css"}
|
|
@@ -8,7 +8,7 @@ import { css } from 'lit';
|
|
|
8
8
|
export const styles = css `/*!
|
|
9
9
|
* Copyright 2026 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% )}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:". handle ." 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: ""}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: ""): var(--handle-size); else: max(var(--handle-size), var(--with-icon-handle-size)); );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:"";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: " "}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}
|
|
11
|
+
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% );--disabled: true}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:". handle ." 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: ""}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: ""): var(--handle-size) ; else: max(var(--handle-size), var(--with-icon-handle-size)) ; );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:"";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: " "}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}
|
|
12
12
|
`;
|
|
13
13
|
export default styles.styleSheet;
|
|
14
14
|
//# sourceMappingURL=switch.cssresult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.cssresult.js","sourceRoot":"","sources":["switch.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mEAAmE;AACnE,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/switch/switch.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, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% )}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:\". handle .\" 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: \"\"}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: \"\"): var(--handle-size); else: max(var(--handle-size), var(--with-icon-handle-size)); );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:\"\";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: \" \"}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
1
|
+
{"version":3,"file":"switch.cssresult.js","sourceRoot":"","sources":["switch.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mEAAmE;AACnE,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/switch/switch.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, md.comp.ripple, md.comp.focus-ring;@layer md.comp.switch{.switch{--handle-color: var(--md-sys-color-outline);--handle-size: 16px;--with-icon-handle-size: 24px;--icon-color: var(--md-sys-color-surface-container-highest);--icon-size: 18px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-size: 40px;--track-color: var(--md-sys-color-surface-container-highest);--track-height: 32px;--track-outline-color: var(--md-sys-color-outline);--track-outline-width: 2px;--track-width: 52px}.switch:is(:hover,.hover){--handle-color: var(--md-sys-color-on-surface-variant)}.switch:is(:checked,.checked,[aria-checked=true]){--track-color: var(--md-sys-color-primary);--track-outline-color: transparent;--handle-color: var(--md-sys-color-on-primary);--handle-size: 24px;--icon-color: var(--md-sys-color-on-primary-container);--state-layer-color: var(--md-sys-color-primary)}.switch:is(:checked,.checked,[aria-checked=true]):where(:hover,.hover){--handle-color: var(--md-sys-color-primary-container)}.switch:is(:active,.active):where(:not(:disabled,.disabled)){--handle-size: 28px}.switch:is(:disabled,.disabled){--handle-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl( from var(--md-sys-color-surface-container-highest) h s l / 12% );--track-outline-color: hsl( from var(--md-sys-color-on-surface) h s l / 12% );--disabled: true}.switch:is(:disabled,.disabled):where(:checked,.checked,[aria-checked=true]){--handle-color: var(--md-sys-color-surface);--icon-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--track-color: hsl(from var(--md-sys-color-on-surface) h s l / 12%)}.switch{display:inline-grid;grid-template:\". handle .\" 1fr/0fr min-content 1fr;place-items:center;appearance:none;background:var(--track-color);border:var(--track-outline-width) solid var(--track-outline-color);border-radius:calc(var(--track-height)/2);width:var(--track-width);height:var(--track-height);margin:0;padding:0;transition:grid-template-columns 75ms cubic-bezier(0.4, 0, 0.2, 1);isolation:isolate;position:relative;color:var(--icon-color);--md-icon-size: var(--icon-size);--icon: \"\"}.switch:is(:checked,.checked,[aria-checked=true]){grid-template-columns:1fr min-content 0fr}.switch::before{--_handle-size: if( style(--icon: \"\"): var(--handle-size) ; else: max(var(--handle-size), var(--with-icon-handle-size)) ; );content:var(--icon);font:var(--md-icon-size) var(--md-icon-font);display:grid;place-items:center;z-index:-1;grid-area:handle;aspect-ratio:1;height:100%;clip-path:circle(calc(var(--_handle-size) / 2));transition:clip-path 75ms cubic-bezier(0.4, 0, 0.2, 1);border-radius:50%;background:var(--handle-color)}.switch::after{content:\"\";z-index:-1;position:absolute;grid-area:handle;background-image:var(--ripple);aspect-ratio:1;width:var(--state-layer-size);border-radius:50%;color:var(--state-layer-color);transition:var(--ripple-transition);animation:var(--ripple-animation)}.switch:has(.switch-icon-off:not(slot),.switch-icon-off.has-slotted){--icon: \" \"}.switch .switch-icon-off:not(slot),.switch .switch-icon-off::slotted(*),.switch .switch-icon-on:not(slot),.switch .switch-icon-on::slotted(*){grid-area:handle}.switch:is(:checked,.checked,[aria-checked=true]) .switch-icon-off,.switch:not(:checked,.checked,[aria-checked=true]) .switch-icon-on{display:none}}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
}
|
|
28
28
|
&:is(:disabled, .disabled) {
|
|
29
29
|
@include switch-tokens.disabled;
|
|
30
|
+
--disabled: true;
|
|
31
|
+
|
|
30
32
|
&:where(:checked, .checked, [aria-checked='true']) {
|
|
31
33
|
@include switch-tokens.disabled-selected;
|
|
32
34
|
}
|
|
@@ -57,8 +59,8 @@
|
|
|
57
59
|
|
|
58
60
|
&::before {
|
|
59
61
|
--_handle-size: if(
|
|
60
|
-
style(--icon: ''): var(--handle-size);
|
|
61
|
-
|
|
62
|
+
style(--icon: ''): var(--handle-size) ;
|
|
63
|
+
else: max(var(--handle-size), var(--with-icon-handle-size)) ;
|
|
62
64
|
);
|
|
63
65
|
content: var(--icon);
|
|
64
66
|
font: var(--md-icon-size) var(--md-icon-font);
|