@material/web 2.5.1-nightly.56a486b.0 → 2.5.1-nightly.703aed2.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 (189) hide show
  1. package/custom-elements.json +29543 -23432
  2. package/labs/aria/buttons/keyboard_click_handler.d.ts +25 -0
  3. package/labs/aria/buttons/keyboard_click_handler.js +74 -0
  4. package/labs/aria/buttons/keyboard_click_handler.js.map +1 -0
  5. package/labs/aria/buttons/md-aria-toggle.d.ts +29 -0
  6. package/labs/aria/buttons/md-aria-toggle.js +67 -0
  7. package/labs/aria/buttons/md-aria-toggle.js.map +1 -0
  8. package/labs/aria/buttons/toggle.d.ts +40 -0
  9. package/labs/aria/buttons/toggle.js +100 -0
  10. package/labs/aria/buttons/toggle.js.map +1 -0
  11. package/labs/aria/menu/fieldset.d.ts +36 -0
  12. package/labs/aria/menu/fieldset.js +103 -0
  13. package/labs/aria/menu/fieldset.js.map +1 -0
  14. package/labs/aria/menu/internal.d.ts +15 -0
  15. package/labs/aria/menu/internal.js +16 -0
  16. package/labs/aria/menu/internal.js.map +1 -0
  17. package/labs/aria/menu/md-aria-fieldset.d.ts +11 -0
  18. package/labs/aria/menu/md-aria-fieldset.js +8 -0
  19. package/labs/aria/menu/md-aria-fieldset.js.map +1 -0
  20. package/labs/aria/menu/md-aria-menubar.d.ts +11 -0
  21. package/labs/aria/menu/md-aria-menubar.js +8 -0
  22. package/labs/aria/menu/md-aria-menubar.js.map +1 -0
  23. package/labs/aria/menu/menubar.d.ts +15 -0
  24. package/labs/aria/menu/menubar.js +45 -0
  25. package/labs/aria/menu/menubar.js.map +1 -0
  26. package/labs/aria/menu/menuitem.d.ts +37 -4
  27. package/labs/aria/menu/menuitem.js +172 -21
  28. package/labs/aria/menu/menuitem.js.map +1 -1
  29. package/labs/aria/menu/menulist.d.ts +2 -6
  30. package/labs/aria/menu/menulist.js +12 -46
  31. package/labs/aria/menu/menulist.js.map +1 -1
  32. package/labs/aria/menu/shared-slotted-content.d.ts +10 -0
  33. package/labs/aria/menu/shared-slotted-content.js +51 -0
  34. package/labs/aria/menu/shared-slotted-content.js.map +1 -0
  35. package/labs/aria/pseudo-classes.d.ts +19 -0
  36. package/labs/aria/pseudo-classes.js +22 -0
  37. package/labs/aria/pseudo-classes.js.map +1 -0
  38. package/labs/aria/tabs/tab.js +5 -0
  39. package/labs/aria/tabs/tab.js.map +1 -1
  40. package/labs/gb/components/appbar/app-bar.css +1 -1
  41. package/labs/gb/components/appbar/app-bar.css.map +1 -1
  42. package/labs/gb/components/appbar/app-bar.cssresult.js +1 -1
  43. package/labs/gb/components/appbar/app-bar.cssresult.js.map +1 -1
  44. package/labs/gb/components/appbar/app-bar.scss +1 -0
  45. package/labs/gb/components/badge/badge.css +1 -1
  46. package/labs/gb/components/badge/badge.css.map +1 -1
  47. package/labs/gb/components/badge/badge.cssresult.js +1 -1
  48. package/labs/gb/components/badge/badge.cssresult.js.map +1 -1
  49. package/labs/gb/components/badge/badge.scss +1 -0
  50. package/labs/gb/components/button/button-element.d.ts +2 -0
  51. package/labs/gb/components/button/button-element.js +15 -2
  52. package/labs/gb/components/button/button-element.js.map +1 -1
  53. package/labs/gb/components/button/button.css +1 -1
  54. package/labs/gb/components/button/button.css.map +1 -1
  55. package/labs/gb/components/button/button.cssresult.js +1 -1
  56. package/labs/gb/components/button/button.cssresult.js.map +1 -1
  57. package/labs/gb/components/button/button.scss +1 -0
  58. package/labs/gb/components/buttongroup/_button-group-tokens.scss +123 -0
  59. package/labs/gb/components/buttongroup/button-group-element.d.ts +65 -0
  60. package/labs/gb/components/buttongroup/button-group-element.js +277 -0
  61. package/labs/gb/components/buttongroup/button-group-element.js.map +1 -0
  62. package/labs/gb/components/buttongroup/button-group.css +5 -0
  63. package/labs/gb/components/buttongroup/button-group.css.map +1 -0
  64. package/labs/gb/components/buttongroup/button-group.cssresult.d.ts +3 -0
  65. package/labs/gb/components/buttongroup/button-group.cssresult.js +15 -0
  66. package/labs/gb/components/buttongroup/button-group.cssresult.js.map +1 -0
  67. package/labs/gb/components/buttongroup/button-group.d.ts +96 -0
  68. package/labs/gb/components/buttongroup/button-group.js +105 -0
  69. package/labs/gb/components/buttongroup/button-group.js.map +1 -0
  70. package/labs/gb/components/buttongroup/button-group.scss +282 -0
  71. package/labs/gb/components/buttongroup/md-gb-button-group.d.ts +12 -0
  72. package/labs/gb/components/buttongroup/md-gb-button-group.js +8 -0
  73. package/labs/gb/components/buttongroup/md-gb-button-group.js.map +1 -0
  74. package/labs/gb/components/chip/chip.css +1 -1
  75. package/labs/gb/components/chip/chip.css.map +1 -1
  76. package/labs/gb/components/chip/chip.cssresult.js +1 -1
  77. package/labs/gb/components/chip/chip.cssresult.js.map +1 -1
  78. package/labs/gb/components/chip/chip.scss +1 -0
  79. package/labs/gb/components/fab/fab.css +1 -1
  80. package/labs/gb/components/fab/fab.css.map +1 -1
  81. package/labs/gb/components/fab/fab.cssresult.js +1 -1
  82. package/labs/gb/components/fab/fab.cssresult.js.map +1 -1
  83. package/labs/gb/components/fab/fab.scss +1 -0
  84. package/labs/gb/components/iconbutton/icon-button-element.d.ts +2 -0
  85. package/labs/gb/components/iconbutton/icon-button-element.js +15 -2
  86. package/labs/gb/components/iconbutton/icon-button-element.js.map +1 -1
  87. package/labs/gb/components/iconbutton/icon-button.css +1 -1
  88. package/labs/gb/components/iconbutton/icon-button.css.map +1 -1
  89. package/labs/gb/components/iconbutton/icon-button.cssresult.js +1 -1
  90. package/labs/gb/components/iconbutton/icon-button.cssresult.js.map +1 -1
  91. package/labs/gb/components/iconbutton/icon-button.scss +1 -0
  92. package/labs/gb/components/list/list.css +1 -1
  93. package/labs/gb/components/list/list.css.map +1 -1
  94. package/labs/gb/components/list/list.cssresult.js +1 -1
  95. package/labs/gb/components/list/list.cssresult.js.map +1 -1
  96. package/labs/gb/components/list/list.scss +1 -0
  97. package/labs/gb/components/menu/menu.css +1 -1
  98. package/labs/gb/components/menu/menu.css.map +1 -1
  99. package/labs/gb/components/menu/menu.cssresult.js +1 -1
  100. package/labs/gb/components/menu/menu.cssresult.js.map +1 -1
  101. package/labs/gb/components/menu/menu.scss +1 -0
  102. package/labs/gb/components/navbar/_nav-bar-tokens.scss +53 -0
  103. package/labs/gb/components/navbar/md-gb-nav-bar-item.d.ts +12 -0
  104. package/labs/gb/components/navbar/md-gb-nav-bar-item.js +10 -0
  105. package/labs/gb/components/navbar/md-gb-nav-bar-item.js.map +1 -0
  106. package/labs/gb/components/navbar/md-gb-nav-bar.d.ts +12 -0
  107. package/labs/gb/components/navbar/md-gb-nav-bar.js +10 -0
  108. package/labs/gb/components/navbar/md-gb-nav-bar.js.map +1 -0
  109. package/labs/gb/components/navbar/nav-bar-element.d.ts +58 -0
  110. package/labs/gb/components/navbar/nav-bar-element.js +116 -0
  111. package/labs/gb/components/navbar/nav-bar-element.js.map +1 -0
  112. package/labs/gb/components/navbar/nav-bar-item-element.d.ts +41 -0
  113. package/labs/gb/components/navbar/nav-bar-item-element.js +146 -0
  114. package/labs/gb/components/navbar/nav-bar-item-element.js.map +1 -0
  115. package/labs/gb/components/navbar/nav-bar.css +4 -0
  116. package/labs/gb/components/navbar/nav-bar.css.map +1 -0
  117. package/labs/gb/components/navbar/nav-bar.cssresult.d.ts +3 -0
  118. package/labs/gb/components/navbar/nav-bar.cssresult.js +14 -0
  119. package/labs/gb/components/navbar/nav-bar.cssresult.js.map +1 -0
  120. package/labs/gb/components/navbar/nav-bar.d.ts +86 -0
  121. package/labs/gb/components/navbar/nav-bar.js +92 -0
  122. package/labs/gb/components/navbar/nav-bar.js.map +1 -0
  123. package/labs/gb/components/navbar/nav-bar.scss +295 -0
  124. package/labs/gb/components/shared/pseudo-classes.d.ts +1 -7
  125. package/labs/gb/components/shared/pseudo-classes.js +1 -9
  126. package/labs/gb/components/shared/pseudo-classes.js.map +1 -1
  127. package/labs/gb/components/shared/update-class-list.d.ts +22 -0
  128. package/labs/gb/components/shared/update-class-list.js +26 -0
  129. package/labs/gb/components/shared/update-class-list.js.map +1 -0
  130. package/labs/gb/components/slider/_slider-tokens.scss +82 -0
  131. package/labs/gb/components/slider/md-gb-slider.d.ts +12 -0
  132. package/labs/gb/components/slider/md-gb-slider.js +8 -0
  133. package/labs/gb/components/slider/md-gb-slider.js.map +1 -0
  134. package/labs/gb/components/slider/slider-element.d.ts +145 -0
  135. package/labs/gb/components/slider/slider-element.js +934 -0
  136. package/labs/gb/components/slider/slider-element.js.map +1 -0
  137. package/labs/gb/components/slider/slider.css +1 -0
  138. package/labs/gb/components/slider/slider.css.map +1 -0
  139. package/labs/gb/components/slider/slider.cssresult.d.ts +3 -0
  140. package/labs/gb/components/slider/slider.cssresult.js +11 -0
  141. package/labs/gb/components/slider/slider.cssresult.js.map +1 -0
  142. package/labs/gb/components/slider/slider.d.ts +169 -0
  143. package/labs/gb/components/slider/slider.js +452 -0
  144. package/labs/gb/components/slider/slider.js.map +1 -0
  145. package/labs/gb/components/slider/slider.scss +661 -0
  146. package/labs/gb/components/tabs/_tabs-tokens.scss +177 -0
  147. package/labs/gb/components/tabs/md-gb-tab.d.ts +12 -0
  148. package/labs/gb/components/tabs/md-gb-tab.js +8 -0
  149. package/labs/gb/components/tabs/md-gb-tab.js.map +1 -0
  150. package/labs/gb/components/tabs/md-gb-tabs.d.ts +12 -0
  151. package/labs/gb/components/tabs/md-gb-tabs.js +8 -0
  152. package/labs/gb/components/tabs/md-gb-tabs.js.map +1 -0
  153. package/labs/gb/components/tabs/tab-element.d.ts +42 -0
  154. package/labs/gb/components/tabs/tab-element.js +75 -0
  155. package/labs/gb/components/tabs/tab-element.js.map +1 -0
  156. package/labs/gb/components/tabs/tabs-element.d.ts +37 -0
  157. package/labs/gb/components/tabs/tabs-element.js +67 -0
  158. package/labs/gb/components/tabs/tabs-element.js.map +1 -0
  159. package/labs/gb/components/tabs/tabs.css +4 -0
  160. package/labs/gb/components/tabs/tabs.css.map +1 -0
  161. package/labs/gb/components/tabs/tabs.cssresult.d.ts +3 -0
  162. package/labs/gb/components/tabs/tabs.cssresult.js +14 -0
  163. package/labs/gb/components/tabs/tabs.cssresult.js.map +1 -0
  164. package/labs/gb/components/tabs/tabs.d.ts +98 -0
  165. package/labs/gb/components/tabs/tabs.js +112 -0
  166. package/labs/gb/components/tabs/tabs.js.map +1 -0
  167. package/labs/gb/components/tabs/tabs.scss +301 -0
  168. package/labs/gb/components/toolbar/_toolbar-tokens.scss +70 -0
  169. package/labs/gb/components/toolbar/md-gb-toolbar.d.ts +12 -0
  170. package/labs/gb/components/toolbar/md-gb-toolbar.js +8 -0
  171. package/labs/gb/components/toolbar/md-gb-toolbar.js.map +1 -0
  172. package/labs/gb/components/toolbar/toolbar-element.d.ts +56 -0
  173. package/labs/gb/components/toolbar/toolbar-element.js +120 -0
  174. package/labs/gb/components/toolbar/toolbar-element.js.map +1 -0
  175. package/labs/gb/components/toolbar/toolbar.css +4 -0
  176. package/labs/gb/components/toolbar/toolbar.css.map +1 -0
  177. package/labs/gb/components/toolbar/toolbar.cssresult.d.ts +3 -0
  178. package/labs/gb/components/toolbar/toolbar.cssresult.js +14 -0
  179. package/labs/gb/components/toolbar/toolbar.cssresult.js.map +1 -0
  180. package/labs/gb/components/toolbar/toolbar.d.ts +56 -0
  181. package/labs/gb/components/toolbar/toolbar.js +60 -0
  182. package/labs/gb/components/toolbar/toolbar.js.map +1 -0
  183. package/labs/gb/components/toolbar/toolbar.scss +240 -0
  184. package/labs/gb/styles/tailwind.css +1 -1
  185. package/labs/gb/styles/tailwind.css.map +1 -1
  186. package/labs/gb/styles/tailwind.cssresult.js +1 -1
  187. package/labs/gb/styles/tailwind.cssresult.js.map +1 -1
  188. package/labs/gb/styles/tailwind.scss +2 -0
  189. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Options for configuring keyboard click handling.
