@material/web 2.4.2-nightly.2fe7e22.0 → 2.4.2-nightly.5088d91.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.
Files changed (210) hide show
  1. package/button/internal/_touch-target.scss +1 -1
  2. package/button/internal/button.d.ts +0 -4
  3. package/button/internal/button.js.map +1 -1
  4. package/button/internal/shared-styles.css +1 -1
  5. package/button/internal/shared-styles.css.map +1 -1
  6. package/button/internal/shared-styles.cssresult.js +1 -1
  7. package/button/internal/shared-styles.cssresult.js.map +1 -1
  8. package/checkbox/internal/checkbox.d.ts +2 -2
  9. package/checkbox/internal/checkbox.js.map +1 -1
  10. package/chips/internal/chip.d.ts +2 -0
  11. package/custom-elements.json +41872 -0
  12. package/icon/internal/icon.d.ts +1 -1
  13. package/icon/internal/icon.js +1 -1
  14. package/icon/internal/icon.js.map +1 -1
  15. package/iconbutton/internal/icon-button.d.ts +0 -4
  16. package/iconbutton/internal/icon-button.js.map +1 -1
  17. package/internal/aria/aria.d.ts +1 -1
  18. package/internal/events/dispatch-hooks.js +31 -35
  19. package/internal/events/dispatch-hooks.js.map +1 -1
  20. package/labs/behaviors/form-associated.d.ts +0 -22
  21. package/labs/behaviors/form-associated.js +0 -11
  22. package/labs/behaviors/form-associated.js.map +1 -1
  23. package/labs/gb/components/button/_button-tokens.scss +30 -30
  24. package/labs/gb/components/button/button.css +1 -1
  25. package/labs/gb/components/button/button.css.map +1 -1
  26. package/labs/gb/components/button/button.cssresult.js +1 -1
  27. package/labs/gb/components/button/button.cssresult.js.map +1 -1
  28. package/labs/gb/components/button/button.d.ts +1 -16
  29. package/labs/gb/components/button/button.js +10 -33
  30. package/labs/gb/components/button/button.js.map +1 -1
  31. package/labs/gb/components/button/button.scss +25 -25
  32. package/labs/gb/components/button/md-button.d.ts +10 -2
  33. package/labs/gb/components/button/md-button.js +92 -11
  34. package/labs/gb/components/button/md-button.js.map +1 -1
  35. package/labs/gb/components/card/card.d.ts +1 -11
  36. package/labs/gb/components/card/card.js +6 -13
  37. package/labs/gb/components/card/card.js.map +1 -1
  38. package/labs/gb/components/card/md-card.d.ts +9 -1
  39. package/labs/gb/components/card/md-card.js +85 -8
  40. package/labs/gb/components/card/md-card.js.map +1 -1
  41. package/labs/gb/components/checkbox/checkbox.css +1 -1
  42. package/labs/gb/components/checkbox/checkbox.css.map +1 -1
  43. package/labs/gb/components/checkbox/checkbox.cssresult.js +1 -1
  44. package/labs/gb/components/checkbox/checkbox.cssresult.js.map +1 -1
  45. package/labs/gb/components/checkbox/checkbox.d.ts +1 -16
  46. package/labs/gb/components/checkbox/checkbox.js +8 -31
  47. package/labs/gb/components/checkbox/checkbox.js.map +1 -1
  48. package/labs/gb/components/checkbox/checkbox.scss +13 -13
  49. package/labs/gb/components/checkbox/md-checkbox.d.ts +4 -4
  50. package/labs/gb/components/checkbox/md-checkbox.js +10 -10
  51. package/labs/gb/components/checkbox/md-checkbox.js.map +1 -1
  52. package/labs/gb/components/divider/divider.d.ts +1 -11
  53. package/labs/gb/components/divider/divider.js +4 -11
  54. package/labs/gb/components/divider/divider.js.map +1 -1
  55. package/labs/gb/components/fab/fab.d.ts +1 -16
  56. package/labs/gb/components/fab/fab.js +8 -31
  57. package/labs/gb/components/fab/fab.js.map +1 -1
  58. package/labs/gb/components/fab/md-fab.js +4 -4
  59. package/labs/gb/components/fab/md-fab.js.map +1 -1
  60. package/labs/gb/components/focus/focus-ring.js +1 -1
  61. package/labs/gb/components/focus/focus-ring.js.map +1 -1
  62. package/labs/gb/components/iconbutton/_icon-button-tokens.scss +202 -0
  63. package/labs/gb/components/iconbutton/icon-button.css +4 -0
  64. package/labs/gb/components/iconbutton/icon-button.css.map +1 -0
  65. package/labs/gb/components/iconbutton/icon-button.cssresult.d.ts +3 -0
  66. package/labs/gb/components/iconbutton/icon-button.cssresult.js +14 -0
  67. package/labs/gb/components/iconbutton/icon-button.cssresult.js.map +1 -0
  68. package/labs/gb/components/iconbutton/icon-button.d.ts +97 -0
  69. package/labs/gb/components/iconbutton/icon-button.js +122 -0
  70. package/labs/gb/components/iconbutton/icon-button.js.map +1 -0
  71. package/labs/gb/components/iconbutton/icon-button.scss +153 -0
  72. package/labs/gb/components/iconbutton/md-icon-button.d.ts +73 -0
  73. package/labs/gb/components/iconbutton/md-icon-button.js +176 -0
  74. package/labs/gb/components/iconbutton/md-icon-button.js.map +1 -0
  75. package/labs/gb/components/list/_list-tokens.scss +102 -0
  76. package/labs/gb/components/list/list.css +4 -0
  77. package/labs/gb/components/list/list.css.map +1 -0
  78. package/labs/gb/components/list/list.cssresult.d.ts +3 -0
  79. package/labs/gb/components/list/list.cssresult.js +14 -0
  80. package/labs/gb/components/list/list.cssresult.js.map +1 -0
  81. package/labs/gb/components/list/list.d.ts +103 -0
  82. package/labs/gb/components/list/list.js +109 -0
  83. package/labs/gb/components/list/list.js.map +1 -0
  84. package/labs/gb/components/list/list.scss +212 -0
  85. package/labs/gb/components/list/md-list-item.d.ts +44 -0
  86. package/labs/gb/components/list/md-list-item.js +122 -0
  87. package/labs/gb/components/list/md-list-item.js.map +1 -0
  88. package/labs/gb/components/list/md-list.d.ts +26 -0
  89. package/labs/gb/components/list/md-list.js +51 -0
  90. package/labs/gb/components/list/md-list.js.map +1 -0
  91. package/labs/gb/components/menu/_menu-tokens.scss +128 -0
  92. package/labs/gb/components/menu/md-menu-group.d.ts +26 -0
  93. package/labs/gb/components/menu/md-menu-group.js +65 -0
  94. package/labs/gb/components/menu/md-menu-group.js.map +1 -0
  95. package/labs/gb/components/menu/md-menu-item.d.ts +30 -0
  96. package/labs/gb/components/menu/md-menu-item.js +165 -0
  97. package/labs/gb/components/menu/md-menu-item.js.map +1 -0
  98. package/labs/gb/components/menu/md-menu.d.ts +28 -0
  99. package/labs/gb/components/menu/md-menu.js +141 -0
  100. package/labs/gb/components/menu/md-menu.js.map +1 -0
  101. package/labs/gb/components/menu/menu.css +4 -0
  102. package/labs/gb/components/menu/menu.css.map +1 -0
  103. package/labs/gb/components/menu/menu.cssresult.d.ts +3 -0
  104. package/labs/gb/components/menu/menu.cssresult.js +14 -0
  105. package/labs/gb/components/menu/menu.cssresult.js.map +1 -0
  106. package/labs/gb/components/menu/menu.d.ts +117 -0
  107. package/labs/gb/components/menu/menu.js +107 -0
  108. package/labs/gb/components/menu/menu.js.map +1 -0
  109. package/labs/gb/components/menu/menu.scss +171 -0
  110. package/labs/gb/components/radio/md-radio.d.ts +4 -4
  111. package/labs/gb/components/radio/md-radio.js +11 -11
  112. package/labs/gb/components/radio/md-radio.js.map +1 -1
  113. package/labs/gb/components/radio/radio.css +1 -1
  114. package/labs/gb/components/radio/radio.css.map +1 -1
  115. package/labs/gb/components/radio/radio.cssresult.js +1 -1
  116. package/labs/gb/components/radio/radio.cssresult.js.map +1 -1
  117. package/labs/gb/components/radio/radio.d.ts +1 -14
  118. package/labs/gb/components/radio/radio.js +8 -23
  119. package/labs/gb/components/radio/radio.js.map +1 -1
  120. package/labs/gb/components/radio/radio.scss +4 -5
  121. package/labs/gb/components/ripple/ripple.d.ts +1 -10
  122. package/labs/gb/components/ripple/ripple.js +28 -32
  123. package/labs/gb/components/ripple/ripple.js.map +1 -1
  124. package/labs/gb/components/shared/directives.d.ts +93 -0
  125. package/labs/gb/components/shared/directives.js +111 -0
  126. package/labs/gb/components/shared/directives.js.map +1 -0
  127. package/labs/gb/components/shared/has-slotted.d.ts +10 -0
  128. package/labs/gb/components/shared/has-slotted.js +19 -0
  129. package/labs/gb/components/shared/has-slotted.js.map +1 -0
  130. package/labs/gb/components/shared/pseudo-classes.d.ts +7 -0
  131. package/labs/gb/components/shared/pseudo-classes.js +9 -0
  132. package/labs/gb/components/shared/pseudo-classes.js.map +1 -1
  133. package/labs/gb/components/splitbutton/_split-button-tokens.scss +135 -0
  134. package/labs/gb/components/splitbutton/md-split-button.d.ts +26 -0
  135. package/labs/gb/components/splitbutton/md-split-button.js +119 -0
  136. package/labs/gb/components/splitbutton/md-split-button.js.map +1 -0
  137. package/labs/gb/components/splitbutton/split-button.css +4 -0
  138. package/labs/gb/components/splitbutton/split-button.css.map +1 -0
  139. package/labs/gb/components/splitbutton/split-button.cssresult.d.ts +3 -0
  140. package/labs/gb/components/splitbutton/split-button.cssresult.js +14 -0
  141. package/labs/gb/components/splitbutton/split-button.cssresult.js.map +1 -0
  142. package/labs/gb/components/splitbutton/split-button.d.ts +47 -0
  143. package/labs/gb/components/splitbutton/split-button.js +46 -0
  144. package/labs/gb/components/splitbutton/split-button.js.map +1 -0
  145. package/labs/gb/components/splitbutton/split-button.scss +164 -0
  146. package/labs/gb/components/switch/_switch-tokens.scss +56 -0
  147. package/labs/gb/components/switch/md-switch.d.ts +66 -0
  148. package/labs/gb/components/switch/md-switch.js +162 -0
  149. package/labs/gb/components/switch/md-switch.js.map +1 -0
  150. package/labs/gb/components/switch/switch.css +4 -0
  151. package/labs/gb/components/switch/switch.css.map +1 -0
  152. package/labs/gb/components/switch/switch.cssresult.d.ts +3 -0
  153. package/labs/gb/components/switch/switch.cssresult.js +14 -0
  154. package/labs/gb/components/switch/switch.cssresult.js.map +1 -0
  155. package/labs/gb/components/switch/switch.d.ts +54 -0
  156. package/labs/gb/components/switch/switch.js +85 -0
  157. package/labs/gb/components/switch/switch.js.map +1 -0
  158. package/labs/gb/components/switch/switch.scss +109 -0
  159. package/labs/gb/styles/icon/md-icon.css +1 -1
  160. package/labs/gb/styles/icon/md-icon.css.map +1 -1
  161. package/labs/gb/styles/icon/md-icon.cssresult.js +1 -1
  162. package/labs/gb/styles/icon/md-icon.cssresult.js.map +1 -1
  163. package/labs/gb/styles/icon/md-icon.d.ts +20 -0
  164. package/labs/gb/styles/icon/md-icon.js +24 -0
  165. package/labs/gb/styles/icon/md-icon.js.map +1 -0
  166. package/labs/gb/styles/icon/md-icon.scss +2 -1
  167. package/labs/gb/styles/m3.css +5 -2
  168. package/labs/gb/styles/m3.css.map +1 -1
  169. package/labs/gb/styles/m3.cssresult.js +5 -2
  170. package/labs/gb/styles/m3.cssresult.js.map +1 -1
  171. package/labs/gb/styles/m3.scss +1 -0
  172. package/labs/gb/styles/space/md-space-tokens.css +4 -0
  173. package/labs/gb/styles/space/md-space-tokens.css.map +1 -0
  174. package/labs/gb/styles/space/md-space-tokens.cssresult.d.ts +3 -0
  175. package/labs/gb/styles/space/md-space-tokens.cssresult.js +14 -0
  176. package/labs/gb/styles/space/md-space-tokens.cssresult.js.map +1 -0
  177. package/labs/gb/styles/space/md-space-tokens.scss +28 -0
  178. package/labs/gb/styles/tailwind.css +4 -0
  179. package/labs/gb/styles/tailwind.css.map +1 -0
  180. package/labs/gb/styles/tailwind.cssresult.d.ts +3 -0
  181. package/labs/gb/styles/tailwind.cssresult.js +14 -0
  182. package/labs/gb/styles/tailwind.cssresult.js.map +1 -0
  183. package/labs/gb/styles/tailwind.scss +349 -0
  184. package/labs/gb/styles/typography/internal/_typography-tokens.scss +85 -16
  185. package/labs/gb/styles/typography/md-typography-tokens.css +1 -1
  186. package/labs/gb/styles/typography/md-typography-tokens.css.map +1 -1
  187. package/labs/gb/styles/typography/md-typography-tokens.cssresult.js +1 -1
  188. package/labs/gb/styles/typography/md-typography-tokens.cssresult.js.map +1 -1
  189. package/list/internal/listitem/list-item.d.ts +6 -1
  190. package/list/internal/listitem/list-item.js +4 -1
  191. package/list/internal/listitem/list-item.js.map +1 -1
  192. package/menu/internal/menuitem/menu-item.d.ts +2 -0
  193. package/menu/internal/submenu/sub-menu.d.ts +5 -1
  194. package/menu/internal/submenu/sub-menu.js +5 -1
  195. package/menu/internal/submenu/sub-menu.js.map +1 -1
  196. package/package.json +26 -4
  197. package/radio/internal/radio.d.ts +0 -2
  198. package/radio/internal/radio.js.map +1 -1
  199. package/select/internal/select.d.ts +2 -2
  200. package/select/internal/select.js.map +1 -1
  201. package/select/internal/selectoption/select-option.d.ts +2 -0
  202. package/slider/internal/slider.d.ts +0 -2
  203. package/slider/internal/slider.js.map +1 -1
  204. package/switch/internal/_switch.scss +1 -0
  205. package/switch/internal/switch-styles.css +1 -1
  206. package/switch/internal/switch-styles.css.map +1 -1
  207. package/switch/internal/switch-styles.cssresult.js +1 -1
  208. package/switch/internal/switch-styles.cssresult.js.map +1 -1
  209. package/switch/internal/switch.d.ts +0 -2
  210. package/switch/internal/switch.js.map +1 -1
