@material/web 1.0.0-pre.6 → 1.0.0-pre.7

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 (334) hide show
  1. package/README.md +7 -7
  2. package/aria/aria.d.ts +43 -0
  3. package/aria/aria.js +56 -0
  4. package/aria/aria.js.map +1 -0
  5. package/aria/delegate.d.ts +37 -0
  6. package/aria/delegate.js +53 -0
  7. package/aria/delegate.js.map +1 -0
  8. package/badge/badge.d.ts +0 -1
  9. package/badge/badge.js +0 -1
  10. package/badge/badge.js.map +1 -1
  11. package/badge/lib/badge.d.ts +8 -7
  12. package/badge/lib/badge.js +5 -6
  13. package/badge/lib/badge.js.map +1 -1
  14. package/button/lib/_elevation.scss +13 -3
  15. package/button/lib/button.d.ts +1 -12
  16. package/button/lib/button.js +29 -60
  17. package/button/lib/button.js.map +1 -1
  18. package/button/lib/shared-elevation-styles.css.js +1 -1
  19. package/button/lib/shared-elevation-styles.css.js.map +1 -1
  20. package/checkbox/lib/checkbox.d.ts +0 -1
  21. package/checkbox/lib/checkbox.js +33 -43
  22. package/checkbox/lib/checkbox.js.map +1 -1
  23. package/chips/_filter-chip.scss +6 -0
  24. package/chips/filter-chip.d.ts +20 -0
  25. package/chips/filter-chip.js +24 -0
  26. package/chips/filter-chip.js.map +1 -0
  27. package/chips/lib/_filter-chip.scss +141 -0
  28. package/chips/lib/_shared.scss +18 -14
  29. package/chips/lib/assist-styles.css.js +1 -1
  30. package/chips/lib/assist-styles.css.js.map +1 -1
  31. package/chips/lib/chip.d.ts +8 -3
  32. package/chips/lib/chip.js +29 -30
  33. package/chips/lib/chip.js.map +1 -1
  34. package/chips/lib/filter-chip.d.ts +21 -0
  35. package/chips/lib/filter-chip.js +47 -0
  36. package/chips/lib/filter-chip.js.map +1 -0
  37. package/chips/lib/filter-styles.css.js +9 -0
  38. package/chips/lib/filter-styles.css.js.map +1 -0
  39. package/{fab/lib/fab-extended-styles.scss → chips/lib/filter-styles.scss} +3 -3
  40. package/chips/lib/shared-styles.css.js +1 -1
  41. package/chips/lib/shared-styles.css.js.map +1 -1
  42. package/chips/lib/suggestion-styles.css.js +1 -1
  43. package/chips/lib/suggestion-styles.css.js.map +1 -1
  44. package/circularprogress/harness.d.ts +1 -0
  45. package/circularprogress/harness.js +4 -0
  46. package/circularprogress/harness.js.map +1 -1
  47. package/circularprogress/lib/circular-progress.d.ts +0 -1
  48. package/circularprogress/lib/circular-progress.js +16 -19
  49. package/circularprogress/lib/circular-progress.js.map +1 -1
  50. package/dialog/lib/_dialog.scss +8 -8
  51. package/dialog/lib/dialog-styles.css.js +1 -1
  52. package/dialog/lib/dialog-styles.css.js.map +1 -1
  53. package/dialog/lib/dialog.js +25 -49
  54. package/dialog/lib/dialog.js.map +1 -1
  55. package/divider/lib/divider.js +4 -7
  56. package/divider/lib/divider.js.map +1 -1
  57. package/elevation/lib/_elevation.scss +5 -7
  58. package/elevation/lib/elevation-styles.css.js +1 -1
  59. package/elevation/lib/elevation-styles.css.js.map +1 -1
  60. package/fab/_fab.scss +1 -0
  61. package/fab/branded-fab.d.ts +53 -0
  62. package/fab/branded-fab.js +56 -0
  63. package/fab/branded-fab.js.map +1 -0
  64. package/fab/fab.d.ts +25 -5
  65. package/fab/fab.js +27 -10
  66. package/fab/fab.js.map +1 -1
  67. package/fab/harness.d.ts +1 -2
  68. package/fab/harness.js +1 -1
  69. package/fab/harness.js.map +1 -1
  70. package/fab/lib/_fab-branded.scss +27 -0
  71. package/fab/lib/_fab.scss +144 -16
  72. package/fab/lib/_shared.scss +155 -130
  73. package/fab/lib/fab-branded-styles.css.js +9 -0
  74. package/fab/lib/fab-branded-styles.css.js.map +1 -0
  75. package/fab/lib/fab-branded-styles.scss +10 -0
  76. package/fab/lib/fab-styles.css.js +1 -1
  77. package/fab/lib/fab-styles.css.js.map +1 -1
  78. package/fab/lib/fab.d.ts +14 -10
  79. package/fab/lib/fab.js +19 -12
  80. package/fab/lib/fab.js.map +1 -1
  81. package/fab/lib/forced-colors-styles.css.d.ts +1 -0
  82. package/fab/lib/forced-colors-styles.css.js +9 -0
  83. package/fab/lib/forced-colors-styles.css.js.map +1 -0
  84. package/fab/lib/forced-colors-styles.scss +26 -0
  85. package/fab/lib/shared-styles.css.d.ts +1 -0
  86. package/fab/lib/shared-styles.css.js +9 -0
  87. package/fab/lib/shared-styles.css.js.map +1 -0
  88. package/fab/lib/{fab-shared-styles.scss → shared-styles.scss} +1 -1
  89. package/fab/lib/{fab-shared.d.ts → shared.d.ts} +24 -16
  90. package/fab/lib/shared.js +137 -0
  91. package/fab/lib/shared.js.map +1 -0
  92. package/field/lib/field.js +14 -27
  93. package/field/lib/field.js.map +1 -1
  94. package/focus/focus-ring.d.ts +0 -1
  95. package/focus/focus-ring.js +0 -1
  96. package/focus/focus-ring.js.map +1 -1
  97. package/focus/lib/focus-ring.js +2 -3
  98. package/focus/lib/focus-ring.js.map +1 -1
  99. package/focus/strong-focus.js +5 -0
  100. package/focus/strong-focus.js.map +1 -1
  101. package/icon/icon.d.ts +0 -1
  102. package/icon/icon.js +0 -1
  103. package/icon/icon.js.map +1 -1
  104. package/icon/lib/_icon.scss +2 -0
  105. package/icon/lib/icon-styles.css.js +1 -1
  106. package/icon/lib/icon-styles.css.js.map +1 -1
  107. package/icon/lib/icon.d.ts +5 -4
  108. package/icon/lib/icon.js +3 -2
  109. package/icon/lib/icon.js.map +1 -1
  110. package/iconbutton/lib/icon-button.d.ts +0 -4
  111. package/iconbutton/lib/icon-button.js +28 -48
  112. package/iconbutton/lib/icon-button.js.map +1 -1
  113. package/linearprogress/_linear-progress.scss +6 -0
  114. package/linearprogress/harness.d.ts +13 -0
  115. package/linearprogress/harness.js +18 -0
  116. package/linearprogress/harness.js.map +1 -0
  117. package/linearprogress/lib/_linear-progress.scss +380 -0
  118. package/linearprogress/lib/linear-progress-styles.css.d.ts +1 -0
  119. package/linearprogress/lib/linear-progress-styles.css.js +9 -0
  120. package/linearprogress/lib/linear-progress-styles.css.js.map +1 -0
  121. package/linearprogress/lib/linear-progress-styles.scss +8 -0
  122. package/linearprogress/lib/linear-progress.d.ts +35 -0
  123. package/linearprogress/lib/linear-progress.js +127 -0
  124. package/linearprogress/lib/linear-progress.js.map +1 -0
  125. package/linearprogress/linear-progress.d.ts +23 -0
  126. package/linearprogress/linear-progress.js +26 -0
  127. package/linearprogress/linear-progress.js.map +1 -0
  128. package/list/lib/_list.scss +6 -49
  129. package/list/lib/list-styles.css.js +1 -1
  130. package/list/lib/list-styles.css.js.map +1 -1
  131. package/list/lib/list.d.ts +1 -3
  132. package/list/lib/list.js +18 -34
  133. package/list/lib/list.js.map +1 -1
  134. package/list/lib/listitem/_list-item.scss +10 -69
  135. package/list/lib/listitem/forced-colors-styles.css.js +1 -1
  136. package/list/lib/listitem/forced-colors-styles.css.js.map +1 -1
  137. package/list/lib/listitem/list-item-styles.css.js +1 -1
  138. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  139. package/list/lib/listitem/list-item.d.ts +2 -4
  140. package/list/lib/listitem/list-item.js +24 -53
  141. package/list/lib/listitem/list-item.js.map +1 -1
  142. package/list/lib/listitemlink/list-item-link.js +4 -6
  143. package/list/lib/listitemlink/list-item-link.js.map +1 -1
  144. package/menu/lib/_menu.scss +6 -28
  145. package/menu/lib/menu-styles.css.js +1 -1
  146. package/menu/lib/menu-styles.css.js.map +1 -1
  147. package/menu/lib/menu.d.ts +1 -2
  148. package/menu/lib/menu.js +38 -63
  149. package/menu/lib/menu.js.map +1 -1
  150. package/menu/lib/menuitem/_menu-item.scss +13 -32
  151. package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
  152. package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
  153. package/menu/lib/menuitem/menu-item.d.ts +1 -1
  154. package/menu/lib/menuitem/menu-item.js +4 -6
  155. package/menu/lib/menuitem/menu-item.js.map +1 -1
  156. package/menu/lib/menuitemlink/menu-item-link.d.ts +0 -2
  157. package/menu/lib/menuitemlink/menu-item-link.js +3 -6
  158. package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
  159. package/menu/lib/shared.d.ts +6 -2
  160. package/menu/lib/shared.js.map +1 -1
  161. package/menu/lib/submenuitem/sub-menu-item.d.ts +0 -2
  162. package/menu/lib/submenuitem/sub-menu-item.js +7 -15
  163. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  164. package/navigationbar/lib/_navigation-bar.scss +7 -1
  165. package/navigationbar/lib/navigation-bar-styles.css.js +1 -1
  166. package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -1
  167. package/navigationbar/lib/navigation-bar.d.ts +5 -5
  168. package/navigationbar/lib/navigation-bar.js +17 -18
  169. package/navigationbar/lib/navigation-bar.js.map +1 -1
  170. package/navigationbar/navigation-bar.d.ts +0 -1
  171. package/navigationbar/navigation-bar.js +0 -1
  172. package/navigationbar/navigation-bar.js.map +1 -1
  173. package/navigationdrawer/lib/navigation-drawer-modal.d.ts +5 -10
  174. package/navigationdrawer/lib/navigation-drawer-modal.js +19 -41
  175. package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
  176. package/navigationdrawer/lib/navigation-drawer.d.ts +5 -9
  177. package/navigationdrawer/lib/navigation-drawer.js +17 -38
  178. package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
  179. package/navigationdrawer/navigation-drawer-modal.d.ts +0 -1
  180. package/navigationdrawer/navigation-drawer-modal.js +0 -1
  181. package/navigationdrawer/navigation-drawer-modal.js.map +1 -1
  182. package/navigationdrawer/navigation-drawer.d.ts +0 -1
  183. package/navigationdrawer/navigation-drawer.js +0 -1
  184. package/navigationdrawer/navigation-drawer.js.map +1 -1
  185. package/navigationtab/lib/navigation-tab.d.ts +19 -24
  186. package/navigationtab/lib/navigation-tab.js +48 -68
  187. package/navigationtab/lib/navigation-tab.js.map +1 -1
  188. package/navigationtab/navigation-tab.d.ts +0 -1
  189. package/navigationtab/navigation-tab.js +0 -1
  190. package/navigationtab/navigation-tab.js.map +1 -1
  191. package/package.json +1 -1
  192. package/radio/lib/radio.d.ts +0 -1
  193. package/radio/lib/radio.js +30 -37
  194. package/radio/lib/radio.js.map +1 -1
  195. package/ripple/lib/ripple.js +7 -13
  196. package/ripple/lib/ripple.js.map +1 -1
  197. package/segmentedbutton/lib/outlined-segmented-button.d.ts +16 -7
  198. package/segmentedbutton/lib/outlined-segmented-button.js +3 -3
  199. package/segmentedbutton/lib/outlined-segmented-button.js.map +1 -1
  200. package/segmentedbutton/lib/segmented-button.d.ts +27 -33
  201. package/segmentedbutton/lib/segmented-button.js +42 -75
  202. package/segmentedbutton/lib/segmented-button.js.map +1 -1
  203. package/segmentedbutton/outlined-segmented-button.d.ts +0 -1
  204. package/segmentedbutton/outlined-segmented-button.js +0 -1
  205. package/segmentedbutton/outlined-segmented-button.js.map +1 -1
  206. package/segmentedbuttonset/lib/outlined-segmented-button-set.d.ts +6 -4
  207. package/segmentedbuttonset/lib/outlined-segmented-button-set.js +3 -2
  208. package/segmentedbuttonset/lib/outlined-segmented-button-set.js.map +1 -1
  209. package/segmentedbuttonset/lib/segmented-button-set.d.ts +3 -9
  210. package/segmentedbuttonset/lib/segmented-button-set.js +14 -20
  211. package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
  212. package/segmentedbuttonset/outlined-segmented-button-set.d.ts +0 -1
  213. package/segmentedbuttonset/outlined-segmented-button-set.js +0 -1
  214. package/segmentedbuttonset/outlined-segmented-button-set.js.map +1 -1
  215. package/select/_filled-select.scss +6 -0
  216. package/select/_outlined-select.scss +6 -0
  217. package/select/filled-select.d.ts +41 -0
  218. package/select/filled-select.js +46 -0
  219. package/select/filled-select.js.map +1 -0
  220. package/select/harness.d.ts +24 -0
  221. package/select/harness.js +53 -0
  222. package/select/harness.js.map +1 -0
  223. package/select/lib/_filled-select.scss +163 -0
  224. package/select/lib/_outlined-select.scss +146 -0
  225. package/select/lib/_shared.scss +48 -0
  226. package/select/lib/filled-forced-colors-styles.css.d.ts +1 -0
  227. package/select/lib/filled-forced-colors-styles.css.js +9 -0
  228. package/select/lib/filled-forced-colors-styles.css.js.map +1 -0
  229. package/select/lib/filled-forced-colors-styles.scss +29 -0
  230. package/select/lib/filled-select-styles.css.d.ts +1 -0
  231. package/select/lib/filled-select-styles.css.js +9 -0
  232. package/select/lib/filled-select-styles.css.js.map +1 -0
  233. package/select/lib/filled-select-styles.scss +10 -0
  234. package/select/lib/filled-select.d.ts +10 -0
  235. package/select/lib/filled-select.js +16 -0
  236. package/select/lib/filled-select.js.map +1 -0
  237. package/select/lib/outlined-forced-colors-styles.css.d.ts +1 -0
  238. package/select/lib/outlined-forced-colors-styles.css.js +9 -0
  239. package/select/lib/outlined-forced-colors-styles.css.js.map +1 -0
  240. package/select/lib/outlined-forced-colors-styles.scss +29 -0
  241. package/select/lib/outlined-select-styles.css.d.ts +1 -0
  242. package/select/lib/outlined-select-styles.css.js +9 -0
  243. package/select/lib/outlined-select-styles.css.js.map +1 -0
  244. package/select/lib/outlined-select-styles.scss +10 -0
  245. package/select/lib/outlined-select.d.ts +10 -0
  246. package/select/lib/outlined-select.js +16 -0
  247. package/select/lib/outlined-select.js.map +1 -0
  248. package/select/lib/select.d.ts +218 -0
  249. package/select/lib/select.js +587 -0
  250. package/select/lib/select.js.map +1 -0
  251. package/select/lib/selectoption/harness.d.ts +11 -0
  252. package/select/lib/selectoption/harness.js +12 -0
  253. package/select/lib/selectoption/harness.js.map +1 -0
  254. package/select/lib/selectoption/select-option.d.ts +30 -0
  255. package/select/lib/selectoption/select-option.js +71 -0
  256. package/select/lib/selectoption/select-option.js.map +1 -0
  257. package/select/lib/shared-styles.css.d.ts +1 -0
  258. package/select/lib/shared-styles.css.js +9 -0
  259. package/select/lib/shared-styles.css.js.map +1 -0
  260. package/select/lib/shared-styles.scss +10 -0
  261. package/select/lib/shared.d.ts +52 -0
  262. package/select/lib/shared.js +41 -0
  263. package/select/lib/shared.js.map +1 -0
  264. package/select/outlined-select.d.ts +41 -0
  265. package/select/outlined-select.js +46 -0
  266. package/select/outlined-select.js.map +1 -0
  267. package/select/select-option.d.ts +44 -0
  268. package/select/select-option.js +51 -0
  269. package/select/select-option.js.map +1 -0
  270. package/slider/harness.d.ts +1 -0
  271. package/slider/harness.js +5 -0
  272. package/slider/harness.js.map +1 -1
  273. package/slider/lib/_slider.scss +146 -164
  274. package/slider/lib/forced-colors-styles.css.js +1 -1
  275. package/slider/lib/forced-colors-styles.css.js.map +1 -1
  276. package/slider/lib/forced-colors-styles.scss +2 -2
  277. package/slider/lib/slider-styles.css.js +1 -1
  278. package/slider/lib/slider-styles.css.js.map +1 -1
  279. package/slider/lib/slider.d.ts +2 -7
  280. package/slider/lib/slider.js +64 -118
  281. package/slider/lib/slider.js.map +1 -1
  282. package/switch/lib/switch.d.ts +0 -2
  283. package/switch/lib/switch.js +32 -54
  284. package/switch/lib/switch.js.map +1 -1
  285. package/textfield/lib/text-field.d.ts +0 -10
  286. package/textfield/lib/text-field.js +45 -115
  287. package/textfield/lib/text-field.js.map +1 -1
  288. package/tokens/_index.scss +3 -0
  289. package/tokens/_md-comp-assist-chip.scss +25 -20
  290. package/tokens/_md-comp-elevation.scss +0 -4
  291. package/tokens/_md-comp-fab-branded.scss +109 -1
  292. package/tokens/_md-comp-fab.scss +290 -0
  293. package/tokens/_md-comp-filled-select.scss +150 -1
  294. package/tokens/_md-comp-filter-chip.scss +103 -93
  295. package/tokens/_md-comp-input-chip.scss +77 -85
  296. package/tokens/_md-comp-linear-progress-indicator.scss +14 -1
  297. package/tokens/_md-comp-list-item.scss +201 -0
  298. package/tokens/_md-comp-list.scss +107 -26
  299. package/tokens/_md-comp-menu-item.scss +76 -0
  300. package/tokens/_md-comp-menu.scss +52 -2
  301. package/tokens/_md-comp-outlined-select.scss +150 -1
  302. package/tokens/_md-comp-slider.scss +13 -1
  303. package/tokens/_md-comp-suggestion-chip.scss +29 -21
  304. package/tokens/_values.scss +5 -2
  305. package/types/aria.d.ts +61 -1
  306. package/actionelement/action-element.d.ts +0 -79
  307. package/actionelement/action-element.js +0 -97
  308. package/actionelement/action-element.js.map +0 -1
  309. package/button/lib/state.d.ts +0 -10
  310. package/button/lib/state.js +0 -7
  311. package/button/lib/state.js.map +0 -1
  312. package/controller/action-controller.d.ts +0 -147
  313. package/controller/action-controller.js +0 -286
  314. package/controller/action-controller.js.map +0 -1
  315. package/decorators/aria-property.d.ts +0 -32
  316. package/decorators/aria-property.js +0 -99
  317. package/decorators/aria-property.js.map +0 -1
  318. package/fab/_fab-extended.scss +0 -6
  319. package/fab/fab-extended.d.ts +0 -23
  320. package/fab/fab-extended.js +0 -29
  321. package/fab/fab-extended.js.map +0 -1
  322. package/fab/lib/_fab-extended.scss +0 -73
  323. package/fab/lib/fab-extended-styles.css.js +0 -9
  324. package/fab/lib/fab-extended-styles.css.js.map +0 -1
  325. package/fab/lib/fab-extended.d.ts +0 -19
  326. package/fab/lib/fab-extended.js +0 -28
  327. package/fab/lib/fab-extended.js.map +0 -1
  328. package/fab/lib/fab-shared-styles.css.js +0 -9
  329. package/fab/lib/fab-shared-styles.css.js.map +0 -1
  330. package/fab/lib/fab-shared.js +0 -121
  331. package/fab/lib/fab-shared.js.map +0 -1
  332. package/slider/lib/_tokens.scss +0 -65
  333. /package/{fab/lib/fab-extended-styles.css.d.ts → chips/lib/filter-styles.css.d.ts} +0 -0
  334. /package/fab/lib/{fab-shared-styles.css.d.ts → fab-branded-styles.css.d.ts} +0 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { PropertyValues } from 'lit';