8
+ */
9
+ export interface KeyboardClickHandlerOptions {
10
+ /**
11
+ * Optional function to determine if the element is disabled.
12
+ *
13
+ * Defaults to checking for disabled attributes or pseudo-classes.
14
+ */
15
+ isDisabled?: () => boolean;
16
+ }
17
+ /**
18
+ * Sets up button-like keyboard click activation for an element (Enter on
19
+ * keydown, Space on keyup).
20
+ *
21
+ * @param element The target HTMLElement.
22
+ * @param options Additional setup options.
23
+ * @return A cleanup function that removes all registered listeners.
24
+ */
25
+ export declare function setupKeyboardClickHandler(element: HTMLElement, options?: KeyboardClickHandlerOptions): () => void;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { afterDispatch, setupDispatchHooks, } from '../../../internal/events/dispatch-hooks.js';
7
+ import { isDisabled as defaultIsDisabled } from '../pseudo-classes.js';
8
+ /**
9
+ * Sets up button-like keyboard click activation for an element (Enter on
10
+ * keydown, Space on keyup).
11
+ *
12
+ * @param element The target HTMLElement.
13
+ * @param options Additional setup options.
14
+ * @return A cleanup function that removes all registered listeners.
15
+ */
16
+ export function setupKeyboardClickHandler(element, options) {
17
+ const isDisabled = options?.isDisabled ?? (() => defaultIsDisabled(element));
18
+ // Tracks whether Space was pressed down on this element.
19
+ let isSpacePressed = false;
20
+ // Intercepts event dispatch to allow `afterDispatch` callbacks to run after
21
+ // the event has completely finished bubbling.
22
+ setupDispatchHooks(element, 'keydown', 'keyup');
23
+ const isSpace = (event) => event.key === ' ';
24
+ const isEnter = (event) => event.key === 'Enter';
25
+ const onKeyDown = (event) => {
26
+ if (!(isSpace(event) || isEnter(event)) || isDisabled()) {
27
+ return;
28
+ }
29
+ // Defer activation until after dispatch so keydown listeners can cancel
30
+ // via preventDefault().
31
+ afterDispatch(event, () => {
32
+ if (event.defaultPrevented) {
33
+ return;
34
+ }
35
+ if (isSpace(event)) {
36
+ // Space activates on keyup, record that it is currently pressed.
37
+ isSpacePressed = true;
38
+ // Space natively scrolls the page unless prevented synchronously on
39
+ // keydown.
40
+ event.preventDefault();
41
+ }
42
+ else if (isEnter(event)) {
43
+ // Enter activates on keydown.
44
+ element.click();
45
+ }
46
+ });
47
+ };
48
+ const onKeyUp = (event) => {
49
+ if (!isSpace(event) || isDisabled()) {
50
+ return;
51
+ }
52
+ // Space activates on keyup. Defer click until after dispatch so keyup
53
+ // listeners can cancel via preventDefault().
54
+ afterDispatch(event, () => {
55
+ const wasSpacePressed = isSpacePressed;
56
+ isSpacePressed = false;
57
+ if (!event.defaultPrevented && wasSpacePressed) {
58
+ element.click();
59
+ }
60
+ });
61
+ };
62
+ // Reset pressed state if focus leaves the element before keyup.
63
+ const onBlur = () => {
64
+ isSpacePressed = false;
65
+ };
66
+ const controller = new AbortController();
67
+ element.addEventListener('keydown', onKeyDown, { signal: controller.signal });
68
+ element.addEventListener('keyup', onKeyUp, { signal: controller.signal });
69
+ element.addEventListener('blur', onBlur, { signal: controller.signal });
70
+ return () => {
71
+ controller.abort();
72
+ };
73
+ }
74
+ //# sourceMappingURL=keyboard_click_handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard_click_handler.js","sourceRoot":"","sources":["keyboard_click_handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,UAAU,IAAI,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAcrE;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAoB,EACpB,OAAqC;IAErC,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAE7E,yDAAyD;IACzD,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,4EAA4E;IAC5E,8CAA8C;IAC9C,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEhD,MAAM,OAAO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C,CAAC;IACL,CAAC,CAAC;IAEF,gEAAgE;IAChE,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAC,CAAC,CAAC;IAC5E,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAC,CAAC,CAAC;IACxE,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAC,CAAC,CAAC;IAEtE,OAAO,GAAG,EAAE;QACV,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n afterDispatch,\n setupDispatchHooks,\n} from '../../../internal/events/dispatch-hooks.js';\nimport {isDisabled as defaultIsDisabled} from '../pseudo-classes.js';\n\n/**\n * Options for configuring keyboard click handling.\n */\nexport interface KeyboardClickHandlerOptions {\n /**\n * Optional function to determine if the element is disabled.\n *\n * Defaults to checking for disabled attributes or pseudo-classes.\n */\n isDisabled?: () => boolean;\n}\n\n/**\n * Sets up button-like keyboard click activation for an element (Enter on\n * keydown, Space on keyup).\n *\n * @param element The target HTMLElement.\n * @param options Additional setup options.\n * @return A cleanup function that removes all registered listeners.\n */\nexport function setupKeyboardClickHandler(\n element: HTMLElement,\n options?: KeyboardClickHandlerOptions,\n): () => void {\n const isDisabled = options?.isDisabled ?? (() => defaultIsDisabled(element));\n\n // Tracks whether Space was pressed down on this element.\n let isSpacePressed = false;\n\n // Intercepts event dispatch to allow `afterDispatch` callbacks to run after\n // the event has completely finished bubbling.\n setupDispatchHooks(element, 'keydown', 'keyup');\n\n const isSpace = (event: KeyboardEvent) => event.key === ' ';\n const isEnter = (event: KeyboardEvent) => event.key === 'Enter';\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!(isSpace(event) || isEnter(event)) || isDisabled()) {\n return;\n }\n\n // Defer activation until after dispatch so keydown listeners can cancel\n // via preventDefault().\n afterDispatch(event, () => {\n if (event.defaultPrevented) {\n return;\n }\n\n if (isSpace(event)) {\n // Space activates on keyup, record that it is currently pressed.\n isSpacePressed = true;\n // Space natively scrolls the page unless prevented synchronously on\n // keydown.\n event.preventDefault();\n } else if (isEnter(event)) {\n // Enter activates on keydown.\n element.click();\n }\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isSpace(event) || isDisabled()) {\n return;\n }\n\n // Space activates on keyup. Defer click until after dispatch so keyup\n // listeners can cancel via preventDefault().\n afterDispatch(event, () => {\n const wasSpacePressed = isSpacePressed;\n isSpacePressed = false;\n\n if (!event.defaultPrevented && wasSpacePressed) {\n element.click();\n }\n });\n };\n\n // Reset pressed state if focus leaves the element before keyup.\n const onBlur = () => {\n isSpacePressed = false;\n };\n\n const controller = new AbortController();\n element.addEventListener('keydown', onKeyDown, {signal: controller.signal});\n element.addEventListener('keyup', onKeyUp, {signal: controller.signal});\n element.addEventListener('blur', onBlur, {signal: controller.signal});\n\n return () => {\n controller.abort();\n };\n}\n"]}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CSSResultGroup } from 'lit';
7
+ import { AriaToggleElement } from './toggle.js';
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ /** An ARIA toggle button element. */
11
+ 'md-aria-toggle': MdAriaToggleElement;
12
+ }
13
+ }
14
+ /**
15
+ * An ARIA toggle button element with default properties and styles.
16
+ */
17
+ export declare class MdAriaToggleElement extends AriaToggleElement {
18
+ static styles: CSSResultGroup;
19
+ /**
20
+ * Whether the toggle button is selected.
21
+ */
22
+ get selected(): boolean;
23
+ set selected(value: boolean);
24
+ /**
25
+ * Whether the toggle button is disabled.
26
+ */
27
+ get disabled(): boolean;
28
+ set disabled(value: boolean);
29
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { css } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { AriaToggleElement, isToggleDisabled, isTogglePressed } from './toggle.js';
10
+ /**
11
+ * An ARIA toggle button element with default properties and styles.
12
+ */
13
+ let MdAriaToggleElement = class MdAriaToggleElement extends AriaToggleElement {
14
+ /**
15
+ * Whether the toggle button is selected.
16
+ */
17
+ get selected() {
18
+ return this[isTogglePressed];
19
+ }
20
+ set selected(value) {
21
+ const oldValue = this.selected;
22
+ this[isTogglePressed] = value;
23
+ this.requestUpdate('selected', oldValue); // Remove when Lit 2 support is dropped.
24
+ }
25
+ /**
26
+ * Whether the toggle button is disabled.
27
+ */
28
+ get disabled() {
29
+ return this[isToggleDisabled];
30
+ }
31
+ set disabled(value) {
32
+ const oldValue = this.disabled;
33
+ this[isToggleDisabled] = value;
34
+ this.requestUpdate('disabled', oldValue); // Remove when Lit 2 support is dropped.
35
+ }
36
+ };
37
+ MdAriaToggleElement.styles = [
38
+ AriaToggleElement.styles,
39
+ css `
40
+ :host {
41
+ background-color: ButtonFace;
42
+ color: ButtonText;
43
+ }
44
+ :host(:state(selected)) {
45
+ background-color: SelectedItem;
46
+ color: SelectedItemText;
47
+ }
48
+ :host(:focus-visible) {
49
+ outline: 2px solid AccentColor;
50
+ outline-offset: 2px;
51
+ }
52
+ :host(:state(disabled)) {
53
+ opacity: 38%;
54
+ }
55
+ `,
56
+ ];
57
+ __decorate([
58
+ property({ type: Boolean, reflect: true })
59
+ ], MdAriaToggleElement.prototype, "selected", null);
60
+ __decorate([
61
+ property({ type: Boolean, reflect: true })
62
+ ], MdAriaToggleElement.prototype, "disabled", null);
63
+ MdAriaToggleElement = __decorate([
64
+ customElement('md-aria-toggle')
65
+ ], MdAriaToggleElement);
66
+ export { MdAriaToggleElement };
67
+ //# sourceMappingURL=md-aria-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md-aria-toggle.js","sourceRoot":"","sources":["md-aria-toggle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAiB,MAAM,KAAK,CAAC;AACxC,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC;AASjF;;GAEG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,iBAAiB;IAsBxD;;OAEG;IAEH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,QAAQ,CAAC,KAAc;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,wCAAwC;IACpF,CAAC;IAED;;OAEG;IAEH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,QAAQ,CAAC,KAAc;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,wCAAwC;IACpF,CAAC;;AA7Ce,0BAAM,GAAmB;IACvC,iBAAiB,CAAC,MAAM;IACxB,GAAG,CAAA;;;;;;;;;;;;;;;;KAgBF;CACF,AAnBqB,CAmBpB;AAMF;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;mDAGxC;AAWD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;mDAGxC;AAzCU,mBAAmB;IAD/B,aAAa,CAAC,gBAAgB,CAAC;GACnB,mBAAmB,CA+C/B","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultGroup} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\n\nimport {AriaToggleElement, isToggleDisabled, isTogglePressed} from './toggle.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** An ARIA toggle button element. */\n 'md-aria-toggle': MdAriaToggleElement;\n }\n}\n\n/**\n * An ARIA toggle button element with default properties and styles.\n */\n@customElement('md-aria-toggle')\nexport class MdAriaToggleElement extends AriaToggleElement {\n static override styles: CSSResultGroup = [\n AriaToggleElement.styles,\n css`\n :host {\n background-color: ButtonFace;\n color: ButtonText;\n }\n :host(:state(selected)) {\n background-color: SelectedItem;\n color: SelectedItemText;\n }\n :host(:focus-visible) {\n outline: 2px solid AccentColor;\n outline-offset: 2px;\n }\n :host(:state(disabled)) {\n opacity: 38%;\n }\n `,\n ];\n\n /**\n * Whether the toggle button is selected.\n */\n @property({type: Boolean, reflect: true})\n get selected(): boolean {\n return this[isTogglePressed];\n }\n set selected(value: boolean) {\n const oldValue = this.selected;\n this[isTogglePressed] = value;\n this.requestUpdate('selected', oldValue); // Remove when Lit 2 support is dropped.\n }\n\n /**\n * Whether the toggle button is disabled.\n */\n @property({type: Boolean, reflect: true})\n get disabled(): boolean {\n return this[isToggleDisabled];\n }\n set disabled(value: boolean) {\n const oldValue = this.disabled;\n this[isToggleDisabled] = value;\n this.requestUpdate('disabled', oldValue); // Remove when Lit 2 support is dropped.\n }\n}\n"]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CSSResultGroup, LitElement } from 'lit';
7
+ declare const baseClass: import("../../behaviors/mixin.js").MixinReturn<import("../../behaviors/mixin.js").MixinReturn<import("../../behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../behaviors/element-internals.js").WithElementInternals>, import("../../behaviors/custom-state-set.js").WithCustomStateSet>, import("../../behaviors/focusable.js").Focusable>;
8
+ /**
9
+ * A unique symbol used to check if the toggle button is disabled.
10
+ */
11
+ export declare const isToggleDisabled: unique symbol;
12
+ /**
13
+ * A unique symbol used to check if the toggle button is pressed.
14
+ */
15
+ export declare const isTogglePressed: unique symbol;
16
+ /**
17
+ * An ARIA toggle button element.
18
+ *
19
+ * @fires {InputEvent} input - Fired when the toggle button is pressed or unpressed. --bubbles --composed
20
+ * @fires {Event} change - Fired when the toggle button is pressed or unpressed. --bubbles
21
+ * @cssstate selected - Whether the toggle button is selected.
22
+ * @cssstate enabled - True when the toggle button is enabled.
23
+ * @cssstate disabled - True when the toggle button is disabled.
24
+ */
25
+ export declare class AriaToggleElement extends baseClass {
26
+ static styles: CSSResultGroup;
27
+ /**
28
+ * Whether the toggle button is selected.
29
+ */
30
+ get [isTogglePressed](): boolean;
31
+ set [isTogglePressed](value: boolean);
32
+ /**
33
+ * Whether the toggle button is disabled.
34
+ */
35
+ get [isToggleDisabled](): boolean;
36
+ set [isToggleDisabled](value: boolean);
37
+ constructor();
38
+ protected render(): import("lit-html").TemplateResult<1>;
39
+ }
40
+ export {};
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { css, html, isServer, LitElement } from 'lit';
7
+ import { afterDispatch, setupDispatchHooks, } from '../../../internal/events/dispatch-hooks.js';
8
+ import { mixinCustomStateSet, toggleState, } from '../../behaviors/custom-state-set.js';
9
+ import { internals, mixinElementInternals, } from '../../behaviors/element-internals.js';
10
+ import { isFocusable, mixinFocusable } from '../../behaviors/focusable.js';
11
+ import { setupKeyboardClickHandler } from './keyboard_click_handler.js';
12
+ const baseClass = mixinFocusable(mixinCustomStateSet(mixinElementInternals(LitElement)));
13
+ /**
14
+ * A unique symbol used to check if the toggle button is disabled.
15
+ */
16
+ export const isToggleDisabled = Symbol('isToggleDisabled');
17
+ /**
18
+ * A unique symbol used to check if the toggle button is pressed.
19
+ */
20
+ export const isTogglePressed = Symbol('isTogglePressed');
21
+ /**
22
+ * An ARIA toggle button element.
23
+ *
24
+ * @fires {InputEvent} input - Fired when the toggle button is pressed or unpressed. --bubbles --composed
25
+ * @fires {Event} change - Fired when the toggle button is pressed or unpressed. --bubbles
26
+ * @cssstate selected - Whether the toggle button is selected.
27
+ * @cssstate enabled - True when the toggle button is enabled.
28
+ * @cssstate disabled - True when the toggle button is disabled.
29
+ */
30
+ export class AriaToggleElement extends baseClass {
31
+ /**
32
+ * Whether the toggle button is selected.
33
+ */
34
+ get [isTogglePressed]() {
35
+ return this[internals].ariaPressed === 'true';
36
+ }
37
+ set [isTogglePressed](value) {
38
+ value = Boolean(value); // coerce for safety
39
+ this[internals].ariaPressed = String(value);
40
+ this[toggleState]('selected', value);
41
+ }
42
+ /**
43
+ * Whether the toggle button is disabled.
44
+ */
45
+ get [isToggleDisabled]() {
46
+ return this[internals].ariaDisabled === 'true';
47
+ }
48
+ set [isToggleDisabled](value) {
49
+ value = Boolean(value); // coerce for safety
50
+ this[internals].ariaDisabled = String(value);
51
+ this[toggleState]('disabled', value);
52
+ this[toggleState]('enabled', !value);
53
+ this[isFocusable] = !value;
54
+ }
55
+ constructor() {
56
+ super();
57
+ if (isServer)
58
+ return;
59
+ this[internals].role = 'button';
60
+ this[isTogglePressed] = false;
61
+ this[isToggleDisabled] = false;
62
+ setupDispatchHooks(this, 'click');
63
+ setupKeyboardClickHandler(this);
64
+ this.addEventListener('click', (event) => {
65
+ if (this[isToggleDisabled]) {
66
+ event.stopImmediatePropagation();
67
+ event.preventDefault();
68
+ return;
69
+ }
70
+ // Toggle state updates synchronously during capture phase before
71
+ // bubbling to other listeners. This ensures `event.target` has the
72
+ // correct state.
73
+ const wasPressed = this[isTogglePressed];
74
+ this[isTogglePressed] = !wasPressed;
75
+ afterDispatch(event, () => {
76
+ if (event.defaultPrevented) {
77
+ // Revert state if a listener cancels the click event after the
78
+ // event has finished bubbling.
79
+ this[isTogglePressed] = wasPressed;
80
+ return;
81
+ }
82
+ this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
83
+ this.dispatchEvent(new Event('change', { bubbles: true }));
84
+ });
85
+ }, { capture: true });
86
+ }
87
+ render() {
88
+ return html `<slot></slot>`;
89
+ }
90
+ }
91
+ AriaToggleElement.styles = css `
92
+ :host {
93
+ display: inline-flex;
94
+ user-select: none;
95
+ }
96
+ :host(:state(enabled)) {
97
+ cursor: pointer;
98
+ }
99
+ `;
100
+ //# sourceMappingURL=toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle.js","sourceRoot":"","sources":["toggle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,GAAG,EAAkB,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,WAAW,GACZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAEtE,MAAM,SAAS,GAAG,cAAc,CAC9B,mBAAmB,CAAC,qBAAqB,CAAC,U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A;;;;;;;;GAQ3C,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultGroup, html, isServer, LitElement} from 'lit';\n\nimport {\n afterDispatch,\n setupDispatchHooks,\n} from '../../../internal/events/dispatch-hooks.js';\nimport {\n mixinCustomStateSet,\n toggleState,\n} from '../../behaviors/custom-state-set.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../behaviors/element-internals.js';\nimport {isFocusable, mixinFocusable} from '../../behaviors/focusable.js';\nimport {setupKeyboardClickHandler} from './keyboard_click_handler.js';\n\nconst baseClass = mixinFocusable(\n mixinCustomStateSet(mixinElementInternals(LitElement)),\n);\n\n/**\n * A unique symbol used to check if the toggle button is disabled.\n */\nexport const isToggleDisabled = Symbol('isToggleDisabled');\n\n/**\n * A unique symbol used to check if the toggle button is pressed.\n */\nexport const isTogglePressed = Symbol('isTogglePressed');\n\n/**\n * An ARIA toggle button element.\n *\n * @fires {InputEvent} input - Fired when the toggle button is pressed or unpressed. --bubbles --composed\n * @fires {Event} change - Fired when the toggle button is pressed or unpressed. --bubbles\n * @cssstate selected - Whether the toggle button is selected.\n * @cssstate enabled - True when the toggle button is enabled.\n * @cssstate disabled - True when the toggle button is disabled.\n */\nexport class AriaToggleElement extends baseClass {\n static override styles: CSSResultGroup = css`\n :host {\n display: inline-flex;\n user-select: none;\n }\n :host(:state(enabled)) {\n cursor: pointer;\n }\n `;\n\n /**\n * Whether the toggle button is selected.\n */\n get [isTogglePressed](): boolean {\n return this[internals].ariaPressed === 'true';\n }\n set [isTogglePressed](value: boolean) {\n value = Boolean(value); // coerce for safety\n this[internals].ariaPressed = String(value);\n this[toggleState]('selected', value);\n }\n\n /**\n * Whether the toggle button is disabled.\n */\n get [isToggleDisabled](): boolean {\n return this[internals].ariaDisabled === 'true';\n }\n set [isToggleDisabled](value: boolean) {\n value = Boolean(value); // coerce for safety\n this[internals].ariaDisabled = String(value);\n this[toggleState]('disabled', value);\n this[toggleState]('enabled', !value);\n this[isFocusable] = !value;\n }\n\n constructor() {\n super();\n if (isServer) return;\n\n this[internals].role = 'button';\n this[isTogglePressed] = false;\n this[isToggleDisabled] = false;\n\n setupDispatchHooks(this, 'click');\n setupKeyboardClickHandler(this);\n\n this.addEventListener(\n 'click',\n (event: MouseEvent) => {\n if (this[isToggleDisabled]) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n // Toggle state updates synchronously during capture phase before\n // bubbling to other listeners. This ensures `event.target` has the\n // correct state.\n const wasPressed = this[isTogglePressed];\n this[isTogglePressed] = !wasPressed;\n afterDispatch(event, () => {\n if (event.defaultPrevented) {\n // Revert state if a listener cancels the click event after the\n // event has finished bubbling.\n this[isTogglePressed] = wasPressed;\n return;\n }\n\n this.dispatchEvent(\n new InputEvent('input', {bubbles: true, composed: true}),\n );\n this.dispatchEvent(new Event('change', {bubbles: true}));\n });\n },\n {capture: true},\n );\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CSSResultOrNative, LitElement } from 'lit';
7
+ import { resetMenuitemCheckedness } from './internal.js';
8
+ import type { AriaMenuitemElement } from './menuitem.js';
9
+ declare const baseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../behaviors/element-internals.js").WithElementInternals>;
10
+ /** Possible values for `AriaFieldsetElement`'s `checkable` property. */
11
+ export type CheckableState = 'single' | 'multiple' | null;
12
+ /**
13
+ * An element implementing the proposed menu behavior of `<fieldset>`.
14
+ */
15
+ export declare class AriaFieldsetElement extends baseClass {
16
+ static styles: CSSResultOrNative[];
17
+ private internalDisabled;
18
+ private internalCheckable;
19
+ private get items();
20
+ get disabled(): boolean;
21
+ set disabled(value: boolean);
22
+ get checkable(): CheckableState;
23
+ set checkable(value: CheckableState);
24
+ constructor();
25
+ render(): import("lit-html").TemplateResult<1>;
26
+ /**
27
+ * Unchecks every menuitem in this fieldset apart from the given one.
28
+ *
29
+ * `<md-aria-menuitem>` calls this on its cached ancestor fieldset when it
30
+ * becomes checked in a single-checkable fieldset.
31
+ *
32
+ * @param checkedItem The item to leave as-is, or null to uncheck every item.
33
+ */
34
+ [resetMenuitemCheckedness](checkedItem: AriaMenuitemElement | null): void;
35
+ }
36
+ export {};
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { LitElement, css, html } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import { internals, mixinElementInternals, } from '../../behaviors/element-internals.js';
10
+ import { resetMenuitemCheckedness, setCheckedness, updateUsedValues, } from './internal.js';
11
+ import { sharedSlottedContentStyles } from './shared-slotted-content.js';
12
+ const baseClass = mixinElementInternals(LitElement);
13
+ /**
14
+ * An element implementing the proposed menu behavior of `<fieldset>`.
15
+ */
16
+ export class AriaFieldsetElement extends baseClass {
17
+ get items() {
18
+ // This naively queries for these elements because this element doesn't need
19
+ // to support nested fieldsets yet.
20
+ return this.querySelectorAll('md-aria-menuitem');
21
+ }
22
+ get disabled() {
23
+ return this.internalDisabled;
24
+ }
25
+ set disabled(value) {
26
+ this.internalDisabled = value;
27
+ for (const item of this.items) {
28
+ // If this component is upgraded with `disabled` set in HTML,
29
+ // `<md-aria-menuitem>` children will not be upgraded at this point.
30
+ // These children will update themselves during `connectedCallback`.
31
+ item[updateUsedValues]?.();
32
+ }
33
+ }
34
+ get checkable() {
35
+ return this.internalCheckable;
36
+ }
37
+ set checkable(value) {
38
+ if (typeof value === 'string') {
39
+ const canonicalizedValue = value.toLowerCase();
40
+ if (canonicalizedValue === 'single' ||
41
+ canonicalizedValue === 'multiple') {
42
+ value = canonicalizedValue;
43
+ }
44
+ else {
45
+ value = 'multiple';
46
+ }
47
+ }
48
+ this.internalCheckable = value;
49
+ if (value === 'single') {
50
+ this[resetMenuitemCheckedness](null);
51
+ }
52
+ for (const item of this.items) {
53
+ // If this component is upgraded with `checkable` set in HTML,
54
+ // `<md-aria-menuitem>` children will not be upgraded at this point.
55
+ // These children will update themselves during `connectedCallback`.
56
+ item[updateUsedValues]?.();
57
+ }
58
+ }
59
+ constructor() {
60
+ super();
61
+ this.internalDisabled = false;
62
+ this.internalCheckable = null;
63
+ this[internals].role = 'group';
64
+ }
65
+ render() {
66
+ return html `<slot></slot>`;
67
+ }
68
+ /**
69
+ * Unchecks every menuitem in this fieldset apart from the given one.
70
+ *
71
+ * `<md-aria-menuitem>` calls this on its cached ancestor fieldset when it
72
+ * becomes checked in a single-checkable fieldset.
73
+ *
74
+ * @param checkedItem The item to leave as-is, or null to uncheck every item.
75
+ */
76
+ [resetMenuitemCheckedness](checkedItem) {
77
+ for (const item of this.items) {
78
+ if (item !== checkedItem) {
79
+ item[setCheckedness]?.(false);
80
+ }
81
+ }
82
+ }
83
+ }
84
+ AriaFieldsetElement.styles = [
85
+ sharedSlottedContentStyles,
86
+ css `
87
+ :host {
88
+ display: block;
89
+ margin-inline: 2px;
90
+ border: groove 2px ThreeDFace;
91
+ padding-block: 0.35em 0.625em;
92
+ padding-inline: 0.75em;
93
+ min-inline-size: min-content;
94
+ }
95
+ `,
96
+ ];
97
+ __decorate([
98
+ property({ type: Boolean, reflect: true })
99
+ ], AriaFieldsetElement.prototype, "disabled", null);
100
+ __decorate([
101
+ property({ type: String, reflect: true })
102
+ ], AriaFieldsetElement.prototype, "checkable", null);
103
+ //# sourceMappingURL=fieldset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldset.js","sourceRoot":"","sources":["fieldset.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAoB,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;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vB,IAAI,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,8DAA8D;YAC9D,oEAAoE;YACpE,oEAAoE;YACpE,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QAvDF,qBAAgB,GAAG,KAAK,CAAC;QACzB,sBAAiB,GAAmB,IAAI,CAAC;QAuD/C,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC;IACjC,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,CAAC,wBAAwB,CAAC,CAAC,WAAuC;QAChE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;gBACzB,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;;AA3Fe,0BAAM,GAAwB;IAC5C,0BAA0B;IAC1B,GAAG,CAAA;;;;;;;;;KASF;CACF,AAZqB,CAYpB;AAYF;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;mDAGxC;AAYD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oDAGvC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {CSSResultOrNative, LitElement, css, html} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../behaviors/element-internals.js';\nimport {\n resetMenuitemCheckedness,\n setCheckedness,\n updateUsedValues,\n} from './internal.js';\nimport type {AriaMenuitemElement} from './menuitem.js';\nimport {sharedSlottedContentStyles} from './shared-slotted-content.js';\n\nconst baseClass = mixinElementInternals(LitElement);\n\n/** Possible values for `AriaFieldsetElement`'s `checkable` property. */\n// tslint:disable-next-line:no-undefined-type-alias Defined by proposed spec\nexport type CheckableState = 'single' | 'multiple' | null;\n\n/**\n * An element implementing the proposed menu behavior of `<fieldset>`.\n */\nexport class AriaFieldsetElement extends baseClass {\n static override styles: CSSResultOrNative[] = [\n sharedSlottedContentStyles,\n css`\n :host {\n display: block;\n margin-inline: 2px;\n border: groove 2px ThreeDFace;\n padding-block: 0.35em 0.625em;\n padding-inline: 0.75em;\n min-inline-size: min-content;\n }\n `,\n ];\n\n private internalDisabled = false;\n private internalCheckable: CheckableState = null;\n\n private get items(): Iterable<AriaMenuitemElement> {\n // This naively queries for these elements because this element doesn't need\n // to support nested fieldsets yet.\n return this.querySelectorAll('md-aria-menuitem');\n }\n\n @property({type: Boolean, reflect: true})\n get disabled(): boolean {\n return this.internalDisabled;\n }\n set disabled(value: boolean) {\n this.internalDisabled = value;\n for (const item of this.items) {\n // If this component is upgraded with `disabled` set in HTML,\n // `<md-aria-menuitem>` children will not be upgraded at this point.\n // These children will update themselves during `connectedCallback`.\n item[updateUsedValues]?.();\n }\n }\n\n @property({type: String, reflect: true})\n get checkable(): CheckableState {\n return this.internalCheckable;\n }\n set checkable(value: CheckableState) {\n if (typeof value === 'string') {\n const canonicalizedValue = value.toLowerCase();\n if (\n canonicalizedValue === 'single' ||\n canonicalizedValue === 'multiple'\n ) {\n value = canonicalizedValue;\n } else {\n value = 'multiple';\n }\n }\n\n this.internalCheckable = value;\n\n if (value === 'single') {\n this[resetMenuitemCheckedness](null);\n }\n\n for (const item of this.items) {\n // If this component is upgraded with `checkable` set in HTML,\n // `<md-aria-menuitem>` children will not be upgraded at this point.\n // These children will update themselves during `connectedCallback`.\n item[updateUsedValues]?.();\n }\n }\n\n constructor() {\n super();\n this[internals].role = 'group';\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n /**\n * Unchecks every menuitem in this fieldset apart from the given one.\n *\n * `<md-aria-menuitem>` calls this on its cached ancestor fieldset when it\n * becomes checked in a single-checkable fieldset.\n *\n * @param checkedItem The item to leave as-is, or null to uncheck every item.\n */\n [resetMenuitemCheckedness](checkedItem: AriaMenuitemElement | null) {\n for (const item of this.items) {\n if (item !== checkedItem) {\n item[setCheckedness]?.(false);\n }\n }\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * @fileoverview Unique symbols for members that the menu elements share with
8
+ * each other but that are not part of any of their public APIs.
9
+ */
10
+ /** Defined by `AriaMenuitemElement`. */
11
+ export declare const updateUsedValues: unique symbol;
12
+ /** Defined by `AriaMenuitemElement`. */
13
+ export declare const setCheckedness: unique symbol;
14
+ /** Defined by `AriaFieldsetElement`. */
15
+ export declare const resetMenuitemCheckedness: unique symbol;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * @fileoverview Unique symbols for members that the menu elements share with
8
+ * each other but that are not part of any of their public APIs.
9
+ */
10
+ /** Defined by `AriaMenuitemElement`. */
11
+ export const updateUsedValues = Symbol('updateUsedValues');
12
+ /** Defined by `AriaMenuitemElement`. */
13
+ export const setCheckedness = Symbol('setCheckedness');
14
+ /** Defined by `AriaFieldsetElement`. */
15
+ export const resetMenuitemCheckedness = Symbol('resetMenuitemCheckedness');
16
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["internal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAE3D,wCAAwC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD,wCAAwC;AACxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Unique symbols for members that the menu elements share with\n * each other but that are not part of any of their public APIs.\n */\n\n/** Defined by `AriaMenuitemElement`. */\nexport const updateUsedValues = Symbol('updateUsedValues');\n\n/** Defined by `AriaMenuitemElement`. */\nexport const setCheckedness = Symbol('setCheckedness');\n\n/** Defined by `AriaFieldsetElement`. */\nexport const resetMenuitemCheckedness = Symbol('resetMenuitemCheckedness');\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AriaFieldsetElement } from './fieldset.js';
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'md-aria-fieldset': AriaFieldsetElement;
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AriaFieldsetElement } from './fieldset.js';
7
+ customElements.define('md-aria-fieldset', AriaFieldsetElement);
8
+ //# sourceMappingURL=md-aria-fieldset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md-aria-fieldset.js","sourceRoot":"","sources":["md-aria-fieldset.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAQlD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {AriaFieldsetElement} from './fieldset.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-aria-fieldset': AriaFieldsetElement;\n }\n}\n\ncustomElements.define('md-aria-fieldset', AriaFieldsetElement);\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AriaMenubarElement } from './menubar.js';
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'md-aria-menubar': AriaMenubarElement;
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AriaMenubarElement } from './menubar.js';
7
+ customElements.define('md-aria-menubar', AriaMenubarElement);
8
+ //# sourceMappingURL=md-aria-menubar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md-aria-menubar.js","sourceRoot":"","sources":["md-aria-menubar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAQhD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {AriaMenubarElement} from './menubar.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-aria-menubar': AriaMenubarElement;\n }\n}\n\ncustomElements.define('md-aria-menubar', AriaMenubarElement);\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CSSResultOrNative, LitElement, PropertyValues } from 'lit';
7
+ declare const baseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../behaviors/element-internals.js").WithElementInternals>;
8
+ /** An element implementing the proposed `<menubar>` built-in element. */
9
+ export declare class AriaMenubarElement extends baseClass {
10
+ static styles: CSSResultOrNative[];
11
+ constructor();
12
+ protected updated(changedProperties: PropertyValues<this>): void;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ }
15
+ export {};