@@ -4,14 +4,15 @@
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 { ripple } from '@material/web/labs/gb/components/ripple/ripple.js';
9
- import { css, html, LitElement, nothing } from 'lit';
10
- import { customElement, property } from 'lit/decorators.js';
11
- import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with { type: 'css' }; // github-only
12
- // import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only
13
- import rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with { type: 'css' }; // github-only
14
- // import rippleStyles from '@material/web/labs/gb/components/ripple/ripple.cssresult.js'; // google3-only
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;;AAGH,OAAO,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,mDAAmD,CAAC;AACzE,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,eAAe,MAAM,uDAAuD,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtH,gHAAgH;AAChH,OAAO,YAAY,M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,EAAC,CAAC;sCAAkB;AAGjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAqB;AA5BpC,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CAkDhB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ARIAMixinStrict} from '@material/web/internal/aria/aria.js';\nimport {mixinDelegatesAria} from '@material/web/internal/aria/delegate.js';\nimport {ripple} from '@material/web/labs/gb/components/ripple/ripple.js';\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\n\nimport focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with {type: 'css'}; // github-only\n// import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with {type: 'css'}; // github-only\n// import rippleStyles from '@material/web/labs/gb/components/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 }\n .card {\n flex: 1;\n }\n `,\n ];\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 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 })}\">\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 </div>`;\n }\n}\n"]}
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,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;IACf,YAAY;IACZ,UAAU;IACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;CACF,AAnCqB,CAmCpB;AAEe;IAAhB,KAAK,EAAE;yCAA6B;AAKzB;IAAX,QAAQ,EAAE;mCAA+B;AAGf;IAA1B,QAAQ,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{content:"";box-sizing:border-box;width:var(--container-size);height: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-family:var(--md-icon-font);font-size:var(--icon-size);line-height:1}.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)}.checkbox:is(:checked,.checked)::before{content:"check"}.checkbox:is(:indeterminate,.indeterminate)::before{content:"remove"}}/*# sourceMappingURL=checkbox.css.map */
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,aAEA,kBACE,WACA,sBACA,4BACA,6BACA,kCACA,qCACA,uDACA,wBACA,gCACA,2BACA,cAGF,iBACE,WACA,kBACA,eACA,+BACA,+BACA,8BACA,uCACA,kCACA,wCACA,oCACA,8DAGF,wCACE,gBAGF,oDACE","file":"checkbox.css"}
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{content:"";box-sizing:border-box;width:var(--container-size);height: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-family:var(--md-icon-font);font-size:var(--icon-size);line-height:1}.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)}.checkbox:is(:checked,.checked)::before{content:"check"}.checkbox:is(:indeterminate,.indeterminate)::before{content:"remove"}}
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{content:\"\";box-sizing:border-box;width:var(--container-size);height: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-family:var(--md-icon-font);font-size:var(--icon-size);line-height:1}.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)}.checkbox:is(:checked,.checked)::before{content:\"check\"}.checkbox:is(:indeterminate,.indeterminate)::before{content:\"remove\"}}\n`;\nexport default styles.styleSheet!;\n"]}
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"]}
@@ -3,7 +3,6 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { AsyncDirective, AttributePart, DirectiveParameters } from 'lit/async-directive.js';
7
6
  import { type ClassInfo } from 'lit/directives/class-map.js';
