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

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 (321) hide show
  1. package/README.md +3 -3
  2. package/aria/aria.js +37 -13
  3. package/aria/aria.js.map +1 -1
  4. package/aria/delegate.d.ts +1 -1
  5. package/aria/delegate.js +1 -1
  6. package/aria/delegate.js.map +1 -1
  7. package/badge/lib/badge.d.ts +0 -3
  8. package/badge/lib/badge.js +4 -6
  9. package/badge/lib/badge.js.map +1 -1
  10. package/button/lib/_elevated-button.scss +35 -6
  11. package/button/lib/_filled-button.scss +35 -3
  12. package/button/lib/_outlined-button.scss +35 -6
  13. package/button/lib/_shared.scss +4 -2
  14. package/button/lib/_text-button.scss +35 -6
  15. package/button/lib/_tonal-button.scss +34 -7
  16. package/button/lib/button.d.ts +23 -26
  17. package/button/lib/button.js +12 -30
  18. package/button/lib/button.js.map +1 -1
  19. package/button/lib/elevated-button.d.ts +6 -4
  20. package/button/lib/elevated-button.js.map +1 -1
  21. package/button/lib/elevated-styles.css.js +1 -1
  22. package/button/lib/elevated-styles.css.js.map +1 -1
  23. package/button/lib/filled-button.d.ts +6 -4
  24. package/button/lib/filled-button.js.map +1 -1
  25. package/button/lib/filled-styles.css.js +1 -1
  26. package/button/lib/filled-styles.css.js.map +1 -1
  27. package/button/lib/outlined-button.d.ts +6 -4
  28. package/button/lib/outlined-button.js.map +1 -1
  29. package/button/lib/outlined-styles.css.js +1 -1
  30. package/button/lib/outlined-styles.css.js.map +1 -1
  31. package/button/lib/shared-styles.css.js +1 -1
  32. package/button/lib/shared-styles.css.js.map +1 -1
  33. package/button/lib/text-button.d.ts +5 -2
  34. package/button/lib/text-button.js.map +1 -1
  35. package/button/lib/text-styles.css.js +1 -1
  36. package/button/lib/text-styles.css.js.map +1 -1
  37. package/button/lib/tonal-button.d.ts +6 -4
  38. package/button/lib/tonal-button.js.map +1 -1
  39. package/button/lib/tonal-styles.css.js +1 -1
  40. package/button/lib/tonal-styles.css.js.map +1 -1
  41. package/checkbox/lib/_checkbox.scss +48 -47
  42. package/checkbox/lib/checkbox-styles.css.js +1 -1
  43. package/checkbox/lib/checkbox-styles.css.js.map +1 -1
  44. package/checkbox/lib/checkbox.d.ts +2 -6
  45. package/checkbox/lib/checkbox.js +3 -20
  46. package/checkbox/lib/checkbox.js.map +1 -1
  47. package/checkbox/lib/forced-colors-styles.css.js +1 -1
  48. package/checkbox/lib/forced-colors-styles.css.js.map +1 -1
  49. package/chips/assist-chip.js +2 -1
  50. package/chips/assist-chip.js.map +1 -1
  51. package/chips/filter-chip.js +2 -1
  52. package/chips/filter-chip.js.map +1 -1
  53. package/chips/lib/_assist-chip.scss +37 -3
  54. package/chips/lib/_elevated.scss +60 -0
  55. package/chips/lib/_filter-chip.scss +43 -9
  56. package/chips/lib/_shared.scss +36 -76
  57. package/chips/lib/_suggestion-chip.scss +36 -5
  58. package/chips/lib/assist-chip.d.ts +12 -0
  59. package/chips/lib/assist-chip.js +64 -0
  60. package/chips/lib/assist-chip.js.map +1 -1
  61. package/chips/lib/assist-styles.css.js +1 -1
  62. package/chips/lib/assist-styles.css.js.map +1 -1
  63. package/chips/lib/chip.d.ts +19 -16
  64. package/chips/lib/chip.js +43 -63
  65. package/chips/lib/chip.js.map +1 -1
  66. package/chips/lib/elevated-styles.css.d.ts +1 -0
  67. package/chips/lib/elevated-styles.css.js +9 -0
  68. package/chips/lib/elevated-styles.css.js.map +1 -0
  69. package/chips/lib/elevated-styles.scss +10 -0
  70. package/chips/lib/filter-chip.d.ts +6 -1
  71. package/chips/lib/filter-chip.js +38 -5
  72. package/chips/lib/filter-chip.js.map +1 -1
  73. package/chips/lib/filter-styles.css.js +1 -1
  74. package/chips/lib/filter-styles.css.js.map +1 -1
  75. package/chips/lib/shared-styles.css.js +1 -1
  76. package/chips/lib/shared-styles.css.js.map +1 -1
  77. package/chips/lib/suggestion-chip.d.ts +2 -2
  78. package/chips/lib/suggestion-chip.js +4 -2
  79. package/chips/lib/suggestion-chip.js.map +1 -1
  80. package/chips/lib/suggestion-styles.css.js +1 -1
  81. package/chips/lib/suggestion-styles.css.js.map +1 -1
  82. package/chips/suggestion-chip.js +2 -1
  83. package/chips/suggestion-chip.js.map +1 -1
  84. package/circularprogress/lib/_circular-progress.scss +13 -7
  85. package/circularprogress/lib/circular-progress-styles.css.js +1 -1
  86. package/circularprogress/lib/circular-progress-styles.css.js.map +1 -1
  87. package/circularprogress/lib/circular-progress.d.ts +5 -6
  88. package/circularprogress/lib/circular-progress.js +1 -2
  89. package/circularprogress/lib/circular-progress.js.map +1 -1
  90. package/dialog/lib/_dialog.scss +0 -1
  91. package/dialog/lib/_tokens.scss +0 -1
  92. package/dialog/lib/dialog.d.ts +10 -10
  93. package/dialog/lib/dialog.js +8 -7
  94. package/dialog/lib/dialog.js.map +1 -1
  95. package/elevation/lib/elevation.d.ts +1 -1
  96. package/elevation/lib/elevation.js.map +1 -1
  97. package/fab/branded-fab.d.ts +3 -0
  98. package/fab/lib/_fab-branded.scss +58 -4
  99. package/fab/lib/_fab.scss +80 -6
  100. package/fab/lib/_shared.scss +8 -3
  101. package/fab/lib/fab-branded-styles.css.js +1 -1
  102. package/fab/lib/fab-branded-styles.css.js.map +1 -1
  103. package/fab/lib/fab-styles.css.js +1 -1
  104. package/fab/lib/fab-styles.css.js.map +1 -1
  105. package/fab/lib/fab.d.ts +4 -0
  106. package/fab/lib/forced-colors-styles.css.js +1 -1
  107. package/fab/lib/forced-colors-styles.css.js.map +1 -1
  108. package/fab/lib/shared-styles.css.js +1 -1
  109. package/fab/lib/shared-styles.css.js.map +1 -1
  110. package/fab/lib/shared.d.ts +12 -15
  111. package/fab/lib/shared.js +2 -26
  112. package/fab/lib/shared.js.map +1 -1
  113. package/field/lib/_filled-field.scss +47 -12
  114. package/field/lib/_outlined-field.scss +39 -12
  115. package/field/lib/filled-styles.css.js +1 -1
  116. package/field/lib/filled-styles.css.js.map +1 -1
  117. package/field/lib/outlined-styles.css.js +1 -1
  118. package/field/lib/outlined-styles.css.js.map +1 -1
  119. package/focus/focus-ring.d.ts +2 -0
  120. package/focus/focus-ring.js +2 -0
  121. package/focus/focus-ring.js.map +1 -1
  122. package/focus/lib/_focus-ring.scss +49 -34
  123. package/focus/lib/focus-ring-styles.css.js +1 -1
  124. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  125. package/focus/lib/focus-ring.d.ts +59 -12
  126. package/focus/lib/focus-ring.js +116 -11
  127. package/focus/lib/focus-ring.js.map +1 -1
  128. package/iconbutton/filled-icon-button.d.ts +6 -2
  129. package/iconbutton/filled-icon-button.js.map +1 -1
  130. package/iconbutton/filled-tonal-icon-button.d.ts +6 -2
  131. package/iconbutton/filled-tonal-icon-button.js.map +1 -1
  132. package/iconbutton/harness.d.ts +1 -1
  133. package/iconbutton/harness.js +4 -1
  134. package/iconbutton/harness.js.map +1 -1
  135. package/iconbutton/lib/_filled-icon-button.scss +38 -13
  136. package/iconbutton/lib/_filled-tonal-icon-button.scss +38 -11
  137. package/iconbutton/lib/_outlined-icon-button.scss +38 -13
  138. package/iconbutton/lib/_shared.scss +4 -6
  139. package/iconbutton/lib/_standard-icon-button.scss +14 -14
  140. package/iconbutton/lib/filled-styles.css.js +1 -1
  141. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  142. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  143. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  144. package/iconbutton/lib/icon-button.d.ts +17 -21
  145. package/iconbutton/lib/icon-button.js +12 -28
  146. package/iconbutton/lib/icon-button.js.map +1 -1
  147. package/iconbutton/lib/outlined-styles.css.js +1 -1
  148. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  149. package/iconbutton/lib/shared-styles.css.js +1 -1
  150. package/iconbutton/lib/shared-styles.css.js.map +1 -1
  151. package/iconbutton/lib/standard-styles.css.js +1 -1
  152. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  153. package/iconbutton/outlined-icon-button.d.ts +5 -2
  154. package/iconbutton/outlined-icon-button.js.map +1 -1
  155. package/iconbutton/standard-icon-button.d.ts +5 -2
  156. package/iconbutton/standard-icon-button.js.map +1 -1
  157. package/linearprogress/lib/_linear-progress.scss +78 -72
  158. package/linearprogress/lib/linear-progress.d.ts +5 -5
  159. package/linearprogress/lib/linear-progress.js +1 -1
  160. package/linearprogress/lib/linear-progress.js.map +1 -1
  161. package/list/lib/_list.scss +4 -2
  162. package/list/lib/list.d.ts +7 -12
  163. package/list/lib/list.js +2 -11
  164. package/list/lib/list.js.map +1 -1
  165. package/list/lib/listitem/_list-item.scss +8 -4
  166. package/list/lib/listitem/list-item-styles.css.js +1 -1
  167. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  168. package/list/lib/listitem/list-item.d.ts +27 -27
  169. package/list/lib/listitem/list-item.js +4 -29
  170. package/list/lib/listitem/list-item.js.map +1 -1
  171. package/list/lib/listitemlink/list-item-link.js +1 -3
  172. package/list/lib/listitemlink/list-item-link.js.map +1 -1
  173. package/menu/lib/_menu.scss +4 -2
  174. package/menu/lib/menu-styles.css.js +1 -1
  175. package/menu/lib/menu-styles.css.js.map +1 -1
  176. package/menu/lib/menu.d.ts +31 -39
  177. package/menu/lib/menu.js +14 -20
  178. package/menu/lib/menu.js.map +1 -1
  179. package/menu/lib/menuitem/_menu-item.scss +4 -2
  180. package/menu/lib/shared.d.ts +14 -0
  181. package/menu/lib/shared.js +18 -0
  182. package/menu/lib/shared.js.map +1 -1
  183. package/menu/lib/submenuitem/sub-menu-item.d.ts +16 -11
  184. package/menu/lib/submenuitem/sub-menu-item.js +20 -3
  185. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  186. package/menu/lib/typeaheadController.d.ts +9 -9
  187. package/menu/lib/typeaheadController.js.map +1 -1
  188. package/navigationbar/lib/navigation-bar.d.ts +2 -2
  189. package/navigationbar/lib/navigation-bar.js.map +1 -1
  190. package/navigationdrawer/lib/_navigation-drawer-modal.scss +0 -3
  191. package/navigationdrawer/lib/_navigation-drawer.scss +0 -3
  192. package/navigationdrawer/lib/_shared.scss +1 -4
  193. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +1 -1
  194. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -1
  195. package/navigationdrawer/lib/navigation-drawer-modal.d.ts +3 -3
  196. package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
  197. package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
  198. package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
  199. package/navigationdrawer/lib/navigation-drawer.d.ts +2 -2
  200. package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
  201. package/navigationdrawer/lib/shared-styles.css.js +1 -1
  202. package/navigationdrawer/lib/shared-styles.css.js.map +1 -1
  203. package/navigationtab/lib/_navigation-tab.scss +2 -2
  204. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  205. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  206. package/navigationtab/lib/navigation-tab.d.ts +9 -17
  207. package/navigationtab/lib/navigation-tab.js +3 -22
  208. package/navigationtab/lib/navigation-tab.js.map +1 -1
  209. package/navigationtab/lib/state.d.ts +1 -1
  210. package/navigationtab/lib/state.js.map +1 -1
  211. package/package.json +1 -1
  212. package/radio/lib/_radio.scss +1 -1
  213. package/radio/lib/radio-styles.css.js +1 -1
  214. package/radio/lib/radio-styles.css.js.map +1 -1
  215. package/radio/lib/radio.d.ts +2 -7
  216. package/radio/lib/radio.js +2 -22
  217. package/radio/lib/radio.js.map +1 -1
  218. package/ripple/lib/ripple.js +4 -0
  219. package/ripple/lib/ripple.js.map +1 -1
  220. package/segmentedbutton/lib/segmented-button.d.ts +15 -21
  221. package/segmentedbutton/lib/segmented-button.js +3 -24
  222. package/segmentedbutton/lib/segmented-button.js.map +1 -1
  223. package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +32 -13
  224. package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  225. package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  226. package/segmentedbuttonset/lib/segmented-button-set.d.ts +1 -1
  227. package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
  228. package/select/lib/_filled-select.scss +66 -7
  229. package/select/lib/_outlined-select.scss +41 -7
  230. package/select/lib/filled-select-styles.css.js +1 -1
  231. package/select/lib/filled-select-styles.css.js.map +1 -1
  232. package/select/lib/outlined-select-styles.css.js +1 -1
  233. package/select/lib/outlined-select-styles.css.js.map +1 -1
  234. package/select/lib/select.d.ts +46 -48
  235. package/select/lib/select.js +21 -19
  236. package/select/lib/select.js.map +1 -1
  237. package/slider/harness.d.ts +1 -1
  238. package/slider/harness.js +9 -9
  239. package/slider/harness.js.map +1 -1
  240. package/slider/lib/_slider.scss +6 -6
  241. package/slider/lib/slider-styles.css.js +1 -1
  242. package/slider/lib/slider-styles.css.js.map +1 -1
  243. package/slider/lib/slider.d.ts +22 -51
  244. package/slider/lib/slider.js +18 -54
  245. package/slider/lib/slider.js.map +1 -1
  246. package/switch/lib/_switch.scss +63 -18
  247. package/switch/lib/switch-styles.css.js +1 -1
  248. package/switch/lib/switch-styles.css.js.map +1 -1
  249. package/switch/lib/switch.d.ts +0 -5
  250. package/switch/lib/switch.js +2 -27
  251. package/switch/lib/switch.js.map +1 -1
  252. package/textfield/harness.d.ts +1 -1
  253. package/textfield/harness.js.map +1 -1
  254. package/textfield/lib/_filled-text-field.scss +70 -14
  255. package/textfield/lib/_outlined-text-field.scss +60 -35
  256. package/textfield/lib/filled-forced-colors-styles.css.js +1 -1
  257. package/textfield/lib/filled-forced-colors-styles.css.js.map +1 -1
  258. package/textfield/lib/filled-styles.css.js +1 -1
  259. package/textfield/lib/filled-styles.css.js.map +1 -1
  260. package/textfield/lib/outlined-forced-colors-styles.css.js +1 -1
  261. package/textfield/lib/outlined-forced-colors-styles.css.js.map +1 -1
  262. package/textfield/lib/outlined-styles.css.js +1 -1
  263. package/textfield/lib/outlined-styles.css.js.map +1 -1
  264. package/textfield/lib/text-field.d.ts +1 -1
  265. package/textfield/lib/text-field.js.map +1 -1
  266. package/tokens/_index.scss +2 -18
  267. package/tokens/_md-comp-assist-chip.scss +0 -9
  268. package/tokens/_md-comp-checkbox.scss +78 -1
  269. package/tokens/_md-comp-circular-progress-indicator.scss +39 -13
  270. package/tokens/_md-comp-elevated-button.scss +0 -10
  271. package/tokens/_md-comp-fab-branded.scss +6 -31
  272. package/tokens/_md-comp-fab.scss +9 -50
  273. package/tokens/_md-comp-filled-button.scss +0 -10
  274. package/{field/lib → tokens}/_md-comp-filled-field.scss +91 -9
  275. package/tokens/_md-comp-filled-icon-button.scss +46 -1
  276. package/tokens/_md-comp-filled-select.scss +4 -30
  277. package/tokens/_md-comp-filled-text-field.scss +93 -9
  278. package/tokens/_md-comp-filled-tonal-button.scss +0 -11
  279. package/tokens/_md-comp-filled-tonal-icon-button.scss +45 -3
  280. package/tokens/_md-comp-filter-chip.scss +0 -10
  281. package/tokens/_md-comp-focus-ring.scss +23 -24
  282. package/tokens/_md-comp-icon-button.scss +37 -1
  283. package/tokens/_md-comp-input-chip.scss +0 -10
  284. package/tokens/_md-comp-linear-progress-indicator.scss +23 -8
  285. package/tokens/_md-comp-list-item.scss +0 -27
  286. package/tokens/_md-comp-list.scss +3 -29
  287. package/tokens/_md-comp-menu-item.scss +3 -29
  288. package/tokens/_md-comp-menu.scss +0 -23
  289. package/tokens/_md-comp-outlined-button.scss +0 -10
  290. package/{field/lib → tokens}/_md-comp-outlined-field.scss +85 -9
  291. package/tokens/_md-comp-outlined-icon-button.scss +41 -1
  292. package/tokens/_md-comp-outlined-segmented-button.scss +57 -11
  293. package/tokens/_md-comp-outlined-select.scss +1 -28
  294. package/tokens/_md-comp-outlined-text-field.scss +85 -8
  295. package/tokens/_md-comp-suggestion-chip.scss +0 -9
  296. package/tokens/_md-comp-switch.scss +81 -1
  297. package/tokens/_md-comp-text-button.scss +0 -10
  298. package/tokens/_values.scss +2 -7
  299. package/types/aria.d.ts +0 -2
  300. package/focus/strong-focus.d.ts +0 -56
  301. package/focus/strong-focus.js +0 -101
  302. package/focus/strong-focus.js.map +0 -1
  303. package/sass/_shape.scss +0 -154
  304. package/tokens/_md-comp-extended-fab-branded.scss +0 -45
  305. package/tokens/_md-comp-extended-fab-primary.scss +0 -45
  306. package/tokens/_md-comp-extended-fab-secondary.scss +0 -48
  307. package/tokens/_md-comp-extended-fab-surface.scss +0 -45
  308. package/tokens/_md-comp-extended-fab-tertiary.scss +0 -48
  309. package/tokens/_md-comp-fab-branded-large.scss +0 -23
  310. package/tokens/_md-comp-fab-primary-large.scss +0 -23
  311. package/tokens/_md-comp-fab-primary-small.scss +0 -23
  312. package/tokens/_md-comp-fab-primary.scss +0 -23
  313. package/tokens/_md-comp-fab-secondary-large.scss +0 -23
  314. package/tokens/_md-comp-fab-secondary-small.scss +0 -23
  315. package/tokens/_md-comp-fab-secondary.scss +0 -23
  316. package/tokens/_md-comp-fab-surface-large.scss +0 -23
  317. package/tokens/_md-comp-fab-surface-small.scss +0 -23
  318. package/tokens/_md-comp-fab-surface.scss +0 -23
  319. package/tokens/_md-comp-fab-tertiary-large.scss +0 -23
  320. package/tokens/_md-comp-fab-tertiary-small.scss +0 -23
  321. package/tokens/_md-comp-fab-tertiary.scss +0 -23