7
+ import { MenuItemEl } from '../../../menu/lib/menuitem/menu-item.js';
8
+ import { ARIARole } from '../../../types/aria.js';
9
+ import { SelectOption } from '../shared.js';
10
+ /**
11
+ * @fires close-menu {CloseMenuEvent} Closes the encapsulating menu on
12
+ * @fires request-selection {RequestSelectionEvent} Requests the parent
13
+ * md-select to select this element (and deselect others if single-selection)
14
+ * when `selected` changed to `true`.
15
+ * @fires request-deselection {RequestDeselectionEvent} Requests the parent
16
+ * md-select to deselect this element when `selected` changed to `false`.
17
+ */
18
+ export declare class SelectOptionEl extends MenuItemEl implements SelectOption {
19
+ /**
20
+ * Form value of the option.
21
+ */
22
+ value: string;
23
+ /**
24
+ * Whether or not this option is selected.
25
+ */
26
+ selected: boolean;
27
+ protected readonly listItemRole: ARIARole;
28
+ willUpdate(changed: PropertyValues<this>): void;
29
+ updated(changed: PropertyValues<this>): void;
30
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { property } from 'lit/decorators.js';
8
+ import { MenuItemEl } from '../../../menu/lib/menuitem/menu-item.js';
9
+ import { RequestDeselectionEvent, RequestSelectionEvent } from '../shared.js';
10
+ /**
11
+ * @fires close-menu {CloseMenuEvent} Closes the encapsulating menu on
12
+ * @fires request-selection {RequestSelectionEvent} Requests the parent
13
+ * md-select to select this element (and deselect others if single-selection)
14
+ * when `selected` changed to `true`.
15
+ * @fires request-deselection {RequestDeselectionEvent} Requests the parent
16
+ * md-select to deselect this element when `selected` changed to `false`.
17
+ */
18
+ export class SelectOptionEl extends MenuItemEl {
19
+ constructor() {
20
+ super(...arguments);
21
+ /**
22
+ * Form value of the option.
23
+ */
24
+ this.value = '';
25
+ /**
26
+ * Whether or not this option is selected.
27
+ */
28
+ this.selected = false;
29
+ this.listItemRole = 'option';
30
+ }
31
+ willUpdate(changed) {
32
+ if (changed.has('selected')) {
33
+ // Synchronize selected -> active but not the other way around because
34
+ // active is used for keyboard navigation and doesn't mean the option
35
+ // should be selected if active.
36
+ this.active = this.selected;
37
+ this.ariaSelected = this.selected ? 'true' : 'false';
38
+ // By default active = true focuses the element. We want to prevent that
39
+ // in this case because we set active = this.selected and that may mess
40
+ // around with menu's restore focus function once the menu closes.
41
+ this.focusOnActivation = false;
42
+ }
43
+ super.willUpdate(changed);
44
+ }
45
+ updated(changed) {
46
+ super.updated(changed);
47
+ // Restore the active = true focusing behavior which happens in
48
+ // super.updated() if it was turned off.
49
+ this.focusOnActivation = true;
50
+ // Do not dispatch event on first update / boot-up.
51
+ if (changed.has('selected') && changed.get('selected') !== undefined) {
52
+ // This section is really useful for when the user sets selected on the
53
+ // option programmatically. Most other cases (click and keyboard) are
54
+ // handled by md-select because it needs to coordinate the
55
+ // single-selection behavior.
56
+ if (this.selected) {
57
+ this.dispatchEvent(new RequestSelectionEvent());
58
+ }
59
+ else {
60
+ this.dispatchEvent(new RequestDeselectionEvent());
61
+ }
62
+ }
63
+ }
64
+ }
65
+ __decorate([
66
+ property()
67
+ ], SelectOptionEl.prototype, "value", void 0);
68
+ __decorate([
69
+ property({ type: Boolean, reflect: true })
70
+ ], SelectOptionEl.prototype, "selected", void 0);
71
+ //# sourceMappingURL=select-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option.js","sourceRoot":"","sources":["select-option.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAGH,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAEnE,OAAO,EAAC,uBAAuB,EAAE,qBAAqB,EAAe,MAAM,cAAc,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QACE;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QAEvB;;WAEG;QACuC,aAAQ,GAAG,KAAK,CAAC;QAE/B,iBAAY,GAAa,QAAQ,CAAC;IAqChE,CAAC;IAnCU,UAAU,CAAC,OAA6B;QAC/C,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC3B,sEAAsE;YACtE,qEAAqE;YACrE,gCAAgC;YAChC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YACrD,wEAAwE;YACxE,uEAAuE;YACvE,kEAAkE;YAClE,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;SAChC;QAED,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEQ,OAAO,CAAC,OAA6B;QAC5C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,+DAA+D;QAC/D,wCAAwC;QACxC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAE9B,mDAAmD;QACnD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YACpE,uEAAuE;YACvE,qEAAqE;YACrE,0DAA0D;YAC1D,6BAA6B;YAC7B,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,IAAI,CAAC,aAAa,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;aACjD;iBAAM;gBACL,IAAI,CAAC,aAAa,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;aACnD;SACF;IACH,CAAC;CACF;AA5Ca;IAAX,QAAQ,EAAE;6CAAY;AAKmB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;gDAAkB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {PropertyValues} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {MenuItemEl} from '../../../menu/lib/menuitem/menu-item.js';\nimport {ARIARole} from '../../../types/aria.js';\nimport {RequestDeselectionEvent, RequestSelectionEvent, SelectOption} from '../shared.js';\n\n/**\n * @fires close-menu {CloseMenuEvent} Closes the encapsulating menu on\n * @fires request-selection {RequestSelectionEvent} Requests the parent\n * md-select to select this element (and deselect others if single-selection)\n * when `selected` changed to `true`.\n * @fires request-deselection {RequestDeselectionEvent} Requests the parent\n * md-select to deselect this element when `selected` changed to `false`.\n */\nexport class SelectOptionEl extends MenuItemEl implements SelectOption {\n /**\n * Form value of the option.\n */\n @property() value = '';\n\n /**\n * Whether or not this option is selected.\n */\n @property({type: Boolean, reflect: true}) selected = false;\n\n protected override readonly listItemRole: ARIARole = 'option';\n\n override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('selected')) {\n // Synchronize selected -> active but not the other way around because\n // active is used for keyboard navigation and doesn't mean the option\n // should be selected if active.\n this.active = this.selected;\n this.ariaSelected = this.selected ? 'true' : 'false';\n // By default active = true focuses the element. We want to prevent that\n // in this case because we set active = this.selected and that may mess\n // around with menu's restore focus function once the menu closes.\n this.focusOnActivation = false;\n }\n\n super.willUpdate(changed);\n }\n\n override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n // Restore the active = true focusing behavior which happens in\n // super.updated() if it was turned off.\n this.focusOnActivation = true;\n\n // Do not dispatch event on first update / boot-up.\n if (changed.has('selected') && changed.get('selected') !== undefined) {\n // This section is really useful for when the user sets selected on the\n // option programmatically. Most other cases (click and keyboard) are\n // handled by md-select because it needs to coordinate the\n // single-selection behavior.\n if (this.selected) {\n this.dispatchEvent(new RequestSelectionEvent());\n } else {\n this.dispatchEvent(new RequestDeselectionEvent());\n }\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { css } from 'lit';
7
+ export const styles = css `:host{color:unset;min-width:210px}.field{cursor:default;outline:none}.select{position:relative}.field,.select{min-width:inherit}:host{display:inline-flex}.label{width:100%}:host([disabled]){pointer-events:none}/*# sourceMappingURL=shared-styles.css.map */
8
+ `;
9
+ //# sourceMappingURL=shared-styles.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{color:unset;min-width:210px}.field{cursor:default;outline:none}.select{position:relative}.field,.select{min-width:inherit}:host{display:inline-flex}.label{width:100%}:host([disabled]){pointer-events:none}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2023 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ // go/keep-sorted start
7
+ @use './shared';
8
+ // go/keep-sorted end
9
+
10
+ @include shared.styles();
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { MenuItem } from '../../menu/lib/shared.js';
7
+ /**
8
+ * The interface specific to a Select Option
9
+ */
10
+ interface SelectOptionSelf {
11
+ /**
12
+ * The form value associated with the Select Option. (Note: the visual portion
13
+ * of the SelectOption is the headline defined in ListItem)
14
+ */
15
+ value: string;
16
+ /**
17
+ * Whether or not the SelectOption is selected.
18
+ */
19
+ selected: boolean;
20
+ }
21
+ /**
22
+ * The interface to implement for a select option. Additionally, the element
23
+ * must have `md-list-item` and `md-menu-item` attributes on the host.
24
+ */
25
+ export type SelectOption = SelectOptionSelf & MenuItem;
26
+ /**
27
+ * A type that describes a SelectOption and its index.
28
+ */
29
+ export type SelectOptionRecord = [SelectOption, number];
30
+ /**
31
+ * Given a list of select options, this function will return an array of
32
+ * SelectOptionRecords that are selected.
33
+ *
34
+ * @return An array of SelectOptionRecords describing the options that are
35
+ * selected.
36
+ */
37
+ export declare function getSelectedItems(items: SelectOption[]): SelectOptionRecord[];
38
+ /**
39
+ * An event fired by a SelectOption to request selection from md-select.
40
+ * Typically fired after `selected` changes from `false` to `true`.
41
+ */
42
+ export declare class RequestSelectionEvent extends Event {
43
+ constructor();
44
+ }
45
+ /**
46
+ * An event fired by a SelectOption to request deselection from md-select.
47
+ * Typically fired after `selected` changes from `true` to `false`.
48
+ */
49
+ export declare class RequestDeselectionEvent extends Event {
50
+ constructor();
51
+ }
52
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Given a list of select options, this function will return an array of
8
+ * SelectOptionRecords that are selected.
9
+ *
10
+ * @return An array of SelectOptionRecords describing the options that are
11
+ * selected.
12
+ */
13
+ export function getSelectedItems(items) {
14
+ const selectedItemRecords = [];
15
+ for (let i = 0; i < items.length; i++) {
16
+ const item = items[i];
17
+ if (item.selected) {
18
+ selectedItemRecords.push([item, i]);
19
+ }
20
+ }
21
+ return selectedItemRecords;
22
+ }
23
+ /**
24
+ * An event fired by a SelectOption to request selection from md-select.
25
+ * Typically fired after `selected` changes from `false` to `true`.
26
+ */
27
+ export class RequestSelectionEvent extends Event {
28
+ constructor() {
29
+ super('request-selection', { bubbles: true, composed: true });
30
+ }
31
+ }
32
+ /**
33
+ * An event fired by a SelectOption to request deselection from md-select.
34
+ * Typically fired after `selected` changes from `true` to `false`.
35
+ */
36
+ export class RequestDeselectionEvent extends Event {
37
+ constructor() {
38
+ super('request-deselection', { bubbles: true, composed: true });
39
+ }
40
+ }
41
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8BH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,MAAM,mBAAmB,GAAyB,EAAE,CAAC;IAErD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;SACrC;KACF;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,CAAC,mBAAmB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CAAC,qBAAqB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {MenuItem} from '../../menu/lib/shared.js';\n\n/**\n * The interface specific to a Select Option\n */\ninterface SelectOptionSelf {\n /**\n * The form value associated with the Select Option. (Note: the visual portion\n * of the SelectOption is the headline defined in ListItem)\n */\n value: string;\n /**\n * Whether or not the SelectOption is selected.\n */\n selected: boolean;\n}\n\n/**\n * The interface to implement for a select option. Additionally, the element\n * must have `md-list-item` and `md-menu-item` attributes on the host.\n */\nexport type SelectOption = SelectOptionSelf&MenuItem;\n\n/**\n * A type that describes a SelectOption and its index.\n */\nexport type SelectOptionRecord = [SelectOption, number];\n\n/**\n * Given a list of select options, this function will return an array of\n * SelectOptionRecords that are selected.\n * \n * @return An array of SelectOptionRecords describing the options that are\n * selected.\n */\nexport function getSelectedItems(items: SelectOption[]) {\n const selectedItemRecords: SelectOptionRecord[] = [];\n\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.selected) {\n selectedItemRecords.push([item, i]);\n }\n }\n\n return selectedItemRecords;\n}\n\n/**\n * An event fired by a SelectOption to request selection from md-select.\n * Typically fired after `selected` changes from `false` to `true`.\n */\nexport class RequestSelectionEvent extends Event {\n constructor() {\n super('request-selection', {bubbles: true, composed: true});\n }\n}\n\n/**\n * An event fired by a SelectOption to request deselection from md-select.\n * Typically fired after `selected` changes from `true` to `false`.\n */\nexport class RequestDeselectionEvent extends Event {\n constructor() {\n super('request-deselection', {bubbles: true, composed: true});\n }\n}\n"]}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OutlinedSelect } from './lib/outlined-select.js';
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'md-outlined-select': MdOutlinedSelect;
10
+ }
11
+ }
12
+ /**
13
+ * @summary
14
+ * Select menus display a list of choices on temporary surfaces and display the
15
+ * currently selected menu item above the menu.
16
+ *
17
+ * @description
18
+ * The select component allows users to choose a value from a fixed list of
19
+ * available options. Composed of an interactive anchor button and a menu, it is
20
+ * analogous to the native HTML `<select>` element. This is the "outlined"
21
+ * variant.
22
+ *
23
+ * @example
24
+ * ```html
25
+ * <md-outlined-select label="fruits">
26
+ * <!-- An empty selected option will give select an "un-filled" state -->
27
+ * <md-select-option selected></md-select-option>
28
+ * <md-select-option value="apple" headline="Apple"></md-select-option>
29
+ * <md-select-option value="banana" headline="Banana"></md-select-option>
30
+ * <md-select-option value="kiwi" headline="Kiwi"></md-select-option>
31
+ * <md-select-option value="orange" headline="Orange"></md-select-option>
32
+ * <md-select-option value="tomato" headline="Tomato"></md-select-option>
33
+ * </md-outlined-select>
34
+ * ```
35
+ *
36
+ * @final
37
+ * @suppress {visibility}
38
+ */
39
+ export declare class MdOutlinedSelect extends OutlinedSelect {
40
+ static styles: import("lit").CSSResult[];
41
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { customElement } from 'lit/decorators.js';
8
+ import { styles as outlinedForcedColorsStyles } from './lib/outlined-forced-colors-styles.css.js';
9
+ import { OutlinedSelect } from './lib/outlined-select.js';
10
+ import { styles } from './lib/outlined-select-styles.css.js';
11
+ import { styles as sharedStyles } from './lib/shared-styles.css.js';
12
+ /**
13
+ * @summary
14
+ * Select menus display a list of choices on temporary surfaces and display the
15
+ * currently selected menu item above the menu.
16
+ *
17
+ * @description
18
+ * The select component allows users to choose a value from a fixed list of
19
+ * available options. Composed of an interactive anchor button and a menu, it is
20
+ * analogous to the native HTML `<select>` element. This is the "outlined"
21
+ * variant.
22
+ *
23
+ * @example
24
+ * ```html
25
+ * <md-outlined-select label="fruits">
26
+ * <!-- An empty selected option will give select an "un-filled" state -->
27
+ * <md-select-option selected></md-select-option>
28
+ * <md-select-option value="apple" headline="Apple"></md-select-option>
29
+ * <md-select-option value="banana" headline="Banana"></md-select-option>
30
+ * <md-select-option value="kiwi" headline="Kiwi"></md-select-option>
31
+ * <md-select-option value="orange" headline="Orange"></md-select-option>
32
+ * <md-select-option value="tomato" headline="Tomato"></md-select-option>
33
+ * </md-outlined-select>
34
+ * ```
35
+ *
36
+ * @final
37
+ * @suppress {visibility}
38
+ */
39
+ let MdOutlinedSelect = class MdOutlinedSelect extends OutlinedSelect {
40
+ };
41
+ MdOutlinedSelect.styles = [sharedStyles, styles, outlinedForcedColorsStyles];
42
+ MdOutlinedSelect = __decorate([
43
+ customElement('md-outlined-select')
44
+ ], MdOutlinedSelect);
45
+ export { MdOutlinedSelect };
46
+ //# sourceMappingURL=outlined-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlined-select.js","sourceRoot":"","sources":["outlined-select.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,MAAM,IAAI,0BAA0B,EAAC,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAC,MAAM,EAAC,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAQlE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,cAAc;;AAClC,uBAAM,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,0BAA0B,CAAC,CAAC;AADjE,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAE5B;SAFY,gBAAgB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {styles as outlinedForcedColorsStyles} from './lib/outlined-forced-colors-styles.css.js';\nimport {OutlinedSelect} from './lib/outlined-select.js';\nimport {styles} from './lib/outlined-select-styles.css.js';\nimport {styles as sharedStyles} from './lib/shared-styles.css.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-outlined-select': MdOutlinedSelect;\n }\n}\n\n/**\n * @summary\n * Select menus display a list of choices on temporary surfaces and display the\n * currently selected menu item above the menu.\n *\n * @description\n * The select component allows users to choose a value from a fixed list of\n * available options. Composed of an interactive anchor button and a menu, it is\n * analogous to the native HTML `<select>` element. This is the \"outlined\"\n * variant.\n *\n * @example\n * ```html\n * <md-outlined-select label=\"fruits\">\n * <!-- An empty selected option will give select an \"un-filled\" state -->\n * <md-select-option selected></md-select-option>\n * <md-select-option value=\"apple\" headline=\"Apple\"></md-select-option>\n * <md-select-option value=\"banana\" headline=\"Banana\"></md-select-option>\n * <md-select-option value=\"kiwi\" headline=\"Kiwi\"></md-select-option>\n * <md-select-option value=\"orange\" headline=\"Orange\"></md-select-option>\n * <md-select-option value=\"tomato\" headline=\"Tomato\"></md-select-option>\n * </md-outlined-select>\n * ```\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-outlined-select')\nexport class MdOutlinedSelect extends OutlinedSelect {\n static override styles = [sharedStyles, styles, outlinedForcedColorsStyles];\n}\n"]}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { SelectOptionEl } from './lib/selectoption/select-option.js';
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'md-select-option': MdSelectOption;
10
+ }
11
+ }
12
+ /**
13
+ * @summary
14
+ * Select menus display a list of choices on temporary surfaces and display the
15
+ * currently selected menu item above the menu.
16
+ *
17
+ * @description
18
+ * The select component allows users to choose a value from a fixed list of
19
+ * available options. Composed of an interactive anchor button and a menu, it is
20
+ * analogous to the native HTML `<select>` element. This is the option that
21
+ * can be placed inside of an md-select.
22
+ *
23
+ * This component is a subclass of `md-menu-item` and can accept the same slots,
24
+ * properties, and events as `md-menu-item`.
25
+ *
26
+ * @example
27
+ * ```html
28
+ * <md-outlined-select label="fruits">
29
+ * <!-- An empty selected option will give select an "un-filled" state -->
30
+ * <md-select-option selected></md-select-option>
31
+ * <md-select-option value="apple" headline="Apple"></md-select-option>
32
+ * <md-select-option value="banana" headline="Banana"></md-select-option>
33
+ * <md-select-option value="kiwi" headline="Kiwi"></md-select-option>
34
+ * <md-select-option value="orange" headline="Orange"></md-select-option>
35
+ * <md-select-option value="tomato" headline="Tomato"></md-select-option>
36
+ * </md-outlined-select>
37
+ * ```
38
+ *
39
+ * @final
40
+ * @suppress {visibility}
41
+ */
42
+ export declare class MdSelectOption extends SelectOptionEl {
43
+ static styles: import("lit").CSSResult[];
44
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { customElement } from 'lit/decorators.js';
8
+ import { styles as listItemForcedColorsStyles } from '../list/lib/listitem/forced-colors-styles.css.js';
9
+ import { styles as listItemStyles } from '../list/lib/listitem/list-item-styles.css.js';
10
+ import { styles as forcedColorsStyles } from '../menu/lib/menuitem/forced-colors-styles.css.js';
11
+ import { styles } from '../menu/lib/menuitem/menu-item-styles.css.js';
12
+ // TODO(b/236285090): update with HCM best practices
13
+ import { SelectOptionEl } from './lib/selectoption/select-option.js';
14
+ /**
15
+ * @summary
16
+ * Select menus display a list of choices on temporary surfaces and display the
17
+ * currently selected menu item above the menu.
18
+ *
19
+ * @description
20
+ * The select component allows users to choose a value from a fixed list of
21
+ * available options. Composed of an interactive anchor button and a menu, it is
22
+ * analogous to the native HTML `<select>` element. This is the option that
23
+ * can be placed inside of an md-select.
24
+ *
25
+ * This component is a subclass of `md-menu-item` and can accept the same slots,
26
+ * properties, and events as `md-menu-item`.
27
+ *
28
+ * @example
29
+ * ```html
30
+ * <md-outlined-select label="fruits">
31
+ * <!-- An empty selected option will give select an "un-filled" state -->
32
+ * <md-select-option selected></md-select-option>
33
+ * <md-select-option value="apple" headline="Apple"></md-select-option>
34
+ * <md-select-option value="banana" headline="Banana"></md-select-option>
35
+ * <md-select-option value="kiwi" headline="Kiwi"></md-select-option>
36
+ * <md-select-option value="orange" headline="Orange"></md-select-option>
37
+ * <md-select-option value="tomato" headline="Tomato"></md-select-option>
38
+ * </md-outlined-select>
39
+ * ```
40
+ *
41
+ * @final
42
+ * @suppress {visibility}
43
+ */
44
+ let MdSelectOption = class MdSelectOption extends SelectOptionEl {
45
+ };
46
+ MdSelectOption.styles = [listItemStyles, styles, listItemForcedColorsStyles, forcedColorsStyles];
47
+ MdSelectOption = __decorate([
48
+ customElement('md-select-option')
49
+ ], MdSelectOption);
50
+ export { MdSelectOption };
51
+ //# sourceMappingURL=select-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option.js","sourceRoot":"","sources":["select-option.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,MAAM,IAAI,0BAA0B,EAAC,MAAM,kDAAkD,CAAC;AACtG,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAC,MAAM,IAAI,kBAAkB,EAAC,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAC,MAAM,EAAC,MAAM,8CAA8C,CAAC;AAEpE,oDAAoD;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,qCAAqC,CAAC;AAQnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,cAAc;;AAChC,qBAAM,GAClB,CAAC,cAAc,EAAE,MAAM,EAAE,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAFlE,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAG1B;SAHY,cAAc","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {styles as listItemForcedColorsStyles} from '../list/lib/listitem/forced-colors-styles.css.js';\nimport {styles as listItemStyles} from '../list/lib/listitem/list-item-styles.css.js';\nimport {styles as forcedColorsStyles} from '../menu/lib/menuitem/forced-colors-styles.css.js';\nimport {styles} from '../menu/lib/menuitem/menu-item-styles.css.js';\n\n// TODO(b/236285090): update with HCM best practices\nimport {SelectOptionEl} from './lib/selectoption/select-option.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-select-option': MdSelectOption;\n }\n}\n\n/**\n * @summary\n * Select menus display a list of choices on temporary surfaces and display the\n * currently selected menu item above the menu.\n *\n * @description\n * The select component allows users to choose a value from a fixed list of\n * available options. Composed of an interactive anchor button and a menu, it is\n * analogous to the native HTML `<select>` element. This is the option that\n * can be placed inside of an md-select.\n *\n * This component is a subclass of `md-menu-item` and can accept the same slots,\n * properties, and events as `md-menu-item`.\n *\n * @example\n * ```html\n * <md-outlined-select label=\"fruits\">\n * <!-- An empty selected option will give select an \"un-filled\" state -->\n * <md-select-option selected></md-select-option>\n * <md-select-option value=\"apple\" headline=\"Apple\"></md-select-option>\n * <md-select-option value=\"banana\" headline=\"Banana\"></md-select-option>\n * <md-select-option value=\"kiwi\" headline=\"Kiwi\"></md-select-option>\n * <md-select-option value=\"orange\" headline=\"Orange\"></md-select-option>\n * <md-select-option value=\"tomato\" headline=\"Tomato\"></md-select-option>\n * </md-outlined-select>\n * ```\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-select-option')\nexport class MdSelectOption extends SelectOptionEl {\n static override styles =\n [listItemStyles, styles, listItemForcedColorsStyles, forcedColorsStyles];\n}\n"]}
@@ -17,4 +17,5 @@ export declare class SliderHarness extends Harness<Slider> {
17
17
  simulateValueInteraction(value: number, el?: HTMLInputElement): Promise<void>;
18
18
  private positionEventAtHandle;
19
19
  protected simulateStartHover(element: HTMLElement, init?: PointerEventInit): void;
20
+ protected simulateMousePress(element: HTMLElement, init?: PointerEventInit): void;
20
21
  }
package/slider/harness.js CHANGED
@@ -59,5 +59,10 @@ export class SliderHarness extends Harness {
59
59
  }
60
60
  super.simulateStartHover(element, init);
61
61
  }