8
7
  /** Checkbox classes. */
9
8
  export declare const CHECKBOX_CLASSES: {
@@ -49,19 +48,6 @@ export declare function checkboxClasses({ invalid, hover, focus, active, checked
49
48
  export declare function setupCheckbox(checkbox: HTMLElement, opts?: {
50
49
  signal?: AbortSignal;
51
50
  }): void;
52
- /** The state provided to the `checkbox()` directive. */
53
- export interface CheckboxDirectiveState extends CheckboxClassesState {
54
- /** Additional classes to apply to the element. */
55
- classes?: ClassInfo;
56
- }
57
- declare class CheckboxDirective extends AsyncDirective {
58
- private element?;
59
- private cleanup?;
60
- render(state?: CheckboxDirectiveState): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/class-map.js").ClassMapDirective>;
61
- update({ element }: AttributePart, [state]: DirectiveParameters<this>): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/class-map.js").ClassMapDirective>;
62
- protected disconnected(): void;
63
- protected reconnected(): void;
64
- }
65
51
  /**
66
52
  * A Lit directive that adds checkbox styling and functionality to its element.
67
53
  *
@@ -70,5 +56,4 @@ declare class CheckboxDirective extends AsyncDirective {
70
56
  * html`<input type="checkbox" class="${checkbox()}">`;
71
57
  * ```
72
58
  */
73
- export declare const checkbox: (state?: CheckboxDirectiveState) => import("lit-html/directive.js").DirectiveResult<typeof CheckboxDirective>;
74
- export {};
59
+ export declare const checkbox: (state?: CheckboxClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
@@ -3,11 +3,10 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { focusRingClasses } from '@material/web/labs/gb/components/focus/focus-ring.js';
7
- import { rippleClasses, setupRipple, } from '@material/web/labs/gb/components/ripple/ripple.js';
8
- import { PSEUDO_CLASSES } from '@material/web/labs/gb/components/shared/pseudo-classes.js';
9
- import { AsyncDirective, directive, } from 'lit/async-directive.js';
10
- import { classMap } from 'lit/directives/class-map.js';
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';
11
10
  /** Checkbox classes. */
12
11
  export const CHECKBOX_CLASSES = {
13
12
  checkbox: 'checkbox',
@@ -48,31 +47,6 @@ export function checkboxClasses({ invalid = false, hover = false, focus = false,
48
47
  export function setupCheckbox(checkbox, opts) {
49
48
  setupRipple(checkbox, opts);
50
49
  }
51
- class CheckboxDirective extends AsyncDirective {
52
- render(state = {}) {
53
- return classMap({
54
- ...(state.classes || {}),
55
- ...checkboxClasses(state),
56
- });
57
- }
58
- update({ element }, [state]) {
59
- if (this.isConnected && element !== this.element) {
60
- this.element = element;
61
- this.disconnected();
62
- this.reconnected();
63
- }
64
- return this.render(state);
65
- }
66
- disconnected() {
67
- this.cleanup?.abort();
68
- }
69
- reconnected() {
70
- if (this.element) {
71
- this.cleanup = new AbortController();
72
- setupCheckbox(this.element, { signal: this.cleanup.signal });
73
- }
74
- }
75
- }
76
50
  /**
77
51
  * A Lit directive that adds checkbox styling and functionality to its element.
78
52
  *
@@ -81,5 +55,8 @@ class CheckboxDirective extends AsyncDirective {
81
55
  * html`<input type="checkbox" class="${checkbox()}">`;
82
56
  * ```
83
57
  */
84
- export const checkbox = directive(CheckboxDirective);
58
+ export const checkbox = createClassMapDirective({
59
+ getClasses: checkboxClasses,
60
+ setupElement: setupCheckbox,
61
+ });
85
62
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["checkbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,sDAAsD,CAAC;AACtF,OAAO,EACL,aAAa,EACb,WAAW,GACZ,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,2DAA2D,CAAC;AACzF,OAAO,EACL,cAAc,EAEd,SAAS,GAEV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAiB,MAAM,6BAA6B,CAAC;AAErE,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,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AAK,CAA4B;QAElC,IAAI,IAAI,CAAC,WAAW,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACjD,IAAI,CAAC,OAAO,GAAG,OAAsB,CAAC;YACtC,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEkB,YAAY;QAC7B,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IAEkB,WAAW;QAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;YACrC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {focusRingClasses} from '@material/web/labs/gb/components/focus/focus-ring.js';\nimport {\n rippleClasses,\n setupRipple,\n} from '@material/web/labs/gb/components/ripple/ripple.js';\nimport {PSEUDO_CLASSES} from '@material/web/labs/gb/components/shared/pseudo-classes.js';\nimport {\n AsyncDirective,\n AttributePart,\n directive,\n DirectiveParameters,\n} from 'lit/async-directive.js';\nimport {classMap, type ClassInfo} from 'lit/directives/class-map.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/** The state provided to the `checkbox()` directive. */\nexport interface CheckboxDirectiveState extends CheckboxClassesState {\n /** Additional classes to apply to the element. */\n classes?: ClassInfo;\n}\n\nclass CheckboxDirective extends AsyncDirective {\n private element?: HTMLElement;\n private cleanup?: AbortController;\n\n render(state: CheckboxDirectiveState = {}) {\n return classMap({\n ...(state.classes || {}),\n ...checkboxClasses(state),\n });\n }\n\n override update(\n {element}: AttributePart,\n [state]: DirectiveParameters<this>,\n ) {\n if (this.isConnected && element !== this.element) {\n this.element = element as HTMLElement;\n this.disconnected();\n this.reconnected();\n }\n\n return this.render(state);\n }\n\n protected override disconnected() {\n this.cleanup?.abort();\n }\n\n protected override reconnected() {\n if (this.element) {\n this.cleanup = new AbortController();\n setupCheckbox(this.element, {signal: this.cleanup.signal});\n }\n }\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 = directive(CheckboxDirective);\n"]}
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-family: var(--md-icon-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("@material/web/labs/behaviors/element-internals.js").WithElementInternals) & typeof LitElement & import("@material/web/labs/behaviors/form-associated.js").FormAssociatedConstructor, import("@material/web/labs/behaviors/form-associated.js").FormAssociated>, import("@material/web/labs/behaviors/constraint-validation.js").ConstraintValidation>>;
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 focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with { type: 'css' }; // github-only
16
- // import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only
17
- import rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with { type: 'css' }; // github-only
18
- // import rippleStyles from '@material/web/labs/gb/components/ripple/ripple.cssresult.js'; // google3-only
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;;AAGH,OAAO,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAC,eAAe,EAAC,MAAM,mDAAmD,CAAC;AAClF,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAC,qBAAqB,EAAC,MAAM,mDAAmD,CAAC;AACxF,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+DAA+D,CAAC;AAChG,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,E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,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEQ,iBAAiB;QACxB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC;IACrC,CAAC;IAEQ,wBAAwB,CAAC,KAAa;QAC7C,IAAI,CAAC,OAAO,GAAG,KAAK,KAAK,MAAM,CAAC;IAClC,CAAC;IAEQ,CAAC,eAAe,CAAC;QACxB,OAAO,IAAI,iBAAiB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAEQ,CAAC,iBAAiB,CAAC;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;;AAhJD,kBAAkB;AACF,0BAAiB,GAAmB;IAClD,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAEc,eAAM,GAAwB;IAC5C,eAAe;IACf,YAAY;IACZ,cAAc;IACd,GAAG,CAAA;;;;;;;KAOF;CACF,AAZqB,CAYpB;AAKyB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAe;AAKd;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAiB;AAiBhB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;+CAAuB;AAQtB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;0CAAkB;AAOhC;IAAX,QAAQ,EAAE;uCAAc;AAGR;IADhB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;uCAC4B;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 {ARIAMixinStrict} from '@material/web/internal/aria/aria.js';\nimport {mixinDelegatesAria} from '@material/web/internal/aria/delegate.js';\nimport {redispatchEvent} from '@material/web/internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '@material/web/labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '@material/web/labs/behaviors/element-internals.js';\nimport {\n getFormState,\n getFormValue,\n mixinFormAssociated,\n} from '@material/web/labs/behaviors/form-associated.js';\nimport {CheckboxValidator} from '@material/web/labs/behaviors/validators/checkbox-validator.js';\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property, query} from 'lit/decorators.js';\n\nimport focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.css' with {type: 'css'}; // github-only\n// import focusRingStyles from '@material/web/labs/gb/components/focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '@material/web/labs/gb/components/ripple/ripple.css' with {type: 'css'}; // github-only\n// import rippleStyles from '@material/web/labs/gb/components/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"]}
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,EACjB,yBAAyB,GAC1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,iBAAiB,EAAC,MAAM,qDAAqD,CAAC;AAEtF,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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AK,KAAK,MAAM,CAAC;IAClC,CAAC;IAEQ,CAAC,eAAe,CAAC;QACxB,OAAO,IAAI,iBAAiB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAEQ,CAAC,iBAAiB,CAAC;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;;AAhJD,kBAAkB;AACF,0BAAiB,GAAmB;IAClD,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAEc,eAAM,GAAwB;IAC5C,eAAe;IACf,YAAY;IACZ,cAAc;IACd,GAAG,CAAA;;;;;;;KAOF;CACF,AAZqB,CAYpB;AAKyB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAe;AAKd;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAiB;AAiBhB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;+CAAuB;AAQtB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;0CAAkB;AAOhC;IAAX,QAAQ,EAAE;uCAAc;AAGR;IADhB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;uCAC4B;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"]}
@@ -3,7 +3,6 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Directive } from 'lit/directive.js';
7
6
  import { type ClassInfo } from 'lit/directives/class-map.js';
8
7
  /** Divider classes. */
9
8
  export declare const DIVIDER_CLASSES: {
@@ -22,14 +21,6 @@ export interface DividerClassesState {
22
21
  * @return An object of class names and truthy values if they apply.
23
22
  */
24
23
  export declare function dividerClasses({ vertical, }?: DividerClassesState): ClassInfo;
25
- /** The state provided to the `divider()` directive. */
26
- export interface DividerDirectiveState extends DividerClassesState {
27
- /** Additional classes to apply to the element. */
28
- classes?: ClassInfo;
29
- }
30
- declare class DividerDirective extends Directive {
31
- render(state?: DividerDirectiveState): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/class-map.js").ClassMapDirective>;
32
- }
33
24
  /**
34
25
  * A Lit directive that adds divider styling to its element.
35
26
  *
@@ -50,5 +41,4 @@ declare class DividerDirective extends Directive {
50
41
  * `;
51
42
  * ```
52
43
  */
53
- export declare const divider: (state?: DividerDirectiveState) => import("lit-html/directive.js").DirectiveResult<typeof DividerDirective>;
54
- export {};
44
+ export declare const divider: (state?: DividerClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
@@ -3,8 +3,7 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Directive, directive } from 'lit/directive.js';
7
- import { classMap } from 'lit/directives/class-map.js';
6
+ import { createClassMapDirective } from '../shared/directives.js';
8
7
  /** Divider classes. */
9
8
  export const DIVIDER_CLASSES = {
10
9
  divider: 'divider',
@@ -22,14 +21,6 @@ export function dividerClasses({ vertical = false, } = {}) {
22
21
  [DIVIDER_CLASSES.dividerVertical]: vertical,
23
22
  };
24
23
  }
25
- class DividerDirective extends Directive {
26
- render(state = {}) {
27
- return classMap({
28
- ...(state.classes || {}),
29
- ...dividerClasses(state),
30
- });
31
- }
32
- }
33
24
  /**
34
25
  * A Lit directive that adds divider styling to its element.
35
26
  *
@@ -50,5 +41,7 @@ class DividerDirective extends Directive {
50
41
  * `;
51
42
  * ```
52
43
  */
53
- export const divider = directive(DividerDirective);
44
+ export const divider = createClassMapDirective({
45
+ getClasses: dividerClasses,
46
+ });
54
47
  //# sourceMappingURL=divider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"divider.js","sourceRoot":"","sources":["divider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAiB,MAAM,6BAA6B,CAAC;AAErE,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;AAQD,MAAM,gBAAiB,SAAQ,SAAS;IACtC,MAAM,CAAC,QAA+B,EAAE;QACtC,OAAO,QAAQ,CAAC;YACd,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;YACxB,GAAG,cAAc,CAAC,KAAK,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Directive, directive} from 'lit/directive.js';\nimport {classMap, type ClassInfo} from 'lit/directives/class-map.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/** The state provided to the `divider()` directive. */\nexport interface DividerDirectiveState extends DividerClassesState {\n /** Additional classes to apply to the element. */\n classes?: ClassInfo;\n}\n\nclass DividerDirective extends Directive {\n render(state: DividerDirectiveState = {}) {\n return classMap({\n ...(state.classes || {}),\n ...dividerClasses(state),\n });\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 = directive(DividerDirective);\n"]}
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"]}