@@ -4,21 +4,27 @@
4
4
  //
5
5
 
6
6
  // go/keep-sorted start
7
- @use '../../sass/theme';
7
+ @use 'sass:list';
8
+ // go/keep-sorted end
9
+ // go/keep-sorted start
8
10
  @use '../../tokens';
9
11
  // go/keep-sorted end
10
12
 
11
13
  @mixin theme($tokens) {
12
- $reference: tokens.md-comp-circular-progress-indicator-values();
13
- $tokens: theme.validate-theme($reference, $tokens);
14
- $tokens: theme.create-theme-vars($tokens, 'circular-progress');
14
+ $supported-tokens: tokens.$md-comp-circular-progress-indicator-supported-tokens;
15
+ @each $token, $value in $tokens {
16
+ @if list.index($supported-tokens, $token) == null {
17
+ @error 'Token `#{$token}` is not a supported token.';
18
+ }
15
19
 
16
- @include theme.emit-theme-vars($tokens);
20
+ @if $value {
21
+ --md-circular-progress-#{$token}: #{$value};
22
+ }
23
+ }
17
24
  }
18
25
 
19
26
  @mixin styles() {
20
27
  $tokens: tokens.md-comp-circular-progress-indicator-values();
21
- $tokens: theme.create-theme-vars($tokens, 'circular-progress');
22
28
 
23
29
  $container-padding: 4px;
24
30
 
@@ -42,7 +48,7 @@
42
48
 
43
49
  :host {
44
50
  @each $token, $value in $tokens {
45
- --_#{$token}: #{$value};
51
+ --_#{$token}: var(--md-circular-progress-#{$token}, #{$value});
46
52
  }
47
53
 
48
54
  display: inline-flex;
@@ -4,6 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { css } from 'lit';
7
- export const styles = css `:host{--_active-indicator-color: var(--md-circular-progress-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-width: var(--md-circular-progress-active-indicator-width, 8.33);--_four-color-active-indicator-four-color: var(--md-circular-progress-four-color-active-indicator-four-color, var(--md-sys-color-tertiary-container, #ffd8e4));--_four-color-active-indicator-one-color: var(--md-circular-progress-four-color-active-indicator-one-color, var(--md-sys-color-primary, #6750a4));--_four-color-active-indicator-three-color: var(--md-circular-progress-four-color-active-indicator-three-color, var(--md-sys-color-tertiary, #7d5260));--_four-color-active-indicator-two-color: var(--md-circular-progress-four-color-active-indicator-two-color, var(--md-sys-color-primary-container, #eaddff));--_size: var(--md-circular-progress-size, 48px);display:inline-flex;vertical-align:middle;min-block-size:var(--_size);min-inline-size:var(--_size);position:relative;align-items:center;justify-content:center;contain:strict;content-visibility:auto}.circular-progress{flex:1;align-self:stretch;margin:4px}.circular-progress,.spinner,.left,.right,.circle,svg,.track,.progress{position:absolute;inset:0}svg{transform:rotate(-90deg)}circle{cx:50%;cy:50%;r:calc(50%*(1 - var(--_active-indicator-width)/100));stroke-width:calc(var(--_active-indicator-width)*1%);stroke-dasharray:100;fill:rgba(0,0,0,0)}.progress{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);stroke:var(--_active-indicator-color)}.track{stroke:rgba(0,0,0,0)}.circular-progress.indeterminate{will-change:transform;animation:linear infinite linear-rotate;animation-duration:1568.2352941176ms}.spinner{will-change:transform;animation:infinite both rotate-arc;animation-duration:5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.left{overflow:hidden;inset:0 50% 0 0}.right{overflow:hidden;inset:0 0 0 50%}.circle{box-sizing:border-box;border-radius:50%;border:solid calc(var(--_active-indicator-width)/100*(var(--_size) - 8px));border-color:var(--_active-indicator-color) var(--_active-indicator-color) rgba(0,0,0,0) rgba(0,0,0,0);will-change:transform;animation:expand-arc;animation-iteration-count:infinite;animation-fill-mode:both;animation-duration:1333ms,5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.four-color .circle{animation-name:expand-arc,four-color}.left .circle{rotate:135deg;inset:0 -100% 0 0}.right .circle{rotate:100deg;inset:0 0 0 -100%;animation-delay:-666.5ms,0ms}@media screen and (forced-colors: active){.progress{stroke:CanvasText}.circle{border-color:CanvasText CanvasText Canvas Canvas}}@keyframes expand-arc{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes rotate-arc{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes linear-rotate{to{transform:rotate(360deg)}}@keyframes four-color{0%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}15%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}25%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}40%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}50%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}65%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}75%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}90%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}100%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}}/*# sourceMappingURL=circular-progress-styles.css.map */
7
+ export const styles = css `:host{--_active-indicator-color: var(--md-circular-progress-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-width: var(--md-circular-progress-active-indicator-width, 8.3333333333);--_four-color-active-indicator-four-color: var(--md-circular-progress-four-color-active-indicator-four-color, var(--md-sys-color-tertiary-container, #ffd8e4));--_four-color-active-indicator-one-color: var(--md-circular-progress-four-color-active-indicator-one-color, var(--md-sys-color-primary, #6750a4));--_four-color-active-indicator-three-color: var(--md-circular-progress-four-color-active-indicator-three-color, var(--md-sys-color-tertiary, #7d5260));--_four-color-active-indicator-two-color: var(--md-circular-progress-four-color-active-indicator-two-color, var(--md-sys-color-primary-container, #eaddff));--_size: var(--md-circular-progress-size, 48px);display:inline-flex;vertical-align:middle;min-block-size:var(--_size);min-inline-size:var(--_size);position:relative;align-items:center;justify-content:center;contain:strict;content-visibility:auto}.circular-progress{flex:1;align-self:stretch;margin:4px}.circular-progress,.spinner,.left,.right,.circle,svg,.track,.progress{position:absolute;inset:0}svg{transform:rotate(-90deg)}circle{cx:50%;cy:50%;r:calc(50%*(1 - var(--_active-indicator-width)/100));stroke-width:calc(var(--_active-indicator-width)*1%);stroke-dasharray:100;fill:rgba(0,0,0,0)}.progress{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);stroke:var(--_active-indicator-color)}.track{stroke:rgba(0,0,0,0)}.circular-progress.indeterminate{will-change:transform;animation:linear infinite linear-rotate;animation-duration:1568.2352941176ms}.spinner{will-change:transform;animation:infinite both rotate-arc;animation-duration:5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.left{overflow:hidden;inset:0 50% 0 0}.right{overflow:hidden;inset:0 0 0 50%}.circle{box-sizing:border-box;border-radius:50%;border:solid calc(var(--_active-indicator-width)/100*(var(--_size) - 8px));border-color:var(--_active-indicator-color) var(--_active-indicator-color) rgba(0,0,0,0) rgba(0,0,0,0);will-change:transform;animation:expand-arc;animation-iteration-count:infinite;animation-fill-mode:both;animation-duration:1333ms,5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.four-color .circle{animation-name:expand-arc,four-color}.left .circle{rotate:135deg;inset:0 -100% 0 0}.right .circle{rotate:100deg;inset:0 0 0 -100%;animation-delay:-666.5ms,0ms}@media screen and (forced-colors: active){.progress{stroke:CanvasText}.circle{border-color:CanvasText CanvasText Canvas Canvas}}@keyframes expand-arc{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes rotate-arc{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes linear-rotate{to{transform:rotate(360deg)}}@keyframes four-color{0%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}15%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}25%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}40%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}50%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}65%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}75%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}90%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}100%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}}/*# sourceMappingURL=circular-progress-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=circular-progress-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"circular-progress-styles.css.js","sourceRoot":"","sources":["circular-progress-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{--_active-indicator-color: var(--md-circular-progress-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-width: var(--md-circular-progress-active-indicator-width, 8.33);--_four-color-active-indicator-four-color: var(--md-circular-progress-four-color-active-indicator-four-color, var(--md-sys-color-tertiary-container, #ffd8e4));--_four-color-active-indicator-one-color: var(--md-circular-progress-four-color-active-indicator-one-color, var(--md-sys-color-primary, #6750a4));--_four-color-active-indicator-three-color: var(--md-circular-progress-four-color-active-indicator-three-color, var(--md-sys-color-tertiary, #7d5260));--_four-color-active-indicator-two-color: var(--md-circular-progress-four-color-active-indicator-two-color, var(--md-sys-color-primary-container, #eaddff));--_size: var(--md-circular-progress-size, 48px);display:inline-flex;vertical-align:middle;min-block-size:var(--_size);min-inline-size:var(--_size);position:relative;align-items:center;justify-content:center;contain:strict;content-visibility:auto}.circular-progress{flex:1;align-self:stretch;margin:4px}.circular-progress,.spinner,.left,.right,.circle,svg,.track,.progress{position:absolute;inset:0}svg{transform:rotate(-90deg)}circle{cx:50%;cy:50%;r:calc(50%*(1 - var(--_active-indicator-width)/100));stroke-width:calc(var(--_active-indicator-width)*1%);stroke-dasharray:100;fill:rgba(0,0,0,0)}.progress{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);stroke:var(--_active-indicator-color)}.track{stroke:rgba(0,0,0,0)}.circular-progress.indeterminate{will-change:transform;animation:linear infinite linear-rotate;animation-duration:1568.2352941176ms}.spinner{will-change:transform;animation:infinite both rotate-arc;animation-duration:5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.left{overflow:hidden;inset:0 50% 0 0}.right{overflow:hidden;inset:0 0 0 50%}.circle{box-sizing:border-box;border-radius:50%;border:solid calc(var(--_active-indicator-width)/100*(var(--_size) - 8px));border-color:var(--_active-indicator-color) var(--_active-indicator-color) rgba(0,0,0,0) rgba(0,0,0,0);will-change:transform;animation:expand-arc;animation-iteration-count:infinite;animation-fill-mode:both;animation-duration:1333ms,5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.four-color .circle{animation-name:expand-arc,four-color}.left .circle{rotate:135deg;inset:0 -100% 0 0}.right .circle{rotate:100deg;inset:0 0 0 -100%;animation-delay:-666.5ms,0ms}@media screen and (forced-colors: active){.progress{stroke:CanvasText}.circle{border-color:CanvasText CanvasText Canvas Canvas}}@keyframes expand-arc{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes rotate-arc{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes linear-rotate{to{transform:rotate(360deg)}}@keyframes four-color{0%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}15%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}25%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}40%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}50%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}65%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}75%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}90%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}100%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}}/*# sourceMappingURL=circular-progress-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"circular-progress-styles.css.js","sourceRoot":"","sources":["circular-progress-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{--_active-indicator-color: var(--md-circular-progress-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_active-indicator-width: var(--md-circular-progress-active-indicator-width, 8.3333333333);--_four-color-active-indicator-four-color: var(--md-circular-progress-four-color-active-indicator-four-color, var(--md-sys-color-tertiary-container, #ffd8e4));--_four-color-active-indicator-one-color: var(--md-circular-progress-four-color-active-indicator-one-color, var(--md-sys-color-primary, #6750a4));--_four-color-active-indicator-three-color: var(--md-circular-progress-four-color-active-indicator-three-color, var(--md-sys-color-tertiary, #7d5260));--_four-color-active-indicator-two-color: var(--md-circular-progress-four-color-active-indicator-two-color, var(--md-sys-color-primary-container, #eaddff));--_size: var(--md-circular-progress-size, 48px);display:inline-flex;vertical-align:middle;min-block-size:var(--_size);min-inline-size:var(--_size);position:relative;align-items:center;justify-content:center;contain:strict;content-visibility:auto}.circular-progress{flex:1;align-self:stretch;margin:4px}.circular-progress,.spinner,.left,.right,.circle,svg,.track,.progress{position:absolute;inset:0}svg{transform:rotate(-90deg)}circle{cx:50%;cy:50%;r:calc(50%*(1 - var(--_active-indicator-width)/100));stroke-width:calc(var(--_active-indicator-width)*1%);stroke-dasharray:100;fill:rgba(0,0,0,0)}.progress{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1);stroke:var(--_active-indicator-color)}.track{stroke:rgba(0,0,0,0)}.circular-progress.indeterminate{will-change:transform;animation:linear infinite linear-rotate;animation-duration:1568.2352941176ms}.spinner{will-change:transform;animation:infinite both rotate-arc;animation-duration:5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.left{overflow:hidden;inset:0 50% 0 0}.right{overflow:hidden;inset:0 0 0 50%}.circle{box-sizing:border-box;border-radius:50%;border:solid calc(var(--_active-indicator-width)/100*(var(--_size) - 8px));border-color:var(--_active-indicator-color) var(--_active-indicator-color) rgba(0,0,0,0) rgba(0,0,0,0);will-change:transform;animation:expand-arc;animation-iteration-count:infinite;animation-fill-mode:both;animation-duration:1333ms,5332ms;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.four-color .circle{animation-name:expand-arc,four-color}.left .circle{rotate:135deg;inset:0 -100% 0 0}.right .circle{rotate:100deg;inset:0 0 0 -100%;animation-delay:-666.5ms,0ms}@media screen and (forced-colors: active){.progress{stroke:CanvasText}.circle{border-color:CanvasText CanvasText Canvas Canvas}}@keyframes expand-arc{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes rotate-arc{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes linear-rotate{to{transform:rotate(360deg)}}@keyframes four-color{0%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}15%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}25%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}40%{border-top-color:var(--_four-color-active-indicator-two-color);border-right-color:var(--_four-color-active-indicator-two-color)}50%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}65%{border-top-color:var(--_four-color-active-indicator-three-color);border-right-color:var(--_four-color-active-indicator-three-color)}75%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}90%{border-top-color:var(--_four-color-active-indicator-four-color);border-right-color:var(--_four-color-active-indicator-four-color)}100%{border-top-color:var(--_four-color-active-indicator-one-color);border-right-color:var(--_four-color-active-indicator-one-color)}}/*# sourceMappingURL=circular-progress-styles.css.map */\n`;\n "]}
@@ -3,9 +3,9 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { LitElement, TemplateResult } from 'lit';
6
+ import { LitElement } from 'lit';
7
7
  /**
8
- * Circular Progress component.
8
+ * A circular progress component.
9
9
  */
10
10
  export declare class CircularProgress extends LitElement {
11
11
  /**
@@ -19,10 +19,9 @@ export declare class CircularProgress extends LitElement {
19
19
  indeterminate: boolean;
20
20
  /**
21
21
  * Whether or not to render indeterminate mode using 4 colors instead of one.
22
- *
23
22
  */
24
23
  fourColor: boolean;
25
- protected render(): TemplateResult;
26
- protected renderDeterminateContainer(): TemplateResult<1>;
27
- protected renderIndeterminateContainer(): TemplateResult<1>;
24
+ protected render(): import("lit-html").TemplateResult<1>;
25
+ private renderDeterminateContainer;
26
+ private renderIndeterminateContainer;
28
27
  }
@@ -10,7 +10,7 @@ import { property } from 'lit/decorators.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { requestUpdateOnAriaChange } from '../../aria/delegate.js';
12
12
  /**
13
- * Circular Progress component.
13
+ * A circular progress component.
14
14
  */
15
15
  export class CircularProgress extends LitElement {
16
16
  constructor() {
@@ -26,7 +26,6 @@ export class CircularProgress extends LitElement {
26
26
  this.indeterminate = false;
27
27
  /**
28
28
  * Whether or not to render indeterminate mode using 4 colors instead of one.
29
- *
30
29
  */
31
30
  this.fourColor = false;
32
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"circular-progress.js","sourceRoot":"","sources":["circular-progress.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AAGjE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAAhD;;QAKE;;WAEG;QACuB,aAAQ,GAAG,CAAC,CAAC;QAGvC;;;WAGG;QACwB,kBAAa,GAAG,KAAK,CAAC;QAEjD;;;WAGG;QACiD,cAAS,GAAG,KAAK,CAAC;IAuDxE,CAAC;IArDoB,MAAM;QACvB,MAAM,OAAO,GAAG;YACd,eAAe,EAAE,IAAI,CAAC,aAAa;YACnC,YAAY,EAAE,IAAI,CAAC,SAAS;SAC7B,CAAC;QAEF,iCAAiC;QACjC,MAAM,EAAC,SAAS,EAAC,GAAG,IAAuB,CAAC;QAC5C,OAAO,IAAI,CAAA;;mCAEoB,QAAQ,CAAC,OAAO,CAAC;;sBAE9B,SAAS,IAAI,OAAO;;;yBAGjB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ;UAE7D,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,0BAA0B,EAAE;;oBAE1C,CAAC;IACnB,CAAC;IAED,sEAAsE;IACtE,yCAAyC;IAC/B,0BAA0B;QAClC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;QAC7C,mEAAmE;QACnE,4EAA4E;QAC5E,MAAM,UAAU,GAAG,GAAG,CAAC;QACvB,OAAO,IAAI,CAAA;0CAC2B,UAAU;6CACP,UAAU,wBAC/C,UAAU;WACP,CAAC;IACV,CAAC;IAED,oEAAoE;IACpE,6EAA6E;IAC7E,uDAAuD;IACvD,qEAAqE;IACrE,yEAAyE;IAC/D,4BAA4B;QACpC,OAAO,IAAI,CAAA;;;;;;;;aAQF,CAAC;IACZ,CAAC;CACF;;AA3EC;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAKyB;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDAAc;AAOZ;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uDAAuB;AAMG;IAAnD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;mDAAmB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing, TemplateResult} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\n/**\n * Circular Progress component.\n */\nexport class CircularProgress extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /**\n * Progress to display, a fraction between 0 and 1.\n */\n @property({type: Number}) progress = 0;\n\n\n /**\n * Whether or not to display an animated spinner representing indeterminate\n * progress.\n */\n @property({type: Boolean}) indeterminate = false;\n\n /**\n * Whether or not to render indeterminate mode using 4 colors instead of one.\n *\n */\n @property({type: Boolean, attribute: 'four-color'}) fourColor = false;\n\n protected override render(): TemplateResult {\n const classes = {\n 'indeterminate': this.indeterminate,\n 'four-color': this.fourColor\n };\n\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <div\n class=\"circular-progress ${classMap(classes)}\"\n role=\"progressbar\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-valuemin=\"0\"\n aria-valuemax=\"1\"\n aria-valuenow=\"${this.indeterminate ? nothing : this.progress}\">\n ${\n this.indeterminate ? this.renderIndeterminateContainer() :\n this.renderDeterminateContainer()}\n </div>\n <slot></slot>`;\n }\n\n // Determinate mode is rendered with an svg so the progress arc can be\n // easily animated via stroke-dashoffset.\n protected renderDeterminateContainer() {\n const dashOffset = (1 - this.progress) * 100;\n // note, dash-array/offset are relative to Setting `pathLength` but\n // Chrome seems to render this inaccurately and using a large viewbox helps.\n const pathLength = 100;\n return html`<svg viewBox=\"0 0 4800 4800\">\n <circle class=\"track\" pathLength=\"${pathLength}\"></circle>\n <circle class=\"progress\" pathLength=\"${pathLength}\" stroke-dashoffset=\"${\n dashOffset}\"></circle>\n </svg>`;\n }\n\n // Indeterminate mode rendered with 2 bordered-divs. The borders are\n // clipped into half circles by their containers. The divs are then carefully\n // animated to produce changes to the spinner arc size.\n // This approach has 4.5x the FPS of rendering via svg on Chrome 111.\n // See https://lit.dev/playground/#gist=febb773565272f75408ab06a0eb49746.\n protected renderIndeterminateContainer() {\n return html`\n <div class=\"spinner\">\n <div class=\"left\">\n <div class=\"circle\"></div>\n </div>\n <div class=\"right\">\n <div class=\"circle\"></div>\n </div>\n </div>`;\n }\n}\n"]}
1
+ {"version":3,"file":"circular-progress.js","sourceRoot":"","sources":["circular-progress.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,E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uD;IACvD,qEAAqE;IACrE,yEAAyE;IACjE,4BAA4B;QAClC,OAAO,IAAI,CAAA;;;;;;;;aAQF,CAAC;IACZ,CAAC;CACF;;AAzEC;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAKyB;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDAAc;AAMZ;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uDAAuB;AAKG;IAAnD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;mDAAmB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\n/**\n * A circular progress component.\n */\nexport class CircularProgress extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /**\n * Progress to display, a fraction between 0 and 1.\n */\n @property({type: Number}) progress = 0;\n\n /**\n * Whether or not to display an animated spinner representing indeterminate\n * progress.\n */\n @property({type: Boolean}) indeterminate = false;\n\n /**\n * Whether or not to render indeterminate mode using 4 colors instead of one.\n */\n @property({type: Boolean, attribute: 'four-color'}) fourColor = false;\n\n protected override render() {\n const classes = {\n 'indeterminate': this.indeterminate,\n 'four-color': this.fourColor\n };\n\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <div\n class=\"circular-progress ${classMap(classes)}\"\n role=\"progressbar\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-valuemin=\"0\"\n aria-valuemax=\"1\"\n aria-valuenow=\"${this.indeterminate ? nothing : this.progress}\">\n ${\n this.indeterminate ? this.renderIndeterminateContainer() :\n this.renderDeterminateContainer()}\n </div>\n <slot></slot>`;\n }\n\n // Determinate mode is rendered with an svg so the progress arc can be\n // easily animated via stroke-dashoffset.\n private renderDeterminateContainer() {\n const dashOffset = (1 - this.progress) * 100;\n // note, dash-array/offset are relative to Setting `pathLength` but\n // Chrome seems to render this inaccurately and using a large viewbox helps.\n const pathLength = 100;\n return html`<svg viewBox=\"0 0 4800 4800\">\n <circle class=\"track\" pathLength=\"${pathLength}\"></circle>\n <circle class=\"progress\" pathLength=\"${pathLength}\" stroke-dashoffset=\"${\n dashOffset}\"></circle>\n </svg>`;\n }\n\n // Indeterminate mode rendered with 2 bordered-divs. The borders are\n // clipped into half circles by their containers. The divs are then carefully\n // animated to produce changes to the spinner arc size.\n // This approach has 4.5x the FPS of rendering via svg on Chrome 111.\n // See https://lit.dev/playground/#gist=febb773565272f75408ab06a0eb49746.\n private renderIndeterminateContainer() {\n return html`\n <div class=\"spinner\">\n <div class=\"left\">\n <div class=\"circle\"></div>\n </div>\n <div class=\"right\">\n <div class=\"circle\"></div>\n </div>\n </div>`;\n }\n}\n"]}
@@ -11,7 +11,6 @@
11
11
  // go/keep-sorted start
12
12
  @use '../../elevation/elevation';
13
13
  @use '../../sass/color';
14
- @use '../../sass/shape';
15
14
  @use '../../sass/theme';
16
15
  @use '../../sass/var';
17
16
  @use './tokens';
@@ -9,7 +9,6 @@
9
9
  // go/keep-sorted end
10
10
  // go/keep-sorted start
11
11
  @use '../../sass/color';
12
- @use '../../sass/shape';
13
12
  @use '../../sass/string-ext';
14
13
  @use '../../sass/theme';
15
14
  @use '../../sass/var';
@@ -173,18 +173,18 @@ export declare class Dialog extends LitElement {
173
173
  */
174
174
  private reflectStateProp;
175
175
  private dialogClosedResolver?;
176
- protected performTransition(shouldDispatchAction: boolean): Promise<void>;
177
- protected dispatchActionEvent(type: string): void;
176
+ private performTransition;
177
+ private dispatchActionEvent;
178
178
  private fullscreenQuery?;
179
179
  private fullscreenQueryListener;
180
- protected updateFullscreen(): void;
181
- protected handleDialogDismiss(e: Event): void;
182
- protected handleDialogClick(e: Event): void;
183
- protected handleContentScroll(): void;
184
- protected getFocusElement(): HTMLElement | null;
180
+ private updateFullscreen;
181
+ private handleDialogDismiss;
182
+ private handleDialogClick;
183
+ private handleContentScroll;
184
+ private getFocusElement;
185
185
  focus(): void;
186
186
  blur(): void;
187
- protected canStartDrag(e: PointerEvent): boolean;
188
- protected handlePointerMove(e: PointerEvent): void;
189
- protected handleDragEnd(e: PointerEvent): void;
187
+ private canStartDrag;
188
+ private handlePointerMove;
189
+ private handleDragEnd;
190
190
  }
@@ -196,7 +196,7 @@ export class Dialog extends LitElement {
196
196
  }
197
197
  }
198
198
  getContentScrollInfo() {
199
- if (!this.hasUpdated) {
199
+ if (!this.hasUpdated || !this.contentElement) {
200
200
  return { isScrollable: false, isAtScrollTop: true, isAtScrollBottom: true };
201
201
  }
202
202
  const { scrollTop, scrollHeight, offsetHeight, clientHeight } = this.contentElement;
@@ -335,7 +335,7 @@ export class Dialog extends LitElement {
335
335
  await promise;
336
336
  this.opening = false;
337
337
  this.closing = false;
338
- if (!this.open && this.dialogElement.open) {
338
+ if (!this.open && this.dialogElement?.open) {
339
339
  // Closing the dialog triggers an asynchronous `close` event.
340
340
  // It's important to wait for this event to fire since it changes the
341
341
  // state of `open` to false.
@@ -348,7 +348,7 @@ export class Dialog extends LitElement {
348
348
  const closedPromise = new Promise(resolve => {
349
349
  this.dialogClosedResolver = resolve;
350
350
  });
351
- this.dialogElement.close(this.currentAction || this.defaultAction);
351
+ this.dialogElement?.close(this.currentAction || this.defaultAction);
352
352
  await closedPromise;
353
353
  // enable scrolling late to avoid layout shift when closing
354
354
  if (!this.modeless) {
@@ -401,7 +401,8 @@ export class Dialog extends LitElement {
401
401
  }
402
402
  this.currentAction =
403
403
  e.target.getAttribute(this.actionAttribute) ??
404
- (!this.modeless && !e.composedPath().includes(this.containerElement) ?
404
+ (!this.modeless && this.containerElement &&
405
+ !e.composedPath().includes(this.containerElement) ?
405
406
  this.scrimClickAction :
406
407
  '');
407
408
  if (this.currentAction !== '') {
@@ -433,13 +434,13 @@ export class Dialog extends LitElement {
433
434
  }
434
435
  canStartDrag(e) {
435
436
  if (this.draggable === false || e.defaultPrevented || !(e.buttons & 1) ||
436
- !e.composedPath().includes(this.headerElement)) {
437
+ !this.headerElement || !e.composedPath().includes(this.headerElement)) {
437
438
  return false;
438
439
  }
439
440
  return true;
440
441
  }
441
442
  handlePointerMove(e) {
442
- if (!this.dragging && !this.canStartDrag(e)) {
443
+ if (!this.dragging && !this.canStartDrag(e) || !this.containerElement) {
443
444
  return;
444
445
  }
445
446
  const { top, left, height, width } = this.containerElement.getBoundingClientRect();
@@ -463,7 +464,7 @@ export class Dialog extends LitElement {
463
464
  if (!this.dragging) {
464
465
  return;
465
466
  }
466
- this.containerElement.releasePointerCapture(e.pointerId);
467
+ this.containerElement?.releasePointerCapture(e.pointerId);
467
468
  this.dragging = false;
468
469
  this.dragInfo = undefined;
469
470
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7E,mCAAmC;AACnC,mCAAmC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AACjE,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QA6BE;;WAEG;QACw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,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;0CAA0B;AAI3C;IAAR,KAAK,EAAE;wCAA0B","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\n\nimport {html, LitElement, PropertyValues} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {createThrottle, msFromTimeCSSValue} from '../../motion/animation.js';\n\n// This is required for decorators.\n// tslint:disable:no-new-decorators\n\n/**\n * Default close action.\n */\nexport const CLOSE_ACTION = 'close';\n\nconst OPENING_TRANSITION_PROP = '--_opening-transition-duration';\nconst CLOSING_TRANSITION_PROP = '--_closing-transition-duration';\n\n/**\n * A dialog component.\n */\nexport class Dialog extends LitElement {\n private static preventedScrollingCount = 0;\n private static scrollbarTester: HTMLDivElement;\n\n private static setDocumentScrollingDisabled(disabled = false) {\n let {preventedScrollingCount, scrollbarTester} = Dialog;\n Dialog.preventedScrollingCount = preventedScrollingCount =\n Math.max(preventedScrollingCount + (Number(disabled) || -1), 0);\n const shouldPrevent = Boolean(preventedScrollingCount);\n const {style} = document.body;\n if (shouldPrevent && style.overflow === 'hidden') {\n return;\n }\n if (scrollbarTester === undefined) {\n Dialog.scrollbarTester = scrollbarTester = document.createElement('div');\n scrollbarTester.style.cssText =\n `position: absolute; height: 0; width: 100%; visibility: hidden; pointer-events: none;`;\n }\n // Appends an element to see if its offsetWidth changes when overflow is\n // altered. If it does, then add end inline padding to restore the width to\n // avoid a visible layout shift.\n document.body.append(scrollbarTester);\n const {offsetWidth} = scrollbarTester;\n style.overflow = shouldPrevent ? 'hidden' : '';\n const scrollbarWidth = scrollbarTester.offsetWidth - offsetWidth;\n scrollbarTester.remove();\n style.paddingInlineEnd = shouldPrevent ? `${scrollbarWidth}px` : '';\n }\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({type: Boolean}) open = false;\n\n /**\n * Setting fullscreen displays the dialog fullscreen on small screens.\n * This can be customized via the `fullscreenBreakpoint` property.\n * When showing fullscreen, the header will take up less vertical space, and\n * the dialog will have a `showing-fullscreen`attribute, allowing content to\n * be styled in this state.\n *\n * Dialogs can be sized by setting:\n *\n * * --md-dialog-container-min-block-size\n * * --md-dialog-container-max-block-size\n * * --md-dialog-container-min-inline-size\n * * --md-dialog-container-max-inline-size\n *\n * These are typically configured via media queries and are independent of the\n * fullscreen setting.\n */\n @property({type: Boolean}) fullscreen = false;\n\n /**\n * A media query string specifying the breakpoint at which the dialog\n * should be shown fullscreen. Note, this only applies when the `fullscreen`\n * property is set.\n *\n * By default, the dialog is shown fullscreen on screens less than 600px wide\n * or 400px tall.\n */\n @property() fullscreenBreakpoint = '(max-width: 600px), (max-height: 400px)';\n\n /**\n * Hides the dialog footer, making any content slotted into the footer\n * inaccessible.\n */\n @property({type: Boolean}) footerHidden = false;\n\n /**\n * Renders footer content in a vertically stacked alignment rather than the\n * normal horizontal alignment.\n */\n @property({type: Boolean}) stacked = false;\n\n /**\n * When the dialog is closed it disptaches `closing` and `closed` events.\n * These events have an action property which has a default value of\n * the value of this property. Specific actions have explicit values but when\n * a value is not specified, the default is used. For example, clicking the\n * scrim, pressing escape, or clicking a button with an action attribute set\n * produce an explicit action.\n *\n * Defaults to `close`.\n */\n @property() defaultAction = CLOSE_ACTION;\n\n /**\n * The name of an attribute which can be placed on any element slotted into\n * the dialog. If an element has an action attribute set, clicking it will\n * close the dialog and the `closing` and `closed` events dispatched will\n * have their action property set the the value of this attribute on the\n * clicked element.The default valus is `dialogAction`. For example,\n *\n * <md-dialog>\n * Content\n * <md-filled-button slot=\"footer\"dialogAction=\"buy\">\n * Buy\n * </md-filled-button>\n * </md-dialog>\n */\n @property() actionAttribute = 'dialogAction';\n\n /**\n * When the dialog is opened, it will focus the first element which has\n * an attribute name matching this property. The default value is\n * `dialogFocus`. For example:\n *\n * <md-dialog>\n * <md-filled-text-field\n * label=\"Enter some text\"\n * dialogFocus\n * >\n * </md-filled-text-field>\n * </md-dialog>\n */\n @property() focusAttribute = 'dialogFocus';\n\n /**\n * Clicking on the scrim surrounding the dialog closes the dialog.\n * The `closing` and `closed` events this produces have an `action` property\n * which is the value of this property and defaults to `close`.\n */\n @property() scrimClickAction = CLOSE_ACTION;\n\n /**\n * Pressing the `escape` key while the dialog is open closes the dialog.\n * The `closing` and `closed` events this produces have an `action` property\n * which is the value of this property and defaults to `close`.\n */\n @property() escapeKeyAction = CLOSE_ACTION;\n\n /**\n * When opened, the dialog is displayed modeless or non-modal. This\n * allows users to interact with content outside the dialog without\n * closing the dialog and does not display the scrim around the dialog.\n */\n @property({type: Boolean, reflect: true}) modeless = false;\n\n /**\n * Set to make the dialog position draggable.\n */\n @property({type: Boolean}) override draggable = false;\n\n private readonly throttle = createThrottle();\n\n @query('.dialog', true) private readonly dialogElement!: HTMLDialogElement;\n\n // slots tracked to find focusable elements.\n @query('slot[name=footer]', true)\n private readonly footerSlot!: HTMLSlotElement;\n @query('slot:not([name])', true)\n private readonly contentSlot!: HTMLSlotElement;\n // for scrolling related styling\n @query(`.content`, true) private readonly contentElement!: HTMLDivElement;\n // used to determine container size for dragging\n @query(`.container`, true) private readonly containerElement!: HTMLDivElement;\n // used to determin where users can drag from.\n @query(`.header`, true) private readonly headerElement!: HTMLDivElement;\n\n /**\n * Private properties that reflect for styling manually in `updated`.\n */\n @state() private showingFullscreen = false;\n @state() private showingOpen = false;\n @state() private opening = false;\n @state() private closing = false;\n\n /**\n * Transition kind. Supported options include: grow, shrink, grow-down,\n * grow-up, grow-left, and grow-right.\n *\n * Defaults to grow-down.\n */\n @property({reflect: true}) transition = 'grow-down';\n\n private currentAction: string|undefined;\n\n @state() private dragging = false;\n private readonly dragMargin = 8;\n private dragInfo?: [number, number, number, number]|undefined;\n\n /**\n * Opens and shows the dialog. This is equivalent to setting the `open`\n * property to true.\n */\n show() {\n this.open = true;\n }\n\n /**\n * Closes the dialog. This is equivalent to setting the `open`\n * property to false.\n */\n close(action = '') {\n this.currentAction = action;\n this.open = false;\n }\n\n /**\n * Opens and shows the dialog if it is closed; otherwise closes it.\n */\n toggleShow() {\n if (this.open) {\n this.close(this.currentAction);\n } else {\n this.show();\n }\n }\n\n private getContentScrollInfo() {\n if (!this.hasUpdated) {\n return {isScrollable: false, isAtScrollTop: true, isAtScrollBottom: true};\n }\n const {scrollTop, scrollHeight, offsetHeight, clientHeight} =\n this.contentElement;\n return {\n isScrollable: scrollHeight > offsetHeight,\n isAtScrollTop: scrollTop === 0,\n isAtScrollBottom:\n Math.abs(Math.round(scrollHeight - scrollTop) - clientHeight) <= 2\n };\n }\n\n protected override render() {\n const {isScrollable, isAtScrollTop, isAtScrollBottom} =\n this.getContentScrollInfo();\n return html`\n <dialog\n @close=${this.handleDialogDismiss}\n @cancel=${this.handleDialogDismiss}\n @click=${this.handleDialogClick}\n class=\"dialog ${classMap({\n 'stacked': this.stacked,\n 'scrollable': isScrollable,\n 'scroll-divider-header': !isAtScrollTop,\n 'scroll-divider-footer': !isAtScrollBottom,\n 'footerHidden': this.footerHidden\n })}\"\n aria-labelledby=\"header\"\n aria-describedby=\"content\"\n >\n <div class=\"container ${classMap({\n 'dragging': this.dragging\n })}\"\n @pointermove=${this.handlePointerMove}\n @pointerup=${this.handleDragEnd}\n >\n <md-elevation></md-elevation>\n <header class=\"header\">\n <slot name=\"header\">\n <slot name=\"headline-prefix\"></slot>\n <slot name=\"headline\"></slot>\n <slot name=\"headline-suffix\"></slot>\n </slot>\n </header>\n <section class=\"content\" @scroll=${this.handleContentScroll}>\n <slot></slot>\n </section>\n <footer class=\"footer\">\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n </dialog>`;\n }\n\n protected override willUpdate(changed: PropertyValues) {\n if (changed.has('open')) {\n this.opening = this.open;\n // only closing if was opened previously...\n this.closing = !this.open && changed.get('open');\n }\n if (changed.has('fullscreen') || changed.has('fullscreenBreakpoint')) {\n this.updateFullscreen();\n }\n }\n\n protected override firstUpdated() {\n // Update when content size changes to show/hide scroll dividers.\n new ResizeObserver(() => {\n if (this.showingOpen) {\n this.requestUpdate();\n }\n }).observe(this.contentElement);\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.get('draggable') && !this.draggable) {\n this.style.removeProperty('--_container-drag-inline-start');\n this.style.removeProperty('--_container-drag-block-start');\n }\n // Reflect internal state to facilitate styling.\n this.reflectStateProp(changed, 'opening', this.opening);\n this.reflectStateProp(changed, 'closing', this.closing);\n this.reflectStateProp(\n changed, 'showingFullscreen', this.showingFullscreen,\n 'showing-fullscreen');\n this.reflectStateProp(\n changed, 'showingOpen', this.showingOpen, 'showing-open');\n if (!changed.has('open')) {\n return;\n }\n // prevent body scrolling early only when opening to avoid layout\n // shift when closing.\n if (!this.modeless && this.open) {\n Dialog.setDocumentScrollingDisabled(this.open);\n }\n if (this.open) {\n this.contentElement.scrollTop = 0;\n if (this.modeless) {\n this.dialogElement.show();\n } else {\n // Note, native focus handling fails when focused element is in an\n // overflow: auto container.\n this.dialogElement.showModal();\n }\n }\n // Avoids dispatching initial state.\n const shouldDispatchAction = changed.get('open') !== undefined;\n this.performTransition(shouldDispatchAction);\n }\n\n /**\n * Internal state is reflected here as attributes to effect styling. This\n * could be done via internal classes, but it's published on the host\n * to facilitate the (currently undocumented) possibility of customizing\n * styling of user content based on these states.\n * Note, in the future this could be done with `:state(...)` when browser\n * support improves.\n */\n private reflectStateProp(\n changed: PropertyValues, key: string, value: unknown,\n attribute?: string) {\n attribute ??= key;\n if (!changed.has(key)) {\n return;\n }\n if (value) {\n this.setAttribute(attribute, '');\n } else {\n this.removeAttribute(attribute);\n }\n }\n\n private dialogClosedResolver?: () => void;\n\n protected async performTransition(shouldDispatchAction: boolean) {\n // TODO: pause here only to avoid a double update warning.\n await this.updateComplete;\n this.showingOpen = this.open;\n if (shouldDispatchAction) {\n this.dispatchActionEvent(this.open ? 'opening' : 'closing');\n }\n // Compute desired transition duration.\n const duration = msFromTimeCSSValue(getComputedStyle(this).getPropertyValue(\n this.open ? OPENING_TRANSITION_PROP : CLOSING_TRANSITION_PROP));\n let promise = this.updateComplete;\n if (duration > 0) {\n promise = new Promise((r) => {\n setTimeout(r, duration);\n });\n }\n await promise;\n this.opening = false;\n this.closing = false;\n if (!this.open && this.dialogElement.open) {\n // Closing the dialog triggers an asynchronous `close` event.\n // It's important to wait for this event to fire since it changes the\n // state of `open` to false.\n // Without waiting, this element's `closed` event can be called before\n // the dialog's `close` event, which is problematic since the user\n // can set `open` in the `closed` event.\n // The timing of the event appears to vary via browser and does *not*\n // seem to resolve by \"task\" timing; therefore an explicit promise is\n // used.\n const closedPromise = new Promise<void>(resolve => {\n this.dialogClosedResolver = resolve;\n });\n this.dialogElement.close(this.currentAction || this.defaultAction);\n await closedPromise;\n // enable scrolling late to avoid layout shift when closing\n if (!this.modeless) {\n Dialog.setDocumentScrollingDisabled(this.open);\n }\n }\n // Focus initial element.\n if (this.open) {\n this.focus();\n }\n if (shouldDispatchAction) {\n this.dispatchActionEvent(this.open ? 'opened' : 'closed');\n }\n this.currentAction = undefined;\n }\n\n protected dispatchActionEvent(type: string) {\n const detail = {action: this.open ? 'none' : this.currentAction};\n this.dispatchEvent(new CustomEvent(type, {detail, bubbles: true}));\n }\n\n /* Live media query for matching user specified fullscreen breakpoint. */\n private fullscreenQuery?: MediaQueryList;\n private fullscreenQueryListener:\n ((e: MediaQueryListEvent) => void)|undefined = undefined;\n protected updateFullscreen() {\n if (this.fullscreenQuery !== undefined) {\n this.fullscreenQuery.removeEventListener(\n 'change', this.fullscreenQueryListener!);\n this.fullscreenQuery = this.fullscreenQueryListener = undefined;\n }\n if (!this.fullscreen) {\n this.showingFullscreen = false;\n return;\n }\n this.fullscreenQuery = window.matchMedia(this.fullscreenBreakpoint);\n this.fullscreenQuery.addEventListener(\n 'change',\n (this.fullscreenQueryListener = (event: MediaQueryListEvent) => {\n this.showingFullscreen = event.matches;\n }));\n this.showingFullscreen = this.fullscreenQuery.matches;\n }\n\n // handles native close/cancel events and we just ensure\n // internal state is in sync.\n protected handleDialogDismiss(e: Event) {\n if (e.type === 'cancel') {\n this.currentAction = this.escapeKeyAction;\n }\n this.dialogClosedResolver?.();\n this.dialogClosedResolver = undefined;\n this.open = false;\n this.opening = false;\n this.closing = false;\n }\n\n protected handleDialogClick(e: Event) {\n if (!this.open) {\n return;\n }\n this.currentAction =\n (e.target as Element).getAttribute(this.actionAttribute) ??\n (!this.modeless && !e.composedPath().includes(this.containerElement) ?\n this.scrimClickAction :\n '');\n if (this.currentAction !== '') {\n this.close(this.currentAction);\n }\n }\n\n /* This allows the dividers to dynamically show based on scrolling. */\n protected handleContentScroll() {\n this.throttle('scroll', () => {\n this.requestUpdate();\n });\n }\n\n protected getFocusElement(): HTMLElement|null {\n const selector = `[${this.focusAttribute}]`;\n const slotted = [this.footerSlot, this.contentSlot].flatMap(\n slot => slot.assignedElements({flatten: true}));\n for (const el of slotted) {\n const focusEl = el.matches(selector) ? el : el.querySelector(selector);\n if (focusEl) {\n return focusEl as HTMLElement;\n }\n }\n return null;\n }\n\n override focus() {\n this.getFocusElement()?.focus();\n }\n\n override blur() {\n this.getFocusElement()?.blur();\n }\n\n protected canStartDrag(e: PointerEvent) {\n if (this.draggable === false || e.defaultPrevented || !(e.buttons & 1) ||\n !e.composedPath().includes(this.headerElement)) {\n return false;\n }\n return true;\n }\n\n protected handlePointerMove(e: PointerEvent) {\n if (!this.dragging && !this.canStartDrag(e)) {\n return;\n }\n const {top, left, height, width} =\n this.containerElement.getBoundingClientRect();\n if (!this.dragging) {\n this.containerElement.setPointerCapture(e.pointerId);\n this.dragging = true;\n const {x, y} = e;\n this.dragInfo = [x, y, top, left];\n }\n const [sx, sy, st, sl] = this.dragInfo ?? [0, 0, 0, 0];\n const dx = e.x - sx;\n const dy = e.y - sy;\n const ml = window.innerWidth - width - this.dragMargin;\n const mt = window.innerHeight - height - this.dragMargin;\n const l = Math.max(this.dragMargin, Math.min(ml, dx + sl));\n const t = Math.max(this.dragMargin, Math.min(mt, dy + st));\n this.style.setProperty('--_container-drag-inline-start', `${l}px`);\n this.style.setProperty('--_container-drag-block-start', `${t}px`);\n }\n\n protected handleDragEnd(e: PointerEvent) {\n if (!this.dragging) {\n return;\n }\n this.containerElement.releasePointerCapture(e.pointerId);\n this.dragging = false;\n this.dragInfo = undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7E,mCAAmC;AACnC,mCAAmC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AACjE,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QA6BE;;WAEG;QACwB,SAAI,GAAG,KAAK,CAAC;QAExC;;;;;;;;;;;;;;;;WAgBG;QACwB,eAAU,GAAG,KAAK,CAAC;QAE9C;;;;;;;WAOG;QACS,yBAAoB,GAAG,yCAAyC,CAAC;QAE7E;;;WAGG;QACwB,iBAAY,GAAG,KAAK,CAAC;QAEhD;;;WAGG;QACwB,YAAO,GAAG,KAAK,CAAC;QAE3C;;;;;;;;;WASG;QACS,kBAAa,GAAG,YAAY,CAAC;QAEzC;;;;;;;;;;;;;WAaG;QACS,oBAAe,GAAG,cAAc,CAAC;QAE7C;;;;;;;;;;;;WAYG;QACS,mBAAc,GAAG,aAAa,CAA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AAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;4CAAsB;AAMrB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAiB;AAY/B;IAAX,QAAQ,EAAE;6CAA8B;AAgB7B;IAAX,QAAQ,EAAE;+CAAkC;AAejC;IAAX,QAAQ,EAAE;8CAAgC;AAO/B;IAAX,QAAQ,EAAE;gDAAiC;AAOhC;IAAX,QAAQ,EAAE;+CAAgC;AAOD;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;wCAAkB;AAKhC;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAA4B;AAKtD;IADC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;6CACiC;AAIxD;IADC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC;0CACa;AAE9C;IADC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;2CACe;AAG/C;IADC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC;8CAC8B;AAGtD;IADC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC;gDAC8B;AAEhC;IAAvB,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;6CAAsD;AAKpE;IAAR,KAAK,EAAE;iDAAmC;AAClC;IAAR,KAAK,EAAE;2CAA6B;AAC5B;IAAR,KAAK,EAAE;uCAAyB;AACxB;IAAR,KAAK,EAAE;uCAAyB;AAQN;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;0CAA0B;AAI3C;IAAR,KAAK,EAAE;wCAA0B","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\n\nimport {html, LitElement, PropertyValues} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {createThrottle, msFromTimeCSSValue} from '../../motion/animation.js';\n\n// This is required for decorators.\n// tslint:disable:no-new-decorators\n\n/**\n * Default close action.\n */\nexport const CLOSE_ACTION = 'close';\n\nconst OPENING_TRANSITION_PROP = '--_opening-transition-duration';\nconst CLOSING_TRANSITION_PROP = '--_closing-transition-duration';\n\n/**\n * A dialog component.\n */\nexport class Dialog extends LitElement {\n private static preventedScrollingCount = 0;\n private static scrollbarTester: HTMLDivElement;\n\n private static setDocumentScrollingDisabled(disabled = false) {\n let {preventedScrollingCount, scrollbarTester} = Dialog;\n Dialog.preventedScrollingCount = preventedScrollingCount =\n Math.max(preventedScrollingCount + (Number(disabled) || -1), 0);\n const shouldPrevent = Boolean(preventedScrollingCount);\n const {style} = document.body;\n if (shouldPrevent && style.overflow === 'hidden') {\n return;\n }\n if (scrollbarTester === undefined) {\n Dialog.scrollbarTester = scrollbarTester = document.createElement('div');\n scrollbarTester.style.cssText =\n `position: absolute; height: 0; width: 100%; visibility: hidden; pointer-events: none;`;\n }\n // Appends an element to see if its offsetWidth changes when overflow is\n // altered. If it does, then add end inline padding to restore the width to\n // avoid a visible layout shift.\n document.body.append(scrollbarTester);\n const {offsetWidth} = scrollbarTester;\n style.overflow = shouldPrevent ? 'hidden' : '';\n const scrollbarWidth = scrollbarTester.offsetWidth - offsetWidth;\n scrollbarTester.remove();\n style.paddingInlineEnd = shouldPrevent ? `${scrollbarWidth}px` : '';\n }\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({type: Boolean}) open = false;\n\n /**\n * Setting fullscreen displays the dialog fullscreen on small screens.\n * This can be customized via the `fullscreenBreakpoint` property.\n * When showing fullscreen, the header will take up less vertical space, and\n * the dialog will have a `showing-fullscreen`attribute, allowing content to\n * be styled in this state.\n *\n * Dialogs can be sized by setting:\n *\n * * --md-dialog-container-min-block-size\n * * --md-dialog-container-max-block-size\n * * --md-dialog-container-min-inline-size\n * * --md-dialog-container-max-inline-size\n *\n * These are typically configured via media queries and are independent of the\n * fullscreen setting.\n */\n @property({type: Boolean}) fullscreen = false;\n\n /**\n * A media query string specifying the breakpoint at which the dialog\n * should be shown fullscreen. Note, this only applies when the `fullscreen`\n * property is set.\n *\n * By default, the dialog is shown fullscreen on screens less than 600px wide\n * or 400px tall.\n */\n @property() fullscreenBreakpoint = '(max-width: 600px), (max-height: 400px)';\n\n /**\n * Hides the dialog footer, making any content slotted into the footer\n * inaccessible.\n */\n @property({type: Boolean}) footerHidden = false;\n\n /**\n * Renders footer content in a vertically stacked alignment rather than the\n * normal horizontal alignment.\n */\n @property({type: Boolean}) stacked = false;\n\n /**\n * When the dialog is closed it disptaches `closing` and `closed` events.\n * These events have an action property which has a default value of\n * the value of this property. Specific actions have explicit values but when\n * a value is not specified, the default is used. For example, clicking the\n * scrim, pressing escape, or clicking a button with an action attribute set\n * produce an explicit action.\n *\n * Defaults to `close`.\n */\n @property() defaultAction = CLOSE_ACTION;\n\n /**\n * The name of an attribute which can be placed on any element slotted into\n * the dialog. If an element has an action attribute set, clicking it will\n * close the dialog and the `closing` and `closed` events dispatched will\n * have their action property set the the value of this attribute on the\n * clicked element.The default valus is `dialogAction`. For example,\n *\n * <md-dialog>\n * Content\n * <md-filled-button slot=\"footer\"dialogAction=\"buy\">\n * Buy\n * </md-filled-button>\n * </md-dialog>\n */\n @property() actionAttribute = 'dialogAction';\n\n /**\n * When the dialog is opened, it will focus the first element which has\n * an attribute name matching this property. The default value is\n * `dialogFocus`. For example:\n *\n * <md-dialog>\n * <md-filled-text-field\n * label=\"Enter some text\"\n * dialogFocus\n * >\n * </md-filled-text-field>\n * </md-dialog>\n */\n @property() focusAttribute = 'dialogFocus';\n\n /**\n * Clicking on the scrim surrounding the dialog closes the dialog.\n * The `closing` and `closed` events this produces have an `action` property\n * which is the value of this property and defaults to `close`.\n */\n @property() scrimClickAction = CLOSE_ACTION;\n\n /**\n * Pressing the `escape` key while the dialog is open closes the dialog.\n * The `closing` and `closed` events this produces have an `action` property\n * which is the value of this property and defaults to `close`.\n */\n @property() escapeKeyAction = CLOSE_ACTION;\n\n /**\n * When opened, the dialog is displayed modeless or non-modal. This\n * allows users to interact with content outside the dialog without\n * closing the dialog and does not display the scrim around the dialog.\n */\n @property({type: Boolean, reflect: true}) modeless = false;\n\n /**\n * Set to make the dialog position draggable.\n */\n @property({type: Boolean}) override draggable = false;\n\n private readonly throttle = createThrottle();\n\n @query('.dialog', true)\n private readonly dialogElement!: HTMLDialogElement|null;\n\n // slots tracked to find focusable elements.\n @query('slot[name=footer]', true)\n private readonly footerSlot!: HTMLSlotElement;\n @query('slot:not([name])', true)\n private readonly contentSlot!: HTMLSlotElement;\n // for scrolling related styling\n @query(`.content`, true)\n private readonly contentElement!: HTMLDivElement|null;\n // used to determine container size for dragging\n @query(`.container`, true)\n private readonly containerElement!: HTMLDivElement|null;\n // used to determin where users can drag from.\n @query(`.header`, true) private readonly headerElement!: HTMLDivElement|null;\n\n /**\n * Private properties that reflect for styling manually in `updated`.\n */\n @state() private showingFullscreen = false;\n @state() private showingOpen = false;\n @state() private opening = false;\n @state() private closing = false;\n\n /**\n * Transition kind. Supported options include: grow, shrink, grow-down,\n * grow-up, grow-left, and grow-right.\n *\n * Defaults to grow-down.\n */\n @property({reflect: true}) transition = 'grow-down';\n\n private currentAction: string|undefined;\n\n @state() private dragging = false;\n private readonly dragMargin = 8;\n private dragInfo?: [number, number, number, number]|undefined;\n\n /**\n * Opens and shows the dialog. This is equivalent to setting the `open`\n * property to true.\n */\n show() {\n this.open = true;\n }\n\n /**\n * Closes the dialog. This is equivalent to setting the `open`\n * property to false.\n */\n close(action = '') {\n this.currentAction = action;\n this.open = false;\n }\n\n /**\n * Opens and shows the dialog if it is closed; otherwise closes it.\n */\n toggleShow() {\n if (this.open) {\n this.close(this.currentAction);\n } else {\n this.show();\n }\n }\n\n private getContentScrollInfo() {\n if (!this.hasUpdated || !this.contentElement) {\n return {isScrollable: false, isAtScrollTop: true, isAtScrollBottom: true};\n }\n const {scrollTop, scrollHeight, offsetHeight, clientHeight} =\n this.contentElement;\n return {\n isScrollable: scrollHeight > offsetHeight,\n isAtScrollTop: scrollTop === 0,\n isAtScrollBottom:\n Math.abs(Math.round(scrollHeight - scrollTop) - clientHeight) <= 2\n };\n }\n\n protected override render() {\n const {isScrollable, isAtScrollTop, isAtScrollBottom} =\n this.getContentScrollInfo();\n return html`\n <dialog\n @close=${this.handleDialogDismiss}\n @cancel=${this.handleDialogDismiss}\n @click=${this.handleDialogClick}\n class=\"dialog ${classMap({\n 'stacked': this.stacked,\n 'scrollable': isScrollable,\n 'scroll-divider-header': !isAtScrollTop,\n 'scroll-divider-footer': !isAtScrollBottom,\n 'footerHidden': this.footerHidden\n })}\"\n aria-labelledby=\"header\"\n aria-describedby=\"content\"\n >\n <div class=\"container ${classMap({\n 'dragging': this.dragging\n })}\"\n @pointermove=${this.handlePointerMove}\n @pointerup=${this.handleDragEnd}\n >\n <md-elevation></md-elevation>\n <header class=\"header\">\n <slot name=\"header\">\n <slot name=\"headline-prefix\"></slot>\n <slot name=\"headline\"></slot>\n <slot name=\"headline-suffix\"></slot>\n </slot>\n </header>\n <section class=\"content\" @scroll=${this.handleContentScroll}>\n <slot></slot>\n </section>\n <footer class=\"footer\">\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n </dialog>`;\n }\n\n protected override willUpdate(changed: PropertyValues) {\n if (changed.has('open')) {\n this.opening = this.open;\n // only closing if was opened previously...\n this.closing = !this.open && changed.get('open');\n }\n if (changed.has('fullscreen') || changed.has('fullscreenBreakpoint')) {\n this.updateFullscreen();\n }\n }\n\n protected override firstUpdated() {\n // Update when content size changes to show/hide scroll dividers.\n new ResizeObserver(() => {\n if (this.showingOpen) {\n this.requestUpdate();\n }\n }).observe(this.contentElement!);\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.get('draggable') && !this.draggable) {\n this.style.removeProperty('--_container-drag-inline-start');\n this.style.removeProperty('--_container-drag-block-start');\n }\n // Reflect internal state to facilitate styling.\n this.reflectStateProp(changed, 'opening', this.opening);\n this.reflectStateProp(changed, 'closing', this.closing);\n this.reflectStateProp(\n changed, 'showingFullscreen', this.showingFullscreen,\n 'showing-fullscreen');\n this.reflectStateProp(\n changed, 'showingOpen', this.showingOpen, 'showing-open');\n if (!changed.has('open')) {\n return;\n }\n // prevent body scrolling early only when opening to avoid layout\n // shift when closing.\n if (!this.modeless && this.open) {\n Dialog.setDocumentScrollingDisabled(this.open);\n }\n if (this.open) {\n this.contentElement!.scrollTop = 0;\n if (this.modeless) {\n this.dialogElement!.show();\n } else {\n // Note, native focus handling fails when focused element is in an\n // overflow: auto container.\n this.dialogElement!.showModal();\n }\n }\n // Avoids dispatching initial state.\n const shouldDispatchAction = changed.get('open') !== undefined;\n this.performTransition(shouldDispatchAction);\n }\n\n /**\n * Internal state is reflected here as attributes to effect styling. This\n * could be done via internal classes, but it's published on the host\n * to facilitate the (currently undocumented) possibility of customizing\n * styling of user content based on these states.\n * Note, in the future this could be done with `:state(...)` when browser\n * support improves.\n */\n private reflectStateProp(\n changed: PropertyValues, key: string, value: unknown,\n attribute?: string) {\n attribute ??= key;\n if (!changed.has(key)) {\n return;\n }\n if (value) {\n this.setAttribute(attribute, '');\n } else {\n this.removeAttribute(attribute);\n }\n }\n\n private dialogClosedResolver?: () => void;\n\n private async performTransition(shouldDispatchAction: boolean) {\n // TODO: pause here only to avoid a double update warning.\n await this.updateComplete;\n this.showingOpen = this.open;\n if (shouldDispatchAction) {\n this.dispatchActionEvent(this.open ? 'opening' : 'closing');\n }\n // Compute desired transition duration.\n const duration = msFromTimeCSSValue(getComputedStyle(this).getPropertyValue(\n this.open ? OPENING_TRANSITION_PROP : CLOSING_TRANSITION_PROP));\n let promise = this.updateComplete;\n if (duration > 0) {\n promise = new Promise((r) => {\n setTimeout(r, duration);\n });\n }\n await promise;\n this.opening = false;\n this.closing = false;\n if (!this.open && this.dialogElement?.open) {\n // Closing the dialog triggers an asynchronous `close` event.\n // It's important to wait for this event to fire since it changes the\n // state of `open` to false.\n // Without waiting, this element's `closed` event can be called before\n // the dialog's `close` event, which is problematic since the user\n // can set `open` in the `closed` event.\n // The timing of the event appears to vary via browser and does *not*\n // seem to resolve by \"task\" timing; therefore an explicit promise is\n // used.\n const closedPromise = new Promise<void>(resolve => {\n this.dialogClosedResolver = resolve;\n });\n this.dialogElement?.close(this.currentAction || this.defaultAction);\n await closedPromise;\n // enable scrolling late to avoid layout shift when closing\n if (!this.modeless) {\n Dialog.setDocumentScrollingDisabled(this.open);\n }\n }\n // Focus initial element.\n if (this.open) {\n this.focus();\n }\n if (shouldDispatchAction) {\n this.dispatchActionEvent(this.open ? 'opened' : 'closed');\n }\n this.currentAction = undefined;\n }\n\n private dispatchActionEvent(type: string) {\n const detail = {action: this.open ? 'none' : this.currentAction};\n this.dispatchEvent(new CustomEvent(type, {detail, bubbles: true}));\n }\n\n /* Live media query for matching user specified fullscreen breakpoint. */\n private fullscreenQuery?: MediaQueryList;\n private fullscreenQueryListener:\n ((e: MediaQueryListEvent) => void)|undefined = undefined;\n private updateFullscreen() {\n if (this.fullscreenQuery !== undefined) {\n this.fullscreenQuery.removeEventListener(\n 'change', this.fullscreenQueryListener!);\n this.fullscreenQuery = this.fullscreenQueryListener = undefined;\n }\n if (!this.fullscreen) {\n this.showingFullscreen = false;\n return;\n }\n this.fullscreenQuery = window.matchMedia(this.fullscreenBreakpoint);\n this.fullscreenQuery.addEventListener(\n 'change',\n (this.fullscreenQueryListener = (event: MediaQueryListEvent) => {\n this.showingFullscreen = event.matches;\n }));\n this.showingFullscreen = this.fullscreenQuery.matches;\n }\n\n // handles native close/cancel events and we just ensure\n // internal state is in sync.\n private handleDialogDismiss(e: Event) {\n if (e.type === 'cancel') {\n this.currentAction = this.escapeKeyAction;\n }\n this.dialogClosedResolver?.();\n this.dialogClosedResolver = undefined;\n this.open = false;\n this.opening = false;\n this.closing = false;\n }\n\n private handleDialogClick(e: Event) {\n if (!this.open) {\n return;\n }\n this.currentAction =\n (e.target as Element).getAttribute(this.actionAttribute) ??\n (!this.modeless && this.containerElement &&\n !e.composedPath().includes(this.containerElement) ?\n this.scrimClickAction :\n '');\n if (this.currentAction !== '') {\n this.close(this.currentAction);\n }\n }\n\n /* This allows the dividers to dynamically show based on scrolling. */\n private handleContentScroll() {\n this.throttle('scroll', () => {\n this.requestUpdate();\n });\n }\n\n private getFocusElement(): HTMLElement|null {\n const selector = `[${this.focusAttribute}]`;\n const slotted = [this.footerSlot, this.contentSlot].flatMap(\n slot => slot.assignedElements({flatten: true}));\n for (const el of slotted) {\n const focusEl = el.matches(selector) ? el : el.querySelector(selector);\n if (focusEl) {\n return focusEl as HTMLElement;\n }\n }\n return null;\n }\n\n override focus() {\n this.getFocusElement()?.focus();\n }\n\n override blur() {\n this.getFocusElement()?.blur();\n }\n\n private canStartDrag(e: PointerEvent) {\n if (this.draggable === false || e.defaultPrevented || !(e.buttons & 1) ||\n !this.headerElement || !e.composedPath().includes(this.headerElement)) {\n return false;\n }\n return true;\n }\n\n private handlePointerMove(e: PointerEvent) {\n if (!this.dragging && !this.canStartDrag(e) || !this.containerElement) {\n return;\n }\n const {top, left, height, width} =\n this.containerElement.getBoundingClientRect();\n if (!this.dragging) {\n this.containerElement.setPointerCapture(e.pointerId);\n this.dragging = true;\n const {x, y} = e;\n this.dragInfo = [x, y, top, left];\n }\n const [sx, sy, st, sl] = this.dragInfo ?? [0, 0, 0, 0];\n const dx = e.x - sx;\n const dy = e.y - sy;\n const ml = window.innerWidth - width - this.dragMargin;\n const mt = window.innerHeight - height - this.dragMargin;\n const l = Math.max(this.dragMargin, Math.min(ml, dx + sl));\n const t = Math.max(this.dragMargin, Math.min(mt, dy + st));\n this.style.setProperty('--_container-drag-inline-start', `${l}px`);\n this.style.setProperty('--_container-drag-block-start', `${t}px`);\n }\n\n private handleDragEnd(e: PointerEvent) {\n if (!this.dragging) {\n return;\n }\n this.containerElement?.releasePointerCapture(e.pointerId);\n this.dragging = false;\n this.dragInfo = undefined;\n }\n}\n"]}
@@ -8,5 +8,5 @@ import { LitElement } from 'lit';
8
8
  * A component for elevation.
9
9
  */
10
10
  export declare class Elevation extends LitElement {
11
- render(): import("lit-html").TemplateResult<1>;
11
+ protected render(): import("lit-html").TemplateResult<1>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"elevation.js","sourceRoot":"","sources":["elevation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAC9B,MAAM;QACb,OAAO,IAAI,CAAA,8BAA8B,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement} from 'lit';\n\n/**\n * A component for elevation.\n */\nexport class Elevation extends LitElement {\n override render() {\n return html`<span class=\"shadow\"></span>`;\n }\n}\n"]}
1
+ {"version":3,"file":"elevation.js","sourceRoot":"","sources":["elevation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IACpB,MAAM;QACvB,OAAO,IAAI,CAAA,8BAA8B,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement} from 'lit';\n\n/**\n * A component for elevation.\n */\nexport class Elevation extends LitElement {\n protected override render() {\n return html`<span class=\"shadow\"></span>`;\n }\n}\n"]}
@@ -48,6 +48,9 @@ export declare class MdBrandedFab extends Fab {
48
48
  secondary: boolean;
49
49
  tertiary: boolean;
50
50
  small: boolean;
51
+ lowered: boolean;
52
+ large: boolean;
53
+ extended: boolean;
51
54
  };
52
55
  static styles: import("lit").CSSResult[];
53
56
  }
@@ -4,15 +4,35 @@
4
4
  //
5
5
 
6
6
  // go/keep-sorted start
7
- @use '../../sass/theme';
7
+ @use 'sass:list';
8
+ // go/keep-sorted end
9
+ // go/keep-sorted start
8
10
  @use '../../tokens';
9
11
  // go/keep-sorted end
10
12
 
11
13
  @mixin theme($tokens) {
12
- $tokens: theme.validate-theme(tokens.md-comp-fab-branded-values(), $tokens);
14
+ $supported-tokens: list.join(
15
+ tokens.$md-comp-fab-branded-supported-tokens,
16
+ (
17
+ 'container-shape-start-start',
18
+ 'container-shape-start-end',
19
+ 'container-shape-end-end',
20
+ 'container-shape-end-start',
21
+ 'large-container-shape-start-start',
22
+ 'large-container-shape-start-end',
23
+ 'large-container-shape-end-end',
24
+ 'large-container-shape-end-start'
25
+ )
26
+ );
13
27
 
14
28
  @each $token, $value in $tokens {
15
- --md-fab-branded-#{$token}: #{$value};
29
+ @if list.index($supported-tokens, $token) == null {
30
+ @error 'Token `#{$token}` is not a supported token.';
31
+ }
32
+
33
+ @if $value {
34
+ --md-fab-branded-#{$token}: #{$value};
35
+ }
16
36
  }
17
37
  }
18
38
 
@@ -21,7 +41,41 @@
21
41
 
22
42
  :host {
23
43
  @each $token, $value in $tokens {
24
- --_#{$token}: #{$value};
44
+ --_#{$token}: var(--md-fab-branded-#{$token}, #{$value});
25
45
  }
46
+
47
+ // Support logical shape properties
48
+ --_container-shape-start-start: var(
49
+ --md-fab-branded-container-shape-start-start,
50
+ var(--_container-shape)
51
+ );
52
+ --_container-shape-start-end: var(
53
+ --md-fab-branded-container-shape-start-end,
54
+ var(--_container-shape)
55
+ );
56
+ --_container-shape-end-end: var(
57
+ --md-fab-branded-container-shape-end-end,
58
+ var(--_container-shape)
59
+ );
60
+ --_container-shape-end-start: var(
61
+ --md-fab-branded-container-shape-end-start,
62
+ var(--_container-shape)
63
+ );
64
+ --_large-container-shape-start-start: var(
65
+ --md-fab-branded-large-container-shape-start-start,
66
+ var(--_large-container-shape)
67
+ );
68
+ --_large-container-shape-start-end: var(
69
+ --md-fab-branded-large-container-shape-start-end,
70
+ var(--_large-container-shape)
71
+ );
72
+ --_large-container-shape-end-end: var(
73
+ --md-fab-branded-large-container-shape-end-end,
74
+ var(--_large-container-shape)
75
+ );
76
+ --_large-container-shape-end-start: var(
77
+ --md-fab-branded-large-container-shape-end-start,
78
+ var(--_large-container-shape)
79
+ );
26
80
  }
27
81
  }