62
+ simulateMousePress(element, init = {}) {
63
+ super.simulateMousePress(element, init);
64
+ // advance beyond RAF, which is used by the element's pointerDown handler.
65
+ jasmine.clock().tick(1);
66
+ }
62
67
  }
63
68
  //# sourceMappingURL=harness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAI9C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACvC,KA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\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Slider} from './lib/slider.js';\n\n/**\n * Test harness for slider.\n */\nexport class SliderHarness extends Harness<Slider> {\n override async getInteractiveElement() {\n await this.element.updateComplete;\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return this.element['inputB'];\n }\n\n getInputs() {\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return [this.element['inputB'], this.element['inputA']];\n }\n getHandles() {\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return [this.element['handleB'], this.element['handleA']];\n }\n\n getLabels() {\n return Array.from(this.element.renderRoot.querySelectorAll('.label'));\n }\n\n isLabelShowing() {\n const labels = this.getLabels();\n return labels.some(l => {\n // remove transition to avoid the need to wait for it.\n (l as HTMLElement).style.setProperty('transition', 'none');\n const {width} = l.getBoundingClientRect();\n (l as HTMLElement).style.removeProperty('transition');\n return width > 0;\n });\n }\n\n async simulateValueInteraction(value: number, el?: HTMLInputElement) {\n if (!el) {\n el = (this.getInputs())[0];\n }\n el.focus();\n el.value = String(value);\n el.dispatchEvent(new Event('input', {bubbles: true, composed: true}));\n el.dispatchEvent(new Event('change', {bubbles: true}));\n await this.element.updateComplete;\n }\n\n private positionEventAtHandle(init: PointerEventInit, startHandle = false) {\n const handle = this.getHandles()[startHandle ? 1 : 0];\n const {x, y} = handle.getBoundingClientRect();\n return {...init, clientX: x, clientY: y, screenX: x, screenY: y};\n }\n\n protected override simulateStartHover(\n element: HTMLElement, init: PointerEventInit = {}) {\n const i = this.getInputs().indexOf(element as HTMLInputElement);\n if ((i >= 0) || (element === this.element)) {\n init = this.positionEventAtHandle(init, i === 1);\n }\n super.simulateStartHover(element, init);\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAI9C;;GAEG;AACH,MAAM,OA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,EAAE;QACnD,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACxC,0EAA0E;QAC1E,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Slider} from './lib/slider.js';\n\n/**\n * Test harness for slider.\n */\nexport class SliderHarness extends Harness<Slider> {\n override async getInteractiveElement() {\n await this.element.updateComplete;\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return this.element['inputB'];\n }\n\n getInputs() {\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return [this.element['inputB'], this.element['inputA']];\n }\n getHandles() {\n // Test access to protected property\n // tslint:disable-next-line:no-dict-access-on-struct-type\n return [this.element['handleB'], this.element['handleA']];\n }\n\n getLabels() {\n return Array.from(this.element.renderRoot.querySelectorAll('.label'));\n }\n\n isLabelShowing() {\n const labels = this.getLabels();\n return labels.some(l => {\n // remove transition to avoid the need to wait for it.\n (l as HTMLElement).style.setProperty('transition', 'none');\n const {width} = l.getBoundingClientRect();\n (l as HTMLElement).style.removeProperty('transition');\n return width > 0;\n });\n }\n\n async simulateValueInteraction(value: number, el?: HTMLInputElement) {\n if (!el) {\n el = (this.getInputs())[0];\n }\n el.focus();\n el.value = String(value);\n el.dispatchEvent(new Event('input', {bubbles: true, composed: true}));\n el.dispatchEvent(new Event('change', {bubbles: true}));\n await this.element.updateComplete;\n }\n\n private positionEventAtHandle(init: PointerEventInit, startHandle = false) {\n const handle = this.getHandles()[startHandle ? 1 : 0];\n const {x, y} = handle.getBoundingClientRect();\n return {...init, clientX: x, clientY: y, screenX: x, screenY: y};\n }\n\n protected override simulateStartHover(\n element: HTMLElement, init: PointerEventInit = {}) {\n const i = this.getInputs().indexOf(element as HTMLInputElement);\n if ((i >= 0) || (element === this.element)) {\n init = this.positionEventAtHandle(init, i === 1);\n }\n super.simulateStartHover(element, init);\n }\n\n protected override simulateMousePress(\n element: HTMLElement, init: PointerEventInit = {}) {\n super.simulateMousePress(element, init);\n // advance beyond RAF, which is used by the element's pointerDown handler.\n jasmine.clock().tick(1);\n }\n}\n"]}