@material/web 2.4.2-nightly.f6c1871.0 → 2.4.2-nightly.fd6fe2a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/internal/_touch-target.scss +1 -1
- package/button/internal/button.d.ts +0 -4
- package/button/internal/button.js.map +1 -1
- package/button/internal/shared-styles.css +1 -1
- package/button/internal/shared-styles.css.map +1 -1
- package/button/internal/shared-styles.cssresult.js +1 -1
- package/button/internal/shared-styles.cssresult.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +2 -2
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/internal/chip.d.ts +2 -0
- package/custom-elements.json +47238 -0
- package/icon/internal/icon.d.ts +1 -1
- package/icon/internal/icon.js +1 -1
- package/icon/internal/icon.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +0 -4
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/internal/aria/aria.d.ts +1 -1
- package/labs/behaviors/form-associated.d.ts +0 -22
- package/labs/behaviors/form-associated.js +0 -11
- package/labs/behaviors/form-associated.js.map +1 -1
- package/labs/gb/components/button/button.d.ts +1 -1
- package/labs/gb/components/button/button.js +5 -5
- package/labs/gb/components/button/button.js.map +1 -1
- package/labs/gb/components/button/md-button.d.ts +10 -2
- package/labs/gb/components/button/md-button.js +92 -11
- package/labs/gb/components/button/md-button.js.map +1 -1
- package/labs/gb/components/card/card.d.ts +1 -1
- package/labs/gb/components/card/card.js +3 -3
- package/labs/gb/components/card/card.js.map +1 -1
- package/labs/gb/components/card/md-card.d.ts +9 -1
- package/labs/gb/components/card/md-card.js +85 -8
- package/labs/gb/components/card/md-card.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.css +1 -1
- package/labs/gb/components/checkbox/checkbox.css.map +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js +1 -1
- package/labs/gb/components/checkbox/checkbox.cssresult.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.d.ts +1 -1
- package/labs/gb/components/checkbox/checkbox.js +4 -4
- package/labs/gb/components/checkbox/checkbox.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.scss +13 -13
- package/labs/gb/components/checkbox/md-checkbox.d.ts +4 -4
- package/labs/gb/components/checkbox/md-checkbox.js +10 -10
- package/labs/gb/components/checkbox/md-checkbox.js.map +1 -1
- package/labs/gb/components/divider/divider.d.ts +1 -1
- package/labs/gb/components/divider/divider.js +1 -1
- package/labs/gb/components/divider/divider.js.map +1 -1
- package/labs/gb/components/fab/fab.d.ts +1 -1
- package/labs/gb/components/fab/fab.js +4 -4
- package/labs/gb/components/fab/fab.js.map +1 -1
- package/labs/gb/components/fab/md-fab.js +4 -4
- package/labs/gb/components/fab/md-fab.js.map +1 -1
- package/labs/gb/components/focus/focus-ring.js +1 -1
- package/labs/gb/components/focus/focus-ring.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.d.ts +1 -1
- package/labs/gb/components/iconbutton/icon-button.js +5 -5
- package/labs/gb/components/iconbutton/icon-button.js.map +1 -1
- package/labs/gb/components/iconbutton/md-icon-button.d.ts +1 -1
- package/labs/gb/components/iconbutton/md-icon-button.js +7 -7
- package/labs/gb/components/iconbutton/md-icon-button.js.map +1 -1
- package/labs/gb/components/list/_list-tokens.scss +102 -0
- package/labs/gb/components/list/list.css +4 -0
- package/labs/gb/components/list/list.css.map +1 -0
- package/labs/gb/components/list/list.cssresult.d.ts +3 -0
- package/labs/gb/components/list/list.cssresult.js +14 -0
- package/labs/gb/components/list/list.cssresult.js.map +1 -0
- package/labs/gb/components/list/list.d.ts +103 -0
- package/labs/gb/components/list/list.js +109 -0
- package/labs/gb/components/list/list.js.map +1 -0
- package/labs/gb/components/list/list.scss +212 -0
- package/labs/gb/components/list/md-list-item.d.ts +44 -0
- package/labs/gb/components/list/md-list-item.js +122 -0
- package/labs/gb/components/list/md-list-item.js.map +1 -0
- package/labs/gb/components/list/md-list.d.ts +26 -0
- package/labs/gb/components/list/md-list.js +51 -0
- package/labs/gb/components/list/md-list.js.map +1 -0
- package/labs/gb/components/menu/_menu-tokens.scss +128 -0
- package/labs/gb/components/menu/md-menu-group.d.ts +26 -0
- package/labs/gb/components/menu/md-menu-group.js +65 -0
- package/labs/gb/components/menu/md-menu-group.js.map +1 -0
- package/labs/gb/components/menu/md-menu-item.d.ts +30 -0
- package/labs/gb/components/menu/md-menu-item.js +165 -0
- package/labs/gb/components/menu/md-menu-item.js.map +1 -0
- package/labs/gb/components/menu/md-menu.d.ts +28 -0
- package/labs/gb/components/menu/md-menu.js +141 -0
- package/labs/gb/components/menu/md-menu.js.map +1 -0
- package/labs/gb/components/menu/menu.css +4 -0
- package/labs/gb/components/menu/menu.css.map +1 -0
- package/labs/gb/components/menu/menu.cssresult.d.ts +3 -0
- package/labs/gb/components/menu/menu.cssresult.js +14 -0
- package/labs/gb/components/menu/menu.cssresult.js.map +1 -0
- package/labs/gb/components/menu/menu.d.ts +117 -0
- package/labs/gb/components/menu/menu.js +107 -0
- package/labs/gb/components/menu/menu.js.map +1 -0
- package/labs/gb/components/menu/menu.scss +171 -0
- package/labs/gb/components/radio/md-radio.d.ts +4 -4
- package/labs/gb/components/radio/md-radio.js +11 -11
- package/labs/gb/components/radio/md-radio.js.map +1 -1
- package/labs/gb/components/radio/radio.css +1 -1
- package/labs/gb/components/radio/radio.css.map +1 -1
- package/labs/gb/components/radio/radio.cssresult.js +1 -1
- package/labs/gb/components/radio/radio.cssresult.js.map +1 -1
- package/labs/gb/components/radio/radio.d.ts +1 -1
- package/labs/gb/components/radio/radio.js +4 -4
- package/labs/gb/components/radio/radio.js.map +1 -1
- package/labs/gb/components/radio/radio.scss +4 -5
- package/labs/gb/components/ripple/ripple.js +5 -2
- package/labs/gb/components/ripple/ripple.js.map +1 -1
- package/labs/gb/components/shared/directives.js +2 -3
- package/labs/gb/components/shared/directives.js.map +1 -1
- package/labs/gb/components/splitbutton/_split-button-tokens.scss +135 -0
- package/labs/gb/components/splitbutton/md-split-button.d.ts +26 -0
- package/labs/gb/components/splitbutton/md-split-button.js +119 -0
- package/labs/gb/components/splitbutton/md-split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.css +4 -0
- package/labs/gb/components/splitbutton/split-button.css.map +1 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.d.ts +3 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js +14 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.d.ts +47 -0
- package/labs/gb/components/splitbutton/split-button.js +46 -0
- package/labs/gb/components/splitbutton/split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.scss +164 -0
- package/labs/gb/components/switch/md-switch.d.ts +4 -4
- package/labs/gb/components/switch/md-switch.js +12 -12
- package/labs/gb/components/switch/md-switch.js.map +1 -1
- package/labs/gb/components/switch/switch.d.ts +1 -1
- package/labs/gb/components/switch/switch.js +5 -5
- package/labs/gb/components/switch/switch.js.map +1 -1
- package/labs/gb/styles/adopt-styles.js +1 -6
- package/labs/gb/styles/adopt-styles.js.map +1 -1
- package/labs/gb/styles/icon/md-icon.css +1 -1
- package/labs/gb/styles/icon/md-icon.css.map +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js.map +1 -1
- package/labs/gb/styles/icon/md-icon.d.ts +20 -0
- package/labs/gb/styles/icon/md-icon.js +24 -0
- package/labs/gb/styles/icon/md-icon.js.map +1 -0
- package/labs/gb/styles/icon/md-icon.scss +2 -1
- package/labs/gb/styles/m3.css +5 -2
- package/labs/gb/styles/m3.css.map +1 -1
- package/labs/gb/styles/m3.cssresult.js +5 -2
- package/labs/gb/styles/m3.cssresult.js.map +1 -1
- package/labs/gb/styles/m3.scss +1 -0
- package/labs/gb/styles/space/md-space-tokens.css +4 -0
- package/labs/gb/styles/space/md-space-tokens.css.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.d.ts +3 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js +14 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.scss +28 -0
- package/labs/gb/styles/tailwind.css +4 -0
- package/labs/gb/styles/tailwind.css.map +1 -0
- package/labs/gb/styles/tailwind.cssresult.d.ts +3 -0
- package/labs/gb/styles/tailwind.cssresult.js +14 -0
- package/labs/gb/styles/tailwind.cssresult.js.map +1 -0
- package/labs/gb/styles/tailwind.scss +349 -0
- package/labs/gb/styles/typography/internal/_typography-tokens.scss +85 -16
- package/labs/gb/styles/typography/md-typography-tokens.css +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.css.map +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +6 -1
- package/list/internal/listitem/list-item.js +4 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +2 -0
- package/menu/internal/submenu/sub-menu.d.ts +5 -1
- package/menu/internal/submenu/sub-menu.js +5 -1
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/package.json +27 -4
- package/radio/internal/radio.d.ts +0 -2
- package/radio/internal/radio.js.map +1 -1
- package/select/internal/select.d.ts +2 -2
- package/select/internal/select.js.map +1 -1
- package/select/internal/selectoption/select-option.d.ts +2 -0
- package/slider/internal/slider.d.ts +0 -2
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/_switch.scss +1 -0
- package/switch/internal/switch-styles.css +1 -1
- package/switch/internal/switch-styles.css.map +1 -1
- package/switch/internal/switch-styles.cssresult.js +1 -1
- package/switch/internal/switch-styles.cssresult.js.map +1 -1
- package/switch/internal/switch.d.ts +0 -2
- package/switch/internal/switch.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["card.ts"],"names":[],"mappings":"AAA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B,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK;QAC3B,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ;KAClC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAC;IAC1C,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {type ClassInfo} from 'lit/directives/class-map.js';\nimport {FOCUS_RING_CLASSES} from '../focus/focus-ring.js';\nimport {createClassMapDirective} from '../shared/directives.js';\nimport {PSEUDO_CLASSES} from '../shared/pseudo-classes.js';\n\n/** Card color configuration types. */\nexport type CardColor = 'elevated' | 'filled' | 'outlined';\n\n/** Card color configurations. */\nexport const CARD_COLORS = {\n elevated: 'elevated',\n filled: 'filled',\n outlined: 'outlined',\n} as const;\n\n/** Card classes. */\nexport const CARD_CLASSES = {\n card: 'card',\n cardElevated: 'card-elevated',\n cardFilled: 'card-filled',\n cardOutlined: 'card-outlined',\n hover: PSEUDO_CLASSES.hover,\n focus: PSEUDO_CLASSES.focus,\n disabled: PSEUDO_CLASSES.disabled,\n} as const;\n\n/** The state provided to the `cardClasses()` function. */\nexport interface CardClassesState {\n /** The color of the card. */\n color?: CardColor;\n /** Whether the card is interactive. */\n interactive?: boolean;\n /** Emulates `:hover`. */\n hover?: boolean;\n /** Emulates `:focus`. */\n focus?: boolean;\n /** Emulates `:disabled`. */\n disabled?: boolean;\n}\n\n/**\n * Returns the card classes to apply to an element based on the given state.\n *\n * @param state The state of the card.\n * @return An object of class names and truthy values if they apply.\n */\nexport function cardClasses({\n color,\n interactive = false,\n hover = false,\n focus = false,\n disabled = false,\n}: CardClassesState = {}): ClassInfo {\n return {\n [FOCUS_RING_CLASSES.focusRingOuter]: interactive,\n [CARD_CLASSES.card]: true,\n [CARD_CLASSES.cardElevated]: color === CARD_COLORS.elevated,\n [CARD_CLASSES.cardFilled]: color === CARD_COLORS.filled,\n [CARD_CLASSES.cardOutlined]: color === CARD_COLORS.outlined || !color,\n [CARD_CLASSES.hover]: hover,\n [CARD_CLASSES.focus]: focus,\n [CARD_CLASSES.disabled]: disabled,\n };\n}\n\n/**\n * A Lit directive that adds card styling and functionality to its element.\n *\n * @example\n * ```ts\n * html`\n * <div class=\"${card({color: 'filled'})} flex flex-row p-4\">\n * Card content\n * </div>\n * `\n * ```\n */\nexport const card = createClassMapDirective({\n getClasses: cardClasses,\n});\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { CSSResultOrNative, LitElement } from 'lit';
|
|
6
|
+
import { CSSResultOrNative, LitElement, PropertyValues } from 'lit';
|
|
7
7
|
import { type CardColor } from './card.js';
|
|
8
8
|
declare global {
|
|
9
9
|
interface HTMLElementTagNameMap {
|
|
@@ -19,12 +19,20 @@ export declare class Card extends baseClass {
|
|
|
19
19
|
/** @nocollapse */
|
|
20
20
|
static shadowRootOptions: ShadowRootInit;
|
|
21
21
|
static styles: CSSResultOrNative[];
|
|
22
|
+
private hideOutline;
|
|
23
|
+
private lastFiredEnabledState?;
|
|
22
24
|
/** The color of the card. */
|
|
23
25
|
color: CardColor;
|
|
24
26
|
/** Whether the card is disabled. */
|
|
25
27
|
disabled: boolean;
|
|
26
28
|
/** Whether the card is interactive. */
|
|
27
29
|
interactive: boolean;
|
|
30
|
+
connectedCallback(): void;
|
|
31
|
+
disconnectedCallback(): void;
|
|
32
|
+
private readonly handleSetShowOutline;
|
|
33
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
34
|
+
private dispatchSetEnabledEvent;
|
|
28
35
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
36
|
+
private handleContainerSlotChange;
|
|
29
37
|
}
|
|
30
38
|
export {};
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
|
|
7
|
+
import { css, html, LitElement, nothing, } from 'lit';
|
|
8
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
+
import { mixinDelegatesAria } from '../../../../internal/aria/delegate.js';
|
|
10
|
+
import { ripple } from '../ripple/ripple.js';
|
|
11
|
+
import { hasSlotted } from '../shared/has-slotted.js';
|
|
12
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
13
|
+
// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
14
|
+
import rippleStyles from '../ripple/ripple.css' with { type: 'css' }; // github-only
|
|
15
|
+
// import rippleStyles from '../ripple/ripple.cssresult.js'; // google3-only
|
|
15
16
|
import cardStyles from './card.css' with { type: 'css' }; // github-only
|
|
16
17
|
// import cardStyles from './card.cssresult.js'; // google3-only
|
|
17
18
|
import { card } from './card.js';
|
|
@@ -23,12 +24,45 @@ const baseClass = mixinDelegatesAria(LitElement);
|
|
|
23
24
|
let Card = class Card extends baseClass {
|
|
24
25
|
constructor() {
|
|
25
26
|
super(...arguments);
|
|
27
|
+
this.hideOutline = false;
|
|
26
28
|
/** The color of the card. */
|
|
27
29
|
this.color = 'outlined';
|
|
28
30
|
/** Whether the card is disabled. */
|
|
29
31
|
this.disabled = false;
|
|
30
32
|
/** Whether the card is interactive. */
|
|
31
33
|
this.interactive = false;
|
|
34
|
+
this.handleSetShowOutline = (event) => {
|
|
35
|
+
const customEvent = event;
|
|
36
|
+
this.hideOutline = !customEvent.detail.shown;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this.addEventListener('md-gb:set-show-outline', this.handleSetShowOutline);
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback();
|
|
45
|
+
this.removeEventListener('md-gb:set-show-outline', this.handleSetShowOutline);
|
|
46
|
+
}
|
|
47
|
+
updated(changedProperties) {
|
|
48
|
+
super.updated(changedProperties);
|
|
49
|
+
if (changedProperties.has('disabled')) {
|
|
50
|
+
this.dispatchSetEnabledEvent();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
dispatchSetEnabledEvent() {
|
|
54
|
+
const enabled = !this.disabled;
|
|
55
|
+
if (this.lastFiredEnabledState === enabled)
|
|
56
|
+
return;
|
|
57
|
+
const slot = this.shadowRoot?.querySelector('slot[name="container"]');
|
|
58
|
+
if (slot) {
|
|
59
|
+
for (const element of slot.assignedElements({ flatten: true })) {
|
|
60
|
+
element.dispatchEvent(new CustomEvent('md-gb:set-enabled', {
|
|
61
|
+
detail: { enabled },
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.lastFiredEnabledState = enabled;
|
|
32
66
|
}
|
|
33
67
|
render() {
|
|
34
68
|
const { ariaLabel } = this;
|
|
@@ -38,6 +72,9 @@ let Card = class Card extends baseClass {
|
|
|
38
72
|
color: this.color,
|
|
39
73
|
disabled: this.disabled,
|
|
40
74
|
interactive: this.interactive,
|
|
75
|
+
classes: {
|
|
76
|
+
'card-hide-outline': this.hideOutline,
|
|
77
|
+
},
|
|
41
78
|
})}">
|
|
42
79
|
${this.interactive
|
|
43
80
|
? html `<button
|
|
@@ -48,8 +85,22 @@ let Card = class Card extends baseClass {
|
|
|
48
85
|
aria-label="${ariaLabel || nothing}"></button>`
|
|
49
86
|
: nothing}
|
|
50
87
|
<slot></slot>
|
|
88
|
+
<slot
|
|
89
|
+
name="container"
|
|
90
|
+
${hasSlotted()}
|
|
91
|
+
@slotchange=${this.handleContainerSlotChange}></slot>
|
|
51
92
|
</div>`;
|
|
52
93
|
}
|
|
94
|
+
handleContainerSlotChange(event) {
|
|
95
|
+
const slot = event.target;
|
|
96
|
+
const enabled = !this.disabled;
|
|
97
|
+
for (const element of slot.assignedElements({ flatten: true })) {
|
|
98
|
+
element.dispatchEvent(new CustomEvent('md-gb:change-container-slot'));
|
|
99
|
+
element.dispatchEvent(new CustomEvent('md-gb:set-enabled', {
|
|
100
|
+
detail: { enabled },
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
53
104
|
};
|
|
54
105
|
/** @nocollapse */
|
|
55
106
|
Card.shadowRootOptions = {
|
|
@@ -63,12 +114,38 @@ Card.styles = [
|
|
|
63
114
|
css `
|
|
64
115
|
:host {
|
|
65
116
|
display: inline-flex;
|
|
117
|
+
isolation: isolate;
|
|
66
118
|
}
|
|
67
119
|
.card {
|
|
68
120
|
flex: 1;
|
|
121
|
+
position: relative;
|
|
122
|
+
}
|
|
123
|
+
.card:has([name='container'].has-slotted) {
|
|
124
|
+
background-color: transparent;
|
|
125
|
+
}
|
|
126
|
+
.card.card-hide-outline {
|
|
127
|
+
--outline-color: transparent;
|
|
128
|
+
--container-elevation: var(--md-sys-elevation-shadow-0);
|
|
129
|
+
}
|
|
130
|
+
slot[name='container'] {
|
|
131
|
+
display: block;
|
|
132
|
+
position: absolute;
|
|
133
|
+
inset: 0;
|
|
134
|
+
border-radius: inherit;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
--color: var(--container-color);
|
|
137
|
+
z-index: -1;
|
|
138
|
+
transition: inherit;
|
|
139
|
+
}
|
|
140
|
+
slot[name='container']::slotted(*) {
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 100%;
|
|
69
143
|
}
|
|
70
144
|
`,
|
|
71
145
|
];
|
|
146
|
+
__decorate([
|
|
147
|
+
state()
|
|
148
|
+
], Card.prototype, "hideOutline", void 0);
|
|
72
149
|
__decorate([
|
|
73
150
|
property()
|
|
74
151
|
], Card.prototype, "color", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-card.js","sourceRoot":"","sources":["md-card.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;
|
|
1
|
+
{"version":3,"file":"md-card.js","sourceRoot":"","sources":["md-card.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,eAAe,MAAM,yBAAyB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACxF,kFAAkF;AAClF,OAAO,YAAY,MAAM,sBAAsB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AAClF,4EAA4E;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtE,gEAAgE;AAEhE,OAAO,EAAiB,IAAI,EAAC,MAAM,WAAW,CAAC;AAS/C,wCAAwC;AACxC,MAAM,SAAS,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEjD;;GAEG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,SAAS;IAA5B;;QA4CY,gBAAW,GAAG,KAAK,CAAC;QAIrC,6BAA6B;QACjB,UAAK,GAAc,UAAU,CAAC;QAE1C,oCAAoC;QACT,aAAQ,GAAG,KAAK,CAAC;QAE5C,uCAAuC;QACZ,gBAAW,GAAG,KAAK,CAAC;QAe9B,yBAAoB,GAAG,CAAC,KAAY,EAAE,EAAE;YACvD,MAAM,WAAW,GAAG,KAAsC,CAAC;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CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;sCAAkB;AAGjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAqB;AAvDpC,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CAgJhB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n css,\n CSSResultOrNative,\n html,\n LitElement,\n nothing,\n PropertyValues,\n} from 'lit';\nimport {customElement, property, state} from 'lit/decorators.js';\nimport {ARIAMixinStrict} from '../../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../../internal/aria/delegate.js';\nimport {ripple} from '../ripple/ripple.js';\nimport {hasSlotted} from '../shared/has-slotted.js';\n\nimport focusRingStyles from '../focus/focus-ring.css' with {type: 'css'}; // github-only\n// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '../ripple/ripple.css' with {type: 'css'}; // github-only\n// import rippleStyles from '../ripple/ripple.cssresult.js'; // google3-only\nimport cardStyles from './card.css' with {type: 'css'}; // github-only\n// import cardStyles from './card.cssresult.js'; // google3-only\n\nimport {type CardColor, card} from './card.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design card component. */\n 'md-card': Card;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinDelegatesAria(LitElement);\n\n/**\n * A Material Design card.\n */\n@customElement('md-card')\nexport class Card extends baseClass {\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n static override styles: CSSResultOrNative[] = [\n focusRingStyles,\n rippleStyles,\n cardStyles,\n css`\n :host {\n display: inline-flex;\n isolation: isolate;\n }\n .card {\n flex: 1;\n position: relative;\n }\n .card:has([name='container'].has-slotted) {\n background-color: transparent;\n }\n .card.card-hide-outline {\n --outline-color: transparent;\n --container-elevation: var(--md-sys-elevation-shadow-0);\n }\n slot[name='container'] {\n display: block;\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n --color: var(--container-color);\n z-index: -1;\n transition: inherit;\n }\n slot[name='container']::slotted(*) {\n width: 100%;\n height: 100%;\n }\n `,\n ];\n\n @state() private hideOutline = false;\n\n private lastFiredEnabledState?: boolean;\n\n /** The color of the card. */\n @property() color: CardColor = 'outlined';\n\n /** Whether the card is disabled. */\n @property({type: Boolean}) disabled = false;\n\n /** Whether the card is interactive. */\n @property({type: Boolean}) interactive = false;\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('md-gb:set-show-outline', this.handleSetShowOutline);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\n 'md-gb:set-show-outline',\n this.handleSetShowOutline,\n );\n }\n\n private readonly handleSetShowOutline = (event: Event) => {\n const customEvent = event as CustomEvent<{shown: boolean}>;\n this.hideOutline = !customEvent.detail.shown;\n };\n\n protected override updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n if (changedProperties.has('disabled')) {\n this.dispatchSetEnabledEvent();\n }\n }\n\n private dispatchSetEnabledEvent() {\n const enabled = !this.disabled;\n\n if (this.lastFiredEnabledState === enabled) return;\n\n const slot = this.shadowRoot?.querySelector(\n 'slot[name=\"container\"]',\n ) as HTMLSlotElement;\n if (slot) {\n for (const element of slot.assignedElements({flatten: true})) {\n element.dispatchEvent(\n new CustomEvent('md-gb:set-enabled', {\n detail: {enabled},\n }),\n );\n }\n }\n this.lastFiredEnabledState = enabled;\n }\n\n protected override render() {\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`<div\n part=\"card\"\n class=\"${card({\n color: this.color,\n disabled: this.disabled,\n interactive: this.interactive,\n classes: {\n 'card-hide-outline': this.hideOutline,\n },\n })}\">\n ${this.interactive\n ? html`<button\n part=\"card-btn\"\n class=\"card-btn ripple focus-ring-target\"\n ${ripple()}\n ?disabled=\"${this.disabled}\"\n aria-label=\"${ariaLabel || nothing}\"></button>`\n : nothing}\n <slot></slot>\n <slot\n name=\"container\"\n ${hasSlotted()}\n @slotchange=${this.handleContainerSlotChange}></slot>\n </div>`;\n }\n\n private handleContainerSlotChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n\n const enabled = !this.disabled;\n\n for (const element of slot.assignedElements({flatten: true})) {\n element.dispatchEvent(new CustomEvent('md-gb:change-container-slot'));\n element.dispatchEvent(\n new CustomEvent('md-gb:set-enabled', {\n detail: {enabled},\n }),\n );\n }\n }\n}\n"]}
|
|
@@ -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.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none}.checkbox::before{
|
|
4
|
+
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none;margin:0;--icon: "check"}.checkbox:is(:indeterminate,.indeterminate)::before{--icon: "remove"}.checkbox::before{content:var(--icon);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;overflow:hidden;aspect-ratio:1;width:var(--container-size);background:var(--container-color);border-radius:var(--container-shape);border:var(--outline-width) solid var(--outline-color);color:var(--icon-color);font:var(--icon-size)/1 var(--md-icon-font)}.checkbox::after{content:"";position:absolute;aspect-ratio:1;background-image:var(--ripple);color:var(--state-layer-color);width:var(--state-layer-size);border-radius:var(--state-layer-shape);outline:var(--focus-ring-outline);outline-offset:var(--focus-ring-offset);transition:var(--ripple-transition);animation:var(--ripple-animation),var(--focus-ring-animation)}}/*# sourceMappingURL=checkbox.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["checkbox.scss","_checkbox-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,kDACA,wBAEI,UCNF,+BACA,uBACA,uBACA,0BACA,kBACA,wDACA,qBACA,oDACA,yBACA,yBDCE,4BCGF,oDACA,mFAIA,8EAIA,iDACA,gDDDE,8DCKF,mBACA,+CACA,6CDJI,mFCQJ,iDDJI,qFCQJ,oDDHE,gCCOF,+CACA,2CDLI,uFCSJ,6CACA,2CDLE,kCCSF,sEDNI,yFCUJ,wEACA,0CDNE,UACE,gBACA,kBACA,oBACA,mBACA,uBACA,WACA,YACA,sBACA,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["checkbox.scss","_checkbox-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,kDACA,wBAEI,UCNF,+BACA,uBACA,uBACA,0BACA,kBACA,wDACA,qBACA,oDACA,yBACA,yBDCE,4BCGF,oDACA,mFAIA,8EAIA,iDACA,gDDDE,8DCKF,mBACA,+CACA,6CDJI,mFCQJ,iDDJI,qFCQJ,oDDHE,gCCOF,+CACA,2CDLI,uFCSJ,6CACA,2CDLE,kCCSF,sEDNI,yFCUJ,wEACA,0CDNE,UACE,gBACA,kBACA,oBACA,mBACA,uBACA,WACA,YACA,sBACA,aACA,SACA,gBAEA,oDACE,iBAGF,kBACE,oBACA,oBACA,mBACA,uBACA,sBACA,gBACA,eACA,4BACA,kCACA,qCACA,uDACA,wBACA,4CAGF,iBACE,WACA,kBACA,eACA,+BACA,+BACA,8BACA,uCACA,kCACA,wCACA,oCACA","file":"checkbox.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.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none}.checkbox::before{
|
|
11
|
+
*/@layer md.sys, md.comp.ripple, md.comp.focus-ring;@layer md.comp.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none;margin:0;--icon: "check"}.checkbox:is(:indeterminate,.indeterminate)::before{--icon: "remove"}.checkbox::before{content:var(--icon);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;overflow:hidden;aspect-ratio:1;width:var(--container-size);background:var(--container-color);border-radius:var(--container-shape);border:var(--outline-width) solid var(--outline-color);color:var(--icon-color);font:var(--icon-size)/1 var(--md-icon-font)}.checkbox::after{content:"";position:absolute;aspect-ratio:1;background-image:var(--ripple);color:var(--state-layer-color);width:var(--state-layer-size);border-radius:var(--state-layer-shape);outline:var(--focus-ring-outline);outline-offset:var(--focus-ring-offset);transition:var(--ripple-transition);animation:var(--ripple-animation),var(--focus-ring-animation)}}
|
|
12
12
|
`;
|
|
13
13
|
export default styles.styleSheet;
|
|
14
14
|
//# sourceMappingURL=checkbox.cssresult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.cssresult.js","sourceRoot":"","sources":["checkbox.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,uEAAuE;AACvE,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/checkbox/checkbox.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.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none}.checkbox::before{
|
|
1
|
+
{"version":3,"file":"checkbox.cssresult.js","sourceRoot":"","sources":["checkbox.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,uEAAuE;AACvE,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/checkbox/checkbox.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.checkbox{.checkbox{--container-color: transparent;--container-shape: 2px;--container-size: 18px;--icon-color: transparent;--icon-size: 18px;--outline-color: var(--md-sys-color-on-surface-variant);--outline-width: 2px;--state-layer-color: var(--md-sys-color-on-surface);--state-layer-shape: 50%;--state-layer-size: 40px}.checkbox:is(:hover,.hover){--state-layer-color: var(--md-sys-color-on-surface);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:focus-within,.focus){--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:active,.active){--state-layer-color: var(--md-sys-color-primary);--outline-color: var(--md-sys-color-on-surface)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate){--outline-width: 0;--container-color: var(--md-sys-color-primary);--icon-color: var(--md-sys-color-on-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:hover,.hover){--state-layer-color: var(--md-sys-color-primary)}.checkbox:is(:checked,.checked,:indeterminate,.indeterminate):where(:active,.active){--state-layer-color: var(--md-sys-color-on-surface)}.checkbox:is(:invalid,.invalid){--state-layer-color: var(--md-sys-color-error);--outline-color: var(--md-sys-color-error)}.checkbox:is(:invalid,.invalid):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: var(--md-sys-color-error);--icon-color: var(--md-sys-color-on-error)}.checkbox:is(:disabled,.disabled){--outline-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%)}.checkbox:is(:disabled,.disabled):where(:checked,.checked,:indeterminate,.indeterminate){--container-color: hsl(from var(--md-sys-color-on-surface) h s l / 38%);--icon-color: var(--md-sys-color-surface)}.checkbox{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;background-image:none;outline:none;margin:0;--icon: \"check\"}.checkbox:is(:indeterminate,.indeterminate)::before{--icon: \"remove\"}.checkbox::before{content:var(--icon);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;overflow:hidden;aspect-ratio:1;width:var(--container-size);background:var(--container-color);border-radius:var(--container-shape);border:var(--outline-width) solid var(--outline-color);color:var(--icon-color);font:var(--icon-size)/1 var(--md-icon-font)}.checkbox::after{content:\"\";position:absolute;aspect-ratio:1;background-image:var(--ripple);color:var(--state-layer-color);width:var(--state-layer-size);border-radius:var(--state-layer-shape);outline:var(--focus-ring-outline);outline-offset:var(--focus-ring-offset);transition:var(--ripple-transition);animation:var(--ripple-animation),var(--focus-ring-animation)}}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
@@ -56,4 +56,4 @@ export declare function setupCheckbox(checkbox: HTMLElement, opts?: {
|
|
|
56
56
|
* html`<input type="checkbox" class="${checkbox()}">`;
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export declare const checkbox: (state?: CheckboxClassesState & import("
|
|
59
|
+
export declare const checkbox: (state?: CheckboxClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { focusRingClasses } from '
|
|
7
|
-
import { rippleClasses, setupRipple
|
|
8
|
-
import { createClassMapDirective } from '
|
|
9
|
-
import { PSEUDO_CLASSES } from '
|
|
6
|
+
import { focusRingClasses } from '../focus/focus-ring.js';
|
|
7
|
+
import { rippleClasses, setupRipple } from '../ripple/ripple.js';
|
|
8
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
9
|
+
import { PSEUDO_CLASSES } from '../shared/pseudo-classes.js';
|
|
10
10
|
/** Checkbox classes. */
|
|
11
11
|
export const CHECKBOX_CLASSES = {
|
|
12
12
|
checkbox: 'checkbox',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["checkbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["checkbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAE3D,wBAAwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,MAAM,EAAE,cAAc,CAAC,MAAM;IAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,aAAa,EAAE,cAAc,CAAC,aAAa;IAC3C,QAAQ,EAAE,cAAc,CAAC,QAAQ;CACzB,CAAC;AAoBX;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,OAAO,GAAG,KAAK,EACf,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,KAAK,EACf,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,KAAK,MACQ,EAAE;IAC1B,OAAO;QACL,GAAG,aAAa,EAAE;QAClB,GAAG,gBAAgB,EAAE;QACrB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI;QACjC,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO;QACnC,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,aAAa;QAC/C,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ;QACrC,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO;QACnC,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK;QAC/B,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK;QAC/B,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM;KAClC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAqB,EACrB,IAA6B;IAE7B,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;GAOG;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 {focusRingClasses} from '../focus/focus-ring.js';\nimport {rippleClasses, setupRipple} from '../ripple/ripple.js';\nimport {createClassMapDirective} from '../shared/directives.js';\nimport {PSEUDO_CLASSES} from '../shared/pseudo-classes.js';\n\n/** Checkbox classes. */\nexport const CHECKBOX_CLASSES = {\n checkbox: 'checkbox',\n invalid: PSEUDO_CLASSES.invalid,\n hover: PSEUDO_CLASSES.hover,\n focus: PSEUDO_CLASSES.focus,\n active: PSEUDO_CLASSES.active,\n checked: PSEUDO_CLASSES.checked,\n indeterminate: PSEUDO_CLASSES.indeterminate,\n disabled: PSEUDO_CLASSES.disabled,\n} as const;\n\n/** The state provided to the `checkboxClasses()` function. */\nexport interface CheckboxClassesState {\n /** Emulates `:invalid`. */\n invalid?: boolean;\n /** Emulates `:hover`. */\n hover?: boolean;\n /** Emulates `:focus`. */\n focus?: boolean;\n /** Emulates `:active`. */\n active?: boolean;\n /** Emulates `:checked`. */\n checked?: boolean;\n /** Emulates `:indeterminate`. */\n indeterminate?: boolean;\n /** Emulates `:disabled`. */\n disabled?: boolean;\n}\n\n/**\n * Returns the checkbox classes to apply to an element based on the given state.\n *\n * @param state The state of the checkbox.\n * @return An object of class names and truthy values if they apply.\n */\nexport function checkboxClasses({\n invalid = false,\n hover = false,\n focus = false,\n active = false,\n checked = false,\n indeterminate = false,\n disabled = false,\n}: CheckboxClassesState = {}): ClassInfo {\n return {\n ...rippleClasses(),\n ...focusRingClasses(),\n [CHECKBOX_CLASSES.checkbox]: true,\n [CHECKBOX_CLASSES.checked]: checked,\n [CHECKBOX_CLASSES.indeterminate]: indeterminate,\n [CHECKBOX_CLASSES.disabled]: disabled,\n [CHECKBOX_CLASSES.invalid]: invalid,\n [CHECKBOX_CLASSES.hover]: hover,\n [CHECKBOX_CLASSES.focus]: focus,\n [CHECKBOX_CLASSES.active]: active,\n };\n}\n\n/**\n * Sets up checkbox functionality for the given element.\n *\n * @param checkbox The element on which to set up checkbox functionality.\n * @param opts Setup options, supports a cleanup `signal`.\n */\nexport function setupCheckbox(\n checkbox: HTMLElement,\n opts?: {signal?: AbortSignal},\n): void {\n setupRipple(checkbox, opts);\n}\n\n/**\n * A Lit directive that adds checkbox styling and functionality to its element.\n *\n * @example\n * ```ts\n * html`<input type=\"checkbox\" class=\"${checkbox()}\">`;\n * ```\n */\nexport const checkbox = createClassMapDirective({\n getClasses: checkboxClasses,\n setupElement: setupCheckbox,\n});\n"]}
|
|
@@ -64,19 +64,27 @@
|
|
|
64
64
|
height: 48px;
|
|
65
65
|
background-image: none;
|
|
66
66
|
outline: none;
|
|
67
|
+
margin: 0;
|
|
68
|
+
--icon: 'check';
|
|
69
|
+
|
|
70
|
+
&:is(:indeterminate, .indeterminate)::before {
|
|
71
|
+
--icon: 'remove';
|
|
72
|
+
}
|
|
67
73
|
|
|
68
74
|
&::before {
|
|
69
|
-
content:
|
|
75
|
+
content: var(--icon);
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
70
79
|
box-sizing: border-box;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
aspect-ratio: 1;
|
|
71
82
|
width: var(--container-size);
|
|
72
|
-
height: var(--container-size);
|
|
73
83
|
background: var(--container-color);
|
|
74
84
|
border-radius: var(--container-shape);
|
|
75
85
|
border: var(--outline-width) solid var(--outline-color);
|
|
76
86
|
color: var(--icon-color);
|
|
77
|
-
font
|
|
78
|
-
font-size: var(--icon-size);
|
|
79
|
-
line-height: 1;
|
|
87
|
+
font: var(--icon-size) / 1 var(--md-icon-font);
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
&::after {
|
|
@@ -92,14 +100,6 @@
|
|
|
92
100
|
transition: var(--ripple-transition);
|
|
93
101
|
animation: var(--ripple-animation), var(--focus-ring-animation);
|
|
94
102
|
}
|
|
95
|
-
|
|
96
|
-
&:is(:checked, .checked)::before {
|
|
97
|
-
content: 'check';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&:is(:indeterminate, .indeterminate)::before {
|
|
101
|
-
content: 'remove';
|
|
102
|
-
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { createValidator, getValidityAnchor } from '@material/web/labs/behaviors/constraint-validation.js';
|
|
7
|
-
import { getFormState, getFormValue } from '@material/web/labs/behaviors/form-associated.js';
|
|
8
|
-
import { CheckboxValidator } from '@material/web/labs/behaviors/validators/checkbox-validator.js';
|
|
9
6
|
import { CSSResultOrNative, LitElement } from 'lit';
|
|
7
|
+
import { createValidator, getValidityAnchor } from '../../../behaviors/constraint-validation.js';
|
|
8
|
+
import { getFormState, getFormValue } from '../../../behaviors/form-associated.js';
|
|
9
|
+
import { CheckboxValidator } from '../../../behaviors/validators/checkbox-validator.js';
|
|
10
10
|
declare global {
|
|
11
11
|
interface HTMLElementTagNameMap {
|
|
12
12
|
/** A Material Design checkbox component. */
|
|
13
13
|
'md-checkbox': Checkbox;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
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("
|
|
16
|
+
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/constraint-validation.js").ConstraintValidation>>;
|
|
17
17
|
/**
|
|
18
18
|
* A Material Design checkbox component.
|
|
19
19
|
*/
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
|
-
import { mixinDelegatesAria } from '@material/web/internal/aria/delegate.js';
|
|
8
|
-
import { redispatchEvent } from '@material/web/internal/events/redispatch-event.js';
|
|
9
|
-
import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '@material/web/labs/behaviors/constraint-validation.js';
|
|
10
|
-
import { mixinElementInternals } from '@material/web/labs/behaviors/element-internals.js';
|
|
11
|
-
import { getFormState, getFormValue, mixinFormAssociated, } from '@material/web/labs/behaviors/form-associated.js';
|
|
12
|
-
import { CheckboxValidator } from '@material/web/labs/behaviors/validators/checkbox-validator.js';
|
|
13
7
|
import { css, html, LitElement, nothing } from 'lit';
|
|
14
8
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
|
|
9
|
+
import { mixinDelegatesAria } from '../../../../internal/aria/delegate.js';
|
|
10
|
+
import { redispatchEvent } from '../../../../internal/events/redispatch-event.js';
|
|
11
|
+
import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '../../../behaviors/constraint-validation.js';
|
|
12
|
+
import { mixinElementInternals } from '../../../behaviors/element-internals.js';
|
|
13
|
+
import { getFormState, getFormValue, mixinFormAssociated, } from '../../../behaviors/form-associated.js';
|
|
14
|
+
import { CheckboxValidator } from '../../../behaviors/validators/checkbox-validator.js';
|
|
15
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
16
|
+
// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
17
|
+
import rippleStyles from '../ripple/ripple.css' with { type: 'css' }; // github-only
|
|
18
|
+
// import rippleStyles from '../ripple/ripple.cssresult.js'; // google3-only
|
|
19
19
|
import checkboxStyles from './checkbox.css' with { type: 'css' }; // github-only
|
|
20
20
|
// import checkboxStyles from './checkbox.cssresult.js'; // google3-only
|
|
21
21
|
import { checkbox } from './checkbox.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-checkbox.js","sourceRoot":"","sources":["md-checkbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;
|
|
1
|
+
{"version":3,"file":"md-checkbox.js","sourceRoot":"","sources":["md-checkbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAC,eAAe,EAAC,MAAM,iDAAiD,CAAC;AAChF,OAAO,EACL,eAAe,EACf,iBAAiB,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B;AAhEtC,QAAQ;IADpB,aAAa,CAAC,aAAa,CAAC;GAChB,QAAQ,CAkJpB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property, query} from 'lit/decorators.js';\nimport {ARIAMixinStrict} from '../../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../../internal/aria/delegate.js';\nimport {redispatchEvent} from '../../../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../../behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../../behaviors/element-internals.js';\nimport {\n getFormState,\n getFormValue,\n mixinFormAssociated,\n} from '../../../behaviors/form-associated.js';\nimport {CheckboxValidator} from '../../../behaviors/validators/checkbox-validator.js';\n\nimport focusRingStyles from '../focus/focus-ring.css' with {type: 'css'}; // github-only\n// import focusRingStyles from '../focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '../ripple/ripple.css' with {type: 'css'}; // github-only\n// import rippleStyles from '../ripple/ripple.cssresult.js'; // google3-only\nimport checkboxStyles from './checkbox.css' with {type: 'css'}; // github-only\n// import checkboxStyles from './checkbox.cssresult.js'; // google3-only\n\nimport {checkbox} from './checkbox.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design checkbox component. */\n 'md-checkbox': Checkbox;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinDelegatesAria(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n);\n\n/**\n * A Material Design checkbox component.\n */\n@customElement('md-checkbox')\nexport class Checkbox extends baseClass {\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n static override styles: CSSResultOrNative[] = [\n focusRingStyles,\n rippleStyles,\n checkboxStyles,\n css`\n :host {\n display: inline-flex;\n }\n .checkbox {\n flex: 1;\n }\n `,\n ];\n\n /**\n * Whether or not the checkbox is invalid.\n */\n @property({type: Boolean}) error = false;\n\n /**\n * Whether or not the checkbox is selected.\n */\n @property({type: Boolean}) checked = false;\n\n /**\n * The default checked state of the checkbox.\n */\n get defaultChecked(): boolean {\n return this.hasAttribute('checked');\n }\n set defaultChecked(value: boolean) {\n this.toggleAttribute('checked', value || false);\n }\n\n /**\n * Whether or not the checkbox is indeterminate.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes\n */\n @property({type: Boolean}) indeterminate = false;\n\n /**\n * When true, require the checkbox to be selected when participating in\n * form submission.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#validation\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The value of the checkbox that is submitted with a form when selected.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value\n */\n @property() value = 'on';\n\n @query('input', true)\n private readonly input!: HTMLInputElement | null;\n /**\n * Mimics the behavior of <input> dirty checkedness, where the `checked`\n * attribute only updates the checked state if the checkbox has not been\n * interacted with.\n *\n * @see https://html.spec.whatwg.org/multipage/input.html#concept-input-checked-dirty-flag\n */\n private dirtyCheckedness = false;\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel, ariaInvalid} = this as ARIAMixinStrict;\n return html`\n <input\n part=\"checkbox\"\n class=\"${checkbox({invalid: this.error})}\"\n type=\"checkbox\"\n aria-checked=${this.indeterminate ? 'mixed' : nothing}\n aria-label=${ariaLabel || nothing}\n aria-invalid=${ariaInvalid || this.error || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n .indeterminate=${this.indeterminate}\n .checked=${this.checked}\n @input=${this.handleInput}\n @change=${this.handleChange} />\n `;\n }\n\n private handleInput(event: Event) {\n this.dirtyCheckedness = true;\n const target = event.target as HTMLInputElement;\n this.checked = target.checked;\n this.indeterminate = target.indeterminate;\n // <input> 'input' event bubbles and is composed, don't re-dispatch it.\n }\n\n private handleChange(event: Event) {\n this.dirtyCheckedness = true;\n // <input> 'change' event is not composed, re-dispatch it.\n redispatchEvent(this, event);\n }\n\n override attributeChangedCallback(\n name: string,\n oldValue: string | null,\n newValue: string | null,\n ) {\n if (name === 'checked' && this.dirtyCheckedness) {\n // The 'checked' attribute does not update checkboxes that have been\n // interacted with.\n return;\n }\n\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n override [getFormValue]() {\n return this.checked ? this.value : null;\n }\n\n override [getFormState]() {\n return String(this.checked);\n }\n\n override formResetCallback() {\n this.dirtyCheckedness = false;\n this.checked = this.defaultChecked;\n }\n\n override formStateRestoreCallback(state: string) {\n this.checked = state === 'true';\n }\n\n override [createValidator]() {\n return new CheckboxValidator(() => this);\n }\n\n override [getValidityAnchor]() {\n return this.input;\n }\n}\n"]}
|
|
@@ -41,4 +41,4 @@ export declare function dividerClasses({ vertical, }?: DividerClassesState): Cla
|
|
|
41
41
|
* `;
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare const divider: (state?: DividerClassesState & import("
|
|
44
|
+
export declare const divider: (state?: DividerClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { createClassMapDirective } from '
|
|
6
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
7
7
|
/** Divider classes. */
|
|
8
8
|
export const DIVIDER_CLASSES = {
|
|
9
9
|
divider: 'divider',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sourceRoot":"","sources":["divider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"divider.js","sourceRoot":"","sources":["divider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAEhE,uBAAuB;AACvB,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,SAAS;IAClB,eAAe,EAAE,kBAAkB;CAC3B,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,GAAG,KAAK,MACO,EAAE;IACzB,OAAO;QACL,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI;QAC/B,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,QAAQ;KAC5C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,uBAAuB,CAAC;IAC7C,UAAU,EAAE,cAAc;CAC3B,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/** Divider classes. */\nexport const DIVIDER_CLASSES = {\n divider: 'divider',\n dividerVertical: 'divider-vertical',\n} as const;\n\n/** The state provided to the `dividerClasses()` function. */\nexport interface DividerClassesState {\n /** Whether the divider is vertical. */\n vertical?: boolean;\n}\n\n/**\n * Returns the divider classes to apply to an element based on the given state.\n *\n * @param state The state of the divider.\n * @return An object of class names and truthy values if they apply.\n */\nexport function dividerClasses({\n vertical = false,\n}: DividerClassesState = {}): ClassInfo {\n return {\n [DIVIDER_CLASSES.divider]: true,\n [DIVIDER_CLASSES.dividerVertical]: vertical,\n };\n}\n\n/**\n * A Lit directive that adds divider styling to its element.\n *\n * @example\n * ```ts\n * html`\n * <div class=\"flex flex-col\">\n * <div>Vertical</div>\n * <hr class=\"${divider()}\">\n * <div>Items</div>\n * </div>\n *\n * <div class=\"flex flex-row\">\n * <div>Horizontal</div>\n * <hr class=\"${divider({vertical: true})}\">\n * <div>Items</div>\n * </div>\n * `;\n * ```\n */\nexport const divider = createClassMapDirective({\n getClasses: dividerClasses,\n});\n"]}
|
|
@@ -81,4 +81,4 @@ export declare function setupFab(fab: HTMLElement, opts?: {
|
|
|
81
81
|
* `;
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
|
-
export declare const fab: (state?: FabClassesState & import("
|
|
84
|
+
export declare const fab: (state?: FabClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { focusRingClasses } from '
|
|
7
|
-
import { rippleClasses, setupRipple
|
|
8
|
-
import { createClassMapDirective } from '
|
|
9
|
-
import { PSEUDO_CLASSES } from '
|
|
6
|
+
import { focusRingClasses } from '../focus/focus-ring.js';
|
|
7
|
+
import { rippleClasses, setupRipple } from '../ripple/ripple.js';
|
|
8
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
9
|
+
import { PSEUDO_CLASSES } from '../shared/pseudo-classes.js';
|
|
10
10
|
/** Fab color configurations. */
|
|
11
11
|
export const FAB_COLORS = {
|
|
12
12
|
primary: 'primary',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fab.js","sourceRoot":"","sources":["fab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"fab.js","sourceRoot":"","sources":["fab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAc3D,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OA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AC,WAAW,CAAC,WAAW,CAAC,EAAE,KAAK,KAAK,UAAU,CAAC,QAAQ;QACxD,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE,KAAK,KAAK,UAAU,CAAC,iBAAiB;QAC1E,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,SAAS,CAAC,EAAE;QAC1C,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,SAAS,CAAC,EAAE;QAC1C,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK;QAC1B,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAgB,EAChB,IAA6B;IAE7B,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,uBAAuB,CAAC;IACzC,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,QAAQ;CACvB,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 {focusRingClasses} from '../focus/focus-ring.js';\nimport {rippleClasses, setupRipple} from '../ripple/ripple.js';\nimport {createClassMapDirective} from '../shared/directives.js';\nimport {PSEUDO_CLASSES} from '../shared/pseudo-classes.js';\n\n/** Fab color configuration types. */\nexport type FabColor =\n | 'primary'\n | 'primary-container'\n | 'secondary'\n | 'secondary-container'\n | 'tertiary'\n | 'tertiary-container';\n\n/** Fab size configuration types. */\nexport type FabSize = 'default' | 'md' | 'lg';\n\n/** Fab color configurations. */\nexport const FAB_COLORS = {\n primary: 'primary',\n primaryContainer: 'primary-container',\n secondary: 'secondary',\n secondaryContainer: 'secondary-container',\n tertiary: 'tertiary',\n tertiaryContainer: 'tertiary-container',\n} as const;\n\n/** Fab size configurations. */\nexport const FAB_SIZES = {\n default: 'default',\n md: 'md',\n lg: 'lg',\n} as const;\n\n/** Fab classes. */\nexport const FAB_CLASSES = {\n fab: 'fab',\n fabPrimary: 'fab-primary',\n fabPrimaryContainer: 'fab-primary-container',\n fabSecondary: 'fab-secondary',\n fabSecondaryContainer: 'fab-secondary-container',\n fabTertiary: 'fab-tertiary',\n fabTertiaryContainer: 'fab-tertiary-container',\n fabMd: 'fab-md',\n fabLg: 'fab-lg',\n hover: PSEUDO_CLASSES.hover,\n active: PSEUDO_CLASSES.active,\n} as const;\n\n/** The state provided to the `fabClasses()` function. */\nexport interface FabClassesState {\n /** The color of the fab. */\n color?: FabColor;\n /** The size of the fab. */\n size?: FabSize;\n /** Emulates `:hover`. */\n hover?: boolean;\n /** Emulates `:active`. */\n active?: boolean;\n}\n\n/**\n * Returns the fab classes to apply to an element based on the given state.\n *\n * @param state The state of the fab.\n * @return An object of class names and truthy values if they apply.\n */\nexport function fabClasses({\n color,\n size,\n hover = false,\n active = false,\n}: FabClassesState = {}): ClassInfo {\n return {\n ...rippleClasses(),\n ...focusRingClasses(),\n [FAB_CLASSES.fab]: true,\n [FAB_CLASSES.fabPrimary]: color === FAB_COLORS.primary,\n [FAB_CLASSES.fabPrimaryContainer]:\n color === FAB_COLORS.primaryContainer || !color,\n [FAB_CLASSES.fabSecondary]: color === FAB_COLORS.secondary,\n [FAB_CLASSES.fabSecondaryContainer]:\n color === FAB_COLORS.secondaryContainer,\n [FAB_CLASSES.fabTertiary]: color === FAB_COLORS.tertiary,\n [FAB_CLASSES.fabTertiaryContainer]: color === FAB_COLORS.tertiaryContainer,\n [FAB_CLASSES.fabMd]: size === FAB_SIZES.md,\n [FAB_CLASSES.fabLg]: size === FAB_SIZES.lg,\n [FAB_CLASSES.hover]: hover,\n [FAB_CLASSES.active]: active,\n };\n}\n\n/**\n * Sets up fab functionality for the given element.\n *\n * @param fab The element on which to set up fab functionality.\n * @param opts Setup options, supports a cleanup `signal`.\n */\nexport function setupFab(\n fab: HTMLElement,\n opts?: {signal?: AbortSignal},\n): void {\n setupRipple(fab, opts);\n}\n\n/**\n * A Lit directive that adds fab styling and functionality to its element.\n *\n * @example\n * ```ts\n * html`\n * <button class=\"${fab()}\">\n * <md-icon>add</md-icon>\n * </button>\n *\n * <button class=\"${fab()}\">\n * <md-icon>add</md-icon>\n * Extended\n * </button>\n * `;\n * ```\n */\nexport const fab = createClassMapDirective({\n getClasses: fabClasses,\n setupElement: setupFab,\n});\n"]}
|